aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/actbl.h1
-rw-r--r--include/asm-alpha/mmu_context.h1
-rw-r--r--include/asm-alpha/percpu.h14
-rw-r--r--include/asm-alpha/scatterlist.h1
-rw-r--r--include/asm-alpha/socket.h2
-rw-r--r--include/asm-alpha/sockios.h3
-rw-r--r--include/asm-alpha/string.h2
-rw-r--r--include/asm-arm/arch-imx/mmc.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/dma.h1
-rw-r--r--include/asm-arm/arch-pxa/mmc.h2
-rw-r--r--include/asm-arm/arch-pxa/pxa27x_keyboard.h13
-rw-r--r--include/asm-arm/div64.h3
-rw-r--r--include/asm-arm/mach/mmc.h2
-rw-r--r--include/asm-arm/mmu_context.h1
-rw-r--r--include/asm-arm/socket.h2
-rw-r--r--include/asm-arm/sockios.h3
-rw-r--r--include/asm-arm26/mmu_context.h2
-rw-r--r--include/asm-arm26/socket.h2
-rw-r--r--include/asm-arm26/sockios.h3
-rw-r--r--include/asm-avr32/arch-at32ap/io.h39
-rw-r--r--include/asm-avr32/arch-at32ap/smc.h22
-rw-r--r--include/asm-avr32/arch-at32ap/time.h112
-rw-r--r--include/asm-avr32/atomic.h2
-rw-r--r--include/asm-avr32/bug.h50
-rw-r--r--include/asm-avr32/io.h326
-rw-r--r--include/asm-avr32/mmu_context.h1
-rw-r--r--include/asm-avr32/processor.h15
-rw-r--r--include/asm-avr32/scatterlist.h2
-rw-r--r--include/asm-avr32/setup.h13
-rw-r--r--include/asm-avr32/socket.h2
-rw-r--r--include/asm-avr32/sockios.h3
-rw-r--r--include/asm-avr32/sysreg.h543
-rw-r--r--include/asm-avr32/system.h13
-rw-r--r--include/asm-avr32/thread_info.h2
-rw-r--r--include/asm-avr32/uaccess.h13
-rw-r--r--include/asm-cris/mmu_context.h2
-rw-r--r--include/asm-cris/socket.h2
-rw-r--r--include/asm-cris/sockios.h3
-rw-r--r--include/asm-frv/mmu_context.h1
-rw-r--r--include/asm-frv/scatterlist.h2
-rw-r--r--include/asm-frv/socket.h2
-rw-r--r--include/asm-frv/sockios.h3
-rw-r--r--include/asm-generic/div64.h7
-rw-r--r--include/asm-generic/mm_hooks.h18
-rw-r--r--include/asm-generic/percpu.h1
-rw-r--r--include/asm-generic/pgtable.h11
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/asm-h8300/mmu_context.h1
-rw-r--r--include/asm-h8300/scatterlist.h2
-rw-r--r--include/asm-h8300/socket.h2
-rw-r--r--include/asm-h8300/sockios.h3
-rw-r--r--include/asm-i386/Kbuild2
-rw-r--r--include/asm-i386/agp.h6
-rw-r--r--include/asm-i386/alternative.h34
-rw-r--r--include/asm-i386/apic.h9
-rw-r--r--include/asm-i386/bugs.h194
-rw-r--r--include/asm-i386/cpufeature.h13
-rw-r--r--include/asm-i386/current.h5
-rw-r--r--include/asm-i386/desc.h95
-rw-r--r--include/asm-i386/div64.h4
-rw-r--r--include/asm-i386/e820.h1
-rw-r--r--include/asm-i386/elf.h28
-rw-r--r--include/asm-i386/fixmap.h11
-rw-r--r--include/asm-i386/genapic.h6
-rw-r--r--include/asm-i386/highmem.h6
-rw-r--r--include/asm-i386/hpet.h2
-rw-r--r--include/asm-i386/i387.h17
-rw-r--r--include/asm-i386/io.h15
-rw-r--r--include/asm-i386/irq.h2
-rw-r--r--include/asm-i386/irq_regs.h12
-rw-r--r--include/asm-i386/irqflags.h64
-rw-r--r--include/asm-i386/kexec.h8
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apic.h2
-rw-r--r--include/asm-i386/mach-default/mach_apic.h2
-rw-r--r--include/asm-i386/mach-es7000/mach_apic.h9
-rw-r--r--include/asm-i386/mach-es7000/mach_mpparse.h32
-rw-r--r--include/asm-i386/mach-generic/mach_apic.h2
-rw-r--r--include/asm-i386/mach-numaq/mach_apic.h2
-rw-r--r--include/asm-i386/mach-summit/mach_apic.h2
-rw-r--r--include/asm-i386/mach-summit/mach_mpparse.h4
-rw-r--r--include/asm-i386/mach-visws/mach_apic.h2
-rw-r--r--include/asm-i386/mmu_context.h17
-rw-r--r--include/asm-i386/module.h2
-rw-r--r--include/asm-i386/msr-index.h278
-rw-r--r--include/asm-i386/msr.h400
-rw-r--r--include/asm-i386/mtrr.h4
-rw-r--r--include/asm-i386/nmi.h8
-rw-r--r--include/asm-i386/page.h81
-rw-r--r--include/asm-i386/paravirt.h957
-rw-r--r--include/asm-i386/pda.h100
-rw-r--r--include/asm-i386/percpu.h136
-rw-r--r--include/asm-i386/pgalloc.h1
-rw-r--r--include/asm-i386/pgtable-2level-defs.h2
-rw-r--r--include/asm-i386/pgtable-2level.h37
-rw-r--r--include/asm-i386/pgtable-3level-defs.h6
-rw-r--r--include/asm-i386/pgtable-3level.h69
-rw-r--r--include/asm-i386/pgtable.h62
-rw-r--r--include/asm-i386/processor-flags.h91
-rw-r--r--include/asm-i386/processor.h187
-rw-r--r--include/asm-i386/reboot.h20
-rw-r--r--include/asm-i386/reboot_fixups.h (renamed from include/linux/reboot_fixups.h)4
-rw-r--r--include/asm-i386/required-features.h34
-rw-r--r--include/asm-i386/scatterlist.h2
-rw-r--r--include/asm-i386/segment.h10
-rw-r--r--include/asm-i386/smp.h64
-rw-r--r--include/asm-i386/socket.h2
-rw-r--r--include/asm-i386/sockios.h3
-rw-r--r--include/asm-i386/system.h139
-rw-r--r--include/asm-i386/timer.h2
-rw-r--r--include/asm-i386/tlbflush.h19
-rw-r--r--include/asm-i386/tsc.h15
-rw-r--r--include/asm-i386/uaccess.h14
-rw-r--r--include/asm-i386/vmi_time.h18
-rw-r--r--include/asm-i386/voyager.h6
-rw-r--r--include/asm-ia64/mmu_context.h1
-rw-r--r--include/asm-ia64/scatterlist.h2
-rw-r--r--include/asm-ia64/socket.h2
-rw-r--r--include/asm-ia64/sockios.h3
-rw-r--r--include/asm-m32r/mmu_context.h1
-rw-r--r--include/asm-m32r/scatterlist.h2
-rw-r--r--include/asm-m32r/socket.h2
-rw-r--r--include/asm-m32r/sockios.h3
-rw-r--r--include/asm-m68k/adb.h75
-rw-r--r--include/asm-m68k/atarikb.h6
-rw-r--r--include/asm-m68k/div64.h3
-rw-r--r--include/asm-m68k/mmu_context.h1
-rw-r--r--include/asm-m68k/socket.h2
-rw-r--r--include/asm-m68k/sockios.h3
-rw-r--r--include/asm-m68knommu/mmu_context.h1
-rw-r--r--include/asm-m68knommu/scatterlist.h1
-rw-r--r--include/asm-mips/bug.h3
-rw-r--r--include/asm-mips/cacheflush.h2
-rw-r--r--include/asm-mips/checksum.h2
-rw-r--r--include/asm-mips/div64.h11
-rw-r--r--include/asm-mips/fpu.h25
-rw-r--r--include/asm-mips/jmr3927/irq.h57
-rw-r--r--include/asm-mips/jmr3927/jmr3927.h130
-rw-r--r--include/asm-mips/jmr3927/tx3927.h8
-rw-r--r--include/asm-mips/jmr3927/txx927.h5
-rw-r--r--include/asm-mips/mmu_context.h1
-rw-r--r--include/asm-mips/paccess.h2
-rw-r--r--include/asm-mips/scatterlist.h2
-rw-r--r--include/asm-mips/sgi/hpc3.h2
-rw-r--r--include/asm-mips/sgi/ip22.h2
-rw-r--r--include/asm-mips/sgi/mc.h2
-rw-r--r--include/asm-mips/sibyte/bcm1480_int.h2
-rw-r--r--include/asm-mips/sibyte/bcm1480_mc.h32
-rw-r--r--include/asm-mips/sibyte/bcm1480_regs.h20
-rw-r--r--include/asm-mips/sibyte/bcm1480_scd.h94
-rw-r--r--include/asm-mips/sibyte/board.h14
-rw-r--r--include/asm-mips/sibyte/carmel.h1
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h5
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h24
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h2
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h46
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h31
-rw-r--r--include/asm-mips/sibyte/swarm.h12
-rw-r--r--include/asm-mips/socket.h2
-rw-r--r--include/asm-mips/sockios.h3
-rw-r--r--include/asm-mips/thread_info.h1
-rw-r--r--include/asm-parisc/mmu_context.h1
-rw-r--r--include/asm-parisc/scatterlist.h1
-rw-r--r--include/asm-parisc/socket.h2
-rw-r--r--include/asm-parisc/sockios.h3
-rw-r--r--include/asm-powerpc/asm-compat.h10
-rw-r--r--include/asm-powerpc/cacheflush.h6
-rw-r--r--include/asm-powerpc/cell-pmu.h5
-rw-r--r--include/asm-powerpc/cputable.h11
-rw-r--r--include/asm-powerpc/current.h1
-rw-r--r--include/asm-powerpc/edac.h40
-rw-r--r--include/asm-powerpc/eeh_event.h6
-rw-r--r--include/asm-powerpc/ibmebus.h44
-rw-r--r--include/asm-powerpc/immap_86xx.h75
-rw-r--r--include/asm-powerpc/io.h7
-rw-r--r--include/asm-powerpc/kprobes.h5
-rw-r--r--include/asm-powerpc/machdep.h3
-rw-r--r--include/asm-powerpc/mmu-hash64.h400
-rw-r--r--include/asm-powerpc/mmu.h405
-rw-r--r--include/asm-powerpc/mmu_context.h1
-rw-r--r--include/asm-powerpc/mpic.h12
-rw-r--r--include/asm-powerpc/of_device.h3
-rw-r--r--include/asm-powerpc/oprofile_impl.h2
-rw-r--r--include/asm-powerpc/paca.h4
-rw-r--r--include/asm-powerpc/parport.h6
-rw-r--r--include/asm-powerpc/pci.h14
-rw-r--r--include/asm-powerpc/pgtable-4k.h3
-rw-r--r--include/asm-powerpc/pgtable-64k.h5
-rw-r--r--include/asm-powerpc/pgtable.h60
-rw-r--r--include/asm-powerpc/pmc.h1
-rw-r--r--include/asm-powerpc/ppc-pci.h12
-rw-r--r--include/asm-powerpc/processor.h1
-rw-r--r--include/asm-powerpc/prom.h34
-rw-r--r--include/asm-powerpc/ps3av.h22
-rw-r--r--include/asm-powerpc/reg.h68
-rw-r--r--include/asm-powerpc/socket.h2
-rw-r--r--include/asm-powerpc/sockios.h3
-rw-r--r--include/asm-powerpc/spu_csa.h1
-rw-r--r--include/asm-powerpc/string.h2
-rw-r--r--include/asm-powerpc/system.h1
-rw-r--r--include/asm-powerpc/tlb.h1
-rw-r--r--include/asm-powerpc/tlbflush.h172
-rw-r--r--include/asm-powerpc/uaccess.h28
-rw-r--r--include/asm-powerpc/ucc_fast.h3
-rw-r--r--include/asm-powerpc/uic.h23
-rw-r--r--include/asm-ppc/ibm4xx.h8
-rw-r--r--include/asm-ppc/mmu_context.h1
-rw-r--r--include/asm-ppc/ppc_sys.h2
-rw-r--r--include/asm-ppc/prom.h3
-rw-r--r--include/asm-s390/bug.h69
-rw-r--r--include/asm-s390/ccwdev.h6
-rw-r--r--include/asm-s390/ccwgroup.h1
-rw-r--r--include/asm-s390/chpid.h53
-rw-r--r--include/asm-s390/cio.h8
-rw-r--r--include/asm-s390/elf.h7
-rw-r--r--include/asm-s390/ipl.h35
-rw-r--r--include/asm-s390/kdebug.h18
-rw-r--r--include/asm-s390/kprobes.h16
-rw-r--r--include/asm-s390/lowcore.h56
-rw-r--r--include/asm-s390/mmu_context.h2
-rw-r--r--include/asm-s390/pgtable.h15
-rw-r--r--include/asm-s390/processor.h2
-rw-r--r--include/asm-s390/sclp.h14
-rw-r--r--include/asm-s390/setup.h2
-rw-r--r--include/asm-s390/smp.h6
-rw-r--r--include/asm-s390/socket.h2
-rw-r--r--include/asm-s390/sockios.h3
-rw-r--r--include/asm-sh/mmu_context.h1
-rw-r--r--include/asm-sh/scatterlist.h2
-rw-r--r--include/asm-sh/socket.h2
-rw-r--r--include/asm-sh/sockios.h3
-rw-r--r--include/asm-sh/string.h3
-rw-r--r--include/asm-sh64/mmu_context.h2
-rw-r--r--include/asm-sh64/scatterlist.h2
-rw-r--r--include/asm-sh64/sockios.h3
-rw-r--r--include/asm-sparc/mmu_context.h2
-rw-r--r--include/asm-sparc/prom.h14
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc/sockios.h3
-rw-r--r--include/asm-sparc64/cpudata.h4
-rw-r--r--include/asm-sparc64/device.h18
-rw-r--r--include/asm-sparc64/ebus.h2
-rw-r--r--include/asm-sparc64/floppy.h4
-rw-r--r--include/asm-sparc64/io.h8
-rw-r--r--include/asm-sparc64/iommu.h51
-rw-r--r--include/asm-sparc64/isa.h2
-rw-r--r--include/asm-sparc64/mmu_context.h1
-rw-r--r--include/asm-sparc64/parport.h2
-rw-r--r--include/asm-sparc64/pbm.h132
-rw-r--r--include/asm-sparc64/pci.h2
-rw-r--r--include/asm-sparc64/percpu.h10
-rw-r--r--include/asm-sparc64/pgtable.h16
-rw-r--r--include/asm-sparc64/prom.h12
-rw-r--r--include/asm-sparc64/scatterlist.h1
-rw-r--r--include/asm-sparc64/smp.h4
-rw-r--r--include/asm-sparc64/socket.h2
-rw-r--r--include/asm-sparc64/sockios.h3
-rw-r--r--include/asm-sparc64/sparsemem.h2
-rw-r--r--include/asm-sparc64/timer.h17
-rw-r--r--include/asm-sparc64/ttable.h27
-rw-r--r--include/asm-um/div64.h1
-rw-r--r--include/asm-um/mmu_context.h2
-rw-r--r--include/asm-v850/mmu_context.h2
-rw-r--r--include/asm-v850/scatterlist.h2
-rw-r--r--include/asm-v850/socket.h2
-rw-r--r--include/asm-v850/sockios.h3
-rw-r--r--include/asm-x86_64/Kbuild4
-rw-r--r--include/asm-x86_64/agp.h6
-rw-r--r--include/asm-x86_64/alternative.h5
-rw-r--r--include/asm-x86_64/apic.h10
-rw-r--r--include/asm-x86_64/bugs.h30
-rw-r--r--include/asm-x86_64/const.h20
-rw-r--r--include/asm-x86_64/desc.h21
-rw-r--r--include/asm-x86_64/dma-mapping.h2
-rw-r--r--include/asm-x86_64/fixmap.h1
-rw-r--r--include/asm-x86_64/genapic.h4
-rw-r--r--include/asm-x86_64/ipi.h61
-rw-r--r--include/asm-x86_64/irqflags.h9
-rw-r--r--include/asm-x86_64/mmu_context.h1
-rw-r--r--include/asm-x86_64/mmzone.h2
-rw-r--r--include/asm-x86_64/msr-index.h1
-rw-r--r--include/asm-x86_64/msr.h274
-rw-r--r--include/asm-x86_64/mtrr.h12
-rw-r--r--include/asm-x86_64/nmi.h9
-rw-r--r--include/asm-x86_64/page.h39
-rw-r--r--include/asm-x86_64/percpu.h10
-rw-r--r--include/asm-x86_64/pgalloc.h15
-rw-r--r--include/asm-x86_64/pgtable.h42
-rw-r--r--include/asm-x86_64/processor-flags.h1
-rw-r--r--include/asm-x86_64/processor.h55
-rw-r--r--include/asm-x86_64/proto.h15
-rw-r--r--include/asm-x86_64/scatterlist.h2
-rw-r--r--include/asm-x86_64/segment.h2
-rw-r--r--include/asm-x86_64/smp.h4
-rw-r--r--include/asm-x86_64/socket.h2
-rw-r--r--include/asm-x86_64/sockios.h3
-rw-r--r--include/asm-x86_64/suspend.h13
-rw-r--r--include/asm-x86_64/system.h7
-rw-r--r--include/asm-x86_64/timex.h2
-rw-r--r--include/asm-x86_64/tlbflush.h33
-rw-r--r--include/asm-x86_64/unistd.h3
-rw-r--r--include/asm-xtensa/div64.h6
-rw-r--r--include/asm-xtensa/mmu_context.h1
-rw-r--r--include/asm-xtensa/scatterlist.h2
-rw-r--r--include/asm-xtensa/socket.h2
-rw-r--r--include/asm-xtensa/sockios.h3
-rw-r--r--include/crypto/algapi.h84
-rw-r--r--include/keys/rxrpc-type.h22
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/ata.h10
-rw-r--r--include/linux/atalk.h4
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/cpufreq.h20
-rw-r--r--include/linux/crash_dump.h8
-rw-r--r--include/linux/crypto.h236
-rw-r--r--include/linux/dccp.h46
-rw-r--r--include/linux/debugfs.h9
-rw-r--r--include/linux/device.h76
-rw-r--r--include/linux/dvb/audio.h5
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/dvb/video.h62
-rw-r--r--include/linux/elf.h17
-rw-r--r--include/linux/elfnote.h4
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fib_rules.h15
-rw-r--r--include/linux/fs.h11
-rw-r--r--include/linux/fsl_devices.h39
-rw-r--r--include/linux/gpio_keys.h3
-rw-r--r--include/linux/hdlc.h7
-rw-r--r--include/linux/hid.h14
-rw-r--r--include/linux/highmem.h15
-rw-r--r--include/linux/hp_sdc.h1
-rw-r--r--include/linux/i2c-algo-bit.h7
-rw-r--r--include/linux/i2c-gpio.h38
-rw-r--r--include/linux/i2c-id.h3
-rw-r--r--include/linux/i2c.h123
-rw-r--r--include/linux/icmp.h9
-rw-r--r--include/linux/icmpv6.h9
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/ieee80211.h342
-rw-r--r--include/linux/if_addr.h1
-rw-r--r--include/linux/if_arp.h9
-rw-r--r--include/linux/if_bridge.h3
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_packet.h1
-rw-r--r--include/linux/if_pppox.h10
-rw-r--r--include/linux/if_tr.h2
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/if_wanpipe_common.h58
-rw-r--r--include/linux/igmp.h21
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h3
-rw-r--r--include/linux/init.h7
-rw-r--r--include/linux/input-polldev.h46
-rw-r--r--include/linux/input.h53
-rw-r--r--include/linux/interrupt.h6
-rw-r--r--include/linux/ioport.h1
-rw-r--r--include/linux/ip.h14
-rw-r--r--include/linux/ipv6.h17
-rw-r--r--include/linux/jhash.h2
-rw-r--r--include/linux/kallsyms.h13
-rw-r--r--include/linux/kernel.h1
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/kobject.h70
-rw-r--r--include/linux/ktime.h6
-rw-r--r--include/linux/libata.h78
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/mmc/card.h32
-rw-r--r--include/linux/mmc/core.h112
-rw-r--r--include/linux/mmc/host.h59
-rw-r--r--include/linux/mmc/mmc.h322
-rw-r--r--include/linux/mmc/protocol.h327
-rw-r--r--include/linux/mmc/sd.h83
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/msi.h11
-rw-r--r--include/linux/mtd/iflash.h98
-rw-r--r--include/linux/mtd/mtd.h1
-rw-r--r--include/linux/mtd/nand.h1
-rw-r--r--include/linux/mtd/ubi.h202
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h43
-rw-r--r--include/linux/netfilter.h12
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h18
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h5
-rw-r--r--include/linux/netfilter/nfnetlink.h19
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h4
-rw-r--r--include/linux/netfilter_bridge.h20
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h4
-rw-r--r--include/linux/netfilter_ipv4/Kbuild14
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h402
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_amanda.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h61
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h44
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h89
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h46
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_icmp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_irc.h32
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h326
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h114
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_protocol.h98
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sctp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h40
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tcp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tftp.h20
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h146
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h79
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h18
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_helper.h33
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h74
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_rule.h28
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h2
-rw-r--r--include/linux/netlink.h37
-rw-r--r--include/linux/nfs_fs.h4
-rw-r--r--include/linux/nfs_mount.h1
-rw-r--r--include/linux/nfs_page.h63
-rw-r--r--include/linux/nl80211.h38
-rw-r--r--include/linux/nubus.h126
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/parser.h6
-rw-r--r--include/linux/pci.h30
-rw-r--r--include/linux/pci_hotplug.h2
-rw-r--r--include/linux/pci_ids.h6
-rw-r--r--include/linux/percpu.h9
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/pm.h83
-rw-r--r--include/linux/pmu.h12
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/rtnetlink.h13
-rw-r--r--include/linux/rxrpc.h62
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/sctp.h9
-rw-r--r--include/linux/sdla_fr.h638
-rw-r--r--include/linux/seqlock.h8
-rw-r--r--include/linux/skbuff.h399
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/sony-laptop.h34
-rw-r--r--include/linux/string.h6
-rw-r--r--include/linux/sunrpc/clnt.h9
-rw-r--r--include/linux/sunrpc/debug.h2
-rw-r--r--include/linux/sunrpc/msg_prot.h4
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/xprt.h7
-rw-r--r--include/linux/sysctl.h5
-rw-r--r--include/linux/sysfs.h4
-rw-r--r--include/linux/taskstats.h13
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/tifm.h117
-rw-r--r--include/linux/udp.h9
-rw-r--r--include/linux/usb.h22
-rw-r--r--include/linux/usb/cdc.h11
-rw-r--r--include/linux/usb/ch9.h15
-rw-r--r--include/linux/videodev2.h83
-rw-r--r--include/linux/wireless.h2
-rw-r--r--include/linux/workqueue.h7
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xfrm.h46
-rw-r--r--include/media/cx2341x.h6
-rw-r--r--include/media/ivtv.h65
-rw-r--r--include/media/ovcamchip.h1
-rw-r--r--include/media/tuner.h6
-rw-r--r--include/media/v4l2-chip-ident.h149
-rw-r--r--include/media/v4l2-common.h47
-rw-r--r--include/media/v4l2-dev.h10
-rw-r--r--include/mtd/Kbuild2
-rw-r--r--include/mtd/mtd-abi.h1
-rw-r--r--include/mtd/ubi-header.h360
-rw-r--r--include/mtd/ubi-user.h161
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/af_rxrpc.h57
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/bluetooth/hci.h18
-rw-r--r--include/net/cfg80211.h40
-rw-r--r--include/net/cipso_ipv4.h2
-rw-r--r--include/net/compat.h1
-rw-r--r--include/net/dn_fib.h9
-rw-r--r--include/net/dn_route.h1
-rw-r--r--include/net/esp.h2
-rw-r--r--include/net/fib_rules.h20
-rw-r--r--include/net/flow.h6
-rw-r--r--include/net/ieee80211.h4
-rw-r--r--include/net/ieee80211_crypt.h4
-rw-r--r--include/net/ieee80211_radiotap.h77
-rw-r--r--include/net/inet6_hashtables.h12
-rw-r--r--include/net/inet_ecn.h8
-rw-r--r--include/net/inet_sock.h11
-rw-r--r--include/net/ip.h11
-rw-r--r--include/net/ip6_fib.h2
-rw-r--r--include/net/ip6_route.h5
-rw-r--r--include/net/ip_fib.h6
-rw-r--r--include/net/ipv6.h34
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/iucv/af_iucv.h2
-rw-r--r--include/net/iucv/iucv.h2
-rw-r--r--include/net/iw_handler.h21
-rw-r--r--include/net/llc_pdu.h15
-rw-r--r--include/net/mac80211.h1045
-rw-r--r--include/net/neighbour.h10
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h145
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h30
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h5
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h1
-rw-r--r--include/net/netfilter/nf_nat_rule.h10
-rw-r--r--include/net/netlink.h18
-rw-r--r--include/net/pkt_cls.h10
-rw-r--r--include/net/pkt_sched.h182
-rw-r--r--include/net/red.h10
-rw-r--r--include/net/rtnetlink.h25
-rw-r--r--include/net/sch_generic.h12
-rw-r--r--include/net/sctp/command.h2
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sctp/ulpevent.h1
-rw-r--r--include/net/sctp/ulpqueue.h2
-rw-r--r--include/net/sctp/user.h25
-rw-r--r--include/net/sock.h89
-rw-r--r--include/net/tcp.h200
-rw-r--r--include/net/tcp_ecn.h17
-rw-r--r--include/net/udp.h11
-rw-r--r--include/net/udplite.h45
-rw-r--r--include/net/wext.h24
-rw-r--r--include/net/wireless.h139
-rw-r--r--include/net/x25device.h2
-rw-r--r--include/net/xfrm.h32
-rw-r--r--include/rdma/ib_mad.h2
-rw-r--r--include/rxrpc/call.h212
-rw-r--r--include/rxrpc/connection.h83
-rw-r--r--include/rxrpc/krxiod.h27
-rw-r--r--include/rxrpc/krxsecd.h22
-rw-r--r--include/rxrpc/krxtimod.h45
-rw-r--r--include/rxrpc/message.h71
-rw-r--r--include/rxrpc/packet.h119
-rw-r--r--include/rxrpc/peer.h82
-rw-r--r--include/rxrpc/rxrpc.h36
-rw-r--r--include/rxrpc/transport.h106
-rw-r--r--include/scsi/iscsi_proto.h12
-rw-r--r--include/scsi/scsi.h1
-rw-r--r--include/scsi/scsi_cmnd.h3
-rw-r--r--include/scsi/scsi_dbg.h10
-rw-r--r--include/scsi/scsi_device.h14
-rw-r--r--include/scsi/scsi_host.h32
-rw-r--r--include/scsi/scsi_tgt_if.h6
-rw-r--r--include/scsi/scsi_transport_fc.h2
-rw-r--r--include/scsi/sd.h72
553 files changed, 10469 insertions, 8808 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 0d9f984a60a..16c3c441256 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -316,7 +316,7 @@ struct acpi_bus_event {
316 u32 data; 316 u32 data;
317}; 317};
318 318
319extern struct subsystem acpi_subsys; 319extern struct kset acpi_subsys;
320 320
321/* 321/*
322 * External Functions 322 * External Functions
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 09469e7db6a..955adfb8d64 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -276,6 +276,7 @@ enum acpi_prefered_pm_profiles {
276 276
277#define BAF_LEGACY_DEVICES 0x0001 277#define BAF_LEGACY_DEVICES 0x0001
278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
279#define BAF_MSI_NOT_SUPPORTED 0x0008
279 280
280#define FADT2_REVISION_ID 3 281#define FADT2_REVISION_ID 3
281#define FADT2_MINUS_REVISION_ID 2 282#define FADT2_MINUS_REVISION_ID 2
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index fe249e9d336..0bd7bd2ccb9 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -10,6 +10,7 @@
10#include <asm/system.h> 10#include <asm/system.h>
11#include <asm/machvec.h> 11#include <asm/machvec.h>
12#include <asm/compiler.h> 12#include <asm/compiler.h>
13#include <asm-generic/mm_hooks.h>
13 14
14/* 15/*
15 * Force a context reload. This is needed when we change the page 16 * Force a context reload. This is needed when we change the page
diff --git a/include/asm-alpha/percpu.h b/include/asm-alpha/percpu.h
index 651ebb141b2..48348fe34c1 100644
--- a/include/asm-alpha/percpu.h
+++ b/include/asm-alpha/percpu.h
@@ -1,20 +1,6 @@
1#ifndef __ALPHA_PERCPU_H 1#ifndef __ALPHA_PERCPU_H
2#define __ALPHA_PERCPU_H 2#define __ALPHA_PERCPU_H
3 3
4/*
5 * Increase the per cpu area for Alpha so that
6 * modules using percpu area can load.
7 */
8#ifdef CONFIG_MODULES
9# define PERCPU_MODULE_RESERVE 8192
10#else
11# define PERCPU_MODULE_RESERVE 0
12#endif
13
14#define PERCPU_ENOUGH_ROOM \
15 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
16 PERCPU_MODULE_RESERVE)
17
18#include <asm-generic/percpu.h> 4#include <asm-generic/percpu.h>
19 5
20#endif /* __ALPHA_PERCPU_H */ 6#endif /* __ALPHA_PERCPU_H */
diff --git a/include/asm-alpha/scatterlist.h b/include/asm-alpha/scatterlist.h
index 6afb8bd3aaf..917365405e8 100644
--- a/include/asm-alpha/scatterlist.h
+++ b/include/asm-alpha/scatterlist.h
@@ -2,6 +2,7 @@
2#define _ALPHA_SCATTERLIST_H 2#define _ALPHA_SCATTERLIST_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm/types.h>
5 6
6struct scatterlist { 7struct scatterlist {
7 struct page *page; 8 struct page *page;
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index d22ab97ea72..1fede7f9286 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -52,6 +52,8 @@
52 52
53#define SO_PEERSEC 30 53#define SO_PEERSEC 30
54#define SO_PASSSEC 34 54#define SO_PASSSEC 34
55#define SO_TIMESTAMPNS 35
56#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
55 57
56/* Security levels - as per NRL IPv6 - don't actually do anything */ 58/* Security levels - as per NRL IPv6 - don't actually do anything */
57#define SO_SECURITY_AUTHENTICATION 19 59#define SO_SECURITY_AUTHENTICATION 19
diff --git a/include/asm-alpha/sockios.h b/include/asm-alpha/sockios.h
index e4961a740e5..7932c7ab4a4 100644
--- a/include/asm-alpha/sockios.h
+++ b/include/asm-alpha/sockios.h
@@ -10,6 +10,7 @@
10#define SIOCSPGRP _IOW('s', 8, pid_t) 10#define SIOCSPGRP _IOW('s', 8, pid_t)
11#define SIOCGPGRP _IOR('s', 9, pid_t) 11#define SIOCGPGRP _IOR('s', 9, pid_t)
12 12
13#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 13#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
14#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
14 15
15#endif /* _ASM_ALPHA_SOCKIOS_H */ 16#endif /* _ASM_ALPHA_SOCKIOS_H */
diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h
index 9e44fea669b..b02b8a28294 100644
--- a/include/asm-alpha/string.h
+++ b/include/asm-alpha/string.h
@@ -61,8 +61,6 @@ extern void * __memsetw(void *dest, unsigned short, size_t count);
61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ 61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
62 : __memsetw((s),(c),(n))) 62 : __memsetw((s),(c),(n)))
63 63
64extern int strcasecmp(const char *, const char *);
65
66#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
67 65
68#endif /* __ALPHA_STRING_H__ */ 66#endif /* __ALPHA_STRING_H__ */
diff --git a/include/asm-arm/arch-imx/mmc.h b/include/asm-arm/arch-imx/mmc.h
index 1937151665c..84c726934ac 100644
--- a/include/asm-arm/arch-imx/mmc.h
+++ b/include/asm-arm/arch-imx/mmc.h
@@ -1,7 +1,7 @@
1#ifndef ASMARM_ARCH_MMC_H 1#ifndef ASMARM_ARCH_MMC_H
2#define ASMARM_ARCH_MMC_H 2#define ASMARM_ARCH_MMC_H
3 3
4#include <linux/mmc/protocol.h> 4#include <linux/mmc/host.h>
5 5
6struct imxmmc_platform_data { 6struct imxmmc_platform_data {
7 int (*card_present)(void); 7 int (*card_present)(void);
diff --git a/include/asm-arm/arch-ixp4xx/dma.h b/include/asm-arm/arch-ixp4xx/dma.h
index 789f7f53c35..2c7f5327d80 100644
--- a/include/asm-arm/arch-ixp4xx/dma.h
+++ b/include/asm-arm/arch-ixp4xx/dma.h
@@ -12,7 +12,6 @@
12#define __ASM_ARCH_DMA_H 12#define __ASM_ARCH_DMA_H
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/pci.h>
16#include <asm/page.h> 15#include <asm/page.h>
17#include <asm/sizes.h> 16#include <asm/sizes.h>
18#include <asm/hardware.h> 17#include <asm/hardware.h>
diff --git a/include/asm-arm/arch-pxa/mmc.h b/include/asm-arm/arch-pxa/mmc.h
index a38a28c4bbd..ef4f570381d 100644
--- a/include/asm-arm/arch-pxa/mmc.h
+++ b/include/asm-arm/arch-pxa/mmc.h
@@ -1,7 +1,7 @@
1#ifndef ASMARM_ARCH_MMC_H 1#ifndef ASMARM_ARCH_MMC_H
2#define ASMARM_ARCH_MMC_H 2#define ASMARM_ARCH_MMC_H
3 3
4#include <linux/mmc/protocol.h> 4#include <linux/mmc/host.h>
5#include <linux/interrupt.h> 5#include <linux/interrupt.h>
6 6
7struct device; 7struct device;
diff --git a/include/asm-arm/arch-pxa/pxa27x_keyboard.h b/include/asm-arm/arch-pxa/pxa27x_keyboard.h
new file mode 100644
index 00000000000..3aaff923b2c
--- /dev/null
+++ b/include/asm-arm/arch-pxa/pxa27x_keyboard.h
@@ -0,0 +1,13 @@
1#define PXAKBD_MAXROW 8
2#define PXAKBD_MAXCOL 8
3
4struct pxa27x_keyboard_platform_data {
5 int nr_rows, nr_cols;
6 int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL];
7 int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL];
8
9#ifdef CONFIG_PM
10 u32 reg_kpc;
11 u32 reg_kprec;
12#endif
13};
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h
index 37e0a96e878..0b5f881c3d8 100644
--- a/include/asm-arm/div64.h
+++ b/include/asm-arm/div64.h
@@ -2,6 +2,7 @@
2#define __ASM_ARM_DIV64 2#define __ASM_ARM_DIV64
3 3
4#include <asm/system.h> 4#include <asm/system.h>
5#include <linux/types.h>
5 6
6/* 7/*
7 * The semantics of do_div() are: 8 * The semantics of do_div() are:
@@ -223,4 +224,6 @@
223 224
224#endif 225#endif
225 226
227extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
228
226#endif 229#endif
diff --git a/include/asm-arm/mach/mmc.h b/include/asm-arm/mach/mmc.h
index 1b3555d4b41..eb91145c00c 100644
--- a/include/asm-arm/mach/mmc.h
+++ b/include/asm-arm/mach/mmc.h
@@ -4,7 +4,7 @@
4#ifndef ASMARM_MACH_MMC_H 4#ifndef ASMARM_MACH_MMC_H
5#define ASMARM_MACH_MMC_H 5#define ASMARM_MACH_MMC_H
6 6
7#include <linux/mmc/protocol.h> 7#include <linux/mmc/host.h>
8 8
9struct mmc_platform_data { 9struct mmc_platform_data {
10 unsigned int ocr_mask; /* available voltages */ 10 unsigned int ocr_mask; /* available voltages */
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index d1a65b1edca..f8755c818b5 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -16,6 +16,7 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/proc-fns.h> 18#include <asm/proc-fns.h>
19#include <asm-generic/mm_hooks.h>
19 20
20void __check_kvm_seq(struct mm_struct *mm); 21void __check_kvm_seq(struct mm_struct *mm);
21 22
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 19f7df702b0..65a1a64bf93 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/sockios.h b/include/asm-arm/sockios.h
index 77c34087d51..a2588a2512d 100644
--- a/include/asm-arm/sockios.h
+++ b/include/asm-arm/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-arm26/mmu_context.h b/include/asm-arm26/mmu_context.h
index 1a929bfe5c3..16c821f81b8 100644
--- a/include/asm-arm26/mmu_context.h
+++ b/include/asm-arm26/mmu_context.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_ARM_MMU_CONTEXT_H 13#ifndef __ASM_ARM_MMU_CONTEXT_H
14#define __ASM_ARM_MMU_CONTEXT_H 14#define __ASM_ARM_MMU_CONTEXT_H
15 15
16#include <asm-generic/mm_hooks.h>
17
16#define init_new_context(tsk,mm) 0 18#define init_new_context(tsk,mm) 0
17#define destroy_context(mm) do { } while(0) 19#define destroy_context(mm) do { } while(0)
18 20
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h
index 19f7df702b0..65a1a64bf93 100644
--- a/include/asm-arm26/socket.h
+++ b/include/asm-arm26/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm26/sockios.h b/include/asm-arm26/sockios.h
index 77c34087d51..a2588a2512d 100644
--- a/include/asm-arm26/sockios.h
+++ b/include/asm-arm26/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-avr32/arch-at32ap/io.h b/include/asm-avr32/arch-at32ap/io.h
new file mode 100644
index 00000000000..ee59e401f04
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/io.h
@@ -0,0 +1,39 @@
1#ifndef __ASM_AVR32_ARCH_AT32AP_IO_H
2#define __ASM_AVR32_ARCH_AT32AP_IO_H
3
4/* For "bizarre" halfword swapping */
5#include <linux/byteorder/swabb.h>
6
7#if defined(CONFIG_AP7000_32_BIT_SMC)
8# define __swizzle_addr_b(addr) (addr ^ 3UL)
9# define __swizzle_addr_w(addr) (addr ^ 2UL)
10# define __swizzle_addr_l(addr) (addr)
11# define ioswabb(a, x) (x)
12# define ioswabw(a, x) (x)
13# define ioswabl(a, x) (x)
14# define __mem_ioswabb(a, x) (x)
15# define __mem_ioswabw(a, x) swab16(x)
16# define __mem_ioswabl(a, x) swab32(x)
17#elif defined(CONFIG_AP7000_16_BIT_SMC)
18# define __swizzle_addr_b(addr) (addr ^ 1UL)
19# define __swizzle_addr_w(addr) (addr)
20# define __swizzle_addr_l(addr) (addr)
21# define ioswabb(a, x) (x)
22# define ioswabw(a, x) (x)
23# define ioswabl(a, x) swahw32(x)
24# define __mem_ioswabb(a, x) (x)
25# define __mem_ioswabw(a, x) swab16(x)
26# define __mem_ioswabl(a, x) swahb32(x)
27#else
28# define __swizzle_addr_b(addr) (addr)
29# define __swizzle_addr_w(addr) (addr)
30# define __swizzle_addr_l(addr) (addr)
31# define ioswabb(a, x) (x)
32# define ioswabw(a, x) swab16(x)
33# define ioswabl(a, x) swab32(x)
34# define __mem_ioswabb(a, x) (x)
35# define __mem_ioswabw(a, x) (x)
36# define __mem_ioswabl(a, x) (x)
37#endif
38
39#endif /* __ASM_AVR32_ARCH_AT32AP_IO_H */
diff --git a/include/asm-avr32/arch-at32ap/smc.h b/include/asm-avr32/arch-at32ap/smc.h
index 3732b328303..07152b7fd9c 100644
--- a/include/asm-avr32/arch-at32ap/smc.h
+++ b/include/asm-avr32/arch-at32ap/smc.h
@@ -48,10 +48,32 @@ struct smc_config {
48 unsigned int nwe_controlled:1; 48 unsigned int nwe_controlled:1;
49 49
50 /* 50 /*
51 * 0: NWAIT is disabled
52 * 1: Reserved
53 * 2: NWAIT is frozen mode
54 * 3: NWAIT in ready mode
55 */
56 unsigned int nwait_mode:2;
57
58 /*
51 * 0: Byte select access type 59 * 0: Byte select access type
52 * 1: Byte write access type 60 * 1: Byte write access type
53 */ 61 */
54 unsigned int byte_write:1; 62 unsigned int byte_write:1;
63
64 /*
65 * Number of clock cycles before data is released after
66 * the rising edge of the read controlling signal
67 *
68 * Total cycles from SMC is tdf_cycles + 1
69 */
70 unsigned int tdf_cycles:4;
71
72 /*
73 * 0: TDF optimization disabled
74 * 1: TDF optimization enabled
75 */
76 unsigned int tdf_mode:1;
55}; 77};
56 78
57extern int smc_set_configuration(int cs, const struct smc_config *config); 79extern int smc_set_configuration(int cs, const struct smc_config *config);
diff --git a/include/asm-avr32/arch-at32ap/time.h b/include/asm-avr32/arch-at32ap/time.h
new file mode 100644
index 00000000000..cc8a43418a4
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/time.h
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_AVR32_ARCH_AT32AP_TIME_H
10#define _ASM_AVR32_ARCH_AT32AP_TIME_H
11
12#include <linux/platform_device.h>
13
14extern struct irqaction timer_irqaction;
15extern struct platform_device at32_systc0_device;
16extern void local_timer_interrupt(int irq, void *dev_id);
17
18#define TIMER_BCR 0x000000c0
19#define TIMER_BCR_SYNC 0
20#define TIMER_BMR 0x000000c4
21#define TIMER_BMR_TC0XC0S 0
22#define TIMER_BMR_TC1XC1S 2
23#define TIMER_BMR_TC2XC2S 4
24#define TIMER_CCR 0x00000000
25#define TIMER_CCR_CLKDIS 1
26#define TIMER_CCR_CLKEN 0
27#define TIMER_CCR_SWTRG 2
28#define TIMER_CMR 0x00000004
29#define TIMER_CMR_ABETRG 10
30#define TIMER_CMR_ACPA 16
31#define TIMER_CMR_ACPC 18
32#define TIMER_CMR_AEEVT 20
33#define TIMER_CMR_ASWTRG 22
34#define TIMER_CMR_BCPB 24
35#define TIMER_CMR_BCPC 26
36#define TIMER_CMR_BEEVT 28
37#define TIMER_CMR_BSWTRG 30
38#define TIMER_CMR_BURST 4
39#define TIMER_CMR_CLKI 3
40#define TIMER_CMR_CPCDIS 7
41#define TIMER_CMR_CPCSTOP 6
42#define TIMER_CMR_CPCTRG 14
43#define TIMER_CMR_EEVT 10
44#define TIMER_CMR_EEVTEDG 8
45#define TIMER_CMR_ENETRG 12
46#define TIMER_CMR_ETRGEDG 8
47#define TIMER_CMR_LDBDIS 7
48#define TIMER_CMR_LDBSTOP 6
49#define TIMER_CMR_LDRA 16
50#define TIMER_CMR_LDRB 18
51#define TIMER_CMR_TCCLKS 0
52#define TIMER_CMR_WAVE 15
53#define TIMER_CMR_WAVSEL 13
54#define TIMER_CV 0x00000010
55#define TIMER_CV_CV 0
56#define TIMER_IDR 0x00000028
57#define TIMER_IDR_COVFS 0
58#define TIMER_IDR_CPAS 2
59#define TIMER_IDR_CPBS 3
60#define TIMER_IDR_CPCS 4
61#define TIMER_IDR_ETRGS 7
62#define TIMER_IDR_LDRAS 5
63#define TIMER_IDR_LDRBS 6
64#define TIMER_IDR_LOVRS 1
65#define TIMER_IER 0x00000024
66#define TIMER_IER_COVFS 0
67#define TIMER_IER_CPAS 2
68#define TIMER_IER_CPBS 3
69#define TIMER_IER_CPCS 4
70#define TIMER_IER_ETRGS 7
71#define TIMER_IER_LDRAS 5
72#define TIMER_IER_LDRBS 6
73#define TIMER_IER_LOVRS 1
74#define TIMER_IMR 0x0000002c
75#define TIMER_IMR_COVFS 0
76#define TIMER_IMR_CPAS 2
77#define TIMER_IMR_CPBS 3
78#define TIMER_IMR_CPCS 4
79#define TIMER_IMR_ETRGS 7
80#define TIMER_IMR_LDRAS 5
81#define TIMER_IMR_LDRBS 6
82#define TIMER_IMR_LOVRS 1
83#define TIMER_RA 0x00000014
84#define TIMER_RA_RA 0
85#define TIMER_RB 0x00000018
86#define TIMER_RB_RB 0
87#define TIMER_RC 0x0000001c
88#define TIMER_RC_RC 0
89#define TIMER_SR 0x00000020
90#define TIMER_SR_CLKSTA 16
91#define TIMER_SR_COVFS 0
92#define TIMER_SR_CPAS 2
93#define TIMER_SR_CPBS 3
94#define TIMER_SR_CPCS 4
95#define TIMER_SR_ETRGS 7
96#define TIMER_SR_LDRAS 5
97#define TIMER_SR_LDRBS 6
98#define TIMER_SR_LOVRS 1
99#define TIMER_SR_MTIOA 17
100#define TIMER_SR_MTIOB 18
101
102/* Bit manipulation macros */
103#define TIMER_BIT(name) (1 << TIMER_##name)
104#define TIMER_BF(name,value) ((value) << TIMER_##name)
105
106/* Register access macros */
107#define timer_read(port,instance,reg) \
108 __raw_readl(port + (0x40 * instance) + TIMER_##reg)
109#define timer_write(port,instance,reg,value) \
110 __raw_writel((value), port + (0x40 * instance) + TIMER_##reg)
111
112#endif /* _ASM_AVR32_ARCH_AT32AP_TIME_H */
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index c40b6032c48..b9c2548a52f 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -173,7 +173,7 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
173} 173}
174 174
175#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 175#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
176#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 176#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
177 177
178#define atomic_sub(i, v) (void)atomic_sub_return(i, v) 178#define atomic_sub(i, v) (void)atomic_sub_return(i, v)
179#define atomic_add(i, v) (void)atomic_add_return(i, v) 179#define atomic_add(i, v) (void)atomic_add_return(i, v)
diff --git a/include/asm-avr32/bug.h b/include/asm-avr32/bug.h
index 521766bc936..afdcd79a296 100644
--- a/include/asm-avr32/bug.h
+++ b/include/asm-avr32/bug.h
@@ -18,27 +18,53 @@
18 18
19#ifdef CONFIG_DEBUG_BUGVERBOSE 19#ifdef CONFIG_DEBUG_BUGVERBOSE
20 20
21#define BUG() \ 21#define _BUG_OR_WARN(flags) \
22 do { \ 22 asm volatile( \
23 asm volatile(".hword %0\n\t" \ 23 "1: .hword %0\n" \
24 ".hword %1\n\t" \ 24 " .section __bug_table,\"a\",@progbits\n" \
25 ".long %2" \ 25 "2: .long 1b\n" \
26 : \ 26 " .long %1\n" \
27 : "n"(AVR32_BUG_OPCODE), \ 27 " .short %2\n" \
28 "i"(__LINE__), "X"(__FILE__)); \ 28 " .short %3\n" \
29 } while (0) 29 " .org 2b + %4\n" \
30 " .previous" \
31 : \
32 : "i"(AVR32_BUG_OPCODE), "i"(__FILE__), \
33 "i"(__LINE__), "i"(flags), \
34 "i"(sizeof(struct bug_entry)))
30 35
31#else 36#else
32 37
38#define _BUG_OR_WARN(flags) \
39 asm volatile( \
40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \
42 "2: .long 1b\n" \
43 " .short %1\n" \
44 " .org 2b + %2\n" \
45 " .previous" \
46 : \
47 : "i"(AVR32_BUG_OPCODE), "i"(flags), \
48 "i"(sizeof(struct bug_entry)))
49
50#endif /* CONFIG_DEBUG_BUGVERBOSE */
51
33#define BUG() \ 52#define BUG() \
34 do { \ 53 do { \
35 asm volatile(".hword %0\n\t" \ 54 _BUG_OR_WARN(0); \
36 : : "n"(AVR32_BUG_OPCODE)); \ 55 for (;;); \
37 } while (0) 56 } while (0)
38 57
39#endif /* CONFIG_DEBUG_BUGVERBOSE */ 58#define WARN_ON(condition) \
59 ({ \
60 typeof(condition) __ret_warn_on = (condition); \
61 if (unlikely(__ret_warn_on)) \
62 _BUG_OR_WARN(BUGFLAG_WARNING); \
63 unlikely(__ret_warn_on); \
64 })
40 65
41#define HAVE_ARCH_BUG 66#define HAVE_ARCH_BUG
67#define HAVE_ARCH_WARN_ON
42 68
43#endif /* CONFIG_BUG */ 69#endif /* CONFIG_BUG */
44 70
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index c08e8104839..e30d4b3bd83 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -1,13 +1,15 @@
1#ifndef __ASM_AVR32_IO_H 1#ifndef __ASM_AVR32_IO_H
2#define __ASM_AVR32_IO_H 2#define __ASM_AVR32_IO_H
3 3
4#include <linux/kernel.h>
4#include <linux/string.h> 5#include <linux/string.h>
5 6#include <linux/types.h>
6#ifdef __KERNEL__
7 7
8#include <asm/addrspace.h> 8#include <asm/addrspace.h>
9#include <asm/byteorder.h> 9#include <asm/byteorder.h>
10 10
11#include <asm/arch/io.h>
12
11/* virt_to_phys will only work when address is in P1 or P2 */ 13/* virt_to_phys will only work when address is in P1 or P2 */
12static __inline__ unsigned long virt_to_phys(volatile void *address) 14static __inline__ unsigned long virt_to_phys(volatile void *address)
13{ 15{
@@ -36,104 +38,215 @@ extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
36extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 38extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
37extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); 39extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
38 40
39static inline void writeb(unsigned char b, volatile void __iomem *addr) 41static inline void __raw_writeb(u8 v, volatile void __iomem *addr)
40{ 42{
41 *(volatile unsigned char __force *)addr = b; 43 *(volatile u8 __force *)addr = v;
42} 44}
43static inline void writew(unsigned short b, volatile void __iomem *addr) 45static inline void __raw_writew(u16 v, volatile void __iomem *addr)
44{ 46{
45 *(volatile unsigned short __force *)addr = b; 47 *(volatile u16 __force *)addr = v;
46} 48}
47static inline void writel(unsigned int b, volatile void __iomem *addr) 49static inline void __raw_writel(u32 v, volatile void __iomem *addr)
48{ 50{
49 *(volatile unsigned int __force *)addr = b; 51 *(volatile u32 __force *)addr = v;
50} 52}
51#define __raw_writeb writeb
52#define __raw_writew writew
53#define __raw_writel writel
54 53
55static inline unsigned char readb(const volatile void __iomem *addr) 54static inline u8 __raw_readb(const volatile void __iomem *addr)
56{ 55{
57 return *(const volatile unsigned char __force *)addr; 56 return *(const volatile u8 __force *)addr;
58} 57}
59static inline unsigned short readw(const volatile void __iomem *addr) 58static inline u16 __raw_readw(const volatile void __iomem *addr)
60{ 59{
61 return *(const volatile unsigned short __force *)addr; 60 return *(const volatile u16 __force *)addr;
62} 61}
63static inline unsigned int readl(const volatile void __iomem *addr) 62static inline u32 __raw_readl(const volatile void __iomem *addr)
64{ 63{
65 return *(const volatile unsigned int __force *)addr; 64 return *(const volatile u32 __force *)addr;
65}
66
67/* Convert I/O port address to virtual address */
68#ifndef __io
69# define __io(p) ((void *)phys_to_uncached(p))
70#endif
71
72/*
73 * Not really sure about the best way to slow down I/O on
74 * AVR32. Defining it as a no-op until we have an actual test case.
75 */
76#define SLOW_DOWN_IO do { } while (0)
77
78#define __BUILD_MEMORY_SINGLE(pfx, bwl, type) \
79static inline void \
80pfx##write##bwl(type val, volatile void __iomem *addr) \
81{ \
82 volatile type *__addr; \
83 type __val; \
84 \
85 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
86 __val = pfx##ioswab##bwl(__addr, val); \
87 \
88 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
89 \
90 *__addr = __val; \
91} \
92 \
93static inline type pfx##read##bwl(const volatile void __iomem *addr) \
94{ \
95 volatile type *__addr; \
96 type __val; \
97 \
98 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
99 \
100 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
101 \
102 __val = *__addr; \
103 return pfx##ioswab##bwl(__addr, __val); \
104}
105
106#define __BUILD_IOPORT_SINGLE(pfx, bwl, type, p, slow) \
107static inline void pfx##out##bwl##p(type val, unsigned long port) \
108{ \
109 volatile type *__addr; \
110 type __val; \
111 \
112 __addr = __io(__swizzle_addr_##bwl(port)); \
113 __val = pfx##ioswab##bwl(__addr, val); \
114 \
115 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
116 \
117 *__addr = __val; \
118 slow; \
119} \
120 \
121static inline type pfx##in##bwl##p(unsigned long port) \
122{ \
123 volatile type *__addr; \
124 type __val; \
125 \
126 __addr = __io(__swizzle_addr_##bwl(port)); \
127 \
128 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
129 \
130 __val = *__addr; \
131 slow; \
132 \
133 return pfx##ioswab##bwl(__addr, __val); \
134}
135
136#define __BUILD_MEMORY_PFX(bus, bwl, type) \
137 __BUILD_MEMORY_SINGLE(bus, bwl, type)
138
139#define BUILDIO_MEM(bwl, type) \
140 __BUILD_MEMORY_PFX(, bwl, type) \
141 __BUILD_MEMORY_PFX(__mem_, bwl, type)
142
143#define __BUILD_IOPORT_PFX(bus, bwl, type) \
144 __BUILD_IOPORT_SINGLE(bus, bwl, type, ,) \
145 __BUILD_IOPORT_SINGLE(bus, bwl, type, _p, SLOW_DOWN_IO)
146
147#define BUILDIO_IOPORT(bwl, type) \
148 __BUILD_IOPORT_PFX(, bwl, type) \
149 __BUILD_IOPORT_PFX(__mem_, bwl, type)
150
151BUILDIO_MEM(b, u8)
152BUILDIO_MEM(w, u16)
153BUILDIO_MEM(l, u32)
154
155BUILDIO_IOPORT(b, u8)
156BUILDIO_IOPORT(w, u16)
157BUILDIO_IOPORT(l, u32)
158
159#define readb_relaxed readb
160#define readw_relaxed readw
161#define readl_relaxed readl
162
163#define __BUILD_MEMORY_STRING(bwl, type) \
164static inline void writes##bwl(volatile void __iomem *addr, \
165 const void *data, unsigned int count) \
166{ \
167 const type *__data = data; \
168 \
169 while (count--) \
170 __mem_write##bwl(*__data++, addr); \
171} \
172 \
173static inline void reads##bwl(const volatile void __iomem *addr, \
174 void *data, unsigned int count) \
175{ \
176 type *__data = data; \
177 \
178 while (count--) \
179 *__data++ = __mem_read##bwl(addr); \
66} 180}
67#define __raw_readb readb
68#define __raw_readw readw
69#define __raw_readl readl
70 181
71#define writesb(p, d, l) __raw_writesb((unsigned int)p, d, l) 182#define __BUILD_IOPORT_STRING(bwl, type) \
72#define writesw(p, d, l) __raw_writesw((unsigned int)p, d, l) 183static inline void outs##bwl(unsigned long port, const void *data, \
73#define writesl(p, d, l) __raw_writesl((unsigned int)p, d, l) 184 unsigned int count) \
185{ \
186 const type *__data = data; \
187 \
188 while (count--) \
189 __mem_out##bwl(*__data++, port); \
190} \
191 \
192static inline void ins##bwl(unsigned long port, void *data, \
193 unsigned int count) \
194{ \
195 type *__data = data; \
196 \
197 while (count--) \
198 *__data++ = __mem_in##bwl(port); \
199}
74 200
75#define readsb(p, d, l) __raw_readsb((unsigned int)p, d, l) 201#define BUILDSTRING(bwl, type) \
76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) 202 __BUILD_MEMORY_STRING(bwl, type) \
77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) 203 __BUILD_IOPORT_STRING(bwl, type)
78 204
205BUILDSTRING(b, u8)
206BUILDSTRING(w, u16)
207BUILDSTRING(l, u32)
79 208
80/* 209/*
81 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be 210 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
82 */ 211 */
83#ifndef ioread8 212#ifndef ioread8
84 213
85#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) 214#define ioread8(p) ((unsigned int)readb(p))
86 215
87#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) 216#define ioread16(p) ((unsigned int)readw(p))
88#define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; }) 217#define ioread16be(p) ((unsigned int)__raw_readw(p))
89 218
90#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) 219#define ioread32(p) ((unsigned int)readl(p))
91#define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; }) 220#define ioread32be(p) ((unsigned int)__raw_readl(p))
92 221
93#define iowrite8(v,p) __raw_writeb(v, p) 222#define iowrite8(v,p) writeb(v, p)
94 223
95#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p) 224#define iowrite16(v,p) writew(v, p)
96#define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p) 225#define iowrite16be(v,p) __raw_writew(v, p)
97 226
98#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p) 227#define iowrite32(v,p) writel(v, p)
99#define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p) 228#define iowrite32be(v,p) __raw_writel(v, p)
100 229
101#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 230#define ioread8_rep(p,d,c) readsb(p,d,c)
102#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 231#define ioread16_rep(p,d,c) readsw(p,d,c)
103#define ioread32_rep(p,d,c) __raw_readsl(p,d,c) 232#define ioread32_rep(p,d,c) readsl(p,d,c)
104 233
105#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c) 234#define iowrite8_rep(p,s,c) writesb(p,s,c)
106#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c) 235#define iowrite16_rep(p,s,c) writesw(p,s,c)
107#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c) 236#define iowrite32_rep(p,s,c) writesl(p,s,c)
108 237
109#endif 238#endif
110 239
111
112/*
113 * These two are only here because ALSA _thinks_ it needs them...
114 */
115static inline void memcpy_fromio(void * to, const volatile void __iomem *from, 240static inline void memcpy_fromio(void * to, const volatile void __iomem *from,
116 unsigned long count) 241 unsigned long count)
117{ 242{
118 char *p = to; 243 memcpy(to, (const void __force *)from, count);
119 while (count) {
120 count--;
121 *p = readb(from);
122 p++;
123 from++;
124 }
125} 244}
126 245
127static inline void memcpy_toio(volatile void __iomem *to, const void * from, 246static inline void memcpy_toio(volatile void __iomem *to, const void * from,
128 unsigned long count) 247 unsigned long count)
129{ 248{
130 const char *p = from; 249 memcpy((void __force *)to, from, count);
131 while (count) {
132 count--;
133 writeb(*p, to);
134 p++;
135 to++;
136 }
137} 250}
138 251
139static inline void memset_io(volatile void __iomem *addr, unsigned char val, 252static inline void memset_io(volatile void __iomem *addr, unsigned char val,
@@ -142,99 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val,
142 memset((void __force *)addr, val, count); 255 memset((void __force *)addr, val, count);
143} 256}
144 257
145/*
146 * Bad read/write accesses...
147 */
148extern void __readwrite_bug(const char *fn);
149
150#define IO_SPACE_LIMIT 0xffffffff 258#define IO_SPACE_LIMIT 0xffffffff
151 259
152/* Convert I/O port address to virtual address */
153#define __io(p) ((void __iomem *)phys_to_uncached(p))
154
155/*
156 * IO port access primitives
157 * -------------------------
158 *
159 * The AVR32 doesn't have special IO access instructions; all IO is memory
160 * mapped. Note that these are defined to perform little endian accesses
161 * only. Their primary purpose is to access PCI and ISA peripherals.
162 *
163 * Note that for a big endian machine, this implies that the following
164 * big endian mode connectivity is in place.
165 *
166 * The machine specific io.h include defines __io to translate an "IO"
167 * address to a memory address.
168 *
169 * Note that we prevent GCC re-ordering or caching values in expressions
170 * by introducing sequence points into the in*() definitions. Note that
171 * __raw_* do not guarantee this behaviour.
172 *
173 * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space.
174 */
175#define outb(v, p) __raw_writeb(v, __io(p))
176#define outw(v, p) __raw_writew(cpu_to_le16(v), __io(p))
177#define outl(v, p) __raw_writel(cpu_to_le32(v), __io(p))
178
179#define inb(p) __raw_readb(__io(p))
180#define inw(p) le16_to_cpu(__raw_readw(__io(p)))
181#define inl(p) le32_to_cpu(__raw_readl(__io(p)))
182
183static inline void __outsb(unsigned long port, void *addr, unsigned int count)
184{
185 while (count--) {
186 outb(*(u8 *)addr, port);
187 addr++;
188 }
189}
190
191static inline void __insb(unsigned long port, void *addr, unsigned int count)
192{
193 while (count--) {
194 *(u8 *)addr = inb(port);
195 addr++;
196 }
197}
198
199static inline void __outsw(unsigned long port, void *addr, unsigned int count)
200{
201 while (count--) {
202 outw(*(u16 *)addr, port);
203 addr += 2;
204 }
205}
206
207static inline void __insw(unsigned long port, void *addr, unsigned int count)
208{
209 while (count--) {
210 *(u16 *)addr = inw(port);
211 addr += 2;
212 }
213}
214
215static inline void __outsl(unsigned long port, void *addr, unsigned int count)
216{
217 while (count--) {
218 outl(*(u32 *)addr, port);
219 addr += 4;
220 }
221}
222
223static inline void __insl(unsigned long port, void *addr, unsigned int count)
224{
225 while (count--) {
226 *(u32 *)addr = inl(port);
227 addr += 4;
228 }
229}
230
231#define outsb(port, addr, count) __outsb(port, addr, count)
232#define insb(port, addr, count) __insb(port, addr, count)
233#define outsw(port, addr, count) __outsw(port, addr, count)
234#define insw(port, addr, count) __insw(port, addr, count)
235#define outsl(port, addr, count) __outsl(port, addr, count)
236#define insl(port, addr, count) __insl(port, addr, count)
237
238extern void __iomem *__ioremap(unsigned long offset, size_t size, 260extern void __iomem *__ioremap(unsigned long offset, size_t size,
239 unsigned long flags); 261 unsigned long flags);
240extern void __iounmap(void __iomem *addr); 262extern void __iounmap(void __iomem *addr);
@@ -292,6 +314,4 @@ extern void __iounmap(void __iomem *addr);
292 */ 314 */
293#define xlate_dev_kmem_ptr(p) p 315#define xlate_dev_kmem_ptr(p) p
294 316
295#endif /* __KERNEL__ */
296
297#endif /* __ASM_AVR32_IO_H */ 317#endif /* __ASM_AVR32_IO_H */
diff --git a/include/asm-avr32/mmu_context.h b/include/asm-avr32/mmu_context.h
index 31add1ae808..c37c391faef 100644
--- a/include/asm-avr32/mmu_context.h
+++ b/include/asm-avr32/mmu_context.h
@@ -15,6 +15,7 @@
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16#include <asm/pgalloc.h> 16#include <asm/pgalloc.h>
17#include <asm/sysreg.h> 17#include <asm/sysreg.h>
18#include <asm-generic/mm_hooks.h>
18 19
19/* 20/*
20 * The MMU "context" consists of two things: 21 * The MMU "context" consists of two things:
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h
index f6913778a45..6a64833756a 100644
--- a/include/asm-avr32/processor.h
+++ b/include/asm-avr32/processor.h
@@ -40,6 +40,14 @@ enum tlb_config {
40 TLB_INVALID 40 TLB_INVALID
41}; 41};
42 42
43#define AVR32_FEATURE_RMW (1 << 0)
44#define AVR32_FEATURE_DSP (1 << 1)
45#define AVR32_FEATURE_SIMD (1 << 2)
46#define AVR32_FEATURE_OCD (1 << 3)
47#define AVR32_FEATURE_PCTR (1 << 4)
48#define AVR32_FEATURE_JAVA (1 << 5)
49#define AVR32_FEATURE_FPU (1 << 6)
50
43struct avr32_cpuinfo { 51struct avr32_cpuinfo {
44 struct clk *clk; 52 struct clk *clk;
45 unsigned long loops_per_jiffy; 53 unsigned long loops_per_jiffy;
@@ -48,6 +56,7 @@ struct avr32_cpuinfo {
48 unsigned short arch_revision; 56 unsigned short arch_revision;
49 unsigned short cpu_revision; 57 unsigned short cpu_revision;
50 enum tlb_config tlb_config; 58 enum tlb_config tlb_config;
59 unsigned long features;
51 60
52 struct cache_info icache; 61 struct cache_info icache;
53 struct cache_info dcache; 62 struct cache_info dcache;
@@ -125,10 +134,10 @@ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
125#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) 134#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
126 135
127struct pt_regs; 136struct pt_regs;
128void show_trace(struct task_struct *task, unsigned long *stack,
129 struct pt_regs *regs);
130
131extern unsigned long get_wchan(struct task_struct *p); 137extern unsigned long get_wchan(struct task_struct *p);
138extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl);
139extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp,
140 struct pt_regs *regs, const char *log_lvl);
132 141
133#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) 142#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
134#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) 143#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
diff --git a/include/asm-avr32/scatterlist.h b/include/asm-avr32/scatterlist.h
index bfe7d753423..c6d5ce3b3a2 100644
--- a/include/asm-avr32/scatterlist.h
+++ b/include/asm-avr32/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_AVR32_SCATTERLIST_H 1#ifndef __ASM_AVR32_SCATTERLIST_H
2#define __ASM_AVR32_SCATTERLIST_H 2#define __ASM_AVR32_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page *page; 7 struct page *page;
6 unsigned int offset; 8 unsigned int offset;
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index 0a5224245e4..1ff1a217015 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -124,19 +124,12 @@ struct tagtable {
124#define for_each_tag(t,base) \ 124#define for_each_tag(t,base) \
125 for (t = base; t->hdr.size; t = tag_next(t)) 125 for (t = base; t->hdr.size; t = tag_next(t))
126 126
127extern struct tag_mem_range *mem_phys;
128extern struct tag_mem_range *mem_reserved;
129extern struct tag_mem_range *mem_ramdisk;
130
131extern struct tag *bootloader_tags; 127extern struct tag *bootloader_tags;
132 128
133extern void setup_bootmem(void); 129extern resource_size_t fbmem_start;
134extern void setup_processor(void); 130extern resource_size_t fbmem_size;
135extern void board_setup_fbmem(unsigned long fbmem_start,
136 unsigned long fbmem_size);
137 131
138/* Chip-specific hook to enable the use of SDRAM */ 132void setup_processor(void);
139void chip_enable_sdram(void);
140 133
141#endif /* !__ASSEMBLY__ */ 134#endif /* !__ASSEMBLY__ */
142 135
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index 543229de817..a0d0507a503 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __ASM_AVR32_SOCKET_H */ 55#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-avr32/sockios.h b/include/asm-avr32/sockios.h
index 84f3d65b3b3..0802d742f97 100644
--- a/include/asm-avr32/sockios.h
+++ b/include/asm-avr32/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ASM_AVR32_SOCKIOS_H */ 13#endif /* __ASM_AVR32_SOCKIOS_H */
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
index f91975f330f..c02bc8304b1 100644
--- a/include/asm-avr32/sysreg.h
+++ b/include/asm-avr32/sysreg.h
@@ -7,326 +7,281 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#ifndef __ASM_AVR32_SYSREG_H__ 10#ifndef __ASM_AVR32_SYSREG_H
11#define __ASM_AVR32_SYSREG_H__ 11#define __ASM_AVR32_SYSREG_H
12 12
13/* sysreg register offsets */ 13/* sysreg register offsets */
14#define SYSREG_SR 0x0000 14#define SYSREG_SR 0x0000
15#define SYSREG_EVBA 0x0004 15#define SYSREG_EVBA 0x0004
16#define SYSREG_ACBA 0x0008 16#define SYSREG_ACBA 0x0008
17#define SYSREG_CPUCR 0x000c 17#define SYSREG_CPUCR 0x000c
18#define SYSREG_ECR 0x0010 18#define SYSREG_ECR 0x0010
19#define SYSREG_RSR_SUP 0x0014 19#define SYSREG_RSR_SUP 0x0014
20#define SYSREG_RSR_INT0 0x0018 20#define SYSREG_RSR_INT0 0x0018
21#define SYSREG_RSR_INT1 0x001c 21#define SYSREG_RSR_INT1 0x001c
22#define SYSREG_RSR_INT2 0x0020 22#define SYSREG_RSR_INT2 0x0020
23#define SYSREG_RSR_INT3 0x0024 23#define SYSREG_RSR_INT3 0x0024
24#define SYSREG_RSR_EX 0x0028 24#define SYSREG_RSR_EX 0x0028
25#define SYSREG_RSR_NMI 0x002c 25#define SYSREG_RSR_NMI 0x002c
26#define SYSREG_RSR_DBG 0x0030 26#define SYSREG_RSR_DBG 0x0030
27#define SYSREG_RAR_SUP 0x0034 27#define SYSREG_RAR_SUP 0x0034
28#define SYSREG_RAR_INT0 0x0038 28#define SYSREG_RAR_INT0 0x0038
29#define SYSREG_RAR_INT1 0x003c 29#define SYSREG_RAR_INT1 0x003c
30#define SYSREG_RAR_INT2 0x0040 30#define SYSREG_RAR_INT2 0x0040
31#define SYSREG_RAR_INT3 0x0044 31#define SYSREG_RAR_INT3 0x0044
32#define SYSREG_RAR_EX 0x0048 32#define SYSREG_RAR_EX 0x0048
33#define SYSREG_RAR_NMI 0x004c 33#define SYSREG_RAR_NMI 0x004c
34#define SYSREG_RAR_DBG 0x0050 34#define SYSREG_RAR_DBG 0x0050
35#define SYSREG_JECR 0x0054 35#define SYSREG_JECR 0x0054
36#define SYSREG_JOSP 0x0058 36#define SYSREG_JOSP 0x0058
37#define SYSREG_JAVA_LV0 0x005c 37#define SYSREG_JAVA_LV0 0x005c
38#define SYSREG_JAVA_LV1 0x0060 38#define SYSREG_JAVA_LV1 0x0060
39#define SYSREG_JAVA_LV2 0x0064 39#define SYSREG_JAVA_LV2 0x0064
40#define SYSREG_JAVA_LV3 0x0068 40#define SYSREG_JAVA_LV3 0x0068
41#define SYSREG_JAVA_LV4 0x006c 41#define SYSREG_JAVA_LV4 0x006c
42#define SYSREG_JAVA_LV5 0x0070 42#define SYSREG_JAVA_LV5 0x0070
43#define SYSREG_JAVA_LV6 0x0074 43#define SYSREG_JAVA_LV6 0x0074
44#define SYSREG_JAVA_LV7 0x0078 44#define SYSREG_JAVA_LV7 0x0078
45#define SYSREG_JTBA 0x007c 45#define SYSREG_JTBA 0x007c
46#define SYSREG_JBCR 0x0080 46#define SYSREG_JBCR 0x0080
47#define SYSREG_CONFIG0 0x0100 47#define SYSREG_CONFIG0 0x0100
48#define SYSREG_CONFIG1 0x0104 48#define SYSREG_CONFIG1 0x0104
49#define SYSREG_COUNT 0x0108 49#define SYSREG_COUNT 0x0108
50#define SYSREG_COMPARE 0x010c 50#define SYSREG_COMPARE 0x010c
51#define SYSREG_TLBEHI 0x0110 51#define SYSREG_TLBEHI 0x0110
52#define SYSREG_TLBELO 0x0114 52#define SYSREG_TLBELO 0x0114
53#define SYSREG_PTBR 0x0118 53#define SYSREG_PTBR 0x0118
54#define SYSREG_TLBEAR 0x011c 54#define SYSREG_TLBEAR 0x011c
55#define SYSREG_MMUCR 0x0120 55#define SYSREG_MMUCR 0x0120
56#define SYSREG_TLBARLO 0x0124 56#define SYSREG_TLBARLO 0x0124
57#define SYSREG_TLBARHI 0x0128 57#define SYSREG_TLBARHI 0x0128
58#define SYSREG_PCCNT 0x012c 58#define SYSREG_PCCNT 0x012c
59#define SYSREG_PCNT0 0x0130 59#define SYSREG_PCNT0 0x0130
60#define SYSREG_PCNT1 0x0134 60#define SYSREG_PCNT1 0x0134
61#define SYSREG_PCCR 0x0138 61#define SYSREG_PCCR 0x0138
62#define SYSREG_BEAR 0x013c 62#define SYSREG_BEAR 0x013c
63#define SYSREG_SABAL 0x0300
64#define SYSREG_SABAH 0x0304
65#define SYSREG_SABD 0x0308
63 66
64/* Bitfields in SR */ 67/* Bitfields in SR */
65#define SYSREG_SR_C_OFFSET 0 68#define SYSREG_SR_C_OFFSET 0
66#define SYSREG_SR_C_SIZE 1 69#define SYSREG_SR_C_SIZE 1
67#define SYSREG_Z_OFFSET 1 70#define SYSREG_Z_OFFSET 1
68#define SYSREG_Z_SIZE 1 71#define SYSREG_Z_SIZE 1
69#define SYSREG_SR_N_OFFSET 2 72#define SYSREG_SR_N_OFFSET 2
70#define SYSREG_SR_N_SIZE 1 73#define SYSREG_SR_N_SIZE 1
71#define SYSREG_SR_V_OFFSET 3 74#define SYSREG_SR_V_OFFSET 3
72#define SYSREG_SR_V_SIZE 1 75#define SYSREG_SR_V_SIZE 1
73#define SYSREG_Q_OFFSET 4 76#define SYSREG_Q_OFFSET 4
74#define SYSREG_Q_SIZE 1 77#define SYSREG_Q_SIZE 1
75#define SYSREG_GM_OFFSET 16 78#define SYSREG_L_OFFSET 5
76#define SYSREG_GM_SIZE 1 79#define SYSREG_L_SIZE 1
77#define SYSREG_I0M_OFFSET 17 80#define SYSREG_T_OFFSET 14
78#define SYSREG_I0M_SIZE 1 81#define SYSREG_T_SIZE 1
79#define SYSREG_I1M_OFFSET 18 82#define SYSREG_SR_R_OFFSET 15
80#define SYSREG_I1M_SIZE 1 83#define SYSREG_SR_R_SIZE 1
81#define SYSREG_I2M_OFFSET 19 84#define SYSREG_GM_OFFSET 16
82#define SYSREG_I2M_SIZE 1 85#define SYSREG_GM_SIZE 1
83#define SYSREG_I3M_OFFSET 20 86#define SYSREG_I0M_OFFSET 17
84#define SYSREG_I3M_SIZE 1 87#define SYSREG_I0M_SIZE 1
85#define SYSREG_EM_OFFSET 21 88#define SYSREG_I1M_OFFSET 18
86#define SYSREG_EM_SIZE 1 89#define SYSREG_I1M_SIZE 1
87#define SYSREG_M0_OFFSET 22 90#define SYSREG_I2M_OFFSET 19
88#define SYSREG_M0_SIZE 1 91#define SYSREG_I2M_SIZE 1
89#define SYSREG_M1_OFFSET 23 92#define SYSREG_I3M_OFFSET 20
90#define SYSREG_M1_SIZE 1 93#define SYSREG_I3M_SIZE 1
91#define SYSREG_M2_OFFSET 24 94#define SYSREG_EM_OFFSET 21
92#define SYSREG_M2_SIZE 1 95#define SYSREG_EM_SIZE 1
93#define SYSREG_SR_D_OFFSET 26 96#define SYSREG_M0_OFFSET 22
94#define SYSREG_SR_D_SIZE 1 97#define SYSREG_M0_SIZE 1
95#define SYSREG_DM_OFFSET 27 98#define SYSREG_M1_OFFSET 23
96#define SYSREG_DM_SIZE 1 99#define SYSREG_M1_SIZE 1
97#define SYSREG_SR_J_OFFSET 28 100#define SYSREG_M2_OFFSET 24
98#define SYSREG_SR_J_SIZE 1 101#define SYSREG_M2_SIZE 1
99#define SYSREG_R_OFFSET 29 102#define SYSREG_SR_D_OFFSET 26
100#define SYSREG_R_SIZE 1 103#define SYSREG_SR_D_SIZE 1
101#define SYSREG_H_OFFSET 30 104#define SYSREG_DM_OFFSET 27
102#define SYSREG_H_SIZE 1 105#define SYSREG_DM_SIZE 1
103 106#define SYSREG_SR_J_OFFSET 28
104/* Bitfields in EVBA */ 107#define SYSREG_SR_J_SIZE 1
105 108#define SYSREG_H_OFFSET 29
106/* Bitfields in ACBA */ 109#define SYSREG_H_SIZE 1
107 110
108/* Bitfields in CPUCR */ 111/* Bitfields in CPUCR */
109#define SYSREG_BI_OFFSET 0 112#define SYSREG_BI_OFFSET 0
110#define SYSREG_BI_SIZE 1 113#define SYSREG_BI_SIZE 1
111#define SYSREG_BE_OFFSET 1 114#define SYSREG_BE_OFFSET 1
112#define SYSREG_BE_SIZE 1 115#define SYSREG_BE_SIZE 1
113#define SYSREG_FE_OFFSET 2 116#define SYSREG_FE_OFFSET 2
114#define SYSREG_FE_SIZE 1 117#define SYSREG_FE_SIZE 1
115#define SYSREG_RE_OFFSET 3 118#define SYSREG_RE_OFFSET 3
116#define SYSREG_RE_SIZE 1 119#define SYSREG_RE_SIZE 1
117#define SYSREG_IBE_OFFSET 4 120#define SYSREG_IBE_OFFSET 4
118#define SYSREG_IBE_SIZE 1 121#define SYSREG_IBE_SIZE 1
119#define SYSREG_IEE_OFFSET 5 122#define SYSREG_IEE_OFFSET 5
120#define SYSREG_IEE_SIZE 1 123#define SYSREG_IEE_SIZE 1
121
122/* Bitfields in ECR */
123#define SYSREG_ECR_OFFSET 0
124#define SYSREG_ECR_SIZE 32
125
126/* Bitfields in RSR_SUP */
127
128/* Bitfields in RSR_INT0 */
129
130/* Bitfields in RSR_INT1 */
131
132/* Bitfields in RSR_INT2 */
133
134/* Bitfields in RSR_INT3 */
135
136/* Bitfields in RSR_EX */
137
138/* Bitfields in RSR_NMI */
139
140/* Bitfields in RSR_DBG */
141
142/* Bitfields in RAR_SUP */
143
144/* Bitfields in RAR_INT0 */
145
146/* Bitfields in RAR_INT1 */
147
148/* Bitfields in RAR_INT2 */
149
150/* Bitfields in RAR_INT3 */
151
152/* Bitfields in RAR_EX */
153
154/* Bitfields in RAR_NMI */
155
156/* Bitfields in RAR_DBG */
157
158/* Bitfields in JECR */
159
160/* Bitfields in JOSP */
161
162/* Bitfields in JAVA_LV0 */
163
164/* Bitfields in JAVA_LV1 */
165
166/* Bitfields in JAVA_LV2 */
167
168/* Bitfields in JAVA_LV3 */
169
170/* Bitfields in JAVA_LV4 */
171
172/* Bitfields in JAVA_LV5 */
173
174/* Bitfields in JAVA_LV6 */
175
176/* Bitfields in JAVA_LV7 */
177
178/* Bitfields in JTBA */
179
180/* Bitfields in JBCR */
181 124
182/* Bitfields in CONFIG0 */ 125/* Bitfields in CONFIG0 */
183#define SYSREG_CONFIG0_D_OFFSET 1 126#define SYSREG_CONFIG0_R_OFFSET 0
184#define SYSREG_CONFIG0_D_SIZE 1 127#define SYSREG_CONFIG0_R_SIZE 1
185#define SYSREG_CONFIG0_S_OFFSET 2 128#define SYSREG_CONFIG0_D_OFFSET 1
186#define SYSREG_CONFIG0_S_SIZE 1 129#define SYSREG_CONFIG0_D_SIZE 1
187#define SYSREG_O_OFFSET 3 130#define SYSREG_CONFIG0_S_OFFSET 2
188#define SYSREG_O_SIZE 1 131#define SYSREG_CONFIG0_S_SIZE 1
189#define SYSREG_P_OFFSET 4 132#define SYSREG_CONFIG0_O_OFFSET 3
190#define SYSREG_P_SIZE 1 133#define SYSREG_CONFIG0_O_SIZE 1
191#define SYSREG_CONFIG0_J_OFFSET 5 134#define SYSREG_CONFIG0_P_OFFSET 4
192#define SYSREG_CONFIG0_J_SIZE 1 135#define SYSREG_CONFIG0_P_SIZE 1
193#define SYSREG_F_OFFSET 6 136#define SYSREG_CONFIG0_J_OFFSET 5
194#define SYSREG_F_SIZE 1 137#define SYSREG_CONFIG0_J_SIZE 1
195#define SYSREG_MMUT_OFFSET 7 138#define SYSREG_CONFIG0_F_OFFSET 6
196#define SYSREG_MMUT_SIZE 3 139#define SYSREG_CONFIG0_F_SIZE 1
197#define SYSREG_AR_OFFSET 10 140#define SYSREG_MMUT_OFFSET 7
198#define SYSREG_AR_SIZE 3 141#define SYSREG_MMUT_SIZE 3
199#define SYSREG_AT_OFFSET 13 142#define SYSREG_AR_OFFSET 10
200#define SYSREG_AT_SIZE 3 143#define SYSREG_AR_SIZE 3
201#define SYSREG_PROCESSORREVISION_OFFSET 16 144#define SYSREG_AT_OFFSET 13
202#define SYSREG_PROCESSORREVISION_SIZE 8 145#define SYSREG_AT_SIZE 3
203#define SYSREG_PROCESSORID_OFFSET 24 146#define SYSREG_PROCESSORREVISION_OFFSET 16
204#define SYSREG_PROCESSORID_SIZE 8 147#define SYSREG_PROCESSORREVISION_SIZE 8
148#define SYSREG_PROCESSORID_OFFSET 24
149#define SYSREG_PROCESSORID_SIZE 8
205 150
206/* Bitfields in CONFIG1 */ 151/* Bitfields in CONFIG1 */
207#define SYSREG_DASS_OFFSET 0 152#define SYSREG_DASS_OFFSET 0
208#define SYSREG_DASS_SIZE 3 153#define SYSREG_DASS_SIZE 3
209#define SYSREG_DLSZ_OFFSET 3 154#define SYSREG_DLSZ_OFFSET 3
210#define SYSREG_DLSZ_SIZE 3 155#define SYSREG_DLSZ_SIZE 3
211#define SYSREG_DSET_OFFSET 6 156#define SYSREG_DSET_OFFSET 6
212#define SYSREG_DSET_SIZE 4 157#define SYSREG_DSET_SIZE 4
213#define SYSREG_IASS_OFFSET 10 158#define SYSREG_IASS_OFFSET 10
214#define SYSREG_IASS_SIZE 2 159#define SYSREG_IASS_SIZE 3
215#define SYSREG_ILSZ_OFFSET 13 160#define SYSREG_ILSZ_OFFSET 13
216#define SYSREG_ILSZ_SIZE 3 161#define SYSREG_ILSZ_SIZE 3
217#define SYSREG_ISET_OFFSET 16 162#define SYSREG_ISET_OFFSET 16
218#define SYSREG_ISET_SIZE 4 163#define SYSREG_ISET_SIZE 4
219#define SYSREG_DMMUSZ_OFFSET 20 164#define SYSREG_DMMUSZ_OFFSET 20
220#define SYSREG_DMMUSZ_SIZE 6 165#define SYSREG_DMMUSZ_SIZE 6
221#define SYSREG_IMMUSZ_OFFSET 26 166#define SYSREG_IMMUSZ_OFFSET 26
222#define SYSREG_IMMUSZ_SIZE 6 167#define SYSREG_IMMUSZ_SIZE 6
223
224/* Bitfields in COUNT */
225
226/* Bitfields in COMPARE */
227 168
228/* Bitfields in TLBEHI */ 169/* Bitfields in TLBEHI */
229#define SYSREG_ASID_OFFSET 0 170#define SYSREG_ASID_OFFSET 0
230#define SYSREG_ASID_SIZE 8 171#define SYSREG_ASID_SIZE 8
231#define SYSREG_TLBEHI_I_OFFSET 8 172#define SYSREG_TLBEHI_I_OFFSET 8
232#define SYSREG_TLBEHI_I_SIZE 1 173#define SYSREG_TLBEHI_I_SIZE 1
233#define SYSREG_TLBEHI_V_OFFSET 9 174#define SYSREG_TLBEHI_V_OFFSET 9
234#define SYSREG_TLBEHI_V_SIZE 1 175#define SYSREG_TLBEHI_V_SIZE 1
235#define SYSREG_VPN_OFFSET 10 176#define SYSREG_VPN_OFFSET 10
236#define SYSREG_VPN_SIZE 22 177#define SYSREG_VPN_SIZE 22
237 178
238/* Bitfields in TLBELO */ 179/* Bitfields in TLBELO */
239#define SYSREG_W_OFFSET 0 180#define SYSREG_W_OFFSET 0
240#define SYSREG_W_SIZE 1 181#define SYSREG_W_SIZE 1
241#define SYSREG_TLBELO_D_OFFSET 1 182#define SYSREG_TLBELO_D_OFFSET 1
242#define SYSREG_TLBELO_D_SIZE 1 183#define SYSREG_TLBELO_D_SIZE 1
243#define SYSREG_SZ_OFFSET 2 184#define SYSREG_SZ_OFFSET 2
244#define SYSREG_SZ_SIZE 2 185#define SYSREG_SZ_SIZE 2
245#define SYSREG_AP_OFFSET 4 186#define SYSREG_AP_OFFSET 4
246#define SYSREG_AP_SIZE 3 187#define SYSREG_AP_SIZE 3
247#define SYSREG_B_OFFSET 7 188#define SYSREG_B_OFFSET 7
248#define SYSREG_B_SIZE 1 189#define SYSREG_B_SIZE 1
249#define SYSREG_G_OFFSET 8 190#define SYSREG_G_OFFSET 8
250#define SYSREG_G_SIZE 1 191#define SYSREG_G_SIZE 1
251#define SYSREG_TLBELO_C_OFFSET 9 192#define SYSREG_TLBELO_C_OFFSET 9
252#define SYSREG_TLBELO_C_SIZE 1 193#define SYSREG_TLBELO_C_SIZE 1
253#define SYSREG_PFN_OFFSET 10 194#define SYSREG_PFN_OFFSET 10
254#define SYSREG_PFN_SIZE 22 195#define SYSREG_PFN_SIZE 22
255
256/* Bitfields in PTBR */
257
258/* Bitfields in TLBEAR */
259 196
260/* Bitfields in MMUCR */ 197/* Bitfields in MMUCR */
261#define SYSREG_E_OFFSET 0 198#define SYSREG_E_OFFSET 0
262#define SYSREG_E_SIZE 1 199#define SYSREG_E_SIZE 1
263#define SYSREG_M_OFFSET 1 200#define SYSREG_M_OFFSET 1
264#define SYSREG_M_SIZE 1 201#define SYSREG_M_SIZE 1
265#define SYSREG_MMUCR_I_OFFSET 2 202#define SYSREG_MMUCR_I_OFFSET 2
266#define SYSREG_MMUCR_I_SIZE 1 203#define SYSREG_MMUCR_I_SIZE 1
267#define SYSREG_MMUCR_N_OFFSET 3 204#define SYSREG_MMUCR_N_OFFSET 3
268#define SYSREG_MMUCR_N_SIZE 1 205#define SYSREG_MMUCR_N_SIZE 1
269#define SYSREG_MMUCR_S_OFFSET 4 206#define SYSREG_MMUCR_S_OFFSET 4
270#define SYSREG_MMUCR_S_SIZE 1 207#define SYSREG_MMUCR_S_SIZE 1
271#define SYSREG_DLA_OFFSET 8 208#define SYSREG_DLA_OFFSET 8
272#define SYSREG_DLA_SIZE 6 209#define SYSREG_DLA_SIZE 6
273#define SYSREG_DRP_OFFSET 14 210#define SYSREG_DRP_OFFSET 14
274#define SYSREG_DRP_SIZE 6 211#define SYSREG_DRP_SIZE 6
275#define SYSREG_ILA_OFFSET 20 212#define SYSREG_ILA_OFFSET 20
276#define SYSREG_ILA_SIZE 6 213#define SYSREG_ILA_SIZE 6
277#define SYSREG_IRP_OFFSET 26 214#define SYSREG_IRP_OFFSET 26
278#define SYSREG_IRP_SIZE 6 215#define SYSREG_IRP_SIZE 6
279
280/* Bitfields in TLBARLO */
281
282/* Bitfields in TLBARHI */
283
284/* Bitfields in PCCNT */
285
286/* Bitfields in PCNT0 */
287
288/* Bitfields in PCNT1 */
289 216
290/* Bitfields in PCCR */ 217/* Bitfields in PCCR */
291 218#define SYSREG_PCCR_R_OFFSET 1
292/* Bitfields in BEAR */ 219#define SYSREG_PCCR_R_SIZE 1
220#define SYSREG_PCCR_C_OFFSET 2
221#define SYSREG_PCCR_C_SIZE 1
222#define SYSREG_PCCR_S_OFFSET 3
223#define SYSREG_PCCR_S_SIZE 1
224#define SYSREG_IEC_OFFSET 4
225#define SYSREG_IEC_SIZE 1
226#define SYSREG_IE0_OFFSET 5
227#define SYSREG_IE0_SIZE 1
228#define SYSREG_IE1_OFFSET 6
229#define SYSREG_IE1_SIZE 1
230#define SYSREG_FC_OFFSET 8
231#define SYSREG_FC_SIZE 1
232#define SYSREG_F0_OFFSET 9
233#define SYSREG_F0_SIZE 1
234#define SYSREG_F1_OFFSET 10
235#define SYSREG_F1_SIZE 1
236#define SYSREG_CONF0_OFFSET 12
237#define SYSREG_CONF0_SIZE 6
238#define SYSREG_CONF1_OFFSET 18
239#define SYSREG_CONF1_SIZE 6
293 240
294/* Constants for ECR */ 241/* Constants for ECR */
295#define ECR_UNRECOVERABLE 0 242#define ECR_UNRECOVERABLE 0
296#define ECR_TLB_MULTIPLE 1 243#define ECR_TLB_MULTIPLE 1
297#define ECR_BUS_ERROR_WRITE 2 244#define ECR_BUS_ERROR_WRITE 2
298#define ECR_BUS_ERROR_READ 3 245#define ECR_BUS_ERROR_READ 3
299#define ECR_NMI 4 246#define ECR_NMI 4
300#define ECR_ADDR_ALIGN_X 5 247#define ECR_ADDR_ALIGN_X 5
301#define ECR_PROTECTION_X 6 248#define ECR_PROTECTION_X 6
302#define ECR_DEBUG 7 249#define ECR_DEBUG 7
303#define ECR_ILLEGAL_OPCODE 8 250#define ECR_ILLEGAL_OPCODE 8
304#define ECR_UNIMPL_INSTRUCTION 9 251#define ECR_UNIMPL_INSTRUCTION 9
305#define ECR_PRIVILEGE_VIOLATION 10 252#define ECR_PRIVILEGE_VIOLATION 10
306#define ECR_FPE 11 253#define ECR_FPE 11
307#define ECR_COPROC_ABSENT 12 254#define ECR_COPROC_ABSENT 12
308#define ECR_ADDR_ALIGN_R 13 255#define ECR_ADDR_ALIGN_R 13
309#define ECR_ADDR_ALIGN_W 14 256#define ECR_ADDR_ALIGN_W 14
310#define ECR_PROTECTION_R 15 257#define ECR_PROTECTION_R 15
311#define ECR_PROTECTION_W 16 258#define ECR_PROTECTION_W 16
312#define ECR_DTLB_MODIFIED 17 259#define ECR_DTLB_MODIFIED 17
313#define ECR_TLB_MISS_X 20 260#define ECR_TLB_MISS_X 20
314#define ECR_TLB_MISS_R 24 261#define ECR_TLB_MISS_R 24
315#define ECR_TLB_MISS_W 28 262#define ECR_TLB_MISS_W 28
316 263
317/* Bit manipulation macros */ 264/* Bit manipulation macros */
318#define SYSREG_BIT(name) (1 << SYSREG_##name##_OFFSET) 265#define SYSREG_BIT(name) \
319#define SYSREG_BF(name,value) (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) << SYSREG_##name##_OFFSET) 266 (1 << SYSREG_##name##_OFFSET)
320#define SYSREG_BFEXT(name,value) (((value) >> SYSREG_##name##_OFFSET) & ((1 << SYSREG_##name##_SIZE) - 1)) 267#define SYSREG_BF(name,value) \
321#define SYSREG_BFINS(name,value,old) (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) << SYSREG_##name##_OFFSET)) | SYSREG_BF(name,value)) 268 (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) \
269 << SYSREG_##name##_OFFSET)
270#define SYSREG_BFEXT(name,value)\
271 (((value) >> SYSREG_##name##_OFFSET) \
272 & ((1 << SYSREG_##name##_SIZE) - 1))
273#define SYSREG_BFINS(name,value,old) \
274 (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) \
275 << SYSREG_##name##_OFFSET)) \
276 | SYSREG_BF(name,value))
322 277
278/* Register access macros */
323#ifdef __CHECKER__ 279#ifdef __CHECKER__
324extern unsigned long __builtin_mfsr(unsigned long reg); 280extern unsigned long __builtin_mfsr(unsigned long reg);
325extern void __builtin_mtsr(unsigned long reg, unsigned long value); 281extern void __builtin_mtsr(unsigned long reg, unsigned long value);
326#endif 282#endif
327 283
328/* Register access macros */ 284#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg)
329#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg) 285#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
330#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
331 286
332#endif /* __ASM_AVR32_SYSREG_H__ */ 287#endif /* __ASM_AVR32_SYSREG_H */
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
index ac596058697..a8236bacc87 100644
--- a/include/asm-avr32/system.h
+++ b/include/asm-avr32/system.h
@@ -9,6 +9,7 @@
9#define __ASM_AVR32_SYSTEM_H 9#define __ASM_AVR32_SYSTEM_H
10 10
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/linkage.h>
12#include <linux/types.h> 13#include <linux/types.h>
13 14
14#include <asm/ptrace.h> 15#include <asm/ptrace.h>
@@ -140,15 +141,9 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
140 sizeof(*(ptr)))) 141 sizeof(*(ptr))))
141 142
142struct pt_regs; 143struct pt_regs;
143extern void __die(const char *, struct pt_regs *, unsigned long, 144void NORET_TYPE die(const char *str, struct pt_regs *regs, long err);
144 const char *, const char *, unsigned long); 145void _exception(long signr, struct pt_regs *regs, int code,
145extern void __die_if_kernel(const char *, struct pt_regs *, unsigned long, 146 unsigned long addr);
146 const char *, const char *, unsigned long);
147
148#define die(msg, regs, err) \
149 __die(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
150#define die_if_kernel(msg, regs, err) \
151 __die_if_kernel(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
152 147
153#define arch_align_stack(x) (x) 148#define arch_align_stack(x) (x)
154 149
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h
index d1f5b35ebd5..a2e606dd4f4 100644
--- a/include/asm-avr32/thread_info.h
+++ b/include/asm-avr32/thread_info.h
@@ -83,6 +83,7 @@ static inline struct thread_info *current_thread_info(void)
83#define TIF_SINGLE_STEP 6 /* single step after next break */ 83#define TIF_SINGLE_STEP 6 /* single step after next break */
84#define TIF_MEMDIE 7 84#define TIF_MEMDIE 7
85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */ 85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */
86#define TIF_CPU_GOING_TO_SLEEP 9 /* CPU is entering sleep 0 mode */
86#define TIF_USERSPACE 31 /* true if FS sets userspace */ 87#define TIF_USERSPACE 31 /* true if FS sets userspace */
87 88
88#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 89#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
@@ -94,6 +95,7 @@ static inline struct thread_info *current_thread_info(void)
94#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) 95#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
95#define _TIF_MEMDIE (1 << TIF_MEMDIE) 96#define _TIF_MEMDIE (1 << TIF_MEMDIE)
96#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 97#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
98#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
97 99
98/* XXX: These two masks must never span more than 16 bits! */ 100/* XXX: These two masks must never span more than 16 bits! */
99/* work to do on interrupt/exception return */ 101/* work to do on interrupt/exception return */
diff --git a/include/asm-avr32/uaccess.h b/include/asm-avr32/uaccess.h
index 74a679e9098..ed092395215 100644
--- a/include/asm-avr32/uaccess.h
+++ b/include/asm-avr32/uaccess.h
@@ -181,24 +181,23 @@ extern int __put_user_bad(void);
181 181
182#define __get_user_nocheck(x, ptr, size) \ 182#define __get_user_nocheck(x, ptr, size) \
183({ \ 183({ \
184 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ 184 unsigned long __gu_val = 0; \
185 int __gu_err = 0; \ 185 int __gu_err = 0; \
186 \ 186 \
187 switch (size) { \ 187 switch (size) { \
188 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \ 188 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \
189 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \ 189 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \
190 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \ 190 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \
191 case 8: __get_user_asm("d", __gu_val, ptr, __gu_err); break; \
192 default: __gu_err = __get_user_bad(); break; \ 191 default: __gu_err = __get_user_bad(); break; \
193 } \ 192 } \
194 \ 193 \
195 x = __gu_val; \ 194 x = (typeof(*(ptr)))__gu_val; \
196 __gu_err; \ 195 __gu_err; \
197}) 196})
198 197
199#define __get_user_check(x, ptr, size) \ 198#define __get_user_check(x, ptr, size) \
200({ \ 199({ \
201 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ 200 unsigned long __gu_val = 0; \
202 const typeof(*(ptr)) __user * __gu_addr = (ptr); \ 201 const typeof(*(ptr)) __user * __gu_addr = (ptr); \
203 int __gu_err = 0; \ 202 int __gu_err = 0; \
204 \ 203 \
@@ -216,10 +215,6 @@ extern int __put_user_bad(void);
216 __get_user_asm("w", __gu_val, __gu_addr, \ 215 __get_user_asm("w", __gu_val, __gu_addr, \
217 __gu_err); \ 216 __gu_err); \
218 break; \ 217 break; \
219 case 8: \
220 __get_user_asm("d", __gu_val, __gu_addr, \
221 __gu_err); \
222 break; \
223 default: \ 218 default: \
224 __gu_err = __get_user_bad(); \ 219 __gu_err = __get_user_bad(); \
225 break; \ 220 break; \
@@ -227,7 +222,7 @@ extern int __put_user_bad(void);
227 } else { \ 222 } else { \
228 __gu_err = -EFAULT; \ 223 __gu_err = -EFAULT; \
229 } \ 224 } \
230 x = __gu_val; \ 225 x = (typeof(*(ptr)))__gu_val; \
231 __gu_err; \ 226 __gu_err; \
232}) 227})
233 228
diff --git a/include/asm-cris/mmu_context.h b/include/asm-cris/mmu_context.h
index e6e659dc757..72ba08dcfd1 100644
--- a/include/asm-cris/mmu_context.h
+++ b/include/asm-cris/mmu_context.h
@@ -1,6 +1,8 @@
1#ifndef __CRIS_MMU_CONTEXT_H 1#ifndef __CRIS_MMU_CONTEXT_H
2#define __CRIS_MMU_CONTEXT_H 2#define __CRIS_MMU_CONTEXT_H
3 3
4#include <asm-generic/mm_hooks.h>
5
4extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 6extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
5extern void get_mmu_context(struct mm_struct *mm); 7extern void get_mmu_context(struct mm_struct *mm);
6extern void destroy_context(struct mm_struct *mm); 8extern void destroy_context(struct mm_struct *mm);
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 01cfdf1d6d3..5b18dfdf174 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -51,6 +51,8 @@
51 51
52#define SO_PEERSEC 31 52#define SO_PEERSEC 31
53#define SO_PASSSEC 34 53#define SO_PASSSEC 34
54#define SO_TIMESTAMPNS 35
55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
56 58
diff --git a/include/asm-cris/sockios.h b/include/asm-cris/sockios.h
index 6c4012f0b29..cfe7bfecf59 100644
--- a/include/asm-cris/sockios.h
+++ b/include/asm-cris/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-frv/mmu_context.h b/include/asm-frv/mmu_context.h
index 72edcaaccd5..c7daa395156 100644
--- a/include/asm-frv/mmu_context.h
+++ b/include/asm-frv/mmu_context.h
@@ -15,6 +15,7 @@
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm-generic/mm_hooks.h>
18 19
19static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 20static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
20{ 21{
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
index fb38fd329a5..8e827fa853f 100644
--- a/include/asm-frv/scatterlist.h
+++ b/include/asm-frv/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_SCATTERLIST_H 1#ifndef _ASM_SCATTERLIST_H
2#define _ASM_SCATTERLIST_H 2#define _ASM_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4/* 6/*
5 * Drivers must set either ->address or (preferred) ->page and ->offset 7 * Drivers must set either ->address or (preferred) ->page and ->offset
6 * to indicate where data must be transferred to/from. 8 * to indicate where data must be transferred to/from.
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index 31db18fc871..a823befd11d 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
54 56
diff --git a/include/asm-frv/sockios.h b/include/asm-frv/sockios.h
index 8a6e4b2074b..5dbdd13e6de 100644
--- a/include/asm-frv/sockios.h
+++ b/include/asm-frv/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* _ASM_SOCKIOS__ */ 13#endif /* _ASM_SOCKIOS__ */
13 14
diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h
index 8f4e3193342..a4a49370793 100644
--- a/include/asm-generic/div64.h
+++ b/include/asm-generic/div64.h
@@ -30,6 +30,11 @@
30 __rem; \ 30 __rem; \
31 }) 31 })
32 32
33static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
34{
35 return dividend / divisor;
36}
37
33#elif BITS_PER_LONG == 32 38#elif BITS_PER_LONG == 32
34 39
35extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); 40extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
@@ -49,6 +54,8 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
49 __rem; \ 54 __rem; \
50 }) 55 })
51 56
57extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
58
52#else /* BITS_PER_LONG == ?? */ 59#else /* BITS_PER_LONG == ?? */
53 60
54# error do_div() does not yet support the C64 61# error do_div() does not yet support the C64
diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h
new file mode 100644
index 00000000000..67dea812368
--- /dev/null
+++ b/include/asm-generic/mm_hooks.h
@@ -0,0 +1,18 @@
1/*
2 * Define generic no-op hooks for arch_dup_mmap and arch_exit_mmap, to
3 * be included in asm-FOO/mmu_context.h for any arch FOO which doesn't
4 * need to hook these.
5 */
6#ifndef _ASM_GENERIC_MM_HOOKS_H
7#define _ASM_GENERIC_MM_HOOKS_H
8
9static inline void arch_dup_mmap(struct mm_struct *oldmm,
10 struct mm_struct *mm)
11{
12}
13
14static inline void arch_exit_mmap(struct mm_struct *mm)
15{
16}
17
18#endif /* _ASM_GENERIC_MM_HOOKS_H */
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 19637626224..d984a904143 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_GENERIC_PERCPU_H_ 1#ifndef _ASM_GENERIC_PERCPU_H_
2#define _ASM_GENERIC_PERCPU_H_ 2#define _ASM_GENERIC_PERCPU_H_
3#include <linux/compiler.h> 3#include <linux/compiler.h>
4#include <linux/threads.h>
4 5
5#define __GENERIC_PER_CPU 6#define __GENERIC_PER_CPU
6#ifdef CONFIG_SMP 7#ifdef CONFIG_SMP
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 6d7e279b149..dc8f99ee305 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -139,8 +139,15 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
139#define pte_same(A,B) (pte_val(A) == pte_val(B)) 139#define pte_same(A,B) (pte_val(A) == pte_val(B))
140#endif 140#endif
141 141
142#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 142#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
143#define page_test_and_clear_dirty(page) (0) 143#define page_test_dirty(page) (0)
144#endif
145
146#ifndef __HAVE_ARCH_PAGE_CLEAR_DIRTY
147#define page_clear_dirty(page) do { } while (0)
148#endif
149
150#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
144#define pte_maybe_dirty(pte) pte_dirty(pte) 151#define pte_maybe_dirty(pte) pte_dirty(pte)
145#else 152#else
146#define pte_maybe_dirty(pte) (1) 153#define pte_maybe_dirty(pte) (1)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9fcc8d9fbb1..f3806a74c47 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -208,7 +208,7 @@
208 } 208 }
209 209
210#define NOTES \ 210#define NOTES \
211 .notes : { *(.note.*) } :note 211 .notes : { *(.note.*) } :note
212 212
213#define INITCALLS \ 213#define INITCALLS \
214 *(.initcall0.init) \ 214 *(.initcall0.init) \
diff --git a/include/asm-h8300/mmu_context.h b/include/asm-h8300/mmu_context.h
index 5c165f7bee0..f44b730da54 100644
--- a/include/asm-h8300/mmu_context.h
+++ b/include/asm-h8300/mmu_context.h
@@ -4,6 +4,7 @@
4#include <asm/setup.h> 4#include <asm/setup.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm-generic/mm_hooks.h>
7 8
8static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 10{
diff --git a/include/asm-h8300/scatterlist.h b/include/asm-h8300/scatterlist.h
index 7627f0cd1a2..985fdf54eac 100644
--- a/include/asm-h8300/scatterlist.h
+++ b/include/asm-h8300/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef _H8300_SCATTERLIST_H 1#ifndef _H8300_SCATTERLIST_H
2#define _H8300_SCATTERLIST_H 2#define _H8300_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page *page; 7 struct page *page;
6 unsigned int offset; 8 unsigned int offset;
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index ebc830fee0d..39911d8c968 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-h8300/sockios.h b/include/asm-h8300/sockios.h
index d005d9594cc..e9c7ec810c2 100644
--- a/include/asm-h8300/sockios.h
+++ b/include/asm-h8300/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ARCH_H8300_SOCKIOS__ */ 13#endif /* __ARCH_H8300_SOCKIOS__ */
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild
index 5ae93afc67e..cbf6e8f1087 100644
--- a/include/asm-i386/Kbuild
+++ b/include/asm-i386/Kbuild
@@ -3,8 +3,10 @@ include include/asm-generic/Kbuild.asm
3header-y += boot.h 3header-y += boot.h
4header-y += debugreg.h 4header-y += debugreg.h
5header-y += ldt.h 5header-y += ldt.h
6header-y += msr-index.h
6header-y += ptrace-abi.h 7header-y += ptrace-abi.h
7header-y += ucontext.h 8header-y += ucontext.h
8 9
10unifdef-y += msr.h
9unifdef-y += mtrr.h 11unifdef-y += mtrr.h
10unifdef-y += vm86.h 12unifdef-y += vm86.h
diff --git a/include/asm-i386/agp.h b/include/asm-i386/agp.h
index 9075083bab7..6af173dbf12 100644
--- a/include/asm-i386/agp.h
+++ b/include/asm-i386/agp.h
@@ -12,8 +12,10 @@
12 * data corruption on some CPUs. 12 * data corruption on some CPUs.
13 */ 13 */
14 14
15int map_page_into_agp(struct page *page); 15/* Caller's responsibility to call global_flush_tlb() for
16int unmap_page_from_agp(struct page *page); 16 * performance reasons */
17#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)
18#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL)
17#define flush_agp_mappings() global_flush_tlb() 19#define flush_agp_mappings() global_flush_tlb()
18 20
19/* Could use CLFLUSH here if the cpu supports it. But then it would 21/* Could use CLFLUSH here if the cpu supports it. But then it would
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index b8fa9557c53..0f70b379b02 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -1,8 +1,6 @@
1#ifndef _I386_ALTERNATIVE_H 1#ifndef _I386_ALTERNATIVE_H
2#define _I386_ALTERNATIVE_H 2#define _I386_ALTERNATIVE_H
3 3
4#ifdef __KERNEL__
5
6#include <asm/types.h> 4#include <asm/types.h>
7#include <linux/stddef.h> 5#include <linux/stddef.h>
8#include <linux/types.h> 6#include <linux/types.h>
@@ -16,6 +14,7 @@ struct alt_instr {
16 u8 pad; 14 u8 pad;
17}; 15};
18 16
17extern void alternative_instructions(void);
19extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); 18extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
20 19
21struct module; 20struct module;
@@ -31,9 +30,7 @@ static inline void alternatives_smp_module_add(struct module *mod, char *name,
31 void *text, void *text_end) {} 30 void *text, void *text_end) {}
32static inline void alternatives_smp_module_del(struct module *mod) {} 31static inline void alternatives_smp_module_del(struct module *mod) {}
33static inline void alternatives_smp_switch(int smp) {} 32static inline void alternatives_smp_switch(int smp) {}
34#endif 33#endif /* CONFIG_SMP */
35
36#endif
37 34
38/* 35/*
39 * Alternative instructions for different CPU types or capabilities. 36 * Alternative instructions for different CPU types or capabilities.
@@ -85,6 +82,21 @@ static inline void alternatives_smp_switch(int smp) {}
85 "663:\n\t" newinstr "\n664:\n" /* replacement */\ 82 "663:\n\t" newinstr "\n664:\n" /* replacement */\
86 ".previous" :: "i" (feature), ##input) 83 ".previous" :: "i" (feature), ##input)
87 84
85/* Like alternative_input, but with a single output argument */
86#define alternative_io(oldinstr, newinstr, feature, output, input...) \
87 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
88 ".section .altinstructions,\"a\"\n" \
89 " .align 4\n" \
90 " .long 661b\n" /* label */ \
91 " .long 663f\n" /* new instruction */ \
92 " .byte %c[feat]\n" /* feature bit */ \
93 " .byte 662b-661b\n" /* sourcelen */ \
94 " .byte 664f-663f\n" /* replacementlen */ \
95 ".previous\n" \
96 ".section .altinstr_replacement,\"ax\"\n" \
97 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
98 ".previous" : output : [feat] "i" (feature), ##input)
99
88/* 100/*
89 * Alternative inline assembly for SMP. 101 * Alternative inline assembly for SMP.
90 * 102 *
@@ -118,15 +130,17 @@ static inline void alternatives_smp_switch(int smp) {}
118#define LOCK_PREFIX "" 130#define LOCK_PREFIX ""
119#endif 131#endif
120 132
121struct paravirt_patch; 133struct paravirt_patch_site;
122#ifdef CONFIG_PARAVIRT 134#ifdef CONFIG_PARAVIRT
123void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end); 135void apply_paravirt(struct paravirt_patch_site *start,
136 struct paravirt_patch_site *end);
124#else 137#else
125static inline void 138static inline void
126apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end) 139apply_paravirt(struct paravirt_patch_site *start,
140 struct paravirt_patch_site *end)
127{} 141{}
128#define __start_parainstructions NULL 142#define __parainstructions NULL
129#define __stop_parainstructions NULL 143#define __parainstructions_end NULL
130#endif 144#endif
131 145
132#endif /* _I386_ALTERNATIVE_H */ 146#endif /* _I386_ALTERNATIVE_H */
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index a19810a08ae..1e8f6f252dd 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -2,6 +2,7 @@
2#define __ASM_APIC_H 2#define __ASM_APIC_H
3 3
4#include <linux/pm.h> 4#include <linux/pm.h>
5#include <linux/delay.h>
5#include <asm/fixmap.h> 6#include <asm/fixmap.h>
6#include <asm/apicdef.h> 7#include <asm/apicdef.h>
7#include <asm/processor.h> 8#include <asm/processor.h>
@@ -64,12 +65,8 @@ static __inline fastcall unsigned long native_apic_read(unsigned long reg)
64 return *((volatile unsigned long *)(APIC_BASE+reg)); 65 return *((volatile unsigned long *)(APIC_BASE+reg));
65} 66}
66 67
67static __inline__ void apic_wait_icr_idle(void) 68void apic_wait_icr_idle(void);
68{ 69unsigned long safe_apic_wait_icr_idle(void);
69 while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY )
70 cpu_relax();
71}
72
73int get_physical_broadcast(void); 70int get_physical_broadcast(void);
74 71
75#ifdef CONFIG_X86_GOOD_APIC 72#ifdef CONFIG_X86_GOOD_APIC
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index c90c7c49930..d28979ff73b 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -1,198 +1,12 @@
1/* 1/*
2 * include/asm-i386/bugs.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 *
6 * Cyrix stuff, June 1998 by:
7 * - Rafael R. Reilova (moved everything from head.S),
8 * <rreilova@ececs.uc.edu>
9 * - Channing Corn (tests & fixes),
10 * - Andrew D. Balsa (code cleanup).
11 */
12
13/*
14 * This is included by init/main.c to check for architecture-dependent bugs. 2 * This is included by init/main.c to check for architecture-dependent bugs.
15 * 3 *
16 * Needs: 4 * Needs:
17 * void check_bugs(void); 5 * void check_bugs(void);
18 */ 6 */
7#ifndef _ASM_I386_BUG_H
8#define _ASM_I386_BUG_H
19 9
20#include <linux/init.h> 10void check_bugs(void);
21#include <asm/processor.h>
22#include <asm/i387.h>
23#include <asm/msr.h>
24#include <asm/paravirt.h>
25
26static int __init no_halt(char *s)
27{
28 boot_cpu_data.hlt_works_ok = 0;
29 return 1;
30}
31
32__setup("no-hlt", no_halt);
33
34static int __init mca_pentium(char *s)
35{
36 mca_pentium_flag = 1;
37 return 1;
38}
39
40__setup("mca-pentium", mca_pentium);
41
42static int __init no_387(char *s)
43{
44 boot_cpu_data.hard_math = 0;
45 write_cr0(0xE | read_cr0());
46 return 1;
47}
48
49__setup("no387", no_387);
50
51static double __initdata x = 4195835.0;
52static double __initdata y = 3145727.0;
53
54/*
55 * This used to check for exceptions..
56 * However, it turns out that to support that,
57 * the XMM trap handlers basically had to
58 * be buggy. So let's have a correct XMM trap
59 * handler, and forget about printing out
60 * some status at boot.
61 *
62 * We should really only care about bugs here
63 * anyway. Not features.
64 */
65static void __init check_fpu(void)
66{
67 if (!boot_cpu_data.hard_math) {
68#ifndef CONFIG_MATH_EMULATION
69 printk(KERN_EMERG "No coprocessor found and no math emulation present.\n");
70 printk(KERN_EMERG "Giving up.\n");
71 for (;;) ;
72#endif
73 return;
74 }
75
76/* trap_init() enabled FXSR and company _before_ testing for FP problems here. */
77 /* Test for the divl bug.. */
78 __asm__("fninit\n\t"
79 "fldl %1\n\t"
80 "fdivl %2\n\t"
81 "fmull %2\n\t"
82 "fldl %1\n\t"
83 "fsubp %%st,%%st(1)\n\t"
84 "fistpl %0\n\t"
85 "fwait\n\t"
86 "fninit"
87 : "=m" (*&boot_cpu_data.fdiv_bug)
88 : "m" (*&x), "m" (*&y));
89 if (boot_cpu_data.fdiv_bug)
90 printk("Hmm, FPU with FDIV bug.\n");
91}
92
93static void __init check_hlt(void)
94{
95 if (paravirt_enabled())
96 return;
97
98 printk(KERN_INFO "Checking 'hlt' instruction... ");
99 if (!boot_cpu_data.hlt_works_ok) {
100 printk("disabled\n");
101 return;
102 }
103 halt();
104 halt();
105 halt();
106 halt();
107 printk("OK.\n");
108}
109
110/*
111 * Most 386 processors have a bug where a POPAD can lock the
112 * machine even from user space.
113 */
114
115static void __init check_popad(void)
116{
117#ifndef CONFIG_X86_POPAD_OK
118 int res, inp = (int) &res;
119
120 printk(KERN_INFO "Checking for popad bug... ");
121 __asm__ __volatile__(
122 "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx "
123 : "=&a" (res)
124 : "d" (inp)
125 : "ecx", "edi" );
126 /* If this fails, it means that any user program may lock the CPU hard. Too bad. */
127 if (res != 12345678) printk( "Buggy.\n" );
128 else printk( "OK.\n" );
129#endif
130}
131
132/*
133 * Check whether we are able to run this kernel safely on SMP.
134 *
135 * - In order to run on a i386, we need to be compiled for i386
136 * (for due to lack of "invlpg" and working WP on a i386)
137 * - In order to run on anything without a TSC, we need to be
138 * compiled for a i486.
139 * - In order to support the local APIC on a buggy Pentium machine,
140 * we need to be compiled with CONFIG_X86_GOOD_APIC disabled,
141 * which happens implicitly if compiled for a Pentium or lower
142 * (unless an advanced selection of CPU features is used) as an
143 * otherwise config implies a properly working local APIC without
144 * the need to do extra reads from the APIC.
145*/
146
147static void __init check_config(void)
148{
149/*
150 * We'd better not be a i386 if we're configured to use some
151 * i486+ only features! (WP works in supervisor mode and the
152 * new "invlpg" and "bswap" instructions)
153 */
154#if defined(CONFIG_X86_WP_WORKS_OK) || defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_BSWAP)
155 if (boot_cpu_data.x86 == 3)
156 panic("Kernel requires i486+ for 'invlpg' and other features");
157#endif
158
159/*
160 * If we configured ourselves for a TSC, we'd better have one!
161 */
162#ifdef CONFIG_X86_TSC
163 if (!cpu_has_tsc && !tsc_disable)
164 panic("Kernel compiled for Pentium+, requires TSC feature!");
165#endif
166
167/*
168 * If we were told we had a good local APIC, check for buggy Pentia,
169 * i.e. all B steppings and the C2 stepping of P54C when using their
170 * integrated APIC (see 11AP erratum in "Pentium Processor
171 * Specification Update").
172 */
173#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_GOOD_APIC)
174 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL
175 && cpu_has_apic
176 && boot_cpu_data.x86 == 5
177 && boot_cpu_data.x86_model == 2
178 && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11))
179 panic("Kernel compiled for PMMX+, assumes a local APIC without the read-before-write bug!");
180#endif
181}
182
183extern void alternative_instructions(void);
184 11
185static void __init check_bugs(void) 12#endif /* _ASM_I386_BUG_H */
186{
187 identify_cpu(&boot_cpu_data);
188#ifndef CONFIG_SMP
189 printk("CPU: ");
190 print_cpu_info(&boot_cpu_data);
191#endif
192 check_config();
193 check_fpu();
194 check_hlt();
195 check_popad();
196 init_utsname()->machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
197 alternative_instructions();
198}
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index d1b8e4ab6c1..f514e906643 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -7,7 +7,10 @@
7#ifndef __ASM_I386_CPUFEATURE_H 7#ifndef __ASM_I386_CPUFEATURE_H
8#define __ASM_I386_CPUFEATURE_H 8#define __ASM_I386_CPUFEATURE_H
9 9
10#ifndef __ASSEMBLY__
10#include <linux/bitops.h> 11#include <linux/bitops.h>
12#endif
13#include <asm/required-features.h>
11 14
12#define NCAPINTS 7 /* N 32-bit words worth of info */ 15#define NCAPINTS 7 /* N 32-bit words worth of info */
13 16
@@ -49,6 +52,7 @@
49#define X86_FEATURE_MP (1*32+19) /* MP Capable. */ 52#define X86_FEATURE_MP (1*32+19) /* MP Capable. */
50#define X86_FEATURE_NX (1*32+20) /* Execute Disable */ 53#define X86_FEATURE_NX (1*32+20) /* Execute Disable */
51#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ 54#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
55#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
52#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ 56#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
53#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ 57#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
54#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ 58#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */
@@ -76,6 +80,7 @@
76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 80#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 81#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
78#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */ 82#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
83#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
79 84
80/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 85/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
81#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 86#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
@@ -103,8 +108,12 @@
103#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */ 108#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
104#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */ 109#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
105 110
106#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) 111#define cpu_has(c, bit) \
107#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) 112 ((__builtin_constant_p(bit) && (bit) < 32 && \
113 (1UL << (bit)) & REQUIRED_MASK1) ? \
114 1 : \
115 test_bit(bit, (c)->x86_capability))
116#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
108 117
109#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU) 118#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
110#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME) 119#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME)
diff --git a/include/asm-i386/current.h b/include/asm-i386/current.h
index 5252ee0f6d7..d3524853991 100644
--- a/include/asm-i386/current.h
+++ b/include/asm-i386/current.h
@@ -1,14 +1,15 @@
1#ifndef _I386_CURRENT_H 1#ifndef _I386_CURRENT_H
2#define _I386_CURRENT_H 2#define _I386_CURRENT_H
3 3
4#include <asm/pda.h>
5#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <asm/percpu.h>
6 6
7struct task_struct; 7struct task_struct;
8 8
9DECLARE_PER_CPU(struct task_struct *, current_task);
9static __always_inline struct task_struct *get_current(void) 10static __always_inline struct task_struct *get_current(void)
10{ 11{
11 return read_pda(pcurrent); 12 return x86_read_percpu(current_task);
12} 13}
13 14
14#define current get_current() 15#define current get_current()
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 050831f34f7..c547403f341 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -12,23 +12,24 @@
12 12
13#include <asm/mmu.h> 13#include <asm/mmu.h>
14 14
15extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
16
17struct Xgt_desc_struct { 15struct Xgt_desc_struct {
18 unsigned short size; 16 unsigned short size;
19 unsigned long address __attribute__((packed)); 17 unsigned long address __attribute__((packed));
20 unsigned short pad; 18 unsigned short pad;
21} __attribute__ ((packed)); 19} __attribute__ ((packed));
22 20
23extern struct Xgt_desc_struct idt_descr; 21struct gdt_page
24DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr); 22{
25extern struct Xgt_desc_struct early_gdt_descr; 23 struct desc_struct gdt[GDT_ENTRIES];
24} __attribute__((aligned(PAGE_SIZE)));
25DECLARE_PER_CPU(struct gdt_page, gdt_page);
26 26
27static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) 27static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
28{ 28{
29 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; 29 return per_cpu(gdt_page, cpu).gdt;
30} 30}
31 31
32extern struct Xgt_desc_struct idt_descr;
32extern struct desc_struct idt_table[]; 33extern struct desc_struct idt_table[];
33extern void set_intr_gate(unsigned int irq, void * addr); 34extern void set_intr_gate(unsigned int irq, void * addr);
34 35
@@ -58,45 +59,33 @@ static inline void pack_gate(__u32 *a, __u32 *b,
58#ifdef CONFIG_PARAVIRT 59#ifdef CONFIG_PARAVIRT
59#include <asm/paravirt.h> 60#include <asm/paravirt.h>
60#else 61#else
61#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 62#define load_TR_desc() native_load_tr_desc()
62 63#define load_gdt(dtr) native_load_gdt(dtr)
63#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) 64#define load_idt(dtr) native_load_idt(dtr)
64#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr))
65#define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr)) 65#define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr))
66#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt)) 66#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt))
67 67
68#define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) 68#define store_gdt(dtr) native_store_gdt(dtr)
69#define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) 69#define store_idt(dtr) native_store_idt(dtr)
70#define store_tr(tr) __asm__ ("str %0":"=m" (tr)) 70#define store_tr(tr) (tr = native_store_tr())
71#define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt)) 71#define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt))
72 72
73#if TLS_SIZE != 24 73#define load_TLS(t, cpu) native_load_tls(t, cpu)
74# error update this code. 74#define set_ldt native_set_ldt
75#endif
76
77static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
78{
79#define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]
80 C(0); C(1); C(2);
81#undef C
82}
83 75
84#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 76#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) 77#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) 78#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
79#endif
87 80
88static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) 81static inline void write_dt_entry(struct desc_struct *dt,
82 int entry, u32 entry_low, u32 entry_high)
89{ 83{
90 __u32 *lp = (__u32 *)((char *)dt + entry*8); 84 dt[entry].a = entry_low;
91 *lp = entry_a; 85 dt[entry].b = entry_high;
92 *(lp+1) = entry_b;
93} 86}
94 87
95#define set_ldt native_set_ldt 88static inline void native_set_ldt(const void *addr, unsigned int entries)
96#endif /* CONFIG_PARAVIRT */
97
98static inline fastcall void native_set_ldt(const void *addr,
99 unsigned int entries)
100{ 89{
101 if (likely(entries == 0)) 90 if (likely(entries == 0))
102 __asm__ __volatile__("lldt %w0"::"q" (0)); 91 __asm__ __volatile__("lldt %w0"::"q" (0));
@@ -112,6 +101,48 @@ static inline fastcall void native_set_ldt(const void *addr,
112 } 101 }
113} 102}
114 103
104
105static inline void native_load_tr_desc(void)
106{
107 asm volatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8));
108}
109
110static inline void native_load_gdt(const struct Xgt_desc_struct *dtr)
111{
112 asm volatile("lgdt %0"::"m" (*dtr));
113}
114
115static inline void native_load_idt(const struct Xgt_desc_struct *dtr)
116{
117 asm volatile("lidt %0"::"m" (*dtr));
118}
119
120static inline void native_store_gdt(struct Xgt_desc_struct *dtr)
121{
122 asm ("sgdt %0":"=m" (*dtr));
123}
124
125static inline void native_store_idt(struct Xgt_desc_struct *dtr)
126{
127 asm ("sidt %0":"=m" (*dtr));
128}
129
130static inline unsigned long native_store_tr(void)
131{
132 unsigned long tr;
133 asm ("str %0":"=r" (tr));
134 return tr;
135}
136
137static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
138{
139 unsigned int i;
140 struct desc_struct *gdt = get_cpu_gdt_table(cpu);
141
142 for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
143 gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i];
144}
145
115static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) 146static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
116{ 147{
117 __u32 a, b; 148 __u32 a, b;
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h
index 75c67c785bb..438e980068b 100644
--- a/include/asm-i386/div64.h
+++ b/include/asm-i386/div64.h
@@ -1,6 +1,8 @@
1#ifndef __I386_DIV64 1#ifndef __I386_DIV64
2#define __I386_DIV64 2#define __I386_DIV64
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * do_div() is NOT a C function. It wants to return 7 * do_div() is NOT a C function. It wants to return
6 * two values (the quotient and the remainder), but 8 * two values (the quotient and the remainder), but
@@ -45,4 +47,6 @@ div_ll_X_l_rem(long long divs, long div, long *rem)
45 return dum2; 47 return dum2;
46 48
47} 49}
50
51extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
48#endif 52#endif
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index c5b8fc6109d..096a2a8eb1d 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -38,6 +38,7 @@ 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 int e820_any_mapped(u64 start, u64 end, unsigned type);
41extern void find_max_pfn(void); 42extern void find_max_pfn(void);
42extern void register_bootmem_low_pages(unsigned long max_low_pfn); 43extern void register_bootmem_low_pages(unsigned long max_low_pfn);
43extern void e820_register_memory(void); 44extern void e820_register_memory(void);
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 952b3ee3c9b..d304ab4161f 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -133,39 +133,31 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct
133#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs) 133#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
134 134
135#define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO)) 135#define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO))
136#define VDSO_BASE ((unsigned long)current->mm->context.vdso) 136#define VDSO_CURRENT_BASE ((unsigned long)current->mm->context.vdso)
137 137#define VDSO_PRELINK 0
138#ifdef CONFIG_COMPAT_VDSO
139# define VDSO_COMPAT_BASE VDSO_HIGH_BASE
140# define VDSO_PRELINK VDSO_HIGH_BASE
141#else
142# define VDSO_COMPAT_BASE VDSO_BASE
143# define VDSO_PRELINK 0
144#endif
145 138
146#define VDSO_SYM(x) \ 139#define VDSO_SYM(x) \
147 (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK) 140 (VDSO_CURRENT_BASE + (unsigned long)(x) - VDSO_PRELINK)
148 141
149#define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE) 142#define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE)
150#define VDSO_EHDR ((const struct elfhdr *) VDSO_COMPAT_BASE) 143#define VDSO_EHDR ((const struct elfhdr *) VDSO_CURRENT_BASE)
151 144
152extern void __kernel_vsyscall; 145extern void __kernel_vsyscall;
153 146
154#define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall) 147#define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall)
155 148
156#ifndef CONFIG_COMPAT_VDSO
157#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
158struct linux_binprm; 149struct linux_binprm;
150
151#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
159extern int arch_setup_additional_pages(struct linux_binprm *bprm, 152extern int arch_setup_additional_pages(struct linux_binprm *bprm,
160 int executable_stack); 153 int executable_stack);
161#endif
162 154
163extern unsigned int vdso_enabled; 155extern unsigned int vdso_enabled;
164 156
165#define ARCH_DLINFO \ 157#define ARCH_DLINFO \
166do if (vdso_enabled) { \ 158do if (vdso_enabled) { \
167 NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \ 159 NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \
168 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \ 160 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE); \
169} while (0) 161} while (0)
170 162
171#endif 163#endif
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index 3e9f610c35d..80ea052ee3a 100644
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -19,13 +19,9 @@
19 * Leave one empty page between vmalloc'ed areas and 19 * Leave one empty page between vmalloc'ed areas and
20 * the start of the fixmap. 20 * the start of the fixmap.
21 */ 21 */
22#ifndef CONFIG_COMPAT_VDSO
23extern unsigned long __FIXADDR_TOP; 22extern unsigned long __FIXADDR_TOP;
24#else 23#define FIXADDR_USER_START __fix_to_virt(FIX_VDSO)
25#define __FIXADDR_TOP 0xfffff000 24#define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1)
26#define FIXADDR_USER_START __fix_to_virt(FIX_VDSO)
27#define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1)
28#endif
29 25
30#ifndef __ASSEMBLY__ 26#ifndef __ASSEMBLY__
31#include <linux/kernel.h> 27#include <linux/kernel.h>
@@ -88,6 +84,9 @@ enum fixed_addresses {
88#ifdef CONFIG_PCI_MMCONFIG 84#ifdef CONFIG_PCI_MMCONFIG
89 FIX_PCIE_MCFG, 85 FIX_PCIE_MCFG,
90#endif 86#endif
87#ifdef CONFIG_PARAVIRT
88 FIX_PARAVIRT_BOOTMAP,
89#endif
91 __end_of_permanent_fixed_addresses, 90 __end_of_permanent_fixed_addresses,
92 /* temporary boot-time mappings, used before ioremap() is functional */ 91 /* temporary boot-time mappings, used before ioremap() is functional */
93#define NR_FIX_BTMAPS 16 92#define NR_FIX_BTMAPS 16
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h
index fd2be593b06..33e3ffe1766 100644
--- a/include/asm-i386/genapic.h
+++ b/include/asm-i386/genapic.h
@@ -36,7 +36,7 @@ struct genapic {
36 void (*init_apic_ldr)(void); 36 void (*init_apic_ldr)(void);
37 physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); 37 physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
38 38
39 void (*clustered_apic_check)(void); 39 void (*setup_apic_routing)(void);
40 int (*multi_timer_check)(int apic, int irq); 40 int (*multi_timer_check)(int apic, int irq);
41 int (*apicid_to_node)(int logical_apicid); 41 int (*apicid_to_node)(int logical_apicid);
42 int (*cpu_to_logical_apicid)(int cpu); 42 int (*cpu_to_logical_apicid)(int cpu);
@@ -99,7 +99,7 @@ struct genapic {
99 APICFUNC(check_apicid_present) \ 99 APICFUNC(check_apicid_present) \
100 APICFUNC(init_apic_ldr) \ 100 APICFUNC(init_apic_ldr) \
101 APICFUNC(ioapic_phys_id_map) \ 101 APICFUNC(ioapic_phys_id_map) \
102 APICFUNC(clustered_apic_check) \ 102 APICFUNC(setup_apic_routing) \
103 APICFUNC(multi_timer_check) \ 103 APICFUNC(multi_timer_check) \
104 APICFUNC(apicid_to_node) \ 104 APICFUNC(apicid_to_node) \
105 APICFUNC(cpu_to_logical_apicid) \ 105 APICFUNC(cpu_to_logical_apicid) \
@@ -122,6 +122,6 @@ struct genapic {
122 APICFUNC(phys_pkg_id) \ 122 APICFUNC(phys_pkg_id) \
123 } 123 }
124 124
125extern struct genapic *genapic, apic_default; 125extern struct genapic *genapic;
126 126
127#endif 127#endif
diff --git a/include/asm-i386/highmem.h b/include/asm-i386/highmem.h
index e9a34ebc25d..13cdcd66fff 100644
--- a/include/asm-i386/highmem.h
+++ b/include/asm-i386/highmem.h
@@ -24,6 +24,7 @@
24#include <linux/threads.h> 24#include <linux/threads.h>
25#include <asm/kmap_types.h> 25#include <asm/kmap_types.h>
26#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
27#include <asm/paravirt.h>
27 28
28/* declarations for highmem.c */ 29/* declarations for highmem.c */
29extern unsigned long highstart_pfn, highend_pfn; 30extern unsigned long highstart_pfn, highend_pfn;
@@ -67,11 +68,16 @@ extern void FASTCALL(kunmap_high(struct page *page));
67 68
68void *kmap(struct page *page); 69void *kmap(struct page *page);
69void kunmap(struct page *page); 70void kunmap(struct page *page);
71void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot);
70void *kmap_atomic(struct page *page, enum km_type type); 72void *kmap_atomic(struct page *page, enum km_type type);
71void kunmap_atomic(void *kvaddr, enum km_type type); 73void kunmap_atomic(void *kvaddr, enum km_type type);
72void *kmap_atomic_pfn(unsigned long pfn, enum km_type type); 74void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
73struct page *kmap_atomic_to_page(void *ptr); 75struct page *kmap_atomic_to_page(void *ptr);
74 76
77#ifndef CONFIG_PARAVIRT
78#define kmap_atomic_pte(page, type) kmap_atomic(page, type)
79#endif
80
75#define flush_cache_kmaps() do { } while (0) 81#define flush_cache_kmaps() do { } while (0)
76 82
77#endif /* __KERNEL__ */ 83#endif /* __KERNEL__ */
diff --git a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
index fc03cf9de5c..dddeedf504b 100644
--- a/include/asm-i386/hpet.h
+++ b/include/asm-i386/hpet.h
@@ -28,8 +28,6 @@
28 28
29#include <linux/timex.h> 29#include <linux/timex.h>
30 30
31#include <asm/fixmap.h>
32
33/* 31/*
34 * Documentation on HPET can be found at: 32 * Documentation on HPET can be found at:
35 * http://www.intel.com/ial/home/sp/pcmmspec.htm 33 * http://www.intel.com/ial/home/sp/pcmmspec.htm
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index 434936c732d..cdd1e248e3b 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -74,17 +74,18 @@ static inline void __save_init_fpu( struct task_struct *tsk )
74 task_thread_info(tsk)->status &= ~TS_USEDFPU; 74 task_thread_info(tsk)->status &= ~TS_USEDFPU;
75} 75}
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 \ 80 stts(); \
81 tsk->fpu_counter = 0; \ 81 } else \
82 tsk->fpu_counter = 0; \
82} while (0) 83} while (0)
83 84
84#define __clear_fpu( tsk ) \ 85#define __clear_fpu( tsk ) \
85do { \ 86do { \
86 if (task_thread_info(tsk)->status & TS_USEDFPU) { \ 87 if (task_thread_info(tsk)->status & TS_USEDFPU) { \
87 asm volatile("fnclex ; fwait"); \ 88 asm volatile("fnclex ; fwait"); \
88 task_thread_info(tsk)->status &= ~TS_USEDFPU; \ 89 task_thread_info(tsk)->status &= ~TS_USEDFPU; \
89 stts(); \ 90 stts(); \
90 } \ 91 } \
@@ -113,7 +114,7 @@ static inline void save_init_fpu( struct task_struct *tsk )
113 __clear_fpu( tsk ); \ 114 __clear_fpu( tsk ); \
114 preempt_enable(); \ 115 preempt_enable(); \
115} while (0) 116} while (0)
116 \ 117
117/* 118/*
118 * FPU state interaction... 119 * FPU state interaction...
119 */ 120 */
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 59fe616933c..e797586a5bf 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -250,19 +250,22 @@ static inline void flush_write_buffers(void)
250 250
251#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
252 252
253static inline void native_io_delay(void)
254{
255 asm volatile("outb %%al,$0x80" : : : "memory");
256}
257
253#if defined(CONFIG_PARAVIRT) 258#if defined(CONFIG_PARAVIRT)
254#include <asm/paravirt.h> 259#include <asm/paravirt.h>
255#else 260#else
256 261
257#define __SLOW_DOWN_IO "outb %%al,$0x80;"
258
259static inline void slow_down_io(void) { 262static inline void slow_down_io(void) {
260 __asm__ __volatile__( 263 native_io_delay();
261 __SLOW_DOWN_IO
262#ifdef REALLY_SLOW_IO 264#ifdef REALLY_SLOW_IO
263 __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO 265 native_io_delay();
266 native_io_delay();
267 native_io_delay();
264#endif 268#endif
265 : : );
266} 269}
267 270
268#endif 271#endif
diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h
index 11761cdaae1..9e15ce0006e 100644
--- a/include/asm-i386/irq.h
+++ b/include/asm-i386/irq.h
@@ -37,8 +37,6 @@ 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
42#ifdef CONFIG_HOTPLUG_CPU 40#ifdef CONFIG_HOTPLUG_CPU
43extern void fixup_irqs(cpumask_t map); 41extern void fixup_irqs(cpumask_t map);
44#endif 42#endif
diff --git a/include/asm-i386/irq_regs.h b/include/asm-i386/irq_regs.h
index a1b3f7f594a..3368b20c0b4 100644
--- a/include/asm-i386/irq_regs.h
+++ b/include/asm-i386/irq_regs.h
@@ -1,25 +1,27 @@
1/* 1/*
2 * Per-cpu current frame pointer - the location of the last exception frame on 2 * Per-cpu current frame pointer - the location of the last exception frame on
3 * the stack, stored in the PDA. 3 * the stack, stored in the per-cpu area.
4 * 4 *
5 * Jeremy Fitzhardinge <jeremy@goop.org> 5 * Jeremy Fitzhardinge <jeremy@goop.org>
6 */ 6 */
7#ifndef _ASM_I386_IRQ_REGS_H 7#ifndef _ASM_I386_IRQ_REGS_H
8#define _ASM_I386_IRQ_REGS_H 8#define _ASM_I386_IRQ_REGS_H
9 9
10#include <asm/pda.h> 10#include <asm/percpu.h>
11
12DECLARE_PER_CPU(struct pt_regs *, irq_regs);
11 13
12static inline struct pt_regs *get_irq_regs(void) 14static inline struct pt_regs *get_irq_regs(void)
13{ 15{
14 return read_pda(irq_regs); 16 return x86_read_percpu(irq_regs);
15} 17}
16 18
17static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) 19static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
18{ 20{
19 struct pt_regs *old_regs; 21 struct pt_regs *old_regs;
20 22
21 old_regs = read_pda(irq_regs); 23 old_regs = get_irq_regs();
22 write_pda(irq_regs, new_regs); 24 x86_write_percpu(irq_regs, new_regs);
23 25
24 return old_regs; 26 return old_regs;
25} 27}
diff --git a/include/asm-i386/irqflags.h b/include/asm-i386/irqflags.h
index 17b18cf4fe9..eff8585cb74 100644
--- a/include/asm-i386/irqflags.h
+++ b/include/asm-i386/irqflags.h
@@ -9,6 +9,43 @@
9 */ 9 */
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12#include <asm/processor-flags.h>
13
14#ifndef __ASSEMBLY__
15static inline unsigned long native_save_fl(void)
16{
17 unsigned long f;
18 asm volatile("pushfl ; popl %0":"=g" (f): /* no input */);
19 return f;
20}
21
22static inline void native_restore_fl(unsigned long f)
23{
24 asm volatile("pushl %0 ; popfl": /* no output */
25 :"g" (f)
26 :"memory", "cc");
27}
28
29static inline void native_irq_disable(void)
30{
31 asm volatile("cli": : :"memory");
32}
33
34static inline void native_irq_enable(void)
35{
36 asm volatile("sti": : :"memory");
37}
38
39static inline void native_safe_halt(void)
40{
41 asm volatile("sti; hlt": : :"memory");
42}
43
44static inline void native_halt(void)
45{
46 asm volatile("hlt": : :"memory");
47}
48#endif /* __ASSEMBLY__ */
12 49
13#ifdef CONFIG_PARAVIRT 50#ifdef CONFIG_PARAVIRT
14#include <asm/paravirt.h> 51#include <asm/paravirt.h>
@@ -17,35 +54,22 @@
17 54
18static inline unsigned long __raw_local_save_flags(void) 55static inline unsigned long __raw_local_save_flags(void)
19{ 56{
20 unsigned long flags; 57 return native_save_fl();
21
22 __asm__ __volatile__(
23 "pushfl ; popl %0"
24 : "=g" (flags)
25 : /* no input */
26 );
27
28 return flags;
29} 58}
30 59
31static inline void raw_local_irq_restore(unsigned long flags) 60static inline void raw_local_irq_restore(unsigned long flags)
32{ 61{
33 __asm__ __volatile__( 62 native_restore_fl(flags);
34 "pushl %0 ; popfl"
35 : /* no output */
36 :"g" (flags)
37 :"memory", "cc"
38 );
39} 63}
40 64
41static inline void raw_local_irq_disable(void) 65static inline void raw_local_irq_disable(void)
42{ 66{
43 __asm__ __volatile__("cli" : : : "memory"); 67 native_irq_disable();
44} 68}
45 69
46static inline void raw_local_irq_enable(void) 70static inline void raw_local_irq_enable(void)
47{ 71{
48 __asm__ __volatile__("sti" : : : "memory"); 72 native_irq_enable();
49} 73}
50 74
51/* 75/*
@@ -54,7 +78,7 @@ static inline void raw_local_irq_enable(void)
54 */ 78 */
55static inline void raw_safe_halt(void) 79static inline void raw_safe_halt(void)
56{ 80{
57 __asm__ __volatile__("sti; hlt" : : : "memory"); 81 native_safe_halt();
58} 82}
59 83
60/* 84/*
@@ -63,7 +87,7 @@ static inline void raw_safe_halt(void)
63 */ 87 */
64static inline void halt(void) 88static inline void halt(void)
65{ 89{
66 __asm__ __volatile__("hlt": : :"memory"); 90 native_halt();
67} 91}
68 92
69/* 93/*
@@ -96,7 +120,7 @@ static inline unsigned long __raw_local_irq_save(void)
96 120
97static inline int raw_irqs_disabled_flags(unsigned long flags) 121static inline int raw_irqs_disabled_flags(unsigned long flags)
98{ 122{
99 return !(flags & (1 << 9)); 123 return !(flags & X86_EFLAGS_IF);
100} 124}
101 125
102static inline int raw_irqs_disabled(void) 126static inline int raw_irqs_disabled(void)
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h
index 4dfc9f5ed03..bcb5b21de2d 100644
--- a/include/asm-i386/kexec.h
+++ b/include/asm-i386/kexec.h
@@ -21,7 +21,6 @@
21 21
22#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
23 23
24#include <asm/fixmap.h>
25#include <asm/ptrace.h> 24#include <asm/ptrace.h>
26#include <asm/string.h> 25#include <asm/string.h>
27 26
@@ -29,10 +28,6 @@
29 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. 28 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
30 * I.e. Maximum page that is mapped directly into kernel memory, 29 * I.e. Maximum page that is mapped directly into kernel memory,
31 * and kmap is not required. 30 * and kmap is not required.
32 *
33 * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
34 * calculation for the amount of memory directly mappable into the
35 * kernel memory space.
36 */ 31 */
37 32
38/* Maximum physical address we can use pages from */ 33/* Maximum physical address we can use pages from */
@@ -47,6 +42,9 @@
47/* The native architecture */ 42/* The native architecture */
48#define KEXEC_ARCH KEXEC_ARCH_386 43#define KEXEC_ARCH KEXEC_ARCH_386
49 44
45/* We can also handle crash dumps from 64 bit kernel. */
46#define vmcore_elf_check_arch_cross(x) ((x)->e_machine == EM_X86_64)
47
50#define MAX_NOTE_BYTES 1024 48#define MAX_NOTE_BYTES 1024
51 49
52/* CPU does not save ss and esp on stack if execution is already 50/* CPU does not save ss and esp on stack if execution is already
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h
index 18b19a77344..ebd319f838a 100644
--- a/include/asm-i386/mach-bigsmp/mach_apic.h
+++ b/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -71,7 +71,7 @@ static inline void init_apic_ldr(void)
71 apic_write_around(APIC_LDR, val); 71 apic_write_around(APIC_LDR, val);
72} 72}
73 73
74static inline void clustered_apic_check(void) 74static inline void setup_apic_routing(void)
75{ 75{
76 printk("Enabling APIC mode: %s. Using %d I/O APICs\n", 76 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
77 "Physflat", nr_ioapics); 77 "Physflat", nr_ioapics);
diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h
index 3ef6292db78..6db1c3babe9 100644
--- a/include/asm-i386/mach-default/mach_apic.h
+++ b/include/asm-i386/mach-default/mach_apic.h
@@ -54,7 +54,7 @@ static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
54 return phys_map; 54 return phys_map;
55} 55}
56 56
57static inline void clustered_apic_check(void) 57static inline void setup_apic_routing(void)
58{ 58{
59 printk("Enabling APIC mode: %s. Using %d I/O APICs\n", 59 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
60 "Flat", nr_ioapics); 60 "Flat", nr_ioapics);
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h
index 26333685a7f..2d978928a39 100644
--- a/include/asm-i386/mach-es7000/mach_apic.h
+++ b/include/asm-i386/mach-es7000/mach_apic.h
@@ -73,15 +73,8 @@ static inline void init_apic_ldr(void)
73 apic_write_around(APIC_LDR, val); 73 apic_write_around(APIC_LDR, val);
74} 74}
75 75
76extern void es7000_sw_apic(void);
77static inline void enable_apic_mode(void)
78{
79 es7000_sw_apic();
80 return;
81}
82
83extern int apic_version [MAX_APICS]; 76extern int apic_version [MAX_APICS];
84static inline void clustered_apic_check(void) 77static inline void setup_apic_routing(void)
85{ 78{
86 int apic = bios_cpu_apicid[smp_processor_id()]; 79 int apic = bios_cpu_apicid[smp_processor_id()];
87 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", 80 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
diff --git a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
index 24990e546da..b9fb784e1fd 100644
--- a/include/asm-i386/mach-es7000/mach_mpparse.h
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h
@@ -18,18 +18,6 @@ extern int parse_unisys_oem (char *oemptr);
18extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); 18extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
19extern void setup_unisys(void); 19extern void setup_unisys(void);
20 20
21static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
22 char *productid)
23{
24 if (mpc->mpc_oemptr) {
25 struct mp_config_oemtable *oem_table =
26 (struct mp_config_oemtable *)mpc->mpc_oemptr;
27 if (!strncmp(oem, "UNISYS", 6))
28 return parse_unisys_oem((char *)oem_table);
29 }
30 return 0;
31}
32
33#ifdef CONFIG_ACPI 21#ifdef CONFIG_ACPI
34 22
35static inline int es7000_check_dsdt(void) 23static inline int es7000_check_dsdt(void)
@@ -41,26 +29,6 @@ static inline int es7000_check_dsdt(void)
41 return 1; 29 return 1;
42 return 0; 30 return 0;
43} 31}
44
45/* Hook from generic ACPI tables.c */
46static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
47{
48 unsigned long oem_addr;
49 if (!find_unisys_acpi_oem_table(&oem_addr)) {
50 if (es7000_check_dsdt())
51 return parse_unisys_oem((char *)oem_addr);
52 else {
53 setup_unisys();
54 return 1;
55 }
56 }
57 return 0;
58}
59#else
60static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
61{
62 return 0;
63}
64#endif 32#endif
65 33
66#endif /* __ASM_MACH_MPPARSE_H */ 34#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-i386/mach-generic/mach_apic.h b/include/asm-i386/mach-generic/mach_apic.h
index d9dc039da94..a236e702152 100644
--- a/include/asm-i386/mach-generic/mach_apic.h
+++ b/include/asm-i386/mach-generic/mach_apic.h
@@ -13,7 +13,7 @@
13#define apic_id_registered (genapic->apic_id_registered) 13#define apic_id_registered (genapic->apic_id_registered)
14#define init_apic_ldr (genapic->init_apic_ldr) 14#define init_apic_ldr (genapic->init_apic_ldr)
15#define ioapic_phys_id_map (genapic->ioapic_phys_id_map) 15#define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
16#define clustered_apic_check (genapic->clustered_apic_check) 16#define setup_apic_routing (genapic->setup_apic_routing)
17#define multi_timer_check (genapic->multi_timer_check) 17#define multi_timer_check (genapic->multi_timer_check)
18#define apicid_to_node (genapic->apicid_to_node) 18#define apicid_to_node (genapic->apicid_to_node)
19#define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid) 19#define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid)
diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h
index 9d158095da8..5e5e7dd2692 100644
--- a/include/asm-i386/mach-numaq/mach_apic.h
+++ b/include/asm-i386/mach-numaq/mach_apic.h
@@ -34,7 +34,7 @@ static inline void init_apic_ldr(void)
34 /* Already done in NUMA-Q firmware */ 34 /* Already done in NUMA-Q firmware */
35} 35}
36 36
37static inline void clustered_apic_check(void) 37static inline void setup_apic_routing(void)
38{ 38{
39 printk("Enabling APIC mode: %s. Using %d I/O APICs\n", 39 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
40 "NUMA-Q", nr_ioapics); 40 "NUMA-Q", nr_ioapics);
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h
index 43e5bd8f4a1..732f776aab8 100644
--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -80,7 +80,7 @@ static inline int apic_id_registered(void)
80 return 1; 80 return 1;
81} 81}
82 82
83static inline void clustered_apic_check(void) 83static inline void setup_apic_routing(void)
84{ 84{
85 printk("Enabling APIC mode: Summit. Using %d I/O APICs\n", 85 printk("Enabling APIC mode: Summit. Using %d I/O APICs\n",
86 nr_ioapics); 86 nr_ioapics);
diff --git a/include/asm-i386/mach-summit/mach_mpparse.h b/include/asm-i386/mach-summit/mach_mpparse.h
index 94268399170..c2520539d93 100644
--- a/include/asm-i386/mach-summit/mach_mpparse.h
+++ b/include/asm-i386/mach-summit/mach_mpparse.h
@@ -30,7 +30,7 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
30 (!strncmp(productid, "VIGIL SMP", 9) 30 (!strncmp(productid, "VIGIL SMP", 9)
31 || !strncmp(productid, "EXA", 3) 31 || !strncmp(productid, "EXA", 3)
32 || !strncmp(productid, "RUTHLESS SMP", 12))){ 32 || !strncmp(productid, "RUTHLESS SMP", 12))){
33 mark_tsc_unstable(); 33 mark_tsc_unstable("Summit based system");
34 use_cyclone = 1; /*enable cyclone-timer*/ 34 use_cyclone = 1; /*enable cyclone-timer*/
35 setup_summit(); 35 setup_summit();
36 return 1; 36 return 1;
@@ -44,7 +44,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
44 if (!strncmp(oem_id, "IBM", 3) && 44 if (!strncmp(oem_id, "IBM", 3) &&
45 (!strncmp(oem_table_id, "SERVIGIL", 8) 45 (!strncmp(oem_table_id, "SERVIGIL", 8)
46 || !strncmp(oem_table_id, "EXA", 3))){ 46 || !strncmp(oem_table_id, "EXA", 3))){
47 mark_tsc_unstable(); 47 mark_tsc_unstable("Summit based system");
48 use_cyclone = 1; /*enable cyclone-timer*/ 48 use_cyclone = 1; /*enable cyclone-timer*/
49 setup_summit(); 49 setup_summit();
50 return 1; 50 return 1;
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h
index 18afe6b6fc4..efac6f0d139 100644
--- a/include/asm-i386/mach-visws/mach_apic.h
+++ b/include/asm-i386/mach-visws/mach_apic.h
@@ -47,7 +47,7 @@ static inline void summit_check(char *oem, char *productid)
47{ 47{
48} 48}
49 49
50static inline void clustered_apic_check(void) 50static inline void setup_apic_routing(void)
51{ 51{
52} 52}
53 53
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index e6aa30f8de5..8198d1cca1f 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -5,6 +5,16 @@
5#include <asm/atomic.h> 5#include <asm/atomic.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm/tlbflush.h> 7#include <asm/tlbflush.h>
8#include <asm/paravirt.h>
9#ifndef CONFIG_PARAVIRT
10#include <asm-generic/mm_hooks.h>
11
12static inline void paravirt_activate_mm(struct mm_struct *prev,
13 struct mm_struct *next)
14{
15}
16#endif /* !CONFIG_PARAVIRT */
17
8 18
9/* 19/*
10 * Used for LDT copy/destruction. 20 * Used for LDT copy/destruction.
@@ -65,7 +75,10 @@ static inline void switch_mm(struct mm_struct *prev,
65#define deactivate_mm(tsk, mm) \ 75#define deactivate_mm(tsk, mm) \
66 asm("movl %0,%%gs": :"r" (0)); 76 asm("movl %0,%%gs": :"r" (0));
67 77
68#define activate_mm(prev, next) \ 78#define activate_mm(prev, next) \
69 switch_mm((prev),(next),NULL) 79 do { \
80 paravirt_activate_mm(prev, next); \
81 switch_mm((prev),(next),NULL); \
82 } while(0);
70 83
71#endif 84#endif
diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
index 02f8f541cbe..7e5fda6c397 100644
--- a/include/asm-i386/module.h
+++ b/include/asm-i386/module.h
@@ -54,6 +54,8 @@ struct mod_arch_specific
54#define MODULE_PROC_FAMILY "CYRIXIII " 54#define MODULE_PROC_FAMILY "CYRIXIII "
55#elif defined CONFIG_MVIAC3_2 55#elif defined CONFIG_MVIAC3_2
56#define MODULE_PROC_FAMILY "VIAC3-2 " 56#define MODULE_PROC_FAMILY "VIAC3-2 "
57#elif defined CONFIG_MVIAC7
58#define MODULE_PROC_FAMILY "VIAC7 "
57#elif defined CONFIG_MGEODEGX1 59#elif defined CONFIG_MGEODEGX1
58#define MODULE_PROC_FAMILY "GEODEGX1 " 60#define MODULE_PROC_FAMILY "GEODEGX1 "
59#elif defined CONFIG_MGEODE_LX 61#elif defined CONFIG_MGEODE_LX
diff --git a/include/asm-i386/msr-index.h b/include/asm-i386/msr-index.h
new file mode 100644
index 00000000000..a02eb299134
--- /dev/null
+++ b/include/asm-i386/msr-index.h
@@ -0,0 +1,278 @@
1#ifndef __ASM_MSR_INDEX_H
2#define __ASM_MSR_INDEX_H
3
4/* CPU model specific register (MSR) numbers */
5
6/* x86-64 specific MSRs */
7#define MSR_EFER 0xc0000080 /* extended feature register */
8#define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target */
9#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */
10#define MSR_CSTAR 0xc0000083 /* compat mode SYSCALL target */
11#define MSR_SYSCALL_MASK 0xc0000084 /* EFLAGS mask for syscall */
12#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */
13#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */
14#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */
15
16/* EFER bits: */
17#define _EFER_SCE 0 /* SYSCALL/SYSRET */
18#define _EFER_LME 8 /* Long mode enable */
19#define _EFER_LMA 10 /* Long mode active (read-only) */
20#define _EFER_NX 11 /* No execute enable */
21
22#define EFER_SCE (1<<_EFER_SCE)
23#define EFER_LME (1<<_EFER_LME)
24#define EFER_LMA (1<<_EFER_LMA)
25#define EFER_NX (1<<_EFER_NX)
26
27/* Intel MSRs. Some also available on other CPUs */
28#define MSR_IA32_PERFCTR0 0x000000c1
29#define MSR_IA32_PERFCTR1 0x000000c2
30#define MSR_FSB_FREQ 0x000000cd
31
32#define MSR_MTRRcap 0x000000fe
33#define MSR_IA32_BBL_CR_CTL 0x00000119
34
35#define MSR_IA32_SYSENTER_CS 0x00000174
36#define MSR_IA32_SYSENTER_ESP 0x00000175
37#define MSR_IA32_SYSENTER_EIP 0x00000176
38
39#define MSR_IA32_MCG_CAP 0x00000179
40#define MSR_IA32_MCG_STATUS 0x0000017a
41#define MSR_IA32_MCG_CTL 0x0000017b
42
43#define MSR_IA32_PEBS_ENABLE 0x000003f1
44#define MSR_IA32_DS_AREA 0x00000600
45#define MSR_IA32_PERF_CAPABILITIES 0x00000345
46
47#define MSR_MTRRfix64K_00000 0x00000250
48#define MSR_MTRRfix16K_80000 0x00000258
49#define MSR_MTRRfix16K_A0000 0x00000259
50#define MSR_MTRRfix4K_C0000 0x00000268
51#define MSR_MTRRfix4K_C8000 0x00000269
52#define MSR_MTRRfix4K_D0000 0x0000026a
53#define MSR_MTRRfix4K_D8000 0x0000026b
54#define MSR_MTRRfix4K_E0000 0x0000026c
55#define MSR_MTRRfix4K_E8000 0x0000026d
56#define MSR_MTRRfix4K_F0000 0x0000026e
57#define MSR_MTRRfix4K_F8000 0x0000026f
58#define MSR_MTRRdefType 0x000002ff
59
60#define MSR_IA32_DEBUGCTLMSR 0x000001d9
61#define MSR_IA32_LASTBRANCHFROMIP 0x000001db
62#define MSR_IA32_LASTBRANCHTOIP 0x000001dc
63#define MSR_IA32_LASTINTFROMIP 0x000001dd
64#define MSR_IA32_LASTINTTOIP 0x000001de
65
66#define MSR_IA32_MC0_CTL 0x00000400
67#define MSR_IA32_MC0_STATUS 0x00000401
68#define MSR_IA32_MC0_ADDR 0x00000402
69#define MSR_IA32_MC0_MISC 0x00000403
70
71#define MSR_P6_PERFCTR0 0x000000c1
72#define MSR_P6_PERFCTR1 0x000000c2
73#define MSR_P6_EVNTSEL0 0x00000186
74#define MSR_P6_EVNTSEL1 0x00000187
75
76/* K7/K8 MSRs. Not complete. See the architecture manual for a more
77 complete list. */
78#define MSR_K7_EVNTSEL0 0xc0010000
79#define MSR_K7_PERFCTR0 0xc0010004
80#define MSR_K7_EVNTSEL1 0xc0010001
81#define MSR_K7_PERFCTR1 0xc0010005
82#define MSR_K7_EVNTSEL2 0xc0010002
83#define MSR_K7_PERFCTR2 0xc0010006
84#define MSR_K7_EVNTSEL3 0xc0010003
85#define MSR_K7_PERFCTR3 0xc0010007
86#define MSR_K8_TOP_MEM1 0xc001001a
87#define MSR_K7_CLK_CTL 0xc001001b
88#define MSR_K8_TOP_MEM2 0xc001001d
89#define MSR_K8_SYSCFG 0xc0010010
90
91#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */
92#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */
93#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */
94
95#define MSR_K7_HWCR 0xc0010015
96#define MSR_K8_HWCR 0xc0010015
97#define MSR_K7_FID_VID_CTL 0xc0010041
98#define MSR_K7_FID_VID_STATUS 0xc0010042
99#define MSR_K8_ENABLE_C1E 0xc0010055
100
101/* K6 MSRs */
102#define MSR_K6_EFER 0xc0000080
103#define MSR_K6_STAR 0xc0000081
104#define MSR_K6_WHCR 0xc0000082
105#define MSR_K6_UWCCR 0xc0000085
106#define MSR_K6_EPMR 0xc0000086
107#define MSR_K6_PSOR 0xc0000087
108#define MSR_K6_PFIR 0xc0000088
109
110/* Centaur-Hauls/IDT defined MSRs. */
111#define MSR_IDT_FCR1 0x00000107
112#define MSR_IDT_FCR2 0x00000108
113#define MSR_IDT_FCR3 0x00000109
114#define MSR_IDT_FCR4 0x0000010a
115
116#define MSR_IDT_MCR0 0x00000110
117#define MSR_IDT_MCR1 0x00000111
118#define MSR_IDT_MCR2 0x00000112
119#define MSR_IDT_MCR3 0x00000113
120#define MSR_IDT_MCR4 0x00000114
121#define MSR_IDT_MCR5 0x00000115
122#define MSR_IDT_MCR6 0x00000116
123#define MSR_IDT_MCR7 0x00000117
124#define MSR_IDT_MCR_CTRL 0x00000120
125
126/* VIA Cyrix defined MSRs*/
127#define MSR_VIA_FCR 0x00001107
128#define MSR_VIA_LONGHAUL 0x0000110a
129#define MSR_VIA_RNG 0x0000110b
130#define MSR_VIA_BCR2 0x00001147
131
132/* Transmeta defined MSRs */
133#define MSR_TMTA_LONGRUN_CTRL 0x80868010
134#define MSR_TMTA_LONGRUN_FLAGS 0x80868011
135#define MSR_TMTA_LRTI_READOUT 0x80868018
136#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a
137
138/* Intel defined MSRs. */
139#define MSR_IA32_P5_MC_ADDR 0x00000000
140#define MSR_IA32_P5_MC_TYPE 0x00000001
141#define MSR_IA32_TSC 0x00000010
142#define MSR_IA32_PLATFORM_ID 0x00000017
143#define MSR_IA32_EBL_CR_POWERON 0x0000002a
144
145#define MSR_IA32_APICBASE 0x0000001b
146#define MSR_IA32_APICBASE_BSP (1<<8)
147#define MSR_IA32_APICBASE_ENABLE (1<<11)
148#define MSR_IA32_APICBASE_BASE (0xfffff<<12)
149
150#define MSR_IA32_UCODE_WRITE 0x00000079
151#define MSR_IA32_UCODE_REV 0x0000008b
152
153#define MSR_IA32_PERF_STATUS 0x00000198
154#define MSR_IA32_PERF_CTL 0x00000199
155
156#define MSR_IA32_MPERF 0x000000e7
157#define MSR_IA32_APERF 0x000000e8
158
159#define MSR_IA32_THERM_CONTROL 0x0000019a
160#define MSR_IA32_THERM_INTERRUPT 0x0000019b
161#define MSR_IA32_THERM_STATUS 0x0000019c
162#define MSR_IA32_MISC_ENABLE 0x000001a0
163
164/* Intel Model 6 */
165#define MSR_P6_EVNTSEL0 0x00000186
166#define MSR_P6_EVNTSEL1 0x00000187
167
168/* P4/Xeon+ specific */
169#define MSR_IA32_MCG_EAX 0x00000180
170#define MSR_IA32_MCG_EBX 0x00000181
171#define MSR_IA32_MCG_ECX 0x00000182
172#define MSR_IA32_MCG_EDX 0x00000183
173#define MSR_IA32_MCG_ESI 0x00000184
174#define MSR_IA32_MCG_EDI 0x00000185
175#define MSR_IA32_MCG_EBP 0x00000186
176#define MSR_IA32_MCG_ESP 0x00000187
177#define MSR_IA32_MCG_EFLAGS 0x00000188
178#define MSR_IA32_MCG_EIP 0x00000189
179#define MSR_IA32_MCG_RESERVED 0x0000018a
180
181/* Pentium IV performance counter MSRs */
182#define MSR_P4_BPU_PERFCTR0 0x00000300
183#define MSR_P4_BPU_PERFCTR1 0x00000301
184#define MSR_P4_BPU_PERFCTR2 0x00000302
185#define MSR_P4_BPU_PERFCTR3 0x00000303
186#define MSR_P4_MS_PERFCTR0 0x00000304
187#define MSR_P4_MS_PERFCTR1 0x00000305
188#define MSR_P4_MS_PERFCTR2 0x00000306
189#define MSR_P4_MS_PERFCTR3 0x00000307
190#define MSR_P4_FLAME_PERFCTR0 0x00000308
191#define MSR_P4_FLAME_PERFCTR1 0x00000309
192#define MSR_P4_FLAME_PERFCTR2 0x0000030a
193#define MSR_P4_FLAME_PERFCTR3 0x0000030b
194#define MSR_P4_IQ_PERFCTR0 0x0000030c
195#define MSR_P4_IQ_PERFCTR1 0x0000030d
196#define MSR_P4_IQ_PERFCTR2 0x0000030e
197#define MSR_P4_IQ_PERFCTR3 0x0000030f
198#define MSR_P4_IQ_PERFCTR4 0x00000310
199#define MSR_P4_IQ_PERFCTR5 0x00000311
200#define MSR_P4_BPU_CCCR0 0x00000360
201#define MSR_P4_BPU_CCCR1 0x00000361
202#define MSR_P4_BPU_CCCR2 0x00000362
203#define MSR_P4_BPU_CCCR3 0x00000363
204#define MSR_P4_MS_CCCR0 0x00000364
205#define MSR_P4_MS_CCCR1 0x00000365
206#define MSR_P4_MS_CCCR2 0x00000366
207#define MSR_P4_MS_CCCR3 0x00000367
208#define MSR_P4_FLAME_CCCR0 0x00000368
209#define MSR_P4_FLAME_CCCR1 0x00000369
210#define MSR_P4_FLAME_CCCR2 0x0000036a
211#define MSR_P4_FLAME_CCCR3 0x0000036b
212#define MSR_P4_IQ_CCCR0 0x0000036c
213#define MSR_P4_IQ_CCCR1 0x0000036d
214#define MSR_P4_IQ_CCCR2 0x0000036e
215#define MSR_P4_IQ_CCCR3 0x0000036f
216#define MSR_P4_IQ_CCCR4 0x00000370
217#define MSR_P4_IQ_CCCR5 0x00000371
218#define MSR_P4_ALF_ESCR0 0x000003ca
219#define MSR_P4_ALF_ESCR1 0x000003cb
220#define MSR_P4_BPU_ESCR0 0x000003b2
221#define MSR_P4_BPU_ESCR1 0x000003b3
222#define MSR_P4_BSU_ESCR0 0x000003a0
223#define MSR_P4_BSU_ESCR1 0x000003a1
224#define MSR_P4_CRU_ESCR0 0x000003b8
225#define MSR_P4_CRU_ESCR1 0x000003b9
226#define MSR_P4_CRU_ESCR2 0x000003cc
227#define MSR_P4_CRU_ESCR3 0x000003cd
228#define MSR_P4_CRU_ESCR4 0x000003e0
229#define MSR_P4_CRU_ESCR5 0x000003e1
230#define MSR_P4_DAC_ESCR0 0x000003a8
231#define MSR_P4_DAC_ESCR1 0x000003a9
232#define MSR_P4_FIRM_ESCR0 0x000003a4
233#define MSR_P4_FIRM_ESCR1 0x000003a5
234#define MSR_P4_FLAME_ESCR0 0x000003a6
235#define MSR_P4_FLAME_ESCR1 0x000003a7
236#define MSR_P4_FSB_ESCR0 0x000003a2
237#define MSR_P4_FSB_ESCR1 0x000003a3
238#define MSR_P4_IQ_ESCR0 0x000003ba
239#define MSR_P4_IQ_ESCR1 0x000003bb
240#define MSR_P4_IS_ESCR0 0x000003b4
241#define MSR_P4_IS_ESCR1 0x000003b5
242#define MSR_P4_ITLB_ESCR0 0x000003b6
243#define MSR_P4_ITLB_ESCR1 0x000003b7
244#define MSR_P4_IX_ESCR0 0x000003c8
245#define MSR_P4_IX_ESCR1 0x000003c9
246#define MSR_P4_MOB_ESCR0 0x000003aa
247#define MSR_P4_MOB_ESCR1 0x000003ab
248#define MSR_P4_MS_ESCR0 0x000003c0
249#define MSR_P4_MS_ESCR1 0x000003c1
250#define MSR_P4_PMH_ESCR0 0x000003ac
251#define MSR_P4_PMH_ESCR1 0x000003ad
252#define MSR_P4_RAT_ESCR0 0x000003bc
253#define MSR_P4_RAT_ESCR1 0x000003bd
254#define MSR_P4_SAAT_ESCR0 0x000003ae
255#define MSR_P4_SAAT_ESCR1 0x000003af
256#define MSR_P4_SSU_ESCR0 0x000003be
257#define MSR_P4_SSU_ESCR1 0x000003bf /* guess: not in manual */
258
259#define MSR_P4_TBPU_ESCR0 0x000003c2
260#define MSR_P4_TBPU_ESCR1 0x000003c3
261#define MSR_P4_TC_ESCR0 0x000003c4
262#define MSR_P4_TC_ESCR1 0x000003c5
263#define MSR_P4_U2L_ESCR0 0x000003b0
264#define MSR_P4_U2L_ESCR1 0x000003b1
265
266/* Intel Core-based CPU performance counters */
267#define MSR_CORE_PERF_FIXED_CTR0 0x00000309
268#define MSR_CORE_PERF_FIXED_CTR1 0x0000030a
269#define MSR_CORE_PERF_FIXED_CTR2 0x0000030b
270#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x0000038d
271#define MSR_CORE_PERF_GLOBAL_STATUS 0x0000038e
272#define MSR_CORE_PERF_GLOBAL_CTRL 0x0000038f
273#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x00000390
274
275/* Geode defined MSRs */
276#define MSR_GEODE_BUSCONT_CONF0 0x00001900
277
278#endif /* __ASM_MSR_INDEX_H */
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index 2ad3f30b1a6..9559894c765 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -1,6 +1,79 @@
1#ifndef __ASM_MSR_H 1#ifndef __ASM_MSR_H
2#define __ASM_MSR_H 2#define __ASM_MSR_H
3 3
4#include <asm/msr-index.h>
5
6#ifdef __KERNEL__
7#ifndef __ASSEMBLY__
8
9#include <asm/errno.h>
10
11static inline unsigned long long native_read_msr(unsigned int msr)
12{
13 unsigned long long val;
14
15 asm volatile("rdmsr" : "=A" (val) : "c" (msr));
16 return val;
17}
18
19static inline unsigned long long native_read_msr_safe(unsigned int msr,
20 int *err)
21{
22 unsigned long long val;
23
24 asm volatile("2: rdmsr ; xorl %0,%0\n"
25 "1:\n\t"
26 ".section .fixup,\"ax\"\n\t"
27 "3: movl %3,%0 ; jmp 1b\n\t"
28 ".previous\n\t"
29 ".section __ex_table,\"a\"\n"
30 " .align 4\n\t"
31 " .long 2b,3b\n\t"
32 ".previous"
33 : "=r" (*err), "=A" (val)
34 : "c" (msr), "i" (-EFAULT));
35
36 return val;
37}
38
39static inline void native_write_msr(unsigned int msr, unsigned long long val)
40{
41 asm volatile("wrmsr" : : "c" (msr), "A"(val));
42}
43
44static inline int native_write_msr_safe(unsigned int msr,
45 unsigned long long val)
46{
47 int err;
48 asm volatile("2: wrmsr ; xorl %0,%0\n"
49 "1:\n\t"
50 ".section .fixup,\"ax\"\n\t"
51 "3: movl %4,%0 ; jmp 1b\n\t"
52 ".previous\n\t"
53 ".section __ex_table,\"a\"\n"
54 " .align 4\n\t"
55 " .long 2b,3b\n\t"
56 ".previous"
57 : "=a" (err)
58 : "c" (msr), "0" ((u32)val), "d" ((u32)(val>>32)),
59 "i" (-EFAULT));
60 return err;
61}
62
63static inline unsigned long long native_read_tsc(void)
64{
65 unsigned long long val;
66 asm volatile("rdtsc" : "=A" (val));
67 return val;
68}
69
70static inline unsigned long long native_read_pmc(void)
71{
72 unsigned long long val;
73 asm volatile("rdpmc" : "=A" (val));
74 return val;
75}
76
4#ifdef CONFIG_PARAVIRT 77#ifdef CONFIG_PARAVIRT
5#include <asm/paravirt.h> 78#include <asm/paravirt.h>
6#else 79#else
@@ -11,22 +84,20 @@
11 * pointer indirection), this allows gcc to optimize better 84 * pointer indirection), this allows gcc to optimize better
12 */ 85 */
13 86
14#define rdmsr(msr,val1,val2) \ 87#define rdmsr(msr,val1,val2) \
15 __asm__ __volatile__("rdmsr" \ 88 do { \
16 : "=a" (val1), "=d" (val2) \ 89 unsigned long long __val = native_read_msr(msr); \
17 : "c" (msr)) 90 val1 = __val; \
91 val2 = __val >> 32; \
92 } while(0)
18 93
19#define wrmsr(msr,val1,val2) \ 94#define wrmsr(msr,val1,val2) \
20 __asm__ __volatile__("wrmsr" \ 95 native_write_msr(msr, ((unsigned long long)val2 << 32) | val1)
21 : /* no outputs */ \
22 : "c" (msr), "a" (val1), "d" (val2))
23 96
24#define rdmsrl(msr,val) do { \ 97#define rdmsrl(msr,val) \
25 unsigned long l__,h__; \ 98 do { \
26 rdmsr (msr, l__, h__); \ 99 (val) = native_read_msr(msr); \
27 val = l__; \ 100 } while(0)
28 val |= ((u64)h__<<32); \
29} while(0)
30 101
31static inline void wrmsrl (unsigned long msr, unsigned long long val) 102static inline void wrmsrl (unsigned long msr, unsigned long long val)
32{ 103{
@@ -37,50 +108,41 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
37} 108}
38 109
39/* wrmsr with exception handling */ 110/* wrmsr with exception handling */
40#define wrmsr_safe(msr,a,b) ({ int ret__; \ 111#define wrmsr_safe(msr,val1,val2) \
41 asm volatile("2: wrmsr ; xorl %0,%0\n" \ 112 (native_write_msr_safe(msr, ((unsigned long long)val2 << 32) | val1))
42 "1:\n\t" \
43 ".section .fixup,\"ax\"\n\t" \
44 "3: movl %4,%0 ; jmp 1b\n\t" \
45 ".previous\n\t" \
46 ".section __ex_table,\"a\"\n" \
47 " .align 4\n\t" \
48 " .long 2b,3b\n\t" \
49 ".previous" \
50 : "=a" (ret__) \
51 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\
52 ret__; })
53 113
54/* rdmsr with exception handling */ 114/* rdmsr with exception handling */
55#define rdmsr_safe(msr,a,b) ({ int ret__; \ 115#define rdmsr_safe(msr,p1,p2) \
56 asm volatile("2: rdmsr ; xorl %0,%0\n" \ 116 ({ \
57 "1:\n\t" \ 117 int __err; \
58 ".section .fixup,\"ax\"\n\t" \ 118 unsigned long long __val = native_read_msr_safe(msr, &__err);\
59 "3: movl %4,%0 ; jmp 1b\n\t" \ 119 (*p1) = __val; \
60 ".previous\n\t" \ 120 (*p2) = __val >> 32; \
61 ".section __ex_table,\"a\"\n" \ 121 __err; \
62 " .align 4\n\t" \ 122 })
63 " .long 2b,3b\n\t" \ 123
64 ".previous" \ 124#define rdtsc(low,high) \
65 : "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \ 125 do { \
66 : "c" (msr), "i" (-EFAULT));\ 126 u64 _l = native_read_tsc(); \
67 ret__; }) 127 (low) = (u32)_l; \
68 128 (high) = _l >> 32; \
69#define rdtsc(low,high) \ 129 } while(0)
70 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) 130
71 131#define rdtscl(low) \
72#define rdtscl(low) \ 132 do { \
73 __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx") 133 (low) = native_read_tsc(); \
74 134 } while(0)
75#define rdtscll(val) \ 135
76 __asm__ __volatile__("rdtsc" : "=A" (val)) 136#define rdtscll(val) ((val) = native_read_tsc())
77 137
78#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 138#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
79 139
80#define rdpmc(counter,low,high) \ 140#define rdpmc(counter,low,high) \
81 __asm__ __volatile__("rdpmc" \ 141 do { \
82 : "=a" (low), "=d" (high) \ 142 u64 _l = native_read_pmc(); \
83 : "c" (counter)) 143 low = (u32)_l; \
144 high = _l >> 32; \
145 } while(0)
84#endif /* !CONFIG_PARAVIRT */ 146#endif /* !CONFIG_PARAVIRT */
85 147
86#ifdef CONFIG_SMP 148#ifdef CONFIG_SMP
@@ -96,234 +158,6 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
96 wrmsr(msr_no, l, h); 158 wrmsr(msr_no, l, h);
97} 159}
98#endif /* CONFIG_SMP */ 160#endif /* CONFIG_SMP */
99 161#endif
100/* symbolic names for some interesting MSRs */ 162#endif
101/* Intel defined MSRs. */
102#define MSR_IA32_P5_MC_ADDR 0
103#define MSR_IA32_P5_MC_TYPE 1
104#define MSR_IA32_PLATFORM_ID 0x17
105#define MSR_IA32_EBL_CR_POWERON 0x2a
106
107#define MSR_IA32_APICBASE 0x1b
108#define MSR_IA32_APICBASE_BSP (1<<8)
109#define MSR_IA32_APICBASE_ENABLE (1<<11)
110#define MSR_IA32_APICBASE_BASE (0xfffff<<12)
111
112#define MSR_IA32_UCODE_WRITE 0x79
113#define MSR_IA32_UCODE_REV 0x8b
114
115#define MSR_P6_PERFCTR0 0xc1
116#define MSR_P6_PERFCTR1 0xc2
117#define MSR_FSB_FREQ 0xcd
118
119
120#define MSR_IA32_BBL_CR_CTL 0x119
121
122#define MSR_IA32_SYSENTER_CS 0x174
123#define MSR_IA32_SYSENTER_ESP 0x175
124#define MSR_IA32_SYSENTER_EIP 0x176
125
126#define MSR_IA32_MCG_CAP 0x179
127#define MSR_IA32_MCG_STATUS 0x17a
128#define MSR_IA32_MCG_CTL 0x17b
129
130/* P4/Xeon+ specific */
131#define MSR_IA32_MCG_EAX 0x180
132#define MSR_IA32_MCG_EBX 0x181
133#define MSR_IA32_MCG_ECX 0x182
134#define MSR_IA32_MCG_EDX 0x183
135#define MSR_IA32_MCG_ESI 0x184
136#define MSR_IA32_MCG_EDI 0x185
137#define MSR_IA32_MCG_EBP 0x186
138#define MSR_IA32_MCG_ESP 0x187
139#define MSR_IA32_MCG_EFLAGS 0x188
140#define MSR_IA32_MCG_EIP 0x189
141#define MSR_IA32_MCG_RESERVED 0x18A
142
143#define MSR_P6_EVNTSEL0 0x186
144#define MSR_P6_EVNTSEL1 0x187
145
146#define MSR_IA32_PERF_STATUS 0x198
147#define MSR_IA32_PERF_CTL 0x199
148
149#define MSR_IA32_MPERF 0xE7
150#define MSR_IA32_APERF 0xE8
151
152#define MSR_IA32_THERM_CONTROL 0x19a
153#define MSR_IA32_THERM_INTERRUPT 0x19b
154#define MSR_IA32_THERM_STATUS 0x19c
155#define MSR_IA32_MISC_ENABLE 0x1a0
156
157#define MSR_IA32_DEBUGCTLMSR 0x1d9
158#define MSR_IA32_LASTBRANCHFROMIP 0x1db
159#define MSR_IA32_LASTBRANCHTOIP 0x1dc
160#define MSR_IA32_LASTINTFROMIP 0x1dd
161#define MSR_IA32_LASTINTTOIP 0x1de
162
163#define MSR_IA32_MC0_CTL 0x400
164#define MSR_IA32_MC0_STATUS 0x401
165#define MSR_IA32_MC0_ADDR 0x402
166#define MSR_IA32_MC0_MISC 0x403
167
168#define MSR_IA32_PEBS_ENABLE 0x3f1
169#define MSR_IA32_DS_AREA 0x600
170#define MSR_IA32_PERF_CAPABILITIES 0x345
171
172/* Pentium IV performance counter MSRs */
173#define MSR_P4_BPU_PERFCTR0 0x300
174#define MSR_P4_BPU_PERFCTR1 0x301
175#define MSR_P4_BPU_PERFCTR2 0x302
176#define MSR_P4_BPU_PERFCTR3 0x303
177#define MSR_P4_MS_PERFCTR0 0x304
178#define MSR_P4_MS_PERFCTR1 0x305
179#define MSR_P4_MS_PERFCTR2 0x306
180#define MSR_P4_MS_PERFCTR3 0x307
181#define MSR_P4_FLAME_PERFCTR0 0x308
182#define MSR_P4_FLAME_PERFCTR1 0x309
183#define MSR_P4_FLAME_PERFCTR2 0x30a
184#define MSR_P4_FLAME_PERFCTR3 0x30b
185#define MSR_P4_IQ_PERFCTR0 0x30c
186#define MSR_P4_IQ_PERFCTR1 0x30d
187#define MSR_P4_IQ_PERFCTR2 0x30e
188#define MSR_P4_IQ_PERFCTR3 0x30f
189#define MSR_P4_IQ_PERFCTR4 0x310
190#define MSR_P4_IQ_PERFCTR5 0x311
191#define MSR_P4_BPU_CCCR0 0x360
192#define MSR_P4_BPU_CCCR1 0x361
193#define MSR_P4_BPU_CCCR2 0x362
194#define MSR_P4_BPU_CCCR3 0x363
195#define MSR_P4_MS_CCCR0 0x364
196#define MSR_P4_MS_CCCR1 0x365
197#define MSR_P4_MS_CCCR2 0x366
198#define MSR_P4_MS_CCCR3 0x367
199#define MSR_P4_FLAME_CCCR0 0x368
200#define MSR_P4_FLAME_CCCR1 0x369
201#define MSR_P4_FLAME_CCCR2 0x36a
202#define MSR_P4_FLAME_CCCR3 0x36b
203#define MSR_P4_IQ_CCCR0 0x36c
204#define MSR_P4_IQ_CCCR1 0x36d
205#define MSR_P4_IQ_CCCR2 0x36e
206#define MSR_P4_IQ_CCCR3 0x36f
207#define MSR_P4_IQ_CCCR4 0x370
208#define MSR_P4_IQ_CCCR5 0x371
209#define MSR_P4_ALF_ESCR0 0x3ca
210#define MSR_P4_ALF_ESCR1 0x3cb
211#define MSR_P4_BPU_ESCR0 0x3b2
212#define MSR_P4_BPU_ESCR1 0x3b3
213#define MSR_P4_BSU_ESCR0 0x3a0
214#define MSR_P4_BSU_ESCR1 0x3a1
215#define MSR_P4_CRU_ESCR0 0x3b8
216#define MSR_P4_CRU_ESCR1 0x3b9
217#define MSR_P4_CRU_ESCR2 0x3cc
218#define MSR_P4_CRU_ESCR3 0x3cd
219#define MSR_P4_CRU_ESCR4 0x3e0
220#define MSR_P4_CRU_ESCR5 0x3e1
221#define MSR_P4_DAC_ESCR0 0x3a8
222#define MSR_P4_DAC_ESCR1 0x3a9
223#define MSR_P4_FIRM_ESCR0 0x3a4
224#define MSR_P4_FIRM_ESCR1 0x3a5
225#define MSR_P4_FLAME_ESCR0 0x3a6
226#define MSR_P4_FLAME_ESCR1 0x3a7
227#define MSR_P4_FSB_ESCR0 0x3a2
228#define MSR_P4_FSB_ESCR1 0x3a3
229#define MSR_P4_IQ_ESCR0 0x3ba
230#define MSR_P4_IQ_ESCR1 0x3bb
231#define MSR_P4_IS_ESCR0 0x3b4
232#define MSR_P4_IS_ESCR1 0x3b5
233#define MSR_P4_ITLB_ESCR0 0x3b6
234#define MSR_P4_ITLB_ESCR1 0x3b7
235#define MSR_P4_IX_ESCR0 0x3c8
236#define MSR_P4_IX_ESCR1 0x3c9
237#define MSR_P4_MOB_ESCR0 0x3aa
238#define MSR_P4_MOB_ESCR1 0x3ab
239#define MSR_P4_MS_ESCR0 0x3c0
240#define MSR_P4_MS_ESCR1 0x3c1
241#define MSR_P4_PMH_ESCR0 0x3ac
242#define MSR_P4_PMH_ESCR1 0x3ad
243#define MSR_P4_RAT_ESCR0 0x3bc
244#define MSR_P4_RAT_ESCR1 0x3bd
245#define MSR_P4_SAAT_ESCR0 0x3ae
246#define MSR_P4_SAAT_ESCR1 0x3af
247#define MSR_P4_SSU_ESCR0 0x3be
248#define MSR_P4_SSU_ESCR1 0x3bf /* guess: not defined in manual */
249#define MSR_P4_TBPU_ESCR0 0x3c2
250#define MSR_P4_TBPU_ESCR1 0x3c3
251#define MSR_P4_TC_ESCR0 0x3c4
252#define MSR_P4_TC_ESCR1 0x3c5
253#define MSR_P4_U2L_ESCR0 0x3b0
254#define MSR_P4_U2L_ESCR1 0x3b1
255
256/* AMD Defined MSRs */
257#define MSR_K6_EFER 0xC0000080
258#define MSR_K6_STAR 0xC0000081
259#define MSR_K6_WHCR 0xC0000082
260#define MSR_K6_UWCCR 0xC0000085
261#define MSR_K6_EPMR 0xC0000086
262#define MSR_K6_PSOR 0xC0000087
263#define MSR_K6_PFIR 0xC0000088
264
265#define MSR_K7_EVNTSEL0 0xC0010000
266#define MSR_K7_EVNTSEL1 0xC0010001
267#define MSR_K7_EVNTSEL2 0xC0010002
268#define MSR_K7_EVNTSEL3 0xC0010003
269#define MSR_K7_PERFCTR0 0xC0010004
270#define MSR_K7_PERFCTR1 0xC0010005
271#define MSR_K7_PERFCTR2 0xC0010006
272#define MSR_K7_PERFCTR3 0xC0010007
273#define MSR_K7_HWCR 0xC0010015
274#define MSR_K7_CLK_CTL 0xC001001b
275#define MSR_K7_FID_VID_CTL 0xC0010041
276#define MSR_K7_FID_VID_STATUS 0xC0010042
277
278#define MSR_K8_ENABLE_C1E 0xC0010055
279
280/* extended feature register */
281#define MSR_EFER 0xc0000080
282
283/* EFER bits: */
284
285/* Execute Disable enable */
286#define _EFER_NX 11
287#define EFER_NX (1<<_EFER_NX)
288
289/* Centaur-Hauls/IDT defined MSRs. */
290#define MSR_IDT_FCR1 0x107
291#define MSR_IDT_FCR2 0x108
292#define MSR_IDT_FCR3 0x109
293#define MSR_IDT_FCR4 0x10a
294
295#define MSR_IDT_MCR0 0x110
296#define MSR_IDT_MCR1 0x111
297#define MSR_IDT_MCR2 0x112
298#define MSR_IDT_MCR3 0x113
299#define MSR_IDT_MCR4 0x114
300#define MSR_IDT_MCR5 0x115
301#define MSR_IDT_MCR6 0x116
302#define MSR_IDT_MCR7 0x117
303#define MSR_IDT_MCR_CTRL 0x120
304
305/* VIA Cyrix defined MSRs*/
306#define MSR_VIA_FCR 0x1107
307#define MSR_VIA_LONGHAUL 0x110a
308#define MSR_VIA_RNG 0x110b
309#define MSR_VIA_BCR2 0x1147
310
311/* Transmeta defined MSRs */
312#define MSR_TMTA_LONGRUN_CTRL 0x80868010
313#define MSR_TMTA_LONGRUN_FLAGS 0x80868011
314#define MSR_TMTA_LRTI_READOUT 0x80868018
315#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a
316
317/* Intel Core-based CPU performance counters */
318#define MSR_CORE_PERF_FIXED_CTR0 0x309
319#define MSR_CORE_PERF_FIXED_CTR1 0x30a
320#define MSR_CORE_PERF_FIXED_CTR2 0x30b
321#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x38d
322#define MSR_CORE_PERF_GLOBAL_STATUS 0x38e
323#define MSR_CORE_PERF_GLOBAL_CTRL 0x38f
324#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x390
325
326/* Geode defined MSRs */
327#define MSR_GEODE_BUSCONT_CONF0 0x1900
328
329#endif /* __ASM_MSR_H */ 163#endif /* __ASM_MSR_H */
diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h
index 07f063ae26e..7e9c7ccbdcf 100644
--- a/include/asm-i386/mtrr.h
+++ b/include/asm-i386/mtrr.h
@@ -69,6 +69,8 @@ struct mtrr_gentry
69 69
70/* The following functions are for use by other drivers */ 70/* The following functions are for use by other drivers */
71# ifdef CONFIG_MTRR 71# ifdef CONFIG_MTRR
72extern void mtrr_save_fixed_ranges(void *);
73extern void mtrr_save_state(void);
72extern int mtrr_add (unsigned long base, unsigned long size, 74extern int mtrr_add (unsigned long base, unsigned long size,
73 unsigned int type, char increment); 75 unsigned int type, char increment);
74extern int mtrr_add_page (unsigned long base, unsigned long size, 76extern int mtrr_add_page (unsigned long base, unsigned long size,
@@ -79,6 +81,8 @@ extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
79extern void mtrr_ap_init(void); 81extern void mtrr_ap_init(void);
80extern void mtrr_bp_init(void); 82extern void mtrr_bp_init(void);
81# else 83# else
84#define mtrr_save_fixed_ranges(arg) do {} while (0)
85#define mtrr_save_state() do {} while (0)
82static __inline__ int mtrr_add (unsigned long base, unsigned long size, 86static __inline__ int mtrr_add (unsigned long base, unsigned long size,
83 unsigned int type, char increment) 87 unsigned int type, char increment)
84{ 88{
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h
index b04333ea6f3..fb1e133efd9 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -50,4 +50,12 @@ void __trigger_all_cpu_backtrace(void);
50 50
51#endif 51#endif
52 52
53void lapic_watchdog_stop(void);
54int lapic_watchdog_init(unsigned nmi_hz);
55int lapic_wd_event(unsigned nmi_hz);
56unsigned lapic_adjust_nmi_hz(unsigned hz);
57int lapic_watchdog_ok(void);
58void disable_lapic_nmi_watchdog(void);
59void enable_lapic_nmi_watchdog(void);
60
53#endif /* ASM_NMI_H */ 61#endif /* ASM_NMI_H */
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 7b19f454761..818ac8bf01e 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -12,7 +12,6 @@
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14 14
15
16#ifdef CONFIG_X86_USE_3DNOW 15#ifdef CONFIG_X86_USE_3DNOW
17 16
18#include <asm/mmx.h> 17#include <asm/mmx.h>
@@ -42,26 +41,81 @@
42 * These are used to make use of C type-checking.. 41 * These are used to make use of C type-checking..
43 */ 42 */
44extern int nx_enabled; 43extern int nx_enabled;
44
45#ifdef CONFIG_X86_PAE 45#ifdef CONFIG_X86_PAE
46extern unsigned long long __supported_pte_mask; 46extern unsigned long long __supported_pte_mask;
47typedef struct { unsigned long pte_low, pte_high; } pte_t; 47typedef struct { unsigned long pte_low, pte_high; } pte_t;
48typedef struct { unsigned long long pmd; } pmd_t; 48typedef struct { unsigned long long pmd; } pmd_t;
49typedef struct { unsigned long long pgd; } pgd_t; 49typedef struct { unsigned long long pgd; } pgd_t;
50typedef struct { unsigned long long pgprot; } pgprot_t; 50typedef struct { unsigned long long pgprot; } pgprot_t;
51#define pmd_val(x) ((x).pmd) 51
52#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) 52static inline unsigned long long native_pgd_val(pgd_t pgd)
53#define __pmd(x) ((pmd_t) { (x) } ) 53{
54 return pgd.pgd;
55}
56
57static inline unsigned long long native_pmd_val(pmd_t pmd)
58{
59 return pmd.pmd;
60}
61
62static inline unsigned long long native_pte_val(pte_t pte)
63{
64 return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
65}
66
67static inline pgd_t native_make_pgd(unsigned long long val)
68{
69 return (pgd_t) { val };
70}
71
72static inline pmd_t native_make_pmd(unsigned long long val)
73{
74 return (pmd_t) { val };
75}
76
77static inline pte_t native_make_pte(unsigned long long val)
78{
79 return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
80}
81
82#ifndef CONFIG_PARAVIRT
83#define pmd_val(x) native_pmd_val(x)
84#define __pmd(x) native_make_pmd(x)
85#endif
86
54#define HPAGE_SHIFT 21 87#define HPAGE_SHIFT 21
55#include <asm-generic/pgtable-nopud.h> 88#include <asm-generic/pgtable-nopud.h>
56#else 89#else /* !CONFIG_X86_PAE */
57typedef struct { unsigned long pte_low; } pte_t; 90typedef struct { unsigned long pte_low; } pte_t;
58typedef struct { unsigned long pgd; } pgd_t; 91typedef struct { unsigned long pgd; } pgd_t;
59typedef struct { unsigned long pgprot; } pgprot_t; 92typedef struct { unsigned long pgprot; } pgprot_t;
60#define boot_pte_t pte_t /* or would you rather have a typedef */ 93#define boot_pte_t pte_t /* or would you rather have a typedef */
61#define pte_val(x) ((x).pte_low) 94
95static inline unsigned long native_pgd_val(pgd_t pgd)
96{
97 return pgd.pgd;
98}
99
100static inline unsigned long native_pte_val(pte_t pte)
101{
102 return pte.pte_low;
103}
104
105static inline pgd_t native_make_pgd(unsigned long val)
106{
107 return (pgd_t) { val };
108}
109
110static inline pte_t native_make_pte(unsigned long val)
111{
112 return (pte_t) { .pte_low = val };
113}
114
62#define HPAGE_SHIFT 22 115#define HPAGE_SHIFT 22
63#include <asm-generic/pgtable-nopmd.h> 116#include <asm-generic/pgtable-nopmd.h>
64#endif 117#endif /* CONFIG_X86_PAE */
118
65#define PTE_MASK PAGE_MASK 119#define PTE_MASK PAGE_MASK
66 120
67#ifdef CONFIG_HUGETLB_PAGE 121#ifdef CONFIG_HUGETLB_PAGE
@@ -71,13 +125,16 @@ typedef struct { unsigned long pgprot; } pgprot_t;
71#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 125#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
72#endif 126#endif
73 127
74#define pgd_val(x) ((x).pgd)
75#define pgprot_val(x) ((x).pgprot) 128#define pgprot_val(x) ((x).pgprot)
76
77#define __pte(x) ((pte_t) { (x) } )
78#define __pgd(x) ((pgd_t) { (x) } )
79#define __pgprot(x) ((pgprot_t) { (x) } ) 129#define __pgprot(x) ((pgprot_t) { (x) } )
80 130
131#ifndef CONFIG_PARAVIRT
132#define pgd_val(x) native_pgd_val(x)
133#define __pgd(x) native_make_pgd(x)
134#define pte_val(x) native_pte_val(x)
135#define __pte(x) native_make_pte(x)
136#endif
137
81#endif /* !__ASSEMBLY__ */ 138#endif /* !__ASSEMBLY__ */
82 139
83/* to align the pointer to the (next) page boundary */ 140/* to align the pointer to the (next) page boundary */
@@ -143,9 +200,7 @@ extern int page_is_ram(unsigned long pagenr);
143#include <asm-generic/memory_model.h> 200#include <asm-generic/memory_model.h>
144#include <asm-generic/page.h> 201#include <asm-generic/page.h>
145 202
146#ifndef CONFIG_COMPAT_VDSO
147#define __HAVE_ARCH_GATE_AREA 1 203#define __HAVE_ARCH_GATE_AREA 1
148#endif
149#endif /* __KERNEL__ */ 204#endif /* __KERNEL__ */
150 205
151#endif /* _I386_PAGE_H */ 206#endif /* _I386_PAGE_H */
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index e63f1e444fc..e2e7f98723c 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -2,20 +2,9 @@
2#define __ASM_PARAVIRT_H 2#define __ASM_PARAVIRT_H
3/* Various instructions on x86 need to be replaced for 3/* Various instructions on x86 need to be replaced for
4 * para-virtualization: those hooks are defined here. */ 4 * para-virtualization: those hooks are defined here. */
5#include <linux/linkage.h>
6#include <linux/stringify.h>
7#include <asm/page.h>
8 5
9#ifdef CONFIG_PARAVIRT 6#ifdef CONFIG_PARAVIRT
10/* These are the most performance critical ops, so we want to be able to patch 7#include <asm/page.h>
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 8
20/* Bitmask of what can be clobbered: usually at least eax. */ 9/* Bitmask of what can be clobbered: usually at least eax. */
21#define CLBR_NONE 0x0 10#define CLBR_NONE 0x0
@@ -25,13 +14,29 @@
25#define CLBR_ANY 0x7 14#define CLBR_ANY 0x7
26 15
27#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17#include <linux/types.h>
18#include <linux/cpumask.h>
19#include <asm/kmap_types.h>
20
21struct page;
28struct thread_struct; 22struct thread_struct;
29struct Xgt_desc_struct; 23struct Xgt_desc_struct;
30struct tss_struct; 24struct tss_struct;
31struct mm_struct; 25struct mm_struct;
26struct desc_struct;
27
28/* Lazy mode for batching updates / context switch */
29enum paravirt_lazy_mode {
30 PARAVIRT_LAZY_NONE = 0,
31 PARAVIRT_LAZY_MMU = 1,
32 PARAVIRT_LAZY_CPU = 2,
33 PARAVIRT_LAZY_FLUSH = 3,
34};
35
32struct paravirt_ops 36struct paravirt_ops
33{ 37{
34 unsigned int kernel_rpl; 38 unsigned int kernel_rpl;
39 int shared_kernel_pmd;
35 int paravirt_enabled; 40 int paravirt_enabled;
36 const char *name; 41 const char *name;
37 42
@@ -44,24 +49,33 @@ struct paravirt_ops
44 */ 49 */
45 unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len); 50 unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len);
46 51
52 /* Basic arch-specific setup */
47 void (*arch_setup)(void); 53 void (*arch_setup)(void);
48 char *(*memory_setup)(void); 54 char *(*memory_setup)(void);
49 void (*init_IRQ)(void); 55 void (*init_IRQ)(void);
56 void (*time_init)(void);
50 57
58 /*
59 * Called before/after init_mm pagetable setup. setup_start
60 * may reset %cr3, and may pre-install parts of the pagetable;
61 * pagetable setup is expected to preserve any existing
62 * mapping.
63 */
64 void (*pagetable_setup_start)(pgd_t *pgd_base);
65 void (*pagetable_setup_done)(pgd_t *pgd_base);
66
67 /* Print a banner to identify the environment */
51 void (*banner)(void); 68 void (*banner)(void);
52 69
70 /* Set and set time of day */
53 unsigned long (*get_wallclock)(void); 71 unsigned long (*get_wallclock)(void);
54 int (*set_wallclock)(unsigned long); 72 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 73
74 /* cpuid emulation, mostly so that caps bits can be disabled */
62 void (*cpuid)(unsigned int *eax, unsigned int *ebx, 75 void (*cpuid)(unsigned int *eax, unsigned int *ebx,
63 unsigned int *ecx, unsigned int *edx); 76 unsigned int *ecx, unsigned int *edx);
64 77
78 /* hooks for various privileged instructions */
65 unsigned long (*get_debugreg)(int regno); 79 unsigned long (*get_debugreg)(int regno);
66 void (*set_debugreg)(int regno, unsigned long value); 80 void (*set_debugreg)(int regno, unsigned long value);
67 81
@@ -80,15 +94,23 @@ struct paravirt_ops
80 unsigned long (*read_cr4)(void); 94 unsigned long (*read_cr4)(void);
81 void (*write_cr4)(unsigned long); 95 void (*write_cr4)(unsigned long);
82 96
97 /*
98 * Get/set interrupt state. save_fl and restore_fl are only
99 * expected to use X86_EFLAGS_IF; all other bits
100 * returned from save_fl are undefined, and may be ignored by
101 * restore_fl.
102 */
83 unsigned long (*save_fl)(void); 103 unsigned long (*save_fl)(void);
84 void (*restore_fl)(unsigned long); 104 void (*restore_fl)(unsigned long);
85 void (*irq_disable)(void); 105 void (*irq_disable)(void);
86 void (*irq_enable)(void); 106 void (*irq_enable)(void);
87 void (*safe_halt)(void); 107 void (*safe_halt)(void);
88 void (*halt)(void); 108 void (*halt)(void);
109
89 void (*wbinvd)(void); 110 void (*wbinvd)(void);
90 111
91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ 112 /* MSR, PMC and TSR operations.
113 err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
92 u64 (*read_msr)(unsigned int msr, int *err); 114 u64 (*read_msr)(unsigned int msr, int *err);
93 int (*write_msr)(unsigned int msr, u64 val); 115 int (*write_msr)(unsigned int msr, u64 val);
94 116
@@ -97,6 +119,7 @@ struct paravirt_ops
97 u64 (*get_scheduled_cycles)(void); 119 u64 (*get_scheduled_cycles)(void);
98 unsigned long (*get_cpu_khz)(void); 120 unsigned long (*get_cpu_khz)(void);
99 121
122 /* Segment descriptor handling */
100 void (*load_tr_desc)(void); 123 void (*load_tr_desc)(void);
101 void (*load_gdt)(const struct Xgt_desc_struct *); 124 void (*load_gdt)(const struct Xgt_desc_struct *);
102 void (*load_idt)(const struct Xgt_desc_struct *); 125 void (*load_idt)(const struct Xgt_desc_struct *);
@@ -105,59 +128,98 @@ struct paravirt_ops
105 void (*set_ldt)(const void *desc, unsigned entries); 128 void (*set_ldt)(const void *desc, unsigned entries);
106 unsigned long (*store_tr)(void); 129 unsigned long (*store_tr)(void);
107 void (*load_tls)(struct thread_struct *t, unsigned int cpu); 130 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
108 void (*write_ldt_entry)(void *dt, int entrynum, 131 void (*write_ldt_entry)(struct desc_struct *,
109 u32 low, u32 high); 132 int entrynum, u32 low, u32 high);
110 void (*write_gdt_entry)(void *dt, int entrynum, 133 void (*write_gdt_entry)(struct desc_struct *,
111 u32 low, u32 high); 134 int entrynum, u32 low, u32 high);
112 void (*write_idt_entry)(void *dt, int entrynum, 135 void (*write_idt_entry)(struct desc_struct *,
113 u32 low, u32 high); 136 int entrynum, u32 low, u32 high);
114 void (*load_esp0)(struct tss_struct *tss, 137 void (*load_esp0)(struct tss_struct *tss, struct thread_struct *t);
115 struct thread_struct *thread);
116 138
117 void (*set_iopl_mask)(unsigned mask); 139 void (*set_iopl_mask)(unsigned mask);
118
119 void (*io_delay)(void); 140 void (*io_delay)(void);
120 141
142 /*
143 * Hooks for intercepting the creation/use/destruction of an
144 * mm_struct.
145 */
146 void (*activate_mm)(struct mm_struct *prev,
147 struct mm_struct *next);
148 void (*dup_mmap)(struct mm_struct *oldmm,
149 struct mm_struct *mm);
150 void (*exit_mmap)(struct mm_struct *mm);
151
121#ifdef CONFIG_X86_LOCAL_APIC 152#ifdef CONFIG_X86_LOCAL_APIC
153 /*
154 * Direct APIC operations, principally for VMI. Ideally
155 * these shouldn't be in this interface.
156 */
122 void (*apic_write)(unsigned long reg, unsigned long v); 157 void (*apic_write)(unsigned long reg, unsigned long v);
123 void (*apic_write_atomic)(unsigned long reg, unsigned long v); 158 void (*apic_write_atomic)(unsigned long reg, unsigned long v);
124 unsigned long (*apic_read)(unsigned long reg); 159 unsigned long (*apic_read)(unsigned long reg);
125 void (*setup_boot_clock)(void); 160 void (*setup_boot_clock)(void);
126 void (*setup_secondary_clock)(void); 161 void (*setup_secondary_clock)(void);
162
163 void (*startup_ipi_hook)(int phys_apicid,
164 unsigned long start_eip,
165 unsigned long start_esp);
127#endif 166#endif
128 167
168 /* TLB operations */
129 void (*flush_tlb_user)(void); 169 void (*flush_tlb_user)(void);
130 void (*flush_tlb_kernel)(void); 170 void (*flush_tlb_kernel)(void);
131 void (*flush_tlb_single)(u32 addr); 171 void (*flush_tlb_single)(unsigned long addr);
132 172 void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
133 void (*map_pt_hook)(int type, pte_t *va, u32 pfn); 173 unsigned long va);
134 174
175 /* Hooks for allocating/releasing pagetable pages */
135 void (*alloc_pt)(u32 pfn); 176 void (*alloc_pt)(u32 pfn);
136 void (*alloc_pd)(u32 pfn); 177 void (*alloc_pd)(u32 pfn);
137 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); 178 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
138 void (*release_pt)(u32 pfn); 179 void (*release_pt)(u32 pfn);
139 void (*release_pd)(u32 pfn); 180 void (*release_pd)(u32 pfn);
140 181
182 /* Pagetable manipulation functions */
141 void (*set_pte)(pte_t *ptep, pte_t pteval); 183 void (*set_pte)(pte_t *ptep, pte_t pteval);
142 void (*set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval); 184 void (*set_pte_at)(struct mm_struct *mm, unsigned long addr,
185 pte_t *ptep, pte_t pteval);
143 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); 186 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
144 void (*pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep); 187 void (*pte_update)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
145 void (*pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep); 188 void (*pte_update_defer)(struct mm_struct *mm,
189 unsigned long addr, pte_t *ptep);
190
191#ifdef CONFIG_HIGHPTE
192 void *(*kmap_atomic_pte)(struct page *page, enum km_type type);
193#endif
194
146#ifdef CONFIG_X86_PAE 195#ifdef CONFIG_X86_PAE
147 void (*set_pte_atomic)(pte_t *ptep, pte_t pteval); 196 void (*set_pte_atomic)(pte_t *ptep, pte_t pteval);
148 void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); 197 void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
149 void (*set_pud)(pud_t *pudp, pud_t pudval); 198 void (*set_pud)(pud_t *pudp, pud_t pudval);
150 void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 199 void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
151 void (*pmd_clear)(pmd_t *pmdp); 200 void (*pmd_clear)(pmd_t *pmdp);
201
202 unsigned long long (*pte_val)(pte_t);
203 unsigned long long (*pmd_val)(pmd_t);
204 unsigned long long (*pgd_val)(pgd_t);
205
206 pte_t (*make_pte)(unsigned long long pte);
207 pmd_t (*make_pmd)(unsigned long long pmd);
208 pgd_t (*make_pgd)(unsigned long long pgd);
209#else
210 unsigned long (*pte_val)(pte_t);
211 unsigned long (*pgd_val)(pgd_t);
212
213 pte_t (*make_pte)(unsigned long pte);
214 pgd_t (*make_pgd)(unsigned long pgd);
152#endif 215#endif
153 216
154 void (*set_lazy_mode)(int mode); 217 /* Set deferred update mode, used for batching operations. */
218 void (*set_lazy_mode)(enum paravirt_lazy_mode mode);
155 219
156 /* These two are jmp to, not actually called. */ 220 /* These two are jmp to, not actually called. */
157 void (*irq_enable_sysexit)(void); 221 void (*irq_enable_sysexit)(void);
158 void (*iret)(void); 222 void (*iret)(void);
159
160 void (*startup_ipi_hook)(int phys_apicid, unsigned long start_eip, unsigned long start_esp);
161}; 223};
162 224
163/* Mark a paravirt probe function. */ 225/* Mark a paravirt probe function. */
@@ -167,23 +229,202 @@ struct paravirt_ops
167 229
168extern struct paravirt_ops paravirt_ops; 230extern struct paravirt_ops paravirt_ops;
169 231
170#define paravirt_enabled() (paravirt_ops.paravirt_enabled) 232#define PARAVIRT_PATCH(x) \
233 (offsetof(struct paravirt_ops, x) / sizeof(void *))
234
235#define paravirt_type(type) \
236 [paravirt_typenum] "i" (PARAVIRT_PATCH(type))
237#define paravirt_clobber(clobber) \
238 [paravirt_clobber] "i" (clobber)
239
240/*
241 * Generate some code, and mark it as patchable by the
242 * apply_paravirt() alternate instruction patcher.
243 */
244#define _paravirt_alt(insn_string, type, clobber) \
245 "771:\n\t" insn_string "\n" "772:\n" \
246 ".pushsection .parainstructions,\"a\"\n" \
247 " .long 771b\n" \
248 " .byte " type "\n" \
249 " .byte 772b-771b\n" \
250 " .short " clobber "\n" \
251 ".popsection\n"
252
253/* Generate patchable code, with the default asm parameters. */
254#define paravirt_alt(insn_string) \
255 _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
256
257unsigned paravirt_patch_nop(void);
258unsigned paravirt_patch_ignore(unsigned len);
259unsigned paravirt_patch_call(void *target, u16 tgt_clobbers,
260 void *site, u16 site_clobbers,
261 unsigned len);
262unsigned paravirt_patch_jmp(void *target, void *site, unsigned len);
263unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len);
264
265unsigned paravirt_patch_insns(void *site, unsigned len,
266 const char *start, const char *end);
267
268
269/*
270 * This generates an indirect call based on the operation type number.
271 * The type number, computed in PARAVIRT_PATCH, is derived from the
272 * offset into the paravirt_ops structure, and can therefore be freely
273 * converted back into a structure offset.
274 */
275#define PARAVIRT_CALL "call *(paravirt_ops+%c[paravirt_typenum]*4);"
276
277/*
278 * These macros are intended to wrap calls into a paravirt_ops
279 * operation, so that they can be later identified and patched at
280 * runtime.
281 *
282 * Normally, a call to a pv_op function is a simple indirect call:
283 * (paravirt_ops.operations)(args...).
284 *
285 * Unfortunately, this is a relatively slow operation for modern CPUs,
286 * because it cannot necessarily determine what the destination
287 * address is. In this case, the address is a runtime constant, so at
288 * the very least we can patch the call to e a simple direct call, or
289 * ideally, patch an inline implementation into the callsite. (Direct
290 * calls are essentially free, because the call and return addresses
291 * are completely predictable.)
292 *
293 * These macros rely on the standard gcc "regparm(3)" calling
294 * convention, in which the first three arguments are placed in %eax,
295 * %edx, %ecx (in that order), and the remaining arguments are placed
296 * on the stack. All caller-save registers (eax,edx,ecx) are expected
297 * to be modified (either clobbered or used for return values).
298 *
299 * The call instruction itself is marked by placing its start address
300 * and size into the .parainstructions section, so that
301 * apply_paravirt() in arch/i386/kernel/alternative.c can do the
302 * appropriate patching under the control of the backend paravirt_ops
303 * implementation.
304 *
305 * Unfortunately there's no way to get gcc to generate the args setup
306 * for the call, and then allow the call itself to be generated by an
307 * inline asm. Because of this, we must do the complete arg setup and
308 * return value handling from within these macros. This is fairly
309 * cumbersome.
310 *
311 * There are 5 sets of PVOP_* macros for dealing with 0-4 arguments.
312 * It could be extended to more arguments, but there would be little
313 * to be gained from that. For each number of arguments, there are
314 * the two VCALL and CALL variants for void and non-void functions.
315 *
316 * When there is a return value, the invoker of the macro must specify
317 * the return type. The macro then uses sizeof() on that type to
318 * determine whether its a 32 or 64 bit value, and places the return
319 * in the right register(s) (just %eax for 32-bit, and %edx:%eax for
320 * 64-bit).
321 *
322 * 64-bit arguments are passed as a pair of adjacent 32-bit arguments
323 * in low,high order.
324 *
325 * Small structures are passed and returned in registers. The macro
326 * calling convention can't directly deal with this, so the wrapper
327 * functions must do this.
328 *
329 * These PVOP_* macros are only defined within this header. This
330 * means that all uses must be wrapped in inline functions. This also
331 * makes sure the incoming and outgoing types are always correct.
332 */
333#define __PVOP_CALL(rettype, op, pre, post, ...) \
334 ({ \
335 rettype __ret; \
336 unsigned long __eax, __edx, __ecx; \
337 if (sizeof(rettype) > sizeof(unsigned long)) { \
338 asm volatile(pre \
339 paravirt_alt(PARAVIRT_CALL) \
340 post \
341 : "=a" (__eax), "=d" (__edx), \
342 "=c" (__ecx) \
343 : paravirt_type(op), \
344 paravirt_clobber(CLBR_ANY), \
345 ##__VA_ARGS__ \
346 : "memory", "cc"); \
347 __ret = (rettype)((((u64)__edx) << 32) | __eax); \
348 } else { \
349 asm volatile(pre \
350 paravirt_alt(PARAVIRT_CALL) \
351 post \
352 : "=a" (__eax), "=d" (__edx), \
353 "=c" (__ecx) \
354 : paravirt_type(op), \
355 paravirt_clobber(CLBR_ANY), \
356 ##__VA_ARGS__ \
357 : "memory", "cc"); \
358 __ret = (rettype)__eax; \
359 } \
360 __ret; \
361 })
362#define __PVOP_VCALL(op, pre, post, ...) \
363 ({ \
364 unsigned long __eax, __edx, __ecx; \
365 asm volatile(pre \
366 paravirt_alt(PARAVIRT_CALL) \
367 post \
368 : "=a" (__eax), "=d" (__edx), "=c" (__ecx) \
369 : paravirt_type(op), \
370 paravirt_clobber(CLBR_ANY), \
371 ##__VA_ARGS__ \
372 : "memory", "cc"); \
373 })
374
375#define PVOP_CALL0(rettype, op) \
376 __PVOP_CALL(rettype, op, "", "")
377#define PVOP_VCALL0(op) \
378 __PVOP_VCALL(op, "", "")
379
380#define PVOP_CALL1(rettype, op, arg1) \
381 __PVOP_CALL(rettype, op, "", "", "0" ((u32)(arg1)))
382#define PVOP_VCALL1(op, arg1) \
383 __PVOP_VCALL(op, "", "", "0" ((u32)(arg1)))
384
385#define PVOP_CALL2(rettype, op, arg1, arg2) \
386 __PVOP_CALL(rettype, op, "", "", "0" ((u32)(arg1)), "1" ((u32)(arg2)))
387#define PVOP_VCALL2(op, arg1, arg2) \
388 __PVOP_VCALL(op, "", "", "0" ((u32)(arg1)), "1" ((u32)(arg2)))
389
390#define PVOP_CALL3(rettype, op, arg1, arg2, arg3) \
391 __PVOP_CALL(rettype, op, "", "", "0" ((u32)(arg1)), \
392 "1"((u32)(arg2)), "2"((u32)(arg3)))
393#define PVOP_VCALL3(op, arg1, arg2, arg3) \
394 __PVOP_VCALL(op, "", "", "0" ((u32)(arg1)), "1"((u32)(arg2)), \
395 "2"((u32)(arg3)))
396
397#define PVOP_CALL4(rettype, op, arg1, arg2, arg3, arg4) \
398 __PVOP_CALL(rettype, op, \
399 "push %[_arg4];", "lea 4(%%esp),%%esp;", \
400 "0" ((u32)(arg1)), "1" ((u32)(arg2)), \
401 "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)))
402#define PVOP_VCALL4(op, arg1, arg2, arg3, arg4) \
403 __PVOP_VCALL(op, \
404 "push %[_arg4];", "lea 4(%%esp),%%esp;", \
405 "0" ((u32)(arg1)), "1" ((u32)(arg2)), \
406 "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)))
407
408static inline int paravirt_enabled(void)
409{
410 return paravirt_ops.paravirt_enabled;
411}
171 412
172static inline void load_esp0(struct tss_struct *tss, 413static inline void load_esp0(struct tss_struct *tss,
173 struct thread_struct *thread) 414 struct thread_struct *thread)
174{ 415{
175 paravirt_ops.load_esp0(tss, thread); 416 PVOP_VCALL2(load_esp0, tss, thread);
176} 417}
177 418
178#define ARCH_SETUP paravirt_ops.arch_setup(); 419#define ARCH_SETUP paravirt_ops.arch_setup();
179static inline unsigned long get_wallclock(void) 420static inline unsigned long get_wallclock(void)
180{ 421{
181 return paravirt_ops.get_wallclock(); 422 return PVOP_CALL0(unsigned long, get_wallclock);
182} 423}
183 424
184static inline int set_wallclock(unsigned long nowtime) 425static inline int set_wallclock(unsigned long nowtime)
185{ 426{
186 return paravirt_ops.set_wallclock(nowtime); 427 return PVOP_CALL1(int, set_wallclock, nowtime);
187} 428}
188 429
189static inline void (*choose_time_init(void))(void) 430static inline void (*choose_time_init(void))(void)
@@ -195,113 +436,208 @@ static inline void (*choose_time_init(void))(void)
195static inline void __cpuid(unsigned int *eax, unsigned int *ebx, 436static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
196 unsigned int *ecx, unsigned int *edx) 437 unsigned int *ecx, unsigned int *edx)
197{ 438{
198 paravirt_ops.cpuid(eax, ebx, ecx, edx); 439 PVOP_VCALL4(cpuid, eax, ebx, ecx, edx);
199} 440}
200 441
201/* 442/*
202 * These special macros can be used to get or set a debugging register 443 * These special macros can be used to get or set a debugging register
203 */ 444 */
204#define get_debugreg(var, reg) var = paravirt_ops.get_debugreg(reg) 445static inline unsigned long paravirt_get_debugreg(int reg)
205#define set_debugreg(val, reg) paravirt_ops.set_debugreg(reg, val) 446{
447 return PVOP_CALL1(unsigned long, get_debugreg, reg);
448}
449#define get_debugreg(var, reg) var = paravirt_get_debugreg(reg)
450static inline void set_debugreg(unsigned long val, int reg)
451{
452 PVOP_VCALL2(set_debugreg, reg, val);
453}
454
455static inline void clts(void)
456{
457 PVOP_VCALL0(clts);
458}
206 459
207#define clts() paravirt_ops.clts() 460static inline unsigned long read_cr0(void)
461{
462 return PVOP_CALL0(unsigned long, read_cr0);
463}
208 464
209#define read_cr0() paravirt_ops.read_cr0() 465static inline void write_cr0(unsigned long x)
210#define write_cr0(x) paravirt_ops.write_cr0(x) 466{
467 PVOP_VCALL1(write_cr0, x);
468}
211 469
212#define read_cr2() paravirt_ops.read_cr2() 470static inline unsigned long read_cr2(void)
213#define write_cr2(x) paravirt_ops.write_cr2(x) 471{
472 return PVOP_CALL0(unsigned long, read_cr2);
473}
214 474
215#define read_cr3() paravirt_ops.read_cr3() 475static inline void write_cr2(unsigned long x)
216#define write_cr3(x) paravirt_ops.write_cr3(x) 476{
477 PVOP_VCALL1(write_cr2, x);
478}
217 479
218#define read_cr4() paravirt_ops.read_cr4() 480static inline unsigned long read_cr3(void)
219#define read_cr4_safe(x) paravirt_ops.read_cr4_safe() 481{
220#define write_cr4(x) paravirt_ops.write_cr4(x) 482 return PVOP_CALL0(unsigned long, read_cr3);
483}
484
485static inline void write_cr3(unsigned long x)
486{
487 PVOP_VCALL1(write_cr3, x);
488}
489
490static inline unsigned long read_cr4(void)
491{
492 return PVOP_CALL0(unsigned long, read_cr4);
493}
494static inline unsigned long read_cr4_safe(void)
495{
496 return PVOP_CALL0(unsigned long, read_cr4_safe);
497}
498
499static inline void write_cr4(unsigned long x)
500{
501 PVOP_VCALL1(write_cr4, x);
502}
221 503
222static inline void raw_safe_halt(void) 504static inline void raw_safe_halt(void)
223{ 505{
224 paravirt_ops.safe_halt(); 506 PVOP_VCALL0(safe_halt);
225} 507}
226 508
227static inline void halt(void) 509static inline void halt(void)
228{ 510{
229 paravirt_ops.safe_halt(); 511 PVOP_VCALL0(safe_halt);
512}
513
514static inline void wbinvd(void)
515{
516 PVOP_VCALL0(wbinvd);
230} 517}
231#define wbinvd() paravirt_ops.wbinvd()
232 518
233#define get_kernel_rpl() (paravirt_ops.kernel_rpl) 519#define get_kernel_rpl() (paravirt_ops.kernel_rpl)
234 520
235#define rdmsr(msr,val1,val2) do { \ 521static inline u64 paravirt_read_msr(unsigned msr, int *err)
236 int _err; \ 522{
237 u64 _l = paravirt_ops.read_msr(msr,&_err); \ 523 return PVOP_CALL2(u64, read_msr, msr, err);
238 val1 = (u32)_l; \ 524}
239 val2 = _l >> 32; \ 525static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high)
526{
527 return PVOP_CALL3(int, write_msr, msr, low, high);
528}
529
530/* These should all do BUG_ON(_err), but our headers are too tangled. */
531#define rdmsr(msr,val1,val2) do { \
532 int _err; \
533 u64 _l = paravirt_read_msr(msr, &_err); \
534 val1 = (u32)_l; \
535 val2 = _l >> 32; \
240} while(0) 536} while(0)
241 537
242#define wrmsr(msr,val1,val2) do { \ 538#define wrmsr(msr,val1,val2) do { \
243 u64 _l = ((u64)(val2) << 32) | (val1); \ 539 paravirt_write_msr(msr, val1, val2); \
244 paravirt_ops.write_msr((msr), _l); \
245} while(0) 540} while(0)
246 541
247#define rdmsrl(msr,val) do { \ 542#define rdmsrl(msr,val) do { \
248 int _err; \ 543 int _err; \
249 val = paravirt_ops.read_msr((msr),&_err); \ 544 val = paravirt_read_msr(msr, &_err); \
250} while(0) 545} while(0)
251 546
252#define wrmsrl(msr,val) (paravirt_ops.write_msr((msr),(val))) 547#define wrmsrl(msr,val) ((void)paravirt_write_msr(msr, val, 0))
253#define wrmsr_safe(msr,a,b) ({ \ 548#define wrmsr_safe(msr,a,b) paravirt_write_msr(msr, a, b)
254 u64 _l = ((u64)(b) << 32) | (a); \
255 paravirt_ops.write_msr((msr),_l); \
256})
257 549
258/* rdmsr with exception handling */ 550/* rdmsr with exception handling */
259#define rdmsr_safe(msr,a,b) ({ \ 551#define rdmsr_safe(msr,a,b) ({ \
260 int _err; \ 552 int _err; \
261 u64 _l = paravirt_ops.read_msr(msr,&_err); \ 553 u64 _l = paravirt_read_msr(msr, &_err); \
262 (*a) = (u32)_l; \ 554 (*a) = (u32)_l; \
263 (*b) = _l >> 32; \ 555 (*b) = _l >> 32; \
264 _err; }) 556 _err; })
265 557
266#define rdtsc(low,high) do { \ 558
267 u64 _l = paravirt_ops.read_tsc(); \ 559static inline u64 paravirt_read_tsc(void)
268 low = (u32)_l; \ 560{
269 high = _l >> 32; \ 561 return PVOP_CALL0(u64, read_tsc);
562}
563#define rdtsc(low,high) do { \
564 u64 _l = paravirt_read_tsc(); \
565 low = (u32)_l; \
566 high = _l >> 32; \
270} while(0) 567} while(0)
271 568
272#define rdtscl(low) do { \ 569#define rdtscl(low) do { \
273 u64 _l = paravirt_ops.read_tsc(); \ 570 u64 _l = paravirt_read_tsc(); \
274 low = (int)_l; \ 571 low = (int)_l; \
275} while(0) 572} while(0)
276 573
277#define rdtscll(val) (val = paravirt_ops.read_tsc()) 574#define rdtscll(val) (val = paravirt_read_tsc())
278 575
279#define get_scheduled_cycles(val) (val = paravirt_ops.get_scheduled_cycles()) 576#define get_scheduled_cycles(val) (val = paravirt_ops.get_scheduled_cycles())
280#define calculate_cpu_khz() (paravirt_ops.get_cpu_khz()) 577#define calculate_cpu_khz() (paravirt_ops.get_cpu_khz())
281 578
282#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 579#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
283 580
284#define rdpmc(counter,low,high) do { \ 581static inline unsigned long long paravirt_read_pmc(int counter)
285 u64 _l = paravirt_ops.read_pmc(); \ 582{
286 low = (u32)_l; \ 583 return PVOP_CALL1(u64, read_pmc, counter);
287 high = _l >> 32; \ 584}
585
586#define rdpmc(counter,low,high) do { \
587 u64 _l = paravirt_read_pmc(counter); \
588 low = (u32)_l; \
589 high = _l >> 32; \
288} while(0) 590} while(0)
289 591
290#define load_TR_desc() (paravirt_ops.load_tr_desc()) 592static inline void load_TR_desc(void)
291#define load_gdt(dtr) (paravirt_ops.load_gdt(dtr)) 593{
292#define load_idt(dtr) (paravirt_ops.load_idt(dtr)) 594 PVOP_VCALL0(load_tr_desc);
293#define set_ldt(addr, entries) (paravirt_ops.set_ldt((addr), (entries))) 595}
294#define store_gdt(dtr) (paravirt_ops.store_gdt(dtr)) 596static inline void load_gdt(const struct Xgt_desc_struct *dtr)
295#define store_idt(dtr) (paravirt_ops.store_idt(dtr)) 597{
296#define store_tr(tr) ((tr) = paravirt_ops.store_tr()) 598 PVOP_VCALL1(load_gdt, dtr);
297#define load_TLS(t,cpu) (paravirt_ops.load_tls((t),(cpu))) 599}
298#define write_ldt_entry(dt, entry, low, high) \ 600static inline void load_idt(const struct Xgt_desc_struct *dtr)
299 (paravirt_ops.write_ldt_entry((dt), (entry), (low), (high))) 601{
300#define write_gdt_entry(dt, entry, low, high) \ 602 PVOP_VCALL1(load_idt, dtr);
301 (paravirt_ops.write_gdt_entry((dt), (entry), (low), (high))) 603}
302#define write_idt_entry(dt, entry, low, high) \ 604static inline void set_ldt(const void *addr, unsigned entries)
303 (paravirt_ops.write_idt_entry((dt), (entry), (low), (high))) 605{
304#define set_iopl_mask(mask) (paravirt_ops.set_iopl_mask(mask)) 606 PVOP_VCALL2(set_ldt, addr, entries);
607}
608static inline void store_gdt(struct Xgt_desc_struct *dtr)
609{
610 PVOP_VCALL1(store_gdt, dtr);
611}
612static inline void store_idt(struct Xgt_desc_struct *dtr)
613{
614 PVOP_VCALL1(store_idt, dtr);
615}
616static inline unsigned long paravirt_store_tr(void)
617{
618 return PVOP_CALL0(unsigned long, store_tr);
619}
620#define store_tr(tr) ((tr) = paravirt_store_tr())
621static inline void load_TLS(struct thread_struct *t, unsigned cpu)
622{
623 PVOP_VCALL2(load_tls, t, cpu);
624}
625static inline void write_ldt_entry(void *dt, int entry, u32 low, u32 high)
626{
627 PVOP_VCALL4(write_ldt_entry, dt, entry, low, high);
628}
629static inline void write_gdt_entry(void *dt, int entry, u32 low, u32 high)
630{
631 PVOP_VCALL4(write_gdt_entry, dt, entry, low, high);
632}
633static inline void write_idt_entry(void *dt, int entry, u32 low, u32 high)
634{
635 PVOP_VCALL4(write_idt_entry, dt, entry, low, high);
636}
637static inline void set_iopl_mask(unsigned mask)
638{
639 PVOP_VCALL1(set_iopl_mask, mask);
640}
305 641
306/* The paravirtualized I/O functions */ 642/* The paravirtualized I/O functions */
307static inline void slow_down_io(void) { 643static inline void slow_down_io(void) {
@@ -319,215 +655,390 @@ static inline void slow_down_io(void) {
319 */ 655 */
320static inline void apic_write(unsigned long reg, unsigned long v) 656static inline void apic_write(unsigned long reg, unsigned long v)
321{ 657{
322 paravirt_ops.apic_write(reg,v); 658 PVOP_VCALL2(apic_write, reg, v);
323} 659}
324 660
325static inline void apic_write_atomic(unsigned long reg, unsigned long v) 661static inline void apic_write_atomic(unsigned long reg, unsigned long v)
326{ 662{
327 paravirt_ops.apic_write_atomic(reg,v); 663 PVOP_VCALL2(apic_write_atomic, reg, v);
328} 664}
329 665
330static inline unsigned long apic_read(unsigned long reg) 666static inline unsigned long apic_read(unsigned long reg)
331{ 667{
332 return paravirt_ops.apic_read(reg); 668 return PVOP_CALL1(unsigned long, apic_read, reg);
333} 669}
334 670
335static inline void setup_boot_clock(void) 671static inline void setup_boot_clock(void)
336{ 672{
337 paravirt_ops.setup_boot_clock(); 673 PVOP_VCALL0(setup_boot_clock);
338} 674}
339 675
340static inline void setup_secondary_clock(void) 676static inline void setup_secondary_clock(void)
341{ 677{
342 paravirt_ops.setup_secondary_clock(); 678 PVOP_VCALL0(setup_secondary_clock);
343} 679}
344#endif 680#endif
345 681
682static inline void paravirt_pagetable_setup_start(pgd_t *base)
683{
684 if (paravirt_ops.pagetable_setup_start)
685 (*paravirt_ops.pagetable_setup_start)(base);
686}
687
688static inline void paravirt_pagetable_setup_done(pgd_t *base)
689{
690 if (paravirt_ops.pagetable_setup_done)
691 (*paravirt_ops.pagetable_setup_done)(base);
692}
693
346#ifdef CONFIG_SMP 694#ifdef CONFIG_SMP
347static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip, 695static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
348 unsigned long start_esp) 696 unsigned long start_esp)
349{ 697{
350 return paravirt_ops.startup_ipi_hook(phys_apicid, start_eip, start_esp); 698 PVOP_VCALL3(startup_ipi_hook, phys_apicid, start_eip, start_esp);
351} 699}
352#endif 700#endif
353 701
354#define __flush_tlb() paravirt_ops.flush_tlb_user() 702static inline void paravirt_activate_mm(struct mm_struct *prev,
355#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel() 703 struct mm_struct *next)
356#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr) 704{
705 PVOP_VCALL2(activate_mm, prev, next);
706}
357 707
358#define paravirt_map_pt_hook(type, va, pfn) paravirt_ops.map_pt_hook(type, va, pfn) 708static inline void arch_dup_mmap(struct mm_struct *oldmm,
709 struct mm_struct *mm)
710{
711 PVOP_VCALL2(dup_mmap, oldmm, mm);
712}
359 713
360#define paravirt_alloc_pt(pfn) paravirt_ops.alloc_pt(pfn) 714static inline void arch_exit_mmap(struct mm_struct *mm)
361#define paravirt_release_pt(pfn) paravirt_ops.release_pt(pfn) 715{
716 PVOP_VCALL1(exit_mmap, mm);
717}
362 718
363#define paravirt_alloc_pd(pfn) paravirt_ops.alloc_pd(pfn) 719static inline void __flush_tlb(void)
364#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) \ 720{
365 paravirt_ops.alloc_pd_clone(pfn, clonepfn, start, count) 721 PVOP_VCALL0(flush_tlb_user);
366#define paravirt_release_pd(pfn) paravirt_ops.release_pd(pfn) 722}
723static inline void __flush_tlb_global(void)
724{
725 PVOP_VCALL0(flush_tlb_kernel);
726}
727static inline void __flush_tlb_single(unsigned long addr)
728{
729 PVOP_VCALL1(flush_tlb_single, addr);
730}
367 731
368static inline void set_pte(pte_t *ptep, pte_t pteval) 732static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
733 unsigned long va)
369{ 734{
370 paravirt_ops.set_pte(ptep, pteval); 735 PVOP_VCALL3(flush_tlb_others, &cpumask, mm, va);
371} 736}
372 737
373static inline void set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) 738static inline void paravirt_alloc_pt(unsigned pfn)
374{ 739{
375 paravirt_ops.set_pte_at(mm, addr, ptep, pteval); 740 PVOP_VCALL1(alloc_pt, pfn);
741}
742static inline void paravirt_release_pt(unsigned pfn)
743{
744 PVOP_VCALL1(release_pt, pfn);
376} 745}
377 746
378static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval) 747static inline void paravirt_alloc_pd(unsigned pfn)
379{ 748{
380 paravirt_ops.set_pmd(pmdp, pmdval); 749 PVOP_VCALL1(alloc_pd, pfn);
381} 750}
382 751
383static inline void pte_update(struct mm_struct *mm, u32 addr, pte_t *ptep) 752static inline void paravirt_alloc_pd_clone(unsigned pfn, unsigned clonepfn,
753 unsigned start, unsigned count)
384{ 754{
385 paravirt_ops.pte_update(mm, addr, ptep); 755 PVOP_VCALL4(alloc_pd_clone, pfn, clonepfn, start, count);
756}
757static inline void paravirt_release_pd(unsigned pfn)
758{
759 PVOP_VCALL1(release_pd, pfn);
386} 760}
387 761
388static inline void pte_update_defer(struct mm_struct *mm, u32 addr, pte_t *ptep) 762#ifdef CONFIG_HIGHPTE
763static inline void *kmap_atomic_pte(struct page *page, enum km_type type)
389{ 764{
390 paravirt_ops.pte_update_defer(mm, addr, ptep); 765 unsigned long ret;
766 ret = PVOP_CALL2(unsigned long, kmap_atomic_pte, page, type);
767 return (void *)ret;
768}
769#endif
770
771static inline void pte_update(struct mm_struct *mm, unsigned long addr,
772 pte_t *ptep)
773{
774 PVOP_VCALL3(pte_update, mm, addr, ptep);
775}
776
777static inline void pte_update_defer(struct mm_struct *mm, unsigned long addr,
778 pte_t *ptep)
779{
780 PVOP_VCALL3(pte_update_defer, mm, addr, ptep);
391} 781}
392 782
393#ifdef CONFIG_X86_PAE 783#ifdef CONFIG_X86_PAE
784static inline pte_t __pte(unsigned long long val)
785{
786 unsigned long long ret = PVOP_CALL2(unsigned long long, make_pte,
787 val, val >> 32);
788 return (pte_t) { ret, ret >> 32 };
789}
790
791static inline pmd_t __pmd(unsigned long long val)
792{
793 return (pmd_t) { PVOP_CALL2(unsigned long long, make_pmd, val, val >> 32) };
794}
795
796static inline pgd_t __pgd(unsigned long long val)
797{
798 return (pgd_t) { PVOP_CALL2(unsigned long long, make_pgd, val, val >> 32) };
799}
800
801static inline unsigned long long pte_val(pte_t x)
802{
803 return PVOP_CALL2(unsigned long long, pte_val, x.pte_low, x.pte_high);
804}
805
806static inline unsigned long long pmd_val(pmd_t x)
807{
808 return PVOP_CALL2(unsigned long long, pmd_val, x.pmd, x.pmd >> 32);
809}
810
811static inline unsigned long long pgd_val(pgd_t x)
812{
813 return PVOP_CALL2(unsigned long long, pgd_val, x.pgd, x.pgd >> 32);
814}
815
816static inline void set_pte(pte_t *ptep, pte_t pteval)
817{
818 PVOP_VCALL3(set_pte, ptep, pteval.pte_low, pteval.pte_high);
819}
820
821static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
822 pte_t *ptep, pte_t pteval)
823{
824 /* 5 arg words */
825 paravirt_ops.set_pte_at(mm, addr, ptep, pteval);
826}
827
394static inline void set_pte_atomic(pte_t *ptep, pte_t pteval) 828static inline void set_pte_atomic(pte_t *ptep, pte_t pteval)
395{ 829{
396 paravirt_ops.set_pte_atomic(ptep, pteval); 830 PVOP_VCALL3(set_pte_atomic, ptep, pteval.pte_low, pteval.pte_high);
397} 831}
398 832
399static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) 833static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
834 pte_t *ptep, pte_t pte)
400{ 835{
836 /* 5 arg words */
401 paravirt_ops.set_pte_present(mm, addr, ptep, pte); 837 paravirt_ops.set_pte_present(mm, addr, ptep, pte);
402} 838}
403 839
840static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval)
841{
842 PVOP_VCALL3(set_pmd, pmdp, pmdval.pmd, pmdval.pmd >> 32);
843}
844
404static inline void set_pud(pud_t *pudp, pud_t pudval) 845static inline void set_pud(pud_t *pudp, pud_t pudval)
405{ 846{
406 paravirt_ops.set_pud(pudp, pudval); 847 PVOP_VCALL3(set_pud, pudp, pudval.pgd.pgd, pudval.pgd.pgd >> 32);
407} 848}
408 849
409static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 850static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
410{ 851{
411 paravirt_ops.pte_clear(mm, addr, ptep); 852 PVOP_VCALL3(pte_clear, mm, addr, ptep);
412} 853}
413 854
414static inline void pmd_clear(pmd_t *pmdp) 855static inline void pmd_clear(pmd_t *pmdp)
415{ 856{
416 paravirt_ops.pmd_clear(pmdp); 857 PVOP_VCALL1(pmd_clear, pmdp);
417} 858}
418#endif
419 859
420/* Lazy mode for batching updates / context switch */ 860#else /* !CONFIG_X86_PAE */
421#define PARAVIRT_LAZY_NONE 0 861
422#define PARAVIRT_LAZY_MMU 1 862static inline pte_t __pte(unsigned long val)
423#define PARAVIRT_LAZY_CPU 2 863{
424#define PARAVIRT_LAZY_FLUSH 3 864 return (pte_t) { PVOP_CALL1(unsigned long, make_pte, val) };
865}
866
867static inline pgd_t __pgd(unsigned long val)
868{
869 return (pgd_t) { PVOP_CALL1(unsigned long, make_pgd, val) };
870}
871
872static inline unsigned long pte_val(pte_t x)
873{
874 return PVOP_CALL1(unsigned long, pte_val, x.pte_low);
875}
876
877static inline unsigned long pgd_val(pgd_t x)
878{
879 return PVOP_CALL1(unsigned long, pgd_val, x.pgd);
880}
881
882static inline void set_pte(pte_t *ptep, pte_t pteval)
883{
884 PVOP_VCALL2(set_pte, ptep, pteval.pte_low);
885}
886
887static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
888 pte_t *ptep, pte_t pteval)
889{
890 PVOP_VCALL4(set_pte_at, mm, addr, ptep, pteval.pte_low);
891}
892
893static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval)
894{
895 PVOP_VCALL2(set_pmd, pmdp, pmdval.pud.pgd.pgd);
896}
897#endif /* CONFIG_X86_PAE */
425 898
426#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE 899#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
427#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU) 900static inline void arch_enter_lazy_cpu_mode(void)
428#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 901{
429#define arch_flush_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH) 902 PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_CPU);
903}
904
905static inline void arch_leave_lazy_cpu_mode(void)
906{
907 PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_NONE);
908}
909
910static inline void arch_flush_lazy_cpu_mode(void)
911{
912 PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH);
913}
914
430 915
431#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 916#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
432#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU) 917static inline void arch_enter_lazy_mmu_mode(void)
433#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 918{
434#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH) 919 PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_MMU);
920}
921
922static inline void arch_leave_lazy_mmu_mode(void)
923{
924 PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_NONE);
925}
926
927static inline void arch_flush_lazy_mmu_mode(void)
928{
929 PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH);
930}
931
932void _paravirt_nop(void);
933#define paravirt_nop ((void *)_paravirt_nop)
435 934
436/* These all sit in the .parainstructions section to tell us what to patch. */ 935/* These all sit in the .parainstructions section to tell us what to patch. */
437struct paravirt_patch { 936struct paravirt_patch_site {
438 u8 *instr; /* original instructions */ 937 u8 *instr; /* original instructions */
439 u8 instrtype; /* type of this instruction */ 938 u8 instrtype; /* type of this instruction */
440 u8 len; /* length of original instruction */ 939 u8 len; /* length of original instruction */
441 u16 clobbers; /* what registers you may clobber */ 940 u16 clobbers; /* what registers you may clobber */
442}; 941};
443 942
444#define paravirt_alt(insn_string, typenum, clobber) \ 943extern struct paravirt_patch_site __parainstructions[],
445 "771:\n\t" insn_string "\n" "772:\n" \ 944 __parainstructions_end[];
446 ".pushsection .parainstructions,\"a\"\n" \
447 " .long 771b\n" \
448 " .byte " __stringify(typenum) "\n" \
449 " .byte 772b-771b\n" \
450 " .short " __stringify(clobber) "\n" \
451 ".popsection"
452 945
453static inline unsigned long __raw_local_save_flags(void) 946static inline unsigned long __raw_local_save_flags(void)
454{ 947{
455 unsigned long f; 948 unsigned long f;
456 949
457 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;" 950 asm volatile(paravirt_alt("pushl %%ecx; pushl %%edx;"
458 "call *%1;" 951 PARAVIRT_CALL
459 "popl %%edx; popl %%ecx", 952 "popl %%edx; popl %%ecx")
460 PARAVIRT_SAVE_FLAGS, CLBR_NONE) 953 : "=a"(f)
461 : "=a"(f): "m"(paravirt_ops.save_fl) 954 : paravirt_type(save_fl),
462 : "memory", "cc"); 955 paravirt_clobber(CLBR_EAX)
956 : "memory", "cc");
463 return f; 957 return f;
464} 958}
465 959
466static inline void raw_local_irq_restore(unsigned long f) 960static inline void raw_local_irq_restore(unsigned long f)
467{ 961{
468 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;" 962 asm volatile(paravirt_alt("pushl %%ecx; pushl %%edx;"
469 "call *%1;" 963 PARAVIRT_CALL
470 "popl %%edx; popl %%ecx", 964 "popl %%edx; popl %%ecx")
471 PARAVIRT_RESTORE_FLAGS, CLBR_EAX) 965 : "=a"(f)
472 : "=a"(f) : "m" (paravirt_ops.restore_fl), "0"(f) 966 : "0"(f),
473 : "memory", "cc"); 967 paravirt_type(restore_fl),
968 paravirt_clobber(CLBR_EAX)
969 : "memory", "cc");
474} 970}
475 971
476static inline void raw_local_irq_disable(void) 972static inline void raw_local_irq_disable(void)
477{ 973{
478 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;" 974 asm volatile(paravirt_alt("pushl %%ecx; pushl %%edx;"
479 "call *%0;" 975 PARAVIRT_CALL
480 "popl %%edx; popl %%ecx", 976 "popl %%edx; popl %%ecx")
481 PARAVIRT_IRQ_DISABLE, CLBR_EAX) 977 :
482 : : "m" (paravirt_ops.irq_disable) 978 : paravirt_type(irq_disable),
483 : "memory", "eax", "cc"); 979 paravirt_clobber(CLBR_EAX)
980 : "memory", "eax", "cc");
484} 981}
485 982
486static inline void raw_local_irq_enable(void) 983static inline void raw_local_irq_enable(void)
487{ 984{
488 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;" 985 asm volatile(paravirt_alt("pushl %%ecx; pushl %%edx;"
489 "call *%0;" 986 PARAVIRT_CALL
490 "popl %%edx; popl %%ecx", 987 "popl %%edx; popl %%ecx")
491 PARAVIRT_IRQ_ENABLE, CLBR_EAX) 988 :
492 : : "m" (paravirt_ops.irq_enable) 989 : paravirt_type(irq_enable),
493 : "memory", "eax", "cc"); 990 paravirt_clobber(CLBR_EAX)
991 : "memory", "eax", "cc");
494} 992}
495 993
496static inline unsigned long __raw_local_irq_save(void) 994static inline unsigned long __raw_local_irq_save(void)
497{ 995{
498 unsigned long f; 996 unsigned long f;
499 997
500 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;" 998 f = __raw_local_save_flags();
501 "call *%1; pushl %%eax;" 999 raw_local_irq_disable();
502 "call *%2; popl %%eax;"
503 "popl %%edx; popl %%ecx",
504 PARAVIRT_SAVE_FLAGS_IRQ_DISABLE,
505 CLBR_NONE)
506 : "=a"(f)
507 : "m" (paravirt_ops.save_fl),
508 "m" (paravirt_ops.irq_disable)
509 : "memory", "cc");
510 return f; 1000 return f;
511} 1001}
512 1002
513#define CLI_STRING paravirt_alt("pushl %%ecx; pushl %%edx;" \ 1003#define CLI_STRING \
514 "call *paravirt_ops+%c[irq_disable];" \ 1004 _paravirt_alt("pushl %%ecx; pushl %%edx;" \
515 "popl %%edx; popl %%ecx", \ 1005 "call *paravirt_ops+%c[paravirt_cli_type]*4;" \
516 PARAVIRT_IRQ_DISABLE, CLBR_EAX) 1006 "popl %%edx; popl %%ecx", \
1007 "%c[paravirt_cli_type]", "%c[paravirt_clobber]")
1008
1009#define STI_STRING \
1010 _paravirt_alt("pushl %%ecx; pushl %%edx;" \
1011 "call *paravirt_ops+%c[paravirt_sti_type]*4;" \
1012 "popl %%edx; popl %%ecx", \
1013 "%c[paravirt_sti_type]", "%c[paravirt_clobber]")
517 1014
518#define STI_STRING paravirt_alt("pushl %%ecx; pushl %%edx;" \
519 "call *paravirt_ops+%c[irq_enable];" \
520 "popl %%edx; popl %%ecx", \
521 PARAVIRT_IRQ_ENABLE, CLBR_EAX)
522#define CLI_STI_CLOBBERS , "%eax" 1015#define CLI_STI_CLOBBERS , "%eax"
523#define CLI_STI_INPUT_ARGS \ 1016#define CLI_STI_INPUT_ARGS \
524 , \ 1017 , \
525 [irq_disable] "i" (offsetof(struct paravirt_ops, irq_disable)), \ 1018 [paravirt_cli_type] "i" (PARAVIRT_PATCH(irq_disable)), \
526 [irq_enable] "i" (offsetof(struct paravirt_ops, irq_enable)) 1019 [paravirt_sti_type] "i" (PARAVIRT_PATCH(irq_enable)), \
1020 paravirt_clobber(CLBR_EAX)
1021
1022/* Make sure as little as possible of this mess escapes. */
1023#undef PARAVIRT_CALL
1024#undef __PVOP_CALL
1025#undef __PVOP_VCALL
1026#undef PVOP_VCALL0
1027#undef PVOP_CALL0
1028#undef PVOP_VCALL1
1029#undef PVOP_CALL1
1030#undef PVOP_VCALL2
1031#undef PVOP_CALL2
1032#undef PVOP_VCALL3
1033#undef PVOP_CALL3
1034#undef PVOP_VCALL4
1035#undef PVOP_CALL4
527 1036
528#else /* __ASSEMBLY__ */ 1037#else /* __ASSEMBLY__ */
529 1038
530#define PARA_PATCH(ptype, clobbers, ops) \ 1039#define PARA_PATCH(off) ((off) / 4)
1040
1041#define PARA_SITE(ptype, clobbers, ops) \
531771:; \ 1042771:; \
532 ops; \ 1043 ops; \
533772:; \ 1044772:; \
@@ -538,28 +1049,30 @@ static inline unsigned long __raw_local_irq_save(void)
538 .short clobbers; \ 1049 .short clobbers; \
539 .popsection 1050 .popsection
540 1051
541#define INTERRUPT_RETURN \ 1052#define INTERRUPT_RETURN \
542 PARA_PATCH(PARAVIRT_INTERRUPT_RETURN, CLBR_ANY, \ 1053 PARA_SITE(PARA_PATCH(PARAVIRT_iret), CLBR_NONE, \
543 jmp *%cs:paravirt_ops+PARAVIRT_iret) 1054 jmp *%cs:paravirt_ops+PARAVIRT_iret)
544 1055
545#define DISABLE_INTERRUPTS(clobbers) \ 1056#define DISABLE_INTERRUPTS(clobbers) \
546 PARA_PATCH(PARAVIRT_IRQ_DISABLE, clobbers, \ 1057 PARA_SITE(PARA_PATCH(PARAVIRT_irq_disable), clobbers, \
547 pushl %ecx; pushl %edx; \ 1058 pushl %eax; pushl %ecx; pushl %edx; \
548 call *paravirt_ops+PARAVIRT_irq_disable; \ 1059 call *%cs:paravirt_ops+PARAVIRT_irq_disable; \
549 popl %edx; popl %ecx) \ 1060 popl %edx; popl %ecx; popl %eax) \
550 1061
551#define ENABLE_INTERRUPTS(clobbers) \ 1062#define ENABLE_INTERRUPTS(clobbers) \
552 PARA_PATCH(PARAVIRT_IRQ_ENABLE, clobbers, \ 1063 PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable), clobbers, \
553 pushl %ecx; pushl %edx; \ 1064 pushl %eax; pushl %ecx; pushl %edx; \
554 call *%cs:paravirt_ops+PARAVIRT_irq_enable; \ 1065 call *%cs:paravirt_ops+PARAVIRT_irq_enable; \
555 popl %edx; popl %ecx) 1066 popl %edx; popl %ecx; popl %eax)
556 1067
557#define ENABLE_INTERRUPTS_SYSEXIT \ 1068#define ENABLE_INTERRUPTS_SYSEXIT \
558 PARA_PATCH(PARAVIRT_STI_SYSEXIT, CLBR_ANY, \ 1069 PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable_sysexit), CLBR_NONE, \
559 jmp *%cs:paravirt_ops+PARAVIRT_irq_enable_sysexit) 1070 jmp *%cs:paravirt_ops+PARAVIRT_irq_enable_sysexit)
560 1071
561#define GET_CR0_INTO_EAX \ 1072#define GET_CR0_INTO_EAX \
562 call *paravirt_ops+PARAVIRT_read_cr0 1073 push %ecx; push %edx; \
1074 call *paravirt_ops+PARAVIRT_read_cr0; \
1075 pop %edx; pop %ecx
563 1076
564#endif /* __ASSEMBLY__ */ 1077#endif /* __ASSEMBLY__ */
565#endif /* CONFIG_PARAVIRT */ 1078#endif /* CONFIG_PARAVIRT */
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h
deleted file mode 100644
index b12d59a318b..00000000000
--- a/include/asm-i386/pda.h
+++ /dev/null
@@ -1,100 +0,0 @@
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,%%fs:%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,%%fs:%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,%%fs:%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 %%fs:%c1,%0" \
69 : "=r" (ret__) \
70 : "i" (pda_offset(field)), \
71 "m" (_proxy_pda.field)); \
72 break; \
73 case 2: \
74 asm(op "w %%fs:%c1,%0" \
75 : "=r" (ret__) \
76 : "i" (pda_offset(field)), \
77 "m" (_proxy_pda.field)); \
78 break; \
79 case 4: \
80 asm(op "l %%fs:%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 510ae1d3486..f54830b5d5a 100644
--- a/include/asm-i386/percpu.h
+++ b/include/asm-i386/percpu.h
@@ -1,9 +1,32 @@
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#ifdef __ASSEMBLY__
5#include <asm-generic/percpu.h> 5
6#else 6/*
7 * PER_CPU finds an address of a per-cpu variable.
8 *
9 * Args:
10 * var - variable name
11 * reg - 32bit register
12 *
13 * The resulting address is stored in the "reg" argument.
14 *
15 * Example:
16 * PER_CPU(cpu_gdt_descr, %ebx)
17 */
18#ifdef CONFIG_SMP
19#define PER_CPU(var, reg) \
20 movl %fs:per_cpu__##this_cpu_off, reg; \
21 lea per_cpu__##var(reg), reg
22#define PER_CPU_VAR(var) %fs:per_cpu__##var
23#else /* ! SMP */
24#define PER_CPU(var, reg) \
25 movl $per_cpu__##var, reg
26#define PER_CPU_VAR(var) per_cpu__##var
27#endif /* SMP */
28
29#else /* ...!ASSEMBLY */
7 30
8/* 31/*
9 * PER_CPU finds an address of a per-cpu variable. 32 * PER_CPU finds an address of a per-cpu variable.
@@ -18,14 +41,109 @@
18 * PER_CPU(cpu_gdt_descr, %ebx) 41 * PER_CPU(cpu_gdt_descr, %ebx)
19 */ 42 */
20#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
21#define PER_CPU(var, cpu) \ 44/* Same as generic implementation except for optimized local access. */
22 movl __per_cpu_offset(,cpu,4), cpu; \ 45#define __GENERIC_PER_CPU
23 addl $per_cpu__/**/var, cpu; 46
24#else /* ! SMP */ 47/* This is used for other cpus to find our section. */
25#define PER_CPU(var, cpu) \ 48extern unsigned long __per_cpu_offset[];
26 movl $per_cpu__/**/var, cpu; 49
50#define per_cpu_offset(x) (__per_cpu_offset[x])
51
52/* Separate out the type, so (int[3], foo) works. */
53#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
54#define DEFINE_PER_CPU(type, name) \
55 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
56
57/* We can use this directly for local CPU (faster). */
58DECLARE_PER_CPU(unsigned long, this_cpu_off);
59
60/* var is in discarded region: offset to particular copy we want */
61#define per_cpu(var, cpu) (*({ \
62 extern int simple_indentifier_##var(void); \
63 RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))
64
65#define __raw_get_cpu_var(var) (*({ \
66 extern int simple_indentifier_##var(void); \
67 RELOC_HIDE(&per_cpu__##var, x86_read_percpu(this_cpu_off)); \
68}))
69
70#define __get_cpu_var(var) __raw_get_cpu_var(var)
71
72/* A macro to avoid #include hell... */
73#define percpu_modcopy(pcpudst, src, size) \
74do { \
75 unsigned int __i; \
76 for_each_possible_cpu(__i) \
77 memcpy((pcpudst)+__per_cpu_offset[__i], \
78 (src), (size)); \
79} while (0)
80
81#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
82#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
83
84/* fs segment starts at (positive) offset == __per_cpu_offset[cpu] */
85#define __percpu_seg "%%fs:"
86#else /* !SMP */
87#include <asm-generic/percpu.h>
88#define __percpu_seg ""
27#endif /* SMP */ 89#endif /* SMP */
28 90
91/* For arch-specific code, we can use direct single-insn ops (they
92 * don't give an lvalue though). */
93extern void __bad_percpu_size(void);
94
95#define percpu_to_op(op,var,val) \
96 do { \
97 typedef typeof(var) T__; \
98 if (0) { T__ tmp__; tmp__ = (val); } \
99 switch (sizeof(var)) { \
100 case 1: \
101 asm(op "b %1,"__percpu_seg"%0" \
102 : "+m" (var) \
103 :"ri" ((T__)val)); \
104 break; \
105 case 2: \
106 asm(op "w %1,"__percpu_seg"%0" \
107 : "+m" (var) \
108 :"ri" ((T__)val)); \
109 break; \
110 case 4: \
111 asm(op "l %1,"__percpu_seg"%0" \
112 : "+m" (var) \
113 :"ri" ((T__)val)); \
114 break; \
115 default: __bad_percpu_size(); \
116 } \
117 } while (0)
118
119#define percpu_from_op(op,var) \
120 ({ \
121 typeof(var) ret__; \
122 switch (sizeof(var)) { \
123 case 1: \
124 asm(op "b "__percpu_seg"%1,%0" \
125 : "=r" (ret__) \
126 : "m" (var)); \
127 break; \
128 case 2: \
129 asm(op "w "__percpu_seg"%1,%0" \
130 : "=r" (ret__) \
131 : "m" (var)); \
132 break; \
133 case 4: \
134 asm(op "l "__percpu_seg"%1,%0" \
135 : "=r" (ret__) \
136 : "m" (var)); \
137 break; \
138 default: __bad_percpu_size(); \
139 } \
140 ret__; })
141
142#define x86_read_percpu(var) percpu_from_op("mov", per_cpu__##var)
143#define x86_write_percpu(var,val) percpu_to_op("mov", per_cpu__##var, val)
144#define x86_add_percpu(var,val) percpu_to_op("add", per_cpu__##var, val)
145#define x86_sub_percpu(var,val) percpu_to_op("sub", per_cpu__##var, val)
146#define x86_or_percpu(var,val) percpu_to_op("or", per_cpu__##var, val)
29#endif /* !__ASSEMBLY__ */ 147#endif /* !__ASSEMBLY__ */
30 148
31#endif /* __ARCH_I386_PERCPU__ */ 149#endif /* __ARCH_I386_PERCPU__ */
diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h
index c8dc2d0141a..47430175b75 100644
--- a/include/asm-i386/pgalloc.h
+++ b/include/asm-i386/pgalloc.h
@@ -1,7 +1,6 @@
1#ifndef _I386_PGALLOC_H 1#ifndef _I386_PGALLOC_H
2#define _I386_PGALLOC_H 2#define _I386_PGALLOC_H
3 3
4#include <asm/fixmap.h>
5#include <linux/threads.h> 4#include <linux/threads.h>
6#include <linux/mm.h> /* for struct page */ 5#include <linux/mm.h> /* for struct page */
7 6
diff --git a/include/asm-i386/pgtable-2level-defs.h b/include/asm-i386/pgtable-2level-defs.h
index 02518079f81..0f71c9f13da 100644
--- a/include/asm-i386/pgtable-2level-defs.h
+++ b/include/asm-i386/pgtable-2level-defs.h
@@ -1,6 +1,8 @@
1#ifndef _I386_PGTABLE_2LEVEL_DEFS_H 1#ifndef _I386_PGTABLE_2LEVEL_DEFS_H
2#define _I386_PGTABLE_2LEVEL_DEFS_H 2#define _I386_PGTABLE_2LEVEL_DEFS_H
3 3
4#define SHARED_KERNEL_PMD 0
5
4/* 6/*
5 * traditional i386 two-level paging structure: 7 * traditional i386 two-level paging structure:
6 */ 8 */
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index 38c3fcc0676..a50fd1773de 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -11,10 +11,23 @@
11 * within a page table are directly modified. Thus, the following 11 * within a page table are directly modified. Thus, the following
12 * hook is made available. 12 * hook is made available.
13 */ 13 */
14static inline void native_set_pte(pte_t *ptep , pte_t pte)
15{
16 *ptep = pte;
17}
18static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
19 pte_t *ptep , pte_t pte)
20{
21 native_set_pte(ptep, pte);
22}
23static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
24{
25 *pmdp = pmd;
26}
14#ifndef CONFIG_PARAVIRT 27#ifndef CONFIG_PARAVIRT
15#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 28#define set_pte(pteptr, pteval) native_set_pte(pteptr, pteval)
16#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 29#define set_pte_at(mm,addr,ptep,pteval) native_set_pte_at(mm, addr, ptep, pteval)
17#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) 30#define set_pmd(pmdptr, pmdval) native_set_pmd(pmdptr, pmdval)
18#endif 31#endif
19 32
20#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval) 33#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
@@ -23,11 +36,23 @@
23#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 36#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
24#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 37#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
25 38
26#define raw_ptep_get_and_clear(xp) __pte(xchg(&(xp)->pte_low, 0)) 39static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *xp)
40{
41 *xp = __pte(0);
42}
43
44#ifdef CONFIG_SMP
45static inline pte_t native_ptep_get_and_clear(pte_t *xp)
46{
47 return __pte(xchg(&xp->pte_low, 0));
48}
49#else
50#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
51#endif
27 52
28#define pte_page(x) pfn_to_page(pte_pfn(x)) 53#define pte_page(x) pfn_to_page(pte_pfn(x))
29#define pte_none(x) (!(x).pte_low) 54#define pte_none(x) (!(x).pte_low)
30#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) 55#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
31#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 56#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
32#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 57#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
33 58
@@ -66,6 +91,4 @@ static inline int pte_exec_kernel(pte_t pte)
66#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low }) 91#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
67#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 92#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
68 93
69void vmalloc_sync_all(void);
70
71#endif /* _I386_PGTABLE_2LEVEL_H */ 94#endif /* _I386_PGTABLE_2LEVEL_H */
diff --git a/include/asm-i386/pgtable-3level-defs.h b/include/asm-i386/pgtable-3level-defs.h
index eb3a1ea8867..c0df89f66e8 100644
--- a/include/asm-i386/pgtable-3level-defs.h
+++ b/include/asm-i386/pgtable-3level-defs.h
@@ -1,6 +1,12 @@
1#ifndef _I386_PGTABLE_3LEVEL_DEFS_H 1#ifndef _I386_PGTABLE_3LEVEL_DEFS_H
2#define _I386_PGTABLE_3LEVEL_DEFS_H 2#define _I386_PGTABLE_3LEVEL_DEFS_H
3 3
4#ifdef CONFIG_PARAVIRT
5#define SHARED_KERNEL_PMD (paravirt_ops.shared_kernel_pmd)
6#else
7#define SHARED_KERNEL_PMD 1
8#endif
9
4/* 10/*
5 * PGDIR_SHIFT determines what a top-level page table entry can map 11 * PGDIR_SHIFT determines what a top-level page table entry can map
6 */ 12 */
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index 7a2318f3830..eb0f1d7e96a 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -42,20 +42,23 @@ static inline int pte_exec_kernel(pte_t pte)
42 return pte_x(pte); 42 return pte_x(pte);
43} 43}
44 44
45#ifndef CONFIG_PARAVIRT
46/* Rules for using set_pte: the pte being assigned *must* be 45/* Rules for using set_pte: the pte being assigned *must* be
47 * either not present or in a state where the hardware will 46 * either not present or in a state where the hardware will
48 * not attempt to update the pte. In places where this is 47 * not attempt to update the pte. In places where this is
49 * not possible, use pte_get_and_clear to obtain the old pte 48 * not possible, use pte_get_and_clear to obtain the old pte
50 * value and then use set_pte to update it. -ben 49 * value and then use set_pte to update it. -ben
51 */ 50 */
52static inline void set_pte(pte_t *ptep, pte_t pte) 51static inline void native_set_pte(pte_t *ptep, pte_t pte)
53{ 52{
54 ptep->pte_high = pte.pte_high; 53 ptep->pte_high = pte.pte_high;
55 smp_wmb(); 54 smp_wmb();
56 ptep->pte_low = pte.pte_low; 55 ptep->pte_low = pte.pte_low;
57} 56}
58#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 57static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
58 pte_t *ptep , pte_t pte)
59{
60 native_set_pte(ptep, pte);
61}
59 62
60/* 63/*
61 * Since this is only called on user PTEs, and the page fault handler 64 * Since this is only called on user PTEs, and the page fault handler
@@ -63,7 +66,8 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
63 * we are justified in merely clearing the PTE present bit, followed 66 * we are justified in merely clearing the PTE present bit, followed
64 * by a set. The ordering here is important. 67 * by a set. The ordering here is important.
65 */ 68 */
66static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) 69static inline void native_set_pte_present(struct mm_struct *mm, unsigned long addr,
70 pte_t *ptep, pte_t pte)
67{ 71{
68 ptep->pte_low = 0; 72 ptep->pte_low = 0;
69 smp_wmb(); 73 smp_wmb();
@@ -72,32 +76,48 @@ static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte
72 ptep->pte_low = pte.pte_low; 76 ptep->pte_low = pte.pte_low;
73} 77}
74 78
75#define set_pte_atomic(pteptr,pteval) \ 79static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
76 set_64bit((unsigned long long *)(pteptr),pte_val(pteval)) 80{
77#define set_pmd(pmdptr,pmdval) \ 81 set_64bit((unsigned long long *)(ptep),native_pte_val(pte));
78 set_64bit((unsigned long long *)(pmdptr),pmd_val(pmdval)) 82}
79#define set_pud(pudptr,pudval) \ 83static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
80 (*(pudptr) = (pudval)) 84{
85 set_64bit((unsigned long long *)(pmdp),native_pmd_val(pmd));
86}
87static inline void native_set_pud(pud_t *pudp, pud_t pud)
88{
89 *pudp = pud;
90}
81 91
82/* 92/*
83 * For PTEs and PDEs, we must clear the P-bit first when clearing a page table 93 * For PTEs and PDEs, we must clear the P-bit first when clearing a page table
84 * entry, so clear the bottom half first and enforce ordering with a compiler 94 * entry, so clear the bottom half first and enforce ordering with a compiler
85 * barrier. 95 * barrier.
86 */ 96 */
87static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 97static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
88{ 98{
89 ptep->pte_low = 0; 99 ptep->pte_low = 0;
90 smp_wmb(); 100 smp_wmb();
91 ptep->pte_high = 0; 101 ptep->pte_high = 0;
92} 102}
93 103
94static inline void pmd_clear(pmd_t *pmd) 104static inline void native_pmd_clear(pmd_t *pmd)
95{ 105{
96 u32 *tmp = (u32 *)pmd; 106 u32 *tmp = (u32 *)pmd;
97 *tmp = 0; 107 *tmp = 0;
98 smp_wmb(); 108 smp_wmb();
99 *(tmp + 1) = 0; 109 *(tmp + 1) = 0;
100} 110}
111
112#ifndef CONFIG_PARAVIRT
113#define set_pte(ptep, pte) native_set_pte(ptep, pte)
114#define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
115#define set_pte_present(mm, addr, ptep, pte) native_set_pte_present(mm, addr, ptep, pte)
116#define set_pte_atomic(ptep, pte) native_set_pte_atomic(ptep, pte)
117#define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd)
118#define set_pud(pudp, pud) native_set_pud(pudp, pud)
119#define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep)
120#define pmd_clear(pmd) native_pmd_clear(pmd)
101#endif 121#endif
102 122
103/* 123/*
@@ -119,7 +139,8 @@ static inline void pud_clear (pud_t * pud) { }
119#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \ 139#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
120 pmd_index(address)) 140 pmd_index(address))
121 141
122static inline pte_t raw_ptep_get_and_clear(pte_t *ptep) 142#ifdef CONFIG_SMP
143static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
123{ 144{
124 pte_t res; 145 pte_t res;
125 146
@@ -130,6 +151,9 @@ static inline pte_t raw_ptep_get_and_clear(pte_t *ptep)
130 151
131 return res; 152 return res;
132} 153}
154#else
155#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
156#endif
133 157
134#define __HAVE_ARCH_PTE_SAME 158#define __HAVE_ARCH_PTE_SAME
135static inline int pte_same(pte_t a, pte_t b) 159static inline int pte_same(pte_t a, pte_t b)
@@ -146,28 +170,21 @@ static inline int pte_none(pte_t pte)
146 170
147static inline unsigned long pte_pfn(pte_t pte) 171static inline unsigned long pte_pfn(pte_t pte)
148{ 172{
149 return (pte.pte_low >> PAGE_SHIFT) | 173 return pte_val(pte) >> PAGE_SHIFT;
150 (pte.pte_high << (32 - PAGE_SHIFT));
151} 174}
152 175
153extern unsigned long long __supported_pte_mask; 176extern unsigned long long __supported_pte_mask;
154 177
155static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) 178static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
156{ 179{
157 pte_t pte; 180 return __pte((((unsigned long long)page_nr << PAGE_SHIFT) |
158 181 pgprot_val(pgprot)) & __supported_pte_mask);
159 pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) | \
160 (pgprot_val(pgprot) >> 32);
161 pte.pte_high &= (__supported_pte_mask >> 32);
162 pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)) & \
163 __supported_pte_mask;
164 return pte;
165} 182}
166 183
167static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) 184static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
168{ 185{
169 return __pmd((((unsigned long long)page_nr << PAGE_SHIFT) | \ 186 return __pmd((((unsigned long long)page_nr << PAGE_SHIFT) |
170 pgprot_val(pgprot)) & __supported_pte_mask); 187 pgprot_val(pgprot)) & __supported_pte_mask);
171} 188}
172 189
173/* 190/*
@@ -187,6 +204,4 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
187 204
188#define __pmd_free_tlb(tlb, x) do { } while (0) 205#define __pmd_free_tlb(tlb, x) do { } while (0)
189 206
190#define vmalloc_sync_all() ((void)0)
191
192#endif /* _I386_PGTABLE_3LEVEL_H */ 207#endif /* _I386_PGTABLE_3LEVEL_H */
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index c3b58d473a5..c6b8b944120 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -159,6 +159,7 @@ void paging_init(void);
159 159
160extern unsigned long long __PAGE_KERNEL, __PAGE_KERNEL_EXEC; 160extern unsigned long long __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
161#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW) 161#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW)
162#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
162#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD) 163#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD)
163#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE) 164#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
164#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE) 165#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
@@ -166,6 +167,7 @@ extern unsigned long long __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
166#define PAGE_KERNEL __pgprot(__PAGE_KERNEL) 167#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
167#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO) 168#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
168#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) 169#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
170#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX)
169#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE) 171#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
170#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE) 172#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
171#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC) 173#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
@@ -241,6 +243,8 @@ static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; re
241static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 243static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
242static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return pte; } 244static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return pte; }
243 245
246extern void vmalloc_sync_all(void);
247
244#ifdef CONFIG_X86_PAE 248#ifdef CONFIG_X86_PAE
245# include <asm/pgtable-3level.h> 249# include <asm/pgtable-3level.h>
246#else 250#else
@@ -263,9 +267,18 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
263 */ 267 */
264#define pte_update(mm, addr, ptep) do { } while (0) 268#define pte_update(mm, addr, ptep) do { } while (0)
265#define pte_update_defer(mm, addr, ptep) do { } while (0) 269#define pte_update_defer(mm, addr, ptep) do { } while (0)
266#define paravirt_map_pt_hook(slot, va, pfn) do { } while (0)
267#endif 270#endif
268 271
272/* local pte updates need not use xchg for locking */
273static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
274{
275 pte_t res = *ptep;
276
277 /* Pure native function needs no input for mm, addr */
278 native_pte_clear(NULL, 0, ptep);
279 return res;
280}
281
269/* 282/*
270 * We only update the dirty/accessed state if we set 283 * We only update the dirty/accessed state if we set
271 * the dirty bit by hand in the kernel, since the hardware 284 * the dirty bit by hand in the kernel, since the hardware
@@ -330,7 +343,7 @@ do { \
330#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 343#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
331static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 344static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
332{ 345{
333 pte_t pte = raw_ptep_get_and_clear(ptep); 346 pte_t pte = native_ptep_get_and_clear(ptep);
334 pte_update(mm, addr, ptep); 347 pte_update(mm, addr, ptep);
335 return pte; 348 return pte;
336} 349}
@@ -340,8 +353,11 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
340{ 353{
341 pte_t pte; 354 pte_t pte;
342 if (full) { 355 if (full) {
343 pte = *ptep; 356 /*
344 pte_clear(mm, addr, ptep); 357 * Full address destruction in progress; paravirt does not
358 * care about updates and native needs no locking
359 */
360 pte = native_local_ptep_get_and_clear(ptep);
345 } else { 361 } else {
346 pte = ptep_get_and_clear(mm, addr, ptep); 362 pte = ptep_get_and_clear(mm, addr, ptep);
347 } 363 }
@@ -470,24 +486,10 @@ extern pte_t *lookup_address(unsigned long address);
470#endif 486#endif
471 487
472#if defined(CONFIG_HIGHPTE) 488#if defined(CONFIG_HIGHPTE)
473#define pte_offset_map(dir, address) \ 489#define pte_offset_map(dir, address) \
474({ \ 490 ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
475 pte_t *__ptep; \ 491#define pte_offset_map_nested(dir, address) \
476 unsigned pfn = pmd_val(*(dir)) >> PAGE_SHIFT; \ 492 ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE1) + pte_index(address))
477 __ptep = (pte_t *)kmap_atomic(pfn_to_page(pfn),KM_PTE0);\
478 paravirt_map_pt_hook(KM_PTE0,__ptep, pfn); \
479 __ptep = __ptep + pte_index(address); \
480 __ptep; \
481})
482#define pte_offset_map_nested(dir, address) \
483({ \
484 pte_t *__ptep; \
485 unsigned pfn = pmd_val(*(dir)) >> PAGE_SHIFT; \
486 __ptep = (pte_t *)kmap_atomic(pfn_to_page(pfn),KM_PTE1);\
487 paravirt_map_pt_hook(KM_PTE1,__ptep, pfn); \
488 __ptep = __ptep + pte_index(address); \
489 __ptep; \
490})
491#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0) 493#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
492#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1) 494#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
493#else 495#else
@@ -510,6 +512,22 @@ do { \
510 * tables contain all the necessary information. 512 * tables contain all the necessary information.
511 */ 513 */
512#define update_mmu_cache(vma,address,pte) do { } while (0) 514#define update_mmu_cache(vma,address,pte) do { } while (0)
515
516void native_pagetable_setup_start(pgd_t *base);
517void native_pagetable_setup_done(pgd_t *base);
518
519#ifndef CONFIG_PARAVIRT
520static inline void paravirt_pagetable_setup_start(pgd_t *base)
521{
522 native_pagetable_setup_start(base);
523}
524
525static inline void paravirt_pagetable_setup_done(pgd_t *base)
526{
527 native_pagetable_setup_done(base);
528}
529#endif /* !CONFIG_PARAVIRT */
530
513#endif /* !__ASSEMBLY__ */ 531#endif /* !__ASSEMBLY__ */
514 532
515#ifdef CONFIG_FLATMEM 533#ifdef CONFIG_FLATMEM
diff --git a/include/asm-i386/processor-flags.h b/include/asm-i386/processor-flags.h
new file mode 100644
index 00000000000..5404e90edd5
--- /dev/null
+++ b/include/asm-i386/processor-flags.h
@@ -0,0 +1,91 @@
1#ifndef __ASM_I386_PROCESSOR_FLAGS_H
2#define __ASM_I386_PROCESSOR_FLAGS_H
3/* Various flags defined: can be included from assembler. */
4
5/*
6 * EFLAGS bits
7 */
8#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
9#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
10#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
11#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
12#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
13#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
14#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
15#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
16#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
17#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
18#define X86_EFLAGS_NT 0x00004000 /* Nested Task */
19#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
20#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
21#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
22#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
23#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
24#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
25
26/*
27 * Basic CPU control in CR0
28 */
29#define X86_CR0_PE 0x00000001 /* Protection Enable */
30#define X86_CR0_MP 0x00000002 /* Monitor Coprocessor */
31#define X86_CR0_EM 0x00000004 /* Emulation */
32#define X86_CR0_TS 0x00000008 /* Task Switched */
33#define X86_CR0_ET 0x00000010 /* Extension Type */
34#define X86_CR0_NE 0x00000020 /* Numeric Error */
35#define X86_CR0_WP 0x00010000 /* Write Protect */
36#define X86_CR0_AM 0x00040000 /* Alignment Mask */
37#define X86_CR0_NW 0x20000000 /* Not Write-through */
38#define X86_CR0_CD 0x40000000 /* Cache Disable */
39#define X86_CR0_PG 0x80000000 /* Paging */
40
41/*
42 * Paging options in CR3
43 */
44#define X86_CR3_PWT 0x00000008 /* Page Write Through */
45#define X86_CR3_PCD 0x00000010 /* Page Cache Disable */
46
47/*
48 * Intel CPU features in CR4
49 */
50#define X86_CR4_VME 0x00000001 /* enable vm86 extensions */
51#define X86_CR4_PVI 0x00000002 /* virtual interrupts flag enable */
52#define X86_CR4_TSD 0x00000004 /* disable time stamp at ipl 3 */
53#define X86_CR4_DE 0x00000008 /* enable debugging extensions */
54#define X86_CR4_PSE 0x00000010 /* enable page size extensions */
55#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */
56#define X86_CR4_MCE 0x00000040 /* Machine check enable */
57#define X86_CR4_PGE 0x00000080 /* enable global pages */
58#define X86_CR4_PCE 0x00000100 /* enable performance counters at ipl 3 */
59#define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */
60#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */
61#define X86_CR4_VMXE 0x00002000 /* enable VMX virtualization */
62
63/*
64 * x86-64 Task Priority Register, CR8
65 */
66#define X86_CR8_TPR 0x00000007 /* task priority register */
67
68/*
69 * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h>
70 */
71
72/*
73 * NSC/Cyrix CPU configuration register indexes
74 */
75#define CX86_PCR0 0x20
76#define CX86_GCR 0xb8
77#define CX86_CCR0 0xc0
78#define CX86_CCR1 0xc1
79#define CX86_CCR2 0xc2
80#define CX86_CCR3 0xc3
81#define CX86_CCR4 0xe8
82#define CX86_CCR5 0xe9
83#define CX86_CCR6 0xea
84#define CX86_CCR7 0xeb
85#define CX86_PCR1 0xf0
86#define CX86_DIR0 0xfe
87#define CX86_DIR1 0xff
88#define CX86_ARR_BASE 0xc4
89#define CX86_RCR_BASE 0xdc
90
91#endif /* __ASM_I386_PROCESSOR_FLAGS_H */
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 11bf899de8a..70f3515c3db 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -21,6 +21,7 @@
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#include <linux/init.h>
24#include <asm/processor-flags.h>
24 25
25/* flag for disabling the tsc */ 26/* flag for disabling the tsc */
26extern int tsc_disable; 27extern int tsc_disable;
@@ -115,7 +116,8 @@ extern char ignore_fpu_irq;
115 116
116void __init cpu_detect(struct cpuinfo_x86 *c); 117void __init cpu_detect(struct cpuinfo_x86 *c);
117 118
118extern void identify_cpu(struct cpuinfo_x86 *); 119extern void identify_boot_cpu(void);
120extern void identify_secondary_cpu(struct cpuinfo_x86 *);
119extern void print_cpu_info(struct cpuinfo_x86 *); 121extern void print_cpu_info(struct cpuinfo_x86 *);
120extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 122extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
121extern unsigned short num_cache_leaves; 123extern unsigned short num_cache_leaves;
@@ -126,28 +128,7 @@ extern void detect_ht(struct cpuinfo_x86 *c);
126static inline void detect_ht(struct cpuinfo_x86 *c) {} 128static inline void detect_ht(struct cpuinfo_x86 *c) {}
127#endif 129#endif
128 130
129/* 131static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
130 * EFLAGS bits
131 */
132#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
133#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
134#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
135#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
136#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
137#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
138#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
139#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
140#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
141#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
142#define X86_EFLAGS_NT 0x00004000 /* Nested Task */
143#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
144#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
145#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
146#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
147#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
148#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
149
150static inline fastcall void native_cpuid(unsigned int *eax, unsigned int *ebx,
151 unsigned int *ecx, unsigned int *edx) 132 unsigned int *ecx, unsigned int *edx)
152{ 133{
153 /* ecx is often an input as well as an output. */ 134 /* ecx is often an input as well as an output. */
@@ -162,21 +143,6 @@ static inline fastcall void native_cpuid(unsigned int *eax, unsigned int *ebx,
162#define load_cr3(pgdir) write_cr3(__pa(pgdir)) 143#define load_cr3(pgdir) write_cr3(__pa(pgdir))
163 144
164/* 145/*
165 * Intel CPU features in CR4
166 */
167#define X86_CR4_VME 0x0001 /* enable vm86 extensions */
168#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */
169#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */
170#define X86_CR4_DE 0x0008 /* enable debugging extensions */
171#define X86_CR4_PSE 0x0010 /* enable page size extensions */
172#define X86_CR4_PAE 0x0020 /* enable physical address extensions */
173#define X86_CR4_MCE 0x0040 /* Machine check enable */
174#define X86_CR4_PGE 0x0080 /* enable global pages */
175#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */
176#define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */
177#define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */
178
179/*
180 * Save the cr4 feature set we're using (ie 146 * Save the cr4 feature set we're using (ie
181 * Pentium 4MB enable and PPro Global page 147 * Pentium 4MB enable and PPro Global page
182 * enable), so that any CPU's that boot up 148 * enable), so that any CPU's that boot up
@@ -203,26 +169,6 @@ static inline void clear_in_cr4 (unsigned long mask)
203} 169}
204 170
205/* 171/*
206 * NSC/Cyrix CPU configuration register indexes
207 */
208
209#define CX86_PCR0 0x20
210#define CX86_GCR 0xb8
211#define CX86_CCR0 0xc0
212#define CX86_CCR1 0xc1
213#define CX86_CCR2 0xc2
214#define CX86_CCR3 0xc3
215#define CX86_CCR4 0xe8
216#define CX86_CCR5 0xe9
217#define CX86_CCR6 0xea
218#define CX86_CCR7 0xeb
219#define CX86_PCR1 0xf0
220#define CX86_DIR0 0xfe
221#define CX86_DIR1 0xff
222#define CX86_ARR_BASE 0xc4
223#define CX86_RCR_BASE 0xdc
224
225/*
226 * NSC/Cyrix CPU indexed register access macros 172 * NSC/Cyrix CPU indexed register access macros
227 */ 173 */
228 174
@@ -345,7 +291,8 @@ typedef struct {
345 291
346struct thread_struct; 292struct thread_struct;
347 293
348struct tss_struct { 294/* This is the TSS defined by the hardware. */
295struct i386_hw_tss {
349 unsigned short back_link,__blh; 296 unsigned short back_link,__blh;
350 unsigned long esp0; 297 unsigned long esp0;
351 unsigned short ss0,__ss0h; 298 unsigned short ss0,__ss0h;
@@ -369,6 +316,11 @@ struct tss_struct {
369 unsigned short gs, __gsh; 316 unsigned short gs, __gsh;
370 unsigned short ldt, __ldth; 317 unsigned short ldt, __ldth;
371 unsigned short trace, io_bitmap_base; 318 unsigned short trace, io_bitmap_base;
319} __attribute__((packed));
320
321struct tss_struct {
322 struct i386_hw_tss x86_tss;
323
372 /* 324 /*
373 * The extra 1 is there because the CPU will access an 325 * The extra 1 is there because the CPU will access an
374 * additional byte beyond the end of the IO permission 326 * additional byte beyond the end of the IO permission
@@ -421,10 +373,11 @@ struct thread_struct {
421}; 373};
422 374
423#define INIT_THREAD { \ 375#define INIT_THREAD { \
376 .esp0 = sizeof(init_stack) + (long)&init_stack, \
424 .vm86_info = NULL, \ 377 .vm86_info = NULL, \
425 .sysenter_cs = __KERNEL_CS, \ 378 .sysenter_cs = __KERNEL_CS, \
426 .io_bitmap_ptr = NULL, \ 379 .io_bitmap_ptr = NULL, \
427 .fs = __KERNEL_PDA, \ 380 .fs = __KERNEL_PERCPU, \
428} 381}
429 382
430/* 383/*
@@ -434,10 +387,12 @@ struct thread_struct {
434 * be within the limit. 387 * be within the limit.
435 */ 388 */
436#define INIT_TSS { \ 389#define INIT_TSS { \
437 .esp0 = sizeof(init_stack) + (long)&init_stack, \ 390 .x86_tss = { \
438 .ss0 = __KERNEL_DS, \ 391 .esp0 = sizeof(init_stack) + (long)&init_stack, \
439 .ss1 = __KERNEL_CS, \ 392 .ss0 = __KERNEL_DS, \
440 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ 393 .ss1 = __KERNEL_CS, \
394 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
395 }, \
441 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ 396 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \
442} 397}
443 398
@@ -544,40 +499,70 @@ static inline void rep_nop(void)
544 499
545#define cpu_relax() rep_nop() 500#define cpu_relax() rep_nop()
546 501
547#ifdef CONFIG_PARAVIRT 502static inline void native_load_esp0(struct tss_struct *tss, struct thread_struct *thread)
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{ 503{
555 tss->esp0 = thread->esp0; 504 tss->x86_tss.esp0 = thread->esp0;
556 /* This can only happen when SEP is enabled, no need to test "SEP"arately */ 505 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
557 if (unlikely(tss->ss1 != thread->sysenter_cs)) { 506 if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) {
558 tss->ss1 = thread->sysenter_cs; 507 tss->x86_tss.ss1 = thread->sysenter_cs;
559 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); 508 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
560 } 509 }
561} 510}
562 511
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 512
574#define set_iopl_mask native_set_iopl_mask 513static inline unsigned long native_get_debugreg(int regno)
575#endif /* CONFIG_PARAVIRT */ 514{
515 unsigned long val = 0; /* Damn you, gcc! */
516
517 switch (regno) {
518 case 0:
519 asm("movl %%db0, %0" :"=r" (val)); break;
520 case 1:
521 asm("movl %%db1, %0" :"=r" (val)); break;
522 case 2:
523 asm("movl %%db2, %0" :"=r" (val)); break;
524 case 3:
525 asm("movl %%db3, %0" :"=r" (val)); break;
526 case 6:
527 asm("movl %%db6, %0" :"=r" (val)); break;
528 case 7:
529 asm("movl %%db7, %0" :"=r" (val)); break;
530 default:
531 BUG();
532 }
533 return val;
534}
535
536static inline void native_set_debugreg(int regno, unsigned long value)
537{
538 switch (regno) {
539 case 0:
540 asm("movl %0,%%db0" : /* no output */ :"r" (value));
541 break;
542 case 1:
543 asm("movl %0,%%db1" : /* no output */ :"r" (value));
544 break;
545 case 2:
546 asm("movl %0,%%db2" : /* no output */ :"r" (value));
547 break;
548 case 3:
549 asm("movl %0,%%db3" : /* no output */ :"r" (value));
550 break;
551 case 6:
552 asm("movl %0,%%db6" : /* no output */ :"r" (value));
553 break;
554 case 7:
555 asm("movl %0,%%db7" : /* no output */ :"r" (value));
556 break;
557 default:
558 BUG();
559 }
560}
576 561
577/* 562/*
578 * Set IOPL bits in EFLAGS from given mask 563 * Set IOPL bits in EFLAGS from given mask
579 */ 564 */
580static fastcall inline void native_set_iopl_mask(unsigned mask) 565static inline void native_set_iopl_mask(unsigned mask)
581{ 566{
582 unsigned int reg; 567 unsigned int reg;
583 __asm__ __volatile__ ("pushfl;" 568 __asm__ __volatile__ ("pushfl;"
@@ -590,6 +575,28 @@ static fastcall inline void native_set_iopl_mask(unsigned mask)
590 : "i" (~X86_EFLAGS_IOPL), "r" (mask)); 575 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
591} 576}
592 577
578#ifdef CONFIG_PARAVIRT
579#include <asm/paravirt.h>
580#else
581#define paravirt_enabled() 0
582#define __cpuid native_cpuid
583
584static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
585{
586 native_load_esp0(tss, thread);
587}
588
589/*
590 * These special macros can be used to get or set a debugging register
591 */
592#define get_debugreg(var, register) \
593 (var) = native_get_debugreg(register)
594#define set_debugreg(value, register) \
595 native_set_debugreg(register, value)
596
597#define set_iopl_mask native_set_iopl_mask
598#endif /* CONFIG_PARAVIRT */
599
593/* 600/*
594 * Generic CPUID function 601 * Generic CPUID function
595 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx 602 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
@@ -742,8 +749,10 @@ extern unsigned long boot_option_idle_override;
742extern void enable_sep_cpu(void); 749extern void enable_sep_cpu(void);
743extern int sysenter_setup(void); 750extern int sysenter_setup(void);
744 751
745extern int init_gdt(int cpu, struct task_struct *idle);
746extern void cpu_set_gdt(int); 752extern void cpu_set_gdt(int);
747extern void secondary_cpu_init(void); 753extern void switch_to_new_gdt(void);
754extern void cpu_init(void);
755
756extern int force_mwait;
748 757
749#endif /* __ASM_I386_PROCESSOR_H */ 758#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-i386/reboot.h b/include/asm-i386/reboot.h
new file mode 100644
index 00000000000..e9e3ffc22c0
--- /dev/null
+++ b/include/asm-i386/reboot.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_REBOOT_H
2#define _ASM_REBOOT_H
3
4struct pt_regs;
5
6struct machine_ops
7{
8 void (*restart)(char *cmd);
9 void (*halt)(void);
10 void (*power_off)(void);
11 void (*shutdown)(void);
12 void (*crash_shutdown)(struct pt_regs *);
13 void (*emergency_restart)(void);
14};
15
16extern struct machine_ops machine_ops;
17
18void machine_real_restart(unsigned char *code, int length);
19
20#endif /* _ASM_REBOOT_H */
diff --git a/include/linux/reboot_fixups.h b/include/asm-i386/reboot_fixups.h
index 480ea2d489d..0cb7d87c2b6 100644
--- a/include/linux/reboot_fixups.h
+++ b/include/asm-i386/reboot_fixups.h
@@ -1,10 +1,6 @@
1#ifndef _LINUX_REBOOT_FIXUPS_H 1#ifndef _LINUX_REBOOT_FIXUPS_H
2#define _LINUX_REBOOT_FIXUPS_H 2#define _LINUX_REBOOT_FIXUPS_H
3 3
4#ifdef CONFIG_X86_REBOOTFIXUPS
5extern void mach_reboot_fixups(void); 4extern void mach_reboot_fixups(void);
6#else
7#define mach_reboot_fixups() ((void)(0))
8#endif
9 5
10#endif /* _LINUX_REBOOT_FIXUPS_H */ 6#endif /* _LINUX_REBOOT_FIXUPS_H */
diff --git a/include/asm-i386/required-features.h b/include/asm-i386/required-features.h
new file mode 100644
index 00000000000..9db866c1e64
--- /dev/null
+++ b/include/asm-i386/required-features.h
@@ -0,0 +1,34 @@
1#ifndef _ASM_REQUIRED_FEATURES_H
2#define _ASM_REQUIRED_FEATURES_H 1
3
4/* Define minimum CPUID feature set for kernel These bits are checked
5 really early to actually display a visible error message before the
6 kernel dies. Only add word 0 bits here
7
8 Some requirements that are not in CPUID yet are also in the
9 CONFIG_X86_MINIMUM_CPU mode which is checked too.
10
11 The real information is in arch/i386/Kconfig.cpu, this just converts
12 the CONFIGs into a bitmask */
13
14#ifdef CONFIG_X86_PAE
15#define NEED_PAE (1<<X86_FEATURE_PAE)
16#else
17#define NEED_PAE 0
18#endif
19
20#ifdef CONFIG_X86_CMOV
21#define NEED_CMOV (1<<X86_FEATURE_CMOV)
22#else
23#define NEED_CMOV 0
24#endif
25
26#ifdef CONFIG_X86_CMPXCHG64
27#define NEED_CMPXCHG64 (1<<X86_FEATURE_CX8)
28#else
29#define NEED_CMPXCHG64 0
30#endif
31
32#define REQUIRED_MASK1 (NEED_PAE|NEED_CMOV|NEED_CMPXCHG64)
33
34#endif
diff --git a/include/asm-i386/scatterlist.h b/include/asm-i386/scatterlist.h
index 55d6c953a76..d7e45a8f1aa 100644
--- a/include/asm-i386/scatterlist.h
+++ b/include/asm-i386/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef _I386_SCATTERLIST_H 1#ifndef _I386_SCATTERLIST_H
2#define _I386_SCATTERLIST_H 2#define _I386_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page *page; 7 struct page *page;
6 unsigned int offset; 8 unsigned int offset;
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index 065f10bfa48..597a47c2515 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 - PDA [ per-cpu private data area ] 42 * 27 - per-cpu [ offset to per-cpu data area ]
43 * 28 - unused 43 * 28 - unused
44 * 29 - unused 44 * 29 - unused
45 * 30 - unused 45 * 30 - unused
@@ -74,8 +74,12 @@
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) 77#define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE + 15)
78#define __KERNEL_PDA (GDT_ENTRY_PDA * 8) 78#ifdef CONFIG_SMP
79#define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8)
80#else
81#define __KERNEL_PERCPU 0
82#endif
79 83
80#define GDT_ENTRY_DOUBLEFAULT_TSS 31 84#define GDT_ENTRY_DOUBLEFAULT_TSS 31
81 85
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 6bf0033a301..090abc1da32 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -8,19 +8,15 @@
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>
12#endif 11#endif
13 12
14#ifdef CONFIG_X86_LOCAL_APIC 13#if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__)
15#ifndef __ASSEMBLY__
16#include <asm/fixmap.h>
17#include <asm/bitops.h> 14#include <asm/bitops.h>
18#include <asm/mpspec.h> 15#include <asm/mpspec.h>
16#include <asm/apic.h>
19#ifdef CONFIG_X86_IO_APIC 17#ifdef CONFIG_X86_IO_APIC
20#include <asm/io_apic.h> 18#include <asm/io_apic.h>
21#endif 19#endif
22#include <asm/apic.h>
23#endif
24#endif 20#endif
25 21
26#define BAD_APICID 0xFFu 22#define BAD_APICID 0xFFu
@@ -52,6 +48,59 @@ extern void cpu_exit_clear(void);
52extern void cpu_uninit(void); 48extern void cpu_uninit(void);
53#endif 49#endif
54 50
51struct smp_ops
52{
53 void (*smp_prepare_boot_cpu)(void);
54 void (*smp_prepare_cpus)(unsigned max_cpus);
55 int (*cpu_up)(unsigned cpu);
56 void (*smp_cpus_done)(unsigned max_cpus);
57
58 void (*smp_send_stop)(void);
59 void (*smp_send_reschedule)(int cpu);
60 int (*smp_call_function_mask)(cpumask_t mask,
61 void (*func)(void *info), void *info,
62 int wait);
63};
64
65extern struct smp_ops smp_ops;
66
67static inline void smp_prepare_boot_cpu(void)
68{
69 smp_ops.smp_prepare_boot_cpu();
70}
71static inline void smp_prepare_cpus(unsigned int max_cpus)
72{
73 smp_ops.smp_prepare_cpus(max_cpus);
74}
75static inline int __cpu_up(unsigned int cpu)
76{
77 return smp_ops.cpu_up(cpu);
78}
79static inline void smp_cpus_done(unsigned int max_cpus)
80{
81 smp_ops.smp_cpus_done(max_cpus);
82}
83
84static inline void smp_send_stop(void)
85{
86 smp_ops.smp_send_stop();
87}
88static inline void smp_send_reschedule(int cpu)
89{
90 smp_ops.smp_send_reschedule(cpu);
91}
92static inline int smp_call_function_mask(cpumask_t mask,
93 void (*func) (void *info), void *info,
94 int wait)
95{
96 return smp_ops.smp_call_function_mask(mask, func, info, wait);
97}
98
99void native_smp_prepare_boot_cpu(void);
100void native_smp_prepare_cpus(unsigned int max_cpus);
101int native_cpu_up(unsigned int cpunum);
102void native_smp_cpus_done(unsigned int max_cpus);
103
55#ifndef CONFIG_PARAVIRT 104#ifndef CONFIG_PARAVIRT
56#define startup_ipi_hook(phys_apicid, start_eip, start_esp) \ 105#define startup_ipi_hook(phys_apicid, start_eip, start_esp) \
57do { } while (0) 106do { } while (0)
@@ -62,7 +111,8 @@ do { } while (0)
62 * from the initial startup. We map APIC_BASE very early in page_setup(), 111 * from the initial startup. We map APIC_BASE very early in page_setup(),
63 * so this is correct in the x86 case. 112 * so this is correct in the x86 case.
64 */ 113 */
65#define raw_smp_processor_id() (read_pda(cpu_number)) 114DECLARE_PER_CPU(int, cpu_number);
115#define raw_smp_processor_id() (x86_read_percpu(cpu_number))
66 116
67extern cpumask_t cpu_callout_map; 117extern cpumask_t cpu_callout_map;
68extern cpumask_t cpu_callin_map; 118extern cpumask_t cpu_callin_map;
diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h
index 5755d57c4e9..99ca648b94c 100644
--- a/include/asm-i386/socket.h
+++ b/include/asm-i386/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-i386/sockios.h b/include/asm-i386/sockios.h
index 6b747f8e228..ff528c7d255 100644
--- a/include/asm-i386/sockios.h
+++ b/include/asm-i386/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index a6d20d9a1a3..c3a58c08c49 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -88,65 +88,96 @@ __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
92static inline void native_clts(void)
93{
94 asm volatile ("clts");
95}
96
97static inline unsigned long native_read_cr0(void)
98{
99 unsigned long val;
100 asm volatile("movl %%cr0,%0\n\t" :"=r" (val));
101 return val;
102}
103
104static inline void native_write_cr0(unsigned long val)
105{
106 asm volatile("movl %0,%%cr0": :"r" (val));
107}
108
109static inline unsigned long native_read_cr2(void)
110{
111 unsigned long val;
112 asm volatile("movl %%cr2,%0\n\t" :"=r" (val));
113 return val;
114}
115
116static inline void native_write_cr2(unsigned long val)
117{
118 asm volatile("movl %0,%%cr2": :"r" (val));
119}
120
121static inline unsigned long native_read_cr3(void)
122{
123 unsigned long val;
124 asm volatile("movl %%cr3,%0\n\t" :"=r" (val));
125 return val;
126}
127
128static inline void native_write_cr3(unsigned long val)
129{
130 asm volatile("movl %0,%%cr3": :"r" (val));
131}
132
133static inline unsigned long native_read_cr4(void)
134{
135 unsigned long val;
136 asm volatile("movl %%cr4,%0\n\t" :"=r" (val));
137 return val;
138}
139
140static inline unsigned long native_read_cr4_safe(void)
141{
142 unsigned long val;
143 /* This could fault if %cr4 does not exist */
144 asm("1: movl %%cr4, %0 \n"
145 "2: \n"
146 ".section __ex_table,\"a\" \n"
147 ".long 1b,2b \n"
148 ".previous \n"
149 : "=r" (val): "0" (0));
150 return val;
151}
152
153static inline void native_write_cr4(unsigned long val)
154{
155 asm volatile("movl %0,%%cr4": :"r" (val));
156}
157
158static inline void native_wbinvd(void)
159{
160 asm volatile("wbinvd": : :"memory");
161}
162
163
91#ifdef CONFIG_PARAVIRT 164#ifdef CONFIG_PARAVIRT
92#include <asm/paravirt.h> 165#include <asm/paravirt.h>
93#else 166#else
94#define read_cr0() ({ \ 167#define read_cr0() (native_read_cr0())
95 unsigned int __dummy; \ 168#define write_cr0(x) (native_write_cr0(x))
96 __asm__ __volatile__( \ 169#define read_cr2() (native_read_cr2())
97 "movl %%cr0,%0\n\t" \ 170#define write_cr2(x) (native_write_cr2(x))
98 :"=r" (__dummy)); \ 171#define read_cr3() (native_read_cr3())
99 __dummy; \ 172#define write_cr3(x) (native_write_cr3(x))
100}) 173#define read_cr4() (native_read_cr4())
101#define write_cr0(x) \ 174#define read_cr4_safe() (native_read_cr4_safe())
102 __asm__ __volatile__("movl %0,%%cr0": :"r" (x)) 175#define write_cr4(x) (native_write_cr4(x))
103 176#define wbinvd() (native_wbinvd())
104#define read_cr2() ({ \
105 unsigned int __dummy; \
106 __asm__ __volatile__( \
107 "movl %%cr2,%0\n\t" \
108 :"=r" (__dummy)); \
109 __dummy; \
110})
111#define write_cr2(x) \
112 __asm__ __volatile__("movl %0,%%cr2": :"r" (x))
113
114#define read_cr3() ({ \
115 unsigned int __dummy; \
116 __asm__ ( \
117 "movl %%cr3,%0\n\t" \
118 :"=r" (__dummy)); \
119 __dummy; \
120})
121#define write_cr3(x) \
122 __asm__ __volatile__("movl %0,%%cr3": :"r" (x))
123
124#define read_cr4() ({ \
125 unsigned int __dummy; \
126 __asm__( \
127 "movl %%cr4,%0\n\t" \
128 :"=r" (__dummy)); \
129 __dummy; \
130})
131#define read_cr4_safe() ({ \
132 unsigned int __dummy; \
133 /* This could fault if %cr4 does not exist */ \
134 __asm__("1: movl %%cr4, %0 \n" \
135 "2: \n" \
136 ".section __ex_table,\"a\" \n" \
137 ".long 1b,2b \n" \
138 ".previous \n" \
139 : "=r" (__dummy): "0" (0)); \
140 __dummy; \
141})
142#define write_cr4(x) \
143 __asm__ __volatile__("movl %0,%%cr4": :"r" (x))
144
145#define wbinvd() \
146 __asm__ __volatile__ ("wbinvd": : :"memory")
147 177
148/* Clear the 'TS' bit */ 178/* Clear the 'TS' bit */
149#define clts() __asm__ __volatile__ ("clts") 179#define clts() (native_clts())
180
150#endif/* CONFIG_PARAVIRT */ 181#endif/* CONFIG_PARAVIRT */
151 182
152/* Set the 'TS' bit */ 183/* Set the 'TS' bit */
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h
index 12dd67bf760..153770e25fa 100644
--- a/include/asm-i386/timer.h
+++ b/include/asm-i386/timer.h
@@ -9,8 +9,6 @@ void setup_pit_timer(void);
9unsigned long long native_sched_clock(void); 9unsigned long long native_sched_clock(void);
10unsigned long native_calculate_cpu_khz(void); 10unsigned long native_calculate_cpu_khz(void);
11 11
12/* Modifiers for buggy PIT handling */
13extern int pit_latch_buggy;
14extern int timer_ack; 12extern int timer_ack;
15extern int no_timer_check; 13extern int no_timer_check;
16extern int no_sync_cmos_clock; 14extern int no_sync_cmos_clock;
diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
index 4dd82840d53..db7f77eacfa 100644
--- a/include/asm-i386/tlbflush.h
+++ b/include/asm-i386/tlbflush.h
@@ -79,11 +79,15 @@
79 * - flush_tlb_range(vma, start, end) flushes a range of pages 79 * - flush_tlb_range(vma, start, end) flushes a range of pages
80 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 80 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
81 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables 81 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
82 * - flush_tlb_others(cpumask, mm, va) flushes a TLBs on other cpus
82 * 83 *
83 * ..but the i386 has somewhat limited tlb flushing capabilities, 84 * ..but the i386 has somewhat limited tlb flushing capabilities,
84 * and page-granular flushes are available only on i486 and up. 85 * and page-granular flushes are available only on i486 and up.
85 */ 86 */
86 87
88#define TLB_FLUSH_ALL 0xffffffff
89
90
87#ifndef CONFIG_SMP 91#ifndef CONFIG_SMP
88 92
89#define flush_tlb() __flush_tlb() 93#define flush_tlb() __flush_tlb()
@@ -110,7 +114,12 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
110 __flush_tlb(); 114 __flush_tlb();
111} 115}
112 116
113#else 117static inline void native_flush_tlb_others(const cpumask_t *cpumask,
118 struct mm_struct *mm, unsigned long va)
119{
120}
121
122#else /* SMP */
114 123
115#include <asm/smp.h> 124#include <asm/smp.h>
116 125
@@ -129,6 +138,9 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st
129 flush_tlb_mm(vma->vm_mm); 138 flush_tlb_mm(vma->vm_mm);
130} 139}
131 140
141void native_flush_tlb_others(const cpumask_t *cpumask, struct mm_struct *mm,
142 unsigned long va);
143
132#define TLBSTATE_OK 1 144#define TLBSTATE_OK 1
133#define TLBSTATE_LAZY 2 145#define TLBSTATE_LAZY 2
134 146
@@ -139,8 +151,11 @@ struct tlb_state
139 char __cacheline_padding[L1_CACHE_BYTES-8]; 151 char __cacheline_padding[L1_CACHE_BYTES-8];
140}; 152};
141DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); 153DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
154#endif /* SMP */
142 155
143 156#ifndef CONFIG_PARAVIRT
157#define flush_tlb_others(mask, mm, va) \
158 native_flush_tlb_others(&mask, mm, va)
144#endif 159#endif
145 160
146#define flush_tlb_kernel_range(start, end) flush_tlb_all() 161#define flush_tlb_kernel_range(start, end) flush_tlb_all()
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index 84016ff481b..3f3c1fa000b 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -35,25 +35,30 @@ static inline cycles_t get_cycles(void)
35static __always_inline cycles_t get_cycles_sync(void) 35static __always_inline cycles_t get_cycles_sync(void)
36{ 36{
37 unsigned long long ret; 37 unsigned long long ret;
38#ifdef X86_FEATURE_SYNC_RDTSC
39 unsigned eax; 38 unsigned eax;
40 39
41 /* 40 /*
41 * Use RDTSCP if possible; it is guaranteed to be synchronous
42 * and doesn't cause a VMEXIT on Hypervisors
43 */
44 alternative_io(ASM_NOP3, ".byte 0x0f,0x01,0xf9", X86_FEATURE_RDTSCP,
45 "=A" (ret), "0" (0ULL) : "ecx", "memory");
46 if (ret)
47 return ret;
48
49 /*
42 * Don't do an additional sync on CPUs where we know 50 * Don't do an additional sync on CPUs where we know
43 * RDTSC is already synchronous: 51 * RDTSC is already synchronous:
44 */ 52 */
45 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC, 53 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
46 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory"); 54 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
47#else
48 sync_core();
49#endif
50 rdtscll(ret); 55 rdtscll(ret);
51 56
52 return ret; 57 return ret;
53} 58}
54 59
55extern void tsc_init(void); 60extern void tsc_init(void);
56extern void mark_tsc_unstable(void); 61extern void mark_tsc_unstable(char *reason);
57extern int unsynchronized_tsc(void); 62extern int unsynchronized_tsc(void);
58extern void init_tsc_clocksource(void); 63extern void init_tsc_clocksource(void);
59 64
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 70829ae3ad5..e2aa5e0d0cc 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -397,7 +397,19 @@ unsigned long __must_check __copy_from_user_ll_nocache(void *to,
397unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to, 397unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to,
398 const void __user *from, unsigned long n); 398 const void __user *from, unsigned long n);
399 399
400/* 400/**
401 * __copy_to_user_inatomic: - Copy a block of data into user space, with less checking.
402 * @to: Destination address, in user space.
403 * @from: Source address, in kernel space.
404 * @n: Number of bytes to copy.
405 *
406 * Context: User context only.
407 *
408 * Copy data from kernel space to user space. Caller must check
409 * the specified block with access_ok() before calling this function.
410 * The caller should also make sure he pins the user space address
411 * so that the we don't result in page fault and sleep.
412 *
401 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault 413 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
402 * we return the initial request size (1, 2 or 4), as copy_*_user should do. 414 * we return the initial request size (1, 2 or 4), as copy_*_user should do.
403 * If a store crosses a page boundary and gets a fault, the x86 will not write 415 * If a store crosses a page boundary and gets a fault, the x86 will not write
diff --git a/include/asm-i386/vmi_time.h b/include/asm-i386/vmi_time.h
index c3a1fcf66c9..213930b995c 100644
--- a/include/asm-i386/vmi_time.h
+++ b/include/asm-i386/vmi_time.h
@@ -53,22 +53,8 @@ extern unsigned long long vmi_get_sched_cycles(void);
53extern unsigned long vmi_cpu_khz(void); 53extern unsigned long vmi_cpu_khz(void);
54 54
55#ifdef CONFIG_X86_LOCAL_APIC 55#ifdef CONFIG_X86_LOCAL_APIC
56extern void __init vmi_timer_setup_boot_alarm(void); 56extern void __devinit vmi_time_bsp_init(void);
57extern void __devinit vmi_timer_setup_secondary_alarm(void); 57extern void __devinit vmi_time_ap_init(void);
58extern void apic_vmi_timer_interrupt(void);
59#endif
60
61#ifdef CONFIG_NO_IDLE_HZ
62extern int vmi_stop_hz_timer(void);
63extern void vmi_account_time_restart_hz_timer(void);
64#else
65static inline int vmi_stop_hz_timer(void)
66{
67 return 0;
68}
69static inline void vmi_account_time_restart_hz_timer(void)
70{
71}
72#endif 58#endif
73 59
74/* 60/*
diff --git a/include/asm-i386/voyager.h b/include/asm-i386/voyager.h
index 5b27838905b..91a9932937a 100644
--- a/include/asm-i386/voyager.h
+++ b/include/asm-i386/voyager.h
@@ -487,15 +487,11 @@ extern struct voyager_qic_cpi *voyager_quad_cpi_addr[NR_CPUS];
487extern struct voyager_SUS *voyager_SUS; 487extern struct voyager_SUS *voyager_SUS;
488 488
489/* variables exported always */ 489/* variables exported always */
490extern struct task_struct *voyager_thread;
490extern int voyager_level; 491extern int voyager_level;
491extern int kvoyagerd_running;
492extern struct semaphore kvoyagerd_sem;
493extern struct voyager_status voyager_status; 492extern struct voyager_status voyager_status;
494 493
495
496
497/* functions exported by the voyager and voyager_smp modules */ 494/* functions exported by the voyager and voyager_smp modules */
498
499extern int voyager_cat_readb(__u8 module, __u8 asic, int reg); 495extern int voyager_cat_readb(__u8 module, __u8 asic, int reg);
500extern void voyager_cat_init(void); 496extern void voyager_cat_init(void);
501extern void voyager_detect(struct voyager_bios_info *); 497extern void voyager_detect(struct voyager_bios_info *);
diff --git a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
index b5c65081a3a..cef2400983f 100644
--- a/include/asm-ia64/mmu_context.h
+++ b/include/asm-ia64/mmu_context.h
@@ -29,6 +29,7 @@
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30 30
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm-generic/mm_hooks.h>
32 33
33struct ia64_ctx { 34struct ia64_ctx {
34 spinlock_t lock; 35 spinlock_t lock;
diff --git a/include/asm-ia64/scatterlist.h b/include/asm-ia64/scatterlist.h
index 9dbea8844d5..a452ea24205 100644
--- a/include/asm-ia64/scatterlist.h
+++ b/include/asm-ia64/scatterlist.h
@@ -6,6 +6,8 @@
6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
7 */ 7 */
8 8
9#include <asm/types.h>
10
9struct scatterlist { 11struct scatterlist {
10 struct page *page; 12 struct page *page;
11 unsigned int offset; 13 unsigned int offset;
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index d638ef3d50c..9e42ce43cfb 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -58,5 +58,7 @@
58 58
59#define SO_PEERSEC 31 59#define SO_PEERSEC 31
60#define SO_PASSSEC 34 60#define SO_PASSSEC 34
61#define SO_TIMESTAMPNS 35
62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61 63
62#endif /* _ASM_IA64_SOCKET_H */ 64#endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-ia64/sockios.h b/include/asm-ia64/sockios.h
index cf94857c8a5..15c92468ad3 100644
--- a/include/asm-ia64/sockios.h
+++ b/include/asm-ia64/sockios.h
@@ -14,6 +14,7 @@
14#define FIOGETOWN 0x8903 14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904 15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
18 19
19#endif /* _ASM_IA64_SOCKIOS_H */ 20#endif /* _ASM_IA64_SOCKIOS_H */
diff --git a/include/asm-m32r/mmu_context.h b/include/asm-m32r/mmu_context.h
index 1f40d4a0acf..91909e5dd9d 100644
--- a/include/asm-m32r/mmu_context.h
+++ b/include/asm-m32r/mmu_context.h
@@ -15,6 +15,7 @@
15#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
16#include <asm/mmu.h> 16#include <asm/mmu.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18#include <asm-generic/mm_hooks.h>
18 19
19/* 20/*
20 * Cache of MMU context last used. 21 * Cache of MMU context last used.
diff --git a/include/asm-m32r/scatterlist.h b/include/asm-m32r/scatterlist.h
index c2de96cb69e..352415ff5eb 100644
--- a/include/asm-m32r/scatterlist.h
+++ b/include/asm-m32r/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_M32R_SCATTERLIST_H 1#ifndef _ASM_M32R_SCATTERLIST_H
2#define _ASM_M32R_SCATTERLIST_H 2#define _ASM_M32R_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 char * address; /* Location data is to be transferred to, NULL for 7 char * address; /* Location data is to be transferred to, NULL for
6 * highmem page */ 8 * highmem page */
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index acdf748fcdc..793d5d30c85 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_M32R_SOCKET_H */ 55#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h
index f89962e231f..6c1fb9b43bd 100644
--- a/include/asm-m32r/sockios.h
+++ b/include/asm-m32r/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* _ASM_M32R_SOCKIOS_H */ 13#endif /* _ASM_M32R_SOCKIOS_H */
diff --git a/include/asm-m68k/adb.h b/include/asm-m68k/adb.h
deleted file mode 100644
index 9176b55185b..00000000000
--- a/include/asm-m68k/adb.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Definitions for talking to ADB and CUDA. The CUDA is a microcontroller
3 * which controls the ADB, system power, RTC, and various other things on
4 * later Macintoshes
5 *
6 * Copyright (C) 1996 Paul Mackerras.
7 */
8
9/* First byte sent to or received from CUDA */
10#define ADB_PACKET 0
11#define CUDA_PACKET 1
12#define ERROR_PACKET 2
13#define TIMER_PACKET 3
14#define POWER_PACKET 4
15#define MACIIC_PACKET 5
16
17/* ADB commands (2nd byte) */
18#define ADB_BUSRESET 0
19#define ADB_FLUSH(id) (1 + ((id) << 4))
20#define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4))
21#define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4))
22
23/* ADB default device IDs (upper 4 bits of 2nd byte) */
24#define ADB_DONGLE 1 /* "software execution control" devices */
25#define ADB_KEYBOARD 2
26#define ADB_MOUSE 3
27#define ADB_TABLET 4
28#define ADB_MODEM 5
29#define ADB_MISC 7 /* maybe a monitor */
30
31/* CUDA commands (2nd byte) */
32#define CUDA_WARM_START 0
33#define CUDA_AUTOPOLL 1
34#define CUDA_GET_6805_ADDR 2
35#define CUDA_GET_TIME 3
36#define CUDA_GET_PRAM 7
37#define CUDA_SET_6805_ADDR 8
38#define CUDA_SET_TIME 9
39#define CUDA_POWERDOWN 0xa
40#define CUDA_POWERUP_TIME 0xb
41#define CUDA_SET_PRAM 0xc
42#define CUDA_MS_RESET 0xd
43#define CUDA_SEND_DFAC 0xe
44#define CUDA_RESET_SYSTEM 0x11
45#define CUDA_SET_IPL 0x12
46#define CUDA_SET_AUTO_RATE 0x14
47#define CUDA_GET_AUTO_RATE 0x16
48#define CUDA_SET_DEVICE_LIST 0x19
49#define CUDA_GET_DEVICE_LIST 0x1a
50#define CUDA_GET_SET_IIC 0x22
51
52#ifdef __KERNEL__
53
54struct adb_request {
55 unsigned char data[16];
56 int nbytes;
57 unsigned char reply[16];
58 int reply_len;
59 unsigned char reply_expected;
60 unsigned char sent;
61 unsigned char got_reply;
62 void (*done)(struct adb_request *);
63 void *arg;
64 struct adb_request *next;
65};
66
67void via_adb_init(void);
68int adb_request(struct adb_request *req,
69 void (*done)(struct adb_request *), int nbytes, ...);
70int adb_send_request(struct adb_request *req);
71void adb_poll(void);
72int adb_register(int default_id,
73 void (*handler)(unsigned char *, int, struct pt_regs *));
74
75#endif /* __KERNEL */
diff --git a/include/asm-m68k/atarikb.h b/include/asm-m68k/atarikb.h
index 18926058fde..546e7da5804 100644
--- a/include/asm-m68k/atarikb.h
+++ b/include/asm-m68k/atarikb.h
@@ -36,5 +36,11 @@ void ikbd_joystick_disable(void);
36extern void (*atari_MIDI_interrupt_hook) (void); 36extern void (*atari_MIDI_interrupt_hook) (void);
37/* Hook for mouse driver */ 37/* Hook for mouse driver */
38extern void (*atari_mouse_interrupt_hook) (char *); 38extern void (*atari_mouse_interrupt_hook) (char *);
39/* Hook for keyboard inputdev driver */
40extern void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
41/* Hook for mouse inputdev driver */
42extern void (*atari_input_mouse_interrupt_hook) (char *);
43
44int atari_keyb_init(void);
39 45
40#endif /* _LINUX_ATARIKB_H */ 46#endif /* _LINUX_ATARIKB_H */
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h
index 9f65de1a248..33caad1628d 100644
--- a/include/asm-m68k/div64.h
+++ b/include/asm-m68k/div64.h
@@ -1,6 +1,8 @@
1#ifndef _M68K_DIV64_H 1#ifndef _M68K_DIV64_H
2#define _M68K_DIV64_H 2#define _M68K_DIV64_H
3 3
4#include <linux/types.h>
5
4/* n = n / base; return rem; */ 6/* n = n / base; return rem; */
5 7
6#define do_div(n, base) ({ \ 8#define do_div(n, base) ({ \
@@ -23,4 +25,5 @@
23 __rem; \ 25 __rem; \
24}) 26})
25 27
28extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
26#endif /* _M68K_DIV64_H */ 29#endif /* _M68K_DIV64_H */
diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h
index 231d11bd8e3..894dacbcee1 100644
--- a/include/asm-m68k/mmu_context.h
+++ b/include/asm-m68k/mmu_context.h
@@ -1,6 +1,7 @@
1#ifndef __M68K_MMU_CONTEXT_H 1#ifndef __M68K_MMU_CONTEXT_H
2#define __M68K_MMU_CONTEXT_H 2#define __M68K_MMU_CONTEXT_H
3 3
4#include <asm-generic/mm_hooks.h>
4 5
5static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 6static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
6{ 7{
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index a5966ec005a..6d21b90863a 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-m68k/sockios.h b/include/asm-m68k/sockios.h
index 9b9ed973c24..c04a23943cb 100644
--- a/include/asm-m68k/sockios.h
+++ b/include/asm-m68k/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ARCH_M68K_SOCKIOS__ */ 13#endif /* __ARCH_M68K_SOCKIOS__ */
diff --git a/include/asm-m68knommu/mmu_context.h b/include/asm-m68knommu/mmu_context.h
index 6c077d3a257..9ccee4278c9 100644
--- a/include/asm-m68knommu/mmu_context.h
+++ b/include/asm-m68knommu/mmu_context.h
@@ -4,6 +4,7 @@
4#include <asm/setup.h> 4#include <asm/setup.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm-generic/mm_hooks.h>
7 8
8static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 10{
diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h
index 2085d6ff878..4da79d3d3f3 100644
--- a/include/asm-m68knommu/scatterlist.h
+++ b/include/asm-m68knommu/scatterlist.h
@@ -2,6 +2,7 @@
2#define _M68KNOMMU_SCATTERLIST_H 2#define _M68KNOMMU_SCATTERLIST_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/types.h>
5 6
6struct scatterlist { 7struct scatterlist {
7 struct page *page; 8 struct page *page;
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index 4d560a53394..7eb63de808b 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -18,7 +18,8 @@ do { \
18 18
19#define BUG_ON(condition) \ 19#define BUG_ON(condition) \
20do { \ 20do { \
21 __asm__ __volatile__("tne $0, %0" : : "r" (condition)); \ 21 __asm__ __volatile__("tne $0, %0, %1" \
22 : : "r" (condition), "i" (BRK_BUG)); \
22} while (0) 23} while (0)
23 24
24#define HAVE_ARCH_BUG_ON 25#define HAVE_ARCH_BUG_ON
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 28d907d4347..4933b4947ed 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -96,6 +96,6 @@ extern void (*flush_data_cache_page)(unsigned long addr);
96unsigned long __init run_uncached(void *func); 96unsigned long __init run_uncached(void *func);
97 97
98extern void *kmap_coherent(struct page *page, unsigned long addr); 98extern void *kmap_coherent(struct page *page, unsigned long addr);
99extern void kunmap_coherent(struct page *page); 99extern void kunmap_coherent(void);
100 100
101#endif /* _ASM_CACHEFLUSH_H */ 101#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index 20a81e1548f..290485ac540 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -166,7 +166,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr,
166#else 166#else
167 "r" (proto + len), 167 "r" (proto + len),
168#endif 168#endif
169 "r" (sum)); 169 "r" ((__force unsigned long)sum));
170 170
171 return sum; 171 return sum;
172} 172}
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h
index d107832de1b..66189f5f639 100644
--- a/include/asm-mips/div64.h
+++ b/include/asm-mips/div64.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2000, 2004 Maciej W. Rozycki 2 * Copyright (C) 2000, 2004 Maciej W. Rozycki
3 * Copyright (C) 2003 Ralf Baechle 3 * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org)
4 * 4 *
5 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
@@ -9,6 +9,8 @@
9#ifndef _ASM_DIV64_H 9#ifndef _ASM_DIV64_H
10#define _ASM_DIV64_H 10#define _ASM_DIV64_H
11 11
12#include <linux/types.h>
13
12#if (_MIPS_SZLONG == 32) 14#if (_MIPS_SZLONG == 32)
13 15
14#include <asm/compiler.h> 16#include <asm/compiler.h>
@@ -78,6 +80,8 @@
78 __quot = __quot << 32 | __low; \ 80 __quot = __quot << 32 | __low; \
79 (n) = __quot; \ 81 (n) = __quot; \
80 __mod; }) 82 __mod; })
83
84extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
81#endif /* (_MIPS_SZLONG == 32) */ 85#endif /* (_MIPS_SZLONG == 32) */
82 86
83#if (_MIPS_SZLONG == 64) 87#if (_MIPS_SZLONG == 64)
@@ -101,6 +105,11 @@
101 (n) = __quot; \ 105 (n) = __quot; \
102 __mod; }) 106 __mod; })
103 107
108static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
109{
110 return dividend / divisor;
111}
112
104#endif /* (_MIPS_SZLONG == 64) */ 113#endif /* (_MIPS_SZLONG == 64) */
105 114
106#endif /* _ASM_DIV64_H */ 115#endif /* _ASM_DIV64_H */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 4e12d1f9534..b414a7d9db4 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -68,8 +68,6 @@ do { \
68 /* We don't care about the c0 hazard here */ \ 68 /* We don't care about the c0 hazard here */ \
69} while (0) 69} while (0)
70 70
71#define __fpu_enabled() (read_c0_status() & ST0_CU1)
72
73#define enable_fpu() \ 71#define enable_fpu() \
74do { \ 72do { \
75 if (cpu_has_fpu) \ 73 if (cpu_has_fpu) \
@@ -102,14 +100,19 @@ static inline void __own_fpu(void)
102 set_thread_flag(TIF_USEDFPU); 100 set_thread_flag(TIF_USEDFPU);
103} 101}
104 102
105static inline void own_fpu(int restore) 103static inline void own_fpu_inatomic(int restore)
106{ 104{
107 preempt_disable();
108 if (cpu_has_fpu && !__is_fpu_owner()) { 105 if (cpu_has_fpu && !__is_fpu_owner()) {
109 __own_fpu(); 106 __own_fpu();
110 if (restore) 107 if (restore)
111 _restore_fp(current); 108 _restore_fp(current);
112 } 109 }
110}
111
112static inline void own_fpu(int restore)
113{
114 preempt_disable();
115 own_fpu_inatomic(restore);
113 preempt_enable(); 116 preempt_enable();
114} 117}
115 118
@@ -162,18 +165,4 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
162 return tsk->thread.fpu.fpr; 165 return tsk->thread.fpu.fpr;
163} 166}
164 167
165static inline void enable_fp_in_kernel(void)
166{
167 set_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
168 /* make sure CU1 and FPU ownership are consistent */
169 if (!__is_fpu_owner() && __fpu_enabled())
170 __disable_fpu();
171}
172
173static inline void disable_fp_in_kernel(void)
174{
175 BUG_ON(!__is_fpu_owner() && __fpu_enabled());
176 clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
177}
178
179#endif /* _ASM_FPU_H */ 168#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/jmr3927/irq.h b/include/asm-mips/jmr3927/irq.h
deleted file mode 100644
index e3e7ed38da6..00000000000
--- a/include/asm-mips/jmr3927/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/include/asm-mips/tx3927/irq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Toshiba Corporation
9 */
10#ifndef __ASM_TX3927_IRQ_H
11#define __ASM_TX3927_IRQ_H
12
13#ifndef __ASSEMBLY__
14
15#include <asm/irq.h>
16
17struct tb_irq_space {
18 struct tb_irq_space* next;
19 int start_irqno;
20 int nr_irqs;
21 void (*mask_func)(int irq_nr, int space_id);
22 void (*unmask_func)(int irq_no, int space_id);
23 const char *name;
24 int space_id;
25 int can_share;
26};
27extern struct tb_irq_space* tb_irq_spaces;
28
29static __inline__ void add_tb_irq_space(struct tb_irq_space* sp)
30{
31 sp->next = tb_irq_spaces;
32 tb_irq_spaces = sp;
33}
34
35
36struct pt_regs;
37extern void
38toshibaboards_spurious(struct pt_regs *regs, int irq);
39extern void
40toshibaboards_irqdispatch(struct pt_regs *regs, int irq);
41
42extern struct irqaction *
43toshibaboards_get_irq_action(int irq);
44extern int
45toshibaboards_setup_irq(int irq, struct irqaction * new);
46
47
48extern int (*toshibaboards_gen_iack)(void);
49
50#endif /* !__ASSEMBLY__ */
51
52#define NR_ISA_IRQS 16
53#define TB_IRQ_IS_ISA(irq) \
54 (0 <= (irq) && (irq) < NR_ISA_IRQS)
55#define TB_IRQ_TO_ISA_IRQ(irq) (irq)
56
57#endif /* __ASM_TX3927_IRQ_H */
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h
index c50e68ffa3a..958e29706e2 100644
--- a/include/asm-mips/jmr3927/jmr3927.h
+++ b/include/asm-mips/jmr3927/jmr3927.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Defines for the TJSYS JMR-TX3927/JMI-3927IO2/JMY-1394IF. 2 * Defines for the TJSYS JMR-TX3927
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
@@ -12,10 +12,7 @@
12 12
13#include <asm/jmr3927/tx3927.h> 13#include <asm/jmr3927/tx3927.h>
14#include <asm/addrspace.h> 14#include <asm/addrspace.h>
15#include <asm/jmr3927/irq.h>
16#ifndef __ASSEMBLY__
17#include <asm/system.h> 15#include <asm/system.h>
18#endif
19 16
20/* CS */ 17/* CS */
21#define JMR3927_ROMCE0 0x1fc00000 /* 4M */ 18#define JMR3927_ROMCE0 0x1fc00000 /* 4M */
@@ -35,28 +32,10 @@
35#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */ 32#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */
36#define JMR3927_PORT_BASE KSEG1 33#define JMR3927_PORT_BASE KSEG1
37 34
38/* select indirect initiator access per errata */
39#define JMR3927_INIT_INDIRECT_PCI
40#define PCI_ISTAT_IDICC 0x1000
41#define PCI_IPCIBE_IBE_LONG 0
42#define PCI_IPCIBE_ICMD_IOREAD 2
43#define PCI_IPCIBE_ICMD_IOWRITE 3
44#define PCI_IPCIBE_ICMD_MEMREAD 6
45#define PCI_IPCIBE_ICMD_MEMWRITE 7
46#define PCI_IPCIBE_ICMD_SHIFT 4
47
48/* Address map (virtual address) */ 35/* Address map (virtual address) */
49#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0) 36#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0)
50#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1) 37#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1)
51#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2) 38#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2)
52#define JMR3927_IOB_BASE (KSEG1 + JMR3927_ROMCE3)
53#define JMR3927_ISAMEM_BASE (JMR3927_IOB_BASE)
54#define JMR3927_ISAIO_BASE (JMR3927_IOB_BASE + 0x01000000)
55#define JMR3927_ISAC_BASE (JMR3927_IOB_BASE + 0x02000000)
56#define JMR3927_LCDVGA_REG_BASE (JMR3927_IOB_BASE + 0x03000000)
57#define JMR3927_LCDVGA_MEM_BASE (JMR3927_IOB_BASE + 0x03800000)
58#define JMR3927_JMY1394_BASE (KSEG1 + JMR3927_ROMCE5)
59#define JMR3927_PREMIER3_BASE (JMR3927_JMY1394_BASE + 0x00100000)
60#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM) 39#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM)
61#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO) 40#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO)
62 41
@@ -72,25 +51,14 @@
72#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000) 51#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000)
73#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000) 52#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000)
74 53
75#define JMR3927_ISAC_REV_ADDR (JMR3927_ISAC_BASE + 0x00000000)
76#define JMR3927_ISAC_EINTS_ADDR (JMR3927_ISAC_BASE + 0x00200000)
77#define JMR3927_ISAC_EINTM_ADDR (JMR3927_ISAC_BASE + 0x00300000)
78#define JMR3927_ISAC_NMI_ADDR (JMR3927_ISAC_BASE + 0x00400000)
79#define JMR3927_ISAC_LED_ADDR (JMR3927_ISAC_BASE + 0x00500000)
80#define JMR3927_ISAC_INTP_ADDR (JMR3927_ISAC_BASE + 0x00800000)
81#define JMR3927_ISAC_INTS1_ADDR (JMR3927_ISAC_BASE + 0x00900000)
82#define JMR3927_ISAC_INTS2_ADDR (JMR3927_ISAC_BASE + 0x00a00000)
83#define JMR3927_ISAC_INTM_ADDR (JMR3927_ISAC_BASE + 0x00b00000)
84
85/* Flash ROM */ 54/* Flash ROM */
86#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE) 55#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE)
87#define JMR3927_FLASH_SIZE 0x00400000 56#define JMR3927_FLASH_SIZE 0x00400000
88 57
89/* bits for IOC_REV/IOC_BREV/ISAC_REV (high byte) */ 58/* bits for IOC_REV/IOC_BREV (high byte) */
90#define JMR3927_IDT_MASK 0xfc 59#define JMR3927_IDT_MASK 0xfc
91#define JMR3927_REV_MASK 0x03 60#define JMR3927_REV_MASK 0x03
92#define JMR3927_IOC_IDT 0xe0 61#define JMR3927_IOC_IDT 0xe0
93#define JMR3927_ISAC_IDT 0x20
94 62
95/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */ 63/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
96#define JMR3927_IOC_INTB_PCIA 0 64#define JMR3927_IOC_INTB_PCIA 0
@@ -114,40 +82,6 @@
114#define JMR3927_IOC_RESET_CPU 1 82#define JMR3927_IOC_RESET_CPU 1
115#define JMR3927_IOC_RESET_PCI 2 83#define JMR3927_IOC_RESET_PCI 2
116 84
117/* bits for ISAC_EINTS/ISAC_EINTM (high byte) */
118#define JMR3927_ISAC_EINTB_IOCHK 2
119#define JMR3927_ISAC_EINTB_BWTH 4
120#define JMR3927_ISAC_EINTF_IOCHK (1 << JMR3927_ISAC_EINTB_IOCHK)
121#define JMR3927_ISAC_EINTF_BWTH (1 << JMR3927_ISAC_EINTB_BWTH)
122
123/* bits for ISAC_LED (high byte) */
124#define JMR3927_ISAC_LED_ISALED 0x01
125#define JMR3927_ISAC_LED_USRLED 0x02
126
127/* bits for ISAC_INTS/ISAC_INTM/ISAC_INTP (high byte) */
128#define JMR3927_ISAC_INTB_IRQ5 0
129#define JMR3927_ISAC_INTB_IRQKB 1
130#define JMR3927_ISAC_INTB_IRQMOUSE 2
131#define JMR3927_ISAC_INTB_IRQ4 3
132#define JMR3927_ISAC_INTB_IRQ12 4
133#define JMR3927_ISAC_INTB_IRQ3 5
134#define JMR3927_ISAC_INTB_IRQ10 6
135#define JMR3927_ISAC_INTB_ISAER 7
136#define JMR3927_ISAC_INTF_IRQ5 (1 << JMR3927_ISAC_INTB_IRQ5)
137#define JMR3927_ISAC_INTF_IRQKB (1 << JMR3927_ISAC_INTB_IRQKB)
138#define JMR3927_ISAC_INTF_IRQMOUSE (1 << JMR3927_ISAC_INTB_IRQMOUSE)
139#define JMR3927_ISAC_INTF_IRQ4 (1 << JMR3927_ISAC_INTB_IRQ4)
140#define JMR3927_ISAC_INTF_IRQ12 (1 << JMR3927_ISAC_INTB_IRQ12)
141#define JMR3927_ISAC_INTF_IRQ3 (1 << JMR3927_ISAC_INTB_IRQ3)
142#define JMR3927_ISAC_INTF_IRQ10 (1 << JMR3927_ISAC_INTB_IRQ10)
143#define JMR3927_ISAC_INTF_ISAER (1 << JMR3927_ISAC_INTB_ISAER)
144
145#ifndef __ASSEMBLY__
146
147#if 0
148#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned short *)(a)) = (d) << 8)
149#define jmr3927_ioc_reg_in(a) (((*(volatile unsigned short *)(a)) >> 8) & 0xff)
150#else
151#if defined(__BIG_ENDIAN) 85#if defined(__BIG_ENDIAN)
152#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d)) 86#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
153#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a)) 87#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a))
@@ -157,31 +91,9 @@
157#else 91#else
158#error "No Endian" 92#error "No Endian"
159#endif 93#endif
160#endif
161#define jmr3927_isac_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
162#define jmr3927_isac_reg_in(a) (*(volatile unsigned char *)(a))
163
164static inline int jmr3927_have_isac(void)
165{
166 unsigned char idt;
167 unsigned long flags;
168 unsigned long romcr3;
169
170 local_irq_save(flags);
171 romcr3 = tx3927_romcptr->cr[3];
172 tx3927_romcptr->cr[3] &= 0xffffefff; /* do not wait infinitely */
173 idt = jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_IDT_MASK;
174 tx3927_romcptr->cr[3] = romcr3;
175 local_irq_restore(flags);
176
177 return idt == JMR3927_ISAC_IDT;
178}
179#define jmr3927_have_nvram() \
180 ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT)
181 94
182/* LED macro */ 95/* LED macro */
183#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) 96#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
184#define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR)
185 97
186#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR) 98#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR)
187 99
@@ -190,10 +102,6 @@ static inline int jmr3927_have_isac(void)
190#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0) 102#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0)
191#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0) 103#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
192#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0) 104#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
193#define jmr3927_io_dipsw() (jmr3927_isac_reg_in(JMR3927_ISAC_LED_ADDR) >> 4)
194
195
196#endif /* !__ASSEMBLY__ */
197 105
198/* 106/*
199 * IRQ mappings 107 * IRQ mappings
@@ -206,16 +114,10 @@ static inline int jmr3927_have_isac(void)
206 */ 114 */
207#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */ 115#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */
208#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */ 116#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */
209#define JMR3927_NR_IRQ_ISAC 8 /* ISA */
210 117
211 118#define JMR3927_IRQ_IRC 16
212#define JMR3927_IRQ_IRC NR_ISA_IRQS
213#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC) 119#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
214#define JMR3927_IRQ_ISAC (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC) 120#define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
215#define JMR3927_IRQ_END (JMR3927_IRQ_ISAC + JMR3927_NR_IRQ_ISAC)
216#define JMR3927_IRQ_IS_IRC(irq) (JMR3927_IRQ_IRC <= (irq) && (irq) < JMR3927_IRQ_IOC)
217#define JMR3927_IRQ_IS_IOC(irq) (JMR3927_IRQ_IOC <= (irq) && (irq) < JMR3927_IRQ_ISAC)
218#define JMR3927_IRQ_IS_ISAC(irq) (JMR3927_IRQ_ISAC <= (irq) && (irq) < JMR3927_IRQ_END)
219 121
220#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0) 122#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0)
221#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1) 123#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1)
@@ -240,37 +142,13 @@ static inline int jmr3927_have_isac(void)
240#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6) 142#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
241#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7) 143#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
242#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT) 144#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
243#define JMR3927_IRQ_ISAC_IRQ5 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ5)
244#define JMR3927_IRQ_ISAC_IRQKB (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQKB)
245#define JMR3927_IRQ_ISAC_IRQMOUSE (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQMOUSE)
246#define JMR3927_IRQ_ISAC_IRQ4 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ4)
247#define JMR3927_IRQ_ISAC_IRQ12 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ12)
248#define JMR3927_IRQ_ISAC_IRQ3 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ3)
249#define JMR3927_IRQ_ISAC_IRQ10 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ10)
250#define JMR3927_IRQ_ISAC_ISAER (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_ISAER)
251 145
252#if 0 /* auto detect */
253/* RTL8019AS 10M Ether (JMI-3927IO2:JPW2:1-2 Short) */
254#define JMR3927_IRQ_ETHER1 JMR3927_IRQ_IRC_INT0
255#endif
256/* IOC (PCI, MODEM) */ 146/* IOC (PCI, MODEM) */
257#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1 147#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
258/* ISAC (ISA, PCMCIA, KEYBOARD, MOUSE) */
259#define JMR3927_IRQ_ISACINT JMR3927_IRQ_IRC_INT2
260/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */ 148/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
261#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3 149#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
262/* Clock Tick (10ms) */ 150/* Clock Tick (10ms) */
263#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0 151#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0
264#define JMR3927_IRQ_IDE JMR3927_IRQ_ISAC_IRQ12
265
266/* IEEE1394 (Note that this may conflicts with RTL8019AS 10M Ether...) */
267#define JMR3927_IRQ_PREMIER3 JMR3927_IRQ_IRC_INT0
268
269/* I/O Ports */
270/* RTL8019AS 10M Ether */
271#define JMR3927_ETHER1_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x280)
272#define JMR3927_KBD_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x00800060)
273#define JMR3927_IDE_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x001001f0)
274 152
275/* Clocks */ 153/* Clocks */
276#define JMR3927_CORECLK 132710400 /* 132.7MHz */ 154#define JMR3927_CORECLK 132710400 /* 132.7MHz */
diff --git a/include/asm-mips/jmr3927/tx3927.h b/include/asm-mips/jmr3927/tx3927.h
index b3d67c75d9a..0b9073bfb75 100644
--- a/include/asm-mips/jmr3927/tx3927.h
+++ b/include/asm-mips/jmr3927/tx3927.h
@@ -22,8 +22,6 @@
22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100) 22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100)
23#define TX3927_PIO_REG 0xfffef500 23#define TX3927_PIO_REG 0xfffef500
24 24
25#ifndef __ASSEMBLY__
26
27struct tx3927_sdramc_reg { 25struct tx3927_sdramc_reg {
28 volatile unsigned long cr[8]; 26 volatile unsigned long cr[8];
29 volatile unsigned long tr[3]; 27 volatile unsigned long tr[3];
@@ -164,8 +162,6 @@ struct tx3927_ccfg_reg {
164 volatile unsigned long pdcr; 162 volatile unsigned long pdcr;
165}; 163};
166 164
167#endif /* !__ASSEMBLY__ */
168
169/* 165/*
170 * SDRAMC 166 * SDRAMC
171 */ 167 */
@@ -348,8 +344,6 @@ struct tx3927_ccfg_reg {
348#define TX3927_PCFG_SELDMA_ALL 0x0000000f 344#define TX3927_PCFG_SELDMA_ALL 0x0000000f
349#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch)) 345#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch))
350 346
351#ifndef __ASSEMBLY__
352
353#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG) 347#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG)
354#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG) 348#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG)
355#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG) 349#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
@@ -360,6 +354,4 @@ struct tx3927_ccfg_reg {
360#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch)) 354#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
361#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG) 355#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG)
362 356
363#endif /* !__ASSEMBLY__ */
364
365#endif /* __ASM_TX3927_H */ 357#endif /* __ASM_TX3927_H */
diff --git a/include/asm-mips/jmr3927/txx927.h b/include/asm-mips/jmr3927/txx927.h
index 9d5792eab45..58a8ff6be81 100644
--- a/include/asm-mips/jmr3927/txx927.h
+++ b/include/asm-mips/jmr3927/txx927.h
@@ -10,8 +10,6 @@
10#ifndef __ASM_TXX927_H 10#ifndef __ASM_TXX927_H
11#define __ASM_TXX927_H 11#define __ASM_TXX927_H
12 12
13#ifndef __ASSEMBLY__
14
15struct txx927_tmr_reg { 13struct txx927_tmr_reg {
16 volatile unsigned long tcr; 14 volatile unsigned long tcr;
17 volatile unsigned long tisr; 15 volatile unsigned long tisr;
@@ -52,9 +50,6 @@ struct txx927_pio_reg {
52 volatile unsigned long maskext; 50 volatile unsigned long maskext;
53}; 51};
54 52
55#endif /* !__ASSEMBLY__ */
56
57
58/* 53/*
59 * TMR 54 * TMR
60 */ 55 */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index fe065d6070c..65024ffd787 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -20,6 +20,7 @@
20#include <asm/mipsmtregs.h> 20#include <asm/mipsmtregs.h>
21#include <asm/smtc.h> 21#include <asm/smtc.h>
22#endif /* SMTC */ 22#endif /* SMTC */
23#include <asm-generic/mm_hooks.h>
23 24
24/* 25/*
25 * For the fast tlb miss handlers, we keep a per cpu array of pointers 26 * For the fast tlb miss handlers, we keep a per cpu array of pointers
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
index 147844ef103..8c08fa904b2 100644
--- a/include/asm-mips/paccess.h
+++ b/include/asm-mips/paccess.h
@@ -34,7 +34,7 @@ struct __large_pstruct { unsigned long buf[100]; };
34#define __get_dbe(x,ptr,size) \ 34#define __get_dbe(x,ptr,size) \
35({ \ 35({ \
36 long __gu_err; \ 36 long __gu_err; \
37 __typeof(*(ptr)) __gu_val; \ 37 __typeof__(*(ptr)) __gu_val; \
38 unsigned long __gu_addr; \ 38 unsigned long __gu_addr; \
39 __asm__("":"=r" (__gu_val)); \ 39 __asm__("":"=r" (__gu_val)); \
40 __gu_addr = (unsigned long) (ptr); \ 40 __gu_addr = (unsigned long) (ptr); \
diff --git a/include/asm-mips/scatterlist.h b/include/asm-mips/scatterlist.h
index 22634706e9d..7af104c95b2 100644
--- a/include/asm-mips/scatterlist.h
+++ b/include/asm-mips/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_SCATTERLIST_H 1#ifndef __ASM_SCATTERLIST_H
2#define __ASM_SCATTERLIST_H 2#define __ASM_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page * page; 7 struct page * page;
6 unsigned int offset; 8 unsigned int offset;
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
index fcec52bafb2..c4729f53191 100644
--- a/include/asm-mips/sgi/hpc3.h
+++ b/include/asm-mips/sgi/hpc3.h
@@ -206,7 +206,7 @@ struct hpc3_regs {
206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */ 206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */
207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */ 207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */
208 208
209 volatile u32 eeprom; /* EEPROM data reg. */ 209 u32 eeprom; /* EEPROM data reg. */
210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */ 210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */
211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */ 211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */
212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */ 212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
index 6592f3bd199..f4981c4f16b 100644
--- a/include/asm-mips/sgi/ip22.h
+++ b/include/asm-mips/sgi/ip22.h
@@ -72,7 +72,7 @@
72 72
73#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) 73#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE)
74 74
75extern unsigned short ip22_eeprom_read(volatile unsigned int *ctrl, int reg); 75extern unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg);
76extern unsigned short ip22_nvram_read(int reg); 76extern unsigned short ip22_nvram_read(int reg);
77 77
78#endif 78#endif
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h
index c52f7834c7c..1576c2394de 100644
--- a/include/asm-mips/sgi/mc.h
+++ b/include/asm-mips/sgi/mc.h
@@ -57,7 +57,7 @@ struct sgimc_regs {
57 volatile u32 divider; /* Divider reg for RPSS */ 57 volatile u32 divider; /* Divider reg for RPSS */
58 58
59 u32 _unused5; 59 u32 _unused5;
60 volatile u32 eeprom; /* EEPROM byte reg for r4k */ 60 u32 eeprom; /* EEPROM byte reg for r4k */
61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */ 61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */
62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */ 62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */
63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */ 63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */
diff --git a/include/asm-mips/sibyte/bcm1480_int.h b/include/asm-mips/sibyte/bcm1480_int.h
index 42d4cf00efd..c0d5206020f 100644
--- a/include/asm-mips/sibyte/bcm1480_int.h
+++ b/include/asm-mips/sibyte/bcm1480_int.h
@@ -157,6 +157,7 @@
157 * Mask values for each interrupt 157 * Mask values for each interrupt
158 */ 158 */
159 159
160#define _BCM1480_INT_MASK(w,n) _SB_MAKEMASK(w,((n) & 0x3F))
160#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F)) 161#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
161#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6) 162#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
162 163
@@ -195,6 +196,7 @@
195#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH) 196#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
196#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW) 197#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
197#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH) 198#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH)
199#define M_BCM1480_INT_MBOX_ALL _BCM1480_INT_MASK(8,K_BCM1480_INT_MBOX_0_0)
198#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0) 200#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
199#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1) 201#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
200#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2) 202#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
index 6bdc941afc9..a6a437451da 100644
--- a/include/asm-mips/sibyte/bcm1480_mc.h
+++ b/include/asm-mips/sibyte/bcm1480_mc.h
@@ -382,6 +382,10 @@
382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10) 382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10)
383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11) 383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11)
384 384
385#define M_BCM1480_MC_CS _SB_MAKEMASK(8,S_BCM1480_MC_CS0)
386#define V_BCM1480_MC_CS(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS0)
387#define G_BCM1480_MC_CS(x) _SB_GETVALUE(x,S_BCM1480_MC_CS0,M_BCM1480_MC_CS0)
388
385#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16) 389#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16)
386 390
387/* 391/*
@@ -412,6 +416,8 @@
412#define K_BCM1480_MC_DRAM_TYPE_DDR2 2 416#define K_BCM1480_MC_DRAM_TYPE_DDR2 2
413#endif 417#endif
414 418
419#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1 0
420
415#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC) 421#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
416#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM) 422#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
417 423
@@ -511,6 +517,22 @@
511#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31) 517#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31)
512 518
513#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32) 519#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32)
520
521#define S_BCM1480_MC_ODT0 0
522#define M_BCM1480_MC_ODT0 _SB_MAKEMASK(8,S_BCM1480_MC_ODT0)
523#define V_BCM1480_MC_ODT0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT0)
524
525#define S_BCM1480_MC_ODT2 8
526#define M_BCM1480_MC_ODT2 _SB_MAKEMASK(8,S_BCM1480_MC_ODT2)
527#define V_BCM1480_MC_ODT2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT2)
528
529#define S_BCM1480_MC_ODT4 16
530#define M_BCM1480_MC_ODT4 _SB_MAKEMASK(8,S_BCM1480_MC_ODT4)
531#define V_BCM1480_MC_ODT4(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT4)
532
533#define S_BCM1480_MC_ODT6 24
534#define M_BCM1480_MC_ODT6 _SB_MAKEMASK(8,S_BCM1480_MC_ODT6)
535#define V_BCM1480_MC_ODT6(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT6)
514#endif 536#endif
515 537
516/* 538/*
@@ -588,11 +610,11 @@
588#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47) 610#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47)
589#endif 611#endif
590 612
591#define S_BCM1480_MC_DLL_DEFAULT 48 613#define S_BCM1480_MC_DLL_DEFAULT 48
592#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT) 614#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT)
593#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT) 615#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT)
594#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT) 616#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT)
595#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10) 617#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10)
596 618
597#if SIBYTE_HDR_FEATURE(1480, PASS2) 619#if SIBYTE_HDR_FEATURE(1480, PASS2)
598#define S_BCM1480_MC_DLL_REGCTRL 54 620#define S_BCM1480_MC_DLL_REGCTRL 54
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h
index c2dd2fe3047..bda391d3af8 100644
--- a/include/asm-mips/sibyte/bcm1480_regs.h
+++ b/include/asm-mips/sibyte/bcm1480_regs.h
@@ -230,6 +230,7 @@
230 230
231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan)) 231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan))
232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan)) 232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan))
233#define A_BCM1480_DUART_IN_PORT(chan) (A_BCM1480_DUART(chan) + R_DUART_INP_ORT)
233 234
234/* 235/*
235 * These constants are the absolute addresses. 236 * These constants are the absolute addresses.
@@ -404,6 +405,21 @@
404#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */ 405#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */
405#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */ 406#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */
406 407
408/*
409 * these macros work together to build the address of a mailbox
410 * register, e.g., A_BCM1480_MAILBOX_REGISTER(0,R_BCM1480_IMR_MAILBOX_SET,2)
411 * for mbox_0_set_cpu2 returns 0x00100240C8
412 */
413#define R_BCM1480_IMR_MAILBOX_CPU 0x00
414#define R_BCM1480_IMR_MAILBOX_SET 0x08
415#define R_BCM1480_IMR_MAILBOX_CLR 0x10
416#define R_BCM1480_IMR_MAILBOX_NUM_SPACING 0x20
417#define A_BCM1480_MAILBOX_REGISTER(num,reg,cpu) \
418 (A_BCM1480_IMR_CPU0_BASE + \
419 (num * R_BCM1480_IMR_MAILBOX_NUM_SPACING) + \
420 (cpu * BCM1480_IMR_REGISTER_SPACING) + \
421 (R_BCM1480_IMR_MAILBOX_0_CPU + reg))
422
407/* ********************************************************************* 423/* *********************************************************************
408 * System Performance Counter Registers (Section 4.7) 424 * System Performance Counter Registers (Section 4.7)
409 ********************************************************************* */ 425 ********************************************************************* */
@@ -428,6 +444,10 @@
428#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500 444#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500
429#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508 445#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508
430 446
447#define BCM1480_SCD_NUM_PERF_CNT 8
448#define BCM1480_SCD_PERF_CNT_SPACING 8
449#define A_BCM1480_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*BCM1480_SCD_PERF_CNT_SPACING))
450
431/* ********************************************************************* 451/* *********************************************************************
432 * System Bus Watcher Registers (Section 4.8) 452 * System Bus Watcher Registers (Section 4.8)
433 ********************************************************************* */ 453 ********************************************************************* */
diff --git a/include/asm-mips/sibyte/bcm1480_scd.h b/include/asm-mips/sibyte/bcm1480_scd.h
index 648bed96780..6111d6dcf11 100644
--- a/include/asm-mips/sibyte/bcm1480_scd.h
+++ b/include/asm-mips/sibyte/bcm1480_scd.h
@@ -10,7 +10,7 @@
10 * 10 *
11 ********************************************************************* 11 *********************************************************************
12 * 12 *
13 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved. 14 * Broadcom Corporation. All rights reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@
78#define K_SYS_PART_BCM1280 0x1206 78#define K_SYS_PART_BCM1280 0x1206
79#define K_SYS_PART_BCM1455 0x1407 79#define K_SYS_PART_BCM1455 0x1407
80#define K_SYS_PART_BCM1255 0x1257 80#define K_SYS_PART_BCM1255 0x1257
81#define K_SYS_PART_BCM1158 0x1156
81 82
82/* 83/*
83 * Manufacturing Information Register (Table 14) 84 * Manufacturing Information Register (Table 14)
@@ -237,58 +238,42 @@
237 * System Performance Counter Configuration Register (Table 31) 238 * System Performance Counter Configuration Register (Table 31)
238 * Register: PERF_CNT_CFG_0 239 * Register: PERF_CNT_CFG_0
239 * 240 *
240 * Since the clear/enable bits are moved compared to the 241 * SPC_CFG_SRC[0-3] is the same as the 1250.
241 * 1250 and there are more fields, this register will be BCM1480 specific. 242 * SPC_CFG_SRC[4-7] only exist on the 1480
243 * The clear/enable bits are in different locations on the 1250 and 1480.
242 */ 244 */
243 245
244#define S_BCM1480_SPC_CFG_SRC0 0 246#define S_SPC_CFG_SRC4 32
245#define M_BCM1480_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC0) 247#define M_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_SPC_CFG_SRC4)
246#define V_BCM1480_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC0) 248#define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC4)
247#define G_BCM1480_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC0,M_BCM1480_SPC_CFG_SRC0) 249#define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_SPC_CFG_SRC4,M_SPC_CFG_SRC4)
248 250
249#define S_BCM1480_SPC_CFG_SRC1 8 251#define S_SPC_CFG_SRC5 40
250#define M_BCM1480_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC1) 252#define M_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_SPC_CFG_SRC5)
251#define V_BCM1480_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC1) 253#define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC5)
252#define G_BCM1480_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC1,M_BCM1480_SPC_CFG_SRC1) 254#define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_SPC_CFG_SRC5,M_SPC_CFG_SRC5)
253 255
254#define S_BCM1480_SPC_CFG_SRC2 16 256#define S_SPC_CFG_SRC6 48
255#define M_BCM1480_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC2) 257#define M_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_SPC_CFG_SRC6)
256#define V_BCM1480_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC2) 258#define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC6)
257#define G_BCM1480_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC2,M_BCM1480_SPC_CFG_SRC2) 259#define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_SPC_CFG_SRC6,M_SPC_CFG_SRC6)
258 260
259#define S_BCM1480_SPC_CFG_SRC3 24 261#define S_SPC_CFG_SRC7 56
260#define M_BCM1480_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC3) 262#define M_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_SPC_CFG_SRC7)
261#define V_BCM1480_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC3) 263#define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC7)
262#define G_BCM1480_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC3,M_BCM1480_SPC_CFG_SRC3) 264#define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_SPC_CFG_SRC7,M_SPC_CFG_SRC7)
263
264#define S_BCM1480_SPC_CFG_SRC4 32
265#define M_BCM1480_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC4)
266#define V_BCM1480_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC4)
267#define G_BCM1480_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC4,M_BCM1480_SPC_CFG_SRC4)
268
269#define S_BCM1480_SPC_CFG_SRC5 40
270#define M_BCM1480_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC5)
271#define V_BCM1480_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC5)
272#define G_BCM1480_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC5,M_BCM1480_SPC_CFG_SRC5)
273
274#define S_BCM1480_SPC_CFG_SRC6 48
275#define M_BCM1480_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC6)
276#define V_BCM1480_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC6)
277#define G_BCM1480_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC6,M_BCM1480_SPC_CFG_SRC6)
278
279#define S_BCM1480_SPC_CFG_SRC7 56
280#define M_BCM1480_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC7)
281#define V_BCM1480_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC7)
282#define G_BCM1480_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC7,M_BCM1480_SPC_CFG_SRC7)
283 265
284/* 266/*
285 * System Performance Counter Control Register (Table 32) 267 * System Performance Counter Control Register (Table 32)
286 * Register: PERF_CNT_CFG_1 268 * Register: PERF_CNT_CFG_1
287 * BCM1480 specific 269 * BCM1480 specific
288 */ 270 */
289 271#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
290#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0) 272#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1)
291#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1) 273#if SIBYTE_HDR_FEATURE_CHIP(1480)
274#define M_SPC_CFG_CLEAR M_BCM1480_SPC_CFG_CLEAR
275#define M_SPC_CFG_ENABLE M_BCM1480_SPC_CFG_ENABLE
276#endif
292 277
293/* 278/*
294 * System Performance Counters (Table 33) 279 * System Performance Counters (Table 33)
@@ -405,20 +390,10 @@
405 * Trace Control Register (Table 49) 390 * Trace Control Register (Table 49)
406 * Register: TRACE_CFG 391 * Register: TRACE_CFG
407 * 392 *
408 * Bits 0..8 are the same as the BCM1250, rest are different. 393 * BCM1480 changes to this register (other than location of the CUR_ADDR field)
409 * Entire register is redefined below. 394 * are defined below.
410 */ 395 */
411 396
412#define M_BCM1480_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
413#define M_BCM1480_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
414#define M_BCM1480_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
415#define M_BCM1480_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
416#define M_BCM1480_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
417#define M_BCM1480_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
418#define M_BCM1480_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
419#define M_BCM1480_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
420#define M_BCM1480_SCD_TRACE_CFG_FORCE_CNT _SB_MAKEMASK1(8)
421
422#define S_BCM1480_SCD_TRACE_CFG_MODE 16 397#define S_BCM1480_SCD_TRACE_CFG_MODE 16
423#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE) 398#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE)
424#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE) 399#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE)
@@ -428,9 +403,4 @@
428#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1 403#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
429#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2 404#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
430 405
431#define S_BCM1480_SCD_TRACE_CFG_CUR_ADDR 24
432#define M_BCM1480_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
433#define V_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
434#define G_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR,M_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
435
436#endif /* _BCM1480_SCD_H */ 406#endif /* _BCM1480_SCD_H */
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
index 3dfe29ed42a..73bce901a37 100644
--- a/include/asm-mips/sibyte/board.h
+++ b/include/asm-mips/sibyte/board.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation 2 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -19,8 +19,8 @@
19#ifndef _SIBYTE_BOARD_H 19#ifndef _SIBYTE_BOARD_H
20#define _SIBYTE_BOARD_H 20#define _SIBYTE_BOARD_H
21 21
22
23#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ 22#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \
23 defined(CONFIG_SIBYTE_PT1120) || defined(CONFIG_SIBYTE_PT1125) || \
24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \ 24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \
25 defined(CONFIG_SIBYTE_LITTLESUR) 25 defined(CONFIG_SIBYTE_LITTLESUR)
26#include <asm/sibyte/swarm.h> 26#include <asm/sibyte/swarm.h>
@@ -55,6 +55,16 @@
55#define setleds(t0,t1,c0,c1,c2,c3) 55#define setleds(t0,t1,c0,c1,c2,c3)
56#endif /* LEDS_PHYS */ 56#endif /* LEDS_PHYS */
57 57
58#else
59
60void swarm_setup(void);
61
62#ifdef LEDS_PHYS
63extern void setleds(char *str);
64#else
65#define setleds(s) do { } while (0)
66#endif /* LEDS_PHYS */
67
58#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
59 69
60#endif /* _SIBYTE_BOARD_H */ 70#endif /* _SIBYTE_BOARD_H */
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h
index 57c53e62a37..11cad71323e 100644
--- a/include/asm-mips/sibyte/carmel.h
+++ b/include/asm-mips/sibyte/carmel.h
@@ -18,7 +18,6 @@
18#ifndef __ASM_SIBYTE_CARMEL_H 18#ifndef __ASM_SIBYTE_CARMEL_H
19#define __ASM_SIBYTE_CARMEL_H 19#define __ASM_SIBYTE_CARMEL_H
20 20
21
22#include <asm/sibyte/sb1250.h> 21#include <asm/sibyte/sb1250.h>
23#include <asm/sibyte/sb1250_int.h> 22#include <asm/sibyte/sb1250_int.h>
24 23
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
index 05c7b39f1b0..94e8299b0a2 100644
--- a/include/asm-mips/sibyte/sb1250_int.h
+++ b/include/asm-mips/sibyte/sb1250_int.h
@@ -45,8 +45,6 @@
45 * First, the interrupt numbers. 45 * First, the interrupt numbers.
46 */ 46 */
47 47
48#if SIBYTE_HDR_FEATURE_1250_112x
49
50#define K_INT_SOURCES 64 48#define K_INT_SOURCES 64
51 49
52#define K_INT_WATCHDOG_TIMER_0 0 50#define K_INT_WATCHDOG_TIMER_0 0
@@ -152,6 +150,7 @@
152#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1) 150#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
153#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2) 151#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
154#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3) 152#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3)
153#define M_INT_MBOX_ALL _SB_MAKEMASK(4,K_INT_MBOX_0)
155#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 154#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
156#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT) 155#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
157#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT) 156#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
@@ -247,5 +246,3 @@
247 246
248 247
249#endif /* 1250/112x */ 248#endif /* 1250/112x */
250
251#endif
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index adfc688fa55..833c8b59d68 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -129,9 +129,9 @@
129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) 129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42)
130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) 130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43)
131 131
132#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 132#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) 133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44)
134#endif /* 1250 PASS2 || 112x PASS1 */ 134#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
135 135
136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) 137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45)
@@ -223,9 +223,9 @@
223/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 223/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
224/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */ 224/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */
225#endif /* up to 1250 PASS1 */ 225#endif /* up to 1250 PASS1 */
226#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 226#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
227#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH) 227#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH)
228#endif /* 1250 PASS2 || 112x PASS1 */ 228#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
229#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH) 229#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH)
230#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH) 230#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH)
231 231
@@ -234,9 +234,9 @@
234/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 234/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
235/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */ 235/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */
236#endif /* up to 1250 PASS1 */ 236#endif /* up to 1250 PASS1 */
237#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 237#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
238#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH) 238#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH)
239#endif /* 1250 PASS2 || 112x PASS1 */ 239#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
240#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH) 240#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH)
241#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH) 241#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH)
242 242
@@ -260,12 +260,12 @@
260#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH) 260#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH)
261#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH) 261#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH)
262 262
263#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 263#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
264#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56) 264#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56)
265#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH) 265#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH)
266#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH) 266#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH)
267#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH) 267#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH)
268#endif /* 1250 PASS2 || 112x PASS1 */ 268#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
269 269
270/* 270/*
271 * MAC Frame Configuration Registers (Table 9-15) 271 * MAC Frame Configuration Registers (Table 9-15)
@@ -462,9 +462,9 @@
462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) 462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44)
463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) 463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45)
464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) 464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46)
465#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 465#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
466#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */ 466#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */
467#endif /* 1250 PASS2 || 112x PASS1 */ 467#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
468 468
469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47) 469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47)
470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR) 470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR)
@@ -598,9 +598,9 @@
598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4) 598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4)
599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5) 599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5)
600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) 600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6)
601#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 601#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
602#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7) 602#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7)
603#endif /* 1250 PASS2 || 112x PASS1 */ 603#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
604 604
605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) 605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8)
606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET) 606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET)
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
index 26e421498c9..4fe848ffbc3 100644
--- a/include/asm-mips/sibyte/sb1250_mc.h
+++ b/include/asm-mips/sibyte/sb1250_mc.h
@@ -295,7 +295,7 @@
295 295
296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36) 297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36)
298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(38) 298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(37)
299#endif /* 1250 PASS3 || 112x PASS1 */ 299#endif /* 1250 PASS3 || 112x PASS1 */
300 300
301 301
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index bab3a4580a3..da7c188993c 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -131,6 +131,7 @@
131 131
132#endif 132#endif
133 133
134
134/* ********************************************************************* 135/* *********************************************************************
135 * PCI Interface Registers 136 * PCI Interface Registers
136 ********************************************************************* */ 137 ********************************************************************* */
@@ -239,14 +240,14 @@
239#define R_MAC_VLANTAG 0x00000110 240#define R_MAC_VLANTAG 0x00000110
240#define R_MAC_FRAMECFG 0x00000118 241#define R_MAC_FRAMECFG 0x00000118
241#define R_MAC_EOPCNT 0x00000120 242#define R_MAC_EOPCNT 0x00000120
242#define R_MAC_FIFO_PTRS 0x00000130 243#define R_MAC_FIFO_PTRS 0x00000128
243#define R_MAC_ADFILTER_CFG 0x00000200 244#define R_MAC_ADFILTER_CFG 0x00000200
244#define R_MAC_ETHERNET_ADDR 0x00000208 245#define R_MAC_ETHERNET_ADDR 0x00000208
245#define R_MAC_PKT_TYPE 0x00000210 246#define R_MAC_PKT_TYPE 0x00000210
246#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 247#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
247#define R_MAC_ADMASK0 0x00000218 248#define R_MAC_ADMASK0 0x00000218
248#define R_MAC_ADMASK1 0x00000220 249#define R_MAC_ADMASK1 0x00000220
249#endif /* 1250 PASS3 || 112x PASS1 */ 250#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
250#define R_MAC_HASH_BASE 0x00000240 251#define R_MAC_HASH_BASE 0x00000240
251#define R_MAC_ADDR_BASE 0x00000280 252#define R_MAC_ADDR_BASE 0x00000280
252#define R_MAC_CHLO0_BASE 0x00000300 253#define R_MAC_CHLO0_BASE 0x00000300
@@ -256,9 +257,9 @@
256#define R_MAC_INT_MASK 0x00000410 257#define R_MAC_INT_MASK 0x00000410
257#define R_MAC_TXD_CTL 0x00000420 258#define R_MAC_TXD_CTL 0x00000420
258#define R_MAC_MDIO 0x00000428 259#define R_MAC_MDIO 0x00000428
259#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 260#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
260#define R_MAC_STATUS1 0x00000430 261#define R_MAC_STATUS1 0x00000430
261#endif /* 1250 PASS2 || 112x PASS1 */ 262#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
262#define R_MAC_DEBUG_STATUS 0x00000448 263#define R_MAC_DEBUG_STATUS 0x00000448
263 264
264#define MAC_HASH_COUNT 8 265#define MAC_HASH_COUNT 8
@@ -289,11 +290,11 @@
289#define R_DUART_RX_HOLD 0x160 290#define R_DUART_RX_HOLD 0x160
290#define R_DUART_TX_HOLD 0x170 291#define R_DUART_TX_HOLD 0x170
291 292
292#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 293#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
293#define R_DUART_FULL_CTL 0x140 294#define R_DUART_FULL_CTL 0x140
294#define R_DUART_OPCR_X 0x180 295#define R_DUART_OPCR_X 0x180
295#define R_DUART_AUXCTL_X 0x190 296#define R_DUART_AUXCTL_X 0x190
296#endif /* 1250 PASS2 || 112x PASS1 */ 297#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
297 298
298 299
299/* 300/*
@@ -308,6 +309,7 @@
308#define R_DUART_IMR_B 0x350 309#define R_DUART_IMR_B 0x350
309#define R_DUART_OUT_PORT 0x360 310#define R_DUART_OUT_PORT 0x360
310#define R_DUART_OPCR 0x370 311#define R_DUART_OPCR 0x370
312#define R_DUART_IN_PORT 0x380
311 313
312#define R_DUART_SET_OPR 0x3B0 314#define R_DUART_SET_OPR 0x3B0
313#define R_DUART_CLEAR_OPR 0x3C0 315#define R_DUART_CLEAR_OPR 0x3C0
@@ -685,12 +687,17 @@
685#define A_ADDR_TRAP_REG_DEBUG 0x0010020460 687#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
686#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 688#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
687 689
690#define ADDR_TRAP_SPACING 8
691#define NUM_ADDR_TRAP 4
692#define A_ADDR_TRAP_UP(n) (A_ADDR_TRAP_UP_0 + ((n) * ADDR_TRAP_SPACING))
693#define A_ADDR_TRAP_DOWN(n) (A_ADDR_TRAP_DOWN_0 + ((n) * ADDR_TRAP_SPACING))
694#define A_ADDR_TRAP_CFG(n) (A_ADDR_TRAP_CFG_0 + ((n) * ADDR_TRAP_SPACING))
695
688 696
689/* ********************************************************************* 697/* *********************************************************************
690 * System Interrupt Mapper Registers 698 * System Interrupt Mapper Registers
691 ********************************************************************* */ 699 ********************************************************************* */
692 700
693#if SIBYTE_HDR_FEATURE_1250_112x
694#define A_IMR_CPU0_BASE 0x0010020000 701#define A_IMR_CPU0_BASE 0x0010020000
695#define A_IMR_CPU1_BASE 0x0010022000 702#define A_IMR_CPU1_BASE 0x0010022000
696#define IMR_REGISTER_SPACING 0x2000 703#define IMR_REGISTER_SPACING 0x2000
@@ -700,6 +707,7 @@
700#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg)) 707#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg))
701 708
702#define R_IMR_INTERRUPT_DIAG 0x0010 709#define R_IMR_INTERRUPT_DIAG 0x0010
710#define R_IMR_INTERRUPT_LDT 0x0018
703#define R_IMR_INTERRUPT_MASK 0x0028 711#define R_IMR_INTERRUPT_MASK 0x0028
704#define R_IMR_INTERRUPT_TRACE 0x0038 712#define R_IMR_INTERRUPT_TRACE 0x0038
705#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040 713#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040
@@ -715,7 +723,14 @@
715#define R_IMR_INTERRUPT_STATUS_COUNT 7 723#define R_IMR_INTERRUPT_STATUS_COUNT 7
716#define R_IMR_INTERRUPT_MAP_BASE 0x0200 724#define R_IMR_INTERRUPT_MAP_BASE 0x0200
717#define R_IMR_INTERRUPT_MAP_COUNT 64 725#define R_IMR_INTERRUPT_MAP_COUNT 64
718#endif /* 1250/112x */ 726
727/*
728 * these macros work together to build the address of a mailbox
729 * register, e.g., A_MAILBOX_REGISTER(R_IMR_MAILBOX_SET_CPU,1)
730 * for mbox_0_set_cpu2 returns 0x00100240C8
731 */
732#define A_MAILBOX_REGISTER(reg,cpu) \
733 (A_IMR_CPU0_BASE + (cpu * IMR_REGISTER_SPACING) + reg)
719 734
720/* ********************************************************************* 735/* *********************************************************************
721 * System Performance Counter Registers 736 * System Performance Counter Registers
@@ -727,6 +742,10 @@
727#define A_SCD_PERF_CNT_2 0x00100204E0 742#define A_SCD_PERF_CNT_2 0x00100204E0
728#define A_SCD_PERF_CNT_3 0x00100204E8 743#define A_SCD_PERF_CNT_3 0x00100204E8
729 744
745#define SCD_NUM_PERF_CNT 4
746#define SCD_PERF_CNT_SPACING 8
747#define A_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*SCD_PERF_CNT_SPACING))
748
730/* ********************************************************************* 749/* *********************************************************************
731 * System Bus Watcher Registers 750 * System Bus Watcher Registers
732 ********************************************************************* */ 751 ********************************************************************* */
@@ -772,6 +791,15 @@
772#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 791#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
773#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 792#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
774 793
794#define TRACE_REGISTER_SPACING 8
795#define TRACE_NUM_REGISTERS 8
796#define A_SCD_TRACE_EVENT(n) (((n) & 4) ? \
797 (A_SCD_TRACE_EVENT_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
798 (A_SCD_TRACE_EVENT_0 + ((n) * TRACE_REGISTER_SPACING)))
799#define A_SCD_TRACE_SEQUENCE(n) (((n) & 4) ? \
800 (A_SCD_TRACE_SEQUENCE_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
801 (A_SCD_TRACE_SEQUENCE_0 + ((n) * TRACE_REGISTER_SPACING)))
802
775/* ********************************************************************* 803/* *********************************************************************
776 * System Generic DMA Registers 804 * System Generic DMA Registers
777 ********************************************************************* */ 805 ********************************************************************* */
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index 7ed0bb611e5..9ea3da367ab 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -10,7 +10,7 @@
10 * 10 *
11 ********************************************************************* 11 *********************************************************************
12 * 12 *
13 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved. 14 * Broadcom Corporation. All rights reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
@@ -84,6 +84,7 @@
84#define K_SYS_REVISION_BCM112x_A2 0x21 84#define K_SYS_REVISION_BCM112x_A2 0x21
85#define K_SYS_REVISION_BCM112x_A3 0x22 85#define K_SYS_REVISION_BCM112x_A3 0x22
86#define K_SYS_REVISION_BCM112x_A4 0x23 86#define K_SYS_REVISION_BCM112x_A4 0x23
87#define K_SYS_REVISION_BCM112x_B0 0x30
87 88
88#define K_SYS_REVISION_BCM1480_S0 0x01 89#define K_SYS_REVISION_BCM1480_S0 0x01
89#define K_SYS_REVISION_BCM1480_A1 0x02 90#define K_SYS_REVISION_BCM1480_A1 0x02
@@ -149,7 +150,7 @@
149 * (For the assembler version, sysrev and dest may be the same register. 150 * (For the assembler version, sysrev and dest may be the same register.
150 * Also, it clobbers AT.) 151 * Also, it clobbers AT.)
151 */ 152 */
152#ifdef __ASSEMBLY__ 153#ifdef __ASSEMBLER__
153#define SYS_SOC_TYPE(dest, sysrev) \ 154#define SYS_SOC_TYPE(dest, sysrev) \
154 .set push ; \ 155 .set push ; \
155 .set reorder ; \ 156 .set reorder ; \
@@ -213,6 +214,7 @@
213#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) 214#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS)
214#endif 215#endif
215 216
217
216/* 218/*
217 * System Config Register (Table 4-2) 219 * System Config Register (Table 4-2)
218 * Register: SCD_SYSTEM_CFG 220 * Register: SCD_SYSTEM_CFG
@@ -359,13 +361,13 @@
359 */ 361 */
360 362
361#define V_SCD_TIMER_FREQ 1000000 363#define V_SCD_TIMER_FREQ 1000000
362#define V_SCD_TIMER_WIDTH 23
363 364
364#define S_SCD_TIMER_INIT 0 365#define S_SCD_TIMER_INIT 0
365#define M_SCD_TIMER_INIT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_INIT) 366#define M_SCD_TIMER_INIT _SB_MAKEMASK(23,S_SCD_TIMER_INIT)
366#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) 367#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT)
367#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) 368#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT)
368 369
370#define V_SCD_TIMER_WIDTH 23
369#define S_SCD_TIMER_CNT 0 371#define S_SCD_TIMER_CNT 0
370#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT) 372#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT)
371#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) 373#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT)
@@ -379,7 +381,6 @@
379 * System Performance Counters 381 * System Performance Counters
380 */ 382 */
381 383
382#if SIBYTE_HDR_FEATURE_1250_112x
383#define S_SPC_CFG_SRC0 0 384#define S_SPC_CFG_SRC0 0
384#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) 385#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0)
385#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) 386#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0)
@@ -400,6 +401,7 @@
400#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3) 401#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3)
401#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3) 402#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3)
402 403
404#if SIBYTE_HDR_FEATURE_1250_112x
403#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) 405#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
404#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) 406#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
405#endif 407#endif
@@ -515,8 +517,6 @@
515 * Trace Buffer Config register 517 * Trace Buffer Config register
516 */ 518 */
517 519
518#if SIBYTE_HDR_FEATURE_1250_112x
519
520#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) 520#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
521#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) 521#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
522#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) 522#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
@@ -525,17 +525,26 @@
525#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) 525#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
526#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) 526#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
527#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) 527#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
528#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 528#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
529#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8) 529#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8)
530#endif /* 1250 PASS2 || 112x PASS1 */ 530#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
531 531
532/*
533 * This field is the same on the 1250/112x and 1480, just located in
534 * a slightly different place in the register.
535 */
536#if SIBYTE_HDR_FEATURE_1250_112x
532#define S_SCD_TRACE_CFG_CUR_ADDR 10 537#define S_SCD_TRACE_CFG_CUR_ADDR 10
538#else
539#if SIBYTE_HDR_FEATURE_CHIP(1480)
540#define S_SCD_TRACE_CFG_CUR_ADDR 24
541#endif /* 1480 */
542#endif /* 1250/112x */
543
533#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR) 544#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR)
534#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) 545#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR)
535#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) 546#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR)
536 547
537#endif /* 1250/112x */
538
539/* 548/*
540 * Trace Event registers 549 * Trace Event registers
541 */ 550 */
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
index 86db37e5ad8..540865fa7ec 100644
--- a/include/asm-mips/sibyte/swarm.h
+++ b/include/asm-mips/sibyte/swarm.h
@@ -32,6 +32,18 @@
32#define SIBYTE_HAVE_IDE 1 32#define SIBYTE_HAVE_IDE 1
33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" 33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
34#endif 34#endif
35#ifdef CONFIG_SIBYTE_PT1120
36#define SIBYTE_BOARD_NAME "PT1120"
37#define SIBYTE_HAVE_PCMCIA 1
38#define SIBYTE_HAVE_IDE 1
39#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
40#endif
41#ifdef CONFIG_SIBYTE_PT1125
42#define SIBYTE_BOARD_NAME "PT1125"
43#define SIBYTE_HAVE_PCMCIA 1
44#define SIBYTE_HAVE_IDE 1
45#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
46#endif
35#ifdef CONFIG_SIBYTE_LITTLESUR 47#ifdef CONFIG_SIBYTE_LITTLESUR
36#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)" 48#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
37#define SIBYTE_HAVE_PCMCIA 0 49#define SIBYTE_HAVE_PCMCIA 0
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 36ebe4e186a..95945689b1c 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -70,6 +70,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
70#define SO_SNDBUFFORCE 31 70#define SO_SNDBUFFORCE 31
71#define SO_RCVBUFFORCE 33 71#define SO_RCVBUFFORCE 33
72#define SO_PASSSEC 34 72#define SO_PASSSEC 34
73#define SO_TIMESTAMPNS 35
74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
73 75
74#ifdef __KERNEL__ 76#ifdef __KERNEL__
75 77
diff --git a/include/asm-mips/sockios.h b/include/asm-mips/sockios.h
index 87a50bf039e..ed1a5f78d22 100644
--- a/include/asm-mips/sockios.h
+++ b/include/asm-mips/sockios.h
@@ -20,6 +20,7 @@
20#define SIOCSPGRP _IOW('s', 8, pid_t) 20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t) 21#define SIOCGPGRP _IOR('s', 9, pid_t)
22 22
23#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 23#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
24#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
24 25
25#endif /* _ASM_SOCKIOS_H */ 26#endif /* _ASM_SOCKIOS_H */
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index 6cf05f4a4e7..fbcda820447 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -119,7 +119,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
120#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
121#define TIF_FREEZE 19 121#define TIF_FREEZE 19
122#define TIF_ALLOW_FP_IN_KERNEL 20
123#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 122#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
124 123
125#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 124#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
diff --git a/include/asm-parisc/mmu_context.h b/include/asm-parisc/mmu_context.h
index 9c05836239a..bad690298f0 100644
--- a/include/asm-parisc/mmu_context.h
+++ b/include/asm-parisc/mmu_context.h
@@ -5,6 +5,7 @@
5#include <asm/atomic.h> 5#include <asm/atomic.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm/pgtable.h> 7#include <asm/pgtable.h>
8#include <asm-generic/mm_hooks.h>
8 9
9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 10static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
10{ 11{
diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h
index 236c1d0fba3..e7211c74844 100644
--- a/include/asm-parisc/scatterlist.h
+++ b/include/asm-parisc/scatterlist.h
@@ -2,6 +2,7 @@
2#define _ASM_PARISC_SCATTERLIST_H 2#define _ASM_PARISC_SCATTERLIST_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm/types.h>
5 6
6struct scatterlist { 7struct scatterlist {
7 struct page *page; 8 struct page *page;
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index ce2eae1708b..99e868f6a8f 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -33,6 +33,8 @@
33#define SO_PEERCRED 0x4011 33#define SO_PEERCRED 0x4011
34#define SO_TIMESTAMP 0x4012 34#define SO_TIMESTAMP 0x4012
35#define SCM_TIMESTAMP SO_TIMESTAMP 35#define SCM_TIMESTAMP SO_TIMESTAMP
36#define SO_TIMESTAMPNS 0x4013
37#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
36 38
37/* Security levels - as per NRL IPv6 - don't actually do anything */ 39/* Security levels - as per NRL IPv6 - don't actually do anything */
38#define SO_SECURITY_AUTHENTICATION 0x4016 40#define SO_SECURITY_AUTHENTICATION 0x4016
diff --git a/include/asm-parisc/sockios.h b/include/asm-parisc/sockios.h
index aace4962994..dabfbc7483f 100644
--- a/include/asm-parisc/sockios.h
+++ b/include/asm-parisc/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index c89bd58ee28..c19e7367fce 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -78,6 +78,15 @@
78#define PPC_STLCX stringify_in_c(stdcx.) 78#define PPC_STLCX stringify_in_c(stdcx.)
79#define PPC_CNTLZL stringify_in_c(cntlzd) 79#define PPC_CNTLZL stringify_in_c(cntlzd)
80 80
81/* Move to CR, single-entry optimized version. Only available
82 * on POWER4 and later.
83 */
84#ifdef CONFIG_POWER4_ONLY
85#define PPC_MTOCRF stringify_in_c(mtocrf)
86#else
87#define PPC_MTOCRF stringify_in_c(mtcrf)
88#endif
89
81#else /* 32-bit */ 90#else /* 32-bit */
82 91
83/* operations for longs and pointers */ 92/* operations for longs and pointers */
@@ -89,6 +98,7 @@
89#define PPC_LLARX stringify_in_c(lwarx) 98#define PPC_LLARX stringify_in_c(lwarx)
90#define PPC_STLCX stringify_in_c(stwcx.) 99#define PPC_STLCX stringify_in_c(stwcx.)
91#define PPC_CNTLZL stringify_in_c(cntlzw) 100#define PPC_CNTLZL stringify_in_c(cntlzw)
101#define PPC_MTOCRF stringify_in_c(mtcrf)
92 102
93#endif 103#endif
94 104
diff --git a/include/asm-powerpc/cacheflush.h b/include/asm-powerpc/cacheflush.h
index 08e93e78921..ba667a383b8 100644
--- a/include/asm-powerpc/cacheflush.h
+++ b/include/asm-powerpc/cacheflush.h
@@ -64,6 +64,12 @@ extern void flush_dcache_phys_range(unsigned long start, unsigned long stop);
64 memcpy(dst, src, len) 64 memcpy(dst, src, len)
65 65
66 66
67
68#ifdef CONFIG_DEBUG_PAGEALLOC
69/* internal debugging function */
70void kernel_map_pages(struct page *page, int numpages, int enable);
71#endif
72
67#endif /* __KERNEL__ */ 73#endif /* __KERNEL__ */
68 74
69#endif /* _ASM_POWERPC_CACHEFLUSH_H */ 75#endif /* _ASM_POWERPC_CACHEFLUSH_H */
diff --git a/include/asm-powerpc/cell-pmu.h b/include/asm-powerpc/cell-pmu.h
index 35b95773746..8066eede3a0 100644
--- a/include/asm-powerpc/cell-pmu.h
+++ b/include/asm-powerpc/cell-pmu.h
@@ -97,11 +97,6 @@ extern void cbe_disable_pm_interrupts(u32 cpu);
97extern u32 cbe_get_and_clear_pm_interrupts(u32 cpu); 97extern u32 cbe_get_and_clear_pm_interrupts(u32 cpu);
98extern void cbe_sync_irq(int node); 98extern void cbe_sync_irq(int node);
99 99
100/* Utility functions, macros */
101extern u32 cbe_get_hw_thread_id(int cpu);
102
103#define cbe_cpu_to_node(cpu) ((cpu) >> 1)
104
105#define CBE_COUNT_SUPERVISOR_MODE 0 100#define CBE_COUNT_SUPERVISOR_MODE 0
106#define CBE_COUNT_HYPERVISOR_MODE 1 101#define CBE_COUNT_HYPERVISOR_MODE 1
107#define CBE_COUNT_PROBLEM_MODE 2 102#define CBE_COUNT_PROBLEM_MODE 2
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index e870b539317..434524931ef 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -48,6 +48,7 @@ enum powerpc_oprofile_type {
48 PPC_OPROFILE_G4 = 3, 48 PPC_OPROFILE_G4 = 3,
49 PPC_OPROFILE_BOOKE = 4, 49 PPC_OPROFILE_BOOKE = 4,
50 PPC_OPROFILE_CELL = 5, 50 PPC_OPROFILE_CELL = 5,
51 PPC_OPROFILE_PA6T = 6,
51}; 52};
52 53
53enum powerpc_pmc_type { 54enum powerpc_pmc_type {
@@ -223,6 +224,10 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
223 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 224 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
224 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 225 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
225 CPU_FTR_PPC_LE) 226 CPU_FTR_PPC_LE)
227#define CPU_FTRS_750CL (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
228 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
229 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
230 CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
226#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 231#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
227 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 232 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
228 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 233 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
@@ -235,9 +240,9 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
235 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 240 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
236 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 241 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
237 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 242 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
238#define CPU_FTRS_750GX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 243#define CPU_FTRS_750GX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
239 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU | \ 244 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
240 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 245 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
241 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 246 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
242#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 247#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
243 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 248 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h
index b8708aedf92..e2c7f06931e 100644
--- a/include/asm-powerpc/current.h
+++ b/include/asm-powerpc/current.h
@@ -12,6 +12,7 @@
12struct task_struct; 12struct task_struct;
13 13
14#ifdef __powerpc64__ 14#ifdef __powerpc64__
15#include <linux/stddef.h>
15#include <asm/paca.h> 16#include <asm/paca.h>
16 17
17static inline struct task_struct *get_current(void) 18static inline struct task_struct *get_current(void)
diff --git a/include/asm-powerpc/edac.h b/include/asm-powerpc/edac.h
new file mode 100644
index 00000000000..6ead88bbfbb
--- /dev/null
+++ b/include/asm-powerpc/edac.h
@@ -0,0 +1,40 @@
1/*
2 * PPC EDAC common defs
3 *
4 * Author: Dave Jiang <djiang@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef ASM_EDAC_H
12#define ASM_EDAC_H
13/*
14 * ECC atomic, DMA, SMP and interrupt safe scrub function.
15 * Implements the per arch atomic_scrub() that EDAC use for software
16 * ECC scrubbing. It reads memory and then writes back the original
17 * value, allowing the hardware to detect and correct memory errors.
18 */
19static __inline__ void atomic_scrub(void *va, u32 size)
20{
21 unsigned int *virt_addr = va;
22 unsigned int temp;
23 unsigned int i;
24
25 for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
26 /* Very carefully read and write to memory atomically
27 * so we are interrupt, DMA and SMP safe.
28 */
29 __asm__ __volatile__ ("\n\
30 1: lwarx %0,0,%1\n\
31 stwcx. %0,0,%1\n\
32 bne- 1b\n\
33 isync"
34 : "=&r"(temp)
35 : "r"(virt_addr)
36 : "cr0", "memory");
37 }
38}
39
40#endif
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h
index dc6bf0ffb79..cc3cb04539a 100644
--- a/include/asm-powerpc/eeh_event.h
+++ b/include/asm-powerpc/eeh_event.h
@@ -30,8 +30,6 @@ struct eeh_event {
30 struct list_head list; 30 struct list_head list;
31 struct device_node *dn; /* struct device node */ 31 struct device_node *dn; /* struct device node */
32 struct pci_dev *dev; /* affected device */ 32 struct pci_dev *dev; /* affected device */
33 enum pci_channel_state state; /* PCI bus state for the affected device */
34 int time_unavail; /* milliseconds until device might be available */
35}; 33};
36 34
37/** 35/**
@@ -46,9 +44,7 @@ struct eeh_event {
46 * (from a workqueue). 44 * (from a workqueue).
47 */ 45 */
48int eeh_send_failure_event (struct device_node *dn, 46int eeh_send_failure_event (struct device_node *dn,
49 struct pci_dev *dev, 47 struct pci_dev *dev);
50 enum pci_channel_state state,
51 int time_unavail);
52 48
53/* Main recovery function */ 49/* Main recovery function */
54struct pci_dn * handle_eeh_events (struct eeh_event *); 50struct pci_dn * handle_eeh_events (struct eeh_event *);
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 66112114b8c..87d396e28db 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -2,36 +2,37 @@
2 * IBM PowerPC eBus Infrastructure Support. 2 * IBM PowerPC eBus Infrastructure Support.
3 * 3 *
4 * Copyright (c) 2005 IBM Corporation 4 * Copyright (c) 2005 IBM Corporation
5 * Joachim Fenkes <fenkes@de.ibm.com>
5 * Heiko J Schick <schickhj@de.ibm.com> 6 * Heiko J Schick <schickhj@de.ibm.com>
6 * 7 *
7 * All rights reserved. 8 * All rights reserved.
8 * 9 *
9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB 10 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
10 * BSD. 11 * BSD.
11 * 12 *
12 * OpenIB BSD License 13 * OpenIB BSD License
13 * 14 *
14 * Redistribution and use in source and binary forms, with or without 15 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met: 16 * modification, are permitted provided that the following conditions are met:
16 * 17 *
17 * Redistributions of source code must retain the above copyright notice, this 18 * Redistributions of source code must retain the above copyright notice, this
18 * list of conditions and the following disclaimer. 19 * list of conditions and the following disclaimer.
19 * 20 *
20 * Redistributions in binary form must reproduce the above copyright notice, 21 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation 22 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials 23 * and/or other materials
23 * provided with the distribution. 24 * provided with the distribution.
24 * 25 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
36 */ 37 */
37 38
@@ -46,12 +47,11 @@
46 47
47extern struct bus_type ibmebus_bus_type; 48extern struct bus_type ibmebus_bus_type;
48 49
49struct ibmebus_dev { 50struct ibmebus_dev {
50 const char *name;
51 struct of_device ofdev; 51 struct of_device ofdev;
52}; 52};
53 53
54struct ibmebus_driver { 54struct ibmebus_driver {
55 char *name; 55 char *name;
56 struct of_device_id *id_table; 56 struct of_device_id *id_table;
57 int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id); 57 int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id);
@@ -63,7 +63,7 @@ int ibmebus_register_driver(struct ibmebus_driver *drv);
63void ibmebus_unregister_driver(struct ibmebus_driver *drv); 63void ibmebus_unregister_driver(struct ibmebus_driver *drv);
64 64
65int ibmebus_request_irq(struct ibmebus_dev *dev, 65int ibmebus_request_irq(struct ibmebus_dev *dev,
66 u32 ist, 66 u32 ist,
67 irq_handler_t handler, 67 irq_handler_t handler,
68 unsigned long irq_flags, const char * devname, 68 unsigned long irq_flags, const char * devname,
69 void *dev_id); 69 void *dev_id);
diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h
index d905b662226..59b9e07b8e9 100644
--- a/include/asm-powerpc/immap_86xx.h
+++ b/include/asm-powerpc/immap_86xx.h
@@ -85,81 +85,6 @@ typedef struct ccsr_pci {
85 char res19[472]; 85 char res19[472];
86} ccsr_pci_t; 86} ccsr_pci_t;
87 87
88/* PCI Express Registers */
89typedef struct ccsr_pex {
90 uint pex_config_addr; /* 0x.000 - PCI Express Configuration Address Register */
91 uint pex_config_data; /* 0x.004 - PCI Express Configuration Data Register */
92 char res1[4];
93 uint pex_otb_cpl_tor; /* 0x.00c - PCI Express Outbound completion timeout register */
94 uint pex_conf_tor; /* 0x.010 - PCI Express configuration timeout register */
95 char res2[12];
96 uint pex_pme_mes_dr; /* 0x.020 - PCI Express PME and message detect register */
97 uint pex_pme_mes_disr; /* 0x.024 - PCI Express PME and message disable register */
98 uint pex_pme_mes_ier; /* 0x.028 - PCI Express PME and message interrupt enable register */
99 uint pex_pmcr; /* 0x.02c - PCI Express power management command register */
100 char res3[3024];
101 uint pexotar0; /* 0x.c00 - PCI Express outbound translation address register 0 */
102 uint pexotear0; /* 0x.c04 - PCI Express outbound translation extended address register 0*/
103 char res4[8];
104 uint pexowar0; /* 0x.c10 - PCI Express outbound window attributes register 0*/
105 char res5[12];
106 uint pexotar1; /* 0x.c20 - PCI Express outbound translation address register 1 */
107 uint pexotear1; /* 0x.c24 - PCI Express outbound translation extended address register 1*/
108 uint pexowbar1; /* 0x.c28 - PCI Express outbound window base address register 1*/
109 char res6[4];
110 uint pexowar1; /* 0x.c30 - PCI Express outbound window attributes register 1*/
111 char res7[12];
112 uint pexotar2; /* 0x.c40 - PCI Express outbound translation address register 2 */
113 uint pexotear2; /* 0x.c44 - PCI Express outbound translation extended address register 2*/
114 uint pexowbar2; /* 0x.c48 - PCI Express outbound window base address register 2*/
115 char res8[4];
116 uint pexowar2; /* 0x.c50 - PCI Express outbound window attributes register 2*/
117 char res9[12];
118 uint pexotar3; /* 0x.c60 - PCI Express outbound translation address register 3 */
119 uint pexotear3; /* 0x.c64 - PCI Express outbound translation extended address register 3*/
120 uint pexowbar3; /* 0x.c68 - PCI Express outbound window base address register 3*/
121 char res10[4];
122 uint pexowar3; /* 0x.c70 - PCI Express outbound window attributes register 3*/
123 char res11[12];
124 uint pexotar4; /* 0x.c80 - PCI Express outbound translation address register 4 */
125 uint pexotear4; /* 0x.c84 - PCI Express outbound translation extended address register 4*/
126 uint pexowbar4; /* 0x.c88 - PCI Express outbound window base address register 4*/
127 char res12[4];
128 uint pexowar4; /* 0x.c90 - PCI Express outbound window attributes register 4*/
129 char res13[12];
130 char res14[256];
131 uint pexitar3; /* 0x.da0 - PCI Express inbound translation address register 3 */
132 char res15[4];
133 uint pexiwbar3; /* 0x.da8 - PCI Express inbound window base address register 3 */
134 uint pexiwbear3; /* 0x.dac - PCI Express inbound window base extended address register 3 */
135 uint pexiwar3; /* 0x.db0 - PCI Express inbound window attributes register 3 */
136 char res16[12];
137 uint pexitar2; /* 0x.dc0 - PCI Express inbound translation address register 2 */
138 char res17[4];
139 uint pexiwbar2; /* 0x.dc8 - PCI Express inbound window base address register 2 */
140 uint pexiwbear2; /* 0x.dcc - PCI Express inbound window base extended address register 2 */
141 uint pexiwar2; /* 0x.dd0 - PCI Express inbound window attributes register 2 */
142 char res18[12];
143 uint pexitar1; /* 0x.de0 - PCI Express inbound translation address register 2 */
144 char res19[4];
145 uint pexiwbar1; /* 0x.de8 - PCI Express inbound window base address register 2 */
146 uint pexiwbear1; /* 0x.dec - PCI Express inbound window base extended address register 2 */
147 uint pexiwar1; /* 0x.df0 - PCI Express inbound window attributes register 2 */
148 char res20[12];
149 uint pex_err_dr; /* 0x.e00 - PCI Express error detect register */
150 char res21[4];
151 uint pex_err_en; /* 0x.e08 - PCI Express error interrupt enable register */
152 char res22[4];
153 uint pex_err_disr; /* 0x.e10 - PCI Express error disable register */
154 char res23[12];
155 uint pex_err_cap_stat; /* 0x.e20 - PCI Express error capture status register */
156 char res24[4];
157 uint pex_err_cap_r0; /* 0x.e28 - PCI Express error capture register 0 */
158 uint pex_err_cap_r1; /* 0x.e2c - PCI Express error capture register 0 */
159 uint pex_err_cap_r2; /* 0x.e30 - PCI Express error capture register 0 */
160 uint pex_err_cap_r3; /* 0x.e34 - PCI Express error capture register 0 */
161} ccsr_pex_t;
162
163/* Global Utility Registers */ 88/* Global Utility Registers */
164typedef struct ccsr_guts { 89typedef struct ccsr_guts {
165 uint porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */ 90 uint porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 301c9bb308b..350c9bdb31d 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -11,7 +11,12 @@
11 11
12/* Check of existence of legacy devices */ 12/* Check of existence of legacy devices */
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 I8042_DATA_REG 0x60
15#define FDC_BASE 0x3f0
16/* only relevant for PReP */
17#define _PIDXR 0x279
18#define _PNPWRP 0xa79
19#define PNPBIOS_BASE 0xf000
15 20
16#include <linux/compiler.h> 21#include <linux/compiler.h>
17#include <asm/page.h> 22#include <asm/page.h>
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 3a5dd492588..f850ca7020e 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -87,6 +87,11 @@ extern void arch_remove_kprobe(struct kprobe *p);
87struct arch_specific_insn { 87struct arch_specific_insn {
88 /* copy of original instruction */ 88 /* copy of original instruction */
89 kprobe_opcode_t *insn; 89 kprobe_opcode_t *insn;
90 /*
91 * Set in kprobes code, initially to 0. If the instruction can be
92 * eumulated, this is set to 1, if not, to -1.
93 */
94 int boostable;
90}; 95};
91 96
92struct prev_kprobe { 97struct prev_kprobe {
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 1b04e572354..b204926ce91 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -153,9 +153,6 @@ struct machdep_calls {
153 */ 153 */
154 long (*feature_call)(unsigned int feature, ...); 154 long (*feature_call)(unsigned int feature, ...);
155 155
156 /* Check availability of legacy devices like i8042 */
157 int (*check_legacy_ioport)(unsigned int baseport);
158
159 /* Get legacy PCI/IDE interrupt mapping */ 156 /* Get legacy PCI/IDE interrupt mapping */
160 int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel); 157 int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
161 158
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
new file mode 100644
index 00000000000..6739457d8bc
--- /dev/null
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -0,0 +1,400 @@
1#ifndef _ASM_POWERPC_MMU_HASH64_H_
2#define _ASM_POWERPC_MMU_HASH64_H_
3/*
4 * PowerPC64 memory management structures
5 *
6 * Dave Engebretsen & Mike Corrigan <{engebret|mikejc}@us.ibm.com>
7 * PPC64 rework.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <asm/asm-compat.h>
16#include <asm/page.h>
17
18/*
19 * Segment table
20 */
21
22#define STE_ESID_V 0x80
23#define STE_ESID_KS 0x20
24#define STE_ESID_KP 0x10
25#define STE_ESID_N 0x08
26
27#define STE_VSID_SHIFT 12
28
29/* Location of cpu0's segment table */
30#define STAB0_PAGE 0x6
31#define STAB0_OFFSET (STAB0_PAGE << 12)
32#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
33
34#ifndef __ASSEMBLY__
35extern char initial_stab[];
36#endif /* ! __ASSEMBLY */
37
38/*
39 * SLB
40 */
41
42#define SLB_NUM_BOLTED 3
43#define SLB_CACHE_ENTRIES 8
44
45/* Bits in the SLB ESID word */
46#define SLB_ESID_V ASM_CONST(0x0000000008000000) /* valid */
47
48/* Bits in the SLB VSID word */
49#define SLB_VSID_SHIFT 12
50#define SLB_VSID_B ASM_CONST(0xc000000000000000)
51#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
52#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
53#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
54#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
55#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
56#define SLB_VSID_L ASM_CONST(0x0000000000000100)
57#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
58#define SLB_VSID_LP ASM_CONST(0x0000000000000030)
59#define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000)
60#define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010)
61#define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020)
62#define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030)
63#define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP)
64
65#define SLB_VSID_KERNEL (SLB_VSID_KP)
66#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
67
68#define SLBIE_C (0x08000000)
69
70/*
71 * Hash table
72 */
73
74#define HPTES_PER_GROUP 8
75
76#define HPTE_V_AVPN_SHIFT 7
77#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
78#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
79#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN))
80#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
81#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
82#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
83#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
84#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
85
86#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
87#define HPTE_R_TS ASM_CONST(0x4000000000000000)
88#define HPTE_R_RPN_SHIFT 12
89#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
90#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
91#define HPTE_R_PP ASM_CONST(0x0000000000000003)
92#define HPTE_R_N ASM_CONST(0x0000000000000004)
93#define HPTE_R_C ASM_CONST(0x0000000000000080)
94#define HPTE_R_R ASM_CONST(0x0000000000000100)
95
96/* Values for PP (assumes Ks=0, Kp=1) */
97/* pp0 will always be 0 for linux */
98#define PP_RWXX 0 /* Supervisor read/write, User none */
99#define PP_RWRX 1 /* Supervisor read/write, User read */
100#define PP_RWRW 2 /* Supervisor read/write, User read/write */
101#define PP_RXRX 3 /* Supervisor read, User read */
102
103#ifndef __ASSEMBLY__
104
105typedef struct {
106 unsigned long v;
107 unsigned long r;
108} hpte_t;
109
110extern hpte_t *htab_address;
111extern unsigned long htab_size_bytes;
112extern unsigned long htab_hash_mask;
113
114/*
115 * Page size definition
116 *
117 * shift : is the "PAGE_SHIFT" value for that page size
118 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
119 * directly to a slbmte "vsid" value
120 * penc : is the HPTE encoding mask for the "LP" field:
121 *
122 */
123struct mmu_psize_def
124{
125 unsigned int shift; /* number of bits */
126 unsigned int penc; /* HPTE encoding */
127 unsigned int tlbiel; /* tlbiel supported for that page size */
128 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
129 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
130};
131
132#endif /* __ASSEMBLY__ */
133
134/*
135 * The kernel use the constants below to index in the page sizes array.
136 * The use of fixed constants for this purpose is better for performances
137 * of the low level hash refill handlers.
138 *
139 * A non supported page size has a "shift" field set to 0
140 *
141 * Any new page size being implemented can get a new entry in here. Whether
142 * the kernel will use it or not is a different matter though. The actual page
143 * size used by hugetlbfs is not defined here and may be made variable
144 */
145
146#define MMU_PAGE_4K 0 /* 4K */
147#define MMU_PAGE_64K 1 /* 64K */
148#define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */
149#define MMU_PAGE_1M 3 /* 1M */
150#define MMU_PAGE_16M 4 /* 16M */
151#define MMU_PAGE_16G 5 /* 16G */
152#define MMU_PAGE_COUNT 6
153
154#ifndef __ASSEMBLY__
155
156/*
157 * The current system page sizes
158 */
159extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
160extern int mmu_linear_psize;
161extern int mmu_virtual_psize;
162extern int mmu_vmalloc_psize;
163extern int mmu_io_psize;
164
165/*
166 * If the processor supports 64k normal pages but not 64k cache
167 * inhibited pages, we have to be prepared to switch processes
168 * to use 4k pages when they create cache-inhibited mappings.
169 * If this is the case, mmu_ci_restrictions will be set to 1.
170 */
171extern int mmu_ci_restrictions;
172
173#ifdef CONFIG_HUGETLB_PAGE
174/*
175 * The page size index of the huge pages for use by hugetlbfs
176 */
177extern int mmu_huge_psize;
178
179#endif /* CONFIG_HUGETLB_PAGE */
180
181/*
182 * This function sets the AVPN and L fields of the HPTE appropriately
183 * for the page size
184 */
185static inline unsigned long hpte_encode_v(unsigned long va, int psize)
186{
187 unsigned long v =
188 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
189 v <<= HPTE_V_AVPN_SHIFT;
190 if (psize != MMU_PAGE_4K)
191 v |= HPTE_V_LARGE;
192 return v;
193}
194
195/*
196 * This function sets the ARPN, and LP fields of the HPTE appropriately
197 * for the page size. We assume the pa is already "clean" that is properly
198 * aligned for the requested page size
199 */
200static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
201{
202 unsigned long r;
203
204 /* A 4K page needs no special encoding */
205 if (psize == MMU_PAGE_4K)
206 return pa & HPTE_R_RPN;
207 else {
208 unsigned int penc = mmu_psize_defs[psize].penc;
209 unsigned int shift = mmu_psize_defs[psize].shift;
210 return (pa & ~((1ul << shift) - 1)) | (penc << 12);
211 }
212 return r;
213}
214
215/*
216 * This hashes a virtual address for a 256Mb segment only for now
217 */
218
219static inline unsigned long hpt_hash(unsigned long va, unsigned int shift)
220{
221 return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift);
222}
223
224extern int __hash_page_4K(unsigned long ea, unsigned long access,
225 unsigned long vsid, pte_t *ptep, unsigned long trap,
226 unsigned int local);
227extern int __hash_page_64K(unsigned long ea, unsigned long access,
228 unsigned long vsid, pte_t *ptep, unsigned long trap,
229 unsigned int local);
230struct mm_struct;
231extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
232extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
233 unsigned long ea, unsigned long vsid, int local,
234 unsigned long trap);
235
236extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
237 unsigned long pstart, unsigned long mode,
238 int psize);
239
240extern void htab_initialize(void);
241extern void htab_initialize_secondary(void);
242extern void hpte_init_native(void);
243extern void hpte_init_lpar(void);
244extern void hpte_init_iSeries(void);
245extern void hpte_init_beat(void);
246
247extern void stabs_alloc(void);
248extern void slb_initialize(void);
249extern void slb_flush_and_rebolt(void);
250extern void stab_initialize(unsigned long stab);
251
252#endif /* __ASSEMBLY__ */
253
254/*
255 * VSID allocation
256 *
257 * We first generate a 36-bit "proto-VSID". For kernel addresses this
258 * is equal to the ESID, for user addresses it is:
259 * (context << 15) | (esid & 0x7fff)
260 *
261 * The two forms are distinguishable because the top bit is 0 for user
262 * addresses, whereas the top two bits are 1 for kernel addresses.
263 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for
264 * now.
265 *
266 * The proto-VSIDs are then scrambled into real VSIDs with the
267 * multiplicative hash:
268 *
269 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
270 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
271 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
272 *
273 * This scramble is only well defined for proto-VSIDs below
274 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
275 * reserved. VSID_MULTIPLIER is prime, so in particular it is
276 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
277 * Because the modulus is 2^n-1 we can compute it efficiently without
278 * a divide or extra multiply (see below).
279 *
280 * This scheme has several advantages over older methods:
281 *
282 * - We have VSIDs allocated for every kernel address
283 * (i.e. everything above 0xC000000000000000), except the very top
284 * segment, which simplifies several things.
285 *
286 * - We allow for 15 significant bits of ESID and 20 bits of
287 * context for user addresses. i.e. 8T (43 bits) of address space for
288 * up to 1M contexts (although the page table structure and context
289 * allocation will need changes to take advantage of this).
290 *
291 * - The scramble function gives robust scattering in the hash
292 * table (at least based on some initial results). The previous
293 * method was more susceptible to pathological cases giving excessive
294 * hash collisions.
295 */
296/*
297 * WARNING - If you change these you must make sure the asm
298 * implementations in slb_allocate (slb_low.S), do_stab_bolted
299 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
300 *
301 * You'll also need to change the precomputed VSID values in head.S
302 * which are used by the iSeries firmware.
303 */
304
305#define VSID_MULTIPLIER ASM_CONST(200730139) /* 28-bit prime */
306#define VSID_BITS 36
307#define VSID_MODULUS ((1UL<<VSID_BITS)-1)
308
309#define CONTEXT_BITS 19
310#define USER_ESID_BITS 16
311
312#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
313
314/*
315 * This macro generates asm code to compute the VSID scramble
316 * function. Used in slb_allocate() and do_stab_bolted. The function
317 * computed is: (protovsid*VSID_MULTIPLIER) % VSID_MODULUS
318 *
319 * rt = register continaing the proto-VSID and into which the
320 * VSID will be stored
321 * rx = scratch register (clobbered)
322 *
323 * - rt and rx must be different registers
324 * - The answer will end up in the low 36 bits of rt. The higher
325 * bits may contain other garbage, so you may need to mask the
326 * result.
327 */
328#define ASM_VSID_SCRAMBLE(rt, rx) \
329 lis rx,VSID_MULTIPLIER@h; \
330 ori rx,rx,VSID_MULTIPLIER@l; \
331 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \
332 \
333 srdi rx,rt,VSID_BITS; \
334 clrldi rt,rt,(64-VSID_BITS); \
335 add rt,rt,rx; /* add high and low bits */ \
336 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
337 * 2^36-1+2^28-1. That in particular means that if r3 >= \
338 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
339 * the bit clear, r3 already has the answer we want, if it \
340 * doesn't, the answer is the low 36 bits of r3+1. So in all \
341 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\
342 addi rx,rt,1; \
343 srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \
344 add rt,rt,rx
345
346
347#ifndef __ASSEMBLY__
348
349typedef unsigned long mm_context_id_t;
350
351typedef struct {
352 mm_context_id_t id;
353 u16 user_psize; /* page size index */
354 u16 sllp; /* SLB entry page size encoding */
355#ifdef CONFIG_HUGETLB_PAGE
356 u16 low_htlb_areas, high_htlb_areas;
357#endif
358 unsigned long vdso_base;
359} mm_context_t;
360
361
362static inline unsigned long vsid_scramble(unsigned long protovsid)
363{
364#if 0
365 /* The code below is equivalent to this function for arguments
366 * < 2^VSID_BITS, which is all this should ever be called
367 * with. However gcc is not clever enough to compute the
368 * modulus (2^n-1) without a second multiply. */
369 return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS);
370#else /* 1 */
371 unsigned long x;
372
373 x = protovsid * VSID_MULTIPLIER;
374 x = (x >> VSID_BITS) + (x & VSID_MODULUS);
375 return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS;
376#endif /* 1 */
377}
378
379/* This is only valid for addresses >= KERNELBASE */
380static inline unsigned long get_kernel_vsid(unsigned long ea)
381{
382 return vsid_scramble(ea >> SID_SHIFT);
383}
384
385/* This is only valid for user addresses (which are below 2^41) */
386static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
387{
388 return vsid_scramble((context << USER_ESID_BITS)
389 | (ea >> SID_SHIFT));
390}
391
392#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
393#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
394
395/* Physical address used by some IO functions */
396typedef unsigned long phys_addr_t;
397
398#endif /* __ASSEMBLY__ */
399
400#endif /* _ASM_POWERPC_MMU_HASH64_H_ */
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 200055a4b82..06b3e6d336c 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -2,407 +2,14 @@
2#define _ASM_POWERPC_MMU_H_ 2#define _ASM_POWERPC_MMU_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#ifndef CONFIG_PPC64 5#ifdef CONFIG_PPC64
6#include <asm-ppc/mmu.h> 6/* 64-bit classic hash table MMU */
7# include <asm/mmu-hash64.h>
7#else 8#else
8 9/* 32-bit. FIXME: split up the 32-bit MMU types, and revise for
9/* 10 * arch/powerpc */
10 * PowerPC memory management structures 11# include <asm-ppc/mmu.h>
11 *
12 * Dave Engebretsen & Mike Corrigan <{engebret|mikejc}@us.ibm.com>
13 * PPC64 rework.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <asm/asm-compat.h>
22#include <asm/page.h>
23
24/*
25 * Segment table
26 */
27
28#define STE_ESID_V 0x80
29#define STE_ESID_KS 0x20
30#define STE_ESID_KP 0x10
31#define STE_ESID_N 0x08
32
33#define STE_VSID_SHIFT 12
34
35/* Location of cpu0's segment table */
36#define STAB0_PAGE 0x6
37#define STAB0_OFFSET (STAB0_PAGE << 12)
38#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
39
40#ifndef __ASSEMBLY__
41extern char initial_stab[];
42#endif /* ! __ASSEMBLY */
43
44/*
45 * SLB
46 */
47
48#define SLB_NUM_BOLTED 3
49#define SLB_CACHE_ENTRIES 8
50
51/* Bits in the SLB ESID word */
52#define SLB_ESID_V ASM_CONST(0x0000000008000000) /* valid */
53
54/* Bits in the SLB VSID word */
55#define SLB_VSID_SHIFT 12
56#define SLB_VSID_B ASM_CONST(0xc000000000000000)
57#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
58#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
59#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
60#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
61#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
62#define SLB_VSID_L ASM_CONST(0x0000000000000100)
63#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
64#define SLB_VSID_LP ASM_CONST(0x0000000000000030)
65#define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000)
66#define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010)
67#define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020)
68#define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030)
69#define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP)
70
71#define SLB_VSID_KERNEL (SLB_VSID_KP)
72#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
73
74#define SLBIE_C (0x08000000)
75
76/*
77 * Hash table
78 */
79
80#define HPTES_PER_GROUP 8
81
82#define HPTE_V_AVPN_SHIFT 7
83#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
84#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
85#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN))
86#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
87#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
88#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
89#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
90#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
91
92#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
93#define HPTE_R_TS ASM_CONST(0x4000000000000000)
94#define HPTE_R_RPN_SHIFT 12
95#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
96#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
97#define HPTE_R_PP ASM_CONST(0x0000000000000003)
98#define HPTE_R_N ASM_CONST(0x0000000000000004)
99#define HPTE_R_C ASM_CONST(0x0000000000000080)
100#define HPTE_R_R ASM_CONST(0x0000000000000100)
101
102/* Values for PP (assumes Ks=0, Kp=1) */
103/* pp0 will always be 0 for linux */
104#define PP_RWXX 0 /* Supervisor read/write, User none */
105#define PP_RWRX 1 /* Supervisor read/write, User read */
106#define PP_RWRW 2 /* Supervisor read/write, User read/write */
107#define PP_RXRX 3 /* Supervisor read, User read */
108
109#ifndef __ASSEMBLY__
110
111typedef struct {
112 unsigned long v;
113 unsigned long r;
114} hpte_t;
115
116extern hpte_t *htab_address;
117extern unsigned long htab_size_bytes;
118extern unsigned long htab_hash_mask;
119
120/*
121 * Page size definition
122 *
123 * shift : is the "PAGE_SHIFT" value for that page size
124 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
125 * directly to a slbmte "vsid" value
126 * penc : is the HPTE encoding mask for the "LP" field:
127 *
128 */
129struct mmu_psize_def
130{
131 unsigned int shift; /* number of bits */
132 unsigned int penc; /* HPTE encoding */
133 unsigned int tlbiel; /* tlbiel supported for that page size */
134 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
135 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
136};
137
138#endif /* __ASSEMBLY__ */
139
140/*
141 * The kernel use the constants below to index in the page sizes array.
142 * The use of fixed constants for this purpose is better for performances
143 * of the low level hash refill handlers.
144 *
145 * A non supported page size has a "shift" field set to 0
146 *
147 * Any new page size being implemented can get a new entry in here. Whether
148 * the kernel will use it or not is a different matter though. The actual page
149 * size used by hugetlbfs is not defined here and may be made variable
150 */
151
152#define MMU_PAGE_4K 0 /* 4K */
153#define MMU_PAGE_64K 1 /* 64K */
154#define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */
155#define MMU_PAGE_1M 3 /* 1M */
156#define MMU_PAGE_16M 4 /* 16M */
157#define MMU_PAGE_16G 5 /* 16G */
158#define MMU_PAGE_COUNT 6
159
160#ifndef __ASSEMBLY__
161
162/*
163 * The current system page sizes
164 */
165extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
166extern int mmu_linear_psize;
167extern int mmu_virtual_psize;
168extern int mmu_vmalloc_psize;
169extern int mmu_io_psize;
170
171/*
172 * If the processor supports 64k normal pages but not 64k cache
173 * inhibited pages, we have to be prepared to switch processes
174 * to use 4k pages when they create cache-inhibited mappings.
175 * If this is the case, mmu_ci_restrictions will be set to 1.
176 */
177extern int mmu_ci_restrictions;
178
179#ifdef CONFIG_HUGETLB_PAGE
180/*
181 * The page size index of the huge pages for use by hugetlbfs
182 */
183extern int mmu_huge_psize;
184
185#endif /* CONFIG_HUGETLB_PAGE */
186
187/*
188 * This function sets the AVPN and L fields of the HPTE appropriately
189 * for the page size
190 */
191static inline unsigned long hpte_encode_v(unsigned long va, int psize)
192{
193 unsigned long v =
194 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
195 v <<= HPTE_V_AVPN_SHIFT;
196 if (psize != MMU_PAGE_4K)
197 v |= HPTE_V_LARGE;
198 return v;
199}
200
201/*
202 * This function sets the ARPN, and LP fields of the HPTE appropriately
203 * for the page size. We assume the pa is already "clean" that is properly
204 * aligned for the requested page size
205 */
206static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
207{
208 unsigned long r;
209
210 /* A 4K page needs no special encoding */
211 if (psize == MMU_PAGE_4K)
212 return pa & HPTE_R_RPN;
213 else {
214 unsigned int penc = mmu_psize_defs[psize].penc;
215 unsigned int shift = mmu_psize_defs[psize].shift;
216 return (pa & ~((1ul << shift) - 1)) | (penc << 12);
217 }
218 return r;
219}
220
221/*
222 * This hashes a virtual address for a 256Mb segment only for now
223 */
224
225static inline unsigned long hpt_hash(unsigned long va, unsigned int shift)
226{
227 return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift);
228}
229
230extern int __hash_page_4K(unsigned long ea, unsigned long access,
231 unsigned long vsid, pte_t *ptep, unsigned long trap,
232 unsigned int local);
233extern int __hash_page_64K(unsigned long ea, unsigned long access,
234 unsigned long vsid, pte_t *ptep, unsigned long trap,
235 unsigned int local);
236struct mm_struct;
237extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
238 unsigned long ea, unsigned long vsid, int local,
239 unsigned long trap);
240
241extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
242 unsigned long pstart, unsigned long mode,
243 int psize);
244
245extern void htab_initialize(void);
246extern void htab_initialize_secondary(void);
247extern void hpte_init_native(void);
248extern void hpte_init_lpar(void);
249extern void hpte_init_iSeries(void);
250extern void hpte_init_beat(void);
251
252extern void stabs_alloc(void);
253extern void slb_initialize(void);
254extern void slb_flush_and_rebolt(void);
255extern void stab_initialize(unsigned long stab);
256
257#endif /* __ASSEMBLY__ */
258
259/*
260 * VSID allocation
261 *
262 * We first generate a 36-bit "proto-VSID". For kernel addresses this
263 * is equal to the ESID, for user addresses it is:
264 * (context << 15) | (esid & 0x7fff)
265 *
266 * The two forms are distinguishable because the top bit is 0 for user
267 * addresses, whereas the top two bits are 1 for kernel addresses.
268 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for
269 * now.
270 *
271 * The proto-VSIDs are then scrambled into real VSIDs with the
272 * multiplicative hash:
273 *
274 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
275 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
276 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
277 *
278 * This scramble is only well defined for proto-VSIDs below
279 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
280 * reserved. VSID_MULTIPLIER is prime, so in particular it is
281 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
282 * Because the modulus is 2^n-1 we can compute it efficiently without
283 * a divide or extra multiply (see below).
284 *
285 * This scheme has several advantages over older methods:
286 *
287 * - We have VSIDs allocated for every kernel address
288 * (i.e. everything above 0xC000000000000000), except the very top
289 * segment, which simplifies several things.
290 *
291 * - We allow for 15 significant bits of ESID and 20 bits of
292 * context for user addresses. i.e. 8T (43 bits) of address space for
293 * up to 1M contexts (although the page table structure and context
294 * allocation will need changes to take advantage of this).
295 *
296 * - The scramble function gives robust scattering in the hash
297 * table (at least based on some initial results). The previous
298 * method was more susceptible to pathological cases giving excessive
299 * hash collisions.
300 */
301/*
302 * WARNING - If you change these you must make sure the asm
303 * implementations in slb_allocate (slb_low.S), do_stab_bolted
304 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
305 *
306 * You'll also need to change the precomputed VSID values in head.S
307 * which are used by the iSeries firmware.
308 */
309
310#define VSID_MULTIPLIER ASM_CONST(200730139) /* 28-bit prime */
311#define VSID_BITS 36
312#define VSID_MODULUS ((1UL<<VSID_BITS)-1)
313
314#define CONTEXT_BITS 19
315#define USER_ESID_BITS 16
316
317#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
318
319/*
320 * This macro generates asm code to compute the VSID scramble
321 * function. Used in slb_allocate() and do_stab_bolted. The function
322 * computed is: (protovsid*VSID_MULTIPLIER) % VSID_MODULUS
323 *
324 * rt = register continaing the proto-VSID and into which the
325 * VSID will be stored
326 * rx = scratch register (clobbered)
327 *
328 * - rt and rx must be different registers
329 * - The answer will end up in the low 36 bits of rt. The higher
330 * bits may contain other garbage, so you may need to mask the
331 * result.
332 */
333#define ASM_VSID_SCRAMBLE(rt, rx) \
334 lis rx,VSID_MULTIPLIER@h; \
335 ori rx,rx,VSID_MULTIPLIER@l; \
336 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \
337 \
338 srdi rx,rt,VSID_BITS; \
339 clrldi rt,rt,(64-VSID_BITS); \
340 add rt,rt,rx; /* add high and low bits */ \
341 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
342 * 2^36-1+2^28-1. That in particular means that if r3 >= \
343 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
344 * the bit clear, r3 already has the answer we want, if it \
345 * doesn't, the answer is the low 36 bits of r3+1. So in all \
346 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\
347 addi rx,rt,1; \
348 srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \
349 add rt,rt,rx
350
351
352#ifndef __ASSEMBLY__
353
354typedef unsigned long mm_context_id_t;
355
356typedef struct {
357 mm_context_id_t id;
358 u16 user_psize; /* page size index */
359 u16 sllp; /* SLB entry page size encoding */
360#ifdef CONFIG_HUGETLB_PAGE
361 u16 low_htlb_areas, high_htlb_areas;
362#endif 12#endif
363 unsigned long vdso_base;
364} mm_context_t;
365
366
367static inline unsigned long vsid_scramble(unsigned long protovsid)
368{
369#if 0
370 /* The code below is equivalent to this function for arguments
371 * < 2^VSID_BITS, which is all this should ever be called
372 * with. However gcc is not clever enough to compute the
373 * modulus (2^n-1) without a second multiply. */
374 return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS);
375#else /* 1 */
376 unsigned long x;
377
378 x = protovsid * VSID_MULTIPLIER;
379 x = (x >> VSID_BITS) + (x & VSID_MODULUS);
380 return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS;
381#endif /* 1 */
382}
383
384/* This is only valid for addresses >= KERNELBASE */
385static inline unsigned long get_kernel_vsid(unsigned long ea)
386{
387 return vsid_scramble(ea >> SID_SHIFT);
388}
389
390/* This is only valid for user addresses (which are below 2^41) */
391static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
392{
393 return vsid_scramble((context << USER_ESID_BITS)
394 | (ea >> SID_SHIFT));
395}
396
397#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
398#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
399
400/* Physical address used by some IO functions */
401typedef unsigned long phys_addr_t;
402
403
404#endif /* __ASSEMBLY */
405 13
406#endif /* CONFIG_PPC64 */
407#endif /* __KERNEL__ */ 14#endif /* __KERNEL__ */
408#endif /* _ASM_POWERPC_MMU_H_ */ 15#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index 083ac917bd2..c0d7795e3d2 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -10,6 +10,7 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <asm/mmu.h> 11#include <asm/mmu.h>
12#include <asm/cputable.h> 12#include <asm/cputable.h>
13#include <asm-generic/mm_hooks.h>
13 14
14/* 15/*
15 * Copyright (C) 2001 PPC 64 Team, IBM Corp 16 * Copyright (C) 2001 PPC 64 Team, IBM Corp
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index cb204a71e91..e4d5fc5362a 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -199,7 +199,7 @@ enum {
199}; 199};
200 200
201 201
202#ifdef CONFIG_MPIC_BROKEN_U3 202#ifdef CONFIG_MPIC_U3_HT_IRQS
203/* Fixup table entry */ 203/* Fixup table entry */
204struct mpic_irq_fixup 204struct mpic_irq_fixup
205{ 205{
@@ -208,7 +208,7 @@ struct mpic_irq_fixup
208 u32 data; 208 u32 data;
209 unsigned int index; 209 unsigned int index;
210}; 210};
211#endif /* CONFIG_MPIC_BROKEN_U3 */ 211#endif /* CONFIG_MPIC_U3_HT_IRQS */
212 212
213 213
214enum mpic_reg_type { 214enum mpic_reg_type {
@@ -239,7 +239,7 @@ struct mpic
239 239
240 /* The "linux" controller struct */ 240 /* The "linux" controller struct */
241 struct irq_chip hc_irq; 241 struct irq_chip hc_irq;
242#ifdef CONFIG_MPIC_BROKEN_U3 242#ifdef CONFIG_MPIC_U3_HT_IRQS
243 struct irq_chip hc_ht_irq; 243 struct irq_chip hc_ht_irq;
244#endif 244#endif
245#ifdef CONFIG_SMP 245#ifdef CONFIG_SMP
@@ -268,7 +268,7 @@ struct mpic
268 /* Spurious vector to program into unused sources */ 268 /* Spurious vector to program into unused sources */
269 unsigned int spurious_vec; 269 unsigned int spurious_vec;
270 270
271#ifdef CONFIG_MPIC_BROKEN_U3 271#ifdef CONFIG_MPIC_U3_HT_IRQS
272 /* The fixup table */ 272 /* The fixup table */
273 struct mpic_irq_fixup *fixups; 273 struct mpic_irq_fixup *fixups;
274 spinlock_t fixup_lock; 274 spinlock_t fixup_lock;
@@ -313,7 +313,7 @@ struct mpic
313/* Set this for a big-endian MPIC */ 313/* Set this for a big-endian MPIC */
314#define MPIC_BIG_ENDIAN 0x00000002 314#define MPIC_BIG_ENDIAN 0x00000002
315/* Broken U3 MPIC */ 315/* Broken U3 MPIC */
316#define MPIC_BROKEN_U3 0x00000004 316#define MPIC_U3_HT_IRQS 0x00000004
317/* Broken IPI registers (autodetected) */ 317/* Broken IPI registers (autodetected) */
318#define MPIC_BROKEN_IPI 0x00000008 318#define MPIC_BROKEN_IPI 0x00000008
319/* MPIC wants a reset */ 319/* MPIC wants a reset */
@@ -352,7 +352,7 @@ struct mpic
352 * @senses_num: number of entries in the array 352 * @senses_num: number of entries in the array
353 * 353 *
354 * Note about the sense array. If none is passed, all interrupts are 354 * Note about the sense array. If none is passed, all interrupts are
355 * setup to be level negative unless MPIC_BROKEN_U3 is set in which 355 * setup to be level negative unless MPIC_U3_HT_IRQS is set in which
356 * case they are edge positive (and the array is ignored anyway). 356 * case they are edge positive (and the array is ignored anyway).
357 * The values in the array start at the first source of the MPIC, 357 * The values in the array start at the first source of the MPIC,
358 * that is senses[0] correspond to linux irq "irq_offset". 358 * that is senses[0] correspond to linux irq "irq_offset".
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index a889b2005bf..4f1aabe0ce7 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -32,5 +32,8 @@ extern int of_device_register(struct of_device *ofdev);
32extern void of_device_unregister(struct of_device *ofdev); 32extern void of_device_unregister(struct of_device *ofdev);
33extern void of_release_dev(struct device *dev); 33extern void of_release_dev(struct device *dev);
34 34
35extern int of_device_uevent(struct device *dev,
36 char **envp, int num_envp, char *buffer, int buffer_size);
37
35#endif /* __KERNEL__ */ 38#endif /* __KERNEL__ */
36#endif /* _ASM_POWERPC_OF_DEVICE_H */ 39#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 94c0ad2bff9..8d6b47f7b30 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -57,6 +57,8 @@ extern struct op_powerpc_model op_model_rs64;
57extern struct op_powerpc_model op_model_power4; 57extern struct op_powerpc_model op_model_power4;
58extern struct op_powerpc_model op_model_7450; 58extern struct op_powerpc_model op_model_7450;
59extern struct op_powerpc_model op_model_cell; 59extern struct op_powerpc_model op_model_cell;
60extern struct op_powerpc_model op_model_pa6t;
61
60 62
61/* All the classic PPC parts use these */ 63/* All the classic PPC parts use these */
62static inline unsigned int classic_ctr_read(unsigned int i) 64static inline unsigned int classic_ctr_read(unsigned int i)
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 0d3adc09c84..cf95274f735 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -70,6 +70,7 @@ struct paca_struct {
70 s16 hw_cpu_id; /* Physical processor number */ 70 s16 hw_cpu_id; /* Physical processor number */
71 u8 cpu_start; /* At startup, processor spins until */ 71 u8 cpu_start; /* At startup, processor spins until */
72 /* this becomes non-zero. */ 72 /* this becomes non-zero. */
73 struct slb_shadow *slb_shadow_ptr;
73 74
74 /* 75 /*
75 * Now, starting in cacheline 2, the exception save areas 76 * Now, starting in cacheline 2, the exception save areas
@@ -93,6 +94,7 @@ struct paca_struct {
93 u64 stab_rr; /* stab/slb round-robin counter */ 94 u64 stab_rr; /* stab/slb round-robin counter */
94 u64 saved_r1; /* r1 save for RTAS calls */ 95 u64 saved_r1; /* r1 save for RTAS calls */
95 u64 saved_msr; /* MSR saved here by enter_rtas */ 96 u64 saved_msr; /* MSR saved here by enter_rtas */
97 u16 trap_save; /* Used when bad stack is encountered */
96 u8 soft_enabled; /* irq soft-enable flag */ 98 u8 soft_enabled; /* irq soft-enable flag */
97 u8 hard_enabled; /* set if irqs are enabled in MSR */ 99 u8 hard_enabled; /* set if irqs are enabled in MSR */
98 u8 io_sync; /* writel() needs spin_unlock sync */ 100 u8 io_sync; /* writel() needs spin_unlock sync */
@@ -101,8 +103,6 @@ struct paca_struct {
101 u64 user_time; /* accumulated usermode TB ticks */ 103 u64 user_time; /* accumulated usermode TB ticks */
102 u64 system_time; /* accumulated system TB ticks */ 104 u64 system_time; /* accumulated system TB ticks */
103 u64 startpurr; /* PURR/TB value snapshot */ 105 u64 startpurr; /* PURR/TB value snapshot */
104
105 struct slb_shadow *slb_shadow_ptr;
106}; 106};
107 107
108extern struct paca_struct paca[]; 108extern struct paca_struct paca[];
diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h
index 3fca21ddf54..b37b81e3727 100644
--- a/include/asm-powerpc/parport.h
+++ b/include/asm-powerpc/parport.h
@@ -20,18 +20,18 @@ extern struct parport *parport_pc_probe_port (unsigned long int base,
20static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 20static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
21{ 21{
22 struct device_node *np; 22 struct device_node *np;
23 u32 *prop; 23 const u32 *prop;
24 u32 io1, io2; 24 u32 io1, io2;
25 int propsize; 25 int propsize;
26 int count = 0; 26 int count = 0;
27 for (np = NULL; (np = of_find_compatible_node(np, 27 for (np = NULL; (np = of_find_compatible_node(np,
28 "parallel", 28 "parallel",
29 "pnpPNP,400")) != NULL;) { 29 "pnpPNP,400")) != NULL;) {
30 prop = (u32 *)get_property(np, "reg", &propsize); 30 prop = of_get_property(np, "reg", &propsize);
31 if (!prop || propsize > 6*sizeof(u32)) 31 if (!prop || propsize > 6*sizeof(u32))
32 continue; 32 continue;
33 io1 = prop[1]; io2 = prop[2]; 33 io1 = prop[1]; io2 = prop[2];
34 prop = (u32 *)get_property(np, "interrupts", NULL); 34 prop = of_get_property(np, "interrupts", NULL);
35 if (!prop) 35 if (!prop)
36 continue; 36 continue;
37 if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL) 37 if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL)
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index ac656ee6bb1..ce0f13e8eb1 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -70,19 +70,22 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
70 */ 70 */
71#define PCI_DISABLE_MWI 71#define PCI_DISABLE_MWI
72 72
73extern struct dma_mapping_ops *pci_dma_ops; 73#ifdef CONFIG_PCI
74extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
75extern struct dma_mapping_ops *get_pci_dma_ops(void);
74 76
75/* For DAC DMA, we currently don't support it by default, but 77/* For DAC DMA, we currently don't support it by default, but
76 * we let 64-bit platforms override this. 78 * we let 64-bit platforms override this.
77 */ 79 */
78static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) 80static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
79{ 81{
80 if (pci_dma_ops && pci_dma_ops->dac_dma_supported) 82 struct dma_mapping_ops *d = get_pci_dma_ops();
81 return pci_dma_ops->dac_dma_supported(&hwdev->dev, mask); 83
84 if (d && d->dac_dma_supported)
85 return d->dac_dma_supported(&hwdev->dev, mask);
82 return 0; 86 return 0;
83} 87}
84 88
85#ifdef CONFIG_PCI
86static inline void pci_dma_burst_advice(struct pci_dev *pdev, 89static inline void pci_dma_burst_advice(struct pci_dev *pdev,
87 enum pci_dma_burst_strategy *strat, 90 enum pci_dma_burst_strategy *strat,
88 unsigned long *strategy_parameter) 91 unsigned long *strategy_parameter)
@@ -99,6 +102,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
99 *strat = PCI_DMA_BURST_MULTIPLE; 102 *strat = PCI_DMA_BURST_MULTIPLE;
100 *strategy_parameter = cacheline_size; 103 *strategy_parameter = cacheline_size;
101} 104}
105#else /* CONFIG_PCI */
106#define set_pci_dma_ops(d)
107#define get_pci_dma_ops() NULL
102#endif 108#endif
103 109
104extern int pci_domain_nr(struct pci_bus *bus); 110extern int pci_domain_nr(struct pci_bus *bus);
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index 345d9b07b3e..a28fa8bc01d 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -97,3 +97,6 @@
97 97
98#define pud_ERROR(e) \ 98#define pud_ERROR(e) \
99 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e)) 99 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))
100
101#define remap_4k_pfn(vma, addr, pfn, prot) \
102 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot))
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 4b7126c53f3..5e84f070eaf 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -35,6 +35,7 @@
35#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */ 35#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */
36#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */ 36#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */
37#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */ 37#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */
38#define _PAGE_4K_PFN 0x20000000 /* PFN is for a single 4k page */
38#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */ 39#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */
39#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */ 40#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */
40 41
@@ -93,6 +94,10 @@
93#define pte_pagesize_index(pte) \ 94#define pte_pagesize_index(pte) \
94 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K) 95 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K)
95 96
97#define remap_4k_pfn(vma, addr, pfn, prot) \
98 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \
99 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN))
100
96#endif /* __ASSEMBLY__ */ 101#endif /* __ASSEMBLY__ */
97#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
98#endif /* _ASM_POWERPC_PGTABLE_64K_H */ 103#endif /* _ASM_POWERPC_PGTABLE_64K_H */
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 10f52743f4f..19edb6982b8 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -272,7 +272,10 @@ static inline pte_t pte_mkhuge(pte_t pte) {
272 return pte; } 272 return pte; }
273 273
274/* Atomic PTE updates */ 274/* Atomic PTE updates */
275static inline unsigned long pte_update(pte_t *p, unsigned long clr) 275static inline unsigned long pte_update(struct mm_struct *mm,
276 unsigned long addr,
277 pte_t *ptep, unsigned long clr,
278 int huge)
276{ 279{
277 unsigned long old, tmp; 280 unsigned long old, tmp;
278 281
@@ -283,20 +286,15 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr)
283 andc %1,%0,%4 \n\ 286 andc %1,%0,%4 \n\
284 stdcx. %1,0,%3 \n\ 287 stdcx. %1,0,%3 \n\
285 bne- 1b" 288 bne- 1b"
286 : "=&r" (old), "=&r" (tmp), "=m" (*p) 289 : "=&r" (old), "=&r" (tmp), "=m" (*ptep)
287 : "r" (p), "r" (clr), "m" (*p), "i" (_PAGE_BUSY) 290 : "r" (ptep), "r" (clr), "m" (*ptep), "i" (_PAGE_BUSY)
288 : "cc" ); 291 : "cc" );
292
293 if (old & _PAGE_HASHPTE)
294 hpte_need_flush(mm, addr, ptep, old, huge);
289 return old; 295 return old;
290} 296}
291 297
292/* PTE updating functions, this function puts the PTE in the
293 * batch, doesn't actually triggers the hash flush immediately,
294 * you need to call flush_tlb_pending() to do that.
295 * Pass -1 for "normal" size (4K or 64K)
296 */
297extern void hpte_update(struct mm_struct *mm, unsigned long addr,
298 pte_t *ptep, unsigned long pte, int huge);
299
300static inline int __ptep_test_and_clear_young(struct mm_struct *mm, 298static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
301 unsigned long addr, pte_t *ptep) 299 unsigned long addr, pte_t *ptep)
302{ 300{
@@ -304,11 +302,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
304 302
305 if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0) 303 if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
306 return 0; 304 return 0;
307 old = pte_update(ptep, _PAGE_ACCESSED); 305 old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0);
308 if (old & _PAGE_HASHPTE) {
309 hpte_update(mm, addr, ptep, old, 0);
310 flush_tlb_pending();
311 }
312 return (old & _PAGE_ACCESSED) != 0; 306 return (old & _PAGE_ACCESSED) != 0;
313} 307}
314#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 308#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
@@ -331,9 +325,7 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm,
331 325
332 if ((pte_val(*ptep) & _PAGE_DIRTY) == 0) 326 if ((pte_val(*ptep) & _PAGE_DIRTY) == 0)
333 return 0; 327 return 0;
334 old = pte_update(ptep, _PAGE_DIRTY); 328 old = pte_update(mm, addr, ptep, _PAGE_DIRTY, 0);
335 if (old & _PAGE_HASHPTE)
336 hpte_update(mm, addr, ptep, old, 0);
337 return (old & _PAGE_DIRTY) != 0; 329 return (old & _PAGE_DIRTY) != 0;
338} 330}
339#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 331#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
@@ -352,9 +344,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
352 344
353 if ((pte_val(*ptep) & _PAGE_RW) == 0) 345 if ((pte_val(*ptep) & _PAGE_RW) == 0)
354 return; 346 return;
355 old = pte_update(ptep, _PAGE_RW); 347 old = pte_update(mm, addr, ptep, _PAGE_RW, 0);
356 if (old & _PAGE_HASHPTE)
357 hpte_update(mm, addr, ptep, old, 0);
358} 348}
359 349
360/* 350/*
@@ -378,7 +368,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
378({ \ 368({ \
379 int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \ 369 int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \
380 __ptep); \ 370 __ptep); \
381 flush_tlb_page(__vma, __address); \
382 __dirty; \ 371 __dirty; \
383}) 372})
384 373
@@ -386,20 +375,14 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
386static inline pte_t ptep_get_and_clear(struct mm_struct *mm, 375static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
387 unsigned long addr, pte_t *ptep) 376 unsigned long addr, pte_t *ptep)
388{ 377{
389 unsigned long old = pte_update(ptep, ~0UL); 378 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 0);
390
391 if (old & _PAGE_HASHPTE)
392 hpte_update(mm, addr, ptep, old, 0);
393 return __pte(old); 379 return __pte(old);
394} 380}
395 381
396static inline void pte_clear(struct mm_struct *mm, unsigned long addr, 382static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
397 pte_t * ptep) 383 pte_t * ptep)
398{ 384{
399 unsigned long old = pte_update(ptep, ~0UL); 385 pte_update(mm, addr, ptep, ~0UL, 0);
400
401 if (old & _PAGE_HASHPTE)
402 hpte_update(mm, addr, ptep, old, 0);
403} 386}
404 387
405/* 388/*
@@ -408,10 +391,8 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
408static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, 391static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
409 pte_t *ptep, pte_t pte) 392 pte_t *ptep, pte_t pte)
410{ 393{
411 if (pte_present(*ptep)) { 394 if (pte_present(*ptep))
412 pte_clear(mm, addr, ptep); 395 pte_clear(mm, addr, ptep);
413 flush_tlb_pending();
414 }
415 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); 396 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
416 *ptep = pte; 397 *ptep = pte;
417} 398}
@@ -467,16 +448,6 @@ extern pgd_t swapper_pg_dir[];
467 448
468extern void paging_init(void); 449extern void paging_init(void);
469 450
470/*
471 * This gets called at the end of handling a page fault, when
472 * the kernel has put a new PTE into the page table for the process.
473 * We use it to put a corresponding HPTE into the hash table
474 * ahead of time, instead of waiting for the inevitable extra
475 * hash-table miss exception.
476 */
477struct vm_area_struct;
478extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
479
480/* Encode and de-code a swap entry */ 451/* Encode and de-code a swap entry */
481#define __swp_type(entry) (((entry).val >> 1) & 0x3f) 452#define __swp_type(entry) (((entry).val >> 1) & 0x3f)
482#define __swp_offset(entry) ((entry).val >> 8) 453#define __swp_offset(entry) ((entry).val >> 8)
@@ -522,6 +493,7 @@ void pgtable_cache_init(void);
522 return pt; 493 return pt;
523} 494}
524 495
496
525#include <asm-generic/pgtable.h> 497#include <asm-generic/pgtable.h>
526 498
527#endif /* __ASSEMBLY__ */ 499#endif /* __ASSEMBLY__ */
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 8588be68e0a..d6a616a1b3e 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -30,6 +30,7 @@ void release_pmc_hardware(void);
30 30
31#ifdef CONFIG_PPC64 31#ifdef CONFIG_PPC64
32void power4_enable_pmcs(void); 32void power4_enable_pmcs(void);
33void pasemi_enable_pmcs(void);
33#endif 34#endif
34 35
35#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index ab6eddb518c..d74b2965bb8 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -10,6 +10,8 @@
10#define _ASM_POWERPC_PPC_PCI_H 10#define _ASM_POWERPC_PPC_PCI_H
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#ifdef CONFIG_PCI
14
13#include <linux/pci.h> 15#include <linux/pci.h>
14#include <asm/pci-bridge.h> 16#include <asm/pci-bridge.h>
15 17
@@ -22,7 +24,7 @@ extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
22extern struct list_head hose_list; 24extern struct list_head hose_list;
23extern int global_phb_number; 25extern int global_phb_number;
24 26
25extern unsigned long find_and_init_phbs(void); 27extern void find_and_init_phbs(void);
26 28
27extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */ 29extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */
28 30
@@ -68,7 +70,7 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr);
68void eeh_slot_error_detail (struct pci_dn *pdn, int severity); 70void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
69 71
70/** 72/**
71 * rtas_pci_enableo - enable IO transfers for this slot 73 * rtas_pci_enable - enable IO transfers for this slot
72 * @pdn: pci device node 74 * @pdn: pci device node
73 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA 75 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
74 * 76 *
@@ -89,6 +91,7 @@ int rtas_pci_enable(struct pci_dn *pdn, int function);
89 * Returns a non-zero value if the reset failed. 91 * Returns a non-zero value if the reset failed.
90 */ 92 */
91int rtas_set_slot_reset (struct pci_dn *); 93int rtas_set_slot_reset (struct pci_dn *);
94int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs);
92 95
93/** 96/**
94 * eeh_restore_bars - Restore device configuration info. 97 * eeh_restore_bars - Restore device configuration info.
@@ -126,5 +129,10 @@ struct device_node * find_device_pe(struct device_node *dn);
126 129
127#endif 130#endif
128 131
132#else /* CONFIG_PCI */
133static inline void find_and_init_phbs(void) { }
134static inline void init_pci_config_tokens(void) { }
135#endif /* !CONFIG_PCI */
136
129#endif /* __KERNEL__ */ 137#endif /* __KERNEL__ */
130#endif /* _ASM_POWERPC_PPC_PCI_H */ 138#endif /* _ASM_POWERPC_PPC_PCI_H */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index a26c32ee552..d947b160949 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -133,7 +133,6 @@ struct thread_struct {
133 mm_segment_t fs; /* for get_fs() validation */ 133 mm_segment_t fs; /* for get_fs() validation */
134#ifdef CONFIG_PPC32 134#ifdef CONFIG_PPC32
135 void *pgdir; /* root of page-table tree */ 135 void *pgdir; /* root of page-table tree */
136 signed long last_syscall;
137#endif 136#endif
138#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE) 137#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
139 unsigned long dbcr0; /* debug control register values */ 138 unsigned long dbcr0; /* debug control register values */
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 020ed015a94..ec400f608e1 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -18,7 +18,9 @@
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 <linux/platform_device.h>
21#include <asm/irq.h>
21#include <asm/atomic.h> 22#include <asm/atomic.h>
23#include <asm/io.h>
22 24
23/* Definitions used by the flattened device tree */ 25/* Definitions used by the flattened device tree */
24#define OF_DT_HEADER 0xd00dfeed /* marker */ 26#define OF_DT_HEADER 0xd00dfeed /* marker */
@@ -58,6 +60,8 @@ struct boot_param_header
58 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ 60 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
59 /* version 3 fields below */ 61 /* version 3 fields below */
60 u32 dt_strings_size; /* size of the DT strings block */ 62 u32 dt_strings_size; /* size of the DT strings block */
63 /* version 17 fields below */
64 u32 dt_struct_size; /* size of the DT structure block */
61}; 65};
62 66
63 67
@@ -68,7 +72,7 @@ typedef u32 ihandle;
68struct property { 72struct property {
69 char *name; 73 char *name;
70 int length; 74 int length;
71 unsigned char *value; 75 void *value;
72 struct property *next; 76 struct property *next;
73}; 77};
74 78
@@ -108,14 +112,6 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
108} 112}
109 113
110 114
111/* OBSOLETE: Old style node lookup */
112extern struct device_node *find_devices(const char *name);
113extern struct device_node *find_type_devices(const char *type);
114extern struct device_node *find_path_device(const char *path);
115extern struct device_node *find_compatible_devices(const char *type,
116 const char *compat);
117extern struct device_node *find_all_nodes(void);
118
119/* New style node lookup */ 115/* New style node lookup */
120extern struct device_node *of_find_node_by_name(struct device_node *from, 116extern struct device_node *of_find_node_by_name(struct device_node *from,
121 const char *name); 117 const char *name);
@@ -159,15 +155,17 @@ extern void of_detach_node(const struct device_node *);
159extern void finish_device_tree(void); 155extern void finish_device_tree(void);
160extern void unflatten_device_tree(void); 156extern void unflatten_device_tree(void);
161extern void early_init_devtree(void *); 157extern void early_init_devtree(void *);
162extern int device_is_compatible(const struct device_node *device, 158extern int of_device_is_compatible(const struct device_node *device,
163 const char *); 159 const char *);
160#define device_is_compatible(d, c) of_device_is_compatible((d), (c))
164extern int machine_is_compatible(const char *compat); 161extern int machine_is_compatible(const char *compat);
165extern const void *get_property(const struct device_node *node, 162extern const void *of_get_property(const struct device_node *node,
166 const char *name, 163 const char *name,
167 int *lenp); 164 int *lenp);
165#define get_property(a, b, c) of_get_property((a), (b), (c))
168extern void print_properties(struct device_node *node); 166extern void print_properties(struct device_node *node);
169extern int prom_n_addr_cells(struct device_node* np); 167extern int of_n_addr_cells(struct device_node* np);
170extern int prom_n_size_cells(struct device_node* np); 168extern int of_n_size_cells(struct device_node* np);
171extern int prom_n_intr_cells(struct device_node* np); 169extern int prom_n_intr_cells(struct device_node* np);
172extern void prom_get_irq_senses(unsigned char *senses, int off, int max); 170extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
173extern int prom_add_property(struct device_node* np, struct property* prop); 171extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -350,6 +348,16 @@ static inline int of_irq_to_resource(struct device_node *dev, int index, struct
350 return irq; 348 return irq;
351} 349}
352 350
351static inline void __iomem *of_iomap(struct device_node *np, int index)
352{
353 struct resource res;
354
355 if (of_address_to_resource(np, index, &res))
356 return NULL;
357
358 return ioremap(res.start, 1 + res.end - res.start);
359}
360
353 361
354#endif /* __KERNEL__ */ 362#endif /* __KERNEL__ */
355#endif /* _POWERPC_PROM_H */ 363#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h
index 43e90ea9613..9efc40f1c77 100644
--- a/include/asm-powerpc/ps3av.h
+++ b/include/asm-powerpc/ps3av.h
@@ -18,8 +18,6 @@
18#ifndef _ASM_POWERPC_PS3AV_H_ 18#ifndef _ASM_POWERPC_PS3AV_H_
19#define _ASM_POWERPC_PS3AV_H_ 19#define _ASM_POWERPC_PS3AV_H_
20 20
21#include <linux/mutex.h>
22
23/** command for ioctl() **/ 21/** command for ioctl() **/
24#define PS3AV_VERSION 0x205 /* version of ps3av command */ 22#define PS3AV_VERSION 0x205 /* version of ps3av command */
25 23
@@ -643,24 +641,6 @@ struct ps3av_pkt_avb_param {
643 u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE]; 641 u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE];
644}; 642};
645 643
646struct ps3av {
647 int available;
648 struct semaphore sem;
649 struct semaphore ping;
650 struct semaphore pong;
651 struct mutex mutex;
652 int open_count;
653 struct ps3_vuart_port_device *dev;
654
655 int region;
656 struct ps3av_pkt_av_get_hw_conf av_hw_conf;
657 u32 av_port[PS3AV_AV_PORT_MAX + PS3AV_OPT_PORT_MAX];
658 u32 opt_port[PS3AV_OPT_PORT_MAX];
659 u32 head[PS3AV_HEAD_MAX];
660 u32 audio_port;
661 int ps3av_mode;
662 int ps3av_mode_old;
663};
664 644
665/** command status **/ 645/** command status **/
666#define PS3AV_STATUS_SUCCESS 0x0000 /* success */ 646#define PS3AV_STATUS_SUCCESS 0x0000 /* success */
@@ -718,6 +698,7 @@ static inline void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_
718extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, 698extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
719 u32); 699 u32);
720 700
701struct ps3_vuart_port_device;
721extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev, 702extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev,
722 const void *buf, unsigned long size); 703 const void *buf, unsigned long size);
723extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf, 704extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
@@ -725,6 +706,7 @@ extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
725 706
726extern int ps3av_set_video_mode(u32, int); 707extern int ps3av_set_video_mode(u32, int);
727extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32); 708extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
709extern int ps3av_get_auto_mode(int);
728extern int ps3av_set_mode(u32, int); 710extern int ps3av_set_mode(u32, int);
729extern int ps3av_get_mode(void); 711extern int ps3av_get_mode(void);
730extern int ps3av_get_scanmode(int); 712extern int ps3av_get_scanmode(int);
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 0d7f0164ed8..749c7f953b5 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -469,12 +469,68 @@
469#define SPRN_SIAR 780 469#define SPRN_SIAR 780
470#define SPRN_SDAR 781 470#define SPRN_SDAR 781
471 471
472#define PA6T_SPRN_PMC0 787 472#define SPRN_PA6T_MMCR0 795
473#define PA6T_SPRN_PMC1 788 473#define PA6T_MMCR0_EN0 0x0000000000000001UL
474#define PA6T_SPRN_PMC2 789 474#define PA6T_MMCR0_EN1 0x0000000000000002UL
475#define PA6T_SPRN_PMC3 790 475#define PA6T_MMCR0_EN2 0x0000000000000004UL
476#define PA6T_SPRN_PMC4 791 476#define PA6T_MMCR0_EN3 0x0000000000000008UL
477#define PA6T_SPRN_PMC5 792 477#define PA6T_MMCR0_EN4 0x0000000000000010UL
478#define PA6T_MMCR0_EN5 0x0000000000000020UL
479#define PA6T_MMCR0_SUPEN 0x0000000000000040UL
480#define PA6T_MMCR0_PREN 0x0000000000000080UL
481#define PA6T_MMCR0_HYPEN 0x0000000000000100UL
482#define PA6T_MMCR0_FCM0 0x0000000000000200UL
483#define PA6T_MMCR0_FCM1 0x0000000000000400UL
484#define PA6T_MMCR0_INTGEN 0x0000000000000800UL
485#define PA6T_MMCR0_INTEN0 0x0000000000001000UL
486#define PA6T_MMCR0_INTEN1 0x0000000000002000UL
487#define PA6T_MMCR0_INTEN2 0x0000000000004000UL
488#define PA6T_MMCR0_INTEN3 0x0000000000008000UL
489#define PA6T_MMCR0_INTEN4 0x0000000000010000UL
490#define PA6T_MMCR0_INTEN5 0x0000000000020000UL
491#define PA6T_MMCR0_DISCNT 0x0000000000040000UL
492#define PA6T_MMCR0_UOP 0x0000000000080000UL
493#define PA6T_MMCR0_TRG 0x0000000000100000UL
494#define PA6T_MMCR0_TRGEN 0x0000000000200000UL
495#define PA6T_MMCR0_TRGREG 0x0000000001600000UL
496#define PA6T_MMCR0_SIARLOG 0x0000000002000000UL
497#define PA6T_MMCR0_SDARLOG 0x0000000004000000UL
498#define PA6T_MMCR0_PROEN 0x0000000008000000UL
499#define PA6T_MMCR0_PROLOG 0x0000000010000000UL
500#define PA6T_MMCR0_DAMEN2 0x0000000020000000UL
501#define PA6T_MMCR0_DAMEN3 0x0000000040000000UL
502#define PA6T_MMCR0_DAMEN4 0x0000000080000000UL
503#define PA6T_MMCR0_DAMEN5 0x0000000100000000UL
504#define PA6T_MMCR0_DAMSEL2 0x0000000200000000UL
505#define PA6T_MMCR0_DAMSEL3 0x0000000400000000UL
506#define PA6T_MMCR0_DAMSEL4 0x0000000800000000UL
507#define PA6T_MMCR0_DAMSEL5 0x0000001000000000UL
508#define PA6T_MMCR0_HANDDIS 0x0000002000000000UL
509#define PA6T_MMCR0_PCTEN 0x0000004000000000UL
510#define PA6T_MMCR0_SOCEN 0x0000008000000000UL
511#define PA6T_MMCR0_SOCMOD 0x0000010000000000UL
512
513#define SPRN_PA6T_MMCR1 798
514#define PA6T_MMCR1_ES2 0x00000000000000ffUL
515#define PA6T_MMCR1_ES3 0x000000000000ff00UL
516#define PA6T_MMCR1_ES4 0x0000000000ff0000UL
517#define PA6T_MMCR1_ES5 0x00000000ff000000UL
518
519#define SPRN_PA6T_SIAR 780
520#define SPRN_PA6T_UPMC0 771
521#define SPRN_PA6T_UPMC1 772
522#define SPRN_PA6T_UPMC2 773
523#define SPRN_PA6T_UPMC3 774
524#define SPRN_PA6T_UPMC4 775
525#define SPRN_PA6T_UPMC5 776
526#define SPRN_PA6T_UMMCR0 779
527#define SPRN_PA6T_UMMCR1 782
528#define SPRN_PA6T_PMC0 787
529#define SPRN_PA6T_PMC1 788
530#define SPRN_PA6T_PMC2 789
531#define SPRN_PA6T_PMC3 790
532#define SPRN_PA6T_PMC4 791
533#define SPRN_PA6T_PMC5 792
478 534
479#else /* 32-bit */ 535#else /* 32-bit */
480#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */ 536#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index c8b1da50e72..403e9fde2eb 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -56,5 +56,7 @@
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58#define SO_PASSSEC 34 58#define SO_PASSSEC 34
59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
59 61
60#endif /* _ASM_POWERPC_SOCKET_H */ 62#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h
index 590078d8ed2..55cef7675a3 100644
--- a/include/asm-powerpc/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -14,6 +14,7 @@
14#define FIOGETOWN 0x8903 14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904 15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
18 19
19#endif /* _ASM_POWERPC_SOCKIOS_H */ 20#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index 8aad0619eb8..02e56a6685a 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -242,6 +242,7 @@ struct spu_state {
242 u64 spu_chnldata_RW[32]; 242 u64 spu_chnldata_RW[32];
243 u32 spu_mailbox_data[4]; 243 u32 spu_mailbox_data[4];
244 u32 pu_mailbox_data[1]; 244 u32 pu_mailbox_data[1];
245 u64 dar, dsisr;
245 unsigned long suspend_time; 246 unsigned long suspend_time;
246 spinlock_t register_lock; 247 spinlock_t register_lock;
247}; 248};
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h
index faa407f33c6..aa40f92c298 100644
--- a/include/asm-powerpc/string.h
+++ b/include/asm-powerpc/string.h
@@ -14,8 +14,6 @@
14#define __HAVE_ARCH_MEMCMP 14#define __HAVE_ARCH_MEMCMP
15#define __HAVE_ARCH_MEMCHR 15#define __HAVE_ARCH_MEMCHR
16 16
17extern int strcasecmp(const char *, const char *);
18extern int strncasecmp(const char *, const char *, __kernel_size_t);
19extern char * strcpy(char *,const char *); 17extern char * strcpy(char *,const char *);
20extern char * strncpy(char *,const char *, __kernel_size_t); 18extern char * strncpy(char *,const char *, __kernel_size_t);
21extern __kernel_size_t strlen(const char *); 19extern __kernel_size_t strlen(const char *);
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index f7b1227d645..d3e0906ff2b 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -131,6 +131,7 @@ extern void enable_kernel_altivec(void);
131extern void giveup_altivec(struct task_struct *); 131extern void giveup_altivec(struct task_struct *);
132extern void load_up_altivec(struct task_struct *); 132extern void load_up_altivec(struct task_struct *);
133extern int emulate_altivec(struct pt_regs *); 133extern int emulate_altivec(struct pt_regs *);
134extern void enable_kernel_spe(void);
134extern void giveup_spe(struct task_struct *); 135extern void giveup_spe(struct task_struct *);
135extern void load_up_spe(struct task_struct *); 136extern void load_up_spe(struct task_struct *);
136extern int fix_alignment(struct pt_regs *); 137extern int fix_alignment(struct pt_regs *);
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 4e2a834683f..0a17682663d 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -38,7 +38,6 @@ extern void pte_free_finish(void);
38 38
39static inline void tlb_flush(struct mmu_gather *tlb) 39static inline void tlb_flush(struct mmu_gather *tlb)
40{ 40{
41 flush_tlb_pending();
42 pte_free_finish(); 41 pte_free_finish();
43} 42}
44 43
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
index 93c7d0c7230..86e6266a028 100644
--- a/include/asm-powerpc/tlbflush.h
+++ b/include/asm-powerpc/tlbflush.h
@@ -17,10 +17,73 @@
17 */ 17 */
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20
21struct mm_struct; 20struct mm_struct;
21struct vm_area_struct;
22
23#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
24/*
25 * TLB flushing for software loaded TLB chips
26 *
27 * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
28 * flush_tlb_kernel_range are best implemented as tlbia vs
29 * specific tlbie's
30 */
31
32extern void _tlbie(unsigned long address);
33
34#if defined(CONFIG_40x) || defined(CONFIG_8xx)
35#define _tlbia() asm volatile ("tlbia; sync" : : : "memory")
36#else /* CONFIG_44x || CONFIG_FSL_BOOKE */
37extern void _tlbia(void);
38#endif
39
40static inline void flush_tlb_mm(struct mm_struct *mm)
41{
42 _tlbia();
43}
44
45static inline void flush_tlb_page(struct vm_area_struct *vma,
46 unsigned long vmaddr)
47{
48 _tlbie(vmaddr);
49}
50
51static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
52 unsigned long vmaddr)
53{
54 _tlbie(vmaddr);
55}
56
57static inline void flush_tlb_range(struct vm_area_struct *vma,
58 unsigned long start, unsigned long end)
59{
60 _tlbia();
61}
62
63static inline void flush_tlb_kernel_range(unsigned long start,
64 unsigned long end)
65{
66 _tlbia();
67}
22 68
23#ifdef CONFIG_PPC64 69#elif defined(CONFIG_PPC32)
70/*
71 * TLB flushing for "classic" hash-MMMU 32-bit CPUs, 6xx, 7xx, 7xxx
72 */
73extern void _tlbie(unsigned long address);
74extern void _tlbia(void);
75
76extern void flush_tlb_mm(struct mm_struct *mm);
77extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
78extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
79extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
80 unsigned long end);
81extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
82
83#else
84/*
85 * TLB flushing for 64-bit has-MMU CPUs
86 */
24 87
25#include <linux/percpu.h> 88#include <linux/percpu.h>
26#include <asm/page.h> 89#include <asm/page.h>
@@ -28,117 +91,90 @@ struct mm_struct;
28#define PPC64_TLB_BATCH_NR 192 91#define PPC64_TLB_BATCH_NR 192
29 92
30struct ppc64_tlb_batch { 93struct ppc64_tlb_batch {
31 unsigned long index; 94 int active;
32 struct mm_struct *mm; 95 unsigned long index;
33 real_pte_t pte[PPC64_TLB_BATCH_NR]; 96 struct mm_struct *mm;
34 unsigned long vaddr[PPC64_TLB_BATCH_NR]; 97 real_pte_t pte[PPC64_TLB_BATCH_NR];
35 unsigned int psize; 98 unsigned long vaddr[PPC64_TLB_BATCH_NR];
99 unsigned int psize;
36}; 100};
37DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 101DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
38 102
39extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); 103extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
40 104
41static inline void flush_tlb_pending(void) 105extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
106 pte_t *ptep, unsigned long pte, int huge);
107
108#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
109
110static inline void arch_enter_lazy_mmu_mode(void)
111{
112 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
113
114 batch->active = 1;
115}
116
117static inline void arch_leave_lazy_mmu_mode(void)
42{ 118{
43 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); 119 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
44 120
45 if (batch->index) 121 if (batch->index)
46 __flush_tlb_pending(batch); 122 __flush_tlb_pending(batch);
47 put_cpu_var(ppc64_tlb_batch); 123 batch->active = 0;
48} 124}
49 125
126#define arch_flush_lazy_mmu_mode() do {} while (0)
127
128
50extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, 129extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize,
51 int local); 130 int local);
52extern void flush_hash_range(unsigned long number, int local); 131extern void flush_hash_range(unsigned long number, int local);
53 132
54#else /* CONFIG_PPC64 */
55
56#include <linux/mm.h>
57
58extern void _tlbie(unsigned long address);
59extern void _tlbia(void);
60
61/*
62 * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
63 * flush_tlb_kernel_range are best implemented as tlbia vs
64 * specific tlbie's
65 */
66
67#if (defined(CONFIG_4xx) && !defined(CONFIG_44x)) || defined(CONFIG_8xx)
68#define flush_tlb_pending() asm volatile ("tlbia; sync" : : : "memory")
69#elif defined(CONFIG_4xx) || defined(CONFIG_FSL_BOOKE)
70#define flush_tlb_pending() _tlbia()
71#endif
72
73/*
74 * This gets called at the end of handling a page fault, when
75 * the kernel has put a new PTE into the page table for the process.
76 * We use it to ensure coherency between the i-cache and d-cache
77 * for the page which has just been mapped in.
78 * On machines which use an MMU hash table, we use this to put a
79 * corresponding HPTE into the hash table ahead of time, instead of
80 * waiting for the inevitable extra hash-table miss exception.
81 */
82extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
83
84#endif /* CONFIG_PPC64 */
85
86#if defined(CONFIG_PPC64) || defined(CONFIG_4xx) || \
87 defined(CONFIG_FSL_BOOKE) || defined(CONFIG_8xx)
88 133
89static inline void flush_tlb_mm(struct mm_struct *mm) 134static inline void flush_tlb_mm(struct mm_struct *mm)
90{ 135{
91 flush_tlb_pending();
92} 136}
93 137
94static inline void flush_tlb_page(struct vm_area_struct *vma, 138static inline void flush_tlb_page(struct vm_area_struct *vma,
95 unsigned long vmaddr) 139 unsigned long vmaddr)
96{ 140{
97#ifdef CONFIG_PPC64
98 flush_tlb_pending();
99#else
100 _tlbie(vmaddr);
101#endif
102} 141}
103 142
104static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, 143static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
105 unsigned long vmaddr) 144 unsigned long vmaddr)
106{ 145{
107#ifndef CONFIG_PPC64
108 _tlbie(vmaddr);
109#endif
110} 146}
111 147
112static inline void flush_tlb_range(struct vm_area_struct *vma, 148static inline void flush_tlb_range(struct vm_area_struct *vma,
113 unsigned long start, unsigned long end) 149 unsigned long start, unsigned long end)
114{ 150{
115 flush_tlb_pending();
116} 151}
117 152
118static inline void flush_tlb_kernel_range(unsigned long start, 153static inline void flush_tlb_kernel_range(unsigned long start,
119 unsigned long end) 154 unsigned long end)
120{ 155{
121 flush_tlb_pending();
122} 156}
123 157
124#else /* 6xx, 7xx, 7xxx cpus */
125
126extern void flush_tlb_mm(struct mm_struct *mm);
127extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
128extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
129extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
130 unsigned long end);
131extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
132
133#endif 158#endif
134 159
135/* 160/*
161 * This gets called at the end of handling a page fault, when
162 * the kernel has put a new PTE into the page table for the process.
163 * We use it to ensure coherency between the i-cache and d-cache
164 * for the page which has just been mapped in.
165 * On machines which use an MMU hash table, we use this to put a
166 * corresponding HPTE into the hash table ahead of time, instead of
167 * waiting for the inevitable extra hash-table miss exception.
168 */
169extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
170
171/*
136 * This is called in munmap when we have freed up some page-table 172 * This is called in munmap when we have freed up some page-table
137 * pages. We don't need to do anything here, there's nothing special 173 * pages. We don't need to do anything here, there's nothing special
138 * about our page-table pages. -- paulus 174 * about our page-table pages. -- paulus
139 */ 175 */
140static inline void flush_tlb_pgtables(struct mm_struct *mm, 176static inline void flush_tlb_pgtables(struct mm_struct *mm,
141 unsigned long start, unsigned long end) 177 unsigned long start, unsigned long end)
142{ 178{
143} 179}
144 180
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index adbf16b8cfb..8e798e3758b 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -110,12 +110,18 @@ struct exception_table_entry {
110 __get_user_nocheck((x), (ptr), sizeof(*(ptr))) 110 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
111#define __put_user(x, ptr) \ 111#define __put_user(x, ptr) \
112 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) 112 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
113
113#ifndef __powerpc64__ 114#ifndef __powerpc64__
114#define __get_user64(x, ptr) \ 115#define __get_user64(x, ptr) \
115 __get_user64_nocheck((x), (ptr), sizeof(*(ptr))) 116 __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
116#define __put_user64(x, ptr) __put_user(x, ptr) 117#define __put_user64(x, ptr) __put_user(x, ptr)
117#endif 118#endif
118 119
120#define __get_user_inatomic(x, ptr) \
121 __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
122#define __put_user_inatomic(x, ptr) \
123 __put_user_nosleep((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
124
119#define __get_user_unaligned __get_user 125#define __get_user_unaligned __get_user
120#define __put_user_unaligned __put_user 126#define __put_user_unaligned __put_user
121 127
@@ -198,6 +204,16 @@ do { \
198 __pu_err; \ 204 __pu_err; \
199}) 205})
200 206
207#define __put_user_nosleep(x, ptr, size) \
208({ \
209 long __pu_err; \
210 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
211 __chk_user_ptr(ptr); \
212 __put_user_size((x), __pu_addr, (size), __pu_err); \
213 __pu_err; \
214})
215
216
201extern long __get_user_bad(void); 217extern long __get_user_bad(void);
202 218
203#define __get_user_asm(x, addr, err, op) \ 219#define __get_user_asm(x, addr, err, op) \
@@ -297,6 +313,18 @@ do { \
297 __gu_err; \ 313 __gu_err; \
298}) 314})
299 315
316#define __get_user_nosleep(x, ptr, size) \
317({ \
318 long __gu_err; \
319 unsigned long __gu_val; \
320 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
321 __chk_user_ptr(ptr); \
322 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
323 (x) = (__typeof__(*(ptr)))__gu_val; \
324 __gu_err; \
325})
326
327
300/* more complex routines */ 328/* more complex routines */
301 329
302extern unsigned long __copy_tofrom_user(void __user *to, 330extern unsigned long __copy_tofrom_user(void __user *to,
diff --git a/include/asm-powerpc/ucc_fast.h b/include/asm-powerpc/ucc_fast.h
index 39d1c90fd2c..f529f70b1d8 100644
--- a/include/asm-powerpc/ucc_fast.h
+++ b/include/asm-powerpc/ucc_fast.h
@@ -159,6 +159,9 @@ struct ucc_fast_private {
159 struct ucc_fast *uf_regs; /* a pointer to memory map of UCC regs. */ 159 struct ucc_fast *uf_regs; /* a pointer to memory map of UCC regs. */
160 u32 *p_ucce; /* a pointer to the event register in memory. */ 160 u32 *p_ucce; /* a pointer to the event register in memory. */
161 u32 *p_uccm; /* a pointer to the mask register in memory. */ 161 u32 *p_uccm; /* a pointer to the mask register in memory. */
162#ifdef CONFIG_UGETH_TX_ON_DEMAND
163 u16 *p_utodr; /* pointer to the transmit on demand register */
164#endif
162 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */ 165 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
163 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */ 166 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */
164 int stopped_tx; /* Whether channel has been stopped for Tx 167 int stopped_tx; /* Whether channel has been stopped for Tx
diff --git a/include/asm-powerpc/uic.h b/include/asm-powerpc/uic.h
new file mode 100644
index 00000000000..970eb7e2186
--- /dev/null
+++ b/include/asm-powerpc/uic.h
@@ -0,0 +1,23 @@
1/*
2 * include/asm-powerpc/uic.h
3 *
4 * IBM PPC4xx UIC external definitions and structure.
5 *
6 * Maintainer: David Gibson <dwg@au1.ibm.com>
7 * Copyright 2007 IBM Corporation.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#ifndef _ASM_POWERPC_UIC_H
15#define _ASM_POWERPC_UIC_H
16
17#ifdef __KERNEL__
18
19extern void __init uic_init_tree(void);
20extern unsigned int uic_get_irq(void);
21
22#endif /* __KERNEL__ */
23#endif /* _ASM_POWERPC_UIC_H */
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index 92fd02d7b17..ed6891af05d 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -47,12 +47,8 @@
47#include <platforms/4xx/walnut.h> 47#include <platforms/4xx/walnut.h>
48#endif 48#endif
49 49
50#if defined(CONFIG_XILINX_ML300) 50#if defined(CONFIG_XILINX_VIRTEX)
51#include <platforms/4xx/xilinx_ml300.h> 51#include <platforms/4xx/virtex.h>
52#endif
53
54#if defined(CONFIG_XILINX_ML403)
55#include <platforms/4xx/xilinx_ml403.h>
56#endif 52#endif
57 53
58#ifndef __ASSEMBLY__ 54#ifndef __ASSEMBLY__
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index 2bc8589cc45..a6441a063e5 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -6,6 +6,7 @@
6#include <asm/bitops.h> 6#include <asm/bitops.h>
7#include <asm/mmu.h> 7#include <asm/mmu.h>
8#include <asm/cputable.h> 8#include <asm/cputable.h>
9#include <asm-generic/mm_hooks.h>
9 10
10/* 11/*
11 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs 12 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
index 40f197af650..de99e92d627 100644
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -33,8 +33,6 @@
33#include <asm/mpc52xx.h> 33#include <asm/mpc52xx.h>
34#elif defined(CONFIG_MPC10X_BRIDGE) 34#elif defined(CONFIG_MPC10X_BRIDGE)
35#include <asm/mpc10x.h> 35#include <asm/mpc10x.h>
36#elif defined(CONFIG_XILINX_VIRTEX)
37#include <platforms/4xx/virtex.h>
38#else 36#else
39#error "need definition of ppc_sys_devices" 37#error "need definition of ppc_sys_devices"
40#endif 38#endif
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
index adc5ae78492..901f7fa8b2d 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -34,7 +34,8 @@ extern unsigned long sub_reloc_offset(unsigned long);
34 */ 34 */
35#define machine_is_compatible(x) 0 35#define machine_is_compatible(x) 0
36#define of_find_compatible_node(f, t, c) NULL 36#define of_find_compatible_node(f, t, c) NULL
37#define get_property(p, n, l) NULL 37#define of_get_property(p, n, l) NULL
38#define get_property(a, b, c) of_get_property((a), (b), (c))
38 39
39#endif /* _PPC_PROM_H */ 40#endif /* _PPC_PROM_H */
40#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h
index 87689836394..838684dc6d3 100644
--- a/include/asm-s390/bug.h
+++ b/include/asm-s390/bug.h
@@ -1,27 +1,70 @@
1#ifndef _S390_BUG_H 1#ifndef _ASM_S390_BUG_H
2#define _S390_BUG_H 2#define _ASM_S390_BUG_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7 7
8static inline __attribute__((noreturn)) void __do_illegal_op(void) 8#ifdef CONFIG_64BIT
9{ 9#define S390_LONG ".quad"
10#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
11 __builtin_trap();
12#else 10#else
13 asm volatile(".long 0"); 11#define S390_LONG ".long"
14#endif 12#endif
15}
16 13
17#define BUG() do { \ 14#ifdef CONFIG_DEBUG_BUGVERBOSE
18 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 15
19 __do_illegal_op(); \ 16#define __EMIT_BUG(x) do { \
17 asm volatile( \
18 "0: j 0b+2\n" \
19 "1:\n" \
20 ".section .rodata.str,\"aMS\",@progbits,1\n" \
21 "2: .asciz \""__FILE__"\"\n" \
22 ".previous\n" \
23 ".section __bug_table,\"a\"\n" \
24 "3:\t" S390_LONG "\t1b,2b\n" \
25 " .short %0,%1\n" \
26 " .org 3b+%2\n" \
27 ".previous\n" \
28 : : "i" (__LINE__), \
29 "i" (x), \
30 "i" (sizeof(struct bug_entry))); \
20} while (0) 31} while (0)
21 32
33#else /* CONFIG_DEBUG_BUGVERBOSE */
34
35#define __EMIT_BUG(x) do { \
36 asm volatile( \
37 "0: j 0b+2\n" \
38 "1:\n" \
39 ".section __bug_table,\"a\"\n" \
40 "2:\t" S390_LONG "\t1b\n" \
41 " .short %0\n" \
42 " .org 2b+%1\n" \
43 ".previous\n" \
44 : : "i" (x), \
45 "i" (sizeof(struct bug_entry))); \
46} while (0)
47
48#endif /* CONFIG_DEBUG_BUGVERBOSE */
49
50#define BUG() __EMIT_BUG(0)
51
52#define WARN_ON(x) ({ \
53 typeof(x) __ret_warn_on = (x); \
54 if (__builtin_constant_p(__ret_warn_on)) { \
55 if (__ret_warn_on) \
56 __EMIT_BUG(BUGFLAG_WARNING); \
57 } else { \
58 if (unlikely(__ret_warn_on)) \
59 __EMIT_BUG(BUGFLAG_WARNING); \
60 } \
61 unlikely(__ret_warn_on); \
62})
63
22#define HAVE_ARCH_BUG 64#define HAVE_ARCH_BUG
23#endif 65#define HAVE_ARCH_WARN_ON
66#endif /* CONFIG_BUG */
24 67
25#include <asm-generic/bug.h> 68#include <asm-generic/bug.h>
26 69
27#endif 70#endif /* _ASM_S390_BUG_H */
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
index cfc81533b9b..6795ecefd15 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -164,9 +164,9 @@ extern int ccw_device_resume(struct ccw_device *);
164extern int ccw_device_halt(struct ccw_device *, unsigned long); 164extern int ccw_device_halt(struct ccw_device *, unsigned long);
165extern int ccw_device_clear(struct ccw_device *, unsigned long); 165extern int ccw_device_clear(struct ccw_device *, unsigned long);
166 166
167extern int read_dev_chars(struct ccw_device *cdev, void **buffer, int length); 167extern int __deprecated read_dev_chars(struct ccw_device *cdev, void **buffer, int length);
168extern int read_conf_data(struct ccw_device *cdev, void **buffer, int *length); 168extern int __deprecated read_conf_data(struct ccw_device *cdev, void **buffer, int *length);
169extern int read_conf_data_lpm(struct ccw_device *cdev, void **buffer, 169extern int __deprecated read_conf_data_lpm(struct ccw_device *cdev, void **buffer,
170 int *length, __u8 lpm); 170 int *length, __u8 lpm);
171 171
172extern int ccw_device_set_online(struct ccw_device *cdev); 172extern int ccw_device_set_online(struct ccw_device *cdev);
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index d2f9c0d53a9..925b3ddfa14 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -11,6 +11,7 @@ struct ccwgroup_device {
11 CCWGROUP_ONLINE, 11 CCWGROUP_ONLINE,
12 } state; 12 } state;
13 atomic_t onoff; 13 atomic_t onoff;
14 struct mutex reg_mutex;
14 unsigned int count; /* number of attached slave devices */ 15 unsigned int count; /* number of attached slave devices */
15 struct device dev; /* master device */ 16 struct device dev; /* master device */
16 struct ccw_device *cdev[0]; /* variable number, allocate as needed */ 17 struct ccw_device *cdev[0]; /* variable number, allocate as needed */
diff --git a/include/asm-s390/chpid.h b/include/asm-s390/chpid.h
new file mode 100644
index 00000000000..b203336fd89
--- /dev/null
+++ b/include/asm-s390/chpid.h
@@ -0,0 +1,53 @@
1/*
2 * drivers/s390/cio/chpid.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_CHPID_H
9#define _ASM_S390_CHPID_H _ASM_S390_CHPID_H
10
11#include <linux/string.h>
12#include <asm/types.h>
13#include <asm/cio.h>
14
15#define __MAX_CHPID 255
16
17struct chp_id {
18 u8 reserved1;
19 u8 cssid;
20 u8 reserved2;
21 u8 id;
22} __attribute__((packed));
23
24static inline void chp_id_init(struct chp_id *chpid)
25{
26 memset(chpid, 0, sizeof(struct chp_id));
27}
28
29static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
30{
31 return (a->id == b->id) && (a->cssid == b->cssid);
32}
33
34static inline void chp_id_next(struct chp_id *chpid)
35{
36 if (chpid->id < __MAX_CHPID)
37 chpid->id++;
38 else {
39 chpid->id = 0;
40 chpid->cssid++;
41 }
42}
43
44static inline int chp_id_is_valid(struct chp_id *chpid)
45{
46 return (chpid->cssid <= __MAX_CSSID);
47}
48
49
50#define chp_id_for_each(c) \
51 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
52
53#endif /* _ASM_S390_CHPID_H */
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index d9278503098..f738d282758 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -13,6 +13,7 @@
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15#define LPM_ANYPATH 0xff 15#define LPM_ANYPATH 0xff
16#define __MAX_CSSID 0
16 17
17/* 18/*
18 * subchannel status word 19 * subchannel status word
@@ -292,6 +293,13 @@ extern void css_schedule_reprobe(void);
292 293
293extern void reipl_ccw_dev(struct ccw_dev_id *id); 294extern void reipl_ccw_dev(struct ccw_dev_id *id);
294 295
296struct cio_iplinfo {
297 u16 devno;
298 int is_qdio;
299};
300
301extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
302
295#endif 303#endif
296 304
297#endif 305#endif
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index c0d629d61d3..91d06325cc7 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -188,7 +188,8 @@ static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
188/* This yields a mask that user programs can use to figure out what 188/* This yields a mask that user programs can use to figure out what
189 instruction set this CPU supports. */ 189 instruction set this CPU supports. */
190 190
191#define ELF_HWCAP (0) 191extern unsigned long elf_hwcap;
192#define ELF_HWCAP (elf_hwcap)
192 193
193/* This yields a string that ld.so will use to load implementation 194/* This yields a string that ld.so will use to load implementation
194 specific libraries for optimization. This is more specific in 195 specific libraries for optimization. This is more specific in
@@ -197,7 +198,9 @@ static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
197 For the moment, we have only optimizations for the Intel generations, 198 For the moment, we have only optimizations for the Intel generations,
198 but that could change... */ 199 but that could change... */
199 200
200#define ELF_PLATFORM (NULL) 201#define ELF_PLATFORM_SIZE 8
202extern char elf_platform[];
203#define ELF_PLATFORM (elf_platform)
201 204
202#ifndef __s390x__ 205#ifndef __s390x__
203#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 206#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
diff --git a/include/asm-s390/ipl.h b/include/asm-s390/ipl.h
index 0eb64083480..bdcd448d43f 100644
--- a/include/asm-s390/ipl.h
+++ b/include/asm-s390/ipl.h
@@ -8,6 +8,8 @@
8#define _ASM_S390_IPL_H 8#define _ASM_S390_IPL_H
9 9
10#include <asm/types.h> 10#include <asm/types.h>
11#include <asm/cio.h>
12#include <asm/setup.h>
11 13
12#define IPL_PARMBLOCK_ORIGIN 0x2000 14#define IPL_PARMBLOCK_ORIGIN 0x2000
13 15
@@ -74,12 +76,12 @@ struct ipl_parameter_block {
74} __attribute__((packed)); 76} __attribute__((packed));
75 77
76/* 78/*
77 * IPL validity flags and parameters as detected in head.S 79 * IPL validity flags
78 */ 80 */
79extern u32 ipl_flags; 81extern u32 ipl_flags;
80extern u16 ipl_devno;
81 82
82extern u32 dump_prefix_page; 83extern u32 dump_prefix_page;
84
83extern void do_reipl(void); 85extern void do_reipl(void);
84extern void ipl_save_parameters(void); 86extern void ipl_save_parameters(void);
85 87
@@ -89,6 +91,35 @@ enum {
89 IPL_NSS_VALID = 4, 91 IPL_NSS_VALID = 4,
90}; 92};
91 93
94enum ipl_type {
95 IPL_TYPE_UNKNOWN = 1,
96 IPL_TYPE_CCW = 2,
97 IPL_TYPE_FCP = 4,
98 IPL_TYPE_FCP_DUMP = 8,
99 IPL_TYPE_NSS = 16,
100};
101
102struct ipl_info
103{
104 enum ipl_type type;
105 union {
106 struct {
107 struct ccw_dev_id dev_id;
108 } ccw;
109 struct {
110 struct ccw_dev_id dev_id;
111 u64 wwpn;
112 u64 lun;
113 } fcp;
114 struct {
115 char name[NSS_NAME_SIZE + 1];
116 } nss;
117 } data;
118};
119
120extern struct ipl_info ipl_info;
121extern void setup_ipl_info(void);
122
92/* 123/*
93 * DIAG 308 support 124 * DIAG 308 support
94 */ 125 */
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h
index 1b50f89819a..d2d7ad27614 100644
--- a/include/asm-s390/kdebug.h
+++ b/include/asm-s390/kdebug.h
@@ -22,8 +22,21 @@ struct die_args {
22 */ 22 */
23extern int register_die_notifier(struct notifier_block *); 23extern int register_die_notifier(struct notifier_block *);
24extern int unregister_die_notifier(struct notifier_block *); 24extern int unregister_die_notifier(struct notifier_block *);
25extern int register_page_fault_notifier(struct notifier_block *); 25
26extern int unregister_page_fault_notifier(struct notifier_block *); 26/*
27 * These are only here because kprobes.c wants them to implement a
28 * blatant layering violation. Will hopefully go away soon once all
29 * architectures are updated.
30 */
31static inline int register_page_fault_notifier(struct notifier_block *nb)
32{
33 return 0;
34}
35static inline int unregister_page_fault_notifier(struct notifier_block *nb)
36{
37 return 0;
38}
39
27extern struct atomic_notifier_head s390die_chain; 40extern struct atomic_notifier_head s390die_chain;
28 41
29enum die_val { 42enum die_val {
@@ -39,7 +52,6 @@ enum die_val {
39 DIE_GPF, 52 DIE_GPF,
40 DIE_CALL, 53 DIE_CALL,
41 DIE_NMI_IPI, 54 DIE_NMI_IPI,
42 DIE_PAGE_FAULT,
43}; 55};
44 56
45static inline int notify_die(enum die_val val, const char *str, 57static inline int notify_die(enum die_val val, const char *str,
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h
index b847ff0ec3f..830fe4c4eea 100644
--- a/include/asm-s390/kprobes.h
+++ b/include/asm-s390/kprobes.h
@@ -97,18 +97,10 @@ void kretprobe_trampoline(void);
97int is_prohibited_opcode(kprobe_opcode_t *instruction); 97int is_prohibited_opcode(kprobe_opcode_t *instruction);
98void get_instruction_type(struct arch_specific_insn *ainsn); 98void get_instruction_type(struct arch_specific_insn *ainsn);
99 99
100int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
101int kprobe_exceptions_notify(struct notifier_block *self,
102 unsigned long val, void *data);
103
100#define flush_insn_slot(p) do { } while (0) 104#define flush_insn_slot(p) do { } while (0)
101 105
102#endif /* _ASM_S390_KPROBES_H */ 106#endif /* _ASM_S390_KPROBES_H */
103
104#ifdef CONFIG_KPROBES
105
106extern int kprobe_exceptions_notify(struct notifier_block *self,
107 unsigned long val, void *data);
108#else /* !CONFIG_KPROBES */
109static inline int kprobe_exceptions_notify(struct notifier_block *self,
110 unsigned long val, void *data)
111{
112 return 0;
113}
114#endif
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 4a31d0a7ee8..801a6fd35b5 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -147,6 +147,52 @@ void pgm_check_handler(void);
147void mcck_int_handler(void); 147void mcck_int_handler(void);
148void io_int_handler(void); 148void io_int_handler(void);
149 149
150struct save_area_s390 {
151 u32 ext_save;
152 u64 timer;
153 u64 clk_cmp;
154 u8 pad1[24];
155 u8 psw[8];
156 u32 pref_reg;
157 u8 pad2[20];
158 u32 acc_regs[16];
159 u64 fp_regs[4];
160 u32 gp_regs[16];
161 u32 ctrl_regs[16];
162} __attribute__((packed));
163
164struct save_area_s390x {
165 u64 fp_regs[16];
166 u64 gp_regs[16];
167 u8 psw[16];
168 u8 pad1[8];
169 u32 pref_reg;
170 u32 fp_ctrl_reg;
171 u8 pad2[4];
172 u32 tod_reg;
173 u64 timer;
174 u64 clk_cmp;
175 u8 pad3[8];
176 u32 acc_regs[16];
177 u64 ctrl_regs[16];
178} __attribute__((packed));
179
180union save_area {
181 struct save_area_s390 s390;
182 struct save_area_s390x s390x;
183};
184
185#define SAVE_AREA_BASE_S390 0xd4
186#define SAVE_AREA_BASE_S390X 0x1200
187
188#ifndef __s390x__
189#define SAVE_AREA_SIZE sizeof(struct save_area_s390)
190#define SAVE_AREA_BASE SAVE_AREA_BASE_S390
191#else
192#define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
193#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
194#endif
195
150struct _lowcore 196struct _lowcore
151{ 197{
152#ifndef __s390x__ 198#ifndef __s390x__
@@ -183,17 +229,19 @@ struct _lowcore
183 __u16 subchannel_nr; /* 0x0ba */ 229 __u16 subchannel_nr; /* 0x0ba */
184 __u32 io_int_parm; /* 0x0bc */ 230 __u32 io_int_parm; /* 0x0bc */
185 __u32 io_int_word; /* 0x0c0 */ 231 __u32 io_int_word; /* 0x0c0 */
186 __u8 pad3[0xD4-0xC4]; /* 0x0c4 */ 232 __u8 pad3[0xc8-0xc4]; /* 0x0c4 */
233 __u32 stfl_fac_list; /* 0x0c8 */
234 __u8 pad4[0xd4-0xcc]; /* 0x0cc */
187 __u32 extended_save_area_addr; /* 0x0d4 */ 235 __u32 extended_save_area_addr; /* 0x0d4 */
188 __u32 cpu_timer_save_area[2]; /* 0x0d8 */ 236 __u32 cpu_timer_save_area[2]; /* 0x0d8 */
189 __u32 clock_comp_save_area[2]; /* 0x0e0 */ 237 __u32 clock_comp_save_area[2]; /* 0x0e0 */
190 __u32 mcck_interruption_code[2]; /* 0x0e8 */ 238 __u32 mcck_interruption_code[2]; /* 0x0e8 */
191 __u8 pad4[0xf4-0xf0]; /* 0x0f0 */ 239 __u8 pad5[0xf4-0xf0]; /* 0x0f0 */
192 __u32 external_damage_code; /* 0x0f4 */ 240 __u32 external_damage_code; /* 0x0f4 */
193 __u32 failing_storage_address; /* 0x0f8 */ 241 __u32 failing_storage_address; /* 0x0f8 */
194 __u8 pad5[0x100-0xfc]; /* 0x0fc */ 242 __u8 pad6[0x100-0xfc]; /* 0x0fc */
195 __u32 st_status_fixed_logout[4];/* 0x100 */ 243 __u32 st_status_fixed_logout[4];/* 0x100 */
196 __u8 pad6[0x120-0x110]; /* 0x110 */ 244 __u8 pad7[0x120-0x110]; /* 0x110 */
197 __u32 access_regs_save_area[16];/* 0x120 */ 245 __u32 access_regs_save_area[16];/* 0x120 */
198 __u32 floating_pt_save_area[8]; /* 0x160 */ 246 __u32 floating_pt_save_area[8]; /* 0x160 */
199 __u32 gpregs_save_area[16]; /* 0x180 */ 247 __u32 gpregs_save_area[16]; /* 0x180 */
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h
index 1d21da220d4..501cb9b0631 100644
--- a/include/asm-s390/mmu_context.h
+++ b/include/asm-s390/mmu_context.h
@@ -10,6 +10,8 @@
10#define __S390_MMU_CONTEXT_H 10#define __S390_MMU_CONTEXT_H
11 11
12#include <asm/pgalloc.h> 12#include <asm/pgalloc.h>
13#include <asm-generic/mm_hooks.h>
14
13/* 15/*
14 * get a new mmu context.. S390 don't know about contexts. 16 * get a new mmu context.. S390 don't know about contexts.
15 */ 17 */
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 13c16546eff..8fe8d42e64c 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -753,14 +753,14 @@ ptep_establish(struct vm_area_struct *vma,
753 * should therefore only be called if it is not mapped in any 753 * should therefore only be called if it is not mapped in any
754 * address space. 754 * address space.
755 */ 755 */
756static inline int page_test_and_clear_dirty(struct page *page) 756static inline int page_test_dirty(struct page *page)
757{ 757{
758 unsigned long physpage = page_to_phys(page); 758 return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0;
759 int skey = page_get_storage_key(physpage); 759}
760 760
761 if (skey & _PAGE_CHANGED) 761static inline void page_clear_dirty(struct page *page)
762 page_set_storage_key(physpage, skey & ~_PAGE_CHANGED); 762{
763 return skey & _PAGE_CHANGED; 763 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY);
764} 764}
765 765
766/* 766/*
@@ -953,7 +953,8 @@ extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
953#define __HAVE_ARCH_PTEP_CLEAR_FLUSH 953#define __HAVE_ARCH_PTEP_CLEAR_FLUSH
954#define __HAVE_ARCH_PTEP_SET_WRPROTECT 954#define __HAVE_ARCH_PTEP_SET_WRPROTECT
955#define __HAVE_ARCH_PTE_SAME 955#define __HAVE_ARCH_PTE_SAME
956#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 956#define __HAVE_ARCH_PAGE_TEST_DIRTY
957#define __HAVE_ARCH_PAGE_CLEAR_DIRTY
957#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 958#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
958#include <asm-generic/pgtable.h> 959#include <asm-generic/pgtable.h>
959 960
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 33b80ced4bc..e0fcea8c64c 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -57,6 +57,7 @@ struct cpuinfo_S390
57 57
58extern void s390_adjust_jiffies(void); 58extern void s390_adjust_jiffies(void);
59extern void print_cpu_info(struct cpuinfo_S390 *); 59extern void print_cpu_info(struct cpuinfo_S390 *);
60extern int get_cpu_capability(unsigned int *);
60 61
61/* Lazy FPU handling on uni-processor */ 62/* Lazy FPU handling on uni-processor */
62extern struct task_struct *last_task_used_math; 63extern struct task_struct *last_task_used_math;
@@ -196,6 +197,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
196extern char *task_show_regs(struct task_struct *task, char *buffer); 197extern char *task_show_regs(struct task_struct *task, char *buffer);
197 198
198extern void show_registers(struct pt_regs *regs); 199extern void show_registers(struct pt_regs *regs);
200extern void show_code(struct pt_regs *regs);
199extern void show_trace(struct task_struct *task, unsigned long *sp); 201extern void show_trace(struct task_struct *task, unsigned long *sp);
200 202
201unsigned long get_wchan(struct task_struct *p); 203unsigned long get_wchan(struct task_struct *p);
diff --git a/include/asm-s390/sclp.h b/include/asm-s390/sclp.h
index 468b9701840..21ed6477321 100644
--- a/include/asm-s390/sclp.h
+++ b/include/asm-s390/sclp.h
@@ -9,6 +9,7 @@
9#define _ASM_S390_SCLP_H 9#define _ASM_S390_SCLP_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/chpid.h>
12 13
13struct sccb_header { 14struct sccb_header {
14 u16 length; 15 u16 length;
@@ -33,7 +34,20 @@ struct sclp_readinfo_sccb {
33 u8 _reserved3[4096 - 112]; /* 112-4095 */ 34 u8 _reserved3[4096 - 112]; /* 112-4095 */
34} __attribute__((packed, aligned(4096))); 35} __attribute__((packed, aligned(4096)));
35 36
37#define SCLP_CHP_INFO_MASK_SIZE 32
38
39struct sclp_chp_info {
40 u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
41 u8 standby[SCLP_CHP_INFO_MASK_SIZE];
42 u8 configured[SCLP_CHP_INFO_MASK_SIZE];
43};
44
36extern struct sclp_readinfo_sccb s390_readinfo_sccb; 45extern struct sclp_readinfo_sccb s390_readinfo_sccb;
37extern void sclp_readinfo_early(void); 46extern void sclp_readinfo_early(void);
47extern int sclp_sdias_blk_count(void);
48extern int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
49extern int sclp_chp_configure(struct chp_id chpid);
50extern int sclp_chp_deconfigure(struct chp_id chpid);
51extern int sclp_chp_read_info(struct sclp_chp_info *info);
38 52
39#endif /* _ASM_S390_SCLP_H */ 53#endif /* _ASM_S390_SCLP_H */
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 44c7aee2bd3..a76a6b8fd88 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -40,6 +40,7 @@ struct mem_chunk {
40}; 40};
41 41
42extern struct mem_chunk memory_chunk[]; 42extern struct mem_chunk memory_chunk[];
43extern unsigned long real_memory_size;
43 44
44#ifdef CONFIG_S390_SWITCH_AMODE 45#ifdef CONFIG_S390_SWITCH_AMODE
45extern unsigned int switch_amode; 46extern unsigned int switch_amode;
@@ -77,6 +78,7 @@ extern unsigned long machine_flags;
77#endif /* __s390x__ */ 78#endif /* __s390x__ */
78 79
79#define MACHINE_HAS_SCLP (!MACHINE_IS_P390) 80#define MACHINE_HAS_SCLP (!MACHINE_IS_P390)
81#define ZFCPDUMP_HSA_SIZE (32UL<<20)
80 82
81/* 83/*
82 * Console mode. Override with conmode= 84 * Console mode. Override with conmode=
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index b957e4cda46..0a28e6d6ef4 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -54,9 +54,6 @@ extern int smp_call_function_on(void (*func) (void *info), void *info,
54 54
55#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) 55#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
56 56
57extern int smp_get_cpu(cpumask_t cpu_map);
58extern void smp_put_cpu(int cpu);
59
60static inline __u16 hard_smp_processor_id(void) 57static inline __u16 hard_smp_processor_id(void)
61{ 58{
62 __u16 cpu_address; 59 __u16 cpu_address;
@@ -114,9 +111,8 @@ static inline void smp_send_stop(void)
114} 111}
115 112
116#define smp_cpu_not_running(cpu) 1 113#define smp_cpu_not_running(cpu) 1
117#define smp_get_cpu(cpu) ({ 0; })
118#define smp_put_cpu(cpu) ({ 0; })
119#define smp_setup_cpu_possible_map() do { } while (0) 114#define smp_setup_cpu_possible_map() do { } while (0)
120#endif 115#endif
121 116
117extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
122#endif 118#endif
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 1778a49a74c..1161ebe3dec 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -57,5 +57,7 @@
57 57
58#define SO_PEERSEC 31 58#define SO_PEERSEC 31
59#define SO_PASSSEC 34 59#define SO_PASSSEC 34
60#define SO_TIMESTAMPNS 35
61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
60 62
61#endif /* _ASM_SOCKET_H */ 63#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-s390/sockios.h b/include/asm-s390/sockios.h
index 412aeb4dd6c..f4fc16c7da5 100644
--- a/include/asm-s390/sockios.h
+++ b/include/asm-s390/sockios.h
@@ -15,6 +15,7 @@
15#define FIOGETOWN 0x8903 15#define FIOGETOWN 0x8903
16#define SIOCGPGRP 0x8904 16#define SIOCGPGRP 0x8904
17#define SIOCATMARK 0x8905 17#define SIOCATMARK 0x8905
18#define SIOCGSTAMP 0x8906 /* Get stamp */ 18#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
19#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
19 20
20#endif 21#endif
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index 342024425b7..01acaaae975 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -12,6 +12,7 @@
12#include <asm/tlbflush.h> 12#include <asm/tlbflush.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm-generic/mm_hooks.h>
15 16
16/* 17/*
17 * The MMU "context" consists of two things: 18 * The MMU "context" consists of two things:
diff --git a/include/asm-sh/scatterlist.h b/include/asm-sh/scatterlist.h
index d19e7cd3b02..b9ae53c3836 100644
--- a/include/asm-sh/scatterlist.h
+++ b/include/asm-sh/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_SH_SCATTERLIST_H 1#ifndef __ASM_SH_SCATTERLIST_H
2#define __ASM_SH_SCATTERLIST_H 2#define __ASM_SH_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page * page; /* Location for highmem page, if any */ 7 struct page * page; /* Location for highmem page, if any */
6 unsigned int offset;/* for highmem, page offset */ 8 unsigned int offset;/* for highmem, page offset */
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
index ca70362eb56..c48d6fc9da3 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __ASM_SH_SOCKET_H */ 55#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sh/sockios.h b/include/asm-sh/sockios.h
index 08a71df8a8b..cf8b96b1f9a 100644
--- a/include/asm-sh/sockios.h
+++ b/include/asm-sh/sockios.h
@@ -9,5 +9,6 @@
9#define SIOCSPGRP _IOW('s', 8, pid_t) 9#define SIOCSPGRP _IOW('s', 8, pid_t)
10#define SIOCGPGRP _IOR('s', 9, pid_t) 10#define SIOCGPGRP _IOR('s', 9, pid_t)
11 11
12#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ 12#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
13#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
13#endif /* __ASM_SH_SOCKIOS_H */ 14#endif /* __ASM_SH_SOCKIOS_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
index 95bc7db006b..55f8db6bc1d 100644
--- a/include/asm-sh/string.h
+++ b/include/asm-sh/string.h
@@ -126,9 +126,6 @@ extern void *memchr(const void *__s, int __c, size_t __n);
126#define __HAVE_ARCH_STRLEN 126#define __HAVE_ARCH_STRLEN
127extern size_t strlen(const char *); 127extern size_t strlen(const char *);
128 128
129/* arch/sh/lib/strcasecmp.c */
130extern int strcasecmp(const char *, const char *);
131
132#endif /* __KERNEL__ */ 129#endif /* __KERNEL__ */
133 130
134#endif /* __ASM_SH_STRING_H */ 131#endif /* __ASM_SH_STRING_H */
diff --git a/include/asm-sh64/mmu_context.h b/include/asm-sh64/mmu_context.h
index 8c860dab2d0..507bf72bb8e 100644
--- a/include/asm-sh64/mmu_context.h
+++ b/include/asm-sh64/mmu_context.h
@@ -27,7 +27,7 @@
27extern unsigned long mmu_context_cache; 27extern unsigned long mmu_context_cache;
28 28
29#include <asm/page.h> 29#include <asm/page.h>
30 30#include <asm-generic/mm_hooks.h>
31 31
32/* Current mm's pgd */ 32/* Current mm's pgd */
33extern pgd_t *mmu_pdtp_cache; 33extern pgd_t *mmu_pdtp_cache;
diff --git a/include/asm-sh64/scatterlist.h b/include/asm-sh64/scatterlist.h
index 5d8fa32d2e9..1c723f2d7a9 100644
--- a/include/asm-sh64/scatterlist.h
+++ b/include/asm-sh64/scatterlist.h
@@ -11,6 +11,8 @@
11#ifndef __ASM_SH64_SCATTERLIST_H 11#ifndef __ASM_SH64_SCATTERLIST_H
12#define __ASM_SH64_SCATTERLIST_H 12#define __ASM_SH64_SCATTERLIST_H
13 13
14#include <asm/types.h>
15
14struct scatterlist { 16struct scatterlist {
15 struct page * page; /* Location for highmem page, if any */ 17 struct page * page; /* Location for highmem page, if any */
16 unsigned int offset;/* for highmem, page offset */ 18 unsigned int offset;/* for highmem, page offset */
diff --git a/include/asm-sh64/sockios.h b/include/asm-sh64/sockios.h
index 1ae23ae8297..419e76f12f4 100644
--- a/include/asm-sh64/sockios.h
+++ b/include/asm-sh64/sockios.h
@@ -20,5 +20,6 @@
20#define SIOCSPGRP _IOW('s', 8, pid_t) 20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t) 21#define SIOCGPGRP _IOR('s', 9, pid_t)
22 22
23#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ 23#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
24#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
24#endif /* __ASM_SH64_SOCKIOS_H */ 25#endif /* __ASM_SH64_SOCKIOS_H */
diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h
index ed1e01d04d2..671a997b9e6 100644
--- a/include/asm-sparc/mmu_context.h
+++ b/include/asm-sparc/mmu_context.h
@@ -5,6 +5,8 @@
5 5
6#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
7 7
8#include <asm-generic/mm_hooks.h>
9
8static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 10static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 11{
10} 12}
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 274868d8598..9ea105ebe2f 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -35,8 +35,8 @@ struct property {
35}; 35};
36 36
37struct device_node { 37struct device_node {
38 char *name; 38 const char *name;
39 char *type; 39 const char *type;
40 phandle node; 40 phandle node;
41 char *path_component_name; 41 char *path_component_name;
42 char *full_name; 42 char *full_name;
@@ -85,12 +85,14 @@ extern struct device_node *of_find_node_by_phandle(phandle handle);
85extern struct device_node *of_get_parent(const struct device_node *node); 85extern struct device_node *of_get_parent(const struct device_node *node);
86extern struct device_node *of_get_next_child(const struct device_node *node, 86extern struct device_node *of_get_next_child(const struct device_node *node,
87 struct device_node *prev); 87 struct device_node *prev);
88extern struct property *of_find_property(struct device_node *np, 88extern struct property *of_find_property(const struct device_node *np,
89 const char *name, 89 const char *name,
90 int *lenp); 90 int *lenp);
91extern int of_device_is_compatible(struct device_node *device, const char *); 91extern int of_device_is_compatible(const struct device_node *device,
92extern void *of_get_property(struct device_node *node, const char *name, 92 const char *);
93 int *lenp); 93extern const void *of_get_property(const struct device_node *node,
94 const char *name,
95 int *lenp);
94#define get_property(node,name,lenp) of_get_property(node,name,lenp) 96#define get_property(node,name,lenp) of_get_property(node,name,lenp)
95extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 97extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
96extern int of_getintprop_default(struct device_node *np, 98extern int of_getintprop_default(struct device_node *np,
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index f6c4e5baf3f..7c1423997cf 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f 51#define SO_PASSSEC 0x001f
52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53/* Security levels - as per NRL IPv6 - don't actually do anything */ 55/* Security levels - as per NRL IPv6 - don't actually do anything */
54#define SO_SECURITY_AUTHENTICATION 0x5001 56#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc/sockios.h b/include/asm-sparc/sockios.h
index 0c01b597b06..990ea746486 100644
--- a/include/asm-sparc/sockios.h
+++ b/include/asm-sparc/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* !(_ASM_SPARC_SOCKIOS_H) */ 13#endif /* !(_ASM_SPARC_SOCKIOS_H) */
13 14
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index f2cc9411b4c..e89922d6718 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -17,8 +17,8 @@
17typedef struct { 17typedef struct {
18 /* Dcache line 1 */ 18 /* Dcache line 1 */
19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
20 unsigned int multiplier; 20 unsigned int __pad0_1;
21 unsigned int counter; 21 unsigned int __pad0_2;
22 unsigned int __pad1; 22 unsigned int __pad1;
23 unsigned long clock_tick; /* %tick's per second */ 23 unsigned long clock_tick; /* %tick's per second */
24 unsigned long udelay_val; 24 unsigned long udelay_val;
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
index d8f9872b0e2..d5a4559b955 100644
--- a/include/asm-sparc64/device.h
+++ b/include/asm-sparc64/device.h
@@ -3,5 +3,21 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef _ASM_SPARC64_DEVICE_H
7#define _ASM_SPARC64_DEVICE_H
7 8
9struct device_node;
10struct of_device;
11
12struct dev_archdata {
13 void *iommu;
14 void *stc;
15 void *host_controller;
16
17 struct device_node *prom_node;
18 struct of_device *op;
19
20 unsigned int msi_num;
21};
22
23#endif /* _ASM_SPARC64_DEVICE_H */
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index a4afe9d5703..9c1c6db2a79 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -8,7 +8,6 @@
8#ifndef __SPARC64_EBUS_H 8#ifndef __SPARC64_EBUS_H
9#define __SPARC64_EBUS_H 9#define __SPARC64_EBUS_H
10 10
11#include <asm/pbm.h>
12#include <asm/oplib.h> 11#include <asm/oplib.h>
13#include <asm/prom.h> 12#include <asm/prom.h>
14#include <asm/of_device.h> 13#include <asm/of_device.h>
@@ -41,7 +40,6 @@ struct linux_ebus {
41 struct of_device ofdev; 40 struct of_device ofdev;
42 struct linux_ebus *next; 41 struct linux_ebus *next;
43 struct linux_ebus_device *devices; 42 struct linux_ebus_device *devices;
44 struct pci_pbm_info *parent;
45 struct pci_dev *self; 43 struct pci_dev *self;
46 int index; 44 int index;
47 int is_rio; 45 int is_rio;
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 331013a0053..4aa0925e1b1 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -549,7 +549,7 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
549 if (!strcmp(edev->prom_node->name, "fdthree")) 549 if (!strcmp(edev->prom_node->name, "fdthree"))
550 return 1; 550 return 1;
551 if (!strcmp(edev->prom_node->name, "floppy")) { 551 if (!strcmp(edev->prom_node->name, "floppy")) {
552 char *compat; 552 const char *compat;
553 553
554 compat = of_get_property(edev->prom_node, 554 compat = of_get_property(edev->prom_node,
555 "compatible", NULL); 555 "compatible", NULL);
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
661 struct linux_ebus_device *edev = NULL; 661 struct linux_ebus_device *edev = NULL;
662 unsigned long config = 0; 662 unsigned long config = 0;
663 void __iomem *auxio_reg; 663 void __iomem *auxio_reg;
664 char *state_prop; 664 const char *state_prop;
665 665
666 for_each_ebus(ebus) { 666 for_each_ebus(ebus) {
667 for_each_ebusdev(edev, ebus) { 667 for_each_ebusdev(edev, ebus) {
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 30b912d8e8b..ad595b67984 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -24,14 +24,6 @@ extern unsigned long kern_base, kern_size;
24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
25#define BIO_VMERGE_BOUNDARY 8192 25#define BIO_VMERGE_BOUNDARY 8192
26 26
27/* Different PCI controllers we support have their PCI MEM space
28 * mapped to an either 2GB (Psycho) or 4GB (Sabre) aligned area,
29 * so need to chop off the top 33 or 32 bits.
30 */
31extern unsigned long pci_memspace_mask;
32
33#define bus_dvma_to_mem(__vaddr) ((__vaddr) & pci_memspace_mask)
34
35static __inline__ u8 _inb(unsigned long addr) 27static __inline__ u8 _inb(unsigned long addr)
36{ 28{
37 u8 ret; 29 u8 ret;
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
index 0de7a3da79c..e199594a1e9 100644
--- a/include/asm-sparc64/iommu.h
+++ b/include/asm-sparc64/iommu.h
@@ -7,15 +7,50 @@
7#define _SPARC64_IOMMU_H 7#define _SPARC64_IOMMU_H
8 8
9/* The format of an iopte in the page tables. */ 9/* The format of an iopte in the page tables. */
10#define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */ 10#define IOPTE_VALID 0x8000000000000000UL
11#define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */ 11#define IOPTE_64K 0x2000000000000000UL
12#define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */ 12#define IOPTE_STBUF 0x1000000000000000UL
13#define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/ 13#define IOPTE_INTRA 0x0800000000000000UL
14#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */ 14#define IOPTE_CONTEXT 0x07ff800000000000UL
15#define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/ 15#define IOPTE_PAGE 0x00007fffffffe000UL
16#define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ 16#define IOPTE_CACHE 0x0000000000000010UL
17#define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ 17#define IOPTE_WRITE 0x0000000000000002UL
18 18
19#define IOMMU_NUM_CTXS 4096 19#define IOMMU_NUM_CTXS 4096
20 20
21struct iommu_arena {
22 unsigned long *map;
23 unsigned int hint;
24 unsigned int limit;
25};
26
27struct iommu {
28 spinlock_t lock;
29 struct iommu_arena arena;
30 iopte_t *page_table;
31 u32 page_table_map_base;
32 unsigned long iommu_control;
33 unsigned long iommu_tsbbase;
34 unsigned long iommu_flush;
35 unsigned long iommu_ctxflush;
36 unsigned long write_complete_reg;
37 unsigned long dummy_page;
38 unsigned long dummy_page_pa;
39 unsigned long ctx_lowest_free;
40 DECLARE_BITMAP(ctx_bitmap, IOMMU_NUM_CTXS);
41 u32 dma_addr_mask;
42};
43
44struct strbuf {
45 int strbuf_enabled;
46 unsigned long strbuf_control;
47 unsigned long strbuf_pflush;
48 unsigned long strbuf_fsync;
49 unsigned long strbuf_ctxflush;
50 unsigned long strbuf_ctxmatch_base;
51 unsigned long strbuf_flushflag_pa;
52 volatile unsigned long *strbuf_flushflag;
53 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)];
54};
55
21#endif /* !(_SPARC_IOMMU_H) */ 56#endif /* !(_SPARC_IOMMU_H) */
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index d9728b9031f..ecd9290f78d 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -7,7 +7,6 @@
7#ifndef __SPARC64_ISA_H 7#ifndef __SPARC64_ISA_H
8#define __SPARC64_ISA_H 8#define __SPARC64_ISA_H
9 9
10#include <asm/pbm.h>
11#include <asm/oplib.h> 10#include <asm/oplib.h>
12#include <asm/prom.h> 11#include <asm/prom.h>
13#include <asm/of_device.h> 12#include <asm/of_device.h>
@@ -29,7 +28,6 @@ struct sparc_isa_bridge {
29 struct of_device ofdev; 28 struct of_device ofdev;
30 struct sparc_isa_bridge *next; 29 struct sparc_isa_bridge *next;
31 struct sparc_isa_device *devices; 30 struct sparc_isa_device *devices;
32 struct pci_pbm_info *parent;
33 struct pci_dev *self; 31 struct pci_dev *self;
34 int index; 32 int index;
35 struct device_node *prom_node; 33 struct device_node *prom_node;
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 2337eb48771..8d129032013 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -9,6 +9,7 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <asm/system.h> 10#include <asm/system.h>
11#include <asm/spitfire.h> 11#include <asm/spitfire.h>
12#include <asm-generic/mm_hooks.h>
12 13
13static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 14static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
14{ 15{
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 284dfd01a33..6340a5253a3 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -103,7 +103,7 @@ static int ebus_ecpp_p(struct linux_ebus_device *edev)
103 if (!strcmp(edev->prom_node->name, "ecpp")) 103 if (!strcmp(edev->prom_node->name, "ecpp"))
104 return 1; 104 return 1;
105 if (!strcmp(edev->prom_node->name, "parallel")) { 105 if (!strcmp(edev->prom_node->name, "parallel")) {
106 char *compat; 106 const char *compat;
107 107
108 compat = of_get_property(edev->prom_node, 108 compat = of_get_property(edev->prom_node,
109 "compatible", NULL); 109 "compatible", NULL);
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 7a246d8a182..c008cecca14 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -1,7 +1,6 @@
1/* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $ 1/* pbm.h: UltraSparc PCI controller software state.
2 * pbm.h: UltraSparc PCI controller software state.
3 * 2 *
4 * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef __SPARC64_PBM_H 6#ifndef __SPARC64_PBM_H
@@ -30,90 +29,7 @@
30 * PCI bus. 29 * PCI bus.
31 */ 30 */
32 31
33struct pci_controller_info; 32extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
34
35/* This contains the software state necessary to drive a PCI
36 * controller's IOMMU.
37 */
38struct pci_iommu_arena {
39 unsigned long *map;
40 unsigned int hint;
41 unsigned int limit;
42};
43
44struct pci_iommu {
45 /* This protects the controller's IOMMU and all
46 * streaming buffers underneath.
47 */
48 spinlock_t lock;
49
50 struct pci_iommu_arena arena;
51
52 /* IOMMU page table, a linear array of ioptes. */
53 iopte_t *page_table; /* The page table itself. */
54
55 /* Base PCI memory space address where IOMMU mappings
56 * begin.
57 */
58 u32 page_table_map_base;
59
60 /* IOMMU Controller Registers */
61 unsigned long iommu_control; /* IOMMU control register */
62 unsigned long iommu_tsbbase; /* IOMMU page table base register */
63 unsigned long iommu_flush; /* IOMMU page flush register */
64 unsigned long iommu_ctxflush; /* IOMMU context flush register */
65
66 /* This is a register in the PCI controller, which if
67 * read will have no side-effects but will guarantee
68 * completion of all previous writes into IOMMU/STC.
69 */
70 unsigned long write_complete_reg;
71
72 /* In order to deal with some buggy third-party PCI bridges that
73 * do wrong prefetching, we never mark valid mappings as invalid.
74 * Instead we point them at this dummy page.
75 */
76 unsigned long dummy_page;
77 unsigned long dummy_page_pa;
78
79 /* CTX allocation. */
80 unsigned long ctx_lowest_free;
81 unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)];
82
83 /* Here a PCI controller driver describes the areas of
84 * PCI memory space where DMA to/from physical memory
85 * are addressed. Drivers interrogate the PCI layer
86 * if their device has addressing limitations. They
87 * do so via pci_dma_supported, and pass in a mask of
88 * DMA address bits their device can actually drive.
89 *
90 * The test for being usable is:
91 * (device_mask & dma_addr_mask) == dma_addr_mask
92 */
93 u32 dma_addr_mask;
94};
95
96extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
97
98/* This describes a PCI bus module's streaming buffer. */
99struct pci_strbuf {
100 int strbuf_enabled; /* Present and using it? */
101
102 /* Streaming Buffer Control Registers */
103 unsigned long strbuf_control; /* STC control register */
104 unsigned long strbuf_pflush; /* STC page flush register */
105 unsigned long strbuf_fsync; /* STC flush synchronization reg */
106 unsigned long strbuf_ctxflush; /* STC context flush register */
107 unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */
108 unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */
109 volatile unsigned long *strbuf_flushflag; /* The flush flag itself */
110
111 /* And this is the actual flush flag area.
112 * We allocate extra because the chips require
113 * a 64-byte aligned area.
114 */
115 volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)];
116};
117 33
118#define PCI_STC_FLUSHFLAG_INIT(STC) \ 34#define PCI_STC_FLUSHFLAG_INIT(STC) \
119 (*((STC)->strbuf_flushflag) = 0UL) 35 (*((STC)->strbuf_flushflag) = 0UL)
@@ -126,6 +42,8 @@ struct pci_strbuf {
126#define PROM_PCIRNG_MAX 64 42#define PROM_PCIRNG_MAX 64
127#define PROM_PCIIMAP_MAX 64 43#define PROM_PCIIMAP_MAX 64
128 44
45struct pci_controller_info;
46
129struct pci_pbm_info { 47struct pci_pbm_info {
130 /* PCI controller we sit under. */ 48 /* PCI controller we sit under. */
131 struct pci_controller_info *parent; 49 struct pci_controller_info *parent;
@@ -160,11 +78,6 @@ struct pci_pbm_info {
160 78
161 /* OBP specific information. */ 79 /* OBP specific information. */
162 struct device_node *prom_node; 80 struct device_node *prom_node;
163 struct linux_prom_pci_ranges *pbm_ranges;
164 int num_pbm_ranges;
165 struct linux_prom_pci_intmap *pbm_intmap;
166 int num_pbm_intmap;
167 struct linux_prom_pci_intmask *pbm_intmask;
168 u64 ino_bitmap; 81 u64 ino_bitmap;
169 82
170 /* PBM I/O and Memory space resources. */ 83 /* PBM I/O and Memory space resources. */
@@ -197,13 +110,10 @@ struct pci_pbm_info {
197#endif /* !(CONFIG_PCI_MSI) */ 110#endif /* !(CONFIG_PCI_MSI) */
198 111
199 /* This PBM's streaming buffer. */ 112 /* This PBM's streaming buffer. */
200 struct pci_strbuf stc; 113 struct strbuf stc;
201 114
202 /* IOMMU state, potentially shared by both PBM segments. */ 115 /* IOMMU state, potentially shared by both PBM segments. */
203 struct pci_iommu *iommu; 116 struct iommu *iommu;
204
205 /* PCI slot mapping. */
206 unsigned int pci_first_slot;
207 117
208 /* Now things for the actual PCI bus probes. */ 118 /* Now things for the actual PCI bus probes. */
209 unsigned int pci_first_busno; 119 unsigned int pci_first_busno;
@@ -220,17 +130,12 @@ struct pci_controller_info {
220 */ 130 */
221 int index; 131 int index;
222 132
223 /* Do the PBMs both exist in the same PCI domain? */
224 int pbms_same_domain;
225
226 /* The PCI bus modules controlled by us. */ 133 /* The PCI bus modules controlled by us. */
227 struct pci_pbm_info pbm_A; 134 struct pci_pbm_info pbm_A;
228 struct pci_pbm_info pbm_B; 135 struct pci_pbm_info pbm_B;
229 136
230 /* Operations which are controller specific. */ 137 /* Operations which are controller specific. */
231 void (*scan_bus)(struct pci_controller_info *); 138 void (*scan_bus)(struct pci_controller_info *);
232 void (*base_address_update)(struct pci_dev *, int);
233 void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *);
234 139
235#ifdef CONFIG_PCI_MSI 140#ifdef CONFIG_PCI_MSI
236 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, 141 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev,
@@ -244,27 +149,4 @@ struct pci_controller_info {
244 unsigned int pci_last_busno; 149 unsigned int pci_last_busno;
245}; 150};
246 151
247/* PCI devices which are not bridges have this placed in their pci_dev
248 * sysdata member. This makes OBP aware PCI device drivers easier to
249 * code.
250 */
251struct pcidev_cookie {
252 struct pci_pbm_info *pbm;
253 struct device_node *prom_node;
254 struct of_device *op;
255 struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
256 int num_prom_regs;
257 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
258 int num_prom_assignments;
259#ifdef CONFIG_PCI_MSI
260 unsigned int msi_num;
261#endif
262};
263
264/* Currently these are the same across all PCI controllers
265 * we support. Someday they may not be...
266 */
267#define PCI_IRQ_IGN 0x000007c0 /* Interrupt Group Number */
268#define PCI_IRQ_INO 0x0000003f /* Interrupt Number */
269
270#endif /* !(__SPARC64_PBM_H) */ 152#endif /* !(__SPARC64_PBM_H) */
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index b14a725b430..47cea16e1ba 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -54,7 +54,7 @@ struct pci_iommu_ops {
54 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int); 54 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int);
55}; 55};
56 56
57extern struct pci_iommu_ops *pci_iommu_ops; 57extern const struct pci_iommu_ops *pci_iommu_ops;
58 58
59/* Allocate and map kernel buffer using consistent mode DMA for a device. 59/* Allocate and map kernel buffer using consistent mode DMA for a device.
60 * hwdev should be valid struct pci_dev pointer for PCI devices. 60 * hwdev should be valid struct pci_dev pointer for PCI devices.
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index 0d3df76aa47..ced8cbde046 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -5,16 +5,6 @@
5 5
6#ifdef CONFIG_SMP 6#ifdef CONFIG_SMP
7 7
8#ifdef CONFIG_MODULES
9# define PERCPU_MODULE_RESERVE 8192
10#else
11# define PERCPU_MODULE_RESERVE 0
12#endif
13
14#define PERCPU_ENOUGH_ROOM \
15 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
16 PERCPU_MODULE_RESERVE)
17
18extern void setup_per_cpu_areas(void); 8extern void setup_per_cpu_areas(void);
19 9
20extern unsigned long __per_cpu_base; 10extern unsigned long __per_cpu_base;
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index b12be7a869f..46705ef47d2 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -737,20 +737,6 @@ extern unsigned long pte_file(pte_t);
737extern pte_t pgoff_to_pte(unsigned long); 737extern pte_t pgoff_to_pte(unsigned long);
738#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 738#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
739 739
740extern unsigned long prom_virt_to_phys(unsigned long, int *);
741
742extern unsigned long sun4u_get_pte(unsigned long);
743
744static inline unsigned long __get_phys(unsigned long addr)
745{
746 return sun4u_get_pte(addr);
747}
748
749static inline int __get_iospace(unsigned long addr)
750{
751 return ((sun4u_get_pte(addr) & 0xf0000000) >> 28);
752}
753
754extern unsigned long *sparc64_valid_addr_bitmap; 740extern unsigned long *sparc64_valid_addr_bitmap;
755 741
756/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 742/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
@@ -791,6 +777,8 @@ extern void pgtable_cache_init(void);
791extern void sun4v_register_fault_status(void); 777extern void sun4v_register_fault_status(void);
792extern void sun4v_ktsb_register(void); 778extern void sun4v_ktsb_register(void);
793 779
780extern unsigned long cmdline_memory_size;
781
794#endif /* !(__ASSEMBLY__) */ 782#endif /* !(__ASSEMBLY__) */
795 783
796#endif /* !(_SPARC64_PGTABLE_H) */ 784#endif /* !(_SPARC64_PGTABLE_H) */
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 0eca2d98627..ddad5f99ac7 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -36,8 +36,8 @@ struct property {
36 36
37struct of_irq_controller; 37struct of_irq_controller;
38struct device_node { 38struct device_node {
39 char *name; 39 const char *name;
40 char *type; 40 const char *type;
41 phandle node; 41 phandle node;
42 char *path_component_name; 42 char *path_component_name;
43 char *full_name; 43 char *full_name;
@@ -93,11 +93,13 @@ extern struct device_node *of_find_node_by_phandle(phandle handle);
93extern struct device_node *of_get_parent(const struct device_node *node); 93extern struct device_node *of_get_parent(const struct device_node *node);
94extern struct device_node *of_get_next_child(const struct device_node *node, 94extern struct device_node *of_get_next_child(const struct device_node *node,
95 struct device_node *prev); 95 struct device_node *prev);
96extern struct property *of_find_property(struct device_node *np, 96extern struct property *of_find_property(const struct device_node *np,
97 const char *name, 97 const char *name,
98 int *lenp); 98 int *lenp);
99extern int of_device_is_compatible(struct device_node *device, const char *); 99extern int of_device_is_compatible(const struct device_node *device,
100extern void *of_get_property(struct device_node *node, const char *name, 100 const char *);
101extern const void *of_get_property(const struct device_node *node,
102 const char *name,
101 int *lenp); 103 int *lenp);
102#define get_property(node,name,lenp) of_get_property(node,name,lenp) 104#define get_property(node,name,lenp) of_get_property(node,name,lenp)
103extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 105extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h
index ec4f3c63fe9..048fdb40e81 100644
--- a/include/asm-sparc64/scatterlist.h
+++ b/include/asm-sparc64/scatterlist.h
@@ -3,6 +3,7 @@
3#define _SPARC64_SCATTERLIST_H 3#define _SPARC64_SCATTERLIST_H
4 4
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/types.h>
6 7
7struct scatterlist { 8struct scatterlist {
8 struct page *page; 9 struct page *page;
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 388249b751c..cca54804b72 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -42,15 +42,15 @@ extern int hard_smp_processor_id(void);
42#define raw_smp_processor_id() (current_thread_info()->cpu) 42#define raw_smp_processor_id() (current_thread_info()->cpu)
43 43
44extern void smp_setup_cpu_possible_map(void); 44extern void smp_setup_cpu_possible_map(void);
45extern unsigned char boot_cpu_id;
45 46
46#endif /* !(__ASSEMBLY__) */ 47#endif /* !(__ASSEMBLY__) */
47 48
48#else 49#else
49 50
50#define smp_setup_cpu_possible_map() do { } while (0) 51#define smp_setup_cpu_possible_map() do { } while (0)
52#define boot_cpu_id (0)
51 53
52#endif /* !(CONFIG_SMP) */ 54#endif /* !(CONFIG_SMP) */
53 55
54#define NO_PROC_ID 0xFF
55
56#endif /* !(_SPARC64_SMP_H) */ 56#endif /* !(_SPARC64_SMP_H) */
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 754d46a50af..986441dcb8f 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f 51#define SO_PASSSEC 0x001f
52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53/* Security levels - as per NRL IPv6 - don't actually do anything */ 55/* Security levels - as per NRL IPv6 - don't actually do anything */
54#define SO_SECURITY_AUTHENTICATION 0x5001 56#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc64/sockios.h b/include/asm-sparc64/sockios.h
index 6735bab4f39..c7d9900638d 100644
--- a/include/asm-sparc64/sockios.h
+++ b/include/asm-sparc64/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* !(_ASM_SPARC64_SOCKIOS_H) */ 13#endif /* !(_ASM_SPARC64_SOCKIOS_H) */
13 14
diff --git a/include/asm-sparc64/sparsemem.h b/include/asm-sparc64/sparsemem.h
index ed5c9d8541e..77bcd2bfa53 100644
--- a/include/asm-sparc64/sparsemem.h
+++ b/include/asm-sparc64/sparsemem.h
@@ -3,7 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#define SECTION_SIZE_BITS 26 6#define SECTION_SIZE_BITS 31
7#define MAX_PHYSADDR_BITS 42 7#define MAX_PHYSADDR_BITS 42
8#define MAX_PHYSMEM_BITS 42 8#define MAX_PHYSMEM_BITS 42
9 9
diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h
index d435594df78..ccbd6944886 100644
--- a/include/asm-sparc64/timer.h
+++ b/include/asm-sparc64/timer.h
@@ -11,22 +11,19 @@
11 11
12 12
13struct sparc64_tick_ops { 13struct sparc64_tick_ops {
14 void (*init_tick)(unsigned long);
15 unsigned long (*get_tick)(void); 14 unsigned long (*get_tick)(void);
16 unsigned long (*get_compare)(void); 15 int (*add_compare)(unsigned long);
17 unsigned long (*add_tick)(unsigned long, unsigned long);
18 unsigned long (*add_compare)(unsigned long);
19 unsigned long softint_mask; 16 unsigned long softint_mask;
17 void (*disable_irq)(void);
18
19 void (*init_tick)(void);
20 unsigned long (*add_tick)(unsigned long);
21
22 char *name;
20}; 23};
21 24
22extern struct sparc64_tick_ops *tick_ops; 25extern struct sparc64_tick_ops *tick_ops;
23 26
24#ifdef CONFIG_SMP
25extern unsigned long timer_tick_offset;
26struct pt_regs;
27extern void timer_tick_interrupt(struct pt_regs *);
28#endif
29
30extern unsigned long sparc64_get_clock_tick(unsigned int cpu); 27extern unsigned long sparc64_get_clock_tick(unsigned int cpu);
31 28
32#endif /* _SPARC64_TIMER_H */ 29#endif /* _SPARC64_TIMER_H */
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index c2a16e18849..bbb9c8f13d6 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -157,23 +157,6 @@
157 ba,a,pt %xcc, rtrap_irq; \ 157 ba,a,pt %xcc, rtrap_irq; \
158 .previous; 158 .previous;
159 159
160#define TICK_SMP_IRQ \
161 rdpr %pil, %g2; \
162 wrpr %g0, 15, %pil; \
163 sethi %hi(1f-4), %g7; \
164 ba,pt %xcc, etrap_irq; \
165 or %g7, %lo(1f-4), %g7; \
166 nop; \
167 nop; \
168 nop; \
169 .subsection 2; \
1701: call trace_hardirqs_off; \
171 nop; \
172 call smp_percpu_timer_interrupt; \
173 add %sp, PTREGS_OFF, %o0; \
174 ba,a,pt %xcc, rtrap_irq; \
175 .previous;
176
177#else 160#else
178 161
179#define TRAP_IRQ(routine, level) \ 162#define TRAP_IRQ(routine, level) \
@@ -186,16 +169,6 @@
186 add %sp, PTREGS_OFF, %o1; \ 169 add %sp, PTREGS_OFF, %o1; \
187 ba,a,pt %xcc, rtrap_irq; 170 ba,a,pt %xcc, rtrap_irq;
188 171
189#define TICK_SMP_IRQ \
190 rdpr %pil, %g2; \
191 wrpr %g0, 15, %pil; \
192 sethi %hi(109f), %g7; \
193 ba,pt %xcc, etrap_irq; \
194109: or %g7, %lo(109b), %g7; \
195 call smp_percpu_timer_interrupt; \
196 add %sp, PTREGS_OFF, %o0; \
197 ba,a,pt %xcc, rtrap_irq;
198
199#endif 172#endif
200 173
201#define TRAP_IVEC TRAP_NOSAVE(do_ivec) 174#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h
index 1e17f7409ca..7b73b2cd5b3 100644
--- a/include/asm-um/div64.h
+++ b/include/asm-um/div64.h
@@ -3,4 +3,5 @@
3 3
4#include "asm/arch/div64.h" 4#include "asm/arch/div64.h"
5 5
6extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
6#endif 7#endif
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index f709c784bf1..9aa4b44e8cc 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -6,6 +6,8 @@
6#ifndef __UM_MMU_CONTEXT_H 6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H 7#define __UM_MMU_CONTEXT_H
8 8
9#include <asm-generic/mm_hooks.h>
10
9#include "linux/sched.h" 11#include "linux/sched.h"
10#include "choose-mode.h" 12#include "choose-mode.h"
11#include "um_mmu.h" 13#include "um_mmu.h"
diff --git a/include/asm-v850/mmu_context.h b/include/asm-v850/mmu_context.h
index f521c8050d3..01daacd5474 100644
--- a/include/asm-v850/mmu_context.h
+++ b/include/asm-v850/mmu_context.h
@@ -1,6 +1,8 @@
1#ifndef __V850_MMU_CONTEXT_H__ 1#ifndef __V850_MMU_CONTEXT_H__
2#define __V850_MMU_CONTEXT_H__ 2#define __V850_MMU_CONTEXT_H__
3 3
4#include <asm-generic/mm_hooks.h>
5
4#define destroy_context(mm) ((void)0) 6#define destroy_context(mm) ((void)0)
5#define init_new_context(tsk,mm) 0 7#define init_new_context(tsk,mm) 0
6#define switch_mm(prev,next,tsk) ((void)0) 8#define switch_mm(prev,next,tsk) ((void)0)
diff --git a/include/asm-v850/scatterlist.h b/include/asm-v850/scatterlist.h
index af1cba69a52..56f402920db 100644
--- a/include/asm-v850/scatterlist.h
+++ b/include/asm-v850/scatterlist.h
@@ -14,6 +14,8 @@
14#ifndef __V850_SCATTERLIST_H__ 14#ifndef __V850_SCATTERLIST_H__
15#define __V850_SCATTERLIST_H__ 15#define __V850_SCATTERLIST_H__
16 16
17#include <asm/types.h>
18
17struct scatterlist { 19struct scatterlist {
18 struct page *page; 20 struct page *page;
19 unsigned offset; 21 unsigned offset;
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index 0dfe55ac2ef..a4c2493b025 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __V850_SOCKET_H__ */ 55#endif /* __V850_SOCKET_H__ */
diff --git a/include/asm-v850/sockios.h b/include/asm-v850/sockios.h
index cf4874c2fd8..823e106e6cd 100644
--- a/include/asm-v850/sockios.h
+++ b/include/asm-v850/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __V850_SOCKIOS_H__ */ 13#endif /* __V850_SOCKIOS_H__ */
diff --git a/include/asm-x86_64/Kbuild b/include/asm-x86_64/Kbuild
index ebd7117782a..89ad1fc27c8 100644
--- a/include/asm-x86_64/Kbuild
+++ b/include/asm-x86_64/Kbuild
@@ -8,7 +8,7 @@ header-y += boot.h
8header-y += bootsetup.h 8header-y += bootsetup.h
9header-y += debugreg.h 9header-y += debugreg.h
10header-y += ldt.h 10header-y += ldt.h
11header-y += msr.h 11header-y += msr-index.h
12header-y += prctl.h 12header-y += prctl.h
13header-y += ptrace-abi.h 13header-y += ptrace-abi.h
14header-y += sigcontext32.h 14header-y += sigcontext32.h
@@ -16,5 +16,7 @@ header-y += ucontext.h
16header-y += vsyscall32.h 16header-y += vsyscall32.h
17 17
18unifdef-y += mce.h 18unifdef-y += mce.h
19unifdef-y += msr.h
19unifdef-y += mtrr.h 20unifdef-y += mtrr.h
20unifdef-y += vsyscall.h 21unifdef-y += vsyscall.h
22unifdef-y += const.h
diff --git a/include/asm-x86_64/agp.h b/include/asm-x86_64/agp.h
index 06c52ee9c06..de338666f3f 100644
--- a/include/asm-x86_64/agp.h
+++ b/include/asm-x86_64/agp.h
@@ -10,8 +10,10 @@
10 * with different cachability attributes for the same page. 10 * with different cachability attributes for the same page.
11 */ 11 */
12 12
13int map_page_into_agp(struct page *page); 13/* Caller's responsibility to call global_flush_tlb() for
14int unmap_page_from_agp(struct page *page); 14 * performance reasons */
15#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)
16#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL)
15#define flush_agp_mappings() global_flush_tlb() 17#define flush_agp_mappings() global_flush_tlb()
16 18
17/* Could use CLFLUSH here if the cpu supports it. But then it would 19/* Could use CLFLUSH here if the cpu supports it. But then it would
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h
index a6657b4f3e0..a09fe85c268 100644
--- a/include/asm-x86_64/alternative.h
+++ b/include/asm-x86_64/alternative.h
@@ -16,6 +16,7 @@ struct alt_instr {
16 u8 pad[5]; 16 u8 pad[5];
17}; 17};
18 18
19extern void alternative_instructions(void);
19extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); 20extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
20 21
21struct module; 22struct module;
@@ -141,8 +142,8 @@ void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end);
141static inline void 142static inline void
142apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end) 143apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end)
143{} 144{}
144#define __start_parainstructions NULL 145#define __parainstructions NULL
145#define __stop_parainstructions NULL 146#define __parainstructions_end NULL
146#endif 147#endif
147 148
148#endif /* _X86_64_ALTERNATIVE_H */ 149#endif /* _X86_64_ALTERNATIVE_H */
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index 7cfb39cbd91..45e9fca1feb 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -2,6 +2,7 @@
2#define __ASM_APIC_H 2#define __ASM_APIC_H
3 3
4#include <linux/pm.h> 4#include <linux/pm.h>
5#include <linux/delay.h>
5#include <asm/fixmap.h> 6#include <asm/fixmap.h>
6#include <asm/apicdef.h> 7#include <asm/apicdef.h>
7#include <asm/system.h> 8#include <asm/system.h>
@@ -47,11 +48,8 @@ static __inline unsigned int apic_read(unsigned long reg)
47 return *((volatile unsigned int *)(APIC_BASE+reg)); 48 return *((volatile unsigned int *)(APIC_BASE+reg));
48} 49}
49 50
50static __inline__ void apic_wait_icr_idle(void) 51extern void apic_wait_icr_idle(void);
51{ 52extern unsigned int safe_apic_wait_icr_idle(void);
52 while (apic_read( APIC_ICR ) & APIC_ICR_BUSY)
53 cpu_relax();
54}
55 53
56static inline void ack_APIC_irq(void) 54static inline void ack_APIC_irq(void)
57{ 55{
@@ -83,7 +81,7 @@ extern void setup_secondary_APIC_clock (void);
83extern int APIC_init_uniprocessor (void); 81extern int APIC_init_uniprocessor (void);
84extern void disable_APIC_timer(void); 82extern void disable_APIC_timer(void);
85extern void enable_APIC_timer(void); 83extern void enable_APIC_timer(void);
86extern void clustered_apic_check(void); 84extern void setup_apic_routing(void);
87 85
88extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector, 86extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
89 unsigned char msg_type, unsigned char mask); 87 unsigned char msg_type, unsigned char mask);
diff --git a/include/asm-x86_64/bugs.h b/include/asm-x86_64/bugs.h
index d86c5dd689f..b33dc04d8f4 100644
--- a/include/asm-x86_64/bugs.h
+++ b/include/asm-x86_64/bugs.h
@@ -1,28 +1,6 @@
1/* 1#ifndef _ASM_X86_64_BUGS_H
2 * include/asm-x86_64/bugs.h 2#define _ASM_X86_64_BUGS_H
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 * Copyright (C) 2000 SuSE
6 *
7 * This is included by init/main.c to check for architecture-dependent bugs.
8 *
9 * Needs:
10 * void check_bugs(void);
11 */
12 3
13#include <asm/processor.h> 4void check_bugs(void);
14#include <asm/i387.h>
15#include <asm/msr.h>
16#include <asm/pda.h>
17 5
18extern void alternative_instructions(void); 6#endif /* _ASM_X86_64_BUGS_H */
19
20static void __init check_bugs(void)
21{
22 identify_cpu(&boot_cpu_data);
23#if !defined(CONFIG_SMP)
24 printk("CPU: ");
25 print_cpu_info(&boot_cpu_data);
26#endif
27 alternative_instructions();
28}
diff --git a/include/asm-x86_64/const.h b/include/asm-x86_64/const.h
new file mode 100644
index 00000000000..54fb08f3db9
--- /dev/null
+++ b/include/asm-x86_64/const.h
@@ -0,0 +1,20 @@
1/* const.h: Macros for dealing with constants. */
2
3#ifndef _X86_64_CONST_H
4#define _X86_64_CONST_H
5
6/* Some constant macros are used in both assembler and
7 * C code. Therefore we cannot annotate them always with
8 * 'UL' and other type specificers unilaterally. We
9 * use the following macros to deal with this.
10 */
11
12#ifdef __ASSEMBLY__
13#define _AC(X,Y) X
14#else
15#define __AC(X,Y) (X##Y)
16#define _AC(X,Y) __AC(X,Y)
17#endif
18
19
20#endif /* !(_X86_64_CONST_H) */
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
index 913d6ac0003..ac991b5ca0f 100644
--- a/include/asm-x86_64/desc.h
+++ b/include/asm-x86_64/desc.h
@@ -107,16 +107,6 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
107 DESC_LDT, size * 8 - 1); 107 DESC_LDT, size * 8 - 1);
108} 108}
109 109
110static inline void set_seg_base(unsigned cpu, int entry, void *base)
111{
112 struct desc_struct *d = &cpu_gdt(cpu)[entry];
113 u32 addr = (u32)(u64)base;
114 BUG_ON((u64)base >> 32);
115 d->base0 = addr & 0xffff;
116 d->base1 = (addr >> 16) & 0xff;
117 d->base2 = (addr >> 24) & 0xff;
118}
119
120#define LDT_entry_a(info) \ 110#define LDT_entry_a(info) \
121 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) 111 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
122/* Don't allow setting of the lm bit. It is useless anyways because 112/* Don't allow setting of the lm bit. It is useless anyways because
@@ -145,16 +135,13 @@ static inline void set_seg_base(unsigned cpu, int entry, void *base)
145 (info)->useable == 0 && \ 135 (info)->useable == 0 && \
146 (info)->lm == 0) 136 (info)->lm == 0)
147 137
148#if TLS_SIZE != 24
149# error update this code.
150#endif
151
152static inline void load_TLS(struct thread_struct *t, unsigned int cpu) 138static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
153{ 139{
140 unsigned int i;
154 u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN); 141 u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN);
155 gdt[0] = t->tls_array[0]; 142
156 gdt[1] = t->tls_array[1]; 143 for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
157 gdt[2] = t->tls_array[2]; 144 gdt[i] = t->tls_array[i];
158} 145}
159 146
160/* 147/*
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index d2af227f06d..6897e2a436e 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -52,7 +52,7 @@ struct dma_mapping_ops {
52}; 52};
53 53
54extern dma_addr_t bad_dma_address; 54extern dma_addr_t bad_dma_address;
55extern struct dma_mapping_ops* dma_ops; 55extern const struct dma_mapping_ops* dma_ops;
56extern int iommu_merge; 56extern int iommu_merge;
57 57
58static inline int dma_mapping_error(dma_addr_t dma_addr) 58static inline int dma_mapping_error(dma_addr_t dma_addr)
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
index 1b620db5b9e..e90e1677531 100644
--- a/include/asm-x86_64/fixmap.h
+++ b/include/asm-x86_64/fixmap.h
@@ -15,7 +15,6 @@
15#include <asm/apicdef.h> 15#include <asm/apicdef.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/vsyscall.h> 17#include <asm/vsyscall.h>
18#include <asm/vsyscall32.h>
19 18
20/* 19/*
21 * Here we define all the compile-time 'special' virtual 20 * Here we define all the compile-time 'special' virtual
diff --git a/include/asm-x86_64/genapic.h b/include/asm-x86_64/genapic.h
index b80f4bb5f27..d7e516ccbaa 100644
--- a/include/asm-x86_64/genapic.h
+++ b/include/asm-x86_64/genapic.h
@@ -29,7 +29,9 @@ struct genapic {
29 unsigned int (*phys_pkg_id)(int index_msb); 29 unsigned int (*phys_pkg_id)(int index_msb);
30}; 30};
31 31
32extern struct genapic *genapic;
32 33
33extern struct genapic *genapic, *genapic_force, apic_flat; 34extern struct genapic apic_flat;
35extern struct genapic apic_physflat;
34 36
35#endif 37#endif
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h
index 2a5c162b7d9..a7c75ea408a 100644
--- a/include/asm-x86_64/ipi.h
+++ b/include/asm-x86_64/ipi.h
@@ -18,10 +18,8 @@
18 * Subject to the GNU Public License, v.2 18 * Subject to the GNU Public License, v.2
19 */ 19 */
20 20
21#include <asm/fixmap.h>
22#include <asm/hw_irq.h> 21#include <asm/hw_irq.h>
23#include <asm/apicdef.h> 22#include <asm/apic.h>
24#include <asm/genapic.h>
25 23
26/* 24/*
27 * the following functions deal with sending IPIs between CPUs. 25 * the following functions deal with sending IPIs between CPUs.
@@ -76,10 +74,42 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, unsign
76 apic_write(APIC_ICR, cfg); 74 apic_write(APIC_ICR, cfg);
77} 75}
78 76
77/*
78 * This is used to send an IPI with no shorthand notation (the destination is
79 * specified in bits 56 to 63 of the ICR).
80 */
81static inline void __send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest)
82{
83 unsigned long cfg;
84
85 /*
86 * Wait for idle.
87 */
88 if (unlikely(vector == NMI_VECTOR))
89 safe_apic_wait_icr_idle();
90 else
91 apic_wait_icr_idle();
92
93 /*
94 * prepare target chip field
95 */
96 cfg = __prepare_ICR2(mask);
97 apic_write(APIC_ICR2, cfg);
98
99 /*
100 * program the ICR
101 */
102 cfg = __prepare_ICR(0, vector, dest);
103
104 /*
105 * Send the IPI. The write to APIC_ICR fires this off.
106 */
107 apic_write(APIC_ICR, cfg);
108}
79 109
80static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) 110static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
81{ 111{
82 unsigned long cfg, flags; 112 unsigned long flags;
83 unsigned long query_cpu; 113 unsigned long query_cpu;
84 114
85 /* 115 /*
@@ -88,28 +118,9 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
88 * - mbligh 118 * - mbligh
89 */ 119 */
90 local_irq_save(flags); 120 local_irq_save(flags);
91
92 for_each_cpu_mask(query_cpu, mask) { 121 for_each_cpu_mask(query_cpu, mask) {
93 /* 122 __send_IPI_dest_field(x86_cpu_to_apicid[query_cpu],
94 * Wait for idle. 123 vector, APIC_DEST_PHYSICAL);
95 */
96 apic_wait_icr_idle();
97
98 /*
99 * prepare target chip field
100 */
101 cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]);
102 apic_write(APIC_ICR2, cfg);
103
104 /*
105 * program the ICR
106 */
107 cfg = __prepare_ICR(0, vector, APIC_DEST_PHYSICAL);
108
109 /*
110 * Send the IPI. The write to APIC_ICR fires this off.
111 */
112 apic_write(APIC_ICR, cfg);
113 } 124 }
114 local_irq_restore(flags); 125 local_irq_restore(flags);
115} 126}
diff --git a/include/asm-x86_64/irqflags.h b/include/asm-x86_64/irqflags.h
index cce6937e87c..86e70fe2365 100644
--- a/include/asm-x86_64/irqflags.h
+++ b/include/asm-x86_64/irqflags.h
@@ -9,6 +9,7 @@
9 */ 9 */
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12#include <asm/processor-flags.h>
12 13
13#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
14/* 15/*
@@ -53,19 +54,19 @@ static inline void raw_local_irq_disable(void)
53{ 54{
54 unsigned long flags = __raw_local_save_flags(); 55 unsigned long flags = __raw_local_save_flags();
55 56
56 raw_local_irq_restore((flags & ~(1 << 9)) | (1 << 18)); 57 raw_local_irq_restore((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
57} 58}
58 59
59static inline void raw_local_irq_enable(void) 60static inline void raw_local_irq_enable(void)
60{ 61{
61 unsigned long flags = __raw_local_save_flags(); 62 unsigned long flags = __raw_local_save_flags();
62 63
63 raw_local_irq_restore((flags | (1 << 9)) & ~(1 << 18)); 64 raw_local_irq_restore((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
64} 65}
65 66
66static inline int raw_irqs_disabled_flags(unsigned long flags) 67static inline int raw_irqs_disabled_flags(unsigned long flags)
67{ 68{
68 return !(flags & (1<<9)) || (flags & (1 << 18)); 69 return !(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC);
69} 70}
70 71
71#else /* CONFIG_X86_VSMP */ 72#else /* CONFIG_X86_VSMP */
@@ -82,7 +83,7 @@ static inline void raw_local_irq_enable(void)
82 83
83static inline int raw_irqs_disabled_flags(unsigned long flags) 84static inline int raw_irqs_disabled_flags(unsigned long flags)
84{ 85{
85 return !(flags & (1 << 9)); 86 return !(flags & X86_EFLAGS_IF);
86} 87}
87 88
88#endif 89#endif
diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h
index af03b9f852d..0cce83a7837 100644
--- a/include/asm-x86_64/mmu_context.h
+++ b/include/asm-x86_64/mmu_context.h
@@ -7,6 +7,7 @@
7#include <asm/pda.h> 7#include <asm/pda.h>
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9#include <asm/tlbflush.h> 9#include <asm/tlbflush.h>
10#include <asm-generic/mm_hooks.h>
10 11
11/* 12/*
12 * possibly do the LDT unload here? 13 * possibly do the LDT unload here?
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index fb558fb1d21..19a89377b12 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -49,7 +49,7 @@ extern int pfn_valid(unsigned long pfn);
49 49
50#ifdef CONFIG_NUMA_EMU 50#ifdef CONFIG_NUMA_EMU
51#define FAKE_NODE_MIN_SIZE (64*1024*1024) 51#define FAKE_NODE_MIN_SIZE (64*1024*1024)
52#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1ul)) 52#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1uL))
53#endif 53#endif
54 54
55#endif 55#endif
diff --git a/include/asm-x86_64/msr-index.h b/include/asm-x86_64/msr-index.h
new file mode 100644
index 00000000000..d77a63f1ddf
--- /dev/null
+++ b/include/asm-x86_64/msr-index.h
@@ -0,0 +1 @@
#include <asm-i386/msr-index.h>
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index 902f9a58617..a524f032567 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -1,6 +1,8 @@
1#ifndef X86_64_MSR_H 1#ifndef X86_64_MSR_H
2#define X86_64_MSR_H 1 2#define X86_64_MSR_H 1
3 3
4#include <asm/msr-index.h>
5
4#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
5/* 7/*
6 * Access to machine-specific registers (available on 586 and better only) 8 * Access to machine-specific registers (available on 586 and better only)
@@ -157,9 +159,6 @@ static inline unsigned int cpuid_edx(unsigned int op)
157 return edx; 159 return edx;
158} 160}
159 161
160#define MSR_IA32_UCODE_WRITE 0x79
161#define MSR_IA32_UCODE_REV 0x8b
162
163#ifdef CONFIG_SMP 162#ifdef CONFIG_SMP
164void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 163void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
165void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 164void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
@@ -172,269 +171,6 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
172{ 171{
173 wrmsr(msr_no, l, h); 172 wrmsr(msr_no, l, h);
174} 173}
175#endif /* CONFIG_SMP */ 174#endif /* CONFIG_SMP */
176 175#endif /* __ASSEMBLY__ */
177#endif 176#endif /* X86_64_MSR_H */
178
179/* AMD/K8 specific MSRs */
180#define MSR_EFER 0xc0000080 /* extended feature register */
181#define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target */
182#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */
183#define MSR_CSTAR 0xc0000083 /* compatibility mode SYSCALL target */
184#define MSR_SYSCALL_MASK 0xc0000084 /* EFLAGS mask for syscall */
185#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */
186#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */
187#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow (or USER_GS from kernel) */
188/* EFER bits: */
189#define _EFER_SCE 0 /* SYSCALL/SYSRET */
190#define _EFER_LME 8 /* Long mode enable */
191#define _EFER_LMA 10 /* Long mode active (read-only) */
192#define _EFER_NX 11 /* No execute enable */
193
194#define EFER_SCE (1<<_EFER_SCE)
195#define EFER_LME (1<<_EFER_LME)
196#define EFER_LMA (1<<_EFER_LMA)
197#define EFER_NX (1<<_EFER_NX)
198
199/* Intel MSRs. Some also available on other CPUs */
200#define MSR_IA32_TSC 0x10
201#define MSR_IA32_PLATFORM_ID 0x17
202
203#define MSR_IA32_PERFCTR0 0xc1
204#define MSR_IA32_PERFCTR1 0xc2
205#define MSR_FSB_FREQ 0xcd
206
207#define MSR_MTRRcap 0x0fe
208#define MSR_IA32_BBL_CR_CTL 0x119
209
210#define MSR_IA32_SYSENTER_CS 0x174
211#define MSR_IA32_SYSENTER_ESP 0x175
212#define MSR_IA32_SYSENTER_EIP 0x176
213
214#define MSR_IA32_MCG_CAP 0x179
215#define MSR_IA32_MCG_STATUS 0x17a
216#define MSR_IA32_MCG_CTL 0x17b
217
218#define MSR_IA32_EVNTSEL0 0x186
219#define MSR_IA32_EVNTSEL1 0x187
220
221#define MSR_IA32_DEBUGCTLMSR 0x1d9
222#define MSR_IA32_LASTBRANCHFROMIP 0x1db
223#define MSR_IA32_LASTBRANCHTOIP 0x1dc
224#define MSR_IA32_LASTINTFROMIP 0x1dd
225#define MSR_IA32_LASTINTTOIP 0x1de
226
227#define MSR_IA32_PEBS_ENABLE 0x3f1
228#define MSR_IA32_DS_AREA 0x600
229#define MSR_IA32_PERF_CAPABILITIES 0x345
230
231#define MSR_MTRRfix64K_00000 0x250
232#define MSR_MTRRfix16K_80000 0x258
233#define MSR_MTRRfix16K_A0000 0x259
234#define MSR_MTRRfix4K_C0000 0x268
235#define MSR_MTRRfix4K_C8000 0x269
236#define MSR_MTRRfix4K_D0000 0x26a
237#define MSR_MTRRfix4K_D8000 0x26b
238#define MSR_MTRRfix4K_E0000 0x26c
239#define MSR_MTRRfix4K_E8000 0x26d
240#define MSR_MTRRfix4K_F0000 0x26e
241#define MSR_MTRRfix4K_F8000 0x26f
242#define MSR_MTRRdefType 0x2ff
243
244#define MSR_IA32_MC0_CTL 0x400
245#define MSR_IA32_MC0_STATUS 0x401
246#define MSR_IA32_MC0_ADDR 0x402
247#define MSR_IA32_MC0_MISC 0x403
248
249#define MSR_P6_PERFCTR0 0xc1
250#define MSR_P6_PERFCTR1 0xc2
251#define MSR_P6_EVNTSEL0 0x186
252#define MSR_P6_EVNTSEL1 0x187
253
254/* K7/K8 MSRs. Not complete. See the architecture manual for a more complete list. */
255#define MSR_K7_EVNTSEL0 0xC0010000
256#define MSR_K7_PERFCTR0 0xC0010004
257#define MSR_K7_EVNTSEL1 0xC0010001
258#define MSR_K7_PERFCTR1 0xC0010005
259#define MSR_K7_EVNTSEL2 0xC0010002
260#define MSR_K7_PERFCTR2 0xC0010006
261#define MSR_K7_EVNTSEL3 0xC0010003
262#define MSR_K7_PERFCTR3 0xC0010007
263#define MSR_K8_TOP_MEM1 0xC001001A
264#define MSR_K8_TOP_MEM2 0xC001001D
265#define MSR_K8_SYSCFG 0xC0010010
266#define MSR_K8_HWCR 0xC0010015
267
268/* K6 MSRs */
269#define MSR_K6_EFER 0xC0000080
270#define MSR_K6_STAR 0xC0000081
271#define MSR_K6_WHCR 0xC0000082
272#define MSR_K6_UWCCR 0xC0000085
273#define MSR_K6_PSOR 0xC0000087
274#define MSR_K6_PFIR 0xC0000088
275
276/* Centaur-Hauls/IDT defined MSRs. */
277#define MSR_IDT_FCR1 0x107
278#define MSR_IDT_FCR2 0x108
279#define MSR_IDT_FCR3 0x109
280#define MSR_IDT_FCR4 0x10a
281
282#define MSR_IDT_MCR0 0x110
283#define MSR_IDT_MCR1 0x111
284#define MSR_IDT_MCR2 0x112
285#define MSR_IDT_MCR3 0x113
286#define MSR_IDT_MCR4 0x114
287#define MSR_IDT_MCR5 0x115
288#define MSR_IDT_MCR6 0x116
289#define MSR_IDT_MCR7 0x117
290#define MSR_IDT_MCR_CTRL 0x120
291
292/* VIA Cyrix defined MSRs*/
293#define MSR_VIA_FCR 0x1107
294#define MSR_VIA_LONGHAUL 0x110a
295#define MSR_VIA_RNG 0x110b
296#define MSR_VIA_BCR2 0x1147
297
298/* Intel defined MSRs. */
299#define MSR_IA32_P5_MC_ADDR 0
300#define MSR_IA32_P5_MC_TYPE 1
301#define MSR_IA32_PLATFORM_ID 0x17
302#define MSR_IA32_EBL_CR_POWERON 0x2a
303
304#define MSR_IA32_APICBASE 0x1b
305#define MSR_IA32_APICBASE_BSP (1<<8)
306#define MSR_IA32_APICBASE_ENABLE (1<<11)
307#define MSR_IA32_APICBASE_BASE (0xfffff<<12)
308
309/* P4/Xeon+ specific */
310#define MSR_IA32_MCG_EAX 0x180
311#define MSR_IA32_MCG_EBX 0x181
312#define MSR_IA32_MCG_ECX 0x182
313#define MSR_IA32_MCG_EDX 0x183
314#define MSR_IA32_MCG_ESI 0x184
315#define MSR_IA32_MCG_EDI 0x185
316#define MSR_IA32_MCG_EBP 0x186
317#define MSR_IA32_MCG_ESP 0x187
318#define MSR_IA32_MCG_EFLAGS 0x188
319#define MSR_IA32_MCG_EIP 0x189
320#define MSR_IA32_MCG_RESERVED 0x18A
321
322#define MSR_P6_EVNTSEL0 0x186
323#define MSR_P6_EVNTSEL1 0x187
324
325#define MSR_IA32_PERF_STATUS 0x198
326#define MSR_IA32_PERF_CTL 0x199
327
328#define MSR_IA32_MPERF 0xE7
329#define MSR_IA32_APERF 0xE8
330
331#define MSR_IA32_THERM_CONTROL 0x19a
332#define MSR_IA32_THERM_INTERRUPT 0x19b
333#define MSR_IA32_THERM_STATUS 0x19c
334#define MSR_IA32_MISC_ENABLE 0x1a0
335
336#define MSR_IA32_DEBUGCTLMSR 0x1d9
337#define MSR_IA32_LASTBRANCHFROMIP 0x1db
338#define MSR_IA32_LASTBRANCHTOIP 0x1dc
339#define MSR_IA32_LASTINTFROMIP 0x1dd
340#define MSR_IA32_LASTINTTOIP 0x1de
341
342#define MSR_IA32_MC0_CTL 0x400
343#define MSR_IA32_MC0_STATUS 0x401
344#define MSR_IA32_MC0_ADDR 0x402
345#define MSR_IA32_MC0_MISC 0x403
346
347/* Pentium IV performance counter MSRs */
348#define MSR_P4_BPU_PERFCTR0 0x300
349#define MSR_P4_BPU_PERFCTR1 0x301
350#define MSR_P4_BPU_PERFCTR2 0x302
351#define MSR_P4_BPU_PERFCTR3 0x303
352#define MSR_P4_MS_PERFCTR0 0x304
353#define MSR_P4_MS_PERFCTR1 0x305
354#define MSR_P4_MS_PERFCTR2 0x306
355#define MSR_P4_MS_PERFCTR3 0x307
356#define MSR_P4_FLAME_PERFCTR0 0x308
357#define MSR_P4_FLAME_PERFCTR1 0x309
358#define MSR_P4_FLAME_PERFCTR2 0x30a
359#define MSR_P4_FLAME_PERFCTR3 0x30b
360#define MSR_P4_IQ_PERFCTR0 0x30c
361#define MSR_P4_IQ_PERFCTR1 0x30d
362#define MSR_P4_IQ_PERFCTR2 0x30e
363#define MSR_P4_IQ_PERFCTR3 0x30f
364#define MSR_P4_IQ_PERFCTR4 0x310
365#define MSR_P4_IQ_PERFCTR5 0x311
366#define MSR_P4_BPU_CCCR0 0x360
367#define MSR_P4_BPU_CCCR1 0x361
368#define MSR_P4_BPU_CCCR2 0x362
369#define MSR_P4_BPU_CCCR3 0x363
370#define MSR_P4_MS_CCCR0 0x364
371#define MSR_P4_MS_CCCR1 0x365
372#define MSR_P4_MS_CCCR2 0x366
373#define MSR_P4_MS_CCCR3 0x367
374#define MSR_P4_FLAME_CCCR0 0x368
375#define MSR_P4_FLAME_CCCR1 0x369
376#define MSR_P4_FLAME_CCCR2 0x36a
377#define MSR_P4_FLAME_CCCR3 0x36b
378#define MSR_P4_IQ_CCCR0 0x36c
379#define MSR_P4_IQ_CCCR1 0x36d
380#define MSR_P4_IQ_CCCR2 0x36e
381#define MSR_P4_IQ_CCCR3 0x36f
382#define MSR_P4_IQ_CCCR4 0x370
383#define MSR_P4_IQ_CCCR5 0x371
384#define MSR_P4_ALF_ESCR0 0x3ca
385#define MSR_P4_ALF_ESCR1 0x3cb
386#define MSR_P4_BPU_ESCR0 0x3b2
387#define MSR_P4_BPU_ESCR1 0x3b3
388#define MSR_P4_BSU_ESCR0 0x3a0
389#define MSR_P4_BSU_ESCR1 0x3a1
390#define MSR_P4_CRU_ESCR0 0x3b8
391#define MSR_P4_CRU_ESCR1 0x3b9
392#define MSR_P4_CRU_ESCR2 0x3cc
393#define MSR_P4_CRU_ESCR3 0x3cd
394#define MSR_P4_CRU_ESCR4 0x3e0
395#define MSR_P4_CRU_ESCR5 0x3e1
396#define MSR_P4_DAC_ESCR0 0x3a8
397#define MSR_P4_DAC_ESCR1 0x3a9
398#define MSR_P4_FIRM_ESCR0 0x3a4
399#define MSR_P4_FIRM_ESCR1 0x3a5
400#define MSR_P4_FLAME_ESCR0 0x3a6
401#define MSR_P4_FLAME_ESCR1 0x3a7
402#define MSR_P4_FSB_ESCR0 0x3a2
403#define MSR_P4_FSB_ESCR1 0x3a3
404#define MSR_P4_IQ_ESCR0 0x3ba
405#define MSR_P4_IQ_ESCR1 0x3bb
406#define MSR_P4_IS_ESCR0 0x3b4
407#define MSR_P4_IS_ESCR1 0x3b5
408#define MSR_P4_ITLB_ESCR0 0x3b6
409#define MSR_P4_ITLB_ESCR1 0x3b7
410#define MSR_P4_IX_ESCR0 0x3c8
411#define MSR_P4_IX_ESCR1 0x3c9
412#define MSR_P4_MOB_ESCR0 0x3aa
413#define MSR_P4_MOB_ESCR1 0x3ab
414#define MSR_P4_MS_ESCR0 0x3c0
415#define MSR_P4_MS_ESCR1 0x3c1
416#define MSR_P4_PMH_ESCR0 0x3ac
417#define MSR_P4_PMH_ESCR1 0x3ad
418#define MSR_P4_RAT_ESCR0 0x3bc
419#define MSR_P4_RAT_ESCR1 0x3bd
420#define MSR_P4_SAAT_ESCR0 0x3ae
421#define MSR_P4_SAAT_ESCR1 0x3af
422#define MSR_P4_SSU_ESCR0 0x3be
423#define MSR_P4_SSU_ESCR1 0x3bf /* guess: not defined in manual */
424#define MSR_P4_TBPU_ESCR0 0x3c2
425#define MSR_P4_TBPU_ESCR1 0x3c3
426#define MSR_P4_TC_ESCR0 0x3c4
427#define MSR_P4_TC_ESCR1 0x3c5
428#define MSR_P4_U2L_ESCR0 0x3b0
429#define MSR_P4_U2L_ESCR1 0x3b1
430
431/* Intel Core-based CPU performance counters */
432#define MSR_CORE_PERF_FIXED_CTR0 0x309
433#define MSR_CORE_PERF_FIXED_CTR1 0x30a
434#define MSR_CORE_PERF_FIXED_CTR2 0x30b
435#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x38d
436#define MSR_CORE_PERF_GLOBAL_STATUS 0x38e
437#define MSR_CORE_PERF_GLOBAL_CTRL 0x38f
438#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x390
439
440#endif
diff --git a/include/asm-x86_64/mtrr.h b/include/asm-x86_64/mtrr.h
index d6135b2549b..b557c486bef 100644
--- a/include/asm-x86_64/mtrr.h
+++ b/include/asm-x86_64/mtrr.h
@@ -135,6 +135,18 @@ struct mtrr_gentry32
135 135
136#endif /* CONFIG_COMPAT */ 136#endif /* CONFIG_COMPAT */
137 137
138#ifdef CONFIG_MTRR
139extern void mtrr_ap_init(void);
140extern void mtrr_bp_init(void);
141extern void mtrr_save_fixed_ranges(void *);
142extern void mtrr_save_state(void);
143#else
144#define mtrr_ap_init() do {} while (0)
145#define mtrr_bp_init() do {} while (0)
146#define mtrr_save_fixed_ranges(arg) do {} while (0)
147#define mtrr_save_state() do {} while (0)
148#endif
149
138#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
139 151
140#endif /* _LINUX_MTRR_H */ 152#endif /* _LINUX_MTRR_H */
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
index 72375e7d32a..d0a7f53b149 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -80,4 +80,13 @@ extern int unknown_nmi_panic;
80void __trigger_all_cpu_backtrace(void); 80void __trigger_all_cpu_backtrace(void);
81#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() 81#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
82 82
83
84void lapic_watchdog_stop(void);
85int lapic_watchdog_init(unsigned nmi_hz);
86int lapic_wd_event(unsigned nmi_hz);
87unsigned lapic_adjust_nmi_hz(unsigned hz);
88int lapic_watchdog_ok(void);
89void disable_lapic_nmi_watchdog(void);
90void enable_lapic_nmi_watchdog(void);
91
83#endif /* ASM_NMI_H */ 92#endif /* ASM_NMI_H */
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 10f346165ca..b17fc16ec2e 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -1,14 +1,11 @@
1#ifndef _X86_64_PAGE_H 1#ifndef _X86_64_PAGE_H
2#define _X86_64_PAGE_H 2#define _X86_64_PAGE_H
3 3
4#include <asm/const.h>
4 5
5/* PAGE_SHIFT determines the page size */ 6/* PAGE_SHIFT determines the page size */
6#define PAGE_SHIFT 12 7#define PAGE_SHIFT 12
7#ifdef __ASSEMBLY__ 8#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
8#define PAGE_SIZE (0x1 << PAGE_SHIFT)
9#else
10#define PAGE_SIZE (1UL << PAGE_SHIFT)
11#endif
12#define PAGE_MASK (~(PAGE_SIZE-1)) 9#define PAGE_MASK (~(PAGE_SIZE-1))
13#define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK) 10#define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK)
14 11
@@ -33,10 +30,10 @@
33#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ 30#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
34 31
35#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) 32#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
36#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) 33#define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT)
37 34
38#define HPAGE_SHIFT PMD_SHIFT 35#define HPAGE_SHIFT PMD_SHIFT
39#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 36#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
40#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 37#define HPAGE_MASK (~(HPAGE_SIZE - 1))
41#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 38#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
42 39
@@ -64,6 +61,8 @@ typedef struct { unsigned long pgd; } pgd_t;
64 61
65typedef struct { unsigned long pgprot; } pgprot_t; 62typedef struct { unsigned long pgprot; } pgprot_t;
66 63
64extern unsigned long phys_base;
65
67#define pte_val(x) ((x).pte) 66#define pte_val(x) ((x).pte)
68#define pmd_val(x) ((x).pmd) 67#define pmd_val(x) ((x).pmd)
69#define pud_val(x) ((x).pud) 68#define pud_val(x) ((x).pud)
@@ -76,29 +75,25 @@ typedef struct { unsigned long pgprot; } pgprot_t;
76#define __pgd(x) ((pgd_t) { (x) } ) 75#define __pgd(x) ((pgd_t) { (x) } )
77#define __pgprot(x) ((pgprot_t) { (x) } ) 76#define __pgprot(x) ((pgprot_t) { (x) } )
78 77
79#define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START) 78#endif /* !__ASSEMBLY__ */
80#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
81#define __START_KERNEL_map 0xffffffff80000000UL
82#define __PAGE_OFFSET 0xffff810000000000UL
83 79
84#else
85#define __PHYSICAL_START CONFIG_PHYSICAL_START 80#define __PHYSICAL_START CONFIG_PHYSICAL_START
81#define __KERNEL_ALIGN 0x200000
86#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) 82#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
87#define __START_KERNEL_map 0xffffffff80000000 83#define __START_KERNEL_map 0xffffffff80000000
88#define __PAGE_OFFSET 0xffff810000000000 84#define __PAGE_OFFSET 0xffff810000000000
89#endif /* !__ASSEMBLY__ */
90 85
91/* to align the pointer to the (next) page boundary */ 86/* to align the pointer to the (next) page boundary */
92#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 87#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
93 88
94/* See Documentation/x86_64/mm.txt for a description of the memory map. */ 89/* See Documentation/x86_64/mm.txt for a description of the memory map. */
95#define __PHYSICAL_MASK_SHIFT 46 90#define __PHYSICAL_MASK_SHIFT 46
96#define __PHYSICAL_MASK ((1UL << __PHYSICAL_MASK_SHIFT) - 1) 91#define __PHYSICAL_MASK ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
97#define __VIRTUAL_MASK_SHIFT 48 92#define __VIRTUAL_MASK_SHIFT 48
98#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) 93#define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
99 94
100#define KERNEL_TEXT_SIZE (40UL*1024*1024) 95#define KERNEL_TEXT_SIZE (40*1024*1024)
101#define KERNEL_TEXT_START 0xffffffff80000000UL 96#define KERNEL_TEXT_START 0xffffffff80000000
102 97
103#ifndef __ASSEMBLY__ 98#ifndef __ASSEMBLY__
104 99
@@ -106,21 +101,19 @@ typedef struct { unsigned long pgprot; } pgprot_t;
106 101
107#endif /* __ASSEMBLY__ */ 102#endif /* __ASSEMBLY__ */
108 103
109#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 104#define PAGE_OFFSET __PAGE_OFFSET
110 105
111/* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol. 106/* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol.
112 Otherwise you risk miscompilation. */ 107 Otherwise you risk miscompilation. */
113#define __pa(x) (((unsigned long)(x)>=__START_KERNEL_map)?(unsigned long)(x) - (unsigned long)__START_KERNEL_map:(unsigned long)(x) - PAGE_OFFSET) 108#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
114/* __pa_symbol should be used for C visible symbols. 109/* __pa_symbol should be used for C visible symbols.
115 This seems to be the official gcc blessed way to do such arithmetic. */ 110 This seems to be the official gcc blessed way to do such arithmetic. */
116#define __pa_symbol(x) \ 111#define __pa_symbol(x) \
117 ({unsigned long v; \ 112 ({unsigned long v; \
118 asm("" : "=r" (v) : "0" (x)); \ 113 asm("" : "=r" (v) : "0" (x)); \
119 __pa(v); }) 114 ((v - __START_KERNEL_map) + phys_base); })
120 115
121#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 116#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
122#define __boot_va(x) __va(x)
123#define __boot_pa(x) __pa(x)
124#ifdef CONFIG_FLATMEM 117#ifdef CONFIG_FLATMEM
125#define pfn_valid(pfn) ((pfn) < end_pfn) 118#define pfn_valid(pfn) ((pfn) < end_pfn)
126#endif 119#endif
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 5ed0ef34084..c6fbb67eac9 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,16 +11,6 @@
11 11
12#include <asm/pda.h> 12#include <asm/pda.h>
13 13
14#ifdef CONFIG_MODULES
15# define PERCPU_MODULE_RESERVE 8192
16#else
17# define PERCPU_MODULE_RESERVE 0
18#endif
19
20#define PERCPU_ENOUGH_ROOM \
21 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
22 PERCPU_MODULE_RESERVE)
23
24#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) 14#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
25#define __my_cpu_offset() read_pda(data_offset) 15#define __my_cpu_offset() read_pda(data_offset)
26 16
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 4e28b6060a5..8bb56468786 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -1,7 +1,6 @@
1#ifndef _X86_64_PGALLOC_H 1#ifndef _X86_64_PGALLOC_H
2#define _X86_64_PGALLOC_H 2#define _X86_64_PGALLOC_H
3 3
4#include <asm/fixmap.h>
5#include <asm/pda.h> 4#include <asm/pda.h>
6#include <linux/threads.h> 5#include <linux/threads.h>
7#include <linux/mm.h> 6#include <linux/mm.h>
@@ -45,24 +44,16 @@ static inline void pgd_list_add(pgd_t *pgd)
45 struct page *page = virt_to_page(pgd); 44 struct page *page = virt_to_page(pgd);
46 45
47 spin_lock(&pgd_lock); 46 spin_lock(&pgd_lock);
48 page->index = (pgoff_t)pgd_list; 47 list_add(&page->lru, &pgd_list);
49 if (pgd_list)
50 pgd_list->private = (unsigned long)&page->index;
51 pgd_list = page;
52 page->private = (unsigned long)&pgd_list;
53 spin_unlock(&pgd_lock); 48 spin_unlock(&pgd_lock);
54} 49}
55 50
56static inline void pgd_list_del(pgd_t *pgd) 51static inline void pgd_list_del(pgd_t *pgd)
57{ 52{
58 struct page *next, **pprev, *page = virt_to_page(pgd); 53 struct page *page = virt_to_page(pgd);
59 54
60 spin_lock(&pgd_lock); 55 spin_lock(&pgd_lock);
61 next = (struct page *)page->index; 56 list_del(&page->lru);
62 pprev = (struct page **)page->private;
63 *pprev = next;
64 if (next)
65 next->private = (unsigned long)pprev;
66 spin_unlock(&pgd_lock); 57 spin_unlock(&pgd_lock);
67} 58}
68 59
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 730bd602841..599993f6ba8 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -1,25 +1,25 @@
1#ifndef _X86_64_PGTABLE_H 1#ifndef _X86_64_PGTABLE_H
2#define _X86_64_PGTABLE_H 2#define _X86_64_PGTABLE_H
3 3
4#include <asm/const.h>
5#ifndef __ASSEMBLY__
6
4/* 7/*
5 * This file contains the functions and defines necessary to modify and use 8 * This file contains the functions and defines necessary to modify and use
6 * the x86-64 page table tree. 9 * the x86-64 page table tree.
7 */ 10 */
8#include <asm/processor.h> 11#include <asm/processor.h>
9#include <asm/fixmap.h>
10#include <asm/bitops.h> 12#include <asm/bitops.h>
11#include <linux/threads.h> 13#include <linux/threads.h>
12#include <asm/pda.h> 14#include <asm/pda.h>
13 15
14extern pud_t level3_kernel_pgt[512]; 16extern pud_t level3_kernel_pgt[512];
15extern pud_t level3_physmem_pgt[512];
16extern pud_t level3_ident_pgt[512]; 17extern pud_t level3_ident_pgt[512];
17extern pmd_t level2_kernel_pgt[512]; 18extern pmd_t level2_kernel_pgt[512];
18extern pgd_t init_level4_pgt[]; 19extern pgd_t init_level4_pgt[];
19extern pgd_t boot_level4_pgt[];
20extern unsigned long __supported_pte_mask; 20extern unsigned long __supported_pte_mask;
21 21
22#define swapper_pg_dir init_level4_pgt 22#define swapper_pg_dir ((pgd_t *)NULL)
23 23
24extern void paging_init(void); 24extern void paging_init(void);
25extern void clear_kernel_mapping(unsigned long addr, unsigned long size); 25extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
@@ -29,7 +29,9 @@ extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
29 * for zero-mapped memory areas etc.. 29 * for zero-mapped memory areas etc..
30 */ 30 */
31extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)]; 31extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)];
32#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 32#define ZERO_PAGE(vaddr) (pfn_to_page(__pa_symbol(&empty_zero_page) >> PAGE_SHIFT))
33
34#endif /* !__ASSEMBLY__ */
33 35
34/* 36/*
35 * PGDIR_SHIFT determines what a top-level page table entry can map 37 * PGDIR_SHIFT determines what a top-level page table entry can map
@@ -55,6 +57,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)];
55 */ 57 */
56#define PTRS_PER_PTE 512 58#define PTRS_PER_PTE 512
57 59
60#ifndef __ASSEMBLY__
61
58#define pte_ERROR(e) \ 62#define pte_ERROR(e) \
59 printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) 63 printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), pte_val(e))
60#define pmd_ERROR(e) \ 64#define pmd_ERROR(e) \
@@ -118,22 +122,23 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
118 122
119#define pte_pgprot(a) (__pgprot((a).pte & ~PHYSICAL_PAGE_MASK)) 123#define pte_pgprot(a) (__pgprot((a).pte & ~PHYSICAL_PAGE_MASK))
120 124
121#define PMD_SIZE (1UL << PMD_SHIFT) 125#endif /* !__ASSEMBLY__ */
126
127#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT)
122#define PMD_MASK (~(PMD_SIZE-1)) 128#define PMD_MASK (~(PMD_SIZE-1))
123#define PUD_SIZE (1UL << PUD_SHIFT) 129#define PUD_SIZE (_AC(1,UL) << PUD_SHIFT)
124#define PUD_MASK (~(PUD_SIZE-1)) 130#define PUD_MASK (~(PUD_SIZE-1))
125#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 131#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT)
126#define PGDIR_MASK (~(PGDIR_SIZE-1)) 132#define PGDIR_MASK (~(PGDIR_SIZE-1))
127 133
128#define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1) 134#define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1)
129#define FIRST_USER_ADDRESS 0 135#define FIRST_USER_ADDRESS 0
130 136
131#ifndef __ASSEMBLY__ 137#define MAXMEM 0x3fffffffffff
132#define MAXMEM 0x3fffffffffffUL 138#define VMALLOC_START 0xffffc20000000000
133#define VMALLOC_START 0xffffc20000000000UL 139#define VMALLOC_END 0xffffe1ffffffffff
134#define VMALLOC_END 0xffffe1ffffffffffUL 140#define MODULES_VADDR 0xffffffff88000000
135#define MODULES_VADDR 0xffffffff88000000UL 141#define MODULES_END 0xfffffffffff00000
136#define MODULES_END 0xfffffffffff00000UL
137#define MODULES_LEN (MODULES_END - MODULES_VADDR) 142#define MODULES_LEN (MODULES_END - MODULES_VADDR)
138 143
139#define _PAGE_BIT_PRESENT 0 144#define _PAGE_BIT_PRESENT 0
@@ -159,7 +164,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
159#define _PAGE_GLOBAL 0x100 /* Global TLB entry */ 164#define _PAGE_GLOBAL 0x100 /* Global TLB entry */
160 165
161#define _PAGE_PROTNONE 0x080 /* If not present */ 166#define _PAGE_PROTNONE 0x080 /* If not present */
162#define _PAGE_NX (1UL<<_PAGE_BIT_NX) 167#define _PAGE_NX (_AC(1,UL)<<_PAGE_BIT_NX)
163 168
164#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) 169#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
165#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 170#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -221,6 +226,8 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
221#define __S110 PAGE_SHARED_EXEC 226#define __S110 PAGE_SHARED_EXEC
222#define __S111 PAGE_SHARED_EXEC 227#define __S111 PAGE_SHARED_EXEC
223 228
229#ifndef __ASSEMBLY__
230
224static inline unsigned long pgd_bad(pgd_t pgd) 231static inline unsigned long pgd_bad(pgd_t pgd)
225{ 232{
226 return pgd_val(pgd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); 233 return pgd_val(pgd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
@@ -403,11 +410,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
403#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 410#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
404 411
405extern spinlock_t pgd_lock; 412extern spinlock_t pgd_lock;
406extern struct page *pgd_list; 413extern struct list_head pgd_list;
407void vmalloc_sync_all(void); 414void vmalloc_sync_all(void);
408 415
409#endif /* !__ASSEMBLY__ */
410
411extern int kern_addr_valid(unsigned long addr); 416extern int kern_addr_valid(unsigned long addr);
412 417
413#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ 418#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
@@ -437,5 +442,6 @@ extern int kern_addr_valid(unsigned long addr);
437#define __HAVE_ARCH_PTEP_SET_WRPROTECT 442#define __HAVE_ARCH_PTEP_SET_WRPROTECT
438#define __HAVE_ARCH_PTE_SAME 443#define __HAVE_ARCH_PTE_SAME
439#include <asm-generic/pgtable.h> 444#include <asm-generic/pgtable.h>
445#endif /* !__ASSEMBLY__ */
440 446
441#endif /* _X86_64_PGTABLE_H */ 447#endif /* _X86_64_PGTABLE_H */
diff --git a/include/asm-x86_64/processor-flags.h b/include/asm-x86_64/processor-flags.h
new file mode 100644
index 00000000000..ec99a57b2c6
--- /dev/null
+++ b/include/asm-x86_64/processor-flags.h
@@ -0,0 +1 @@
#include <asm-i386/processor-flags.h>
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 76552d72804..461ffe4c1fc 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -20,6 +20,7 @@
20#include <asm/percpu.h> 20#include <asm/percpu.h>
21#include <linux/personality.h> 21#include <linux/personality.h>
22#include <linux/cpumask.h> 22#include <linux/cpumask.h>
23#include <asm/processor-flags.h>
23 24
24#define TF_MASK 0x00000100 25#define TF_MASK 0x00000100
25#define IF_MASK 0x00000200 26#define IF_MASK 0x00000200
@@ -103,42 +104,6 @@ extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
103extern unsigned short num_cache_leaves; 104extern unsigned short num_cache_leaves;
104 105
105/* 106/*
106 * EFLAGS bits
107 */
108#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
109#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
110#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
111#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
112#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
113#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
114#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
115#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
116#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
117#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
118#define X86_EFLAGS_NT 0x00004000 /* Nested Task */
119#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
120#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
121#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
122#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
123#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
124#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
125
126/*
127 * Intel CPU features in CR4
128 */
129#define X86_CR4_VME 0x0001 /* enable vm86 extensions */
130#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */
131#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */
132#define X86_CR4_DE 0x0008 /* enable debugging extensions */
133#define X86_CR4_PSE 0x0010 /* enable page size extensions */
134#define X86_CR4_PAE 0x0020 /* enable physical address extensions */
135#define X86_CR4_MCE 0x0040 /* Machine check enable */
136#define X86_CR4_PGE 0x0080 /* enable global pages */
137#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */
138#define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */
139#define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */
140
141/*
142 * Save the cr4 feature set we're using (ie 107 * Save the cr4 feature set we're using (ie
143 * Pentium 4MB enable and PPro Global page 108 * Pentium 4MB enable and PPro Global page
144 * enable), so that any CPU's that boot up 109 * enable), so that any CPU's that boot up
@@ -201,7 +166,7 @@ struct i387_fxsave_struct {
201 u32 mxcsr; 166 u32 mxcsr;
202 u32 mxcsr_mask; 167 u32 mxcsr_mask;
203 u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ 168 u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
204 u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 128 bytes */ 169 u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
205 u32 padding[24]; 170 u32 padding[24];
206} __attribute__ ((aligned (16))); 171} __attribute__ ((aligned (16)));
207 172
@@ -427,22 +392,6 @@ static inline void prefetchw(void *x)
427#define cpu_relax() rep_nop() 392#define cpu_relax() rep_nop()
428 393
429/* 394/*
430 * NSC/Cyrix CPU configuration register indexes
431 */
432#define CX86_CCR0 0xc0
433#define CX86_CCR1 0xc1
434#define CX86_CCR2 0xc2
435#define CX86_CCR3 0xc3
436#define CX86_CCR4 0xe8
437#define CX86_CCR5 0xe9
438#define CX86_CCR6 0xea
439#define CX86_CCR7 0xeb
440#define CX86_DIR0 0xfe
441#define CX86_DIR1 0xff
442#define CX86_ARR_BASE 0xc4
443#define CX86_RCR_BASE 0xdc
444
445/*
446 * NSC/Cyrix CPU indexed register access macros 395 * NSC/Cyrix CPU indexed register access macros
447 */ 396 */
448 397
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index b6e65a699f2..85255db1e82 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -11,18 +11,9 @@ struct pt_regs;
11extern void start_kernel(void); 11extern void start_kernel(void);
12extern void pda_init(int); 12extern void pda_init(int);
13 13
14extern void zap_low_mappings(int cpu);
15
16extern void early_idt_handler(void); 14extern void early_idt_handler(void);
17 15
18extern void mcheck_init(struct cpuinfo_x86 *c); 16extern void mcheck_init(struct cpuinfo_x86 *c);
19#ifdef CONFIG_MTRR
20extern void mtrr_ap_init(void);
21extern void mtrr_bp_init(void);
22#else
23#define mtrr_ap_init() do {} while (0)
24#define mtrr_bp_init() do {} while (0)
25#endif
26extern void init_memory_mapping(unsigned long start, unsigned long end); 17extern void init_memory_mapping(unsigned long start, unsigned long end);
27 18
28extern void system_call(void); 19extern void system_call(void);
@@ -82,7 +73,6 @@ extern void syscall32_cpu_init(void);
82extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); 73extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end);
83 74
84extern void early_quirks(void); 75extern void early_quirks(void);
85extern void quirk_intel_irqbalance(void);
86extern void check_efer(void); 76extern void check_efer(void);
87 77
88extern int unhandled_signal(struct task_struct *tsk, int sig); 78extern int unhandled_signal(struct task_struct *tsk, int sig);
@@ -93,6 +83,7 @@ extern unsigned long table_start, table_end;
93 83
94extern int exception_trace; 84extern int exception_trace;
95extern unsigned cpu_khz; 85extern unsigned cpu_khz;
86extern unsigned tsc_khz;
96 87
97extern void no_iommu_init(void); 88extern void no_iommu_init(void);
98extern int force_iommu, no_iommu; 89extern int force_iommu, no_iommu;
@@ -121,8 +112,12 @@ extern int gsi_irq_sharing(int gsi);
121 112
122extern void smp_local_timer_interrupt(void); 113extern void smp_local_timer_interrupt(void);
123 114
115extern int force_mwait;
116
124long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); 117long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
125 118
119void i8254_timer_resume(void);
120
126#define round_up(x,y) (((x) + (y) - 1) & ~((y)-1)) 121#define round_up(x,y) (((x) + (y) - 1) & ~((y)-1))
127#define round_down(x,y) ((x) & ~((y)-1)) 122#define round_down(x,y) ((x) & ~((y)-1))
128 123
diff --git a/include/asm-x86_64/scatterlist.h b/include/asm-x86_64/scatterlist.h
index 49d89f8129c..eaf7ada27e1 100644
--- a/include/asm-x86_64/scatterlist.h
+++ b/include/asm-x86_64/scatterlist.h
@@ -1,6 +1,8 @@
1#ifndef _X8664_SCATTERLIST_H 1#ifndef _X8664_SCATTERLIST_H
2#define _X8664_SCATTERLIST_H 2#define _X8664_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
4struct scatterlist { 6struct scatterlist {
5 struct page *page; 7 struct page *page;
6 unsigned int offset; 8 unsigned int offset;
diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h
index 334ddcdd8f9..adf2bf1e187 100644
--- a/include/asm-x86_64/segment.h
+++ b/include/asm-x86_64/segment.h
@@ -6,7 +6,7 @@
6#define __KERNEL_CS 0x10 6#define __KERNEL_CS 0x10
7#define __KERNEL_DS 0x18 7#define __KERNEL_DS 0x18
8 8
9#define __KERNEL32_CS 0x38 9#define __KERNEL32_CS 0x08
10 10
11/* 11/*
12 * we cannot use the same code segment descriptor for user and kernel 12 * we cannot use the same code segment descriptor for user and kernel
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index de592a408c0..d5704421456 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -10,10 +10,9 @@
10#include <linux/init.h> 10#include <linux/init.h>
11extern int disable_apic; 11extern int disable_apic;
12 12
13#include <asm/fixmap.h>
14#include <asm/mpspec.h> 13#include <asm/mpspec.h>
15#include <asm/io_apic.h>
16#include <asm/apic.h> 14#include <asm/apic.h>
15#include <asm/io_apic.h>
17#include <asm/thread_info.h> 16#include <asm/thread_info.h>
18 17
19#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
@@ -38,7 +37,6 @@ extern void lock_ipi_call_lock(void);
38extern void unlock_ipi_call_lock(void); 37extern void unlock_ipi_call_lock(void);
39extern int smp_num_siblings; 38extern int smp_num_siblings;
40extern void smp_send_reschedule(int cpu); 39extern void smp_send_reschedule(int cpu);
41void smp_stop_cpu(void);
42 40
43extern cpumask_t cpu_sibling_map[NR_CPUS]; 41extern cpumask_t cpu_sibling_map[NR_CPUS];
44extern cpumask_t cpu_core_map[NR_CPUS]; 42extern cpumask_t cpu_core_map[NR_CPUS];
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h
index b4670260793..90af60cf3c0 100644
--- a/include/asm-x86_64/socket.h
+++ b/include/asm-x86_64/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86_64/sockios.h b/include/asm-x86_64/sockios.h
index 2eefd10d4f4..d726ba2513e 100644
--- a/include/asm-x86_64/sockios.h
+++ b/include/asm-x86_64/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h
index bc7f81715e5..9c3f8de90d2 100644
--- a/include/asm-x86_64/suspend.h
+++ b/include/asm-x86_64/suspend.h
@@ -17,6 +17,7 @@ struct saved_context {
17 u16 ds, es, fs, gs, ss; 17 u16 ds, es, fs, gs, ss;
18 unsigned long gs_base, gs_kernel_base, fs_base; 18 unsigned long gs_base, gs_kernel_base, fs_base;
19 unsigned long cr0, cr2, cr3, cr4, cr8; 19 unsigned long cr0, cr2, cr3, cr4, cr8;
20 unsigned long efer;
20 u16 gdt_pad; 21 u16 gdt_pad;
21 u16 gdt_limit; 22 u16 gdt_limit;
22 unsigned long gdt_base; 23 unsigned long gdt_base;
@@ -44,12 +45,12 @@ extern unsigned long saved_context_eflags;
44extern void fix_processor_context(void); 45extern void fix_processor_context(void);
45 46
46#ifdef CONFIG_ACPI_SLEEP 47#ifdef CONFIG_ACPI_SLEEP
47extern unsigned long saved_eip; 48extern unsigned long saved_rip;
48extern unsigned long saved_esp; 49extern unsigned long saved_rsp;
49extern unsigned long saved_ebp; 50extern unsigned long saved_rbp;
50extern unsigned long saved_ebx; 51extern unsigned long saved_rbx;
51extern unsigned long saved_esi; 52extern unsigned long saved_rsi;
52extern unsigned long saved_edi; 53extern unsigned long saved_rdi;
53 54
54/* routines for saving/restoring kernel state */ 55/* routines for saving/restoring kernel state */
55extern int acpi_save_state_mem(void); 56extern int acpi_save_state_mem(void);
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index bd376bc8c4a..213b7fe5d99 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -89,6 +89,11 @@ static inline unsigned long read_cr3(void)
89 return cr3; 89 return cr3;
90} 90}
91 91
92static inline void write_cr3(unsigned long val)
93{
94 asm volatile("movq %0,%%cr3" :: "r" (val) : "memory");
95}
96
92static inline unsigned long read_cr4(void) 97static inline unsigned long read_cr4(void)
93{ 98{
94 unsigned long cr4; 99 unsigned long cr4;
@@ -98,7 +103,7 @@ static inline unsigned long read_cr4(void)
98 103
99static inline void write_cr4(unsigned long val) 104static inline void write_cr4(unsigned long val)
100{ 105{
101 asm volatile("movq %0,%%cr4" :: "r" (val)); 106 asm volatile("movq %0,%%cr4" :: "r" (val) : "memory");
102} 107}
103 108
104#define stts() write_cr0(8 | read_cr0()) 109#define stts() write_cr0(8 | read_cr0())
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index 8c6808a3fba..f6527e1b6c1 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -27,6 +27,6 @@ extern int read_current_timer(unsigned long *timer_value);
27#define NS_SCALE 10 /* 2^10, carefully chosen */ 27#define NS_SCALE 10 /* 2^10, carefully chosen */
28#define US_SCALE 32 /* 2^32, arbitralrily chosen */ 28#define US_SCALE 32 /* 2^32, arbitralrily chosen */
29 29
30extern void mark_tsc_unstable(void); 30extern void mark_tsc_unstable(char *msg);
31extern void set_cyc2ns_scale(unsigned long khz); 31extern void set_cyc2ns_scale(unsigned long khz);
32#endif 32#endif
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
index 983bd296c81..512401b8725 100644
--- a/include/asm-x86_64/tlbflush.h
+++ b/include/asm-x86_64/tlbflush.h
@@ -3,41 +3,18 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/processor.h> 5#include <asm/processor.h>
6 6#include <asm/system.h>
7static inline unsigned long get_cr3(void)
8{
9 unsigned long cr3;
10 asm volatile("mov %%cr3,%0" : "=r" (cr3));
11 return cr3;
12}
13
14static inline void set_cr3(unsigned long cr3)
15{
16 asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory");
17}
18 7
19static inline void __flush_tlb(void) 8static inline void __flush_tlb(void)
20{ 9{
21 set_cr3(get_cr3()); 10 write_cr3(read_cr3());
22}
23
24static inline unsigned long get_cr4(void)
25{
26 unsigned long cr4;
27 asm volatile("mov %%cr4,%0" : "=r" (cr4));
28 return cr4;
29}
30
31static inline void set_cr4(unsigned long cr4)
32{
33 asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory");
34} 11}
35 12
36static inline void __flush_tlb_all(void) 13static inline void __flush_tlb_all(void)
37{ 14{
38 unsigned long cr4 = get_cr4(); 15 unsigned long cr4 = read_cr4();
39 set_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */ 16 write_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */
40 set_cr4(cr4); /* write old PGE again and flush TLBs */ 17 write_cr4(cr4); /* write old PGE again and flush TLBs */
41} 18}
42 19
43#define __flush_tlb_one(addr) \ 20#define __flush_tlb_one(addr) \
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index c5f596e71fa..26e23e01c54 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -620,8 +620,6 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice)
620#define __NR_move_pages 279 620#define __NR_move_pages 279
621__SYSCALL(__NR_move_pages, sys_move_pages) 621__SYSCALL(__NR_move_pages, sys_move_pages)
622 622
623#define __NR_syscall_max __NR_move_pages
624
625#ifndef __NO_STUBS 623#ifndef __NO_STUBS
626#define __ARCH_WANT_OLD_READDIR 624#define __ARCH_WANT_OLD_READDIR
627#define __ARCH_WANT_OLD_STAT 625#define __ARCH_WANT_OLD_STAT
@@ -655,7 +653,6 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
655#include <asm/ptrace.h> 653#include <asm/ptrace.h>
656 654
657asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs); 655asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs);
658asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on);
659struct sigaction; 656struct sigaction;
660asmlinkage long sys_rt_sigaction(int sig, 657asmlinkage long sys_rt_sigaction(int sig,
661 const struct sigaction __user *act, 658 const struct sigaction __user *act,
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h
index c4a10577638..20965e3af1d 100644
--- a/include/asm-xtensa/div64.h
+++ b/include/asm-xtensa/div64.h
@@ -11,9 +11,15 @@
11#ifndef _XTENSA_DIV64_H 11#ifndef _XTENSA_DIV64_H
12#define _XTENSA_DIV64_H 12#define _XTENSA_DIV64_H
13 13
14#include <linux/types.h>
15
14#define do_div(n,base) ({ \ 16#define do_div(n,base) ({ \
15 int __res = n % ((unsigned int) base); \ 17 int __res = n % ((unsigned int) base); \
16 n /= (unsigned int) base; \ 18 n /= (unsigned int) base; \
17 __res; }) 19 __res; })
18 20
21static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
22{
23 return dividend / divisor;
24}
19#endif 25#endif
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h
index f14851f086c..92f948392eb 100644
--- a/include/asm-xtensa/mmu_context.h
+++ b/include/asm-xtensa/mmu_context.h
@@ -18,6 +18,7 @@
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
20#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
21#include <asm-generic/mm_hooks.h>
21 22
22#define XCHAL_MMU_ASID_BITS 8 23#define XCHAL_MMU_ASID_BITS 8
23 24
diff --git a/include/asm-xtensa/scatterlist.h b/include/asm-xtensa/scatterlist.h
index 38a2b9acd65..ca337a29429 100644
--- a/include/asm-xtensa/scatterlist.h
+++ b/include/asm-xtensa/scatterlist.h
@@ -11,6 +11,8 @@
11#ifndef _XTENSA_SCATTERLIST_H 11#ifndef _XTENSA_SCATTERLIST_H
12#define _XTENSA_SCATTERLIST_H 12#define _XTENSA_SCATTERLIST_H
13 13
14#include <asm/types.h>
15
14struct scatterlist { 16struct scatterlist {
15 struct page *page; 17 struct page *page;
16 unsigned int offset; 18 unsigned int offset;
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index 971d231be60..1f5aeacb9da 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -60,5 +60,7 @@
60#define SO_ACCEPTCONN 30 60#define SO_ACCEPTCONN 30
61#define SO_PEERSEC 31 61#define SO_PEERSEC 31
62#define SO_PASSSEC 34 62#define SO_PASSSEC 34
63#define SO_TIMESTAMPNS 35
64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
63 65
64#endif /* _XTENSA_SOCKET_H */ 66#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h
index 20d2ba10ecd..efe0af379f0 100644
--- a/include/asm-xtensa/sockios.h
+++ b/include/asm-xtensa/sockios.h
@@ -25,6 +25,7 @@
25#define SIOCSPGRP _IOW('s', 8, pid_t) 25#define SIOCSPGRP _IOW('s', 8, pid_t)
26#define SIOCGPGRP _IOR('s', 9, pid_t) 26#define SIOCGPGRP _IOR('s', 9, pid_t)
27 27
28#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 28#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
29#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
29 30
30#endif /* _XTENSA_SOCKIOS_H */ 31#endif /* _XTENSA_SOCKIOS_H */
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 4e05e93ff68..b2b1e6efd81 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -13,8 +13,11 @@
13#define _CRYPTO_ALGAPI_H 13#define _CRYPTO_ALGAPI_H
14 14
15#include <linux/crypto.h> 15#include <linux/crypto.h>
16#include <linux/list.h>
17#include <linux/kernel.h>
16 18
17struct module; 19struct module;
20struct rtattr;
18struct seq_file; 21struct seq_file;
19 22
20struct crypto_type { 23struct crypto_type {
@@ -38,7 +41,7 @@ struct crypto_template {
38 struct hlist_head instances; 41 struct hlist_head instances;
39 struct module *module; 42 struct module *module;
40 43
41 struct crypto_instance *(*alloc)(void *param, unsigned int len); 44 struct crypto_instance *(*alloc)(struct rtattr **tb);
42 void (*free)(struct crypto_instance *inst); 45 void (*free)(struct crypto_instance *inst);
43 46
44 char name[CRYPTO_MAX_ALG_NAME]; 47 char name[CRYPTO_MAX_ALG_NAME];
@@ -48,6 +51,15 @@ struct crypto_spawn {
48 struct list_head list; 51 struct list_head list;
49 struct crypto_alg *alg; 52 struct crypto_alg *alg;
50 struct crypto_instance *inst; 53 struct crypto_instance *inst;
54 u32 mask;
55};
56
57struct crypto_queue {
58 struct list_head list;
59 struct list_head *backlog;
60
61 unsigned int qlen;
62 unsigned int max_qlen;
51}; 63};
52 64
53struct scatter_walk { 65struct scatter_walk {
@@ -81,6 +93,7 @@ struct blkcipher_walk {
81 int flags; 93 int flags;
82}; 94};
83 95
96extern const struct crypto_type crypto_ablkcipher_type;
84extern const struct crypto_type crypto_blkcipher_type; 97extern const struct crypto_type crypto_blkcipher_type;
85extern const struct crypto_type crypto_hash_type; 98extern const struct crypto_type crypto_hash_type;
86 99
@@ -91,16 +104,23 @@ void crypto_unregister_template(struct crypto_template *tmpl);
91struct crypto_template *crypto_lookup_template(const char *name); 104struct crypto_template *crypto_lookup_template(const char *name);
92 105
93int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 106int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
94 struct crypto_instance *inst); 107 struct crypto_instance *inst, u32 mask);
95void crypto_drop_spawn(struct crypto_spawn *spawn); 108void crypto_drop_spawn(struct crypto_spawn *spawn);
96struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, 109struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type,
97 u32 mask); 110 u32 mask);
98 111
99struct crypto_alg *crypto_get_attr_alg(void *param, unsigned int len, 112struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb);
100 u32 type, u32 mask); 113int crypto_check_attr_type(struct rtattr **tb, u32 type);
114struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, u32 type, u32 mask);
101struct crypto_instance *crypto_alloc_instance(const char *name, 115struct crypto_instance *crypto_alloc_instance(const char *name,
102 struct crypto_alg *alg); 116 struct crypto_alg *alg);
103 117
118void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen);
119int crypto_enqueue_request(struct crypto_queue *queue,
120 struct crypto_async_request *request);
121struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue);
122int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm);
123
104int blkcipher_walk_done(struct blkcipher_desc *desc, 124int blkcipher_walk_done(struct blkcipher_desc *desc,
105 struct blkcipher_walk *walk, int err); 125 struct blkcipher_walk *walk, int err);
106int blkcipher_walk_virt(struct blkcipher_desc *desc, 126int blkcipher_walk_virt(struct blkcipher_desc *desc,
@@ -118,11 +138,37 @@ static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
118 return (void *)ALIGN(addr, align); 138 return (void *)ALIGN(addr, align);
119} 139}
120 140
141static inline struct crypto_instance *crypto_tfm_alg_instance(
142 struct crypto_tfm *tfm)
143{
144 return container_of(tfm->__crt_alg, struct crypto_instance, alg);
145}
146
121static inline void *crypto_instance_ctx(struct crypto_instance *inst) 147static inline void *crypto_instance_ctx(struct crypto_instance *inst)
122{ 148{
123 return inst->__ctx; 149 return inst->__ctx;
124} 150}
125 151
152static inline struct ablkcipher_alg *crypto_ablkcipher_alg(
153 struct crypto_ablkcipher *tfm)
154{
155 return &crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_ablkcipher;
156}
157
158static inline void *crypto_ablkcipher_ctx(struct crypto_ablkcipher *tfm)
159{
160 return crypto_tfm_ctx(&tfm->base);
161}
162
163static inline struct crypto_blkcipher *crypto_spawn_blkcipher(
164 struct crypto_spawn *spawn)
165{
166 u32 type = CRYPTO_ALG_TYPE_BLKCIPHER;
167 u32 mask = CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC;
168
169 return __crypto_blkcipher_cast(crypto_spawn_tfm(spawn, type, mask));
170}
171
126static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm) 172static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm)
127{ 173{
128 return crypto_tfm_ctx(&tfm->base); 174 return crypto_tfm_ctx(&tfm->base);
@@ -170,5 +216,35 @@ static inline void blkcipher_walk_init(struct blkcipher_walk *walk,
170 walk->total = nbytes; 216 walk->total = nbytes;
171} 217}
172 218
219static inline struct crypto_async_request *crypto_get_backlog(
220 struct crypto_queue *queue)
221{
222 return queue->backlog == &queue->list ? NULL :
223 container_of(queue->backlog, struct crypto_async_request, list);
224}
225
226static inline int ablkcipher_enqueue_request(struct ablkcipher_alg *alg,
227 struct ablkcipher_request *request)
228{
229 return crypto_enqueue_request(alg->queue, &request->base);
230}
231
232static inline struct ablkcipher_request *ablkcipher_dequeue_request(
233 struct ablkcipher_alg *alg)
234{
235 return ablkcipher_request_cast(crypto_dequeue_request(alg->queue));
236}
237
238static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req)
239{
240 return req->__ctx;
241}
242
243static inline int ablkcipher_tfm_in_queue(struct crypto_ablkcipher *tfm)
244{
245 return crypto_tfm_in_queue(crypto_ablkcipher_alg(tfm)->queue,
246 crypto_ablkcipher_tfm(tfm));
247}
248
173#endif /* _CRYPTO_ALGAPI_H */ 249#endif /* _CRYPTO_ALGAPI_H */
174 250
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
new file mode 100644
index 00000000000..e2ee73aef0e
--- /dev/null
+++ b/include/keys/rxrpc-type.h
@@ -0,0 +1,22 @@
1/* RxRPC key type
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_RXRPC_TYPE_H
13#define _KEYS_RXRPC_TYPE_H
14
15#include <linux/key.h>
16
17/*
18 * key type for AF_RXRPC keys
19 */
20extern struct key_type key_type_rxrpc;
21
22#endif /* _KEYS_USER_TYPE_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e81e301a4d7..4ff0f57d0ad 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -69,9 +69,7 @@ header-y += hdsmart.h
69header-y += hysdn_if.h 69header-y += hysdn_if.h
70header-y += i2c-dev.h 70header-y += i2c-dev.h
71header-y += i8k.h 71header-y += i8k.h
72header-y += icmp.h
73header-y += if_arcnet.h 72header-y += if_arcnet.h
74header-y += if_arp.h
75header-y += if_bonding.h 73header-y += if_bonding.h
76header-y += if_cablemodem.h 74header-y += if_cablemodem.h
77header-y += if_fc.h 75header-y += if_fc.h
@@ -88,7 +86,6 @@ header-y += if_tunnel.h
88header-y += in6.h 86header-y += in6.h
89header-y += in_route.h 87header-y += in_route.h
90header-y += ioctl.h 88header-y += ioctl.h
91header-y += ip.h
92header-y += ipmi_msgdefs.h 89header-y += ipmi_msgdefs.h
93header-y += ip_mp_alg.h 90header-y += ip_mp_alg.h
94header-y += ipsec.h 91header-y += ipsec.h
@@ -116,6 +113,7 @@ header-y += netrom.h
116header-y += nfs2.h 113header-y += nfs2.h
117header-y += nfs4_mount.h 114header-y += nfs4_mount.h
118header-y += nfs_mount.h 115header-y += nfs_mount.h
116header-y += nl80211.h
119header-y += oom.h 117header-y += oom.h
120header-y += param.h 118header-y += param.h
121header-y += pci_regs.h 119header-y += pci_regs.h
@@ -210,8 +208,10 @@ unifdef-y += hiddev.h
210unifdef-y += hpet.h 208unifdef-y += hpet.h
211unifdef-y += i2c.h 209unifdef-y += i2c.h
212unifdef-y += i2o-dev.h 210unifdef-y += i2o-dev.h
211unifdef-y += icmp.h
213unifdef-y += icmpv6.h 212unifdef-y += icmpv6.h
214unifdef-y += if_addr.h 213unifdef-y += if_addr.h
214unifdef-y += if_arp.h
215unifdef-y += if_bridge.h 215unifdef-y += if_bridge.h
216unifdef-y += if_ec.h 216unifdef-y += if_ec.h
217unifdef-y += if_eql.h 217unifdef-y += if_eql.h
@@ -231,6 +231,7 @@ unifdef-y += inet_diag.h
231unifdef-y += in.h 231unifdef-y += in.h
232unifdef-y += inotify.h 232unifdef-y += inotify.h
233unifdef-y += input.h 233unifdef-y += input.h
234unifdef-y += ip.h
234unifdef-y += ipc.h 235unifdef-y += ipc.h
235unifdef-y += ipmi.h 236unifdef-y += ipmi.h
236unifdef-y += ipv6.h 237unifdef-y += ipv6.h
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 6caeb98e29d..edb31bfff68 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -159,11 +159,19 @@ enum {
159 ATA_CMD_INIT_DEV_PARAMS = 0x91, 159 ATA_CMD_INIT_DEV_PARAMS = 0x91,
160 ATA_CMD_READ_NATIVE_MAX = 0xF8, 160 ATA_CMD_READ_NATIVE_MAX = 0xF8,
161 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 161 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
162 ATA_CMD_SET_MAX = 0xF9,
163 ATA_CMD_SET_MAX_EXT = 0x37,
162 ATA_CMD_READ_LOG_EXT = 0x2f, 164 ATA_CMD_READ_LOG_EXT = 0x2f,
163 165
164 /* READ_LOG_EXT pages */ 166 /* READ_LOG_EXT pages */
165 ATA_LOG_SATA_NCQ = 0x10, 167 ATA_LOG_SATA_NCQ = 0x10,
166 168
169 /* READ/WRITE LONG (obsolete) */
170 ATA_CMD_READ_LONG = 0x22,
171 ATA_CMD_READ_LONG_ONCE = 0x23,
172 ATA_CMD_WRITE_LONG = 0x32,
173 ATA_CMD_WRITE_LONG_ONCE = 0x33,
174
167 /* SETFEATURES stuff */ 175 /* SETFEATURES stuff */
168 SETFEATURES_XFER = 0x03, 176 SETFEATURES_XFER = 0x03,
169 XFER_UDMA_7 = 0x47, 177 XFER_UDMA_7 = 0x47,
@@ -194,6 +202,8 @@ enum {
194 SETFEATURES_WC_ON = 0x02, /* Enable write cache */ 202 SETFEATURES_WC_ON = 0x02, /* Enable write cache */
195 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ 203 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */
196 204
205 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
206
197 /* ATAPI stuff */ 207 /* ATAPI stuff */
198 ATAPI_PKT_DMA = (1 << 0), 208 ATAPI_PKT_DMA = (1 << 0),
199 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 209 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index d12984ddaa9..ced8a1ed080 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -101,7 +101,7 @@ struct ddpehdr {
101 101
102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) 102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
103{ 103{
104 return (struct ddpehdr *)skb->h.raw; 104 return (struct ddpehdr *)skb_transport_header(skb);
105} 105}
106 106
107/* AppleTalk AARP headers */ 107/* AppleTalk AARP headers */
@@ -129,7 +129,7 @@ struct elapaarp {
129 129
130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
131{ 131{
132 return (struct elapaarp *)skb->h.raw; 132 return (struct elapaarp *)skb_transport_header(skb);
133} 133}
134 134
135/* Not specified - how long till we drop a resolved entry */ 135/* Not specified - how long till we drop a resolved entry */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 08daf3272c0..4d85262b4fa 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -276,7 +276,7 @@ extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
276extern mempool_t *bio_split_pool; 276extern mempool_t *bio_split_pool;
277extern void bio_pair_release(struct bio_pair *dbio); 277extern void bio_pair_release(struct bio_pair *dbio);
278 278
279extern struct bio_set *bioset_create(int, int, int); 279extern struct bio_set *bioset_create(int, int);
280extern void bioset_free(struct bio_set *); 280extern void bioset_free(struct bio_set *);
281 281
282extern struct bio *bio_alloc(gfp_t, int); 282extern struct bio *bio_alloc(gfp_t, int);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 83dcd8c0e97..a686eabe22d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -116,6 +116,7 @@ struct io_context {
116 116
117 struct as_io_context *aic; 117 struct as_io_context *aic;
118 struct rb_root cic_root; 118 struct rb_root cic_root;
119 void *ioc_data;
119}; 120};
120 121
121void put_io_context(struct io_context *ioc); 122void put_io_context(struct io_context *ioc);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 81c07cd1864..0365ec9fc0c 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -122,9 +122,9 @@ extern void *alloc_large_system_hash(const char *tablename,
122#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 122#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
123 123
124/* Only NUMA needs hash distribution. 124/* Only NUMA needs hash distribution.
125 * IA64 is known to have sufficient vmalloc space. 125 * IA64 and x86_64 have sufficient vmalloc space.
126 */ 126 */
127#if defined(CONFIG_NUMA) && defined(CONFIG_IA64) 127#if defined(CONFIG_NUMA) && (defined(CONFIG_IA64) || defined(CONFIG_X86_64))
128#define HASHDIST_DEFAULT 1 128#define HASHDIST_DEFAULT 1
129#else 129#else
130#define HASHDIST_DEFAULT 0 130#define HASHDIST_DEFAULT 0
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 0899e2cdcdd..963051a967d 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -32,7 +32,15 @@
32 * CPUFREQ NOTIFIER INTERFACE * 32 * CPUFREQ NOTIFIER INTERFACE *
33 *********************************************************************/ 33 *********************************************************************/
34 34
35#ifdef CONFIG_CPU_FREQ
35int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); 36int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
37#else
38static inline int cpufreq_register_notifier(struct notifier_block *nb,
39 unsigned int list)
40{
41 return 0;
42}
43#endif
36int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); 44int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
37 45
38#define CPUFREQ_TRANSITION_NOTIFIER (0) 46#define CPUFREQ_TRANSITION_NOTIFIER (0)
@@ -257,21 +265,25 @@ struct freq_attr {
257/********************************************************************* 265/*********************************************************************
258 * CPUFREQ 2.6. INTERFACE * 266 * CPUFREQ 2.6. INTERFACE *
259 *********************************************************************/ 267 *********************************************************************/
260int cpufreq_set_policy(struct cpufreq_policy *policy);
261int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 268int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
262int cpufreq_update_policy(unsigned int cpu); 269int cpufreq_update_policy(unsigned int cpu);
263 270
264/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
265unsigned int cpufreq_get(unsigned int cpu);
266 271
267/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 272/*
273 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
274 */
268#ifdef CONFIG_CPU_FREQ 275#ifdef CONFIG_CPU_FREQ
269unsigned int cpufreq_quick_get(unsigned int cpu); 276unsigned int cpufreq_quick_get(unsigned int cpu);
277unsigned int cpufreq_get(unsigned int cpu);
270#else 278#else
271static inline unsigned int cpufreq_quick_get(unsigned int cpu) 279static inline unsigned int cpufreq_quick_get(unsigned int cpu)
272{ 280{
273 return 0; 281 return 0;
274} 282}
283static inline unsigned int cpufreq_get(unsigned int cpu)
284{
285 return 0;
286}
275#endif 287#endif
276 288
277 289
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 32503657f14..22c7ac5cd80 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -14,5 +14,13 @@ extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
14extern const struct file_operations proc_vmcore_operations; 14extern const struct file_operations proc_vmcore_operations;
15extern struct proc_dir_entry *proc_vmcore; 15extern struct proc_dir_entry *proc_vmcore;
16 16
17/* Architecture code defines this if there are other possible ELF
18 * machine types, e.g. on bi-arch capable hardware. */
19#ifndef vmcore_elf_check_arch_cross
20#define vmcore_elf_check_arch_cross(x) 0
21#endif
22
23#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
24
17#endif /* CONFIG_CRASH_DUMP */ 25#endif /* CONFIG_CRASH_DUMP */
18#endif /* LINUX_CRASHDUMP_H */ 26#endif /* LINUX_CRASHDUMP_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 779aa78ee64..0de7e2ace82 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -56,6 +56,7 @@
56 56
57#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 57#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100
58#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 58#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
59#define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400
59#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 60#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000
60#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 61#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
61#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 62#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000
@@ -88,11 +89,38 @@
88#endif 89#endif
89 90
90struct scatterlist; 91struct scatterlist;
92struct crypto_ablkcipher;
93struct crypto_async_request;
91struct crypto_blkcipher; 94struct crypto_blkcipher;
92struct crypto_hash; 95struct crypto_hash;
96struct crypto_queue;
93struct crypto_tfm; 97struct crypto_tfm;
94struct crypto_type; 98struct crypto_type;
95 99
100typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
101
102struct crypto_async_request {
103 struct list_head list;
104 crypto_completion_t complete;
105 void *data;
106 struct crypto_tfm *tfm;
107
108 u32 flags;
109};
110
111struct ablkcipher_request {
112 struct crypto_async_request base;
113
114 unsigned int nbytes;
115
116 void *info;
117
118 struct scatterlist *src;
119 struct scatterlist *dst;
120
121 void *__ctx[] CRYPTO_MINALIGN_ATTR;
122};
123
96struct blkcipher_desc { 124struct blkcipher_desc {
97 struct crypto_blkcipher *tfm; 125 struct crypto_blkcipher *tfm;
98 void *info; 126 void *info;
@@ -116,6 +144,19 @@ struct hash_desc {
116 * Algorithms: modular crypto algorithm implementations, managed 144 * Algorithms: modular crypto algorithm implementations, managed
117 * via crypto_register_alg() and crypto_unregister_alg(). 145 * via crypto_register_alg() and crypto_unregister_alg().
118 */ 146 */
147struct ablkcipher_alg {
148 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
149 unsigned int keylen);
150 int (*encrypt)(struct ablkcipher_request *req);
151 int (*decrypt)(struct ablkcipher_request *req);
152
153 struct crypto_queue *queue;
154
155 unsigned int min_keysize;
156 unsigned int max_keysize;
157 unsigned int ivsize;
158};
159
119struct blkcipher_alg { 160struct blkcipher_alg {
120 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 161 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
121 unsigned int keylen); 162 unsigned int keylen);
@@ -170,6 +211,7 @@ struct compress_alg {
170 unsigned int slen, u8 *dst, unsigned int *dlen); 211 unsigned int slen, u8 *dst, unsigned int *dlen);
171}; 212};
172 213
214#define cra_ablkcipher cra_u.ablkcipher
173#define cra_blkcipher cra_u.blkcipher 215#define cra_blkcipher cra_u.blkcipher
174#define cra_cipher cra_u.cipher 216#define cra_cipher cra_u.cipher
175#define cra_digest cra_u.digest 217#define cra_digest cra_u.digest
@@ -194,6 +236,7 @@ struct crypto_alg {
194 const struct crypto_type *cra_type; 236 const struct crypto_type *cra_type;
195 237
196 union { 238 union {
239 struct ablkcipher_alg ablkcipher;
197 struct blkcipher_alg blkcipher; 240 struct blkcipher_alg blkcipher;
198 struct cipher_alg cipher; 241 struct cipher_alg cipher;
199 struct digest_alg digest; 242 struct digest_alg digest;
@@ -232,6 +275,15 @@ static inline int crypto_has_alg(const char *name, u32 type, u32 mask)
232 * crypto_free_*(), as well as the various helpers below. 275 * crypto_free_*(), as well as the various helpers below.
233 */ 276 */
234 277
278struct ablkcipher_tfm {
279 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
280 unsigned int keylen);
281 int (*encrypt)(struct ablkcipher_request *req);
282 int (*decrypt)(struct ablkcipher_request *req);
283 unsigned int ivsize;
284 unsigned int reqsize;
285};
286
235struct blkcipher_tfm { 287struct blkcipher_tfm {
236 void *iv; 288 void *iv;
237 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 289 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
@@ -290,6 +342,7 @@ struct compress_tfm {
290 u8 *dst, unsigned int *dlen); 342 u8 *dst, unsigned int *dlen);
291}; 343};
292 344
345#define crt_ablkcipher crt_u.ablkcipher
293#define crt_blkcipher crt_u.blkcipher 346#define crt_blkcipher crt_u.blkcipher
294#define crt_cipher crt_u.cipher 347#define crt_cipher crt_u.cipher
295#define crt_hash crt_u.hash 348#define crt_hash crt_u.hash
@@ -300,6 +353,7 @@ struct crypto_tfm {
300 u32 crt_flags; 353 u32 crt_flags;
301 354
302 union { 355 union {
356 struct ablkcipher_tfm ablkcipher;
303 struct blkcipher_tfm blkcipher; 357 struct blkcipher_tfm blkcipher;
304 struct cipher_tfm cipher; 358 struct cipher_tfm cipher;
305 struct hash_tfm hash; 359 struct hash_tfm hash;
@@ -311,6 +365,10 @@ struct crypto_tfm {
311 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; 365 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
312}; 366};
313 367
368struct crypto_ablkcipher {
369 struct crypto_tfm base;
370};
371
314struct crypto_blkcipher { 372struct crypto_blkcipher {
315 struct crypto_tfm base; 373 struct crypto_tfm base;
316}; 374};
@@ -330,12 +388,21 @@ struct crypto_hash {
330enum { 388enum {
331 CRYPTOA_UNSPEC, 389 CRYPTOA_UNSPEC,
332 CRYPTOA_ALG, 390 CRYPTOA_ALG,
391 CRYPTOA_TYPE,
392 __CRYPTOA_MAX,
333}; 393};
334 394
395#define CRYPTOA_MAX (__CRYPTOA_MAX - 1)
396
335struct crypto_attr_alg { 397struct crypto_attr_alg {
336 char name[CRYPTO_MAX_ALG_NAME]; 398 char name[CRYPTO_MAX_ALG_NAME];
337}; 399};
338 400
401struct crypto_attr_type {
402 u32 type;
403 u32 mask;
404};
405
339/* 406/*
340 * Transform user interface. 407 * Transform user interface.
341 */ 408 */
@@ -411,6 +478,167 @@ static inline unsigned int crypto_tfm_ctx_alignment(void)
411/* 478/*
412 * API wrappers. 479 * API wrappers.
413 */ 480 */
481static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
482 struct crypto_tfm *tfm)
483{
484 return (struct crypto_ablkcipher *)tfm;
485}
486
487static inline struct crypto_ablkcipher *crypto_alloc_ablkcipher(
488 const char *alg_name, u32 type, u32 mask)
489{
490 type &= ~CRYPTO_ALG_TYPE_MASK;
491 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
492 mask |= CRYPTO_ALG_TYPE_MASK;
493
494 return __crypto_ablkcipher_cast(
495 crypto_alloc_base(alg_name, type, mask));
496}
497
498static inline struct crypto_tfm *crypto_ablkcipher_tfm(
499 struct crypto_ablkcipher *tfm)
500{
501 return &tfm->base;
502}
503
504static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
505{
506 crypto_free_tfm(crypto_ablkcipher_tfm(tfm));
507}
508
509static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
510 u32 mask)
511{
512 type &= ~CRYPTO_ALG_TYPE_MASK;
513 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
514 mask |= CRYPTO_ALG_TYPE_MASK;
515
516 return crypto_has_alg(alg_name, type, mask);
517}
518
519static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(
520 struct crypto_ablkcipher *tfm)
521{
522 return &crypto_ablkcipher_tfm(tfm)->crt_ablkcipher;
523}
524
525static inline unsigned int crypto_ablkcipher_ivsize(
526 struct crypto_ablkcipher *tfm)
527{
528 return crypto_ablkcipher_crt(tfm)->ivsize;
529}
530
531static inline unsigned int crypto_ablkcipher_blocksize(
532 struct crypto_ablkcipher *tfm)
533{
534 return crypto_tfm_alg_blocksize(crypto_ablkcipher_tfm(tfm));
535}
536
537static inline unsigned int crypto_ablkcipher_alignmask(
538 struct crypto_ablkcipher *tfm)
539{
540 return crypto_tfm_alg_alignmask(crypto_ablkcipher_tfm(tfm));
541}
542
543static inline u32 crypto_ablkcipher_get_flags(struct crypto_ablkcipher *tfm)
544{
545 return crypto_tfm_get_flags(crypto_ablkcipher_tfm(tfm));
546}
547
548static inline void crypto_ablkcipher_set_flags(struct crypto_ablkcipher *tfm,
549 u32 flags)
550{
551 crypto_tfm_set_flags(crypto_ablkcipher_tfm(tfm), flags);
552}
553
554static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm,
555 u32 flags)
556{
557 crypto_tfm_clear_flags(crypto_ablkcipher_tfm(tfm), flags);
558}
559
560static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
561 const u8 *key, unsigned int keylen)
562{
563 return crypto_ablkcipher_crt(tfm)->setkey(tfm, key, keylen);
564}
565
566static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
567 struct ablkcipher_request *req)
568{
569 return __crypto_ablkcipher_cast(req->base.tfm);
570}
571
572static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
573{
574 struct ablkcipher_tfm *crt =
575 crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
576 return crt->encrypt(req);
577}
578
579static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
580{
581 struct ablkcipher_tfm *crt =
582 crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
583 return crt->decrypt(req);
584}
585
586static inline int crypto_ablkcipher_reqsize(struct crypto_ablkcipher *tfm)
587{
588 return crypto_ablkcipher_crt(tfm)->reqsize;
589}
590
591static inline void ablkcipher_request_set_tfm(
592 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
593{
594 req->base.tfm = crypto_ablkcipher_tfm(tfm);
595}
596
597static inline struct ablkcipher_request *ablkcipher_request_cast(
598 struct crypto_async_request *req)
599{
600 return container_of(req, struct ablkcipher_request, base);
601}
602
603static inline struct ablkcipher_request *ablkcipher_request_alloc(
604 struct crypto_ablkcipher *tfm, gfp_t gfp)
605{
606 struct ablkcipher_request *req;
607
608 req = kmalloc(sizeof(struct ablkcipher_request) +
609 crypto_ablkcipher_reqsize(tfm), gfp);
610
611 if (likely(req))
612 ablkcipher_request_set_tfm(req, tfm);
613
614 return req;
615}
616
617static inline void ablkcipher_request_free(struct ablkcipher_request *req)
618{
619 kfree(req);
620}
621
622static inline void ablkcipher_request_set_callback(
623 struct ablkcipher_request *req,
624 u32 flags, crypto_completion_t complete, void *data)
625{
626 req->base.complete = complete;
627 req->base.data = data;
628 req->base.flags = flags;
629}
630
631static inline void ablkcipher_request_set_crypt(
632 struct ablkcipher_request *req,
633 struct scatterlist *src, struct scatterlist *dst,
634 unsigned int nbytes, void *iv)
635{
636 req->src = src;
637 req->dst = dst;
638 req->nbytes = nbytes;
639 req->info = iv;
640}
641
414static inline struct crypto_blkcipher *__crypto_blkcipher_cast( 642static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
415 struct crypto_tfm *tfm) 643 struct crypto_tfm *tfm)
416{ 644{
@@ -427,9 +655,9 @@ static inline struct crypto_blkcipher *crypto_blkcipher_cast(
427static inline struct crypto_blkcipher *crypto_alloc_blkcipher( 655static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
428 const char *alg_name, u32 type, u32 mask) 656 const char *alg_name, u32 type, u32 mask)
429{ 657{
430 type &= ~CRYPTO_ALG_TYPE_MASK; 658 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
431 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 659 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
432 mask |= CRYPTO_ALG_TYPE_MASK; 660 mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC;
433 661
434 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask)); 662 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
435} 663}
@@ -447,9 +675,9 @@ static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
447 675
448static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask) 676static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
449{ 677{
450 type &= ~CRYPTO_ALG_TYPE_MASK; 678 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
451 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 679 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
452 mask |= CRYPTO_ALG_TYPE_MASK; 680 mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC;
453 681
454 return crypto_has_alg(alg_name, type, mask); 682 return crypto_has_alg(alg_name, type, mask);
455} 683}
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 1cb054bd93f..fda2148d8c8 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -260,19 +260,20 @@ enum {
260 260
261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) 261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
262{ 262{
263 return (struct dccp_hdr *)skb->h.raw; 263 return (struct dccp_hdr *)skb_transport_header(skb);
264} 264}
265 265
266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen) 266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
267{ 267{
268 skb->h.raw = skb_push(skb, headlen); 268 skb_push(skb, headlen);
269 memset(skb->h.raw, 0, headlen); 269 skb_reset_transport_header(skb);
270 return dccp_hdr(skb); 270 return memset(skb_transport_header(skb), 0, headlen);
271} 271}
272 272
273static 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)
274{ 274{
275 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 275 return (struct dccp_hdr_ext *)(skb_transport_header(skb) +
276 sizeof(struct dccp_hdr));
276} 277}
277 278
278static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) 279static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
@@ -301,12 +302,14 @@ static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
301 302
302static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) 303static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
303{ 304{
304 return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb)); 305 return (struct dccp_hdr_request *)(skb_transport_header(skb) +
306 dccp_basic_hdr_len(skb));
305} 307}
306 308
307static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) 309static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
308{ 310{
309 return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb)); 311 return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
312 dccp_basic_hdr_len(skb));
310} 313}
311 314
312static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) 315static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
@@ -317,12 +320,14 @@ static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
317 320
318static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) 321static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
319{ 322{
320 return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb)); 323 return (struct dccp_hdr_response *)(skb_transport_header(skb) +
324 dccp_basic_hdr_len(skb));
321} 325}
322 326
323static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) 327static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
324{ 328{
325 return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); 329 return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
330 dccp_basic_hdr_len(skb));
326} 331}
327 332
328static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) 333static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
@@ -460,26 +465,27 @@ struct dccp_ackvec;
460 * @dccps_service_list - second .. last service code on passive socket 465 * @dccps_service_list - second .. last service code on passive socket
461 * @dccps_timestamp_time - time of latest TIMESTAMP option 466 * @dccps_timestamp_time - time of latest TIMESTAMP option
462 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 467 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
463 * @dccps_l_ack_ratio - 468 * @dccps_l_ack_ratio - feature-local Ack Ratio
464 * @dccps_r_ack_ratio - 469 * @dccps_r_ack_ratio - feature-remote Ack Ratio
465 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 470 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
466 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 471 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
467 * @dccps_ndp_count - number of Non Data Packets since last data packet 472 * @dccps_ndp_count - number of Non Data Packets since last data packet
468 * @dccps_mss_cache - 473 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
469 * @dccps_minisock - 474 * @dccps_minisock - associated minisock (accessed via dccp_msk)
470 * @dccps_hc_rx_ackvec - rx half connection ack vector 475 * @dccps_hc_rx_ackvec - rx half connection ack vector
471 * @dccps_hc_rx_ccid - 476 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
472 * @dccps_hc_tx_ccid - 477 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
473 * @dccps_options_received - 478 * @dccps_options_received - parsed set of retrieved options
474 * @dccps_epoch - 479 * @dccps_role - role of this sock, one of %dccp_role
475 * @dccps_role - Role of this sock, one of %dccp_role 480 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
476 * @dccps_hc_rx_insert_options - 481 * @dccps_hc_tx_insert_options - sender wants to add options when sending
477 * @dccps_hc_tx_insert_options -
478 * @dccps_xmit_timer - timer for when CCID is not ready to send 482 * @dccps_xmit_timer - timer for when CCID is not ready to send
483 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
479 */ 484 */
480struct dccp_sock { 485struct dccp_sock {
481 /* inet_connection_sock has to be the first member of dccp_sock */ 486 /* inet_connection_sock has to be the first member of dccp_sock */
482 struct inet_connection_sock dccps_inet_connection; 487 struct inet_connection_sock dccps_inet_connection;
488#define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime
483 __u64 dccps_swl; 489 __u64 dccps_swl;
484 __u64 dccps_swh; 490 __u64 dccps_swh;
485 __u64 dccps_awl; 491 __u64 dccps_awl;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 9fa0983d1aa..5a9c49534d0 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -44,6 +44,8 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode,
44 struct dentry *parent, u16 *value); 44 struct dentry *parent, u16 *value);
45struct dentry *debugfs_create_u32(const char *name, mode_t mode, 45struct dentry *debugfs_create_u32(const char *name, mode_t mode,
46 struct dentry *parent, u32 *value); 46 struct dentry *parent, u32 *value);
47struct dentry *debugfs_create_u64(const char *name, mode_t mode,
48 struct dentry *parent, u64 *value);
47struct dentry *debugfs_create_bool(const char *name, mode_t mode, 49struct dentry *debugfs_create_bool(const char *name, mode_t mode,
48 struct dentry *parent, u32 *value); 50 struct dentry *parent, u32 *value);
49 51
@@ -104,6 +106,13 @@ static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode,
104 return ERR_PTR(-ENODEV); 106 return ERR_PTR(-ENODEV);
105} 107}
106 108
109static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode,
110 struct dentry *parent,
111 u64 *value)
112{
113 return ERR_PTR(-ENODEV);
114}
115
107static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 116static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
108 struct dentry *parent, 117 struct dentry *parent,
109 u32 *value) 118 u32 *value)
diff --git a/include/linux/device.h b/include/linux/device.h
index 5cf30e95c8b..6579068134d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -34,11 +34,26 @@ struct device;
34struct device_driver; 34struct device_driver;
35struct class; 35struct class;
36struct class_device; 36struct class_device;
37struct bus_type;
38
39struct bus_attribute {
40 struct attribute attr;
41 ssize_t (*show)(struct bus_type *, char * buf);
42 ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
43};
44
45#define BUS_ATTR(_name,_mode,_show,_store) \
46struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
47
48extern int __must_check bus_create_file(struct bus_type *,
49 struct bus_attribute *);
50extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
37 51
38struct bus_type { 52struct bus_type {
39 const char * name; 53 const char * name;
54 struct module * owner;
40 55
41 struct subsystem subsys; 56 struct kset subsys;
42 struct kset drivers; 57 struct kset drivers;
43 struct kset devices; 58 struct kset devices;
44 struct klist klist_devices; 59 struct klist klist_devices;
@@ -49,6 +64,8 @@ struct bus_type {
49 struct bus_attribute * bus_attrs; 64 struct bus_attribute * bus_attrs;
50 struct device_attribute * dev_attrs; 65 struct device_attribute * dev_attrs;
51 struct driver_attribute * drv_attrs; 66 struct driver_attribute * drv_attrs;
67 struct bus_attribute drivers_autoprobe_attr;
68 struct bus_attribute drivers_probe_attr;
52 69
53 int (*match)(struct device * dev, struct device_driver * drv); 70 int (*match)(struct device * dev, struct device_driver * drv);
54 int (*uevent)(struct device *dev, char **envp, 71 int (*uevent)(struct device *dev, char **envp,
@@ -61,6 +78,8 @@ struct bus_type {
61 int (*suspend_late)(struct device * dev, pm_message_t state); 78 int (*suspend_late)(struct device * dev, pm_message_t state);
62 int (*resume_early)(struct device * dev); 79 int (*resume_early)(struct device * dev);
63 int (*resume)(struct device * dev); 80 int (*resume)(struct device * dev);
81
82 unsigned int drivers_autoprobe:1;
64}; 83};
65 84
66extern int __must_check bus_register(struct bus_type * bus); 85extern int __must_check bus_register(struct bus_type * bus);
@@ -102,26 +121,10 @@ extern int bus_unregister_notifier(struct bus_type *bus,
102#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 121#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
103 unbound */ 122 unbound */
104 123
105/* sysfs interface for exporting bus attributes */
106
107struct bus_attribute {
108 struct attribute attr;
109 ssize_t (*show)(struct bus_type *, char * buf);
110 ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
111};
112
113#define BUS_ATTR(_name,_mode,_show,_store) \
114struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
115
116extern int __must_check bus_create_file(struct bus_type *,
117 struct bus_attribute *);
118extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
119
120struct device_driver { 124struct device_driver {
121 const char * name; 125 const char * name;
122 struct bus_type * bus; 126 struct bus_type * bus;
123 127
124 struct completion unloaded;
125 struct kobject kobj; 128 struct kobject kobj;
126 struct klist klist_devices; 129 struct klist klist_devices;
127 struct klist_node knode_bus; 130 struct klist_node knode_bus;
@@ -135,8 +138,6 @@ struct device_driver {
135 void (*shutdown) (struct device * dev); 138 void (*shutdown) (struct device * dev);
136 int (*suspend) (struct device * dev, pm_message_t state); 139 int (*suspend) (struct device * dev, pm_message_t state);
137 int (*resume) (struct device * dev); 140 int (*resume) (struct device * dev);
138
139 unsigned int multithread_probe:1;
140}; 141};
141 142
142 143
@@ -177,14 +178,13 @@ struct class {
177 const char * name; 178 const char * name;
178 struct module * owner; 179 struct module * owner;
179 180
180 struct subsystem subsys; 181 struct kset subsys;
181 struct list_head children; 182 struct list_head children;
182 struct list_head devices; 183 struct list_head devices;
183 struct list_head interfaces; 184 struct list_head interfaces;
185 struct kset class_dirs;
184 struct semaphore sem; /* locks both the children and interfaces lists */ 186 struct semaphore sem; /* locks both the children and interfaces lists */
185 187
186 struct kobject *virtual_dir;
187
188 struct class_attribute * class_attrs; 188 struct class_attribute * class_attrs;
189 struct class_device_attribute * class_dev_attrs; 189 struct class_device_attribute * class_dev_attrs;
190 struct device_attribute * dev_attrs; 190 struct device_attribute * dev_attrs;
@@ -328,11 +328,23 @@ extern struct class_device *class_device_create(struct class *cls,
328 __attribute__((format(printf,5,6))); 328 __attribute__((format(printf,5,6)));
329extern void class_device_destroy(struct class *cls, dev_t devt); 329extern void class_device_destroy(struct class *cls, dev_t devt);
330 330
331/*
332 * The type of device, "struct device" is embedded in. A class
333 * or bus can contain devices of different types
334 * like "partitions" and "disks", "mouse" and "event".
335 * This identifies the device type and carries type-specific
336 * information, equivalent to the kobj_type of a kobject.
337 * If "name" is specified, the uevent will contain it in
338 * the DEVTYPE variable.
339 */
331struct device_type { 340struct device_type {
332 struct device_attribute *attrs; 341 const char *name;
342 struct attribute_group **groups;
333 int (*uevent)(struct device *dev, char **envp, int num_envp, 343 int (*uevent)(struct device *dev, char **envp, int num_envp,
334 char *buffer, int buffer_size); 344 char *buffer, int buffer_size);
335 void (*release)(struct device *dev); 345 void (*release)(struct device *dev);
346 int (*suspend)(struct device * dev, pm_message_t state);
347 int (*resume)(struct device * dev);
336}; 348};
337 349
338/* interface for exporting device attributes */ 350/* interface for exporting device attributes */
@@ -354,8 +366,12 @@ extern int __must_check device_create_bin_file(struct device *dev,
354 struct bin_attribute *attr); 366 struct bin_attribute *attr);
355extern void device_remove_bin_file(struct device *dev, 367extern void device_remove_bin_file(struct device *dev,
356 struct bin_attribute *attr); 368 struct bin_attribute *attr);
357extern int device_schedule_callback(struct device *dev, 369extern int device_schedule_callback_owner(struct device *dev,
358 void (*func)(struct device *)); 370 void (*func)(struct device *), struct module *owner);
371
372/* This is a macro to avoid include problems with THIS_MODULE */
373#define device_schedule_callback(dev, func) \
374 device_schedule_callback_owner(dev, func, THIS_MODULE)
359 375
360/* device resource management */ 376/* device resource management */
361typedef void (*dr_release_t)(struct device *dev, void *res); 377typedef void (*dr_release_t)(struct device *dev, void *res);
@@ -542,8 +558,8 @@ extern void device_shutdown(void);
542 558
543 559
544/* drivers/base/firmware.c */ 560/* drivers/base/firmware.c */
545extern int __must_check firmware_register(struct subsystem *); 561extern int __must_check firmware_register(struct kset *);
546extern void firmware_unregister(struct subsystem *); 562extern void firmware_unregister(struct kset *);
547 563
548/* debugging and troubleshooting/diagnostic helpers. */ 564/* debugging and troubleshooting/diagnostic helpers. */
549extern const char *dev_driver_string(struct device *dev); 565extern const char *dev_driver_string(struct device *dev);
@@ -554,7 +570,11 @@ extern const char *dev_driver_string(struct device *dev);
554#define dev_dbg(dev, format, arg...) \ 570#define dev_dbg(dev, format, arg...) \
555 dev_printk(KERN_DEBUG , dev , format , ## arg) 571 dev_printk(KERN_DEBUG , dev , format , ## arg)
556#else 572#else
557#define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0) 573static inline int __attribute__ ((format (printf, 2, 3)))
574dev_dbg(struct device * dev, const char * fmt, ...)
575{
576 return 0;
577}
558#endif 578#endif
559 579
560#define dev_err(dev, format, arg...) \ 580#define dev_err(dev, format, arg...) \
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index 0874a67c6b9..89412e18f57 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -47,7 +47,9 @@ typedef enum {
47typedef enum { 47typedef enum {
48 AUDIO_STEREO, 48 AUDIO_STEREO,
49 AUDIO_MONO_LEFT, 49 AUDIO_MONO_LEFT,
50 AUDIO_MONO_RIGHT 50 AUDIO_MONO_RIGHT,
51 AUDIO_MONO,
52 AUDIO_STEREO_SWAPPED
51} audio_channel_select_t; 53} audio_channel_select_t;
52 54
53 55
@@ -133,5 +135,6 @@ typedef uint16_t audio_attributes_t;
133 * extracted by the PES parser. 135 * extracted by the PES parser.
134 */ 136 */
135#define AUDIO_GET_PTS _IOR('o', 19, __u64) 137#define AUDIO_GET_PTS _IOR('o', 19, __u64)
138#define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20)
136 139
137#endif /* _DVBAUDIO_H_ */ 140#endif /* _DVBAUDIO_H_ */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 6183c9c4849..126e0c26cb0 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 3 26#define DVB_API_VERSION 3
27#define DVB_API_VERSION_MINOR 1 27#define DVB_API_VERSION_MINOR 2
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index faebfda397f..93e4c3a6d19 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -80,14 +80,70 @@ typedef enum {
80} video_play_state_t; 80} video_play_state_t;
81 81
82 82
83/* Decoder commands */
84#define VIDEO_CMD_PLAY (0)
85#define VIDEO_CMD_STOP (1)
86#define VIDEO_CMD_FREEZE (2)
87#define VIDEO_CMD_CONTINUE (3)
88
89/* Flags for VIDEO_CMD_FREEZE */
90#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
91
92/* Flags for VIDEO_CMD_STOP */
93#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
94#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
95
96/* Play input formats: */
97/* The decoder has no special format requirements */
98#define VIDEO_PLAY_FMT_NONE (0)
99/* The decoder requires full GOPs */
100#define VIDEO_PLAY_FMT_GOP (1)
101
102/* The structure must be zeroed before use by the application
103 This ensures it can be extended safely in the future. */
104struct video_command {
105 __u32 cmd;
106 __u32 flags;
107 union {
108 struct {
109 __u64 pts;
110 } stop;
111
112 struct {
113 /* 0 or 1000 specifies normal speed,
114 1 specifies forward single stepping,
115 -1 specifies backward single stepping,
116 >1: playback at speed/1000 of the normal speed,
117 <-1: reverse playback at (-speed/1000) of the normal speed. */
118 __s32 speed;
119 __u32 format;
120 } play;
121
122 struct {
123 __u32 data[16];
124 } raw;
125 };
126};
127
128/* FIELD_UNKNOWN can be used if the hardware does not know whether
129 the Vsync is for an odd, even or progressive (i.e. non-interlaced)
130 field. */
131#define VIDEO_VSYNC_FIELD_UNKNOWN (0)
132#define VIDEO_VSYNC_FIELD_ODD (1)
133#define VIDEO_VSYNC_FIELD_EVEN (2)
134#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
135
83struct video_event { 136struct video_event {
84 int32_t type; 137 int32_t type;
85#define VIDEO_EVENT_SIZE_CHANGED 1 138#define VIDEO_EVENT_SIZE_CHANGED 1
86#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 139#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
140#define VIDEO_EVENT_DECODER_STOPPED 3
141#define VIDEO_EVENT_VSYNC 4
87 time_t timestamp; 142 time_t timestamp;
88 union { 143 union {
89 video_size_t size; 144 video_size_t size;
90 unsigned int frame_rate; /* in frames per 1000sec */ 145 unsigned int frame_rate; /* in frames per 1000sec */
146 unsigned char vsync_field; /* unknown/odd/even/progressive */
91 } u; 147 } u;
92}; 148};
93 149
@@ -213,4 +269,10 @@ typedef uint16_t video_attributes_t;
213 */ 269 */
214#define VIDEO_GET_PTS _IOR('o', 57, __u64) 270#define VIDEO_GET_PTS _IOR('o', 57, __u64)
215 271
272/* Read the number of displayed frames since the decoder was started */
273#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
274
275#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
276#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
277
216#endif /*_DVBVIDEO_H_*/ 278#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 60713e6ea29..8b17ffe222c 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -83,6 +83,23 @@ typedef __s64 Elf64_Sxword;
83#define DT_DEBUG 21 83#define DT_DEBUG 21
84#define DT_TEXTREL 22 84#define DT_TEXTREL 22
85#define DT_JMPREL 23 85#define DT_JMPREL 23
86#define DT_ENCODING 32
87#define OLD_DT_LOOS 0x60000000
88#define DT_LOOS 0x6000000d
89#define DT_HIOS 0x6ffff000
90#define DT_VALRNGLO 0x6ffffd00
91#define DT_VALRNGHI 0x6ffffdff
92#define DT_ADDRRNGLO 0x6ffffe00
93#define DT_ADDRRNGHI 0x6ffffeff
94#define DT_VERSYM 0x6ffffff0
95#define DT_RELACOUNT 0x6ffffff9
96#define DT_RELCOUNT 0x6ffffffa
97#define DT_FLAGS_1 0x6ffffffb
98#define DT_VERDEF 0x6ffffffc
99#define DT_VERDEFNUM 0x6ffffffd
100#define DT_VERNEED 0x6ffffffe
101#define DT_VERNEEDNUM 0x6fffffff
102#define OLD_DT_HIOS 0x6fffffff
86#define DT_LOPROC 0x70000000 103#define DT_LOPROC 0x70000000
87#define DT_HIPROC 0x7fffffff 104#define DT_HIPROC 0x7fffffff
88 105
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index 67396db141e..9a1e0674e56 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -39,12 +39,12 @@
39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef) 39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
40 */ 40 */
41#define ELFNOTE(name, type, desctype, descdata) \ 41#define ELFNOTE(name, type, desctype, descdata) \
42.pushsection .note.name ; \ 42.pushsection .note.name, "",@note ; \
43 .align 4 ; \ 43 .align 4 ; \
44 .long 2f - 1f /* namesz */ ; \ 44 .long 2f - 1f /* namesz */ ; \
45 .long 4f - 3f /* descsz */ ; \ 45 .long 4f - 3f /* descsz */ ; \
46 .long type ; \ 46 .long type ; \
471:.asciz "name" ; \ 471:.asciz #name ; \
482:.align 4 ; \ 482:.align 4 ; \
493:desctype descdata ; \ 493:desctype descdata ; \
504:.align 4 ; \ 504:.align 4 ; \
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c6310aef5ab..f2d248f8cc9 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -434,6 +434,7 @@ struct ethtool_ops {
434#define SUPPORTED_10000baseT_Full (1 << 12) 434#define SUPPORTED_10000baseT_Full (1 << 12)
435#define SUPPORTED_Pause (1 << 13) 435#define SUPPORTED_Pause (1 << 13)
436#define SUPPORTED_Asym_Pause (1 << 14) 436#define SUPPORTED_Asym_Pause (1 << 14)
437#define SUPPORTED_2500baseX_Full (1 << 15)
437 438
438/* Indicates what features are advertised by the interface. */ 439/* Indicates what features are advertised by the interface. */
439#define ADVERTISED_10baseT_Half (1 << 0) 440#define ADVERTISED_10baseT_Half (1 << 0)
@@ -451,6 +452,7 @@ struct ethtool_ops {
451#define ADVERTISED_10000baseT_Full (1 << 12) 452#define ADVERTISED_10000baseT_Full (1 << 12)
452#define ADVERTISED_Pause (1 << 13) 453#define ADVERTISED_Pause (1 << 13)
453#define ADVERTISED_Asym_Pause (1 << 14) 454#define ADVERTISED_Asym_Pause (1 << 14)
455#define ADVERTISED_2500baseX_Full (1 << 15)
454 456
455/* The following are all involved in forcing a particular link 457/* The following are all involved in forcing a particular link
456 * mode for the device for setting things. When getting the 458 * mode for the device for setting things. When getting the
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 8270aac2aa5..87b606b63f1 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -5,8 +5,13 @@
5#include <linux/rtnetlink.h> 5#include <linux/rtnetlink.h>
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 0x00000001
9#define FIB_RULE_INVERT 2 9#define FIB_RULE_INVERT 0x00000002
10#define FIB_RULE_UNRESOLVED 0x00000004
11#define FIB_RULE_DEV_DETACHED 0x00000008
12
13/* try to find source address in routing lookups */
14#define FIB_RULE_FIND_SADDR 0x00010000
10 15
11struct fib_rule_hdr 16struct fib_rule_hdr
12{ 17{
@@ -29,7 +34,7 @@ enum
29 FRA_DST, /* destination address */ 34 FRA_DST, /* destination address */
30 FRA_SRC, /* source address */ 35 FRA_SRC, /* source address */
31 FRA_IFNAME, /* interface name */ 36 FRA_IFNAME, /* interface name */
32 FRA_UNUSED1, 37 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
33 FRA_UNUSED2, 38 FRA_UNUSED2,
34 FRA_PRIORITY, /* priority/preference */ 39 FRA_PRIORITY, /* priority/preference */
35 FRA_UNUSED3, 40 FRA_UNUSED3,
@@ -51,8 +56,8 @@ enum
51{ 56{
52 FR_ACT_UNSPEC, 57 FR_ACT_UNSPEC,
53 FR_ACT_TO_TBL, /* Pass to fixed table */ 58 FR_ACT_TO_TBL, /* Pass to fixed table */
54 FR_ACT_RES1, 59 FR_ACT_GOTO, /* Jump to another rule */
55 FR_ACT_RES2, 60 FR_ACT_NOP, /* No operation */
56 FR_ACT_RES3, 61 FR_ACT_RES3,
57 FR_ACT_RES4, 62 FR_ACT_RES4,
58 FR_ACT_BLACKHOLE, /* Drop without notification */ 63 FR_ACT_BLACKHOLE, /* Drop without notification */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 86ec3f4a7da..7c0077f06e2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -843,8 +843,13 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
843extern int fcntl_getlease(struct file *filp); 843extern int fcntl_getlease(struct file *filp);
844 844
845/* fs/sync.c */ 845/* fs/sync.c */
846extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, 846extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
847 unsigned int flags); 847 loff_t endbyte, unsigned int flags);
848static inline int do_sync_file_range(struct file *file, loff_t offset,
849 loff_t endbyte, unsigned int flags)
850{
851 return do_sync_mapping_range(file->f_mapping, offset, endbyte, flags);
852}
848 853
849/* fs/locks.c */ 854/* fs/locks.c */
850extern void locks_init_lock(struct file_lock *); 855extern void locks_init_lock(struct file_lock *);
@@ -1411,7 +1416,7 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1411extern int vfs_statfs(struct dentry *, struct kstatfs *); 1416extern int vfs_statfs(struct dentry *, struct kstatfs *);
1412 1417
1413/* /sys/fs */ 1418/* /sys/fs */
1414extern struct subsystem fs_subsys; 1419extern struct kset fs_subsys;
1415 1420
1416#define FLOCK_VERIFY_READ 1 1421#define FLOCK_VERIFY_READ 1
1417#define FLOCK_VERIFY_WRITE 2 1422#define FLOCK_VERIFY_WRITE 2
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index abb64c437f6..73710d61777 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -120,44 +120,5 @@ struct fsl_spi_platform_data {
120 u32 sysclk; 120 u32 sysclk;
121}; 121};
122 122
123/* Ethernet interface (phy management and speed)
124*/
125enum enet_interface {
126 ENET_10_MII, /* 10 Base T, MII interface */
127 ENET_10_RMII, /* 10 Base T, RMII interface */
128 ENET_10_RGMII, /* 10 Base T, RGMII interface */
129 ENET_100_MII, /* 100 Base T, MII interface */
130 ENET_100_RMII, /* 100 Base T, RMII interface */
131 ENET_100_RGMII, /* 100 Base T, RGMII interface */
132 ENET_1000_GMII, /* 1000 Base T, GMII interface */
133 ENET_1000_RGMII, /* 1000 Base T, RGMII interface */
134 ENET_1000_TBI, /* 1000 Base T, TBI interface */
135 ENET_1000_RTBI /* 1000 Base T, RTBI interface */
136};
137
138struct ucc_geth_platform_data {
139 /* device specific information */
140 u32 device_flags;
141 u32 phy_reg_addr;
142
143 /* board specific information */
144 u32 board_flags;
145 u8 rx_clock;
146 u8 tx_clock;
147 u32 phy_id;
148 enum enet_interface phy_interface;
149 u32 phy_interrupt;
150 u8 mac_addr[6];
151};
152
153/* Flags related to UCC Gigabit Ethernet device features */
154#define FSL_UGETH_DEV_HAS_GIGABIT 0x00000001
155#define FSL_UGETH_DEV_HAS_COALESCE 0x00000002
156#define FSL_UGETH_DEV_HAS_RMON 0x00000004
157
158/* Flags in ucc_geth_platform_data */
159#define FSL_UGETH_BRD_HAS_PHY_INTR 0x00000001
160 /* if not set use a timer */
161
162#endif /* _FSL_DEVICE_H_ */ 123#endif /* _FSL_DEVICE_H_ */
163#endif /* __KERNEL__ */ 124#endif /* __KERNEL__ */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 2b217c7b931..265d17830a0 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -3,10 +3,11 @@
3 3
4struct gpio_keys_button { 4struct gpio_keys_button {
5 /* Configuration parameters */ 5 /* Configuration parameters */
6 int keycode; 6 int code; /* input event code (KEY_*, SW_*) */
7 int gpio; 7 int gpio;
8 int active_low; 8 int active_low;
9 char *desc; 9 char *desc;
10 int type; /* input event type (EV_KEY, EV_SW) */
10}; 11};
11 12
12struct gpio_keys_platform_data { 13struct gpio_keys_platform_data {
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index d4b333938f7..db390c511ad 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,8 +43,7 @@ struct hdlc_proto {
43 void (*stop)(struct net_device *dev); /* if open & !DCD */ 43 void (*stop)(struct net_device *dev); /* if open & !DCD */
44 void (*detach)(struct net_device *dev); 44 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 unsigned short (*type_trans)(struct sk_buff *skb, 46 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
47 struct net_device *dev);
48 struct module *module; 47 struct module *module;
49 struct hdlc_proto *next; /* next protocol in the list */ 48 struct hdlc_proto *next; /* next protocol in the list */
50}; 49};
@@ -132,8 +131,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
132{ 131{
133 hdlc_device *hdlc = dev_to_hdlc(dev); 132 hdlc_device *hdlc = dev_to_hdlc(dev);
134 133
135 skb->mac.raw = skb->data; 134 skb->dev = dev;
136 skb->dev = dev; 135 skb_reset_mac_header(skb);
137 136
138 if (hdlc->proto->type_trans) 137 if (hdlc->proto->type_trans)
139 return hdlc->proto->type_trans(skb, dev); 138 return hdlc->proto->type_trans(skb, dev);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 8c97d4d3fdb..37076b116ed 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -247,6 +247,11 @@ struct hid_item {
247 * HID device quirks. 247 * HID device quirks.
248 */ 248 */
249 249
250/*
251 * Increase this if you need to configure more HID quirks at module load time
252 */
253#define MAX_USBHID_BOOT_QUIRKS 4
254
250#define HID_QUIRK_INVERT 0x00000001 255#define HID_QUIRK_INVERT 0x00000001
251#define HID_QUIRK_NOTOUCH 0x00000002 256#define HID_QUIRK_NOTOUCH 0x00000002
252#define HID_QUIRK_IGNORE 0x00000004 257#define HID_QUIRK_IGNORE 0x00000004
@@ -267,8 +272,9 @@ struct hid_item {
267#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00020000 272#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00020000
268#define HID_QUIRK_IGNORE_MOUSE 0x00040000 273#define HID_QUIRK_IGNORE_MOUSE 0x00040000
269#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00080000 274#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00080000
270#define HID_QUIRK_LOGITECH_S510_DESCRIPTOR 0x00100000 275#define HID_QUIRK_LOGITECH_DESCRIPTOR 0x00100000
271#define HID_QUIRK_DUPLICATE_USAGES 0x00200000 276#define HID_QUIRK_DUPLICATE_USAGES 0x00200000
277#define HID_QUIRK_RESET_LEDS 0x00400000
272 278
273/* 279/*
274 * This is the global environment of the parser. This information is 280 * This is the global environment of the parser. This information is
@@ -494,6 +500,12 @@ void hid_output_report(struct hid_report *report, __u8 *data);
494void hid_free_device(struct hid_device *device); 500void hid_free_device(struct hid_device *device);
495struct hid_device *hid_parse_report(__u8 *start, unsigned size); 501struct hid_device *hid_parse_report(__u8 *start, unsigned size);
496 502
503/* HID quirks API */
504u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
505int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, const u32 quirks);
506int usbhid_quirks_init(char **quirks_param);
507void usbhid_quirks_exit(void);
508
497#ifdef CONFIG_HID_FF 509#ifdef CONFIG_HID_FF
498int hid_ff_init(struct hid_device *hid); 510int hid_ff_init(struct hid_device *hid);
499 511
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 645d440807c..a515eb0afdf 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -27,6 +27,8 @@ static inline void flush_kernel_dcache_page(struct page *page)
27unsigned int nr_free_highpages(void); 27unsigned int nr_free_highpages(void);
28extern unsigned long totalhigh_pages; 28extern unsigned long totalhigh_pages;
29 29
30void kmap_flush_unused(void);
31
30#else /* CONFIG_HIGHMEM */ 32#else /* CONFIG_HIGHMEM */
31 33
32static inline unsigned int nr_free_highpages(void) { return 0; } 34static inline unsigned int nr_free_highpages(void) { return 0; }
@@ -42,11 +44,20 @@ static inline void *kmap(struct page *page)
42 44
43#define kunmap(page) do { (void) (page); } while (0) 45#define kunmap(page) do { (void) (page); } while (0)
44 46
45#define kmap_atomic(page, idx) \ 47#include <asm/kmap_types.h>
46 ({ pagefault_disable(); page_address(page); }) 48
49static inline void *kmap_atomic(struct page *page, enum km_type idx)
50{
51 pagefault_disable();
52 return page_address(page);
53}
54#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx)
55
47#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0) 56#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0)
48#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 57#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
49#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 58#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
59
60#define kmap_flush_unused() do {} while(0)
50#endif 61#endif
51 62
52#endif /* CONFIG_HIGHMEM */ 63#endif /* CONFIG_HIGHMEM */
diff --git a/include/linux/hp_sdc.h b/include/linux/hp_sdc.h
index debd7151531..9db3d454887 100644
--- a/include/linux/hp_sdc.h
+++ b/include/linux/hp_sdc.h
@@ -71,6 +71,7 @@ typedef struct {
71 struct semaphore *semaphore; /* Semaphore to sleep on. */ 71 struct semaphore *semaphore; /* Semaphore to sleep on. */
72 } act; 72 } act;
73} hp_sdc_transaction; 73} hp_sdc_transaction;
74int __hp_sdc_enqueue_transaction(hp_sdc_transaction *this);
74int hp_sdc_enqueue_transaction(hp_sdc_transaction *this); 75int hp_sdc_enqueue_transaction(hp_sdc_transaction *this);
75int hp_sdc_dequeue_transaction(hp_sdc_transaction *this); 76int hp_sdc_dequeue_transaction(hp_sdc_transaction *this);
76 77
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 937da70cb4c..9ee0f800592 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -38,11 +38,14 @@ struct i2c_algo_bit_data {
38 int (*getscl) (void *data); 38 int (*getscl) (void *data);
39 39
40 /* local settings */ 40 /* local settings */
41 int udelay; /* half-clock-cycle time in microsecs */ 41 int udelay; /* half clock cycle time in us,
42 /* i.e. clock is (500 / udelay) KHz */ 42 minimum 2 us for fast-mode I2C,
43 minimum 5 us for standard-mode I2C and SMBus,
44 maximum 50 us for SMBus */
43 int timeout; /* in jiffies */ 45 int timeout; /* in jiffies */
44}; 46};
45 47
46int i2c_bit_add_bus(struct i2c_adapter *); 48int i2c_bit_add_bus(struct i2c_adapter *);
49int i2c_bit_add_numbered_bus(struct i2c_adapter *);
47 50
48#endif /* _LINUX_I2C_ALGO_BIT_H */ 51#endif /* _LINUX_I2C_ALGO_BIT_H */
diff --git a/include/linux/i2c-gpio.h b/include/linux/i2c-gpio.h
new file mode 100644
index 00000000000..c1bcb1f1d73
--- /dev/null
+++ b/include/linux/i2c-gpio.h
@@ -0,0 +1,38 @@
1/*
2 * i2c-gpio interface to platform code
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _LINUX_I2C_GPIO_H
11#define _LINUX_I2C_GPIO_H
12
13/**
14 * struct i2c_gpio_platform_data - Platform-dependent data for i2c-gpio
15 * @sda_pin: GPIO pin ID to use for SDA
16 * @scl_pin: GPIO pin ID to use for SCL
17 * @udelay: signal toggle delay. SCL frequency is (500 / udelay) kHz
18 * @timeout: clock stretching timeout in jiffies. If the slave keeps
19 * SCL low for longer than this, the transfer will time out.
20 * @sda_is_open_drain: SDA is configured as open drain, i.e. the pin
21 * isn't actively driven high when setting the output value high.
22 * gpio_get_value() must return the actual pin state even if the
23 * pin is configured as an output.
24 * @scl_is_open_drain: SCL is set up as open drain. Same requirements
25 * as for sda_is_open_drain apply.
26 * @scl_is_output_only: SCL output drivers cannot be turned off.
27 */
28struct i2c_gpio_platform_data {
29 unsigned int sda_pin;
30 unsigned int scl_pin;
31 int udelay;
32 int timeout;
33 unsigned int sda_is_open_drain:1;
34 unsigned int scl_is_open_drain:1;
35 unsigned int scl_is_output_only:1;
36};
37
38#endif /* _LINUX_I2C_GPIO_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 9c21dc793d7..0e8da684ce6 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -258,8 +258,9 @@
258/* --- MCP107 adapter */ 258/* --- MCP107 adapter */
259#define I2C_HW_MPC107 0x0d0000 259#define I2C_HW_MPC107 0x0d0000
260 260
261/* --- Marvell mv64xxx i2c adapter */ 261/* --- Embedded adapters */
262#define I2C_HW_MV64XXX 0x190000 262#define I2C_HW_MV64XXX 0x190000
263#define I2C_HW_BLACKFIN 0x190001 /* ADI Blackfin I2C TWI driver */
263 264
264/* --- Miscellaneous adapters */ 265/* --- Miscellaneous adapters */
265#define I2C_HW_SAA7146 0x060000 /* SAA7146 video decoder bus */ 266#define I2C_HW_SAA7146 0x060000 /* SAA7146 video decoder bus */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 9428092017e..cae7d618030 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -35,11 +35,6 @@
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37 37
38/* --- For i2c-isa ---------------------------------------------------- */
39
40extern void i2c_adapter_dev_release(struct device *dev);
41extern struct device_driver i2c_adapter_driver;
42extern struct class i2c_adapter_class;
43extern struct bus_type i2c_bus_type; 38extern struct bus_type i2c_bus_type;
44 39
45/* --- General options ------------------------------------------------ */ 40/* --- General options ------------------------------------------------ */
@@ -87,6 +82,9 @@ extern s32 i2c_smbus_write_byte_data(struct i2c_client * client,
87extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); 82extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
88extern s32 i2c_smbus_write_word_data(struct i2c_client * client, 83extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
89 u8 command, u16 value); 84 u8 command, u16 value);
85/* Returns the number of read bytes */
86extern s32 i2c_smbus_read_block_data(struct i2c_client *client,
87 u8 command, u8 *values);
90extern s32 i2c_smbus_write_block_data(struct i2c_client * client, 88extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
91 u8 command, u8 length, 89 u8 command, u8 length,
92 const u8 *values); 90 const u8 *values);
@@ -114,7 +112,7 @@ struct i2c_driver {
114 * can be used by the driver to test if the bus meets its conditions 112 * can be used by the driver to test if the bus meets its conditions
115 * & seek for the presence of the chip(s) it supports. If found, it 113 * & seek for the presence of the chip(s) it supports. If found, it
116 * registers the client(s) that are on the bus to the i2c admin. via 114 * registers the client(s) that are on the bus to the i2c admin. via
117 * i2c_attach_client. 115 * i2c_attach_client. (LEGACY I2C DRIVERS ONLY)
118 */ 116 */
119 int (*attach_adapter)(struct i2c_adapter *); 117 int (*attach_adapter)(struct i2c_adapter *);
120 int (*detach_adapter)(struct i2c_adapter *); 118 int (*detach_adapter)(struct i2c_adapter *);
@@ -122,10 +120,17 @@ struct i2c_driver {
122 /* tells the driver that a client is about to be deleted & gives it 120 /* tells the driver that a client is about to be deleted & gives it
123 * the chance to remove its private data. Also, if the client struct 121 * the chance to remove its private data. Also, if the client struct
124 * has been dynamically allocated by the driver in the function above, 122 * has been dynamically allocated by the driver in the function above,
125 * it must be freed here. 123 * it must be freed here. (LEGACY I2C DRIVERS ONLY)
126 */ 124 */
127 int (*detach_client)(struct i2c_client *); 125 int (*detach_client)(struct i2c_client *);
128 126
127 /* Standard driver model interfaces, for "new style" i2c drivers.
128 * With the driver model, device enumeration is NEVER done by drivers;
129 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY)
130 */
131 int (*probe)(struct i2c_client *);
132 int (*remove)(struct i2c_client *);
133
129 /* driver model interfaces that don't relate to enumeration */ 134 /* driver model interfaces that don't relate to enumeration */
130 void (*shutdown)(struct i2c_client *); 135 void (*shutdown)(struct i2c_client *);
131 int (*suspend)(struct i2c_client *, pm_message_t mesg); 136 int (*suspend)(struct i2c_client *, pm_message_t mesg);
@@ -141,25 +146,34 @@ struct i2c_driver {
141}; 146};
142#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 147#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
143 148
144#define I2C_NAME_SIZE 50 149#define I2C_NAME_SIZE 20
145 150
146/* 151/**
147 * i2c_client identifies a single device (i.e. chip) that is connected to an 152 * struct i2c_client - represent an I2C slave device
148 * i2c bus. The behaviour is defined by the routines of the driver. This 153 * @addr: Address used on the I2C bus connected to the parent adapter.
149 * function is mainly used for lookup & other admin. functions. 154 * @name: Indicates the type of the device, usually a chip name that's
155 * generic enough to hide second-sourcing and compatible revisions.
156 * @dev: Driver model device node for the slave.
157 * @driver_name: Identifies new-style driver used with this device; also
158 * used as the module name for hotplug/coldplug modprobe support.
159 *
160 * An i2c_client identifies a single device (i.e. chip) connected to an
161 * i2c bus. The behaviour is defined by the routines of the driver.
150 */ 162 */
151struct i2c_client { 163struct i2c_client {
152 unsigned int flags; /* div., see below */ 164 unsigned short flags; /* div., see below */
153 unsigned short addr; /* chip address - NOTE: 7bit */ 165 unsigned short addr; /* chip address - NOTE: 7bit */
154 /* addresses are stored in the */ 166 /* addresses are stored in the */
155 /* _LOWER_ 7 bits */ 167 /* _LOWER_ 7 bits */
168 char name[I2C_NAME_SIZE];
156 struct i2c_adapter *adapter; /* the adapter we sit on */ 169 struct i2c_adapter *adapter; /* the adapter we sit on */
157 struct i2c_driver *driver; /* and our access routines */ 170 struct i2c_driver *driver; /* and our access routines */
158 int usage_count; /* How many accesses currently */ 171 int usage_count; /* How many accesses currently */
159 /* to the client */ 172 /* to the client */
160 struct device dev; /* the device structure */ 173 struct device dev; /* the device structure */
174 int irq; /* irq issued by device (or -1) */
175 char driver_name[KOBJ_NAME_LEN];
161 struct list_head list; 176 struct list_head list;
162 char name[I2C_NAME_SIZE];
163 struct completion released; 177 struct completion released;
164}; 178};
165#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 179#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -179,6 +193,76 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
179 dev_set_drvdata (&dev->dev, data); 193 dev_set_drvdata (&dev->dev, data);
180} 194}
181 195
196/**
197 * struct i2c_board_info - template for device creation
198 * @driver_name: identifies the driver to be bound to the device
199 * @type: optional chip type information, to initialize i2c_client.name
200 * @flags: to initialize i2c_client.flags
201 * @addr: stored in i2c_client.addr
202 * @platform_data: stored in i2c_client.dev.platform_data
203 * @irq: stored in i2c_client.irq
204
205 * I2C doesn't actually support hardware probing, although controllers and
206 * devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's
207 * a device at a given address. Drivers commonly need more information than
208 * that, such as chip type, configuration, associated IRQ, and so on.
209 *
210 * i2c_board_info is used to build tables of information listing I2C devices
211 * that are present. This information is used to grow the driver model tree
212 * for "new style" I2C drivers. For mainboards this is done statically using
213 * i2c_register_board_info(), where @bus_num represents an adapter that isn't
214 * yet available. For add-on boards, i2c_new_device() does this dynamically
215 * with the adapter already known.
216 */
217struct i2c_board_info {
218 char driver_name[KOBJ_NAME_LEN];
219 char type[I2C_NAME_SIZE];
220 unsigned short flags;
221 unsigned short addr;
222 void *platform_data;
223 int irq;
224};
225
226/**
227 * I2C_BOARD_INFO - macro used to list an i2c device and its driver
228 * @driver: identifies the driver to use with the device
229 * @dev_addr: the device's address on the bus.
230 *
231 * This macro initializes essential fields of a struct i2c_board_info,
232 * declaring what has been provided on a particular board. Optional
233 * fields (such as the chip type, its associated irq, or device-specific
234 * platform_data) are provided using conventional syntax.
235 */
236#define I2C_BOARD_INFO(driver,dev_addr) \
237 .driver_name = (driver), .addr = (dev_addr)
238
239
240/* Add-on boards should register/unregister their devices; e.g. a board
241 * with integrated I2C, a config eeprom, sensors, and a codec that's
242 * used in conjunction with the primary hardware.
243 */
244extern struct i2c_client *
245i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
246
247/* If you don't know the exact address of an I2C device, use this variant
248 * instead, which can probe for device presence in a list of possible
249 * addresses.
250 */
251extern struct i2c_client *
252i2c_new_probed_device(struct i2c_adapter *adap,
253 struct i2c_board_info *info,
254 unsigned short const *addr_list);
255
256extern void i2c_unregister_device(struct i2c_client *);
257
258/* Mainboard arch_initcall() code should register all its I2C devices.
259 * This is done at arch_initcall time, before declaring any i2c adapters.
260 * Modules for add-on boards must use other calls.
261 */
262extern int
263i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n);
264
265
182/* 266/*
183 * The following structs are for those who like to implement new bus drivers: 267 * The following structs are for those who like to implement new bus drivers:
184 * i2c_algorithm is the interface to a class of hardware solutions which can 268 * i2c_algorithm is the interface to a class of hardware solutions which can
@@ -228,17 +312,14 @@ struct i2c_adapter {
228 int timeout; 312 int timeout;
229 int retries; 313 int retries;
230 struct device dev; /* the adapter device */ 314 struct device dev; /* the adapter device */
231 struct class_device class_dev; /* the class device */
232 315
233 int nr; 316 int nr;
234 struct list_head clients; 317 struct list_head clients;
235 struct list_head list; 318 struct list_head list;
236 char name[I2C_NAME_SIZE]; 319 char name[48];
237 struct completion dev_released; 320 struct completion dev_released;
238 struct completion class_dev_released;
239}; 321};
240#define dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 322#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
241#define class_dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, class_dev)
242 323
243static inline void *i2c_get_adapdata (struct i2c_adapter *dev) 324static inline void *i2c_get_adapdata (struct i2c_adapter *dev)
244{ 325{
@@ -290,9 +371,10 @@ struct i2c_client_address_data {
290 */ 371 */
291extern int i2c_add_adapter(struct i2c_adapter *); 372extern int i2c_add_adapter(struct i2c_adapter *);
292extern int i2c_del_adapter(struct i2c_adapter *); 373extern int i2c_del_adapter(struct i2c_adapter *);
374extern int i2c_add_numbered_adapter(struct i2c_adapter *);
293 375
294extern int i2c_register_driver(struct module *, struct i2c_driver *); 376extern int i2c_register_driver(struct module *, struct i2c_driver *);
295extern int i2c_del_driver(struct i2c_driver *); 377extern void i2c_del_driver(struct i2c_driver *);
296 378
297static inline int i2c_add_driver(struct i2c_driver *driver) 379static inline int i2c_add_driver(struct i2c_driver *driver)
298{ 380{
@@ -365,6 +447,7 @@ struct i2c_msg {
365#define I2C_M_REV_DIR_ADDR 0x2000 447#define I2C_M_REV_DIR_ADDR 0x2000
366#define I2C_M_IGNORE_NAK 0x1000 448#define I2C_M_IGNORE_NAK 0x1000
367#define I2C_M_NO_RD_ACK 0x0800 449#define I2C_M_NO_RD_ACK 0x0800
450#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
368 __u16 len; /* msg length */ 451 __u16 len; /* msg length */
369 __u8 *buf; /* pointer to msg data */ 452 __u8 *buf; /* pointer to msg data */
370}; 453};
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 24da4fbc1a2..474f2a51cf0 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -82,6 +82,15 @@ struct icmphdr {
82 } un; 82 } un;
83}; 83};
84 84
85#ifdef __KERNEL__
86#include <linux/skbuff.h>
87
88static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
89{
90 return (struct icmphdr *)skb_transport_header(skb);
91}
92#endif
93
85/* 94/*
86 * constants for (set|get)sockopt 95 * constants for (set|get)sockopt
87 */ 96 */
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 68d3526c3a0..7c5e9817e99 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -75,6 +75,15 @@ struct icmp6hdr {
75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref 75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
76}; 76};
77 77
78#ifdef __KERNEL__
79#include <linux/skbuff.h>
80
81static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
82{
83 return (struct icmp6hdr *)skb_transport_header(skb);
84}
85#endif
86
78#define ICMPV6_ROUTER_PREF_LOW 0x3 87#define ICMPV6_ROUTER_PREF_LOW 0x3
79#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 88#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
80#define ICMPV6_ROUTER_PREF_HIGH 0x1 89#define ICMPV6_ROUTER_PREF_HIGH 0x1
diff --git a/include/linux/ide.h b/include/linux/ide.h
index d3bbc7188b6..418dfb5adad 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -613,7 +613,6 @@ typedef struct ide_drive_s {
613 613
614 u8 quirk_list; /* considered quirky, set for a specific host */ 614 u8 quirk_list; /* considered quirky, set for a specific host */
615 u8 init_speed; /* transfer rate set at boot */ 615 u8 init_speed; /* transfer rate set at boot */
616 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */
617 u8 current_speed; /* current transfer rate set */ 616 u8 current_speed; /* current transfer rate set */
618 u8 desired_speed; /* desired transfer rate set */ 617 u8 desired_speed; /* desired transfer rate set */
619 u8 dn; /* now wide spread use */ 618 u8 dn; /* now wide spread use */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
new file mode 100644
index 00000000000..ecd61e8438a
--- /dev/null
+++ b/include/linux/ieee80211.h
@@ -0,0 +1,342 @@
1/*
2 * IEEE 802.11 defines
3 *
4 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
5 * <jkmaline@cc.hut.fi>
6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef IEEE80211_H
16#define IEEE80211_H
17
18#include <linux/types.h>
19
20#define FCS_LEN 4
21
22#define IEEE80211_FCTL_VERS 0x0003
23#define IEEE80211_FCTL_FTYPE 0x000c
24#define IEEE80211_FCTL_STYPE 0x00f0
25#define IEEE80211_FCTL_TODS 0x0100
26#define IEEE80211_FCTL_FROMDS 0x0200
27#define IEEE80211_FCTL_MOREFRAGS 0x0400
28#define IEEE80211_FCTL_RETRY 0x0800
29#define IEEE80211_FCTL_PM 0x1000
30#define IEEE80211_FCTL_MOREDATA 0x2000
31#define IEEE80211_FCTL_PROTECTED 0x4000
32#define IEEE80211_FCTL_ORDER 0x8000
33
34#define IEEE80211_SCTL_FRAG 0x000F
35#define IEEE80211_SCTL_SEQ 0xFFF0
36
37#define IEEE80211_FTYPE_MGMT 0x0000
38#define IEEE80211_FTYPE_CTL 0x0004
39#define IEEE80211_FTYPE_DATA 0x0008
40
41/* management */
42#define IEEE80211_STYPE_ASSOC_REQ 0x0000
43#define IEEE80211_STYPE_ASSOC_RESP 0x0010
44#define IEEE80211_STYPE_REASSOC_REQ 0x0020
45#define IEEE80211_STYPE_REASSOC_RESP 0x0030
46#define IEEE80211_STYPE_PROBE_REQ 0x0040
47#define IEEE80211_STYPE_PROBE_RESP 0x0050
48#define IEEE80211_STYPE_BEACON 0x0080
49#define IEEE80211_STYPE_ATIM 0x0090
50#define IEEE80211_STYPE_DISASSOC 0x00A0
51#define IEEE80211_STYPE_AUTH 0x00B0
52#define IEEE80211_STYPE_DEAUTH 0x00C0
53#define IEEE80211_STYPE_ACTION 0x00D0
54
55/* control */
56#define IEEE80211_STYPE_PSPOLL 0x00A0
57#define IEEE80211_STYPE_RTS 0x00B0
58#define IEEE80211_STYPE_CTS 0x00C0
59#define IEEE80211_STYPE_ACK 0x00D0
60#define IEEE80211_STYPE_CFEND 0x00E0
61#define IEEE80211_STYPE_CFENDACK 0x00F0
62
63/* data */
64#define IEEE80211_STYPE_DATA 0x0000
65#define IEEE80211_STYPE_DATA_CFACK 0x0010
66#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
67#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
68#define IEEE80211_STYPE_NULLFUNC 0x0040
69#define IEEE80211_STYPE_CFACK 0x0050
70#define IEEE80211_STYPE_CFPOLL 0x0060
71#define IEEE80211_STYPE_CFACKPOLL 0x0070
72#define IEEE80211_STYPE_QOS_DATA 0x0080
73#define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
74#define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
75#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
76#define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
77#define IEEE80211_STYPE_QOS_CFACK 0x00D0
78#define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
79#define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
80
81
82/* miscellaneous IEEE 802.11 constants */
83#define IEEE80211_MAX_FRAG_THRESHOLD 2346
84#define IEEE80211_MAX_RTS_THRESHOLD 2347
85#define IEEE80211_MAX_AID 2007
86#define IEEE80211_MAX_TIM_LEN 251
87#define IEEE80211_MAX_DATA_LEN 2304
88/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
89 6.2.1.1.2.
90
91 The figure in section 7.1.2 suggests a body size of up to 2312
92 bytes is allowed, which is a bit confusing, I suspect this
93 represents the 2304 bytes of real data, plus a possible 8 bytes of
94 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
95
96#define IEEE80211_MAX_SSID_LEN 32
97
98struct ieee80211_hdr {
99 __le16 frame_control;
100 __le16 duration_id;
101 u8 addr1[6];
102 u8 addr2[6];
103 u8 addr3[6];
104 __le16 seq_ctrl;
105 u8 addr4[6];
106} __attribute__ ((packed));
107
108
109struct ieee80211_mgmt {
110 __le16 frame_control;
111 __le16 duration;
112 u8 da[6];
113 u8 sa[6];
114 u8 bssid[6];
115 __le16 seq_ctrl;
116 union {
117 struct {
118 __le16 auth_alg;
119 __le16 auth_transaction;
120 __le16 status_code;
121 /* possibly followed by Challenge text */
122 u8 variable[0];
123 } __attribute__ ((packed)) auth;
124 struct {
125 __le16 reason_code;
126 } __attribute__ ((packed)) deauth;
127 struct {
128 __le16 capab_info;
129 __le16 listen_interval;
130 /* followed by SSID and Supported rates */
131 u8 variable[0];
132 } __attribute__ ((packed)) assoc_req;
133 struct {
134 __le16 capab_info;
135 __le16 status_code;
136 __le16 aid;
137 /* followed by Supported rates */
138 u8 variable[0];
139 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
140 struct {
141 __le16 capab_info;
142 __le16 listen_interval;
143 u8 current_ap[6];
144 /* followed by SSID and Supported rates */
145 u8 variable[0];
146 } __attribute__ ((packed)) reassoc_req;
147 struct {
148 __le16 reason_code;
149 } __attribute__ ((packed)) disassoc;
150 struct {
151 __le64 timestamp;
152 __le16 beacon_int;
153 __le16 capab_info;
154 /* followed by some of SSID, Supported rates,
155 * FH Params, DS Params, CF Params, IBSS Params, TIM */
156 u8 variable[0];
157 } __attribute__ ((packed)) beacon;
158 struct {
159 /* only variable items: SSID, Supported rates */
160 u8 variable[0];
161 } __attribute__ ((packed)) probe_req;
162 struct {
163 __le64 timestamp;
164 __le16 beacon_int;
165 __le16 capab_info;
166 /* followed by some of SSID, Supported rates,
167 * FH Params, DS Params, CF Params, IBSS Params */
168 u8 variable[0];
169 } __attribute__ ((packed)) probe_resp;
170 struct {
171 u8 category;
172 union {
173 struct {
174 u8 action_code;
175 u8 dialog_token;
176 u8 status_code;
177 u8 variable[0];
178 } __attribute__ ((packed)) wme_action;
179 struct{
180 u8 action_code;
181 u8 element_id;
182 u8 length;
183 u8 switch_mode;
184 u8 new_chan;
185 u8 switch_count;
186 } __attribute__((packed)) chan_switch;
187 } u;
188 } __attribute__ ((packed)) action;
189 } u;
190} __attribute__ ((packed));
191
192
193/* Control frames */
194struct ieee80211_rts {
195 __le16 frame_control;
196 __le16 duration;
197 u8 ra[6];
198 u8 ta[6];
199} __attribute__ ((packed));
200
201struct ieee80211_cts {
202 __le16 frame_control;
203 __le16 duration;
204 u8 ra[6];
205} __attribute__ ((packed));
206
207
208/* Authentication algorithms */
209#define WLAN_AUTH_OPEN 0
210#define WLAN_AUTH_SHARED_KEY 1
211#define WLAN_AUTH_FAST_BSS_TRANSITION 2
212#define WLAN_AUTH_LEAP 128
213
214#define WLAN_AUTH_CHALLENGE_LEN 128
215
216#define WLAN_CAPABILITY_ESS (1<<0)
217#define WLAN_CAPABILITY_IBSS (1<<1)
218#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
219#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
220#define WLAN_CAPABILITY_PRIVACY (1<<4)
221#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
222#define WLAN_CAPABILITY_PBCC (1<<6)
223#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
224/* 802.11h */
225#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
226#define WLAN_CAPABILITY_QOS (1<<9)
227#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
228#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
229
230/* Status codes */
231enum ieee80211_statuscode {
232 WLAN_STATUS_SUCCESS = 0,
233 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
234 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
235 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
236 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
237 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
238 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
239 WLAN_STATUS_CHALLENGE_FAIL = 15,
240 WLAN_STATUS_AUTH_TIMEOUT = 16,
241 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
242 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
243 /* 802.11b */
244 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
245 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
246 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
247 /* 802.11h */
248 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
249 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
250 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
251 /* 802.11g */
252 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
253 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
254 /* 802.11i */
255 WLAN_STATUS_INVALID_IE = 40,
256 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
257 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
258 WLAN_STATUS_INVALID_AKMP = 43,
259 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
260 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
261 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
262};
263
264
265/* Reason codes */
266enum ieee80211_reasoncode {
267 WLAN_REASON_UNSPECIFIED = 1,
268 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
269 WLAN_REASON_DEAUTH_LEAVING = 3,
270 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
271 WLAN_REASON_DISASSOC_AP_BUSY = 5,
272 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
273 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
274 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
275 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
276 /* 802.11h */
277 WLAN_REASON_DISASSOC_BAD_POWER = 10,
278 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
279 /* 802.11i */
280 WLAN_REASON_INVALID_IE = 13,
281 WLAN_REASON_MIC_FAILURE = 14,
282 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
283 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
284 WLAN_REASON_IE_DIFFERENT = 17,
285 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
286 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
287 WLAN_REASON_INVALID_AKMP = 20,
288 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
289 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
290 WLAN_REASON_IEEE8021X_FAILED = 23,
291 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
292};
293
294
295/* Information Element IDs */
296enum ieee80211_eid {
297 WLAN_EID_SSID = 0,
298 WLAN_EID_SUPP_RATES = 1,
299 WLAN_EID_FH_PARAMS = 2,
300 WLAN_EID_DS_PARAMS = 3,
301 WLAN_EID_CF_PARAMS = 4,
302 WLAN_EID_TIM = 5,
303 WLAN_EID_IBSS_PARAMS = 6,
304 WLAN_EID_CHALLENGE = 16,
305 /* 802.11d */
306 WLAN_EID_COUNTRY = 7,
307 WLAN_EID_HP_PARAMS = 8,
308 WLAN_EID_HP_TABLE = 9,
309 WLAN_EID_REQUEST = 10,
310 /* 802.11h */
311 WLAN_EID_PWR_CONSTRAINT = 32,
312 WLAN_EID_PWR_CAPABILITY = 33,
313 WLAN_EID_TPC_REQUEST = 34,
314 WLAN_EID_TPC_REPORT = 35,
315 WLAN_EID_SUPPORTED_CHANNELS = 36,
316 WLAN_EID_CHANNEL_SWITCH = 37,
317 WLAN_EID_MEASURE_REQUEST = 38,
318 WLAN_EID_MEASURE_REPORT = 39,
319 WLAN_EID_QUIET = 40,
320 WLAN_EID_IBSS_DFS = 41,
321 /* 802.11g */
322 WLAN_EID_ERP_INFO = 42,
323 WLAN_EID_EXT_SUPP_RATES = 50,
324 /* 802.11i */
325 WLAN_EID_RSN = 48,
326 WLAN_EID_WPA = 221,
327 WLAN_EID_GENERIC = 221,
328 WLAN_EID_VENDOR_SPECIFIC = 221,
329 WLAN_EID_QOS_PARAMETER = 222
330};
331
332/* cipher suite selectors */
333#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
334#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
335#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
336/* reserved: 0x000FAC03 */
337#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
338#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
339
340#define WLAN_MAX_KEY_LEN 32
341
342#endif /* IEEE80211_H */
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index d557e4ce9b6..43f3bedaafd 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -39,6 +39,7 @@ enum
39#define IFA_F_TEMPORARY IFA_F_SECONDARY 39#define IFA_F_TEMPORARY IFA_F_SECONDARY
40 40
41#define IFA_F_NODAD 0x02 41#define IFA_F_NODAD 0x02
42#define IFA_F_OPTIMISTIC 0x04
42#define IFA_F_HOMEADDRESS 0x10 43#define IFA_F_HOMEADDRESS 0x10
43#define IFA_F_DEPRECATED 0x20 44#define IFA_F_DEPRECATED 0x20
44#define IFA_F_TENTATIVE 0x40 45#define IFA_F_TENTATIVE 0x40
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 7f5714214ee..ed7b93c3083 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -148,4 +148,13 @@ struct arphdr
148 148
149}; 149};
150 150
151#ifdef __KERNEL__
152#include <linux/skbuff.h>
153
154static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
155{
156 return (struct arphdr *)skb_network_header(skb);
157}
158#endif
159
151#endif /* _LINUX_IF_ARP_H */ 160#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index fd1b6eb94a5..4ff211d9876 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -105,7 +105,8 @@ struct __fdb_entry
105#include <linux/netdevice.h> 105#include <linux/netdevice.h>
106 106
107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); 107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *));
108extern int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb); 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb);
109extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern int (*br_should_route_hook)(struct sk_buff **pskb);
110 111
111#endif 112#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index ab08f35cbc3..1db774cf9dc 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -61,6 +61,7 @@
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ 61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */ 62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ 63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
64#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ 65#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
65#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 66#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
66 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 67 * defined in draft-wilson-wrec-wccp-v2-00.txt */
@@ -112,7 +113,7 @@ struct ethhdr {
112 113
113static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 114static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
114{ 115{
115 return (struct ethhdr *)skb->mac.raw; 116 return (struct ethhdr *)skb_mac_header(skb);
116} 117}
117 118
118#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 35ed3b5467f..604c2434f71 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -126,6 +126,7 @@ enum
126 IFLA_INET6_STATS, /* statistics */ 126 IFLA_INET6_STATS, /* statistics */
127 IFLA_INET6_MCAST, /* MC things. What of them? */ 127 IFLA_INET6_MCAST, /* MC things. What of them? */
128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */ 128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
129 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
129 __IFLA_INET6_MAX 130 __IFLA_INET6_MAX
130}; 131};
131 132
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index f3de05c3067..ad09609227f 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -42,6 +42,7 @@ struct sockaddr_ll
42#define PACKET_STATISTICS 6 42#define PACKET_STATISTICS 6
43#define PACKET_COPY_THRESH 7 43#define PACKET_COPY_THRESH 7
44#define PACKET_AUXDATA 8 44#define PACKET_AUXDATA 8
45#define PACKET_ORIGDEV 9
45 46
46struct tpacket_stats 47struct tpacket_stats
47{ 48{
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e33ee763c05..6f987be60fe 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -111,7 +111,17 @@ struct pppoe_hdr {
111 struct pppoe_tag tag[0]; 111 struct pppoe_tag tag[0];
112} __attribute__ ((packed)); 112} __attribute__ ((packed));
113 113
114/* Length of entire PPPoE + PPP header */
115#define PPPOE_SES_HLEN 8
116
114#ifdef __KERNEL__ 117#ifdef __KERNEL__
118#include <linux/skbuff.h>
119
120static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
121{
122 return (struct pppoe_hdr *)skb_network_header(skb);
123}
124
115struct pppoe_opt { 125struct pppoe_opt {
116 struct net_device *dev; /* device associated with socket*/ 126 struct net_device *dev; /* device associated with socket*/
117 int ifindex; /* ifindex of device associated with socket */ 127 int ifindex; /* ifindex of device associated with socket */
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 2f94cf2c7ab..046e9d95ba9 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -47,7 +47,7 @@ struct trh_hdr {
47 47
48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) 48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 49{
50 return (struct trh_hdr *)skb->mac.raw; 50 return (struct trh_hdr *)skb_mac_header(skb);
51} 51}
52#ifdef CONFIG_SYSCTL 52#ifdef CONFIG_SYSCTL
53extern struct ctl_table tr_table[]; 53extern struct ctl_table tr_table[];
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d103580c72d..81e9bc93569 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -51,7 +51,7 @@ struct vlan_ethhdr {
51 51
52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) 52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
53{ 53{
54 return (struct vlan_ethhdr *)skb->mac.raw; 54 return (struct vlan_ethhdr *)skb_mac_header(skb);
55} 55}
56 56
57struct vlan_hdr { 57struct vlan_hdr {
@@ -275,8 +275,8 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
275 veth->h_vlan_TCI = htons(tag); 275 veth->h_vlan_TCI = htons(tag);
276 276
277 skb->protocol = __constant_htons(ETH_P_8021Q); 277 skb->protocol = __constant_htons(ETH_P_8021Q);
278 skb->mac.raw -= VLAN_HLEN; 278 skb->mac_header -= VLAN_HLEN;
279 skb->nh.raw -= VLAN_HLEN; 279 skb->network_header -= VLAN_HLEN;
280 280
281 return skb; 281 return skb;
282} 282}
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h
deleted file mode 100644
index 6e5461d69fd..00000000000
--- a/include/linux/if_wanpipe_common.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*****************************************************************************
2* if_wanipe_common.h Sangoma Driver/Socket common area definitions.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Jan 13, 2000 Nenad Corbic Initial version
14*****************************************************************************/
15
16
17#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H
18#define _WANPIPE_SOCK_DRIVER_COMMON_H
19
20typedef struct {
21 struct net_device *slave;
22 atomic_t packet_sent;
23 atomic_t receive_block;
24 atomic_t command;
25 atomic_t disconnect;
26 atomic_t driver_busy;
27 long common_critical;
28 struct timer_list *tx_timer;
29 struct sock *sk; /* Wanpipe Sock bind's here */
30 int (*func)(struct sk_buff *skb, struct net_device *dev,
31 struct sock *sk);
32
33 struct work_struct wanpipe_work; /* deferred keventd work */
34 unsigned char rw_bind; /* Sock bind state */
35 unsigned char usedby;
36 unsigned char state;
37 unsigned char svc;
38 unsigned short lcn;
39 void *mbox;
40} wanpipe_common_t;
41
42
43enum {
44 WANSOCK_UNCONFIGURED, /* link/channel is not configured */
45 WANSOCK_DISCONNECTED, /* link/channel is disconnected */
46 WANSOCK_CONNECTING, /* connection is in progress */
47 WANSOCK_CONNECTED, /* link/channel is operational */
48 WANSOCK_LIMIT, /* for verification only */
49 WANSOCK_DUALPORT, /* for Dual Port cards */
50 WANSOCK_DISCONNECTING,
51 WANSOCK_BINDED,
52 WANSOCK_BIND_LISTEN,
53 WANSOCK_LISTEN
54};
55
56#endif
57
58
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index a113fe68d8a..f510e7e382a 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,6 +80,27 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
85#define IGMP_DVMRP 0x13 /* DVMRP routing */ 106#define IGMP_DVMRP 0x13 /* DVMRP routing */
diff --git a/include/linux/in.h b/include/linux/in.h
index 1912e7c0bc2..3975cbf52f2 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -83,6 +83,7 @@ struct in_addr {
83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
84#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 84#define IP_PMTUDISC_WANT 1 /* Use per route hints */
85#define IP_PMTUDISC_DO 2 /* Always DF */ 85#define IP_PMTUDISC_DO 2 /* Always DF */
86#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
86 87
87#define IP_MULTICAST_IF 32 88#define IP_MULTICAST_IF 32
88#define IP_MULTICAST_TTL 33 89#define IP_MULTICAST_TTL 33
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 4e8350ae886..2a61c82af11 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,10 +44,8 @@ struct in6_addr
44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined 44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
45 * in network byte order, not in host byte order as are the IPv4 equivalents 45 * in network byte order, not in host byte order as are the IPv4 equivalents
46 */ 46 */
47#if 0
48extern const struct in6_addr in6addr_any; 47extern const struct in6_addr in6addr_any;
49#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
50#endif
51extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
52#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
53 51
@@ -179,6 +177,7 @@ struct in6_flowlabel_req
179#define IPV6_PMTUDISC_DONT 0 177#define IPV6_PMTUDISC_DONT 0
180#define IPV6_PMTUDISC_WANT 1 178#define IPV6_PMTUDISC_WANT 1
181#define IPV6_PMTUDISC_DO 2 179#define IPV6_PMTUDISC_DO 2
180#define IPV6_PMTUDISC_PROBE 3
182 181
183/* Flowlabel */ 182/* Flowlabel */
184#define IPV6_FLOWLABEL_MGR 32 183#define IPV6_FLOWLABEL_MGR 32
diff --git a/include/linux/init.h b/include/linux/init.h
index e290a010e3f..9abf120ec9f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -52,9 +52,14 @@
52#endif 52#endif
53 53
54/* For assembly routines */ 54/* For assembly routines */
55#ifdef CONFIG_HOTPLUG_CPU
56#define __INIT .section ".text","ax"
57#define __INITDATA .section ".data","aw"
58#else
55#define __INIT .section ".init.text","ax" 59#define __INIT .section ".init.text","ax"
56#define __FINIT .previous
57#define __INITDATA .section ".init.data","aw" 60#define __INITDATA .section ".init.data","aw"
61#endif
62#define __FINIT .previous
58 63
59#ifndef __ASSEMBLY__ 64#ifndef __ASSEMBLY__
60/* 65/*
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
new file mode 100644
index 00000000000..597a0077b3c
--- /dev/null
+++ b/include/linux/input-polldev.h
@@ -0,0 +1,46 @@
1#ifndef _INPUT_POLLDEV_H
2#define _INPUT_POLLDEV_H
3
4/*
5 * Copyright (c) 2007 Dmitry Torokhov
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 version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#include <linux/input.h>
13#include <linux/workqueue.h>
14
15/**
16 * struct input_polled_dev - simple polled input device
17 * @private: private driver data
18 * @flush: driver-supplied method that flushes device's state upon
19 * opening (optional)
20 * @poll: driver-supplied method that polls the device and posts
21 * input events (mandatory).
22 * @poll_interval: specifies how often the poll() method shoudl be called.
23 * @input: input device structire associated with the polled device.
24 * Must be properly initialized by the driver (id, name, phys, bits).
25 *
26 * Polled input device provides a skeleton for supporting simple input
27 * devices that do not raise interrupts but have to be periodically
28 * scanned or polled to detect changes in their state.
29 */
30struct input_polled_dev {
31 void *private;
32
33 void (*flush)(struct input_polled_dev *dev);
34 void (*poll)(struct input_polled_dev *dev);
35 unsigned int poll_interval; /* msec */
36
37 struct input_dev *input;
38 struct delayed_work work;
39};
40
41struct input_polled_dev *input_allocate_polled_device(void);
42void input_free_polled_device(struct input_polled_dev *dev);
43int input_register_polled_device(struct input_polled_dev *dev);
44void input_unregister_polled_device(struct input_polled_dev *dev);
45
46#endif
diff --git a/include/linux/input.h b/include/linux/input.h
index bde65c8a351..439954d0975 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -506,6 +506,7 @@ struct input_absinfo {
506#define KEY_VOICEMAIL 0x1ac 506#define KEY_VOICEMAIL 0x1ac
507#define KEY_ADDRESSBOOK 0x1ad 507#define KEY_ADDRESSBOOK 0x1ad
508#define KEY_MESSENGER 0x1ae 508#define KEY_MESSENGER 0x1ae
509#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
509 510
510#define KEY_DEL_EOL 0x1c0 511#define KEY_DEL_EOL 0x1c0
511#define KEY_DEL_EOS 0x1c1 512#define KEY_DEL_EOS 0x1c1
@@ -676,6 +677,7 @@ struct input_absinfo {
676#define BUS_I2C 0x18 677#define BUS_I2C 0x18
677#define BUS_HOST 0x19 678#define BUS_HOST 0x19
678#define BUS_GSC 0x1A 679#define BUS_GSC 0x1A
680#define BUS_ATARI 0x1B
679 681
680/* 682/*
681 * Values describing the status of a force-feedback effect 683 * Values describing the status of a force-feedback effect
@@ -913,33 +915,6 @@ struct ff_effect {
913#define BIT(x) (1UL<<((x)%BITS_PER_LONG)) 915#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
914#define LONG(x) ((x)/BITS_PER_LONG) 916#define LONG(x) ((x)/BITS_PER_LONG)
915 917
916#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
917 ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
918
919#define SET_INPUT_KEYCODE(dev, scancode, val) \
920 ({ unsigned __old; \
921 switch (dev->keycodesize) { \
922 case 1: { \
923 u8 *k = (u8 *)dev->keycode; \
924 __old = k[scancode]; \
925 k[scancode] = val; \
926 break; \
927 } \
928 case 2: { \
929 u16 *k = (u16 *)dev->keycode; \
930 __old = k[scancode]; \
931 k[scancode] = val; \
932 break; \
933 } \
934 default: { \
935 u32 *k = (u32 *)dev->keycode; \
936 __old = k[scancode]; \
937 k[scancode] = val; \
938 break; \
939 } \
940 } \
941 __old; })
942
943struct input_dev { 918struct input_dev {
944 919
945 void *private; 920 void *private;
@@ -962,6 +937,8 @@ struct input_dev {
962 unsigned int keycodemax; 937 unsigned int keycodemax;
963 unsigned int keycodesize; 938 unsigned int keycodesize;
964 void *keycode; 939 void *keycode;
940 int (*setkeycode)(struct input_dev *dev, int scancode, int keycode);
941 int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode);
965 942
966 struct ff_device *ff; 943 struct ff_device *ff;
967 944
@@ -996,6 +973,9 @@ struct input_dev {
996 unsigned int users; 973 unsigned int users;
997 974
998 struct class_device cdev; 975 struct class_device cdev;
976 union { /* temporarily so while we switching to struct device */
977 struct device *parent;
978 } dev;
999 979
1000 struct list_head h_list; 980 struct list_head h_list;
1001 struct list_head node; 981 struct list_head node;
@@ -1074,7 +1054,7 @@ struct input_handler {
1074 void *private; 1054 void *private;
1075 1055
1076 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1056 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1077 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); 1057 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1078 void (*disconnect)(struct input_handle *handle); 1058 void (*disconnect)(struct input_handle *handle);
1079 void (*start)(struct input_handle *handle); 1059 void (*start)(struct input_handle *handle);
1080 1060
@@ -1104,7 +1084,7 @@ struct input_handle {
1104}; 1084};
1105 1085
1106#define to_dev(n) container_of(n,struct input_dev,node) 1086#define to_dev(n) container_of(n,struct input_dev,node)
1107#define to_handler(n) container_of(n,struct input_handler,node); 1087#define to_handler(n) container_of(n,struct input_handler,node)
1108#define to_handle(n) container_of(n,struct input_handle,d_node) 1088#define to_handle(n) container_of(n,struct input_handle,d_node)
1109#define to_handle_h(n) container_of(n,struct input_handle,h_node) 1089#define to_handle_h(n) container_of(n,struct input_handle,h_node)
1110 1090
@@ -1121,12 +1101,25 @@ static inline void input_put_device(struct input_dev *dev)
1121 class_device_put(&dev->cdev); 1101 class_device_put(&dev->cdev);
1122} 1102}
1123 1103
1104static inline void *input_get_drvdata(struct input_dev *dev)
1105{
1106 return dev->private;
1107}
1108
1109static inline void input_set_drvdata(struct input_dev *dev, void *data)
1110{
1111 dev->private = data;
1112}
1113
1124int input_register_device(struct input_dev *); 1114int input_register_device(struct input_dev *);
1125void input_unregister_device(struct input_dev *); 1115void input_unregister_device(struct input_dev *);
1126 1116
1127int input_register_handler(struct input_handler *); 1117int input_register_handler(struct input_handler *);
1128void input_unregister_handler(struct input_handler *); 1118void input_unregister_handler(struct input_handler *);
1129 1119
1120int input_register_handle(struct input_handle *);
1121void input_unregister_handle(struct input_handle *);
1122
1130int input_grab_device(struct input_handle *); 1123int input_grab_device(struct input_handle *);
1131void input_release_device(struct input_handle *); 1124void input_release_device(struct input_handle *);
1132 1125
@@ -1168,6 +1161,8 @@ static inline void input_sync(struct input_dev *dev)
1168 input_event(dev, EV_SYN, SYN_REPORT, 0); 1161 input_event(dev, EV_SYN, SYN_REPORT, 0);
1169} 1162}
1170 1163
1164void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1165
1171static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1166static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
1172{ 1167{
1173 dev->absmin[axis] = min; 1168 dev->absmin[axis] = min;
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 838cf5a5bd7..0319f665dd3 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -185,10 +185,14 @@ static inline int disable_irq_wake(unsigned int irq)
185 * validator need to define the methods below in their asm/irq.h 185 * validator need to define the methods below in their asm/irq.h
186 * files, under an #ifdef CONFIG_LOCKDEP section. 186 * files, under an #ifdef CONFIG_LOCKDEP section.
187 */ 187 */
188# ifndef CONFIG_LOCKDEP 188#ifndef CONFIG_LOCKDEP
189# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq) 189# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
190# define disable_irq_nosync_lockdep_irqsave(irq, flags) \
191 disable_irq_nosync(irq)
190# define disable_irq_lockdep(irq) disable_irq(irq) 192# define disable_irq_lockdep(irq) disable_irq(irq)
191# define enable_irq_lockdep(irq) enable_irq(irq) 193# define enable_irq_lockdep(irq) enable_irq(irq)
194# define enable_irq_lockdep_irqrestore(irq, flags) \
195 enable_irq(irq)
192# endif 196# endif
193 197
194#endif /* CONFIG_GENERIC_HARDIRQS */ 198#endif /* CONFIG_GENERIC_HARDIRQS */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 6859a3b1408..71ea9231924 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -99,7 +99,6 @@ extern struct resource ioport_resource;
99extern struct resource iomem_resource; 99extern struct resource iomem_resource;
100 100
101extern int request_resource(struct resource *root, struct resource *new); 101extern int request_resource(struct resource *root, struct resource *new);
102extern struct resource * ____request_resource(struct resource *root, struct resource *new);
103extern int release_resource(struct resource *new); 102extern int release_resource(struct resource *new);
104extern int insert_resource(struct resource *parent, struct resource *new); 103extern int insert_resource(struct resource *parent, struct resource *new);
105extern int allocate_resource(struct resource *root, struct resource *new, 104extern int allocate_resource(struct resource *root, struct resource *new,
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 1d36b971a8b..bd0a2a8631c 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -104,6 +104,20 @@ struct iphdr {
104 /*The options start here. */ 104 /*The options start here. */
105}; 105};
106 106
107#ifdef __KERNEL__
108#include <linux/skbuff.h>
109
110static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
111{
112 return (struct iphdr *)skb_network_header(skb);
113}
114
115static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
116{
117 return (struct iphdr *)skb_transport_header(skb);
118}
119#endif
120
107struct ip_auth_hdr { 121struct ip_auth_hdr {
108 __u8 nexthdr; 122 __u8 nexthdr;
109 __u8 hdrlen; /* This one is measured in 32 bit units! */ 123 __u8 hdrlen; /* This one is measured in 32 bit units! */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index f8241130f5e..09ea01a8a99 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -177,6 +177,10 @@ struct ipv6_devconf {
177#endif 177#endif
178#endif 178#endif
179 __s32 proxy_ndp; 179 __s32 proxy_ndp;
180 __s32 accept_source_route;
181#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
182 __s32 optimistic_dad;
183#endif
180 void *sysctl; 184 void *sysctl;
181}; 185};
182 186
@@ -205,6 +209,9 @@ enum {
205 DEVCONF_RTR_PROBE_INTERVAL, 209 DEVCONF_RTR_PROBE_INTERVAL,
206 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, 210 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
207 DEVCONF_PROXY_NDP, 211 DEVCONF_PROXY_NDP,
212 __DEVCONF_OPTIMISTIC_DAD,
213 DEVCONF_ACCEPT_SOURCE_ROUTE,
214 DEVCONF_OPTIMISTIC_DAD,
208 DEVCONF_MAX 215 DEVCONF_MAX
209}; 216};
210 217
@@ -216,6 +223,16 @@ enum {
216#include <net/if_inet6.h> /* struct ipv6_mc_socklist */ 223#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
217#include <net/inet_sock.h> 224#include <net/inet_sock.h>
218 225
226static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
227{
228 return (struct ipv6hdr *)skb_network_header(skb);
229}
230
231static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
232{
233 return (struct ipv6hdr *)skb_transport_header(skb);
234}
235
219/* 236/*
220 This structure contains results of exthdrs parsing 237 This structure contains results of exthdrs parsing
221 as offsets from skb->nh. 238 as offsets from skb->nh.
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 82c7ae412ee..2a2f99fbcb1 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -84,7 +84,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
84/* A special optimized version that handles 1 or more of u32s. 84/* A special optimized version that handles 1 or more of u32s.
85 * The length parameter here is the number of u32s in the key. 85 * The length parameter here is the number of u32s in the key.
86 */ 86 */
87static inline u32 jhash2(u32 *k, u32 length, u32 initval) 87static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
88{ 88{
89 u32 a, b, c, len; 89 u32 a, b, c, len;
90 90
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 1cebcbc28b4..3e3b92dabe3 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -7,6 +7,8 @@
7 7
8 8
9#define KSYM_NAME_LEN 127 9#define KSYM_NAME_LEN 127
10#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN + \
11 2*(BITS_PER_LONG*3/10) + MODULE_NAME_LEN + 1)
10 12
11#ifdef CONFIG_KALLSYMS 13#ifdef CONFIG_KALLSYMS
12/* Lookup the address for a symbol. Returns 0 if not found. */ 14/* Lookup the address for a symbol. Returns 0 if not found. */
@@ -22,7 +24,10 @@ const char *kallsyms_lookup(unsigned long addr,
22 unsigned long *offset, 24 unsigned long *offset,
23 char **modname, char *namebuf); 25 char **modname, char *namebuf);
24 26
25/* Replace "%s" in format with address, if found */ 27/* Look up a kernel symbol and return it in a text buffer. */
28extern int sprint_symbol(char *buffer, unsigned long address);
29
30/* Look up a kernel symbol and print it to the kernel messages. */
26extern void __print_symbol(const char *fmt, unsigned long address); 31extern void __print_symbol(const char *fmt, unsigned long address);
27 32
28#else /* !CONFIG_KALLSYMS */ 33#else /* !CONFIG_KALLSYMS */
@@ -47,6 +52,12 @@ static inline const char *kallsyms_lookup(unsigned long addr,
47 return NULL; 52 return NULL;
48} 53}
49 54
55static inline int sprint_symbol(char *buffer, unsigned long addr)
56{
57 *buffer = '\0';
58 return 0;
59}
60
50/* Stupid that this does nothing, but I didn't create this mess. */ 61/* Stupid that this does nothing, but I didn't create this mess. */
51#define __print_symbol(fmt, addr) 62#define __print_symbol(fmt, addr)
52#endif /*CONFIG_KALLSYMS*/ 63#endif /*CONFIG_KALLSYMS*/
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9ddf25c2153..e2f41b051b1 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -121,6 +121,7 @@ extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
121 __attribute__ ((format (printf, 3, 0))); 121 __attribute__ ((format (printf, 3, 0)));
122extern char *kasprintf(gfp_t gfp, const char *fmt, ...) 122extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
123 __attribute__ ((format (printf, 2, 3))); 123 __attribute__ ((format (printf, 2, 3)));
124extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
124 125
125extern int sscanf(const char *, const char *, ...) 126extern int sscanf(const char *, const char *, ...)
126 __attribute__ ((format (scanf, 2, 3))); 127 __attribute__ ((format (scanf, 2, 3)));
diff --git a/include/linux/key.h b/include/linux/key.h
index 169f05e4863..a9220e75782 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -160,6 +160,8 @@ struct key {
160 */ 160 */
161 union { 161 union {
162 struct list_head link; 162 struct list_head link;
163 unsigned long x[2];
164 void *p[2];
163 } type_data; 165 } type_data;
164 166
165 /* key data 167 /* key data
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index b850e031053..c288e41ba33 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -22,7 +22,6 @@
22#include <linux/sysfs.h> 22#include <linux/sysfs.h>
23#include <linux/compiler.h> 23#include <linux/compiler.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/rwsem.h>
26#include <linux/kref.h> 25#include <linux/kref.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/wait.h> 27#include <linux/wait.h>
@@ -43,11 +42,9 @@ enum kobject_action {
43 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ 42 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
44 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ 43 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
45 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ 44 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
46 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices (broken) */ 45 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */
47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ 46 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */
48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ 47 KOBJ_MOVE = (__force kobject_action_t) 0x06, /* device move */
49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
50 KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */
51}; 48};
52 49
53struct kobject { 50struct kobject {
@@ -89,6 +86,8 @@ extern void kobject_unregister(struct kobject *);
89extern struct kobject * kobject_get(struct kobject *); 86extern struct kobject * kobject_get(struct kobject *);
90extern void kobject_put(struct kobject *); 87extern void kobject_put(struct kobject *);
91 88
89extern struct kobject *kobject_kset_add_dir(struct kset *kset,
90 struct kobject *, const char *);
92extern struct kobject *kobject_add_dir(struct kobject *, const char *); 91extern struct kobject *kobject_add_dir(struct kobject *, const char *);
93 92
94extern char * kobject_get_path(struct kobject *, gfp_t); 93extern char * kobject_get_path(struct kobject *, gfp_t);
@@ -125,7 +124,6 @@ struct kset_uevent_ops {
125}; 124};
126 125
127struct kset { 126struct kset {
128 struct subsystem * subsys;
129 struct kobj_type * ktype; 127 struct kobj_type * ktype;
130 struct list_head list; 128 struct list_head list;
131 spinlock_t list_lock; 129 spinlock_t list_lock;
@@ -172,33 +170,23 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
172#define set_kset_name(str) .kset = { .kobj = { .name = str } } 170#define set_kset_name(str) .kset = { .kobj = { .name = str } }
173 171
174 172
175
176struct subsystem {
177 struct kset kset;
178 struct rw_semaphore rwsem;
179};
180
181#define decl_subsys(_name,_type,_uevent_ops) \ 173#define decl_subsys(_name,_type,_uevent_ops) \
182struct subsystem _name##_subsys = { \ 174struct kset _name##_subsys = { \
183 .kset = { \ 175 .kobj = { .name = __stringify(_name) }, \
184 .kobj = { .name = __stringify(_name) }, \ 176 .ktype = _type, \
185 .ktype = _type, \ 177 .uevent_ops =_uevent_ops, \
186 .uevent_ops =_uevent_ops, \
187 } \
188} 178}
189#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ 179#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
190struct subsystem _varname##_subsys = { \ 180struct kset _varname##_subsys = { \
191 .kset = { \ 181 .kobj = { .name = __stringify(_name) }, \
192 .kobj = { .name = __stringify(_name) }, \ 182 .ktype = _type, \
193 .ktype = _type, \ 183 .uevent_ops =_uevent_ops, \
194 .uevent_ops =_uevent_ops, \
195 } \
196} 184}
197 185
198/* The global /sys/kernel/ subsystem for people to chain off of */ 186/* The global /sys/kernel/ subsystem for people to chain off of */
199extern struct subsystem kernel_subsys; 187extern struct kset kernel_subsys;
200/* The global /sys/hypervisor/ subsystem */ 188/* The global /sys/hypervisor/ subsystem */
201extern struct subsystem hypervisor_subsys; 189extern struct kset hypervisor_subsys;
202 190
203/** 191/**
204 * Helpers for setting the kset of registered objects. 192 * Helpers for setting the kset of registered objects.
@@ -216,7 +204,7 @@ extern struct subsystem hypervisor_subsys;
216 */ 204 */
217 205
218#define kobj_set_kset_s(obj,subsys) \ 206#define kobj_set_kset_s(obj,subsys) \
219 (obj)->kobj.kset = &(subsys).kset 207 (obj)->kobj.kset = &(subsys)
220 208
221/** 209/**
222 * kset_set_kset_s(obj,subsys) - set kset for embedded kset. 210 * kset_set_kset_s(obj,subsys) - set kset for embedded kset.
@@ -230,7 +218,7 @@ extern struct subsystem hypervisor_subsys;
230 */ 218 */
231 219
232#define kset_set_kset_s(obj,subsys) \ 220#define kset_set_kset_s(obj,subsys) \
233 (obj)->kset.kobj.kset = &(subsys).kset 221 (obj)->kset.kobj.kset = &(subsys)
234 222
235/** 223/**
236 * subsys_set_kset(obj,subsys) - set kset for subsystem 224 * subsys_set_kset(obj,subsys) - set kset for subsystem
@@ -243,29 +231,31 @@ extern struct subsystem hypervisor_subsys;
243 */ 231 */
244 232
245#define subsys_set_kset(obj,_subsys) \ 233#define subsys_set_kset(obj,_subsys) \
246 (obj)->subsys.kset.kobj.kset = &(_subsys).kset 234 (obj)->subsys.kobj.kset = &(_subsys)
247 235
248extern void subsystem_init(struct subsystem *); 236extern void subsystem_init(struct kset *);
249extern int __must_check subsystem_register(struct subsystem *); 237extern int __must_check subsystem_register(struct kset *);
250extern void subsystem_unregister(struct subsystem *); 238extern void subsystem_unregister(struct kset *);
251 239
252static inline struct subsystem * subsys_get(struct subsystem * s) 240static inline struct kset *subsys_get(struct kset *s)
253{ 241{
254 return s ? container_of(kset_get(&s->kset),struct subsystem,kset) : NULL; 242 if (s)
243 return kset_get(s);
244 return NULL;
255} 245}
256 246
257static inline void subsys_put(struct subsystem * s) 247static inline void subsys_put(struct kset *s)
258{ 248{
259 kset_put(&s->kset); 249 kset_put(s);
260} 250}
261 251
262struct subsys_attribute { 252struct subsys_attribute {
263 struct attribute attr; 253 struct attribute attr;
264 ssize_t (*show)(struct subsystem *, char *); 254 ssize_t (*show)(struct kset *, char *);
265 ssize_t (*store)(struct subsystem *, const char *, size_t); 255 ssize_t (*store)(struct kset *, const char *, size_t);
266}; 256};
267 257
268extern int __must_check subsys_create_file(struct subsystem * , 258extern int __must_check subsys_create_file(struct kset *,
269 struct subsys_attribute *); 259 struct subsys_attribute *);
270 260
271#if defined(CONFIG_HOTPLUG) 261#if defined(CONFIG_HOTPLUG)
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 248305bb9a1..81bb9c7a4eb 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
259 259
260#endif 260#endif
261 261
262static inline s64 ktime_to_us(const ktime_t kt)
263{
264 struct timeval tv = ktime_to_timeval(kt);
265 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
266}
267
262/* 268/*
263 * The resolution of the clocks. The resolution value is returned in 269 * The resolution of the clocks. The resolution value is returned in
264 * the clock_getres() system call to give application programmers an 270 * the clock_getres() system call to give application programmers an
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0cfbcb6f08e..d8cfc72ea9c 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -210,6 +210,7 @@ enum {
210 210
211 /* host set flags */ 211 /* host set flags */
212 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 212 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
213 ATA_HOST_STARTED = (1 << 1), /* Host started */
213 214
214 /* various lengths of time */ 215 /* various lengths of time */
215 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 216 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
@@ -281,11 +282,13 @@ enum {
281 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 282 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
282 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 283 ATA_EHI_QUIET = (1 << 3), /* be quiet */
283 284
284 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 285 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
285 ATA_EHI_PRINTINFO = (1 << 17), /* print configuration info */ 286 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
286 ATA_EHI_SETMODE = (1 << 18), /* configure transfer mode */ 287 ATA_EHI_PRINTINFO = (1 << 18), /* print configuration info */
287 ATA_EHI_POST_SETMODE = (1 << 19), /* revaildating after setmode */ 288 ATA_EHI_SETMODE = (1 << 19), /* configure transfer mode */
289 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */
288 290
291 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
289 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 292 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
290 293
291 /* max repeat if error condition is still set after ->error_handler */ 294 /* max repeat if error condition is still set after ->error_handler */
@@ -367,34 +370,6 @@ struct ata_ioports {
367 void __iomem *scr_addr; 370 void __iomem *scr_addr;
368}; 371};
369 372
370struct ata_probe_ent {
371 struct list_head node;
372 struct device *dev;
373 const struct ata_port_operations *port_ops;
374 struct scsi_host_template *sht;
375 struct ata_ioports port[ATA_MAX_PORTS];
376 unsigned int n_ports;
377 unsigned int dummy_port_mask;
378 unsigned int pio_mask;
379 unsigned int mwdma_mask;
380 unsigned int udma_mask;
381 unsigned long irq;
382 unsigned long irq2;
383 unsigned int irq_flags;
384 unsigned long port_flags;
385 unsigned long _host_flags;
386 void __iomem * const *iomap;
387 void *private_data;
388
389 /* port_info for the secondary port. Together with irq2, it's
390 * used to implement non-uniform secondary port. Currently,
391 * the only user is ata_piix combined mode. This workaround
392 * will be removed together with ata_probe_ent when init model
393 * is updated.
394 */
395 const struct ata_port_info *pinfo2;
396};
397
398struct ata_host { 373struct ata_host {
399 spinlock_t lock; 374 spinlock_t lock;
400 struct device *dev; 375 struct device *dev;
@@ -427,6 +402,7 @@ struct ata_queued_cmd {
427 int dma_dir; 402 int dma_dir;
428 403
429 unsigned int pad_len; 404 unsigned int pad_len;
405 unsigned int sect_size;
430 406
431 unsigned int nbytes; 407 unsigned int nbytes;
432 unsigned int curbytes; 408 unsigned int curbytes;
@@ -472,6 +448,7 @@ struct ata_device {
472 struct scsi_device *sdev; /* attached SCSI device */ 448 struct scsi_device *sdev; /* attached SCSI device */
473 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 449 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
474 u64 n_sectors; /* size of device, if ATA */ 450 u64 n_sectors; /* size of device, if ATA */
451 u64 n_sectors_boot; /* size of ATA device at startup */
475 unsigned int class; /* ATA_DEV_xxx */ 452 unsigned int class; /* ATA_DEV_xxx */
476 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 453 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
477 u8 pio_mode; 454 u8 pio_mode;
@@ -597,11 +574,11 @@ struct ata_port {
597struct ata_port_operations { 574struct ata_port_operations {
598 void (*port_disable) (struct ata_port *); 575 void (*port_disable) (struct ata_port *);
599 576
600 void (*dev_config) (struct ata_port *, struct ata_device *); 577 void (*dev_config) (struct ata_device *);
601 578
602 void (*set_piomode) (struct ata_port *, struct ata_device *); 579 void (*set_piomode) (struct ata_port *, struct ata_device *);
603 void (*set_dmamode) (struct ata_port *, struct ata_device *); 580 void (*set_dmamode) (struct ata_port *, struct ata_device *);
604 unsigned long (*mode_filter) (const struct ata_port *, struct ata_device *, unsigned long); 581 unsigned long (*mode_filter) (struct ata_device *, unsigned long);
605 582
606 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); 583 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
607 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); 584 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
@@ -616,6 +593,8 @@ struct ata_port_operations {
616 593
617 void (*post_set_mode) (struct ata_port *ap); 594 void (*post_set_mode) (struct ata_port *ap);
618 595
596 int (*cable_detect) (struct ata_port *ap);
597
619 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 598 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
620 599
621 void (*bmdma_setup) (struct ata_queued_cmd *qc); 600 void (*bmdma_setup) (struct ata_queued_cmd *qc);
@@ -664,6 +643,7 @@ struct ata_port_info {
664 unsigned long mwdma_mask; 643 unsigned long mwdma_mask;
665 unsigned long udma_mask; 644 unsigned long udma_mask;
666 const struct ata_port_operations *port_ops; 645 const struct ata_port_operations *port_ops;
646 irq_handler_t irq_handler;
667 void *private_data; 647 void *private_data;
668}; 648};
669 649
@@ -686,6 +666,7 @@ extern const unsigned long sata_deb_timing_hotplug[];
686extern const unsigned long sata_deb_timing_long[]; 666extern const unsigned long sata_deb_timing_long[];
687 667
688extern const struct ata_port_operations ata_dummy_port_ops; 668extern const struct ata_port_operations ata_dummy_port_ops;
669extern const struct ata_port_info ata_dummy_port_info;
689 670
690static inline const unsigned long * 671static inline const unsigned long *
691sata_ehc_deb_timing(struct ata_eh_context *ehc) 672sata_ehc_deb_timing(struct ata_eh_context *ehc)
@@ -701,6 +682,7 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
701 return ap->ops == &ata_dummy_port_ops; 682 return ap->ops == &ata_dummy_port_ops;
702} 683}
703 684
685extern void sata_print_link_status(struct ata_port *ap);
704extern void ata_port_probe(struct ata_port *); 686extern void ata_port_probe(struct ata_port *);
705extern void __sata_phy_reset(struct ata_port *ap); 687extern void __sata_phy_reset(struct ata_port *ap);
706extern void sata_phy_reset(struct ata_port *ap); 688extern void sata_phy_reset(struct ata_port *ap);
@@ -728,7 +710,15 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
728#endif 710#endif
729extern int ata_pci_clear_simplex(struct pci_dev *pdev); 711extern int ata_pci_clear_simplex(struct pci_dev *pdev);
730#endif /* CONFIG_PCI */ 712#endif /* CONFIG_PCI */
731extern int ata_device_add(const struct ata_probe_ent *ent); 713extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
714extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
715 const struct ata_port_info * const * ppi, int n_ports);
716extern int ata_host_start(struct ata_host *host);
717extern int ata_host_register(struct ata_host *host,
718 struct scsi_host_template *sht);
719extern int ata_host_activate(struct ata_host *host, int irq,
720 irq_handler_t irq_handler, unsigned long irq_flags,
721 struct scsi_host_template *sht);
732extern void ata_host_detach(struct ata_host *host); 722extern void ata_host_detach(struct ata_host *host);
733extern void ata_host_init(struct ata_host *, struct device *, 723extern void ata_host_init(struct ata_host *, struct device *,
734 unsigned long, const struct ata_port_operations *); 724 unsigned long, const struct ata_port_operations *);
@@ -828,11 +818,17 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
828extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 818extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
829 int queue_depth); 819 int queue_depth);
830extern struct ata_device *ata_dev_pair(struct ata_device *adev); 820extern struct ata_device *ata_dev_pair(struct ata_device *adev);
821extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev);
831extern u8 ata_irq_on(struct ata_port *ap); 822extern u8 ata_irq_on(struct ata_port *ap);
832extern u8 ata_dummy_irq_on(struct ata_port *ap); 823extern u8 ata_dummy_irq_on(struct ata_port *ap);
833extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); 824extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
834extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq); 825extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
835 826
827extern int ata_cable_40wire(struct ata_port *ap);
828extern int ata_cable_80wire(struct ata_port *ap);
829extern int ata_cable_sata(struct ata_port *ap);
830extern int ata_cable_unknown(struct ata_port *ap);
831
836/* 832/*
837 * Timing helpers 833 * Timing helpers
838 */ 834 */
@@ -870,10 +866,13 @@ struct pci_bits {
870 unsigned long val; 866 unsigned long val;
871}; 867};
872 868
873extern struct ata_probe_ent * 869extern int ata_pci_init_native_host(struct ata_host *host,
874ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 870 unsigned int port_mask);
871extern int ata_pci_prepare_native_host(struct pci_dev *pdev,
872 const struct ata_port_info * const * ppi,
873 int n_ports, struct ata_host **r_host);
875extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 874extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
876extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long); 875extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
877#endif /* CONFIG_PCI */ 876#endif /* CONFIG_PCI */
878 877
879/* 878/*
@@ -1173,6 +1172,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1173 qc->n_elem = 0; 1172 qc->n_elem = 0;
1174 qc->err_mask = 0; 1173 qc->err_mask = 0;
1175 qc->pad_len = 0; 1174 qc->pad_len = 0;
1175 qc->sect_size = ATA_SECT_SIZE;
1176 1176
1177 ata_tf_init(qc->dev, &qc->tf); 1177 ata_tf_init(qc->dev, &qc->tf);
1178 1178
@@ -1220,7 +1220,7 @@ static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
1220 1220
1221static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) 1221static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1222{ 1222{
1223 return (struct ata_port *) &host->hostdata[0]; 1223 return *(struct ata_port **)&host->hostdata[0];
1224} 1224}
1225 1225
1226#endif /* __LINUX_LIBATA_H__ */ 1226#endif /* __LINUX_LIBATA_H__ */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ac25b5649c5..f6a81e0b1b9 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -88,7 +88,7 @@ struct nlm_wait;
88/* 88/*
89 * Memory chunk for NLM client RPC request. 89 * Memory chunk for NLM client RPC request.
90 */ 90 */
91#define NLMCLNT_OHSIZE (sizeof(utsname()->nodename)+10) 91#define NLMCLNT_OHSIZE ((__NEW_UTS_LEN) + 10u)
92struct nlm_rqst { 92struct nlm_rqst {
93 unsigned int a_flags; /* initial RPC task flags */ 93 unsigned int a_flags; /* initial RPC task flags */
94 struct nlm_host * a_host; /* host handle */ 94 struct nlm_host * a_host; /* host handle */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index e45712acfac..badf702fcff 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -10,7 +10,7 @@
10#ifndef LINUX_MMC_CARD_H 10#ifndef LINUX_MMC_CARD_H
11#define LINUX_MMC_CARD_H 11#define LINUX_MMC_CARD_H
12 12
13#include <linux/mmc/mmc.h> 13#include <linux/mmc/core.h>
14 14
15struct mmc_cid { 15struct mmc_cid {
16 unsigned int manfid; 16 unsigned int manfid;
@@ -41,6 +41,7 @@ struct mmc_csd {
41 41
42struct mmc_ext_csd { 42struct mmc_ext_csd {
43 unsigned int hs_max_dtr; 43 unsigned int hs_max_dtr;
44 unsigned int sectors;
44}; 45};
45 46
46struct sd_scr { 47struct sd_scr {
@@ -60,18 +61,17 @@ struct mmc_host;
60 * MMC device 61 * MMC device
61 */ 62 */
62struct mmc_card { 63struct mmc_card {
63 struct list_head node; /* node in hosts devices list */
64 struct mmc_host *host; /* the host this device belongs to */ 64 struct mmc_host *host; /* the host this device belongs to */
65 struct device dev; /* the device */ 65 struct device dev; /* the device */
66 unsigned int rca; /* relative card address of device */ 66 unsigned int rca; /* relative card address of device */
67 unsigned int type; /* card type */
68#define MMC_TYPE_MMC 0 /* MMC card */
69#define MMC_TYPE_SD 1 /* SD card */
67 unsigned int state; /* (our) card state */ 70 unsigned int state; /* (our) card state */
68#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 71#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
69#define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ 72#define MMC_STATE_READONLY (1<<1) /* card is read-only */
70#define MMC_STATE_BAD (1<<2) /* unrecognised device */ 73#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
71#define MMC_STATE_SDCARD (1<<3) /* is an SD card */ 74#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
72#define MMC_STATE_READONLY (1<<4) /* card is read-only */
73#define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */
74#define MMC_STATE_BLOCKADDR (1<<6) /* card uses block-addressing */
75 u32 raw_cid[4]; /* raw card CID */ 75 u32 raw_cid[4]; /* raw card CID */
76 u32 raw_csd[4]; /* raw card CSD */ 76 u32 raw_csd[4]; /* raw card CSD */
77 u32 raw_scr[2]; /* raw card SCR */ 77 u32 raw_scr[2]; /* raw card SCR */
@@ -82,18 +82,15 @@ struct mmc_card {
82 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ 82 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
83}; 83};
84 84
85#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
86#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
87
85#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 88#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
86#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD)
87#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
88#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
89#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 89#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
90#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 90#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
91#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 91#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
92 92
93#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 93#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
94#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
95#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
96#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
97#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 94#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
98#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 95#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
99#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 96#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
@@ -119,11 +116,4 @@ struct mmc_driver {
119extern int mmc_register_driver(struct mmc_driver *); 116extern int mmc_register_driver(struct mmc_driver *);
120extern void mmc_unregister_driver(struct mmc_driver *); 117extern void mmc_unregister_driver(struct mmc_driver *);
121 118
122static inline int mmc_card_claim_host(struct mmc_card *card)
123{
124 return __mmc_claim_host(card->host, card);
125}
126
127#define mmc_card_release_host(c) mmc_release_host((c)->host)
128
129#endif 119#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
new file mode 100644
index 00000000000..04bbe12fae8
--- /dev/null
+++ b/include/linux/mmc/core.h
@@ -0,0 +1,112 @@
1/*
2 * linux/include/linux/mmc/core.h
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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef LINUX_MMC_CORE_H
9#define LINUX_MMC_CORE_H
10
11#include <linux/interrupt.h>
12#include <linux/device.h>
13
14struct request;
15struct mmc_data;
16struct mmc_request;
17
18struct mmc_command {
19 u32 opcode;
20 u32 arg;
21 u32 resp[4];
22 unsigned int flags; /* expected response type */
23#define MMC_RSP_PRESENT (1 << 0)
24#define MMC_RSP_136 (1 << 1) /* 136 bit response */
25#define MMC_RSP_CRC (1 << 2) /* expect valid crc */
26#define MMC_RSP_BUSY (1 << 3) /* card may send busy */
27#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */
28#define MMC_CMD_MASK (3 << 5) /* command type */
29#define MMC_CMD_AC (0 << 5)
30#define MMC_CMD_ADTC (1 << 5)
31#define MMC_CMD_BC (2 << 5)
32#define MMC_CMD_BCR (3 << 5)
33
34/*
35 * These are the response types, and correspond to valid bit
36 * patterns of the above flags. One additional valid pattern
37 * is all zeros, which means we don't expect a response.
38 */
39#define MMC_RSP_NONE (0)
40#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
41#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
42#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
43#define MMC_RSP_R3 (MMC_RSP_PRESENT)
44#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
45#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
46
47#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
48
49/*
50 * These are the command types.
51 */
52#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
53
54 unsigned int retries; /* max number of retries */
55 unsigned int error; /* command error */
56
57#define MMC_ERR_NONE 0
58#define MMC_ERR_TIMEOUT 1
59#define MMC_ERR_BADCRC 2
60#define MMC_ERR_FIFO 3
61#define MMC_ERR_FAILED 4
62#define MMC_ERR_INVALID 5
63
64 struct mmc_data *data; /* data segment associated with cmd */
65 struct mmc_request *mrq; /* associated request */
66};
67
68struct mmc_data {
69 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */
70 unsigned int timeout_clks; /* data timeout (in clocks) */
71 unsigned int blksz; /* data block size */
72 unsigned int blocks; /* number of blocks */
73 unsigned int error; /* data error */
74 unsigned int flags;
75
76#define MMC_DATA_WRITE (1 << 8)
77#define MMC_DATA_READ (1 << 9)
78#define MMC_DATA_STREAM (1 << 10)
79#define MMC_DATA_MULTI (1 << 11)
80
81 unsigned int bytes_xfered;
82
83 struct mmc_command *stop; /* stop command */
84 struct mmc_request *mrq; /* associated request */
85
86 unsigned int sg_len; /* size of scatter list */
87 struct scatterlist *sg; /* I/O scatter list */
88};
89
90struct mmc_request {
91 struct mmc_command *cmd;
92 struct mmc_data *data;
93 struct mmc_command *stop;
94
95 void *done_data; /* completion data */
96 void (*done)(struct mmc_request *);/* completion function */
97};
98
99struct mmc_host;
100struct mmc_card;
101
102extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
103extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
104extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
105 struct mmc_command *, int);
106
107extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int);
108
109extern void mmc_claim_host(struct mmc_host *host);
110extern void mmc_release_host(struct mmc_host *host);
111
112#endif
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index bfcef8a1ad8..b1350dfd3e9 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -10,36 +10,13 @@
10#ifndef LINUX_MMC_HOST_H 10#ifndef LINUX_MMC_HOST_H
11#define LINUX_MMC_HOST_H 11#define LINUX_MMC_HOST_H
12 12
13#include <linux/mmc/mmc.h> 13#include <linux/mmc/core.h>
14 14
15struct mmc_ios { 15struct mmc_ios {
16 unsigned int clock; /* clock rate */ 16 unsigned int clock; /* clock rate */
17 unsigned short vdd; 17 unsigned short vdd;
18 18
19#define MMC_VDD_150 0 19/* vdd stores the bit number of the selected voltage range from below. */
20#define MMC_VDD_155 1
21#define MMC_VDD_160 2
22#define MMC_VDD_165 3
23#define MMC_VDD_170 4
24#define MMC_VDD_180 5
25#define MMC_VDD_190 6
26#define MMC_VDD_200 7
27#define MMC_VDD_210 8
28#define MMC_VDD_220 9
29#define MMC_VDD_230 10
30#define MMC_VDD_240 11
31#define MMC_VDD_250 12
32#define MMC_VDD_260 13
33#define MMC_VDD_270 14
34#define MMC_VDD_280 15
35#define MMC_VDD_290 16
36#define MMC_VDD_300 17
37#define MMC_VDD_310 18
38#define MMC_VDD_320 19
39#define MMC_VDD_330 20
40#define MMC_VDD_340 21
41#define MMC_VDD_350 22
42#define MMC_VDD_360 23
43 20
44 unsigned char bus_mode; /* command output mode */ 21 unsigned char bus_mode; /* command output mode */
45 22
@@ -88,6 +65,24 @@ struct mmc_host {
88 unsigned int f_max; 65 unsigned int f_max;
89 u32 ocr_avail; 66 u32 ocr_avail;
90 67
68#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
69#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
70#define MMC_VDD_21_22 0x00000200 /* VDD voltage 2.1 ~ 2.2 */
71#define MMC_VDD_22_23 0x00000400 /* VDD voltage 2.2 ~ 2.3 */
72#define MMC_VDD_23_24 0x00000800 /* VDD voltage 2.3 ~ 2.4 */
73#define MMC_VDD_24_25 0x00001000 /* VDD voltage 2.4 ~ 2.5 */
74#define MMC_VDD_25_26 0x00002000 /* VDD voltage 2.5 ~ 2.6 */
75#define MMC_VDD_26_27 0x00004000 /* VDD voltage 2.6 ~ 2.7 */
76#define MMC_VDD_27_28 0x00008000 /* VDD voltage 2.7 ~ 2.8 */
77#define MMC_VDD_28_29 0x00010000 /* VDD voltage 2.8 ~ 2.9 */
78#define MMC_VDD_29_30 0x00020000 /* VDD voltage 2.9 ~ 3.0 */
79#define MMC_VDD_30_31 0x00040000 /* VDD voltage 3.0 ~ 3.1 */
80#define MMC_VDD_31_32 0x00080000 /* VDD voltage 3.1 ~ 3.2 */
81#define MMC_VDD_32_33 0x00100000 /* VDD voltage 3.2 ~ 3.3 */
82#define MMC_VDD_33_34 0x00200000 /* VDD voltage 3.3 ~ 3.4 */
83#define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */
84#define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */
85
91 unsigned long caps; /* Host capabilities */ 86 unsigned long caps; /* Host capabilities */
92 87
93#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 88#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
@@ -106,6 +101,8 @@ struct mmc_host {
106 unsigned int max_blk_count; /* maximum number of blocks in one req */ 101 unsigned int max_blk_count; /* maximum number of blocks in one req */
107 102
108 /* private data */ 103 /* private data */
104 spinlock_t lock; /* lock for claim and bus ops */
105
109 struct mmc_ios ios; /* current io bus settings */ 106 struct mmc_ios ios; /* current io bus settings */
110 u32 ocr; /* the current OCR setting */ 107 u32 ocr; /* the current OCR setting */
111 108
@@ -113,15 +110,19 @@ struct mmc_host {
113#define MMC_MODE_MMC 0 110#define MMC_MODE_MMC 0
114#define MMC_MODE_SD 1 111#define MMC_MODE_SD 1
115 112
116 struct list_head cards; /* devices attached to this host */ 113 struct mmc_card *card; /* device attached to this host */
117 114
118 wait_queue_head_t wq; 115 wait_queue_head_t wq;
119 spinlock_t lock; /* claimed lock */
120 unsigned int claimed:1; /* host exclusively claimed */ 116 unsigned int claimed:1; /* host exclusively claimed */
121 117
122 struct mmc_card *card_selected; /* the selected MMC card */
123
124 struct delayed_work detect; 118 struct delayed_work detect;
119#ifdef CONFIG_MMC_DEBUG
120 unsigned int removed:1; /* host is being removed */
121#endif
122
123 const struct mmc_bus_ops *bus_ops; /* current bus driver */
124 unsigned int bus_refs; /* reference counter */
125 unsigned int bus_dead:1; /* bus has been released */
125 126
126 unsigned long private[0] ____cacheline_aligned; 127 unsigned long private[0] ____cacheline_aligned;
127}; 128};
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index cdc54be804f..e3ed9b95040 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -1,119 +1,257 @@
1/* 1/*
2 * linux/include/linux/mmc/mmc.h 2 * Header for MultiMediaCard (MMC)
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * Copyright 2002 Hewlett-Packard Company
5 * it under the terms of the GNU General Public License version 2 as 5 *
6 * published by the Free Software Foundation. 6 * Use consistent with the GNU GPL is permitted,
7 * provided that this copyright notice is
8 * preserved in its entirety in all copies and derived works.
9 *
10 * HEWLETT-PACKARD COMPANY MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
11 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
12 * FITNESS FOR ANY PARTICULAR PURPOSE.
13 *
14 * Many thanks to Alessandro Rubini and Jonathan Corbet!
15 *
16 * Based strongly on code by:
17 *
18 * Author: Yong-iL Joh <tolkien@mizi.com>
19 * Date : $Date: 2002/06/18 12:37:30 $
20 *
21 * Author: Andrew Christian
22 * 15 May 2002
7 */ 23 */
8#ifndef MMC_H 24
9#define MMC_H 25#ifndef MMC_MMC_H
10 26#define MMC_MMC_H
11#include <linux/list.h> 27
12#include <linux/interrupt.h> 28/* Standard MMC commands (4.1) type argument response */
13#include <linux/device.h> 29 /* class 1 */
14 30#define MMC_GO_IDLE_STATE 0 /* bc */
15struct request; 31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
16struct mmc_data; 32#define MMC_ALL_SEND_CID 2 /* bcr R2 */
17struct mmc_request; 33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
18 34#define MMC_SET_DSR 4 /* bc [31:16] RCA */
19struct mmc_command { 35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
20 u32 opcode; 36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
21 u32 arg; 37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
22 u32 resp[4]; 38#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */
23 unsigned int flags; /* expected response type */ 39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */
24#define MMC_RSP_PRESENT (1 << 0) 40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
25#define MMC_RSP_136 (1 << 1) /* 136 bit response */ 41#define MMC_STOP_TRANSMISSION 12 /* ac R1b */
26#define MMC_RSP_CRC (1 << 2) /* expect valid crc */ 42#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */
27#define MMC_RSP_BUSY (1 << 3) /* card may send busy */ 43#define MMC_GO_INACTIVE_STATE 15 /* ac [31:16] RCA */
28#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */ 44
29#define MMC_CMD_MASK (3 << 5) /* command type */ 45 /* class 2 */
30#define MMC_CMD_AC (0 << 5) 46#define MMC_SET_BLOCKLEN 16 /* ac [31:0] block len R1 */
31#define MMC_CMD_ADTC (1 << 5) 47#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
32#define MMC_CMD_BC (2 << 5) 48#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
33#define MMC_CMD_BCR (3 << 5) 49
50 /* class 3 */
51#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
52
53 /* class 4 */
54#define MMC_SET_BLOCK_COUNT 23 /* adtc [31:0] data addr R1 */
55#define MMC_WRITE_BLOCK 24 /* adtc [31:0] data addr R1 */
56#define MMC_WRITE_MULTIPLE_BLOCK 25 /* adtc R1 */
57#define MMC_PROGRAM_CID 26 /* adtc R1 */
58#define MMC_PROGRAM_CSD 27 /* adtc R1 */
59
60 /* class 6 */
61#define MMC_SET_WRITE_PROT 28 /* ac [31:0] data addr R1b */
62#define MMC_CLR_WRITE_PROT 29 /* ac [31:0] data addr R1b */
63#define MMC_SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */
64
65 /* class 5 */
66#define MMC_ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */
67#define MMC_ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */
68#define MMC_ERASE 38 /* ac R1b */
69
70 /* class 9 */
71#define MMC_FAST_IO 39 /* ac <Complex> R4 */
72#define MMC_GO_IRQ_STATE 40 /* bcr R5 */
73
74 /* class 7 */
75#define MMC_LOCK_UNLOCK 42 /* adtc R1b */
76
77 /* class 8 */
78#define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */
79#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */
34 80
35/* 81/*
36 * These are the response types, and correspond to valid bit 82 * MMC_SWITCH argument format:
37 * patterns of the above flags. One additional valid pattern 83 *
38 * is all zeros, which means we don't expect a response. 84 * [31:26] Always 0
85 * [25:24] Access Mode
86 * [23:16] Location of target Byte in EXT_CSD
87 * [15:08] Value Byte
88 * [07:03] Always 0
89 * [02:00] Command Set
39 */ 90 */
40#define MMC_RSP_NONE (0)
41#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
42#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
43#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
44#define MMC_RSP_R3 (MMC_RSP_PRESENT)
45#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
46#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
47
48#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
49 91
50/* 92/*
51 * These are the command types. 93 MMC status in R1
94 Type
95 e : error bit
96 s : status bit
97 r : detected and set for the actual command response
98 x : detected and set during command execution. the host must poll
99 the card by sending status command in order to read these bits.
100 Clear condition
101 a : according to the card state
102 b : always related to the previous command. Reception of
103 a valid command will clear it (with a delay of one command)
104 c : clear by read
52 */ 105 */
53#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
54 106
55 unsigned int retries; /* max number of retries */ 107#define R1_OUT_OF_RANGE (1 << 31) /* er, c */
56 unsigned int error; /* command error */ 108#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */
109#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */
110#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */
111#define R1_ERASE_PARAM (1 << 27) /* ex, c */
112#define R1_WP_VIOLATION (1 << 26) /* erx, c */
113#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */
114#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */
115#define R1_COM_CRC_ERROR (1 << 23) /* er, b */
116#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */
117#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */
118#define R1_CC_ERROR (1 << 20) /* erx, c */
119#define R1_ERROR (1 << 19) /* erx, c */
120#define R1_UNDERRUN (1 << 18) /* ex, c */
121#define R1_OVERRUN (1 << 17) /* ex, c */
122#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */
123#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */
124#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */
125#define R1_ERASE_RESET (1 << 13) /* sr, c */
126#define R1_STATUS(x) (x & 0xFFFFE000)
127#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
128#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
129#define R1_APP_CMD (1 << 5) /* sr, c */
57 130
58#define MMC_ERR_NONE 0 131/* These are unpacked versions of the actual responses */
59#define MMC_ERR_TIMEOUT 1
60#define MMC_ERR_BADCRC 2
61#define MMC_ERR_FIFO 3
62#define MMC_ERR_FAILED 4
63#define MMC_ERR_INVALID 5
64 132
65 struct mmc_data *data; /* data segment associated with cmd */ 133struct _mmc_csd {
66 struct mmc_request *mrq; /* associated request */ 134 u8 csd_structure;
135 u8 spec_vers;
136 u8 taac;
137 u8 nsac;
138 u8 tran_speed;
139 u16 ccc;
140 u8 read_bl_len;
141 u8 read_bl_partial;
142 u8 write_blk_misalign;
143 u8 read_blk_misalign;
144 u8 dsr_imp;
145 u16 c_size;
146 u8 vdd_r_curr_min;
147 u8 vdd_r_curr_max;
148 u8 vdd_w_curr_min;
149 u8 vdd_w_curr_max;
150 u8 c_size_mult;
151 union {
152 struct { /* MMC system specification version 3.1 */
153 u8 erase_grp_size;
154 u8 erase_grp_mult;
155 } v31;
156 struct { /* MMC system specification version 2.2 */
157 u8 sector_size;
158 u8 erase_grp_size;
159 } v22;
160 } erase;
161 u8 wp_grp_size;
162 u8 wp_grp_enable;
163 u8 default_ecc;
164 u8 r2w_factor;
165 u8 write_bl_len;
166 u8 write_bl_partial;
167 u8 file_format_grp;
168 u8 copy;
169 u8 perm_write_protect;
170 u8 tmp_write_protect;
171 u8 file_format;
172 u8 ecc;
67}; 173};
68 174
69struct mmc_data { 175/*
70 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */ 176 * OCR bits are mostly in host.h
71 unsigned int timeout_clks; /* data timeout (in clocks) */ 177 */
72 unsigned int blksz; /* data block size */ 178#define MMC_CARD_BUSY 0x80000000 /* Card Power up status bit */
73 unsigned int blocks; /* number of blocks */
74 unsigned int error; /* data error */
75 unsigned int flags;
76 179
77#define MMC_DATA_WRITE (1 << 8) 180/*
78#define MMC_DATA_READ (1 << 9) 181 * Card Command Classes (CCC)
79#define MMC_DATA_STREAM (1 << 10) 182 */
80#define MMC_DATA_MULTI (1 << 11) 183#define CCC_BASIC (1<<0) /* (0) Basic protocol functions */
184 /* (CMD0,1,2,3,4,7,9,10,12,13,15) */
185#define CCC_STREAM_READ (1<<1) /* (1) Stream read commands */
186 /* (CMD11) */
187#define CCC_BLOCK_READ (1<<2) /* (2) Block read commands */
188 /* (CMD16,17,18) */
189#define CCC_STREAM_WRITE (1<<3) /* (3) Stream write commands */
190 /* (CMD20) */
191#define CCC_BLOCK_WRITE (1<<4) /* (4) Block write commands */
192 /* (CMD16,24,25,26,27) */
193#define CCC_ERASE (1<<5) /* (5) Ability to erase blocks */
194 /* (CMD32,33,34,35,36,37,38,39) */
195#define CCC_WRITE_PROT (1<<6) /* (6) Able to write protect blocks */
196 /* (CMD28,29,30) */
197#define CCC_LOCK_CARD (1<<7) /* (7) Able to lock down card */
198 /* (CMD16,CMD42) */
199#define CCC_APP_SPEC (1<<8) /* (8) Application specific */
200 /* (CMD55,56,57,ACMD*) */
201#define CCC_IO_MODE (1<<9) /* (9) I/O mode */
202 /* (CMD5,39,40,52,53) */
203#define CCC_SWITCH (1<<10) /* (10) High speed switch */
204 /* (CMD6,34,35,36,37,50) */
205 /* (11) Reserved */
206 /* (CMD?) */
81 207
82 unsigned int bytes_xfered; 208/*
209 * CSD field definitions
210 */
83 211
84 struct mmc_command *stop; /* stop command */ 212#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */
85 struct mmc_request *mrq; /* associated request */ 213#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */
214#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 - 3.2 - 3.31 - 4.0 - 4.1 */
215#define CSD_STRUCT_EXT_CSD 3 /* Version is coded in CSD_STRUCTURE in EXT_CSD */
86 216
87 unsigned int sg_len; /* size of scatter list */ 217#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */
88 struct scatterlist *sg; /* I/O scatter list */ 218#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */
89}; 219#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
220#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 - 3.2 - 3.31 */
221#define CSD_SPEC_VER_4 4 /* Implements system specification 4.0 - 4.1 */
90 222
91struct mmc_request { 223/*
92 struct mmc_command *cmd; 224 * EXT_CSD fields
93 struct mmc_data *data; 225 */
94 struct mmc_command *stop;
95 226
96 void *done_data; /* completion data */ 227#define EXT_CSD_BUS_WIDTH 183 /* R/W */
97 void (*done)(struct mmc_request *);/* completion function */ 228#define EXT_CSD_HS_TIMING 185 /* R/W */
98}; 229#define EXT_CSD_CARD_TYPE 196 /* RO */
230#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
231
232/*
233 * EXT_CSD field definitions
234 */
99 235
100struct mmc_host; 236#define EXT_CSD_CMD_SET_NORMAL (1<<0)
101struct mmc_card; 237#define EXT_CSD_CMD_SET_SECURE (1<<1)
238#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
102 239
103extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 240#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
104extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); 241#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
105extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int,
106 struct mmc_command *, int);
107 242
108extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int); 243#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
244#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
245#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
109 246
110extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card); 247/*
248 * MMC_SWITCH access modes
249 */
111 250
112static inline void mmc_claim_host(struct mmc_host *host) 251#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */
113{ 252#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */
114 __mmc_claim_host(host, (struct mmc_card *)-1); 253#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
115} 254#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
116 255
117extern void mmc_release_host(struct mmc_host *host); 256#endif /* MMC_MMC_PROTOCOL_H */
118 257
119#endif
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
deleted file mode 100644
index c90b6768329..00000000000
--- a/include/linux/mmc/protocol.h
+++ /dev/null
@@ -1,327 +0,0 @@
1/*
2 * Header for MultiMediaCard (MMC)
3 *
4 * Copyright 2002 Hewlett-Packard Company
5 *
6 * Use consistent with the GNU GPL is permitted,
7 * provided that this copyright notice is
8 * preserved in its entirety in all copies and derived works.
9 *
10 * HEWLETT-PACKARD COMPANY MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
11 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
12 * FITNESS FOR ANY PARTICULAR PURPOSE.
13 *
14 * Many thanks to Alessandro Rubini and Jonathan Corbet!
15 *
16 * Based strongly on code by:
17 *
18 * Author: Yong-iL Joh <tolkien@mizi.com>
19 * Date : $Date: 2002/06/18 12:37:30 $
20 *
21 * Author: Andrew Christian
22 * 15 May 2002
23 */
24
25#ifndef MMC_MMC_PROTOCOL_H
26#define MMC_MMC_PROTOCOL_H
27
28/* Standard MMC commands (4.1) type argument response */
29 /* class 1 */
30#define MMC_GO_IDLE_STATE 0 /* bc */
31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
32#define MMC_ALL_SEND_CID 2 /* bcr R2 */
33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
34#define MMC_SET_DSR 4 /* bc [31:16] RCA */
35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
38#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */
39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */
40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
41#define MMC_STOP_TRANSMISSION 12 /* ac R1b */
42#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */
43#define MMC_GO_INACTIVE_STATE 15 /* ac [31:16] RCA */
44
45 /* class 2 */
46#define MMC_SET_BLOCKLEN 16 /* ac [31:0] block len R1 */
47#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
48#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
49
50 /* class 3 */
51#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
52
53 /* class 4 */
54#define MMC_SET_BLOCK_COUNT 23 /* adtc [31:0] data addr R1 */
55#define MMC_WRITE_BLOCK 24 /* adtc [31:0] data addr R1 */
56#define MMC_WRITE_MULTIPLE_BLOCK 25 /* adtc R1 */
57#define MMC_PROGRAM_CID 26 /* adtc R1 */
58#define MMC_PROGRAM_CSD 27 /* adtc R1 */
59
60 /* class 6 */
61#define MMC_SET_WRITE_PROT 28 /* ac [31:0] data addr R1b */
62#define MMC_CLR_WRITE_PROT 29 /* ac [31:0] data addr R1b */
63#define MMC_SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */
64
65 /* class 5 */
66#define MMC_ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */
67#define MMC_ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */
68#define MMC_ERASE 38 /* ac R1b */
69
70 /* class 9 */
71#define MMC_FAST_IO 39 /* ac <Complex> R4 */
72#define MMC_GO_IRQ_STATE 40 /* bcr R5 */
73
74 /* class 7 */
75#define MMC_LOCK_UNLOCK 42 /* adtc R1b */
76
77 /* class 8 */
78#define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */
79#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */
80
81/* SD commands type argument response */
82 /* class 0 */
83/* This is basically the same command as for MMC with some quirks. */
84#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
85#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
86
87 /* class 10 */
88#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
89
90 /* Application commands */
91#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
92#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
93#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
94#define SD_APP_SEND_SCR 51 /* adtc R1 */
95
96/*
97 * MMC_SWITCH argument format:
98 *
99 * [31:26] Always 0
100 * [25:24] Access Mode
101 * [23:16] Location of target Byte in EXT_CSD
102 * [15:08] Value Byte
103 * [07:03] Always 0
104 * [02:00] Command Set
105 */
106
107/*
108 * SD_SWITCH argument format:
109 *
110 * [31] Check (0) or switch (1)
111 * [30:24] Reserved (0)
112 * [23:20] Function group 6
113 * [19:16] Function group 5
114 * [15:12] Function group 4
115 * [11:8] Function group 3
116 * [7:4] Function group 2
117 * [3:0] Function group 1
118 */
119
120/*
121 * SD_SEND_IF_COND argument format:
122 *
123 * [31:12] Reserved (0)
124 * [11:8] Host Voltage Supply Flags
125 * [7:0] Check Pattern (0xAA)
126 */
127
128/*
129 MMC status in R1
130 Type
131 e : error bit
132 s : status bit
133 r : detected and set for the actual command response
134 x : detected and set during command execution. the host must poll
135 the card by sending status command in order to read these bits.
136 Clear condition
137 a : according to the card state
138 b : always related to the previous command. Reception of
139 a valid command will clear it (with a delay of one command)
140 c : clear by read
141 */
142
143#define R1_OUT_OF_RANGE (1 << 31) /* er, c */
144#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */
145#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */
146#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */
147#define R1_ERASE_PARAM (1 << 27) /* ex, c */
148#define R1_WP_VIOLATION (1 << 26) /* erx, c */
149#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */
150#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */
151#define R1_COM_CRC_ERROR (1 << 23) /* er, b */
152#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */
153#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */
154#define R1_CC_ERROR (1 << 20) /* erx, c */
155#define R1_ERROR (1 << 19) /* erx, c */
156#define R1_UNDERRUN (1 << 18) /* ex, c */
157#define R1_OVERRUN (1 << 17) /* ex, c */
158#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */
159#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */
160#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */
161#define R1_ERASE_RESET (1 << 13) /* sr, c */
162#define R1_STATUS(x) (x & 0xFFFFE000)
163#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
164#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
165#define R1_APP_CMD (1 << 5) /* sr, c */
166
167/* These are unpacked versions of the actual responses */
168
169struct _mmc_csd {
170 u8 csd_structure;
171 u8 spec_vers;
172 u8 taac;
173 u8 nsac;
174 u8 tran_speed;
175 u16 ccc;
176 u8 read_bl_len;
177 u8 read_bl_partial;
178 u8 write_blk_misalign;
179 u8 read_blk_misalign;
180 u8 dsr_imp;
181 u16 c_size;
182 u8 vdd_r_curr_min;
183 u8 vdd_r_curr_max;
184 u8 vdd_w_curr_min;
185 u8 vdd_w_curr_max;
186 u8 c_size_mult;
187 union {
188 struct { /* MMC system specification version 3.1 */
189 u8 erase_grp_size;
190 u8 erase_grp_mult;
191 } v31;
192 struct { /* MMC system specification version 2.2 */
193 u8 sector_size;
194 u8 erase_grp_size;
195 } v22;
196 } erase;
197 u8 wp_grp_size;
198 u8 wp_grp_enable;
199 u8 default_ecc;
200 u8 r2w_factor;
201 u8 write_bl_len;
202 u8 write_bl_partial;
203 u8 file_format_grp;
204 u8 copy;
205 u8 perm_write_protect;
206 u8 tmp_write_protect;
207 u8 file_format;
208 u8 ecc;
209};
210
211#define MMC_VDD_145_150 0x00000001 /* VDD voltage 1.45 - 1.50 */
212#define MMC_VDD_150_155 0x00000002 /* VDD voltage 1.50 - 1.55 */
213#define MMC_VDD_155_160 0x00000004 /* VDD voltage 1.55 - 1.60 */
214#define MMC_VDD_160_165 0x00000008 /* VDD voltage 1.60 - 1.65 */
215#define MMC_VDD_165_170 0x00000010 /* VDD voltage 1.65 - 1.70 */
216#define MMC_VDD_17_18 0x00000020 /* VDD voltage 1.7 - 1.8 */
217#define MMC_VDD_18_19 0x00000040 /* VDD voltage 1.8 - 1.9 */
218#define MMC_VDD_19_20 0x00000080 /* VDD voltage 1.9 - 2.0 */
219#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
220#define MMC_VDD_21_22 0x00000200 /* VDD voltage 2.1 ~ 2.2 */
221#define MMC_VDD_22_23 0x00000400 /* VDD voltage 2.2 ~ 2.3 */
222#define MMC_VDD_23_24 0x00000800 /* VDD voltage 2.3 ~ 2.4 */
223#define MMC_VDD_24_25 0x00001000 /* VDD voltage 2.4 ~ 2.5 */
224#define MMC_VDD_25_26 0x00002000 /* VDD voltage 2.5 ~ 2.6 */
225#define MMC_VDD_26_27 0x00004000 /* VDD voltage 2.6 ~ 2.7 */
226#define MMC_VDD_27_28 0x00008000 /* VDD voltage 2.7 ~ 2.8 */
227#define MMC_VDD_28_29 0x00010000 /* VDD voltage 2.8 ~ 2.9 */
228#define MMC_VDD_29_30 0x00020000 /* VDD voltage 2.9 ~ 3.0 */
229#define MMC_VDD_30_31 0x00040000 /* VDD voltage 3.0 ~ 3.1 */
230#define MMC_VDD_31_32 0x00080000 /* VDD voltage 3.1 ~ 3.2 */
231#define MMC_VDD_32_33 0x00100000 /* VDD voltage 3.2 ~ 3.3 */
232#define MMC_VDD_33_34 0x00200000 /* VDD voltage 3.3 ~ 3.4 */
233#define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */
234#define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */
235#define MMC_CARD_BUSY 0x80000000 /* Card Power up status bit */
236
237/*
238 * Card Command Classes (CCC)
239 */
240#define CCC_BASIC (1<<0) /* (0) Basic protocol functions */
241 /* (CMD0,1,2,3,4,7,9,10,12,13,15) */
242#define CCC_STREAM_READ (1<<1) /* (1) Stream read commands */
243 /* (CMD11) */
244#define CCC_BLOCK_READ (1<<2) /* (2) Block read commands */
245 /* (CMD16,17,18) */
246#define CCC_STREAM_WRITE (1<<3) /* (3) Stream write commands */
247 /* (CMD20) */
248#define CCC_BLOCK_WRITE (1<<4) /* (4) Block write commands */
249 /* (CMD16,24,25,26,27) */
250#define CCC_ERASE (1<<5) /* (5) Ability to erase blocks */
251 /* (CMD32,33,34,35,36,37,38,39) */
252#define CCC_WRITE_PROT (1<<6) /* (6) Able to write protect blocks */
253 /* (CMD28,29,30) */
254#define CCC_LOCK_CARD (1<<7) /* (7) Able to lock down card */
255 /* (CMD16,CMD42) */
256#define CCC_APP_SPEC (1<<8) /* (8) Application specific */
257 /* (CMD55,56,57,ACMD*) */
258#define CCC_IO_MODE (1<<9) /* (9) I/O mode */
259 /* (CMD5,39,40,52,53) */
260#define CCC_SWITCH (1<<10) /* (10) High speed switch */
261 /* (CMD6,34,35,36,37,50) */
262 /* (11) Reserved */
263 /* (CMD?) */
264
265/*
266 * CSD field definitions
267 */
268
269#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */
270#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */
271#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 - 3.2 - 3.31 - 4.0 - 4.1 */
272#define CSD_STRUCT_EXT_CSD 3 /* Version is coded in CSD_STRUCTURE in EXT_CSD */
273
274#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */
275#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */
276#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
277#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 - 3.2 - 3.31 */
278#define CSD_SPEC_VER_4 4 /* Implements system specification 4.0 - 4.1 */
279
280/*
281 * EXT_CSD fields
282 */
283
284#define EXT_CSD_BUS_WIDTH 183 /* R/W */
285#define EXT_CSD_HS_TIMING 185 /* R/W */
286#define EXT_CSD_CARD_TYPE 196 /* RO */
287
288/*
289 * EXT_CSD field definitions
290 */
291
292#define EXT_CSD_CMD_SET_NORMAL (1<<0)
293#define EXT_CSD_CMD_SET_SECURE (1<<1)
294#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
295
296#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
297#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
298
299#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
300#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
301#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
302
303/*
304 * MMC_SWITCH access modes
305 */
306
307#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */
308#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */
309#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
310#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
311
312/*
313 * SCR field definitions
314 */
315
316#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
317#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
318#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
319
320/*
321 * SD bus widths
322 */
323#define SD_BUS_WIDTH_1 0
324#define SD_BUS_WIDTH_4 2
325
326#endif /* MMC_MMC_PROTOCOL_H */
327
diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h
new file mode 100644
index 00000000000..f310062cffb
--- /dev/null
+++ b/include/linux/mmc/sd.h
@@ -0,0 +1,83 @@
1/*
2 * include/linux/mmc/sd.h
3 *
4 * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef MMC_SD_H
13#define MMC_SD_H
14
15/* SD commands type argument response */
16 /* class 0 */
17/* This is basically the same command as for MMC with some quirks. */
18#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
19#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
20
21 /* class 10 */
22#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
23
24 /* Application commands */
25#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
26#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
27#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
28#define SD_APP_SEND_SCR 51 /* adtc R1 */
29
30/*
31 * SD_SWITCH argument format:
32 *
33 * [31] Check (0) or switch (1)
34 * [30:24] Reserved (0)
35 * [23:20] Function group 6
36 * [19:16] Function group 5
37 * [15:12] Function group 4
38 * [11:8] Function group 3
39 * [7:4] Function group 2
40 * [3:0] Function group 1
41 */
42
43/*
44 * SD_SEND_IF_COND argument format:
45 *
46 * [31:12] Reserved (0)
47 * [11:8] Host Voltage Supply Flags
48 * [7:0] Check Pattern (0xAA)
49 */
50
51/*
52 * SCR field definitions
53 */
54
55#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
56#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
57#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
58
59/*
60 * SD bus widths
61 */
62#define SD_BUS_WIDTH_1 0
63#define SD_BUS_WIDTH_4 2
64
65/*
66 * SD_SWITCH mode
67 */
68#define SD_SWITCH_CHECK 0
69#define SD_SWITCH_SET 1
70
71/*
72 * SD_SWITCH function groups
73 */
74#define SD_SWITCH_GRP_ACCESS 0
75
76/*
77 * SD_SWITCH access modes
78 */
79#define SD_SWITCH_ACCESS_DEF 0
80#define SD_SWITCH_ACCESS_HS 1
81
82#endif
83
diff --git a/include/linux/module.h b/include/linux/module.h
index 95679eb8571..f0b0faf42d5 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -568,7 +568,7 @@ struct device_driver;
568#ifdef CONFIG_SYSFS 568#ifdef CONFIG_SYSFS
569struct module; 569struct module;
570 570
571extern struct subsystem module_subsys; 571extern struct kset module_subsys;
572 572
573int mod_sysfs_init(struct module *mod); 573int mod_sysfs_init(struct module *mod);
574int mod_sysfs_setup(struct module *mod, 574int mod_sysfs_setup(struct module *mod,
diff --git a/include/linux/msi.h b/include/linux/msi.h
index e38fe6822cb..94bb46d82ef 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -1,6 +1,8 @@
1#ifndef LINUX_MSI_H 1#ifndef LINUX_MSI_H
2#define LINUX_MSI_H 2#define LINUX_MSI_H
3 3
4#include <linux/list.h>
5
4struct msi_msg { 6struct msi_msg {
5 u32 address_lo; /* low 32 bits of msi message address */ 7 u32 address_lo; /* low 32 bits of msi message address */
6 u32 address_hi; /* high 32 bits of msi message address */ 8 u32 address_hi; /* high 32 bits of msi message address */
@@ -24,10 +26,8 @@ struct msi_desc {
24 unsigned default_irq; /* default pre-assigned irq */ 26 unsigned default_irq; /* default pre-assigned irq */
25 }msi_attrib; 27 }msi_attrib;
26 28
27 struct { 29 unsigned int irq;
28 __u16 head; 30 struct list_head list;
29 __u16 tail;
30 }link;
31 31
32 void __iomem *mask_base; 32 void __iomem *mask_base;
33 struct pci_dev *dev; 33 struct pci_dev *dev;
@@ -41,6 +41,9 @@ struct msi_desc {
41 */ 41 */
42int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 42int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
43void arch_teardown_msi_irq(unsigned int irq); 43void arch_teardown_msi_irq(unsigned int irq);
44extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
45extern void arch_teardown_msi_irqs(struct pci_dev *dev);
46extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
44 47
45 48
46#endif /* LINUX_MSI_H */ 49#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/iflash.h b/include/linux/mtd/iflash.h
deleted file mode 100644
index 9aa5b4f0266..00000000000
--- a/include/linux/mtd/iflash.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* $Id: iflash.h,v 1.2 2000/11/13 18:01:54 dwmw2 Exp $ */
2
3#ifndef __MTD_IFLASH_H__
4#define __MTD_IFLASH_H__
5
6/* Extended CIS registers for Series 2 and 2+ cards */
7/* The registers are all offsets from 0x4000 */
8#define CISREG_CSR 0x0100
9#define CISREG_WP 0x0104
10#define CISREG_RDYBSY 0x0140
11
12/* Extended CIS registers for Series 2 cards */
13#define CISREG_SLEEP 0x0118
14#define CISREG_RDY_MASK 0x0120
15#define CISREG_RDY_STATUS 0x0130
16
17/* Extended CIS registers for Series 2+ cards */
18#define CISREG_VCR 0x010c
19
20/* Card Status Register */
21#define CSR_SRESET 0x20 /* Soft reset */
22#define CSR_CMWP 0x10 /* Common memory write protect */
23#define CSR_PWRDOWN 0x08 /* Power down status */
24#define CSR_CISWP 0x04 /* Common memory CIS WP */
25#define CSR_WP 0x02 /* Mechanical write protect */
26#define CSR_READY 0x01 /* Ready/busy status */
27
28/* Write Protection Register */
29#define WP_BLKEN 0x04 /* Enable block locking */
30#define WP_CMWP 0x02 /* Common memory write protect */
31#define WP_CISWP 0x01 /* Common memory CIS WP */
32
33/* Voltage Control Register */
34#define VCR_VCC_LEVEL 0x80 /* 0 = 5V, 1 = 3.3V */
35#define VCR_VPP_VALID 0x02 /* Vpp Valid */
36#define VCR_VPP_GEN 0x01 /* Integrated Vpp generator */
37
38/* Ready/Busy Mode Register */
39#define RDYBSY_RACK 0x02 /* Ready acknowledge */
40#define RDYBSY_MODE 0x01 /* 1 = high performance */
41
42#define LOW(x) ((x) & 0xff)
43
44/* 28F008SA-Compatible Command Set */
45#define IF_READ_ARRAY 0xffff
46#define IF_INTEL_ID 0x9090
47#define IF_READ_CSR 0x7070
48#define IF_CLEAR_CSR 0x5050
49#define IF_WRITE 0x4040
50#define IF_BLOCK_ERASE 0x2020
51#define IF_ERASE_SUSPEND 0xb0b0
52#define IF_CONFIRM 0xd0d0
53
54/* 28F016SA Performance Enhancement Commands */
55#define IF_READ_PAGE 0x7575
56#define IF_PAGE_SWAP 0x7272
57#define IF_SINGLE_LOAD 0x7474
58#define IF_SEQ_LOAD 0xe0e0
59#define IF_PAGE_WRITE 0x0c0c
60#define IF_RDY_MODE 0x9696
61#define IF_RDY_LEVEL 0x0101
62#define IF_RDY_PULSE_WRITE 0x0202
63#define IF_RDY_PULSE_ERASE 0x0303
64#define IF_RDY_DISABLE 0x0404
65#define IF_LOCK_BLOCK 0x7777
66#define IF_UPLOAD_STATUS 0x9797
67#define IF_READ_ESR 0x7171
68#define IF_ERASE_UNLOCKED 0xa7a7
69#define IF_SLEEP 0xf0f0
70#define IF_ABORT 0x8080
71#define IF_UPLOAD_DEVINFO 0x9999
72
73/* Definitions for Compatible Status Register */
74#define CSR_WR_READY 0x8080 /* Write state machine status */
75#define CSR_ERA_SUSPEND 0x4040 /* Erase suspend status */
76#define CSR_ERA_ERR 0x2020 /* Erase status */
77#define CSR_WR_ERR 0x1010 /* Data write status */
78#define CSR_VPP_LOW 0x0808 /* Vpp status */
79
80/* Definitions for Global Status Register */
81#define GSR_WR_READY 0x8080 /* Write state machine status */
82#define GSR_OP_SUSPEND 0x4040 /* Operation suspend status */
83#define GSR_OP_ERR 0x2020 /* Device operation status */
84#define GSR_SLEEP 0x1010 /* Device sleep status */
85#define GSR_QUEUE_FULL 0x0808 /* Queue status */
86#define GSR_PAGE_AVAIL 0x0404 /* Page buffer available status */
87#define GSR_PAGE_READY 0x0202 /* Page buffer status */
88#define GSR_PAGE_SELECT 0x0101 /* Page buffer select status */
89
90/* Definitions for Block Status Register */
91#define BSR_READY 0x8080 /* Block status */
92#define BSR_UNLOCK 0x4040 /* Block lock status */
93#define BSR_FAILED 0x2020 /* Block operation status */
94#define BSR_ABORTED 0x1010 /* Operation abort status */
95#define BSR_QUEUE_FULL 0x0808 /* Queue status */
96#define BSR_VPP_LOW 0x0404 /* Vpp status */
97
98#endif /* __MTD_IFLASH_H__ */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 3d956c3abb3..45d482ce839 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -53,6 +53,7 @@ struct mtd_erase_region_info {
53 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ 53 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */
54 u_int32_t erasesize; /* For this region */ 54 u_int32_t erasesize; /* For this region */
55 u_int32_t numblocks; /* Number of blocks of erasesize in this region */ 55 u_int32_t numblocks; /* Number of blocks of erasesize in this region */
56 unsigned long *lockmap; /* If keeping bitmap of locks */
56}; 57};
57 58
58/* 59/*
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 97523887fe5..cf197ad62da 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -431,6 +431,7 @@ struct nand_chip {
431#define NAND_MFR_RENESAS 0x07 431#define NAND_MFR_RENESAS 0x07
432#define NAND_MFR_STMICRO 0x20 432#define NAND_MFR_STMICRO 0x20
433#define NAND_MFR_HYNIX 0xad 433#define NAND_MFR_HYNIX 0xad
434#define NAND_MFR_MICRON 0x2c
434 435
435/** 436/**
436 * struct nand_flash_dev - NAND Flash Device ID Structure 437 * struct nand_flash_dev - NAND Flash Device ID Structure
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
new file mode 100644
index 00000000000..3d967b6b120
--- /dev/null
+++ b/include/linux/mtd/ubi.h
@@ -0,0 +1,202 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
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
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Artem Bityutskiy (Битюцкий Артём)
19 */
20
21#ifndef __LINUX_UBI_H__
22#define __LINUX_UBI_H__
23
24#include <asm/ioctl.h>
25#include <linux/types.h>
26#include <mtd/ubi-user.h>
27
28/*
29 * UBI data type hint constants.
30 *
31 * UBI_LONGTERM: long-term data
32 * UBI_SHORTTERM: short-term data
33 * UBI_UNKNOWN: data persistence is unknown
34 *
35 * These constants are used when data is written to UBI volumes in order to
36 * help the UBI wear-leveling unit to find more appropriate physical
37 * eraseblocks.
38 */
39enum {
40 UBI_LONGTERM = 1,
41 UBI_SHORTTERM,
42 UBI_UNKNOWN
43};
44
45/*
46 * enum ubi_open_mode - UBI volume open mode constants.
47 *
48 * UBI_READONLY: read-only mode
49 * UBI_READWRITE: read-write mode
50 * UBI_EXCLUSIVE: exclusive mode
51 */
52enum {
53 UBI_READONLY = 1,
54 UBI_READWRITE,
55 UBI_EXCLUSIVE
56};
57
58/**
59 * struct ubi_volume_info - UBI volume description data structure.
60 * @vol_id: volume ID
61 * @ubi_num: UBI device number this volume belongs to
62 * @size: how many physical eraseblocks are reserved for this volume
63 * @used_bytes: how many bytes of data this volume contains
64 * @used_ebs: how many physical eraseblocks of this volume actually contain any
65 * data
66 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
67 * @corrupted: non-zero if the volume is corrupted (static volumes only)
68 * @upd_marker: non-zero if the volume has update marker set
69 * @alignment: volume alignment
70 * @usable_leb_size: how many bytes are available in logical eraseblocks of
71 * this volume
72 * @name_len: volume name length
73 * @name: volume name
74 * @cdev: UBI volume character device major and minor numbers
75 *
76 * The @corrupted flag is only relevant to static volumes and is always zero
77 * for dynamic ones. This is because UBI does not care about dynamic volume
78 * data protection and only cares about protecting static volume data.
79 *
80 * The @upd_marker flag is set if the volume update operation was interrupted.
81 * Before touching the volume data during the update operation, UBI first sets
82 * the update marker flag for this volume. If the volume update operation was
83 * further interrupted, the update marker indicates this. If the update marker
84 * is set, the contents of the volume is certainly damaged and a new volume
85 * update operation has to be started.
86 *
87 * To put it differently, @corrupted and @upd_marker fields have different
88 * semantics:
89 * o the @corrupted flag means that this static volume is corrupted for some
90 * reasons, but not because an interrupted volume update
91 * o the @upd_marker field means that the volume is damaged because of an
92 * interrupted update operation.
93 *
94 * I.e., the @corrupted flag is never set if the @upd_marker flag is set.
95 *
96 * The @used_bytes and @used_ebs fields are only really needed for static
97 * volumes and contain the number of bytes stored in this static volume and how
98 * many eraseblock this data occupies. In case of dynamic volumes, the
99 * @used_bytes field is equivalent to @size*@usable_leb_size, and the @used_ebs
100 * field is equivalent to @size.
101 *
102 * In general, logical eraseblock size is a property of the UBI device, not
103 * of the UBI volume. Indeed, the logical eraseblock size depends on the
104 * physical eraseblock size and on how much bytes UBI headers consume. But
105 * because of the volume alignment (@alignment), the usable size of logical
106 * eraseblocks if a volume may be less. The following equation is true:
107 * @usable_leb_size = LEB size - (LEB size mod @alignment),
108 * where LEB size is the logical eraseblock size defined by the UBI device.
109 *
110 * The alignment is multiple to the minimal flash input/output unit size or %1
111 * if all the available space is used.
112 *
113 * To put this differently, alignment may be considered is a way to change
114 * volume logical eraseblock sizes.
115 */
116struct ubi_volume_info {
117 int ubi_num;
118 int vol_id;
119 int size;
120 long long used_bytes;
121 int used_ebs;
122 int vol_type;
123 int corrupted;
124 int upd_marker;
125 int alignment;
126 int usable_leb_size;
127 int name_len;
128 const char *name;
129 dev_t cdev;
130};
131
132/**
133 * struct ubi_device_info - UBI device description data structure.
134 * @ubi_num: ubi device number
135 * @leb_size: logical eraseblock size on this UBI device
136 * @min_io_size: minimal I/O unit size
137 * @ro_mode: if this device is in read-only mode
138 * @cdev: UBI character device major and minor numbers
139 *
140 * Note, @leb_size is the logical eraseblock size offered by the UBI device.
141 * Volumes of this UBI device may have smaller logical eraseblock size if their
142 * alignment is not equivalent to %1.
143 */
144struct ubi_device_info {
145 int ubi_num;
146 int leb_size;
147 int min_io_size;
148 int ro_mode;
149 dev_t cdev;
150};
151
152/* UBI descriptor given to users when they open UBI volumes */
153struct ubi_volume_desc;
154
155int ubi_get_device_info(int ubi_num, struct ubi_device_info *di);
156void ubi_get_volume_info(struct ubi_volume_desc *desc,
157 struct ubi_volume_info *vi);
158struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
159struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
160 int mode);
161void ubi_close_volume(struct ubi_volume_desc *desc);
162int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
163 int len, int check);
164int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
165 int offset, int len, int dtype);
166int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
167 int len, int dtype);
168int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
169int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
170int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
171
172/*
173 * This function is the same as the 'ubi_leb_read()' function, but it does not
174 * provide the checking capability.
175 */
176static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
177 int offset, int len)
178{
179 return ubi_leb_read(desc, lnum, buf, offset, len, 0);
180}
181
182/*
183 * This function is the same as the 'ubi_leb_write()' functions, but it does
184 * not have the data type argument.
185 */
186static inline int ubi_write(struct ubi_volume_desc *desc, int lnum,
187 const void *buf, int offset, int len)
188{
189 return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
190}
191
192/*
193 * This function is the same as the 'ubi_leb_change()' functions, but it does
194 * not have the data type argument.
195 */
196static inline int ubi_change(struct ubi_volume_desc *desc, int lnum,
197 const void *buf, int len)
198{
199 return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
200}
201
202#endif /* !__LINUX_UBI_H__ */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d39a5a67e97..b7dd24917f0 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -82,6 +82,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
82extern void release_open_intent(struct nameidata *); 82extern void release_open_intent(struct nameidata *);
83 83
84extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 84extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
85extern struct dentry *lookup_one_len_kern(const char *, struct dentry *, int);
85 86
86extern int follow_down(struct vfsmount **, struct dentry **); 87extern int follow_down(struct vfsmount **, struct dentry **);
87extern int follow_up(struct vfsmount **, struct dentry **); 88extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/net.h b/include/linux/net.h
index 4db21e63d8d..efc45177b50 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -24,7 +24,7 @@
24struct poll_table_struct; 24struct poll_table_struct;
25struct inode; 25struct inode;
26 26
27#define NPROTO 33 /* should be enough for now.. */ 27#define NPROTO 34 /* should be enough for now.. */
28 28
29#define SYS_SOCKET 1 /* sys_socket(2) */ 29#define SYS_SOCKET 1 /* sys_socket(2) */
30#define SYS_BIND 2 /* sys_bind(2) */ 30#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1a528548cd1..30446222b39 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -42,6 +42,8 @@
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll_info; 44struct netpoll_info;
45/* 802.11 specific */
46struct wireless_dev;
45 /* source back-compat hooks */ 47 /* source back-compat hooks */
46#define SET_ETHTOOL_OPS(netdev,ops) \ 48#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) ) 49 ( (netdev)->ethtool_ops = (ops) )
@@ -302,7 +304,7 @@ struct net_device
302 304
303 unsigned long state; 305 unsigned long state;
304 306
305 struct net_device *next; 307 struct list_head dev_list;
306 308
307 /* The device initialization function. Called only once. */ 309 /* The device initialization function. Called only once. */
308 int (*init)(struct net_device *dev); 310 int (*init)(struct net_device *dev);
@@ -347,13 +349,15 @@ struct net_device
347 349
348 350
349 struct net_device_stats* (*get_stats)(struct net_device *dev); 351 struct net_device_stats* (*get_stats)(struct net_device *dev);
352 struct net_device_stats stats;
350 353
354#ifdef CONFIG_WIRELESS_EXT
351 /* List of functions to handle Wireless Extensions (instead of ioctl). 355 /* List of functions to handle Wireless Extensions (instead of ioctl).
352 * See <net/iw_handler.h> for details. Jean II */ 356 * See <net/iw_handler.h> for details. Jean II */
353 const struct iw_handler_def * wireless_handlers; 357 const struct iw_handler_def * wireless_handlers;
354 /* Instance data managed by the core of Wireless Extensions. */ 358 /* Instance data managed by the core of Wireless Extensions. */
355 struct iw_public_data * wireless_data; 359 struct iw_public_data * wireless_data;
356 360#endif
357 const struct ethtool_ops *ethtool_ops; 361 const struct ethtool_ops *ethtool_ops;
358 362
359 /* 363 /*
@@ -398,6 +402,8 @@ struct net_device
398 void *ip6_ptr; /* IPv6 specific data */ 402 void *ip6_ptr; /* IPv6 specific data */
399 void *ec_ptr; /* Econet specific data */ 403 void *ec_ptr; /* Econet specific data */
400 void *ax25_ptr; /* AX.25 specific data */ 404 void *ax25_ptr; /* AX.25 specific data */
405 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
406 assign before registering */
401 407
402/* 408/*
403 * Cache line mostly used on receive path (including eth_type_trans()) 409 * Cache line mostly used on receive path (including eth_type_trans())
@@ -569,13 +575,36 @@ struct packet_type {
569#include <linux/notifier.h> 575#include <linux/notifier.h>
570 576
571extern struct net_device loopback_dev; /* The loopback */ 577extern struct net_device loopback_dev; /* The loopback */
572extern struct net_device *dev_base; /* All devices */ 578extern struct list_head dev_base_head; /* All devices */
573extern rwlock_t dev_base_lock; /* Device list lock */ 579extern rwlock_t dev_base_lock; /* Device list lock */
574 580
581#define for_each_netdev(d) \
582 list_for_each_entry(d, &dev_base_head, dev_list)
583#define for_each_netdev_safe(d, n) \
584 list_for_each_entry_safe(d, n, &dev_base_head, dev_list)
585#define for_each_netdev_continue(d) \
586 list_for_each_entry_continue(d, &dev_base_head, dev_list)
587#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
588
589static inline struct net_device *next_net_device(struct net_device *dev)
590{
591 struct list_head *lh;
592
593 lh = dev->dev_list.next;
594 return lh == &dev_base_head ? NULL : net_device_entry(lh);
595}
596
597static inline struct net_device *first_net_device(void)
598{
599 return list_empty(&dev_base_head) ? NULL :
600 net_device_entry(dev_base_head.next);
601}
602
575extern int netdev_boot_setup_check(struct net_device *dev); 603extern int netdev_boot_setup_check(struct net_device *dev);
576extern unsigned long netdev_boot_base(const char *prefix, int unit); 604extern unsigned long netdev_boot_base(const char *prefix, int unit);
577extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); 605extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
578extern struct net_device *dev_getfirstbyhwtype(unsigned short type); 606extern struct net_device *dev_getfirstbyhwtype(unsigned short type);
607extern struct net_device *__dev_getfirstbyhwtype(unsigned short type);
579extern void dev_add_pack(struct packet_type *pt); 608extern void dev_add_pack(struct packet_type *pt);
580extern void dev_remove_pack(struct packet_type *pt); 609extern void dev_remove_pack(struct packet_type *pt);
581extern void __dev_remove_pack(struct packet_type *pt); 610extern void __dev_remove_pack(struct packet_type *pt);
@@ -647,8 +676,10 @@ static inline void netif_start_queue(struct net_device *dev)
647static inline void netif_wake_queue(struct net_device *dev) 676static inline void netif_wake_queue(struct net_device *dev)
648{ 677{
649#ifdef CONFIG_NETPOLL_TRAP 678#ifdef CONFIG_NETPOLL_TRAP
650 if (netpoll_trap()) 679 if (netpoll_trap()) {
680 clear_bit(__LINK_STATE_XOFF, &dev->state);
651 return; 681 return;
682 }
652#endif 683#endif
653 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) 684 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
654 __netif_schedule(dev); 685 __netif_schedule(dev);
@@ -656,10 +687,6 @@ static inline void netif_wake_queue(struct net_device *dev)
656 687
657static inline void netif_stop_queue(struct net_device *dev) 688static inline void netif_stop_queue(struct net_device *dev)
658{ 689{
659#ifdef CONFIG_NETPOLL_TRAP
660 if (netpoll_trap())
661 return;
662#endif
663 set_bit(__LINK_STATE_XOFF, &dev->state); 690 set_bit(__LINK_STATE_XOFF, &dev->state);
664} 691}
665 692
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 70d3b4f1e48..10b5c627570 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb,
281 struct nf_info *info, 281 struct nf_info *info,
282 unsigned int verdict); 282 unsigned int verdict);
283 283
284extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
285extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
286
287/* FIXME: Before cache is ever used, this must be implemented for real. */ 284/* FIXME: Before cache is ever used, this must be implemented for real. */
288extern void nf_invalidate_cache(int pf); 285extern void nf_invalidate_cache(int pf);
289 286
@@ -388,11 +385,18 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
388{ 385{
389 return 1; 386 return 1;
390} 387}
391static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
392struct flowi; 388struct flowi;
393static inline void 389static inline void
394nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 390nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
395#endif /*CONFIG_NETFILTER*/ 391#endif /*CONFIG_NETFILTER*/
396 392
393#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
394extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
395extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
396extern void (*nf_ct_destroy)(struct nf_conntrack *);
397#else
398static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
399#endif
400
397#endif /*__KERNEL__*/ 401#endif /*__KERNEL__*/
398#endif /*__LINUX_NETFILTER_H*/ 402#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
index 4e6bbce04ff..535e4219d2b 100644
--- a/include/linux/netfilter/nf_conntrack_proto_gre.h
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -87,24 +87,6 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
87/* delete keymap entries */ 87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct); 88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89 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); 90extern void nf_ct_gre_keymap_flush(void);
109extern void nf_nat_need_gre(void); 91extern void nf_nat_need_gre(void);
110 92
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 007af4c2770..22ce29995f1 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -30,6 +30,11 @@ enum tcp_conntrack {
30/* Be liberal in window checking */ 30/* Be liberal in window checking */
31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
32 32
33struct nf_ct_tcp_flags {
34 u_int8_t flags;
35 u_int8_t mask;
36};
37
33#ifdef __KERNEL__ 38#ifdef __KERNEL__
34 39
35struct ip_ct_tcp_state { 40struct ip_ct_tcp_state {
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 1e9c821f152..0f9311df155 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -62,11 +62,11 @@ struct nfattr
62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) 62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) 63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
64#define NFA_NEST(skb, type) \ 64#define NFA_NEST(skb, type) \
65({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ 65({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ 66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
67 __start; }) 67 __start; })
68#define NFA_NEST_END(skb, start) \ 68#define NFA_NEST_END(skb, start) \
69({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ 69({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
70 (skb)->len; }) 70 (skb)->len; })
71#define NFA_NEST_CANCEL(skb, start) \ 71#define NFA_NEST_CANCEL(skb, start) \
72({ if (start) \ 72({ if (start) \
@@ -111,7 +111,7 @@ struct nfgenmsg {
111struct nfnl_callback 111struct nfnl_callback
112{ 112{
113 int (*call)(struct sock *nl, struct sk_buff *skb, 113 int (*call)(struct sock *nl, struct sk_buff *skb,
114 struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); 114 struct nlmsghdr *nlh, struct nfattr *cda[]);
115 u_int16_t attr_count; /* number of nfattr's */ 115 u_int16_t attr_count; /* number of nfattr's */
116}; 116};
117 117
@@ -129,19 +129,6 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype,
129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ 129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
130 __nfa_fill(skb, attrtype, attrlen, data); }) 130 __nfa_fill(skb, attrtype, attrlen, data); })
131 131
132extern struct semaphore nfnl_sem;
133
134#define nfnl_shlock() down(&nfnl_sem)
135#define nfnl_shlock_nowait() down_trylock(&nfnl_sem)
136
137#define nfnl_shunlock() do { up(&nfnl_sem); \
138 if(nfnl && nfnl->sk_receive_queue.qlen) \
139 nfnl->sk_data_ready(nfnl, 0); \
140 } while(0)
141
142extern void nfnl_lock(void);
143extern void nfnl_unlock(void);
144
145extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); 132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
146extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); 133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
147 134
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index b5883ccee29..d7c35039721 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -83,6 +83,10 @@ enum ctattr_protoinfo {
83enum ctattr_protoinfo_tcp { 83enum ctattr_protoinfo_tcp {
84 CTA_PROTOINFO_TCP_UNSPEC, 84 CTA_PROTOINFO_TCP_UNSPEC,
85 CTA_PROTOINFO_TCP_STATE, 85 CTA_PROTOINFO_TCP_STATE,
86 CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
87 CTA_PROTOINFO_TCP_WSCALE_REPLY,
88 CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
89 CTA_PROTOINFO_TCP_FLAGS_REPLY,
86 __CTA_PROTOINFO_TCP_MAX 90 __CTA_PROTOINFO_TCP_MAX
87}; 91};
88#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 92#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 55689f39f77..533ee351a27 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -7,6 +7,7 @@
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#include <linux/if_ether.h> 8#include <linux/if_ether.h>
9#include <linux/if_vlan.h> 9#include <linux/if_vlan.h>
10#include <linux/if_pppox.h>
10 11
11/* Bridge Hooks */ 12/* Bridge Hooks */
12/* After promisc drops, checksum checks. */ 13/* After promisc drops, checksum checks. */
@@ -54,12 +55,25 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
54 return 0; 55 return 0;
55} 56}
56 57
58static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
59{
60 switch (skb->protocol) {
61 case __constant_htons(ETH_P_8021Q):
62 return VLAN_HLEN;
63 case __constant_htons(ETH_P_PPP_SES):
64 return PPPOE_SES_HLEN;
65 default:
66 return 0;
67 }
68}
69
57/* This is called by the IP fragmenting code and it ensures there is 70/* This is called by the IP fragmenting code and it ensures there is
58 * enough room for the encapsulating header (if there is one). */ 71 * enough room for the encapsulating header (if there is one). */
59static inline int nf_bridge_pad(const struct sk_buff *skb) 72static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
60{ 73{
61 return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) 74 if (skb->nf_bridge)
62 ? VLAN_HLEN : 0; 75 return nf_bridge_encap_header_len(skb);
76 return 0;
63} 77}
64 78
65struct bridge_skb_cb { 79struct bridge_skb_cb {
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index 07f044ff1a6..a11b0c2017f 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr {
54 54
55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) 55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
56{ 56{
57 return (struct ebt_802_3_hdr *)skb->mac.raw; 57 return (struct ebt_802_3_hdr *)skb_mac_header(skb);
58} 58}
59#endif 59#endif
60 60
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index 97e4dbde1f8..cbf4843b6b0 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -8,8 +8,10 @@
8#define EBT_ARP_DST_IP 0x10 8#define EBT_ARP_DST_IP 0x10
9#define EBT_ARP_SRC_MAC 0x20 9#define EBT_ARP_SRC_MAC 0x20
10#define EBT_ARP_DST_MAC 0x40 10#define EBT_ARP_DST_MAC 0x40
11#define EBT_ARP_GRAT 0x80
11#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ 12#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \
12 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC) 13 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \
14 EBT_ARP_GRAT)
13#define EBT_ARP_MATCH "arp" 15#define EBT_ARP_MATCH "arp"
14 16
15struct ebt_arp_info 17struct ebt_arp_info
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 180337801a8..7185792b900 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,9 +1,3 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_protocol.h
3header-y += ip_conntrack_sctp.h
4header-y += ip_conntrack_tcp.h
5header-y += ip_conntrack_tftp.h
6header-y += ip_nat_pptp.h
7header-y += ipt_addrtype.h 1header-y += ipt_addrtype.h
8header-y += ipt_ah.h 2header-y += ipt_ah.h
9header-y += ipt_CLASSIFY.h 3header-y += ipt_CLASSIFY.h
@@ -49,13 +43,5 @@ header-y += ipt_ttl.h
49header-y += ipt_TTL.h 43header-y += ipt_TTL.h
50header-y += ipt_ULOG.h 44header-y += ipt_ULOG.h
51 45
52unifdef-y += ip_conntrack.h
53unifdef-y += ip_conntrack_h323.h
54unifdef-y += ip_conntrack_irc.h
55unifdef-y += ip_conntrack_pptp.h
56unifdef-y += ip_conntrack_proto_gre.h
57unifdef-y += ip_conntrack_tuple.h
58unifdef-y += ip_nat.h
59unifdef-y += ip_nat_rule.h
60unifdef-y += ip_queue.h 46unifdef-y += ip_queue.h
61unifdef-y += ip_tables.h 47unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
deleted file mode 100644
index da9274e6bf1..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ /dev/null
@@ -1,402 +0,0 @@
1#ifndef _IP_CONNTRACK_H
2#define _IP_CONNTRACK_H
3
4#include <linux/netfilter/nf_conntrack_common.h>
5
6#ifdef __KERNEL__
7#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
8#include <linux/bitops.h>
9#include <linux/compiler.h>
10#include <asm/atomic.h>
11
12#include <linux/timer.h>
13#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
14#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
15#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
16#include <linux/netfilter_ipv4/ip_conntrack_sctp.h>
17
18/* per conntrack: protocol private data */
19union ip_conntrack_proto {
20 /* insert conntrack proto private data here */
21 struct ip_ct_gre gre;
22 struct ip_ct_sctp sctp;
23 struct ip_ct_tcp tcp;
24 struct ip_ct_icmp icmp;
25};
26
27union ip_conntrack_expect_proto {
28 /* insert expect proto private data here */
29};
30
31/* Add protocol helper include file here */
32#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
33#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
34#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
35#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
36#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
37
38/* per conntrack: application helper private data */
39union ip_conntrack_help {
40 /* insert conntrack helper private data (master) here */
41 struct ip_ct_h323_master ct_h323_info;
42 struct ip_ct_pptp_master ct_pptp_info;
43 struct ip_ct_ftp_master ct_ftp_info;
44 struct ip_ct_irc_master ct_irc_info;
45};
46
47#ifdef CONFIG_IP_NF_NAT_NEEDED
48#include <linux/netfilter_ipv4/ip_nat.h>
49#include <linux/netfilter_ipv4/ip_nat_pptp.h>
50
51/* per conntrack: nat application helper private data */
52union ip_conntrack_nat_help {
53 /* insert nat helper private data here */
54 struct ip_nat_pptp nat_pptp_info;
55};
56#endif
57
58#include <linux/types.h>
59#include <linux/skbuff.h>
60
61#ifdef CONFIG_NETFILTER_DEBUG
62#define IP_NF_ASSERT(x) \
63do { \
64 if (!(x)) \
65 /* Wooah! I'm tripping my conntrack in a frenzy of \
66 netplay... */ \
67 printk("NF_IP_ASSERT: %s:%i(%s)\n", \
68 __FILE__, __LINE__, __FUNCTION__); \
69} while(0)
70#else
71#define IP_NF_ASSERT(x)
72#endif
73
74struct ip_conntrack_helper;
75
76struct ip_conntrack
77{
78 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
79 plus 1 for any connection(s) we are `master' for */
80 struct nf_conntrack ct_general;
81
82 /* Have we seen traffic both ways yet? (bitset) */
83 unsigned long status;
84
85 /* Timer function; drops refcnt when it goes off. */
86 struct timer_list timeout;
87
88#ifdef CONFIG_IP_NF_CT_ACCT
89 /* Accounting Information (same cache line as other written members) */
90 struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
91#endif
92 /* If we were expected by an expectation, this will be it */
93 struct ip_conntrack *master;
94
95 /* Current number of expected connections */
96 unsigned int expecting;
97
98 /* Unique ID that identifies this conntrack*/
99 unsigned int id;
100
101 /* Helper, if any. */
102 struct ip_conntrack_helper *helper;
103
104 /* Storage reserved for other modules: */
105 union ip_conntrack_proto proto;
106
107 union ip_conntrack_help help;
108
109#ifdef CONFIG_IP_NF_NAT_NEEDED
110 struct {
111 struct ip_nat_info info;
112 union ip_conntrack_nat_help help;
113#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
114 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
115 int masq_index;
116#endif
117 } nat;
118#endif /* CONFIG_IP_NF_NAT_NEEDED */
119
120#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
121 u_int32_t mark;
122#endif
123
124#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
125 u_int32_t secmark;
126#endif
127
128 /* Traversed often, so hopefully in different cacheline to top */
129 /* These are my tuples; original and reply */
130 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
131};
132
133struct ip_conntrack_expect
134{
135 /* Internal linked list (global expectation list) */
136 struct list_head list;
137
138 /* We expect this tuple, with the following mask */
139 struct ip_conntrack_tuple tuple, mask;
140
141 /* Function to call after setup and insertion */
142 void (*expectfn)(struct ip_conntrack *new,
143 struct ip_conntrack_expect *this);
144
145 /* The conntrack of the master connection */
146 struct ip_conntrack *master;
147
148 /* Timer function; deletes the expectation. */
149 struct timer_list timeout;
150
151 /* Usage count. */
152 atomic_t use;
153
154 /* Unique ID */
155 unsigned int id;
156
157 /* Flags */
158 unsigned int flags;
159
160#ifdef CONFIG_IP_NF_NAT_NEEDED
161 __be32 saved_ip;
162 /* This is the original per-proto part, used to map the
163 * expected connection the way the recipient expects. */
164 union ip_conntrack_manip_proto saved_proto;
165 /* Direction relative to the master connection. */
166 enum ip_conntrack_dir dir;
167#endif
168};
169
170#define IP_CT_EXPECT_PERMANENT 0x1
171
172static inline struct ip_conntrack *
173tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash)
174{
175 return container_of(hash, struct ip_conntrack,
176 tuplehash[hash->tuple.dst.dir]);
177}
178
179/* get master conntrack via master expectation */
180#define master_ct(conntr) (conntr->master)
181
182/* Alter reply tuple (maybe alter helper). */
183extern void
184ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
185 const struct ip_conntrack_tuple *newreply);
186
187/* Is this tuple taken? (ignoring any belonging to the given
188 conntrack). */
189extern int
190ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
191 const struct ip_conntrack *ignored_conntrack);
192
193/* Return conntrack_info and tuple hash for given skb. */
194static inline struct ip_conntrack *
195ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
196{
197 *ctinfo = skb->nfctinfo;
198 return (struct ip_conntrack *)skb->nfct;
199}
200
201/* decrement reference count on a conntrack */
202static inline void
203ip_conntrack_put(struct ip_conntrack *ct)
204{
205 IP_NF_ASSERT(ct);
206 nf_conntrack_put(&ct->ct_general);
207}
208
209extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
210 const struct ip_conntrack_tuple *orig);
211
212extern void __ip_ct_refresh_acct(struct ip_conntrack *ct,
213 enum ip_conntrack_info ctinfo,
214 const struct sk_buff *skb,
215 unsigned long extra_jiffies,
216 int do_acct);
217
218/* Refresh conntrack for this many jiffies and do accounting */
219static inline void ip_ct_refresh_acct(struct ip_conntrack *ct,
220 enum ip_conntrack_info ctinfo,
221 const struct sk_buff *skb,
222 unsigned long extra_jiffies)
223{
224 __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
225}
226
227/* Refresh conntrack for this many jiffies */
228static inline void ip_ct_refresh(struct ip_conntrack *ct,
229 const struct sk_buff *skb,
230 unsigned long extra_jiffies)
231{
232 __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
233}
234
235/* These are for NAT. Icky. */
236/* Update TCP window tracking data when NAT mangles the packet */
237extern void ip_conntrack_tcp_update(struct sk_buff *skb,
238 struct ip_conntrack *conntrack,
239 enum ip_conntrack_dir dir);
240
241/* Call me when a conntrack is destroyed. */
242extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
243
244/* Fake conntrack entry for untracked connections */
245extern struct ip_conntrack ip_conntrack_untracked;
246
247/* Returns new sk_buff, or NULL */
248struct sk_buff *
249ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user);
250
251/* Iterate over all conntracks: if iter returns true, it's deleted. */
252extern void
253ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data),
254 void *data);
255
256extern struct ip_conntrack_helper *
257__ip_conntrack_helper_find_byname(const char *);
258extern struct ip_conntrack_helper *
259ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple);
260extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper);
261
262extern struct ip_conntrack_protocol *
263__ip_conntrack_proto_find(u_int8_t protocol);
264extern struct ip_conntrack_protocol *
265ip_conntrack_proto_find_get(u_int8_t protocol);
266extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto);
267
268extern void ip_ct_remove_expectations(struct ip_conntrack *ct);
269
270extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *,
271 struct ip_conntrack_tuple *);
272
273extern void ip_conntrack_free(struct ip_conntrack *ct);
274
275extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
276
277extern struct ip_conntrack_expect *
278__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
279
280extern struct ip_conntrack_expect *
281ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
282
283extern struct ip_conntrack_tuple_hash *
284__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
285 const struct ip_conntrack *ignored_conntrack);
286
287extern void ip_conntrack_flush(void);
288
289/* It's confirmed if it is, or has been in the hash table. */
290static inline int is_confirmed(struct ip_conntrack *ct)
291{
292 return test_bit(IPS_CONFIRMED_BIT, &ct->status);
293}
294
295static inline int is_dying(struct ip_conntrack *ct)
296{
297 return test_bit(IPS_DYING_BIT, &ct->status);
298}
299
300extern unsigned int ip_conntrack_htable_size;
301extern int ip_conntrack_checksum;
302
303#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
304#define CONNTRACK_STAT_INC_ATOMIC(count) \
305do { \
306 local_bh_disable(); \
307 __get_cpu_var(ip_conntrack_stat).count++; \
308 local_bh_enable(); \
309} while (0)
310
311#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
312#include <linux/notifier.h>
313#include <linux/interrupt.h>
314
315struct ip_conntrack_ecache {
316 struct ip_conntrack *ct;
317 unsigned int events;
318};
319DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
320
321#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
322
323extern struct atomic_notifier_head ip_conntrack_chain;
324extern struct atomic_notifier_head ip_conntrack_expect_chain;
325
326static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
327{
328 return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
329}
330
331static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
332{
333 return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
334}
335
336static inline int
337ip_conntrack_expect_register_notifier(struct notifier_block *nb)
338{
339 return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
340}
341
342static inline int
343ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
344{
345 return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
346 nb);
347}
348
349extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
350extern void __ip_ct_event_cache_init(struct ip_conntrack *ct);
351
352static inline void
353ip_conntrack_event_cache(enum ip_conntrack_events event,
354 const struct sk_buff *skb)
355{
356 struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct;
357 struct ip_conntrack_ecache *ecache;
358
359 local_bh_disable();
360 ecache = &__get_cpu_var(ip_conntrack_ecache);
361 if (ct != ecache->ct)
362 __ip_ct_event_cache_init(ct);
363 ecache->events |= event;
364 local_bh_enable();
365}
366
367static inline void ip_conntrack_event(enum ip_conntrack_events event,
368 struct ip_conntrack *ct)
369{
370 if (is_confirmed(ct) && !is_dying(ct))
371 atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
372}
373
374static inline void
375ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
376 struct ip_conntrack_expect *exp)
377{
378 atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
379}
380#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
381static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
382 const struct sk_buff *skb) {}
383static inline void ip_conntrack_event(enum ip_conntrack_events event,
384 struct ip_conntrack *ct) {}
385static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {}
386static inline void
387ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
388 struct ip_conntrack_expect *exp) {}
389#endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */
390
391#ifdef CONFIG_IP_NF_NAT_NEEDED
392static inline int ip_nat_initialized(struct ip_conntrack *conntrack,
393 enum ip_nat_manip_type manip)
394{
395 if (manip == IP_NAT_MANIP_SRC)
396 return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status);
397 return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status);
398}
399#endif /* CONFIG_IP_NF_NAT_NEEDED */
400
401#endif /* __KERNEL__ */
402#endif /* _IP_CONNTRACK_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h b/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
deleted file mode 100644
index de3e41f51ae..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _IP_CONNTRACK_AMANDA_H
2#define _IP_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */
4
5struct ip_conntrack_expect;
6extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
7 enum ip_conntrack_info ctinfo,
8 unsigned int matchoff,
9 unsigned int matchlen,
10 struct ip_conntrack_expect *exp);
11#endif /* _IP_CONNTRACK_AMANDA_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
deleted file mode 100644
index e3a6df07aa4..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _IP_CONNTRACK_CORE_H
2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h>
4
5#define MAX_IP_CT_PROTO 256
6extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
7
8/* This header is used to share core functionality between the
9 standalone connection tracking module, and the compatibility layer's use
10 of connection tracking. */
11extern unsigned int ip_conntrack_in(unsigned int hooknum,
12 struct sk_buff **pskb,
13 const struct net_device *in,
14 const struct net_device *out,
15 int (*okfn)(struct sk_buff *));
16
17extern int ip_conntrack_init(void);
18extern void ip_conntrack_cleanup(void);
19
20struct ip_conntrack_protocol;
21
22extern int
23ip_ct_get_tuple(const struct iphdr *iph,
24 const struct sk_buff *skb,
25 unsigned int dataoff,
26 struct ip_conntrack_tuple *tuple,
27 const struct ip_conntrack_protocol *protocol);
28
29extern int
30ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
31 const struct ip_conntrack_tuple *orig,
32 const struct ip_conntrack_protocol *protocol);
33
34/* Find a connection corresponding to a tuple. */
35struct ip_conntrack_tuple_hash *
36ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
37 const struct ip_conntrack *ignored_conntrack);
38
39extern int __ip_conntrack_confirm(struct sk_buff **pskb);
40
41/* Confirm a connection: returns NF_DROP if packet must be dropped. */
42static inline int ip_conntrack_confirm(struct sk_buff **pskb)
43{
44 struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
45 int ret = NF_ACCEPT;
46
47 if (ct) {
48 if (!is_confirmed(ct) && !is_dying(ct))
49 ret = __ip_conntrack_confirm(pskb);
50 ip_ct_deliver_cached_events(ct);
51 }
52 return ret;
53}
54
55extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
56
57extern struct list_head *ip_conntrack_hash;
58extern struct list_head ip_conntrack_expect_list;
59extern rwlock_t ip_conntrack_lock;
60#endif /* _IP_CONNTRACK_CORE_H */
61
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
deleted file mode 100644
index 2129fc3972a..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
4
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__ */
43
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
deleted file mode 100644
index 18f769818f4..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef _IP_CONNTRACK_H323_H
2#define _IP_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 ip_ct_h323_master {
14
15 /* Original and NATed Q.931 or H.245 signal ports */
16 u_int16_t sig_port[IP_CT_DIR_MAX];
17
18 /* Original and NATed RTP ports */
19 u_int16_t 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 ip_conntrack_expect;
31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 __be32 * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
37 struct ip_conntrack_expect *this);
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr,
41 __be32 ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff,
44 TransportAddress * addr,
45 __be32 ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned char **data,
50 TransportAddress * addr, int count);
51extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
52 struct ip_conntrack * ct,
53 enum ip_conntrack_info ctinfo,
54 unsigned char **data,
55 TransportAddress * addr, int count);
56extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
57 struct ip_conntrack * ct,
58 enum ip_conntrack_info ctinfo,
59 unsigned char **data, int dataoff,
60 H245_TransportAddress * addr,
61 u_int16_t port, u_int16_t rtp_port,
62 struct ip_conntrack_expect * rtp_exp,
63 struct ip_conntrack_expect * rtcp_exp);
64extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
65 enum ip_conntrack_info ctinfo,
66 unsigned char **data, int dataoff,
67 H245_TransportAddress * addr, u_int16_t port,
68 struct ip_conntrack_expect * exp);
69extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
70 enum ip_conntrack_info ctinfo,
71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp);
74extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
75 struct ip_conntrack * ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned char **data, int dataoff,
78 TransportAddress * addr,
79 u_int16_t port,
80 struct ip_conntrack_expect * exp);
81extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
82 enum ip_conntrack_info ctinfo,
83 unsigned char **data, TransportAddress * addr,
84 int idx, u_int16_t port,
85 struct ip_conntrack_expect * exp);
86
87#endif
88
89#endif
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
deleted file mode 100644
index 77fe868d36f..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/* IP connection tracking helpers. */
2#ifndef _IP_CONNTRACK_HELPER_H
3#define _IP_CONNTRACK_HELPER_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6struct module;
7
8struct ip_conntrack_helper
9{
10 struct list_head list; /* Internal use. */
11
12 const char *name; /* name of the module */
13 struct module *me; /* pointer to self */
14 unsigned int max_expected; /* Maximum number of concurrent
15 * expected connections */
16 unsigned int timeout; /* timeout for expecteds */
17
18 /* Mask of things we will help (compared against server response) */
19 struct ip_conntrack_tuple tuple;
20 struct ip_conntrack_tuple mask;
21
22 /* Function to call when data passes; return verdict, or -1 to
23 invalidate. */
24 int (*help)(struct sk_buff **pskb,
25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo);
27
28 void (*destroy)(struct ip_conntrack *ct);
29
30 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
31};
32
33extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
34extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
35
36/* Allocate space for an expectation: this is mandatory before calling
37 ip_conntrack_expect_related. You will have to call put afterwards. */
38extern struct ip_conntrack_expect *
39ip_conntrack_expect_alloc(struct ip_conntrack *master);
40extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
41
42/* Add an expected connection: can have more than one per connection */
43extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
44extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp);
45
46#endif /*_IP_CONNTRACK_HELPER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
deleted file mode 100644
index eed5ee3e474..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_ICMP_H
2#define _IP_CONNTRACK_ICMP_H
3
4#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
5
6#endif /* _IP_CONNTRACK_ICMP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_irc.h b/include/linux/netfilter_ipv4/ip_conntrack_irc.h
deleted file mode 100644
index 16601e0d562..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_irc.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* IRC extension for IP connection tracking.
2 * (C) 2000 by Harald Welte <laforge@gnumonks.org>
3 * based on RR's ip_conntrack_ftp.h
4 *
5 * ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 *
13 */
14#ifndef _IP_CONNTRACK_IRC_H
15#define _IP_CONNTRACK_IRC_H
16
17/* This structure exists only once per master */
18struct ip_ct_irc_master {
19};
20
21#ifdef __KERNEL__
22extern unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 unsigned int matchoff,
25 unsigned int matchlen,
26 struct ip_conntrack_expect *exp);
27
28#define IRC_PORT 6667
29
30#endif /* __KERNEL__ */
31
32#endif /* _IP_CONNTRACK_IRC_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
deleted file mode 100644
index 2644b1faddd..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ /dev/null
@@ -1,326 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _CONNTRACK_PPTP_H
3#define _CONNTRACK_PPTP_H
4
5/* state of the control session */
6enum pptp_ctrlsess_state {
7 PPTP_SESSION_NONE, /* no session present */
8 PPTP_SESSION_ERROR, /* some session error */
9 PPTP_SESSION_STOPREQ, /* stop_sess request seen */
10 PPTP_SESSION_REQUESTED, /* start_sess request seen */
11 PPTP_SESSION_CONFIRMED, /* session established */
12};
13
14/* state of the call inside the control session */
15enum pptp_ctrlcall_state {
16 PPTP_CALL_NONE,
17 PPTP_CALL_ERROR,
18 PPTP_CALL_OUT_REQ,
19 PPTP_CALL_OUT_CONF,
20 PPTP_CALL_IN_REQ,
21 PPTP_CALL_IN_REP,
22 PPTP_CALL_IN_CONF,
23 PPTP_CALL_CLEAR_REQ,
24};
25
26
27/* conntrack private data */
28struct ip_ct_pptp_master {
29 enum pptp_ctrlsess_state sstate; /* session state */
30
31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */
34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 __be16 pns_call_id; /* call id of PNS, host byte order */
36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */
39 struct ip_ct_gre_keymap *keymap_orig, *keymap_reply;
40};
41
42/* conntrack_expect private member */
43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */
45 __be16 pac_call_id; /* call id of PAC */
46 __be16 pns_call_id; /* call id of PNS */
47};
48
49
50#ifdef __KERNEL__
51
52#define IP_CONNTR_PPTP PPTP_CONTROL_PORT
53
54#define PPTP_CONTROL_PORT 1723
55
56#define PPTP_PACKET_CONTROL 1
57#define PPTP_PACKET_MGMT 2
58
59#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
60
61struct pptp_pkt_hdr {
62 __u16 packetLength;
63 __be16 packetType;
64 __be32 magicCookie;
65};
66
67/* PptpControlMessageType values */
68#define PPTP_START_SESSION_REQUEST 1
69#define PPTP_START_SESSION_REPLY 2
70#define PPTP_STOP_SESSION_REQUEST 3
71#define PPTP_STOP_SESSION_REPLY 4
72#define PPTP_ECHO_REQUEST 5
73#define PPTP_ECHO_REPLY 6
74#define PPTP_OUT_CALL_REQUEST 7
75#define PPTP_OUT_CALL_REPLY 8
76#define PPTP_IN_CALL_REQUEST 9
77#define PPTP_IN_CALL_REPLY 10
78#define PPTP_IN_CALL_CONNECT 11
79#define PPTP_CALL_CLEAR_REQUEST 12
80#define PPTP_CALL_DISCONNECT_NOTIFY 13
81#define PPTP_WAN_ERROR_NOTIFY 14
82#define PPTP_SET_LINK_INFO 15
83
84#define PPTP_MSG_MAX 15
85
86/* PptpGeneralError values */
87#define PPTP_ERROR_CODE_NONE 0
88#define PPTP_NOT_CONNECTED 1
89#define PPTP_BAD_FORMAT 2
90#define PPTP_BAD_VALUE 3
91#define PPTP_NO_RESOURCE 4
92#define PPTP_BAD_CALLID 5
93#define PPTP_REMOVE_DEVICE_ERROR 6
94
95struct PptpControlHeader {
96 __be16 messageType;
97 __u16 reserved;
98};
99
100/* FramingCapability Bitmap Values */
101#define PPTP_FRAME_CAP_ASYNC 0x1
102#define PPTP_FRAME_CAP_SYNC 0x2
103
104/* BearerCapability Bitmap Values */
105#define PPTP_BEARER_CAP_ANALOG 0x1
106#define PPTP_BEARER_CAP_DIGITAL 0x2
107
108struct PptpStartSessionRequest {
109 __be16 protocolVersion;
110 __u16 reserved1;
111 __be32 framingCapability;
112 __be32 bearerCapability;
113 __be16 maxChannels;
114 __be16 firmwareRevision;
115 __u8 hostName[64];
116 __u8 vendorString[64];
117};
118
119/* PptpStartSessionResultCode Values */
120#define PPTP_START_OK 1
121#define PPTP_START_GENERAL_ERROR 2
122#define PPTP_START_ALREADY_CONNECTED 3
123#define PPTP_START_NOT_AUTHORIZED 4
124#define PPTP_START_UNKNOWN_PROTOCOL 5
125
126struct PptpStartSessionReply {
127 __be16 protocolVersion;
128 __u8 resultCode;
129 __u8 generalErrorCode;
130 __be32 framingCapability;
131 __be32 bearerCapability;
132 __be16 maxChannels;
133 __be16 firmwareRevision;
134 __u8 hostName[64];
135 __u8 vendorString[64];
136};
137
138/* PptpStopReasons */
139#define PPTP_STOP_NONE 1
140#define PPTP_STOP_PROTOCOL 2
141#define PPTP_STOP_LOCAL_SHUTDOWN 3
142
143struct PptpStopSessionRequest {
144 __u8 reason;
145 __u8 reserved1;
146 __u16 reserved2;
147};
148
149/* PptpStopSessionResultCode */
150#define PPTP_STOP_OK 1
151#define PPTP_STOP_GENERAL_ERROR 2
152
153struct PptpStopSessionReply {
154 __u8 resultCode;
155 __u8 generalErrorCode;
156 __u16 reserved1;
157};
158
159struct PptpEchoRequest {
160 __be32 identNumber;
161};
162
163/* PptpEchoReplyResultCode */
164#define PPTP_ECHO_OK 1
165#define PPTP_ECHO_GENERAL_ERROR 2
166
167struct PptpEchoReply {
168 __be32 identNumber;
169 __u8 resultCode;
170 __u8 generalErrorCode;
171 __u16 reserved;
172};
173
174/* PptpFramingType */
175#define PPTP_ASYNC_FRAMING 1
176#define PPTP_SYNC_FRAMING 2
177#define PPTP_DONT_CARE_FRAMING 3
178
179/* PptpCallBearerType */
180#define PPTP_ANALOG_TYPE 1
181#define PPTP_DIGITAL_TYPE 2
182#define PPTP_DONT_CARE_BEARER_TYPE 3
183
184struct PptpOutCallRequest {
185 __be16 callID;
186 __be16 callSerialNumber;
187 __be32 minBPS;
188 __be32 maxBPS;
189 __be32 bearerType;
190 __be32 framingType;
191 __be16 packetWindow;
192 __be16 packetProcDelay;
193 __be16 phoneNumberLength;
194 __u16 reserved1;
195 __u8 phoneNumber[64];
196 __u8 subAddress[64];
197};
198
199/* PptpCallResultCode */
200#define PPTP_OUTCALL_CONNECT 1
201#define PPTP_OUTCALL_GENERAL_ERROR 2
202#define PPTP_OUTCALL_NO_CARRIER 3
203#define PPTP_OUTCALL_BUSY 4
204#define PPTP_OUTCALL_NO_DIAL_TONE 5
205#define PPTP_OUTCALL_TIMEOUT 6
206#define PPTP_OUTCALL_DONT_ACCEPT 7
207
208struct PptpOutCallReply {
209 __be16 callID;
210 __be16 peersCallID;
211 __u8 resultCode;
212 __u8 generalErrorCode;
213 __be16 causeCode;
214 __be32 connectSpeed;
215 __be16 packetWindow;
216 __be16 packetProcDelay;
217 __be32 physChannelID;
218};
219
220struct PptpInCallRequest {
221 __be16 callID;
222 __be16 callSerialNumber;
223 __be32 callBearerType;
224 __be32 physChannelID;
225 __be16 dialedNumberLength;
226 __be16 dialingNumberLength;
227 __u8 dialedNumber[64];
228 __u8 dialingNumber[64];
229 __u8 subAddress[64];
230};
231
232/* PptpInCallResultCode */
233#define PPTP_INCALL_ACCEPT 1
234#define PPTP_INCALL_GENERAL_ERROR 2
235#define PPTP_INCALL_DONT_ACCEPT 3
236
237struct PptpInCallReply {
238 __be16 callID;
239 __be16 peersCallID;
240 __u8 resultCode;
241 __u8 generalErrorCode;
242 __be16 packetWindow;
243 __be16 packetProcDelay;
244 __u16 reserved;
245};
246
247struct PptpInCallConnected {
248 __be16 peersCallID;
249 __u16 reserved;
250 __be32 connectSpeed;
251 __be16 packetWindow;
252 __be16 packetProcDelay;
253 __be32 callFramingType;
254};
255
256struct PptpClearCallRequest {
257 __be16 callID;
258 __u16 reserved;
259};
260
261struct PptpCallDisconnectNotify {
262 __be16 callID;
263 __u8 resultCode;
264 __u8 generalErrorCode;
265 __be16 causeCode;
266 __u16 reserved;
267 __u8 callStatistics[128];
268};
269
270struct PptpWanErrorNotify {
271 __be16 peersCallID;
272 __u16 reserved;
273 __be32 crcErrors;
274 __be32 framingErrors;
275 __be32 hardwareOverRuns;
276 __be32 bufferOverRuns;
277 __be32 timeoutErrors;
278 __be32 alignmentErrors;
279};
280
281struct PptpSetLinkInfo {
282 __be16 peersCallID;
283 __u16 reserved;
284 __be32 sendAccm;
285 __be32 recvAccm;
286};
287
288union pptp_ctrl_union {
289 struct PptpStartSessionRequest sreq;
290 struct PptpStartSessionReply srep;
291 struct PptpStopSessionRequest streq;
292 struct PptpStopSessionReply strep;
293 struct PptpOutCallRequest ocreq;
294 struct PptpOutCallReply ocack;
295 struct PptpInCallRequest icreq;
296 struct PptpInCallReply icack;
297 struct PptpInCallConnected iccon;
298 struct PptpClearCallRequest clrreq;
299 struct PptpCallDisconnectNotify disc;
300 struct PptpWanErrorNotify wanerr;
301 struct PptpSetLinkInfo setlink;
302};
303
304extern int
305(*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb,
306 struct ip_conntrack *ct,
307 enum ip_conntrack_info ctinfo,
308 struct PptpControlHeader *ctlh,
309 union pptp_ctrl_union *pptpReq);
310
311extern int
312(*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb,
313 struct ip_conntrack *ct,
314 enum ip_conntrack_info ctinfo,
315 struct PptpControlHeader *ctlh,
316 union pptp_ctrl_union *pptpReq);
317
318extern void
319(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
320 struct ip_conntrack_expect *exp_reply);
321
322extern void
323(*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct,
324 struct ip_conntrack_expect *exp);
325#endif /* __KERNEL__ */
326#endif /* _CONNTRACK_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
deleted file mode 100644
index e371e0fc167..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ /dev/null
@@ -1,114 +0,0 @@
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
67
68/* this is part of ip_conntrack */
69struct ip_ct_gre {
70 unsigned int stream_timeout;
71 unsigned int timeout;
72};
73
74#ifdef __KERNEL__
75struct ip_conntrack_expect;
76struct ip_conntrack;
77
78/* structure for original <-> reply keymap */
79struct ip_ct_gre_keymap {
80 struct list_head list;
81
82 struct ip_conntrack_tuple tuple;
83};
84
85/* add new tuple->key_reply pair to keymap */
86int ip_ct_gre_keymap_add(struct ip_conntrack *ct,
87 struct ip_conntrack_tuple *t,
88 int reply);
89
90/* delete keymap entries */
91void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92
93
94/* get pointer to gre key, if present */
95static inline __be32 *gre_key(struct gre_hdr *greh)
96{
97 if (!greh->key)
98 return NULL;
99 if (greh->csum || greh->routing)
100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (__be32 *) (greh+sizeof(*greh));
102}
103
104/* get pointer ot gre csum, if present */
105static inline __sum16 *gre_csum(struct gre_hdr *greh)
106{
107 if (!greh->csum)
108 return NULL;
109 return (__sum16 *) (greh+sizeof(*greh));
110}
111
112#endif /* __KERNEL__ */
113
114#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
deleted file mode 100644
index 2c76b879e3d..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* Header for use in defining a given protocol for connection tracking. */
2#ifndef _IP_CONNTRACK_PROTOCOL_H
3#define _IP_CONNTRACK_PROTOCOL_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct seq_file;
8
9struct ip_conntrack_protocol
10{
11 /* Protocol number. */
12 u_int8_t proto;
13
14 /* Protocol name */
15 const char *name;
16
17 /* Try to fill in the third arg: dataoff is offset past IP
18 hdr. Return true if possible. */
19 int (*pkt_to_tuple)(const struct sk_buff *skb,
20 unsigned int dataoff,
21 struct ip_conntrack_tuple *tuple);
22
23 /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
24 * Some packets can't be inverted: return 0 in that case.
25 */
26 int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
27 const struct ip_conntrack_tuple *orig);
28
29 /* Print out the per-protocol part of the tuple. Return like seq_* */
30 int (*print_tuple)(struct seq_file *,
31 const struct ip_conntrack_tuple *);
32
33 /* Print out the private part of the conntrack. */
34 int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *);
35
36 /* Returns verdict for packet, or -1 for invalid. */
37 int (*packet)(struct ip_conntrack *conntrack,
38 const struct sk_buff *skb,
39 enum ip_conntrack_info ctinfo);
40
41 /* Called when a new connection for this protocol found;
42 * returns TRUE if it's OK. If so, packet() called next. */
43 int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb);
44
45 /* Called when a conntrack entry is destroyed */
46 void (*destroy)(struct ip_conntrack *conntrack);
47
48 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
49 unsigned int hooknum);
50
51 /* convert protoinfo to nfnetink attributes */
52 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
53 const struct ip_conntrack *ct);
54
55 /* convert nfnetlink attributes to protoinfo */
56 int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
57
58 int (*tuple_to_nfattr)(struct sk_buff *skb,
59 const struct ip_conntrack_tuple *t);
60 int (*nfattr_to_tuple)(struct nfattr *tb[],
61 struct ip_conntrack_tuple *t);
62
63 /* Module (if any) which this is connected to. */
64 struct module *me;
65};
66
67/* Protocol registration. */
68extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
69extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
70/* Existing built-in protocols */
71extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
72extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
73extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
74extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
75extern int ip_conntrack_protocol_tcp_init(void);
76
77/* Log invalid packets */
78extern unsigned int ip_ct_log_invalid;
79
80extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
81 const struct ip_conntrack_tuple *);
82extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
83 struct ip_conntrack_tuple *);
84
85#ifdef CONFIG_SYSCTL
86#ifdef DEBUG_INVALID_PACKETS
87#define LOG_INVALID(proto) \
88 (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
89#else
90#define LOG_INVALID(proto) \
91 ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
92 && net_ratelimit())
93#endif
94#else
95#define LOG_INVALID(proto) 0
96#endif /* CONFIG_SYSCTL */
97
98#endif /*_IP_CONNTRACK_PROTOCOL_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
deleted file mode 100644
index 4099a041a32..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_SCTP_H
2#define _IP_CONNTRACK_SCTP_H
3
4#include <linux/netfilter/nf_conntrack_sctp.h>
5
6#endif /* _IP_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
deleted file mode 100644
index bef6c646def..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h
+++ /dev/null
@@ -1,40 +0,0 @@
1#ifndef __IP_CONNTRACK_SIP_H__
2#define __IP_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,
18 POS_CONNECTION,
19 POS_SDP_HEADER,
20};
21
22extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 struct ip_conntrack *ct,
25 const char **dptr);
26extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
27 enum ip_conntrack_info ctinfo,
28 struct ip_conntrack_expect *exp,
29 const char *dptr);
30
31extern int ct_sip_get_info(const char *dptr, size_t dlen,
32 unsigned int *matchoff,
33 unsigned int *matchlen,
34 enum sip_header_pos pos);
35extern int ct_sip_lnlen(const char *line, const char *limit);
36extern const char *ct_sip_search(const char *needle, const char *haystack,
37 size_t needle_len, size_t haystack_len,
38 int case_sensitive);
39#endif /* __KERNEL__ */
40#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
deleted file mode 100644
index 876b8fb17e6..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_TCP_H
2#define _IP_CONNTRACK_TCP_H
3
4#include <linux/netfilter/nf_conntrack_tcp.h>
5
6#endif /* _IP_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
deleted file mode 100644
index a404fc0abf0..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IP_CT_TFTP
2#define _IP_CT_TFTP
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 (*ip_nat_tftp_hook)(struct sk_buff **pskb,
17 enum ip_conntrack_info ctinfo,
18 struct ip_conntrack_expect *exp);
19
20#endif /* _IP_CT_TFTP */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
deleted file mode 100644
index c228bde74c3..00000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ /dev/null
@@ -1,146 +0,0 @@
1#ifndef _IP_CONNTRACK_TUPLE_H
2#define _IP_CONNTRACK_TUPLE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7/* A `tuple' is a structure containing the information to uniquely
8 identify a connection. ie. if two packets have the same tuple, they
9 are in the same connection; if not, they are not.
10
11 We divide the structure along "manipulatable" and
12 "non-manipulatable" lines, for the benefit of the NAT code.
13*/
14
15/* The protocol-specific manipulable parts of the tuple: always in
16 network order! */
17union ip_conntrack_manip_proto
18{
19 /* Add other protocols here. */
20 u_int16_t all;
21
22 struct {
23 __be16 port;
24 } tcp;
25 struct {
26 __be16 port;
27 } udp;
28 struct {
29 __be16 id;
30 } icmp;
31 struct {
32 __be16 port;
33 } sctp;
34 struct {
35 __be16 key; /* key is 32bit, pptp only uses 16 */
36 } gre;
37};
38
39/* The manipulable part of the tuple. */
40struct ip_conntrack_manip
41{
42 __be32 ip;
43 union ip_conntrack_manip_proto u;
44};
45
46/* This contains the information to distinguish a connection. */
47struct ip_conntrack_tuple
48{
49 struct ip_conntrack_manip src;
50
51 /* These are the parts of the tuple which are fixed. */
52 struct {
53 __be32 ip;
54 union {
55 /* Add other protocols here. */
56 u_int16_t all;
57
58 struct {
59 __be16 port;
60 } tcp;
61 struct {
62 __be16 port;
63 } udp;
64 struct {
65 u_int8_t type, code;
66 } icmp;
67 struct {
68 __be16 port;
69 } sctp;
70 struct {
71 __be16 key; /* key is 32bit,
72 * pptp only uses 16 */
73 } gre;
74 } u;
75
76 /* The protocol. */
77 u_int8_t protonum;
78
79 /* The direction (for tuplehash) */
80 u_int8_t dir;
81 } dst;
82};
83
84/* This is optimized opposed to a memset of the whole structure. Everything we
85 * really care about is the source/destination unions */
86#define IP_CT_TUPLE_U_BLANK(tuple) \
87 do { \
88 (tuple)->src.u.all = 0; \
89 (tuple)->dst.u.all = 0; \
90 } while (0)
91
92#ifdef __KERNEL__
93
94#define DUMP_TUPLE(tp) \
95DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
96 (tp), (tp)->dst.protonum, \
97 NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
98 NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
99
100/* If we're the first tuple, it's the original dir. */
101#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
102
103/* Connections have two entries in the hash table: one for each way */
104struct ip_conntrack_tuple_hash
105{
106 struct list_head list;
107
108 struct ip_conntrack_tuple tuple;
109};
110
111#endif /* __KERNEL__ */
112
113static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1,
114 const struct ip_conntrack_tuple *t2)
115{
116 return t1->src.ip == t2->src.ip
117 && t1->src.u.all == t2->src.u.all;
118}
119
120static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1,
121 const struct ip_conntrack_tuple *t2)
122{
123 return t1->dst.ip == t2->dst.ip
124 && t1->dst.u.all == t2->dst.u.all
125 && t1->dst.protonum == t2->dst.protonum;
126}
127
128static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1,
129 const struct ip_conntrack_tuple *t2)
130{
131 return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2);
132}
133
134static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t,
135 const struct ip_conntrack_tuple *tuple,
136 const struct ip_conntrack_tuple *mask)
137{
138 return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip)
139 || ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip)
140 || ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all)
141 || ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all)
142 || ((t->dst.protonum ^ tuple->dst.protonum)
143 & mask->dst.protonum));
144}
145
146#endif /* _IP_CONNTRACK_TUPLE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
deleted file mode 100644
index bbca89aab81..00000000000
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef _IP_NAT_H
2#define _IP_NAT_H
3#include <linux/netfilter_ipv4.h>
4#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
5
6#define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7
8enum ip_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#define IP_NAT_RANGE_PROTO_RANDOM 4 /* add randomness to "port" selection */
20
21/* NAT sequence number modifications */
22struct ip_nat_seq {
23 /* position of the last TCP sequence number
24 * modification (if any) */
25 u_int32_t correction_pos;
26 /* sequence number offset before and after last modification */
27 int16_t offset_before, offset_after;
28};
29
30/* Single range specification. */
31struct ip_nat_range
32{
33 /* Set to OR of flags above. */
34 unsigned int flags;
35
36 /* Inclusive: network order. */
37 __be32 min_ip, max_ip;
38
39 /* Inclusive: network order */
40 union ip_conntrack_manip_proto min, max;
41};
42
43/* For backwards compat: don't use in modern code. */
44struct ip_nat_multi_range_compat
45{
46 unsigned int rangesize; /* Must be 1. */
47
48 /* hangs off end. */
49 struct ip_nat_range range[1];
50};
51
52#ifdef __KERNEL__
53#include <linux/list.h>
54
55/* Protects NAT hash tables, and NAT-private part of conntracks. */
56extern rwlock_t ip_nat_lock;
57
58/* The structure embedded in the conntrack structure. */
59struct ip_nat_info
60{
61 struct list_head bysource;
62 struct ip_nat_seq seq[IP_CT_DIR_MAX];
63};
64
65struct ip_conntrack;
66
67/* Set up the info structure to map into this range. */
68extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
69 const struct ip_nat_range *range,
70 unsigned int hooknum);
71
72/* Is this tuple already taken? (not by us)*/
73extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
74 const struct ip_conntrack *ignored_conntrack);
75
76#else /* !__KERNEL__: iptables wants this to compile. */
77#define ip_nat_multi_range ip_nat_multi_range_compat
78#endif /*__KERNEL__*/
79#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
deleted file mode 100644
index 60566f9fd7b..00000000000
--- a/include/linux/netfilter_ipv4/ip_nat_core.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IP_NAT_CORE_H
2#define _IP_NAT_CORE_H
3#include <linux/list.h>
4#include <linux/netfilter_ipv4/ip_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 ip_nat_packet(struct ip_conntrack *ct,
10 enum ip_conntrack_info conntrackinfo,
11 unsigned int hooknum,
12 struct sk_buff **pskb);
13
14extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
15 enum ip_conntrack_info ctinfo,
16 unsigned int hooknum,
17 struct sk_buff **pskb);
18#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h
deleted file mode 100644
index bf9cb105c88..00000000000
--- a/include/linux/netfilter_ipv4/ip_nat_helper.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _IP_NAT_HELPER_H
2#define _IP_NAT_HELPER_H
3/* NAT protocol helper routines. */
4
5#include <linux/netfilter_ipv4/ip_conntrack.h>
6#include <linux/module.h>
7
8struct sk_buff;
9
10/* These return true or false. */
11extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
12 struct ip_conntrack *ct,
13 enum ip_conntrack_info ctinfo,
14 unsigned int match_offset,
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len);
18extern int ip_nat_mangle_udp_packet(struct sk_buff **skb,
19 struct ip_conntrack *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len);
25extern int ip_nat_seq_adjust(struct sk_buff **pskb,
26 struct ip_conntrack *ct,
27 enum ip_conntrack_info ctinfo);
28
29/* Setup NAT on this expected conntrack so it follows master, but goes
30 * to port ct->master->saved_proto. */
31extern void ip_nat_follow_master(struct ip_conntrack *ct,
32 struct ip_conntrack_expect *this);
33#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
deleted file mode 100644
index 36668bf0f37..00000000000
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _NAT_PPTP_H
3#define _NAT_PPTP_H
4
5/* conntrack private data */
6struct ip_nat_pptp {
7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 __be16 pac_call_id; /* NAT'ed PAC call id */
9};
10
11#endif /* _NAT_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
deleted file mode 100644
index 612a43614e7..00000000000
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/* Header for use in defining a given protocol. */
2#ifndef _IP_NAT_PROTOCOL_H
3#define _IP_NAT_PROTOCOL_H
4#include <linux/init.h>
5#include <linux/list.h>
6
7#include <linux/netfilter_ipv4/ip_nat.h>
8#include <linux/netfilter/nfnetlink_conntrack.h>
9
10struct iphdr;
11struct ip_nat_range;
12
13struct ip_nat_protocol
14{
15 /* Protocol name */
16 const char *name;
17
18 /* Protocol number. */
19 unsigned int protonum;
20
21 struct module *me;
22
23 /* Translate a packet to the target according to manip type.
24 Return true if succeeded. */
25 int (*manip_pkt)(struct sk_buff **pskb,
26 unsigned int iphdroff,
27 const struct ip_conntrack_tuple *tuple,
28 enum ip_nat_manip_type maniptype);
29
30 /* Is the manipable part of the tuple between min and max incl? */
31 int (*in_range)(const struct ip_conntrack_tuple *tuple,
32 enum ip_nat_manip_type maniptype,
33 const union ip_conntrack_manip_proto *min,
34 const union ip_conntrack_manip_proto *max);
35
36 /* Alter the per-proto part of the tuple (depending on
37 maniptype), to give a unique tuple in the given range if
38 possible; return false if not. Per-protocol part of tuple
39 is initialized to the incoming packet. */
40 int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
41 const struct ip_nat_range *range,
42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack);
44
45 int (*range_to_nfattr)(struct sk_buff *skb,
46 const struct ip_nat_range *range);
47
48 int (*nfattr_to_range)(struct nfattr *tb[],
49 struct ip_nat_range *range);
50};
51
52/* Protocol registration. */
53extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
54extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
55
56extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
57extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
58
59/* Built-in protocols. */
60extern struct ip_nat_protocol ip_nat_protocol_tcp;
61extern struct ip_nat_protocol ip_nat_protocol_udp;
62extern struct ip_nat_protocol ip_nat_protocol_icmp;
63extern struct ip_nat_protocol ip_nat_unknown_protocol;
64
65extern int init_protocols(void) __init;
66extern void cleanup_protocols(void);
67extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
68
69extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
70 const struct ip_nat_range *range);
71extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
72 struct ip_nat_range *range);
73
74#endif /*_IP_NAT_PROTO_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h
deleted file mode 100644
index 73b9552e6a8..00000000000
--- a/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _IP_NAT_RULE_H
2#define _IP_NAT_RULE_H
3#include <linux/netfilter_ipv4/ip_conntrack.h>
4#include <linux/netfilter_ipv4/ip_tables.h>
5#include <linux/netfilter_ipv4/ip_nat.h>
6
7#ifdef __KERNEL__
8
9extern int ip_nat_rule_init(void) __init;
10extern void ip_nat_rule_cleanup(void);
11extern int ip_nat_rule_find(struct sk_buff **pskb,
12 unsigned int hooknum,
13 const struct net_device *in,
14 const struct net_device *out,
15 struct ip_conntrack *ct,
16 struct ip_nat_info *info);
17
18extern unsigned int
19alloc_null_binding(struct ip_conntrack *conntrack,
20 struct ip_nat_info *info,
21 unsigned int hooknum);
22
23extern unsigned int
24alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
25 struct ip_nat_info *info,
26 unsigned int hooknum);
27#endif
28#endif /* _IP_NAT_RULE_H */
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index cc4c0b2269a..be6e682a85e 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -13,7 +13,7 @@ struct ipt_same_info
13 u_int32_t *iparray; 13 u_int32_t *iparray;
14 14
15 /* hangs off end. */ 15 /* hangs off end. */
16 struct ip_nat_range range[IPT_SAME_MAX_RANGE]; 16 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
17}; 17};
18 18
19#endif /*_IPT_SAME_H*/ 19#endif /*_IPT_SAME_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2a20f488ac1..2e23353c28a 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -31,7 +31,7 @@ struct sockaddr_nl
31{ 31{
32 sa_family_t nl_family; /* AF_NETLINK */ 32 sa_family_t nl_family; /* AF_NETLINK */
33 unsigned short nl_pad; /* zero */ 33 unsigned short nl_pad; /* zero */
34 __u32 nl_pid; /* process pid */ 34 __u32 nl_pid; /* port ID */
35 __u32 nl_groups; /* multicast groups mask */ 35 __u32 nl_groups; /* multicast groups mask */
36}; 36};
37 37
@@ -41,7 +41,7 @@ struct nlmsghdr
41 __u16 nlmsg_type; /* Message content */ 41 __u16 nlmsg_type; /* Message content */
42 __u16 nlmsg_flags; /* Additional flags */ 42 __u16 nlmsg_flags; /* Additional flags */
43 __u32 nlmsg_seq; /* Sequence number */ 43 __u32 nlmsg_seq; /* Sequence number */
44 __u32 nlmsg_pid; /* Sending process PID */ 44 __u32 nlmsg_pid; /* Sending process port ID */
45}; 45};
46 46
47/* Flags values */ 47/* Flags values */
@@ -138,6 +138,11 @@ struct nlattr
138#include <linux/capability.h> 138#include <linux/capability.h>
139#include <linux/skbuff.h> 139#include <linux/skbuff.h>
140 140
141static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
142{
143 return (struct nlmsghdr *)skb->data;
144}
145
141struct netlink_skb_parms 146struct netlink_skb_parms
142{ 147{
143 struct ucred creds; /* Skb credentials */ 148 struct ucred creds; /* Skb credentials */
@@ -152,7 +157,10 @@ struct netlink_skb_parms
152#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 157#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
153 158
154 159
155extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); 160extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
161 void (*input)(struct sock *sk, int len),
162 struct mutex *cb_mutex,
163 struct module *module);
156extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
157extern int netlink_has_listeners(struct sock *sk, unsigned int group); 165extern int netlink_has_listeners(struct sock *sk, unsigned int group);
158extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
@@ -171,9 +179,16 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
171 179
172/* 180/*
173 * skb should fit one page. This choice is good for headerless malloc. 181 * skb should fit one page. This choice is good for headerless malloc.
182 * But we should limit to 8K so that userspace does not have to
183 * use enormous buffer sizes on recvmsg() calls just to avoid
184 * MSG_TRUNC when PAGE_SIZE is very large.
174 */ 185 */
175#define NLMSG_GOODORDER 0 186#if PAGE_SIZE < 8192UL
176#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) 187#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
188#else
189#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
190#endif
191
177#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) 192#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
178 193
179 194
@@ -217,18 +232,6 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
217#define NLMSG_PUT(skb, pid, seq, type, len) \ 232#define NLMSG_PUT(skb, pid, seq, type, len) \
218 NLMSG_NEW(skb, pid, seq, type, len, 0) 233 NLMSG_NEW(skb, pid, seq, type, len, 0)
219 234
220#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
221 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
222 (cb)->nlh->nlmsg_seq, type, len, flags)
223
224#define NLMSG_END(skb, nlh) \
225({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
226 (skb)->len; })
227
228#define NLMSG_CANCEL(skb, nlh) \
229({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
230 -1; })
231
232extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 235extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
233 struct nlmsghdr *nlh, 236 struct nlmsghdr *nlh,
234 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 237 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e9ae0c6e2c6..0543439a97a 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -455,7 +455,7 @@ nfs_have_writebacks(struct inode *inode)
455/* 455/*
456 * Allocate nfs_write_data structures 456 * Allocate nfs_write_data structures
457 */ 457 */
458extern struct nfs_write_data *nfs_writedata_alloc(size_t len); 458extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages);
459 459
460/* 460/*
461 * linux/fs/nfs/read.c 461 * linux/fs/nfs/read.c
@@ -469,7 +469,7 @@ extern void nfs_readdata_release(void *data);
469/* 469/*
470 * Allocate nfs_read_data structures 470 * Allocate nfs_read_data structures
471 */ 471 */
472extern struct nfs_read_data *nfs_readdata_alloc(size_t len); 472extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages);
473 473
474/* 474/*
475 * linux/fs/nfs3proc.c 475 * linux/fs/nfs3proc.c
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index 659c7543845..cc8b9c59acb 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -61,6 +61,7 @@ struct nfs_mount_data {
61#define NFS_MOUNT_NOACL 0x0800 /* 4 */ 61#define NFS_MOUNT_NOACL 0x0800 /* 4 */
62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ 62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ 63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
64#define NFS_MOUNT_FLAGMASK 0xFFFF 65#define NFS_MOUNT_FLAGMASK 0xFFFF
65 66
66#endif 67#endif
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index d111be63914..41afab6b5f0 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -21,8 +21,7 @@
21/* 21/*
22 * Valid flags for the radix tree 22 * Valid flags for the radix tree
23 */ 23 */
24#define NFS_PAGE_TAG_DIRTY 0 24#define NFS_PAGE_TAG_WRITEBACK 0
25#define NFS_PAGE_TAG_WRITEBACK 1
26 25
27/* 26/*
28 * Valid flags for a dirty buffer 27 * Valid flags for a dirty buffer
@@ -39,7 +38,7 @@ struct nfs_page {
39 struct page *wb_page; /* page to read in/write out */ 38 struct page *wb_page; /* page to read in/write out */
40 struct nfs_open_context *wb_context; /* File state context info */ 39 struct nfs_open_context *wb_context; /* File state context info */
41 atomic_t wb_complete; /* i/os we're waiting for */ 40 atomic_t wb_complete; /* i/os we're waiting for */
42 unsigned long wb_index; /* Offset >> PAGE_CACHE_SHIFT */ 41 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */
43 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */ 42 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */
44 wb_pgbase, /* Start of page data */ 43 wb_pgbase, /* Start of page data */
45 wb_bytes; /* Length of request */ 44 wb_bytes; /* Length of request */
@@ -48,9 +47,20 @@ struct nfs_page {
48 struct nfs_writeverf wb_verf; /* Commit cookie */ 47 struct nfs_writeverf wb_verf; /* Commit cookie */
49}; 48};
50 49
50struct nfs_pageio_descriptor {
51 struct list_head pg_list;
52 unsigned long pg_bytes_written;
53 size_t pg_count;
54 size_t pg_bsize;
55 unsigned int pg_base;
56
57 struct inode *pg_inode;
58 int (*pg_doio)(struct inode *, struct list_head *, unsigned int, size_t, int);
59 int pg_ioflags;
60 int pg_error;
61};
62
51#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 63#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
52#define NFS_NEED_COMMIT(req) (test_bit(PG_NEED_COMMIT,&(req)->wb_flags))
53#define NFS_NEED_RESCHED(req) (test_bit(PG_NEED_RESCHED,&(req)->wb_flags))
54 64
55extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, 65extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
56 struct inode *inode, 66 struct inode *inode,
@@ -61,13 +71,16 @@ extern void nfs_clear_request(struct nfs_page *req);
61extern void nfs_release_request(struct nfs_page *req); 71extern void nfs_release_request(struct nfs_page *req);
62 72
63 73
64extern long nfs_scan_dirty(struct address_space *mapping,
65 struct writeback_control *wbc,
66 struct list_head *dst);
67extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst, 74extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst,
68 unsigned long idx_start, unsigned int npages); 75 pgoff_t idx_start, unsigned int npages);
69extern int nfs_coalesce_requests(struct list_head *, struct list_head *, 76extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
70 unsigned int); 77 struct inode *inode,
78 int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int),
79 size_t bsize,
80 int how);
81extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
82 struct nfs_page *);
83extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
71extern int nfs_wait_on_request(struct nfs_page *); 84extern int nfs_wait_on_request(struct nfs_page *);
72extern void nfs_unlock_request(struct nfs_page *req); 85extern void nfs_unlock_request(struct nfs_page *req);
73extern int nfs_set_page_writeback_locked(struct nfs_page *req); 86extern int nfs_set_page_writeback_locked(struct nfs_page *req);
@@ -121,34 +134,6 @@ nfs_list_remove_request(struct nfs_page *req)
121 req->wb_list_head = NULL; 134 req->wb_list_head = NULL;
122} 135}
123 136
124static inline int
125nfs_defer_commit(struct nfs_page *req)
126{
127 return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags);
128}
129
130static inline void
131nfs_clear_commit(struct nfs_page *req)
132{
133 smp_mb__before_clear_bit();
134 clear_bit(PG_NEED_COMMIT, &req->wb_flags);
135 smp_mb__after_clear_bit();
136}
137
138static inline int
139nfs_defer_reschedule(struct nfs_page *req)
140{
141 return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags);
142}
143
144static inline void
145nfs_clear_reschedule(struct nfs_page *req)
146{
147 smp_mb__before_clear_bit();
148 clear_bit(PG_NEED_RESCHED, &req->wb_flags);
149 smp_mb__after_clear_bit();
150}
151
152static inline struct nfs_page * 137static inline struct nfs_page *
153nfs_list_entry(struct list_head *head) 138nfs_list_entry(struct list_head *head)
154{ 139{
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
new file mode 100644
index 00000000000..9a30ba2ca75
--- /dev/null
+++ b/include/linux/nl80211.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_NL80211_H
2#define __LINUX_NL80211_H
3/*
4 * 802.11 netlink interface public header
5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
7 */
8
9/**
10 * enum nl80211_iftype - (virtual) interface types
11 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
12 * @NL80211_IFTYPE_ADHOC: independent BSS member
13 * @NL80211_IFTYPE_STATION: managed BSS member
14 * @NL80211_IFTYPE_AP: access point
15 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
16 * @NL80211_IFTYPE_WDS: wireless distribution interface
17 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
18 * @__NL80211_IFTYPE_AFTER_LAST: internal use
19 *
20 * These values are used with the NL80211_ATTR_IFTYPE
21 * to set the type of an interface.
22 *
23 */
24enum nl80211_iftype {
25 NL80211_IFTYPE_UNSPECIFIED,
26 NL80211_IFTYPE_ADHOC,
27 NL80211_IFTYPE_STATION,
28 NL80211_IFTYPE_AP,
29 NL80211_IFTYPE_AP_VLAN,
30 NL80211_IFTYPE_WDS,
31 NL80211_IFTYPE_MONITOR,
32
33 /* keep last */
34 __NL80211_IFTYPE_AFTER_LAST
35};
36#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
37
38#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index 870e66a9628..cdb3e9b8db5 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -28,18 +28,18 @@ enum nubus_category {
28}; 28};
29 29
30enum nubus_type_network { 30enum nubus_type_network {
31 NUBUS_TYPE_ETHERNET = 0x0001, 31 NUBUS_TYPE_ETHERNET = 0x0001,
32 NUBUS_TYPE_RS232 = 0x0002 32 NUBUS_TYPE_RS232 = 0x0002
33}; 33};
34 34
35enum nubus_type_display { 35enum nubus_type_display {
36 NUBUS_TYPE_VIDEO = 0x0001 36 NUBUS_TYPE_VIDEO = 0x0001
37}; 37};
38 38
39enum nubus_type_cpu { 39enum nubus_type_cpu {
40 NUBUS_TYPE_68020 = 0x0003, 40 NUBUS_TYPE_68020 = 0x0003,
41 NUBUS_TYPE_68030 = 0x0004, 41 NUBUS_TYPE_68030 = 0x0004,
42 NUBUS_TYPE_68040 = 0x0005 42 NUBUS_TYPE_68040 = 0x0005
43}; 43};
44 44
45/* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots) 45/* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots)
@@ -56,6 +56,7 @@ enum nubus_type_cpu {
56 * 56 *
57 * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272> 57 * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272>
58 * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271> 58 * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271>
59 * Apple SONIC LC-PDS Ethernet ("Apple Ethernet LC Twisted-Pair Card"): <4,1,0,281>
59 * Sonic Systems Ethernet A-Series Card: <4,1,268,256> 60 * Sonic Systems Ethernet A-Series Card: <4,1,268,256>
60 * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision) 61 * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision)
61 * ROM on the above card: <2,1,0,0> 62 * ROM on the above card: <2,1,0,0>
@@ -80,24 +81,26 @@ enum nubus_type_cpu {
80/* Add known DrSW values here */ 81/* Add known DrSW values here */
81enum nubus_drsw { 82enum nubus_drsw {
82 /* NUBUS_CAT_DISPLAY */ 83 /* NUBUS_CAT_DISPLAY */
83 NUBUS_DRSW_APPLE = 0x0001, 84 NUBUS_DRSW_APPLE = 0x0001,
84 NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */ 85 NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */
85 86
86 /* NUBUS_CAT_NETWORK */ 87 /* NUBUS_CAT_NETWORK */
87 NUBUS_DRSW_CABLETRON = 0x0001, 88 NUBUS_DRSW_3COM = 0x0000,
88 NUBUS_DRSW_SONIC_LC = 0x0001, 89 NUBUS_DRSW_CABLETRON = 0x0001,
89 NUBUS_DRSW_KINETICS = 0x0103, 90 NUBUS_DRSW_SONIC_LC = 0x0001,
90 NUBUS_DRSW_ASANTE = 0x0104, 91 NUBUS_DRSW_KINETICS = 0x0103,
91 NUBUS_DRSW_DAYNA = 0x010b, 92 NUBUS_DRSW_ASANTE = 0x0104,
92 NUBUS_DRSW_FARALLON = 0x010c, 93 NUBUS_DRSW_TECHWORKS = 0x0109,
93 NUBUS_DRSW_APPLE_SN = 0x010f, 94 NUBUS_DRSW_DAYNA = 0x010b,
94 NUBUS_DRSW_DAYNA2 = 0x0115, 95 NUBUS_DRSW_FARALLON = 0x010c,
96 NUBUS_DRSW_APPLE_SN = 0x010f,
97 NUBUS_DRSW_DAYNA2 = 0x0115,
95 NUBUS_DRSW_FOCUS = 0x011a, 98 NUBUS_DRSW_FOCUS = 0x011a,
96 NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */ 99 NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */
97 NUBUS_DRSW_DAYNA_LC = 0x011e, 100 NUBUS_DRSW_DAYNA_LC = 0x011e,
98 101
99 /* NUBUS_CAT_CPU */ 102 /* NUBUS_CAT_CPU */
100 NUBUS_DRSW_NONE = 0x0000, 103 NUBUS_DRSW_NONE = 0x0000,
101}; 104};
102 105
103/* DrHW: Uniquely identifies the hardware interface to a board (or at 106/* DrHW: Uniquely identifies the hardware interface to a board (or at
@@ -107,27 +110,48 @@ enum nubus_drsw {
107/* Add known DrHW values here */ 110/* Add known DrHW values here */
108enum nubus_drhw { 111enum nubus_drhw {
109 /* NUBUS_CAT_DISPLAY */ 112 /* NUBUS_CAT_DISPLAY */
110 NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */ 113 NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */
111 NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High Res Video card */ 114 NUBUS_DRHW_APPLE_WVC = 0x0006, /* Apple Workstation Video Card */
112 NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */ 115 NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */
113 NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */ 116 NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */
114 NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */ 117 NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */
115 NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */ 118 NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */
119 NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */
120 NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */
121 NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */
122 NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */
116 NUBUS_DRHW_APPLE_VALKYRIE = 0x002e, 123 NUBUS_DRHW_APPLE_VALKYRIE = 0x002e,
117 NUBUS_DRHW_THUNDER24 = 0x02cb, /* SuperMac Thunder/24 */ 124 NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */
125 NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */
126 NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */
127 NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */
128 NUBUS_DRHW_RDIUS_GSC = 0x0153, /* Radius GS/C */
129 NUBUS_DRHW_SMAC_SPEC8 = 0x017B, /* SuperMac Spectrum/8 */
130 NUBUS_DRHW_SMAC_SPEC24 = 0x017C, /* SuperMac Spectrum/24 */
131 NUBUS_DRHW_RASTER_CB364 = 0x026F, /* RasterOps ColorBoard 364 */
132 NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */
133 NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */
134 NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */
135 NUBUS_DRHW_RASTER_24LXI = 0x02A0, /* RasterOps 8/24 XLi */
136 NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */
137 NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */
138 NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */
139 NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */
140 NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */
141 NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */
118 142
119 /* NUBUS_CAT_NETWORK */ 143 /* NUBUS_CAT_NETWORK */
120 NUBUS_DRHW_INTERLAN = 0x0100, 144 NUBUS_DRHW_INTERLAN = 0x0100,
121 NUBUS_DRHW_SMC9194 = 0x0101, 145 NUBUS_DRHW_SMC9194 = 0x0101,
122 NUBUS_DRHW_KINETICS = 0x0106, 146 NUBUS_DRHW_KINETICS = 0x0106,
123 NUBUS_DRHW_CABLETRON = 0x0109, 147 NUBUS_DRHW_CABLETRON = 0x0109,
124 NUBUS_DRHW_ASANTE_LC = 0x010f, 148 NUBUS_DRHW_ASANTE_LC = 0x010f,
125 NUBUS_DRHW_SONIC = 0x0110, 149 NUBUS_DRHW_SONIC = 0x0110,
126 NUBUS_DRHW_SONIC_NB = 0x0118, 150 NUBUS_DRHW_TECHWORKS = 0x0112,
127 NUBUS_DRHW_SONIC_LC = 0x0119, 151 NUBUS_DRHW_APPLE_SONIC_NB = 0x0118,
128 152 NUBUS_DRHW_APPLE_SONIC_LC = 0x0119,
129 /* NUBUS_CAT_COMMUNICATIONS */ 153 NUBUS_DRHW_FOCUS = 0x011c,
130 NUBUS_DRHW_DOVEFAX = 0x0100, 154 NUBUS_DRHW_SONNET = 0x011d,
131}; 155};
132 156
133/* Resource IDs: These are the identifiers for the various weird and 157/* Resource IDs: These are the identifiers for the various weird and
@@ -153,17 +177,17 @@ enum nubus_res_id {
153 177
154/* Category-specific resources. */ 178/* Category-specific resources. */
155enum nubus_board_res_id { 179enum nubus_board_res_id {
156 NUBUS_RESID_BOARDID = 0x0020, 180 NUBUS_RESID_BOARDID = 0x0020,
157 NUBUS_RESID_PRAMINITDATA = 0x0021, 181 NUBUS_RESID_PRAMINITDATA = 0x0021,
158 NUBUS_RESID_PRIMARYINIT = 0x0022, 182 NUBUS_RESID_PRIMARYINIT = 0x0022,
159 NUBUS_RESID_TIMEOUTCONST = 0x0023, 183 NUBUS_RESID_TIMEOUTCONST = 0x0023,
160 NUBUS_RESID_VENDORINFO = 0x0024, 184 NUBUS_RESID_VENDORINFO = 0x0024,
161 NUBUS_RESID_BOARDFLAGS = 0x0025, 185 NUBUS_RESID_BOARDFLAGS = 0x0025,
162 NUBUS_RESID_SECONDINIT = 0x0026, 186 NUBUS_RESID_SECONDINIT = 0x0026,
163 187
164 /* Not sure why Apple put these next two in here */ 188 /* Not sure why Apple put these next two in here */
165 NUBUS_RESID_VIDNAMES = 0x0041, 189 NUBUS_RESID_VIDNAMES = 0x0041,
166 NUBUS_RESID_VIDMODES = 0x007e 190 NUBUS_RESID_VIDMODES = 0x007e
167}; 191};
168 192
169/* Fields within the vendor info directory */ 193/* Fields within the vendor info directory */
@@ -185,13 +209,13 @@ enum nubus_cpu_res_id {
185}; 209};
186 210
187enum nubus_display_res_id { 211enum nubus_display_res_id {
188 NUBUS_RESID_GAMMADIR = 0x0040, 212 NUBUS_RESID_GAMMADIR = 0x0040,
189 NUBUS_RESID_FIRSTMODE = 0x0080, 213 NUBUS_RESID_FIRSTMODE = 0x0080,
190 NUBUS_RESID_SECONDMODE = 0x0081, 214 NUBUS_RESID_SECONDMODE = 0x0081,
191 NUBUS_RESID_THIRDMODE = 0x0082, 215 NUBUS_RESID_THIRDMODE = 0x0082,
192 NUBUS_RESID_FOURTHMODE = 0x0083, 216 NUBUS_RESID_FOURTHMODE = 0x0083,
193 NUBUS_RESID_FIFTHMODE = 0x0084, 217 NUBUS_RESID_FIFTHMODE = 0x0084,
194 NUBUS_RESID_SIXTHMODE = 0x0085 218 NUBUS_RESID_SIXTHMODE = 0x0085
195}; 219};
196 220
197struct nubus_dir 221struct nubus_dir
@@ -214,7 +238,7 @@ struct nubus_board {
214 struct nubus_board* next; 238 struct nubus_board* next;
215 struct nubus_dev* first_dev; 239 struct nubus_dev* first_dev;
216 240
217 /* Only 9-E actually exist, though 0-8 are also theoretically 241 /* Only 9-E actually exist, though 0-8 are also theoretically
218 possible, and 0 is a special case which represents the 242 possible, and 0 is a special case which represents the
219 motherboard and onboard peripherals (Ethernet, video) */ 243 motherboard and onboard peripherals (Ethernet, video) */
220 int slot; 244 int slot;
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9cd0d0eaf52..96326594e55 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -133,7 +133,7 @@
133static inline void SetPageUptodate(struct page *page) 133static inline void SetPageUptodate(struct page *page)
134{ 134{
135 if (!test_and_set_bit(PG_uptodate, &page->flags)) 135 if (!test_and_set_bit(PG_uptodate, &page->flags))
136 page_test_and_clear_dirty(page); 136 page_clear_dirty(page);
137} 137}
138#else 138#else
139#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 139#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
diff --git a/include/linux/parser.h b/include/linux/parser.h
index fa3332861a0..26b2bdfcaf0 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -11,7 +11,7 @@
11/* associates an integer enumerator with a pattern string. */ 11/* associates an integer enumerator with a pattern string. */
12struct match_token { 12struct match_token {
13 int token; 13 int token;
14 char *pattern; 14 const char *pattern;
15}; 15};
16 16
17typedef struct match_token match_table_t[]; 17typedef struct match_token match_table_t[];
@@ -29,5 +29,5 @@ int match_token(char *, match_table_t table, substring_t args[]);
29int match_int(substring_t *, int *result); 29int match_int(substring_t *, int *result);
30int match_octal(substring_t *, int *result); 30int match_octal(substring_t *, int *result);
31int match_hex(substring_t *, int *result); 31int match_hex(substring_t *, int *result);
32void match_strcpy(char *, substring_t *); 32void match_strcpy(char *, const substring_t *);
33char *match_strdup(substring_t *); 33char *match_strdup(const substring_t *);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 481ea0663f1..fbf3766dac1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -96,6 +96,19 @@ enum pci_channel_state {
96 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, 96 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
97}; 97};
98 98
99typedef unsigned int __bitwise pcie_reset_state_t;
100
101enum pcie_reset_state {
102 /* Reset is NOT asserted (Use to deassert reset) */
103 pcie_deassert_reset = (__force pcie_reset_state_t) 1,
104
105 /* Use #PERST to reset PCI-E device */
106 pcie_warm_reset = (__force pcie_reset_state_t) 2,
107
108 /* Use PCI-E Hot Reset to reset device */
109 pcie_hot_reset = (__force pcie_reset_state_t) 3
110};
111
99typedef unsigned short __bitwise pci_bus_flags_t; 112typedef unsigned short __bitwise pci_bus_flags_t;
100enum pci_bus_flags { 113enum pci_bus_flags {
101 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 114 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
@@ -176,10 +189,12 @@ struct pci_dev {
176 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 189 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
177 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 190 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
178#ifdef CONFIG_PCI_MSI 191#ifdef CONFIG_PCI_MSI
179 unsigned int first_msi_irq; 192 struct list_head msi_list;
180#endif 193#endif
181}; 194};
182 195
196extern struct pci_dev *alloc_pci_dev(void);
197
183#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) 198#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
184#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) 199#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
185#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 200#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
@@ -361,8 +376,6 @@ struct pci_driver {
361 struct pci_error_handlers *err_handler; 376 struct pci_error_handlers *err_handler;
362 struct device_driver driver; 377 struct device_driver driver;
363 struct pci_dynids dynids; 378 struct pci_dynids dynids;
364
365 int multithread_probe;
366}; 379};
367 380
368#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 381#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver)
@@ -394,12 +407,6 @@ struct pci_driver {
394 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ 407 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
395 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 408 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
396 409
397/*
398 * pci_module_init is obsolete, this stays here till we fix up all usages of it
399 * in the tree.
400 */
401#define pci_module_init pci_register_driver
402
403/** 410/**
404 * PCI_VDEVICE - macro used to describe a specific pci device in short form 411 * PCI_VDEVICE - macro used to describe a specific pci device in short form
405 * @vend: the vendor name 412 * @vend: the vendor name
@@ -534,6 +541,7 @@ static inline int pci_is_managed(struct pci_dev *pdev)
534 541
535void pci_disable_device(struct pci_dev *dev); 542void pci_disable_device(struct pci_dev *dev);
536void pci_set_master(struct pci_dev *dev); 543void pci_set_master(struct pci_dev *dev);
544int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
537#define HAVE_PCI_SET_MWI 545#define HAVE_PCI_SET_MWI
538int __must_check pci_set_mwi(struct pci_dev *dev); 546int __must_check pci_set_mwi(struct pci_dev *dev);
539void pci_clear_mwi(struct pci_dev *dev); 547void pci_clear_mwi(struct pci_dev *dev);
@@ -732,6 +740,9 @@ static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) {
732static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } 740static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; }
733static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } 741static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; }
734 742
743static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) { return -EIO; }
744static inline void pci_release_regions(struct pci_dev *dev) { }
745
735#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 746#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
736 747
737static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } 748static inline void pci_block_user_cfg_access(struct pci_dev *dev) { }
@@ -840,6 +851,7 @@ void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
840void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 851void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
841void __iomem * const * pcim_iomap_table(struct pci_dev *pdev); 852void __iomem * const * pcim_iomap_table(struct pci_dev *pdev);
842int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 853int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
854void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
843 855
844extern int pci_pci_problems; 856extern int pci_pci_problems;
845#define PCIPCI_FAIL 1 /* No PCI PCI DMA */ 857#define PCIPCI_FAIL 1 /* No PCI PCI DMA */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index a675a05c409..ab4cb6ecd47 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -174,7 +174,7 @@ extern int pci_hp_register (struct hotplug_slot *slot);
174extern int pci_hp_deregister (struct hotplug_slot *slot); 174extern int pci_hp_deregister (struct hotplug_slot *slot);
175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info); 176 struct hotplug_slot_info *info);
177extern struct subsystem pci_hotplug_slots_subsys; 177extern struct kset pci_hotplug_slots_subsys;
178 178
179/* PCI Setting Record (Type 0) */ 179/* PCI Setting Record (Type 0) */
180struct hpp_type0 { 180struct hpp_type0 {
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 600308fdf9c..ae849f0d443 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -368,7 +368,6 @@
368#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 368#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379
369#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a 369#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a
370#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 370#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380
371#define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381
372#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385 371#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385
373#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c 372#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c
374 373
@@ -1214,11 +1213,13 @@
1214#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5 1213#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5
1215#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6 1214#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6
1216#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 1215#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7
1216#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB
1217#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC 1217#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC
1218#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE 1218#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE
1219#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF 1219#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1220#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 1220#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6
1221#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 1221#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7
1222#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446
1222#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448 1223#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448
1223#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450 1224#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1224#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1225#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
@@ -1459,6 +1460,8 @@
1459 1460
1460#define PCI_VENDOR_ID_TOSHIBA_2 0x102f 1461#define PCI_VENDOR_ID_TOSHIBA_2 0x102f
1461#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030 1462#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030
1463#define PCI_DEVICE_ID_TOSHIBA_TC35815_NWU 0x0031
1464#define PCI_DEVICE_ID_TOSHIBA_TC35815_TX4939 0x0032
1462#define PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE 0x0105 1465#define PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE 0x0105
1463#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 1466#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108
1464#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 1467#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
@@ -1923,6 +1926,7 @@
1923#define PCI_DEVICE_ID_TIGON3_5752 0x1600 1926#define PCI_DEVICE_ID_TIGON3_5752 0x1600
1924#define PCI_DEVICE_ID_TIGON3_5752M 0x1601 1927#define PCI_DEVICE_ID_TIGON3_5752M 0x1601
1925#define PCI_DEVICE_ID_NX2_5709 0x1639 1928#define PCI_DEVICE_ID_NX2_5709 0x1639
1929#define PCI_DEVICE_ID_NX2_5709S 0x163a
1926#define PCI_DEVICE_ID_TIGON3_5700 0x1644 1930#define PCI_DEVICE_ID_TIGON3_5700 0x1644
1927#define PCI_DEVICE_ID_TIGON3_5701 0x1645 1931#define PCI_DEVICE_ID_TIGON3_5701 0x1645
1928#define PCI_DEVICE_ID_TIGON3_5702 0x1646 1932#define PCI_DEVICE_ID_TIGON3_5702 0x1646
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 600e3d387ff..b72be2f79e6 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -11,9 +11,16 @@
11 11
12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
13#ifndef PERCPU_ENOUGH_ROOM 13#ifndef PERCPU_ENOUGH_ROOM
14#define PERCPU_ENOUGH_ROOM 32768 14#ifdef CONFIG_MODULES
15#define PERCPU_MODULE_RESERVE 8192
16#else
17#define PERCPU_MODULE_RESERVE 0
15#endif 18#endif
16 19
20#define PERCPU_ENOUGH_ROOM \
21 (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE)
22#endif /* PERCPU_ENOUGH_ROOM */
23
17/* 24/*
18 * Must be an lvalue. Since @var must be a simple identifier, 25 * Must be an lvalue. Since @var must be a simple identifier,
19 * we force a syntax error here if it isn't. 26 * we force a syntax error here if it isn't.
diff --git a/include/linux/phy.h b/include/linux/phy.h
index edd4c88ca7d..2a659789f9c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -55,6 +55,7 @@ typedef enum {
55 PHY_INTERFACE_MODE_TBI, 55 PHY_INTERFACE_MODE_TBI,
56 PHY_INTERFACE_MODE_RMII, 56 PHY_INTERFACE_MODE_RMII,
57 PHY_INTERFACE_MODE_RGMII, 57 PHY_INTERFACE_MODE_RGMII,
58 PHY_INTERFACE_MODE_RGMII_ID,
58 PHY_INTERFACE_MODE_RTBI 59 PHY_INTERFACE_MODE_RTBI
59} phy_interface_t; 60} phy_interface_t;
60 61
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 21db05ac7c0..6e8fa3049e5 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -112,21 +112,25 @@ typedef int __bitwise suspend_state_t;
112 112
113typedef int __bitwise suspend_disk_method_t; 113typedef int __bitwise suspend_disk_method_t;
114 114
115#define PM_DISK_FIRMWARE ((__force suspend_disk_method_t) 1) 115/* invalid must be 0 so struct pm_ops initialisers can leave it out */
116#define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 2) 116#define PM_DISK_INVALID ((__force suspend_disk_method_t) 0)
117#define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 3) 117#define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 1)
118#define PM_DISK_REBOOT ((__force suspend_disk_method_t) 4) 118#define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 2)
119#define PM_DISK_TEST ((__force suspend_disk_method_t) 5) 119#define PM_DISK_REBOOT ((__force suspend_disk_method_t) 3)
120#define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6) 120#define PM_DISK_TEST ((__force suspend_disk_method_t) 4)
121#define PM_DISK_MAX ((__force suspend_disk_method_t) 7) 121#define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 5)
122#define PM_DISK_MAX ((__force suspend_disk_method_t) 6)
122 123
123/** 124/**
124 * struct pm_ops - Callbacks for managing platform dependent suspend states. 125 * struct pm_ops - Callbacks for managing platform dependent suspend states.
125 * @valid: Callback to determine whether the given state can be entered. 126 * @valid: Callback to determine whether the given state can be entered.
126 * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is 127 * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is
127 * always valid and never passed to this call. 128 * always valid and never passed to this call. If not assigned,
128 * If not assigned, all suspend states are advertised as valid 129 * no suspend states are valid.
129 * in /sys/power/state (but can still be rejected by prepare or enter.) 130 * Valid states are advertised in /sys/power/state but can still
131 * be rejected by prepare or enter if the conditions aren't right.
132 * There is a %pm_valid_only_mem function available that can be assigned
133 * to this if you only implement mem sleep.
130 * 134 *
131 * @prepare: Prepare the platform for the given suspend state. Can return a 135 * @prepare: Prepare the platform for the given suspend state. Can return a
132 * negative error code if necessary. 136 * negative error code if necessary.
@@ -137,17 +141,16 @@ typedef int __bitwise suspend_disk_method_t;
137 * @finish: Called when the system has left the given state and all devices 141 * @finish: Called when the system has left the given state and all devices
138 * are resumed. The return value is ignored. 142 * are resumed. The return value is ignored.
139 * 143 *
140 * @pm_disk_mode: Set to the disk method that the user should be able to 144 * @pm_disk_mode: The generic code always allows one of the shutdown methods
141 * configure for suspend-to-disk. Since %PM_DISK_SHUTDOWN, 145 * %PM_DISK_SHUTDOWN, %PM_DISK_REBOOT, %PM_DISK_TEST and
142 * %PM_DISK_REBOOT, %PM_DISK_TEST and %PM_DISK_TESTPROC 146 * %PM_DISK_TESTPROC. If this variable is set, the mode it is set
143 * are always allowed, currently only %PM_DISK_PLATFORM 147 * to is allowed in addition to those modes and is also made default.
144 * makes sense. If the user then choses %PM_DISK_PLATFORM, 148 * When this mode is sent selected, the @prepare call will be called
145 * the @prepare call will be called before suspending to disk 149 * before suspending to disk (if present), the @enter call should be
146 * (if present), the @enter call should be present and will 150 * present and will be called after all state has been saved and the
147 * be called after all state has been saved and the machine 151 * machine is ready to be powered off; the @finish callback is called
148 * is ready to be shut down/suspended/..., and the @finish 152 * after state has been restored. All these calls are called with
149 * callback is called after state has been restored. All 153 * %PM_SUSPEND_DISK as the state.
150 * these calls are called with %PM_SUSPEND_DISK as the state.
151 */ 154 */
152struct pm_ops { 155struct pm_ops {
153 int (*valid)(suspend_state_t state); 156 int (*valid)(suspend_state_t state);
@@ -165,6 +168,25 @@ extern void pm_set_ops(struct pm_ops *pm_ops);
165extern struct pm_ops *pm_ops; 168extern struct pm_ops *pm_ops;
166extern int pm_suspend(suspend_state_t state); 169extern int pm_suspend(suspend_state_t state);
167 170
171extern int pm_valid_only_mem(suspend_state_t state);
172
173/**
174 * arch_suspend_disable_irqs - disable IRQs for suspend
175 *
176 * Disables IRQs (in the default case). This is a weak symbol in the common
177 * code and thus allows architectures to override it if more needs to be
178 * done. Not called for suspend to disk.
179 */
180extern void arch_suspend_disable_irqs(void);
181
182/**
183 * arch_suspend_enable_irqs - enable IRQs after suspend
184 *
185 * Enables IRQs (in the default case). This is a weak symbol in the common
186 * code and thus allows architectures to override it if more needs to be
187 * done. Not called for suspend to disk.
188 */
189extern void arch_suspend_enable_irqs(void);
168 190
169/* 191/*
170 * Device power management 192 * Device power management
@@ -273,6 +295,20 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
273 __suspend_report_result(__FUNCTION__, fn, ret); \ 295 __suspend_report_result(__FUNCTION__, fn, ret); \
274 } while (0) 296 } while (0)
275 297
298/*
299 * Platform hook to activate device wakeup capability, if that's not already
300 * handled by enable_irq_wake() etc.
301 * Returns zero on success, else negative errno
302 */
303extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
304
305static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
306{
307 if (platform_enable_wakeup)
308 return (*platform_enable_wakeup)(dev, is_on);
309 return 0;
310}
311
276#else /* !CONFIG_PM */ 312#else /* !CONFIG_PM */
277 313
278static inline int device_suspend(pm_message_t state) 314static inline int device_suspend(pm_message_t state)
@@ -294,6 +330,11 @@ static inline void dpm_runtime_resume(struct device * dev)
294 330
295#define suspend_report_result(fn, ret) do { } while (0) 331#define suspend_report_result(fn, ret) do { } while (0)
296 332
333static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
334{
335 return 0;
336}
337
297#endif 338#endif
298 339
299/* changes to device_may_wakeup take effect on the next pm state change. 340/* changes to device_may_wakeup take effect on the next pm state change.
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 783177387ac..b0952e532ed 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -168,24 +168,16 @@ extern int pmu_get_model(void);
168 168
169struct pmu_sleep_notifier 169struct pmu_sleep_notifier
170{ 170{
171 int (*notifier_call)(struct pmu_sleep_notifier *self, int when); 171 void (*notifier_call)(struct pmu_sleep_notifier *self, int when);
172 int priority; 172 int priority;
173 struct list_head list; 173 struct list_head list;
174}; 174};
175 175
176/* Code values for calling sleep/wakeup handlers 176/* Code values for calling sleep/wakeup handlers
177 *
178 * Note: If a sleep request got cancelled, all drivers will get
179 * the PBOOK_SLEEP_REJECT, even those who didn't get the PBOOK_SLEEP_REQUEST.
180 */ 177 */
181#define PBOOK_SLEEP_REQUEST 1 178#define PBOOK_SLEEP_REQUEST 1
182#define PBOOK_SLEEP_NOW 2 179#define PBOOK_SLEEP_NOW 2
183#define PBOOK_SLEEP_REJECT 3 180#define PBOOK_WAKE 3
184#define PBOOK_WAKE 4
185
186/* Result codes returned by the notifiers */
187#define PBOOK_SLEEP_OK 0
188#define PBOOK_SLEEP_REFUSE -1
189 181
190/* priority levels in notifiers */ 182/* priority levels in notifiers */
191#define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */ 183#define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 3e628f990fd..89580b76495 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -26,9 +26,6 @@
26/********** arch/$ARCH/mm/init.c **********/ 26/********** arch/$ARCH/mm/init.c **********/
27#define POISON_FREE_INITMEM 0xcc 27#define POISON_FREE_INITMEM 0xcc
28 28
29/********** arch/x86_64/mm/init.c **********/
30#define POISON_FREE_INITDATA 0xba
31
32/********** arch/ia64/hp/common/sba_iommu.c **********/ 29/********** arch/ia64/hp/common/sba_iommu.c **********/
33/* 30/*
34 * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a 31 * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 4a629ea70cc..1fae30af91f 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
574#define rtattr_parse_nested(tb, max, rta) \ 574#define rtattr_parse_nested(tb, max, rta) \
575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) 575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
576 576
577struct rtnetlink_link
578{
579 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
580 int (*dumpit)(struct sk_buff *, struct netlink_callback *cb);
581};
582
583extern struct rtnetlink_link * rtnetlink_links[NPROTO];
584extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 577extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
585extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 578extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
586extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 579extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
@@ -605,7 +598,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
605 598
606#define RTA_PUT_NOHDR(skb, attrlen, data) \ 599#define RTA_PUT_NOHDR(skb, attrlen, data) \
607({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ 600({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
608 memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ 601 memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \
609 RTA_ALIGN(attrlen) - attrlen); }) 602 RTA_ALIGN(attrlen) - attrlen); })
610 603
611#define RTA_PUT_U8(skb, attrtype, value) \ 604#define RTA_PUT_U8(skb, attrtype, value) \
@@ -637,12 +630,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
637 RTA_PUT(skb, attrtype, 0, NULL); 630 RTA_PUT(skb, attrtype, 0, NULL);
638 631
639#define RTA_NEST(skb, type) \ 632#define RTA_NEST(skb, type) \
640({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ 633({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \
641 RTA_PUT(skb, type, 0, NULL); \ 634 RTA_PUT(skb, type, 0, NULL); \
642 __start; }) 635 __start; })
643 636
644#define RTA_NEST_END(skb, start) \ 637#define RTA_NEST_END(skb, start) \
645({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ 638({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
646 (skb)->len; }) 639 (skb)->len; })
647 640
648#define RTA_NEST_CANCEL(skb, start) \ 641#define RTA_NEST_CANCEL(skb, start) \
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
new file mode 100644
index 00000000000..f7b826b565c
--- /dev/null
+++ b/include/linux/rxrpc.h
@@ -0,0 +1,62 @@
1/* AF_RXRPC parameters
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_H
13#define _LINUX_RXRPC_H
14
15#include <linux/in.h>
16#include <linux/in6.h>
17
18/*
19 * RxRPC socket address
20 */
21struct sockaddr_rxrpc {
22 sa_family_t srx_family; /* address family */
23 u16 srx_service; /* service desired */
24 u16 transport_type; /* type of transport socket (SOCK_DGRAM) */
25 u16 transport_len; /* length of transport address */
26 union {
27 sa_family_t family; /* transport address family */
28 struct sockaddr_in sin; /* IPv4 transport address */
29 struct sockaddr_in6 sin6; /* IPv6 transport address */
30 } transport;
31};
32
33/*
34 * RxRPC socket options
35 */
36#define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */
37#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */
38#define RXRPC_EXCLUSIVE_CONNECTION 3 /* [clnt] use exclusive RxRPC connection */
39#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */
40
41/*
42 * RxRPC control messages
43 * - terminal messages mean that a user call ID tag can be recycled
44 */
45#define RXRPC_USER_CALL_ID 1 /* user call ID specifier */
46#define RXRPC_ABORT 2 /* abort request / notification [terminal] */
47#define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */
48#define RXRPC_NET_ERROR 5 /* network error received [terminal] */
49#define RXRPC_BUSY 6 /* server busy received [terminal] */
50#define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */
51#define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */
52#define RXRPC_ACCEPT 9 /* [Server] accept request */
53
54/*
55 * RxRPC security levels
56 */
57#define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */
58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
60
61
62#endif /* _LINUX_RXRPC_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 49fe2997a01..a1707583de4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -196,13 +196,13 @@ extern void init_idle(struct task_struct *idle, int cpu);
196extern cpumask_t nohz_cpu_mask; 196extern cpumask_t nohz_cpu_mask;
197 197
198/* 198/*
199 * Only dump TASK_* tasks. (-1 for all tasks) 199 * Only dump TASK_* tasks. (0 for all tasks)
200 */ 200 */
201extern void show_state_filter(unsigned long state_filter); 201extern void show_state_filter(unsigned long state_filter);
202 202
203static inline void show_state(void) 203static inline void show_state(void)
204{ 204{
205 show_state_filter(-1); 205 show_state_filter(0);
206} 206}
207 207
208extern void show_regs(struct pt_regs *); 208extern void show_regs(struct pt_regs *);
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d4f86560bff..d70df61a029 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -63,6 +63,15 @@ typedef struct sctphdr {
63 __be32 checksum; 63 __be32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__
67#include <linux/skbuff.h>
68
69static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
70{
71 return (struct sctphdr *)skb_transport_header(skb);
72}
73#endif
74
66/* Section 3.2. Chunk Field Descriptions. */ 75/* Section 3.2. Chunk Field Descriptions. */
67typedef struct sctp_chunkhdr { 76typedef struct sctp_chunkhdr {
68 __u8 type; 77 __u8 type;
diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h
deleted file mode 100644
index cdfa77fcb06..00000000000
--- a/include/linux/sdla_fr.h
+++ /dev/null
@@ -1,638 +0,0 @@
1/*****************************************************************************
2* sdla_fr.h Sangoma frame relay firmware API definitions.
3*
4* Author: Gideon Hack
5* Nenad Corbic <ncorbic@sangoma.com>
6*
7* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Oct 04, 1999 Gideon Hack Updated API structures
15* Jun 02, 1999 Gideon Hack Modifications for S514 support
16* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
17* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
18* 0x05 and 0x06 respectively.
19* Dec 23, 1996 Gene Kozin v2.0
20* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).
21* Sep 26, 1995 Gene Kozin Initial version.
22*****************************************************************************/
23#ifndef _SDLA_FR_H
24#define _SDLA_FR_H
25
26/*----------------------------------------------------------------------------
27 * Notes:
28 * ------
29 * 1. All structures defined in this file are byte-alined.
30 *
31 * Compiler Platform
32 * -------- --------
33 * GNU C Linux
34 */
35
36#ifndef PACKED
37# define PACKED __attribute__((packed))
38#endif /* PACKED */
39
40/* Adapter memory layout */
41#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
42#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */
43#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */
44#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */
45#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */
46#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */
47#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */
48#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */
49#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */
50
51/* Important constants */
52#define FR502_MAX_DATA 4096 /* maximum data buffer length */
53#define FR508_MAX_DATA 4080 /* maximum data buffer length */
54#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
55(for configuration purposes) */
56#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
57
58#define HIGHEST_VALID_DLCI 991
59
60/****** Data Structures *****************************************************/
61
62/*----------------------------------------------------------------------------
63 * Frame relay command block.
64 */
65typedef struct fr_cmd
66{
67 unsigned char command PACKED; /* command code */
68 unsigned short length PACKED; /* length of data buffer */
69 unsigned char result PACKED; /* return code */
70 unsigned short dlci PACKED; /* DLCI number */
71 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
72 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
73 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
74 unsigned char rsrv[2] PACKED; /* reserved for future use */
75} fr_cmd_t;
76
77/* 'command' field defines */
78#define FR_WRITE 0x01
79#define FR_READ 0x02
80#define FR_ISSUE_IS_FRAME 0x03
81#define FR_SET_CONFIG 0x10
82#define FR_READ_CONFIG 0x11
83#define FR_COMM_DISABLE 0x12
84#define FR_COMM_ENABLE 0x13
85#define FR_READ_STATUS 0x14
86#define FR_READ_STATISTICS 0x15
87#define FR_FLUSH_STATISTICS 0x16
88#define FR_LIST_ACTIVE_DLCI 0x17
89#define FR_FLUSH_DATA_BUFFERS 0x18
90#define FR_READ_ADD_DLC_STATS 0x19
91#define FR_ADD_DLCI 0x20
92#define FR_DELETE_DLCI 0x21
93#define FR_ACTIVATE_DLCI 0x22
94#define FR_DEACTIVATE_DLCI 0x22
95#define FR_READ_MODEM_STATUS 0x30
96#define FR_SET_MODEM_STATUS 0x31
97#define FR_READ_ERROR_STATS 0x32
98#define FR_FLUSH_ERROR_STATS 0x33
99#define FR_READ_DLCI_IB_MAPPING 0x34
100#define FR_READ_CODE_VERSION 0x40
101#define FR_SET_INTR_MODE 0x50
102#define FR_READ_INTR_MODE 0x51
103#define FR_SET_TRACE_CONFIG 0x60
104#define FR_FT1_STATUS_CTRL 0x80
105#define FR_SET_FT1_MODE 0x81
106
107/* Special UDP drivers management commands */
108#define FPIPE_ENABLE_TRACING 0x41
109#define FPIPE_DISABLE_TRACING 0x42
110#define FPIPE_GET_TRACE_INFO 0x43
111#define FPIPE_FT1_READ_STATUS 0x44
112#define FPIPE_DRIVER_STAT_IFSEND 0x45
113#define FPIPE_DRIVER_STAT_INTR 0x46
114#define FPIPE_DRIVER_STAT_GEN 0x47
115#define FPIPE_FLUSH_DRIVER_STATS 0x48
116#define FPIPE_ROUTER_UP_TIME 0x49
117
118/* 'result' field defines */
119#define FRRES_OK 0x00 /* command executed successfully */
120#define FRRES_DISABLED 0x01 /* communications not enabled */
121#define FRRES_INOPERATIVE 0x02 /* channel inoperative */
122#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */
123#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */
124#define FRRES_TOO_LONG 0x05
125#define FRRES_TOO_MANY 0x06
126#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */
127#define FRRES_BUFFER_OVERFLOW 0x08
128#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */
129#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */
130#define FRRES_CHANNEL_UP 0x12 /* channel became operative */
131#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */
132#define FRRES_DLCI_MISMATCH 0x14
133#define FRRES_INVALID_CMD 0x1F /* invalid command */
134
135/* 'attr' field defines */
136#define FRATTR_
137
138/*----------------------------------------------------------------------------
139 * Frame relay mailbox.
140 * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR.
141 * For S502 it is also located at offset FR502_RXMB_OFFS into
142 * FR502_RX_VECTOR.
143 */
144typedef struct fr_mbox
145{
146 unsigned char opflag PACKED; /* 00h: execution flag */
147 fr_cmd_t cmd PACKED; /* 01h: command block */
148 unsigned char data[1] PACKED; /* 10h: variable length data buffer */
149} fr_mbox_t;
150
151/*----------------------------------------------------------------------------
152 * S502 frame relay status flags.
153 * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
154 */
155typedef struct fr502_flags
156{
157 unsigned char rsrv1[1] PACKED; /* 00h: */
158 unsigned char tx_ready PACKED; /* 01h: Tx buffer available */
159 unsigned char rx_ready PACKED; /* 02h: Rx frame available */
160 unsigned char event PACKED; /* 03h: asynchronous event */
161 unsigned char mstatus PACKED; /* 04h: modem status */
162 unsigned char rsrv2[8] PACKED; /* 05h: */
163 unsigned char iflag PACKED; /* 0Dh: interrupt flag */
164 unsigned char imask PACKED; /* 0Eh: interrupt mask */
165} fr502_flags_t;
166
167/*----------------------------------------------------------------------------
168 * S508 frame relay status flags.
169 * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
170 */
171typedef struct fr508_flags
172{
173 unsigned char rsrv1[3] PACKED; /* 00h: reserved */
174 unsigned char event PACKED; /* 03h: asynchronous event */
175 unsigned char mstatus PACKED; /* 04h: modem status */
176 unsigned char rsrv2[11] PACKED; /* 05h: reserved */
177 unsigned char iflag PACKED; /* 10h: interrupt flag */
178 unsigned char imask PACKED; /* 11h: interrupt mask */
179 unsigned long tse_offs PACKED; /* 12h: Tx status element */
180 unsigned short dlci PACKED; /* 16h: DLCI NUMBER */
181} fr508_flags_t;
182
183/* 'event' field defines */
184#define FR_EVENT_STATUS 0x01 /* channel status change */
185#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
186#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
187#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
188
189/* 'mstatus' field defines */
190#define FR_MDM_DCD 0x08 /* mdm_status: DCD */
191#define FR_MDM_CTS 0x20 /* mdm_status: CTS */
192
193/* 'iflag' & 'imask' fields defines */
194#define FR_INTR_RXRDY 0x01 /* Rx ready */
195#define FR_INTR_TXRDY 0x02 /* Tx ready */
196#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
197#define FR_INTR_READY 0x08 /* interface command completed */
198#define FR_INTR_DLC 0x10 /* DLC status change */
199#define FR_INTR_TIMER 0x20 /* millisecond timer */
200#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
201
202
203/*----------------------------------------------------------------------------
204 * Receive Buffer Configuration Info. S508 only!
205 * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
206 */
207typedef struct fr_buf_info
208{
209 unsigned short rse_num PACKED; /* 00h: number of status elements */
210 unsigned long rse_base PACKED; /* 02h: receive status array base */
211 unsigned long rse_next PACKED; /* 06h: next status element */
212 unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */
213 unsigned short reserved PACKED; /* 0Eh: */
214 unsigned long buf_top PACKED; /* 10h: rotational buffer top */
215} fr_buf_info_t;
216
217/*----------------------------------------------------------------------------
218 * Buffer Status Element. S508 only!
219 * Array of structures of this type is located at offset defined by the
220 * 'rse_base' field of the frBufInfo_t structure into absolute adapter
221 * memory address space.
222 */
223typedef struct fr_rx_buf_ctl
224{
225 unsigned char flag PACKED; /* 00h: ready flag */
226 unsigned short length PACKED; /* 01h: frame length */
227 unsigned short dlci PACKED; /* 03h: DLCI */
228 unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */
229 unsigned short tmstamp PACKED; /* 06h: time stamp */
230 unsigned short rsrv[2] PACKED; /* 08h: */
231 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
232} fr_rx_buf_ctl_t;
233
234typedef struct fr_tx_buf_ctl
235{
236 unsigned char flag PACKED; /* 00h: ready flag */
237 unsigned short rsrv0[2] PACKED; /* 01h: */
238 unsigned short length PACKED; /* 05h: frame length */
239 unsigned short dlci PACKED; /* 07h: DLCI */
240 unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
241 unsigned short rsrv1 PACKED; /* 0Ah: */
242 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
243} fr_tx_buf_ctl_t;
244
245/*----------------------------------------------------------------------------
246 * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
247 */
248typedef struct fr_conf
249{
250 unsigned short station PACKED; /* 00h: CPE/Node */
251 unsigned short options PACKED; /* 02h: configuration options */
252 unsigned short kbps PACKED; /* 04h: baud rate in kbps */
253 unsigned short port PACKED; /* 06h: RS-232/V.35 */
254 unsigned short mtu PACKED; /* 08h: max. transmit length */
255 unsigned short t391 PACKED; /* 0Ah: */
256 unsigned short t392 PACKED; /* 0Ch: */
257 unsigned short n391 PACKED; /* 0Eh: */
258 unsigned short n392 PACKED; /* 10h: */
259 unsigned short n393 PACKED; /* 12h: */
260 unsigned short cir_fwd PACKED; /* 14h: */
261 unsigned short bc_fwd PACKED; /* 16h: */
262 unsigned short be_fwd PACKED; /* 18h: */
263 unsigned short cir_bwd PACKED; /* 1Ah: */
264 unsigned short bc_bwd PACKED; /* 1Ch: */
265 unsigned short be_bwd PACKED; /* 1Eh: */
266 unsigned short dlci[0] PACKED; /* 20h: */
267} fr_conf_t;
268
269/* 'station_type' defines */
270#define FRCFG_STATION_CPE 0
271#define FRCFG_STATION_NODE 1
272
273/* 'conf_flags' defines */
274#define FRCFG_IGNORE_TX_CIR 0x0001
275#define FRCFG_IGNORE_RX_CIR 0x0002
276#define FRCFG_DONT_RETRANSMIT 0x0004
277#define FRCFG_IGNORE_CBS 0x0008
278#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */
279#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */
280#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */
281
282/* 'baud_rate' defines */
283#define FRCFG_BAUD_1200 12
284#define FRCFG_BAUD_2400 24
285#define FRCFG_BAUD_4800 48
286#define FRCFG_BAUD_9600 96
287#define FRCFG_BAUD_19200 19
288#define FRCFG_BAUD_38400 38
289#define FRCFG_BAUD_56000 56
290#define FRCFG_BAUD_64000 64
291#define FRCFG_BAUD_128000 128
292
293/* 'port_mode' defines */
294#define FRCFG_MODE_EXT_CLK 0x0000
295#define FRCFG_MODE_INT_CLK 0x0001
296#define FRCFG_MODE_V35 0x0000 /* S508 only */
297#define FRCFG_MODE_RS232 0x0002 /* S508 only */
298
299/* defines for line tracing */
300
301/* the line trace status element presented by the frame relay code */
302typedef struct {
303 unsigned char flag PACKED; /* ready flag */
304 unsigned short length PACKED; /* trace length */
305 unsigned char rsrv0[2] PACKED; /* reserved */
306 unsigned char attr PACKED; /* trace attributes */
307 unsigned short tmstamp PACKED; /* time stamp */
308 unsigned char rsrv1[4] PACKED; /* reserved */
309 unsigned long offset PACKED; /* buffer absolute address */
310} fr_trc_el_t;
311
312typedef struct {
313 unsigned char status PACKED; /* status flag */
314 unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
315 /* data passed */
316 unsigned short length PACKED; /* frame length */
317 unsigned short tmstamp PACKED; /* time stamp */
318} fpipemon_trc_hdr_t;
319
320typedef struct {
321 fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
322 unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
323} fpipemon_trc_t;
324
325/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
326/* for returning the number of frames being passed to fpipemon */
327#define TRC_OUTGOING_FRM 0x01
328#define TRC_ABORT_ERROR 0x10
329#define TRC_CRC_ERROR 0x20
330#define TRC_OVERRUN_ERROR 0x40
331#define MORE_TRC_DATA 0x80
332
333#define MAX_FRMS_TRACED 0x07
334
335#define NO_TRC_ELEMENTS_OFF 0x9000
336#define BASE_TRC_ELEMENTS_OFF 0x9002
337#define TRC_ACTIVE 0x01
338#define FLUSH_TRC_BUFFERS 0x02
339#define FLUSH_TRC_STATISTICS 0x04
340#define TRC_SIGNALLING_FRMS 0x10
341#define TRC_INFO_FRMS 0x20
342#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
343#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
344
345/*----------------------------------------------------------------------------
346 * Channel configuration.
347 * This structure is passed to the FR_SET_CONFIG command when dlci != 0.
348 */
349typedef struct fr_dlc_conf
350{
351 unsigned short conf_flags PACKED; /* 00h: configuration bits */
352 unsigned short cir_fwd PACKED; /* 02h: */
353 unsigned short bc_fwd PACKED; /* 04h: */
354 unsigned short be_fwd PACKED; /* 06h: */
355 unsigned short cir_bwd PACKED; /* 08h: */
356 unsigned short bc_bwd PACKED; /* 0Ah: */
357 unsigned short be_bwd PACKED; /* 0Ch: */
358} fr_dlc_conf_t;
359
360/*----------------------------------------------------------------------------
361 * S502 interrupt mode control block.
362 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
363 * FR_READ_INTR_FLAGS commands.
364 */
365typedef struct fr502_intr_ctl
366{
367 unsigned char mode PACKED; /* 00h: interrupt enable flags */
368 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
369} fr502_intr_ctl_t;
370
371/*----------------------------------------------------------------------------
372 * S508 interrupt mode control block.
373 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
374 * FR_READ_INTR_FLAGS commands.
375 */
376typedef struct fr508_intr_ctl
377{
378 unsigned char mode PACKED; /* 00h: interrupt enable flags */
379 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
380 unsigned char irq PACKED; /* 03h: IRQ level to activate */
381 unsigned char flags PACKED; /* 04h: ?? */
382 unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */
383} fr508_intr_ctl_t;
384
385/*----------------------------------------------------------------------------
386 * Channel status.
387 * This structure is returned by the FR_READ_STATUS command.
388 */
389typedef struct fr_dlc_Status
390{
391 unsigned char status PACKED; /* 00h: link/DLCI status */
392 struct
393 {
394 unsigned short dlci PACKED; /* 01h: DLCI number */
395 unsigned char status PACKED; /* 03h: DLCI status */
396 } circuit[1] PACKED;
397} fr_dlc_status_t;
398
399/* 'status' defines */
400#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
401#define FR_LINK_OPER 0x01
402#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
403#define FR_DLCI_ACTIVE 0x02
404#define FR_DLCI_WAITING 0x04
405#define FR_DLCI_NEW 0x08
406#define FR_DLCI_REPORT 0x40
407
408/*----------------------------------------------------------------------------
409 * Global Statistics Block.
410 * This structure is returned by the FR_READ_STATISTICS command when
411 * dcli == 0.
412 */
413typedef struct fr_link_stat
414{
415 unsigned short rx_too_long PACKED; /* 00h: */
416 unsigned short rx_dropped PACKED; /* 02h: */
417 unsigned short rx_dropped2 PACKED; /* 04h: */
418 unsigned short rx_bad_dlci PACKED; /* 06h: */
419 unsigned short rx_bad_format PACKED; /* 08h: */
420 unsigned short retransmitted PACKED; /* 0Ah: */
421 unsigned short cpe_tx_FSE PACKED; /* 0Ch: */
422 unsigned short cpe_tx_LIV PACKED; /* 0Eh: */
423 unsigned short cpe_rx_FSR PACKED; /* 10h: */
424 unsigned short cpe_rx_LIV PACKED; /* 12h: */
425 unsigned short node_rx_FSE PACKED; /* 14h: */
426 unsigned short node_rx_LIV PACKED; /* 16h: */
427 unsigned short node_tx_FSR PACKED; /* 18h: */
428 unsigned short node_tx_LIV PACKED; /* 1Ah: */
429 unsigned short rx_ISF_err PACKED; /* 1Ch: */
430 unsigned short rx_unsolicited PACKED; /* 1Eh: */
431 unsigned short rx_SSN_err PACKED; /* 20h: */
432 unsigned short rx_RSN_err PACKED; /* 22h: */
433 unsigned short T391_timeouts PACKED; /* 24h: */
434 unsigned short T392_timeouts PACKED; /* 26h: */
435 unsigned short N392_reached PACKED; /* 28h: */
436 unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */
437 unsigned short current_SSN PACKED; /* 2Ch: */
438 unsigned short current_RSN PACKED; /* 2Eh: */
439 unsigned short curreny_T391 PACKED; /* 30h: */
440 unsigned short current_T392 PACKED; /* 32h: */
441 unsigned short current_N392 PACKED; /* 34h: */
442 unsigned short current_N393 PACKED; /* 36h: */
443} fr_link_stat_t;
444
445/*----------------------------------------------------------------------------
446 * DLCI statistics.
447 * This structure is returned by the FR_READ_STATISTICS command when
448 * dlci != 0.
449 */
450typedef struct fr_dlci_stat
451{
452 unsigned long tx_frames PACKED; /* 00h: */
453 unsigned long tx_bytes PACKED; /* 04h: */
454 unsigned long rx_frames PACKED; /* 08h: */
455 unsigned long rx_bytes PACKED; /* 0Ch: */
456 unsigned long rx_dropped PACKED; /* 10h: */
457 unsigned long rx_inactive PACKED; /* 14h: */
458 unsigned long rx_exceed_CIR PACKED; /* 18h: */
459 unsigned long rx_DE_set PACKED; /* 1Ch: */
460 unsigned long tx_throughput PACKED; /* 20h: */
461 unsigned long tx_calc_timer PACKED; /* 24h: */
462 unsigned long rx_throughput PACKED; /* 28h: */
463 unsigned long rx_calc_timer PACKED; /* 2Ch: */
464} fr_dlci_stat_t;
465
466/*----------------------------------------------------------------------------
467 * Communications error statistics.
468 * This structure is returned by the FR_READ_ERROR_STATS command.
469 */
470typedef struct fr_comm_stat
471{
472 unsigned char rx_overruns PACKED; /* 00h: */
473 unsigned char rx_bad_crc PACKED; /* 01h: */
474 unsigned char rx_aborts PACKED; /* 02h: */
475 unsigned char rx_too_long PACKED; /* 03h: */
476 unsigned char tx_aborts PACKED; /* 04h: */
477 unsigned char tx_underruns PACKED; /* 05h: */
478 unsigned char tx_missed_undr PACKED; /* 06h: */
479 unsigned char dcd_dropped PACKED; /* 07h: */
480 unsigned char cts_dropped PACKED; /* 08h: */
481} fr_comm_stat_t;
482
483/*----------------------------------------------------------------------------
484 * Defines for the FR_ISSUE_IS_FRAME command.
485 */
486#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
487#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
488
489/*----------------------------------------------------------------------------
490 * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
491 */
492
493typedef struct arphdr_fr
494 {
495 unsigned short ar_hrd PACKED; /* format of hardware addr */
496 unsigned short ar_pro PACKED; /* format of protocol addr */
497 unsigned char ar_hln PACKED; /* length of hardware addr */
498 unsigned char ar_pln PACKED; /* length of protocol addr */
499 unsigned short ar_op PACKED; /* ARP opcode */
500 unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
501 unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */
502 unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
503 unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */
504 } arphdr_fr_t;
505
506/*----------------------------------------------------------------------------
507 * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
508 */
509typedef struct arphdr_1490
510 {
511 unsigned char control PACKED; /* UI, etc... */
512 unsigned char pad PACKED; /* Pad */
513 unsigned char NLPID PACKED; /* SNAP */
514 unsigned char OUI[3] PACKED; /* Ethertype, etc... */
515 unsigned short PID PACKED; /* ARP, IP, etc... */
516 } arphdr_1490_t;
517
518/* UDP/IP packet (for UDP management) layout */
519
520/* The embedded control block for UDP mgmt
521 This is essentially a mailbox structure, without the large data field */
522
523typedef struct {
524 unsigned char opp_flag PACKED; /* the opp flag */
525 unsigned char command PACKED; /* command code */
526 unsigned short length PACKED; /* length of data buffer */
527 unsigned char result PACKED; /* return code */
528 unsigned short dlci PACKED; /* DLCI number */
529 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
530 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
531 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
532 unsigned char rsrv[2] PACKED; /* reserved for future use */
533} cblock_t;
534
535
536/* UDP management packet layout (data area of ip packet) */
537
538typedef struct {
539 unsigned char control PACKED;
540 unsigned char NLPID PACKED;
541} fr_encap_hdr_t;
542
543typedef struct {
544// fr_encap_hdr_t fr_encap_hdr PACKED;
545 ip_pkt_t ip_pkt PACKED;
546 udp_pkt_t udp_pkt PACKED;
547 wp_mgmt_t wp_mgmt PACKED;
548 cblock_t cblock PACKED;
549 unsigned char data[4080] PACKED;
550} fr_udp_pkt_t;
551
552
553/* valid ip_protocol for UDP management */
554#define UDPMGMT_UDP_PROTOCOL 0x11
555
556#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
557#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
558
559/* values for request/reply byte */
560#define UDPMGMT_REQUEST 0x01
561#define UDPMGMT_REPLY 0x02
562#define UDP_OFFSET 12
563
564typedef struct {
565 unsigned long if_send_entry;
566 unsigned long if_send_skb_null;
567 unsigned long if_send_broadcast;
568 unsigned long if_send_multicast;
569 unsigned long if_send_critical_ISR;
570 unsigned long if_send_critical_non_ISR;
571 unsigned long if_send_busy;
572 unsigned long if_send_busy_timeout;
573 unsigned long if_send_DRVSTATS_request;
574 unsigned long if_send_FPIPE_request;
575 unsigned long if_send_wan_disconnected;
576 unsigned long if_send_dlci_disconnected;
577 unsigned long if_send_no_bfrs;
578 unsigned long if_send_adptr_bfrs_full;
579 unsigned long if_send_bfrs_passed_to_adptr;
580 unsigned long if_send_consec_send_fail;
581} drvstats_if_send_t;
582
583typedef struct {
584 unsigned long rx_intr_no_socket;
585 unsigned long rx_intr_dev_not_started;
586 unsigned long rx_intr_DRVSTATS_request;
587 unsigned long rx_intr_FPIPE_request;
588 unsigned long rx_intr_bfr_not_passed_to_stack;
589 unsigned long rx_intr_bfr_passed_to_stack;
590 } drvstats_rx_intr_t;
591
592typedef struct {
593 unsigned long UDP_FPIPE_mgmt_kmalloc_err;
594 unsigned long UDP_FPIPE_mgmt_direction_err;
595 unsigned long UDP_FPIPE_mgmt_adptr_type_err;
596 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
597 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
598 unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
599 unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
600 unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
601 unsigned long UDP_FPIPE_mgmt_passed_to_stack;
602 unsigned long UDP_FPIPE_mgmt_no_socket;
603 unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
604 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
605 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
606 unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
607 unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
608 unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
609 unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
610 unsigned long UDP_DRVSTATS_mgmt_no_socket;
611} drvstats_gen_t;
612
613typedef struct {
614 unsigned char attr PACKED;
615 unsigned short time_stamp PACKED;
616 unsigned char reserved[13] PACKED;
617} api_rx_hdr_t;
618
619typedef struct {
620 api_rx_hdr_t api_rx_hdr PACKED;
621 void * data PACKED;
622} api_rx_element_t;
623
624typedef struct {
625 unsigned char attr PACKED;
626 unsigned char reserved[15] PACKED;
627} api_tx_hdr_t;
628
629typedef struct {
630 api_tx_hdr_t api_tx_hdr PACKED;
631 void * data PACKED;
632} api_tx_element_t;
633
634#ifdef _MSC_
635# pragma pack()
636#endif
637#endif /* _SDLA_FR_H */
638
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 52c9eb9b6df..26e4925bc35 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -61,10 +61,10 @@ static inline void write_seqlock(seqlock_t *sl)
61{ 61{
62 spin_lock(&sl->lock); 62 spin_lock(&sl->lock);
63 ++sl->sequence; 63 ++sl->sequence;
64 smp_wmb(); 64 smp_wmb();
65} 65}
66 66
67static inline void write_sequnlock(seqlock_t *sl) 67static inline void write_sequnlock(seqlock_t *sl)
68{ 68{
69 smp_wmb(); 69 smp_wmb();
70 sl->sequence++; 70 sl->sequence++;
@@ -77,7 +77,7 @@ static inline int write_tryseqlock(seqlock_t *sl)
77 77
78 if (ret) { 78 if (ret) {
79 ++sl->sequence; 79 ++sl->sequence;
80 smp_wmb(); 80 smp_wmb();
81 } 81 }
82 return ret; 82 return ret;
83} 83}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5992f65b418..e7367c74e1b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -27,20 +27,24 @@
27#include <net/checksum.h> 27#include <net/checksum.h>
28#include <linux/rcupdate.h> 28#include <linux/rcupdate.h>
29#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
30#include <linux/hrtimer.h>
30 31
31#define HAVE_ALLOC_SKB /* For the drivers to know */ 32#define HAVE_ALLOC_SKB /* For the drivers to know */
32#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
33 34
35/* Don't change this without changing skb_csum_unnecessary! */
34#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
35#define CHECKSUM_PARTIAL 1 37#define CHECKSUM_UNNECESSARY 1
36#define CHECKSUM_UNNECESSARY 2 38#define CHECKSUM_COMPLETE 2
37#define CHECKSUM_COMPLETE 3 39#define CHECKSUM_PARTIAL 3
38 40
39#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 41#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
40 ~(SMP_CACHE_BYTES - 1)) 42 ~(SMP_CACHE_BYTES - 1))
41#define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \ 43#define SKB_WITH_OVERHEAD(X) \
42 sizeof(struct skb_shared_info)) & \ 44 (((X) - sizeof(struct skb_shared_info)) & \
43 ~(SMP_CACHE_BYTES - 1)) 45 ~(SMP_CACHE_BYTES - 1))
46#define SKB_MAX_ORDER(X, ORDER) \
47 SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
44#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) 48#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0))
45#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) 49#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2))
46 50
@@ -66,8 +70,8 @@
66 * NONE: skb is checksummed by protocol or csum is not required. 70 * NONE: skb is checksummed by protocol or csum is not required.
67 * 71 *
68 * PARTIAL: device is required to csum packet as seen by hard_start_xmit 72 * PARTIAL: device is required to csum packet as seen by hard_start_xmit
69 * from skb->h.raw to the end and to record the checksum 73 * from skb->transport_header to the end and to record the checksum
70 * at skb->h.raw+skb->csum. 74 * at skb->transport_header + skb->csum.
71 * 75 *
72 * Device must show its capabilities in dev->features, set 76 * Device must show its capabilities in dev->features, set
73 * at device setup time. 77 * at device setup time.
@@ -83,12 +87,13 @@
83 */ 87 */
84 88
85struct net_device; 89struct net_device;
90struct scatterlist;
86 91
87#ifdef CONFIG_NETFILTER 92#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
88struct nf_conntrack { 93struct nf_conntrack {
89 atomic_t use; 94 atomic_t use;
90 void (*destroy)(struct nf_conntrack *);
91}; 95};
96#endif
92 97
93#ifdef CONFIG_BRIDGE_NETFILTER 98#ifdef CONFIG_BRIDGE_NETFILTER
94struct nf_bridge_info { 99struct nf_bridge_info {
@@ -103,8 +108,6 @@ struct nf_bridge_info {
103}; 108};
104#endif 109#endif
105 110
106#endif
107
108struct sk_buff_head { 111struct sk_buff_head {
109 /* These two members must be first. */ 112 /* These two members must be first. */
110 struct sk_buff *next; 113 struct sk_buff *next;
@@ -156,11 +159,6 @@ struct skb_shared_info {
156#define SKB_DATAREF_SHIFT 16 159#define SKB_DATAREF_SHIFT 16
157#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 160#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
158 161
159struct skb_timeval {
160 u32 off_sec;
161 u32 off_usec;
162};
163
164 162
165enum { 163enum {
166 SKB_FCLONE_UNAVAILABLE, 164 SKB_FCLONE_UNAVAILABLE,
@@ -181,6 +179,16 @@ enum {
181 SKB_GSO_TCPV6 = 1 << 4, 179 SKB_GSO_TCPV6 = 1 << 4,
182}; 180};
183 181
182#if BITS_PER_LONG > 32
183#define NET_SKBUFF_DATA_USES_OFFSET 1
184#endif
185
186#ifdef NET_SKBUFF_DATA_USES_OFFSET
187typedef unsigned int sk_buff_data_t;
188#else
189typedef unsigned char *sk_buff_data_t;
190#endif
191
184/** 192/**
185 * struct sk_buff - socket buffer 193 * struct sk_buff - socket buffer
186 * @next: Next buffer in list 194 * @next: Next buffer in list
@@ -189,16 +197,18 @@ enum {
189 * @tstamp: Time we arrived 197 * @tstamp: Time we arrived
190 * @dev: Device we arrived on/are leaving by 198 * @dev: Device we arrived on/are leaving by
191 * @iif: ifindex of device we arrived on 199 * @iif: ifindex of device we arrived on
192 * @h: Transport layer header 200 * @transport_header: Transport layer header
193 * @nh: Network layer header 201 * @network_header: Network layer header
194 * @mac: Link layer header 202 * @mac_header: Link layer header
195 * @dst: destination entry 203 * @dst: destination entry
196 * @sp: the security path, used for xfrm 204 * @sp: the security path, used for xfrm
197 * @cb: Control buffer. Free for use by every layer. Put private vars here 205 * @cb: Control buffer. Free for use by every layer. Put private vars here
198 * @len: Length of actual data 206 * @len: Length of actual data
199 * @data_len: Data length 207 * @data_len: Data length
200 * @mac_len: Length of link layer header 208 * @mac_len: Length of link layer header
201 * @csum: Checksum 209 * @csum: Checksum (must include start/offset pair)
210 * @csum_start: Offset from skb->head where checksumming should start
211 * @csum_offset: Offset from csum_start where checksum should be stored
202 * @local_df: allow local fragmentation 212 * @local_df: allow local fragmentation
203 * @cloned: Head may be cloned (check refcnt to be sure) 213 * @cloned: Head may be cloned (check refcnt to be sure)
204 * @nohdr: Payload reference only, must not modify header 214 * @nohdr: Payload reference only, must not modify header
@@ -233,32 +243,11 @@ struct sk_buff {
233 struct sk_buff *prev; 243 struct sk_buff *prev;
234 244
235 struct sock *sk; 245 struct sock *sk;
236 struct skb_timeval tstamp; 246 ktime_t tstamp;
237 struct net_device *dev; 247 struct net_device *dev;
238 int iif; 248 int iif;
239 /* 4 byte hole on 64 bit*/ 249 /* 4 byte hole on 64 bit*/
240 250
241 union {
242 struct tcphdr *th;
243 struct udphdr *uh;
244 struct icmphdr *icmph;
245 struct igmphdr *igmph;
246 struct iphdr *ipiph;
247 struct ipv6hdr *ipv6h;
248 unsigned char *raw;
249 } h;
250
251 union {
252 struct iphdr *iph;
253 struct ipv6hdr *ipv6h;
254 struct arphdr *arph;
255 unsigned char *raw;
256 } nh;
257
258 union {
259 unsigned char *raw;
260 } mac;
261
262 struct dst_entry *dst; 251 struct dst_entry *dst;
263 struct sec_path *sp; 252 struct sec_path *sp;
264 253
@@ -275,7 +264,10 @@ struct sk_buff {
275 mac_len; 264 mac_len;
276 union { 265 union {
277 __wsum csum; 266 __wsum csum;
278 __u32 csum_offset; 267 struct {
268 __u16 csum_start;
269 __u16 csum_offset;
270 };
279 }; 271 };
280 __u32 priority; 272 __u32 priority;
281 __u8 local_df:1, 273 __u8 local_df:1,
@@ -289,15 +281,13 @@ struct sk_buff {
289 __be16 protocol; 281 __be16 protocol;
290 282
291 void (*destructor)(struct sk_buff *skb); 283 void (*destructor)(struct sk_buff *skb);
292#ifdef CONFIG_NETFILTER
293 struct nf_conntrack *nfct;
294#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 284#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
285 struct nf_conntrack *nfct;
295 struct sk_buff *nfct_reasm; 286 struct sk_buff *nfct_reasm;
296#endif 287#endif
297#ifdef CONFIG_BRIDGE_NETFILTER 288#ifdef CONFIG_BRIDGE_NETFILTER
298 struct nf_bridge_info *nf_bridge; 289 struct nf_bridge_info *nf_bridge;
299#endif 290#endif
300#endif /* CONFIG_NETFILTER */
301#ifdef CONFIG_NET_SCHED 291#ifdef CONFIG_NET_SCHED
302 __u16 tc_index; /* traffic control index */ 292 __u16 tc_index; /* traffic control index */
303#ifdef CONFIG_NET_CLS_ACT 293#ifdef CONFIG_NET_CLS_ACT
@@ -313,13 +303,16 @@ struct sk_buff {
313 303
314 __u32 mark; 304 __u32 mark;
315 305
306 sk_buff_data_t transport_header;
307 sk_buff_data_t network_header;
308 sk_buff_data_t mac_header;
316 /* These elements must be at the end, see alloc_skb() for details. */ 309 /* These elements must be at the end, see alloc_skb() for details. */
310 sk_buff_data_t tail;
311 sk_buff_data_t end;
312 unsigned char *head,
313 *data;
317 unsigned int truesize; 314 unsigned int truesize;
318 atomic_t users; 315 atomic_t users;
319 unsigned char *head,
320 *data,
321 *tail,
322 *end;
323}; 316};
324 317
325#ifdef __KERNEL__ 318#ifdef __KERNEL__
@@ -361,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
361extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 354extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
362 int newheadroom, int newtailroom, 355 int newheadroom, int newtailroom,
363 gfp_t priority); 356 gfp_t priority);
357extern int skb_to_sgvec(struct sk_buff *skb,
358 struct scatterlist *sg, int offset,
359 int len);
360extern int skb_cow_data(struct sk_buff *skb, int tailbits,
361 struct sk_buff **trailer);
364extern int skb_pad(struct sk_buff *skb, int pad); 362extern int skb_pad(struct sk_buff *skb, int pad);
365#define dev_kfree_skb(a) kfree_skb(a) 363#define dev_kfree_skb(a) kfree_skb(a)
366extern void skb_over_panic(struct sk_buff *skb, int len, 364extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -402,8 +400,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
402 unsigned int to, struct ts_config *config, 400 unsigned int to, struct ts_config *config,
403 struct ts_state *state); 401 struct ts_state *state);
404 402
403#ifdef NET_SKBUFF_DATA_USES_OFFSET
404static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
405{
406 return skb->head + skb->end;
407}
408#else
409static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
410{
411 return skb->end;
412}
413#endif
414
405/* Internal */ 415/* Internal */
406#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 416#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
407 417
408/** 418/**
409 * skb_queue_empty - check if a queue is empty 419 * skb_queue_empty - check if a queue is empty
@@ -822,12 +832,46 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
822#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 832#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
823#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 833#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
824 834
835#ifdef NET_SKBUFF_DATA_USES_OFFSET
836static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
837{
838 return skb->head + skb->tail;
839}
840
841static inline void skb_reset_tail_pointer(struct sk_buff *skb)
842{
843 skb->tail = skb->data - skb->head;
844}
845
846static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
847{
848 skb_reset_tail_pointer(skb);
849 skb->tail += offset;
850}
851#else /* NET_SKBUFF_DATA_USES_OFFSET */
852static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
853{
854 return skb->tail;
855}
856
857static inline void skb_reset_tail_pointer(struct sk_buff *skb)
858{
859 skb->tail = skb->data;
860}
861
862static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
863{
864 skb->tail = skb->data + offset;
865}
866
867#endif /* NET_SKBUFF_DATA_USES_OFFSET */
868
825/* 869/*
826 * Add data to an sk_buff 870 * Add data to an sk_buff
827 */ 871 */
828static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 872static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
829{ 873{
830 unsigned char *tmp = skb->tail; 874 unsigned char *tmp = skb_tail_pointer(skb);
831 SKB_LINEAR_ASSERT(skb); 875 SKB_LINEAR_ASSERT(skb);
832 skb->tail += len; 876 skb->tail += len;
833 skb->len += len; 877 skb->len += len;
@@ -845,11 +889,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
845 */ 889 */
846static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) 890static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
847{ 891{
848 unsigned char *tmp = skb->tail; 892 unsigned char *tmp = skb_tail_pointer(skb);
849 SKB_LINEAR_ASSERT(skb); 893 SKB_LINEAR_ASSERT(skb);
850 skb->tail += len; 894 skb->tail += len;
851 skb->len += len; 895 skb->len += len;
852 if (unlikely(skb->tail>skb->end)) 896 if (unlikely(skb->tail > skb->end))
853 skb_over_panic(skb, len, current_text_addr()); 897 skb_over_panic(skb, len, current_text_addr());
854 return tmp; 898 return tmp;
855} 899}
@@ -962,6 +1006,130 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
962 skb->tail += len; 1006 skb->tail += len;
963} 1007}
964 1008
1009#ifdef NET_SKBUFF_DATA_USES_OFFSET
1010static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1011{
1012 return skb->head + skb->transport_header;
1013}
1014
1015static inline void skb_reset_transport_header(struct sk_buff *skb)
1016{
1017 skb->transport_header = skb->data - skb->head;
1018}
1019
1020static inline void skb_set_transport_header(struct sk_buff *skb,
1021 const int offset)
1022{
1023 skb_reset_transport_header(skb);
1024 skb->transport_header += offset;
1025}
1026
1027static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1028{
1029 return skb->head + skb->network_header;
1030}
1031
1032static inline void skb_reset_network_header(struct sk_buff *skb)
1033{
1034 skb->network_header = skb->data - skb->head;
1035}
1036
1037static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1038{
1039 skb_reset_network_header(skb);
1040 skb->network_header += offset;
1041}
1042
1043static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1044{
1045 return skb->head + skb->mac_header;
1046}
1047
1048static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1049{
1050 return skb->mac_header != ~0U;
1051}
1052
1053static inline void skb_reset_mac_header(struct sk_buff *skb)
1054{
1055 skb->mac_header = skb->data - skb->head;
1056}
1057
1058static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1059{
1060 skb_reset_mac_header(skb);
1061 skb->mac_header += offset;
1062}
1063
1064#else /* NET_SKBUFF_DATA_USES_OFFSET */
1065
1066static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1067{
1068 return skb->transport_header;
1069}
1070
1071static inline void skb_reset_transport_header(struct sk_buff *skb)
1072{
1073 skb->transport_header = skb->data;
1074}
1075
1076static inline void skb_set_transport_header(struct sk_buff *skb,
1077 const int offset)
1078{
1079 skb->transport_header = skb->data + offset;
1080}
1081
1082static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1083{
1084 return skb->network_header;
1085}
1086
1087static inline void skb_reset_network_header(struct sk_buff *skb)
1088{
1089 skb->network_header = skb->data;
1090}
1091
1092static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1093{
1094 skb->network_header = skb->data + offset;
1095}
1096
1097static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1098{
1099 return skb->mac_header;
1100}
1101
1102static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1103{
1104 return skb->mac_header != NULL;
1105}
1106
1107static inline void skb_reset_mac_header(struct sk_buff *skb)
1108{
1109 skb->mac_header = skb->data;
1110}
1111
1112static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1113{
1114 skb->mac_header = skb->data + offset;
1115}
1116#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1117
1118static inline int skb_transport_offset(const struct sk_buff *skb)
1119{
1120 return skb_transport_header(skb) - skb->data;
1121}
1122
1123static inline u32 skb_network_header_len(const struct sk_buff *skb)
1124{
1125 return skb->transport_header - skb->network_header;
1126}
1127
1128static inline int skb_network_offset(const struct sk_buff *skb)
1129{
1130 return skb_network_header(skb) - skb->data;
1131}
1132
965/* 1133/*
966 * CPUs often take a performance hit when accessing unaligned memory 1134 * CPUs often take a performance hit when accessing unaligned memory
967 * locations. The actual performance hit varies, it can be small if the 1135 * locations. The actual performance hit varies, it can be small if the
@@ -1013,8 +1181,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1013 WARN_ON(1); 1181 WARN_ON(1);
1014 return; 1182 return;
1015 } 1183 }
1016 skb->len = len; 1184 skb->len = len;
1017 skb->tail = skb->data + len; 1185 skb_set_tail_pointer(skb, len);
1018} 1186}
1019 1187
1020/** 1188/**
@@ -1303,6 +1471,11 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1303 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1471 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
1304 skb = skb->next) 1472 skb = skb->next)
1305 1473
1474#define skb_queue_walk_safe(queue, skb, tmp) \
1475 for (skb = (queue)->next, tmp = skb->next; \
1476 skb != (struct sk_buff *)(queue); \
1477 skb = tmp, tmp = skb->next)
1478
1306#define skb_queue_reverse_walk(queue, skb) \ 1479#define skb_queue_reverse_walk(queue, skb) \
1307 for (skb = (queue)->prev; \ 1480 for (skb = (queue)->prev; \
1308 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1481 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
@@ -1326,8 +1499,8 @@ extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1326 int len, __wsum csum); 1499 int len, __wsum csum);
1327extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1500extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1328 void *to, int len); 1501 void *to, int len);
1329extern int skb_store_bits(const struct sk_buff *skb, int offset, 1502extern int skb_store_bits(struct sk_buff *skb, int offset,
1330 void *from, int len); 1503 const void *from, int len);
1331extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 1504extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1332 int offset, u8 *to, int len, 1505 int offset, u8 *to, int len,
1333 __wsum csum); 1506 __wsum csum);
@@ -1351,8 +1524,36 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1351 return buffer; 1524 return buffer;
1352} 1525}
1353 1526
1527static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
1528 void *to,
1529 const unsigned int len)
1530{
1531 memcpy(to, skb->data, len);
1532}
1533
1534static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
1535 const int offset, void *to,
1536 const unsigned int len)
1537{
1538 memcpy(to, skb->data + offset, len);
1539}
1540
1541static inline void skb_copy_to_linear_data(struct sk_buff *skb,
1542 const void *from,
1543 const unsigned int len)
1544{
1545 memcpy(skb->data, from, len);
1546}
1547
1548static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
1549 const int offset,
1550 const void *from,
1551 const unsigned int len)
1552{
1553 memcpy(skb->data + offset, from, len);
1554}
1555
1354extern void skb_init(void); 1556extern void skb_init(void);
1355extern void skb_add_mtu(int mtu);
1356 1557
1357/** 1558/**
1358 * skb_get_timestamp - get timestamp from a skb 1559 * skb_get_timestamp - get timestamp from a skb
@@ -1365,29 +1566,28 @@ extern void skb_add_mtu(int mtu);
1365 */ 1566 */
1366static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) 1567static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
1367{ 1568{
1368 stamp->tv_sec = skb->tstamp.off_sec; 1569 *stamp = ktime_to_timeval(skb->tstamp);
1369 stamp->tv_usec = skb->tstamp.off_usec;
1370} 1570}
1371 1571
1372/** 1572static inline void __net_timestamp(struct sk_buff *skb)
1373 * skb_set_timestamp - set timestamp of a skb 1573{
1374 * @skb: skb to set stamp of 1574 skb->tstamp = ktime_get_real();
1375 * @stamp: pointer to struct timeval to get stamp from 1575}
1376 * 1576
1377 * Timestamps are stored in the skb as offsets to a base timestamp. 1577static inline ktime_t net_timedelta(ktime_t t)
1378 * This function converts a struct timeval to an offset and stores
1379 * it in the skb.
1380 */
1381static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
1382{ 1578{
1383 skb->tstamp.off_sec = stamp->tv_sec; 1579 return ktime_sub(ktime_get_real(), t);
1384 skb->tstamp.off_usec = stamp->tv_usec;
1385} 1580}
1386 1581
1387extern void __net_timestamp(struct sk_buff *skb);
1388 1582
1583extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1389extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1584extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1390 1585
1586static inline int skb_csum_unnecessary(const struct sk_buff *skb)
1587{
1588 return skb->ip_summed & CHECKSUM_UNNECESSARY;
1589}
1590
1391/** 1591/**
1392 * skb_checksum_complete - Calculate checksum of an entire packet 1592 * skb_checksum_complete - Calculate checksum of an entire packet
1393 * @skb: packet to process 1593 * @skb: packet to process
@@ -1406,22 +1606,22 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1406 */ 1606 */
1407static inline unsigned int skb_checksum_complete(struct sk_buff *skb) 1607static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
1408{ 1608{
1409 return skb->ip_summed != CHECKSUM_UNNECESSARY && 1609 return skb_csum_unnecessary(skb) ?
1410 __skb_checksum_complete(skb); 1610 0 : __skb_checksum_complete(skb);
1411} 1611}
1412 1612
1413#ifdef CONFIG_NETFILTER 1613#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1614extern void nf_conntrack_destroy(struct nf_conntrack *nfct);
1414static inline void nf_conntrack_put(struct nf_conntrack *nfct) 1615static inline void nf_conntrack_put(struct nf_conntrack *nfct)
1415{ 1616{
1416 if (nfct && atomic_dec_and_test(&nfct->use)) 1617 if (nfct && atomic_dec_and_test(&nfct->use))
1417 nfct->destroy(nfct); 1618 nf_conntrack_destroy(nfct);
1418} 1619}
1419static inline void nf_conntrack_get(struct nf_conntrack *nfct) 1620static inline void nf_conntrack_get(struct nf_conntrack *nfct)
1420{ 1621{
1421 if (nfct) 1622 if (nfct)
1422 atomic_inc(&nfct->use); 1623 atomic_inc(&nfct->use);
1423} 1624}
1424#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1425static inline void nf_conntrack_get_reasm(struct sk_buff *skb) 1625static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
1426{ 1626{
1427 if (skb) 1627 if (skb)
@@ -1447,9 +1647,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1447#endif /* CONFIG_BRIDGE_NETFILTER */ 1647#endif /* CONFIG_BRIDGE_NETFILTER */
1448static inline void nf_reset(struct sk_buff *skb) 1648static inline void nf_reset(struct sk_buff *skb)
1449{ 1649{
1650#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1450 nf_conntrack_put(skb->nfct); 1651 nf_conntrack_put(skb->nfct);
1451 skb->nfct = NULL; 1652 skb->nfct = NULL;
1452#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1453 nf_conntrack_put_reasm(skb->nfct_reasm); 1653 nf_conntrack_put_reasm(skb->nfct_reasm);
1454 skb->nfct_reasm = NULL; 1654 skb->nfct_reasm = NULL;
1455#endif 1655#endif
@@ -1459,9 +1659,33 @@ static inline void nf_reset(struct sk_buff *skb)
1459#endif 1659#endif
1460} 1660}
1461 1661
1462#else /* CONFIG_NETFILTER */ 1662/* Note: This doesn't put any conntrack and bridge info in dst. */
1463static inline void nf_reset(struct sk_buff *skb) {} 1663static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1464#endif /* CONFIG_NETFILTER */ 1664{
1665#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1666 dst->nfct = src->nfct;
1667 nf_conntrack_get(src->nfct);
1668 dst->nfctinfo = src->nfctinfo;
1669 dst->nfct_reasm = src->nfct_reasm;
1670 nf_conntrack_get_reasm(src->nfct_reasm);
1671#endif
1672#ifdef CONFIG_BRIDGE_NETFILTER
1673 dst->nf_bridge = src->nf_bridge;
1674 nf_bridge_get(src->nf_bridge);
1675#endif
1676}
1677
1678static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1679{
1680#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1681 nf_conntrack_put(dst->nfct);
1682 nf_conntrack_put_reasm(dst->nfct_reasm);
1683#endif
1684#ifdef CONFIG_BRIDGE_NETFILTER
1685 nf_bridge_put(dst->nf_bridge);
1686#endif
1687 __nf_copy(dst, src);
1688}
1465 1689
1466#ifdef CONFIG_NETWORK_SECMARK 1690#ifdef CONFIG_NETWORK_SECMARK
1467static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) 1691static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
@@ -1486,5 +1710,12 @@ static inline int skb_is_gso(const struct sk_buff *skb)
1486 return skb_shinfo(skb)->gso_size; 1710 return skb_shinfo(skb)->gso_size;
1487} 1711}
1488 1712
1713static inline void skb_forward_csum(struct sk_buff *skb)
1714{
1715 /* Unfortunately we don't support this one. Any brave souls? */
1716 if (skb->ip_summed == CHECKSUM_COMPLETE)
1717 skb->ip_summed = CHECKSUM_NONE;
1718}
1719
1489#endif /* __KERNEL__ */ 1720#endif /* __KERNEL__ */
1490#endif /* _LINUX_SKBUFF_H */ 1721#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 854aa6b543f..802b3a38b04 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -40,6 +40,8 @@ enum
40 IPSTATS_MIB_FRAGCREATES, /* FragCreates */ 40 IPSTATS_MIB_FRAGCREATES, /* FragCreates */
41 IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */ 41 IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
43 __IPSTATS_MIB_MAX 45 __IPSTATS_MIB_MAX
44}; 46};
45 47
diff --git a/include/linux/socket.h b/include/linux/socket.h
index fcd35a210e7..6e7c9483a6a 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -188,7 +188,8 @@ struct ucred {
188#define AF_TIPC 30 /* TIPC sockets */ 188#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_MAX 33 /* For now.. */ 191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_MAX 34 /* For now.. */
192 193
193/* Protocol families, same as address families. */ 194/* Protocol families, same as address families. */
194#define PF_UNSPEC AF_UNSPEC 195#define PF_UNSPEC AF_UNSPEC
@@ -222,6 +223,7 @@ struct ucred {
222#define PF_TIPC AF_TIPC 223#define PF_TIPC AF_TIPC
223#define PF_BLUETOOTH AF_BLUETOOTH 224#define PF_BLUETOOTH AF_BLUETOOTH
224#define PF_IUCV AF_IUCV 225#define PF_IUCV AF_IUCV
226#define PF_RXRPC AF_RXRPC
225#define PF_MAX AF_MAX 227#define PF_MAX AF_MAX
226 228
227/* Maximum queue length specifiable by listen. */ 229/* Maximum queue length specifiable by listen. */
@@ -284,6 +286,7 @@ struct ucred {
284#define SOL_DCCP 269 286#define SOL_DCCP 269
285#define SOL_NETLINK 270 287#define SOL_NETLINK 270
286#define SOL_TIPC 271 288#define SOL_TIPC 271
289#define SOL_RXRPC 272
287 290
288/* IPX options */ 291/* IPX options */
289#define IPX_TYPE 1 292#define IPX_TYPE 1
diff --git a/include/linux/sony-laptop.h b/include/linux/sony-laptop.h
new file mode 100644
index 00000000000..e2e036d94e4
--- /dev/null
+++ b/include/linux/sony-laptop.h
@@ -0,0 +1,34 @@
1#ifndef _SONYLAPTOP_H_
2#define _SONYLAPTOP_H_
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8/* used only for communication between v4l and sony-laptop */
9
10#define SONY_PIC_COMMAND_GETCAMERA 1 /* obsolete */
11#define SONY_PIC_COMMAND_SETCAMERA 2
12#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS 3 /* obsolete */
13#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS 4
14#define SONY_PIC_COMMAND_GETCAMERACONTRAST 5 /* obsolete */
15#define SONY_PIC_COMMAND_SETCAMERACONTRAST 6
16#define SONY_PIC_COMMAND_GETCAMERAHUE 7 /* obsolete */
17#define SONY_PIC_COMMAND_SETCAMERAHUE 8
18#define SONY_PIC_COMMAND_GETCAMERACOLOR 9 /* obsolete */
19#define SONY_PIC_COMMAND_SETCAMERACOLOR 10
20#define SONY_PIC_COMMAND_GETCAMERASHARPNESS 11 /* obsolete */
21#define SONY_PIC_COMMAND_SETCAMERASHARPNESS 12
22#define SONY_PIC_COMMAND_GETCAMERAPICTURE 13 /* obsolete */
23#define SONY_PIC_COMMAND_SETCAMERAPICTURE 14
24#define SONY_PIC_COMMAND_GETCAMERAAGC 15 /* obsolete */
25#define SONY_PIC_COMMAND_SETCAMERAAGC 16
26#define SONY_PIC_COMMAND_GETCAMERADIRECTION 17 /* obsolete */
27#define SONY_PIC_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */
28#define SONY_PIC_COMMAND_GETCAMERAREVISION 19 /* obsolete */
29
30int sony_pic_camera_command(int command, u8 value);
31
32#endif /* __KERNEL__ */
33
34#endif /* _SONYLAPTOP_H_ */
diff --git a/include/linux/string.h b/include/linux/string.h
index 4f69ef9e6eb..7f2eb6a477f 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -47,6 +47,12 @@ extern int strncmp(const char *,const char *,__kernel_size_t);
47#ifndef __HAVE_ARCH_STRNICMP 47#ifndef __HAVE_ARCH_STRNICMP
48extern int strnicmp(const char *, const char *, __kernel_size_t); 48extern int strnicmp(const char *, const char *, __kernel_size_t);
49#endif 49#endif
50#ifndef __HAVE_ARCH_STRCASECMP
51extern int strcasecmp(const char *s1, const char *s2);
52#endif
53#ifndef __HAVE_ARCH_STRNCASECMP
54extern int strncasecmp(const char *s1, const char *s2, size_t n);
55#endif
50#ifndef __HAVE_ARCH_STRCHR 56#ifndef __HAVE_ARCH_STRCHR
51extern char * strchr(const char *,int); 57extern char * strchr(const char *,int);
52#endif 58#endif
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c7a78eef2b4..66611423c8e 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -84,7 +84,8 @@ struct rpc_procinfo {
84 u32 p_proc; /* RPC procedure number */ 84 u32 p_proc; /* RPC procedure number */
85 kxdrproc_t p_encode; /* XDR encode function */ 85 kxdrproc_t p_encode; /* XDR encode function */
86 kxdrproc_t p_decode; /* XDR decode function */ 86 kxdrproc_t p_decode; /* XDR decode function */
87 unsigned int p_bufsiz; /* req. buffer size */ 87 unsigned int p_arglen; /* argument hdr length (u32) */
88 unsigned int p_replen; /* reply hdr length (u32) */
88 unsigned int p_count; /* call count */ 89 unsigned int p_count; /* call count */
89 unsigned int p_timer; /* Which RTT timer to use */ 90 unsigned int p_timer; /* Which RTT timer to use */
90 u32 p_statidx; /* Which procedure to account */ 91 u32 p_statidx; /* Which procedure to account */
@@ -121,8 +122,8 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
121int rpc_shutdown_client(struct rpc_clnt *); 122int rpc_shutdown_client(struct rpc_clnt *);
122int rpc_destroy_client(struct rpc_clnt *); 123int rpc_destroy_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 124void rpc_release_client(struct rpc_clnt *);
124void rpc_getport(struct rpc_task *); 125int rpcb_register(u32, u32, int, unsigned short, int *);
125int rpc_register(u32, u32, int, unsigned short, int *); 126void rpcb_getport(struct rpc_task *);
126 127
127void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 128void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
128 129
@@ -144,7 +145,7 @@ char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
144/* 145/*
145 * Helper function for NFSroot support 146 * Helper function for NFSroot support
146 */ 147 */
147int rpc_getport_external(struct sockaddr_in *, __u32, __u32, int); 148int rpcb_getport_external(struct sockaddr_in *, __u32, __u32, int);
148 149
149#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
150#endif /* _LINUX_SUNRPC_CLNT_H */ 151#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index b7c7307ceec..3912cf16361 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -17,7 +17,7 @@
17#define RPCDBG_DEBUG 0x0004 17#define RPCDBG_DEBUG 0x0004
18#define RPCDBG_NFS 0x0008 18#define RPCDBG_NFS 0x0008
19#define RPCDBG_AUTH 0x0010 19#define RPCDBG_AUTH 0x0010
20#define RPCDBG_PMAP 0x0020 20#define RPCDBG_BIND 0x0020
21#define RPCDBG_SCHED 0x0040 21#define RPCDBG_SCHED 0x0040
22#define RPCDBG_TRANS 0x0080 22#define RPCDBG_TRANS 0x0080
23#define RPCDBG_SVCSOCK 0x0100 23#define RPCDBG_SVCSOCK 0x0100
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 606cb216523..784d4c3ef65 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -78,10 +78,6 @@ enum rpc_auth_stat {
78 RPCSEC_GSS_CTXPROBLEM = 14 78 RPCSEC_GSS_CTXPROBLEM = 14
79}; 79};
80 80
81#define RPC_PMAP_PROGRAM 100000
82#define RPC_PMAP_VERSION 2
83#define RPC_PMAP_PORT 111
84
85#define RPC_MAXNETNAMELEN 256 81#define RPC_MAXNETNAMELEN 256
86 82
87/* 83/*
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 3069ecca012..2047fb202a1 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -264,7 +264,7 @@ struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
264void rpc_wake_up_status(struct rpc_wait_queue *, int); 264void rpc_wake_up_status(struct rpc_wait_queue *, int);
265void rpc_delay(struct rpc_task *, unsigned long); 265void rpc_delay(struct rpc_task *, unsigned long);
266void * rpc_malloc(struct rpc_task *, size_t); 266void * rpc_malloc(struct rpc_task *, size_t);
267void rpc_free(struct rpc_task *); 267void rpc_free(void *);
268int rpciod_up(void); 268int rpciod_up(void);
269void rpciod_down(void); 269void rpciod_down(void);
270int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 270int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index f780e72fc41..fa89ce6ce07 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -84,7 +84,9 @@ struct rpc_rqst {
84 struct list_head rq_list; 84 struct list_head rq_list;
85 85
86 __u32 * rq_buffer; /* XDR encode buffer */ 86 __u32 * rq_buffer; /* XDR encode buffer */
87 size_t rq_bufsize; 87 size_t rq_bufsize,
88 rq_callsize,
89 rq_rcvsize;
88 90
89 struct xdr_buf rq_private_buf; /* The receive buffer 91 struct xdr_buf rq_private_buf; /* The receive buffer
90 * used in the softirq. 92 * used in the softirq.
@@ -112,7 +114,7 @@ struct rpc_xprt_ops {
112 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 114 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
113 void (*connect)(struct rpc_task *task); 115 void (*connect)(struct rpc_task *task);
114 void * (*buf_alloc)(struct rpc_task *task, size_t size); 116 void * (*buf_alloc)(struct rpc_task *task, size_t size);
115 void (*buf_free)(struct rpc_task *task); 117 void (*buf_free)(void *buffer);
116 int (*send_request)(struct rpc_task *task); 118 int (*send_request)(struct rpc_task *task);
117 void (*set_retrans_timeout)(struct rpc_task *task); 119 void (*set_retrans_timeout)(struct rpc_task *task);
118 void (*timer)(struct rpc_task *task); 120 void (*timer)(struct rpc_task *task);
@@ -150,6 +152,7 @@ struct rpc_xprt {
150 unsigned long state; /* transport state */ 152 unsigned long state; /* transport state */
151 unsigned char shutdown : 1, /* being shut down */ 153 unsigned char shutdown : 1, /* being shut down */
152 resvport : 1; /* use a reserved port */ 154 resvport : 1; /* use a reserved port */
155 unsigned int bind_index; /* bind function index */
153 156
154 /* 157 /*
155 * Connection of transports 158 * Connection of transports
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 2c5fb38d939..47f1c53332c 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -290,6 +290,7 @@ enum
290 NET_CORE_BUDGET=19, 290 NET_CORE_BUDGET=19,
291 NET_CORE_AEVENT_ETIME=20, 291 NET_CORE_AEVENT_ETIME=20,
292 NET_CORE_AEVENT_RSEQTH=21, 292 NET_CORE_AEVENT_RSEQTH=21,
293 NET_CORE_WARNINGS=22,
293}; 294};
294 295
295/* /proc/sys/net/ethernet */ 296/* /proc/sys/net/ethernet */
@@ -438,6 +439,8 @@ enum
438 NET_CIPSOV4_RBM_STRICTVALID=121, 439 NET_CIPSOV4_RBM_STRICTVALID=121,
439 NET_TCP_AVAIL_CONG_CONTROL=122, 440 NET_TCP_AVAIL_CONG_CONTROL=122,
440 NET_TCP_ALLOWED_CONG_CONTROL=123, 441 NET_TCP_ALLOWED_CONG_CONTROL=123,
442 NET_TCP_MAX_SSTHRESH=124,
443 NET_TCP_FRTO_RESPONSE=125,
441}; 444};
442 445
443enum { 446enum {
@@ -580,6 +583,7 @@ enum {
580 NET_IPV6_RTR_PROBE_INTERVAL=21, 583 NET_IPV6_RTR_PROBE_INTERVAL=21,
581 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, 584 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
582 NET_IPV6_PROXY_NDP=23, 585 NET_IPV6_PROXY_NDP=23,
586 NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
583 __NET_IPV6_MAX 587 __NET_IPV6_MAX
584}; 588};
585 589
@@ -788,6 +792,7 @@ enum {
788 NET_BRIDGE_NF_CALL_IPTABLES = 2, 792 NET_BRIDGE_NF_CALL_IPTABLES = 2,
789 NET_BRIDGE_NF_CALL_IP6TABLES = 3, 793 NET_BRIDGE_NF_CALL_IP6TABLES = 3,
790 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 794 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
795 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
791}; 796};
792 797
793/* CTL_FS names: */ 798/* CTL_FS names: */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index fea9a6b3fb7..7d5d1ec95c2 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -80,7 +80,7 @@ struct sysfs_ops {
80#ifdef CONFIG_SYSFS 80#ifdef CONFIG_SYSFS
81 81
82extern int sysfs_schedule_callback(struct kobject *kobj, 82extern int sysfs_schedule_callback(struct kobject *kobj,
83 void (*func)(void *), void *data); 83 void (*func)(void *), void *data, struct module *owner);
84 84
85extern int __must_check 85extern int __must_check
86sysfs_create_dir(struct kobject *, struct dentry *); 86sysfs_create_dir(struct kobject *, struct dentry *);
@@ -137,7 +137,7 @@ extern int __must_check sysfs_init(void);
137#else /* CONFIG_SYSFS */ 137#else /* CONFIG_SYSFS */
138 138
139static inline int sysfs_schedule_callback(struct kobject *kobj, 139static inline int sysfs_schedule_callback(struct kobject *kobj,
140 void (*func)(void *), void *data) 140 void (*func)(void *), void *data, struct module *owner)
141{ 141{
142 return -ENOSYS; 142 return -ENOSYS;
143} 143}
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index 3fced479825..a46104a28f6 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33 33
34#define TASKSTATS_VERSION 3 34#define TASKSTATS_VERSION 4
35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
36 * in linux/sched.h */ 36 * in linux/sched.h */
37 37
@@ -66,7 +66,7 @@ struct taskstats {
66 /* Delay waiting for cpu, while runnable 66 /* Delay waiting for cpu, while runnable
67 * count, delay_total NOT updated atomically 67 * count, delay_total NOT updated atomically
68 */ 68 */
69 __u64 cpu_count; 69 __u64 cpu_count __attribute__((aligned(8)));
70 __u64 cpu_delay_total; 70 __u64 cpu_delay_total;
71 71
72 /* Following four fields atomically updated using task->delays->lock */ 72 /* Following four fields atomically updated using task->delays->lock */
@@ -101,14 +101,17 @@ struct taskstats {
101 101
102 /* Basic Accounting Fields start */ 102 /* Basic Accounting Fields start */
103 char ac_comm[TS_COMM_LEN]; /* Command name */ 103 char ac_comm[TS_COMM_LEN]; /* Command name */
104 __u8 ac_sched; /* Scheduling discipline */ 104 __u8 ac_sched __attribute__((aligned(8)));
105 /* Scheduling discipline */
105 __u8 ac_pad[3]; 106 __u8 ac_pad[3];
106 __u32 ac_uid; /* User ID */ 107 __u32 ac_uid __attribute__((aligned(8)));
108 /* User ID */
107 __u32 ac_gid; /* Group ID */ 109 __u32 ac_gid; /* Group ID */
108 __u32 ac_pid; /* Process ID */ 110 __u32 ac_pid; /* Process ID */
109 __u32 ac_ppid; /* Parent process ID */ 111 __u32 ac_ppid; /* Parent process ID */
110 __u32 ac_btime; /* Begin time [sec since 1970] */ 112 __u32 ac_btime; /* Begin time [sec since 1970] */
111 __u64 ac_etime; /* Elapsed time [usec] */ 113 __u64 ac_etime __attribute__((aligned(8)));
114 /* Elapsed time [usec] */
112 __u64 ac_utime; /* User CPU time [usec] */ 115 __u64 ac_utime; /* User CPU time [usec] */
113 __u64 ac_stime; /* SYstem CPU time [usec] */ 116 __u64 ac_stime; /* SYstem CPU time [usec] */
114 __u64 ac_minflt; /* Minor Page Fault Count */ 117 __u64 ac_minflt; /* Minor Page Fault Count */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 29d3089038a..c6b9f92e828 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -178,6 +178,21 @@ struct tcp_md5sig {
178#include <net/inet_connection_sock.h> 178#include <net/inet_connection_sock.h>
179#include <net/inet_timewait_sock.h> 179#include <net/inet_timewait_sock.h>
180 180
181static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
182{
183 return (struct tcphdr *)skb_transport_header(skb);
184}
185
186static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
187{
188 return tcp_hdr(skb)->doff * 4;
189}
190
191static inline unsigned int tcp_optlen(const struct sk_buff *skb)
192{
193 return (tcp_hdr(skb)->doff - 5) * 4;
194}
195
181/* This defines a selective acknowledgement block. */ 196/* This defines a selective acknowledgement block. */
182struct tcp_sack_block_wire { 197struct tcp_sack_block_wire {
183 __be32 start_seq; 198 __be32 start_seq;
@@ -242,6 +257,8 @@ struct tcp_sock {
242 * See RFC793 and RFC1122. The RFC writes these in capitals. 257 * See RFC793 and RFC1122. The RFC writes these in capitals.
243 */ 258 */
244 u32 rcv_nxt; /* What we want to receive next */ 259 u32 rcv_nxt; /* What we want to receive next */
260 u32 copied_seq; /* Head of yet unread data */
261 u32 rcv_wup; /* rcv_nxt on last window update sent */
245 u32 snd_nxt; /* Next sequence we send */ 262 u32 snd_nxt; /* Next sequence we send */
246 263
247 u32 snd_una; /* First byte we want an ack for */ 264 u32 snd_una; /* First byte we want an ack for */
@@ -300,17 +317,15 @@ struct tcp_sock {
300 u32 snd_ssthresh; /* Slow start size threshold */ 317 u32 snd_ssthresh; /* Slow start size threshold */
301 u32 snd_cwnd; /* Sending congestion window */ 318 u32 snd_cwnd; /* Sending congestion window */
302 u16 snd_cwnd_cnt; /* Linear increase counter */ 319 u16 snd_cwnd_cnt; /* Linear increase counter */
303 u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 320 u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
304 u32 snd_cwnd_used; 321 u32 snd_cwnd_used;
305 u32 snd_cwnd_stamp; 322 u32 snd_cwnd_stamp;
306 323
307 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 324 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
308 325
309 u32 rcv_wnd; /* Current receiver window */ 326 u32 rcv_wnd; /* Current receiver window */
310 u32 rcv_wup; /* rcv_nxt on last window update sent */
311 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 327 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
312 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 328 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
313 u32 copied_seq; /* Head of yet unread data */
314 329
315/* SACKs data */ 330/* SACKs data */
316 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 331 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index 3deb0a6c137..2a196982601 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -14,16 +14,16 @@
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/wait.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include <linux/pci.h> 18#include <linux/pci.h>
20#include <linux/kthread.h> 19#include <linux/workqueue.h>
21 20
22/* Host registers (relative to pci base address): */ 21/* Host registers (relative to pci base address): */
23enum { 22enum {
24 FM_SET_INTERRUPT_ENABLE = 0x008, 23 FM_SET_INTERRUPT_ENABLE = 0x008,
25 FM_CLEAR_INTERRUPT_ENABLE = 0x00c, 24 FM_CLEAR_INTERRUPT_ENABLE = 0x00c,
26 FM_INTERRUPT_STATUS = 0x014 }; 25 FM_INTERRUPT_STATUS = 0x014
26};
27 27
28/* Socket registers (relative to socket base address): */ 28/* Socket registers (relative to socket base address): */
29enum { 29enum {
@@ -58,14 +58,8 @@ enum {
58 SOCK_MS_DATA = 0x188, 58 SOCK_MS_DATA = 0x188,
59 SOCK_MS_STATUS = 0x18c, 59 SOCK_MS_STATUS = 0x18c,
60 SOCK_MS_SYSTEM = 0x190, 60 SOCK_MS_SYSTEM = 0x190,
61 SOCK_FIFO_ACCESS = 0x200 }; 61 SOCK_FIFO_ACCESS = 0x200
62 62};
63
64#define TIFM_IRQ_ENABLE 0x80000000
65#define TIFM_IRQ_SOCKMASK(x) (x)
66#define TIFM_IRQ_CARDMASK(x) ((x) << 8)
67#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
68#define TIFM_IRQ_SETALL 0xffffffff
69 63
70#define TIFM_CTRL_LED 0x00000040 64#define TIFM_CTRL_LED 0x00000040
71#define TIFM_CTRL_FAST_CLK 0x00000100 65#define TIFM_CTRL_FAST_CLK 0x00000100
@@ -73,63 +67,76 @@ enum {
73#define TIFM_SOCK_STATE_OCCUPIED 0x00000008 67#define TIFM_SOCK_STATE_OCCUPIED 0x00000008
74#define TIFM_SOCK_STATE_POWERED 0x00000080 68#define TIFM_SOCK_STATE_POWERED 0x00000080
75 69
76#define TIFM_FIFO_ENABLE 0x00000001 /* Meaning of this constant is unverified */ 70#define TIFM_FIFO_ENABLE 0x00000001
71#define TIFM_FIFO_READY 0x00000001
77#define TIFM_FIFO_INT_SETALL 0x0000ffff 72#define TIFM_FIFO_INT_SETALL 0x0000ffff
78#define TIFM_FIFO_INTMASK 0x00000005 /* Meaning of this constant is unverified */ 73#define TIFM_FIFO_INTMASK 0x00000005
74
75#define TIFM_DMA_RESET 0x00000002
76#define TIFM_DMA_TX 0x00008000
77#define TIFM_DMA_EN 0x00000001
78#define TIFM_DMA_TSIZE 0x0000007f
79 79
80#define TIFM_DMA_RESET 0x00000002 /* Meaning of this constant is unverified */ 80#define TIFM_TYPE_XD 1
81#define TIFM_DMA_TX 0x00008000 /* Meaning of this constant is unverified */ 81#define TIFM_TYPE_MS 2
82#define TIFM_DMA_EN 0x00000001 /* Meaning of this constant is unverified */ 82#define TIFM_TYPE_SD 3
83 83
84typedef enum {FM_NULL = 0, FM_XD = 0x01, FM_MS = 0x02, FM_SD = 0x03} tifm_media_id; 84struct tifm_device_id {
85 unsigned char type;
86};
85 87
86struct tifm_driver; 88struct tifm_driver;
87struct tifm_dev { 89struct tifm_dev {
88 char __iomem *addr; 90 char __iomem *addr;
89 spinlock_t lock; 91 spinlock_t lock;
90 tifm_media_id media_id; 92 unsigned char type;
91 unsigned int socket_id; 93 unsigned int socket_id;
92 94
93 void (*signal_irq)(struct tifm_dev *sock, 95 void (*card_event)(struct tifm_dev *sock);
94 unsigned int sock_irq_status); 96 void (*data_event)(struct tifm_dev *sock);
95 97
96 struct tifm_driver *drv; 98 struct device dev;
97 struct device dev;
98}; 99};
99 100
100struct tifm_driver { 101struct tifm_driver {
101 tifm_media_id *id_table; 102 struct tifm_device_id *id_table;
102 int (*probe)(struct tifm_dev *dev); 103 int (*probe)(struct tifm_dev *dev);
103 void (*remove)(struct tifm_dev *dev); 104 void (*remove)(struct tifm_dev *dev);
104 int (*suspend)(struct tifm_dev *dev, 105 int (*suspend)(struct tifm_dev *dev,
105 pm_message_t state); 106 pm_message_t state);
106 int (*resume)(struct tifm_dev *dev); 107 int (*resume)(struct tifm_dev *dev);
107 108
108 struct device_driver driver; 109 struct device_driver driver;
109}; 110};
110 111
111struct tifm_adapter { 112struct tifm_adapter {
112 char __iomem *addr; 113 char __iomem *addr;
113 spinlock_t lock; 114 spinlock_t lock;
114 unsigned int irq_status; 115 unsigned int irq_status;
115 unsigned int socket_change_set; 116 unsigned int socket_change_set;
116 wait_queue_head_t change_set_notify; 117 unsigned int id;
117 unsigned int id; 118 unsigned int num_sockets;
118 unsigned int num_sockets; 119 struct completion *finish_me;
119 struct tifm_dev **sockets; 120
120 struct task_struct *media_switcher; 121 struct work_struct media_switcher;
121 struct class_device cdev; 122 struct class_device cdev;
122 struct device *dev; 123
123 124 void (*eject)(struct tifm_adapter *fm,
124 void (*eject)(struct tifm_adapter *fm, struct tifm_dev *sock); 125 struct tifm_dev *sock);
126
127 struct tifm_dev *sockets[0];
125}; 128};
126 129
127struct tifm_adapter *tifm_alloc_adapter(void); 130struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
128void tifm_free_device(struct device *dev); 131 struct device *dev);
129void tifm_free_adapter(struct tifm_adapter *fm); 132int tifm_add_adapter(struct tifm_adapter *fm);
130int tifm_add_adapter(struct tifm_adapter *fm, int (*mediathreadfn)(void *data));
131void tifm_remove_adapter(struct tifm_adapter *fm); 133void tifm_remove_adapter(struct tifm_adapter *fm);
132struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm); 134void tifm_free_adapter(struct tifm_adapter *fm);
135
136void tifm_free_device(struct device *dev);
137struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
138 unsigned char type);
139
133int tifm_register_driver(struct tifm_driver *drv); 140int tifm_register_driver(struct tifm_driver *drv);
134void tifm_unregister_driver(struct tifm_driver *drv); 141void tifm_unregister_driver(struct tifm_driver *drv);
135void tifm_eject(struct tifm_dev *sock); 142void tifm_eject(struct tifm_dev *sock);
@@ -137,11 +144,11 @@ int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
137 int direction); 144 int direction);
138void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, 145void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
139 int direction); 146 int direction);
140 147void tifm_queue_work(struct work_struct *work);
141 148
142static inline void *tifm_get_drvdata(struct tifm_dev *dev) 149static inline void *tifm_get_drvdata(struct tifm_dev *dev)
143{ 150{
144 return dev_get_drvdata(&dev->dev); 151 return dev_get_drvdata(&dev->dev);
145} 152}
146 153
147static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data) 154static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data)
@@ -149,8 +156,4 @@ static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data)
149 dev_set_drvdata(&dev->dev, data); 156 dev_set_drvdata(&dev->dev, data);
150} 157}
151 158
152struct tifm_device_id {
153 tifm_media_id media_id;
154};
155
156#endif 159#endif
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 7e08c07efe0..6de445c31a6 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,6 +26,15 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
29/* UDP socket options */ 38/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 39#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 87dc75a6cee..cfbd2bb8fa2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -299,8 +299,9 @@ struct usb_bus {
299 int bandwidth_int_reqs; /* number of Interrupt requests */ 299 int bandwidth_int_reqs; /* number of Interrupt requests */
300 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 300 int bandwidth_isoc_reqs; /* number of Isoc. requests */
301 301
302#ifdef CONFIG_USB_DEVICEFS
302 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 303 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
303 304#endif
304 struct class_device *class_dev; /* class device for this bus */ 305 struct class_device *class_dev; /* class device for this bus */
305 306
306#if defined(CONFIG_USB_MON) 307#if defined(CONFIG_USB_MON)
@@ -373,9 +374,12 @@ struct usb_device {
373 char *serial; /* iSerialNumber string, if present */ 374 char *serial; /* iSerialNumber string, if present */
374 375
375 struct list_head filelist; 376 struct list_head filelist;
376 struct device *usbfs_dev; 377#ifdef CONFIG_USB_DEVICE_CLASS
378 struct device *usb_classdev;
379#endif
380#ifdef CONFIG_USB_DEVICEFS
377 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 381 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
378 382#endif
379 /* 383 /*
380 * Child devices - these can be either new devices 384 * Child devices - these can be either new devices
381 * (if this is a hub device), or different instances 385 * (if this is a hub device), or different instances
@@ -394,10 +398,13 @@ struct usb_device {
394 struct delayed_work autosuspend; /* for delayed autosuspends */ 398 struct delayed_work autosuspend; /* for delayed autosuspends */
395 struct mutex pm_mutex; /* protects PM operations */ 399 struct mutex pm_mutex; /* protects PM operations */
396 400
397 unsigned autosuspend_delay; /* in jiffies */ 401 unsigned long last_busy; /* time of last use */
402 int autosuspend_delay; /* in jiffies */
398 403
399 unsigned auto_pm:1; /* autosuspend/resume in progress */ 404 unsigned auto_pm:1; /* autosuspend/resume in progress */
400 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 405 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
406 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
407 unsigned autoresume_disabled:1; /* disabled by the user */
401#endif 408#endif
402}; 409};
403#define to_usb_device(d) container_of(d, struct usb_device, dev) 410#define to_usb_device(d) container_of(d, struct usb_device, dev)
@@ -437,6 +444,11 @@ static inline void usb_autopm_disable(struct usb_interface *intf)
437 usb_autopm_set_interface(intf); 444 usb_autopm_set_interface(intf);
438} 445}
439 446
447static inline void usb_mark_last_busy(struct usb_device *udev)
448{
449 udev->last_busy = jiffies;
450}
451
440#else 452#else
441 453
442static inline int usb_autopm_set_interface(struct usb_interface *intf) 454static inline int usb_autopm_set_interface(struct usb_interface *intf)
@@ -451,6 +463,8 @@ static inline void usb_autopm_enable(struct usb_interface *intf)
451{ } 463{ }
452static inline void usb_autopm_disable(struct usb_interface *intf) 464static inline void usb_autopm_disable(struct usb_interface *intf)
453{ } 465{ }
466static inline void usb_mark_last_busy(struct usb_device *udev)
467{ }
454#endif 468#endif
455 469
456/*-------------------------------------------------------------------------*/ 470/*-------------------------------------------------------------------------*/
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 956edf3bbec..2204ae22c38 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -91,6 +91,17 @@ struct usb_cdc_union_desc {
91 /* ... and there could be other slave interfaces */ 91 /* ... and there could be other slave interfaces */
92} __attribute__ ((packed)); 92} __attribute__ ((packed));
93 93
94/* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */
95struct usb_cdc_country_functional_desc {
96 __u8 bLength;
97 __u8 bDescriptorType;
98 __u8 bDescriptorSubType;
99
100 __u8 iCountryCodeRelDate;
101 __le16 wCountyCode0;
102 /* ... and there can be a lot of country codes */
103} __attribute__ ((packed));
104
94/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ 105/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
95struct usb_cdc_network_terminal_desc { 106struct usb_cdc_network_terminal_desc {
96 __u8 bLength; 107 __u8 bLength;
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 1122a6c2c1a..6169438ec5a 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -181,12 +181,15 @@ struct usb_ctrlrequest {
181#define USB_DT_WIRE_ADAPTER 0x21 181#define USB_DT_WIRE_ADAPTER 0x21
182#define USB_DT_RPIPE 0x22 182#define USB_DT_RPIPE 0x22
183 183
184/* conventional codes for class-specific descriptors */ 184/* Conventional codes for class-specific descriptors. The convention is
185#define USB_DT_CS_DEVICE 0x21 185 * defined in the USB "Common Class" Spec (3.11). Individual class specs
186#define USB_DT_CS_CONFIG 0x22 186 * are authoritative for their usage, not the "common class" writeup.
187#define USB_DT_CS_STRING 0x23 187 */
188#define USB_DT_CS_INTERFACE 0x24 188#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
189#define USB_DT_CS_ENDPOINT 0x25 189#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
190#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
191#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
192#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
190 193
191/* All standard descriptors have these 2 fields at the beginning */ 194/* All standard descriptors have these 2 fields at the beginning */
192struct usb_descriptor_header { 195struct usb_descriptor_header {
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 441b877bf15..a25c2afa67e 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -96,44 +96,60 @@
96 * E N U M S 96 * E N U M S
97 */ 97 */
98enum v4l2_field { 98enum v4l2_field {
99 V4L2_FIELD_ANY = 0, /* driver can choose from none, 99 V4L2_FIELD_ANY = 0, /* driver can choose from none,
100 top, bottom, interlaced 100 top, bottom, interlaced
101 depending on whatever it thinks 101 depending on whatever it thinks
102 is approximate ... */ 102 is approximate ... */
103 V4L2_FIELD_NONE = 1, /* this device has no fields ... */ 103 V4L2_FIELD_NONE = 1, /* this device has no fields ... */
104 V4L2_FIELD_TOP = 2, /* top field only */ 104 V4L2_FIELD_TOP = 2, /* top field only */
105 V4L2_FIELD_BOTTOM = 3, /* bottom field only */ 105 V4L2_FIELD_BOTTOM = 3, /* bottom field only */
106 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ 106 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
107 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one 107 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
108 buffer, top-bottom order */ 108 buffer, top-bottom order */
109 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ 109 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
110 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into 110 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
111 separate buffers */ 111 separate buffers */
112 V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
113 first and the top field is
114 transmitted first */
115 V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
116 first and the bottom field is
117 transmitted first */
112}; 118};
113#define V4L2_FIELD_HAS_TOP(field) \ 119#define V4L2_FIELD_HAS_TOP(field) \
114 ((field) == V4L2_FIELD_TOP ||\ 120 ((field) == V4L2_FIELD_TOP ||\
115 (field) == V4L2_FIELD_INTERLACED ||\ 121 (field) == V4L2_FIELD_INTERLACED ||\
122 (field) == V4L2_FIELD_INTERLACED_TB ||\
123 (field) == V4L2_FIELD_INTERLACED_BT ||\
116 (field) == V4L2_FIELD_SEQ_TB ||\ 124 (field) == V4L2_FIELD_SEQ_TB ||\
117 (field) == V4L2_FIELD_SEQ_BT) 125 (field) == V4L2_FIELD_SEQ_BT)
118#define V4L2_FIELD_HAS_BOTTOM(field) \ 126#define V4L2_FIELD_HAS_BOTTOM(field) \
119 ((field) == V4L2_FIELD_BOTTOM ||\ 127 ((field) == V4L2_FIELD_BOTTOM ||\
120 (field) == V4L2_FIELD_INTERLACED ||\ 128 (field) == V4L2_FIELD_INTERLACED ||\
129 (field) == V4L2_FIELD_INTERLACED_TB ||\
130 (field) == V4L2_FIELD_INTERLACED_BT ||\
121 (field) == V4L2_FIELD_SEQ_TB ||\ 131 (field) == V4L2_FIELD_SEQ_TB ||\
122 (field) == V4L2_FIELD_SEQ_BT) 132 (field) == V4L2_FIELD_SEQ_BT)
123#define V4L2_FIELD_HAS_BOTH(field) \ 133#define V4L2_FIELD_HAS_BOTH(field) \
124 ((field) == V4L2_FIELD_INTERLACED ||\ 134 ((field) == V4L2_FIELD_INTERLACED ||\
125 (field) == V4L2_FIELD_SEQ_TB ||\ 135 (field) == V4L2_FIELD_INTERLACED_TB ||\
136 (field) == V4L2_FIELD_INTERLACED_BT ||\
137 (field) == V4L2_FIELD_SEQ_TB ||\
126 (field) == V4L2_FIELD_SEQ_BT) 138 (field) == V4L2_FIELD_SEQ_BT)
127 139
128enum v4l2_buf_type { 140enum v4l2_buf_type {
129 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, 141 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
130 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, 142 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
131 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, 143 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
132 V4L2_BUF_TYPE_VBI_CAPTURE = 4, 144 V4L2_BUF_TYPE_VBI_CAPTURE = 4,
133 V4L2_BUF_TYPE_VBI_OUTPUT = 5, 145 V4L2_BUF_TYPE_VBI_OUTPUT = 5,
134 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, 146 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
135 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, 147 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
136 V4L2_BUF_TYPE_PRIVATE = 0x80, 148#if 1
149 /* Experimental */
150 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
151#endif
152 V4L2_BUF_TYPE_PRIVATE = 0x80,
137}; 153};
138 154
139enum v4l2_ctrl_type { 155enum v4l2_ctrl_type {
@@ -227,6 +243,8 @@ struct v4l2_capability
227#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ 243#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
228#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ 244#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
229#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 245#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
246#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */
247#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */
230 248
231#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 249#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
232#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 250#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
@@ -249,6 +267,8 @@ struct v4l2_pix_format
249 __u32 sizeimage; 267 __u32 sizeimage;
250 enum v4l2_colorspace colorspace; 268 enum v4l2_colorspace colorspace;
251 __u32 priv; /* private data, depends on pixelformat */ 269 __u32 priv; /* private data, depends on pixelformat */
270 __u32 left; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */
271 __u32 top; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */
252}; 272};
253 273
254/* Pixel format FOURCC depth Description */ 274/* Pixel format FOURCC depth Description */
@@ -596,10 +616,14 @@ struct v4l2_framebuffer
596#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 616#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
597#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 617#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
598#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 618#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
619#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
620#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
599/* Flags for the 'flags' field. */ 621/* Flags for the 'flags' field. */
600#define V4L2_FBUF_FLAG_PRIMARY 0x0001 622#define V4L2_FBUF_FLAG_PRIMARY 0x0001
601#define V4L2_FBUF_FLAG_OVERLAY 0x0002 623#define V4L2_FBUF_FLAG_OVERLAY 0x0002
602#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 624#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
625#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
626#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
603 627
604struct v4l2_clip 628struct v4l2_clip
605{ 629{
@@ -615,6 +639,7 @@ struct v4l2_window
615 struct v4l2_clip __user *clips; 639 struct v4l2_clip __user *clips;
616 __u32 clipcount; 640 __u32 clipcount;
617 void __user *bitmap; 641 void __user *bitmap;
642 __u8 global_alpha;
618}; 643};
619 644
620/* 645/*
@@ -1037,6 +1062,7 @@ enum v4l2_mpeg_audio_crc {
1037 V4L2_MPEG_AUDIO_CRC_NONE = 0, 1062 V4L2_MPEG_AUDIO_CRC_NONE = 0,
1038 V4L2_MPEG_AUDIO_CRC_CRC16 = 1, 1063 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
1039}; 1064};
1065#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
1040 1066
1041/* MPEG video */ 1067/* MPEG video */
1042#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1068#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
@@ -1063,6 +1089,8 @@ enum v4l2_mpeg_video_bitrate_mode {
1063#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) 1089#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
1064#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) 1090#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
1065#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) 1091#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
1092#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1093#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1066 1094
1067/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ 1095/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
1068#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) 1096#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
@@ -1103,6 +1131,7 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
1103#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) 1131#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
1104#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) 1132#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
1105#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) 1133#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1134#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1106 1135
1107/* 1136/*
1108 * T U N I N G 1137 * T U N I N G
@@ -1369,6 +1398,14 @@ struct v4l2_register {
1369 __u64 val; 1398 __u64 val;
1370}; 1399};
1371 1400
1401/* VIDIOC_G_CHIP_IDENT */
1402struct v4l2_chip_ident {
1403 __u32 match_type; /* Match type */
1404 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1405 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1406 __u32 revision; /* chip revision, chip specific */
1407};
1408
1372/* 1409/*
1373 * I O C T L C O D E S F O R V I D E O D E V I C E S 1410 * I O C T L C O D E S F O R V I D E O D E V I C E S
1374 * 1411 *
@@ -1442,6 +1479,8 @@ struct v4l2_register {
1442/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1479/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1443#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) 1480#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register)
1444#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) 1481#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register)
1482
1483#define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident)
1445#endif 1484#endif
1446 1485
1447#ifdef __OLD_VIDIOC_ 1486#ifdef __OLD_VIDIOC_
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 48759b2f57d..0987aa7a6cf 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -186,7 +186,7 @@
186 * - Wireless Event capability in struct iw_range 186 * - Wireless Event capability in struct iw_range
187 * - Add support for relative TxPower (yick !) 187 * - Add support for relative TxPower (yick !)
188 * 188 *
189 * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>) 189 * V17 to V18 (From Jouni Malinen <j@w1.fi>)
190 * ---------- 190 * ----------
191 * - Add support for WPA/WPA2 191 * - Add support for WPA/WPA2
192 * - Add extended encoding configuration (SIOCSIWENCODEEXT and 192 * - Add extended encoding configuration (SIOCSIWENCODEEXT and
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 2a7b38d8701..b8abfc74d03 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -191,14 +191,15 @@ int execute_in_process_context(work_func_t fn, struct execute_work *);
191 191
192/* 192/*
193 * Kill off a pending schedule_delayed_work(). Note that the work callback 193 * Kill off a pending schedule_delayed_work(). Note that the work callback
194 * function may still be running on return from cancel_delayed_work(). Run 194 * function may still be running on return from cancel_delayed_work(), unless
195 * flush_scheduled_work() to wait on it. 195 * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or
196 * cancel_work_sync() to wait on it.
196 */ 197 */
197static inline int cancel_delayed_work(struct delayed_work *work) 198static inline int cancel_delayed_work(struct delayed_work *work)
198{ 199{
199 int ret; 200 int ret;
200 201
201 ret = del_timer_sync(&work->timer); 202 ret = del_timer(&work->timer);
202 if (ret) 203 if (ret)
203 work_release(&work->work); 204 work_release(&work->work);
204 return ret; 205 return ret;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 0c78f7f4a97..daa6c125f66 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -59,6 +59,8 @@ struct writeback_control {
59 unsigned for_reclaim:1; /* Invoked from the page allocator */ 59 unsigned for_reclaim:1; /* Invoked from the page allocator */
60 unsigned for_writepages:1; /* This is a writepages() call */ 60 unsigned for_writepages:1; /* This is a writepages() call */
61 unsigned range_cyclic:1; /* range_start is cyclic */ 61 unsigned range_cyclic:1; /* range_start is cyclic */
62
63 void *fs_private; /* For use by ->writepages() */
62}; 64};
63 65
64/* 66/*
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 15ca89e9961..b58adc52448 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -181,6 +181,15 @@ enum {
181 XFRM_MSG_MIGRATE, 181 XFRM_MSG_MIGRATE,
182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE 182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
183 183
184 XFRM_MSG_NEWSADINFO,
185#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
186 XFRM_MSG_GETSADINFO,
187#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
188
189 XFRM_MSG_NEWSPDINFO,
190#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
191 XFRM_MSG_GETSPDINFO,
192#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
184 __XFRM_MSG_MAX 193 __XFRM_MSG_MAX
185}; 194};
186#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 195#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -265,6 +274,43 @@ enum xfrm_attr_type_t {
265#define XFRMA_MAX (__XFRMA_MAX - 1) 274#define XFRMA_MAX (__XFRMA_MAX - 1)
266}; 275};
267 276
277enum xfrm_sadattr_type_t {
278 XFRMA_SAD_UNSPEC,
279 XFRMA_SAD_CNT,
280 XFRMA_SAD_HINFO,
281 __XFRMA_SAD_MAX
282
283#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
284};
285
286struct xfrmu_sadhinfo {
287 __u32 sadhcnt; /* current hash bkts */
288 __u32 sadhmcnt; /* max allowed hash bkts */
289};
290
291enum xfrm_spdattr_type_t {
292 XFRMA_SPD_UNSPEC,
293 XFRMA_SPD_INFO,
294 XFRMA_SPD_HINFO,
295 __XFRMA_SPD_MAX
296
297#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
298};
299
300struct xfrmu_spdinfo {
301 __u32 incnt;
302 __u32 outcnt;
303 __u32 fwdcnt;
304 __u32 inscnt;
305 __u32 outscnt;
306 __u32 fwdscnt;
307};
308
309struct xfrmu_spdhinfo {
310 __u32 spdhcnt;
311 __u32 spdhmcnt;
312};
313
268struct xfrm_usersa_info { 314struct xfrm_usersa_info {
269 struct xfrm_selector sel; 315 struct xfrm_selector sel;
270 struct xfrm_id id; 316 struct xfrm_id id;
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index d758a52cf55..38c12fed753 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -40,6 +40,7 @@ struct cx2341x_mpeg_params {
40 /* stream */ 40 /* stream */
41 enum v4l2_mpeg_stream_type stream_type; 41 enum v4l2_mpeg_stream_type stream_type;
42 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt; 42 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt;
43 u16 stream_insert_nav_packets;
43 44
44 /* audio */ 45 /* audio */
45 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 46 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
@@ -50,6 +51,7 @@ struct cx2341x_mpeg_params {
50 enum v4l2_mpeg_audio_emphasis audio_emphasis; 51 enum v4l2_mpeg_audio_emphasis audio_emphasis;
51 enum v4l2_mpeg_audio_crc audio_crc; 52 enum v4l2_mpeg_audio_crc audio_crc;
52 u16 audio_properties; 53 u16 audio_properties;
54 u16 audio_mute;
53 55
54 /* video */ 56 /* video */
55 enum v4l2_mpeg_video_encoding video_encoding; 57 enum v4l2_mpeg_video_encoding video_encoding;
@@ -61,6 +63,8 @@ struct cx2341x_mpeg_params {
61 u32 video_bitrate; 63 u32 video_bitrate;
62 u32 video_bitrate_peak; 64 u32 video_bitrate_peak;
63 u16 video_temporal_decimation; 65 u16 video_temporal_decimation;
66 u16 video_mute;
67 u32 video_mute_yuv;
64 68
65 /* encoding filters */ 69 /* encoding filters */
66 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode; 70 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode;
@@ -162,7 +166,7 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix);
162#define CX2341X_ENC_SET_PLACEHOLDER 0xd7 166#define CX2341X_ENC_SET_PLACEHOLDER 0xd7
163#define CX2341X_ENC_MUTE_VIDEO 0xd9 167#define CX2341X_ENC_MUTE_VIDEO 0xd9
164#define CX2341X_ENC_MUTE_AUDIO 0xda 168#define CX2341X_ENC_MUTE_AUDIO 0xda
165#define CX2341X_ENC_UNKNOWN 0xdb 169#define CX2341X_ENC_SET_VERT_CROP_LINE 0xdb
166#define CX2341X_ENC_MISC 0xdc 170#define CX2341X_ENC_MISC 0xdc
167 171
168/* OSD API, specific to the cx23415 */ 172/* OSD API, specific to the cx23415 */
diff --git a/include/media/ivtv.h b/include/media/ivtv.h
new file mode 100644
index 00000000000..412b48ea8ed
--- /dev/null
+++ b/include/media/ivtv.h
@@ -0,0 +1,65 @@
1/*
2 Public ivtv API header
3 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
4 Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _LINUX_IVTV_H
22#define _LINUX_IVTV_H
23
24/* ivtv knows several distinct output modes: MPEG streaming,
25 YUV streaming, YUV updates through user DMA and the passthrough
26 mode.
27
28 In order to clearly tell the driver that we are in user DMA
29 YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL
30 first (althrough if you don't then the first time
31 DMA_FRAME is called the mode switch is done automatically).
32
33 When you close the file handle the user DMA mode is exited again.
34
35 While in one mode, you cannot use another mode (EBUSY is returned).
36
37 All this means that if you want to change the YUV interlacing
38 for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME
39 with y_source == NULL before you can set the correct format using
40 VIDIOC_S_FMT.
41
42 Eventually all this should be replaced with a proper V4L2 API,
43 but for now we have to do it this way. */
44
45struct ivtv_dma_frame {
46 enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */
47 __u32 pixelformat; /* 0 == same as destination */
48 void __user *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT,
49 then just switch to user DMA YUV output mode */
50 void __user *uv_source; /* Unused for RGB pixelformats */
51 struct v4l2_rect src;
52 struct v4l2_rect dst;
53 __u32 src_width;
54 __u32 src_height;
55};
56
57#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
58
59/* These are the VBI types as they appear in the embedded VBI private packets. */
60#define IVTV_SLICED_TYPE_TELETEXT_B (1)
61#define IVTV_SLICED_TYPE_CAPTION_525 (4)
62#define IVTV_SLICED_TYPE_WSS_625 (5)
63#define IVTV_SLICED_TYPE_VPS (7)
64
65#endif /* _LINUX_IVTV_H */
diff --git a/include/media/ovcamchip.h b/include/media/ovcamchip.h
index 0f43451f8bb..05b9569ef1c 100644
--- a/include/media/ovcamchip.h
+++ b/include/media/ovcamchip.h
@@ -16,7 +16,6 @@
16 16
17#include <linux/videodev.h> 17#include <linux/videodev.h>
18#include <media/v4l2-common.h> 18#include <media/v4l2-common.h>
19#include <linux/i2c.h>
20 19
21/* --------------------------------- */ 20/* --------------------------------- */
22/* ENUMERATIONS */ 21/* ENUMERATIONS */
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 99acf847365..6dcf3c45707 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -23,6 +23,7 @@
23#define _TUNER_H 23#define _TUNER_H
24 24
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <linux/i2c.h>
26#include <media/tuner-types.h> 27#include <media/tuner-types.h>
27 28
28extern int tuner_debug; 29extern int tuner_debug;
@@ -177,6 +178,8 @@ struct tuner_setup {
177 unsigned short addr; /* I2C address */ 178 unsigned short addr; /* I2C address */
178 unsigned int type; /* Tuner type */ 179 unsigned int type; /* Tuner type */
179 unsigned int mode_mask; /* Allowed tuner modes */ 180 unsigned int mode_mask; /* Allowed tuner modes */
181 unsigned int config; /* configuraion for more complex tuners */
182 int (*tuner_callback) (void *dev, int command,int arg);
180}; 183};
181 184
182struct tuner { 185struct tuner {
@@ -211,6 +214,9 @@ struct tuner {
211 unsigned char tda827x_ver; 214 unsigned char tda827x_ver;
212 unsigned int sgIF; 215 unsigned int sgIF;
213 216
217 unsigned int config;
218 int (*tuner_callback) (void *dev, int command,int arg);
219
214 /* function ptrs */ 220 /* function ptrs */
215 void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); 221 void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);
216 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); 222 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
new file mode 100644
index 00000000000..09d16c4f00f
--- /dev/null
+++ b/include/media/v4l2-chip-ident.h
@@ -0,0 +1,149 @@
1/*
2 v4l2 chip identifiers header
3
4 This header provides a list of chip identifiers that can be returned
5 through the VIDIOC_G_CHIP_IDENT ioctl.
6
7 Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef V4L2_CHIP_IDENT_H_
25#define V4L2_CHIP_IDENT_H_
26
27/* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */
28enum {
29 /* general idents: reserved range 0-49 */
30 V4L2_IDENT_NONE = 0, /* No chip matched */
31 V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
32 V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */
33
34 /* module tvaudio: reserved range 50-99 */
35 V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */
36
37 /* module saa7110: just ident 100 */
38 V4L2_IDENT_SAA7110 = 100,
39
40 /* module saa7111: just ident 101 */
41 V4L2_IDENT_SAA7111 = 101,
42
43 /* module saa7115: reserved range 102-149 */
44 V4L2_IDENT_SAA7113 = 103,
45 V4L2_IDENT_SAA7114 = 104,
46 V4L2_IDENT_SAA7115 = 105,
47 V4L2_IDENT_SAA7118 = 108,
48
49 /* module saa7127: reserved range 150-199 */
50 V4L2_IDENT_SAA7127 = 157,
51 V4L2_IDENT_SAA7129 = 159,
52
53 /* module cx25840: reserved range 200-249 */
54 V4L2_IDENT_CX25836 = 236,
55 V4L2_IDENT_CX25837 = 237,
56 V4L2_IDENT_CX25840 = 240,
57 V4L2_IDENT_CX25841 = 241,
58 V4L2_IDENT_CX25842 = 242,
59 V4L2_IDENT_CX25843 = 243,
60
61 /* OmniVision sensors: reserved range 250-299 */
62 V4L2_IDENT_OV7670 = 250,
63
64 /* Conexant MPEG encoder/decoders: reserved range 410-420 */
65 V4L2_IDENT_CX23415 = 415,
66 V4L2_IDENT_CX23416 = 416,
67
68 /* module wm8739: just ident 8739 */
69 V4L2_IDENT_WM8739 = 8739,
70
71 /* module wm8775: just ident 8775 */
72 V4L2_IDENT_WM8775 = 8775,
73
74 /* module cs53132a: just ident 53132 */
75 V4L2_IDENT_CS53l32A = 53132,
76
77 /* module upd64031a: just ident 64031 */
78 V4L2_IDENT_UPD64031A = 64031,
79
80 /* module upd64083: just ident 64083 */
81 V4L2_IDENT_UPD64083 = 64083,
82
83 /* module msp34xx: reserved range 34000-34999 */
84 V4L2_IDENT_MSP3400B = 34002,
85 V4L2_IDENT_MSP3410B = 34102,
86
87 V4L2_IDENT_MSP3400C = 34003,
88 V4L2_IDENT_MSP3410C = 34103,
89
90 V4L2_IDENT_MSP3400D = 34004,
91 V4L2_IDENT_MSP3410D = 34104,
92 V4L2_IDENT_MSP3405D = 34054,
93 V4L2_IDENT_MSP3415D = 34154,
94 V4L2_IDENT_MSP3407D = 34074,
95 V4L2_IDENT_MSP3417D = 34174,
96
97 V4L2_IDENT_MSP3400G = 34007,
98 V4L2_IDENT_MSP3410G = 34107,
99 V4L2_IDENT_MSP3420G = 34207,
100 V4L2_IDENT_MSP3430G = 34307,
101 V4L2_IDENT_MSP3440G = 34407,
102 V4L2_IDENT_MSP3450G = 34507,
103 V4L2_IDENT_MSP3460G = 34607,
104
105 V4L2_IDENT_MSP3401G = 34017,
106 V4L2_IDENT_MSP3411G = 34117,
107 V4L2_IDENT_MSP3421G = 34217,
108 V4L2_IDENT_MSP3431G = 34317,
109 V4L2_IDENT_MSP3441G = 34417,
110 V4L2_IDENT_MSP3451G = 34517,
111 V4L2_IDENT_MSP3461G = 34617,
112
113 V4L2_IDENT_MSP3402G = 34027,
114 V4L2_IDENT_MSP3412G = 34127,
115 V4L2_IDENT_MSP3422G = 34227,
116 V4L2_IDENT_MSP3442G = 34427,
117 V4L2_IDENT_MSP3452G = 34527,
118
119 V4L2_IDENT_MSP3405G = 34057,
120 V4L2_IDENT_MSP3415G = 34157,
121 V4L2_IDENT_MSP3425G = 34257,
122 V4L2_IDENT_MSP3435G = 34357,
123 V4L2_IDENT_MSP3445G = 34457,
124 V4L2_IDENT_MSP3455G = 34557,
125 V4L2_IDENT_MSP3465G = 34657,
126
127 V4L2_IDENT_MSP3407G = 34077,
128 V4L2_IDENT_MSP3417G = 34177,
129 V4L2_IDENT_MSP3427G = 34277,
130 V4L2_IDENT_MSP3437G = 34377,
131 V4L2_IDENT_MSP3447G = 34477,
132 V4L2_IDENT_MSP3457G = 34577,
133 V4L2_IDENT_MSP3467G = 34677,
134
135 /* module msp44xx: reserved range 44000-44999 */
136 V4L2_IDENT_MSP4400G = 44007,
137 V4L2_IDENT_MSP4410G = 44107,
138 V4L2_IDENT_MSP4420G = 44207,
139 V4L2_IDENT_MSP4440G = 44407,
140 V4L2_IDENT_MSP4450G = 44507,
141
142 V4L2_IDENT_MSP4408G = 44087,
143 V4L2_IDENT_MSP4418G = 44187,
144 V4L2_IDENT_MSP4428G = 44287,
145 V4L2_IDENT_MSP4448G = 44487,
146 V4L2_IDENT_MSP4458G = 44587,
147};
148
149#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 6eaeec98ed8..181a40c46a5 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -98,6 +98,8 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
98 98
99struct i2c_client; /* forward reference */ 99struct i2c_client; /* forward reference */
100int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); 100int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id);
101int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip,
102 u32 ident, u32 revision);
101int v4l2_chip_match_host(u32 id_type, u32 chip_id); 103int v4l2_chip_match_host(u32 id_type, u32 chip_id);
102 104
103/* ------------------------------------------------------------------------- */ 105/* ------------------------------------------------------------------------- */
@@ -114,39 +116,6 @@ struct v4l2_decode_vbi_line {
114 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ 116 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
115}; 117};
116 118
117/* VIDIOC_INT_G_CHIP_IDENT: identifies the actual chip installed on the board */
118enum v4l2_chip_ident {
119 /* general idents: reserved range 0-49 */
120 V4L2_IDENT_UNKNOWN = 0,
121
122 /* module saa7110: just ident= 100 */
123 V4L2_IDENT_SAA7110 = 100,
124
125 /* module saa7111: just ident= 101 */
126 V4L2_IDENT_SAA7111 = 101,
127
128 /* module saa7115: reserved range 102-149 */
129 V4L2_IDENT_SAA7113 = 103,
130 V4L2_IDENT_SAA7114 = 104,
131 V4L2_IDENT_SAA7115 = 105,
132 V4L2_IDENT_SAA7118 = 108,
133
134 /* module saa7127: reserved range 150-199 */
135 V4L2_IDENT_SAA7127 = 157,
136 V4L2_IDENT_SAA7129 = 159,
137
138 /* module cx25840: reserved range 200-249 */
139 V4L2_IDENT_CX25836 = 236,
140 V4L2_IDENT_CX25837 = 237,
141 V4L2_IDENT_CX25840 = 240,
142 V4L2_IDENT_CX25841 = 241,
143 V4L2_IDENT_CX25842 = 242,
144 V4L2_IDENT_CX25843 = 243,
145
146 /* OmniVision sensors - range 250-299 */
147 V4L2_IDENT_OV7670 = 250,
148};
149
150/* audio ioctls */ 119/* audio ioctls */
151 120
152/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ 121/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
@@ -208,10 +177,6 @@ enum v4l2_chip_ident {
208 whether CC data from the first or second field should be obtained). */ 177 whether CC data from the first or second field should be obtained). */
209#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data) 178#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)
210 179
211/* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can
212 be made. */
213#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident)
214
215/* Sets I2S speed in bps. This is used to provide a standard way to select I2S 180/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
216 clock used by driving digital audio streams at some board designs. 181 clock used by driving digital audio streams at some board designs.
217 Usual values for the frequency are 1024000 and 2048000. 182 Usual values for the frequency are 1024000 and 2048000.
@@ -254,4 +219,12 @@ struct v4l2_crystal_freq {
254 default values. */ 219 default values. */
255#define VIDIOC_INT_INIT _IOW ('d', 114, u32) 220#define VIDIOC_INT_INIT _IOW ('d', 114, u32)
256 221
222/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
223 video input devices. */
224#define VIDIOC_INT_S_STD_OUTPUT _IOW ('d', 115, v4l2_std_id)
225
226/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
227 video input devices. */
228#define VIDIOC_INT_G_STD_OUTPUT _IOW ('d', 116, v4l2_std_id)
229
257#endif /* V4L2_COMMON_H_ */ 230#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 1dd3d3239ec..d62847f846c 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -127,6 +127,8 @@ struct video_device
127 struct v4l2_fmtdesc *f); 127 struct v4l2_fmtdesc *f);
128 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh, 128 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
129 struct v4l2_fmtdesc *f); 129 struct v4l2_fmtdesc *f);
130 int (*vidioc_enum_fmt_output_overlay) (struct file *file, void *fh,
131 struct v4l2_fmtdesc *f);
130 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh, 132 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
131 struct v4l2_fmtdesc *f); 133 struct v4l2_fmtdesc *f);
132 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 134 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
@@ -145,6 +147,8 @@ struct video_device
145 struct v4l2_format *f); 147 struct v4l2_format *f);
146 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh, 148 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
147 struct v4l2_format *f); 149 struct v4l2_format *f);
150 int (*vidioc_g_fmt_output_overlay) (struct file *file, void *fh,
151 struct v4l2_format *f);
148 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, 152 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
149 struct v4l2_format *f); 153 struct v4l2_format *f);
150 154
@@ -162,6 +166,8 @@ struct video_device
162 struct v4l2_format *f); 166 struct v4l2_format *f);
163 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh, 167 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
164 struct v4l2_format *f); 168 struct v4l2_format *f);
169 int (*vidioc_s_fmt_output_overlay) (struct file *file, void *fh,
170 struct v4l2_format *f);
165 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, 171 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
166 struct v4l2_format *f); 172 struct v4l2_format *f);
167 173
@@ -178,6 +184,8 @@ struct video_device
178 struct v4l2_format *f); 184 struct v4l2_format *f);
179 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh, 185 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
180 struct v4l2_format *f); 186 struct v4l2_format *f);
187 int (*vidioc_try_fmt_output_overlay)(struct file *file, void *fh,
188 struct v4l2_format *f);
181 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, 189 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
182 struct v4l2_format *f); 190 struct v4l2_format *f);
183 191
@@ -309,6 +317,8 @@ struct video_device
309 int (*vidioc_s_register) (struct file *file, void *fh, 317 int (*vidioc_s_register) (struct file *file, void *fh,
310 struct v4l2_register *reg); 318 struct v4l2_register *reg);
311#endif 319#endif
320 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
321 struct v4l2_chip_ident *chip);
312 322
313 323
314#ifdef OBSOLETE_OWNER /* to be removed soon */ 324#ifdef OBSOLETE_OWNER /* to be removed soon */
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index e0fe92b03a4..4d46b3bdebd 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -3,3 +3,5 @@ header-y += jffs2-user.h
3header-y += mtd-abi.h 3header-y += mtd-abi.h
4header-y += mtd-user.h 4header-y += mtd-user.h
5header-y += nftl-user.h 5header-y += nftl-user.h
6header-y += ubi-header.h
7header-y += ubi-user.h
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 8e501a75a76..f71dac42039 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -24,6 +24,7 @@ struct mtd_oob_buf {
24#define MTD_NORFLASH 3 24#define MTD_NORFLASH 3
25#define MTD_NANDFLASH 4 25#define MTD_NANDFLASH 4
26#define MTD_DATAFLASH 6 26#define MTD_DATAFLASH 6
27#define MTD_UBIVOLUME 7
27 28
28#define MTD_WRITEABLE 0x400 /* Device is writeable */ 29#define MTD_WRITEABLE 0x400 /* Device is writeable */
29#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ 30#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h
new file mode 100644
index 00000000000..fa479c71aa3
--- /dev/null
+++ b/include/mtd/ubi-header.h
@@ -0,0 +1,360 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
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
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Artem Bityutskiy (Битюцкий Артём)
19 * Thomas Gleixner
20 * Frank Haverkamp
21 * Oliver Lohmann
22 * Andreas Arnez
23 */
24
25/*
26 * This file defines the layout of UBI headers and all the other UBI on-flash
27 * data structures. May be included by user-space.
28 */
29
30#ifndef __UBI_HEADER_H__
31#define __UBI_HEADER_H__
32
33#include <asm/byteorder.h>
34
35/* The version of UBI images supported by this implementation */
36#define UBI_VERSION 1
37
38/* The highest erase counter value supported by this implementation */
39#define UBI_MAX_ERASECOUNTER 0x7FFFFFFF
40
41/* The initial CRC32 value used when calculating CRC checksums */
42#define UBI_CRC32_INIT 0xFFFFFFFFU
43
44/* Erase counter header magic number (ASCII "UBI#") */
45#define UBI_EC_HDR_MAGIC 0x55424923
46/* Volume identifier header magic number (ASCII "UBI!") */
47#define UBI_VID_HDR_MAGIC 0x55424921
48
49/*
50 * Volume type constants used in the volume identifier header.
51 *
52 * @UBI_VID_DYNAMIC: dynamic volume
53 * @UBI_VID_STATIC: static volume
54 */
55enum {
56 UBI_VID_DYNAMIC = 1,
57 UBI_VID_STATIC = 2
58};
59
60/*
61 * Compatibility constants used by internal volumes.
62 *
63 * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
64 * to the flash
65 * @UBI_COMPAT_RO: attach this device in read-only mode
66 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
67 * physical eraseblocks, don't allow the wear-leveling unit to move them
68 * @UBI_COMPAT_REJECT: reject this UBI image
69 */
70enum {
71 UBI_COMPAT_DELETE = 1,
72 UBI_COMPAT_RO = 2,
73 UBI_COMPAT_PRESERVE = 4,
74 UBI_COMPAT_REJECT = 5
75};
76
77/*
78 * ubi16_t/ubi32_t/ubi64_t - 16, 32, and 64-bit integers used in UBI on-flash
79 * data structures.
80 */
81typedef struct {
82 uint16_t int16;
83} __attribute__ ((packed)) ubi16_t;
84
85typedef struct {
86 uint32_t int32;
87} __attribute__ ((packed)) ubi32_t;
88
89typedef struct {
90 uint64_t int64;
91} __attribute__ ((packed)) ubi64_t;
92
93/*
94 * In this implementation of UBI uses the big-endian format for on-flash
95 * integers. The below are the corresponding conversion macros.
96 */
97#define cpu_to_ubi16(x) ((ubi16_t){__cpu_to_be16(x)})
98#define ubi16_to_cpu(x) ((uint16_t)__be16_to_cpu((x).int16))
99
100#define cpu_to_ubi32(x) ((ubi32_t){__cpu_to_be32(x)})
101#define ubi32_to_cpu(x) ((uint32_t)__be32_to_cpu((x).int32))
102
103#define cpu_to_ubi64(x) ((ubi64_t){__cpu_to_be64(x)})
104#define ubi64_to_cpu(x) ((uint64_t)__be64_to_cpu((x).int64))
105
106/* Sizes of UBI headers */
107#define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr)
108#define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr)
109
110/* Sizes of UBI headers without the ending CRC */
111#define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(ubi32_t))
112#define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(ubi32_t))
113
114/**
115 * struct ubi_ec_hdr - UBI erase counter header.
116 * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
117 * @version: version of UBI implementation which is supposed to accept this
118 * UBI image
119 * @padding1: reserved for future, zeroes
120 * @ec: the erase counter
121 * @vid_hdr_offset: where the VID header starts
122 * @data_offset: where the user data start
123 * @padding2: reserved for future, zeroes
124 * @hdr_crc: erase counter header CRC checksum
125 *
126 * The erase counter header takes 64 bytes and has a plenty of unused space for
127 * future usage. The unused fields are zeroed. The @version field is used to
128 * indicate the version of UBI implementation which is supposed to be able to
129 * work with this UBI image. If @version is greater then the current UBI
130 * version, the image is rejected. This may be useful in future if something
131 * is changed radically. This field is duplicated in the volume identifier
132 * header.
133 *
134 * The @vid_hdr_offset and @data_offset fields contain the offset of the the
135 * volume identifier header and user data, relative to the beginning of the
136 * physical eraseblock. These values have to be the same for all physical
137 * eraseblocks.
138 */
139struct ubi_ec_hdr {
140 ubi32_t magic;
141 uint8_t version;
142 uint8_t padding1[3];
143 ubi64_t ec; /* Warning: the current limit is 31-bit anyway! */
144 ubi32_t vid_hdr_offset;
145 ubi32_t data_offset;
146 uint8_t padding2[36];
147 ubi32_t hdr_crc;
148} __attribute__ ((packed));
149
150/**
151 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
152 * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
153 * @version: UBI implementation version which is supposed to accept this UBI
154 * image (%UBI_VERSION)
155 * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
156 * @copy_flag: if this logical eraseblock was copied from another physical
157 * eraseblock (for wear-leveling reasons)
158 * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
159 * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
160 * @vol_id: ID of this volume
161 * @lnum: logical eraseblock number
162 * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be
163 * removed, kept only for not breaking older UBI users)
164 * @data_size: how many bytes of data this logical eraseblock contains
165 * @used_ebs: total number of used logical eraseblocks in this volume
166 * @data_pad: how many bytes at the end of this physical eraseblock are not
167 * used
168 * @data_crc: CRC checksum of the data stored in this logical eraseblock
169 * @padding1: reserved for future, zeroes
170 * @sqnum: sequence number
171 * @padding2: reserved for future, zeroes
172 * @hdr_crc: volume identifier header CRC checksum
173 *
174 * The @sqnum is the value of the global sequence counter at the time when this
175 * VID header was created. The global sequence counter is incremented each time
176 * UBI writes a new VID header to the flash, i.e. when it maps a logical
177 * eraseblock to a new physical eraseblock. The global sequence counter is an
178 * unsigned 64-bit integer and we assume it never overflows. The @sqnum
179 * (sequence number) is used to distinguish between older and newer versions of
180 * logical eraseblocks.
181 *
182 * There are 2 situations when there may be more then one physical eraseblock
183 * corresponding to the same logical eraseblock, i.e., having the same @vol_id
184 * and @lnum values in the volume identifier header. Suppose we have a logical
185 * eraseblock L and it is mapped to the physical eraseblock P.
186 *
187 * 1. Because UBI may erase physical eraseblocks asynchronously, the following
188 * situation is possible: L is asynchronously erased, so P is scheduled for
189 * erasure, then L is written to,i.e. mapped to another physical eraseblock P1,
190 * so P1 is written to, then an unclean reboot happens. Result - there are 2
191 * physical eraseblocks P and P1 corresponding to the same logical eraseblock
192 * L. But P1 has greater sequence number, so UBI picks P1 when it attaches the
193 * flash.
194 *
195 * 2. From time to time UBI moves logical eraseblocks to other physical
196 * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P
197 * to P1, and an unclean reboot happens before P is physically erased, there
198 * are two physical eraseblocks P and P1 corresponding to L and UBI has to
199 * select one of them when the flash is attached. The @sqnum field says which
200 * PEB is the original (obviously P will have lower @sqnum) and the copy. But
201 * it is not enough to select the physical eraseblock with the higher sequence
202 * number, because the unclean reboot could have happen in the middle of the
203 * copying process, so the data in P is corrupted. It is also not enough to
204 * just select the physical eraseblock with lower sequence number, because the
205 * data there may be old (consider a case if more data was added to P1 after
206 * the copying). Moreover, the unclean reboot may happen when the erasure of P
207 * was just started, so it result in unstable P, which is "mostly" OK, but
208 * still has unstable bits.
209 *
210 * UBI uses the @copy_flag field to indicate that this logical eraseblock is a
211 * copy. UBI also calculates data CRC when the data is moved and stores it at
212 * the @data_crc field of the copy (P1). So when UBI needs to pick one physical
213 * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is
214 * examined. If it is cleared, the situation* is simple and the newer one is
215 * picked. If it is set, the data CRC of the copy (P1) is examined. If the CRC
216 * checksum is correct, this physical eraseblock is selected (P1). Otherwise
217 * the older one (P) is selected.
218 *
219 * Note, there is an obsolete @leb_ver field which was used instead of @sqnum
220 * in the past. But it is not used anymore and we keep it in order to be able
221 * to deal with old UBI images. It will be removed at some point.
222 *
223 * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
224 * Internal volumes are not seen from outside and are used for various internal
225 * UBI purposes. In this implementation there is only one internal volume - the
226 * layout volume. Internal volumes are the main mechanism of UBI extensions.
227 * For example, in future one may introduce a journal internal volume. Internal
228 * volumes have their own reserved range of IDs.
229 *
230 * The @compat field is only used for internal volumes and contains the "degree
231 * of their compatibility". It is always zero for user volumes. This field
232 * provides a mechanism to introduce UBI extensions and to be still compatible
233 * with older UBI binaries. For example, if someone introduced a journal in
234 * future, he would probably use %UBI_COMPAT_DELETE compatibility for the
235 * journal volume. And in this case, older UBI binaries, which know nothing
236 * about the journal volume, would just delete this volume and work perfectly
237 * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image
238 * - it just ignores the Ext3fs journal.
239 *
240 * The @data_crc field contains the CRC checksum of the contents of the logical
241 * eraseblock if this is a static volume. In case of dynamic volumes, it does
242 * not contain the CRC checksum as a rule. The only exception is when the
243 * data of the physical eraseblock was moved by the wear-leveling unit, then
244 * the wear-leveling unit calculates the data CRC and stores it in the
245 * @data_crc field. And of course, the @copy_flag is %in this case.
246 *
247 * The @data_size field is used only for static volumes because UBI has to know
248 * how many bytes of data are stored in this eraseblock. For dynamic volumes,
249 * this field usually contains zero. The only exception is when the data of the
250 * physical eraseblock was moved to another physical eraseblock for
251 * wear-leveling reasons. In this case, UBI calculates CRC checksum of the
252 * contents and uses both @data_crc and @data_size fields. In this case, the
253 * @data_size field contains data size.
254 *
255 * The @used_ebs field is used only for static volumes and indicates how many
256 * eraseblocks the data of the volume takes. For dynamic volumes this field is
257 * not used and always contains zero.
258 *
259 * The @data_pad is calculated when volumes are created using the alignment
260 * parameter. So, effectively, the @data_pad field reduces the size of logical
261 * eraseblocks of this volume. This is very handy when one uses block-oriented
262 * software (say, cramfs) on top of the UBI volume.
263 */
264struct ubi_vid_hdr {
265 ubi32_t magic;
266 uint8_t version;
267 uint8_t vol_type;
268 uint8_t copy_flag;
269 uint8_t compat;
270 ubi32_t vol_id;
271 ubi32_t lnum;
272 ubi32_t leb_ver; /* obsolete, to be removed, don't use */
273 ubi32_t data_size;
274 ubi32_t used_ebs;
275 ubi32_t data_pad;
276 ubi32_t data_crc;
277 uint8_t padding1[4];
278 ubi64_t sqnum;
279 uint8_t padding2[12];
280 ubi32_t hdr_crc;
281} __attribute__ ((packed));
282
283/* Internal UBI volumes count */
284#define UBI_INT_VOL_COUNT 1
285
286/*
287 * Starting ID of internal volumes. There is reserved room for 4096 internal
288 * volumes.
289 */
290#define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096)
291
292/* The layout volume contains the volume table */
293
294#define UBI_LAYOUT_VOL_ID UBI_INTERNAL_VOL_START
295#define UBI_LAYOUT_VOLUME_EBS 2
296#define UBI_LAYOUT_VOLUME_NAME "layout volume"
297#define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
298
299/* The maximum number of volumes per one UBI device */
300#define UBI_MAX_VOLUMES 128
301
302/* The maximum volume name length */
303#define UBI_VOL_NAME_MAX 127
304
305/* Size of the volume table record */
306#define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record)
307
308/* Size of the volume table record without the ending CRC */
309#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(ubi32_t))
310
311/**
312 * struct ubi_vtbl_record - a record in the volume table.
313 * @reserved_pebs: how many physical eraseblocks are reserved for this volume
314 * @alignment: volume alignment
315 * @data_pad: how many bytes are unused at the end of the each physical
316 * eraseblock to satisfy the requested alignment
317 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
318 * @upd_marker: if volume update was started but not finished
319 * @name_len: volume name length
320 * @name: the volume name
321 * @padding2: reserved, zeroes
322 * @crc: a CRC32 checksum of the record
323 *
324 * The volume table records are stored in the volume table, which is stored in
325 * the layout volume. The layout volume consists of 2 logical eraseblock, each
326 * of which contains a copy of the volume table (i.e., the volume table is
327 * duplicated). The volume table is an array of &struct ubi_vtbl_record
328 * objects indexed by the volume ID.
329 *
330 * If the size of the logical eraseblock is large enough to fit
331 * %UBI_MAX_VOLUMES records, the volume table contains %UBI_MAX_VOLUMES
332 * records. Otherwise, it contains as many records as it can fit (i.e., size of
333 * logical eraseblock divided by sizeof(struct ubi_vtbl_record)).
334 *
335 * The @upd_marker flag is used to implement volume update. It is set to %1
336 * before update and set to %0 after the update. So if the update operation was
337 * interrupted, UBI knows that the volume is corrupted.
338 *
339 * The @alignment field is specified when the volume is created and cannot be
340 * later changed. It may be useful, for example, when a block-oriented file
341 * system works on top of UBI. The @data_pad field is calculated using the
342 * logical eraseblock size and @alignment. The alignment must be multiple to the
343 * minimal flash I/O unit. If @alignment is 1, all the available space of
344 * the physical eraseblocks is used.
345 *
346 * Empty records contain all zeroes and the CRC checksum of those zeroes.
347 */
348struct ubi_vtbl_record {
349 ubi32_t reserved_pebs;
350 ubi32_t alignment;
351 ubi32_t data_pad;
352 uint8_t vol_type;
353 uint8_t upd_marker;
354 ubi16_t name_len;
355 uint8_t name[UBI_VOL_NAME_MAX+1];
356 uint8_t padding2[24];
357 ubi32_t crc;
358} __attribute__ ((packed));
359
360#endif /* !__UBI_HEADER_H__ */
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
new file mode 100644
index 00000000000..fe06ded0e6b
--- /dev/null
+++ b/include/mtd/ubi-user.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
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
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Artem Bityutskiy (Битюцкий Артём)
19 */
20
21#ifndef __UBI_USER_H__
22#define __UBI_USER_H__
23
24/*
25 * UBI volume creation
26 * ~~~~~~~~~~~~~~~~~~~
27 *
28 * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character
29 * device. A &struct ubi_mkvol_req object has to be properly filled and a
30 * pointer to it has to be passed to the IOCTL.
31 *
32 * UBI volume deletion
33 * ~~~~~~~~~~~~~~~~~~~
34 *
35 * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character
36 * device should be used. A pointer to the 32-bit volume ID hast to be passed
37 * to the IOCTL.
38 *
39 * UBI volume re-size
40 * ~~~~~~~~~~~~~~~~~~
41 *
42 * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character
43 * device should be used. A &struct ubi_rsvol_req object has to be properly
44 * filled and a pointer to it has to be passed to the IOCTL.
45 *
46 * UBI volume update
47 * ~~~~~~~~~~~~~~~~~
48 *
49 * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the
50 * corresponding UBI volume character device. A pointer to a 64-bit update
51 * size should be passed to the IOCTL. After then, UBI expects user to write
52 * this number of bytes to the volume character device. The update is finished
53 * when the claimed number of bytes is passed. So, the volume update sequence
54 * is something like:
55 *
56 * fd = open("/dev/my_volume");
57 * ioctl(fd, UBI_IOCVOLUP, &image_size);
58 * write(fd, buf, image_size);
59 * close(fd);
60 */
61
62/*
63 * When a new volume is created, users may either specify the volume number they
64 * want to create or to let UBI automatically assign a volume number using this
65 * constant.
66 */
67#define UBI_VOL_NUM_AUTO (-1)
68
69/* Maximum volume name length */
70#define UBI_MAX_VOLUME_NAME 127
71
72/* IOCTL commands of UBI character devices */
73
74#define UBI_IOC_MAGIC 'o'
75
76/* Create an UBI volume */
77#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
78/* Remove an UBI volume */
79#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t)
80/* Re-size an UBI volume */
81#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
82
83/* IOCTL commands of UBI volume character devices */
84
85#define UBI_VOL_IOC_MAGIC 'O'
86
87/* Start UBI volume update */
88#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
89/* An eraseblock erasure command, used for debugging, disabled by default */
90#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
91
92/*
93 * UBI volume type constants.
94 *
95 * @UBI_DYNAMIC_VOLUME: dynamic volume
96 * @UBI_STATIC_VOLUME: static volume
97 */
98enum {
99 UBI_DYNAMIC_VOLUME = 3,
100 UBI_STATIC_VOLUME = 4
101};
102
103/**
104 * struct ubi_mkvol_req - volume description data structure used in
105 * volume creation requests.
106 * @vol_id: volume number
107 * @alignment: volume alignment
108 * @bytes: volume size in bytes
109 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
110 * @padding1: reserved for future, not used
111 * @name_len: volume name length
112 * @padding2: reserved for future, not used
113 * @name: volume name
114 *
115 * This structure is used by userspace programs when creating new volumes. The
116 * @used_bytes field is only necessary when creating static volumes.
117 *
118 * The @alignment field specifies the required alignment of the volume logical
119 * eraseblock. This means, that the size of logical eraseblocks will be aligned
120 * to this number, i.e.,
121 * (UBI device logical eraseblock size) mod (@alignment) = 0.
122 *
123 * To put it differently, the logical eraseblock of this volume may be slightly
124 * shortened in order to make it properly aligned. The alignment has to be
125 * multiple of the flash minimal input/output unit, or %1 to utilize the entire
126 * available space of logical eraseblocks.
127 *
128 * The @alignment field may be useful, for example, when one wants to maintain
129 * a block device on top of an UBI volume. In this case, it is desirable to fit
130 * an integer number of blocks in logical eraseblocks of this UBI volume. With
131 * alignment it is possible to update this volume using plane UBI volume image
132 * BLOBs, without caring about how to properly align them.
133 */
134struct ubi_mkvol_req {
135 int32_t vol_id;
136 int32_t alignment;
137 int64_t bytes;
138 int8_t vol_type;
139 int8_t padding1;
140 int16_t name_len;
141 int8_t padding2[4];
142 char name[UBI_MAX_VOLUME_NAME+1];
143} __attribute__ ((packed));
144
145/**
146 * struct ubi_rsvol_req - a data structure used in volume re-size requests.
147 * @vol_id: ID of the volume to re-size
148 * @bytes: new size of the volume in bytes
149 *
150 * Re-sizing is possible for both dynamic and static volumes. But while dynamic
151 * volumes may be re-sized arbitrarily, static volumes cannot be made to be
152 * smaller then the number of bytes they bear. To arbitrarily shrink a static
153 * volume, it must be wiped out first (by means of volume update operation with
154 * zero number of bytes).
155 */
156struct ubi_rsvol_req {
157 int64_t bytes;
158 int32_t vol_id;
159} __attribute__ ((packed));
160
161#endif /* __UBI_USER_H__ */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 88df8fc814e..f3531d0bcd0 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -73,7 +73,9 @@ extern int ipv6_get_saddr(struct dst_entry *dst,
73extern int ipv6_dev_get_saddr(struct net_device *dev, 73extern int ipv6_dev_get_saddr(struct net_device *dev,
74 struct in6_addr *daddr, 74 struct in6_addr *daddr,
75 struct in6_addr *saddr); 75 struct in6_addr *saddr);
76extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *); 76extern int ipv6_get_lladdr(struct net_device *dev,
77 struct in6_addr *addr,
78 unsigned char banned_flags);
77extern int ipv6_rcv_saddr_equal(const struct sock *sk, 79extern int ipv6_rcv_saddr_equal(const struct sock *sk,
78 const struct sock *sk2); 80 const struct sock *sk2);
79extern void addrconf_join_solict(struct net_device *dev, 81extern void addrconf_join_solict(struct net_device *dev,
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
new file mode 100644
index 00000000000..00c2eaa07c2
--- /dev/null
+++ b/include/net/af_rxrpc.h
@@ -0,0 +1,57 @@
1/* RxRPC kernel service interface definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _NET_RXRPC_H
13#define _NET_RXRPC_H
14
15#ifdef __KERNEL__
16
17#include <linux/rxrpc.h>
18
19struct rxrpc_call;
20
21/*
22 * the mark applied to socket buffers that may be intercepted
23 */
24enum {
25 RXRPC_SKB_MARK_DATA, /* data message */
26 RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */
27 RXRPC_SKB_MARK_BUSY, /* server busy message */
28 RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */
29 RXRPC_SKB_MARK_NET_ERROR, /* network error message */
30 RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */
31 RXRPC_SKB_MARK_NEW_CALL, /* local error message */
32};
33
34typedef void (*rxrpc_interceptor_t)(struct sock *, unsigned long,
35 struct sk_buff *);
36extern void rxrpc_kernel_intercept_rx_messages(struct socket *,
37 rxrpc_interceptor_t);
38extern struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
39 struct sockaddr_rxrpc *,
40 struct key *,
41 unsigned long,
42 gfp_t);
43extern int rxrpc_kernel_send_data(struct rxrpc_call *, struct msghdr *,
44 size_t);
45extern void rxrpc_kernel_abort_call(struct rxrpc_call *, u32);
46extern void rxrpc_kernel_end_call(struct rxrpc_call *);
47extern bool rxrpc_kernel_is_data_last(struct sk_buff *);
48extern u32 rxrpc_kernel_get_abort_code(struct sk_buff *);
49extern int rxrpc_kernel_get_error_number(struct sk_buff *);
50extern void rxrpc_kernel_data_delivered(struct sk_buff *);
51extern void rxrpc_kernel_free_skb(struct sk_buff *);
52extern struct rxrpc_call *rxrpc_kernel_accept_call(struct socket *,
53 unsigned long);
54extern int rxrpc_kernel_reject_call(struct socket *);
55
56#endif /* __KERNEL__ */
57#endif /* _NET_RXRPC_H */
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 47ff2f46e90..99a4e364c74 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -263,8 +263,8 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25)
263static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) 263static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
264{ 264{
265 skb->dev = dev; 265 skb->dev = dev;
266 skb_reset_mac_header(skb);
266 skb->pkt_type = PACKET_HOST; 267 skb->pkt_type = PACKET_HOST;
267 skb->mac.raw = skb->data;
268 return htons(ETH_P_AX25); 268 return htons(ETH_P_AX25);
269} 269}
270 270
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 41456c14884..93ce272a5d2 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -709,6 +709,24 @@ struct hci_sco_hdr {
709 __u8 dlen; 709 __u8 dlen;
710} __attribute__ ((packed)); 710} __attribute__ ((packed));
711 711
712#ifdef __KERNEL__
713#include <linux/skbuff.h>
714static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
715{
716 return (struct hci_event_hdr *)skb->data;
717}
718
719static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
720{
721 return (struct hci_acl_hdr *)skb->data;
722}
723
724static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
725{
726 return (struct hci_sco_hdr *)skb->data;
727}
728#endif
729
712/* Command opcode pack/unpack */ 730/* Command opcode pack/unpack */
713#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 731#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
714#define hci_opcode_ogf(op) (op >> 10) 732#define hci_opcode_ogf(op) (op >> 10)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
new file mode 100644
index 00000000000..88171f8ce58
--- /dev/null
+++ b/include/net/cfg80211.h
@@ -0,0 +1,40 @@
1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H
3
4#include <linux/netlink.h>
5#include <linux/skbuff.h>
6#include <net/genetlink.h>
7
8/*
9 * 802.11 configuration in-kernel interface
10 *
11 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
12 */
13
14/* from net/wireless.h */
15struct wiphy;
16
17/**
18 * struct cfg80211_ops - backend description for wireless configuration
19 *
20 * This struct is registered by fullmac card drivers and/or wireless stacks
21 * in order to handle configuration requests on their interfaces.
22 *
23 * All callbacks except where otherwise noted should return 0
24 * on success or a negative error code.
25 *
26 * All operations are currently invoked under rtnl for consistency with the
27 * wireless extensions but this is subject to reevaluation as soon as this
28 * code is used more widely and we have a first user without wext.
29 *
30 * @add_virtual_intf: create a new virtual interface with the given name
31 *
32 * @del_virtual_intf: remove the virtual interface determined by ifindex.
33 */
34struct cfg80211_ops {
35 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
36 unsigned int type);
37 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
38};
39
40#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 4c9522c5178..4f90f5554fa 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -120,7 +120,7 @@ extern int cipso_v4_rbm_strictvalid;
120 */ 120 */
121 121
122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) 122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0)
123#define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) 123#define CIPSO_V4_OPTPTR(x) (skb_network_header(x) + IPCB(x)->opt.cipso)
124 124
125/* 125/*
126 * DOI List Functions 126 * DOI List Functions
diff --git a/include/net/compat.h b/include/net/compat.h
index 9859b60280d..406db242f73 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -25,6 +25,7 @@ struct compat_cmsghdr {
25}; 25};
26 26
27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
28extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
28 29
29#else /* defined(CONFIG_COMPAT) */ 30#else /* defined(CONFIG_COMPAT) */
30#define compat_msghdr msghdr /* to avoid compiler warnings */ 31#define compat_msghdr msghdr /* to avoid compiler warnings */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index f01626cbbed..30125119c95 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void);
148extern unsigned dnet_addr_type(__le16 addr); 148extern unsigned dnet_addr_type(__le16 addr);
149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); 149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
150 150
151/*
152 * rtnetlink interface
153 */
154extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
155extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
156extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 151extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
157 152
158extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
159extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
160extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
161
162extern void dn_fib_free_info(struct dn_fib_info *fi); 153extern void dn_fib_free_info(struct dn_fib_info *fi);
163 154
164static inline void dn_fib_info_put(struct dn_fib_info *fi) 155static inline void dn_fib_info_put(struct dn_fib_info *fi)
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index a566944c496..c10e8e7e59a 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -18,7 +18,6 @@
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
22extern void dn_rt_cache_flush(int delay); 21extern void dn_rt_cache_flush(int delay);
23 22
24/* Masks for flags field */ 23/* Masks for flags field */
diff --git a/include/net/esp.h b/include/net/esp.h
index 713d039f4af..d05d8d2c78f 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -40,8 +40,6 @@ struct esp_data
40 } auth; 40 } auth;
41}; 41};
42 42
43extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len);
44extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
45extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 43extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
46 44
47static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, 45static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index d585ea9fa97..ed3a8872c6c 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -5,7 +5,7 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 6#include <linux/fib_rules.h>
7#include <net/flow.h> 7#include <net/flow.h>
8#include <net/netlink.h> 8#include <net/rtnetlink.h>
9 9
10struct fib_rule 10struct fib_rule
11{ 11{
@@ -19,6 +19,8 @@ struct fib_rule
19 u32 flags; 19 u32 flags;
20 u32 table; 20 u32 table;
21 u8 action; 21 u8 action;
22 u32 target;
23 struct fib_rule * ctarget;
22 struct rcu_head rcu; 24 struct rcu_head rcu;
23}; 25};
24 26
@@ -35,6 +37,8 @@ struct fib_rules_ops
35 struct list_head list; 37 struct list_head list;
36 int rule_size; 38 int rule_size;
37 int addr_size; 39 int addr_size;
40 int unresolved_rules;
41 int nr_goto_rules;
38 42
39 int (*action)(struct fib_rule *, 43 int (*action)(struct fib_rule *,
40 struct flowi *, int, 44 struct flowi *, int,
@@ -55,6 +59,10 @@ struct fib_rules_ops
55 u32 (*default_pref)(void); 59 u32 (*default_pref)(void);
56 size_t (*nlmsg_payload)(struct fib_rule *); 60 size_t (*nlmsg_payload)(struct fib_rule *);
57 61
62 /* Called after modifications to the rules set, must flush
63 * the route cache if one exists. */
64 void (*flush_cache)(void);
65
58 int nlgroup; 66 int nlgroup;
59 struct nla_policy *policy; 67 struct nla_policy *policy;
60 struct list_head *rules_list; 68 struct list_head *rules_list;
@@ -66,7 +74,8 @@ struct fib_rules_ops
66 [FRA_PRIORITY] = { .type = NLA_U32 }, \ 74 [FRA_PRIORITY] = { .type = NLA_U32 }, \
67 [FRA_FWMARK] = { .type = NLA_U32 }, \ 75 [FRA_FWMARK] = { .type = NLA_U32 }, \
68 [FRA_FWMASK] = { .type = NLA_U32 }, \ 76 [FRA_FWMASK] = { .type = NLA_U32 }, \
69 [FRA_TABLE] = { .type = NLA_U32 } 77 [FRA_TABLE] = { .type = NLA_U32 }, \
78 [FRA_GOTO] = { .type = NLA_U32 }
70 79
71static inline void fib_rule_get(struct fib_rule *rule) 80static inline void fib_rule_get(struct fib_rule *rule)
72{ 81{
@@ -98,11 +107,4 @@ extern int fib_rules_unregister(struct fib_rules_ops *);
98extern int fib_rules_lookup(struct fib_rules_ops *, 107extern int fib_rules_lookup(struct fib_rules_ops *,
99 struct flowi *, int flags, 108 struct flowi *, int flags,
100 struct fib_lookup_arg *); 109 struct fib_lookup_arg *);
101
102extern int fib_nl_newrule(struct sk_buff *,
103 struct nlmsghdr *, void *);
104extern int fib_nl_delrule(struct sk_buff *,
105 struct nlmsghdr *, void *);
106extern int fib_rules_dump(struct sk_buff *,
107 struct netlink_callback *, int);
108#endif 110#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index ce4b10d8b41..f3cc1f81261 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -97,4 +97,10 @@ extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
97extern void flow_cache_flush(void); 97extern void flow_cache_flush(void);
98extern atomic_t flow_cache_genid; 98extern atomic_t flow_cache_genid;
99 99
100static inline int flow_cache_uli_match(struct flowi *fl1, struct flowi *fl2)
101{
102 return (fl1->proto == fl2->proto &&
103 !memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u)));
104}
105
100#endif 106#endif
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index e02d85f56e6..d56b2923d61 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -6,8 +6,8 @@
6 * LAN access point) driver for Intersil Prism2/2.5/3. 6 * LAN access point) driver for Intersil Prism2/2.5/3.
7 * 7 *
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <jkmaline@cc.hut.fi> 9 * <j@w1.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 10 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11 * 11 *
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos 12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com> 13 * <jketreno@linux.intel.com>
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index eb476414fd7..b3d65e0bedd 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -3,8 +3,8 @@
3 * for Intersil Prism2/2.5/3. 3 * for Intersil Prism2/2.5/3.
4 * 4 *
5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
6 * <jkmaline@cc.hut.fi> 6 * <j@w1.fi>
7 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 7 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
8 * 8 *
9 * Adaption to a generic IEEE 802.11 stack by James Ketrenos 9 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
10 * <jketreno@linux.intel.com> 10 * <jketreno@linux.intel.com>
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 429b73892a5..a0c2b41a24d 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -66,7 +66,9 @@
66 */ 66 */
67#define IEEE80211_RADIOTAP_HDRLEN 64 67#define IEEE80211_RADIOTAP_HDRLEN 64
68 68
69/* The radio capture header precedes the 802.11 header. */ 69/* The radio capture header precedes the 802.11 header.
70 * All data in the header is little endian on all platforms.
71 */
70struct ieee80211_radiotap_header { 72struct ieee80211_radiotap_header {
71 u8 it_version; /* Version 0. Only increases 73 u8 it_version; /* Version 0. Only increases
72 * for drastic changes, 74 * for drastic changes,
@@ -74,12 +76,12 @@ struct ieee80211_radiotap_header {
74 * new fields does not count. 76 * new fields does not count.
75 */ 77 */
76 u8 it_pad; 78 u8 it_pad;
77 u16 it_len; /* length of the whole 79 __le16 it_len; /* length of the whole
78 * header in bytes, including 80 * header in bytes, including
79 * it_version, it_pad, 81 * it_version, it_pad,
80 * it_len, and data fields. 82 * it_len, and data fields.
81 */ 83 */
82 u32 it_present; /* A bitmap telling which 84 __le32 it_present; /* A bitmap telling which
83 * fields are present. Set bit 31 85 * fields are present. Set bit 31
84 * (0x80000000) to extend the 86 * (0x80000000) to extend the
85 * bitmap by another 32 bits. 87 * bitmap by another 32 bits.
@@ -88,89 +90,102 @@ struct ieee80211_radiotap_header {
88 */ 90 */
89}; 91};
90 92
91/* Name Data type Units 93/* Name Data type Units
92 * ---- --------- ----- 94 * ---- --------- -----
93 * 95 *
94 * IEEE80211_RADIOTAP_TSFT u64 microseconds 96 * IEEE80211_RADIOTAP_TSFT __le64 microseconds
95 * 97 *
96 * Value in microseconds of the MAC's 64-bit 802.11 Time 98 * Value in microseconds of the MAC's 64-bit 802.11 Time
97 * Synchronization Function timer when the first bit of the 99 * Synchronization Function timer when the first bit of the
98 * MPDU arrived at the MAC. For received frames, only. 100 * MPDU arrived at the MAC. For received frames, only.
99 * 101 *
100 * IEEE80211_RADIOTAP_CHANNEL 2 x u16 MHz, bitmap 102 * IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap
101 * 103 *
102 * Tx/Rx frequency in MHz, followed by flags (see below). 104 * Tx/Rx frequency in MHz, followed by flags (see below).
103 * 105 *
104 * IEEE80211_RADIOTAP_FHSS u16 see below 106 * IEEE80211_RADIOTAP_FHSS __le16 see below
105 * 107 *
106 * For frequency-hopping radios, the hop set (first byte) 108 * For frequency-hopping radios, the hop set (first byte)
107 * and pattern (second byte). 109 * and pattern (second byte).
108 * 110 *
109 * IEEE80211_RADIOTAP_RATE u8 500kb/s 111 * IEEE80211_RADIOTAP_RATE u8 500kb/s
110 * 112 *
111 * Tx/Rx data rate 113 * Tx/Rx data rate
112 * 114 *
113 * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from 115 * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from
114 * one milliwatt (dBm) 116 * one milliwatt (dBm)
115 * 117 *
116 * RF signal power at the antenna, decibel difference from 118 * RF signal power at the antenna, decibel difference from
117 * one milliwatt. 119 * one milliwatt.
118 * 120 *
119 * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from 121 * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from
120 * one milliwatt (dBm) 122 * one milliwatt (dBm)
121 * 123 *
122 * RF noise power at the antenna, decibel difference from one 124 * RF noise power at the antenna, decibel difference from one
123 * milliwatt. 125 * milliwatt.
124 * 126 *
125 * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) 127 * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB)
126 * 128 *
127 * RF signal power at the antenna, decibel difference from an 129 * RF signal power at the antenna, decibel difference from an
128 * arbitrary, fixed reference. 130 * arbitrary, fixed reference.
129 * 131 *
130 * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) 132 * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB)
131 * 133 *
132 * RF noise power at the antenna, decibel difference from an 134 * RF noise power at the antenna, decibel difference from an
133 * arbitrary, fixed reference point. 135 * arbitrary, fixed reference point.
134 * 136 *
135 * IEEE80211_RADIOTAP_LOCK_QUALITY u16 unitless 137 * IEEE80211_RADIOTAP_LOCK_QUALITY __le16 unitless
136 * 138 *
137 * Quality of Barker code lock. Unitless. Monotonically 139 * Quality of Barker code lock. Unitless. Monotonically
138 * nondecreasing with "better" lock strength. Called "Signal 140 * nondecreasing with "better" lock strength. Called "Signal
139 * Quality" in datasheets. (Is there a standard way to measure 141 * Quality" in datasheets. (Is there a standard way to measure
140 * this?) 142 * this?)
141 * 143 *
142 * IEEE80211_RADIOTAP_TX_ATTENUATION u16 unitless 144 * IEEE80211_RADIOTAP_TX_ATTENUATION __le16 unitless
143 * 145 *
144 * Transmit power expressed as unitless distance from max 146 * Transmit power expressed as unitless distance from max
145 * power set at factory calibration. 0 is max power. 147 * power set at factory calibration. 0 is max power.
146 * Monotonically nondecreasing with lower power levels. 148 * Monotonically nondecreasing with lower power levels.
147 * 149 *
148 * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u16 decibels (dB) 150 * IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16 decibels (dB)
149 * 151 *
150 * Transmit power expressed as decibel distance from max power 152 * Transmit power expressed as decibel distance from max power
151 * set at factory calibration. 0 is max power. Monotonically 153 * set at factory calibration. 0 is max power. Monotonically
152 * nondecreasing with lower power levels. 154 * nondecreasing with lower power levels.
153 * 155 *
154 * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from 156 * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from
155 * one milliwatt (dBm) 157 * one milliwatt (dBm)
156 * 158 *
157 * Transmit power expressed as dBm (decibels from a 1 milliwatt 159 * Transmit power expressed as dBm (decibels from a 1 milliwatt
158 * reference). This is the absolute power level measured at 160 * reference). This is the absolute power level measured at
159 * the antenna port. 161 * the antenna port.
160 * 162 *
161 * IEEE80211_RADIOTAP_FLAGS u8 bitmap 163 * IEEE80211_RADIOTAP_FLAGS u8 bitmap
162 * 164 *
163 * Properties of transmitted and received frames. See flags 165 * Properties of transmitted and received frames. See flags
164 * defined below. 166 * defined below.
165 * 167 *
166 * IEEE80211_RADIOTAP_ANTENNA u8 antenna index 168 * IEEE80211_RADIOTAP_ANTENNA u8 antenna index
167 * 169 *
168 * Unitless indication of the Rx/Tx antenna for this packet. 170 * Unitless indication of the Rx/Tx antenna for this packet.
169 * The first antenna is antenna 0. 171 * The first antenna is antenna 0.
170 * 172 *
171 * IEEE80211_RADIOTAP_FCS u32 data 173 * IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap
174 *
175 * Properties of received frames. See flags defined below.
176 *
177 * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap
178 *
179 * Properties of transmitted frames. See flags defined below.
180 *
181 * IEEE80211_RADIOTAP_RTS_RETRIES u8 data
182 *
183 * Number of rts retries a transmitted frame used.
184 *
185 * IEEE80211_RADIOTAP_DATA_RETRIES u8 data
186 *
187 * Number of unicast retries a transmitted frame used.
172 * 188 *
173 * FCS from frame in network byte order.
174 */ 189 */
175enum ieee80211_radiotap_type { 190enum ieee80211_radiotap_type {
176 IEEE80211_RADIOTAP_TSFT = 0, 191 IEEE80211_RADIOTAP_TSFT = 0,
@@ -187,7 +202,11 @@ enum ieee80211_radiotap_type {
187 IEEE80211_RADIOTAP_ANTENNA = 11, 202 IEEE80211_RADIOTAP_ANTENNA = 11,
188 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 203 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
189 IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 204 IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
190 IEEE80211_RADIOTAP_EXT = 31, 205 IEEE80211_RADIOTAP_RX_FLAGS = 14,
206 IEEE80211_RADIOTAP_TX_FLAGS = 15,
207 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
208 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
209 IEEE80211_RADIOTAP_EXT = 31
191}; 210};
192 211
193/* Channel flags. */ 212/* Channel flags. */
@@ -219,6 +238,14 @@ enum ieee80211_radiotap_type {
219 * 802.11 header and payload 238 * 802.11 header and payload
220 * (to 32-bit boundary) 239 * (to 32-bit boundary)
221 */ 240 */
241/* For IEEE80211_RADIOTAP_RX_FLAGS */
242#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
243
244/* For IEEE80211_RADIOTAP_TX_FLAGS */
245#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
246 * retries */
247#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
248#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
222 249
223/* Ugly macro to convert literal channel numbers into their mhz equivalents 250/* Ugly macro to convert literal channel numbers into their mhz equivalents
224 * There are certianly some conditions that will break this (like feeding it '30') 251 * There are certianly some conditions that will break this (like feeding it '30')
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index c28e424f53d..668056b4bb0 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -19,6 +19,9 @@
19#include <linux/in6.h> 19#include <linux/in6.h>
20#include <linux/ipv6.h> 20#include <linux/ipv6.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/jhash.h>
23
24#include <net/inet_sock.h>
22 25
23#include <net/ipv6.h> 26#include <net/ipv6.h>
24 27
@@ -28,12 +31,11 @@ struct inet_hashinfo;
28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, 31static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
29 const struct in6_addr *faddr, const __be16 fport) 32 const struct in6_addr *faddr, const __be16 fport)
30{ 33{
31 unsigned int hashent = (lport ^ (__force u16)fport); 34 u32 ports = (lport ^ (__force u16)fport);
32 35
33 hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); 36 return jhash_3words((__force u32)laddr->s6_addr32[3],
34 hashent ^= hashent >> 16; 37 (__force u32)faddr->s6_addr32[3],
35 hashent ^= hashent >> 8; 38 ports, inet_ehash_secret);
36 return hashent;
37} 39}
38 40
39static inline int inet6_sk_ehashfn(const struct sock *sk) 41static inline int inet6_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 10117c8503e..de8399a7977 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -114,13 +114,13 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
114{ 114{
115 switch (skb->protocol) { 115 switch (skb->protocol) {
116 case __constant_htons(ETH_P_IP): 116 case __constant_htons(ETH_P_IP):
117 if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail) 117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
118 return IP_ECN_set_ce(skb->nh.iph); 118 return IP_ECN_set_ce(ip_hdr(skb));
119 break; 119 break;
120 120
121 case __constant_htons(ETH_P_IPV6): 121 case __constant_htons(ETH_P_IPV6):
122 if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail) 122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
123 return IP6_ECN_set_ce(skb->nh.ipv6h); 123 return IP6_ECN_set_ce(ipv6_hdr(skb));
124 break; 124 break;
125 } 125 }
126 126
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index ce6da97bc84..62daf214931 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/jhash.h>
22 23
23#include <net/flow.h> 24#include <net/flow.h>
24#include <net/sock.h> 25#include <net/sock.h>
@@ -167,13 +168,15 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
167 168
168extern int inet_sk_rebuild_header(struct sock *sk); 169extern int inet_sk_rebuild_header(struct sock *sk);
169 170
171extern u32 inet_ehash_secret;
172extern void build_ehash_secret(void);
173
170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, 174static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
171 const __be32 faddr, const __be16 fport) 175 const __be32 faddr, const __be16 fport)
172{ 176{
173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); 177 return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr,
174 h ^= h >> 16; 178 ((__u32) lport) << 16 | (__force __u32)fport,
175 h ^= h >> 8; 179 inet_ehash_secret);
176 return h;
177} 180}
178 181
179static inline int inet_sk_ehashfn(const struct sock *sk) 182static inline int inet_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/ip.h b/include/net/ip.h
index e79c3e3aa4f..bb207db0367 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -25,6 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/ip.h> 26#include <linux/ip.h>
27#include <linux/in.h> 27#include <linux/in.h>
28#include <linux/skbuff.h>
28 29
29#include <net/inet_sock.h> 30#include <net/inet_sock.h>
30#include <net/snmp.h> 31#include <net/snmp.h>
@@ -43,6 +44,11 @@ struct inet_skb_parm
43#define IPSKB_REROUTED 16 44#define IPSKB_REROUTED 16
44}; 45};
45 46
47static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
48{
49 return ip_hdr(skb)->ihl * 4;
50}
51
46struct ipcm_cookie 52struct ipcm_cookie
47{ 53{
48 __be32 addr; 54 __be32 addr;
@@ -74,7 +80,6 @@ struct msghdr;
74struct net_device; 80struct net_device;
75struct packet_type; 81struct packet_type;
76struct rtable; 82struct rtable;
77struct sk_buff;
78struct sockaddr; 83struct sockaddr;
79 84
80extern void ip_mc_dropsocket(struct sock *); 85extern void ip_mc_dropsocket(struct sock *);
@@ -161,6 +166,10 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
161#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) 166#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd)
162#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) 167#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd)
163 168
169extern unsigned long snmp_fold_field(void *mib[], int offt);
170extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
171extern void snmp_mib_free(void *ptr[2]);
172
164extern int sysctl_local_port_range[2]; 173extern int sysctl_local_port_range[2];
165extern int sysctl_ip_default_ttl; 174extern int sysctl_ip_default_ttl;
166extern int sysctl_ip_nonlocal_bind; 175extern int sysctl_ip_nonlocal_bind;
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index cf355a3c2ad..c48ea873f1e 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -219,8 +219,6 @@ extern void fib6_init(void);
219 219
220extern void fib6_rules_init(void); 220extern void fib6_rules_init(void);
221extern void fib6_rules_cleanup(void); 221extern void fib6_rules_cleanup(void);
222extern int fib6_rules_dump(struct sk_buff *,
223 struct netlink_callback *);
224 222
225#endif 223#endif
226#endif 224#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 4e927ebd1cb..5456fdd6d04 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr,
116 struct net_device *dev, 116 struct net_device *dev,
117 u32 pmtu); 117 u32 pmtu);
118 118
119struct nlmsghdr;
120struct netlink_callback; 119struct netlink_callback;
121extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
122extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
123extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
124extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
125 120
126struct rt6_rtnl_dump_arg 121struct rt6_rtnl_dump_arg
127{ 122{
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 36c635ca1aa..5a4a0366c24 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
215/* Exported by fib_frontend.c */ 215/* Exported by fib_frontend.c */
216extern struct nla_policy rtm_ipv4_policy[]; 216extern struct nla_policy rtm_ipv4_policy[];
217extern void ip_fib_init(void); 217extern void ip_fib_init(void);
218extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
219extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
220extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
221extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
222extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
223 struct net_device *dev, __be32 *spec_dst, u32 *itag); 219 struct net_device *dev, __be32 *spec_dst, u32 *itag);
224extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 220extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res);
235extern struct fib_table *fib_hash_init(u32 id); 231extern struct fib_table *fib_hash_init(u32 id);
236 232
237#ifdef CONFIG_IP_MULTIPLE_TABLES 233#ifdef CONFIG_IP_MULTIPLE_TABLES
238extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb);
239
240extern void __init fib4_rules_init(void); 234extern void __init fib4_rules_init(void);
241 235
242#ifdef CONFIG_NET_CLS_ROUTE 236#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 00328b71a08..4fa5dfe886c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -166,13 +166,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ 166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \
167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) 167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0)
168 168
169int snmp6_register_dev(struct inet6_dev *idev);
170int snmp6_unregister_dev(struct inet6_dev *idev);
171int snmp6_alloc_dev(struct inet6_dev *idev);
172int snmp6_free_dev(struct inet6_dev *idev);
173int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
174void snmp6_mib_free(void *ptr[2]);
175
176struct ip6_ra_chain 169struct ip6_ra_chain
177{ 170{
178 struct ip6_ra_chain *next; 171 struct ip6_ra_chain *next;
@@ -211,9 +204,9 @@ struct ip6_flowlabel
211{ 204{
212 struct ip6_flowlabel *next; 205 struct ip6_flowlabel *next;
213 __be32 label; 206 __be32 label;
207 atomic_t users;
214 struct in6_addr dst; 208 struct in6_addr dst;
215 struct ipv6_txoptions *opt; 209 struct ipv6_txoptions *opt;
216 atomic_t users;
217 unsigned long linger; 210 unsigned long linger;
218 u8 share; 211 u8 share;
219 u32 owner; 212 u32 owner;
@@ -298,7 +291,7 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr)
298 291
299static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) 292static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
300{ 293{
301 return memcmp((const void *) a1, (const void *) a2, sizeof(struct in6_addr)); 294 return memcmp(a1, a2, sizeof(struct in6_addr));
302} 295}
303 296
304static inline int 297static inline int
@@ -315,7 +308,7 @@ ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
315 308
316static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) 309static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
317{ 310{
318 memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr)); 311 memcpy(a1, a2, sizeof(struct in6_addr));
319} 312}
320 313
321static inline void ipv6_addr_prefix(struct in6_addr *pfx, 314static inline void ipv6_addr_prefix(struct in6_addr *pfx,
@@ -326,16 +319,12 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
326 int o = plen >> 3, 319 int o = plen >> 3,
327 b = plen & 0x7; 320 b = plen & 0x7;
328 321
322 memset(pfx->s6_addr, 0, sizeof(pfx->s6_addr));
329 memcpy(pfx->s6_addr, addr, o); 323 memcpy(pfx->s6_addr, addr, o);
330 if (b != 0) { 324 if (b != 0)
331 pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); 325 pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
332 o++;
333 }
334 if (o < 16)
335 memset(pfx->s6_addr + o, 0, 16 - o);
336} 326}
337 327
338#ifndef __HAVE_ARCH_ADDR_SET
339static inline void ipv6_addr_set(struct in6_addr *addr, 328static inline void ipv6_addr_set(struct in6_addr *addr,
340 __be32 w1, __be32 w2, 329 __be32 w1, __be32 w2,
341 __be32 w3, __be32 w4) 330 __be32 w3, __be32 w4)
@@ -345,7 +334,6 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
345 addr->s6_addr32[2] = w3; 334 addr->s6_addr32[2] = w3;
346 addr->s6_addr32[3] = w4; 335 addr->s6_addr32[3] = w4;
347} 336}
348#endif
349 337
350static inline int ipv6_addr_equal(const struct in6_addr *a1, 338static inline int ipv6_addr_equal(const struct in6_addr *a1,
351 const struct in6_addr *a2) 339 const struct in6_addr *a2)
@@ -605,8 +593,20 @@ extern int udplite6_proc_init(void);
605extern void udplite6_proc_exit(void); 593extern void udplite6_proc_exit(void);
606extern int ipv6_misc_proc_init(void); 594extern int ipv6_misc_proc_init(void);
607extern void ipv6_misc_proc_exit(void); 595extern void ipv6_misc_proc_exit(void);
596extern int snmp6_register_dev(struct inet6_dev *idev);
597extern int snmp6_unregister_dev(struct inet6_dev *idev);
608 598
609extern struct rt6_statistics rt6_stats; 599extern struct rt6_statistics rt6_stats;
600#else
601static inline int snmp6_register_dev(struct inet6_dev *idev)
602{
603 return 0;
604}
605
606static inline int snmp6_unregister_dev(struct inet6_dev *idev)
607{
608 return 0;
609}
610#endif 610#endif
611 611
612#ifdef CONFIG_SYSCTL 612#ifdef CONFIG_SYSCTL
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c6b2ee61086..4cc0b4eca94 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -43,7 +43,7 @@ struct ipxhdr {
43 43
44static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 44static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
45{ 45{
46 return (struct ipxhdr *)skb->h.raw; 46 return (struct ipxhdr *)skb_transport_header(skb);
47} 47}
48 48
49struct ipx_interface { 49struct ipx_interface {
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 04d1abb72d2..f9bd11be189 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -28,6 +28,7 @@ enum {
28 IUCV_LISTEN, 28 IUCV_LISTEN,
29 IUCV_SEVERED, 29 IUCV_SEVERED,
30 IUCV_DISCONN, 30 IUCV_DISCONN,
31 IUCV_CLOSING,
31 IUCV_CLOSED 32 IUCV_CLOSED
32}; 33};
33 34
@@ -62,6 +63,7 @@ struct iucv_sock {
62 struct sock *parent; 63 struct sock *parent;
63 struct iucv_path *path; 64 struct iucv_path *path;
64 struct sk_buff_head send_skb_q; 65 struct sk_buff_head send_skb_q;
66 struct sk_buff_head backlog_skb_q;
65 unsigned int send_tag; 67 unsigned int send_tag;
66}; 68};
67 69
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index 746e7416261..fd70adbb356 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -16,7 +16,7 @@
16 * completed a register, it can exploit the other functions. 16 * completed a register, it can exploit the other functions.
17 * For furthur reference on all IUCV functionality, refer to the 17 * For furthur reference on all IUCV functionality, refer to the
18 * CP Programming Services book, also available on the web thru 18 * CP Programming Services book, also available on the web thru
19 * www.ibm.com/s390/vm/pubs, manual # SC24-5760 19 * www.vm.ibm.com/pubs, manual # SC24-6084
20 * 20 *
21 * Definition of Return Codes 21 * Definition of Return Codes
22 * - All positive return codes including zero are reflected back 22 * - All positive return codes including zero are reflected back
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 8a830188354..f23d07ca7c5 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -431,26 +431,7 @@ struct iw_public_data {
431 * Those may be called only within the kernel. 431 * Those may be called only within the kernel.
432 */ 432 */
433 433
434/* First : function strictly used inside the kernel */ 434/* functions that may be called by driver modules */
435
436/* Handle /proc/net/wireless, called in net/code/dev.c */
437extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
438 int length);
439
440/* Handle IOCTLs, called in net/core/dev.c */
441extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd);
442
443/* Handle RtNetlink requests, called in net/core/rtnetlink.c */
444extern int wireless_rtnetlink_set(struct net_device * dev,
445 char * data,
446 int len);
447extern int wireless_rtnetlink_get(struct net_device * dev,
448 char * data,
449 int len,
450 char ** p_buf,
451 int * p_len);
452
453/* Second : functions that may be called by driver modules */
454 435
455/* Send a single event to user space */ 436/* Send a single event to user space */
456extern void wireless_send_event(struct net_device * dev, 437extern void wireless_send_event(struct net_device * dev,
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index aa33a477c3f..4a8f58b17e4 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -203,7 +203,7 @@ struct llc_pdu_sn {
203 203
204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) 204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)
205{ 205{
206 return (struct llc_pdu_sn *)skb->nh.raw; 206 return (struct llc_pdu_sn *)skb_network_header(skb);
207} 207}
208 208
209/* Un-numbered PDU format (3 bytes in length) */ 209/* Un-numbered PDU format (3 bytes in length) */
@@ -215,12 +215,7 @@ struct llc_pdu_un {
215 215
216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) 216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)
217{ 217{
218 return (struct llc_pdu_un *)skb->nh.raw; 218 return (struct llc_pdu_un *)skb_network_header(skb);
219}
220
221static inline void *llc_set_pdu_hdr(struct sk_buff *skb, void *ptr)
222{
223 return skb->nh.raw = ptr;
224} 219}
225 220
226/** 221/**
@@ -237,7 +232,11 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
237 u8 ssap, u8 dsap, u8 cr) 232 u8 ssap, u8 dsap, u8 cr)
238{ 233{
239 const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; 234 const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4;
240 struct llc_pdu_un *pdu = llc_set_pdu_hdr(skb, skb_push(skb, hlen)); 235 struct llc_pdu_un *pdu;
236
237 skb_push(skb, hlen);
238 skb_reset_network_header(skb);
239 pdu = llc_pdu_un_hdr(skb);
241 pdu->dsap = dsap; 240 pdu->dsap = dsap;
242 pdu->ssap = ssap; 241 pdu->ssap = ssap;
243 pdu->ssap |= cr; 242 pdu->ssap |= cr;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
new file mode 100644
index 00000000000..a7f122b7994
--- /dev/null
+++ b/include/net/mac80211.h
@@ -0,0 +1,1045 @@
1/*
2 * Low-level hardware driver -- IEEE 802.11 driver (80211.o) interface
3 * Copyright 2002-2005, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef MAC80211_H
12#define MAC80211_H
13
14#include <linux/kernel.h>
15#include <linux/if_ether.h>
16#include <linux/skbuff.h>
17#include <linux/wireless.h>
18#include <linux/device.h>
19#include <linux/ieee80211.h>
20#include <net/wireless.h>
21#include <net/cfg80211.h>
22
23/* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
24 * called in hardware interrupt context. The low-level driver must not call any
25 * other functions in hardware interrupt context. If there is a need for such
26 * call, the low-level driver should first ACK the interrupt and perform the
27 * IEEE 802.11 code call after this, e.g., from a scheduled tasklet (in
28 * software interrupt context).
29 */
30
31/*
32 * Frame format used when passing frame between low-level hardware drivers
33 * and IEEE 802.11 driver the same as used in the wireless media, i.e.,
34 * buffers start with IEEE 802.11 header and include the same octets that
35 * are sent over air.
36 *
37 * If hardware uses IEEE 802.3 headers (and perform 802.3 <-> 802.11
38 * conversion in firmware), upper layer 802.11 code needs to be changed to
39 * support this.
40 *
41 * If the receive frame format is not the same as the real frame sent
42 * on the wireless media (e.g., due to padding etc.), upper layer 802.11 code
43 * could be updated to provide support for such format assuming this would
44 * optimize the performance, e.g., by removing need to re-allocation and
45 * copying of the data.
46 */
47
48#define IEEE80211_CHAN_W_SCAN 0x00000001
49#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002
50#define IEEE80211_CHAN_W_IBSS 0x00000004
51
52/* Channel information structure. Low-level driver is expected to fill in chan,
53 * freq, and val fields. Other fields will be filled in by 80211.o based on
54 * hostapd information and low-level driver does not need to use them. The
55 * limits for each channel will be provided in 'struct ieee80211_conf' when
56 * configuring the low-level driver with hw->config callback. If a device has
57 * a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED
58 * can be set to let the driver configure all fields */
59struct ieee80211_channel {
60 short chan; /* channel number (IEEE 802.11) */
61 short freq; /* frequency in MHz */
62 int val; /* hw specific value for the channel */
63 int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
64 unsigned char power_level;
65 unsigned char antenna_max;
66};
67
68#define IEEE80211_RATE_ERP 0x00000001
69#define IEEE80211_RATE_BASIC 0x00000002
70#define IEEE80211_RATE_PREAMBLE2 0x00000004
71#define IEEE80211_RATE_SUPPORTED 0x00000010
72#define IEEE80211_RATE_OFDM 0x00000020
73#define IEEE80211_RATE_CCK 0x00000040
74#define IEEE80211_RATE_TURBO 0x00000080
75#define IEEE80211_RATE_MANDATORY 0x00000100
76
77#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
78#define IEEE80211_RATE_MODULATION(f) \
79 (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
80
81/* Low-level driver should set PREAMBLE2, OFDM, CCK, and TURBO flags.
82 * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
83 * configuration. */
84struct ieee80211_rate {
85 int rate; /* rate in 100 kbps */
86 int val; /* hw specific value for the rate */
87 int flags; /* IEEE80211_RATE_ flags */
88 int val2; /* hw specific value for the rate when using short preamble
89 * (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for
90 * 2, 5.5, and 11 Mbps) */
91 signed char min_rssi_ack;
92 unsigned char min_rssi_ack_delta;
93
94 /* following fields are set by 80211.o and need not be filled by the
95 * low-level driver */
96 int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for
97 * optimizing channel utilization estimates */
98};
99
100/* 802.11g is backwards-compatible with 802.11b, so a wlan card can
101 * actually be both in 11b and 11g modes at the same time. */
102enum {
103 MODE_IEEE80211A, /* IEEE 802.11a */
104 MODE_IEEE80211B, /* IEEE 802.11b only */
105 MODE_ATHEROS_TURBO, /* Atheros Turbo mode (2x.11a at 5 GHz) */
106 MODE_IEEE80211G, /* IEEE 802.11g (and 802.11b compatibility) */
107 MODE_ATHEROS_TURBOG, /* Atheros Turbo mode (2x.11g at 2.4 GHz) */
108
109 /* keep last */
110 NUM_IEEE80211_MODES
111};
112
113struct ieee80211_hw_mode {
114 int mode; /* MODE_IEEE80211... */
115 int num_channels; /* Number of channels (below) */
116 struct ieee80211_channel *channels; /* Array of supported channels */
117 int num_rates; /* Number of rates (below) */
118 struct ieee80211_rate *rates; /* Array of supported rates */
119
120 struct list_head list; /* Internal, don't touch */
121};
122
123struct ieee80211_tx_queue_params {
124 int aifs; /* 0 .. 255; -1 = use default */
125 int cw_min; /* 2^n-1: 1, 3, 7, .. , 1023; 0 = use default */
126 int cw_max; /* 2^n-1: 1, 3, 7, .. , 1023; 0 = use default */
127 int burst_time; /* maximum burst time in 0.1 ms (i.e., 10 = 1 ms);
128 * 0 = disabled */
129};
130
131struct ieee80211_tx_queue_stats_data {
132 unsigned int len; /* num packets in queue */
133 unsigned int limit; /* queue len (soft) limit */
134 unsigned int count; /* total num frames sent */
135};
136
137enum {
138 IEEE80211_TX_QUEUE_DATA0,
139 IEEE80211_TX_QUEUE_DATA1,
140 IEEE80211_TX_QUEUE_DATA2,
141 IEEE80211_TX_QUEUE_DATA3,
142 IEEE80211_TX_QUEUE_DATA4,
143 IEEE80211_TX_QUEUE_SVP,
144
145 NUM_TX_DATA_QUEUES,
146
147/* due to stupidity in the sub-ioctl userspace interface, the items in
148 * this struct need to have fixed values. As soon as it is removed, we can
149 * fix these entries. */
150 IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
151 IEEE80211_TX_QUEUE_BEACON = 7
152};
153
154struct ieee80211_tx_queue_stats {
155 struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES];
156};
157
158struct ieee80211_low_level_stats {
159 unsigned int dot11ACKFailureCount;
160 unsigned int dot11RTSFailureCount;
161 unsigned int dot11FCSErrorCount;
162 unsigned int dot11RTSSuccessCount;
163};
164
165/* Transmit control fields. This data structure is passed to low-level driver
166 * with each TX frame. The low-level driver is responsible for configuring
167 * the hardware to use given values (depending on what is supported). */
168#define HW_KEY_IDX_INVALID -1
169
170struct ieee80211_tx_control {
171 int tx_rate; /* Transmit rate, given as the hw specific value for the
172 * rate (from struct ieee80211_rate) */
173 int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw
174 * specific value for the rate (from
175 * struct ieee80211_rate) */
176
177#define IEEE80211_TXCTL_REQ_TX_STATUS (1<<0)/* request TX status callback for
178 * this frame */
179#define IEEE80211_TXCTL_DO_NOT_ENCRYPT (1<<1) /* send this frame without
180 * encryption; e.g., for EAPOL
181 * frames */
182#define IEEE80211_TXCTL_USE_RTS_CTS (1<<2) /* use RTS-CTS before sending
183 * frame */
184#define IEEE80211_TXCTL_USE_CTS_PROTECT (1<<3) /* use CTS protection for the
185 * frame (e.g., for combined
186 * 802.11g / 802.11b networks) */
187#define IEEE80211_TXCTL_NO_ACK (1<<4) /* tell the low level not to
188 * wait for an ack */
189#define IEEE80211_TXCTL_RATE_CTRL_PROBE (1<<5)
190#define IEEE80211_TXCTL_CLEAR_DST_MASK (1<<6)
191#define IEEE80211_TXCTL_REQUEUE (1<<7)
192#define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of
193 * the frame */
194#define IEEE80211_TXCTL_TKIP_NEW_PHASE1_KEY (1<<9)
195 u32 flags; /* tx control flags defined
196 * above */
197 u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. */
198 u8 power_level; /* per-packet transmit power level, in dBm */
199 u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
200 s8 key_idx; /* -1 = do not encrypt, >= 0 keyidx from
201 * hw->set_key() */
202 u8 icv_len; /* length of the ICV/MIC field in octets */
203 u8 iv_len; /* length of the IV field in octets */
204 u8 tkip_key[16]; /* generated phase2/phase1 key for hw TKIP */
205 u8 queue; /* hardware queue to use for this frame;
206 * 0 = highest, hw->queues-1 = lowest */
207 u8 sw_retry_attempt; /* number of times hw has tried to
208 * transmit frame (not incl. hw retries) */
209
210 struct ieee80211_rate *rate; /* internal 80211.o rate */
211 struct ieee80211_rate *rts_rate; /* internal 80211.o rate
212 * for RTS/CTS */
213 int alt_retry_rate; /* retry rate for the last retries, given as the
214 * hw specific value for the rate (from
215 * struct ieee80211_rate). To be used to limit
216 * packet dropping when probing higher rates, if hw
217 * supports multiple retry rates. -1 = not used */
218 int type; /* internal */
219 int ifindex; /* internal */
220};
221
222/* Receive status. The low-level driver should provide this information
223 * (the subset supported by hardware) to the 802.11 code with each received
224 * frame. */
225struct ieee80211_rx_status {
226 u64 mactime;
227 int freq; /* receive frequency in Mhz */
228 int channel;
229 int phymode;
230 int ssi;
231 int signal; /* used as qual in statistics reporting */
232 int noise;
233 int antenna;
234 int rate;
235#define RX_FLAG_MMIC_ERROR (1<<0)
236#define RX_FLAG_DECRYPTED (1<<1)
237#define RX_FLAG_RADIOTAP (1<<2)
238 int flag;
239};
240
241/* Transmit status. The low-level driver should provide this information
242 * (the subset supported by hardware) to the 802.11 code for each transmit
243 * frame. */
244struct ieee80211_tx_status {
245 /* copied ieee80211_tx_control structure */
246 struct ieee80211_tx_control control;
247
248#define IEEE80211_TX_STATUS_TX_FILTERED (1<<0)
249#define IEEE80211_TX_STATUS_ACK (1<<1) /* whether the TX frame was ACKed */
250 u32 flags; /* tx staus flags defined above */
251
252 int ack_signal; /* measured signal strength of the ACK frame */
253 int excessive_retries;
254 int retry_count;
255
256 int queue_length; /* information about TX queue */
257 int queue_number;
258};
259
260
261/**
262 * struct ieee80211_conf - configuration of the device
263 *
264 * This struct indicates how the driver shall configure the hardware.
265 *
266 * @radio_enabled: when zero, driver is required to switch off the radio.
267 */
268struct ieee80211_conf {
269 int channel; /* IEEE 802.11 channel number */
270 int freq; /* MHz */
271 int channel_val; /* hw specific value for the channel */
272
273 int phymode; /* MODE_IEEE80211A, .. */
274 struct ieee80211_channel *chan;
275 struct ieee80211_hw_mode *mode;
276 unsigned int regulatory_domain;
277 int radio_enabled;
278
279 int beacon_int;
280
281#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<0) /* use IEEE 802.11g Short Slot
282 * Time */
283#define IEEE80211_CONF_SSID_HIDDEN (1<<1) /* do not broadcast the ssid */
284#define IEEE80211_CONF_RADIOTAP (1<<2) /* use radiotap if supported
285 check this bit at RX time */
286 u32 flags; /* configuration flags defined above */
287
288 u8 power_level; /* transmit power limit for current
289 * regulatory domain; in dBm */
290 u8 antenna_max; /* maximum antenna gain */
291 short tx_power_reduction; /* in 0.1 dBm */
292
293 /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
294 u8 antenna_sel_tx;
295 u8 antenna_sel_rx;
296
297 int antenna_def;
298 int antenna_mode;
299
300 /* Following five fields are used for IEEE 802.11H */
301 unsigned int radar_detect;
302 unsigned int spect_mgmt;
303 /* All following fields are currently unused. */
304 unsigned int quiet_duration; /* duration of quiet period */
305 unsigned int quiet_offset; /* how far into the beacon is the quiet
306 * period */
307 unsigned int quiet_period;
308 u8 radar_firpwr_threshold;
309 u8 radar_rssi_threshold;
310 u8 pulse_height_threshold;
311 u8 pulse_rssi_threshold;
312 u8 pulse_inband_threshold;
313};
314
315/**
316 * enum ieee80211_if_types - types of 802.11 network interfaces
317 *
318 * @IEEE80211_IF_TYPE_AP: interface in AP mode.
319 * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
320 * daemon. Drivers should never see this type.
321 * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
322 * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
323 * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
324 * @IEEE80211_IF_TYPE_WDS: interface in WDS mode.
325 * @IEEE80211_IF_TYPE_VLAN: not used.
326 */
327enum ieee80211_if_types {
328 IEEE80211_IF_TYPE_AP = 0x00000000,
329 IEEE80211_IF_TYPE_MGMT = 0x00000001,
330 IEEE80211_IF_TYPE_STA = 0x00000002,
331 IEEE80211_IF_TYPE_IBSS = 0x00000003,
332 IEEE80211_IF_TYPE_MNTR = 0x00000004,
333 IEEE80211_IF_TYPE_WDS = 0x5A580211,
334 IEEE80211_IF_TYPE_VLAN = 0x00080211,
335};
336
337/**
338 * struct ieee80211_if_init_conf - initial configuration of an interface
339 *
340 * @if_id: internal interface ID. This number has no particular meaning to
341 * drivers and the only allowed usage is to pass it to
342 * ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions.
343 * This field is not valid for monitor interfaces
344 * (interfaces of %IEEE80211_IF_TYPE_MNTR type).
345 * @type: one of &enum ieee80211_if_types constants. Determines the type of
346 * added/removed interface.
347 * @mac_addr: pointer to MAC address of the interface. This pointer is valid
348 * until the interface is removed (i.e. it cannot be used after
349 * remove_interface() callback was called for this interface).
350 *
351 * This structure is used in add_interface() and remove_interface()
352 * callbacks of &struct ieee80211_hw.
353 */
354struct ieee80211_if_init_conf {
355 int if_id;
356 int type;
357 void *mac_addr;
358};
359
360/**
361 * struct ieee80211_if_conf - configuration of an interface
362 *
363 * @type: type of the interface. This is always the same as was specified in
364 * &struct ieee80211_if_init_conf. The type of an interface never changes
365 * during the life of the interface; this field is present only for
366 * convenience.
367 * @bssid: BSSID of the network we are associated to/creating.
368 * @ssid: used (together with @ssid_len) by drivers for hardware that
369 * generate beacons independently. The pointer is valid only during the
370 * config_interface() call, so copy the value somewhere if you need
371 * it.
372 * @ssid_len: length of the @ssid field.
373 * @generic_elem: used (together with @generic_elem_len) by drivers for
374 * hardware that generate beacons independently. The pointer is valid
375 * only during the config_interface() call, so copy the value somewhere
376 * if you need it.
377 * @generic_elem_len: length of the generic element.
378 * @beacon: beacon template. Valid only if @host_gen_beacon_template in
379 * &struct ieee80211_hw is set. The driver is responsible of freeing
380 * the sk_buff.
381 * @beacon_control: tx_control for the beacon template, this field is only
382 * valid when the @beacon field was set.
383 *
384 * This structure is passed to the config_interface() callback of
385 * &struct ieee80211_hw.
386 */
387struct ieee80211_if_conf {
388 int type;
389 u8 *bssid;
390 u8 *ssid;
391 size_t ssid_len;
392 u8 *generic_elem;
393 size_t generic_elem_len;
394 struct sk_buff *beacon;
395 struct ieee80211_tx_control *beacon_control;
396};
397
398typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL }
399ieee80211_key_alg;
400
401
402struct ieee80211_key_conf {
403
404 int hw_key_idx; /* filled + used by low-level driver */
405 ieee80211_key_alg alg;
406 int keylen;
407
408#define IEEE80211_KEY_FORCE_SW_ENCRYPT (1<<0) /* to be cleared by low-level
409 driver */
410#define IEEE80211_KEY_DEFAULT_TX_KEY (1<<1) /* This key is the new default TX
411 key (used only for broadcast
412 keys). */
413#define IEEE80211_KEY_DEFAULT_WEP_ONLY (1<<2) /* static WEP is the only
414 configured security policy;
415 this allows some low-level
416 drivers to determine when
417 hwaccel can be used */
418 u32 flags; /* key configuration flags defined above */
419
420 s8 keyidx; /* WEP key index */
421 u8 key[0];
422};
423
424#define IEEE80211_SEQ_COUNTER_RX 0
425#define IEEE80211_SEQ_COUNTER_TX 1
426
427typedef enum {
428 SET_KEY, DISABLE_KEY, REMOVE_ALL_KEYS,
429} set_key_cmd;
430
431/* This is driver-visible part of the per-hw state the stack keeps. */
432struct ieee80211_hw {
433 /* points to the cfg80211 wiphy for this piece. Note
434 * that you must fill in the perm_addr and dev fields
435 * of this structure, use the macros provided below. */
436 struct wiphy *wiphy;
437
438 /* assigned by mac80211, don't write */
439 struct ieee80211_conf conf;
440
441 /* Single thread workqueue available for driver use
442 * Allocated by mac80211 on registration */
443 struct workqueue_struct *workqueue;
444
445 /* Pointer to the private area that was
446 * allocated with this struct for you. */
447 void *priv;
448
449 /* The rest is information about your hardware */
450
451 /* TODO: frame_type 802.11/802.3, sw_encryption requirements */
452
453 /* Some wireless LAN chipsets generate beacons in the hardware/firmware
454 * and others rely on host generated beacons. This option is used to
455 * configure the upper layer IEEE 802.11 module to generate beacons.
456 * The low-level driver can use ieee80211_beacon_get() to fetch the
457 * next beacon frame. */
458#define IEEE80211_HW_HOST_GEN_BEACON (1<<0)
459
460 /* The device needs to be supplied with a beacon template only. */
461#define IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE (1<<1)
462
463 /* Some devices handle decryption internally and do not
464 * indicate whether the frame was encrypted (unencrypted frames
465 * will be dropped by the hardware, unless specifically allowed
466 * through) */
467#define IEEE80211_HW_DEVICE_HIDES_WEP (1<<2)
468
469 /* Whether RX frames passed to ieee80211_rx() include FCS in the end */
470#define IEEE80211_HW_RX_INCLUDES_FCS (1<<3)
471
472 /* Some wireless LAN chipsets buffer broadcast/multicast frames for
473 * power saving stations in the hardware/firmware and others rely on
474 * the host system for such buffering. This option is used to
475 * configure the IEEE 802.11 upper layer to buffer broadcast/multicast
476 * frames when there are power saving stations so that low-level driver
477 * can fetch them with ieee80211_get_buffered_bc(). */
478#define IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING (1<<4)
479
480#define IEEE80211_HW_WEP_INCLUDE_IV (1<<5)
481
482 /* will data nullfunc frames get proper TX status callback */
483#define IEEE80211_HW_DATA_NULLFUNC_ACK (1<<6)
484
485 /* Force software encryption for TKIP packets if WMM is enabled. */
486#define IEEE80211_HW_NO_TKIP_WMM_HWACCEL (1<<7)
487
488 /* Some devices handle Michael MIC internally and do not include MIC in
489 * the received packets passed up. device_strips_mic must be set
490 * for such devices. The 'encryption' frame control bit is expected to
491 * be still set in the IEEE 802.11 header with this option unlike with
492 * the device_hides_wep configuration option.
493 */
494#define IEEE80211_HW_DEVICE_STRIPS_MIC (1<<8)
495
496 /* Device is capable of performing full monitor mode even during
497 * normal operation. */
498#define IEEE80211_HW_MONITOR_DURING_OPER (1<<9)
499
500 /* Device does not need BSSID filter set to broadcast in order to
501 * receive all probe responses while scanning */
502#define IEEE80211_HW_NO_PROBE_FILTERING (1<<10)
503
504 /* Channels are already configured to the default regulatory domain
505 * specified in the device's EEPROM */
506#define IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED (1<<11)
507
508 /* calculate Michael MIC for an MSDU when doing hwcrypto */
509#define IEEE80211_HW_TKIP_INCLUDE_MMIC (1<<12)
510 /* Do TKIP phase1 key mixing in stack to support cards only do
511 * phase2 key mixing when doing hwcrypto */
512#define IEEE80211_HW_TKIP_REQ_PHASE1_KEY (1<<13)
513 /* Do TKIP phase1 and phase2 key mixing in stack and send the generated
514 * per-packet RC4 key with each TX frame when doing hwcrypto */
515#define IEEE80211_HW_TKIP_REQ_PHASE2_KEY (1<<14)
516
517 u32 flags; /* hardware flags defined above */
518
519 /* Set to the size of a needed device specific skb headroom for TX skbs. */
520 unsigned int extra_tx_headroom;
521
522 /* This is the time in us to change channels
523 */
524 int channel_change_time;
525 /* Maximum values for various statistics.
526 * Leave at 0 to indicate no support. Use negative numbers for dBm. */
527 s8 max_rssi;
528 s8 max_signal;
529 s8 max_noise;
530
531 /* Number of available hardware TX queues for data packets.
532 * WMM requires at least four queues. */
533 int queues;
534};
535
536static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
537{
538 set_wiphy_dev(hw->wiphy, dev);
539}
540
541static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
542{
543 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
544}
545
546/* Configuration block used by the low-level driver to tell the 802.11 code
547 * about supported hardware features and to pass function pointers to callback
548 * functions. */
549struct ieee80211_ops {
550 /* Handler that 802.11 module calls for each transmitted frame.
551 * skb contains the buffer starting from the IEEE 802.11 header.
552 * The low-level driver should send the frame out based on
553 * configuration in the TX control data.
554 * Must be atomic. */
555 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
556 struct ieee80211_tx_control *control);
557
558 /* Handler for performing hardware reset. */
559 int (*reset)(struct ieee80211_hw *hw);
560
561 /* Handler that is called when any netdevice attached to the hardware
562 * device is set UP for the first time. This can be used, e.g., to
563 * enable interrupts and beacon sending. */
564 int (*open)(struct ieee80211_hw *hw);
565
566 /* Handler that is called when the last netdevice attached to the
567 * hardware device is set DOWN. This can be used, e.g., to disable
568 * interrupts and beacon sending. */
569 int (*stop)(struct ieee80211_hw *hw);
570
571 /* Handler for asking a driver if a new interface can be added (or,
572 * more exactly, set UP). If the handler returns zero, the interface
573 * is added. Driver should perform any initialization it needs prior
574 * to returning zero. By returning non-zero addition of the interface
575 * is inhibited. Unless monitor_during_oper is set, it is guaranteed
576 * that monitor interfaces and normal interfaces are mutually
577 * exclusive. The open() handler is called after add_interface()
578 * if this is the first device added. At least one of the open()
579 * open() and add_interface() callbacks has to be assigned. If
580 * add_interface() is NULL, one STA interface is permitted only. */
581 int (*add_interface)(struct ieee80211_hw *hw,
582 struct ieee80211_if_init_conf *conf);
583
584 /* Notify a driver that an interface is going down. The stop() handler
585 * is called prior to this if this is a last interface. */
586 void (*remove_interface)(struct ieee80211_hw *hw,
587 struct ieee80211_if_init_conf *conf);
588
589 /* Handler for configuration requests. IEEE 802.11 code calls this
590 * function to change hardware configuration, e.g., channel. */
591 int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
592
593 /* Handler for configuration requests related to interfaces (e.g.
594 * BSSID). */
595 int (*config_interface)(struct ieee80211_hw *hw,
596 int if_id, struct ieee80211_if_conf *conf);
597
598 /* ieee80211 drivers do not have access to the &struct net_device
599 * that is (are) connected with their device. Hence (and because
600 * we need to combine the multicast lists and flags for multiple
601 * virtual interfaces), they cannot assign set_multicast_list.
602 * The parameters here replace dev->flags and dev->mc_count,
603 * dev->mc_list is replaced by calling ieee80211_get_mc_list_item.
604 * Must be atomic. */
605 void (*set_multicast_list)(struct ieee80211_hw *hw,
606 unsigned short flags, int mc_count);
607
608 /* Set TIM bit handler. If the hardware/firmware takes care of beacon
609 * generation, IEEE 802.11 code uses this function to tell the
610 * low-level to set (or clear if set==0) TIM bit for the given aid. If
611 * host system is used to generate beacons, this handler is not used
612 * and low-level driver should set it to NULL.
613 * Must be atomic. */
614 int (*set_tim)(struct ieee80211_hw *hw, int aid, int set);
615
616 /* Set encryption key. IEEE 802.11 module calls this function to set
617 * encryption keys. addr is ff:ff:ff:ff:ff:ff for default keys and
618 * station hwaddr for individual keys. aid of the station is given
619 * to help low-level driver in selecting which key->hw_key_idx to use
620 * for this key. TX control data will use the hw_key_idx selected by
621 * the low-level driver.
622 * Must be atomic. */
623 int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd,
624 u8 *addr, struct ieee80211_key_conf *key, int aid);
625
626 /* Set TX key index for default/broadcast keys. This is needed in cases
627 * where wlan card is doing full WEP/TKIP encapsulation (wep_include_iv
628 * is not set), in other cases, this function pointer can be set to
629 * NULL since the IEEE 802. 11 module takes care of selecting the key
630 * index for each TX frame. */
631 int (*set_key_idx)(struct ieee80211_hw *hw, int idx);
632
633 /* Enable/disable IEEE 802.1X. This item requests wlan card to pass
634 * unencrypted EAPOL-Key frames even when encryption is configured.
635 * If the wlan card does not require such a configuration, this
636 * function pointer can be set to NULL. */
637 int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x);
638
639 /* Set port authorization state (IEEE 802.1X PAE) to be authorized
640 * (authorized=1) or unauthorized (authorized=0). This function can be
641 * used if the wlan hardware or low-level driver implements PAE.
642 * 80211.o module will anyway filter frames based on authorization
643 * state, so this function pointer can be NULL if low-level driver does
644 * not require event notification about port state changes.
645 * Currently unused. */
646 int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr,
647 int authorized);
648
649 /* Ask the hardware to service the scan request, no need to start
650 * the scan state machine in stack. */
651 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
652
653 /* return low-level statistics */
654 int (*get_stats)(struct ieee80211_hw *hw,
655 struct ieee80211_low_level_stats *stats);
656
657 /* For devices that generate their own beacons and probe response
658 * or association responses this updates the state of privacy_invoked
659 * returns 0 for success or an error number */
660 int (*set_privacy_invoked)(struct ieee80211_hw *hw,
661 int privacy_invoked);
662
663 /* For devices that have internal sequence counters, allow 802.11
664 * code to access the current value of a counter */
665 int (*get_sequence_counter)(struct ieee80211_hw *hw,
666 u8* addr, u8 keyidx, u8 txrx,
667 u32* iv32, u16* iv16);
668
669 /* Configuration of RTS threshold (if device needs it) */
670 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
671
672 /* Configuration of fragmentation threshold.
673 * Assign this if the device does fragmentation by itself,
674 * if this method is assigned then the stack will not do
675 * fragmentation. */
676 int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
677
678 /* Configuration of retry limits (if device needs it) */
679 int (*set_retry_limit)(struct ieee80211_hw *hw,
680 u32 short_retry, u32 long_retr);
681
682 /* Number of STAs in STA table notification (NULL = disabled).
683 * Must be atomic. */
684 void (*sta_table_notification)(struct ieee80211_hw *hw,
685 int num_sta);
686
687 /* Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
688 * bursting) for a hardware TX queue.
689 * queue = IEEE80211_TX_QUEUE_*.
690 * Must be atomic. */
691 int (*conf_tx)(struct ieee80211_hw *hw, int queue,
692 const struct ieee80211_tx_queue_params *params);
693
694 /* Get statistics of the current TX queue status. This is used to get
695 * number of currently queued packets (queue length), maximum queue
696 * size (limit), and total number of packets sent using each TX queue
697 * (count).
698 * Currently unused. */
699 int (*get_tx_stats)(struct ieee80211_hw *hw,
700 struct ieee80211_tx_queue_stats *stats);
701
702 /* Get the current TSF timer value from firmware/hardware. Currently,
703 * this is only used for IBSS mode debugging and, as such, is not a
704 * required function.
705 * Must be atomic. */
706 u64 (*get_tsf)(struct ieee80211_hw *hw);
707
708 /* Reset the TSF timer and allow firmware/hardware to synchronize with
709 * other STAs in the IBSS. This is only used in IBSS mode. This
710 * function is optional if the firmware/hardware takes full care of
711 * TSF synchronization. */
712 void (*reset_tsf)(struct ieee80211_hw *hw);
713
714 /* Setup beacon data for IBSS beacons. Unlike access point (Master),
715 * IBSS uses a fixed beacon frame which is configured using this
716 * function. This handler is required only for IBSS mode. */
717 int (*beacon_update)(struct ieee80211_hw *hw,
718 struct sk_buff *skb,
719 struct ieee80211_tx_control *control);
720
721 /* Determine whether the last IBSS beacon was sent by us. This is
722 * needed only for IBSS mode and the result of this function is used to
723 * determine whether to reply to Probe Requests. */
724 int (*tx_last_beacon)(struct ieee80211_hw *hw);
725};
726
727/* Allocate a new hardware device. This must be called once for each
728 * hardware device. The returned pointer must be used to refer to this
729 * device when calling other functions. 802.11 code allocates a private data
730 * area for the low-level driver. The size of this area is given as
731 * priv_data_len.
732 */
733struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
734 const struct ieee80211_ops *ops);
735
736/* Register hardware device to the IEEE 802.11 code and kernel. Low-level
737 * drivers must call this function before using any other IEEE 802.11
738 * function except ieee80211_register_hwmode. */
739int ieee80211_register_hw(struct ieee80211_hw *hw);
740
741/* driver can use this and ieee80211_get_rx_led_name to get the
742 * name of the registered LEDs after ieee80211_register_hw
743 * was called.
744 * This is useful to set the default trigger on the LED class
745 * device that your driver should export for each LED the device
746 * has, that way the default behaviour will be as expected but
747 * the user can still change it/turn off the LED etc.
748 */
749#ifdef CONFIG_MAC80211_LEDS
750extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
751extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
752#endif
753static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
754{
755#ifdef CONFIG_MAC80211_LEDS
756 return __ieee80211_get_tx_led_name(hw);
757#else
758 return NULL;
759#endif
760}
761
762static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
763{
764#ifdef CONFIG_MAC80211_LEDS
765 return __ieee80211_get_rx_led_name(hw);
766#else
767 return NULL;
768#endif
769}
770
771/* Register a new hardware PHYMODE capability to the stack. */
772int ieee80211_register_hwmode(struct ieee80211_hw *hw,
773 struct ieee80211_hw_mode *mode);
774
775/* Unregister a hardware device. This function instructs 802.11 code to free
776 * allocated resources and unregister netdevices from the kernel. */
777void ieee80211_unregister_hw(struct ieee80211_hw *hw);
778
779/* Free everything that was allocated including private data of a driver. */
780void ieee80211_free_hw(struct ieee80211_hw *hw);
781
782/* Receive frame callback function. The low-level driver uses this function to
783 * send received frames to the IEEE 802.11 code. Receive buffer (skb) must
784 * start with IEEE 802.11 header. */
785void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
786 struct ieee80211_rx_status *status);
787void ieee80211_rx_irqsafe(struct ieee80211_hw *hw,
788 struct sk_buff *skb,
789 struct ieee80211_rx_status *status);
790
791/* Transmit status callback function. The low-level driver must call this
792 * function to report transmit status for all the TX frames that had
793 * req_tx_status set in the transmit control fields. In addition, this should
794 * be called at least for all unicast frames to provide information for TX rate
795 * control algorithm. In order to maintain all statistics, this function is
796 * recommended to be called after each frame, including multicast/broadcast, is
797 * sent. */
798void ieee80211_tx_status(struct ieee80211_hw *hw,
799 struct sk_buff *skb,
800 struct ieee80211_tx_status *status);
801void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
802 struct sk_buff *skb,
803 struct ieee80211_tx_status *status);
804
805/**
806 * ieee80211_beacon_get - beacon generation function
807 * @hw: pointer obtained from ieee80211_alloc_hw().
808 * @if_id: interface ID from &struct ieee80211_if_init_conf.
809 * @control: will be filled with information needed to send this beacon.
810 *
811 * If the beacon frames are generated by the host system (i.e., not in
812 * hardware/firmware), the low-level driver uses this function to receive
813 * the next beacon frame from the 802.11 code. The low-level is responsible
814 * for calling this function before beacon data is needed (e.g., based on
815 * hardware interrupt). Returned skb is used only once and low-level driver
816 * is responsible of freeing it.
817 */
818struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
819 int if_id,
820 struct ieee80211_tx_control *control);
821
822/**
823 * ieee80211_rts_get - RTS frame generation function
824 * @hw: pointer obtained from ieee80211_alloc_hw().
825 * @frame: pointer to the frame that is going to be protected by the RTS.
826 * @frame_len: the frame length (in octets).
827 * @frame_txctl: &struct ieee80211_tx_control of the frame.
828 * @rts: The buffer where to store the RTS frame.
829 *
830 * If the RTS frames are generated by the host system (i.e., not in
831 * hardware/firmware), the low-level driver uses this function to receive
832 * the next RTS frame from the 802.11 code. The low-level is responsible
833 * for calling this function before and RTS frame is needed.
834 */
835void ieee80211_rts_get(struct ieee80211_hw *hw,
836 const void *frame, size_t frame_len,
837 const struct ieee80211_tx_control *frame_txctl,
838 struct ieee80211_rts *rts);
839
840/**
841 * ieee80211_rts_duration - Get the duration field for an RTS frame
842 * @hw: pointer obtained from ieee80211_alloc_hw().
843 * @frame_len: the length of the frame that is going to be protected by the RTS.
844 * @frame_txctl: &struct ieee80211_tx_control of the frame.
845 *
846 * If the RTS is generated in firmware, but the host system must provide
847 * the duration field, the low-level driver uses this function to receive
848 * the duration field value in little-endian byteorder.
849 */
850__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
851 size_t frame_len,
852 const struct ieee80211_tx_control *frame_txctl);
853
854/**
855 * ieee80211_ctstoself_get - CTS-to-self frame generation function
856 * @hw: pointer obtained from ieee80211_alloc_hw().
857 * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
858 * @frame_len: the frame length (in octets).
859 * @frame_txctl: &struct ieee80211_tx_control of the frame.
860 * @cts: The buffer where to store the CTS-to-self frame.
861 *
862 * If the CTS-to-self frames are generated by the host system (i.e., not in
863 * hardware/firmware), the low-level driver uses this function to receive
864 * the next CTS-to-self frame from the 802.11 code. The low-level is responsible
865 * for calling this function before and CTS-to-self frame is needed.
866 */
867void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
868 const void *frame, size_t frame_len,
869 const struct ieee80211_tx_control *frame_txctl,
870 struct ieee80211_cts *cts);
871
872/**
873 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
874 * @hw: pointer obtained from ieee80211_alloc_hw().
875 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
876 * @frame_txctl: &struct ieee80211_tx_control of the frame.
877 *
878 * If the CTS-to-self is generated in firmware, but the host system must provide
879 * the duration field, the low-level driver uses this function to receive
880 * the duration field value in little-endian byteorder.
881 */
882__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
883 size_t frame_len,
884 const struct ieee80211_tx_control *frame_txctl);
885
886/**
887 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
888 * @hw: pointer obtained from ieee80211_alloc_hw().
889 * @frame_len: the length of the frame.
890 * @rate: the rate (in 100kbps) at which the frame is going to be transmitted.
891 *
892 * Calculate the duration field of some generic frame, given its
893 * length and transmission rate (in 100kbps).
894 */
895__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
896 size_t frame_len,
897 int rate);
898
899/**
900 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
901 * @hw: pointer as obtained from ieee80211_alloc_hw().
902 * @if_id: interface ID from &struct ieee80211_if_init_conf.
903 * @control: will be filled with information needed to send returned frame.
904 *
905 * Function for accessing buffered broadcast and multicast frames. If
906 * hardware/firmware does not implement buffering of broadcast/multicast
907 * frames when power saving is used, 802.11 code buffers them in the host
908 * memory. The low-level driver uses this function to fetch next buffered
909 * frame. In most cases, this is used when generating beacon frame. This
910 * function returns a pointer to the next buffered skb or NULL if no more
911 * buffered frames are available.
912 *
913 * Note: buffered frames are returned only after DTIM beacon frame was
914 * generated with ieee80211_beacon_get() and the low-level driver must thus
915 * call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns
916 * NULL if the previous generated beacon was not DTIM, so the low-level driver
917 * does not need to check for DTIM beacons separately and should be able to
918 * use common code for all beacons.
919 */
920struct sk_buff *
921ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id,
922 struct ieee80211_tx_control *control);
923
924/* Low level drivers that have their own MLME and MAC indicate
925 * the aid for an associating station with this call */
926int ieee80211_set_aid_for_sta(struct ieee80211_hw *hw,
927 u8 *peer_address, u16 aid);
928
929
930/* Given an sk_buff with a raw 802.11 header at the data pointer this function
931 * returns the 802.11 header length in bytes (not including encryption
932 * headers). If the data in the sk_buff is too short to contain a valid 802.11
933 * header the function returns 0.
934 */
935int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
936
937/* Like ieee80211_get_hdrlen_from_skb() but takes a FC in CPU order. */
938int ieee80211_get_hdrlen(u16 fc);
939
940/**
941 * ieee80211_wake_queue - wake specific queue
942 * @hw: pointer as obtained from ieee80211_alloc_hw().
943 * @queue: queue number (counted from zero).
944 *
945 * Drivers should use this function instead of netif_wake_queue.
946 */
947void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
948
949/**
950 * ieee80211_stop_queue - stop specific queue
951 * @hw: pointer as obtained from ieee80211_alloc_hw().
952 * @queue: queue number (counted from zero).
953 *
954 * Drivers should use this function instead of netif_stop_queue.
955 */
956void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
957
958/**
959 * ieee80211_start_queues - start all queues
960 * @hw: pointer to as obtained from ieee80211_alloc_hw().
961 *
962 * Drivers should use this function instead of netif_start_queue.
963 */
964void ieee80211_start_queues(struct ieee80211_hw *hw);
965
966/**
967 * ieee80211_stop_queues - stop all queues
968 * @hw: pointer as obtained from ieee80211_alloc_hw().
969 *
970 * Drivers should use this function instead of netif_stop_queue.
971 */
972void ieee80211_stop_queues(struct ieee80211_hw *hw);
973
974/**
975 * ieee80211_wake_queues - wake all queues
976 * @hw: pointer as obtained from ieee80211_alloc_hw().
977 *
978 * Drivers should use this function instead of netif_wake_queue.
979 */
980void ieee80211_wake_queues(struct ieee80211_hw *hw);
981
982/**
983 * ieee80211_get_mc_list_item - iteration over items in multicast list
984 * @hw: pointer as obtained from ieee80211_alloc_hw().
985 * @prev: value returned by previous call to ieee80211_get_mc_list_item() or
986 * NULL to start a new iteration.
987 * @ptr: pointer to buffer of void * type for internal usage of
988 * ieee80211_get_mc_list_item().
989 *
990 * Iterates over items in multicast list of given device. To get the first
991 * item, pass NULL in @prev and in *@ptr. In subsequent calls, pass the
992 * value returned by previous call in @prev. Don't alter *@ptr during
993 * iteration. When there are no more items, NULL is returned.
994 */
995struct dev_mc_list *
996ieee80211_get_mc_list_item(struct ieee80211_hw *hw,
997 struct dev_mc_list *prev,
998 void **ptr);
999
1000/* called by driver to notify scan status completed */
1001void ieee80211_scan_completed(struct ieee80211_hw *hw);
1002
1003/* Function to indicate Radar Detection. The low level driver must call this
1004 * function to indicate the presence of radar in the current channel.
1005 * Additionally the radar type also could be sent */
1006int ieee80211_radar_status(struct ieee80211_hw *hw, int channel,
1007 int radar, int radar_type);
1008
1009/* return a pointer to the source address (SA) */
1010static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
1011{
1012 u8 *raw = (u8 *) hdr;
1013 u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
1014
1015 switch (tofrom) {
1016 case 2:
1017 return hdr->addr3;
1018 case 3:
1019 return hdr->addr4;
1020 }
1021 return hdr->addr2;
1022}
1023
1024/* return a pointer to the destination address (DA) */
1025static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1026{
1027 u8 *raw = (u8 *) hdr;
1028 u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
1029
1030 if (to_ds)
1031 return hdr->addr3;
1032 return hdr->addr1;
1033}
1034
1035static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
1036{
1037 return (le16_to_cpu(hdr->frame_control) &
1038 IEEE80211_FCTL_MOREFRAGS) != 0;
1039}
1040
1041#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
1042#define MAC_ARG(x) ((u8*)(x))[0], ((u8*)(x))[1], ((u8*)(x))[2], \
1043 ((u8*)(x))[3], ((u8*)(x))[4], ((u8*)(x))[5]
1044
1045#endif /* MAC80211_H */
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index ad7fe112141..a4f26187fc1 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -24,6 +24,7 @@
24 24
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <net/rtnetlink.h>
27 28
28#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) 29#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE)
29#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) 30#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
@@ -213,16 +214,7 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
213extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); 214extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat);
214extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); 215extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev);
215 216
216struct netlink_callback;
217struct nlmsghdr;
218extern int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
219extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
220extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
221extern void neigh_app_ns(struct neighbour *n); 217extern void neigh_app_ns(struct neighbour *n);
222
223extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
224extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
225
226extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 218extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
227extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); 219extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
228extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); 220extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0e690e34c00..1c6b8bd09b9 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -250,6 +250,11 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
250 return test_bit(IPS_DYING_BIT, &ct->status); 250 return test_bit(IPS_DYING_BIT, &ct->status);
251} 251}
252 252
253static inline int nf_ct_is_untracked(const struct sk_buff *skb)
254{
255 return (skb->nfct == &nf_conntrack_untracked.ct_general);
256}
257
253extern unsigned int nf_conntrack_htable_size; 258extern unsigned int nf_conntrack_htable_size;
254extern int nf_conntrack_checksum; 259extern int nf_conntrack_checksum;
255extern atomic_t nf_conntrack_count; 260extern atomic_t nf_conntrack_count;
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
deleted file mode 100644
index 6f84c1f7fcd..00000000000
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ /dev/null
@@ -1,145 +0,0 @@
1#ifndef _NF_CONNTRACK_COMPAT_H
2#define _NF_CONNTRACK_COMPAT_H
3
4#ifdef __KERNEL__
5
6#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE)
7
8#include <linux/netfilter_ipv4/ip_conntrack.h>
9#include <linux/socket.h>
10
11#ifdef CONFIG_IP_NF_CONNTRACK_MARK
12static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
13 u_int32_t *ctinfo)
14{
15 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
16
17 if (ct)
18 return &ct->mark;
19 else
20 return NULL;
21}
22#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
23
24#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
25static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
26 u_int32_t *ctinfo)
27{
28 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
29
30 if (ct)
31 return &ct->secmark;
32 else
33 return NULL;
34}
35#endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */
36
37#ifdef CONFIG_IP_NF_CT_ACCT
38static inline struct ip_conntrack_counter *
39nf_ct_get_counters(const struct sk_buff *skb)
40{
41 enum ip_conntrack_info ctinfo;
42 struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo);
43
44 if (ct)
45 return ct->counters;
46 else
47 return NULL;
48}
49#endif /* CONFIG_IP_NF_CT_ACCT */
50
51static inline int nf_ct_is_untracked(const struct sk_buff *skb)
52{
53 return (skb->nfct == &ip_conntrack_untracked.ct_general);
54}
55
56static inline void nf_ct_untrack(struct sk_buff *skb)
57{
58 skb->nfct = &ip_conntrack_untracked.ct_general;
59}
60
61static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
62 enum ip_conntrack_info *ctinfo)
63{
64 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
65 return (ct != NULL);
66}
67
68static inline int nf_ct_l3proto_try_module_get(unsigned short l3proto)
69{
70 need_conntrack();
71 return l3proto == PF_INET ? 0 : -1;
72}
73
74static inline void nf_ct_l3proto_module_put(unsigned short l3proto)
75{
76}
77
78#else /* CONFIG_IP_NF_CONNTRACK */
79
80#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
81#include <net/netfilter/nf_conntrack.h>
82
83#ifdef CONFIG_NF_CONNTRACK_MARK
84
85static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
86 u_int32_t *ctinfo)
87{
88 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
89
90 if (ct)
91 return &ct->mark;
92 else
93 return NULL;
94}
95#endif /* CONFIG_NF_CONNTRACK_MARK */
96
97#ifdef CONFIG_NF_CONNTRACK_SECMARK
98static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
99 u_int32_t *ctinfo)
100{
101 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
102
103 if (ct)
104 return &ct->secmark;
105 else
106 return NULL;
107}
108#endif /* CONFIG_NF_CONNTRACK_MARK */
109
110#ifdef CONFIG_NF_CT_ACCT
111static inline struct ip_conntrack_counter *
112nf_ct_get_counters(const struct sk_buff *skb)
113{
114 enum ip_conntrack_info ctinfo;
115 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
116
117 if (ct)
118 return ct->counters;
119 else
120 return NULL;
121}
122#endif /* CONFIG_NF_CT_ACCT */
123
124static inline int nf_ct_is_untracked(const struct sk_buff *skb)
125{
126 return (skb->nfct == &nf_conntrack_untracked.ct_general);
127}
128
129static inline void nf_ct_untrack(struct sk_buff *skb)
130{
131 skb->nfct = &nf_conntrack_untracked.ct_general;
132}
133
134static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
135 enum ip_conntrack_info *ctinfo)
136{
137 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
138 return (ct != NULL);
139}
140
141#endif /* CONFIG_IP_NF_CONNTRACK */
142
143#endif /* __KERNEL__ */
144
145#endif /* _NF_CONNTRACK_COMPAT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 85634e1865c..9fb906688ff 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -27,6 +27,9 @@ extern unsigned int nf_conntrack_in(int pf,
27extern int nf_conntrack_init(void); 27extern int nf_conntrack_init(void);
28extern void nf_conntrack_cleanup(void); 28extern void nf_conntrack_cleanup(void);
29 29
30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void);
32
30struct nf_conntrack_l3proto; 33struct nf_conntrack_l3proto;
31extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); 34extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
32/* Like above, but you already have conntrack read lock. */ 35/* Like above, but you already have conntrack read lock. */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index b62a8a9ec9d..811c9073c53 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -20,30 +20,8 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) 20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
21 21
22extern struct atomic_notifier_head nf_conntrack_chain; 22extern struct atomic_notifier_head nf_conntrack_chain;
23extern struct atomic_notifier_head nf_conntrack_expect_chain; 23extern int nf_conntrack_register_notifier(struct notifier_block *nb);
24 24extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
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 25
48extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 26extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
49extern void __nf_ct_event_cache_init(struct nf_conn *ct); 27extern void __nf_ct_event_cache_init(struct nf_conn *ct);
@@ -71,6 +49,10 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event,
71 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); 49 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
72} 50}
73 51
52extern struct atomic_notifier_head nf_conntrack_expect_chain;
53extern int nf_conntrack_expect_register_notifier(struct notifier_block *nb);
54extern int nf_conntrack_expect_unregister_notifier(struct notifier_block *nb);
55
74static inline void 56static inline void
75nf_conntrack_expect_event(enum ip_conntrack_expect_events event, 57nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
76 struct nf_conntrack_expect *exp) 58 struct nf_conntrack_expect *exp)
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index eb575cbd4c9..f32f714e5d9 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -90,10 +90,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
90/* Protocol registration. */ 90/* Protocol registration. */
91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
92extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 92extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
93 93extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
94extern struct nf_conntrack_l3proto *
95nf_ct_l3proto_find_get(u_int16_t l3proto);
96
97extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 94extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
98 95
99/* Existing built-in protocols */ 96/* Existing built-in protocols */
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 8415182ec12..f46cb930414 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -97,7 +97,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; 97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
98 98
99#define MAX_NF_CT_PROTO 256 99#define MAX_NF_CT_PROTO 256
100extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX];
101 100
102extern struct nf_conntrack_l4proto * 101extern struct nf_conntrack_l4proto *
103__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 102__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index f191c672bcc..e76565459ad 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -4,16 +4,6 @@
4#include <net/netfilter/nf_nat.h> 4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h> 5#include <linux/netfilter_ipv4/ip_tables.h>
6 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; 7extern int nf_nat_rule_init(void) __init;
18extern void nf_nat_rule_cleanup(void); 8extern void nf_nat_rule_cleanup(void);
19extern int nf_nat_rule_find(struct sk_buff **pskb, 9extern int nf_nat_rule_find(struct sk_buff **pskb,
diff --git a/include/net/netlink.h b/include/net/netlink.h
index bcaf67b7a19..0bf325c29af 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -171,6 +171,7 @@ enum {
171 NLA_MSECS, 171 NLA_MSECS,
172 NLA_NESTED, 172 NLA_NESTED,
173 NLA_NUL_STRING, 173 NLA_NUL_STRING,
174 NLA_BINARY,
174 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
175}; 176};
176 177
@@ -188,12 +189,13 @@ enum {
188 * NLA_STRING Maximum length of string 189 * NLA_STRING Maximum length of string
189 * NLA_NUL_STRING Maximum length of string (excluding NUL) 190 * NLA_NUL_STRING Maximum length of string (excluding NUL)
190 * NLA_FLAG Unused 191 * NLA_FLAG Unused
192 * NLA_BINARY Maximum length of attribute payload
191 * All other Exact length of attribute payload 193 * All other Exact length of attribute payload
192 * 194 *
193 * Example: 195 * Example:
194 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 196 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
195 * [ATTR_FOO] = { .type = NLA_U16 }, 197 * [ATTR_FOO] = { .type = NLA_U16 },
196 * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, 198 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
197 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 199 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
198 * }; 200 * };
199 */ 201 */
@@ -214,9 +216,7 @@ struct nl_info {
214 216
215extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, 217extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
216 int (*cb)(struct sk_buff *, 218 int (*cb)(struct sk_buff *,
217 struct nlmsghdr *, int *)); 219 struct nlmsghdr *));
218extern void netlink_queue_skip(struct nlmsghdr *nlh,
219 struct sk_buff *skb);
220extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 220extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
221 u32 pid, unsigned int group, int report, 221 u32 pid, unsigned int group, int report,
222 gfp_t flags); 222 gfp_t flags);
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
525 */ 525 */
526static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) 526static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
527{ 527{
528 nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; 528 nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh;
529 529
530 return skb->len; 530 return skb->len;
531} 531}
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
538 */ 538 */
539static inline void *nlmsg_get_pos(struct sk_buff *skb) 539static inline void *nlmsg_get_pos(struct sk_buff *skb)
540{ 540{
541 return skb->tail; 541 return skb_tail_pointer(skb);
542} 542}
543 543
544/** 544/**
@@ -548,7 +548,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
548 * 548 *
549 * Trims the message to the provided mark. Returns -1. 549 * Trims the message to the provided mark. Returns -1.
550 */ 550 */
551static inline int nlmsg_trim(struct sk_buff *skb, void *mark) 551static inline int nlmsg_trim(struct sk_buff *skb, const void *mark)
552{ 552{
553 if (mark) 553 if (mark)
554 skb_trim(skb, (unsigned char *) mark - skb->data); 554 skb_trim(skb, (unsigned char *) mark - skb->data);
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla)
940 */ 940 */
941static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) 941static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
942{ 942{
943 struct nlattr *start = (struct nlattr *) skb->tail; 943 struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
944 944
945 if (nla_put(skb, attrtype, 0, NULL) < 0) 945 if (nla_put(skb, attrtype, 0, NULL) < 0)
946 return NULL; 946 return NULL;
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
960 */ 960 */
961static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) 961static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
962{ 962{
963 start->nla_len = skb->tail - (unsigned char *) start; 963 start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start;
964 return skb->len; 964 return skb->len;
965} 965}
966 966
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 02647fe3d74..4129df70807 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -326,18 +326,18 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
326 case TCF_LAYER_LINK: 326 case TCF_LAYER_LINK:
327 return skb->data; 327 return skb->data;
328 case TCF_LAYER_NETWORK: 328 case TCF_LAYER_NETWORK:
329 return skb->nh.raw; 329 return skb_network_header(skb);
330 case TCF_LAYER_TRANSPORT: 330 case TCF_LAYER_TRANSPORT:
331 return skb->h.raw; 331 return skb_transport_header(skb);
332 } 332 }
333 333
334 return NULL; 334 return NULL;
335} 335}
336 336
337static inline int tcf_valid_offset(struct sk_buff *skb, unsigned char *ptr, 337static inline int tcf_valid_offset(const struct sk_buff *skb,
338 int len) 338 const unsigned char *ptr, const int len)
339{ 339{
340 return unlikely((ptr + len) < skb->tail && ptr > skb->head); 340 return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head);
341} 341}
342 342
343#ifdef CONFIG_NET_CLS_IND 343#ifdef CONFIG_NET_CLS_IND
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index f6afee73235..5754d53d9ef 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -2,6 +2,7 @@
2#define __NET_PKT_SCHED_H 2#define __NET_PKT_SCHED_H
3 3
4#include <linux/jiffies.h> 4#include <linux/jiffies.h>
5#include <linux/ktime.h>
5#include <net/sch_generic.h> 6#include <net/sch_generic.h>
6 7
7struct qdisc_walker 8struct qdisc_walker
@@ -12,8 +13,6 @@ struct qdisc_walker
12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); 13 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
13}; 14};
14 15
15extern rwlock_t qdisc_tree_lock;
16
17#define QDISC_ALIGNTO 32 16#define QDISC_ALIGNTO 32
18#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) 17#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
19 18
@@ -37,175 +36,38 @@ static inline void *qdisc_priv(struct Qdisc *q)
37 The things are not so bad, because we may use artifical 36 The things are not so bad, because we may use artifical
38 clock evaluated by integration of network data flow 37 clock evaluated by integration of network data flow
39 in the most critical places. 38 in the most critical places.
40
41 Note: we do not use fastgettimeofday.
42 The reason is that, when it is not the same thing as
43 gettimeofday, it returns invalid timestamp, which is
44 not updated, when net_bh is active.
45 */
46
47/* General note about internal clock.
48
49 Any clock source returns time intervals, measured in units
50 close to 1usec. With source CONFIG_NET_SCH_CLK_GETTIMEOFDAY it is precisely
51 microseconds, otherwise something close but different chosen to minimize
52 arithmetic cost. Ratio usec/internal untis in form nominator/denominator
53 may be read from /proc/net/psched.
54 */ 39 */
55 40
56
57#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
58
59typedef struct timeval psched_time_t;
60typedef long psched_tdiff_t;
61
62#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))
63#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs)
64#define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay)
65
66#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
67
68typedef u64 psched_time_t; 41typedef u64 psched_time_t;
69typedef long psched_tdiff_t; 42typedef long psched_tdiff_t;
70 43
71#ifdef CONFIG_NET_SCH_CLK_JIFFIES 44/* Avoid doing 64 bit divide by 1000 */
72 45#define PSCHED_US2NS(x) ((s64)(x) << 10)
73#if HZ < 96 46#define PSCHED_NS2US(x) ((x) >> 10)
74#define PSCHED_JSCALE 14
75#elif HZ >= 96 && HZ < 192
76#define PSCHED_JSCALE 13
77#elif HZ >= 192 && HZ < 384
78#define PSCHED_JSCALE 12
79#elif HZ >= 384 && HZ < 768
80#define PSCHED_JSCALE 11
81#elif HZ >= 768
82#define PSCHED_JSCALE 10
83#endif
84 47
85#define PSCHED_GET_TIME(stamp) ((stamp) = (get_jiffies_64()<<PSCHED_JSCALE)) 48#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC)
86#define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE) 49#define PSCHED_PASTPERFECT 0
87#define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE) 50
88 51static inline psched_time_t psched_get_time(void)
89#endif /* CONFIG_NET_SCH_CLK_JIFFIES */
90#ifdef CONFIG_NET_SCH_CLK_CPU
91#include <asm/timex.h>
92
93extern psched_tdiff_t psched_clock_per_hz;
94extern int psched_clock_scale;
95extern psched_time_t psched_time_base;
96extern cycles_t psched_time_mark;
97
98#define PSCHED_GET_TIME(stamp) \
99do { \
100 cycles_t cur = get_cycles(); \
101 if (sizeof(cycles_t) == sizeof(u32)) { \
102 if (cur <= psched_time_mark) \
103 psched_time_base += 0x100000000ULL; \
104 psched_time_mark = cur; \
105 (stamp) = (psched_time_base + cur)>>psched_clock_scale; \
106 } else { \
107 (stamp) = cur>>psched_clock_scale; \
108 } \
109} while (0)
110#define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
111#define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
112
113#endif /* CONFIG_NET_SCH_CLK_CPU */
114
115#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
116
117#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
118#define PSCHED_TDIFF(tv1, tv2) \
119({ \
120 int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \
121 int __delta = (tv1).tv_usec - (tv2).tv_usec; \
122 if (__delta_sec) { \
123 switch (__delta_sec) { \
124 default: \
125 __delta = 0; \
126 case 2: \
127 __delta += USEC_PER_SEC; \
128 case 1: \
129 __delta += USEC_PER_SEC; \
130 } \
131 } \
132 __delta; \
133})
134
135static inline int
136psched_tod_diff(int delta_sec, int bound)
137{ 52{
138 int delta; 53 return PSCHED_NS2US(ktime_to_ns(ktime_get()));
139
140 if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1)
141 return bound;
142 delta = delta_sec * USEC_PER_SEC;
143 if (delta > bound || delta < 0)
144 delta = bound;
145 return delta;
146} 54}
147 55
148#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ 56static inline psched_tdiff_t
149({ \ 57psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
150 int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ 58{
151 int __delta = (tv1).tv_usec - (tv2).tv_usec; \ 59 return min(tv1 - tv2, bound);
152 switch (__delta_sec) { \ 60}
153 default: \
154 __delta = psched_tod_diff(__delta_sec, bound); break; \
155 case 2: \
156 __delta += USEC_PER_SEC; \
157 case 1: \
158 __delta += USEC_PER_SEC; \
159 case 0: \
160 if (__delta > bound || __delta < 0) \
161 __delta = bound; \
162 } \
163 __delta; \
164})
165
166#define PSCHED_TLESS(tv1, tv2) (((tv1).tv_usec < (tv2).tv_usec && \
167 (tv1).tv_sec <= (tv2).tv_sec) || \
168 (tv1).tv_sec < (tv2).tv_sec)
169
170#define PSCHED_TADD2(tv, delta, tv_res) \
171({ \
172 int __delta = (tv).tv_usec + (delta); \
173 (tv_res).tv_sec = (tv).tv_sec; \
174 while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
175 (tv_res).tv_usec = __delta; \
176})
177
178#define PSCHED_TADD(tv, delta) \
179({ \
180 (tv).tv_usec += (delta); \
181 while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \
182 (tv).tv_usec -= USEC_PER_SEC; } \
183})
184
185/* Set/check that time is in the "past perfect";
186 it depends on concrete representation of system time
187 */
188
189#define PSCHED_SET_PASTPERFECT(t) ((t).tv_sec = 0)
190#define PSCHED_IS_PASTPERFECT(t) ((t).tv_sec == 0)
191
192#define PSCHED_AUDIT_TDIFF(t) ({ if ((t) > 2000000) (t) = 2000000; })
193
194#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
195
196#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
197#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
198 min_t(long long, (tv1) - (tv2), bound)
199
200 61
201#define PSCHED_TLESS(tv1, tv2) ((tv1) < (tv2)) 62struct qdisc_watchdog {
202#define PSCHED_TADD2(tv, delta, tv_res) ((tv_res) = (tv) + (delta)) 63 struct hrtimer timer;
203#define PSCHED_TADD(tv, delta) ((tv) += (delta)) 64 struct Qdisc *qdisc;
204#define PSCHED_SET_PASTPERFECT(t) ((t) = 0) 65};
205#define PSCHED_IS_PASTPERFECT(t) ((t) == 0)
206#define PSCHED_AUDIT_TDIFF(t)
207 66
208#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ 67extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
68extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
69 psched_time_t expires);
70extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
209 71
210extern struct Qdisc_ops pfifo_qdisc_ops; 72extern struct Qdisc_ops pfifo_qdisc_ops;
211extern struct Qdisc_ops bfifo_qdisc_ops; 73extern struct Qdisc_ops bfifo_qdisc_ops;
diff --git a/include/net/red.h b/include/net/red.h
index a4eb37946f2..3cf31d466a8 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -151,17 +151,17 @@ static inline void red_set_parms(struct red_parms *p,
151 151
152static inline int red_is_idling(struct red_parms *p) 152static inline int red_is_idling(struct red_parms *p)
153{ 153{
154 return !PSCHED_IS_PASTPERFECT(p->qidlestart); 154 return p->qidlestart != PSCHED_PASTPERFECT;
155} 155}
156 156
157static inline void red_start_of_idle_period(struct red_parms *p) 157static inline void red_start_of_idle_period(struct red_parms *p)
158{ 158{
159 PSCHED_GET_TIME(p->qidlestart); 159 p->qidlestart = psched_get_time();
160} 160}
161 161
162static inline void red_end_of_idle_period(struct red_parms *p) 162static inline void red_end_of_idle_period(struct red_parms *p)
163{ 163{
164 PSCHED_SET_PASTPERFECT(p->qidlestart); 164 p->qidlestart = PSCHED_PASTPERFECT;
165} 165}
166 166
167static inline void red_restart(struct red_parms *p) 167static inline void red_restart(struct red_parms *p)
@@ -177,8 +177,8 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
177 long us_idle; 177 long us_idle;
178 int shift; 178 int shift;
179 179
180 PSCHED_GET_TIME(now); 180 now = psched_get_time();
181 us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); 181 us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);
182 182
183 /* 183 /*
184 * The problem: ideally, average length queue recalcultion should 184 * The problem: ideally, average length queue recalcultion should
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
new file mode 100644
index 00000000000..3b3d4745618
--- /dev/null
+++ b/include/net/rtnetlink.h
@@ -0,0 +1,25 @@
1#ifndef __NET_RTNETLINK_H
2#define __NET_RTNETLINK_H
3
4#include <linux/rtnetlink.h>
5#include <net/netlink.h>
6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9
10extern int __rtnl_register(int protocol, int msgtype,
11 rtnl_doit_func, rtnl_dumpit_func);
12extern void rtnl_register(int protocol, int msgtype,
13 rtnl_doit_func, rtnl_dumpit_func);
14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol);
16
17static inline int rtnl_msg_family(struct nlmsghdr *nlh)
18{
19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
21 else
22 return AF_UNSPEC;
23}
24
25#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 82086392735..1b8e35197eb 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -5,10 +5,10 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/rcupdate.h> 6#include <linux/rcupdate.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/rtnetlink.h>
9#include <linux/pkt_sched.h> 8#include <linux/pkt_sched.h>
10#include <linux/pkt_cls.h> 9#include <linux/pkt_cls.h>
11#include <net/gen_stats.h> 10#include <net/gen_stats.h>
11#include <net/rtnetlink.h>
12 12
13struct Qdisc_ops; 13struct Qdisc_ops;
14struct qdisc_walker; 14struct qdisc_walker;
@@ -177,14 +177,8 @@ extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
177extern 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);
178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, 178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
179 struct Qdisc_ops *ops, u32 parentid); 179 struct Qdisc_ops *ops, u32 parentid);
180 180extern void tcf_destroy(struct tcf_proto *tp);
181static inline void 181extern void tcf_destroy_chain(struct tcf_proto *fl);
182tcf_destroy(struct tcf_proto *tp)
183{
184 tp->ops->destroy(tp);
185 module_put(tp->ops->owner);
186 kfree(tp);
187}
188 182
189static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 183static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
190 struct sk_buff_head *list) 184 struct sk_buff_head *list)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 6114c4f54b0..f56c8d695a8 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -100,6 +100,8 @@ typedef enum {
100 SCTP_CMD_T3_RTX_TIMERS_STOP, /* Stops T3-rtx pending timers */ 100 SCTP_CMD_T3_RTX_TIMERS_STOP, /* Stops T3-rtx pending timers */
101 SCTP_CMD_FORCE_PRIM_RETRAN, /* Forces retrans. over primary path. */ 101 SCTP_CMD_FORCE_PRIM_RETRAN, /* Forces retrans. over primary path. */
102 SCTP_CMD_SET_SK_ERR, /* Set sk_err */ 102 SCTP_CMD_SET_SK_ERR, /* Set sk_err */
103 SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */
104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
103 SCTP_CMD_LAST 105 SCTP_CMD_LAST
104} sctp_verb_t; 106} sctp_verb_t;
105 107
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 5ddb8559986..bb37724495a 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -283,7 +283,7 @@ enum { SCTP_MAX_GABS = 16 };
283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ 283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */
284 284
285/* Maximum number of new data packets that can be sent in a burst. */ 285/* Maximum number of new data packets that can be sent in a burst. */
286#define SCTP_MAX_BURST 4 286#define SCTP_DEFAULT_MAX_BURST 4
287 287
288#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ 288#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */
289 289
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 28af6805952..dda72bf5b9b 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -378,11 +378,15 @@ static inline int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int
378 378
379int sctp_v6_init(void); 379int sctp_v6_init(void);
380void sctp_v6_exit(void); 380void sctp_v6_exit(void);
381int sctp_v6_add_protocol(void);
382void sctp_v6_del_protocol(void);
381 383
382#else /* #ifdef defined(CONFIG_IPV6) */ 384#else /* #ifdef defined(CONFIG_IPV6) */
383 385
384static inline int sctp_v6_init(void) { return 0; } 386static inline int sctp_v6_init(void) { return 0; }
385static inline void sctp_v6_exit(void) { return; } 387static inline void sctp_v6_exit(void) { return; }
388static inline int sctp_v6_add_protocol(void) { return 0; }
389static inline void sctp_v6_del_protocol(void) { return; }
386 390
387#endif /* #if defined(CONFIG_IPV6) */ 391#endif /* #if defined(CONFIG_IPV6) */
388 392
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index f431acf3dce..5e81984b847 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -276,6 +276,7 @@ struct sctp_sock {
276 __u32 default_context; 276 __u32 default_context;
277 __u32 default_timetolive; 277 __u32 default_timetolive;
278 __u32 default_rcv_context; 278 __u32 default_rcv_context;
279 int max_burst;
279 280
280 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 281 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
281 * the destination address every heartbeat interval. This value 282 * the destination address every heartbeat interval. This value
@@ -304,10 +305,12 @@ struct sctp_sock {
304 __u32 autoclose; 305 __u32 autoclose;
305 __u8 nodelay; 306 __u8 nodelay;
306 __u8 disable_fragments; 307 __u8 disable_fragments;
307 __u8 pd_mode;
308 __u8 v4mapped; 308 __u8 v4mapped;
309 __u8 frag_interleave;
309 __u32 adaptation_ind; 310 __u32 adaptation_ind;
311 __u32 pd_point;
310 312
313 atomic_t pd_mode;
311 /* Receive to here while partial delivery is in effect. */ 314 /* Receive to here while partial delivery is in effect. */
312 struct sk_buff_head pd_lobby; 315 struct sk_buff_head pd_lobby;
313}; 316};
@@ -1854,6 +1857,7 @@ int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
1854int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, 1857int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
1855 struct sctp_cookie*, 1858 struct sctp_cookie*,
1856 gfp_t gfp); 1859 gfp_t gfp);
1860int sctp_assoc_set_id(struct sctp_association *, gfp_t);
1857 1861
1858int sctp_cmp_addr_exact(const union sctp_addr *ss1, 1862int sctp_cmp_addr_exact(const union sctp_addr *ss1,
1859 const union sctp_addr *ss2); 1863 const union sctp_addr *ss2);
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 2923e3d31a0..de88ed5b0ba 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -89,6 +89,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
89 __u16 error, 89 __u16 error,
90 __u16 outbound, 90 __u16 outbound,
91 __u16 inbound, 91 __u16 inbound,
92 struct sctp_chunk *chunk,
92 gfp_t gfp); 93 gfp_t gfp);
93 94
94struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 95struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index ab26ab3adae..39ea3f442b4 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -78,7 +78,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); 78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
79 79
80/* Clear the partial data delivery condition on this socket. */ 80/* Clear the partial data delivery condition on this socket. */
81int sctp_clear_pd(struct sock *sk); 81int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc);
82 82
83/* Skip over an SSN. */ 83/* Skip over an SSN. */
84void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); 84void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 67a30eb2b3a..6d2b57758cc 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -97,6 +97,12 @@ enum sctp_optname {
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME 97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
98 SCTP_CONTEXT, /* Receive Context */ 98 SCTP_CONTEXT, /* Receive Context */
99#define SCTP_CONTEXT SCTP_CONTEXT 99#define SCTP_CONTEXT SCTP_CONTEXT
100 SCTP_FRAGMENT_INTERLEAVE,
101#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE
102 SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */
103#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT
104 SCTP_MAX_BURST, /* Set/Get max burst */
105#define SCTP_MAX_BURST SCTP_MAX_BURST
100 106
101 /* Internal Socket Options. Some of the sctp library functions are 107 /* Internal Socket Options. Some of the sctp library functions are
102 * implemented using these socket options. 108 * implemented using these socket options.
@@ -213,6 +219,7 @@ struct sctp_assoc_change {
213 __u16 sac_outbound_streams; 219 __u16 sac_outbound_streams;
214 __u16 sac_inbound_streams; 220 __u16 sac_inbound_streams;
215 sctp_assoc_t sac_assoc_id; 221 sctp_assoc_t sac_assoc_id;
222 __u8 sac_info[0];
216}; 223};
217 224
218/* 225/*
@@ -261,6 +268,7 @@ enum sctp_spc_state {
261 SCTP_ADDR_REMOVED, 268 SCTP_ADDR_REMOVED,
262 SCTP_ADDR_ADDED, 269 SCTP_ADDR_ADDED,
263 SCTP_ADDR_MADE_PRIM, 270 SCTP_ADDR_MADE_PRIM,
271 SCTP_ADDR_CONFIRMED,
264}; 272};
265 273
266 274
@@ -508,16 +516,17 @@ struct sctp_setadaptation {
508 * address's parameters: 516 * address's parameters:
509 */ 517 */
510enum sctp_spp_flags { 518enum sctp_spp_flags {
511 SPP_HB_ENABLE = 1, /*Enable heartbeats*/ 519 SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
512 SPP_HB_DISABLE = 2, /*Disable heartbeats*/ 520 SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
513 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, 521 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
514 SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ 522 SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
515 SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ 523 SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
516 SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ 524 SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
517 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, 525 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
518 SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ 526 SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
519 SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ 527 SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
520 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, 528 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
529 SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
521}; 530};
522 531
523struct sctp_paddrparams { 532struct sctp_paddrparams {
@@ -530,7 +539,7 @@ struct sctp_paddrparams {
530 __u32 spp_flags; 539 __u32 spp_flags;
531} __attribute__((packed, aligned(4))); 540} __attribute__((packed, aligned(4)));
532 541
533/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) 542/* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
534 * 543 *
535 * This options will get or set the delayed ack timer. The time is set 544 * This options will get or set the delayed ack timer. The time is set
536 * in milliseconds. If the assoc_id is 0, then this sets or gets the 545 * in milliseconds. If the assoc_id is 0, then this sets or gets the
diff --git a/include/net/sock.h b/include/net/sock.h
index 2c7d60ca354..25c37e34bfd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -202,6 +202,15 @@ struct sock {
202 unsigned short sk_type; 202 unsigned short sk_type;
203 int sk_rcvbuf; 203 int sk_rcvbuf;
204 socket_lock_t sk_lock; 204 socket_lock_t sk_lock;
205 /*
206 * The backlog queue is special, it is always used with
207 * the per-socket spinlock held and requires low latency
208 * access. Therefore we special case it's implementation.
209 */
210 struct {
211 struct sk_buff *head;
212 struct sk_buff *tail;
213 } sk_backlog;
205 wait_queue_head_t *sk_sleep; 214 wait_queue_head_t *sk_sleep;
206 struct dst_entry *sk_dst_cache; 215 struct dst_entry *sk_dst_cache;
207 struct xfrm_policy *sk_policy[2]; 216 struct xfrm_policy *sk_policy[2];
@@ -221,15 +230,6 @@ struct sock {
221 int sk_rcvlowat; 230 int sk_rcvlowat;
222 unsigned long sk_flags; 231 unsigned long sk_flags;
223 unsigned long sk_lingertime; 232 unsigned long sk_lingertime;
224 /*
225 * The backlog queue is special, it is always used with
226 * the per-socket spinlock held and requires low latency
227 * access. Therefore we special case it's implementation.
228 */
229 struct {
230 struct sk_buff *head;
231 struct sk_buff *tail;
232 } sk_backlog;
233 struct sk_buff_head sk_error_queue; 233 struct sk_buff_head sk_error_queue;
234 struct proto *sk_prot_creator; 234 struct proto *sk_prot_creator;
235 rwlock_t sk_callback_lock; 235 rwlock_t sk_callback_lock;
@@ -244,7 +244,7 @@ struct sock {
244 struct sk_filter *sk_filter; 244 struct sk_filter *sk_filter;
245 void *sk_protinfo; 245 void *sk_protinfo;
246 struct timer_list sk_timer; 246 struct timer_list sk_timer;
247 struct timeval sk_stamp; 247 ktime_t sk_stamp;
248 struct socket *sk_socket; 248 struct socket *sk_socket;
249 void *sk_user_data; 249 void *sk_user_data;
250 struct page *sk_sndmsg_page; 250 struct page *sk_sndmsg_page;
@@ -390,6 +390,7 @@ enum sock_flags {
390 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ 390 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */
391 SOCK_DBG, /* %SO_DEBUG setting */ 391 SOCK_DBG, /* %SO_DEBUG setting */
392 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ 392 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */
393 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
393 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 394 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
394 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 395 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
395}; 396};
@@ -710,15 +711,6 @@ static inline void sk_stream_mem_reclaim(struct sock *sk)
710 __sk_stream_mem_reclaim(sk); 711 __sk_stream_mem_reclaim(sk);
711} 712}
712 713
713static inline void sk_stream_writequeue_purge(struct sock *sk)
714{
715 struct sk_buff *skb;
716
717 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
718 sk_stream_free_skb(sk, skb);
719 sk_stream_mem_reclaim(sk);
720}
721
722static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) 714static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb)
723{ 715{
724 return (int)skb->truesize <= sk->sk_forward_alloc || 716 return (int)skb->truesize <= sk->sk_forward_alloc ||
@@ -1083,19 +1075,7 @@ static inline int sk_can_gso(const struct sock *sk)
1083 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1075 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1084} 1076}
1085 1077
1086static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1078extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1087{
1088 __sk_dst_set(sk, dst);
1089 sk->sk_route_caps = dst->dev->features;
1090 if (sk->sk_route_caps & NETIF_F_GSO)
1091 sk->sk_route_caps |= NETIF_F_GSO_MASK;
1092 if (sk_can_gso(sk)) {
1093 if (dst->header_len)
1094 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1095 else
1096 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1097 }
1098}
1099 1079
1100static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) 1080static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb)
1101{ 1081{
@@ -1256,18 +1236,6 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1256 return page; 1236 return page;
1257} 1237}
1258 1238
1259#define sk_stream_for_retrans_queue(skb, sk) \
1260 for (skb = (sk)->sk_write_queue.next; \
1261 (skb != (sk)->sk_send_head) && \
1262 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1263 skb = skb->next)
1264
1265/*from STCP for fast SACK Process*/
1266#define sk_stream_for_retrans_queue_from(skb, sk) \
1267 for (; (skb != (sk)->sk_send_head) && \
1268 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1269 skb = skb->next)
1270
1271/* 1239/*
1272 * Default write policy as shown to user space via poll/select/SIGIO 1240 * Default write policy as shown to user space via poll/select/SIGIO
1273 */ 1241 */
@@ -1304,22 +1272,18 @@ static inline int sock_intr_errno(long timeo)
1304 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 1272 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
1305} 1273}
1306 1274
1275extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
1276 struct sk_buff *skb);
1277
1307static __inline__ void 1278static __inline__ void
1308sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1279sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1309{ 1280{
1310 struct timeval stamp; 1281 ktime_t kt = skb->tstamp;
1311 1282
1312 skb_get_timestamp(skb, &stamp); 1283 if (sock_flag(sk, SOCK_RCVTSTAMP))
1313 if (sock_flag(sk, SOCK_RCVTSTAMP)) { 1284 __sock_recv_timestamp(msg, sk, skb);
1314 /* Race occurred between timestamp enabling and packet 1285 else
1315 receiving. Fill in the current time for now. */ 1286 sk->sk_stamp = kt;
1316 if (stamp.tv_sec == 0)
1317 do_gettimeofday(&stamp);
1318 skb_set_timestamp(skb, &stamp);
1319 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval),
1320 &stamp);
1321 } else
1322 sk->sk_stamp = stamp;
1323} 1287}
1324 1288
1325/** 1289/**
@@ -1350,18 +1314,17 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1350 1314
1351extern void sock_enable_timestamp(struct sock *sk); 1315extern void sock_enable_timestamp(struct sock *sk);
1352extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1316extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1317extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1353 1318
1354/* 1319/*
1355 * Enable debug/info messages 1320 * Enable debug/info messages
1356 */ 1321 */
1322extern int net_msg_warn;
1323#define NETDEBUG(fmt, args...) \
1324 do { if (net_msg_warn) printk(fmt,##args); } while (0)
1357 1325
1358#ifdef CONFIG_NETDEBUG 1326#define LIMIT_NETDEBUG(fmt, args...) \
1359#define NETDEBUG(fmt, args...) printk(fmt,##args) 1327 do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
1360#define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0)
1361#else
1362#define NETDEBUG(fmt, args...) do { } while (0)
1363#define LIMIT_NETDEBUG(fmt, args...) do { } while(0)
1364#endif
1365 1328
1366/* 1329/*
1367 * Macros for sleeping on a socket. Use them like this: 1330 * Macros for sleeping on a socket. Use them like this:
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5c472f255b7..e22b4f0305a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -220,6 +220,7 @@ extern int sysctl_tcp_app_win;
220extern int sysctl_tcp_adv_win_scale; 220extern int sysctl_tcp_adv_win_scale;
221extern int sysctl_tcp_tw_reuse; 221extern int sysctl_tcp_tw_reuse;
222extern int sysctl_tcp_frto; 222extern int sysctl_tcp_frto;
223extern int sysctl_tcp_frto_response;
223extern int sysctl_tcp_low_latency; 224extern int sysctl_tcp_low_latency;
224extern int sysctl_tcp_dma_copybreak; 225extern int sysctl_tcp_dma_copybreak;
225extern int sysctl_tcp_nometrics_save; 226extern int sysctl_tcp_nometrics_save;
@@ -230,6 +231,7 @@ extern int sysctl_tcp_mtu_probing;
230extern int sysctl_tcp_base_mss; 231extern int sysctl_tcp_base_mss;
231extern int sysctl_tcp_workaround_signed_windows; 232extern int sysctl_tcp_workaround_signed_windows;
232extern int sysctl_tcp_slow_start_after_idle; 233extern int sysctl_tcp_slow_start_after_idle;
234extern int sysctl_tcp_max_ssthresh;
233 235
234extern atomic_t tcp_memory_allocated; 236extern atomic_t tcp_memory_allocated;
235extern atomic_t tcp_sockets_allocated; 237extern atomic_t tcp_sockets_allocated;
@@ -341,6 +343,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
341extern int tcp_child_process(struct sock *parent, 343extern int tcp_child_process(struct sock *parent,
342 struct sock *child, 344 struct sock *child,
343 struct sk_buff *skb); 345 struct sk_buff *skb);
346extern int tcp_use_frto(struct sock *sk);
344extern void tcp_enter_frto(struct sock *sk); 347extern void tcp_enter_frto(struct sock *sk);
345extern void tcp_enter_loss(struct sock *sk, int how); 348extern void tcp_enter_loss(struct sock *sk, int how);
346extern void tcp_clear_retrans(struct tcp_sock *tp); 349extern void tcp_clear_retrans(struct tcp_sock *tp);
@@ -417,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
417 420
418/* tcp_output.c */ 421/* tcp_output.c */
419 422
420extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, 423extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
421 unsigned int cur_mss, int nonagle); 424 int nonagle);
422extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp); 425extern int tcp_may_send_now(struct sock *sk);
423extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 426extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
424extern void tcp_xmit_retransmit_queue(struct sock *); 427extern void tcp_xmit_retransmit_queue(struct sock *);
425extern void tcp_simple_retransmit(struct sock *); 428extern void tcp_simple_retransmit(struct sock *);
@@ -476,8 +479,10 @@ static inline void tcp_fast_path_on(struct tcp_sock *tp)
476 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); 479 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
477} 480}
478 481
479static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) 482static inline void tcp_fast_path_check(struct sock *sk)
480{ 483{
484 struct tcp_sock *tp = tcp_sk(sk);
485
481 if (skb_queue_empty(&tp->out_of_order_queue) && 486 if (skb_queue_empty(&tp->out_of_order_queue) &&
482 tp->rcv_wnd && 487 tp->rcv_wnd &&
483 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && 488 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf &&
@@ -588,10 +593,10 @@ static inline void tcp_dec_pcount_approx(__u32 *count,
588 } 593 }
589} 594}
590 595
591static inline void tcp_packets_out_inc(struct sock *sk, 596static inline void tcp_packets_out_inc(struct sock *sk,
592 struct tcp_sock *tp,
593 const struct sk_buff *skb) 597 const struct sk_buff *skb)
594{ 598{
599 struct tcp_sock *tp = tcp_sk(sk);
595 int orig = tp->packets_out; 600 int orig = tp->packets_out;
596 601
597 tp->packets_out += tcp_skb_pcount(skb); 602 tp->packets_out += tcp_skb_pcount(skb);
@@ -624,9 +629,12 @@ enum tcp_ca_event {
624#define TCP_CA_MAX 128 629#define TCP_CA_MAX 128
625#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 630#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
626 631
632#define TCP_CONG_NON_RESTRICTED 0x1
633#define TCP_CONG_RTT_STAMP 0x2
634
627struct tcp_congestion_ops { 635struct tcp_congestion_ops {
628 struct list_head list; 636 struct list_head list;
629 int non_restricted; 637 unsigned long flags;
630 638
631 /* initialize private data (optional) */ 639 /* initialize private data (optional) */
632 void (*init)(struct sock *sk); 640 void (*init)(struct sock *sk);
@@ -640,8 +648,6 @@ struct tcp_congestion_ops {
640 /* do new cwnd calculation (required) */ 648 /* do new cwnd calculation (required) */
641 void (*cong_avoid)(struct sock *sk, u32 ack, 649 void (*cong_avoid)(struct sock *sk, u32 ack,
642 u32 rtt, u32 in_flight, int good_ack); 650 u32 rtt, u32 in_flight, int good_ack);
643 /* round trip time sample per acked packet (optional) */
644 void (*rtt_sample)(struct sock *sk, u32 usrtt);
645 /* call before changing ca_state (optional) */ 651 /* call before changing ca_state (optional) */
646 void (*set_state)(struct sock *sk, u8 new_state); 652 void (*set_state)(struct sock *sk, u8 new_state);
647 /* call when cwnd event occurs (optional) */ 653 /* call when cwnd event occurs (optional) */
@@ -649,7 +655,7 @@ struct tcp_congestion_ops {
649 /* new value of cwnd after loss (optional) */ 655 /* new value of cwnd after loss (optional) */
650 u32 (*undo_cwnd)(struct sock *sk); 656 u32 (*undo_cwnd)(struct sock *sk);
651 /* hook for packet ack accounting (optional) */ 657 /* hook for packet ack accounting (optional) */
652 void (*pkts_acked)(struct sock *sk, u32 num_acked); 658 void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last);
653 /* get info for inet_diag (optional) */ 659 /* get info for inet_diag (optional) */
654 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); 660 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
655 661
@@ -730,13 +736,12 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
730 736
731static inline void tcp_sync_left_out(struct tcp_sock *tp) 737static inline void tcp_sync_left_out(struct tcp_sock *tp)
732{ 738{
733 if (tp->rx_opt.sack_ok && 739 BUG_ON(tp->rx_opt.sack_ok &&
734 (tp->sacked_out >= tp->packets_out - tp->lost_out)) 740 (tp->sacked_out + tp->lost_out > tp->packets_out));
735 tp->sacked_out = tp->packets_out - tp->lost_out;
736 tp->left_out = tp->sacked_out + tp->lost_out; 741 tp->left_out = tp->sacked_out + tp->lost_out;
737} 742}
738 743
739extern void tcp_enter_cwr(struct sock *sk); 744extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
740extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 745extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
741 746
742/* Slow start with delack produces 3 packets of burst, so that 747/* Slow start with delack produces 3 packets of burst, so that
@@ -775,18 +780,21 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
775 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 780 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
776} 781}
777 782
778static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 783static inline void tcp_check_probe_timer(struct sock *sk)
779{ 784{
785 struct tcp_sock *tp = tcp_sk(sk);
780 const struct inet_connection_sock *icsk = inet_csk(sk); 786 const struct inet_connection_sock *icsk = inet_csk(sk);
787
781 if (!tp->packets_out && !icsk->icsk_pending) 788 if (!tp->packets_out && !icsk->icsk_pending)
782 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, 789 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
783 icsk->icsk_rto, TCP_RTO_MAX); 790 icsk->icsk_rto, TCP_RTO_MAX);
784} 791}
785 792
786static inline void tcp_push_pending_frames(struct sock *sk, 793static inline void tcp_push_pending_frames(struct sock *sk)
787 struct tcp_sock *tp)
788{ 794{
789 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 795 struct tcp_sock *tp = tcp_sk(sk);
796
797 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle);
790} 798}
791 799
792static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 800static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
@@ -815,7 +823,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
815 823
816static inline int tcp_checksum_complete(struct sk_buff *skb) 824static inline int tcp_checksum_complete(struct sk_buff *skb)
817{ 825{
818 return skb->ip_summed != CHECKSUM_UNNECESSARY && 826 return !skb_csum_unnecessary(skb) &&
819 __tcp_checksum_complete(skb); 827 __tcp_checksum_complete(skb);
820} 828}
821 829
@@ -918,21 +926,7 @@ static inline void tcp_set_state(struct sock *sk, int state)
918#endif 926#endif
919} 927}
920 928
921static inline void tcp_done(struct sock *sk) 929extern void tcp_done(struct sock *sk);
922{
923 if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
924 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
925
926 tcp_set_state(sk, TCP_CLOSE);
927 tcp_clear_xmit_timers(sk);
928
929 sk->sk_shutdown = SHUTDOWN_MASK;
930
931 if (!sock_flag(sk, SOCK_DEAD))
932 sk->sk_state_change(sk);
933 else
934 inet_csk_destroy_sock(sk);
935}
936 930
937static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 931static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
938{ 932{
@@ -981,7 +975,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
981 ireq->wscale_ok = rx_opt->wscale_ok; 975 ireq->wscale_ok = rx_opt->wscale_ok;
982 ireq->acked = 0; 976 ireq->acked = 0;
983 ireq->ecn_ok = 0; 977 ireq->ecn_ok = 0;
984 ireq->rmt_port = skb->h.th->source; 978 ireq->rmt_port = tcp_hdr(skb)->source;
985} 979}
986 980
987extern void tcp_enter_memory_pressure(void); 981extern void tcp_enter_memory_pressure(void);
@@ -1011,7 +1005,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1011{ 1005{
1012 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1006 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0)
1013 return 0; 1007 return 0;
1014 if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1008 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)
1015 return 0; 1009 return 0;
1016 1010
1017 /* RST segments are not recommended to carry timestamp, 1011 /* RST segments are not recommended to carry timestamp,
@@ -1026,26 +1020,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1026 1020
1027 However, we can relax time bounds for RST segments to MSL. 1021 However, we can relax time bounds for RST segments to MSL.
1028 */ 1022 */
1029 if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1023 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
1030 return 0; 1024 return 0;
1031 return 1; 1025 return 1;
1032} 1026}
1033 1027
1034#define TCP_CHECK_TIMER(sk) do { } while (0) 1028#define TCP_CHECK_TIMER(sk) do { } while (0)
1035 1029
1036static inline int tcp_use_frto(const struct sock *sk)
1037{
1038 const struct tcp_sock *tp = tcp_sk(sk);
1039
1040 /* F-RTO must be activated in sysctl and there must be some
1041 * unsent new data, and the advertised window should allow
1042 * sending it.
1043 */
1044 return (sysctl_tcp_frto && sk->sk_send_head &&
1045 !after(TCP_SKB_CB(sk->sk_send_head)->end_seq,
1046 tp->snd_una + tp->snd_wnd));
1047}
1048
1049static inline void tcp_mib_init(void) 1030static inline void tcp_mib_init(void)
1050{ 1031{
1051 /* See RFC 2012 */ 1032 /* See RFC 2012 */
@@ -1172,6 +1153,125 @@ static inline void tcp_put_md5sig_pool(void)
1172 put_cpu(); 1153 put_cpu();
1173} 1154}
1174 1155
1156/* write queue abstraction */
1157static inline void tcp_write_queue_purge(struct sock *sk)
1158{
1159 struct sk_buff *skb;
1160
1161 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
1162 sk_stream_free_skb(sk, skb);
1163 sk_stream_mem_reclaim(sk);
1164}
1165
1166static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
1167{
1168 struct sk_buff *skb = sk->sk_write_queue.next;
1169 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1170 return NULL;
1171 return skb;
1172}
1173
1174static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk)
1175{
1176 struct sk_buff *skb = sk->sk_write_queue.prev;
1177 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1178 return NULL;
1179 return skb;
1180}
1181
1182static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb)
1183{
1184 return skb->next;
1185}
1186
1187#define tcp_for_write_queue(skb, sk) \
1188 for (skb = (sk)->sk_write_queue.next; \
1189 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1190 skb = skb->next)
1191
1192#define tcp_for_write_queue_from(skb, sk) \
1193 for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\
1194 skb = skb->next)
1195
1196static inline struct sk_buff *tcp_send_head(struct sock *sk)
1197{
1198 return sk->sk_send_head;
1199}
1200
1201static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb)
1202{
1203 struct tcp_sock *tp = tcp_sk(sk);
1204
1205 sk->sk_send_head = skb->next;
1206 if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
1207 sk->sk_send_head = NULL;
1208 /* Don't override Nagle indefinately with F-RTO */
1209 if (tp->frto_counter == 2)
1210 tp->frto_counter = 3;
1211}
1212
1213static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)
1214{
1215 if (sk->sk_send_head == skb_unlinked)
1216 sk->sk_send_head = NULL;
1217}
1218
1219static inline void tcp_init_send_head(struct sock *sk)
1220{
1221 sk->sk_send_head = NULL;
1222}
1223
1224static inline void __tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb)
1225{
1226 __skb_queue_tail(&sk->sk_write_queue, skb);
1227}
1228
1229static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb)
1230{
1231 __tcp_add_write_queue_tail(sk, skb);
1232
1233 /* Queue it, remembering where we must start sending. */
1234 if (sk->sk_send_head == NULL)
1235 sk->sk_send_head = skb;
1236}
1237
1238static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb)
1239{
1240 __skb_queue_head(&sk->sk_write_queue, skb);
1241}
1242
1243/* Insert buff after skb on the write queue of sk. */
1244static inline void tcp_insert_write_queue_after(struct sk_buff *skb,
1245 struct sk_buff *buff,
1246 struct sock *sk)
1247{
1248 __skb_append(skb, buff, &sk->sk_write_queue);
1249}
1250
1251/* Insert skb between prev and next on the write queue of sk. */
1252static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1253 struct sk_buff *skb,
1254 struct sock *sk)
1255{
1256 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
1257}
1258
1259static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1260{
1261 __skb_unlink(skb, &sk->sk_write_queue);
1262}
1263
1264static inline int tcp_skb_is_last(const struct sock *sk,
1265 const struct sk_buff *skb)
1266{
1267 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
1268}
1269
1270static inline int tcp_write_queue_empty(struct sock *sk)
1271{
1272 return skb_queue_empty(&sk->sk_write_queue);
1273}
1274
1175/* /proc */ 1275/* /proc */
1176enum tcp_seq_states { 1276enum tcp_seq_states {
1177 TCP_SEQ_STATE_LISTENING, 1277 TCP_SEQ_STATE_LISTENING,
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index 4629d77173f..89eb3e05116 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(struct tcp_sock *tp,
27 TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; 27 TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE;
28} 28}
29 29
30static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, 30static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb)
31 struct sk_buff *skb)
32{ 31{
32 struct tcp_sock *tp = tcp_sk(sk);
33
33 tp->ecn_flags = 0; 34 tp->ecn_flags = 0;
34 if (sysctl_tcp_ecn) { 35 if (sysctl_tcp_ecn) {
35 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; 36 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR;
@@ -44,9 +45,11 @@ TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th)
44 th->ece = 1; 45 th->ece = 1;
45} 46}
46 47
47static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, 48static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb,
48 struct sk_buff *skb, int tcp_header_len) 49 int tcp_header_len)
49{ 50{
51 struct tcp_sock *tp = tcp_sk(sk);
52
50 if (tp->ecn_flags & TCP_ECN_OK) { 53 if (tp->ecn_flags & TCP_ECN_OK) {
51 /* Not-retransmitted data segment: set ECT and inject CWR. */ 54 /* Not-retransmitted data segment: set ECT and inject CWR. */
52 if (skb->len != tcp_header_len && 55 if (skb->len != tcp_header_len &&
@@ -54,7 +57,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
54 INET_ECN_xmit(sk); 57 INET_ECN_xmit(sk);
55 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { 58 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) {
56 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; 59 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR;
57 skb->h.th->cwr = 1; 60 tcp_hdr(skb)->cwr = 1;
58 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; 61 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
59 } 62 }
60 } else { 63 } else {
@@ -62,7 +65,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
62 INET_ECN_dontxmit(sk); 65 INET_ECN_dontxmit(sk);
63 } 66 }
64 if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) 67 if (tp->ecn_flags & TCP_ECN_DEMAND_CWR)
65 skb->h.th->ece = 1; 68 tcp_hdr(skb)->ece = 1;
66 } 69 }
67} 70}
68 71
@@ -70,7 +73,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
70 73
71static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) 74static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb)
72{ 75{
73 if (skb->h.th->cwr) 76 if (tcp_hdr(skb)->cwr)
74 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; 77 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
75} 78}
76 79
diff --git a/include/net/udp.h b/include/net/udp.h
index 1b921fa8147..98755ebaf16 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -72,15 +72,12 @@ struct sk_buff;
72 */ 72 */
73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) 73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
74{ 74{
75 if (! UDP_SKB_CB(skb)->partial_cov) 75 return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov);
76 return __skb_checksum_complete(skb);
77 return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
78 skb->csum));
79} 76}
80 77
81static inline int udp_lib_checksum_complete(struct sk_buff *skb) 78static inline int udp_lib_checksum_complete(struct sk_buff *skb)
82{ 79{
83 return skb->ip_summed != CHECKSUM_UNNECESSARY && 80 return !skb_csum_unnecessary(skb) &&
84 __udp_lib_checksum_complete(skb); 81 __udp_lib_checksum_complete(skb);
85} 82}
86 83
@@ -92,8 +89,8 @@ static inline int udp_lib_checksum_complete(struct sk_buff *skb)
92 */ 89 */
93static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) 90static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
94{ 91{
95 __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0); 92 __wsum csum = csum_partial(skb_transport_header(skb),
96 93 sizeof(struct udphdr), 0);
97 skb_queue_walk(&sk->sk_write_queue, skb) { 94 skb_queue_walk(&sk->sk_write_queue, skb) {
98 csum = csum_add(csum, skb->csum); 95 csum = csum_add(csum, skb->csum);
99 } 96 }
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 67ac5142430..635b0eafca9 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -47,11 +47,10 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
47 return 1; 47 return 1;
48 } 48 }
49 49
50 UDP_SKB_CB(skb)->partial_cov = 0;
51 cscov = ntohs(uh->len); 50 cscov = ntohs(uh->len);
52 51
53 if (cscov == 0) /* Indicates that full coverage is required. */ 52 if (cscov == 0) /* Indicates that full coverage is required. */
54 cscov = skb->len; 53 ;
55 else if (cscov < 8 || cscov > skb->len) { 54 else if (cscov < 8 || cscov > skb->len) {
56 /* 55 /*
57 * Coverage length violates RFC 3828: log and discard silently. 56 * Coverage length violates RFC 3828: log and discard silently.
@@ -60,42 +59,16 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
60 cscov, skb->len); 59 cscov, skb->len);
61 return 1; 60 return 1;
62 61
63 } else if (cscov < skb->len) 62 } else if (cscov < skb->len) {
64 UDP_SKB_CB(skb)->partial_cov = 1; 63 UDP_SKB_CB(skb)->partial_cov = 1;
65 64 UDP_SKB_CB(skb)->cscov = cscov;
66 UDP_SKB_CB(skb)->cscov = cscov; 65 if (skb->ip_summed == CHECKSUM_COMPLETE)
67 66 skb->ip_summed = CHECKSUM_NONE;
68 /* 67 }
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 68
74 return 0; 69 return 0;
75} 70}
76 71
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) 72static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
100{ 73{
101 int cscov = up->len; 74 int cscov = up->len;
@@ -128,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
128 101
129static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) 102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
130{ 103{
131 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); 104 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
132 __wsum csum = 0; 105 __wsum csum = 0;
133 106
134 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
135 108
136 skb_queue_walk(&sk->sk_write_queue, skb) { 109 skb_queue_walk(&sk->sk_write_queue, skb) {
137 off = skb->h.raw - skb->data; 110 const int off = skb_transport_offset(skb);
138 len = skb->len - off; 111 const int len = skb->len - off;
139 112
140 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); 113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
141 114
diff --git a/include/net/wext.h b/include/net/wext.h
new file mode 100644
index 00000000000..c02b8decf3a
--- /dev/null
+++ b/include/net/wext.h
@@ -0,0 +1,24 @@
1#ifndef __NET_WEXT_H
2#define __NET_WEXT_H
3
4/*
5 * wireless extensions interface to the core code
6 */
7
8#ifdef CONFIG_WIRELESS_EXT
9extern int wext_proc_init(void);
10extern int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd,
11 void __user *arg);
12#else
13static inline int wext_proc_init(void)
14{
15 return 0;
16}
17static inline int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd,
18 void __user *arg)
19{
20 return -EINVAL;
21}
22#endif
23
24#endif /* __NET_WEXT_H */
diff --git a/include/net/wireless.h b/include/net/wireless.h
new file mode 100644
index 00000000000..d30c4ba8fd9
--- /dev/null
+++ b/include/net/wireless.h
@@ -0,0 +1,139 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <net/cfg80211.h>
14
15/**
16 * struct wiphy - wireless hardware description
17 * @idx: the wiphy index assigned to this item
18 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
19 */
20struct wiphy {
21 /* assign these fields before you register the wiphy */
22
23 /* permanent MAC address */
24 u8 perm_addr[ETH_ALEN];
25
26 /* If multiple wiphys are registered and you're handed e.g.
27 * a regular netdev with assigned ieee80211_ptr, you won't
28 * know whether it points to a wiphy your driver has registered
29 * or not. Assign this to something global to your driver to
30 * help determine whether you own this wiphy or not. */
31 void *privid;
32
33 /* fields below are read-only, assigned by cfg80211 */
34
35 /* the item in /sys/class/ieee80211/ points to this,
36 * you need use set_wiphy_dev() (see below) */
37 struct device dev;
38
39 /* dir in debugfs: ieee80211/<wiphyname> */
40 struct dentry *debugfsdir;
41
42 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
43};
44
45/** struct wireless_dev - wireless per-netdev state
46 *
47 * This structure must be allocated by the driver/stack
48 * that uses the ieee80211_ptr field in struct net_device
49 * (this is intentional so it can be allocated along with
50 * the netdev.)
51 *
52 * @wiphy: pointer to hardware description
53 */
54struct wireless_dev {
55 struct wiphy *wiphy;
56
57 /* private to the generic wireless code */
58 struct list_head list;
59 struct net_device *netdev;
60};
61
62/**
63 * wiphy_priv - return priv from wiphy
64 */
65static inline void *wiphy_priv(struct wiphy *wiphy)
66{
67 BUG_ON(!wiphy);
68 return &wiphy->priv;
69}
70
71/**
72 * set_wiphy_dev - set device pointer for wiphy
73 */
74static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
75{
76 wiphy->dev.parent = dev;
77}
78
79/**
80 * wiphy_dev - get wiphy dev pointer
81 */
82static inline struct device *wiphy_dev(struct wiphy *wiphy)
83{
84 return wiphy->dev.parent;
85}
86
87/**
88 * wiphy_name - get wiphy name
89 */
90static inline char *wiphy_name(struct wiphy *wiphy)
91{
92 return wiphy->dev.bus_id;
93}
94
95/**
96 * wdev_priv - return wiphy priv from wireless_dev
97 */
98static inline void *wdev_priv(struct wireless_dev *wdev)
99{
100 BUG_ON(!wdev);
101 return wiphy_priv(wdev->wiphy);
102}
103
104/**
105 * wiphy_new - create a new wiphy for use with cfg80211
106 *
107 * create a new wiphy and associate the given operations with it.
108 * @sizeof_priv bytes are allocated for private use.
109 *
110 * the returned pointer must be assigned to each netdev's
111 * ieee80211_ptr for proper operation.
112 */
113struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
114
115/**
116 * wiphy_register - register a wiphy with cfg80211
117 *
118 * register the given wiphy
119 *
120 * Returns a non-negative wiphy index or a negative error code.
121 */
122extern int wiphy_register(struct wiphy *wiphy);
123
124/**
125 * wiphy_unregister - deregister a wiphy from cfg80211
126 *
127 * unregister a device with the given priv pointer.
128 * After this call, no more requests can be made with this priv
129 * pointer, but the call may sleep to wait for an outstanding
130 * request that is being handled.
131 */
132extern void wiphy_unregister(struct wiphy *wiphy);
133
134/**
135 * wiphy_free - free wiphy
136 */
137extern void wiphy_free(struct wiphy *wiphy);
138
139#endif /* __NET_WIRELESS_H */
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1d10c879f7e..1415bcf9398 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -7,8 +7,8 @@
7 7
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
9{ 9{
10 skb->mac.raw = skb->data;
11 skb->dev = dev; 10 skb->dev = dev;
11 skb_reset_mac_header(skb);
12 skb->pkt_type = PACKET_HOST; 12 skb->pkt_type = PACKET_HOST;
13 13
14 return htons(ETH_P_X25); 14 return htons(ETH_P_X25);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5a00aa85b75..39ef925d39d 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -279,7 +279,7 @@ struct xfrm_type
279 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); 279 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *);
280 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); 280 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *);
281 /* Estimate maximal size of result of transformation of a dgram */ 281 /* Estimate maximal size of result of transformation of a dgram */
282 u32 (*get_max_size)(struct xfrm_state *, int size); 282 u32 (*get_mtu)(struct xfrm_state *, int size);
283}; 283};
284 284
285extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 285extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
@@ -584,6 +584,10 @@ struct xfrm_dst
584 struct rt6_info rt6; 584 struct rt6_info rt6;
585 } u; 585 } u;
586 struct dst_entry *route; 586 struct dst_entry *route;
587#ifdef CONFIG_XFRM_SUB_POLICY
588 struct flowi *origin;
589 struct xfrm_selector *partner;
590#endif
587 u32 genid; 591 u32 genid;
588 u32 route_mtu_cached; 592 u32 route_mtu_cached;
589 u32 child_mtu_cached; 593 u32 child_mtu_cached;
@@ -596,6 +600,12 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
596 dst_release(xdst->route); 600 dst_release(xdst->route);
597 if (likely(xdst->u.dst.xfrm)) 601 if (likely(xdst->u.dst.xfrm))
598 xfrm_state_put(xdst->u.dst.xfrm); 602 xfrm_state_put(xdst->u.dst.xfrm);
603#ifdef CONFIG_XFRM_SUB_POLICY
604 kfree(xdst->origin);
605 xdst->origin = NULL;
606 kfree(xdst->partner);
607 xdst->partner = NULL;
608#endif
599} 609}
600 610
601extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 611extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
@@ -935,9 +945,29 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
935 return -ENOSYS; 945 return -ENOSYS;
936} 946}
937#endif 947#endif
948
949struct xfrmk_sadinfo {
950 u32 sadhcnt; /* current hash bkts */
951 u32 sadhmcnt; /* max allowed hash bkts */
952 u32 sadcnt; /* current running count */
953};
954
955struct xfrmk_spdinfo {
956 u32 incnt;
957 u32 outcnt;
958 u32 fwdcnt;
959 u32 inscnt;
960 u32 outscnt;
961 u32 fwdscnt;
962 u32 spdhcnt;
963 u32 spdhmcnt;
964};
965
938extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 966extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
939extern int xfrm_state_delete(struct xfrm_state *x); 967extern int xfrm_state_delete(struct xfrm_state *x);
940extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 968extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
969extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
970extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
941extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); 971extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
942extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); 972extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
943extern void xfrm_replay_notify(struct xfrm_state *x, int event); 973extern void xfrm_replay_notify(struct xfrm_state *x, int event);
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 585d28e960d..739fa4d0e53 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -39,8 +39,6 @@
39#if !defined( IB_MAD_H ) 39#if !defined( IB_MAD_H )
40#define IB_MAD_H 40#define IB_MAD_H
41 41
42#include <linux/pci.h>
43
44#include <rdma/ib_verbs.h> 42#include <rdma/ib_verbs.h>
45 43
46/* Management base version */ 44/* Management base version */
diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h
deleted file mode 100644
index b86f8374351..00000000000
--- a/include/rxrpc/call.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/* call.h: Rx call record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CALL_H
13#define _LINUX_RXRPC_CALL_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/rxrpc.h>
17#include <rxrpc/packet.h>
18#include <linux/timer.h>
19
20#define RXRPC_CALL_ACK_WINDOW_SIZE 16
21
22extern unsigned rxrpc_call_rcv_timeout; /* receive activity timeout (secs) */
23
24/* application call state
25 * - only state 0 and ffff are reserved, the state is set to 1 after an opid is received
26 */
27enum rxrpc_app_cstate {
28 RXRPC_CSTATE_COMPLETE = 0, /* operation complete */
29 RXRPC_CSTATE_ERROR, /* operation ICMP error or aborted */
30 RXRPC_CSTATE_SRVR_RCV_OPID, /* [SERVER] receiving operation ID */
31 RXRPC_CSTATE_SRVR_RCV_ARGS, /* [SERVER] receiving operation data */
32 RXRPC_CSTATE_SRVR_GOT_ARGS, /* [SERVER] completely received operation data */
33 RXRPC_CSTATE_SRVR_SND_REPLY, /* [SERVER] sending operation reply */
34 RXRPC_CSTATE_SRVR_RCV_FINAL_ACK, /* [SERVER] receiving final ACK */
35 RXRPC_CSTATE_CLNT_SND_ARGS, /* [CLIENT] sending operation args */
36 RXRPC_CSTATE_CLNT_RCV_REPLY, /* [CLIENT] receiving operation reply */
37 RXRPC_CSTATE_CLNT_GOT_REPLY, /* [CLIENT] completely received operation reply */
38} __attribute__((packed));
39
40extern const char *rxrpc_call_states[];
41
42enum rxrpc_app_estate {
43 RXRPC_ESTATE_NO_ERROR = 0, /* no error */
44 RXRPC_ESTATE_LOCAL_ABORT, /* aborted locally by application layer */
45 RXRPC_ESTATE_PEER_ABORT, /* aborted remotely by peer */
46 RXRPC_ESTATE_LOCAL_ERROR, /* local ICMP network error */
47 RXRPC_ESTATE_REMOTE_ERROR, /* remote ICMP network error */
48} __attribute__((packed));
49
50extern const char *rxrpc_call_error_states[];
51
52/*****************************************************************************/
53/*
54 * Rx call record and application scratch buffer
55 * - the call record occupies the bottom of a complete page
56 * - the application scratch buffer occupies the rest
57 */
58struct rxrpc_call
59{
60 atomic_t usage;
61 struct rxrpc_connection *conn; /* connection upon which active */
62 spinlock_t lock; /* access lock */
63 struct module *owner; /* owner module */
64 wait_queue_head_t waitq; /* wait queue for events to happen */
65 struct list_head link; /* general internal list link */
66 struct list_head call_link; /* master call list link */
67 __be32 chan_ix; /* connection channel index */
68 __be32 call_id; /* call ID on connection */
69 unsigned long cjif; /* jiffies at call creation */
70 unsigned long flags; /* control flags */
71#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */
72#define RXRPC_CALL_ACKR_TIMO 0x00000002 /* ACKR timeout reached */
73#define RXRPC_CALL_RCV_TIMO 0x00000004 /* RCV timeout reached */
74#define RXRPC_CALL_RCV_PKT 0x00000008 /* received packet */
75
76 /* transmission */
77 rxrpc_seq_t snd_seq_count; /* outgoing packet sequence number counter */
78 struct rxrpc_message *snd_nextmsg; /* next message being constructed for sending */
79 struct rxrpc_message *snd_ping; /* last ping message sent */
80 unsigned short snd_resend_cnt; /* count of resends since last ACK */
81
82 /* transmission ACK tracking */
83 struct list_head acks_pendq; /* messages pending ACK (ordered by seq) */
84 unsigned acks_pend_cnt; /* number of un-ACK'd packets */
85 rxrpc_seq_t acks_dftv_seq; /* highest definitively ACK'd msg seq */
86 struct timer_list acks_timeout; /* timeout on expected ACK */
87
88 /* reception */
89 struct list_head rcv_receiveq; /* messages pending reception (ordered by seq) */
90 struct list_head rcv_krxiodq_lk; /* krxiod queue for new inbound packets */
91 struct timer_list rcv_timeout; /* call receive activity timeout */
92
93 /* reception ACK'ing */
94 rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */
95 rxrpc_seq_t ackr_win_top; /* top of ACK window */
96 rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */
97 rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */
98 unsigned ackr_pend_cnt; /* number of pending ACKs */
99 struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */
100 char ackr_dfr_perm; /* request for deferred ACKs permitted */
101 rxrpc_seq_t ackr_dfr_seq; /* seqno for deferred ACK */
102 struct rxrpc_ackpacket ackr; /* pending normal ACK packet */
103 uint8_t ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */
104
105 /* presentation layer */
106 char app_last_rcv; /* T if received last packet from remote end */
107 enum rxrpc_app_cstate app_call_state; /* call state */
108 enum rxrpc_app_estate app_err_state; /* abort/error state */
109 struct list_head app_readyq; /* ordered ready received packet queue */
110 struct list_head app_unreadyq; /* ordered post-hole recv'd packet queue */
111 rxrpc_seq_t app_ready_seq; /* last seq number dropped into readyq */
112 size_t app_ready_qty; /* amount of data ready in readyq */
113 unsigned app_opcode; /* operation ID */
114 unsigned app_abort_code; /* abort code (when aborted) */
115 int app_errno; /* error number (when ICMP error received) */
116
117 /* statisics */
118 unsigned pkt_rcv_count; /* count of received packets on this call */
119 unsigned pkt_snd_count; /* count of sent packets on this call */
120 unsigned app_read_count; /* number of reads issued */
121
122 /* bits for the application to use */
123 rxrpc_call_attn_func_t app_attn_func; /* callback when attention required */
124 rxrpc_call_error_func_t app_error_func; /* callback when abort sent (cleanup and put) */
125 rxrpc_call_aemap_func_t app_aemap_func; /* callback to map abort code to/from errno */
126 void *app_user; /* application data */
127 struct list_head app_link; /* application list linkage */
128 struct list_head app_attn_link; /* application attention list linkage */
129 size_t app_mark; /* trigger callback when app_ready_qty>=app_mark */
130 char app_async_read; /* T if in async-read mode */
131 uint8_t *app_read_buf; /* application async read buffer (app_mark size) */
132 uint8_t *app_scr_alloc; /* application scratch allocation pointer */
133 void *app_scr_ptr; /* application pointer into scratch buffer */
134
135#define RXRPC_APP_MARK_EOF 0xFFFFFFFFU /* mark at end of input */
136
137 /* application scratch buffer */
138 uint8_t app_scratch[0] __attribute__((aligned(sizeof(long))));
139};
140
141#define RXRPC_CALL_SCRATCH_SIZE (PAGE_SIZE - sizeof(struct rxrpc_call))
142
143#define rxrpc_call_reset_scratch(CALL) \
144do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0)
145
146#define rxrpc_call_alloc_scratch(CALL,SIZE) \
147({ \
148 void *ptr; \
149 ptr = (CALL)->app_scr_alloc; \
150 (CALL)->app_scr_alloc += (SIZE); \
151 if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \
152 (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
153 printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),(size_t)(SIZE)); \
154 BUG(); \
155 } \
156 ptr; \
157})
158
159#define rxrpc_call_alloc_scratch_s(CALL,TYPE) \
160({ \
161 size_t size = sizeof(TYPE); \
162 TYPE *ptr; \
163 ptr = (TYPE*)(CALL)->app_scr_alloc; \
164 (CALL)->app_scr_alloc += size; \
165 if (size>RXRPC_CALL_SCRATCH_SIZE || \
166 (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
167 printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),size); \
168 BUG(); \
169 } \
170 ptr; \
171})
172
173#define rxrpc_call_is_ack_pending(CALL) ((CALL)->ackr.reason != 0)
174
175extern int rxrpc_create_call(struct rxrpc_connection *conn,
176 rxrpc_call_attn_func_t attn,
177 rxrpc_call_error_func_t error,
178 rxrpc_call_aemap_func_t aemap,
179 struct rxrpc_call **_call);
180
181extern int rxrpc_incoming_call(struct rxrpc_connection *conn,
182 struct rxrpc_message *msg,
183 struct rxrpc_call **_call);
184
185static inline void rxrpc_get_call(struct rxrpc_call *call)
186{
187 BUG_ON(atomic_read(&call->usage)<=0);
188 atomic_inc(&call->usage);
189 /*printk("rxrpc_get_call(%p{u=%d})\n",(C),atomic_read(&(C)->usage));*/
190}
191
192extern void rxrpc_put_call(struct rxrpc_call *call);
193
194extern void rxrpc_call_do_stuff(struct rxrpc_call *call);
195
196extern int rxrpc_call_abort(struct rxrpc_call *call, int error);
197
198#define RXRPC_CALL_READ_BLOCK 0x0001 /* block if not enough data and not yet EOF */
199#define RXRPC_CALL_READ_ALL 0x0002 /* error if insufficient data received */
200extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int flags);
201
202extern int rxrpc_call_write_data(struct rxrpc_call *call,
203 size_t sioc,
204 struct kvec *siov,
205 uint8_t rxhdr_flags,
206 gfp_t alloc_flags,
207 int dup_data,
208 size_t *size_sent);
209
210extern void rxrpc_call_handle_error(struct rxrpc_call *conn, int local, int errno);
211
212#endif /* _LINUX_RXRPC_CALL_H */
diff --git a/include/rxrpc/connection.h b/include/rxrpc/connection.h
deleted file mode 100644
index 41e6781ad06..00000000000
--- a/include/rxrpc/connection.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/* connection.h: Rx connection record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CONNECTION_H
13#define _LINUX_RXRPC_CONNECTION_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxtimod.h>
17
18struct sk_buff;
19
20/*****************************************************************************/
21/*
22 * Rx connection
23 * - connections are matched by (rmt_port,rmt_addr,service_id,conn_id,clientflag)
24 * - connections only retain a refcount on the peer when they are active
25 * - connections with refcount==0 are inactive and reside in the peer's graveyard
26 */
27struct rxrpc_connection
28{
29 atomic_t usage;
30 struct rxrpc_transport *trans; /* transport endpoint */
31 struct rxrpc_peer *peer; /* peer from/to which connected */
32 struct rxrpc_service *service; /* responsible service (inbound conns) */
33 struct rxrpc_timer timeout; /* decaching timer */
34 struct list_head link; /* link in peer's list */
35 struct list_head proc_link; /* link in proc list */
36 struct list_head err_link; /* link in ICMP error processing list */
37 struct list_head id_link; /* link in ID grant list */
38 struct sockaddr_in addr; /* remote address */
39 struct rxrpc_call *channels[4]; /* channels (active calls) */
40 wait_queue_head_t chanwait; /* wait for channel to become available */
41 spinlock_t lock; /* access lock */
42 struct timeval atime; /* last access time */
43 size_t mtu_size; /* MTU size for outbound messages */
44 unsigned call_counter; /* call ID counter */
45 rxrpc_serial_t serial_counter; /* packet serial number counter */
46
47 /* the following should all be in net order */
48 __be32 in_epoch; /* peer's epoch */
49 __be32 out_epoch; /* my epoch */
50 __be32 conn_id; /* connection ID, appropriately shifted */
51 __be16 service_id; /* service ID */
52 uint8_t security_ix; /* security ID */
53 uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
54 uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
55};
56
57extern int rxrpc_create_connection(struct rxrpc_transport *trans,
58 __be16 port,
59 __be32 addr,
60 uint16_t service_id,
61 void *security,
62 struct rxrpc_connection **_conn);
63
64extern int rxrpc_connection_lookup(struct rxrpc_peer *peer,
65 struct rxrpc_message *msg,
66 struct rxrpc_connection **_conn);
67
68static inline void rxrpc_get_connection(struct rxrpc_connection *conn)
69{
70 BUG_ON(atomic_read(&conn->usage)<0);
71 atomic_inc(&conn->usage);
72 //printk("rxrpc_get_conn(%p{u=%d})\n",conn,atomic_read(&conn->usage));
73}
74
75extern void rxrpc_put_connection(struct rxrpc_connection *conn);
76
77extern int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
78 struct rxrpc_call *call,
79 struct rxrpc_message *msg);
80
81extern void rxrpc_conn_handle_error(struct rxrpc_connection *conn, int local, int errno);
82
83#endif /* _LINUX_RXRPC_CONNECTION_H */
diff --git a/include/rxrpc/krxiod.h b/include/rxrpc/krxiod.h
deleted file mode 100644
index c0e0e82e4df..00000000000
--- a/include/rxrpc/krxiod.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* krxiod.h: Rx RPC I/O kernel thread interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXIOD_H
13#define _LINUX_RXRPC_KRXIOD_H
14
15#include <rxrpc/types.h>
16
17extern int rxrpc_krxiod_init(void);
18extern void rxrpc_krxiod_kill(void);
19extern void rxrpc_krxiod_queue_transport(struct rxrpc_transport *trans);
20extern void rxrpc_krxiod_dequeue_transport(struct rxrpc_transport *trans);
21extern void rxrpc_krxiod_queue_peer(struct rxrpc_peer *peer);
22extern void rxrpc_krxiod_dequeue_peer(struct rxrpc_peer *peer);
23extern void rxrpc_krxiod_clear_peers(struct rxrpc_transport *trans);
24extern void rxrpc_krxiod_queue_call(struct rxrpc_call *call);
25extern void rxrpc_krxiod_dequeue_call(struct rxrpc_call *call);
26
27#endif /* _LINUX_RXRPC_KRXIOD_H */
diff --git a/include/rxrpc/krxsecd.h b/include/rxrpc/krxsecd.h
deleted file mode 100644
index 55ce43a25b3..00000000000
--- a/include/rxrpc/krxsecd.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* krxsecd.h: Rx RPC security kernel thread interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXSECD_H
13#define _LINUX_RXRPC_KRXSECD_H
14
15#include <rxrpc/types.h>
16
17extern int rxrpc_krxsecd_init(void);
18extern void rxrpc_krxsecd_kill(void);
19extern void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans);
20extern void rxrpc_krxsecd_queue_incoming_call(struct rxrpc_message *msg);
21
22#endif /* _LINUX_RXRPC_KRXSECD_H */
diff --git a/include/rxrpc/krxtimod.h b/include/rxrpc/krxtimod.h
deleted file mode 100644
index b3d298b612f..00000000000
--- a/include/rxrpc/krxtimod.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/* krxtimod.h: RxRPC timeout daemon
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXTIMOD_H
13#define _LINUX_RXRPC_KRXTIMOD_H
14
15#include <rxrpc/types.h>
16
17struct rxrpc_timer_ops {
18 /* called when the front of the timer queue has timed out */
19 void (*timed_out)(struct rxrpc_timer *timer);
20};
21
22/*****************************************************************************/
23/*
24 * RXRPC timer/timeout record
25 */
26struct rxrpc_timer
27{
28 struct list_head link; /* link in timer queue */
29 unsigned long timo_jif; /* timeout time */
30 const struct rxrpc_timer_ops *ops; /* timeout expiry function */
31};
32
33static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops)
34{
35 INIT_LIST_HEAD(&timer->link);
36 timer->ops = ops;
37}
38
39extern int rxrpc_krxtimod_start(void);
40extern void rxrpc_krxtimod_kill(void);
41
42extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout);
43extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer);
44
45#endif /* _LINUX_RXRPC_KRXTIMOD_H */
diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h
deleted file mode 100644
index b318f273d4f..00000000000
--- a/include/rxrpc/message.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/* message.h: Rx message caching
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_MESSAGE_H
13#define _LINUX_RXRPC_MESSAGE_H
14
15#include <rxrpc/packet.h>
16
17/*****************************************************************************/
18/*
19 * Rx message record
20 */
21struct rxrpc_message
22{
23 atomic_t usage;
24 struct list_head link; /* list link */
25 struct timeval stamp; /* time received or last sent */
26 rxrpc_seq_t seq; /* message sequence number */
27
28 int state; /* the state the message is currently in */
29#define RXRPC_MSG_PREPARED 0
30#define RXRPC_MSG_SENT 1
31#define RXRPC_MSG_ACKED 2 /* provisionally ACK'd */
32#define RXRPC_MSG_DONE 3 /* definitively ACK'd (msg->seq<ack.firstPacket) */
33#define RXRPC_MSG_RECEIVED 4
34#define RXRPC_MSG_ERROR -1
35 char rttdone; /* used for RTT */
36
37 struct rxrpc_transport *trans; /* transport received through */
38 struct rxrpc_connection *conn; /* connection received over */
39 struct sk_buff *pkt; /* received packet */
40 off_t offset; /* offset into pkt of next byte of data */
41
42 struct rxrpc_header hdr; /* message header */
43
44 int dcount; /* data part count */
45 size_t dsize; /* data size */
46#define RXRPC_MSG_MAX_IOCS 8
47 struct kvec data[RXRPC_MSG_MAX_IOCS]; /* message data */
48 unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */
49};
50
51#define rxrpc_get_message(M) do { atomic_inc(&(M)->usage); } while(0)
52
53extern void __rxrpc_put_message(struct rxrpc_message *msg);
54static inline void rxrpc_put_message(struct rxrpc_message *msg)
55{
56 BUG_ON(atomic_read(&msg->usage)<=0);
57 if (atomic_dec_and_test(&msg->usage))
58 __rxrpc_put_message(msg);
59}
60
61extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
62 struct rxrpc_call *call,
63 uint8_t type,
64 int count,
65 struct kvec *diov,
66 gfp_t alloc_flags,
67 struct rxrpc_message **_msg);
68
69extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg);
70
71#endif /* _LINUX_RXRPC_MESSAGE_H */
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index 1447f0aaa0e..b69e6e173ea 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -1,6 +1,6 @@
1/* packet.h: Rx packet layout and definitions 1/* packet.h: Rx packet layout and definitions
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -12,28 +12,25 @@
12#ifndef _LINUX_RXRPC_PACKET_H 12#ifndef _LINUX_RXRPC_PACKET_H
13#define _LINUX_RXRPC_PACKET_H 13#define _LINUX_RXRPC_PACKET_H
14 14
15#include <rxrpc/types.h> 15typedef u32 rxrpc_seq_t; /* Rx message sequence number */
16 16typedef u32 rxrpc_serial_t; /* Rx message serial number */
17#define RXRPC_IPUDP_SIZE 28 17typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */
18extern size_t RXRPC_MAX_PACKET_SIZE; 18typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
19#define RXRPC_MAX_PACKET_DATA_SIZE (RXRPC_MAX_PACKET_SIZE - sizeof(struct rxrpc_header))
20#define RXRPC_LOCAL_PACKET_SIZE RXRPC_MAX_PACKET_SIZE
21#define RXRPC_REMOTE_PACKET_SIZE (576 - RXRPC_IPUDP_SIZE)
22 19
23/*****************************************************************************/ 20/*****************************************************************************/
24/* 21/*
25 * on-the-wire Rx packet header 22 * on-the-wire Rx packet header
26 * - all multibyte fields should be in network byte order 23 * - all multibyte fields should be in network byte order
27 */ 24 */
28struct rxrpc_header 25struct rxrpc_header {
29{
30 __be32 epoch; /* client boot timestamp */ 26 __be32 epoch; /* client boot timestamp */
31 27
32 __be32 cid; /* connection and channel ID */ 28 __be32 cid; /* connection and channel ID */
33#define RXRPC_MAXCALLS 4 /* max active calls per conn */ 29#define RXRPC_MAXCALLS 4 /* max active calls per conn */
34#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ 30#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */
35#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ 31#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */
36#define RXRPC_CIDSHIFT 2 /* shift for connection ID */ 32#define RXRPC_CIDSHIFT ilog2(RXRPC_MAXCALLS) /* shift for connection ID */
33#define RXRPC_CID_INC (1 << RXRPC_CIDSHIFT) /* connection ID increment */
37 34
38 __be32 callNumber; /* call ID (0 for connection-level packets) */ 35 __be32 callNumber; /* call ID (0 for connection-level packets) */
39#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ 36#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
@@ -62,7 +59,10 @@ struct rxrpc_header
62 59
63 uint8_t userStatus; /* app-layer defined status */ 60 uint8_t userStatus; /* app-layer defined status */
64 uint8_t securityIndex; /* security protocol ID */ 61 uint8_t securityIndex; /* security protocol ID */
65 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ 62 union {
63 __be16 _rsvd; /* reserved */
64 __be16 cksum; /* kerberos security checksum */
65 };
66 __be16 serviceId; /* service ID */ 66 __be16 serviceId; /* service ID */
67 67
68} __attribute__((packed)); 68} __attribute__((packed));
@@ -81,8 +81,7 @@ extern const char *rxrpc_pkts[];
81 * - new__rsvd = j__rsvd 81 * - new__rsvd = j__rsvd
82 * - duplicating all other fields 82 * - duplicating all other fields
83 */ 83 */
84struct rxrpc_jumbo_header 84struct rxrpc_jumbo_header {
85{
86 uint8_t flags; /* packet flags (as per rxrpc_header) */ 85 uint8_t flags; /* packet flags (as per rxrpc_header) */
87 uint8_t pad; 86 uint8_t pad;
88 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ 87 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */
@@ -95,8 +94,7 @@ struct rxrpc_jumbo_header
95 * on-the-wire Rx ACK packet data payload 94 * on-the-wire Rx ACK packet data payload
96 * - all multibyte fields should be in network byte order 95 * - all multibyte fields should be in network byte order
97 */ 96 */
98struct rxrpc_ackpacket 97struct rxrpc_ackpacket {
99{
100 __be16 bufferSpace; /* number of packet buffers available */ 98 __be16 bufferSpace; /* number of packet buffers available */
101 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no 99 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no
102 * received */ 100 * received */
@@ -124,4 +122,93 @@ struct rxrpc_ackpacket
124 122
125} __attribute__((packed)); 123} __attribute__((packed));
126 124
125/*
126 * ACK packets can have a further piece of information tagged on the end
127 */
128struct rxrpc_ackinfo {
129 __be32 rxMTU; /* maximum Rx MTU size (bytes) [AFS 3.3] */
130 __be32 maxMTU; /* maximum interface MTU size (bytes) [AFS 3.3] */
131 __be32 rwind; /* Rx window size (packets) [AFS 3.4] */
132 __be32 jumbo_max; /* max packets to stick into a jumbo packet [AFS 3.5] */
133};
134
135/*****************************************************************************/
136/*
137 * Kerberos security type-2 challenge packet
138 */
139struct rxkad_challenge {
140 __be32 version; /* version of this challenge type */
141 __be32 nonce; /* encrypted random number */
142 __be32 min_level; /* minimum security level */
143 __be32 __padding; /* padding to 8-byte boundary */
144} __attribute__((packed));
145
146/*****************************************************************************/
147/*
148 * Kerberos security type-2 response packet
149 */
150struct rxkad_response {
151 __be32 version; /* version of this reponse type */
152 __be32 __pad;
153
154 /* encrypted bit of the response */
155 struct {
156 __be32 epoch; /* current epoch */
157 __be32 cid; /* parent connection ID */
158 __be32 checksum; /* checksum */
159 __be32 securityIndex; /* security type */
160 __be32 call_id[4]; /* encrypted call IDs */
161 __be32 inc_nonce; /* challenge nonce + 1 */
162 __be32 level; /* desired level */
163 } encrypted;
164
165 __be32 kvno; /* Kerberos key version number */
166 __be32 ticket_len; /* Kerberos ticket length */
167} __attribute__((packed));
168
169/*****************************************************************************/
170/*
171 * RxRPC-level abort codes
172 */
173#define RX_CALL_DEAD -1 /* call/conn has been inactive and is shut down */
174#define RX_INVALID_OPERATION -2 /* invalid operation requested / attempted */
175#define RX_CALL_TIMEOUT -3 /* call timeout exceeded */
176#define RX_EOF -4 /* unexpected end of data on read op */
177#define RX_PROTOCOL_ERROR -5 /* low-level protocol error */
178#define RX_USER_ABORT -6 /* generic user abort */
179#define RX_ADDRINUSE -7 /* UDP port in use */
180#define RX_DEBUGI_BADTYPE -8 /* bad debugging packet type */
181
182/*
183 * (un)marshalling abort codes (rxgen)
184 */
185#define RXGEN_CC_MARSHAL -450
186#define RXGEN_CC_UNMARSHAL -451
187#define RXGEN_SS_MARSHAL -452
188#define RXGEN_SS_UNMARSHAL -453
189#define RXGEN_DECODE -454
190#define RXGEN_OPCODE -455
191#define RXGEN_SS_XDRFREE -456
192#define RXGEN_CC_XDRFREE -457
193
194/*
195 * Rx kerberos security abort codes
196 * - unfortunately we have no generalised security abort codes to say things
197 * like "unsupported security", so we have to use these instead and hope the
198 * other side understands
199 */
200#define RXKADINCONSISTENCY 19270400 /* security module structure inconsistent */
201#define RXKADPACKETSHORT 19270401 /* packet too short for security challenge */
202#define RXKADLEVELFAIL 19270402 /* security level negotiation failed */
203#define RXKADTICKETLEN 19270403 /* ticket length too short or too long */
204#define RXKADOUTOFSEQUENCE 19270404 /* packet had bad sequence number */
205#define RXKADNOAUTH 19270405 /* caller not authorised */
206#define RXKADBADKEY 19270406 /* illegal key: bad parity or weak */
207#define RXKADBADTICKET 19270407 /* security object was passed a bad ticket */
208#define RXKADUNKNOWNKEY 19270408 /* ticket contained unknown key version number */
209#define RXKADEXPIRED 19270409 /* authentication expired */
210#define RXKADSEALEDINCON 19270410 /* sealed data inconsistent */
211#define RXKADDATALEN 19270411 /* user data too long */
212#define RXKADILLEGALLEVEL 19270412 /* caller not authorised to use encrypted conns */
213
127#endif /* _LINUX_RXRPC_PACKET_H */ 214#endif /* _LINUX_RXRPC_PACKET_H */
diff --git a/include/rxrpc/peer.h b/include/rxrpc/peer.h
deleted file mode 100644
index 8b8fe97cbbc..00000000000
--- a/include/rxrpc/peer.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/* peer.h: Rx RPC per-transport peer record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_PEER_H
13#define _LINUX_RXRPC_PEER_H
14
15#include <linux/wait.h>
16#include <rxrpc/types.h>
17#include <rxrpc/krxtimod.h>
18
19struct rxrpc_peer_ops
20{
21 /* peer record being added */
22 int (*adding)(struct rxrpc_peer *peer);
23
24 /* peer record being discarded from graveyard */
25 void (*discarding)(struct rxrpc_peer *peer);
26
27 /* change of epoch detected on connection */
28 void (*change_of_epoch)(struct rxrpc_connection *conn);
29};
30
31/*****************************************************************************/
32/*
33 * Rx RPC per-transport peer record
34 * - peers only retain a refcount on the transport when they are active
35 * - peers with refcount==0 are inactive and reside in the transport's graveyard
36 */
37struct rxrpc_peer
38{
39 atomic_t usage;
40 struct rxrpc_peer_ops *ops; /* operations on this peer */
41 struct rxrpc_transport *trans; /* owner transport */
42 struct rxrpc_timer timeout; /* timeout for grave destruction */
43 struct list_head link; /* link in transport's peer list */
44 struct list_head proc_link; /* link in /proc list */
45 rwlock_t conn_idlock; /* lock for connection IDs */
46 struct list_head conn_idlist; /* list of connections granted IDs */
47 uint32_t conn_idcounter; /* connection ID counter */
48 rwlock_t conn_lock; /* lock for active/dead connections */
49 struct list_head conn_active; /* active connections to/from this peer */
50 struct list_head conn_graveyard; /* graveyard for inactive connections */
51 spinlock_t conn_gylock; /* lock for conn_graveyard */
52 wait_queue_head_t conn_gy_waitq; /* wait queue hit when graveyard is empty */
53 atomic_t conn_count; /* number of attached connections */
54 struct in_addr addr; /* remote address */
55 size_t if_mtu; /* interface MTU for this peer */
56 spinlock_t lock; /* access lock */
57
58 void *user; /* application layer data */
59
60 /* calculated RTT cache */
61#define RXRPC_RTT_CACHE_SIZE 32
62 suseconds_t rtt; /* current RTT estimate (in uS) */
63 unsigned rtt_point; /* next entry at which to insert */
64 unsigned rtt_usage; /* amount of cache actually used */
65 suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */
66};
67
68
69extern int rxrpc_peer_lookup(struct rxrpc_transport *trans,
70 __be32 addr,
71 struct rxrpc_peer **_peer);
72
73static inline void rxrpc_get_peer(struct rxrpc_peer *peer)
74{
75 BUG_ON(atomic_read(&peer->usage)<0);
76 atomic_inc(&peer->usage);
77 //printk("rxrpc_get_peer(%p{u=%d})\n",peer,atomic_read(&peer->usage));
78}
79
80extern void rxrpc_put_peer(struct rxrpc_peer *peer);
81
82#endif /* _LINUX_RXRPC_PEER_H */
diff --git a/include/rxrpc/rxrpc.h b/include/rxrpc/rxrpc.h
deleted file mode 100644
index 8d9874cef99..00000000000
--- a/include/rxrpc/rxrpc.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* rx.h: Rx RPC interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_RXRPC_H
13#define _LINUX_RXRPC_RXRPC_H
14
15#ifdef __KERNEL__
16
17extern __be32 rxrpc_epoch;
18
19#ifdef CONFIG_SYSCTL
20extern int rxrpc_ktrace;
21extern int rxrpc_kdebug;
22extern int rxrpc_kproto;
23extern int rxrpc_knet;
24#else
25#define rxrpc_ktrace 0
26#define rxrpc_kdebug 0
27#define rxrpc_kproto 0
28#define rxrpc_knet 0
29#endif
30
31extern int rxrpc_sysctl_init(void);
32extern void rxrpc_sysctl_cleanup(void);
33
34#endif /* __KERNEL__ */
35
36#endif /* _LINUX_RXRPC_RXRPC_H */
diff --git a/include/rxrpc/transport.h b/include/rxrpc/transport.h
deleted file mode 100644
index 7c7b9683fa3..00000000000
--- a/include/rxrpc/transport.h
+++ /dev/null
@@ -1,106 +0,0 @@
1/* transport.h: Rx transport management
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_TRANSPORT_H
13#define _LINUX_RXRPC_TRANSPORT_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxiod.h>
17#include <rxrpc/rxrpc.h>
18#include <linux/skbuff.h>
19#include <linux/rwsem.h>
20
21typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call);
22
23extern wait_queue_head_t rxrpc_krxiod_wq;
24
25/*****************************************************************************/
26/*
27 * Rx operation specification
28 * - tables of these must be sorted by op ID so that they can be binary-chop searched
29 */
30struct rxrpc_operation
31{
32 unsigned id; /* operation ID */
33 size_t asize; /* minimum size of argument block */
34 const char *name; /* name of operation */
35 void *user; /* initial user data */
36};
37
38/*****************************************************************************/
39/*
40 * Rx transport service record
41 */
42struct rxrpc_service
43{
44 struct list_head link; /* link in services list on transport */
45 struct module *owner; /* owner module */
46 rxrpc_newcall_fnx_t new_call; /* new call handler function */
47 const char *name; /* name of service */
48 unsigned short service_id; /* Rx service ID */
49 rxrpc_call_attn_func_t attn_func; /* call requires attention callback */
50 rxrpc_call_error_func_t error_func; /* call error callback */
51 rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */
52
53 const struct rxrpc_operation *ops_begin; /* beginning of operations table */
54 const struct rxrpc_operation *ops_end; /* end of operations table */
55};
56
57/*****************************************************************************/
58/*
59 * Rx transport endpoint record
60 */
61struct rxrpc_transport
62{
63 atomic_t usage;
64 struct socket *socket; /* my UDP socket */
65 struct list_head services; /* services listening on this socket */
66 struct list_head link; /* link in transport list */
67 struct list_head proc_link; /* link in transport proc list */
68 struct list_head krxiodq_link; /* krxiod attention queue link */
69 spinlock_t lock; /* access lock */
70 struct list_head peer_active; /* active peers connected to over this socket */
71 struct list_head peer_graveyard; /* inactive peer list */
72 spinlock_t peer_gylock; /* peer graveyard lock */
73 wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */
74 rwlock_t peer_lock; /* peer list access lock */
75 atomic_t peer_count; /* number of peers */
76 struct rxrpc_peer_ops *peer_ops; /* default peer operations */
77 unsigned short port; /* port upon which listening */
78 volatile char error_rcvd; /* T if received ICMP error outstanding */
79};
80
81extern int rxrpc_create_transport(unsigned short port,
82 struct rxrpc_transport **_trans);
83
84static inline void rxrpc_get_transport(struct rxrpc_transport *trans)
85{
86 BUG_ON(atomic_read(&trans->usage) <= 0);
87 atomic_inc(&trans->usage);
88 //printk("rxrpc_get_transport(%p{u=%d})\n",
89 // trans, atomic_read(&trans->usage));
90}
91
92extern void rxrpc_put_transport(struct rxrpc_transport *trans);
93
94extern int rxrpc_add_service(struct rxrpc_transport *trans,
95 struct rxrpc_service *srv);
96
97extern void rxrpc_del_service(struct rxrpc_transport *trans,
98 struct rxrpc_service *srv);
99
100extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans);
101
102extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
103 struct rxrpc_message *msg,
104 int error);
105
106#endif /* _LINUX_RXRPC_TRANSPORT_H */
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 4a44278ed76..8d1e4e8026f 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -588,7 +588,17 @@ struct iscsi_reject {
588#define VALUE_MAXLEN 255 588#define VALUE_MAXLEN 255
589#define TARGET_NAME_MAXLEN VALUE_MAXLEN 589#define TARGET_NAME_MAXLEN VALUE_MAXLEN
590 590
591#define DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192 591#define ISCSI_DEF_MAX_RECV_SEG_LEN 8192
592#define ISCSI_MIN_MAX_RECV_SEG_LEN 512
593#define ISCSI_MAX_MAX_RECV_SEG_LEN 16777215
594
595#define ISCSI_DEF_FIRST_BURST_LEN 65536
596#define ISCSI_MIN_FIRST_BURST_LEN 512
597#define ISCSI_MAX_FIRST_BURST_LEN 16777215
598
599#define ISCSI_DEF_MAX_BURST_LEN 262144
600#define ISCSI_MIN_MAX_BURST_LEN 512
601#define ISCSI_MAX_MAX_BURST_LEN 16777215
592 602
593/************************* RFC 3720 End *****************************/ 603/************************* RFC 3720 End *****************************/
594 604
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 5c0e9791441..9f8f80ab0c8 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -203,6 +203,7 @@ static inline int scsi_status_is_good(int status)
203 203
204/* 204/*
205 * DEVICE TYPES 205 * DEVICE TYPES
206 * Please keep them in 0x%02x format for $MODALIAS to work
206 */ 207 */
207 208
208#define TYPE_DISK 0x00 209#define TYPE_DISK 0x00
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index d6948d0e8cd..a2e0c103249 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -73,9 +73,6 @@ struct scsi_cmnd {
73 unsigned short use_sg; /* Number of pieces of scatter-gather */ 73 unsigned short use_sg; /* Number of pieces of scatter-gather */
74 unsigned short sglist_len; /* size of malloc'd scatter-gather list */ 74 unsigned short sglist_len; /* size of malloc'd scatter-gather list */
75 75
76 /* offset in cmd we are at (for multi-transfer tgt cmds) */
77 unsigned offset;
78
79 unsigned underflow; /* Return error if less than 76 unsigned underflow; /* Return error if less than
80 this amount is transferred */ 77 this amount is transferred */
81 78
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 3bbbfbe8cbf..5a43a4cd96c 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -5,14 +5,16 @@ struct scsi_cmnd;
5struct scsi_sense_hdr; 5struct scsi_sense_hdr;
6 6
7extern void scsi_print_command(struct scsi_cmnd *); 7extern void scsi_print_command(struct scsi_cmnd *);
8extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
9extern void __scsi_print_command(unsigned char *); 8extern void __scsi_print_command(unsigned char *);
10extern void scsi_print_sense(const char *, struct scsi_cmnd *); 9extern void scsi_show_extd_sense(unsigned char, unsigned char);
10extern void scsi_show_sense_hdr(struct scsi_sense_hdr *);
11extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
12extern void scsi_print_sense(char *, struct scsi_cmnd *);
11extern void __scsi_print_sense(const char *name, 13extern void __scsi_print_sense(const char *name,
12 const unsigned char *sense_buffer, 14 const unsigned char *sense_buffer,
13 int sense_len); 15 int sense_len);
14extern void scsi_print_driverbyte(int); 16extern void scsi_show_result(int);
15extern void scsi_print_hostbyte(int); 17extern void scsi_print_result(struct scsi_cmnd *);
16extern void scsi_print_status(unsigned char); 18extern void scsi_print_status(unsigned char);
17extern const char *scsi_sense_key_string(unsigned char); 19extern const char *scsi_sense_key_string(unsigned char);
18extern const char *scsi_extd_sense_format(unsigned char, unsigned char); 20extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 9dd37e2f5a8..2f3c5b8b1d6 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -5,6 +5,7 @@
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/blkdev.h>
8#include <asm/atomic.h> 9#include <asm/atomic.h>
9 10
10struct request_queue; 11struct request_queue;
@@ -119,6 +120,7 @@ struct scsi_device {
119 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ 120 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
120 unsigned no_start_on_add:1; /* do not issue start on add */ 121 unsigned no_start_on_add:1; /* do not issue start on add */
121 unsigned allow_restart:1; /* issue START_UNIT in error handler */ 122 unsigned allow_restart:1; /* issue START_UNIT in error handler */
123 unsigned manage_start_stop:1; /* Let HLD (sd) manage start/stop */
122 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */ 124 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */
123 unsigned select_no_atn:1; 125 unsigned select_no_atn:1;
124 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ 126 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */
@@ -154,8 +156,11 @@ struct scsi_device {
154#define sdev_printk(prefix, sdev, fmt, a...) \ 156#define sdev_printk(prefix, sdev, fmt, a...) \
155 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) 157 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
156 158
157#define scmd_printk(prefix, scmd, fmt, a...) \ 159#define scmd_printk(prefix, scmd, fmt, a...) \
158 dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a) 160 (scmd)->request->rq_disk ? \
161 sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \
162 (scmd)->request->rq_disk->disk_name, ##a) : \
163 sdev_printk(prefix, (scmd)->device, fmt, ##a)
159 164
160enum scsi_target_state { 165enum scsi_target_state {
161 STARGET_RUNNING = 1, 166 STARGET_RUNNING = 1,
@@ -353,4 +358,9 @@ static inline int scsi_device_qas(struct scsi_device *sdev)
353 return 0; 358 return 0;
354 return sdev->inquiry[56] & 0x02; 359 return sdev->inquiry[56] & 0x02;
355} 360}
361
362#define MODULE_ALIAS_SCSI_DEVICE(type) \
363 MODULE_ALIAS("scsi:t-" __stringify(type) "*")
364#define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x"
365
356#endif /* _SCSI_SCSI_DEVICE_H */ 366#endif /* _SCSI_SCSI_DEVICE_H */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 7f1f411d07a..68f461b7a83 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -129,6 +129,11 @@ struct scsi_host_template {
129 * the LLD. When the driver is finished processing the command 129 * the LLD. When the driver is finished processing the command
130 * the done callback is invoked. 130 * the done callback is invoked.
131 * 131 *
132 * This is called to inform the LLD to transfer
133 * cmd->request_bufflen bytes. The cmd->use_sg speciefies the
134 * number of scatterlist entried in the command and
135 * cmd->request_buffer contains the scatterlist.
136 *
132 * return values: see queuecommand 137 * return values: see queuecommand
133 * 138 *
134 * If the LLD accepts the cmd, it should set the result to an 139 * If the LLD accepts the cmd, it should set the result to an
@@ -139,20 +144,6 @@ struct scsi_host_template {
139 /* TODO: rename */ 144 /* TODO: rename */
140 int (* transfer_response)(struct scsi_cmnd *, 145 int (* transfer_response)(struct scsi_cmnd *,
141 void (*done)(struct scsi_cmnd *)); 146 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 147
157 /* Used as callback for the completion of task management request. */ 148 /* Used as callback for the completion of task management request. */
158 int (* tsk_mgmt_response)(u64 mid, int result); 149 int (* tsk_mgmt_response)(u64 mid, int result);
@@ -335,6 +326,19 @@ struct scsi_host_template {
335 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); 326 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
336 327
337 /* 328 /*
329 * This is an optional routine that allows the transport to become
330 * involved when a scsi io timer fires. The return value tells the
331 * timer routine how to finish the io timeout handling:
332 * EH_HANDLED: I fixed the error, please complete the command
333 * EH_RESET_TIMER: I need more time, reset the timer and
334 * begin counting again
335 * EH_NOT_HANDLED Begin normal error recovery
336 *
337 * Status: OPTIONAL
338 */
339 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
340
341 /*
338 * suspend support 342 * suspend support
339 */ 343 */
340 int (*resume)(struct scsi_device *); 344 int (*resume)(struct scsi_device *);
diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h
index 07d6e77ae89..4cf9dff29a2 100644
--- a/include/scsi/scsi_tgt_if.h
+++ b/include/scsi/scsi_tgt_if.h
@@ -45,11 +45,13 @@ struct tgt_event {
45 /* user-> kernel */ 45 /* user-> kernel */
46 struct { 46 struct {
47 int host_no; 47 int host_no;
48 uint32_t len;
49 int result; 48 int result;
49 aligned_u64 tag;
50 aligned_u64 uaddr; 50 aligned_u64 uaddr;
51 aligned_u64 sense_uaddr;
52 uint32_t len;
53 uint32_t sense_len;
51 uint8_t rw; 54 uint8_t rw;
52 aligned_u64 tag;
53 } cmd_rsp; 55 } cmd_rsp;
54 struct { 56 struct {
55 int host_no; 57 int host_no;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 798f7c7ee42..1e797308640 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -108,6 +108,8 @@ enum fc_port_state {
108#define FC_PORTSPEED_2GBIT 2 108#define FC_PORTSPEED_2GBIT 2
109#define FC_PORTSPEED_4GBIT 4 109#define FC_PORTSPEED_4GBIT 4
110#define FC_PORTSPEED_10GBIT 8 110#define FC_PORTSPEED_10GBIT 8
111#define FC_PORTSPEED_8GBIT 0x10
112#define FC_PORTSPEED_16GBIT 0x20
111#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ 113#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
112 114
113/* 115/*
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
new file mode 100644
index 00000000000..5261488e110
--- /dev/null
+++ b/include/scsi/sd.h
@@ -0,0 +1,72 @@
1#ifndef _SCSI_DISK_H
2#define _SCSI_DISK_H
3
4/*
5 * More than enough for everybody ;) The huge number of majors
6 * is a leftover from 16bit dev_t days, we don't really need that
7 * much numberspace.
8 */
9#define SD_MAJORS 16
10
11/*
12 * This is limited by the naming scheme enforced in sd_probe,
13 * add another character to it if you really need more disks.
14 */
15#define SD_MAX_DISKS (((26 * 26) + 26 + 1) * 26)
16
17/*
18 * Time out in seconds for disks and Magneto-opticals (which are slower).
19 */
20#define SD_TIMEOUT (30 * HZ)
21#define SD_MOD_TIMEOUT (75 * HZ)
22
23/*
24 * Number of allowed retries
25 */
26#define SD_MAX_RETRIES 5
27#define SD_PASSTHROUGH_RETRIES 1
28
29/*
30 * Size of the initial data buffer for mode and read capacity data
31 */
32#define SD_BUF_SIZE 512
33
34struct scsi_disk {
35 struct scsi_driver *driver; /* always &sd_template */
36 struct scsi_device *device;
37 struct class_device cdev;
38 struct gendisk *disk;
39 unsigned int openers; /* protected by BKL for now, yuck */
40 sector_t capacity; /* size in 512-byte sectors */
41 u32 index;
42 u8 media_present;
43 u8 write_prot;
44 unsigned WCE : 1; /* state of disk WCE bit */
45 unsigned RCD : 1; /* state of disk RCD bit, unused */
46 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
47};
48#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
49
50static int sd_revalidate_disk(struct gendisk *disk);
51static void sd_rw_intr(struct scsi_cmnd * SCpnt);
52static int sd_probe(struct device *);
53static int sd_remove(struct device *);
54static void sd_shutdown(struct device *dev);
55static int sd_suspend(struct device *dev, pm_message_t state);
56static int sd_resume(struct device *dev);
57static void sd_rescan(struct device *);
58static int sd_init_command(struct scsi_cmnd *);
59static int sd_issue_flush(struct device *, sector_t *);
60static void sd_prepare_flush(request_queue_t *, struct request *);
61static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
62static void scsi_disk_release(struct class_device *cdev);
63static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
64static void sd_print_result(struct scsi_disk *, int);
65
66#define sd_printk(prefix, sdsk, fmt, a...) \
67 (sdsk)->disk ? \
68 sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
69 (sdsk)->disk->disk_name, ##a) : \
70 sdev_printk(prefix, (sdsk)->device, fmt, ##a)
71
72#endif /* _SCSI_DISK_H */