aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acmacros.h63
-rw-r--r--include/acpi/acoutput.h4
-rw-r--r--include/acpi/acpi_bus.h3
-rw-r--r--include/acpi/acpi_numa.h1
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/aclinux.h3
-rw-r--r--include/acpi/processor.h47
-rw-r--r--include/asm-alpha/a.out.h2
-rw-r--r--include/asm-alpha/fb.h13
-rw-r--r--include/asm-alpha/io.h13
-rw-r--r--include/asm-alpha/page.h3
-rw-r--r--include/asm-alpha/pgtable.h6
-rw-r--r--include/asm-alpha/system.h10
-rw-r--r--include/asm-alpha/termios.h4
-rw-r--r--include/asm-arm/a.out.h1
-rw-r--r--include/asm-arm/arch-at91/board.h1
-rw-r--r--include/asm-arm/fb.h19
-rw-r--r--include/asm-arm/pgtable.h12
-rw-r--r--include/asm-arm/system.h10
-rw-r--r--include/asm-arm26/a.out.h1
-rw-r--r--include/asm-arm26/dma-mapping.h2
-rw-r--r--include/asm-arm26/fb.h12
-rw-r--r--include/asm-arm26/ioctls.h4
-rw-r--r--include/asm-arm26/pgtable.h4
-rw-r--r--include/asm-arm26/system.h10
-rw-r--r--include/asm-arm26/termbits.h5
-rw-r--r--include/asm-arm26/termios.h6
-rw-r--r--include/asm-avr32/a.out.h1
-rw-r--r--include/asm-avr32/arch-at32ap/board.h15
-rw-r--r--include/asm-avr32/arch-at32ap/sm.h27
-rw-r--r--include/asm-avr32/atomic.h4
-rw-r--r--include/asm-avr32/fb.h21
-rw-r--r--include/asm-avr32/pgtable.h28
-rw-r--r--include/asm-avr32/unaligned.h15
-rw-r--r--include/asm-blackfin/fb.h12
-rw-r--r--include/asm-cris/a.out.h1
-rw-r--r--include/asm-cris/fb.h12
-rw-r--r--include/asm-cris/ioctls.h4
-rw-r--r--include/asm-cris/page.h3
-rw-r--r--include/asm-cris/pgtable.h30
-rw-r--r--include/asm-cris/termbits.h1
-rw-r--r--include/asm-cris/termios.h6
-rw-r--r--include/asm-frv/fb.h12
-rw-r--r--include/asm-frv/mem-layout.h1
-rw-r--r--include/asm-frv/pgtable.h14
-rw-r--r--include/asm-frv/unistd.h6
-rw-r--r--include/asm-generic/bug.h2
-rw-r--r--include/asm-generic/dma-mapping-broken.h82
-rw-r--r--include/asm-generic/fcntl.h3
-rw-r--r--include/asm-generic/percpu.h8
-rw-r--r--include/asm-generic/pgtable.h44
-rw-r--r--include/asm-generic/unaligned.h16
-rw-r--r--include/asm-generic/vmlinux.lds.h14
-rw-r--r--include/asm-h8300/a.out.h1
-rw-r--r--include/asm-h8300/dma-mapping.h1
-rw-r--r--include/asm-h8300/fb.h12
-rw-r--r--include/asm-h8300/ioctls.h4
-rw-r--r--include/asm-h8300/page.h3
-rw-r--r--include/asm-h8300/termbits.h5
-rw-r--r--include/asm-h8300/termios.h6
-rw-r--r--include/asm-h8300/thread_info.h2
-rw-r--r--include/asm-i386/a.out.h1
-rw-r--r--include/asm-i386/alternative.h2
-rw-r--r--include/asm-i386/cmpxchg.h16
-rw-r--r--include/asm-i386/e820.h8
-rw-r--r--include/asm-i386/fb.h17
-rw-r--r--include/asm-i386/fixmap.h2
-rw-r--r--include/asm-i386/geode.h159
-rw-r--r--include/asm-i386/hpet.h126
-rw-r--r--include/asm-i386/i8253.h16
-rw-r--r--include/asm-i386/ide.h4
-rw-r--r--include/asm-i386/io.h1
-rw-r--r--include/asm-i386/irq.h1
-rw-r--r--include/asm-i386/kprobes.h1
-rw-r--r--include/asm-i386/mach-default/do_timer.h2
-rw-r--r--include/asm-i386/mach-default/io_ports.h5
-rw-r--r--include/asm-i386/mach-default/irq_vectors_limits.h2
-rw-r--r--include/asm-i386/mach-default/mach_reboot.h25
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h2
-rw-r--r--include/asm-i386/mc146818rtc.h5
-rw-r--r--include/asm-i386/mce.h4
-rw-r--r--include/asm-i386/mmu_context.h2
-rw-r--r--include/asm-i386/nmi.h2
-rw-r--r--include/asm-i386/page.h4
-rw-r--r--include/asm-i386/paravirt.h22
-rw-r--r--include/asm-i386/pci.h5
-rw-r--r--include/asm-i386/percpu.h5
-rw-r--r--include/asm-i386/pgalloc.h6
-rw-r--r--include/asm-i386/pgtable-2level.h8
-rw-r--r--include/asm-i386/pgtable-3level.h17
-rw-r--r--include/asm-i386/pgtable.h40
-rw-r--r--include/asm-i386/processor-cyrix.h30
-rw-r--r--include/asm-i386/processor.h16
-rw-r--r--include/asm-i386/required-features.h2
-rw-r--r--include/asm-i386/resume-trace.h13
-rw-r--r--include/asm-i386/setup.h4
-rw-r--r--include/asm-i386/smp.h5
-rw-r--r--include/asm-i386/string.h243
-rw-r--r--include/asm-i386/system.h9
-rw-r--r--include/asm-i386/thread_info.h5
-rw-r--r--include/asm-i386/timer.h34
-rw-r--r--include/asm-i386/tlbflush.h6
-rw-r--r--include/asm-i386/topology.h2
-rw-r--r--include/asm-i386/tsc.h1
-rw-r--r--include/asm-i386/uaccess.h2
-rw-r--r--include/asm-i386/unistd.h3
-rw-r--r--include/asm-i386/vmi_time.h2
-rw-r--r--include/asm-i386/xen/hypercall.h413
-rw-r--r--include/asm-i386/xen/hypervisor.h73
-rw-r--r--include/asm-i386/xen/interface.h188
-rw-r--r--include/asm-ia64/compat.h2
-rw-r--r--include/asm-ia64/fb.h23
-rw-r--r--include/asm-ia64/hw_irq.h18
-rw-r--r--include/asm-ia64/ioctls.h4
-rw-r--r--include/asm-ia64/iosapic.h6
-rw-r--r--include/asm-ia64/irq.h9
-rw-r--r--include/asm-ia64/kprobes.h2
-rw-r--r--include/asm-ia64/page.h13
-rw-r--r--include/asm-ia64/percpu.h10
-rw-r--r--include/asm-ia64/pgtable.h26
-rw-r--r--include/asm-ia64/processor.h4
-rw-r--r--include/asm-ia64/rwsem.h4
-rw-r--r--include/asm-ia64/system.h1
-rw-r--r--include/asm-ia64/termbits.h5
-rw-r--r--include/asm-ia64/termios.h6
-rw-r--r--include/asm-ia64/unistd.h2
-rw-r--r--include/asm-ia64/ustack.h1
-rw-r--r--include/asm-m32r/a.out.h1
-rw-r--r--include/asm-m32r/dma-mapping.h6
-rw-r--r--include/asm-m32r/fb.h19
-rw-r--r--include/asm-m32r/ioctls.h4
-rw-r--r--include/asm-m32r/page.h3
-rw-r--r--include/asm-m32r/pgtable.h40
-rw-r--r--include/asm-m32r/system.h10
-rw-r--r--include/asm-m32r/termbits.h5
-rw-r--r--include/asm-m32r/termios.h6
-rw-r--r--include/asm-m68k/a.out.h1
-rw-r--r--include/asm-m68k/atari_SLM.h28
-rw-r--r--include/asm-m68k/atari_acsi.h37
-rw-r--r--include/asm-m68k/fb.h34
-rw-r--r--include/asm-m68k/io.h75
-rw-r--r--include/asm-m68k/motorola_pgtable.h6
-rw-r--r--include/asm-m68k/raw_io.h8
-rw-r--r--include/asm-m68k/sun3_pgtable.h6
-rw-r--r--include/asm-m68knommu/fb.h12
-rw-r--r--include/asm-m68knommu/irq.h75
-rw-r--r--include/asm-m68knommu/irqnode.h36
-rw-r--r--include/asm-m68knommu/m68360.h8
-rw-r--r--include/asm-m68knommu/page.h3
-rw-r--r--include/asm-m68knommu/pgtable.h1
-rw-r--r--include/asm-m68knommu/traps.h4
-rw-r--r--include/asm-m68knommu/uaccess.h11
-rw-r--r--include/asm-mips/a.out.h1
-rw-r--r--include/asm-mips/atomic.h33
-rw-r--r--include/asm-mips/barrier.h9
-rw-r--r--include/asm-mips/bitops.h10
-rw-r--r--include/asm-mips/compat.h2
-rw-r--r--include/asm-mips/dec/serial.h36
-rw-r--r--include/asm-mips/ds1216.h31
-rw-r--r--include/asm-mips/fb.h19
-rw-r--r--include/asm-mips/futex.h8
-rw-r--r--include/asm-mips/gfx.h55
-rw-r--r--include/asm-mips/mach-cobalt/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-excite/cpu-feature-overrides.h3
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-qemu/cpu-feature-overrides.h3
-rw-r--r--include/asm-mips/mach-rm/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-sibyte/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-yosemite/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/pgtable.h34
-rw-r--r--include/asm-mips/sibyte/bcm1480_regs.h30
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h76
-rw-r--r--include/asm-mips/sibyte/sb1250_uart.h7
-rw-r--r--include/asm-mips/spinlock.h18
-rw-r--r--include/asm-mips/system.h20
-rw-r--r--include/asm-parisc/a.out.h1
-rw-r--r--include/asm-parisc/compat.h2
-rw-r--r--include/asm-parisc/fb.h19
-rw-r--r--include/asm-parisc/fcntl.h29
-rw-r--r--include/asm-parisc/pgtable.h20
-rw-r--r--include/asm-parisc/system.h11
-rw-r--r--include/asm-powerpc/a.out.h3
-rw-r--r--include/asm-powerpc/cache.h4
-rw-r--r--include/asm-powerpc/compat.h2
-rw-r--r--include/asm-powerpc/cputable.h111
-rw-r--r--include/asm-powerpc/fb.h21
-rw-r--r--include/asm-powerpc/floppy.h6
-rw-r--r--include/asm-powerpc/hvcall.h1
-rw-r--r--include/asm-powerpc/io.h26
-rw-r--r--include/asm-powerpc/irq.h9
-rw-r--r--include/asm-powerpc/kprobes.h6
-rw-r--r--include/asm-powerpc/lppaca.h2
-rw-r--r--include/asm-powerpc/lv1call.h3
-rw-r--r--include/asm-powerpc/machdep.h2
-rw-r--r--include/asm-powerpc/mmu-8xx.h147
-rw-r--r--include/asm-powerpc/mmu-fsl-booke.h88
-rw-r--r--include/asm-powerpc/mmu-hash32.h91
-rw-r--r--include/asm-powerpc/mmu-hash64.h9
-rw-r--r--include/asm-powerpc/mmu.h13
-rw-r--r--include/asm-powerpc/mmu_context.h202
-rw-r--r--include/asm-powerpc/mpc86xx.h6
-rw-r--r--include/asm-powerpc/mpc8xx.h4
-rw-r--r--include/asm-powerpc/mpic.h3
-rw-r--r--include/asm-powerpc/of_device.h22
-rw-r--r--include/asm-powerpc/of_platform.h38
-rw-r--r--include/asm-powerpc/oprofile_impl.h10
-rw-r--r--include/asm-powerpc/pci-bridge.h148
-rw-r--r--include/asm-powerpc/pci.h11
-rw-r--r--include/asm-powerpc/percpu.h7
-rw-r--r--include/asm-powerpc/pgtable-ppc32.h67
-rw-r--r--include/asm-powerpc/pgtable-ppc64.h91
-rw-r--r--include/asm-powerpc/pgtable.h28
-rw-r--r--include/asm-powerpc/pmi.h8
-rw-r--r--include/asm-powerpc/ppc-pci.h9
-rw-r--r--include/asm-powerpc/processor.h8
-rw-r--r--include/asm-powerpc/prom.h58
-rw-r--r--include/asm-powerpc/ps3.h182
-rw-r--r--include/asm-powerpc/ps3av.h48
-rw-r--r--include/asm-powerpc/ps3fb.h12
-rw-r--r--include/asm-powerpc/ps3stor.h71
-rw-r--r--include/asm-powerpc/ptrace.h22
-rw-r--r--include/asm-powerpc/reg.h2
-rw-r--r--include/asm-powerpc/spu.h76
-rw-r--r--include/asm-powerpc/spu_csa.h8
-rw-r--r--include/asm-powerpc/syscalls.h7
-rw-r--r--include/asm-powerpc/systbl.h1
-rw-r--r--include/asm-powerpc/system.h14
-rw-r--r--include/asm-powerpc/termbits.h4
-rw-r--r--include/asm-powerpc/thread_info.h12
-rw-r--r--include/asm-powerpc/time.h4
-rw-r--r--include/asm-powerpc/tlbflush.h5
-rw-r--r--include/asm-powerpc/unistd.h3
-rw-r--r--include/asm-ppc/pgtable.h17
-rw-r--r--include/asm-ppc/system.h11
-rw-r--r--include/asm-s390/a.out.h1
-rw-r--r--include/asm-s390/compat.h2
-rw-r--r--include/asm-s390/dma-mapping.h12
-rw-r--r--include/asm-s390/fb.h12
-rw-r--r--include/asm-s390/kprobes.h2
-rw-r--r--include/asm-s390/page.h3
-rw-r--r--include/asm-s390/percpu.h7
-rw-r--r--include/asm-s390/pgtable.h66
-rw-r--r--include/asm-s390/system.h10
-rw-r--r--include/asm-sh/a.out.h1
-rw-r--r--include/asm-sh/bugs.h4
-rw-r--r--include/asm-sh/cache.h4
-rw-r--r--include/asm-sh/clock.h1
-rw-r--r--include/asm-sh/cpu-sh2/cache.h20
-rw-r--r--include/asm-sh/cpu-sh3/timer.h4
-rw-r--r--include/asm-sh/cpu-sh4/freq.h2
-rw-r--r--include/asm-sh/cpu-sh4/timer.h57
-rw-r--r--include/asm-sh/fb.h19
-rw-r--r--include/asm-sh/futex-irq.h111
-rw-r--r--include/asm-sh/futex.h79
-rw-r--r--include/asm-sh/hd64461.h397
-rw-r--r--include/asm-sh/hw_irq.h113
-rw-r--r--include/asm-sh/irq.h40
-rw-r--r--include/asm-sh/machvec.h4
-rw-r--r--include/asm-sh/machvec_init.h53
-rw-r--r--include/asm-sh/mmzone.h46
-rw-r--r--include/asm-sh/page.h10
-rw-r--r--include/asm-sh/parport.h16
-rw-r--r--include/asm-sh/pgtable.h12
-rw-r--r--include/asm-sh/processor.h8
-rw-r--r--include/asm-sh/rwsem.h6
-rw-r--r--include/asm-sh/saturn/io.h19
-rw-r--r--include/asm-sh/saturn/smpc.h34
-rw-r--r--include/asm-sh/se7722.h40
-rw-r--r--include/asm-sh/sections.h2
-rw-r--r--include/asm-sh/setup.h1
-rw-r--r--include/asm-sh/sh03/io.h4
-rw-r--r--include/asm-sh/smp.h2
-rw-r--r--include/asm-sh/snapgear.h4
-rw-r--r--include/asm-sh/sparsemem.h16
-rw-r--r--include/asm-sh/system.h26
-rw-r--r--include/asm-sh/topology.h30
-rw-r--r--include/asm-sh/uaccess.h40
-rw-r--r--include/asm-sh/ubc.h9
-rw-r--r--include/asm-sh/unistd.h3
-rw-r--r--include/asm-sh64/a.out.h1
-rw-r--r--include/asm-sh64/fb.h19
-rw-r--r--include/asm-sh64/pgtable.h7
-rw-r--r--include/asm-sh64/unistd.h3
-rw-r--r--include/asm-sparc/a.out.h1
-rw-r--r--include/asm-sparc/device.h14
-rw-r--r--include/asm-sparc/fb.h21
-rw-r--r--include/asm-sparc/irq.h168
-rw-r--r--include/asm-sparc/of_device.h49
-rw-r--r--include/asm-sparc/of_platform.h32
-rw-r--r--include/asm-sparc/oplib.h26
-rw-r--r--include/asm-sparc/pgtable.h5
-rw-r--r--include/asm-sparc/prom.h66
-rw-r--r--include/asm-sparc/system.h10
-rw-r--r--include/asm-sparc/unistd.h6
-rw-r--r--include/asm-sparc64/a.out.h2
-rw-r--r--include/asm-sparc64/bugs.h5
-rw-r--r--include/asm-sparc64/compat.h2
-rw-r--r--include/asm-sparc64/cpudata.h5
-rw-r--r--include/asm-sparc64/delay.h32
-rw-r--r--include/asm-sparc64/fb.h27
-rw-r--r--include/asm-sparc64/hvtramp.h37
-rw-r--r--include/asm-sparc64/hypervisor.h2
-rw-r--r--include/asm-sparc64/io.h5
-rw-r--r--include/asm-sparc64/irq.h2
-rw-r--r--include/asm-sparc64/kprobes.h1
-rw-r--r--include/asm-sparc64/ldc.h138
-rw-r--r--include/asm-sparc64/mdesc.h92
-rw-r--r--include/asm-sparc64/mmu_context.h3
-rw-r--r--include/asm-sparc64/of_device.h50
-rw-r--r--include/asm-sparc64/of_platform.h33
-rw-r--r--include/asm-sparc64/oplib.h28
-rw-r--r--include/asm-sparc64/parport.h233
-rw-r--r--include/asm-sparc64/percpu.h7
-rw-r--r--include/asm-sparc64/pgtable.h18
-rw-r--r--include/asm-sparc64/prom.h66
-rw-r--r--include/asm-sparc64/smp.h11
-rw-r--r--include/asm-sparc64/system.h16
-rw-r--r--include/asm-sparc64/unistd.h6
-rw-r--r--include/asm-sparc64/vio.h406
-rw-r--r--include/asm-um/a.out.h2
-rw-r--r--include/asm-um/pgtable.h18
-rw-r--r--include/asm-um/thread_info.h15
-rw-r--r--include/asm-v850/fb.h12
-rw-r--r--include/asm-v850/ioctls.h4
-rw-r--r--include/asm-v850/termbits.h5
-rw-r--r--include/asm-v850/termios.h6
-rw-r--r--include/asm-x86_64/a.out.h3
-rw-r--r--include/asm-x86_64/acpi.h11
-rw-r--r--include/asm-x86_64/alternative.h2
-rw-r--r--include/asm-x86_64/apic.h6
-rw-r--r--include/asm-x86_64/auxvec.h2
-rw-r--r--include/asm-x86_64/calgary.h9
-rw-r--r--include/asm-x86_64/cmpxchg.h2
-rw-r--r--include/asm-x86_64/compat.h2
-rw-r--r--include/asm-x86_64/dmi.h5
-rw-r--r--include/asm-x86_64/elf.h13
-rw-r--r--include/asm-x86_64/fb.h19
-rw-r--r--include/asm-x86_64/fixmap.h10
-rw-r--r--include/asm-x86_64/hpet.h62
-rw-r--r--include/asm-x86_64/hw_irq.h20
-rw-r--r--include/asm-x86_64/hypertransport.h43
-rw-r--r--include/asm-x86_64/i8253.h6
-rw-r--r--include/asm-x86_64/io.h1
-rw-r--r--include/asm-x86_64/iommu.h29
-rw-r--r--include/asm-x86_64/kprobes.h1
-rw-r--r--include/asm-x86_64/mce.h5
-rw-r--r--include/asm-x86_64/mmu.h1
-rw-r--r--include/asm-x86_64/msidef.h48
-rw-r--r--include/asm-x86_64/nmi.h2
-rw-r--r--include/asm-x86_64/page.h3
-rw-r--r--include/asm-x86_64/pci.h19
-rw-r--r--include/asm-x86_64/percpu.h7
-rw-r--r--include/asm-x86_64/pgalloc.h73
-rw-r--r--include/asm-x86_64/pgtable.h17
-rw-r--r--include/asm-x86_64/processor.h12
-rw-r--r--include/asm-x86_64/proto.h20
-rw-r--r--include/asm-x86_64/ptrace.h1
-rw-r--r--include/asm-x86_64/resume-trace.h13
-rw-r--r--include/asm-x86_64/string.h5
-rw-r--r--include/asm-x86_64/system.h45
-rw-r--r--include/asm-x86_64/thread_info.h2
-rw-r--r--include/asm-x86_64/timex.h1
-rw-r--r--include/asm-x86_64/tlbflush.h6
-rw-r--r--include/asm-x86_64/topology.h2
-rw-r--r--include/asm-x86_64/unistd.h2
-rw-r--r--include/asm-x86_64/vgtod.h29
-rw-r--r--include/asm-x86_64/vsyscall.h3
-rw-r--r--include/asm-xtensa/a.out.h1
-rw-r--r--include/asm-xtensa/fb.h12
-rw-r--r--include/asm-xtensa/pgtable.h15
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/aio.h2
-rw-r--r--include/linux/async_tx.h6
-rw-r--r--include/linux/ata.h9
-rw-r--r--include/linux/attribute_container.h1
-rw-r--r--include/linux/audit.h43
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--include/linux/binfmts.h19
-rw-r--r--include/linux/blkdev.h28
-rw-r--r--include/linux/bsg.h69
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/bug.h7
-rw-r--r--include/linux/capability.h1
-rw-r--r--include/linux/cdrom.h4
-rw-r--r--include/linux/clockchips.h5
-rw-r--r--include/linux/clocksource.h6
-rw-r--r--include/linux/cobalt-nvram.h109
-rw-r--r--include/linux/coda_linux.h4
-rw-r--r--include/linux/coda_proc.h76
-rw-r--r--include/linux/coda_psdev.h15
-rw-r--r--include/linux/compiler-gcc4.h18
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/configfs.h34
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/consolemap.h5
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/crc7.h14
-rw-r--r--include/linux/dcookies.h1
-rw-r--r--include/linux/device.h10
-rw-r--r--include/linux/dma-mapping.h4
-rw-r--r--include/linux/ds17287rtc.h1
-rw-r--r--include/linux/edac.h29
-rw-r--r--include/linux/efs_fs.h1
-rw-r--r--include/linux/elf-em.h3
-rw-r--r--include/linux/elfnote.h22
-rw-r--r--include/linux/exportfs.h126
-rw-r--r--include/linux/ext2_fs_sb.h2
-rw-r--r--include/linux/ext3_fs_sb.h2
-rw-r--r--include/linux/ext4_fs.h104
-rw-r--r--include/linux/ext4_fs_extents.h43
-rw-r--r--include/linux/ext4_fs_i.h5
-rw-r--r--include/linux/ext4_fs_sb.h5
-rw-r--r--include/linux/falloc.h6
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/freezer.h23
-rw-r--r--include/linux/fs.h166
-rw-r--r--include/linux/fsl_devices.h8
-rw-r--r--include/linux/fuse.h2
-rw-r--r--include/linux/genetlink.h13
-rw-r--r--include/linux/gfp.h19
-rw-r--r--include/linux/highmem.h36
-rw-r--r--include/linux/hrtimer.h5
-rw-r--r--include/linux/hugetlb.h2
-rw-r--r--include/linux/i2c-id.h7
-rw-r--r--include/linux/i2c-isa.h36
-rw-r--r--include/linux/i2c.h1
-rw-r--r--include/linux/i2o.h8
-rw-r--r--include/linux/ide.h31
-rw-r--r--include/linux/idr.h3
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/input.h3
-rw-r--r--include/linux/io.h29
-rw-r--r--include/linux/ioprio.h8
-rw-r--r--include/linux/ipc.h12
-rw-r--r--include/linux/irda.h1
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/jbd2.h6
-rw-r--r--include/linux/kallsyms.h6
-rw-r--r--include/linux/kernel.h9
-rw-r--r--include/linux/kernelcapi.h2
-rw-r--r--include/linux/kmod.h52
-rw-r--r--include/linux/kobject.h25
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/leds.h1
-rw-r--r--include/linux/lguest.h85
-rw-r--r--include/linux/lguest_bus.h48
-rw-r--r--include/linux/lguest_launcher.h73
-rw-r--r--include/linux/libata.h35
-rw-r--r--include/linux/limits.h2
-rw-r--r--include/linux/linux_logo.h8
-rw-r--r--include/linux/lockd/bind.h9
-rw-r--r--include/linux/lockdep.h71
-rw-r--r--include/linux/lzo.h2
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/major.h2
-rw-r--r--include/linux/mempolicy.h6
-rw-r--r--include/linux/mm.h148
-rw-r--r--include/linux/mmzone.h33
-rw-r--r--include/linux/mnt_namespace.h2
-rw-r--r--include/linux/module.h1
-rw-r--r--include/linux/msdos_fs.h2
-rw-r--r--include/linux/namei.h4
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/netdevice.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h2
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs_fs.h4
-rw-r--r--include/linux/nfs_xdr.h32
-rw-r--r--include/linux/nfsd/export.h30
-rw-r--r--include/linux/nfsd/interface.h13
-rw-r--r--include/linux/nfsd/nfsd.h9
-rw-r--r--include/linux/nfsd/state.h3
-rw-r--r--include/linux/nfsd/xdr4.h7
-rw-r--r--include/linux/notifier.h9
-rw-r--r--include/linux/nsproxy.h3
-rw-r--r--include/linux/of.h61
-rw-r--r--include/linux/of_device.h26
-rw-r--r--include/linux/of_platform.h57
-rw-r--r--include/linux/oprofile.h35
-rw-r--r--include/linux/page-flags.h50
-rw-r--r--include/linux/pci.h3
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/percpu_counter.h18
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pm.h12
-rw-r--r--include/linux/prctl.h4
-rw-r--r--include/linux/prefetch.h2
-rw-r--r--include/linux/proc_fs.h13
-rw-r--r--include/linux/ptrace.h2
-rw-r--r--include/linux/raid/bitmap.h6
-rw-r--r--include/linux/raid/md_k.h2
-rw-r--r--include/linux/reboot.h5
-rw-r--r--include/linux/resume-trace.h19
-rw-r--r--include/linux/rtc/m48t59.h57
-rw-r--r--include/linux/sched.h41
-rw-r--r--include/linux/scx200_gpio.h2
-rw-r--r--include/linux/seccomp.h19
-rw-r--r--include/linux/serial.h6
-rw-r--r--include/linux/serial_8250.h6
-rw-r--r--include/linux/serial_core.h8
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/signal.h4
-rw-r--r--include/linux/slab.h153
-rw-r--r--include/linux/slab_def.h38
-rw-r--r--include/linux/slob_def.h36
-rw-r--r--include/linux/slub_def.h35
-rw-r--r--include/linux/smp.h13
-rw-r--r--include/linux/smp_lock.h1
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/sonypi.h2
-rw-r--r--include/linux/spi/ads7846.h14
-rw-r--r--include/linux/spi/spi.h1
-rw-r--r--include/linux/spi/spi_bitbang.h1
-rw-r--r--include/linux/spi/tle62x0.h24
-rw-r--r--include/linux/spinlock.h7
-rw-r--r--include/linux/spinlock_types.h4
-rw-r--r--include/linux/spinlock_types_up.h9
-rw-r--r--include/linux/stacktrace.h2
-rw-r--r--include/linux/string.h4
-rw-r--r--include/linux/sunrpc/gss_api.h1
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/svcauth.h1
-rw-r--r--include/linux/sunrpc/svcauth_gss.h1
-rw-r--r--include/linux/sunrpc/xdr.h16
-rw-r--r--include/linux/suspend.h52
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/taskstats.h5
-rw-r--r--include/linux/time.h8
-rw-r--r--include/linux/timer.h16
-rw-r--r--include/linux/timex.h60
-rw-r--r--include/linux/tty.h39
-rw-r--r--include/linux/uio.h9
-rw-r--r--include/linux/uio_driver.h91
-rw-r--r--include/linux/user_namespace.h61
-rw-r--r--include/linux/utsname.h16
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/linux/vmalloc.h14
-rw-r--r--include/linux/vmstat.h5
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/workqueue.h15
-rw-r--r--include/media/saa7146.h6
-rw-r--r--include/media/tuner.h71
-rw-r--r--include/mtd/ubi-header.h101
-rw-r--r--include/net/genetlink.h22
-rw-r--r--include/net/netlabel.h62
-rw-r--r--include/net/scm.h2
-rw-r--r--include/net/tcp.h6
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/sound/ak4xxx-adda.h1
-rw-r--r--include/sound/cs46xx.h4
-rw-r--r--include/sound/cs46xx_dsp_spos.h2
-rw-r--r--include/sound/emu10k1.h16
-rw-r--r--include/sound/sb.h1
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wavefront_fx.h9
-rw-r--r--include/video/tgafb.h1
-rw-r--r--include/xen/events.h48
-rw-r--r--include/xen/features.h23
-rw-r--r--include/xen/grant_table.h107
-rw-r--r--include/xen/hvc-console.h6
-rw-r--r--include/xen/interface/elfnote.h133
-rw-r--r--include/xen/interface/event_channel.h195
-rw-r--r--include/xen/interface/features.h43
-rw-r--r--include/xen/interface/grant_table.h375
-rw-r--r--include/xen/interface/io/blkif.h94
-rw-r--r--include/xen/interface/io/console.h23
-rw-r--r--include/xen/interface/io/netif.h158
-rw-r--r--include/xen/interface/io/ring.h260
-rw-r--r--include/xen/interface/io/xenbus.h44
-rw-r--r--include/xen/interface/io/xs_wire.h87
-rw-r--r--include/xen/interface/memory.h145
-rw-r--r--include/xen/interface/physdev.h145
-rw-r--r--include/xen/interface/sched.h77
-rw-r--r--include/xen/interface/vcpu.h167
-rw-r--r--include/xen/interface/version.h60
-rw-r--r--include/xen/interface/xen.h447
-rw-r--r--include/xen/page.h179
-rw-r--r--include/xen/xenbus.h234
585 files changed, 10859 insertions, 4538 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 8948a6461834..45662f6dbdb6 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -486,6 +486,8 @@
486#define ACPI_FUNCTION_NAME(name) 486#define ACPI_FUNCTION_NAME(name)
487#endif 487#endif
488 488
489#ifdef DEBUG_FUNC_TRACE
490
489#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 491#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
490 acpi_ut_trace(ACPI_DEBUG_PARAMETERS) 492 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
491#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 493#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
@@ -563,6 +565,27 @@
563 565
564#endif /* ACPI_SIMPLE_RETURN_MACROS */ 566#endif /* ACPI_SIMPLE_RETURN_MACROS */
565 567
568#else /* !DEBUG_FUNC_TRACE */
569
570#define ACPI_FUNCTION_TRACE(a)
571#define ACPI_FUNCTION_TRACE_PTR(a,b)
572#define ACPI_FUNCTION_TRACE_U32(a,b)
573#define ACPI_FUNCTION_TRACE_STR(a,b)
574#define ACPI_FUNCTION_EXIT
575#define ACPI_FUNCTION_STATUS_EXIT(s)
576#define ACPI_FUNCTION_VALUE_EXIT(s)
577#define ACPI_FUNCTION_TRACE(a)
578#define ACPI_FUNCTION_ENTRY()
579
580#define return_VOID return
581#define return_ACPI_STATUS(s) return(s)
582#define return_VALUE(s) return(s)
583#define return_UINT8(s) return(s)
584#define return_UINT32(s) return(s)
585#define return_PTR(s) return(s)
586
587#endif /* DEBUG_FUNC_TRACE */
588
566/* Conditional execution */ 589/* Conditional execution */
567 590
568#define ACPI_DEBUG_EXEC(a) a 591#define ACPI_DEBUG_EXEC(a) a
@@ -599,26 +622,26 @@
599#define ACPI_DEBUG_EXEC(a) 622#define ACPI_DEBUG_EXEC(a)
600#define ACPI_NORMAL_EXEC(a) a; 623#define ACPI_NORMAL_EXEC(a) a;
601 624
602#define ACPI_DEBUG_DEFINE(a) 625#define ACPI_DEBUG_DEFINE(a) do { } while(0)
603#define ACPI_DEBUG_ONLY_MEMBERS(a) 626#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)
604#define ACPI_FUNCTION_NAME(a) 627#define ACPI_FUNCTION_NAME(a) do { } while(0)
605#define ACPI_FUNCTION_TRACE(a) 628#define ACPI_FUNCTION_TRACE(a) do { } while(0)
606#define ACPI_FUNCTION_TRACE_PTR(a,b) 629#define ACPI_FUNCTION_TRACE_PTR(a,b) do { } while(0)
607#define ACPI_FUNCTION_TRACE_U32(a,b) 630#define ACPI_FUNCTION_TRACE_U32(a,b) do { } while(0)
608#define ACPI_FUNCTION_TRACE_STR(a,b) 631#define ACPI_FUNCTION_TRACE_STR(a,b) do { } while(0)
609#define ACPI_FUNCTION_EXIT 632#define ACPI_FUNCTION_EXIT do { } while(0)
610#define ACPI_FUNCTION_STATUS_EXIT(s) 633#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)
611#define ACPI_FUNCTION_VALUE_EXIT(s) 634#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
612#define ACPI_FUNCTION_ENTRY() 635#define ACPI_FUNCTION_ENTRY() do { } while(0)
613#define ACPI_DUMP_STACK_ENTRY(a) 636#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
614#define ACPI_DUMP_OPERANDS(a,b,c,d,e) 637#define ACPI_DUMP_OPERANDS(a,b,c,d,e) do { } while(0)
615#define ACPI_DUMP_ENTRY(a,b) 638#define ACPI_DUMP_ENTRY(a,b) do { } while(0)
616#define ACPI_DUMP_TABLES(a,b) 639#define ACPI_DUMP_TABLES(a,b) do { } while(0)
617#define ACPI_DUMP_PATHNAME(a,b,c,d) 640#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0)
618#define ACPI_DUMP_RESOURCE_LIST(a) 641#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
619#define ACPI_DUMP_BUFFER(a,b) 642#define ACPI_DUMP_BUFFER(a,b) do { } while(0)
620#define ACPI_DEBUG_PRINT(pl) 643#define ACPI_DEBUG_PRINT(pl) do { } while(0)
621#define ACPI_DEBUG_PRINT_RAW(pl) 644#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0)
622 645
623#define return_VOID return 646#define return_VOID return
624#define return_ACPI_STATUS(s) return(s) 647#define return_ACPI_STATUS(s) return(s)
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 7812267b577f..c090a8b0bc99 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -178,8 +178,8 @@
178 178
179/* Defaults for debug_level, debug and normal */ 179/* Defaults for debug_level, debug and normal */
180 180
181#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) 181#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR)
182#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) 182#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR)
183#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 183#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
184 184
185#endif /* __ACOUTPUT_H__ */ 185#endif /* __ACOUTPUT_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c6fa5e023bc7..5e3dcf3299bf 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -321,7 +321,8 @@ struct acpi_bus_event {
321}; 321};
322 322
323extern struct kset acpi_subsys; 323extern struct kset acpi_subsys;
324 324extern int acpi_bus_generate_genetlink_event(struct acpi_device *device,
325 u8 type, int data);
325/* 326/*
326 * External Functions 327 * External Functions
327 */ 328 */
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index e2fcee2b340d..62c5ee4311da 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -13,6 +13,7 @@
13 13
14extern int pxm_to_node(int); 14extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern void __acpi_map_pxm_to_node(int, int);
16extern int acpi_map_pxm_to_node(int); 17extern int acpi_map_pxm_to_node(int);
17extern void __cpuinit acpi_unmap_pxm_to_node(int); 18extern void __cpuinit acpi_unmap_pxm_to_node(int);
18 19
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index dab2ec59a3b0..c785485e62a6 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -136,7 +136,7 @@
136 136
137/*! [Begin] no source code translation */ 137/*! [Begin] no source code translation */
138 138
139#if defined(__linux__) 139#if defined(_LINUX) || defined(__linux__)
140#include "aclinux.h" 140#include "aclinux.h"
141 141
142#elif defined(_AED_EFI) 142#elif defined(_AED_EFI)
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a568717f98c6..6ed15a0978eb 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -91,7 +91,10 @@
91#define ACPI_USE_NATIVE_DIVIDE 91#define ACPI_USE_NATIVE_DIVIDE
92#endif 92#endif
93 93
94#ifndef __cdecl
94#define __cdecl 95#define __cdecl
96#endif
97
95#define ACPI_FLUSH_CPU_CACHE() 98#define ACPI_FLUSH_CPU_CACHE()
96#endif /* __KERNEL__ */ 99#endif /* __KERNEL__ */
97 100
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index b4b0ffdab098..f9f987f8e661 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -21,6 +21,8 @@
21#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */ 21#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
22#define ACPI_PSD_REV0_ENTRIES 5 22#define ACPI_PSD_REV0_ENTRIES 5
23 23
24#define ACPI_TSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
25#define ACPI_TSD_REV0_ENTRIES 5
24/* 26/*
25 * Types of coordination defined in ACPI 3.0. Same macros can be used across 27 * Types of coordination defined in ACPI 3.0. Same macros can be used across
26 * P, C and T states 28 * P, C and T states
@@ -125,17 +127,53 @@ struct acpi_processor_performance {
125 127
126/* Throttling Control */ 128/* Throttling Control */
127 129
130struct acpi_tsd_package {
131 acpi_integer num_entries;
132 acpi_integer revision;
133 acpi_integer domain;
134 acpi_integer coord_type;
135 acpi_integer num_processors;
136} __attribute__ ((packed));
137
138struct acpi_ptc_register {
139 u8 descriptor;
140 u16 length;
141 u8 space_id;
142 u8 bit_width;
143 u8 bit_offset;
144 u8 reserved;
145 u64 address;
146} __attribute__ ((packed));
147
148struct acpi_processor_tx_tss {
149 acpi_integer freqpercentage; /* */
150 acpi_integer power; /* milliWatts */
151 acpi_integer transition_latency; /* microseconds */
152 acpi_integer control; /* control value */
153 acpi_integer status; /* success indicator */
154};
128struct acpi_processor_tx { 155struct acpi_processor_tx {
129 u16 power; 156 u16 power;
130 u16 performance; 157 u16 performance;
131}; 158};
132 159
160struct acpi_processor;
133struct acpi_processor_throttling { 161struct acpi_processor_throttling {
134 int state; 162 unsigned int state;
163 unsigned int platform_limit;
164 struct acpi_pct_register control_register;
165 struct acpi_pct_register status_register;
166 unsigned int state_count;
167 struct acpi_processor_tx_tss *states_tss;
168 struct acpi_tsd_package domain_info;
169 cpumask_t shared_cpu_map;
170 int (*acpi_processor_get_throttling) (struct acpi_processor * pr);
171 int (*acpi_processor_set_throttling) (struct acpi_processor * pr,
172 int state);
173
135 u32 address; 174 u32 address;
136 u8 duty_offset; 175 u8 duty_offset;
137 u8 duty_width; 176 u8 duty_width;
138 int state_count;
139 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; 177 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
140}; 178};
141 179
@@ -169,6 +207,9 @@ struct acpi_processor {
169 u32 id; 207 u32 id;
170 u32 pblk; 208 u32 pblk;
171 int performance_platform_limit; 209 int performance_platform_limit;
210 int throttling_platform_limit;
211 /* 0 - states 0..n-th state available */
212
172 struct acpi_processor_flags flags; 213 struct acpi_processor_flags flags;
173 struct acpi_processor_power power; 214 struct acpi_processor_power power;
174 struct acpi_processor_performance *performance; 215 struct acpi_processor_performance *performance;
@@ -270,7 +311,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
270 311
271/* in processor_throttling.c */ 312/* in processor_throttling.c */
272int acpi_processor_get_throttling_info(struct acpi_processor *pr); 313int acpi_processor_get_throttling_info(struct acpi_processor *pr);
273int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 314extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
274extern struct file_operations acpi_processor_throttling_fops; 315extern struct file_operations acpi_processor_throttling_fops;
275 316
276/* in processor_idle.c */ 317/* in processor_idle.c */
diff --git a/include/asm-alpha/a.out.h b/include/asm-alpha/a.out.h
index d97daf42753d..e43cf61649a9 100644
--- a/include/asm-alpha/a.out.h
+++ b/include/asm-alpha/a.out.h
@@ -101,6 +101,8 @@ struct exec
101#define STACK_TOP \ 101#define STACK_TOP \
102 (current->personality & ADDR_LIMIT_32BIT ? 0x80000000 : 0x00120000000UL) 102 (current->personality & ADDR_LIMIT_32BIT ? 0x80000000 : 0x00120000000UL)
103 103
104#define STACK_TOP_MAX 0x00120000000UL
105
104#endif 106#endif
105 107
106#endif /* __A_OUT_GNU_H__ */ 108#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-alpha/fb.h b/include/asm-alpha/fb.h
new file mode 100644
index 000000000000..fa9bbb96b2b3
--- /dev/null
+++ b/include/asm-alpha/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/device.h>
4
5/* Caching is off in the I/O space quadrant by design. */
6#define fb_pgprotect(...) do {} while (0)
7
8static inline int fb_is_primary_device(struct fb_info *info)
9{
10 return 0;
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 21a86f1a05b3..ab5b60dcef19 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -4,6 +4,7 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/mm.h>
7#include <asm/compiler.h> 8#include <asm/compiler.h>
8#include <asm/system.h> 9#include <asm/system.h>
9#include <asm/pgtable.h> 10#include <asm/pgtable.h>
@@ -90,6 +91,11 @@ static inline void * phys_to_virt(unsigned long address)
90 91
91#define page_to_phys(page) page_to_pa(page) 92#define page_to_phys(page) page_to_pa(page)
92 93
94static inline dma_addr_t __deprecated isa_page_to_bus(struct page *page)
95{
96 return page_to_phys(page);
97}
98
93/* This depends on working iommu. */ 99/* This depends on working iommu. */
94#define BIO_VMERGE_BOUNDARY (alpha_mv.mv_pci_tbi ? PAGE_SIZE : 0) 100#define BIO_VMERGE_BOUNDARY (alpha_mv.mv_pci_tbi ? PAGE_SIZE : 0)
95 101
@@ -102,12 +108,12 @@ static inline void * phys_to_virt(unsigned long address)
102 * 108 *
103 * Note that this only works for a limited range of kernel addresses, 109 * Note that this only works for a limited range of kernel addresses,
104 * and very well may not span all memory. Consider this interface 110 * and very well may not span all memory. Consider this interface
105 * deprecated in favour of the mapping functions in <asm/pci.h>. 111 * deprecated in favour of the DMA-mapping API.
106 */ 112 */
107extern unsigned long __direct_map_base; 113extern unsigned long __direct_map_base;
108extern unsigned long __direct_map_size; 114extern unsigned long __direct_map_size;
109 115
110static inline unsigned long virt_to_bus(void *address) 116static inline unsigned long __deprecated virt_to_bus(void *address)
111{ 117{
112 unsigned long phys = virt_to_phys(address); 118 unsigned long phys = virt_to_phys(address);
113 unsigned long bus = phys + __direct_map_base; 119 unsigned long bus = phys + __direct_map_base;
@@ -115,7 +121,7 @@ static inline unsigned long virt_to_bus(void *address)
115} 121}
116#define isa_virt_to_bus virt_to_bus 122#define isa_virt_to_bus virt_to_bus
117 123
118static inline void *bus_to_virt(unsigned long address) 124static inline void * __deprecated bus_to_virt(unsigned long address)
119{ 125{
120 void *virt; 126 void *virt;
121 127
@@ -126,6 +132,7 @@ static inline void *bus_to_virt(unsigned long address)
126 virt = phys_to_virt(address); 132 virt = phys_to_virt(address);
127 return (long)address <= 0 ? NULL : virt; 133 return (long)address <= 0 ? NULL : virt;
128} 134}
135#define isa_bus_to_virt bus_to_virt
129 136
130/* 137/*
131 * There are different chipsets to interface the Alpha CPUs to the world. 138 * There are different chipsets to interface the Alpha CPUs to the world.
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index d2bed3cb33ff..bae7f05716d4 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -17,7 +17,8 @@
17extern void clear_page(void *page); 17extern void clear_page(void *page);
18#define clear_user_page(page, vaddr, pg) clear_page(page) 18#define clear_user_page(page, vaddr, pg) clear_page(page)
19 19
20#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr) 20#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
21 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vmaddr)
21#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 22#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
22 23
23extern void copy_page(void * _to, void * _from); 24extern void copy_page(void * _to, void * _from);
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index 616d20662ff3..99037b032357 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -264,21 +264,15 @@ extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; }
264 * The following only work if pte_present() is true. 264 * The following only work if pte_present() is true.
265 * Undefined behaviour if not.. 265 * Undefined behaviour if not..
266 */ 266 */
267extern inline int pte_read(pte_t pte) { return !(pte_val(pte) & _PAGE_FOR); }
268extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); } 267extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); }
269extern inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_FOE); }
270extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 268extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
271extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 269extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
272extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 270extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
273 271
274extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } 272extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; }
275extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOR; return pte; }
276extern inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOE; return pte; }
277extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; } 273extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; }
278extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; } 274extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; }
279extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; } 275extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; }
280extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) &= ~_PAGE_FOR; return pte; }
281extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_FOE; return pte; }
282extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; } 276extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; }
283extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } 277extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; }
284 278
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index cf1021a97b2e..620c4d86cbf4 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -139,16 +139,6 @@ extern void halt(void) __attribute__((noreturn));
139struct task_struct; 139struct task_struct;
140extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*); 140extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
141 141
142/*
143 * On SMP systems, when the scheduler does migration-cost autodetection,
144 * it needs a way to flush as much of the CPU's caches as possible.
145 *
146 * TODO: fill this in!
147 */
148static inline void sched_cacheflush(void)
149{
150}
151
152#define imb() \ 142#define imb() \
153__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory") 143__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
154 144
diff --git a/include/asm-alpha/termios.h b/include/asm-alpha/termios.h
index 39e492c3bfa3..fa13716a11c3 100644
--- a/include/asm-alpha/termios.h
+++ b/include/asm-alpha/termios.h
@@ -81,7 +81,7 @@ struct termio {
81 81
82#define user_termio_to_kernel_termios(a_termios, u_termio) \ 82#define user_termio_to_kernel_termios(a_termios, u_termio) \
83({ \ 83({ \
84 struct termios *k_termios = (a_termios); \ 84 struct ktermios *k_termios = (a_termios); \
85 struct termio k_termio; \ 85 struct termio k_termio; \
86 int canon, ret; \ 86 int canon, ret; \
87 \ 87 \
@@ -113,7 +113,7 @@ struct termio {
113 */ 113 */
114#define kernel_termios_to_user_termio(u_termio, a_termios) \ 114#define kernel_termios_to_user_termio(u_termio, a_termios) \
115({ \ 115({ \
116 struct termios *k_termios = (a_termios); \ 116 struct ktermios *k_termios = (a_termios); \
117 struct termio k_termio; \ 117 struct termio k_termio; \
118 int canon; \ 118 int canon; \
119 \ 119 \
diff --git a/include/asm-arm/a.out.h b/include/asm-arm/a.out.h
index 3e5fe64c4394..d7165e86df25 100644
--- a/include/asm-arm/a.out.h
+++ b/include/asm-arm/a.out.h
@@ -30,6 +30,7 @@ struct exec
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31#define STACK_TOP ((current->personality == PER_LINUX_32BIT) ? \ 31#define STACK_TOP ((current->personality == PER_LINUX_32BIT) ? \
32 TASK_SIZE : TASK_SIZE_26) 32 TASK_SIZE : TASK_SIZE_26)
33#define STACK_TOP_MAX TASK_SIZE
33#endif 34#endif
34 35
35#ifndef LIBRARY_START_TEXT 36#ifndef LIBRARY_START_TEXT
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index 0ce6ee98ed0b..d96b10fd449f 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -64,6 +64,7 @@ extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
64 64
65 /* Ethernet (EMAC & MACB) */ 65 /* Ethernet (EMAC & MACB) */
66struct at91_eth_data { 66struct at91_eth_data {
67 u32 phy_mask;
67 u8 phy_irq_pin; /* PHY IRQ */ 68 u8 phy_irq_pin; /* PHY IRQ */
68 u8 is_rmii; /* using RMII interface? */ 69 u8 is_rmii; /* using RMII interface? */
69}; 70};
diff --git a/include/asm-arm/fb.h b/include/asm-arm/fb.h
new file mode 100644
index 000000000000..d92e99cd8c8a
--- /dev/null
+++ b/include/asm-arm/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 21dec9f258d8..d2e8171d1d4e 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -83,14 +83,14 @@
83 * means that a write to a clean page will cause a permission fault, and 83 * means that a write to a clean page will cause a permission fault, and
84 * the Linux MM layer will mark the page dirty via handle_pte_fault(). 84 * the Linux MM layer will mark the page dirty via handle_pte_fault().
85 * For the hardware to notice the permission change, the TLB entry must 85 * For the hardware to notice the permission change, the TLB entry must
86 * be flushed, and ptep_establish() does that for us. 86 * be flushed, and ptep_set_access_flags() does that for us.
87 * 87 *
88 * The "accessed" or "young" bit is emulated by a similar method; we only 88 * The "accessed" or "young" bit is emulated by a similar method; we only
89 * allow accesses to the page if the "young" bit is set. Accesses to the 89 * allow accesses to the page if the "young" bit is set. Accesses to the
90 * page will cause a fault, and handle_pte_fault() will set the young bit 90 * page will cause a fault, and handle_pte_fault() will set the young bit
91 * for us as long as the page is marked present in the corresponding Linux 91 * for us as long as the page is marked present in the corresponding Linux
92 * PTE entry. Again, ptep_establish() will ensure that the TLB is up to 92 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
93 * date. 93 * up to date.
94 * 94 *
95 * However, when the "young" bit is cleared, we deny access to the page 95 * However, when the "young" bit is cleared, we deny access to the page
96 * by clearing the hardware PTE. Currently Linux does not flush the TLB 96 * by clearing the hardware PTE. Currently Linux does not flush the TLB
@@ -257,9 +257,7 @@ extern struct page *empty_zero_page;
257 * Undefined behaviour if not.. 257 * Undefined behaviour if not..
258 */ 258 */
259#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) 259#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT)
260#define pte_read(pte) (pte_val(pte) & L_PTE_USER)
261#define pte_write(pte) (pte_val(pte) & L_PTE_WRITE) 260#define pte_write(pte) (pte_val(pte) & L_PTE_WRITE)
262#define pte_exec(pte) (pte_val(pte) & L_PTE_EXEC)
263#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) 261#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY)
264#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) 262#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG)
265 263
@@ -275,12 +273,8 @@ extern struct page *empty_zero_page;
275#define PTE_BIT_FUNC(fn,op) \ 273#define PTE_BIT_FUNC(fn,op) \
276static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } 274static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
277 275
278/*PTE_BIT_FUNC(rdprotect, &= ~L_PTE_USER);*/
279/*PTE_BIT_FUNC(mkread, |= L_PTE_USER);*/
280PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE); 276PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE);
281PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE); 277PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE);
282PTE_BIT_FUNC(exprotect, &= ~L_PTE_EXEC);
283PTE_BIT_FUNC(mkexec, |= L_PTE_EXEC);
284PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); 278PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
285PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); 279PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
286PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); 280PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 6f8e6a69dc5f..94ea8c6dc1a4 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -254,16 +254,6 @@ do { \
254 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \ 254 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
255} while (0) 255} while (0)
256 256
257/*
258 * On SMP systems, when the scheduler does migration-cost autodetection,
259 * it needs a way to flush as much of the CPU's caches as possible.
260 *
261 * TODO: fill this in!
262 */
263static inline void sched_cacheflush(void)
264{
265}
266
267#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) 257#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
268/* 258/*
269 * On the StrongARM, "swp" is terminally broken since it bypasses the 259 * On the StrongARM, "swp" is terminally broken since it bypasses the
diff --git a/include/asm-arm26/a.out.h b/include/asm-arm26/a.out.h
index 9b2702c42c87..7167f54ae3fc 100644
--- a/include/asm-arm26/a.out.h
+++ b/include/asm-arm26/a.out.h
@@ -29,6 +29,7 @@ struct exec
29 29
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31#define STACK_TOP TASK_SIZE 31#define STACK_TOP TASK_SIZE
32#define STACK_TOP_MAX STACK_TOP
32#endif 33#endif
33 34
34#ifndef LIBRARY_START_TEXT 35#ifndef LIBRARY_START_TEXT
diff --git a/include/asm-arm26/dma-mapping.h b/include/asm-arm26/dma-mapping.h
deleted file mode 100644
index a95eae0aeb77..000000000000
--- a/include/asm-arm26/dma-mapping.h
+++ /dev/null
@@ -1,2 +0,0 @@
1#include <asm-generic/dma-mapping-broken.h>
2
diff --git a/include/asm-arm26/fb.h b/include/asm-arm26/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-arm26/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-arm26/ioctls.h b/include/asm-arm26/ioctls.h
index ba9c7d81d24e..8a3296200be1 100644
--- a/include/asm-arm26/ioctls.h
+++ b/include/asm-arm26/ioctls.h
@@ -47,6 +47,10 @@
47#define TIOCSBRK 0x5427 /* BSD compatibility */ 47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */ 48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */ 49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52 56
diff --git a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h
index 2b20e9f08857..55a1a697d12b 100644
--- a/include/asm-arm26/pgtable.h
+++ b/include/asm-arm26/pgtable.h
@@ -218,9 +218,7 @@ extern struct page *empty_zero_page;
218 * The following only work if pte_present() is true. 218 * The following only work if pte_present() is true.
219 * Undefined behaviour if not.. 219 * Undefined behaviour if not..
220 */ 220 */
221#define pte_read(pte) (!(pte_val(pte) & _PAGE_NOT_USER))
222#define pte_write(pte) (!(pte_val(pte) & _PAGE_READONLY)) 221#define pte_write(pte) (!(pte_val(pte) & _PAGE_READONLY))
223#define pte_exec(pte) (!(pte_val(pte) & _PAGE_NOT_USER))
224#define pte_dirty(pte) (!(pte_val(pte) & _PAGE_CLEAN)) 222#define pte_dirty(pte) (!(pte_val(pte) & _PAGE_CLEAN))
225#define pte_young(pte) (!(pte_val(pte) & _PAGE_OLD)) 223#define pte_young(pte) (!(pte_val(pte) & _PAGE_OLD))
226//ONLY when !pte_present() I think. nicked from arm32 (FIXME!) 224//ONLY when !pte_present() I think. nicked from arm32 (FIXME!)
@@ -231,8 +229,6 @@ static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
231 229
232PTE_BIT_FUNC(wrprotect, |= _PAGE_READONLY); 230PTE_BIT_FUNC(wrprotect, |= _PAGE_READONLY);
233PTE_BIT_FUNC(mkwrite, &= ~_PAGE_READONLY); 231PTE_BIT_FUNC(mkwrite, &= ~_PAGE_READONLY);
234PTE_BIT_FUNC(exprotect, |= _PAGE_NOT_USER);
235PTE_BIT_FUNC(mkexec, &= ~_PAGE_NOT_USER);
236PTE_BIT_FUNC(mkclean, |= _PAGE_CLEAN); 232PTE_BIT_FUNC(mkclean, |= _PAGE_CLEAN);
237PTE_BIT_FUNC(mkdirty, &= ~_PAGE_CLEAN); 233PTE_BIT_FUNC(mkdirty, &= ~_PAGE_CLEAN);
238PTE_BIT_FUNC(mkold, |= _PAGE_OLD); 234PTE_BIT_FUNC(mkold, |= _PAGE_OLD);
diff --git a/include/asm-arm26/system.h b/include/asm-arm26/system.h
index 4703593b3bb5..e09da5ff1f54 100644
--- a/include/asm-arm26/system.h
+++ b/include/asm-arm26/system.h
@@ -110,16 +110,6 @@ do { \
110} while (0) 110} while (0)
111 111
112/* 112/*
113 * On SMP systems, when the scheduler does migration-cost autodetection,
114 * it needs a way to flush as much of the CPU's caches as possible.
115 *
116 * TODO: fill this in!
117 */
118static inline void sched_cacheflush(void)
119{
120}
121
122/*
123 * Save the current interrupt enable state & disable IRQs 113 * Save the current interrupt enable state & disable IRQs
124 */ 114 */
125#define local_irq_save(x) \ 115#define local_irq_save(x) \
diff --git a/include/asm-arm26/termbits.h b/include/asm-arm26/termbits.h
index f66b51804736..48d2f5c7bcb8 100644
--- a/include/asm-arm26/termbits.h
+++ b/include/asm-arm26/termbits.h
@@ -138,6 +138,7 @@ struct ktermios {
138#define HUPCL 0002000 138#define HUPCL 0002000
139#define CLOCAL 0004000 139#define CLOCAL 0004000
140#define CBAUDEX 0010000 140#define CBAUDEX 0010000
141#define BOTHER 0010000
141#define B57600 0010001 142#define B57600 0010001
142#define B115200 0010002 143#define B115200 0010002
143#define B230400 0010003 144#define B230400 0010003
@@ -153,10 +154,12 @@ struct ktermios {
153#define B3000000 0010015 154#define B3000000 0010015
154#define B3500000 0010016 155#define B3500000 0010016
155#define B4000000 0010017 156#define B4000000 0010017
156#define CIBAUD 002003600000 /* input baud rate (not used) */ 157#define CIBAUD 002003600000 /* input baud rate */
157#define CMSPAR 010000000000 /* mark or space (stick) parity */ 158#define CMSPAR 010000000000 /* mark or space (stick) parity */
158#define CRTSCTS 020000000000 /* flow control */ 159#define CRTSCTS 020000000000 /* flow control */
159 160
161#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
162
160/* c_lflag bits */ 163/* c_lflag bits */
161#define ISIG 0000001 164#define ISIG 0000001
162#define ICANON 0000002 165#define ICANON 0000002
diff --git a/include/asm-arm26/termios.h b/include/asm-arm26/termios.h
index 329c324c4040..293e3f1bc3f2 100644
--- a/include/asm-arm26/termios.h
+++ b/include/asm-arm26/termios.h
@@ -82,8 +82,10 @@ struct termio {
82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
83}) 83})
84 84
85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
88#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
87 89
88#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
89 91
diff --git a/include/asm-avr32/a.out.h b/include/asm-avr32/a.out.h
index 50bf6e31a143..9f398ab28ed0 100644
--- a/include/asm-avr32/a.out.h
+++ b/include/asm-avr32/a.out.h
@@ -20,6 +20,7 @@ struct exec
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#define STACK_TOP TASK_SIZE 22#define STACK_TOP TASK_SIZE
23#define STACK_TOP_MAX STACK_TOP
23 24
24#endif 25#endif
25 26
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 9fd2e32f84b8..0215965dc586 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -21,6 +21,7 @@ void at32_map_usart(unsigned int hw_id, unsigned int line);
21struct platform_device *at32_add_device_usart(unsigned int id); 21struct platform_device *at32_add_device_usart(unsigned int id);
22 22
23struct eth_platform_data { 23struct eth_platform_data {
24 u32 phy_mask;
24 u8 is_rmii; 25 u8 is_rmii;
25}; 26};
26struct platform_device * 27struct platform_device *
@@ -35,4 +36,18 @@ struct platform_device *
35at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 36at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
36 unsigned long fbmem_start, unsigned long fbmem_len); 37 unsigned long fbmem_start, unsigned long fbmem_len);
37 38
39/* depending on what's hooked up, not all SSC pins will be used */
40#define ATMEL_SSC_TK 0x01
41#define ATMEL_SSC_TF 0x02
42#define ATMEL_SSC_TD 0x04
43#define ATMEL_SSC_TX (ATMEL_SSC_TK | ATMEL_SSC_TF | ATMEL_SSC_TD)
44
45#define ATMEL_SSC_RK 0x10
46#define ATMEL_SSC_RF 0x20
47#define ATMEL_SSC_RD 0x40
48#define ATMEL_SSC_RX (ATMEL_SSC_RK | ATMEL_SSC_RF | ATMEL_SSC_RD)
49
50struct platform_device *
51at32_add_device_ssc(unsigned int id, unsigned int flags);
52
38#endif /* __ASM_ARCH_BOARD_H */ 53#endif /* __ASM_ARCH_BOARD_H */
diff --git a/include/asm-avr32/arch-at32ap/sm.h b/include/asm-avr32/arch-at32ap/sm.h
deleted file mode 100644
index 265a9ead20bf..000000000000
--- a/include/asm-avr32/arch-at32ap/sm.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * AT32 System Manager interface.
3 *
4 * Copyright (C) 2006 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 __ASM_AVR32_AT32_SM_H__
11#define __ASM_AVR32_AT32_SM_H__
12
13struct irq_chip;
14struct platform_device;
15
16struct at32_sm {
17 spinlock_t lock;
18 void __iomem *regs;
19 struct irq_chip *eim_chip;
20 unsigned int eim_first_irq;
21 struct platform_device *pdev;
22};
23
24extern struct platform_device at32_sm_device;
25extern struct at32_sm system_manager;
26
27#endif /* __ASM_AVR32_AT32_SM_H__ */
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index b9c2548a52f3..7ef3862a73d0 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -101,7 +101,7 @@ static inline int atomic_sub_unless(atomic_t *v, int a, int u)
101 " mov %1, 1\n" 101 " mov %1, 1\n"
102 "1:" 102 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
104 : "m"(v->counter), "rKs21"(a), "rKs21"(u) 104 : "m"(v->counter), "rKs21"(a), "rKs21"(u), "1"(result)
105 : "cc", "memory"); 105 : "cc", "memory");
106 106
107 return result; 107 return result;
@@ -137,7 +137,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
137 " mov %1, 1\n" 137 " mov %1, 1\n"
138 "1:" 138 "1:"
139 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 139 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
140 : "m"(v->counter), "r"(a), "ir"(u) 140 : "m"(v->counter), "r"(a), "ir"(u), "1"(result)
141 : "cc", "memory"); 141 : "cc", "memory");
142 } 142 }
143 143
diff --git a/include/asm-avr32/fb.h b/include/asm-avr32/fb.h
new file mode 100644
index 000000000000..41baf84ad402
--- /dev/null
+++ b/include/asm-avr32/fb.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
12 & ~_PAGE_CACHABLE)
13 | (_PAGE_BUFFER | _PAGE_DIRTY));
14}
15
16static inline int fb_is_primary_device(struct fb_info *info)
17{
18 return 0;
19}
20
21#endif /* _ASM_FB_H_ */
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h
index f6cc2b0f75c3..c07bdd10b891 100644
--- a/include/asm-avr32/pgtable.h
+++ b/include/asm-avr32/pgtable.h
@@ -201,18 +201,10 @@ extern struct page *empty_zero_page;
201 * The following only work if pte_present() is true. 201 * The following only work if pte_present() is true.
202 * Undefined behaviour if not.. 202 * Undefined behaviour if not..
203 */ 203 */
204static inline int pte_read(pte_t pte)
205{
206 return pte_val(pte) & _PAGE_USER;
207}
208static inline int pte_write(pte_t pte) 204static inline int pte_write(pte_t pte)
209{ 205{
210 return pte_val(pte) & _PAGE_RW; 206 return pte_val(pte) & _PAGE_RW;
211} 207}
212static inline int pte_exec(pte_t pte)
213{
214 return pte_val(pte) & _PAGE_EXECUTE;
215}
216static inline int pte_dirty(pte_t pte) 208static inline int pte_dirty(pte_t pte)
217{ 209{
218 return pte_val(pte) & _PAGE_DIRTY; 210 return pte_val(pte) & _PAGE_DIRTY;
@@ -231,21 +223,11 @@ static inline int pte_file(pte_t pte)
231} 223}
232 224
233/* Mutator functions for PTE bits */ 225/* Mutator functions for PTE bits */
234static inline pte_t pte_rdprotect(pte_t pte)
235{
236 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER));
237 return pte;
238}
239static inline pte_t pte_wrprotect(pte_t pte) 226static inline pte_t pte_wrprotect(pte_t pte)
240{ 227{
241 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); 228 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW));
242 return pte; 229 return pte;
243} 230}
244static inline pte_t pte_exprotect(pte_t pte)
245{
246 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE));
247 return pte;
248}
249static inline pte_t pte_mkclean(pte_t pte) 231static inline pte_t pte_mkclean(pte_t pte)
250{ 232{
251 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); 233 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY));
@@ -256,21 +238,11 @@ static inline pte_t pte_mkold(pte_t pte)
256 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); 238 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED));
257 return pte; 239 return pte;
258} 240}
259static inline pte_t pte_mkread(pte_t pte)
260{
261 set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER));
262 return pte;
263}
264static inline pte_t pte_mkwrite(pte_t pte) 241static inline pte_t pte_mkwrite(pte_t pte)
265{ 242{
266 set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); 243 set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW));
267 return pte; 244 return pte;
268} 245}
269static inline pte_t pte_mkexec(pte_t pte)
270{
271 set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE));
272 return pte;
273}
274static inline pte_t pte_mkdirty(pte_t pte) 246static inline pte_t pte_mkdirty(pte_t pte)
275{ 247{
276 set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); 248 set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY));
diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h
index 3042723fcbfd..36f5fd430543 100644
--- a/include/asm-avr32/unaligned.h
+++ b/include/asm-avr32/unaligned.h
@@ -7,19 +7,10 @@
7 * words, but halfwords must be halfword-aligned, and doublewords must 7 * words, but halfwords must be halfword-aligned, and doublewords must
8 * be word-aligned. 8 * be word-aligned.
9 * 9 *
10 * TODO: Make all this CPU-specific and optimize. 10 * However, swapped word loads must be word-aligned so we can't
11 * optimize word loads in general.
11 */ 12 */
12 13
13#include <linux/string.h> 14#include <asm-generic/unaligned.h>
14
15/* Use memmove here, so gcc does not insert a __builtin_memcpy. */
16
17#define get_unaligned(ptr) \
18 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
19
20#define put_unaligned(val, ptr) \
21 ({ __typeof__(*(ptr)) __tmp = (val); \
22 memmove((ptr), &__tmp, sizeof(*(ptr))); \
23 (void)0; })
24 15
25#endif /* __ASM_AVR32_UNALIGNED_H */ 16#endif /* __ASM_AVR32_UNALIGNED_H */
diff --git a/include/asm-blackfin/fb.h b/include/asm-blackfin/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-blackfin/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-cris/a.out.h b/include/asm-cris/a.out.h
index 770734ce54a6..919b34a084f8 100644
--- a/include/asm-cris/a.out.h
+++ b/include/asm-cris/a.out.h
@@ -8,6 +8,7 @@
8 8
9/* grabbed from the intel stuff */ 9/* grabbed from the intel stuff */
10#define STACK_TOP TASK_SIZE 10#define STACK_TOP TASK_SIZE
11#define STACK_TOP_MAX STACK_TOP
11 12
12 13
13struct exec 14struct exec
diff --git a/include/asm-cris/fb.h b/include/asm-cris/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-cris/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-cris/ioctls.h b/include/asm-cris/ioctls.h
index 97787c3c575f..4f4e52531fa0 100644
--- a/include/asm-cris/ioctls.h
+++ b/include/asm-cris/ioctls.h
@@ -48,6 +48,10 @@
48#define TIOCSBRK 0x5427 /* BSD compatibility */ 48#define TIOCSBRK 0x5427 /* BSD compatibility */
49#define TIOCCBRK 0x5428 /* BSD compatibility */ 49#define TIOCCBRK 0x5428 /* BSD compatibility */
50#define TIOCGSID 0x5429 /* Return the session ID of FD */ 50#define TIOCGSID 0x5429 /* Return the session ID of FD */
51#define TCGETS2 _IOR('T',0x2A, struct termios2)
52#define TCSETS2 _IOW('T',0x2B, struct termios2)
53#define TCSETSW2 _IOW('T',0x2C, struct termios2)
54#define TCSETSF2 _IOW('T',0x2D, struct termios2)
51#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 55#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
52#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 56#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
53 57
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index 9f13c32552bf..0648e3153f81 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -20,7 +20,8 @@
20#define clear_user_page(page, vaddr, pg) clear_page(page) 20#define clear_user_page(page, vaddr, pg) clear_page(page)
21#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 21#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
22 22
23#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 23#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
24 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
24#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 25#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
25 26
26/* 27/*
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
index c94a7107019c..417f71116215 100644
--- a/include/asm-cris/pgtable.h
+++ b/include/asm-cris/pgtable.h
@@ -111,9 +111,7 @@ extern unsigned long empty_zero_page;
111 * Undefined behaviour if not.. 111 * Undefined behaviour if not..
112 */ 112 */
113 113
114static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
115static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 114static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
116static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
117static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 115static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
118static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 116static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
119static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 117static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
@@ -124,18 +122,6 @@ static inline pte_t pte_wrprotect(pte_t pte)
124 return pte; 122 return pte;
125} 123}
126 124
127static inline pte_t pte_rdprotect(pte_t pte)
128{
129 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
130 return pte;
131}
132
133static inline pte_t pte_exprotect(pte_t pte)
134{
135 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
136 return pte;
137}
138
139static inline pte_t pte_mkclean(pte_t pte) 125static inline pte_t pte_mkclean(pte_t pte)
140{ 126{
141 pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); 127 pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
@@ -156,22 +142,6 @@ static inline pte_t pte_mkwrite(pte_t pte)
156 return pte; 142 return pte;
157} 143}
158 144
159static inline pte_t pte_mkread(pte_t pte)
160{
161 pte_val(pte) |= _PAGE_READ;
162 if (pte_val(pte) & _PAGE_ACCESSED)
163 pte_val(pte) |= _PAGE_SILENT_READ;
164 return pte;
165}
166
167static inline pte_t pte_mkexec(pte_t pte)
168{
169 pte_val(pte) |= _PAGE_READ;
170 if (pte_val(pte) & _PAGE_ACCESSED)
171 pte_val(pte) |= _PAGE_SILENT_READ;
172 return pte;
173}
174
175static inline pte_t pte_mkdirty(pte_t pte) 145static inline pte_t pte_mkdirty(pte_t pte)
176{ 146{
177 pte_val(pte) |= _PAGE_MODIFIED; 147 pte_val(pte) |= _PAGE_MODIFIED;
diff --git a/include/asm-cris/termbits.h b/include/asm-cris/termbits.h
index 6cc2e2736f7b..71c1b36269b8 100644
--- a/include/asm-cris/termbits.h
+++ b/include/asm-cris/termbits.h
@@ -166,6 +166,7 @@ struct ktermios {
166#define HUPCL 0002000 166#define HUPCL 0002000
167#define CLOCAL 0004000 167#define CLOCAL 0004000
168#define CBAUDEX 0010000 168#define CBAUDEX 0010000
169#define BOTHER 0010000
169#define B57600 0010001 170#define B57600 0010001
170#define B115200 0010002 171#define B115200 0010002
171#define B230400 0010003 172#define B230400 0010003
diff --git a/include/asm-cris/termios.h b/include/asm-cris/termios.h
index c9dbd4d43368..b0124e6c2e41 100644
--- a/include/asm-cris/termios.h
+++ b/include/asm-cris/termios.h
@@ -81,8 +81,10 @@ struct termio {
81 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 81 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
82}) 82})
83 83
84#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 84#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
85#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 85#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
86#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
87#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
86 88
87#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
88 90
diff --git a/include/asm-frv/fb.h b/include/asm-frv/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-frv/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h
index a025dd4514e7..aaf2a773d9d3 100644
--- a/include/asm-frv/mem-layout.h
+++ b/include/asm-frv/mem-layout.h
@@ -60,6 +60,7 @@
60 */ 60 */
61#define BRK_BASE __UL(2 * 1024 * 1024 + PAGE_SIZE) 61#define BRK_BASE __UL(2 * 1024 * 1024 + PAGE_SIZE)
62#define STACK_TOP __UL(2 * 1024 * 1024) 62#define STACK_TOP __UL(2 * 1024 * 1024)
63#define STACK_TOP_MAX STACK_TOP
63 64
64/* userspace process size */ 65/* userspace process size */
65#ifdef CONFIG_MMU 66#ifdef CONFIG_MMU
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 114aefae2701..147e995bec24 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -377,30 +377,17 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address)
377 * The following only work if pte_present() is true. 377 * The following only work if pte_present() is true.
378 * Undefined behaviour if not.. 378 * Undefined behaviour if not..
379 */ 379 */
380static inline int pte_read(pte_t pte) { return !((pte).pte & _PAGE_SUPER); }
381static inline int pte_exec(pte_t pte) { return !((pte).pte & _PAGE_SUPER); }
382static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; } 380static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; }
383static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; } 381static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; }
384static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); } 382static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); }
385 383
386static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte |= _PAGE_SUPER; return pte; }
387static inline pte_t pte_exprotect(pte_t pte) { (pte).pte |= _PAGE_SUPER; return pte; }
388static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; } 384static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; }
389static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; } 385static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; }
390static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; } 386static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; }
391static inline pte_t pte_mkread(pte_t pte) { (pte).pte &= ~_PAGE_SUPER; return pte; }
392static inline pte_t pte_mkexec(pte_t pte) { (pte).pte &= ~_PAGE_SUPER; return pte; }
393static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; } 387static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; }
394static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; } 388static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; }
395static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; } 389static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; }
396 390
397static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
398{
399 int i = test_and_clear_bit(_PAGE_BIT_DIRTY, ptep);
400 asm volatile("dcf %M0" :: "U"(*ptep));
401 return i;
402}
403
404static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 391static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
405{ 392{
406 int i = test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); 393 int i = test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
@@ -510,7 +497,6 @@ static inline int pte_file(pte_t pte)
510 remap_pfn_range(vma, vaddr, pfn, size, prot) 497 remap_pfn_range(vma, vaddr, pfn, size, prot)
511 498
512#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 499#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
513#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
514#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 500#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
515#define __HAVE_ARCH_PTEP_SET_WRPROTECT 501#define __HAVE_ARCH_PTEP_SET_WRPROTECT
516#define __HAVE_ARCH_PTE_SAME 502#define __HAVE_ARCH_PTE_SAME
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index d0ea6789b31e..7306c71a8926 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -326,10 +326,14 @@
326#define __NR_move_pages 317 326#define __NR_move_pages 317
327#define __NR_getcpu 318 327#define __NR_getcpu 318
328#define __NR_epoll_pwait 319 328#define __NR_epoll_pwait 319
329#define __NR_utimensat 320
330#define __NR_signalfd 321
331#define __NR_timerfd 322
332#define __NR_eventfd 323
329 333
330#ifdef __KERNEL__ 334#ifdef __KERNEL__
331 335
332#define NR_syscalls 320 336#define NR_syscalls 324
333 337
334#define __ARCH_WANT_IPC_PARSE_VERSION 338#define __ARCH_WANT_IPC_PARSE_VERSION
335/* #define __ARCH_WANT_OLD_READDIR */ 339/* #define __ARCH_WANT_OLD_READDIR */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 7f30cce52857..344e3091af24 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -28,7 +28,7 @@ struct bug_entry {
28#endif 28#endif
29 29
30#ifndef HAVE_ARCH_BUG_ON 30#ifndef HAVE_ARCH_BUG_ON
31#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) 31#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
32#endif 32#endif
33 33
34#ifndef HAVE_ARCH_WARN_ON 34#ifndef HAVE_ARCH_WARN_ON
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index 29413d3d4605..e2468f894d2a 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -1,24 +1,82 @@
1#ifndef _ASM_GENERIC_DMA_MAPPING_H 1#ifndef _ASM_GENERIC_DMA_MAPPING_H
2#define _ASM_GENERIC_DMA_MAPPING_H 2#define _ASM_GENERIC_DMA_MAPPING_H
3 3
4/* This is used for archs that do not support DMA */ 4/* define the dma api to allow compilation but not linking of
5 * dma dependent code. Code that depends on the dma-mapping
6 * API needs to set 'depends on HAS_DMA' in its Kconfig
7 */
5 8
6static inline void * 9struct scatterlist;
10
11extern void *
7dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 12dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
8 gfp_t flag) 13 gfp_t flag);
9{
10 BUG();
11 return NULL;
12}
13 14
14static inline void 15extern void
15dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 16dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
16 dma_addr_t dma_handle) 17 dma_addr_t dma_handle);
17{
18 BUG();
19}
20 18
21#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 19#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
22#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 20#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
23 21
22extern dma_addr_t
23dma_map_single(struct device *dev, void *ptr, size_t size,
24 enum dma_data_direction direction);
25
26extern void
27dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
28 enum dma_data_direction direction);
29
30extern int
31dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
32 enum dma_data_direction direction);
33
34extern void
35dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
36 enum dma_data_direction direction);
37
38extern dma_addr_t
39dma_map_page(struct device *dev, struct page *page, unsigned long offset,
40 size_t size, enum dma_data_direction direction);
41
42extern void
43dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
44 enum dma_data_direction direction);
45
46extern void
47dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
48 enum dma_data_direction direction);
49
50extern void
51dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
52 unsigned long offset, size_t size,
53 enum dma_data_direction direction);
54
55extern void
56dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
57 enum dma_data_direction direction);
58
59#define dma_sync_single_for_device dma_sync_single_for_cpu
60#define dma_sync_single_range_for_device dma_sync_single_range_for_cpu
61#define dma_sync_sg_for_device dma_sync_sg_for_cpu
62
63extern int
64dma_mapping_error(dma_addr_t dma_addr);
65
66extern int
67dma_supported(struct device *dev, u64 mask);
68
69extern int
70dma_set_mask(struct device *dev, u64 mask);
71
72extern int
73dma_get_cache_alignment(void);
74
75extern int
76dma_is_consistent(struct device *dev, dma_addr_t dma_handle);
77
78extern void
79dma_cache_sync(struct device *dev, void *vaddr, size_t size,
80 enum dma_data_direction direction);
81
24#endif /* _ASM_GENERIC_DMA_MAPPING_H */ 82#endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index c154b9d6e7e5..b8477414c5c8 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -48,6 +48,9 @@
48#ifndef O_NOATIME 48#ifndef O_NOATIME
49#define O_NOATIME 01000000 49#define O_NOATIME 01000000
50#endif 50#endif
51#ifndef O_CLOEXEC
52#define O_CLOEXEC 02000000 /* set close_on_exec */
53#endif
51#ifndef O_NDELAY 54#ifndef O_NDELAY
52#define O_NDELAY O_NONBLOCK 55#define O_NDELAY O_NONBLOCK
53#endif 56#endif
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index d984a9041436..d85172e9ed45 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -14,6 +14,11 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
14#define DEFINE_PER_CPU(type, name) \ 14#define DEFINE_PER_CPU(type, name) \
15 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 15 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
16 16
17#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
18 __attribute__((__section__(".data.percpu.shared_aligned"))) \
19 __typeof__(type) per_cpu__##name \
20 ____cacheline_aligned_in_smp
21
17/* var is in discarded region: offset to particular copy we want */ 22/* var is in discarded region: offset to particular copy we want */
18#define per_cpu(var, cpu) (*({ \ 23#define per_cpu(var, cpu) (*({ \
19 extern int simple_identifier_##var(void); \ 24 extern int simple_identifier_##var(void); \
@@ -34,6 +39,9 @@ do { \
34#define DEFINE_PER_CPU(type, name) \ 39#define DEFINE_PER_CPU(type, name) \
35 __typeof__(type) per_cpu__##name 40 __typeof__(type) per_cpu__##name
36 41
42#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
43 DEFINE_PER_CPU(type, name)
44
37#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 45#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
38#define __get_cpu_var(var) per_cpu__##var 46#define __get_cpu_var(var) per_cpu__##var
39#define __raw_get_cpu_var(var) per_cpu__##var 47#define __raw_get_cpu_var(var) per_cpu__##var
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 7d7bcf990e99..f605e8d0eed3 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -3,25 +3,6 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#ifndef __HAVE_ARCH_PTEP_ESTABLISH
7/*
8 * Establish a new mapping:
9 * - flush the old one
10 * - update the page tables
11 * - inform the TLB about the new one
12 *
13 * We hold the mm semaphore for reading, and the pte lock.
14 *
15 * Note: the old pte is known to not be writable, so we don't need to
16 * worry about dirty bits etc getting lost.
17 */
18#define ptep_establish(__vma, __address, __ptep, __entry) \
19do { \
20 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
21 flush_tlb_page(__vma, __address); \
22} while (0)
23#endif
24
25#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 6#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
26/* 7/*
27 * Largely same as above, but only sets the access flags (dirty, 8 * Largely same as above, but only sets the access flags (dirty,
@@ -68,31 +49,6 @@ do { \
68}) 49})
69#endif 50#endif
70 51
71#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
72#define ptep_test_and_clear_dirty(__vma, __address, __ptep) \
73({ \
74 pte_t __pte = *__ptep; \
75 int r = 1; \
76 if (!pte_dirty(__pte)) \
77 r = 0; \
78 else \
79 set_pte_at((__vma)->vm_mm, (__address), (__ptep), \
80 pte_mkclean(__pte)); \
81 r; \
82})
83#endif
84
85#ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
86#define ptep_clear_flush_dirty(__vma, __address, __ptep) \
87({ \
88 int __dirty; \
89 __dirty = ptep_test_and_clear_dirty(__vma, __address, __ptep); \
90 if (__dirty) \
91 flush_tlb_page(__vma, __address); \
92 __dirty; \
93})
94#endif
95
96#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR 52#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
97#define ptep_get_and_clear(__mm, __address, __ptep) \ 53#define ptep_get_and_clear(__mm, __address, __ptep) \
98({ \ 54({ \
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 09ec447fe2af..16a466e50681 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -18,7 +18,8 @@
18#define get_unaligned(ptr) \ 18#define get_unaligned(ptr) \
19 __get_unaligned((ptr), sizeof(*(ptr))) 19 __get_unaligned((ptr), sizeof(*(ptr)))
20#define put_unaligned(x,ptr) \ 20#define put_unaligned(x,ptr) \
21 __put_unaligned((__u64)(x), (ptr), sizeof(*(ptr))) 21 ((void)sizeof(*(ptr)=(x)),\
22 __put_unaligned((__force __u64)(x), (ptr), sizeof(*(ptr))))
22 23
23/* 24/*
24 * This function doesn't actually exist. The idea is that when 25 * This function doesn't actually exist. The idea is that when
@@ -95,21 +96,21 @@ static inline void __ustw(__u16 val, __u16 *addr)
95 default: \ 96 default: \
96 bad_unaligned_access_length(); \ 97 bad_unaligned_access_length(); \
97 }; \ 98 }; \
98 (__typeof__(*(ptr)))val; \ 99 (__force __typeof__(*(ptr)))val; \
99}) 100})
100 101
101#define __put_unaligned(val, ptr, size) \ 102#define __put_unaligned(val, ptr, size) \
102do { \ 103({ \
103 void *__gu_p = ptr; \ 104 void *__gu_p = ptr; \
104 switch (size) { \ 105 switch (size) { \
105 case 1: \ 106 case 1: \
106 *(__u8 *)__gu_p = val; \ 107 *(__u8 *)__gu_p = (__force __u8)val; \
107 break; \ 108 break; \
108 case 2: \ 109 case 2: \
109 __ustw(val, __gu_p); \ 110 __ustw((__force __u16)val, __gu_p); \
110 break; \ 111 break; \
111 case 4: \ 112 case 4: \
112 __ustl(val, __gu_p); \ 113 __ustl((__force __u32)val, __gu_p); \
113 break; \ 114 break; \
114 case 8: \ 115 case 8: \
115 __ustq(val, __gu_p); \ 116 __ustq(val, __gu_p); \
@@ -117,6 +118,7 @@ do { \
117 default: \ 118 default: \
118 bad_unaligned_access_length(); \ 119 bad_unaligned_access_length(); \
119 }; \ 120 }; \
120} while(0) 121 (void)0; \
122})
121 123
122#endif /* _ASM_GENERIC_UNALIGNED_H */ 124#endif /* _ASM_GENERIC_UNALIGNED_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 84155eb67f1d..0240e0506a07 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -224,7 +224,11 @@
224 } 224 }
225 225
226#define NOTES \ 226#define NOTES \
227 .notes : { *(.note.*) } :note 227 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
228 VMLINUX_SYMBOL(__start_notes) = .; \
229 *(.note.*) \
230 VMLINUX_SYMBOL(__stop_notes) = .; \
231 }
228 232
229#define INITCALLS \ 233#define INITCALLS \
230 *(.initcall0.init) \ 234 *(.initcall0.init) \
@@ -245,3 +249,11 @@
245 *(.initcall7.init) \ 249 *(.initcall7.init) \
246 *(.initcall7s.init) 250 *(.initcall7s.init)
247 251
252#define PERCPU(align) \
253 . = ALIGN(align); \
254 __per_cpu_start = .; \
255 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
256 *(.data.percpu) \
257 *(.data.percpu.shared_aligned) \
258 } \
259 __per_cpu_end = .;
diff --git a/include/asm-h8300/a.out.h b/include/asm-h8300/a.out.h
index 3c70939f9f00..aa5d22778235 100644
--- a/include/asm-h8300/a.out.h
+++ b/include/asm-h8300/a.out.h
@@ -20,6 +20,7 @@ struct exec
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#define STACK_TOP TASK_SIZE 22#define STACK_TOP TASK_SIZE
23#define STACK_TOP_MAX STACK_TOP
23 24
24#endif 25#endif
25 26
diff --git a/include/asm-h8300/dma-mapping.h b/include/asm-h8300/dma-mapping.h
deleted file mode 100644
index d00e40099165..000000000000
--- a/include/asm-h8300/dma-mapping.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/dma-mapping-broken.h>
diff --git a/include/asm-h8300/fb.h b/include/asm-h8300/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-h8300/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-h8300/ioctls.h b/include/asm-h8300/ioctls.h
index ac20457e5978..98a53d067269 100644
--- a/include/asm-h8300/ioctls.h
+++ b/include/asm-h8300/ioctls.h
@@ -47,6 +47,10 @@
47#define TIOCSBRK 0x5427 /* BSD compatibility */ 47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */ 48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */ 49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52 56
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index 3b4f2903f91d..c8cc81a3aca5 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -22,7 +22,8 @@
22#define clear_user_page(page, vaddr, pg) clear_page(page) 22#define clear_user_page(page, vaddr, pg) clear_page(page)
23#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 23#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
24 24
25#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 25#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
26 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
26#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 27#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
27 28
28/* 29/*
diff --git a/include/asm-h8300/termbits.h b/include/asm-h8300/termbits.h
index e877b40ac5ba..31eca81db3f7 100644
--- a/include/asm-h8300/termbits.h
+++ b/include/asm-h8300/termbits.h
@@ -141,6 +141,7 @@ struct ktermios {
141#define HUPCL 0002000 141#define HUPCL 0002000
142#define CLOCAL 0004000 142#define CLOCAL 0004000
143#define CBAUDEX 0010000 143#define CBAUDEX 0010000
144#define BOTHER 0010000
144#define B57600 0010001 145#define B57600 0010001
145#define B115200 0010002 146#define B115200 0010002
146#define B230400 0010003 147#define B230400 0010003
@@ -156,10 +157,12 @@ struct ktermios {
156#define B3000000 0010015 157#define B3000000 0010015
157#define B3500000 0010016 158#define B3500000 0010016
158#define B4000000 0010017 159#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate (not used) */ 160#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */ 161#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */ 162#define CRTSCTS 020000000000 /* flow control */
162 163
164#define IBSHIFT 16 /* shift from CBAUD to CIBAUD */
165
163/* c_lflag bits */ 166/* c_lflag bits */
164#define ISIG 0000001 167#define ISIG 0000001
165#define ICANON 0000002 168#define ICANON 0000002
diff --git a/include/asm-h8300/termios.h b/include/asm-h8300/termios.h
index fb2925d08c49..70eea64b4213 100644
--- a/include/asm-h8300/termios.h
+++ b/include/asm-h8300/termios.h
@@ -82,8 +82,10 @@ struct termio {
82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
83}) 83})
84 84
85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
88#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
87 89
88#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
89 91
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h
index 45f09dc9caff..aee4009a498e 100644
--- a/include/asm-h8300/thread_info.h
+++ b/include/asm-h8300/thread_info.h
@@ -92,6 +92,7 @@ static inline struct thread_info *current_thread_info(void)
92#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling 92#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
93 TIF_NEED_RESCHED */ 93 TIF_NEED_RESCHED */
94#define TIF_MEMDIE 5 94#define TIF_MEMDIE 5
95#define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
95 96
96/* as above, but as bit values */ 97/* as above, but as bit values */
97#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 98#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -99,6 +100,7 @@ static inline struct thread_info *current_thread_info(void)
99#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 100#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
100#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 101#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
101#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 102#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
103#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
102 104
103#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 105#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
104 106
diff --git a/include/asm-i386/a.out.h b/include/asm-i386/a.out.h
index ab17bb8e5465..851a60f8258c 100644
--- a/include/asm-i386/a.out.h
+++ b/include/asm-i386/a.out.h
@@ -20,6 +20,7 @@ struct exec
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#define STACK_TOP TASK_SIZE 22#define STACK_TOP TASK_SIZE
23#define STACK_TOP_MAX STACK_TOP
23 24
24#endif 25#endif
25 26
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index eb7da5402bfa..bda6c810c0f4 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -149,4 +149,6 @@ apply_paravirt(struct paravirt_patch_site *start,
149#define __parainstructions_end NULL 149#define __parainstructions_end NULL
150#endif 150#endif
151 151
152extern void text_poke(void *addr, unsigned char *opcode, int len);
153
152#endif /* _I386_ALTERNATIVE_H */ 154#endif /* _I386_ALTERNATIVE_H */
diff --git a/include/asm-i386/cmpxchg.h b/include/asm-i386/cmpxchg.h
index 7adcef0cd53b..f86ede28f6dc 100644
--- a/include/asm-i386/cmpxchg.h
+++ b/include/asm-i386/cmpxchg.h
@@ -3,14 +3,16 @@
3 3
4#include <linux/bitops.h> /* for LOCK_PREFIX */ 4#include <linux/bitops.h> /* for LOCK_PREFIX */
5 5
6/*
7 * Note: if you use set64_bit(), __cmpxchg64(), or their variants, you
8 * you need to test for the feature in boot_cpu_data.
9 */
10
6#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) 11#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
7 12
8struct __xchg_dummy { unsigned long a[100]; }; 13struct __xchg_dummy { unsigned long a[100]; };
9#define __xg(x) ((struct __xchg_dummy *)(x)) 14#define __xg(x) ((struct __xchg_dummy *)(x))
10 15
11
12#ifdef CONFIG_X86_CMPXCHG64
13
14/* 16/*
15 * The semantics of XCHGCMP8B are a bit strange, this is why 17 * The semantics of XCHGCMP8B are a bit strange, this is why
16 * there is a loop and the loading of %%eax and %%edx has to 18 * there is a loop and the loading of %%eax and %%edx has to
@@ -32,7 +34,7 @@ static inline void __set_64bit (unsigned long long * ptr,
32 "\n1:\t" 34 "\n1:\t"
33 "movl (%0), %%eax\n\t" 35 "movl (%0), %%eax\n\t"
34 "movl 4(%0), %%edx\n\t" 36 "movl 4(%0), %%edx\n\t"
35 "lock cmpxchg8b (%0)\n\t" 37 LOCK_PREFIX "cmpxchg8b (%0)\n\t"
36 "jnz 1b" 38 "jnz 1b"
37 : /* no outputs */ 39 : /* no outputs */
38 : "D"(ptr), 40 : "D"(ptr),
@@ -65,8 +67,6 @@ static inline void __set_64bit_var (unsigned long long *ptr,
65 __set_64bit(ptr, (unsigned int)(value), (unsigned int)((value)>>32ULL) ) : \ 67 __set_64bit(ptr, (unsigned int)(value), (unsigned int)((value)>>32ULL) ) : \
66 __set_64bit(ptr, ll_low(value), ll_high(value)) ) 68 __set_64bit(ptr, ll_low(value), ll_high(value)) )
67 69
68#endif
69
70/* 70/*
71 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway 71 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway
72 * Note 2: xchg has side effect, so that attribute volatile is necessary, 72 * Note 2: xchg has side effect, so that attribute volatile is necessary,
@@ -252,8 +252,6 @@ static inline unsigned long cmpxchg_386(volatile void *ptr, unsigned long old,
252}) 252})
253#endif 253#endif
254 254
255#ifdef CONFIG_X86_CMPXCHG64
256
257static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long long old, 255static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long long old,
258 unsigned long long new) 256 unsigned long long new)
259{ 257{
@@ -289,5 +287,3 @@ static inline unsigned long long __cmpxchg64_local(volatile void *ptr,
289 ((__typeof__(*(ptr)))__cmpxchg64_local((ptr),(unsigned long long)(o),\ 287 ((__typeof__(*(ptr)))__cmpxchg64_local((ptr),(unsigned long long)(o),\
290 (unsigned long long)(n))) 288 (unsigned long long)(n)))
291#endif 289#endif
292
293#endif
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index c03290ccecb2..43114c824608 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -47,6 +47,14 @@ extern void e820_register_memory(void);
47extern void limit_regions(unsigned long long size); 47extern void limit_regions(unsigned long long size);
48extern void print_memory_map(char *who); 48extern void print_memory_map(char *who);
49 49
50#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
51extern void e820_mark_nosave_regions(void);
52#else
53static inline void e820_mark_nosave_regions(void)
54{
55}
56#endif
57
50#endif/*!__ASSEMBLY__*/ 58#endif/*!__ASSEMBLY__*/
51 59
52#endif/*__E820_HEADER*/ 60#endif/*__E820_HEADER*/
diff --git a/include/asm-i386/fb.h b/include/asm-i386/fb.h
new file mode 100644
index 000000000000..d1c6297d4a61
--- /dev/null
+++ b/include/asm-i386/fb.h
@@ -0,0 +1,17 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8extern int fb_is_primary_device(struct fb_info *info);
9
10static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
11 unsigned long off)
12{
13 if (boot_cpu_data.x86 > 3)
14 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
15}
16
17#endif /* _ASM_FB_H_ */
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index 80ea052ee3a4..249e753ac805 100644
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -54,6 +54,8 @@ extern unsigned long __FIXADDR_TOP;
54enum fixed_addresses { 54enum fixed_addresses {
55 FIX_HOLE, 55 FIX_HOLE,
56 FIX_VDSO, 56 FIX_VDSO,
57 FIX_DBGP_BASE,
58 FIX_EARLYCON_MEM_BASE,
57#ifdef CONFIG_X86_LOCAL_APIC 59#ifdef CONFIG_X86_LOCAL_APIC
58 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ 60 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
59#endif 61#endif
diff --git a/include/asm-i386/geode.h b/include/asm-i386/geode.h
new file mode 100644
index 000000000000..6da4bbbea3dc
--- /dev/null
+++ b/include/asm-i386/geode.h
@@ -0,0 +1,159 @@
1/*
2 * AMD Geode definitions
3 * Copyright (C) 2006, Advanced Micro Devices, Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
8 */
9
10#ifndef _ASM_GEODE_H_
11#define _ASM_GEODE_H_
12
13#include <asm/processor.h>
14#include <linux/io.h>
15
16/* Generic southbridge functions */
17
18#define GEODE_DEV_PMS 0
19#define GEODE_DEV_ACPI 1
20#define GEODE_DEV_GPIO 2
21#define GEODE_DEV_MFGPT 3
22
23extern int geode_get_dev_base(unsigned int dev);
24
25/* Useful macros */
26#define geode_pms_base() geode_get_dev_base(GEODE_DEV_PMS)
27#define geode_acpi_base() geode_get_dev_base(GEODE_DEV_ACPI)
28#define geode_gpio_base() geode_get_dev_base(GEODE_DEV_GPIO)
29#define geode_mfgpt_base() geode_get_dev_base(GEODE_DEV_MFGPT)
30
31/* MSRS */
32
33#define GX_GLCP_SYS_RSTPLL 0x4C000014
34
35#define MSR_LBAR_SMB 0x5140000B
36#define MSR_LBAR_GPIO 0x5140000C
37#define MSR_LBAR_MFGPT 0x5140000D
38#define MSR_LBAR_ACPI 0x5140000E
39#define MSR_LBAR_PMS 0x5140000F
40
41#define MSR_PIC_YSEL_LOW 0x51400020
42#define MSR_PIC_YSEL_HIGH 0x51400021
43#define MSR_PIC_ZSEL_LOW 0x51400022
44#define MSR_PIC_ZSEL_HIGH 0x51400023
45
46#define MFGPT_IRQ_MSR 0x51400028
47#define MFGPT_NR_MSR 0x51400029
48
49/* Resource Sizes */
50
51#define LBAR_GPIO_SIZE 0xFF
52#define LBAR_MFGPT_SIZE 0x40
53#define LBAR_ACPI_SIZE 0x40
54#define LBAR_PMS_SIZE 0x80
55
56/* ACPI registers (PMS block) */
57
58/*
59 * PM1_EN is only valid when VSA is enabled for 16 bit reads.
60 * When VSA is not enabled, *always* read both PM1_STS and PM1_EN
61 * with a 32 bit read at offset 0x0
62 */
63
64#define PM1_STS 0x00
65#define PM1_EN 0x02
66#define PM1_CNT 0x08
67#define PM2_CNT 0x0C
68#define PM_TMR 0x10
69#define PM_GPE0_STS 0x18
70#define PM_GPE0_EN 0x1C
71
72/* PMC registers (PMS block) */
73
74#define PM_SSD 0x00
75#define PM_SCXA 0x04
76#define PM_SCYA 0x08
77#define PM_OUT_SLPCTL 0x0C
78#define PM_SCLK 0x10
79#define PM_SED 0x1
80#define PM_SCXD 0x18
81#define PM_SCYD 0x1C
82#define PM_IN_SLPCTL 0x20
83#define PM_WKD 0x30
84#define PM_WKXD 0x34
85#define PM_RD 0x38
86#define PM_WKXA 0x3C
87#define PM_FSD 0x40
88#define PM_TSD 0x44
89#define PM_PSD 0x48
90#define PM_NWKD 0x4C
91#define PM_AWKD 0x50
92#define PM_SSC 0x54
93
94/* GPIO */
95
96#define GPIO_OUTPUT_VAL 0x00
97#define GPIO_OUTPUT_ENABLE 0x04
98#define GPIO_OUTPUT_OPEN_DRAIN 0x08
99#define GPIO_OUTPUT_INVERT 0x0C
100#define GPIO_OUTPUT_AUX1 0x10
101#define GPIO_OUTPUT_AUX2 0x14
102#define GPIO_PULL_UP 0x18
103#define GPIO_PULL_DOWN 0x1C
104#define GPIO_INPUT_ENABLE 0x20
105#define GPIO_INPUT_INVERT 0x24
106#define GPIO_INPUT_FILTER 0x28
107#define GPIO_INPUT_EVENT_COUNT 0x2C
108#define GPIO_READ_BACK 0x30
109#define GPIO_INPUT_AUX1 0x34
110#define GPIO_EVENTS_ENABLE 0x38
111#define GPIO_LOCK_ENABLE 0x3C
112#define GPIO_POSITIVE_EDGE_EN 0x40
113#define GPIO_NEGATIVE_EDGE_EN 0x44
114#define GPIO_POSITIVE_EDGE_STS 0x48
115#define GPIO_NEGATIVE_EDGE_STS 0x4C
116
117#define GPIO_MAP_X 0xE0
118#define GPIO_MAP_Y 0xE4
119#define GPIO_MAP_Z 0xE8
120#define GPIO_MAP_W 0xEC
121
122extern void geode_gpio_set(unsigned int, unsigned int);
123extern void geode_gpio_clear(unsigned int, unsigned int);
124extern int geode_gpio_isset(unsigned int, unsigned int);
125extern void geode_gpio_setup_event(unsigned int, int, int);
126extern void geode_gpio_set_irq(unsigned int, unsigned int);
127
128static inline void geode_gpio_event_irq(unsigned int gpio, int pair)
129{
130 geode_gpio_setup_event(gpio, pair, 0);
131}
132
133static inline void geode_gpio_event_pme(unsigned int gpio, int pair)
134{
135 geode_gpio_setup_event(gpio, pair, 1);
136}
137
138/* Specific geode tests */
139
140static inline int is_geode_gx(void)
141{
142 return ((boot_cpu_data.x86_vendor == X86_VENDOR_NSC) &&
143 (boot_cpu_data.x86 == 5) &&
144 (boot_cpu_data.x86_model == 5));
145}
146
147static inline int is_geode_lx(void)
148{
149 return ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
150 (boot_cpu_data.x86 == 5) &&
151 (boot_cpu_data.x86_model == 10));
152}
153
154static inline int is_geode(void)
155{
156 return (is_geode_gx() || is_geode_lx());
157}
158
159#endif
diff --git a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
index dddeedf504b7..c82dc7ed96b3 100644
--- a/include/asm-i386/hpet.h
+++ b/include/asm-i386/hpet.h
@@ -4,112 +4,82 @@
4 4
5#ifdef CONFIG_HPET_TIMER 5#ifdef CONFIG_HPET_TIMER
6 6
7#include <linux/errno.h>
8#include <linux/module.h>
9#include <linux/sched.h>
10#include <linux/kernel.h>
11#include <linux/param.h>
12#include <linux/string.h>
13#include <linux/mm.h>
14#include <linux/interrupt.h>
15#include <linux/time.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19
20#include <asm/io.h>
21#include <asm/smp.h>
22#include <asm/irq.h>
23#include <asm/msr.h>
24#include <asm/delay.h>
25#include <asm/mpspec.h>
26#include <asm/uaccess.h>
27#include <asm/processor.h>
28
29#include <linux/timex.h>
30
31/* 7/*
32 * Documentation on HPET can be found at: 8 * Documentation on HPET can be found at:
33 * http://www.intel.com/ial/home/sp/pcmmspec.htm 9 * http://www.intel.com/ial/home/sp/pcmmspec.htm
34 * ftp://download.intel.com/ial/home/sp/mmts098.pdf 10 * ftp://download.intel.com/ial/home/sp/mmts098.pdf
35 */ 11 */
36 12
37#define HPET_MMAP_SIZE 1024 13#define HPET_MMAP_SIZE 1024
38 14
39#define HPET_ID 0x000 15#define HPET_ID 0x000
40#define HPET_PERIOD 0x004 16#define HPET_PERIOD 0x004
41#define HPET_CFG 0x010 17#define HPET_CFG 0x010
42#define HPET_STATUS 0x020 18#define HPET_STATUS 0x020
43#define HPET_COUNTER 0x0f0 19#define HPET_COUNTER 0x0f0
44#define HPET_T0_CFG 0x100 20#define HPET_T0_CFG 0x100
45#define HPET_T0_CMP 0x108 21#define HPET_T0_CMP 0x108
46#define HPET_T0_ROUTE 0x110 22#define HPET_T0_ROUTE 0x110
47#define HPET_T1_CFG 0x120 23#define HPET_T1_CFG 0x120
48#define HPET_T1_CMP 0x128 24#define HPET_T1_CMP 0x128
49#define HPET_T1_ROUTE 0x130 25#define HPET_T1_ROUTE 0x130
50#define HPET_T2_CFG 0x140 26#define HPET_T2_CFG 0x140
51#define HPET_T2_CMP 0x148 27#define HPET_T2_CMP 0x148
52#define HPET_T2_ROUTE 0x150 28#define HPET_T2_ROUTE 0x150
53 29
54#define HPET_ID_LEGSUP 0x00008000 30#define HPET_ID_REV 0x000000ff
55#define HPET_ID_NUMBER 0x00001f00 31#define HPET_ID_NUMBER 0x00001f00
56#define HPET_ID_REV 0x000000ff 32#define HPET_ID_64BIT 0x00002000
33#define HPET_ID_LEGSUP 0x00008000
34#define HPET_ID_VENDOR 0xffff0000
57#define HPET_ID_NUMBER_SHIFT 8 35#define HPET_ID_NUMBER_SHIFT 8
36#define HPET_ID_VENDOR_SHIFT 16
58 37
59#define HPET_CFG_ENABLE 0x001 38#define HPET_ID_VENDOR_8086 0x8086
60#define HPET_CFG_LEGACY 0x002 39
40#define HPET_CFG_ENABLE 0x001
41#define HPET_CFG_LEGACY 0x002
61#define HPET_LEGACY_8254 2 42#define HPET_LEGACY_8254 2
62#define HPET_LEGACY_RTC 8 43#define HPET_LEGACY_RTC 8
63 44
64#define HPET_TN_ENABLE 0x004 45#define HPET_TN_LEVEL 0x0002
65#define HPET_TN_PERIODIC 0x008 46#define HPET_TN_ENABLE 0x0004
66#define HPET_TN_PERIODIC_CAP 0x010 47#define HPET_TN_PERIODIC 0x0008
67#define HPET_TN_SETVAL 0x040 48#define HPET_TN_PERIODIC_CAP 0x0010
68#define HPET_TN_32BIT 0x100 49#define HPET_TN_64BIT_CAP 0x0020
69 50#define HPET_TN_SETVAL 0x0040
70/* Use our own asm for 64 bit multiply/divide */ 51#define HPET_TN_32BIT 0x0100
71#define ASM_MUL64_REG(eax_out,edx_out,reg_in,eax_in) \ 52#define HPET_TN_ROUTE 0x3e00
72 __asm__ __volatile__("mull %2" \ 53#define HPET_TN_FSB 0x4000
73 :"=a" (eax_out), "=d" (edx_out) \ 54#define HPET_TN_FSB_CAP 0x8000
74 :"r" (reg_in), "0" (eax_in)) 55#define HPET_TN_ROUTE_SHIFT 9
75 56
76#define ASM_DIV64_REG(eax_out,edx_out,reg_in,eax_in,edx_in) \
77 __asm__ __volatile__("divl %2" \
78 :"=a" (eax_out), "=d" (edx_out) \
79 :"r" (reg_in), "0" (eax_in), "1" (edx_in))
80
81#define KERNEL_TICK_USEC (1000000UL/HZ) /* tick value in microsec */
82/* Max HPET Period is 10^8 femto sec as in HPET spec */ 57/* Max HPET Period is 10^8 femto sec as in HPET spec */
83#define HPET_MAX_PERIOD (100000000UL) 58#define HPET_MAX_PERIOD 100000000UL
84/* 59/*
85 * Min HPET period is 10^5 femto sec just for safety. If it is less than this, 60 * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
86 * then 32 bit HPET counter wrapsaround in less than 0.5 sec. 61 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
87 */ 62 */
88#define HPET_MIN_PERIOD (100000UL) 63#define HPET_MIN_PERIOD 100000UL
89#define HPET_TICK_RATE (HZ * 100000UL)
90 64
91extern unsigned long hpet_address; /* hpet memory map physical address */ 65/* hpet memory map physical address */
66extern unsigned long hpet_address;
92extern int is_hpet_enabled(void); 67extern int is_hpet_enabled(void);
93
94#ifdef CONFIG_X86_64
95extern unsigned long hpet_tick; /* hpet clks count per tick */
96extern int hpet_use_timer;
97extern int hpet_rtc_timer_init(void);
98extern int hpet_enable(void); 68extern int hpet_enable(void);
99extern int is_hpet_capable(void);
100extern int hpet_readl(unsigned long a);
101#else
102extern int hpet_enable(void);
103#endif
104 69
105#ifdef CONFIG_HPET_EMULATE_RTC 70#ifdef CONFIG_HPET_EMULATE_RTC
71
72#include <linux/interrupt.h>
73
106extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); 74extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
107extern int hpet_set_rtc_irq_bit(unsigned long bit_mask); 75extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
108extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec); 76extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min,
77 unsigned char sec);
109extern int hpet_set_periodic_freq(unsigned long freq); 78extern int hpet_set_periodic_freq(unsigned long freq);
110extern int hpet_rtc_dropped_irq(void); 79extern int hpet_rtc_dropped_irq(void);
111extern int hpet_rtc_timer_init(void); 80extern int hpet_rtc_timer_init(void);
112extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); 81extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
82
113#endif /* CONFIG_HPET_EMULATE_RTC */ 83#endif /* CONFIG_HPET_EMULATE_RTC */
114 84
115#else 85#else
diff --git a/include/asm-i386/i8253.h b/include/asm-i386/i8253.h
index 6cb0dd4dcdde..7577d058d86e 100644
--- a/include/asm-i386/i8253.h
+++ b/include/asm-i386/i8253.h
@@ -3,19 +3,15 @@
3 3
4#include <linux/clockchips.h> 4#include <linux/clockchips.h>
5 5
6/* i8253A PIT registers */
7#define PIT_MODE 0x43
8#define PIT_CH0 0x40
9#define PIT_CH2 0x42
10
6extern spinlock_t i8253_lock; 11extern spinlock_t i8253_lock;
7 12
8extern struct clock_event_device *global_clock_event; 13extern struct clock_event_device *global_clock_event;
9 14
10/** 15extern void setup_pit_timer(void);
11 * pit_interrupt_hook - hook into timer tick
12 * @regs: standard registers from interrupt
13 *
14 * Call the global clock event handler.
15 **/
16static inline void pit_interrupt_hook(void)
17{
18 global_clock_event->event_handler(global_clock_event);
19}
20 16
21#endif /* __ASM_I8253_H__ */ 17#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-i386/ide.h b/include/asm-i386/ide.h
index 0fc240c80f49..e7817a3d6578 100644
--- a/include/asm-i386/ide.h
+++ b/include/asm-i386/ide.h
@@ -40,14 +40,13 @@ static __inline__ int ide_default_irq(unsigned long base)
40 40
41static __inline__ unsigned long ide_default_io_base(int index) 41static __inline__ unsigned long ide_default_io_base(int index)
42{ 42{
43 struct pci_dev *pdev;
44 /* 43 /*
45 * If PCI is present then it is not safe to poke around 44 * If PCI is present then it is not safe to poke around
46 * the other legacy IDE ports. Only 0x1f0 and 0x170 are 45 * the other legacy IDE ports. Only 0x1f0 and 0x170 are
47 * defined compatibility mode ports for PCI. A user can 46 * defined compatibility mode ports for PCI. A user can
48 * override this using ide= but we must default safe. 47 * override this using ide= but we must default safe.
49 */ 48 */
50 if ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL)) == NULL) { 49 if (no_pci_devices()) {
51 switch(index) { 50 switch(index) {
52 case 2: return 0x1e8; 51 case 2: return 0x1e8;
53 case 3: return 0x168; 52 case 3: return 0x168;
@@ -55,7 +54,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
55 case 5: return 0x160; 54 case 5: return 0x160;
56 } 55 }
57 } 56 }
58 pci_dev_put(pdev);
59 switch (index) { 57 switch (index) {
60 case 0: return 0x1f0; 58 case 0: return 0x1f0;
61 case 1: return 0x170; 59 case 1: return 0x170;
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index e797586a5bfc..7b65b5b00034 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -129,6 +129,7 @@ extern void iounmap(volatile void __iomem *addr);
129 */ 129 */
130extern void *bt_ioremap(unsigned long offset, unsigned long size); 130extern void *bt_ioremap(unsigned long offset, unsigned long size);
131extern void bt_iounmap(void *addr, unsigned long size); 131extern void bt_iounmap(void *addr, unsigned long size);
132extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
132 133
133/* Use early IO mappings for DMI because it's initialized early */ 134/* Use early IO mappings for DMI because it's initialized early */
134#define dmi_ioremap bt_ioremap 135#define dmi_ioremap bt_ioremap
diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h
index 9e15ce0006eb..36f310632c49 100644
--- a/include/asm-i386/irq.h
+++ b/include/asm-i386/irq.h
@@ -41,6 +41,7 @@ extern int irqbalance_disable(char *str);
41extern void fixup_irqs(cpumask_t map); 41extern void fixup_irqs(cpumask_t map);
42#endif 42#endif
43 43
44unsigned int do_IRQ(struct pt_regs *regs);
44void init_IRQ(void); 45void init_IRQ(void);
45void __init native_init_IRQ(void); 46void __init native_init_IRQ(void);
46 47
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h
index 8774d06689da..06f7303c30ca 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -42,7 +42,6 @@ typedef u8 kprobe_opcode_t;
42 ? (MAX_STACK_SIZE) \ 42 ? (MAX_STACK_SIZE) \
43 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 43 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
44 44
45#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
46#define ARCH_SUPPORTS_KRETPROBES 45#define ARCH_SUPPORTS_KRETPROBES
47#define ARCH_INACTIVE_KPROBE_COUNT 0 46#define ARCH_INACTIVE_KPROBE_COUNT 0
48#define flush_insn_slot(p) do { } while (0) 47#define flush_insn_slot(p) do { } while (0)
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 56e5689863ae..23ecda0b28a0 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -12,5 +12,5 @@
12 12
13static inline void do_timer_interrupt_hook(void) 13static inline void do_timer_interrupt_hook(void)
14{ 14{
15 pit_interrupt_hook(); 15 global_clock_event->event_handler(global_clock_event);
16} 16}
diff --git a/include/asm-i386/mach-default/io_ports.h b/include/asm-i386/mach-default/io_ports.h
index a96d9f6604ee..48540ba97166 100644
--- a/include/asm-i386/mach-default/io_ports.h
+++ b/include/asm-i386/mach-default/io_ports.h
@@ -7,11 +7,6 @@
7#ifndef _MACH_IO_PORTS_H 7#ifndef _MACH_IO_PORTS_H
8#define _MACH_IO_PORTS_H 8#define _MACH_IO_PORTS_H
9 9
10/* i8253A PIT registers */
11#define PIT_MODE 0x43
12#define PIT_CH0 0x40
13#define PIT_CH2 0x42
14
15/* i8259A PIC registers */ 10/* i8259A PIC registers */
16#define PIC_MASTER_CMD 0x20 11#define PIC_MASTER_CMD 0x20
17#define PIC_MASTER_IMR 0x21 12#define PIC_MASTER_IMR 0x21
diff --git a/include/asm-i386/mach-default/irq_vectors_limits.h b/include/asm-i386/mach-default/irq_vectors_limits.h
index 7f161e760be6..a90c7a60109f 100644
--- a/include/asm-i386/mach-default/irq_vectors_limits.h
+++ b/include/asm-i386/mach-default/irq_vectors_limits.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_IRQ_VECTORS_LIMITS_H 1#ifndef _ASM_IRQ_VECTORS_LIMITS_H
2#define _ASM_IRQ_VECTORS_LIMITS_H 2#define _ASM_IRQ_VECTORS_LIMITS_H
3 3
4#ifdef CONFIG_X86_IO_APIC 4#if defined(CONFIG_X86_IO_APIC) || defined(CONFIG_PARAVIRT)
5#define NR_IRQS 224 5#define NR_IRQS 224
6# if (224 >= 32 * NR_CPUS) 6# if (224 >= 32 * NR_CPUS)
7# define NR_IRQ_VECTORS NR_IRQS 7# define NR_IRQ_VECTORS NR_IRQS
diff --git a/include/asm-i386/mach-default/mach_reboot.h b/include/asm-i386/mach-default/mach_reboot.h
index a955e57ad016..e23fd9fbebb3 100644
--- a/include/asm-i386/mach-default/mach_reboot.h
+++ b/include/asm-i386/mach-default/mach_reboot.h
@@ -19,14 +19,37 @@ static inline void kb_wait(void)
19static inline void mach_reboot(void) 19static inline void mach_reboot(void)
20{ 20{
21 int i; 21 int i;
22
23 /* old method, works on most machines */
22 for (i = 0; i < 10; i++) { 24 for (i = 0; i < 10; i++) {
23 kb_wait(); 25 kb_wait();
24 udelay(50); 26 udelay(50);
27 outb(0xfe, 0x64); /* pulse reset low */
28 udelay(50);
29 }
30
31 /* New method: sets the "System flag" which, when set, indicates
32 * successful completion of the keyboard controller self-test (Basic
33 * Assurance Test, BAT). This is needed for some machines with no
34 * keyboard plugged in. This read-modify-write sequence sets only the
35 * system flag
36 */
37 for (i = 0; i < 10; i++) {
38 int cmd;
39
40 outb(0x20, 0x64); /* read Controller Command Byte */
41 udelay(50);
42 kb_wait();
43 udelay(50);
44 cmd = inb(0x60);
45 udelay(50);
46 kb_wait();
47 udelay(50);
25 outb(0x60, 0x64); /* write Controller Command Byte */ 48 outb(0x60, 0x64); /* write Controller Command Byte */
26 udelay(50); 49 udelay(50);
27 kb_wait(); 50 kb_wait();
28 udelay(50); 51 udelay(50);
29 outb(0x14, 0x60); /* set "System flag" */ 52 outb(cmd | 0x04, 0x60); /* set "System flag" */
30 udelay(50); 53 udelay(50);
31 kb_wait(); 54 kb_wait();
32 udelay(50); 55 udelay(50);
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index 60f9dcc15d54..bc2b58926308 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -12,7 +12,7 @@
12 **/ 12 **/
13static inline void do_timer_interrupt_hook(void) 13static inline void do_timer_interrupt_hook(void)
14{ 14{
15 pit_interrupt_hook(); 15 global_clock_event->event_handler(global_clock_event);
16 voyager_timer_interrupt(); 16 voyager_timer_interrupt();
17} 17}
18 18
diff --git a/include/asm-i386/mc146818rtc.h b/include/asm-i386/mc146818rtc.h
index 99a890047023..1613b42eaf58 100644
--- a/include/asm-i386/mc146818rtc.h
+++ b/include/asm-i386/mc146818rtc.h
@@ -6,6 +6,7 @@
6 6
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/system.h> 8#include <asm/system.h>
9#include <asm/processor.h>
9#include <linux/mc146818rtc.h> 10#include <linux/mc146818rtc.h>
10 11
11#ifndef RTC_PORT 12#ifndef RTC_PORT
@@ -43,8 +44,10 @@ static inline void lock_cmos(unsigned char reg)
43 unsigned long new; 44 unsigned long new;
44 new = ((smp_processor_id()+1) << 8) | reg; 45 new = ((smp_processor_id()+1) << 8) | reg;
45 for (;;) { 46 for (;;) {
46 if (cmos_lock) 47 if (cmos_lock) {
48 cpu_relax();
47 continue; 49 continue;
50 }
48 if (__cmpxchg(&cmos_lock, 0, new, sizeof(cmos_lock)) == 0) 51 if (__cmpxchg(&cmos_lock, 0, new, sizeof(cmos_lock)) == 0)
49 return; 52 return;
50 } 53 }
diff --git a/include/asm-i386/mce.h b/include/asm-i386/mce.h
index b0a02ee34ffd..d56d89742e8f 100644
--- a/include/asm-i386/mce.h
+++ b/include/asm-i386/mce.h
@@ -5,3 +5,7 @@ extern void mcheck_init(struct cpuinfo_x86 *c);
5#endif 5#endif
6 6
7extern int mce_disabled; 7extern int mce_disabled;
8
9extern void stop_mce(void);
10extern void restart_mce(void);
11
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 8198d1cca1f3..7eb0b0b1fb3c 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -32,6 +32,8 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
32#endif 32#endif
33} 33}
34 34
35void leave_mm(unsigned long cpu);
36
35static inline void switch_mm(struct mm_struct *prev, 37static inline void switch_mm(struct mm_struct *prev,
36 struct mm_struct *next, 38 struct mm_struct *next,
37 struct task_struct *tsk) 39 struct task_struct *tsk)
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h
index fb1e133efd9f..ff30c98f87b0 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -57,5 +57,7 @@ unsigned lapic_adjust_nmi_hz(unsigned hz);
57int lapic_watchdog_ok(void); 57int lapic_watchdog_ok(void);
58void disable_lapic_nmi_watchdog(void); 58void disable_lapic_nmi_watchdog(void);
59void enable_lapic_nmi_watchdog(void); 59void enable_lapic_nmi_watchdog(void);
60void stop_nmi(void);
61void restart_nmi(void);
60 62
61#endif /* ASM_NMI_H */ 63#endif /* ASM_NMI_H */
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 818ac8bf01e2..80ecc66b6d86 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -34,7 +34,8 @@
34#define clear_user_page(page, vaddr, pg) clear_page(page) 34#define clear_user_page(page, vaddr, pg) clear_page(page)
35#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 35#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
36 36
37#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 37#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
38 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
38#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 39#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
39 40
40/* 41/*
@@ -43,7 +44,6 @@
43extern int nx_enabled; 44extern int nx_enabled;
44 45
45#ifdef CONFIG_X86_PAE 46#ifdef CONFIG_X86_PAE
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;
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 7f846a7d6bcc..7df88be2dd9e 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -52,6 +52,8 @@ struct paravirt_ops
52 /* Basic arch-specific setup */ 52 /* Basic arch-specific setup */
53 void (*arch_setup)(void); 53 void (*arch_setup)(void);
54 char *(*memory_setup)(void); 54 char *(*memory_setup)(void);
55 void (*post_allocator_init)(void);
56
55 void (*init_IRQ)(void); 57 void (*init_IRQ)(void);
56 void (*time_init)(void); 58 void (*time_init)(void);
57 59
@@ -116,7 +118,7 @@ struct paravirt_ops
116 118
117 u64 (*read_tsc)(void); 119 u64 (*read_tsc)(void);
118 u64 (*read_pmc)(void); 120 u64 (*read_pmc)(void);
119 u64 (*get_scheduled_cycles)(void); 121 unsigned long long (*sched_clock)(void);
120 unsigned long (*get_cpu_khz)(void); 122 unsigned long (*get_cpu_khz)(void);
121 123
122 /* Segment descriptor handling */ 124 /* Segment descriptor handling */
@@ -173,7 +175,7 @@ struct paravirt_ops
173 unsigned long va); 175 unsigned long va);
174 176
175 /* Hooks for allocating/releasing pagetable pages */ 177 /* Hooks for allocating/releasing pagetable pages */
176 void (*alloc_pt)(u32 pfn); 178 void (*alloc_pt)(struct mm_struct *mm, u32 pfn);
177 void (*alloc_pd)(u32 pfn); 179 void (*alloc_pd)(u32 pfn);
178 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); 180 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
179 void (*release_pt)(u32 pfn); 181 void (*release_pt)(u32 pfn);
@@ -260,6 +262,7 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len)
260unsigned paravirt_patch_insns(void *site, unsigned len, 262unsigned paravirt_patch_insns(void *site, unsigned len,
261 const char *start, const char *end); 263 const char *start, const char *end);
262 264
265int paravirt_disable_iospace(void);
263 266
264/* 267/*
265 * This generates an indirect call based on the operation type number. 268 * This generates an indirect call based on the operation type number.
@@ -563,7 +566,10 @@ static inline u64 paravirt_read_tsc(void)
563 566
564#define rdtscll(val) (val = paravirt_read_tsc()) 567#define rdtscll(val) (val = paravirt_read_tsc())
565 568
566#define get_scheduled_cycles(val) (val = paravirt_ops.get_scheduled_cycles()) 569static inline unsigned long long paravirt_sched_clock(void)
570{
571 return PVOP_CALL0(unsigned long long, sched_clock);
572}
567#define calculate_cpu_khz() (paravirt_ops.get_cpu_khz()) 573#define calculate_cpu_khz() (paravirt_ops.get_cpu_khz())
568 574
569#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 575#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
@@ -669,6 +675,12 @@ static inline void setup_secondary_clock(void)
669} 675}
670#endif 676#endif
671 677
678static inline void paravirt_post_allocator_init(void)
679{
680 if (paravirt_ops.post_allocator_init)
681 (*paravirt_ops.post_allocator_init)();
682}
683
672static inline void paravirt_pagetable_setup_start(pgd_t *base) 684static inline void paravirt_pagetable_setup_start(pgd_t *base)
673{ 685{
674 if (paravirt_ops.pagetable_setup_start) 686 if (paravirt_ops.pagetable_setup_start)
@@ -725,9 +737,9 @@ static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
725 PVOP_VCALL3(flush_tlb_others, &cpumask, mm, va); 737 PVOP_VCALL3(flush_tlb_others, &cpumask, mm, va);
726} 738}
727 739
728static inline void paravirt_alloc_pt(unsigned pfn) 740static inline void paravirt_alloc_pt(struct mm_struct *mm, unsigned pfn)
729{ 741{
730 PVOP_VCALL1(alloc_pt, pfn); 742 PVOP_VCALL2(alloc_pt, mm, pfn);
731} 743}
732static inline void paravirt_release_pt(unsigned pfn) 744static inline void paravirt_release_pt(unsigned pfn)
733{ 745{
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 392d3fe5d45e..d790343e9982 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -3,6 +3,11 @@
3 3
4 4
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6
7struct pci_sysdata {
8 int node; /* NUMA node */
9};
10
6#include <linux/mm.h> /* for struct page */ 11#include <linux/mm.h> /* for struct page */
7 12
8/* Can be used to override the logic in pci_scan_bus for skipping 13/* Can be used to override the logic in pci_scan_bus for skipping
diff --git a/include/asm-i386/percpu.h b/include/asm-i386/percpu.h
index f54830b5d5ac..a7ebd436f3cc 100644
--- a/include/asm-i386/percpu.h
+++ b/include/asm-i386/percpu.h
@@ -54,6 +54,11 @@ extern unsigned long __per_cpu_offset[];
54#define DEFINE_PER_CPU(type, name) \ 54#define DEFINE_PER_CPU(type, name) \
55 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 55 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
56 56
57#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
58 __attribute__((__section__(".data.percpu.shared_aligned"))) \
59 __typeof__(type) per_cpu__##name \
60 ____cacheline_aligned_in_smp
61
57/* We can use this directly for local CPU (faster). */ 62/* We can use this directly for local CPU (faster). */
58DECLARE_PER_CPU(unsigned long, this_cpu_off); 63DECLARE_PER_CPU(unsigned long, this_cpu_off);
59 64
diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h
index d07b7afc2692..f2fc33ceb9f2 100644
--- a/include/asm-i386/pgalloc.h
+++ b/include/asm-i386/pgalloc.h
@@ -7,7 +7,7 @@
7#ifdef CONFIG_PARAVIRT 7#ifdef CONFIG_PARAVIRT
8#include <asm/paravirt.h> 8#include <asm/paravirt.h>
9#else 9#else
10#define paravirt_alloc_pt(pfn) do { } while (0) 10#define paravirt_alloc_pt(mm, pfn) do { } while (0)
11#define paravirt_alloc_pd(pfn) do { } while (0) 11#define paravirt_alloc_pd(pfn) do { } while (0)
12#define paravirt_alloc_pd(pfn) do { } while (0) 12#define paravirt_alloc_pd(pfn) do { } while (0)
13#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0) 13#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
@@ -17,13 +17,13 @@
17 17
18#define pmd_populate_kernel(mm, pmd, pte) \ 18#define pmd_populate_kernel(mm, pmd, pte) \
19do { \ 19do { \
20 paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \ 20 paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \
21 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \ 21 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
22} while (0) 22} while (0)
23 23
24#define pmd_populate(mm, pmd, pte) \ 24#define pmd_populate(mm, pmd, pte) \
25do { \ 25do { \
26 paravirt_alloc_pt(page_to_pfn(pte)); \ 26 paravirt_alloc_pt(mm, page_to_pfn(pte)); \
27 set_pmd(pmd, __pmd(_PAGE_TABLE + \ 27 set_pmd(pmd, __pmd(_PAGE_TABLE + \
28 ((unsigned long long)page_to_pfn(pte) << \ 28 ((unsigned long long)page_to_pfn(pte) << \
29 (unsigned long long) PAGE_SHIFT))); \ 29 (unsigned long long) PAGE_SHIFT))); \
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index a50fd1773de8..84b03cf56a79 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -57,14 +57,6 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp)
57#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))
58 58
59/* 59/*
60 * All present user pages are user-executable:
61 */
62static inline int pte_exec(pte_t pte)
63{
64 return pte_user(pte);
65}
66
67/*
68 * All present pages are kernel-executable: 60 * All present pages are kernel-executable:
69 */ 61 */
70static inline int pte_exec_kernel(pte_t pte) 62static inline int pte_exec_kernel(pte_t pte)
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index eb0f1d7e96a1..948a33414118 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -20,26 +20,11 @@
20#define pud_present(pud) 1 20#define pud_present(pud) 1
21 21
22/* 22/*
23 * Is the pte executable?
24 */
25static inline int pte_x(pte_t pte)
26{
27 return !(pte_val(pte) & _PAGE_NX);
28}
29
30/*
31 * All present user-pages with !NX bit are user-executable:
32 */
33static inline int pte_exec(pte_t pte)
34{
35 return pte_user(pte) && pte_x(pte);
36}
37/*
38 * All present pages with !NX bit are kernel-executable: 23 * All present pages with !NX bit are kernel-executable:
39 */ 24 */
40static inline int pte_exec_kernel(pte_t pte) 25static inline int pte_exec_kernel(pte_t pte)
41{ 26{
42 return pte_x(pte); 27 return !(pte_val(pte) & _PAGE_NX);
43} 28}
44 29
45/* Rules for using set_pte: the pte being assigned *must* be 30/* Rules for using set_pte: the pte being assigned *must* be
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 628fa7747d0c..c7fefa6b12fd 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -79,7 +79,7 @@ void paging_init(void);
79 * area for the same reason. ;) 79 * area for the same reason. ;)
80 */ 80 */
81#define VMALLOC_OFFSET (8*1024*1024) 81#define VMALLOC_OFFSET (8*1024*1024)
82#define VMALLOC_START (((unsigned long) high_memory + vmalloc_earlyreserve + \ 82#define VMALLOC_START (((unsigned long) high_memory + \
83 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1)) 83 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1))
84#ifdef CONFIG_HIGHMEM 84#ifdef CONFIG_HIGHMEM
85# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) 85# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
@@ -218,8 +218,6 @@ extern unsigned long pg0[];
218 * The following only work if pte_present() is true. 218 * The following only work if pte_present() is true.
219 * Undefined behaviour if not.. 219 * Undefined behaviour if not..
220 */ 220 */
221static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
222static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
223static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } 221static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
224static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } 222static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
225static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } 223static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; }
@@ -230,13 +228,9 @@ static inline int pte_huge(pte_t pte) { return (pte).pte_low & _PAGE_PSE; }
230 */ 228 */
231static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } 229static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; }
232 230
233static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
234static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
235static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; } 231static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; }
236static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; } 232static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; }
237static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; } 233static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; }
238static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
239static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
240static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } 234static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
241static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } 235static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
242static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 236static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
@@ -295,17 +289,6 @@ static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
295 __changed; \ 289 __changed; \
296}) 290})
297 291
298#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
299#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \
300 int __ret = 0; \
301 if (pte_dirty(*(ptep))) \
302 __ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \
303 &(ptep)->pte_low); \
304 if (__ret) \
305 pte_update((vma)->vm_mm, addr, ptep); \
306 __ret; \
307})
308
309#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 292#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
310#define ptep_test_and_clear_young(vma, addr, ptep) ({ \ 293#define ptep_test_and_clear_young(vma, addr, ptep) ({ \
311 int __ret = 0; \ 294 int __ret = 0; \
@@ -317,27 +300,6 @@ static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
317 __ret; \ 300 __ret; \
318}) 301})
319 302
320/*
321 * Rules for using ptep_establish: the pte MUST be a user pte, and
322 * must be a present->present transition.
323 */
324#define __HAVE_ARCH_PTEP_ESTABLISH
325#define ptep_establish(vma, address, ptep, pteval) \
326do { \
327 set_pte_present((vma)->vm_mm, address, ptep, pteval); \
328 flush_tlb_page(vma, address); \
329} while (0)
330
331#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
332#define ptep_clear_flush_dirty(vma, address, ptep) \
333({ \
334 int __dirty; \
335 __dirty = ptep_test_and_clear_dirty((vma), (address), (ptep)); \
336 if (__dirty) \
337 flush_tlb_page(vma, address); \
338 __dirty; \
339})
340
341#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH 303#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
342#define ptep_clear_flush_young(vma, address, ptep) \ 304#define ptep_clear_flush_young(vma, address, ptep) \
343({ \ 305({ \
diff --git a/include/asm-i386/processor-cyrix.h b/include/asm-i386/processor-cyrix.h
new file mode 100644
index 000000000000..97568ada1f97
--- /dev/null
+++ b/include/asm-i386/processor-cyrix.h
@@ -0,0 +1,30 @@
1/*
2 * NSC/Cyrix CPU indexed register access. Must be inlined instead of
3 * macros to ensure correct access ordering
4 * Access order is always 0x22 (=offset), 0x23 (=value)
5 *
6 * When using the old macros a line like
7 * setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
8 * gets expanded to:
9 * do {
10 * outb((CX86_CCR2), 0x22);
11 * outb((({
12 * outb((CX86_CCR2), 0x22);
13 * inb(0x23);
14 * }) | 0x88), 0x23);
15 * } while (0);
16 *
17 * which in fact violates the access order (= 0x22, 0x22, 0x23, 0x23).
18 */
19
20static inline u8 getCx86(u8 reg)
21{
22 outb(reg, 0x22);
23 return inb(0x23);
24}
25
26static inline void setCx86(u8 reg, u8 data)
27{
28 outb(reg, 0x22);
29 outb(data, 0x23);
30}
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 94e0c147c165..3845fe72383e 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -88,7 +88,6 @@ struct cpuinfo_x86 {
88#define X86_VENDOR_UMC 3 88#define X86_VENDOR_UMC 3
89#define X86_VENDOR_NEXGEN 4 89#define X86_VENDOR_NEXGEN 4
90#define X86_VENDOR_CENTAUR 5 90#define X86_VENDOR_CENTAUR 5
91#define X86_VENDOR_RISE 6
92#define X86_VENDOR_TRANSMETA 7 91#define X86_VENDOR_TRANSMETA 7
93#define X86_VENDOR_NSC 8 92#define X86_VENDOR_NSC 8
94#define X86_VENDOR_NUM 9 93#define X86_VENDOR_NUM 9
@@ -169,17 +168,6 @@ static inline void clear_in_cr4 (unsigned long mask)
169 write_cr4(cr4); 168 write_cr4(cr4);
170} 169}
171 170
172/*
173 * NSC/Cyrix CPU indexed register access macros
174 */
175
176#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
177
178#define setCx86(reg, data) do { \
179 outb((reg), 0x22); \
180 outb((data), 0x23); \
181} while (0)
182
183/* Stop speculative execution */ 171/* Stop speculative execution */
184static inline void sync_core(void) 172static inline void sync_core(void)
185{ 173{
@@ -228,6 +216,10 @@ extern int bootloader_type;
228 216
229#define HAVE_ARCH_PICK_MMAP_LAYOUT 217#define HAVE_ARCH_PICK_MMAP_LAYOUT
230 218
219extern void hard_disable_TSC(void);
220extern void disable_TSC(void);
221extern void hard_enable_TSC(void);
222
231/* 223/*
232 * Size of io_bitmap. 224 * Size of io_bitmap.
233 */ 225 */
diff --git a/include/asm-i386/required-features.h b/include/asm-i386/required-features.h
index 65848a007050..618feb98f9f5 100644
--- a/include/asm-i386/required-features.h
+++ b/include/asm-i386/required-features.h
@@ -29,7 +29,7 @@
29# define NEED_CMOV 0 29# define NEED_CMOV 0
30#endif 30#endif
31 31
32#ifdef CONFIG_X86_CMPXCHG64 32#ifdef CONFIG_X86_PAE
33# define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31)) 33# define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31))
34#else 34#else
35# define NEED_CX8 0 35# define NEED_CX8 0
diff --git a/include/asm-i386/resume-trace.h b/include/asm-i386/resume-trace.h
new file mode 100644
index 000000000000..ec9cfd656230
--- /dev/null
+++ b/include/asm-i386/resume-trace.h
@@ -0,0 +1,13 @@
1#define TRACE_RESUME(user) do { \
2 if (pm_trace_enabled) { \
3 void *tracedata; \
4 asm volatile("movl $1f,%0\n" \
5 ".section .tracedata,\"a\"\n" \
6 "1:\t.word %c1\n" \
7 "\t.long %c2\n" \
8 ".previous" \
9 :"=r" (tracedata) \
10 : "i" (__LINE__), "i" (__FILE__)); \
11 generate_resume_trace(tracedata, user); \
12 } \
13} while (0)
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index 0d5bff9dc4a5..7862fe858a9e 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -81,6 +81,10 @@ void __init add_memory_region(unsigned long long start,
81 81
82extern unsigned long init_pg_tables_end; 82extern unsigned long init_pg_tables_end;
83 83
84#ifndef CONFIG_PARAVIRT
85#define paravirt_post_allocator_init() do {} while (0)
86#endif
87
84#endif /* __ASSEMBLY__ */ 88#endif /* __ASSEMBLY__ */
85 89
86#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 0c7132787062..1f73bde165b1 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -43,9 +43,12 @@ extern u8 x86_cpu_to_apicid[];
43 43
44#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 44#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
45 45
46extern void set_cpu_sibling_map(int cpu);
47
46#ifdef CONFIG_HOTPLUG_CPU 48#ifdef CONFIG_HOTPLUG_CPU
47extern void cpu_exit_clear(void); 49extern void cpu_exit_clear(void);
48extern void cpu_uninit(void); 50extern void cpu_uninit(void);
51extern void remove_siblinginfo(int cpu);
49#endif 52#endif
50 53
51struct smp_ops 54struct smp_ops
@@ -129,6 +132,8 @@ extern int __cpu_disable(void);
129extern void __cpu_die(unsigned int cpu); 132extern void __cpu_die(unsigned int cpu);
130extern unsigned int num_processors; 133extern unsigned int num_processors;
131 134
135void __cpuinit smp_store_cpu_info(int id);
136
132#endif /* !__ASSEMBLY__ */ 137#endif /* !__ASSEMBLY__ */
133 138
134#else /* CONFIG_SMP */ 139#else /* CONFIG_SMP */
diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h
index b9277361954b..a9b64453bdf5 100644
--- a/include/asm-i386/string.h
+++ b/include/asm-i386/string.h
@@ -2,203 +2,35 @@
2#define _I386_STRING_H_ 2#define _I386_STRING_H_
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5/*
6 * On a 486 or Pentium, we are better off not using the
7 * byte string operations. But on a 386 or a PPro the
8 * byte string ops are faster than doing it by hand
9 * (MUCH faster on a Pentium).
10 */
11
12/*
13 * This string-include defines all string functions as inline
14 * functions. Use gcc. It also assumes ds=es=data space, this should be
15 * normal. Most of the string-functions are rather heavily hand-optimized,
16 * see especially strsep,strstr,str[c]spn. They should work, but are not
17 * very easy to understand. Everything is done entirely within the register
18 * set, making the functions fast and clean. String instructions have been
19 * used through-out, making for "slightly" unclear code :-)
20 *
21 * NO Copyright (C) 1991, 1992 Linus Torvalds,
22 * consider these trivial functions to be PD.
23 */
24 5
25/* AK: in fact I bet it would be better to move this stuff all out of line. 6/* Let gcc decide wether to inline or use the out of line functions */
26 */
27 7
28#define __HAVE_ARCH_STRCPY 8#define __HAVE_ARCH_STRCPY
29static inline char * strcpy(char * dest,const char *src) 9extern char *strcpy(char *dest, const char *src);
30{
31int d0, d1, d2;
32__asm__ __volatile__(
33 "1:\tlodsb\n\t"
34 "stosb\n\t"
35 "testb %%al,%%al\n\t"
36 "jne 1b"
37 : "=&S" (d0), "=&D" (d1), "=&a" (d2)
38 :"0" (src),"1" (dest) : "memory");
39return dest;
40}
41 10
42#define __HAVE_ARCH_STRNCPY 11#define __HAVE_ARCH_STRNCPY
43static inline char * strncpy(char * dest,const char *src,size_t count) 12extern char *strncpy(char *dest, const char *src, size_t count);
44{
45int d0, d1, d2, d3;
46__asm__ __volatile__(
47 "1:\tdecl %2\n\t"
48 "js 2f\n\t"
49 "lodsb\n\t"
50 "stosb\n\t"
51 "testb %%al,%%al\n\t"
52 "jne 1b\n\t"
53 "rep\n\t"
54 "stosb\n"
55 "2:"
56 : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3)
57 :"0" (src),"1" (dest),"2" (count) : "memory");
58return dest;
59}
60 13
61#define __HAVE_ARCH_STRCAT 14#define __HAVE_ARCH_STRCAT
62static inline char * strcat(char * dest,const char * src) 15extern char *strcat(char *dest, const char *src);
63{
64int d0, d1, d2, d3;
65__asm__ __volatile__(
66 "repne\n\t"
67 "scasb\n\t"
68 "decl %1\n"
69 "1:\tlodsb\n\t"
70 "stosb\n\t"
71 "testb %%al,%%al\n\t"
72 "jne 1b"
73 : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
74 : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu):"memory");
75return dest;
76}
77 16
78#define __HAVE_ARCH_STRNCAT 17#define __HAVE_ARCH_STRNCAT
79static inline char * strncat(char * dest,const char * src,size_t count) 18extern char *strncat(char *dest, const char *src, size_t count);
80{
81int d0, d1, d2, d3;
82__asm__ __volatile__(
83 "repne\n\t"
84 "scasb\n\t"
85 "decl %1\n\t"
86 "movl %8,%3\n"
87 "1:\tdecl %3\n\t"
88 "js 2f\n\t"
89 "lodsb\n\t"
90 "stosb\n\t"
91 "testb %%al,%%al\n\t"
92 "jne 1b\n"
93 "2:\txorl %2,%2\n\t"
94 "stosb"
95 : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
96 : "0" (src),"1" (dest),"2" (0),"3" (0xffffffffu), "g" (count)
97 : "memory");
98return dest;
99}
100 19
101#define __HAVE_ARCH_STRCMP 20#define __HAVE_ARCH_STRCMP
102static inline int strcmp(const char * cs,const char * ct) 21extern int strcmp(const char *cs, const char *ct);
103{
104int d0, d1;
105register int __res;
106__asm__ __volatile__(
107 "1:\tlodsb\n\t"
108 "scasb\n\t"
109 "jne 2f\n\t"
110 "testb %%al,%%al\n\t"
111 "jne 1b\n\t"
112 "xorl %%eax,%%eax\n\t"
113 "jmp 3f\n"
114 "2:\tsbbl %%eax,%%eax\n\t"
115 "orb $1,%%al\n"
116 "3:"
117 :"=a" (__res), "=&S" (d0), "=&D" (d1)
118 :"1" (cs),"2" (ct)
119 :"memory");
120return __res;
121}
122 22
123#define __HAVE_ARCH_STRNCMP 23#define __HAVE_ARCH_STRNCMP
124static inline int strncmp(const char * cs,const char * ct,size_t count) 24extern int strncmp(const char *cs, const char *ct, size_t count);
125{
126register int __res;
127int d0, d1, d2;
128__asm__ __volatile__(
129 "1:\tdecl %3\n\t"
130 "js 2f\n\t"
131 "lodsb\n\t"
132 "scasb\n\t"
133 "jne 3f\n\t"
134 "testb %%al,%%al\n\t"
135 "jne 1b\n"
136 "2:\txorl %%eax,%%eax\n\t"
137 "jmp 4f\n"
138 "3:\tsbbl %%eax,%%eax\n\t"
139 "orb $1,%%al\n"
140 "4:"
141 :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
142 :"1" (cs),"2" (ct),"3" (count)
143 :"memory");
144return __res;
145}
146 25
147#define __HAVE_ARCH_STRCHR 26#define __HAVE_ARCH_STRCHR
148static inline char * strchr(const char * s, int c) 27extern char *strchr(const char *s, int c);
149{
150int d0;
151register char * __res;
152__asm__ __volatile__(
153 "movb %%al,%%ah\n"
154 "1:\tlodsb\n\t"
155 "cmpb %%ah,%%al\n\t"
156 "je 2f\n\t"
157 "testb %%al,%%al\n\t"
158 "jne 1b\n\t"
159 "movl $1,%1\n"
160 "2:\tmovl %1,%0\n\t"
161 "decl %0"
162 :"=a" (__res), "=&S" (d0)
163 :"1" (s),"0" (c)
164 :"memory");
165return __res;
166}
167 28
168#define __HAVE_ARCH_STRRCHR 29#define __HAVE_ARCH_STRRCHR
169static inline char * strrchr(const char * s, int c) 30extern char *strrchr(const char *s, int c);
170{
171int d0, d1;
172register char * __res;
173__asm__ __volatile__(
174 "movb %%al,%%ah\n"
175 "1:\tlodsb\n\t"
176 "cmpb %%ah,%%al\n\t"
177 "jne 2f\n\t"
178 "leal -1(%%esi),%0\n"
179 "2:\ttestb %%al,%%al\n\t"
180 "jne 1b"
181 :"=g" (__res), "=&S" (d0), "=&a" (d1)
182 :"0" (0),"1" (s),"2" (c)
183 :"memory");
184return __res;
185}
186 31
187#define __HAVE_ARCH_STRLEN 32#define __HAVE_ARCH_STRLEN
188static inline size_t strlen(const char * s) 33extern size_t strlen(const char *s);
189{
190int d0;
191register int __res;
192__asm__ __volatile__(
193 "repne\n\t"
194 "scasb\n\t"
195 "notl %0\n\t"
196 "decl %0"
197 :"=c" (__res), "=&D" (d0)
198 :"1" (s),"a" (0), "0" (0xffffffffu)
199 :"memory");
200return __res;
201}
202 34
203static __always_inline void * __memcpy(void * to, const void * from, size_t n) 35static __always_inline void * __memcpy(void * to, const void * from, size_t n)
204{ 36{
@@ -207,9 +39,7 @@ __asm__ __volatile__(
207 "rep ; movsl\n\t" 39 "rep ; movsl\n\t"
208 "movl %4,%%ecx\n\t" 40 "movl %4,%%ecx\n\t"
209 "andl $3,%%ecx\n\t" 41 "andl $3,%%ecx\n\t"
210#if 1 /* want to pay 2 byte penalty for a chance to skip microcoded rep? */
211 "jz 1f\n\t" 42 "jz 1f\n\t"
212#endif
213 "rep ; movsb\n\t" 43 "rep ; movsb\n\t"
214 "1:" 44 "1:"
215 : "=&c" (d0), "=&D" (d1), "=&S" (d2) 45 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
@@ -328,23 +158,7 @@ void *memmove(void * dest,const void * src, size_t n);
328#define memcmp __builtin_memcmp 158#define memcmp __builtin_memcmp
329 159
330#define __HAVE_ARCH_MEMCHR 160#define __HAVE_ARCH_MEMCHR
331static inline void * memchr(const void * cs,int c,size_t count) 161extern void *memchr(const void * cs,int c,size_t count);
332{
333int d0;
334register void * __res;
335if (!count)
336 return NULL;
337__asm__ __volatile__(
338 "repne\n\t"
339 "scasb\n\t"
340 "je 1f\n\t"
341 "movl $1,%0\n"
342 "1:\tdecl %0"
343 :"=D" (__res), "=&c" (d0)
344 :"a" (c),"0" (cs),"1" (count)
345 :"memory");
346return __res;
347}
348 162
349static inline void * __memset_generic(void * s, char c,size_t count) 163static inline void * __memset_generic(void * s, char c,size_t count)
350{ 164{
@@ -386,29 +200,10 @@ return (s);
386 200
387/* Added by Gertjan van Wingerde to make minix and sysv module work */ 201/* Added by Gertjan van Wingerde to make minix and sysv module work */
388#define __HAVE_ARCH_STRNLEN 202#define __HAVE_ARCH_STRNLEN
389static inline size_t strnlen(const char * s, size_t count) 203extern size_t strnlen(const char * s, size_t count);
390{
391int d0;
392register int __res;
393__asm__ __volatile__(
394 "movl %2,%0\n\t"
395 "jmp 2f\n"
396 "1:\tcmpb $0,(%0)\n\t"
397 "je 3f\n\t"
398 "incl %0\n"
399 "2:\tdecl %1\n\t"
400 "cmpl $-1,%1\n\t"
401 "jne 1b\n"
402 "3:\tsubl %2,%0"
403 :"=a" (__res), "=&d" (d0)
404 :"c" (s),"1" (count)
405 :"memory");
406return __res;
407}
408/* end of additional stuff */ 204/* end of additional stuff */
409 205
410#define __HAVE_ARCH_STRSTR 206#define __HAVE_ARCH_STRSTR
411
412extern char *strstr(const char *cs, const char *ct); 207extern char *strstr(const char *cs, const char *ct);
413 208
414/* 209/*
@@ -474,19 +269,7 @@ __asm__ __volatile__( \
474 * find the first occurrence of byte 'c', or 1 past the area if none 269 * find the first occurrence of byte 'c', or 1 past the area if none
475 */ 270 */
476#define __HAVE_ARCH_MEMSCAN 271#define __HAVE_ARCH_MEMSCAN
477static inline void * memscan(void * addr, int c, size_t size) 272extern void *memscan(void * addr, int c, size_t size);
478{
479 if (!size)
480 return addr;
481 __asm__("repnz; scasb\n\t"
482 "jnz 1f\n\t"
483 "dec %%edi\n"
484 "1:"
485 : "=D" (addr), "=c" (size)
486 : "0" (addr), "1" (size), "a" (c)
487 : "memory");
488 return addr;
489}
490 273
491#endif /* __KERNEL__ */ 274#endif /* __KERNEL__ */
492 275
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 94ed3686a5f3..609756c61676 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -310,15 +310,6 @@ void enable_hlt(void);
310extern int es7000_plat; 310extern int es7000_plat;
311void cpu_idle_wait(void); 311void cpu_idle_wait(void);
312 312
313/*
314 * On SMP systems, when the scheduler does migration-cost autodetection,
315 * it needs a way to flush as much of the CPU's caches as possible:
316 */
317static inline void sched_cacheflush(void)
318{
319 wbinvd();
320}
321
322extern unsigned long arch_align_stack(unsigned long sp); 313extern unsigned long arch_align_stack(unsigned long sp);
323extern void free_init_pages(char *what, unsigned long begin, unsigned long end); 314extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
324 315
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 4cb0f91ae64f..54424e045e01 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -137,6 +137,7 @@ static inline struct thread_info *current_thread_info(void)
137#define TIF_DEBUG 17 /* uses debug registers */ 137#define TIF_DEBUG 17 /* uses debug registers */
138#define TIF_IO_BITMAP 18 /* uses I/O bitmap */ 138#define TIF_IO_BITMAP 18 /* uses I/O bitmap */
139#define TIF_FREEZE 19 /* is freezing for suspend */ 139#define TIF_FREEZE 19 /* is freezing for suspend */
140#define TIF_NOTSC 20 /* TSC is not accessible in userland */
140 141
141#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 142#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
142#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 143#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -151,6 +152,7 @@ static inline struct thread_info *current_thread_info(void)
151#define _TIF_DEBUG (1<<TIF_DEBUG) 152#define _TIF_DEBUG (1<<TIF_DEBUG)
152#define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) 153#define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP)
153#define _TIF_FREEZE (1<<TIF_FREEZE) 154#define _TIF_FREEZE (1<<TIF_FREEZE)
155#define _TIF_NOTSC (1<<TIF_NOTSC)
154 156
155/* work to do on interrupt/exception return */ 157/* work to do on interrupt/exception return */
156#define _TIF_WORK_MASK \ 158#define _TIF_WORK_MASK \
@@ -160,7 +162,8 @@ static inline struct thread_info *current_thread_info(void)
160#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 162#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
161 163
162/* flags to check in __switch_to() */ 164/* flags to check in __switch_to() */
163#define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP) 165#define _TIF_WORK_CTXSW_NEXT (_TIF_IO_BITMAP | _TIF_NOTSC | _TIF_DEBUG)
166#define _TIF_WORK_CTXSW_PREV (_TIF_IO_BITMAP | _TIF_NOTSC)
164 167
165/* 168/*
166 * Thread-synchronous status. 169 * Thread-synchronous status.
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h
index 153770e25faa..0db7e994fb8b 100644
--- a/include/asm-i386/timer.h
+++ b/include/asm-i386/timer.h
@@ -5,18 +5,46 @@
5 5
6#define TICK_SIZE (tick_nsec / 1000) 6#define TICK_SIZE (tick_nsec / 1000)
7 7
8void setup_pit_timer(void);
9unsigned long long native_sched_clock(void); 8unsigned long long native_sched_clock(void);
10unsigned long native_calculate_cpu_khz(void); 9unsigned long native_calculate_cpu_khz(void);
11 10
12extern int timer_ack; 11extern int timer_ack;
13extern int no_timer_check; 12extern int no_timer_check;
14extern int no_sync_cmos_clock;
15extern int recalibrate_cpu_khz(void); 13extern int recalibrate_cpu_khz(void);
16 14
17#ifndef CONFIG_PARAVIRT 15#ifndef CONFIG_PARAVIRT
18#define get_scheduled_cycles(val) rdtscll(val)
19#define calculate_cpu_khz() native_calculate_cpu_khz() 16#define calculate_cpu_khz() native_calculate_cpu_khz()
20#endif 17#endif
21 18
19/* Accellerators for sched_clock()
20 * convert from cycles(64bits) => nanoseconds (64bits)
21 * basic equation:
22 * ns = cycles / (freq / ns_per_sec)
23 * ns = cycles * (ns_per_sec / freq)
24 * ns = cycles * (10^9 / (cpu_khz * 10^3))
25 * ns = cycles * (10^6 / cpu_khz)
26 *
27 * Then we use scaling math (suggested by george@mvista.com) to get:
28 * ns = cycles * (10^6 * SC / cpu_khz) / SC
29 * ns = cycles * cyc2ns_scale / SC
30 *
31 * And since SC is a constant power of two, we can convert the div
32 * into a shift.
33 *
34 * We can use khz divisor instead of mhz to keep a better percision, since
35 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits.
36 * (mathieu.desnoyers@polymtl.ca)
37 *
38 * -johnstul@us.ibm.com "math is hard, lets go shopping!"
39 */
40extern unsigned long cyc2ns_scale __read_mostly;
41
42#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
43
44static inline unsigned long long cycles_2_ns(unsigned long long cyc)
45{
46 return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
47}
48
49
22#endif 50#endif
diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
index fc525c5cd5a9..a50fa6741486 100644
--- a/include/asm-i386/tlbflush.h
+++ b/include/asm-i386/tlbflush.h
@@ -160,7 +160,11 @@ DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
160 native_flush_tlb_others(&mask, mm, va) 160 native_flush_tlb_others(&mask, mm, va)
161#endif 161#endif
162 162
163#define flush_tlb_kernel_range(start, end) flush_tlb_all() 163static inline void flush_tlb_kernel_range(unsigned long start,
164 unsigned long end)
165{
166 flush_tlb_all();
167}
164 168
165static inline void flush_tlb_pgtables(struct mm_struct *mm, 169static inline void flush_tlb_pgtables(struct mm_struct *mm,
166 unsigned long start, unsigned long end) 170 unsigned long start, unsigned long end)
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index 7fc512d90ea8..19b2dafd0c81 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -67,7 +67,7 @@ static inline int node_to_first_cpu(int node)
67 return first_cpu(mask); 67 return first_cpu(mask);
68} 68}
69 69
70#define pcibus_to_node(bus) ((long) (bus)->sysdata) 70#define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node
71#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) 71#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus))
72 72
73/* sched_domains SD_NODE_INIT for NUMAQ machines */ 73/* sched_domains SD_NODE_INIT for NUMAQ machines */
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index 62c091ffcccc..a4d806610b7f 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -63,6 +63,7 @@ extern void tsc_init(void);
63extern void mark_tsc_unstable(char *reason); 63extern void mark_tsc_unstable(char *reason);
64extern int unsynchronized_tsc(void); 64extern int unsynchronized_tsc(void);
65extern void init_tsc_clocksource(void); 65extern void init_tsc_clocksource(void);
66int check_tsc_unstable(void);
66 67
67/* 68/*
68 * Boot-time check whether the TSCs are synchronized across 69 * Boot-time check whether the TSCs are synchronized across
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index e2aa5e0d0cc7..d2a4f7be9c2c 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -581,7 +581,7 @@ long __must_check __strncpy_from_user(char *dst,
581 * If there is a limit on the length of a valid string, you may wish to 581 * If there is a limit on the length of a valid string, you may wish to
582 * consider using strnlen_user() instead. 582 * consider using strnlen_user() instead.
583 */ 583 */
584#define strlen_user(str) strnlen_user(str, ~0UL >> 1) 584#define strlen_user(str) strnlen_user(str, LONG_MAX)
585 585
586long strnlen_user(const char __user *str, long n); 586long strnlen_user(const char __user *str, long n);
587unsigned long __must_check clear_user(void __user *mem, unsigned long len); 587unsigned long __must_check clear_user(void __user *mem, unsigned long len);
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index e84ace1ec8bf..9b15545eb9b5 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -329,10 +329,11 @@
329#define __NR_signalfd 321 329#define __NR_signalfd 321
330#define __NR_timerfd 322 330#define __NR_timerfd 322
331#define __NR_eventfd 323 331#define __NR_eventfd 323
332#define __NR_fallocate 324
332 333
333#ifdef __KERNEL__ 334#ifdef __KERNEL__
334 335
335#define NR_syscalls 324 336#define NR_syscalls 325
336 337
337#define __ARCH_WANT_IPC_PARSE_VERSION 338#define __ARCH_WANT_IPC_PARSE_VERSION
338#define __ARCH_WANT_OLD_READDIR 339#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-i386/vmi_time.h b/include/asm-i386/vmi_time.h
index 213930b995cb..478188130328 100644
--- a/include/asm-i386/vmi_time.h
+++ b/include/asm-i386/vmi_time.h
@@ -49,7 +49,7 @@ extern struct vmi_timer_ops {
49extern void __init vmi_time_init(void); 49extern void __init vmi_time_init(void);
50extern unsigned long vmi_get_wallclock(void); 50extern unsigned long vmi_get_wallclock(void);
51extern int vmi_set_wallclock(unsigned long now); 51extern int vmi_set_wallclock(unsigned long now);
52extern unsigned long long vmi_get_sched_cycles(void); 52extern unsigned long long vmi_sched_clock(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
diff --git a/include/asm-i386/xen/hypercall.h b/include/asm-i386/xen/hypercall.h
new file mode 100644
index 000000000000..bc0ee7d961ca
--- /dev/null
+++ b/include/asm-i386/xen/hypercall.h
@@ -0,0 +1,413 @@
1/******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
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 version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __HYPERCALL_H__
34#define __HYPERCALL_H__
35
36#include <linux/errno.h>
37#include <linux/string.h>
38
39#include <xen/interface/xen.h>
40#include <xen/interface/sched.h>
41#include <xen/interface/physdev.h>
42
43extern struct { char _entry[32]; } hypercall_page[];
44
45#define _hypercall0(type, name) \
46({ \
47 long __res; \
48 asm volatile ( \
49 "call %[call]" \
50 : "=a" (__res) \
51 : [call] "m" (hypercall_page[__HYPERVISOR_##name]) \
52 : "memory" ); \
53 (type)__res; \
54})
55
56#define _hypercall1(type, name, a1) \
57({ \
58 long __res, __ign1; \
59 asm volatile ( \
60 "call %[call]" \
61 : "=a" (__res), "=b" (__ign1) \
62 : "1" ((long)(a1)), \
63 [call] "m" (hypercall_page[__HYPERVISOR_##name]) \
64 : "memory" ); \
65 (type)__res; \
66})
67
68#define _hypercall2(type, name, a1, a2) \
69({ \
70 long __res, __ign1, __ign2; \
71 asm volatile ( \
72 "call %[call]" \
73 : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \
74 : "1" ((long)(a1)), "2" ((long)(a2)), \
75 [call] "m" (hypercall_page[__HYPERVISOR_##name]) \
76 : "memory" ); \
77 (type)__res; \
78})
79
80#define _hypercall3(type, name, a1, a2, a3) \
81({ \
82 long __res, __ign1, __ign2, __ign3; \
83 asm volatile ( \
84 "call %[call]" \
85 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
86 "=d" (__ign3) \
87 : "1" ((long)(a1)), "2" ((long)(a2)), \
88 "3" ((long)(a3)), \
89 [call] "m" (hypercall_page[__HYPERVISOR_##name]) \
90 : "memory" ); \
91 (type)__res; \
92})
93
94#define _hypercall4(type, name, a1, a2, a3, a4) \
95({ \
96 long __res, __ign1, __ign2, __ign3, __ign4; \
97 asm volatile ( \
98 "call %[call]" \
99 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
100 "=d" (__ign3), "=S" (__ign4) \
101 : "1" ((long)(a1)), "2" ((long)(a2)), \
102 "3" ((long)(a3)), "4" ((long)(a4)), \
103 [call] "m" (hypercall_page[__HYPERVISOR_##name]) \
104 : "memory" ); \
105 (type)__res; \
106})
107
108#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
109({ \
110 long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \
111 asm volatile ( \
112 "call %[call]" \
113 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
114 "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \
115 : "1" ((long)(a1)), "2" ((long)(a2)), \
116 "3" ((long)(a3)), "4" ((long)(a4)), \
117 "5" ((long)(a5)), \
118 [call] "m" (hypercall_page[__HYPERVISOR_##name]) \
119 : "memory" ); \
120 (type)__res; \
121})
122
123static inline int
124HYPERVISOR_set_trap_table(struct trap_info *table)
125{
126 return _hypercall1(int, set_trap_table, table);
127}
128
129static inline int
130HYPERVISOR_mmu_update(struct mmu_update *req, int count,
131 int *success_count, domid_t domid)
132{
133 return _hypercall4(int, mmu_update, req, count, success_count, domid);
134}
135
136static inline int
137HYPERVISOR_mmuext_op(struct mmuext_op *op, int count,
138 int *success_count, domid_t domid)
139{
140 return _hypercall4(int, mmuext_op, op, count, success_count, domid);
141}
142
143static inline int
144HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
145{
146 return _hypercall2(int, set_gdt, frame_list, entries);
147}
148
149static inline int
150HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
151{
152 return _hypercall2(int, stack_switch, ss, esp);
153}
154
155static inline int
156HYPERVISOR_set_callbacks(unsigned long event_selector,
157 unsigned long event_address,
158 unsigned long failsafe_selector,
159 unsigned long failsafe_address)
160{
161 return _hypercall4(int, set_callbacks,
162 event_selector, event_address,
163 failsafe_selector, failsafe_address);
164}
165
166static inline int
167HYPERVISOR_fpu_taskswitch(int set)
168{
169 return _hypercall1(int, fpu_taskswitch, set);
170}
171
172static inline int
173HYPERVISOR_sched_op(int cmd, unsigned long arg)
174{
175 return _hypercall2(int, sched_op, cmd, arg);
176}
177
178static inline long
179HYPERVISOR_set_timer_op(u64 timeout)
180{
181 unsigned long timeout_hi = (unsigned long)(timeout>>32);
182 unsigned long timeout_lo = (unsigned long)timeout;
183 return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
184}
185
186static inline int
187HYPERVISOR_set_debugreg(int reg, unsigned long value)
188{
189 return _hypercall2(int, set_debugreg, reg, value);
190}
191
192static inline unsigned long
193HYPERVISOR_get_debugreg(int reg)
194{
195 return _hypercall1(unsigned long, get_debugreg, reg);
196}
197
198static inline int
199HYPERVISOR_update_descriptor(u64 ma, u64 desc)
200{
201 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
202}
203
204static inline int
205HYPERVISOR_memory_op(unsigned int cmd, void *arg)
206{
207 return _hypercall2(int, memory_op, cmd, arg);
208}
209
210static inline int
211HYPERVISOR_multicall(void *call_list, int nr_calls)
212{
213 return _hypercall2(int, multicall, call_list, nr_calls);
214}
215
216static inline int
217HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
218 unsigned long flags)
219{
220 unsigned long pte_hi = 0;
221#ifdef CONFIG_X86_PAE
222 pte_hi = new_val.pte_high;
223#endif
224 return _hypercall4(int, update_va_mapping, va,
225 new_val.pte_low, pte_hi, flags);
226}
227
228static inline int
229HYPERVISOR_event_channel_op(int cmd, void *arg)
230{
231 int rc = _hypercall2(int, event_channel_op, cmd, arg);
232 if (unlikely(rc == -ENOSYS)) {
233 struct evtchn_op op;
234 op.cmd = cmd;
235 memcpy(&op.u, arg, sizeof(op.u));
236 rc = _hypercall1(int, event_channel_op_compat, &op);
237 memcpy(arg, &op.u, sizeof(op.u));
238 }
239 return rc;
240}
241
242static inline int
243HYPERVISOR_xen_version(int cmd, void *arg)
244{
245 return _hypercall2(int, xen_version, cmd, arg);
246}
247
248static inline int
249HYPERVISOR_console_io(int cmd, int count, char *str)
250{
251 return _hypercall3(int, console_io, cmd, count, str);
252}
253
254static inline int
255HYPERVISOR_physdev_op(int cmd, void *arg)
256{
257 int rc = _hypercall2(int, physdev_op, cmd, arg);
258 if (unlikely(rc == -ENOSYS)) {
259 struct physdev_op op;
260 op.cmd = cmd;
261 memcpy(&op.u, arg, sizeof(op.u));
262 rc = _hypercall1(int, physdev_op_compat, &op);
263 memcpy(arg, &op.u, sizeof(op.u));
264 }
265 return rc;
266}
267
268static inline int
269HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
270{
271 return _hypercall3(int, grant_table_op, cmd, uop, count);
272}
273
274static inline int
275HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
276 unsigned long flags, domid_t domid)
277{
278 unsigned long pte_hi = 0;
279#ifdef CONFIG_X86_PAE
280 pte_hi = new_val.pte_high;
281#endif
282 return _hypercall5(int, update_va_mapping_otherdomain, va,
283 new_val.pte_low, pte_hi, flags, domid);
284}
285
286static inline int
287HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
288{
289 return _hypercall2(int, vm_assist, cmd, type);
290}
291
292static inline int
293HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
294{
295 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
296}
297
298static inline int
299HYPERVISOR_suspend(unsigned long srec)
300{
301 return _hypercall3(int, sched_op, SCHEDOP_shutdown,
302 SHUTDOWN_suspend, srec);
303}
304
305static inline int
306HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
307{
308 return _hypercall2(int, nmi_op, op, arg);
309}
310
311static inline void
312MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
313 pte_t new_val, unsigned long flags)
314{
315 mcl->op = __HYPERVISOR_update_va_mapping;
316 mcl->args[0] = va;
317#ifdef CONFIG_X86_PAE
318 mcl->args[1] = new_val.pte_low;
319 mcl->args[2] = new_val.pte_high;
320#else
321 mcl->args[1] = new_val.pte_low;
322 mcl->args[2] = 0;
323#endif
324 mcl->args[3] = flags;
325}
326
327static inline void
328MULTI_grant_table_op(struct multicall_entry *mcl, unsigned int cmd,
329 void *uop, unsigned int count)
330{
331 mcl->op = __HYPERVISOR_grant_table_op;
332 mcl->args[0] = cmd;
333 mcl->args[1] = (unsigned long)uop;
334 mcl->args[2] = count;
335}
336
337static inline void
338MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long va,
339 pte_t new_val, unsigned long flags,
340 domid_t domid)
341{
342 mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
343 mcl->args[0] = va;
344#ifdef CONFIG_X86_PAE
345 mcl->args[1] = new_val.pte_low;
346 mcl->args[2] = new_val.pte_high;
347#else
348 mcl->args[1] = new_val.pte_low;
349 mcl->args[2] = 0;
350#endif
351 mcl->args[3] = flags;
352 mcl->args[4] = domid;
353}
354
355static inline void
356MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
357 struct desc_struct desc)
358{
359 mcl->op = __HYPERVISOR_update_descriptor;
360 mcl->args[0] = maddr;
361 mcl->args[1] = maddr >> 32;
362 mcl->args[2] = desc.a;
363 mcl->args[3] = desc.b;
364}
365
366static inline void
367MULTI_memory_op(struct multicall_entry *mcl, unsigned int cmd, void *arg)
368{
369 mcl->op = __HYPERVISOR_memory_op;
370 mcl->args[0] = cmd;
371 mcl->args[1] = (unsigned long)arg;
372}
373
374static inline void
375MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
376 int count, int *success_count, domid_t domid)
377{
378 mcl->op = __HYPERVISOR_mmu_update;
379 mcl->args[0] = (unsigned long)req;
380 mcl->args[1] = count;
381 mcl->args[2] = (unsigned long)success_count;
382 mcl->args[3] = domid;
383}
384
385static inline void
386MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
387 int *success_count, domid_t domid)
388{
389 mcl->op = __HYPERVISOR_mmuext_op;
390 mcl->args[0] = (unsigned long)op;
391 mcl->args[1] = count;
392 mcl->args[2] = (unsigned long)success_count;
393 mcl->args[3] = domid;
394}
395
396static inline void
397MULTI_set_gdt(struct multicall_entry *mcl, unsigned long *frames, int entries)
398{
399 mcl->op = __HYPERVISOR_set_gdt;
400 mcl->args[0] = (unsigned long)frames;
401 mcl->args[1] = entries;
402}
403
404static inline void
405MULTI_stack_switch(struct multicall_entry *mcl,
406 unsigned long ss, unsigned long esp)
407{
408 mcl->op = __HYPERVISOR_stack_switch;
409 mcl->args[0] = ss;
410 mcl->args[1] = esp;
411}
412
413#endif /* __HYPERCALL_H__ */
diff --git a/include/asm-i386/xen/hypervisor.h b/include/asm-i386/xen/hypervisor.h
new file mode 100644
index 000000000000..8e15dd28c91f
--- /dev/null
+++ b/include/asm-i386/xen/hypervisor.h
@@ -0,0 +1,73 @@
1/******************************************************************************
2 * hypervisor.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
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 version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __HYPERVISOR_H__
34#define __HYPERVISOR_H__
35
36#include <linux/types.h>
37#include <linux/kernel.h>
38#include <linux/version.h>
39
40#include <xen/interface/xen.h>
41#include <xen/interface/version.h>
42
43#include <asm/ptrace.h>
44#include <asm/page.h>
45#include <asm/desc.h>
46#if defined(__i386__)
47# ifdef CONFIG_X86_PAE
48# include <asm-generic/pgtable-nopud.h>
49# else
50# include <asm-generic/pgtable-nopmd.h>
51# endif
52#endif
53#include <asm/xen/hypercall.h>
54
55/* arch/i386/kernel/setup.c */
56extern struct shared_info *HYPERVISOR_shared_info;
57extern struct start_info *xen_start_info;
58#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
59
60/* arch/i386/mach-xen/evtchn.c */
61/* Force a proper event-channel callback from Xen. */
62extern void force_evtchn_callback(void);
63
64/* Turn jiffies into Xen system time. */
65u64 jiffies_to_st(unsigned long jiffies);
66
67
68#define MULTI_UVMFLAGS_INDEX 3
69#define MULTI_UVMDOMID_INDEX 4
70
71#define is_running_on_xen() (xen_start_info ? 1 : 0)
72
73#endif /* __HYPERVISOR_H__ */
diff --git a/include/asm-i386/xen/interface.h b/include/asm-i386/xen/interface.h
new file mode 100644
index 000000000000..165c3968e138
--- /dev/null
+++ b/include/asm-i386/xen/interface.h
@@ -0,0 +1,188 @@
1/******************************************************************************
2 * arch-x86_32.h
3 *
4 * Guest OS interface to x86 32-bit Xen.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
8
9#ifndef __XEN_PUBLIC_ARCH_X86_32_H__
10#define __XEN_PUBLIC_ARCH_X86_32_H__
11
12#ifdef __XEN__
13#define __DEFINE_GUEST_HANDLE(name, type) \
14 typedef struct { type *p; } __guest_handle_ ## name
15#else
16#define __DEFINE_GUEST_HANDLE(name, type) \
17 typedef type * __guest_handle_ ## name
18#endif
19
20#define DEFINE_GUEST_HANDLE_STRUCT(name) \
21 __DEFINE_GUEST_HANDLE(name, struct name)
22#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
23#define GUEST_HANDLE(name) __guest_handle_ ## name
24
25#ifndef __ASSEMBLY__
26/* Guest handles for primitive C types. */
27__DEFINE_GUEST_HANDLE(uchar, unsigned char);
28__DEFINE_GUEST_HANDLE(uint, unsigned int);
29__DEFINE_GUEST_HANDLE(ulong, unsigned long);
30DEFINE_GUEST_HANDLE(char);
31DEFINE_GUEST_HANDLE(int);
32DEFINE_GUEST_HANDLE(long);
33DEFINE_GUEST_HANDLE(void);
34#endif
35
36/*
37 * SEGMENT DESCRIPTOR TABLES
38 */
39/*
40 * A number of GDT entries are reserved by Xen. These are not situated at the
41 * start of the GDT because some stupid OSes export hard-coded selector values
42 * in their ABI. These hard-coded values are always near the start of the GDT,
43 * so Xen places itself out of the way, at the far end of the GDT.
44 */
45#define FIRST_RESERVED_GDT_PAGE 14
46#define FIRST_RESERVED_GDT_BYTE (FIRST_RESERVED_GDT_PAGE * 4096)
47#define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8)
48
49/*
50 * These flat segments are in the Xen-private section of every GDT. Since these
51 * are also present in the initial GDT, many OSes will be able to avoid
52 * installing their own GDT.
53 */
54#define FLAT_RING1_CS 0xe019 /* GDT index 259 */
55#define FLAT_RING1_DS 0xe021 /* GDT index 260 */
56#define FLAT_RING1_SS 0xe021 /* GDT index 260 */
57#define FLAT_RING3_CS 0xe02b /* GDT index 261 */
58#define FLAT_RING3_DS 0xe033 /* GDT index 262 */
59#define FLAT_RING3_SS 0xe033 /* GDT index 262 */
60
61#define FLAT_KERNEL_CS FLAT_RING1_CS
62#define FLAT_KERNEL_DS FLAT_RING1_DS
63#define FLAT_KERNEL_SS FLAT_RING1_SS
64#define FLAT_USER_CS FLAT_RING3_CS
65#define FLAT_USER_DS FLAT_RING3_DS
66#define FLAT_USER_SS FLAT_RING3_SS
67
68/* And the trap vector is... */
69#define TRAP_INSTR "int $0x82"
70
71/*
72 * Virtual addresses beyond this are not modifiable by guest OSes. The
73 * machine->physical mapping table starts at this address, read-only.
74 */
75#ifdef CONFIG_X86_PAE
76#define __HYPERVISOR_VIRT_START 0xF5800000
77#else
78#define __HYPERVISOR_VIRT_START 0xFC000000
79#endif
80
81#ifndef HYPERVISOR_VIRT_START
82#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
83#endif
84
85#ifndef machine_to_phys_mapping
86#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
87#endif
88
89/* Maximum number of virtual CPUs in multi-processor guests. */
90#define MAX_VIRT_CPUS 32
91
92#ifndef __ASSEMBLY__
93
94/*
95 * Send an array of these to HYPERVISOR_set_trap_table()
96 */
97#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
98#define TI_GET_IF(_ti) ((_ti)->flags & 4)
99#define TI_SET_DPL(_ti, _dpl) ((_ti)->flags |= (_dpl))
100#define TI_SET_IF(_ti, _if) ((_ti)->flags |= ((!!(_if))<<2))
101
102struct trap_info {
103 uint8_t vector; /* exception vector */
104 uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */
105 uint16_t cs; /* code selector */
106 unsigned long address; /* code offset */
107};
108DEFINE_GUEST_HANDLE_STRUCT(trap_info);
109
110struct cpu_user_regs {
111 uint32_t ebx;
112 uint32_t ecx;
113 uint32_t edx;
114 uint32_t esi;
115 uint32_t edi;
116 uint32_t ebp;
117 uint32_t eax;
118 uint16_t error_code; /* private */
119 uint16_t entry_vector; /* private */
120 uint32_t eip;
121 uint16_t cs;
122 uint8_t saved_upcall_mask;
123 uint8_t _pad0;
124 uint32_t eflags; /* eflags.IF == !saved_upcall_mask */
125 uint32_t esp;
126 uint16_t ss, _pad1;
127 uint16_t es, _pad2;
128 uint16_t ds, _pad3;
129 uint16_t fs, _pad4;
130 uint16_t gs, _pad5;
131};
132DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
133
134typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
135
136/*
137 * The following is all CPU context. Note that the fpu_ctxt block is filled
138 * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
139 */
140struct vcpu_guest_context {
141 /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
142 struct { char x[512]; } fpu_ctxt; /* User-level FPU registers */
143#define VGCF_I387_VALID (1<<0)
144#define VGCF_HVM_GUEST (1<<1)
145#define VGCF_IN_KERNEL (1<<2)
146 unsigned long flags; /* VGCF_* flags */
147 struct cpu_user_regs user_regs; /* User-level CPU registers */
148 struct trap_info trap_ctxt[256]; /* Virtual IDT */
149 unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
150 unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
151 unsigned long kernel_ss, kernel_sp; /* Virtual TSS (only SS1/SP1) */
152 unsigned long ctrlreg[8]; /* CR0-CR7 (control registers) */
153 unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
154 unsigned long event_callback_cs; /* CS:EIP of event callback */
155 unsigned long event_callback_eip;
156 unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
157 unsigned long failsafe_callback_eip;
158 unsigned long vm_assist; /* VMASST_TYPE_* bitmap */
159};
160DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context);
161
162struct arch_shared_info {
163 unsigned long max_pfn; /* max pfn that appears in table */
164 /* Frame containing list of mfns containing list of mfns containing p2m. */
165 unsigned long pfn_to_mfn_frame_list_list;
166 unsigned long nmi_reason;
167};
168
169struct arch_vcpu_info {
170 unsigned long cr2;
171 unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */
172};
173
174#endif /* !__ASSEMBLY__ */
175
176/*
177 * Prefix forces emulation of some non-trapping instructions.
178 * Currently only CPUID.
179 */
180#ifdef __ASSEMBLY__
181#define XEN_EMULATE_PREFIX .byte 0x0f,0x0b,0x78,0x65,0x6e ;
182#define XEN_CPUID XEN_EMULATE_PREFIX cpuid
183#else
184#define XEN_EMULATE_PREFIX ".byte 0x0f,0x0b,0x78,0x65,0x6e ; "
185#define XEN_CPUID XEN_EMULATE_PREFIX "cpuid"
186#endif
187
188#endif
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h
index 40d01d80610d..0f6e5264ab8f 100644
--- a/include/asm-ia64/compat.h
+++ b/include/asm-ia64/compat.h
@@ -31,8 +31,10 @@ typedef s32 compat_timer_t;
31 31
32typedef s32 compat_int_t; 32typedef s32 compat_int_t;
33typedef s32 compat_long_t; 33typedef s32 compat_long_t;
34typedef s64 __attribute__((aligned(4))) compat_s64;
34typedef u32 compat_uint_t; 35typedef u32 compat_uint_t;
35typedef u32 compat_ulong_t; 36typedef u32 compat_ulong_t;
37typedef u64 __attribute__((aligned(4))) compat_u64;
36 38
37struct compat_timespec { 39struct compat_timespec {
38 compat_time_t tv_sec; 40 compat_time_t tv_sec;
diff --git a/include/asm-ia64/fb.h b/include/asm-ia64/fb.h
new file mode 100644
index 000000000000..89a397cee90a
--- /dev/null
+++ b/include/asm-ia64/fb.h
@@ -0,0 +1,23 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <linux/efi.h>
7#include <asm/page.h>
8
9static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
10 unsigned long off)
11{
12 if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
13 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
14 else
15 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
16}
17
18static inline int fb_is_primary_device(struct fb_info *info)
19{
20 return 0;
21}
22
23#endif /* _ASM_FB_H_ */
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index c054d7a9aaa7..efa1b8f7251d 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -90,13 +90,27 @@ enum {
90extern __u8 isa_irq_to_vector_map[16]; 90extern __u8 isa_irq_to_vector_map[16];
91#define isa_irq_to_vector(x) isa_irq_to_vector_map[(x)] 91#define isa_irq_to_vector(x) isa_irq_to_vector_map[(x)]
92 92
93struct irq_cfg {
94 ia64_vector vector;
95 cpumask_t domain;
96};
97extern spinlock_t vector_lock;
98extern struct irq_cfg irq_cfg[NR_IRQS];
99#define irq_to_domain(x) irq_cfg[(x)].domain
100DECLARE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq);
101
93extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ 102extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */
94 103
104extern int bind_irq_vector(int irq, int vector, cpumask_t domain);
95extern int assign_irq_vector (int irq); /* allocate a free vector */ 105extern int assign_irq_vector (int irq); /* allocate a free vector */
96extern void free_irq_vector (int vector); 106extern void free_irq_vector (int vector);
97extern int reserve_irq_vector (int vector); 107extern int reserve_irq_vector (int vector);
108extern void __setup_vector_irq(int cpu);
109extern int reassign_irq_vector(int irq, int cpu);
98extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); 110extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect);
99extern void register_percpu_irq (ia64_vector vec, struct irqaction *action); 111extern void register_percpu_irq (ia64_vector vec, struct irqaction *action);
112extern int check_irq_used (int irq);
113extern void destroy_and_reserve_irq (unsigned int irq);
100 114
101static inline void ia64_resend_irq(unsigned int vector) 115static inline void ia64_resend_irq(unsigned int vector)
102{ 116{
@@ -113,7 +127,7 @@ extern irq_desc_t irq_desc[NR_IRQS];
113static inline unsigned int 127static inline unsigned int
114__ia64_local_vector_to_irq (ia64_vector vec) 128__ia64_local_vector_to_irq (ia64_vector vec)
115{ 129{
116 return (unsigned int) vec; 130 return __get_cpu_var(vector_irq)[vec];
117} 131}
118#endif 132#endif
119 133
@@ -131,7 +145,7 @@ __ia64_local_vector_to_irq (ia64_vector vec)
131static inline ia64_vector 145static inline ia64_vector
132irq_to_vector (int irq) 146irq_to_vector (int irq)
133{ 147{
134 return (ia64_vector) irq; 148 return irq_cfg[irq].vector;
135} 149}
136 150
137/* 151/*
diff --git a/include/asm-ia64/ioctls.h b/include/asm-ia64/ioctls.h
index 31ee521aeb7a..f41b636a0bf6 100644
--- a/include/asm-ia64/ioctls.h
+++ b/include/asm-ia64/ioctls.h
@@ -53,6 +53,10 @@
53#define TIOCSBRK 0x5427 /* BSD compatibility */ 53#define TIOCSBRK 0x5427 /* BSD compatibility */
54#define TIOCCBRK 0x5428 /* BSD compatibility */ 54#define TIOCCBRK 0x5428 /* BSD compatibility */
55#define TIOCGSID 0x5429 /* Return the session ID of FD */ 55#define TIOCGSID 0x5429 /* Return the session ID of FD */
56#define TCGETS2 _IOR('T',0x2A, struct termios2)
57#define TCSETS2 _IOW('T',0x2B, struct termios2)
58#define TCSETSW2 _IOW('T',0x2C, struct termios2)
59#define TCSETSF2 _IOW('T',0x2D, struct termios2)
56#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 60#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
57#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 61#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
58 62
diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h
index 421cb6b62a7c..b8f712859140 100644
--- a/include/asm-ia64/iosapic.h
+++ b/include/asm-ia64/iosapic.h
@@ -47,19 +47,21 @@
47#define IOSAPIC_MASK_SHIFT 16 47#define IOSAPIC_MASK_SHIFT 16
48#define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT) 48#define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT)
49 49
50#define IOSAPIC_VECTOR_MASK 0xffffff00
51
50#ifndef __ASSEMBLY__ 52#ifndef __ASSEMBLY__
51 53
52#ifdef CONFIG_IOSAPIC 54#ifdef CONFIG_IOSAPIC
53 55
54#define NR_IOSAPICS 256 56#define NR_IOSAPICS 256
55 57
56static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg) 58static inline unsigned int __iosapic_read(char __iomem *iosapic, unsigned int reg)
57{ 59{
58 writel(reg, iosapic + IOSAPIC_REG_SELECT); 60 writel(reg, iosapic + IOSAPIC_REG_SELECT);
59 return readl(iosapic + IOSAPIC_WINDOW); 61 return readl(iosapic + IOSAPIC_WINDOW);
60} 62}
61 63
62static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val) 64static inline void __iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
63{ 65{
64 writel(reg, iosapic + IOSAPIC_REG_SELECT); 66 writel(reg, iosapic + IOSAPIC_REG_SELECT);
65 writel(val, iosapic + IOSAPIC_WINDOW); 67 writel(val, iosapic + IOSAPIC_WINDOW);
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index 67221615e317..35b360b82e43 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -14,8 +14,13 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/cpumask.h> 15#include <linux/cpumask.h>
16 16
17#define NR_IRQS 256 17#define NR_VECTORS 256
18#define NR_IRQ_VECTORS NR_IRQS 18
19#if (NR_VECTORS + 32 * NR_CPUS) < 1024
20#define NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
21#else
22#define NR_IRQS 1024
23#endif
19 24
20static __inline__ int 25static __inline__ int
21irq_canonicalize (int irq) 26irq_canonicalize (int irq)
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 6382e52ec227..067d9dea68f9 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -82,8 +82,6 @@ struct kprobe_ctlblk {
82 struct prev_kprobe prev_kprobe[ARCH_PREV_KPROBE_SZ]; 82 struct prev_kprobe prev_kprobe[ARCH_PREV_KPROBE_SZ];
83}; 83};
84 84
85#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
86
87#define ARCH_SUPPORTS_KRETPROBES 85#define ARCH_SUPPORTS_KRETPROBES
88#define ARCH_INACTIVE_KPROBE_COUNT 1 86#define ARCH_INACTIVE_KPROBE_COUNT 1
89 87
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 485759ba9e36..d6345464a2b3 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -87,12 +87,13 @@ do { \
87} while (0) 87} while (0)
88 88
89 89
90#define alloc_zeroed_user_highpage(vma, vaddr) \ 90#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
91({ \ 91({ \
92 struct page *page = alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr); \ 92 struct page *page = alloc_page_vma( \
93 if (page) \ 93 GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr); \
94 flush_dcache_page(page); \ 94 if (page) \
95 page; \ 95 flush_dcache_page(page); \
96 page; \
96}) 97})
97 98
98#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 99#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
index fbe5cf3ab8dc..43a7aac414e0 100644
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -29,6 +29,16 @@
29 __attribute__((__section__(".data.percpu"))) \ 29 __attribute__((__section__(".data.percpu"))) \
30 __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name 30 __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name
31 31
32#ifdef CONFIG_SMP
33#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
34 __attribute__((__section__(".data.percpu.shared_aligned"))) \
35 __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name \
36 ____cacheline_aligned_in_smp
37#else
38#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
39 DEFINE_PER_CPU(type, name)
40#endif
41
32/* 42/*
33 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an 43 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
34 * external routine, to avoid include-hell. 44 * external routine, to avoid include-hell.
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 6580f31b3135..de6d01e24dd0 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -297,8 +297,6 @@ ia64_phys_addr_valid (unsigned long addr)
297/* 297/*
298 * The following have defined behavior only work if pte_present() is true. 298 * The following have defined behavior only work if pte_present() is true.
299 */ 299 */
300#define pte_user(pte) ((pte_val(pte) & _PAGE_PL_MASK) == _PAGE_PL_3)
301#define pte_read(pte) (((pte_val(pte) & _PAGE_AR_MASK) >> _PAGE_AR_SHIFT) < 6)
302#define pte_write(pte) ((unsigned) (((pte_val(pte) & _PAGE_AR_MASK) >> _PAGE_AR_SHIFT) - 2) <= 4) 300#define pte_write(pte) ((unsigned) (((pte_val(pte) & _PAGE_AR_MASK) >> _PAGE_AR_SHIFT) - 2) <= 4)
303#define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0) 301#define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0)
304#define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0) 302#define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0)
@@ -310,7 +308,6 @@ ia64_phys_addr_valid (unsigned long addr)
310 */ 308 */
311#define pte_wrprotect(pte) (__pte(pte_val(pte) & ~_PAGE_AR_RW)) 309#define pte_wrprotect(pte) (__pte(pte_val(pte) & ~_PAGE_AR_RW))
312#define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_AR_RW)) 310#define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_AR_RW))
313#define pte_mkexec(pte) (__pte(pte_val(pte) | _PAGE_AR_RX))
314#define pte_mkold(pte) (__pte(pte_val(pte) & ~_PAGE_A)) 311#define pte_mkold(pte) (__pte(pte_val(pte) & ~_PAGE_A))
315#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) 312#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A))
316#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) 313#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D))
@@ -398,22 +395,6 @@ ptep_test_and_clear_young (struct vm_area_struct *vma, unsigned long addr, pte_t
398#endif 395#endif
399} 396}
400 397
401static inline int
402ptep_test_and_clear_dirty (struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
403{
404#ifdef CONFIG_SMP
405 if (!pte_dirty(*ptep))
406 return 0;
407 return test_and_clear_bit(_PAGE_D_BIT, ptep);
408#else
409 pte_t pte = *ptep;
410 if (!pte_dirty(pte))
411 return 0;
412 set_pte_at(vma->vm_mm, addr, ptep, pte_mkclean(pte));
413 return 1;
414#endif
415}
416
417static inline pte_t 398static inline pte_t
418ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 399ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
419{ 400{
@@ -546,8 +527,10 @@ extern void lazy_mmu_prot_update (pte_t pte);
546# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \ 527# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
547({ \ 528({ \
548 int __changed = !pte_same(*(__ptep), __entry); \ 529 int __changed = !pte_same(*(__ptep), __entry); \
549 if (__changed) \ 530 if (__changed) { \
550 ptep_establish(__vma, __addr, __ptep, __entry); \ 531 set_pte_at((__vma)->vm_mm, (__addr), __ptep, __entry); \
532 flush_tlb_page(__vma, __addr); \
533 } \
551 __changed; \ 534 __changed; \
552}) 535})
553#endif 536#endif
@@ -591,7 +574,6 @@ extern void lazy_mmu_prot_update (pte_t pte);
591#endif 574#endif
592 575
593#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 576#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
594#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
595#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 577#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
596#define __HAVE_ARCH_PTEP_SET_WRPROTECT 578#define __HAVE_ARCH_PTEP_SET_WRPROTECT
597#define __HAVE_ARCH_PTE_SAME 579#define __HAVE_ARCH_PTE_SAME
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index db81ba406cef..6251c76437d2 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -295,9 +295,9 @@ struct thread_struct {
295 regs->ar_bspstore = current->thread.rbs_bot; \ 295 regs->ar_bspstore = current->thread.rbs_bot; \
296 regs->ar_fpsr = FPSR_DEFAULT; \ 296 regs->ar_fpsr = FPSR_DEFAULT; \
297 regs->loadrs = 0; \ 297 regs->loadrs = 0; \
298 regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \ 298 regs->r8 = get_dumpable(current->mm); /* set "don't zap registers" flag */ \
299 regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \ 299 regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \
300 if (unlikely(!current->mm->dumpable)) { \ 300 if (unlikely(!get_dumpable(current->mm))) { \
301 /* \ 301 /* \
302 * Zap scratch regs to avoid leaking bits between processes with different \ 302 * Zap scratch regs to avoid leaking bits between processes with different \
303 * uid/privileges. \ 303 * uid/privileges. \
diff --git a/include/asm-ia64/rwsem.h b/include/asm-ia64/rwsem.h
index 2d1640cc240a..8aba06a7b038 100644
--- a/include/asm-ia64/rwsem.h
+++ b/include/asm-ia64/rwsem.h
@@ -21,6 +21,10 @@
21#ifndef _ASM_IA64_RWSEM_H 21#ifndef _ASM_IA64_RWSEM_H
22#define _ASM_IA64_RWSEM_H 22#define _ASM_IA64_RWSEM_H
23 23
24#ifndef _LINUX_RWSEM_H
25#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
26#endif
27
24#include <linux/list.h> 28#include <linux/list.h>
25#include <linux/spinlock.h> 29#include <linux/spinlock.h>
26 30
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 384fbf7f2a0f..91bb8e00066c 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -259,7 +259,6 @@ extern void ia64_load_extra (struct task_struct *task);
259#define ia64_platform_is(x) (strcmp(x, platform_name) == 0) 259#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
260 260
261void cpu_idle_wait(void); 261void cpu_idle_wait(void);
262void sched_cacheflush(void);
263 262
264#define arch_align_stack(x) (x) 263#define arch_align_stack(x) (x)
265 264
diff --git a/include/asm-ia64/termbits.h b/include/asm-ia64/termbits.h
index 7fae3109ef47..9f162e0089ad 100644
--- a/include/asm-ia64/termbits.h
+++ b/include/asm-ia64/termbits.h
@@ -149,6 +149,7 @@ struct ktermios {
149#define HUPCL 0002000 149#define HUPCL 0002000
150#define CLOCAL 0004000 150#define CLOCAL 0004000
151#define CBAUDEX 0010000 151#define CBAUDEX 0010000
152#define BOTHER 0010000
152#define B57600 0010001 153#define B57600 0010001
153#define B115200 0010002 154#define B115200 0010002
154#define B230400 0010003 155#define B230400 0010003
@@ -164,10 +165,12 @@ struct ktermios {
164#define B3000000 0010015 165#define B3000000 0010015
165#define B3500000 0010016 166#define B3500000 0010016
166#define B4000000 0010017 167#define B4000000 0010017
167#define CIBAUD 002003600000 /* input baud rate (not used) */ 168#define CIBAUD 002003600000 /* input baud rate */
168#define CMSPAR 010000000000 /* mark or space (stick) parity */ 169#define CMSPAR 010000000000 /* mark or space (stick) parity */
169#define CRTSCTS 020000000000 /* flow control */ 170#define CRTSCTS 020000000000 /* flow control */
170 171
172#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
173
171/* c_lflag bits */ 174/* c_lflag bits */
172#define ISIG 0000001 175#define ISIG 0000001
173#define ICANON 0000002 176#define ICANON 0000002
diff --git a/include/asm-ia64/termios.h b/include/asm-ia64/termios.h
index 08750c2d3607..689d218c0c28 100644
--- a/include/asm-ia64/termios.h
+++ b/include/asm-ia64/termios.h
@@ -87,8 +87,10 @@ struct termio {
87 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 87 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
88}) 88})
89 89
90#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 90#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
91#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 91#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
92#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
93#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
92 94
93# endif /* __KERNEL__ */ 95# endif /* __KERNEL__ */
94 96
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 441c9e001776..315f8de950a2 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -292,7 +292,7 @@
292#define __NR_sync_file_range 1300 292#define __NR_sync_file_range 1300
293#define __NR_tee 1301 293#define __NR_tee 1301
294#define __NR_vmsplice 1302 294#define __NR_vmsplice 1302
295/* 1303 reserved for move_pages */ 295#define __NR_fallocate 1303
296#define __NR_getcpu 1304 296#define __NR_getcpu 1304
297#define __NR_epoll_pwait 1305 297#define __NR_epoll_pwait 1305
298#define __NR_utimensat 1306 298#define __NR_utimensat 1306
diff --git a/include/asm-ia64/ustack.h b/include/asm-ia64/ustack.h
index a349467913ea..504167c35b8b 100644
--- a/include/asm-ia64/ustack.h
+++ b/include/asm-ia64/ustack.h
@@ -11,6 +11,7 @@
11/* The absolute hard limit for stack size is 1/2 of the mappable space in the region */ 11/* The absolute hard limit for stack size is 1/2 of the mappable space in the region */
12#define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2) 12#define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2)
13#define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT) 13#define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT)
14#define STACK_TOP_MAX STACK_TOP
14#endif 15#endif
15 16
16/* Make a default stack size of 2GiB */ 17/* Make a default stack size of 2GiB */
diff --git a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h
index 9a4a5d20160a..6a1b5d42f328 100644
--- a/include/asm-m32r/a.out.h
+++ b/include/asm-m32r/a.out.h
@@ -20,6 +20,7 @@ struct exec
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#define STACK_TOP TASK_SIZE 22#define STACK_TOP TASK_SIZE
23#define STACK_TOP_MAX STACK_TOP
23 24
24#endif 25#endif
25 26
diff --git a/include/asm-m32r/dma-mapping.h b/include/asm-m32r/dma-mapping.h
deleted file mode 100644
index f9b58ebba361..000000000000
--- a/include/asm-m32r/dma-mapping.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_DMA_MAPPING_H
2#define _ASM_M32R_DMA_MAPPING_H
3
4#include <asm-generic/dma-mapping-broken.h>
5
6#endif /* _ASM_M32R_DMA_MAPPING_H */
diff --git a/include/asm-m32r/fb.h b/include/asm-m32r/fb.h
new file mode 100644
index 000000000000..d92e99cd8c8a
--- /dev/null
+++ b/include/asm-m32r/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m32r/ioctls.h b/include/asm-m32r/ioctls.h
index d23cfc45738a..b9f54bb5d7cf 100644
--- a/include/asm-m32r/ioctls.h
+++ b/include/asm-m32r/ioctls.h
@@ -47,6 +47,10 @@
47#define TIOCSBRK 0x5427 /* BSD compatibility */ 47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */ 48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */ 49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52 56
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 6f6ecf7d14a3..04fd183a2c58 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -15,7 +15,8 @@ extern void copy_page(void *to, void *from);
15#define clear_user_page(page, vaddr, pg) clear_page(page) 15#define clear_user_page(page, vaddr, pg) clear_page(page)
16#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 16#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
17 17
18#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 18#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
19 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
19#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 20#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
20 21
21/* 22/*
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
index 6604303fc47c..92d7266783fd 100644
--- a/include/asm-m32r/pgtable.h
+++ b/include/asm-m32r/pgtable.h
@@ -191,16 +191,6 @@ extern unsigned long empty_zero_page[1024];
191 * The following only work if pte_present() is true. 191 * The following only work if pte_present() is true.
192 * Undefined behaviour if not.. 192 * Undefined behaviour if not..
193 */ 193 */
194static inline int pte_read(pte_t pte)
195{
196 return pte_val(pte) & _PAGE_READ;
197}
198
199static inline int pte_exec(pte_t pte)
200{
201 return pte_val(pte) & _PAGE_EXEC;
202}
203
204static inline int pte_dirty(pte_t pte) 194static inline int pte_dirty(pte_t pte)
205{ 195{
206 return pte_val(pte) & _PAGE_DIRTY; 196 return pte_val(pte) & _PAGE_DIRTY;
@@ -224,18 +214,6 @@ static inline int pte_file(pte_t pte)
224 return pte_val(pte) & _PAGE_FILE; 214 return pte_val(pte) & _PAGE_FILE;
225} 215}
226 216
227static inline pte_t pte_rdprotect(pte_t pte)
228{
229 pte_val(pte) &= ~_PAGE_READ;
230 return pte;
231}
232
233static inline pte_t pte_exprotect(pte_t pte)
234{
235 pte_val(pte) &= ~_PAGE_EXEC;
236 return pte;
237}
238
239static inline pte_t pte_mkclean(pte_t pte) 217static inline pte_t pte_mkclean(pte_t pte)
240{ 218{
241 pte_val(pte) &= ~_PAGE_DIRTY; 219 pte_val(pte) &= ~_PAGE_DIRTY;
@@ -254,18 +232,6 @@ static inline pte_t pte_wrprotect(pte_t pte)
254 return pte; 232 return pte;
255} 233}
256 234
257static inline pte_t pte_mkread(pte_t pte)
258{
259 pte_val(pte) |= _PAGE_READ;
260 return pte;
261}
262
263static inline pte_t pte_mkexec(pte_t pte)
264{
265 pte_val(pte) |= _PAGE_EXEC;
266 return pte;
267}
268
269static inline pte_t pte_mkdirty(pte_t pte) 235static inline pte_t pte_mkdirty(pte_t pte)
270{ 236{
271 pte_val(pte) |= _PAGE_DIRTY; 237 pte_val(pte) |= _PAGE_DIRTY;
@@ -284,11 +250,6 @@ static inline pte_t pte_mkwrite(pte_t pte)
284 return pte; 250 return pte;
285} 251}
286 252
287static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
288{
289 return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep);
290}
291
292static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 253static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
293{ 254{
294 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); 255 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
@@ -382,7 +343,6 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
382 remap_pfn_range(vma, vaddr, pfn, size, prot) 343 remap_pfn_range(vma, vaddr, pfn, size, prot)
383 344
384#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 345#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
385#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
386#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 346#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
387#define __HAVE_ARCH_PTEP_SET_WRPROTECT 347#define __HAVE_ARCH_PTEP_SET_WRPROTECT
388#define __HAVE_ARCH_PTE_SAME 348#define __HAVE_ARCH_PTE_SAME
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 8ee73d3f316d..2365de5c2955 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -54,16 +54,6 @@
54 ); \ 54 ); \
55} while(0) 55} while(0)
56 56
57/*
58 * On SMP systems, when the scheduler does migration-cost autodetection,
59 * it needs a way to flush as much of the CPU's caches as possible.
60 *
61 * TODO: fill this in!
62 */
63static inline void sched_cacheflush(void)
64{
65}
66
67/* Interrupt Control */ 57/* Interrupt Control */
68#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104) 58#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
69#define local_irq_enable() \ 59#define local_irq_enable() \
diff --git a/include/asm-m32r/termbits.h b/include/asm-m32r/termbits.h
index 6be3b8a39841..bc104008b55b 100644
--- a/include/asm-m32r/termbits.h
+++ b/include/asm-m32r/termbits.h
@@ -140,6 +140,7 @@ struct ktermios {
140#define HUPCL 0002000 140#define HUPCL 0002000
141#define CLOCAL 0004000 141#define CLOCAL 0004000
142#define CBAUDEX 0010000 142#define CBAUDEX 0010000
143#define BOTHER 0010000
143#define B57600 0010001 144#define B57600 0010001
144#define B115200 0010002 145#define B115200 0010002
145#define B230400 0010003 146#define B230400 0010003
@@ -155,11 +156,13 @@ struct ktermios {
155#define B3000000 0010015 156#define B3000000 0010015
156#define B3500000 0010016 157#define B3500000 0010016
157#define B4000000 0010017 158#define B4000000 0010017
158#define CIBAUD 002003600000 /* input baud rate (not used) */ 159#define CIBAUD 002003600000 /** input baud rate */
159#define CTVB 004000000000 /* VisioBraille Terminal flow control */ 160#define CTVB 004000000000 /* VisioBraille Terminal flow control */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */ 161#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */ 162#define CRTSCTS 020000000000 /* flow control */
162 163
164#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
165
163/* c_lflag bits */ 166/* c_lflag bits */
164#define ISIG 0000001 167#define ISIG 0000001
165#define ICANON 0000002 168#define ICANON 0000002
diff --git a/include/asm-m32r/termios.h b/include/asm-m32r/termios.h
index 4943dd8db44d..93ce79fd342a 100644
--- a/include/asm-m32r/termios.h
+++ b/include/asm-m32r/termios.h
@@ -81,8 +81,10 @@ struct termio {
81 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 81 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
82}) 82})
83 83
84#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 84#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
85#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 85#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
86#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
87#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
86 88
87#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
88 90
diff --git a/include/asm-m68k/a.out.h b/include/asm-m68k/a.out.h
index eda1662773b8..6fc86a221a94 100644
--- a/include/asm-m68k/a.out.h
+++ b/include/asm-m68k/a.out.h
@@ -20,6 +20,7 @@ struct exec
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#define STACK_TOP TASK_SIZE 22#define STACK_TOP TASK_SIZE
23#define STACK_TOP_MAX STACK_TOP
23 24
24#endif 25#endif
25 26
diff --git a/include/asm-m68k/atari_SLM.h b/include/asm-m68k/atari_SLM.h
deleted file mode 100644
index 42f4fcdd8bc7..000000000000
--- a/include/asm-m68k/atari_SLM.h
+++ /dev/null
@@ -1,28 +0,0 @@
1
2#ifndef _ATARI_SLM_H
3#define _ATARI_SLM_H
4
5/* Atari SLM laser printer specific ioctls */
6
7#define SLMIOGSTAT 0xa100
8#define SLMIOGPSIZE 0xa101
9#define SLMIOGMFEED 0xa102
10
11#define SLMIORESET 0xa140
12
13#define SLMIOSPSIZE 0xa181
14#define SLMIOSMFEED 0xa182
15
16/* Status returning structure (SLMIOGSTAT) */
17struct SLM_status {
18 int stat; /* numeric status code */
19 char str[40]; /* status string */
20};
21
22/* Paper size structure (SLMIO[GS]PSIZE) */
23struct SLM_paper_size {
24 int width;
25 int height;
26};
27
28#endif /* _ATARI_SLM_H */
diff --git a/include/asm-m68k/atari_acsi.h b/include/asm-m68k/atari_acsi.h
deleted file mode 100644
index 10fea68f191a..000000000000
--- a/include/asm-m68k/atari_acsi.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _ASM_ATARI_ACSI_H
2#define _ASM_ATARI_ACSI_H
3
4/* Functions exported by drivers/block/acsi.c */
5
6void acsi_delay_start( void );
7void acsi_delay_end( long usec );
8int acsi_wait_for_IRQ( unsigned timeout );
9int acsi_wait_for_noIRQ( unsigned timeout );
10int acsicmd_nodma( const char *cmd, int enable);
11int acsi_getstatus( void );
12int acsi_extstatus( char *buffer, int cnt );
13void acsi_end_extstatus( void );
14int acsi_extcmd( unsigned char *buffer, int cnt );
15
16/* The ACSI buffer is guarantueed to reside in ST-RAM and may be used by other
17 * drivers that work on the ACSI bus, too. It's data are valid only as long as
18 * the ST-DMA is locked. */
19extern char *acsi_buffer;
20extern unsigned long phys_acsi_buffer;
21
22/* Utility macros */
23
24/* Send one data byte over the bus and set mode for next operation
25 * with one move.l -- Atari recommends this...
26 */
27
28#define DMA_LONG_WRITE(data,mode) \
29 do { \
30 *((unsigned long *)&dma_wd.fdc_acces_seccount) = \
31 ((data)<<16) | (mode); \
32 } while(0)
33
34#define ENABLE_IRQ() atari_turnon_irq( IRQ_MFP_ACSI )
35#define DISABLE_IRQ() atari_turnoff_irq( IRQ_MFP_ACSI )
36
37#endif /* _ASM_ATARI_ACSI_H */
diff --git a/include/asm-m68k/fb.h b/include/asm-m68k/fb.h
new file mode 100644
index 000000000000..380b97ae8157
--- /dev/null
+++ b/include/asm-m68k/fb.h
@@ -0,0 +1,34 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7#include <asm/setup.h>
8
9#ifdef CONFIG_SUN3
10static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
11 unsigned long off)
12{
13 pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
14}
15#else
16static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
17 unsigned long off)
18{
19 if (CPU_IS_020_OR_030)
20 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
21 if (CPU_IS_040_OR_060) {
22 pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
23 /* Use no-cache mode, serialized */
24 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
25 }
26}
27#endif /* CONFIG_SUN3 */
28
29static inline int fb_is_primary_device(struct fb_info *info)
30{
31 return 0;
32}
33
34#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 5e0fcf41804d..47bb9cf107b7 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -27,6 +27,7 @@
27#include <asm/raw_io.h> 27#include <asm/raw_io.h>
28#include <asm/virtconvert.h> 28#include <asm/virtconvert.h>
29 29
30#include <asm-generic/iomap.h>
30 31
31#ifdef CONFIG_ATARI 32#ifdef CONFIG_ATARI
32#include <asm/atarihw.h> 33#include <asm/atarihw.h>
@@ -152,6 +153,16 @@ static inline u16 __iomem *isa_itw(unsigned long addr)
152 default: return NULL; /* avoid warnings, just in case */ 153 default: return NULL; /* avoid warnings, just in case */
153 } 154 }
154} 155}
156static inline u32 __iomem *isa_itl(unsigned long addr)
157{
158 switch(ISA_TYPE)
159 {
160#ifdef CONFIG_AMIGA_PCMCIA
161 case AG_ISA: return (u32 __iomem *)AG_ISA_IO_W(addr);
162#endif
163 default: return 0; /* avoid warnings, just in case */
164 }
165}
155static inline u8 __iomem *isa_mtb(unsigned long addr) 166static inline u8 __iomem *isa_mtb(unsigned long addr)
156{ 167{
157 switch(ISA_TYPE) 168 switch(ISA_TYPE)
@@ -188,8 +199,10 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
188 199
189#define isa_inb(port) in_8(isa_itb(port)) 200#define isa_inb(port) in_8(isa_itb(port))
190#define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port))) 201#define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
202#define isa_inl(port) (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
191#define isa_outb(val,port) out_8(isa_itb(port),(val)) 203#define isa_outb(val,port) out_8(isa_itb(port),(val))
192#define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) 204#define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
205#define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
193 206
194#define isa_readb(p) in_8(isa_mtb((unsigned long)(p))) 207#define isa_readb(p) in_8(isa_mtb((unsigned long)(p)))
195#define isa_readw(p) \ 208#define isa_readw(p) \
@@ -234,6 +247,15 @@ static inline void isa_delay(void)
234#define isa_outsw(port, buf, nr) \ 247#define isa_outsw(port, buf, nr) \
235 (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ 248 (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \
236 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) 249 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
250
251#define isa_insl(port, buf, nr) \
252 (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) : \
253 raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
254
255#define isa_outsl(port, buf, nr) \
256 (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \
257 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
258
237#endif /* CONFIG_ISA */ 259#endif /* CONFIG_ISA */
238 260
239 261
@@ -246,14 +268,16 @@ static inline void isa_delay(void)
246#define inw_p isa_inw_p 268#define inw_p isa_inw_p
247#define outw isa_outw 269#define outw isa_outw
248#define outw_p isa_outw_p 270#define outw_p isa_outw_p
249#define inl isa_inw 271#define inl isa_inl
250#define inl_p isa_inw_p 272#define inl_p isa_inl_p
251#define outl isa_outw 273#define outl isa_outl
252#define outl_p isa_outw_p 274#define outl_p isa_outl_p
253#define insb isa_insb 275#define insb isa_insb
254#define insw isa_insw 276#define insw isa_insw
277#define insl isa_insl
255#define outsb isa_outsb 278#define outsb isa_outsb
256#define outsw isa_outsw 279#define outsw isa_outsw
280#define outsl isa_outsl
257#define readb isa_readb 281#define readb isa_readb
258#define readw isa_readw 282#define readw isa_readw
259#define writeb isa_writeb 283#define writeb isa_writeb
@@ -262,8 +286,6 @@ static inline void isa_delay(void)
262 286
263#if defined(CONFIG_PCI) 287#if defined(CONFIG_PCI)
264 288
265#define inl(port) in_le32(port)
266#define outl(val,port) out_le32((port),(val))
267#define readl(addr) in_le32(addr) 289#define readl(addr) in_le32(addr)
268#define writel(val,addr) out_le32((addr),(val)) 290#define writel(val,addr) out_le32((addr),(val))
269 291
@@ -282,6 +304,8 @@ static inline void isa_delay(void)
282#define outb(val,port) out_8((port),(val)) 304#define outb(val,port) out_8((port),(val))
283#define inw(port) in_le16(port) 305#define inw(port) in_le16(port)
284#define outw(val,port) out_le16((port),(val)) 306#define outw(val,port) out_le16((port),(val))
307#define inl(port) in_le32(port)
308#define outl(val,port) out_le32((port),(val))
285 309
286#else 310#else
287/* 311/*
@@ -306,20 +330,35 @@ static inline void isa_delay(void)
306#endif 330#endif
307#endif /* CONFIG_PCI */ 331#endif /* CONFIG_PCI */
308 332
309#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && defined(CONFIG_HP300) 333#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI)
310/* 334/*
311 * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link 335 * We need to define dummy functions for GENERIC_IOMAP support.
312 */ 336 */
313#define inb(port) 0xff 337#define inb(port) 0xff
314#define inb_p(port) 0xff 338#define inb_p(port) 0xff
315#define outb(val,port) do { } while (0) 339#define outb(val,port) ((void)0)
316#define outb_p(val,port) do { } while (0) 340#define outb_p(val,port) ((void)0)
341#define inw(port) 0xffff
342#define outw(val,port) ((void)0)
343#define inl(port) 0xffffffffUL
344#define outl(val,port) ((void)0)
345
346#define insb(port,buf,nr) ((void)0)
347#define outsb(port,buf,nr) ((void)0)
348#define insw(port,buf,nr) ((void)0)
349#define outsw(port,buf,nr) ((void)0)
350#define insl(port,buf,nr) ((void)0)
351#define outsl(port,buf,nr) ((void)0)
317 352
318/* 353/*
319 * These should be valid on any ioremap()ed region 354 * These should be valid on any ioremap()ed region
320 */ 355 */
321#define readb(addr) in_8(addr) 356#define readb(addr) in_8(addr)
322#define writeb(val,addr) out_8((addr),(val)) 357#define writeb(val,addr) out_8((addr),(val))
358#define readw(addr) in_le16(addr)
359#define writew(val,addr) out_le16((addr),(val))
360#endif
361#if !defined(CONFIG_PCI)
323#define readl(addr) in_le32(addr) 362#define readl(addr) in_le32(addr)
324#define writel(val,addr) out_le32((addr),(val)) 363#define writel(val,addr) out_le32((addr),(val))
325#endif 364#endif
@@ -351,6 +390,18 @@ extern void dma_cache_wback_inv(unsigned long start, unsigned long size);
351extern void dma_cache_wback(unsigned long start, unsigned long size); 390extern void dma_cache_wback(unsigned long start, unsigned long size);
352extern void dma_cache_inv(unsigned long start, unsigned long size); 391extern void dma_cache_inv(unsigned long start, unsigned long size);
353 392
393static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
394{
395 __builtin_memset((void __force *) addr, val, count);
396}
397static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
398{
399 __builtin_memcpy(dst, (void __force *) src, count);
400}
401static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
402{
403 __builtin_memcpy((void __force *) dst, src, count);
404}
354 405
355#ifndef CONFIG_SUN3 406#ifndef CONFIG_SUN3
356#define IO_SPACE_LIMIT 0xffff 407#define IO_SPACE_LIMIT 0xffff
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
index b5b78c01eb6c..d029b75bcf04 100644
--- a/include/asm-m68k/motorola_pgtable.h
+++ b/include/asm-m68k/motorola_pgtable.h
@@ -164,21 +164,15 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
164 * The following only work if pte_present() is true. 164 * The following only work if pte_present() is true.
165 * Undefined behaviour if not.. 165 * Undefined behaviour if not..
166 */ 166 */
167static inline int pte_read(pte_t pte) { return 1; }
168static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } 167static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); }
169static inline int pte_exec(pte_t pte) { return 1; }
170static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 168static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
171static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 169static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
172static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 170static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
173 171
174static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } 172static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; }
175static inline pte_t pte_rdprotect(pte_t pte) { return pte; }
176static inline pte_t pte_exprotect(pte_t pte) { return pte; }
177static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 173static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
178static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 174static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
179static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } 175static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; }
180static inline pte_t pte_mkread(pte_t pte) { return pte; }
181static inline pte_t pte_mkexec(pte_t pte) { return pte; }
182static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 176static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
183static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 177static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
184static inline pte_t pte_mknocache(pte_t pte) 178static inline pte_t pte_mknocache(pte_t pte)
diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h
index 811ccd25d4a6..91c623f0994c 100644
--- a/include/asm-m68k/raw_io.h
+++ b/include/asm-m68k/raw_io.h
@@ -49,10 +49,16 @@ extern void __iounmap(void *addr, unsigned long size);
49#define raw_inb in_8 49#define raw_inb in_8
50#define raw_inw in_be16 50#define raw_inw in_be16
51#define raw_inl in_be32 51#define raw_inl in_be32
52#define __raw_readb in_8
53#define __raw_readw in_be16
54#define __raw_readl in_be32
52 55
53#define raw_outb(val,port) out_8((port),(val)) 56#define raw_outb(val,port) out_8((port),(val))
54#define raw_outw(val,port) out_be16((port),(val)) 57#define raw_outw(val,port) out_be16((port),(val))
55#define raw_outl(val,port) out_be32((port),(val)) 58#define raw_outl(val,port) out_be32((port),(val))
59#define __raw_writeb(val,addr) out_8((addr),(val))
60#define __raw_writew(val,addr) out_be16((addr),(val))
61#define __raw_writel(val,addr) out_be32((addr),(val))
56 62
57static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) 63static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
58{ 64{
@@ -336,8 +342,6 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
336 : "d0", "a0", "a1", "d6"); 342 : "d0", "a0", "a1", "d6");
337} 343}
338 344
339#define __raw_writel raw_outl
340
341#endif /* __KERNEL__ */ 345#endif /* __KERNEL__ */
342 346
343#endif /* _RAW_IO_H */ 347#endif /* _RAW_IO_H */
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h
index b9e62c1e7ae3..b766fc261bde 100644
--- a/include/asm-m68k/sun3_pgtable.h
+++ b/include/asm-m68k/sun3_pgtable.h
@@ -165,21 +165,15 @@ static inline void pgd_clear (pgd_t *pgdp) {}
165 * Undefined behaviour if not... 165 * Undefined behaviour if not...
166 * [we have the full set here even if they don't change from m68k] 166 * [we have the full set here even if they don't change from m68k]
167 */ 167 */
168static inline int pte_read(pte_t pte) { return 1; }
169static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } 168static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; }
170static inline int pte_exec(pte_t pte) { return 1; }
171static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } 169static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; }
172static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 170static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
173static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 171static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
174 172
175static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } 173static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; }
176static inline pte_t pte_rdprotect(pte_t pte) { return pte; }
177static inline pte_t pte_exprotect(pte_t pte) { return pte; }
178static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } 174static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; }
179static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; } 175static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; }
180static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; } 176static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; }
181static inline pte_t pte_mkread(pte_t pte) { return pte; }
182static inline pte_t pte_mkexec(pte_t pte) { return pte; }
183static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; } 177static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; }
184static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; } 178static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; }
185static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; } 179static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; }
diff --git a/include/asm-m68knommu/fb.h b/include/asm-m68knommu/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-m68knommu/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index 7b8f874f8429..9373c31ac87d 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -1,7 +1,5 @@
1#ifndef _M68K_IRQ_H_ 1#ifndef _M68KNOMMU_IRQ_H_
2#define _M68K_IRQ_H_ 2#define _M68KNOMMU_IRQ_H_
3
4#include <asm/ptrace.h>
5 3
6#ifdef CONFIG_COLDFIRE 4#ifdef CONFIG_COLDFIRE
7/* 5/*
@@ -17,75 +15,12 @@
17/* 15/*
18 * # of m68k interrupts 16 * # of m68k interrupts
19 */ 17 */
20#define SYS_IRQS 8 18#define SYS_IRQS 8
21#define NR_IRQS (24+SYS_IRQS) 19#define NR_IRQS (24 + SYS_IRQS)
22 20
23#endif /* CONFIG_COLDFIRE */ 21#endif /* CONFIG_COLDFIRE */
24 22
25/*
26 * Interrupt source definitions
27 * General interrupt sources are the level 1-7.
28 * Adding an interrupt service routine for one of these sources
29 * results in the addition of that routine to a chain of routines.
30 * Each one is called in succession. Each individual interrupt
31 * service routine should determine if the device associated with
32 * that routine requires service.
33 */
34 23
35#define IRQ1 (1) /* level 1 interrupt */
36#define IRQ2 (2) /* level 2 interrupt */
37#define IRQ3 (3) /* level 3 interrupt */
38#define IRQ4 (4) /* level 4 interrupt */
39#define IRQ5 (5) /* level 5 interrupt */
40#define IRQ6 (6) /* level 6 interrupt */
41#define IRQ7 (7) /* level 7 interrupt (non-maskable) */
42
43/*
44 * Machine specific interrupt sources.
45 *
46 * Adding an interrupt service routine for a source with this bit
47 * set indicates a special machine specific interrupt source.
48 * The machine specific files define these sources.
49 *
50 * The IRQ_MACHSPEC bit is now gone - the only thing it did was to
51 * introduce unnecessary overhead.
52 *
53 * All interrupt handling is actually machine specific so it is better
54 * to use function pointers, as used by the Sparc port, and select the
55 * interrupt handling functions when initializing the kernel. This way
56 * we save some unnecessary overhead at run-time.
57 * 01/11/97 - Jes
58 */
59
60extern void (*mach_enable_irq)(unsigned int);
61extern void (*mach_disable_irq)(unsigned int);
62
63/*
64 * various flags for request_irq() - the Amiga now uses the standard
65 * mechanism like all other architectures - IRQF_DISABLED and
66 * IRQF_SHARED are your friends.
67 */
68#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
69#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
70#define IRQ_FLG_FAST (0x0004)
71#define IRQ_FLG_SLOW (0x0008)
72#define IRQ_FLG_STD (0x8000) /* internally used */
73
74#ifdef CONFIG_M68360
75
76#define CPM_INTERRUPT IRQ4
77
78/* see MC68360 User's Manual, p. 7-377 */
79#define CPM_VECTOR_BASE 0x04 /* 3 MSbits of CPM vector */
80
81#endif /* CONFIG_M68360 */
82
83/*
84 * Some drivers want these entry points
85 */
86#define enable_irq(x) do { } while (0)
87#define disable_irq(x) do { } while (0)
88#define disable_irq_nosync(x) disable_irq(x)
89#define irq_canonicalize(irq) (irq) 24#define irq_canonicalize(irq) (irq)
90 25
91#endif /* _M68K_IRQ_H_ */ 26#endif /* _M68KNOMMU_IRQ_H_ */
diff --git a/include/asm-m68knommu/irqnode.h b/include/asm-m68knommu/irqnode.h
deleted file mode 100644
index 6132a9858b52..000000000000
--- a/include/asm-m68knommu/irqnode.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _M68K_IRQNODE_H_
2#define _M68K_IRQNODE_H_
3
4#include <linux/interrupt.h>
5
6/*
7 * This structure is used to chain together the ISRs for a particular
8 * interrupt source (if it supports chaining).
9 */
10typedef struct irq_node {
11 irq_handler_t handler;
12 unsigned long flags;
13 void *dev_id;
14 const char *devname;
15 struct irq_node *next;
16} irq_node_t;
17
18/*
19 * This structure has only 4 elements for speed reasons
20 */
21struct irq_entry {
22 irq_handler_t handler;
23 unsigned long flags;
24 void *dev_id;
25 const char *devname;
26};
27
28/* count of spurious interrupts */
29extern volatile unsigned int num_spurious;
30
31/*
32 * This function returns a new irq_node_t
33 */
34extern irq_node_t *new_irq_node(void);
35
36#endif /* _M68K_IRQNODE_H_ */
diff --git a/include/asm-m68knommu/m68360.h b/include/asm-m68knommu/m68360.h
index dd11b070884b..eb7d39ef2855 100644
--- a/include/asm-m68knommu/m68360.h
+++ b/include/asm-m68knommu/m68360.h
@@ -3,3 +3,11 @@
3#include "m68360_quicc.h" 3#include "m68360_quicc.h"
4#include "m68360_enet.h" 4#include "m68360_enet.h"
5 5
6#ifdef CONFIG_M68360
7
8#define CPM_INTERRUPT 4
9
10/* see MC68360 User's Manual, p. 7-377 */
11#define CPM_VECTOR_BASE 0x04 /* 3 MSbits of CPM vector */
12
13#endif /* CONFIG_M68360 */
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h
index 2a1b8bdcb29c..9efa0a9851b1 100644
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -22,7 +22,8 @@
22#define clear_user_page(page, vaddr, pg) clear_page(page) 22#define clear_user_page(page, vaddr, pg) clear_page(page)
23#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 23#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
24 24
25#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 25#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
26 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
26#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 27#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
27 28
28/* 29/*
diff --git a/include/asm-m68knommu/pgtable.h b/include/asm-m68knommu/pgtable.h
index 9dfbbc24aa71..e1e6a1d2333a 100644
--- a/include/asm-m68knommu/pgtable.h
+++ b/include/asm-m68knommu/pgtable.h
@@ -49,7 +49,6 @@ static inline int pte_file(pte_t pte) { return 0; }
49 * These would be in other places but having them here reduces the diffs. 49 * These would be in other places but having them here reduces the diffs.
50 */ 50 */
51extern unsigned int kobjsize(const void *objp); 51extern unsigned int kobjsize(const void *objp);
52extern int is_in_rom(unsigned long);
53 52
54/* 53/*
55 * No page table caches to initialise. 54 * No page table caches to initialise.
diff --git a/include/asm-m68knommu/traps.h b/include/asm-m68knommu/traps.h
index f2a81317cc10..d0671e5f8e29 100644
--- a/include/asm-m68knommu/traps.h
+++ b/include/asm-m68knommu/traps.h
@@ -16,6 +16,10 @@
16typedef void (*e_vector)(void); 16typedef void (*e_vector)(void);
17 17
18extern e_vector vectors[]; 18extern e_vector vectors[];
19extern void init_vectors(void);
20extern void enable_vector(unsigned int irq);
21extern void disable_vector(unsigned int irq);
22extern void ack_vector(unsigned int irq);
19 23
20#endif 24#endif
21 25
diff --git a/include/asm-m68knommu/uaccess.h b/include/asm-m68knommu/uaccess.h
index 62b29b10bc6d..9ed9169a8849 100644
--- a/include/asm-m68knommu/uaccess.h
+++ b/include/asm-m68knommu/uaccess.h
@@ -15,12 +15,15 @@
15 15
16#define access_ok(type,addr,size) _access_ok((unsigned long)(addr),(size)) 16#define access_ok(type,addr,size) _access_ok((unsigned long)(addr),(size))
17 17
18/*
19 * It is not enough to just have access_ok check for a real RAM address.
20 * This would disallow the case of code/ro-data running XIP in flash/rom.
21 * Ideally we would check the possible flash ranges too, but that is
22 * currently not so easy.
23 */
18static inline int _access_ok(unsigned long addr, unsigned long size) 24static inline int _access_ok(unsigned long addr, unsigned long size)
19{ 25{
20 extern unsigned long memory_start, memory_end; 26 return 1;
21
22 return (((addr >= memory_start) && (addr+size < memory_end)) ||
23 (is_in_rom(addr) && is_in_rom(addr+size)));
24} 27}
25 28
26/* 29/*
diff --git a/include/asm-mips/a.out.h b/include/asm-mips/a.out.h
index ef33c3f13484..1ad60ba186d0 100644
--- a/include/asm-mips/a.out.h
+++ b/include/asm-mips/a.out.h
@@ -40,6 +40,7 @@ struct exec
40#ifdef CONFIG_64BIT 40#ifdef CONFIG_64BIT
41#define STACK_TOP (current->thread.mflags & MF_32BIT_ADDR ? TASK_SIZE32 : TASK_SIZE) 41#define STACK_TOP (current->thread.mflags & MF_32BIT_ADDR ? TASK_SIZE32 : TASK_SIZE)
42#endif 42#endif
43#define STACK_TOP_MAX TASK_SIZE
43 44
44#endif 45#endif
45 46
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 1b60624dab7e..7d8003769a44 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -138,7 +138,7 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
138{ 138{
139 unsigned long result; 139 unsigned long result;
140 140
141 smp_mb(); 141 smp_llsc_mb();
142 142
143 if (cpu_has_llsc && R10000_LLSC_WAR) { 143 if (cpu_has_llsc && R10000_LLSC_WAR) {
144 unsigned long temp; 144 unsigned long temp;
@@ -181,7 +181,7 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
181 raw_local_irq_restore(flags); 181 raw_local_irq_restore(flags);
182 } 182 }
183 183
184 smp_mb(); 184 smp_llsc_mb();
185 185
186 return result; 186 return result;
187} 187}
@@ -190,7 +190,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
190{ 190{
191 unsigned long result; 191 unsigned long result;
192 192
193 smp_mb(); 193 smp_llsc_mb();
194 194
195 if (cpu_has_llsc && R10000_LLSC_WAR) { 195 if (cpu_has_llsc && R10000_LLSC_WAR) {
196 unsigned long temp; 196 unsigned long temp;
@@ -233,7 +233,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
233 raw_local_irq_restore(flags); 233 raw_local_irq_restore(flags);
234 } 234 }
235 235
236 smp_mb(); 236 smp_llsc_mb();
237 237
238 return result; 238 return result;
239} 239}
@@ -250,7 +250,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
250{ 250{
251 unsigned long result; 251 unsigned long result;
252 252
253 smp_mb(); 253 smp_llsc_mb();
254 254
255 if (cpu_has_llsc && R10000_LLSC_WAR) { 255 if (cpu_has_llsc && R10000_LLSC_WAR) {
256 unsigned long temp; 256 unsigned long temp;
@@ -302,7 +302,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
302 raw_local_irq_restore(flags); 302 raw_local_irq_restore(flags);
303 } 303 }
304 304
305 smp_mb(); 305 smp_llsc_mb();
306 306
307 return result; 307 return result;
308} 308}
@@ -519,7 +519,7 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
519{ 519{
520 unsigned long result; 520 unsigned long result;
521 521
522 smp_mb(); 522 smp_llsc_mb();
523 523
524 if (cpu_has_llsc && R10000_LLSC_WAR) { 524 if (cpu_has_llsc && R10000_LLSC_WAR) {
525 unsigned long temp; 525 unsigned long temp;
@@ -562,7 +562,7 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
562 raw_local_irq_restore(flags); 562 raw_local_irq_restore(flags);
563 } 563 }
564 564
565 smp_mb(); 565 smp_llsc_mb();
566 566
567 return result; 567 return result;
568} 568}
@@ -571,7 +571,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
571{ 571{
572 unsigned long result; 572 unsigned long result;
573 573
574 smp_mb(); 574 smp_llsc_mb();
575 575
576 if (cpu_has_llsc && R10000_LLSC_WAR) { 576 if (cpu_has_llsc && R10000_LLSC_WAR) {
577 unsigned long temp; 577 unsigned long temp;
@@ -614,7 +614,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
614 raw_local_irq_restore(flags); 614 raw_local_irq_restore(flags);
615 } 615 }
616 616
617 smp_mb(); 617 smp_llsc_mb();
618 618
619 return result; 619 return result;
620} 620}
@@ -631,7 +631,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
631{ 631{
632 unsigned long result; 632 unsigned long result;
633 633
634 smp_mb(); 634 smp_llsc_mb();
635 635
636 if (cpu_has_llsc && R10000_LLSC_WAR) { 636 if (cpu_has_llsc && R10000_LLSC_WAR) {
637 unsigned long temp; 637 unsigned long temp;
@@ -683,7 +683,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
683 raw_local_irq_restore(flags); 683 raw_local_irq_restore(flags);
684 } 684 }
685 685
686 smp_mb(); 686 smp_llsc_mb();
687 687
688 return result; 688 return result;
689} 689}
@@ -791,10 +791,11 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
791 * atomic*_return operations are serializing but not the non-*_return 791 * atomic*_return operations are serializing but not the non-*_return
792 * versions. 792 * versions.
793 */ 793 */
794#define smp_mb__before_atomic_dec() smp_mb() 794#define smp_mb__before_atomic_dec() smp_llsc_mb()
795#define smp_mb__after_atomic_dec() smp_mb() 795#define smp_mb__after_atomic_dec() smp_llsc_mb()
796#define smp_mb__before_atomic_inc() smp_mb() 796#define smp_mb__before_atomic_inc() smp_llsc_mb()
797#define smp_mb__after_atomic_inc() smp_mb() 797#define smp_mb__after_atomic_inc() smp_llsc_mb()
798 798
799#include <asm-generic/atomic.h> 799#include <asm-generic/atomic.h>
800
800#endif /* _ASM_ATOMIC_H */ 801#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-mips/barrier.h b/include/asm-mips/barrier.h
index ed82631b0017..9d8cfbb5e796 100644
--- a/include/asm-mips/barrier.h
+++ b/include/asm-mips/barrier.h
@@ -121,6 +121,11 @@
121#else 121#else
122#define __WEAK_ORDERING_MB " \n" 122#define __WEAK_ORDERING_MB " \n"
123#endif 123#endif
124#if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP)
125#define __WEAK_LLSC_MB " sync \n"
126#else
127#define __WEAK_LLSC_MB " \n"
128#endif
124 129
125#define smp_mb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory") 130#define smp_mb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
126#define smp_rmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory") 131#define smp_rmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
@@ -129,4 +134,8 @@
129#define set_mb(var, value) \ 134#define set_mb(var, value) \
130 do { var = value; smp_mb(); } while (0) 135 do { var = value; smp_mb(); } while (0)
131 136
137#define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
138#define smp_llsc_rmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
139#define smp_llsc_wmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
140
132#endif /* __ASM_BARRIER_H */ 141#endif /* __ASM_BARRIER_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index d9e81af53f78..148bc79557f1 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -38,8 +38,8 @@
38/* 38/*
39 * clear_bit() doesn't provide any barrier for the compiler. 39 * clear_bit() doesn't provide any barrier for the compiler.
40 */ 40 */
41#define smp_mb__before_clear_bit() smp_mb() 41#define smp_mb__before_clear_bit() smp_llsc_mb()
42#define smp_mb__after_clear_bit() smp_mb() 42#define smp_mb__after_clear_bit() smp_llsc_mb()
43 43
44/* 44/*
45 * set_bit - Atomically set a bit in memory 45 * set_bit - Atomically set a bit in memory
@@ -289,7 +289,7 @@ static inline int test_and_set_bit(unsigned long nr,
289 raw_local_irq_restore(flags); 289 raw_local_irq_restore(flags);
290 } 290 }
291 291
292 smp_mb(); 292 smp_llsc_mb();
293 293
294 return res != 0; 294 return res != 0;
295} 295}
@@ -377,7 +377,7 @@ static inline int test_and_clear_bit(unsigned long nr,
377 raw_local_irq_restore(flags); 377 raw_local_irq_restore(flags);
378 } 378 }
379 379
380 smp_mb(); 380 smp_llsc_mb();
381 381
382 return res != 0; 382 return res != 0;
383} 383}
@@ -445,7 +445,7 @@ static inline int test_and_change_bit(unsigned long nr,
445 raw_local_irq_restore(flags); 445 raw_local_irq_restore(flags);
446 } 446 }
447 447
448 smp_mb(); 448 smp_llsc_mb();
449 449
450 return res != 0; 450 return res != 0;
451} 451}
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 67c3f8ec0303..568c76cdd900 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -37,8 +37,10 @@ typedef s32 compat_key_t;
37 37
38typedef s32 compat_int_t; 38typedef s32 compat_int_t;
39typedef s32 compat_long_t; 39typedef s32 compat_long_t;
40typedef s64 compat_s64;
40typedef u32 compat_uint_t; 41typedef u32 compat_uint_t;
41typedef u32 compat_ulong_t; 42typedef u32 compat_ulong_t;
43typedef u64 compat_u64;
42 44
43struct compat_timespec { 45struct compat_timespec {
44 compat_time_t tv_sec; 46 compat_time_t tv_sec;
diff --git a/include/asm-mips/dec/serial.h b/include/asm-mips/dec/serial.h
deleted file mode 100644
index acad75890a05..000000000000
--- a/include/asm-mips/dec/serial.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * include/asm-mips/dec/serial.h
3 *
4 * Definitions common to all DECstation serial devices.
5 *
6 * Copyright (C) 2004 Maciej W. Rozycki
7 *
8 * Based on bits extracted from drivers/tc/zs.h for which
9 * the following copyrights apply:
10 *
11 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
12 * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au)
13 * Copyright (C) Harald Koerfgen
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#ifndef __ASM_MIPS_DEC_SERIAL_H
21#define __ASM_MIPS_DEC_SERIAL_H
22
23struct dec_serial_hook {
24 int (*init_channel)(void *handle);
25 void (*init_info)(void *handle);
26 void (*rx_char)(unsigned char ch, unsigned char fl);
27 int (*poll_rx_char)(void *handle);
28 int (*poll_tx_char)(void *handle, unsigned char ch);
29 unsigned int cflags;
30};
31
32extern int register_dec_serial_hook(unsigned int channel,
33 struct dec_serial_hook *hook);
34extern int unregister_dec_serial_hook(unsigned int channel);
35
36#endif /* __ASM_MIPS_DEC_SERIAL_H */
diff --git a/include/asm-mips/ds1216.h b/include/asm-mips/ds1216.h
deleted file mode 100644
index 1ff8b73f7a6a..000000000000
--- a/include/asm-mips/ds1216.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _DS1216_H
2#define _DS1216_H
3
4extern volatile unsigned char *ds1216_base;
5unsigned long ds1216_get_cmos_time(void);
6int ds1216_set_rtc_mmss(unsigned long nowtime);
7
8#define DS1216_SEC_BYTE 1
9#define DS1216_MIN_BYTE 2
10#define DS1216_HOUR_BYTE 3
11#define DS1216_HOUR_MASK (0x1f)
12#define DS1216_AMPM_MASK (1<<5)
13#define DS1216_1224_MASK (1<<7)
14#define DS1216_DAY_BYTE 4
15#define DS1216_DAY_MASK (0x7)
16#define DS1216_DATE_BYTE 5
17#define DS1216_DATE_MASK (0x3f)
18#define DS1216_MONTH_BYTE 6
19#define DS1216_MONTH_MASK (0x1f)
20#define DS1216_YEAR_BYTE 7
21
22#define DS1216_SEC(buf) (buf[DS1216_SEC_BYTE])
23#define DS1216_MIN(buf) (buf[DS1216_MIN_BYTE])
24#define DS1216_HOUR(buf) (buf[DS1216_HOUR_BYTE] & DS1216_HOUR_MASK)
25#define DS1216_AMPM(buf) (buf[DS1216_HOUR_BYTE] & DS1216_AMPM_MASK)
26#define DS1216_1224(buf) (buf[DS1216_HOUR_BYTE] & DS1216_1224_MASK)
27#define DS1216_DATE(buf) (buf[DS1216_DATE_BYTE] & DS1216_DATE_MASK)
28#define DS1216_MONTH(buf) (buf[DS1216_MONTH_BYTE] & DS1216_MONTH_MASK)
29#define DS1216_YEAR(buf) (buf[DS1216_YEAR_BYTE])
30
31#endif
diff --git a/include/asm-mips/fb.h b/include/asm-mips/fb.h
new file mode 100644
index 000000000000..bd3f68c9ddfc
--- /dev/null
+++ b/include/asm-mips/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 47e5679c2353..b623882bce19 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -29,7 +29,7 @@
29 " .set mips3 \n" \ 29 " .set mips3 \n" \
30 "2: sc $1, %2 \n" \ 30 "2: sc $1, %2 \n" \
31 " beqzl $1, 1b \n" \ 31 " beqzl $1, 1b \n" \
32 __WEAK_ORDERING_MB \ 32 __WEAK_LLSC_MB \
33 "3: \n" \ 33 "3: \n" \
34 " .set pop \n" \ 34 " .set pop \n" \
35 " .set mips0 \n" \ 35 " .set mips0 \n" \
@@ -55,7 +55,7 @@
55 " .set mips3 \n" \ 55 " .set mips3 \n" \
56 "2: sc $1, %2 \n" \ 56 "2: sc $1, %2 \n" \
57 " beqz $1, 1b \n" \ 57 " beqz $1, 1b \n" \
58 __WEAK_ORDERING_MB \ 58 __WEAK_LLSC_MB \
59 "3: \n" \ 59 "3: \n" \
60 " .set pop \n" \ 60 " .set pop \n" \
61 " .set mips0 \n" \ 61 " .set mips0 \n" \
@@ -152,7 +152,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
152 " .set mips3 \n" 152 " .set mips3 \n"
153 "2: sc $1, %1 \n" 153 "2: sc $1, %1 \n"
154 " beqzl $1, 1b \n" 154 " beqzl $1, 1b \n"
155 __WEAK_ORDERING_MB 155 __WEAK_LLSC_MB
156 "3: \n" 156 "3: \n"
157 " .set pop \n" 157 " .set pop \n"
158 " .section .fixup,\"ax\" \n" 158 " .section .fixup,\"ax\" \n"
@@ -179,7 +179,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
179 " .set mips3 \n" 179 " .set mips3 \n"
180 "2: sc $1, %1 \n" 180 "2: sc $1, %1 \n"
181 " beqz $1, 1b \n" 181 " beqz $1, 1b \n"
182 __WEAK_ORDERING_MB 182 __WEAK_LLSC_MB
183 "3: \n" 183 "3: \n"
184 " .set pop \n" 184 " .set pop \n"
185 " .section .fixup,\"ax\" \n" 185 " .section .fixup,\"ax\" \n"
diff --git a/include/asm-mips/gfx.h b/include/asm-mips/gfx.h
deleted file mode 100644
index 37235e41a6fd..000000000000
--- a/include/asm-mips/gfx.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * This is the user-visible SGI GFX interface.
7 *
8 * This must be used verbatim into the GNU libc. It does not include
9 * any kernel-only bits on it.
10 *
11 * miguel@nuclecu.unam.mx
12 */
13#ifndef _ASM_GFX_H
14#define _ASM_GFX_H
15
16/* The iocls, yes, they do not make sense, but such is life */
17#define GFX_BASE 100
18#define GFX_GETNUM_BOARDS (GFX_BASE + 1)
19#define GFX_GETBOARD_INFO (GFX_BASE + 2)
20#define GFX_ATTACH_BOARD (GFX_BASE + 3)
21#define GFX_DETACH_BOARD (GFX_BASE + 4)
22#define GFX_IS_MANAGED (GFX_BASE + 5)
23
24#define GFX_MAPALL (GFX_BASE + 10)
25#define GFX_LABEL (GFX_BASE + 11)
26
27#define GFX_INFO_NAME_SIZE 16
28#define GFX_INFO_LABEL_SIZE 16
29
30struct gfx_info {
31 char name [GFX_INFO_NAME_SIZE]; /* board name */
32 char label [GFX_INFO_LABEL_SIZE]; /* label name */
33 unsigned short int xpmax, ypmax; /* screen resolution */
34 unsigned int lenght; /* size of a complete gfx_info for this board */
35};
36
37struct gfx_getboardinfo_args {
38 unsigned int board; /* board number. starting from zero */
39 void *buf; /* pointer to gfx_info */
40 unsigned int len; /* buffer size of buf */
41};
42
43struct gfx_attach_board_args {
44 unsigned int board; /* board number, starting from zero */
45 void *vaddr; /* address where the board registers should be mapped */
46};
47
48#ifdef __KERNEL__
49/* umap.c */
50extern void remove_mapping (struct vm_area_struct *vma, struct task_struct *, unsigned long, unsigned long);
51extern void *vmalloc_uncached (unsigned long size);
52extern int vmap_page_range (struct vm_area_struct *vma, unsigned long from, unsigned long size, unsigned long vaddr);
53#endif
54
55#endif /* _ASM_GFX_H */
diff --git a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
index c6dfa59d1986..d38f069d9e95 100644
--- a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) 6 * Copyright (C) 2006, 07 Ralf Baechle (ralf@linux-mips.org)
7 */ 7 */
8#ifndef __ASM_COBALT_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
9#define __ASM_COBALT_CPU_FEATURE_OVERRIDES_H 9#define __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
@@ -46,6 +46,8 @@
46#define cpu_has_ic_fills_f_dc 0 46#define cpu_has_ic_fills_f_dc 0
47#define cpu_icache_snoops_remote_store 0 47#define cpu_icache_snoops_remote_store 0
48#define cpu_has_dsp 0 48#define cpu_has_dsp 0
49#define cpu_has_mipsmt 0
50#define cpu_has_userlocal 0
49 51
50#define cpu_has_mips32r1 0 52#define cpu_has_mips32r1 0
51#define cpu_has_mips32r2 0 53#define cpu_has_mips32r2 0
diff --git a/include/asm-mips/mach-excite/cpu-feature-overrides.h b/include/asm-mips/mach-excite/cpu-feature-overrides.h
index 0d31854222f9..07f4322c235d 100644
--- a/include/asm-mips/mach-excite/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-excite/cpu-feature-overrides.h
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004 Thomas Koeller <thomas.koeller@baslerweb.com> 6 * Copyright (C) 2004 Thomas Koeller <thomas.koeller@baslerweb.com>
7 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7 */ 8 */
8#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H 9#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H 10#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
@@ -27,6 +28,8 @@
27#define cpu_has_ic_fills_f_dc 0 28#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0 29#define cpu_has_dsp 0
29#define cpu_icache_snoops_remote_store 0 30#define cpu_icache_snoops_remote_store 0
31#define cpu_has_mipsmt 0
32#define cpu_has_userlocal 0
30 33
31#define cpu_has_nofpuex 0 34#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 35#define cpu_has_64bits 1
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
index f7c5dc8a5336..9c8735158da1 100644
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003 Ralf Baechle 6 * Copyright (C) 2003, 07 Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
@@ -30,6 +30,8 @@
30#define cpu_has_ic_fills_f_dc 0 30#define cpu_has_ic_fills_f_dc 0
31 31
32#define cpu_has_dsp 0 32#define cpu_has_dsp 0
33#define cpu_has_mipsmt 0
34#define cpu_has_userlocal 0
33 35
34#define cpu_has_nofpuex 0 36#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1 37#define cpu_has_64bits 1
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
index a071974b67bb..fe076380c189 100644
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003 Ralf Baechle 6 * Copyright (C) 2003, 07 Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
@@ -27,6 +27,8 @@
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0 28#define cpu_has_dsp 0
29#define cpu_icache_snoops_remote_store 1 29#define cpu_icache_snoops_remote_store 1
30#define cpu_has_mipsmt 0
31#define cpu_has_userlocal 0
30 32
31#define cpu_has_nofpuex 0 33#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 34#define cpu_has_64bits 1
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index 2a3de092bf13..6782fccebe8d 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2005 Ilya A. Volynets-Evenbakh 6 * Copyright (C) 2005 Ilya A. Volynets-Evenbakh
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 2005, 07 Ralf Baechle (ralf@linux-mips.org)
8 */ 8 */
9#ifndef __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H 9#ifndef __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H 10#define __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H
@@ -38,6 +38,8 @@
38#define cpu_has_ic_fills_f_dc 0 38#define cpu_has_ic_fills_f_dc 0
39#define cpu_has_dsp 0 39#define cpu_has_dsp 0
40#define cpu_has_4k_cache 1 40#define cpu_has_4k_cache 1
41#define cpu_has_mipsmt 0
42#define cpu_has_userlocal 0
41 43
42 44
43#define cpu_has_mips32r1 0 45#define cpu_has_mips32r1 0
diff --git a/include/asm-mips/mach-qemu/cpu-feature-overrides.h b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
index 529445dacedb..d2daaed235d5 100644
--- a/include/asm-mips/mach-qemu/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003 Ralf Baechle 6 * Copyright (C) 2003, 07 Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H
@@ -24,6 +24,7 @@
24#define cpu_has_ic_fills_f_dc 0 24#define cpu_has_ic_fills_f_dc 0
25 25
26#define cpu_has_dsp 0 26#define cpu_has_dsp 0
27#define cpu_has_mipsmt 0
27 28
28#define cpu_has_nofpuex 0 29#define cpu_has_nofpuex 0
29#define cpu_has_64bits 0 30#define cpu_has_64bits 0
diff --git a/include/asm-mips/mach-rm/cpu-feature-overrides.h b/include/asm-mips/mach-rm/cpu-feature-overrides.h
index 7e07283140a3..ccf543363537 100644
--- a/include/asm-mips/mach-rm/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle 6 * Copyright (C) 2003, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 * 7 *
8 * SNI RM200 C apparently was only shipped with R4600 V2.0 and R5000 processors. 8 * SNI RM200 C apparently was only shipped with R4600 V2.0 and R5000 processors.
9 */ 9 */
@@ -32,6 +32,8 @@
32#define cpu_has_dsp 0 32#define cpu_has_dsp 0
33#define cpu_has_nofpuex 0 33#define cpu_has_nofpuex 0
34#define cpu_has_64bits 1 34#define cpu_has_64bits 1
35#define cpu_has_mipsmt 0
36#define cpu_has_userlocal 0
35 37
36#define cpu_has_mips32r1 0 38#define cpu_has_mips32r1 0
37#define cpu_has_mips32r2 0 39#define cpu_has_mips32r2 0
diff --git a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
index a25968f277a2..63d5bf649af1 100644
--- a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle 6 * Copyright (C) 2003, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 */ 7 */
8#ifndef __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H
@@ -26,6 +26,8 @@
26#define cpu_has_dc_aliases 0 26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0 28#define cpu_has_dsp 0
29#define cpu_has_mipsmt 0
30#define cpu_has_userlocal 0
29#define cpu_icache_snoops_remote_store 0 31#define cpu_icache_snoops_remote_store 0
30 32
31#define cpu_has_nofpuex 0 33#define cpu_has_nofpuex 0
diff --git a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
index 42cebb7ce7a6..470e5e9e10d6 100644
--- a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle 6 * Copyright (C) 2003, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 */ 7 */
8#ifndef __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
@@ -26,6 +26,8 @@
26#define cpu_has_dc_aliases 0 26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0 28#define cpu_has_dsp 0
29#define cpu_has_mipsmt 0
30#define cpu_has_userlocal 0
29#define cpu_icache_snoops_remote_store 0 31#define cpu_icache_snoops_remote_store 0
30 32
31#define cpu_has_nofpuex 0 33#define cpu_has_nofpuex 0
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 27d77d981937..2e2d70d13ff6 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -178,9 +178,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
178 * The following only work if pte_present() is true. 178 * The following only work if pte_present() is true.
179 * Undefined behaviour if not.. 179 * Undefined behaviour if not..
180 */ 180 */
181static inline int pte_user(pte_t pte) { BUG(); return 0; }
182#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 181#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
183static inline int pte_read(pte_t pte) { return pte.pte_low & _PAGE_READ; }
184static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } 182static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
185static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } 183static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
186static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } 184static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
@@ -193,13 +191,6 @@ static inline pte_t pte_wrprotect(pte_t pte)
193 return pte; 191 return pte;
194} 192}
195 193
196static inline pte_t pte_rdprotect(pte_t pte)
197{
198 pte.pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ);
199 pte.pte_high &= ~_PAGE_SILENT_READ;
200 return pte;
201}
202
203static inline pte_t pte_mkclean(pte_t pte) 194static inline pte_t pte_mkclean(pte_t pte)
204{ 195{
205 pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); 196 pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
@@ -224,16 +215,6 @@ static inline pte_t pte_mkwrite(pte_t pte)
224 return pte; 215 return pte;
225} 216}
226 217
227static inline pte_t pte_mkread(pte_t pte)
228{
229 pte.pte_low |= _PAGE_READ;
230 if (pte.pte_low & _PAGE_ACCESSED) {
231 pte.pte_low |= _PAGE_SILENT_READ;
232 pte.pte_high |= _PAGE_SILENT_READ;
233 }
234 return pte;
235}
236
237static inline pte_t pte_mkdirty(pte_t pte) 218static inline pte_t pte_mkdirty(pte_t pte)
238{ 219{
239 pte.pte_low |= _PAGE_MODIFIED; 220 pte.pte_low |= _PAGE_MODIFIED;
@@ -253,7 +234,6 @@ static inline pte_t pte_mkyoung(pte_t pte)
253 return pte; 234 return pte;
254} 235}
255#else 236#else
256static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
257static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 237static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
258static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 238static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
259static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 239static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
@@ -265,12 +245,6 @@ static inline pte_t pte_wrprotect(pte_t pte)
265 return pte; 245 return pte;
266} 246}
267 247
268static inline pte_t pte_rdprotect(pte_t pte)
269{
270 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
271 return pte;
272}
273
274static inline pte_t pte_mkclean(pte_t pte) 248static inline pte_t pte_mkclean(pte_t pte)
275{ 249{
276 pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); 250 pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE);
@@ -291,14 +265,6 @@ static inline pte_t pte_mkwrite(pte_t pte)
291 return pte; 265 return pte;
292} 266}
293 267
294static inline pte_t pte_mkread(pte_t pte)
295{
296 pte_val(pte) |= _PAGE_READ;
297 if (pte_val(pte) & _PAGE_ACCESSED)
298 pte_val(pte) |= _PAGE_SILENT_READ;
299 return pte;
300}
301
302static inline pte_t pte_mkdirty(pte_t pte) 268static inline pte_t pte_mkdirty(pte_t pte)
303{ 269{
304 pte_val(pte) |= _PAGE_MODIFIED; 270 pte_val(pte) |= _PAGE_MODIFIED;
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h
index bda391d3af85..2738c1366f66 100644
--- a/include/asm-mips/sibyte/bcm1480_regs.h
+++ b/include/asm-mips/sibyte/bcm1480_regs.h
@@ -220,17 +220,25 @@
220#define A_BCM1480_DUART(chan) ((((chan)&2) == 0)? A_BCM1480_DUART0 : A_BCM1480_DUART1) 220#define A_BCM1480_DUART(chan) ((((chan)&2) == 0)? A_BCM1480_DUART0 : A_BCM1480_DUART1)
221 221
222#define BCM1480_DUART_CHANREG_SPACING 0x100 222#define BCM1480_DUART_CHANREG_SPACING 0x100
223#define A_BCM1480_DUART_CHANREG(chan,reg) (A_BCM1480_DUART(chan) \ 223#define A_BCM1480_DUART_CHANREG(chan, reg) \
224 + BCM1480_DUART_CHANREG_SPACING*((chan)&1) \ 224 (A_BCM1480_DUART(chan) + \
225 + (reg)) 225 BCM1480_DUART_CHANREG_SPACING * (((chan) & 1) + 1) + (reg))
226#define R_BCM1480_DUART_CHANREG(chan,reg) (BCM1480_DUART_CHANREG_SPACING*((chan)&1) + (reg)) 226#define A_BCM1480_DUART_CTRLREG(chan, reg) \
227 227 (A_BCM1480_DUART(chan) + \
228#define R_BCM1480_DUART_IMRREG(chan) (R_DUART_IMR_A + ((chan)&1)*DUART_IMRISR_SPACING) 228 BCM1480_DUART_CHANREG_SPACING * 3 + (reg))
229#define R_BCM1480_DUART_ISRREG(chan) (R_DUART_ISR_A + ((chan)&1)*DUART_IMRISR_SPACING) 229
230 230#define R_BCM1480_DUART_IMRREG(chan) \
231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan)) 231 (R_DUART_IMR_A + ((chan) & 1) * DUART_IMRISR_SPACING)
232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan)) 232#define R_BCM1480_DUART_ISRREG(chan) \
233#define A_BCM1480_DUART_IN_PORT(chan) (A_BCM1480_DUART(chan) + R_DUART_INP_ORT) 233 (R_DUART_ISR_A + ((chan) & 1) * DUART_IMRISR_SPACING)
234
235#define A_BCM1480_DUART_IMRREG(chan) \
236 (A_BCM1480_DUART_CTRLREG((chan), R_BCM1480_DUART_IMRREG(chan)))
237#define A_BCM1480_DUART_ISRREG(chan) \
238 (A_BCM1480_DUART_CTRLREG((chan), R_BCM1480_DUART_ISRREG(chan)))
239
240#define A_BCM1480_DUART_IN_PORT(chan) \
241 (A_BCM1480_DUART_CTRLREG((chan), R_DUART_IN_PORT))
234 242
235/* 243/*
236 * These constants are the absolute addresses. 244 * These constants are the absolute addresses.
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index da7c188993c9..220b7e94f1bf 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -272,59 +272,69 @@
272 ********************************************************************* */ 272 ********************************************************************* */
273 273
274 274
275#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */ 275#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
276#define R_DUART_NUM_PORTS 2 276#define R_DUART_NUM_PORTS 2
277 277
278#define A_DUART 0x0010060000 278#define A_DUART 0x0010060000
279 279
280#define DUART_CHANREG_SPACING 0x100 280#define DUART_CHANREG_SPACING 0x100
281#define A_DUART_CHANREG(chan,reg) (A_DUART + DUART_CHANREG_SPACING*(chan) + (reg)) 281
282#define R_DUART_CHANREG(chan,reg) (DUART_CHANREG_SPACING*(chan) + (reg)) 282#define A_DUART_CHANREG(chan, reg) \
283 (A_DUART + DUART_CHANREG_SPACING * ((chan) + 1) + (reg))
283#endif /* 1250 & 112x */ 284#endif /* 1250 & 112x */
284 285
285#define R_DUART_MODE_REG_1 0x100 286#define R_DUART_MODE_REG_1 0x000
286#define R_DUART_MODE_REG_2 0x110 287#define R_DUART_MODE_REG_2 0x010
287#define R_DUART_STATUS 0x120 288#define R_DUART_STATUS 0x020
288#define R_DUART_CLK_SEL 0x130 289#define R_DUART_CLK_SEL 0x030
289#define R_DUART_CMD 0x150 290#define R_DUART_CMD 0x050
290#define R_DUART_RX_HOLD 0x160 291#define R_DUART_RX_HOLD 0x060
291#define R_DUART_TX_HOLD 0x170 292#define R_DUART_TX_HOLD 0x070
292 293
293#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 294#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
294#define R_DUART_FULL_CTL 0x140 295#define R_DUART_FULL_CTL 0x040
295#define R_DUART_OPCR_X 0x180 296#define R_DUART_OPCR_X 0x080
296#define R_DUART_AUXCTL_X 0x190 297#define R_DUART_AUXCTL_X 0x090
297#endif /* 1250 PASS2 || 112x PASS1 || 1480*/ 298#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
298 299
299 300
300/* 301/*
301 * The IMR and ISR can't be addressed with A_DUART_CHANREG, 302 * The IMR and ISR can't be addressed with A_DUART_CHANREG,
302 * so use this macro instead. 303 * so use these macros instead.
303 */ 304 */
304 305
305#define R_DUART_AUX_CTRL 0x310 306#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
306#define R_DUART_ISR_A 0x320 307#define DUART_IMRISR_SPACING 0x20
307#define R_DUART_IMR_A 0x330 308#define DUART_INCHNG_SPACING 0x10
308#define R_DUART_ISR_B 0x340
309#define R_DUART_IMR_B 0x350
310#define R_DUART_OUT_PORT 0x360
311#define R_DUART_OPCR 0x370
312#define R_DUART_IN_PORT 0x380
313 309
314#define R_DUART_SET_OPR 0x3B0 310#define A_DUART_CTRLREG(reg) \
315#define R_DUART_CLEAR_OPR 0x3C0 311 (A_DUART + DUART_CHANREG_SPACING * 3 + (reg))
316 312
317#define DUART_IMRISR_SPACING 0x20 313#define R_DUART_IMRREG(chan) \
314 (R_DUART_IMR_A + (chan) * DUART_IMRISR_SPACING)
315#define R_DUART_ISRREG(chan) \
316 (R_DUART_ISR_A + (chan) * DUART_IMRISR_SPACING)
317#define R_DUART_INCHREG(chan) \
318 (R_DUART_IN_CHNG_A + (chan) * DUART_INCHNG_SPACING)
318 319
319#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */ 320#define A_DUART_IMRREG(chan) A_DUART_CTRLREG(R_DUART_IMRREG(chan))
320#define R_DUART_IMRREG(chan) (R_DUART_IMR_A + (chan)*DUART_IMRISR_SPACING) 321#define A_DUART_ISRREG(chan) A_DUART_CTRLREG(R_DUART_ISRREG(chan))
321#define R_DUART_ISRREG(chan) (R_DUART_ISR_A + (chan)*DUART_IMRISR_SPACING) 322#define A_DUART_INCHREG(chan) A_DUART_CTRLREG(R_DUART_INCHREG(chan))
322
323#define A_DUART_IMRREG(chan) (A_DUART + R_DUART_IMRREG(chan))
324#define A_DUART_ISRREG(chan) (A_DUART + R_DUART_ISRREG(chan))
325#endif /* 1250 & 112x */ 323#endif /* 1250 & 112x */
326 324
327 325#define R_DUART_AUX_CTRL 0x010
326#define R_DUART_ISR_A 0x020
327#define R_DUART_IMR_A 0x030
328#define R_DUART_ISR_B 0x040
329#define R_DUART_IMR_B 0x050
330#define R_DUART_OUT_PORT 0x060
331#define R_DUART_OPCR 0x070
332#define R_DUART_IN_PORT 0x080
333
334#define R_DUART_SET_OPR 0x0B0
335#define R_DUART_CLEAR_OPR 0x0C0
336#define R_DUART_IN_CHNG_A 0x0D0
337#define R_DUART_IN_CHNG_B 0x0E0
328 338
329 339
330/* 340/*
diff --git a/include/asm-mips/sibyte/sb1250_uart.h b/include/asm-mips/sibyte/sb1250_uart.h
index e87045e62bf0..cf74fedcbef1 100644
--- a/include/asm-mips/sibyte/sb1250_uart.h
+++ b/include/asm-mips/sibyte/sb1250_uart.h
@@ -75,7 +75,8 @@
75#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED) 75#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED)
76#define V_DUART_PARITY_MODE_NONE V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE) 76#define V_DUART_PARITY_MODE_NONE V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE)
77 77
78#define M_DUART_ERR_MODE _SB_MAKEMASK1(5) /* must be zero */ 78#define M_DUART_TX_IRQ_SEL_TXRDY 0
79#define M_DUART_TX_IRQ_SEL_TXEMPT _SB_MAKEMASK1(5)
79 80
80#define M_DUART_RX_IRQ_SEL_RXRDY 0 81#define M_DUART_RX_IRQ_SEL_RXRDY 0
81#define M_DUART_RX_IRQ_SEL_RXFULL _SB_MAKEMASK1(6) 82#define M_DUART_RX_IRQ_SEL_RXFULL _SB_MAKEMASK1(6)
@@ -246,10 +247,13 @@
246 247
247#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2) 248#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2)
248#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3) 249#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3)
250#define M_DUART_ISR_ALL_A _SB_MAKEMASK(4,0)
251
249#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4) 252#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4)
250#define M_DUART_ISR_RX_B _SB_MAKEMASK1(5) 253#define M_DUART_ISR_RX_B _SB_MAKEMASK1(5)
251#define M_DUART_ISR_BRK_B _SB_MAKEMASK1(6) 254#define M_DUART_ISR_BRK_B _SB_MAKEMASK1(6)
252#define M_DUART_ISR_IN_B _SB_MAKEMASK1(7) 255#define M_DUART_ISR_IN_B _SB_MAKEMASK1(7)
256#define M_DUART_ISR_ALL_B _SB_MAKEMASK(4,4)
253 257
254/* 258/*
255 * DUART Channel A Interrupt Status Register (Table 10-17) 259 * DUART Channel A Interrupt Status Register (Table 10-17)
@@ -262,6 +266,7 @@
262#define M_DUART_ISR_RX _SB_MAKEMASK1(1) 266#define M_DUART_ISR_RX _SB_MAKEMASK1(1)
263#define M_DUART_ISR_BRK _SB_MAKEMASK1(2) 267#define M_DUART_ISR_BRK _SB_MAKEMASK1(2)
264#define M_DUART_ISR_IN _SB_MAKEMASK1(3) 268#define M_DUART_ISR_IN _SB_MAKEMASK1(3)
269#define M_DUART_ISR_ALL _SB_MAKEMASK(4,0)
265#define M_DUART_ISR_RESERVED _SB_MAKEMASK(4,4) 270#define M_DUART_ISR_RESERVED _SB_MAKEMASK(4,4)
266 271
267/* 272/*
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 35e431cd796b..bb897016c491 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -67,7 +67,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
67 : "memory"); 67 : "memory");
68 } 68 }
69 69
70 smp_mb(); 70 smp_llsc_mb();
71} 71}
72 72
73static inline void __raw_spin_unlock(raw_spinlock_t *lock) 73static inline void __raw_spin_unlock(raw_spinlock_t *lock)
@@ -118,7 +118,7 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
118 : "memory"); 118 : "memory");
119 } 119 }
120 120
121 smp_mb(); 121 smp_llsc_mb();
122 122
123 return res == 0; 123 return res == 0;
124} 124}
@@ -183,7 +183,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
183 : "memory"); 183 : "memory");
184 } 184 }
185 185
186 smp_mb(); 186 smp_llsc_mb();
187} 187}
188 188
189/* Note the use of sub, not subu which will make the kernel die with an 189/* Note the use of sub, not subu which will make the kernel die with an
@@ -193,7 +193,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
193{ 193{
194 unsigned int tmp; 194 unsigned int tmp;
195 195
196 smp_mb(); 196 smp_llsc_mb();
197 197
198 if (R10000_LLSC_WAR) { 198 if (R10000_LLSC_WAR) {
199 __asm__ __volatile__( 199 __asm__ __volatile__(
@@ -262,7 +262,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
262 : "memory"); 262 : "memory");
263 } 263 }
264 264
265 smp_mb(); 265 smp_llsc_mb();
266} 266}
267 267
268static inline void __raw_write_unlock(raw_rwlock_t *rw) 268static inline void __raw_write_unlock(raw_rwlock_t *rw)
@@ -293,7 +293,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
293 " .set reorder \n" 293 " .set reorder \n"
294 " beqzl %1, 1b \n" 294 " beqzl %1, 1b \n"
295 " nop \n" 295 " nop \n"
296 __WEAK_ORDERING_MB 296 __WEAK_LLSC_MB
297 " li %2, 1 \n" 297 " li %2, 1 \n"
298 "2: \n" 298 "2: \n"
299 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) 299 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
@@ -310,7 +310,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
310 " beqz %1, 1b \n" 310 " beqz %1, 1b \n"
311 " nop \n" 311 " nop \n"
312 " .set reorder \n" 312 " .set reorder \n"
313 __WEAK_ORDERING_MB 313 __WEAK_LLSC_MB
314 " li %2, 1 \n" 314 " li %2, 1 \n"
315 "2: \n" 315 "2: \n"
316 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) 316 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
@@ -336,7 +336,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
336 " sc %1, %0 \n" 336 " sc %1, %0 \n"
337 " beqzl %1, 1b \n" 337 " beqzl %1, 1b \n"
338 " nop \n" 338 " nop \n"
339 __WEAK_ORDERING_MB 339 __WEAK_LLSC_MB
340 " li %2, 1 \n" 340 " li %2, 1 \n"
341 " .set reorder \n" 341 " .set reorder \n"
342 "2: \n" 342 "2: \n"
@@ -354,7 +354,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
354 " beqz %1, 3f \n" 354 " beqz %1, 3f \n"
355 " li %2, 1 \n" 355 " li %2, 1 \n"
356 "2: \n" 356 "2: \n"
357 __WEAK_ORDERING_MB 357 __WEAK_LLSC_MB
358 " .subsection 2 \n" 358 " .subsection 2 \n"
359 "3: b 1b \n" 359 "3: b 1b \n"
360 " li %2, 0 \n" 360 " li %2, 0 \n"
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 46bdb3f566f9..8d0b1cd4a45e 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -71,16 +71,6 @@ do { \
71 write_c0_userlocal(task_thread_info(current)->tp_value);\ 71 write_c0_userlocal(task_thread_info(current)->tp_value);\
72} while(0) 72} while(0)
73 73
74/*
75 * On SMP systems, when the scheduler does migration-cost autodetection,
76 * it needs a way to flush as much of the CPU's caches as possible.
77 *
78 * TODO: fill this in!
79 */
80static inline void sched_cacheflush(void)
81{
82}
83
84static inline unsigned long __xchg_u32(volatile int * m, unsigned int val) 74static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
85{ 75{
86 __u32 retval; 76 __u32 retval;
@@ -127,7 +117,7 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
127 raw_local_irq_restore(flags); /* implies memory barrier */ 117 raw_local_irq_restore(flags); /* implies memory barrier */
128 } 118 }
129 119
130 smp_mb(); 120 smp_llsc_mb();
131 121
132 return retval; 122 return retval;
133} 123}
@@ -175,7 +165,7 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
175 raw_local_irq_restore(flags); /* implies memory barrier */ 165 raw_local_irq_restore(flags); /* implies memory barrier */
176 } 166 }
177 167
178 smp_mb(); 168 smp_llsc_mb();
179 169
180 return retval; 170 return retval;
181} 171}
@@ -256,7 +246,7 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
256 raw_local_irq_restore(flags); /* implies memory barrier */ 246 raw_local_irq_restore(flags); /* implies memory barrier */
257 } 247 }
258 248
259 smp_mb(); 249 smp_llsc_mb();
260 250
261 return retval; 251 return retval;
262} 252}
@@ -362,7 +352,7 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
362 raw_local_irq_restore(flags); /* implies memory barrier */ 352 raw_local_irq_restore(flags); /* implies memory barrier */
363 } 353 }
364 354
365 smp_mb(); 355 smp_llsc_mb();
366 356
367 return retval; 357 return retval;
368} 358}
@@ -480,6 +470,6 @@ extern int stop_a_enabled;
480 */ 470 */
481#define __ARCH_WANT_UNLOCKED_CTXSW 471#define __ARCH_WANT_UNLOCKED_CTXSW
482 472
483#define arch_align_stack(x) (x) 473extern unsigned long arch_align_stack(unsigned long sp);
484 474
485#endif /* _ASM_SYSTEM_H */ 475#endif /* _ASM_SYSTEM_H */
diff --git a/include/asm-parisc/a.out.h b/include/asm-parisc/a.out.h
index 2a490cc9ec91..23e2c90943e5 100644
--- a/include/asm-parisc/a.out.h
+++ b/include/asm-parisc/a.out.h
@@ -23,6 +23,7 @@ struct exec
23 * prumpf */ 23 * prumpf */
24 24
25#define STACK_TOP TASK_SIZE 25#define STACK_TOP TASK_SIZE
26#define STACK_TOP_MAX DEFAULT_TASK_SIZE
26 27
27#endif 28#endif
28 29
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 11f4222597a0..5a85d1b025c8 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -31,8 +31,10 @@ typedef s32 compat_timer_t;
31 31
32typedef s32 compat_int_t; 32typedef s32 compat_int_t;
33typedef s32 compat_long_t; 33typedef s32 compat_long_t;
34typedef s64 compat_s64;
34typedef u32 compat_uint_t; 35typedef u32 compat_uint_t;
35typedef u32 compat_ulong_t; 36typedef u32 compat_ulong_t;
37typedef u64 compat_u64;
36 38
37struct compat_timespec { 39struct compat_timespec {
38 compat_time_t tv_sec; 40 compat_time_t tv_sec;
diff --git a/include/asm-parisc/fb.h b/include/asm-parisc/fb.h
new file mode 100644
index 000000000000..4d503a023ab2
--- /dev/null
+++ b/include/asm-parisc/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-parisc/fcntl.h b/include/asm-parisc/fcntl.h
index 317851fa78f3..1e1c824764ee 100644
--- a/include/asm-parisc/fcntl.h
+++ b/include/asm-parisc/fcntl.h
@@ -3,21 +3,22 @@
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */ 5 located on an ext2 file system */
6#define O_APPEND 00000010 6#define O_APPEND 000000010
7#define O_BLKSEEK 00000100 /* HPUX only */ 7#define O_BLKSEEK 000000100 /* HPUX only */
8#define O_CREAT 00000400 /* not fcntl */ 8#define O_CREAT 000000400 /* not fcntl */
9#define O_EXCL 00002000 /* not fcntl */ 9#define O_EXCL 000002000 /* not fcntl */
10#define O_LARGEFILE 00004000 10#define O_LARGEFILE 000004000
11#define O_SYNC 00100000 11#define O_SYNC 000100000
12#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ 12#define O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */
13#define O_NOCTTY 00400000 /* not fcntl */ 13#define O_NOCTTY 000400000 /* not fcntl */
14#define O_DSYNC 01000000 /* HPUX only */ 14#define O_DSYNC 001000000 /* HPUX only */
15#define O_RSYNC 02000000 /* HPUX only */ 15#define O_RSYNC 002000000 /* HPUX only */
16#define O_NOATIME 04000000 16#define O_NOATIME 004000000
17#define O_CLOEXEC 010000000 /* set close_on_exec */
17 18
18#define O_DIRECTORY 00010000 /* must be a directory */ 19#define O_DIRECTORY 000010000 /* must be a directory */
19#define O_NOFOLLOW 00000200 /* don't follow links */ 20#define O_NOFOLLOW 000000200 /* don't follow links */
20#define O_INVISIBLE 04000000 /* invisible I/O, for DMAPI/XDSM */ 21#define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */
21 22
22#define F_GETLK64 8 23#define F_GETLK64 8
23#define F_SETLK64 9 24#define F_SETLK64 9
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index beb2adb979d9..e88cacd63724 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -335,18 +335,14 @@ extern inline void pgd_clear(pgd_t * pgdp) { }
335 * The following only work if pte_present() is true. 335 * The following only work if pte_present() is true.
336 * Undefined behaviour if not.. 336 * Undefined behaviour if not..
337 */ 337 */
338extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
339extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 338extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
340extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 339extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
341extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 340extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
342extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 341extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
343extern inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
344 342
345extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_READ; return pte; }
346extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 343extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
347extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 344extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
348extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; } 345extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; }
349extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_READ; return pte; }
350extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 346extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
351extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 347extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
352extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } 348extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; }
@@ -451,21 +447,6 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned
451#endif 447#endif
452} 448}
453 449
454static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
455{
456#ifdef CONFIG_SMP
457 if (!pte_dirty(*ptep))
458 return 0;
459 return test_and_clear_bit(xlate_pabit(_PAGE_DIRTY_BIT), &pte_val(*ptep));
460#else
461 pte_t pte = *ptep;
462 if (!pte_dirty(pte))
463 return 0;
464 set_pte_at(vma->vm_mm, addr, ptep, pte_mkclean(pte));
465 return 1;
466#endif
467}
468
469extern spinlock_t pa_dbit_lock; 450extern spinlock_t pa_dbit_lock;
470 451
471struct mm_struct; 452struct mm_struct;
@@ -533,7 +514,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
533#define HAVE_ARCH_UNMAPPED_AREA 514#define HAVE_ARCH_UNMAPPED_AREA
534 515
535#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 516#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
536#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
537#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 517#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
538#define __HAVE_ARCH_PTEP_SET_WRPROTECT 518#define __HAVE_ARCH_PTEP_SET_WRPROTECT
539#define __HAVE_ARCH_PTE_SAME 519#define __HAVE_ARCH_PTE_SAME
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index 21fbfc5afd02..ee80c920b464 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -48,17 +48,6 @@ extern struct task_struct *_switch_to(struct task_struct *, struct task_struct *
48 (last) = _switch_to(prev, next); \ 48 (last) = _switch_to(prev, next); \
49} while(0) 49} while(0)
50 50
51/*
52 * On SMP systems, when the scheduler does migration-cost autodetection,
53 * it needs a way to flush as much of the CPU's caches as possible.
54 *
55 * TODO: fill this in!
56 */
57static inline void sched_cacheflush(void)
58{
59}
60
61
62/* interrupt control */ 51/* interrupt control */
63#define local_save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory") 52#define local_save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory")
64#define local_irq_disable() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) 53#define local_irq_disable() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
diff --git a/include/asm-powerpc/a.out.h b/include/asm-powerpc/a.out.h
index c7393a977364..5c5ea83f9349 100644
--- a/include/asm-powerpc/a.out.h
+++ b/include/asm-powerpc/a.out.h
@@ -26,9 +26,12 @@ struct exec
26#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ 26#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
27 STACK_TOP_USER32 : STACK_TOP_USER64) 27 STACK_TOP_USER32 : STACK_TOP_USER64)
28 28
29#define STACK_TOP_MAX STACK_TOP_USER64
30
29#else /* __powerpc64__ */ 31#else /* __powerpc64__ */
30 32
31#define STACK_TOP TASK_SIZE 33#define STACK_TOP TASK_SIZE
34#define STACK_TOP_MAX STACK_TOP
32 35
33#endif /* __powerpc64__ */ 36#endif /* __powerpc64__ */
34#endif /* __KERNEL__ */ 37#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/cache.h b/include/asm-powerpc/cache.h
index 642be62cf393..53507046a1b1 100644
--- a/include/asm-powerpc/cache.h
+++ b/include/asm-powerpc/cache.h
@@ -34,5 +34,9 @@ struct ppc64_caches {
34extern struct ppc64_caches ppc64_caches; 34extern struct ppc64_caches ppc64_caches;
35#endif /* __powerpc64__ && ! __ASSEMBLY__ */ 35#endif /* __powerpc64__ && ! __ASSEMBLY__ */
36 36
37#if !defined(__ASSEMBLY__)
38#define __read_mostly __attribute__((__section__(".data.read_mostly")))
39#endif
40
37#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
38#endif /* _ASM_POWERPC_CACHE_H */ 42#endif /* _ASM_POWERPC_CACHE_H */
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index aacaabd28ac1..64ab1ddbdf85 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -33,8 +33,10 @@ typedef s32 compat_timer_t;
33 33
34typedef s32 compat_int_t; 34typedef s32 compat_int_t;
35typedef s32 compat_long_t; 35typedef s32 compat_long_t;
36typedef s64 compat_s64;
36typedef u32 compat_uint_t; 37typedef u32 compat_uint_t;
37typedef u32 compat_ulong_t; 38typedef u32 compat_ulong_t;
39typedef u64 compat_u64;
38 40
39struct compat_timespec { 41struct compat_timespec {
40 compat_time_t tv_sec; 42 compat_time_t tv_sec;
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 82d595a52109..3dc8e2dfca84 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -111,7 +111,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
111/* CPU kernel features */ 111/* CPU kernel features */
112 112
113/* Retain the 32b definitions all use bottom half of word */ 113/* Retain the 32b definitions all use bottom half of word */
114#define CPU_FTR_SPLIT_ID_CACHE ASM_CONST(0x0000000000000001) 114#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000000000000001)
115#define CPU_FTR_L2CR ASM_CONST(0x0000000000000002) 115#define CPU_FTR_L2CR ASM_CONST(0x0000000000000002)
116#define CPU_FTR_SPEC7450 ASM_CONST(0x0000000000000004) 116#define CPU_FTR_SPEC7450 ASM_CONST(0x0000000000000004)
117#define CPU_FTR_ALTIVEC ASM_CONST(0x0000000000000008) 117#define CPU_FTR_ALTIVEC ASM_CONST(0x0000000000000008)
@@ -135,6 +135,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
135#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000) 135#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000)
136#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000) 136#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000)
137#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000) 137#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000)
138#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000)
138 139
139/* 140/*
140 * Add the 64-bit processor unique features in the top half of the word; 141 * Add the 64-bit processor unique features in the top half of the word;
@@ -154,7 +155,6 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
154#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000004000000000) 155#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000004000000000)
155#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000008000000000) 156#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000008000000000)
156#define CPU_FTR_SMT LONG_ASM_CONST(0x0000010000000000) 157#define CPU_FTR_SMT LONG_ASM_CONST(0x0000010000000000)
157#define CPU_FTR_COHERENT_ICACHE LONG_ASM_CONST(0x0000020000000000)
158#define CPU_FTR_LOCKLESS_TLBIE LONG_ASM_CONST(0x0000040000000000) 158#define CPU_FTR_LOCKLESS_TLBIE LONG_ASM_CONST(0x0000040000000000)
159#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000) 159#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000)
160#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000) 160#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
@@ -206,164 +206,149 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
206 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \ 206 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \
207 !defined(CONFIG_BOOKE)) 207 !defined(CONFIG_BOOKE))
208 208
209#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE) 209#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE | \
210#define CPU_FTRS_603 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 210 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE)
211#define CPU_FTRS_603 (CPU_FTR_COMMON | \
211 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ 212 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
212 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 213 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
213#define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 214#define CPU_FTRS_604 (CPU_FTR_COMMON | \
214 CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE | \ 215 CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE | \
215 CPU_FTR_PPC_LE) 216 CPU_FTR_PPC_LE)
216#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 217#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | \
217 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 218 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
218 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 219 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
219#define CPU_FTRS_740 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 220#define CPU_FTRS_740 (CPU_FTR_COMMON | \
220 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 221 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
221 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 222 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
222 CPU_FTR_PPC_LE) 223 CPU_FTR_PPC_LE)
223#define CPU_FTRS_750 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 224#define CPU_FTRS_750 (CPU_FTR_COMMON | \
224 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 225 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
225 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 226 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
226 CPU_FTR_PPC_LE) 227 CPU_FTR_PPC_LE)
227#define CPU_FTRS_750CL (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 228#define CPU_FTRS_750CL (CPU_FTRS_750 | CPU_FTR_HAS_HIGH_BATS)
228 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 229#define CPU_FTRS_750FX1 (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM)
229 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 230#define CPU_FTRS_750FX2 (CPU_FTRS_750 | CPU_FTR_NO_DPM)
230 CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 231#define CPU_FTRS_750FX (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | \
231#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 232 CPU_FTR_HAS_HIGH_BATS)
232 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 233#define CPU_FTRS_750GX (CPU_FTRS_750FX)
233 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 234#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | \
234 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM | CPU_FTR_PPC_LE)
235#define CPU_FTRS_750FX2 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
236 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
237 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
238 CPU_FTR_NO_DPM | CPU_FTR_PPC_LE)
239#define CPU_FTRS_750FX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
240 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
241 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
242 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
243#define CPU_FTRS_750GX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
244 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
245 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
246 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
247#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
248 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 235 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
249 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \ 236 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
250 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 237 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
251#define CPU_FTRS_7400 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 238#define CPU_FTRS_7400 (CPU_FTR_COMMON | \
252 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 239 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
253 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \ 240 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
254 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE) 241 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
255#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 242#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \
256 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 243 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
257 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 244 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
258 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 245 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
259#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 246#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \
260 CPU_FTR_USE_TB | \ 247 CPU_FTR_USE_TB | \
261 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 248 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
262 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 249 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
263 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 250 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
264 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 251 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
265#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 252#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \
266 CPU_FTR_USE_TB | \ 253 CPU_FTR_USE_TB | \
267 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 254 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
268 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 255 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
269 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 256 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
270#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 257#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \
271 CPU_FTR_USE_TB | \ 258 CPU_FTR_USE_TB | \
272 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \ 259 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \
273 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \ 260 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \
274 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 261 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
275#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 262#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \
276 CPU_FTR_USE_TB | \ 263 CPU_FTR_USE_TB | \
277 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 264 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
278 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 265 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
279 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 266 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
280 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 267 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
281#define CPU_FTRS_7455 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 268#define CPU_FTRS_7455 (CPU_FTR_COMMON | \
282 CPU_FTR_USE_TB | \ 269 CPU_FTR_USE_TB | \
283 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 270 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
284 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 271 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
285 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 272 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
286 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 273 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
287#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 274#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \
288 CPU_FTR_USE_TB | \ 275 CPU_FTR_USE_TB | \
289 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 276 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
290 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 277 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
291 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 278 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
292 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE) 279 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE)
293#define CPU_FTRS_7447 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 280#define CPU_FTRS_7447 (CPU_FTR_COMMON | \
294 CPU_FTR_USE_TB | \ 281 CPU_FTR_USE_TB | \
295 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 282 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
296 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 283 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
297 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 284 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
298 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 285 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
299#define CPU_FTRS_7447A (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 286#define CPU_FTRS_7447A (CPU_FTR_COMMON | \
300 CPU_FTR_USE_TB | \ 287 CPU_FTR_USE_TB | \
301 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 288 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
302 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 289 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
303 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 290 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
304 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 291 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
305#define CPU_FTRS_7448 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 292#define CPU_FTRS_7448 (CPU_FTR_COMMON | \
306 CPU_FTR_USE_TB | \ 293 CPU_FTR_USE_TB | \
307 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 294 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
308 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 295 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
309 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 296 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
310 CPU_FTR_PPC_LE) 297 CPU_FTR_PPC_LE)
311#define CPU_FTRS_82XX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 298#define CPU_FTRS_82XX (CPU_FTR_COMMON | \
312 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) 299 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
313#define CPU_FTRS_G2_LE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 300#define CPU_FTRS_G2_LE (CPU_FTR_MAYBE_CAN_DOZE | \
314 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS) 301 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS)
315#define CPU_FTRS_E300 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 302#define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \
316 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ 303 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
317 CPU_FTR_COMMON) 304 CPU_FTR_COMMON)
318#define CPU_FTRS_E300C2 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 305#define CPU_FTRS_E300C2 (CPU_FTR_MAYBE_CAN_DOZE | \
319 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ 306 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
320 CPU_FTR_COMMON | CPU_FTR_FPU_UNAVAILABLE) 307 CPU_FTR_COMMON | CPU_FTR_FPU_UNAVAILABLE)
321#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 308#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | \
322 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE) 309 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
323#define CPU_FTRS_8XX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB) 310#define CPU_FTRS_8XX (CPU_FTR_USE_TB)
324#define CPU_FTRS_40X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 311#define CPU_FTRS_40X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
325 CPU_FTR_NODSISRALIGN) 312#define CPU_FTRS_44X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
326#define CPU_FTRS_44X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 313#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \
327 CPU_FTR_NODSISRALIGN) 314 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE)
328#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN) 315#define CPU_FTRS_E500 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
329#define CPU_FTRS_E500 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 316#define CPU_FTRS_E500_2 (CPU_FTR_USE_TB | \
330 CPU_FTR_NODSISRALIGN)
331#define CPU_FTRS_E500_2 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
332 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN) 317 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN)
333#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 318#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
334 319
335/* 64-bit CPUs */ 320/* 64-bit CPUs */
336#define CPU_FTRS_POWER3 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 321#define CPU_FTRS_POWER3 (CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE) 322 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE)
338#define CPU_FTRS_RS64 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 323#define CPU_FTRS_RS64 (CPU_FTR_USE_TB | \
339 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ 324 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
340 CPU_FTR_MMCRA | CPU_FTR_CTRL) 325 CPU_FTR_MMCRA | CPU_FTR_CTRL)
341#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 326#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | \
342 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 327 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
343 CPU_FTR_MMCRA) 328 CPU_FTR_MMCRA)
344#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 329#define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | \
345 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
346 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) 331 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
347#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 332#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | \
348 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 333 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
349 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 334 CPU_FTR_MMCRA | CPU_FTR_SMT | \
350 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 335 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
351 CPU_FTR_PURR) 336 CPU_FTR_PURR)
352#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 337#define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | \
353 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 338 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
354 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 339 CPU_FTR_MMCRA | CPU_FTR_SMT | \
355 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 340 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
356 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ 341 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
357 CPU_FTR_DSCR) 342 CPU_FTR_DSCR)
358#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 343#define CPU_FTRS_CELL (CPU_FTR_USE_TB | \
359 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 344 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
360 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 345 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
361 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG) 346 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG)
362#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 347#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | \
363 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 348 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
364 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 349 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
365 CPU_FTR_PURR | CPU_FTR_REAL_LE) 350 CPU_FTR_PURR | CPU_FTR_REAL_LE)
366#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 351#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | \
367 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 352 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
368 353
369#ifdef __powerpc64__ 354#ifdef __powerpc64__
diff --git a/include/asm-powerpc/fb.h b/include/asm-powerpc/fb.h
new file mode 100644
index 000000000000..411af8d17a69
--- /dev/null
+++ b/include/asm-powerpc/fb.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
12 vma->vm_end - vma->vm_start,
13 vma->vm_page_prot);
14}
15
16static inline int fb_is_primary_device(struct fb_info *info)
17{
18 return 0;
19}
20
21#endif /* _ASM_FB_H_ */
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index afa700ded877..34146f0eea63 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -29,7 +29,7 @@
29#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 29#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
30 30
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <asm/ppc-pci.h> /* for ppc64_isabridge_dev */ 32#include <asm/ppc-pci.h> /* for isa_bridge_pcidev */
33 33
34#define fd_dma_setup(addr,size,mode,io) fd_ops->_dma_setup(addr,size,mode,io) 34#define fd_dma_setup(addr,size,mode,io) fd_ops->_dma_setup(addr,size,mode,io)
35 35
@@ -139,12 +139,12 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
139 if (bus_addr 139 if (bus_addr
140 && (addr != prev_addr || size != prev_size || dir != prev_dir)) { 140 && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
141 /* different from last time -- unmap prev */ 141 /* different from last time -- unmap prev */
142 pci_unmap_single(ppc64_isabridge_dev, bus_addr, prev_size, prev_dir); 142 pci_unmap_single(isa_bridge_pcidev, bus_addr, prev_size, prev_dir);
143 bus_addr = 0; 143 bus_addr = 0;
144 } 144 }
145 145
146 if (!bus_addr) /* need to map it */ 146 if (!bus_addr) /* need to map it */
147 bus_addr = pci_map_single(ppc64_isabridge_dev, addr, size, dir); 147 bus_addr = pci_map_single(isa_bridge_pcidev, addr, size, dir);
148 148
149 /* remember this one as prev */ 149 /* remember this one as prev */
150 prev_addr = addr; 150 prev_addr = addr;
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 62efd9d7a43d..bf6cd7cb996c 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -206,6 +206,7 @@
206#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 206#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
207#define H_QUERY_INT_STATE 0x1E4 207#define H_QUERY_INT_STATE 0x1E4
208#define H_POLL_PENDING 0x1D8 208#define H_POLL_PENDING 0x1D8
209#define H_ILLAN_ATTRIBUTES 0x244
209#define H_JOIN 0x298 210#define H_JOIN 0x298
210#define H_VASI_STATE 0x2A4 211#define H_VASI_STATE 0x2A4
211#define H_ENABLE_CRQ 0x2B0 212#define H_ENABLE_CRQ 0x2B0
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 350c9bdb31dc..bb8d965f96c6 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -607,9 +607,9 @@ static inline void iosync(void)
607 * 607 *
608 * * iounmap undoes such a mapping and can be hooked 608 * * iounmap undoes such a mapping and can be hooked
609 * 609 *
610 * * __ioremap_explicit (and the pending __iounmap_explicit) are low level 610 * * __ioremap_at (and the pending __iounmap_at) are low level functions to
611 * functions to create hand-made mappings for use only by the PCI code 611 * create hand-made mappings for use only by the PCI code and cannot
612 * and cannot currently be hooked. 612 * currently be hooked. Must be page aligned.
613 * 613 *
614 * * __ioremap is the low level implementation used by ioremap and 614 * * __ioremap is the low level implementation used by ioremap and
615 * ioremap_flags and cannot be hooked (but can be used by a hook on one 615 * ioremap_flags and cannot be hooked (but can be used by a hook on one
@@ -629,19 +629,9 @@ extern void __iomem *__ioremap(phys_addr_t, unsigned long size,
629 unsigned long flags); 629 unsigned long flags);
630extern void __iounmap(volatile void __iomem *addr); 630extern void __iounmap(volatile void __iomem *addr);
631 631
632extern int __ioremap_explicit(phys_addr_t p_addr, unsigned long v_addr, 632extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea,
633 unsigned long size, unsigned long flags); 633 unsigned long size, unsigned long flags);
634extern int __iounmap_explicit(volatile void __iomem *start, 634extern void __iounmap_at(void *ea, unsigned long size);
635 unsigned long size);
636
637extern void __iomem * reserve_phb_iospace(unsigned long size);
638
639/* Those are more 32 bits only functions */
640extern unsigned long iopa(unsigned long addr);
641extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
642extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
643 unsigned int size, int flags);
644
645 635
646/* 636/*
647 * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation 637 * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation
@@ -651,8 +641,8 @@ extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
651 */ 641 */
652#define HAVE_ARCH_PIO_SIZE 1 642#define HAVE_ARCH_PIO_SIZE 1
653#define PIO_OFFSET 0x00000000UL 643#define PIO_OFFSET 0x00000000UL
654#define PIO_MASK 0x3fffffffUL 644#define PIO_MASK (FULL_IO_SIZE - 1)
655#define PIO_RESERVED 0x40000000UL 645#define PIO_RESERVED (FULL_IO_SIZE)
656 646
657#define mmio_read16be(addr) readw_be(addr) 647#define mmio_read16be(addr) readw_be(addr)
658#define mmio_read32be(addr) readl_be(addr) 648#define mmio_read32be(addr) readl_be(addr)
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 05dd5a3eb3aa..0485c53db2b5 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -223,6 +223,15 @@ extern void irq_dispose_mapping(unsigned int virq);
223extern unsigned int irq_find_mapping(struct irq_host *host, 223extern unsigned int irq_find_mapping(struct irq_host *host,
224 irq_hw_number_t hwirq); 224 irq_hw_number_t hwirq);
225 225
226/**
227 * irq_create_direct_mapping - Allocate a virq for direct mapping
228 * @host: host to allocate the virq for or NULL for default host
229 *
230 * This routine is used for irq controllers which can choose the hardware
231 * interrupt numbers they generate. In such a case it's simplest to use
232 * the linux virq as the hardware interrupt number.
233 */
234extern unsigned int irq_create_direct_mapping(struct irq_host *host);
226 235
227/** 236/**
228 * irq_radix_revmap - Find a linux virq from a hw irq number. 237 * irq_radix_revmap - Find a linux virq from a hw irq number.
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index b0e40ff32ee0..8b08b447d6f3 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -65,20 +65,18 @@ typedef unsigned int kprobe_opcode_t;
65 } else if (name[0] != '.') \ 65 } else if (name[0] != '.') \
66 addr = *(kprobe_opcode_t **)addr; \ 66 addr = *(kprobe_opcode_t **)addr; \
67 } else { \ 67 } else { \
68 char dot_name[KSYM_NAME_LEN+1]; \ 68 char dot_name[KSYM_NAME_LEN]; \
69 dot_name[0] = '.'; \ 69 dot_name[0] = '.'; \
70 dot_name[1] = '\0'; \ 70 dot_name[1] = '\0'; \
71 strncat(dot_name, name, KSYM_NAME_LEN); \ 71 strncat(dot_name, name, KSYM_NAME_LEN - 2); \
72 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \ 72 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \
73 } \ 73 } \
74} 74}
75 75
76#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry)
77#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ 76#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
78 IS_TWI(instr) || IS_TDI(instr)) 77 IS_TWI(instr) || IS_TDI(instr))
79#else 78#else
80/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */ 79/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */
81#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry)
82#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) 80#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
83#endif 81#endif
84 82
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h
index 821ea0c512b4..567ed92cd91f 100644
--- a/include/asm-powerpc/lppaca.h
+++ b/include/asm-powerpc/lppaca.h
@@ -98,7 +98,7 @@ struct lppaca {
98 u64 saved_gpr5; // Saved GPR5 x30-x37 98 u64 saved_gpr5; // Saved GPR5 x30-x37
99 99
100 u8 reserved4; // Reserved x38-x38 100 u8 reserved4; // Reserved x38-x38
101 u8 cpuctls_task_attrs; // Task attributes for cpuctls x39-x39 101 u8 donate_dedicated_cpu; // Donate dedicated CPU cycles x39-x39
102 u8 fpregs_in_use; // FP regs in use x3A-x3A 102 u8 fpregs_in_use; // FP regs in use x3A-x3A
103 u8 pmcregs_in_use; // PMC regs in use x3B-x3B 103 u8 pmcregs_in_use; // PMC regs in use x3B-x3B
104 volatile u32 saved_decr; // Saved Decr Value x3C-x3F 104 volatile u32 saved_decr; // Saved Decr Value x3C-x3F
diff --git a/include/asm-powerpc/lv1call.h b/include/asm-powerpc/lv1call.h
index f733beeea63a..81713acf7529 100644
--- a/include/asm-powerpc/lv1call.h
+++ b/include/asm-powerpc/lv1call.h
@@ -238,6 +238,7 @@ LV1_CALL(destruct_virtual_address_space, 1, 0, 10 )
238LV1_CALL(configure_irq_state_bitmap, 3, 0, 11 ) 238LV1_CALL(configure_irq_state_bitmap, 3, 0, 11 )
239LV1_CALL(connect_irq_plug_ext, 5, 0, 12 ) 239LV1_CALL(connect_irq_plug_ext, 5, 0, 12 )
240LV1_CALL(release_memory, 1, 0, 13 ) 240LV1_CALL(release_memory, 1, 0, 13 )
241LV1_CALL(put_iopte, 5, 0, 15 )
241LV1_CALL(disconnect_irq_plug_ext, 3, 0, 17 ) 242LV1_CALL(disconnect_irq_plug_ext, 3, 0, 17 )
242LV1_CALL(construct_event_receive_port, 0, 1, 18 ) 243LV1_CALL(construct_event_receive_port, 0, 1, 18 )
243LV1_CALL(destruct_event_receive_port, 1, 0, 19 ) 244LV1_CALL(destruct_event_receive_port, 1, 0, 19 )
@@ -268,6 +269,8 @@ LV1_CALL(remove_repository_node, 4, 0, 93 )
268LV1_CALL(read_htab_entries, 2, 5, 95 ) 269LV1_CALL(read_htab_entries, 2, 5, 95 )
269LV1_CALL(set_dabr, 2, 0, 96 ) 270LV1_CALL(set_dabr, 2, 0, 96 )
270LV1_CALL(get_total_execution_time, 2, 1, 103 ) 271LV1_CALL(get_total_execution_time, 2, 1, 103 )
272LV1_CALL(allocate_io_segment, 3, 1, 116 )
273LV1_CALL(release_io_segment, 2, 0, 117 )
271LV1_CALL(construct_io_irq_outlet, 1, 1, 120 ) 274LV1_CALL(construct_io_irq_outlet, 1, 1, 120 )
272LV1_CALL(destruct_io_irq_outlet, 1, 0, 121 ) 275LV1_CALL(destruct_io_irq_outlet, 1, 0, 121 )
273LV1_CALL(map_htab, 1, 1, 122 ) 276LV1_CALL(map_htab, 1, 1, 122 )
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 6cf1a831f550..71c6e7eb2a26 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -218,7 +218,7 @@ struct machdep_calls {
218 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial); 218 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
219 219
220 /* Called in indirect_* to avoid touching devices */ 220 /* Called in indirect_* to avoid touching devices */
221 int (*pci_exclude_device)(unsigned char, unsigned char); 221 int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
222 222
223 /* Called at then very end of pcibios_init() */ 223 /* Called at then very end of pcibios_init() */
224 void (*pcibios_after_init)(void); 224 void (*pcibios_after_init)(void);
diff --git a/include/asm-powerpc/mmu-8xx.h b/include/asm-powerpc/mmu-8xx.h
new file mode 100644
index 000000000000..952bd8899f2f
--- /dev/null
+++ b/include/asm-powerpc/mmu-8xx.h
@@ -0,0 +1,147 @@
1#ifndef _ASM_POWERPC_MMU_8XX_H_
2#define _ASM_POWERPC_MMU_8XX_H_
3/*
4 * PPC8xx support
5 */
6
7/* Control/status registers for the MPC8xx.
8 * A write operation to these registers causes serialized access.
9 * During software tablewalk, the registers used perform mask/shift-add
10 * operations when written/read. A TLB entry is created when the Mx_RPN
11 * is written, and the contents of several registers are used to
12 * create the entry.
13 */
14#define SPRN_MI_CTR 784 /* Instruction TLB control register */
15#define MI_GPM 0x80000000 /* Set domain manager mode */
16#define MI_PPM 0x40000000 /* Set subpage protection */
17#define MI_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */
18#define MI_RSV4I 0x08000000 /* Reserve 4 TLB entries */
19#define MI_PPCS 0x02000000 /* Use MI_RPN prob/priv state */
20#define MI_IDXMASK 0x00001f00 /* TLB index to be loaded */
21#define MI_RESETVAL 0x00000000 /* Value of register at reset */
22
23/* These are the Ks and Kp from the PowerPC books. For proper operation,
24 * Ks = 0, Kp = 1.
25 */
26#define SPRN_MI_AP 786
27#define MI_Ks 0x80000000 /* Should not be set */
28#define MI_Kp 0x40000000 /* Should always be set */
29
30/* The effective page number register. When read, contains the information
31 * about the last instruction TLB miss. When MI_RPN is written, bits in
32 * this register are used to create the TLB entry.
33 */
34#define SPRN_MI_EPN 787
35#define MI_EPNMASK 0xfffff000 /* Effective page number for entry */
36#define MI_EVALID 0x00000200 /* Entry is valid */
37#define MI_ASIDMASK 0x0000000f /* ASID match value */
38 /* Reset value is undefined */
39
40/* A "level 1" or "segment" or whatever you want to call it register.
41 * For the instruction TLB, it contains bits that get loaded into the
42 * TLB entry when the MI_RPN is written.
43 */
44#define SPRN_MI_TWC 789
45#define MI_APG 0x000001e0 /* Access protection group (0) */
46#define MI_GUARDED 0x00000010 /* Guarded storage */
47#define MI_PSMASK 0x0000000c /* Mask of page size bits */
48#define MI_PS8MEG 0x0000000c /* 8M page size */
49#define MI_PS512K 0x00000004 /* 512K page size */
50#define MI_PS4K_16K 0x00000000 /* 4K or 16K page size */
51#define MI_SVALID 0x00000001 /* Segment entry is valid */
52 /* Reset value is undefined */
53
54/* Real page number. Defined by the pte. Writing this register
55 * causes a TLB entry to be created for the instruction TLB, using
56 * additional information from the MI_EPN, and MI_TWC registers.
57 */
58#define SPRN_MI_RPN 790
59
60/* Define an RPN value for mapping kernel memory to large virtual
61 * pages for boot initialization. This has real page number of 0,
62 * large page size, shared page, cache enabled, and valid.
63 * Also mark all subpages valid and write access.
64 */
65#define MI_BOOTINIT 0x000001fd
66
67#define SPRN_MD_CTR 792 /* Data TLB control register */
68#define MD_GPM 0x80000000 /* Set domain manager mode */
69#define MD_PPM 0x40000000 /* Set subpage protection */
70#define MD_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */
71#define MD_WTDEF 0x10000000 /* Set writethrough when MMU dis */
72#define MD_RSV4I 0x08000000 /* Reserve 4 TLB entries */
73#define MD_TWAM 0x04000000 /* Use 4K page hardware assist */
74#define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */
75#define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */
76#define MD_RESETVAL 0x04000000 /* Value of register at reset */
77
78#define SPRN_M_CASID 793 /* Address space ID (context) to match */
79#define MC_ASIDMASK 0x0000000f /* Bits used for ASID value */
80
81
82/* These are the Ks and Kp from the PowerPC books. For proper operation,
83 * Ks = 0, Kp = 1.
84 */
85#define SPRN_MD_AP 794
86#define MD_Ks 0x80000000 /* Should not be set */
87#define MD_Kp 0x40000000 /* Should always be set */
88
89/* The effective page number register. When read, contains the information
90 * about the last instruction TLB miss. When MD_RPN is written, bits in
91 * this register are used to create the TLB entry.
92 */
93#define SPRN_MD_EPN 795
94#define MD_EPNMASK 0xfffff000 /* Effective page number for entry */
95#define MD_EVALID 0x00000200 /* Entry is valid */
96#define MD_ASIDMASK 0x0000000f /* ASID match value */
97 /* Reset value is undefined */
98
99/* The pointer to the base address of the first level page table.
100 * During a software tablewalk, reading this register provides the address
101 * of the entry associated with MD_EPN.
102 */
103#define SPRN_M_TWB 796
104#define M_L1TB 0xfffff000 /* Level 1 table base address */
105#define M_L1INDX 0x00000ffc /* Level 1 index, when read */
106 /* Reset value is undefined */
107
108/* A "level 1" or "segment" or whatever you want to call it register.
109 * For the data TLB, it contains bits that get loaded into the TLB entry
110 * when the MD_RPN is written. It is also provides the hardware assist
111 * for finding the PTE address during software tablewalk.
112 */
113#define SPRN_MD_TWC 797
114#define MD_L2TB 0xfffff000 /* Level 2 table base address */
115#define MD_L2INDX 0xfffffe00 /* Level 2 index (*pte), when read */
116#define MD_APG 0x000001e0 /* Access protection group (0) */
117#define MD_GUARDED 0x00000010 /* Guarded storage */
118#define MD_PSMASK 0x0000000c /* Mask of page size bits */
119#define MD_PS8MEG 0x0000000c /* 8M page size */
120#define MD_PS512K 0x00000004 /* 512K page size */
121#define MD_PS4K_16K 0x00000000 /* 4K or 16K page size */
122#define MD_WT 0x00000002 /* Use writethrough page attribute */
123#define MD_SVALID 0x00000001 /* Segment entry is valid */
124 /* Reset value is undefined */
125
126
127/* Real page number. Defined by the pte. Writing this register
128 * causes a TLB entry to be created for the data TLB, using
129 * additional information from the MD_EPN, and MD_TWC registers.
130 */
131#define SPRN_MD_RPN 798
132
133/* This is a temporary storage register that could be used to save
134 * a processor working register during a tablewalk.
135 */
136#define SPRN_M_TW 799
137
138#ifndef __ASSEMBLY__
139typedef unsigned long phys_addr_t;
140
141typedef struct {
142 unsigned long id;
143 unsigned long vdso_base;
144} mm_context_t;
145#endif /* !__ASSEMBLY__ */
146
147#endif /* _ASM_POWERPC_MMU_8XX_H_ */
diff --git a/include/asm-powerpc/mmu-fsl-booke.h b/include/asm-powerpc/mmu-fsl-booke.h
new file mode 100644
index 000000000000..37580004cd7a
--- /dev/null
+++ b/include/asm-powerpc/mmu-fsl-booke.h
@@ -0,0 +1,88 @@
1#ifndef _ASM_POWERPC_MMU_FSL_BOOKE_H_
2#define _ASM_POWERPC_MMU_FSL_BOOKE_H_
3/*
4 * Freescale Book-E MMU support
5 */
6
7/* Book-E defined page sizes */
8#define BOOKE_PAGESZ_1K 0
9#define BOOKE_PAGESZ_4K 1
10#define BOOKE_PAGESZ_16K 2
11#define BOOKE_PAGESZ_64K 3
12#define BOOKE_PAGESZ_256K 4
13#define BOOKE_PAGESZ_1M 5
14#define BOOKE_PAGESZ_4M 6
15#define BOOKE_PAGESZ_16M 7
16#define BOOKE_PAGESZ_64M 8
17#define BOOKE_PAGESZ_256M 9
18#define BOOKE_PAGESZ_1GB 10
19#define BOOKE_PAGESZ_4GB 11
20#define BOOKE_PAGESZ_16GB 12
21#define BOOKE_PAGESZ_64GB 13
22#define BOOKE_PAGESZ_256GB 14
23#define BOOKE_PAGESZ_1TB 15
24
25#define MAS0_TLBSEL(x) ((x << 28) & 0x30000000)
26#define MAS0_ESEL(x) ((x << 16) & 0x0FFF0000)
27#define MAS0_NV(x) ((x) & 0x00000FFF)
28
29#define MAS1_VALID 0x80000000
30#define MAS1_IPROT 0x40000000
31#define MAS1_TID(x) ((x << 16) & 0x3FFF0000)
32#define MAS1_TS 0x00001000
33#define MAS1_TSIZE(x) ((x << 8) & 0x00000F00)
34
35#define MAS2_EPN 0xFFFFF000
36#define MAS2_X0 0x00000040
37#define MAS2_X1 0x00000020
38#define MAS2_W 0x00000010
39#define MAS2_I 0x00000008
40#define MAS2_M 0x00000004
41#define MAS2_G 0x00000002
42#define MAS2_E 0x00000001
43
44#define MAS3_RPN 0xFFFFF000
45#define MAS3_U0 0x00000200
46#define MAS3_U1 0x00000100
47#define MAS3_U2 0x00000080
48#define MAS3_U3 0x00000040
49#define MAS3_UX 0x00000020
50#define MAS3_SX 0x00000010
51#define MAS3_UW 0x00000008
52#define MAS3_SW 0x00000004
53#define MAS3_UR 0x00000002
54#define MAS3_SR 0x00000001
55
56#define MAS4_TLBSELD(x) MAS0_TLBSEL(x)
57#define MAS4_TIDDSEL 0x000F0000
58#define MAS4_TSIZED(x) MAS1_TSIZE(x)
59#define MAS4_X0D 0x00000040
60#define MAS4_X1D 0x00000020
61#define MAS4_WD 0x00000010
62#define MAS4_ID 0x00000008
63#define MAS4_MD 0x00000004
64#define MAS4_GD 0x00000002
65#define MAS4_ED 0x00000001
66
67#define MAS6_SPID0 0x3FFF0000
68#define MAS6_SPID1 0x00007FFE
69#define MAS6_SAS 0x00000001
70#define MAS6_SPID MAS6_SPID0
71
72#define MAS7_RPN 0xFFFFFFFF
73
74#ifndef __ASSEMBLY__
75
76#ifndef CONFIG_PHYS_64BIT
77typedef unsigned long phys_addr_t;
78#else
79typedef unsigned long long phys_addr_t;
80#endif
81
82typedef struct {
83 unsigned long id;
84 unsigned long vdso_base;
85} mm_context_t;
86#endif /* !__ASSEMBLY__ */
87
88#endif /* _ASM_POWERPC_MMU_FSL_BOOKE_H_ */
diff --git a/include/asm-powerpc/mmu-hash32.h b/include/asm-powerpc/mmu-hash32.h
new file mode 100644
index 000000000000..4bd735be3833
--- /dev/null
+++ b/include/asm-powerpc/mmu-hash32.h
@@ -0,0 +1,91 @@
1#ifndef _ASM_POWERPC_MMU_HASH32_H_
2#define _ASM_POWERPC_MMU_HASH32_H_
3/*
4 * 32-bit hash table MMU support
5 */
6
7/*
8 * BATs
9 */
10
11/* Block size masks */
12#define BL_128K 0x000
13#define BL_256K 0x001
14#define BL_512K 0x003
15#define BL_1M 0x007
16#define BL_2M 0x00F
17#define BL_4M 0x01F
18#define BL_8M 0x03F
19#define BL_16M 0x07F
20#define BL_32M 0x0FF
21#define BL_64M 0x1FF
22#define BL_128M 0x3FF
23#define BL_256M 0x7FF
24
25/* BAT Access Protection */
26#define BPP_XX 0x00 /* No access */
27#define BPP_RX 0x01 /* Read only */
28#define BPP_RW 0x02 /* Read/write */
29
30#ifndef __ASSEMBLY__
31struct ppc_bat {
32 struct {
33 unsigned long bepi:15; /* Effective page index (virtual address) */
34 unsigned long :4; /* Unused */
35 unsigned long bl:11; /* Block size mask */
36 unsigned long vs:1; /* Supervisor valid */
37 unsigned long vp:1; /* User valid */
38 } batu; /* Upper register */
39 struct {
40 unsigned long brpn:15; /* Real page index (physical address) */
41 unsigned long :10; /* Unused */
42 unsigned long w:1; /* Write-thru cache */
43 unsigned long i:1; /* Cache inhibit */
44 unsigned long m:1; /* Memory coherence */
45 unsigned long g:1; /* Guarded (MBZ in IBAT) */
46 unsigned long :1; /* Unused */
47 unsigned long pp:2; /* Page access protections */
48 } batl; /* Lower register */
49};
50#endif /* !__ASSEMBLY__ */
51
52/*
53 * Hash table
54 */
55
56/* Values for PP (assumes Ks=0, Kp=1) */
57#define PP_RWXX 0 /* Supervisor read/write, User none */
58#define PP_RWRX 1 /* Supervisor read/write, User read */
59#define PP_RWRW 2 /* Supervisor read/write, User read/write */
60#define PP_RXRX 3 /* Supervisor read, User read */
61
62#ifndef __ASSEMBLY__
63
64/* Hardware Page Table Entry */
65struct hash_pte {
66 unsigned long v:1; /* Entry is valid */
67 unsigned long vsid:24; /* Virtual segment identifier */
68 unsigned long h:1; /* Hash algorithm indicator */
69 unsigned long api:6; /* Abbreviated page index */
70 unsigned long rpn:20; /* Real (physical) page number */
71 unsigned long :3; /* Unused */
72 unsigned long r:1; /* Referenced */
73 unsigned long c:1; /* Changed */
74 unsigned long w:1; /* Write-thru cache mode */
75 unsigned long i:1; /* Cache inhibited */
76 unsigned long m:1; /* Memory coherence */
77 unsigned long g:1; /* Guarded */
78 unsigned long :1; /* Unused */
79 unsigned long pp:2; /* Page protection */
80};
81
82typedef struct {
83 unsigned long id;
84 unsigned long vdso_base;
85} mm_context_t;
86
87typedef unsigned long phys_addr_t;
88
89#endif /* !__ASSEMBLY__ */
90
91#endif /* _ASM_POWERPC_MMU_HASH32_H_ */
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index b8dca30bd0b5..695962f02059 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -94,6 +94,9 @@ extern char initial_stab[];
94#define HPTE_R_C ASM_CONST(0x0000000000000080) 94#define HPTE_R_C ASM_CONST(0x0000000000000080)
95#define HPTE_R_R ASM_CONST(0x0000000000000100) 95#define HPTE_R_R ASM_CONST(0x0000000000000100)
96 96
97#define HPTE_V_1TB_SEG ASM_CONST(0x4000000000000000)
98#define HPTE_V_VRMA_MASK ASM_CONST(0x4001ffffff000000)
99
97/* Values for PP (assumes Ks=0, Kp=1) */ 100/* Values for PP (assumes Ks=0, Kp=1) */
98/* pp0 will always be 0 for linux */ 101/* pp0 will always be 0 for linux */
99#define PP_RWXX 0 /* Supervisor read/write, User none */ 102#define PP_RWXX 0 /* Supervisor read/write, User none */
@@ -103,12 +106,12 @@ extern char initial_stab[];
103 106
104#ifndef __ASSEMBLY__ 107#ifndef __ASSEMBLY__
105 108
106typedef struct { 109struct hash_pte {
107 unsigned long v; 110 unsigned long v;
108 unsigned long r; 111 unsigned long r;
109} hpte_t; 112};
110 113
111extern hpte_t *htab_address; 114extern struct hash_pte *htab_address;
112extern unsigned long htab_size_bytes; 115extern unsigned long htab_size_bytes;
113extern unsigned long htab_hash_mask; 116extern unsigned long htab_hash_mask;
114 117
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index fe510fff8907..d44d211e7588 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -5,13 +5,18 @@
5#ifdef CONFIG_PPC64 5#ifdef CONFIG_PPC64
6/* 64-bit classic hash table MMU */ 6/* 64-bit classic hash table MMU */
7# include <asm/mmu-hash64.h> 7# include <asm/mmu-hash64.h>
8#elif defined(CONFIG_PPC_STD_MMU)
9/* 32-bit classic hash table MMU */
10# include <asm/mmu-hash32.h>
8#elif defined(CONFIG_44x) 11#elif defined(CONFIG_44x)
9/* 44x-style software loaded TLB */ 12/* 44x-style software loaded TLB */
10# include <asm/mmu-44x.h> 13# include <asm/mmu-44x.h>
11#else 14#elif defined(CONFIG_FSL_BOOKE)
12/* Other 32-bit. FIXME: split up the other 32-bit MMU types, and 15/* Freescale Book-E software loaded TLB */
13 * revise for arch/powerpc */ 16# include <asm/mmu-fsl-booke.h>
14# include <asm-ppc/mmu.h> 17#elif defined (CONFIG_PPC_8xx)
18/* Motorola/Freescale 8xx software loaded TLB */
19# include <asm/mmu-8xx.h>
15#endif 20#endif
16 21
17#endif /* __KERNEL__ */ 22#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index 40c9e5a13ff1..f863ac21409e 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -2,16 +2,210 @@
2#define __ASM_POWERPC_MMU_CONTEXT_H 2#define __ASM_POWERPC_MMU_CONTEXT_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <asm/mmu.h>
6#include <asm/cputable.h>
7#include <asm-generic/mm_hooks.h>
8
5#ifndef CONFIG_PPC64 9#ifndef CONFIG_PPC64
6#include <asm-ppc/mmu_context.h> 10#include <asm/atomic.h>
11#include <asm/bitops.h>
12
13/*
14 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
15 * (virtual segment identifiers) for each context. Although the
16 * hardware supports 24-bit VSIDs, and thus >1 million contexts,
17 * we only use 32,768 of them. That is ample, since there can be
18 * at most around 30,000 tasks in the system anyway, and it means
19 * that we can use a bitmap to indicate which contexts are in use.
20 * Using a bitmap means that we entirely avoid all of the problems
21 * that we used to have when the context number overflowed,
22 * particularly on SMP systems.
23 * -- paulus.
24 */
25
26/*
27 * This function defines the mapping from contexts to VSIDs (virtual
28 * segment IDs). We use a skew on both the context and the high 4 bits
29 * of the 32-bit virtual address (the "effective segment ID") in order
30 * to spread out the entries in the MMU hash table. Note, if this
31 * function is changed then arch/ppc/mm/hashtable.S will have to be
32 * changed to correspond.
33 */
34#define CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
35 & 0xffffff)
36
37/*
38 The MPC8xx has only 16 contexts. We rotate through them on each
39 task switch. A better way would be to keep track of tasks that
40 own contexts, and implement an LRU usage. That way very active
41 tasks don't always have to pay the TLB reload overhead. The
42 kernel pages are mapped shared, so the kernel can run on behalf
43 of any task that makes a kernel entry. Shared does not mean they
44 are not protected, just that the ASID comparison is not performed.
45 -- Dan
46
47 The IBM4xx has 256 contexts, so we can just rotate through these
48 as a way of "switching" contexts. If the TID of the TLB is zero,
49 the PID/TID comparison is disabled, so we can use a TID of zero
50 to represent all kernel pages as shared among all contexts.
51 -- Dan
52 */
53
54static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
55{
56}
57
58#ifdef CONFIG_8xx
59#define NO_CONTEXT 16
60#define LAST_CONTEXT 15
61#define FIRST_CONTEXT 0
62
63#elif defined(CONFIG_4xx)
64#define NO_CONTEXT 256
65#define LAST_CONTEXT 255
66#define FIRST_CONTEXT 1
67
68#elif defined(CONFIG_E200) || defined(CONFIG_E500)
69#define NO_CONTEXT 256
70#define LAST_CONTEXT 255
71#define FIRST_CONTEXT 1
72
73#else
74
75/* PPC 6xx, 7xx CPUs */
76#define NO_CONTEXT ((unsigned long) -1)
77#define LAST_CONTEXT 32767
78#define FIRST_CONTEXT 1
79#endif
80
81/*
82 * Set the current MMU context.
83 * On 32-bit PowerPCs (other than the 8xx embedded chips), this is done by
84 * loading up the segment registers for the user part of the address space.
85 *
86 * Since the PGD is immediately available, it is much faster to simply
87 * pass this along as a second parameter, which is required for 8xx and
88 * can be used for debugging on all processors (if you happen to have
89 * an Abatron).
90 */
91extern void set_context(unsigned long contextid, pgd_t *pgd);
92
93/*
94 * Bitmap of contexts in use.
95 * The size of this bitmap is LAST_CONTEXT + 1 bits.
96 */
97extern unsigned long context_map[];
98
99/*
100 * This caches the next context number that we expect to be free.
101 * Its use is an optimization only, we can't rely on this context
102 * number to be free, but it usually will be.
103 */
104extern unsigned long next_mmu_context;
105
106/*
107 * If we don't have sufficient contexts to give one to every task
108 * that could be in the system, we need to be able to steal contexts.
109 * These variables support that.
110 */
111#if LAST_CONTEXT < 30000
112#define FEW_CONTEXTS 1
113extern atomic_t nr_free_contexts;
114extern struct mm_struct *context_mm[LAST_CONTEXT+1];
115extern void steal_context(void);
116#endif
117
118/*
119 * Get a new mmu context for the address space described by `mm'.
120 */
121static inline void get_mmu_context(struct mm_struct *mm)
122{
123 unsigned long ctx;
124
125 if (mm->context.id != NO_CONTEXT)
126 return;
127#ifdef FEW_CONTEXTS
128 while (atomic_dec_if_positive(&nr_free_contexts) < 0)
129 steal_context();
130#endif
131 ctx = next_mmu_context;
132 while (test_and_set_bit(ctx, context_map)) {
133 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
134 if (ctx > LAST_CONTEXT)
135 ctx = 0;
136 }
137 next_mmu_context = (ctx + 1) & LAST_CONTEXT;
138 mm->context.id = ctx;
139#ifdef FEW_CONTEXTS
140 context_mm[ctx] = mm;
141#endif
142}
143
144/*
145 * Set up the context for a new address space.
146 */
147static inline int init_new_context(struct task_struct *t, struct mm_struct *mm)
148{
149 mm->context.id = NO_CONTEXT;
150 mm->context.vdso_base = 0;
151 return 0;
152}
153
154/*
155 * We're finished using the context for an address space.
156 */
157static inline void destroy_context(struct mm_struct *mm)
158{
159 preempt_disable();
160 if (mm->context.id != NO_CONTEXT) {
161 clear_bit(mm->context.id, context_map);
162 mm->context.id = NO_CONTEXT;
163#ifdef FEW_CONTEXTS
164 atomic_inc(&nr_free_contexts);
165#endif
166 }
167 preempt_enable();
168}
169
170static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
171 struct task_struct *tsk)
172{
173#ifdef CONFIG_ALTIVEC
174 if (cpu_has_feature(CPU_FTR_ALTIVEC))
175 asm volatile ("dssall;\n"
176#ifndef CONFIG_POWER4
177 "sync;\n" /* G4 needs a sync here, G5 apparently not */
178#endif
179 : : );
180#endif /* CONFIG_ALTIVEC */
181
182 tsk->thread.pgdir = next->pgd;
183
184 /* No need to flush userspace segments if the mm doesnt change */
185 if (prev == next)
186 return;
187
188 /* Setup new userspace context */
189 get_mmu_context(next);
190 set_context(next->context.id, next->pgd);
191}
192
193#define deactivate_mm(tsk,mm) do { } while (0)
194
195/*
196 * After we have set current->mm to a new value, this activates
197 * the context for the new mm so we see the new mappings.
198 */
199#define activate_mm(active_mm, mm) switch_mm(active_mm, mm, current)
200
201extern void mmu_context_init(void);
202
203
7#else 204#else
8 205
9#include <linux/kernel.h> 206#include <linux/kernel.h>
10#include <linux/mm.h> 207#include <linux/mm.h>
11#include <linux/sched.h> 208#include <linux/sched.h>
12#include <asm/mmu.h>
13#include <asm/cputable.h>
14#include <asm-generic/mm_hooks.h>
15 209
16/* 210/*
17 * Copyright (C) 2001 PPC 64 Team, IBM Corp 211 * Copyright (C) 2001 PPC 64 Team, IBM Corp
diff --git a/include/asm-powerpc/mpc86xx.h b/include/asm-powerpc/mpc86xx.h
index b85df45b1a84..15f650f987e7 100644
--- a/include/asm-powerpc/mpc86xx.h
+++ b/include/asm-powerpc/mpc86xx.h
@@ -19,12 +19,6 @@
19 19
20#ifdef CONFIG_PPC_86xx 20#ifdef CONFIG_PPC_86xx
21 21
22#define _IO_BASE isa_io_base
23#define _ISA_MEM_BASE isa_mem_base
24#ifdef CONFIG_PCI
25#define PCI_DRAM_OFFSET pci_dram_offset
26#endif
27
28#define CPU0_BOOT_RELEASE 0x01000000 22#define CPU0_BOOT_RELEASE 0x01000000
29#define CPU1_BOOT_RELEASE 0x02000000 23#define CPU1_BOOT_RELEASE 0x02000000
30#define CPU_ALL_RELEASED (CPU0_BOOT_RELEASE | CPU1_BOOT_RELEASE) 24#define CPU_ALL_RELEASED (CPU0_BOOT_RELEASE | CPU1_BOOT_RELEASE)
diff --git a/include/asm-powerpc/mpc8xx.h b/include/asm-powerpc/mpc8xx.h
index 580371120e1a..2be014b6f57c 100644
--- a/include/asm-powerpc/mpc8xx.h
+++ b/include/asm-powerpc/mpc8xx.h
@@ -23,6 +23,10 @@
23#include <platforms/8xx/mpc885ads.h> 23#include <platforms/8xx/mpc885ads.h>
24#endif 24#endif
25 25
26#ifdef CONFIG_PCMCIA_M8XX
27extern struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
28#endif
29
26#endif /* CONFIG_8xx */ 30#endif /* CONFIG_8xx */
27#endif /* __CONFIG_8xx_DEFS */ 31#endif /* __CONFIG_8xx_DEFS */
28#endif /* __KERNEL__ */ 32#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index 2ffb06abe881..262db6b8da73 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -296,6 +296,9 @@ struct mpic
296 unsigned int dcr_base; 296 unsigned int dcr_base;
297#endif 297#endif
298 298
299 /* Protected sources */
300 unsigned long *protected;
301
299#ifdef CONFIG_MPIC_WEIRD 302#ifdef CONFIG_MPIC_WEIRD
300 /* Pointer to HW info array */ 303 /* Pointer to HW info array */
301 u32 *hw_set; 304 u32 *hw_set;
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index e9af49eb1aa8..ec2a8a2c737c 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -3,14 +3,12 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/mod_devicetable.h> 6#include <linux/of.h>
7#include <asm/prom.h>
8
9 7
10/* 8/*
11 * The of_device is a kind of "base class" that is a superset of 9 * The of_device is a kind of "base class" that is a superset of
12 * struct device for use by devices attached to an OF node and 10 * struct device for use by devices attached to an OF node and
13 * probed using OF properties 11 * probed using OF properties.
14 */ 12 */
15struct of_device 13struct of_device
16{ 14{
@@ -18,24 +16,14 @@ struct of_device
18 u64 dma_mask; /* DMA mask */ 16 u64 dma_mask; /* DMA mask */
19 struct device dev; /* Generic device interface */ 17 struct device dev; /* Generic device interface */
20}; 18};
21#define to_of_device(d) container_of(d, struct of_device, dev)
22
23extern const struct of_device_id *of_match_node(
24 const struct of_device_id *matches, const struct device_node *node);
25extern const struct of_device_id *of_match_device(
26 const struct of_device_id *matches, const struct of_device *dev);
27
28extern struct of_device *of_dev_get(struct of_device *dev);
29extern void of_dev_put(struct of_device *dev);
30
31extern int of_device_register(struct of_device *ofdev);
32extern void of_device_unregister(struct of_device *ofdev);
33extern void of_release_dev(struct device *dev);
34 19
35extern ssize_t of_device_get_modalias(struct of_device *ofdev, 20extern ssize_t of_device_get_modalias(struct of_device *ofdev,
36 char *str, ssize_t len); 21 char *str, ssize_t len);
37extern int of_device_uevent(struct device *dev, 22extern int of_device_uevent(struct device *dev,
38 char **envp, int num_envp, char *buffer, int buffer_size); 23 char **envp, int num_envp, char *buffer, int buffer_size);
39 24
25/* This is just here during the transition */
26#include <linux/of_device.h>
27
40#endif /* __KERNEL__ */ 28#endif /* __KERNEL__ */
41#endif /* _ASM_POWERPC_OF_DEVICE_H */ 29#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-powerpc/of_platform.h b/include/asm-powerpc/of_platform.h
index 217eafb167e9..80e6fad28b4f 100644
--- a/include/asm-powerpc/of_platform.h
+++ b/include/asm-powerpc/of_platform.h
@@ -1,3 +1,5 @@
1#ifndef _ASM_POWERPC_OF_PLATFORM_H
2#define _ASM_POWERPC_OF_PLATFORM_H
1/* 3/*
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. 4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org> 5 * <benh@kernel.crashing.org>
@@ -9,37 +11,8 @@
9 * 11 *
10 */ 12 */
11 13
12#include <asm/of_device.h> 14/* This is just here during the transition */
13 15#include <linux/of_platform.h>
14/*
15 * The of_platform_bus_type is a bus type used by drivers that do not
16 * attach to a macio or similar bus but still use OF probing
17 * mechanism
18 */
19extern struct bus_type of_platform_bus_type;
20
21/*
22 * An of_platform_driver driver is attached to a basic of_device on
23 * the "platform bus" (of_platform_bus_type)
24 */
25struct of_platform_driver
26{
27 char *name;
28 struct of_device_id *match_table;
29 struct module *owner;
30
31 int (*probe)(struct of_device* dev,
32 const struct of_device_id *match);
33 int (*remove)(struct of_device* dev);
34
35 int (*suspend)(struct of_device* dev, pm_message_t state);
36 int (*resume)(struct of_device* dev);
37 int (*shutdown)(struct of_device* dev);
38
39 struct device_driver driver;
40};
41#define to_of_platform_driver(drv) \
42 container_of(drv,struct of_platform_driver, driver)
43 16
44/* Platform drivers register/unregister */ 17/* Platform drivers register/unregister */
45extern int of_register_platform_driver(struct of_platform_driver *drv); 18extern int of_register_platform_driver(struct of_platform_driver *drv);
@@ -56,5 +29,6 @@ extern int of_platform_bus_probe(struct device_node *root,
56 struct of_device_id *matches, 29 struct of_device_id *matches,
57 struct device *parent); 30 struct device *parent);
58 31
59extern struct of_device *of_find_device_by_node(struct device_node *np);
60extern struct of_device *of_find_device_by_phandle(phandle ph); 32extern struct of_device *of_find_device_by_phandle(phandle ph);
33
34#endif /* _ASM_POWERPC_OF_PLATFORM_H */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 8d6b47f7b300..938fefb4c4bc 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -39,14 +39,16 @@ struct op_system_config {
39 39
40/* Per-arch configuration */ 40/* Per-arch configuration */
41struct op_powerpc_model { 41struct op_powerpc_model {
42 void (*reg_setup) (struct op_counter_config *, 42 int (*reg_setup) (struct op_counter_config *,
43 struct op_system_config *, 43 struct op_system_config *,
44 int num_counters); 44 int num_counters);
45 void (*cpu_setup) (struct op_counter_config *); 45 int (*cpu_setup) (struct op_counter_config *);
46 void (*start) (struct op_counter_config *); 46 int (*start) (struct op_counter_config *);
47 void (*global_start) (struct op_counter_config *); 47 int (*global_start) (struct op_counter_config *);
48 void (*stop) (void); 48 void (*stop) (void);
49 void (*global_stop) (void); 49 void (*global_stop) (void);
50 int (*sync_start)(void);
51 int (*sync_stop)(void);
50 void (*handle_interrupt) (struct pt_regs *, 52 void (*handle_interrupt) (struct pt_regs *,
51 struct op_counter_config *); 53 struct op_counter_config *);
52 int num_counters; 54 int num_counters;
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index d9bf5aba96cb..e72c2a60853c 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -2,12 +2,91 @@
2#define _ASM_POWERPC_PCI_BRIDGE_H 2#define _ASM_POWERPC_PCI_BRIDGE_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/pci.h>
6#include <linux/list.h>
7#include <linux/ioport.h>
8
5#ifndef CONFIG_PPC64 9#ifndef CONFIG_PPC64
6#include <asm-ppc/pci-bridge.h> 10
11struct device_node;
12struct pci_controller;
13
14/*
15 * Structure of a PCI controller (host bridge)
16 */
17struct pci_controller {
18 struct pci_bus *bus;
19 char is_dynamic;
20 void *arch_data;
21 struct list_head list_node;
22 struct device *parent;
23
24 int first_busno;
25 int last_busno;
26 int self_busno;
27
28 void __iomem *io_base_virt;
29 resource_size_t io_base_phys;
30
31 /* Some machines (PReP) have a non 1:1 mapping of
32 * the PCI memory space in the CPU bus space
33 */
34 resource_size_t pci_mem_offset;
35
36 struct pci_ops *ops;
37 volatile unsigned int __iomem *cfg_addr;
38 volatile void __iomem *cfg_data;
39
40 /*
41 * Used for variants of PCI indirect handling and possible quirks:
42 * SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
43 * EXT_REG - provides access to PCI-e extended registers
44 * SURPRESS_PRIMARY_BUS - we surpress the setting of PCI_PRIMARY_BUS
45 * on Freescale PCI-e controllers since they used the PCI_PRIMARY_BUS
46 * to determine which bus number to match on when generating type0
47 * config cycles
48 */
49#define PPC_INDIRECT_TYPE_SET_CFG_TYPE (0x00000001)
50#define PPC_INDIRECT_TYPE_EXT_REG (0x00000002)
51#define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS (0x00000004)
52 u32 indirect_type;
53
54 /* Currently, we limit ourselves to 1 IO range and 3 mem
55 * ranges since the common pci_bus structure can't handle more
56 */
57 struct resource io_resource;
58 struct resource mem_resources[3];
59 int global_number; /* PCI domain number */
60};
61
62static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
63{
64 return bus->sysdata;
65}
66
67/* These are used for config access before all the PCI probing
68 has been done. */
69int early_read_config_byte(struct pci_controller *hose, int bus, int dev_fn,
70 int where, u8 *val);
71int early_read_config_word(struct pci_controller *hose, int bus, int dev_fn,
72 int where, u16 *val);
73int early_read_config_dword(struct pci_controller *hose, int bus, int dev_fn,
74 int where, u32 *val);
75int early_write_config_byte(struct pci_controller *hose, int bus, int dev_fn,
76 int where, u8 val);
77int early_write_config_word(struct pci_controller *hose, int bus, int dev_fn,
78 int where, u16 val);
79int early_write_config_dword(struct pci_controller *hose, int bus, int dev_fn,
80 int where, u32 val);
81
82extern void setup_indirect_pci_nomap(struct pci_controller* hose,
83 void __iomem *cfg_addr, void __iomem *cfg_data);
84extern void setup_indirect_pci(struct pci_controller* hose,
85 u32 cfg_addr, u32 cfg_data);
86extern void setup_grackle(struct pci_controller *hose);
87
7#else 88#else
8 89
9#include <linux/pci.h>
10#include <linux/list.h>
11 90
12/* 91/*
13 * This program is free software; you can redistribute it and/or 92 * This program is free software; you can redistribute it and/or
@@ -31,6 +110,7 @@ struct pci_controller {
31 int last_busno; 110 int last_busno;
32 111
33 void __iomem *io_base_virt; 112 void __iomem *io_base_virt;
113 void *io_base_alloc;
34 resource_size_t io_base_phys; 114 resource_size_t io_base_phys;
35 115
36 /* Some machines have a non 1:1 mapping of 116 /* Some machines have a non 1:1 mapping of
@@ -48,8 +128,7 @@ struct pci_controller {
48 */ 128 */
49 struct resource io_resource; 129 struct resource io_resource;
50 struct resource mem_resources[3]; 130 struct resource mem_resources[3];
51 int global_number; 131 int global_number;
52 int local_number;
53 unsigned long buid; 132 unsigned long buid;
54 unsigned long dma_window_base_cur; 133 unsigned long dma_window_base_cur;
55 unsigned long dma_window_size; 134 unsigned long dma_window_size;
@@ -70,19 +149,22 @@ struct pci_dn {
70 int devfn; /* pci device and function number */ 149 int devfn; /* pci device and function number */
71 int class_code; /* pci device class */ 150 int class_code; /* pci device class */
72 151
73#ifdef CONFIG_PPC_PSERIES 152 struct pci_controller *phb; /* for pci devices */
153 struct iommu_table *iommu_table; /* for phb's or bridges */
154 struct pci_dev *pcidev; /* back-pointer to the pci device */
155 struct device_node *node; /* back-pointer to the device_node */
156
157 int pci_ext_config_space; /* for pci devices */
158
159#ifdef CONFIG_EEH
74 int eeh_mode; /* See eeh.h for possible EEH_MODEs */ 160 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
75 int eeh_config_addr; 161 int eeh_config_addr;
76 int eeh_pe_config_addr; /* new-style partition endpoint address */ 162 int eeh_pe_config_addr; /* new-style partition endpoint address */
77 int eeh_check_count; /* # times driver ignored error */ 163 int eeh_check_count; /* # times driver ignored error */
78 int eeh_freeze_count; /* # times this device froze up. */ 164 int eeh_freeze_count; /* # times this device froze up. */
79#endif 165 int eeh_false_positives; /* # times this device reported #ff's */
80 int pci_ext_config_space; /* for pci devices */
81 struct pci_controller *phb; /* for pci devices */
82 struct iommu_table *iommu_table; /* for phb's or bridges */
83 struct pci_dev *pcidev; /* back-pointer to the pci device */
84 struct device_node *node; /* back-pointer to the device_node */
85 u32 config_space[16]; /* saved PCI config space */ 166 u32 config_space[16]; /* saved PCI config space */
167#endif
86}; 168};
87 169
88/* Get the pointer to a device_node's pci_dn */ 170/* Get the pointer to a device_node's pci_dn */
@@ -128,9 +210,6 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
128/** Find the bus corresponding to the indicated device node */ 210/** Find the bus corresponding to the indicated device node */
129struct pci_bus * pcibios_find_pci_bus(struct device_node *dn); 211struct pci_bus * pcibios_find_pci_bus(struct device_node *dn);
130 212
131extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
132 struct device_node *dev, int primary);
133
134/** Remove all of the PCI devices under this bus */ 213/** Remove all of the PCI devices under this bus */
135void pcibios_remove_pci_devices(struct pci_bus *bus); 214void pcibios_remove_pci_devices(struct pci_bus *bus);
136 215
@@ -148,13 +227,38 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
148 return PCI_DN(busdn)->phb; 227 return PCI_DN(busdn)->phb;
149} 228}
150 229
230extern void pcibios_free_controller(struct pci_controller *phb);
231
232extern void isa_bridge_find_early(struct pci_controller *hose);
233
234extern int pcibios_unmap_io_space(struct pci_bus *bus);
235extern int pcibios_map_io_space(struct pci_bus *bus);
236
237/* Return values for ppc_md.pci_probe_mode function */
238#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
239#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
240#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
241
242#ifdef CONFIG_NUMA
243#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
244#else
245#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
246#endif
247
248#endif /* CONFIG_PPC64 */
249
250/* Get the PCI host controller for an OF device */
151extern struct pci_controller* 251extern struct pci_controller*
152pci_find_hose_for_OF_device(struct device_node* node); 252pci_find_hose_for_OF_device(struct device_node* node);
153 253
254/* Fill up host controller resources from the OF node */
255extern void
256pci_process_bridge_OF_ranges(struct pci_controller *hose,
257 struct device_node *dev, int primary);
258
259/* Allocate a new PCI host bridge structure */
154extern struct pci_controller * 260extern struct pci_controller *
155pcibios_alloc_controller(struct device_node *dev); 261pcibios_alloc_controller(struct device_node *dev);
156extern void pcibios_free_controller(struct pci_controller *phb);
157
158#ifdef CONFIG_PCI 262#ifdef CONFIG_PCI
159extern unsigned long pci_address_to_pio(phys_addr_t address); 263extern unsigned long pci_address_to_pio(phys_addr_t address);
160#else 264#else
@@ -164,17 +268,7 @@ static inline unsigned long pci_address_to_pio(phys_addr_t address)
164} 268}
165#endif 269#endif
166 270
167/* Return values for ppc_md.pci_probe_mode function */
168#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
169#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
170#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
171 271
172#ifdef CONFIG_NUMA
173#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
174#else
175#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
176#endif
177 272
178#endif /* CONFIG_PPC64 */
179#endif /* __KERNEL__ */ 273#endif /* __KERNEL__ */
180#endif 274#endif
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index e16e7bc9ab5c..7b11765c6865 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -95,8 +95,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
95#define get_pci_dma_ops() NULL 95#define get_pci_dma_ops() NULL
96#endif 96#endif
97 97
98extern int pci_domain_nr(struct pci_bus *bus);
99
100/* Decide whether to display the domain number in /proc */ 98/* Decide whether to display the domain number in /proc */
101extern int pci_proc_domain(struct pci_bus *bus); 99extern int pci_proc_domain(struct pci_bus *bus);
102 100
@@ -112,9 +110,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
112} 110}
113#endif 111#endif
114 112
115/* Return the index of the PCI controller for device PDEV. */
116#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
117
118/* Set the name of the bus as it appears in /proc/bus/pci */ 113/* Set the name of the bus as it appears in /proc/bus/pci */
119static inline int pci_proc_domain(struct pci_bus *bus) 114static inline int pci_proc_domain(struct pci_bus *bus)
120{ 115{
@@ -123,6 +118,8 @@ static inline int pci_proc_domain(struct pci_bus *bus)
123 118
124#endif /* CONFIG_PPC64 */ 119#endif /* CONFIG_PPC64 */
125 120
121extern int pci_domain_nr(struct pci_bus *bus);
122
126struct vm_area_struct; 123struct vm_area_struct;
127/* Map a range of PCI memory or I/O space for a device into user space */ 124/* Map a range of PCI memory or I/O space for a device into user space */
128int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, 125int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
@@ -202,10 +199,6 @@ static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
202 return root; 199 return root;
203} 200}
204 201
205extern int unmap_bus_range(struct pci_bus *bus);
206
207extern int remap_bus_range(struct pci_bus *bus);
208
209extern void pcibios_fixup_device_resources(struct pci_dev *dev, 202extern void pcibios_fixup_device_resources(struct pci_dev *dev,
210 struct pci_bus *bus); 203 struct pci_bus *bus);
211 204
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index 2f2e3024fa61..73dc8ba4010d 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -20,6 +20,11 @@
20#define DEFINE_PER_CPU(type, name) \ 20#define DEFINE_PER_CPU(type, name) \
21 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 21 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
22 22
23#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
24 __attribute__((__section__(".data.percpu.shared_aligned"))) \
25 __typeof__(type) per_cpu__##name \
26 ____cacheline_aligned_in_smp
27
23/* var is in discarded region: offset to particular copy we want */ 28/* var is in discarded region: offset to particular copy we want */
24#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 29#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
25#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 30#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
@@ -40,6 +45,8 @@ extern void setup_per_cpu_areas(void);
40 45
41#define DEFINE_PER_CPU(type, name) \ 46#define DEFINE_PER_CPU(type, name) \
42 __typeof__(type) per_cpu__##name 47 __typeof__(type) per_cpu__##name
48#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
49 DEFINE_PER_CPU(type, name)
43 50
44#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 51#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
45#define __get_cpu_var(var) per_cpu__##var 52#define __get_cpu_var(var) per_cpu__##var
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h
index 7fb730c62f83..86a54a4a8a2a 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -6,11 +6,7 @@
6#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/threads.h> 8#include <linux/threads.h>
9#include <asm/processor.h> /* For TASK_SIZE */
10#include <asm/mmu.h>
11#include <asm/page.h>
12#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */ 9#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */
13struct mm_struct;
14 10
15extern unsigned long va_to_phys(unsigned long address); 11extern unsigned long va_to_phys(unsigned long address);
16extern pte_t *va_to_pte(unsigned long address); 12extern pte_t *va_to_pte(unsigned long address);
@@ -488,14 +484,6 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
488#define pfn_pte(pfn, prot) __pte(((pte_basic_t)(pfn) << PFN_SHIFT_OFFSET) |\ 484#define pfn_pte(pfn, prot) __pte(((pte_basic_t)(pfn) << PFN_SHIFT_OFFSET) |\
489 pgprot_val(prot)) 485 pgprot_val(prot))
490#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) 486#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
491
492/*
493 * ZERO_PAGE is a global shared page that is always zero: used
494 * for zero-mapped memory areas etc..
495 */
496extern unsigned long empty_zero_page[1024];
497#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
498
499#endif /* __ASSEMBLY__ */ 487#endif /* __ASSEMBLY__ */
500 488
501#define pte_none(pte) ((pte_val(pte) & ~_PTE_NONE_MASK) == 0) 489#define pte_none(pte) ((pte_val(pte) & ~_PTE_NONE_MASK) == 0)
@@ -512,9 +500,7 @@ extern unsigned long empty_zero_page[1024];
512 * The following only work if pte_present() is true. 500 * The following only work if pte_present() is true.
513 * Undefined behaviour if not.. 501 * Undefined behaviour if not..
514 */ 502 */
515static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
516static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 503static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
517static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
518static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 504static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
519static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 505static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
520static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 506static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
@@ -522,21 +508,13 @@ static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
522static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 508static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
523static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 509static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
524 510
525static inline pte_t pte_rdprotect(pte_t pte) {
526 pte_val(pte) &= ~_PAGE_USER; return pte; }
527static inline pte_t pte_wrprotect(pte_t pte) { 511static inline pte_t pte_wrprotect(pte_t pte) {
528 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } 512 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; }
529static inline pte_t pte_exprotect(pte_t pte) {
530 pte_val(pte) &= ~_PAGE_EXEC; return pte; }
531static inline pte_t pte_mkclean(pte_t pte) { 513static inline pte_t pte_mkclean(pte_t pte) {
532 pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } 514 pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; }
533static inline pte_t pte_mkold(pte_t pte) { 515static inline pte_t pte_mkold(pte_t pte) {
534 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 516 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
535 517
536static inline pte_t pte_mkread(pte_t pte) {
537 pte_val(pte) |= _PAGE_USER; return pte; }
538static inline pte_t pte_mkexec(pte_t pte) {
539 pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; }
540static inline pte_t pte_mkwrite(pte_t pte) { 518static inline pte_t pte_mkwrite(pte_t pte) {
541 pte_val(pte) |= _PAGE_RW; return pte; } 519 pte_val(pte) |= _PAGE_RW; return pte; }
542static inline pte_t pte_mkdirty(pte_t pte) { 520static inline pte_t pte_mkdirty(pte_t pte) {
@@ -643,13 +621,6 @@ static inline int __ptep_test_and_clear_young(unsigned int context, unsigned lon
643#define ptep_test_and_clear_young(__vma, __addr, __ptep) \ 621#define ptep_test_and_clear_young(__vma, __addr, __ptep) \
644 __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep) 622 __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep)
645 623
646#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
647static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma,
648 unsigned long addr, pte_t *ptep)
649{
650 return (pte_update(ptep, (_PAGE_DIRTY | _PAGE_HWWRITE), 0) & _PAGE_DIRTY) != 0;
651}
652
653#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 624#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
654static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 625static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
655 pte_t *ptep) 626 pte_t *ptep)
@@ -734,10 +705,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
734#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0) 705#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
735#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1) 706#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
736 707
737extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
738
739extern void paging_init(void);
740
741/* 708/*
742 * Encode and decode a swap entry. 709 * Encode and decode a swap entry.
743 * Note that the bits we use in a PTE for representing a swap entry 710 * Note that the bits we use in a PTE for representing a swap entry
@@ -755,40 +722,6 @@ extern void paging_init(void);
755#define pte_to_pgoff(pte) (pte_val(pte) >> 3) 722#define pte_to_pgoff(pte) (pte_val(pte) >> 3)
756#define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE }) 723#define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE })
757 724
758/* CONFIG_APUS */
759/* For virtual address to physical address conversion */
760extern void cache_clear(__u32 addr, int length);
761extern void cache_push(__u32 addr, int length);
762extern int mm_end_of_chunk (unsigned long addr, int len);
763extern unsigned long iopa(unsigned long addr);
764extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
765
766/* Values for nocacheflag and cmode */
767/* These are not used by the APUS kernel_map, but prevents
768 compilation errors. */
769#define KERNELMAP_FULL_CACHING 0
770#define KERNELMAP_NOCACHE_SER 1
771#define KERNELMAP_NOCACHE_NONSER 2
772#define KERNELMAP_NO_COPYBACK 3
773
774/*
775 * Map some physical address range into the kernel address space.
776 */
777extern unsigned long kernel_map(unsigned long paddr, unsigned long size,
778 int nocacheflag, unsigned long *memavailp );
779
780/*
781 * Set cache mode of (kernel space) address range.
782 */
783extern void kernel_set_cachemode (unsigned long address, unsigned long size,
784 unsigned int cmode);
785
786/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
787#define kern_addr_valid(addr) (1)
788
789#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
790 remap_pfn_range(vma, vaddr, pfn, size, prot)
791
792/* 725/*
793 * No page table caches to initialise 726 * No page table caches to initialise
794 */ 727 */
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h
index 3cfd98f44bfe..300f9a199bf2 100644
--- a/include/asm-powerpc/pgtable-ppc64.h
+++ b/include/asm-powerpc/pgtable-ppc64.h
@@ -7,11 +7,7 @@
7 7
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9#include <linux/stddef.h> 9#include <linux/stddef.h>
10#include <asm/processor.h> /* For TASK_SIZE */
11#include <asm/mmu.h>
12#include <asm/page.h>
13#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
14struct mm_struct;
15#endif /* __ASSEMBLY__ */ 11#endif /* __ASSEMBLY__ */
16 12
17#ifdef CONFIG_PPC_64K_PAGES 13#ifdef CONFIG_PPC_64K_PAGES
@@ -27,7 +23,7 @@ struct mm_struct;
27 */ 23 */
28#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ 24#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \
29 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) 25 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)
30#define PGTABLE_RANGE (1UL << PGTABLE_EADDR_SIZE) 26#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)
31 27
32#if TASK_SIZE_USER64 > PGTABLE_RANGE 28#if TASK_SIZE_USER64 > PGTABLE_RANGE
33#error TASK_SIZE_USER64 exceeds pagetable range 29#error TASK_SIZE_USER64 exceeds pagetable range
@@ -37,19 +33,28 @@ struct mm_struct;
37#error TASK_SIZE_USER64 exceeds user VSID range 33#error TASK_SIZE_USER64 exceeds user VSID range
38#endif 34#endif
39 35
36
40/* 37/*
41 * Define the address range of the vmalloc VM area. 38 * Define the address range of the vmalloc VM area.
42 */ 39 */
43#define VMALLOC_START ASM_CONST(0xD000000000000000) 40#define VMALLOC_START ASM_CONST(0xD000000000000000)
44#define VMALLOC_SIZE ASM_CONST(0x80000000000) 41#define VMALLOC_SIZE (PGTABLE_RANGE >> 1)
45#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) 42#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
46 43
47/* 44/*
48 * Define the address range of the imalloc VM area. 45 * Define the address ranges for MMIO and IO space :
46 *
47 * ISA_IO_BASE = VMALLOC_END, 64K reserved area
48 * PHB_IO_BASE = ISA_IO_BASE + 64K to ISA_IO_BASE + 2G, PHB IO spaces
49 * IOREMAP_BASE = ISA_IO_BASE + 2G to VMALLOC_START + PGTABLE_RANGE
49 */ 50 */
50#define PHBS_IO_BASE VMALLOC_END 51#define FULL_IO_SIZE 0x80000000ul
51#define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */ 52#define ISA_IO_BASE (VMALLOC_END)
52#define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE) 53#define ISA_IO_END (VMALLOC_END + 0x10000ul)
54#define PHB_IO_BASE (ISA_IO_END)
55#define PHB_IO_END (VMALLOC_END + FULL_IO_SIZE)
56#define IOREMAP_BASE (PHB_IO_END)
57#define IOREMAP_END (VMALLOC_START + PGTABLE_RANGE)
53 58
54/* 59/*
55 * Region IDs 60 * Region IDs
@@ -134,16 +139,6 @@ struct mm_struct;
134#define __S110 PAGE_SHARED_X 139#define __S110 PAGE_SHARED_X
135#define __S111 PAGE_SHARED_X 140#define __S111 PAGE_SHARED_X
136 141
137#ifndef __ASSEMBLY__
138
139/*
140 * ZERO_PAGE is a global shared page that is always zero: used
141 * for zero-mapped memory areas etc..
142 */
143extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)];
144#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
145#endif /* __ASSEMBLY__ */
146
147#ifdef CONFIG_HUGETLB_PAGE 142#ifdef CONFIG_HUGETLB_PAGE
148 143
149#define HAVE_ARCH_UNMAPPED_AREA 144#define HAVE_ARCH_UNMAPPED_AREA
@@ -232,9 +227,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
232 * The following only work if pte_present() is true. 227 * The following only work if pte_present() is true.
233 * Undefined behaviour if not.. 228 * Undefined behaviour if not..
234 */ 229 */
235static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER;}
236static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;} 230static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;}
237static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;}
238static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} 231static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
239static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} 232static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
240static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 233static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
@@ -242,20 +235,12 @@ static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
242static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 235static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
243static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 236static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
244 237
245static inline pte_t pte_rdprotect(pte_t pte) {
246 pte_val(pte) &= ~_PAGE_USER; return pte; }
247static inline pte_t pte_exprotect(pte_t pte) {
248 pte_val(pte) &= ~_PAGE_EXEC; return pte; }
249static inline pte_t pte_wrprotect(pte_t pte) { 238static inline pte_t pte_wrprotect(pte_t pte) {
250 pte_val(pte) &= ~(_PAGE_RW); return pte; } 239 pte_val(pte) &= ~(_PAGE_RW); return pte; }
251static inline pte_t pte_mkclean(pte_t pte) { 240static inline pte_t pte_mkclean(pte_t pte) {
252 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } 241 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; }
253static inline pte_t pte_mkold(pte_t pte) { 242static inline pte_t pte_mkold(pte_t pte) {
254 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 243 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
255static inline pte_t pte_mkread(pte_t pte) {
256 pte_val(pte) |= _PAGE_USER; return pte; }
257static inline pte_t pte_mkexec(pte_t pte) {
258 pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; }
259static inline pte_t pte_mkwrite(pte_t pte) { 244static inline pte_t pte_mkwrite(pte_t pte) {
260 pte_val(pte) |= _PAGE_RW; return pte; } 245 pte_val(pte) |= _PAGE_RW; return pte; }
261static inline pte_t pte_mkdirty(pte_t pte) { 246static inline pte_t pte_mkdirty(pte_t pte) {
@@ -307,29 +292,6 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
307 __r; \ 292 __r; \
308}) 293})
309 294
310/*
311 * On RW/DIRTY bit transitions we can avoid flushing the hpte. For the
312 * moment we always flush but we need to fix hpte_update and test if the
313 * optimisation is worth it.
314 */
315static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm,
316 unsigned long addr, pte_t *ptep)
317{
318 unsigned long old;
319
320 if ((pte_val(*ptep) & _PAGE_DIRTY) == 0)
321 return 0;
322 old = pte_update(mm, addr, ptep, _PAGE_DIRTY, 0);
323 return (old & _PAGE_DIRTY) != 0;
324}
325#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
326#define ptep_test_and_clear_dirty(__vma, __addr, __ptep) \
327({ \
328 int __r; \
329 __r = __ptep_test_and_clear_dirty((__vma)->vm_mm, __addr, __ptep); \
330 __r; \
331})
332
333#define __HAVE_ARCH_PTEP_SET_WRPROTECT 295#define __HAVE_ARCH_PTEP_SET_WRPROTECT
334static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, 296static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
335 pte_t *ptep) 297 pte_t *ptep)
@@ -357,14 +319,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
357 __young; \ 319 __young; \
358}) 320})
359 321
360#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
361#define ptep_clear_flush_dirty(__vma, __address, __ptep) \
362({ \
363 int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \
364 __ptep); \
365 __dirty; \
366})
367
368#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 322#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
369static inline pte_t ptep_get_and_clear(struct mm_struct *mm, 323static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
370 unsigned long addr, pte_t *ptep) 324 unsigned long addr, pte_t *ptep)
@@ -442,10 +396,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
442#define pgd_ERROR(e) \ 396#define pgd_ERROR(e) \
443 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) 397 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
444 398
445extern pgd_t swapper_pg_dir[];
446
447extern void paging_init(void);
448
449/* Encode and de-code a swap entry */ 399/* Encode and de-code a swap entry */
450#define __swp_type(entry) (((entry).val >> 1) & 0x3f) 400#define __swp_type(entry) (((entry).val >> 1) & 0x3f)
451#define __swp_offset(entry) ((entry).val >> 8) 401#define __swp_offset(entry) ((entry).val >> 8)
@@ -456,17 +406,6 @@ extern void paging_init(void);
456#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE}) 406#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE})
457#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) 407#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT)
458 408
459/*
460 * kern_addr_valid is intended to indicate whether an address is a valid
461 * kernel address. Most 32-bit archs define it as always true (like this)
462 * but most 64-bit archs actually perform a test. What should we do here?
463 * The only use is in fs/ncpfs/dir.c
464 */
465#define kern_addr_valid(addr) (1)
466
467#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
468 remap_pfn_range(vma, vaddr, pfn, size, prot)
469
470void pgtable_cache_init(void); 409void pgtable_cache_init(void);
471 410
472/* 411/*
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 78bf4ae712a6..d18ffe7bc7c4 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -2,6 +2,13 @@
2#define _ASM_POWERPC_PGTABLE_H 2#define _ASM_POWERPC_PGTABLE_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#ifndef __ASSEMBLY__
6#include <asm/processor.h> /* For TASK_SIZE */
7#include <asm/mmu.h>
8#include <asm/page.h>
9struct mm_struct;
10#endif /* !__ASSEMBLY__ */
11
5#if defined(CONFIG_PPC64) 12#if defined(CONFIG_PPC64)
6# include <asm/pgtable-ppc64.h> 13# include <asm/pgtable-ppc64.h>
7#else 14#else
@@ -9,6 +16,27 @@
9#endif 16#endif
10 17
11#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
19/*
20 * ZERO_PAGE is a global shared page that is always zero: used
21 * for zero-mapped memory areas etc..
22 */
23extern unsigned long empty_zero_page[];
24#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
25
26extern pgd_t swapper_pg_dir[];
27
28extern void paging_init(void);
29
30/*
31 * kern_addr_valid is intended to indicate whether an address is a valid
32 * kernel address. Most 32-bit archs define it as always true (like this)
33 * but most 64-bit archs actually perform a test. What should we do here?
34 */
35#define kern_addr_valid(addr) (1)
36
37#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
38 remap_pfn_range(vma, vaddr, pfn, size, prot)
39
12#include <asm-generic/pgtable.h> 40#include <asm-generic/pgtable.h>
13#endif /* __ASSEMBLY__ */ 41#endif /* __ASSEMBLY__ */
14 42
diff --git a/include/asm-powerpc/pmi.h b/include/asm-powerpc/pmi.h
index cb0f8aa43088..2259d4ce3846 100644
--- a/include/asm-powerpc/pmi.h
+++ b/include/asm-powerpc/pmi.h
@@ -55,13 +55,13 @@ typedef struct {
55struct pmi_handler { 55struct pmi_handler {
56 struct list_head node; 56 struct list_head node;
57 u8 type; 57 u8 type;
58 void (*handle_pmi_message) (struct of_device *, pmi_message_t); 58 void (*handle_pmi_message) (pmi_message_t);
59}; 59};
60 60
61void pmi_register_handler(struct of_device *, struct pmi_handler *); 61int pmi_register_handler(struct pmi_handler *);
62void pmi_unregister_handler(struct of_device *, struct pmi_handler *); 62void pmi_unregister_handler(struct pmi_handler *);
63 63
64void pmi_send_message(struct of_device *, pmi_message_t); 64int pmi_send_message(pmi_message_t);
65 65
66#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
67#endif /* _POWERPC_PMI_H */ 67#endif /* _POWERPC_PMI_H */
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index 8e2005159ffd..b847aa10074b 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -26,7 +26,7 @@ extern int global_phb_number;
26 26
27extern void find_and_init_phbs(void); 27extern void find_and_init_phbs(void);
28 28
29extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */ 29extern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */
30 30
31/** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */ 31/** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */
32#define BUID_HI(buid) ((buid) >> 32) 32#define BUID_HI(buid) ((buid) >> 32)
@@ -47,8 +47,8 @@ extern void init_pci_config_tokens (void);
47extern unsigned long get_phb_buid (struct device_node *); 47extern unsigned long get_phb_buid (struct device_node *);
48extern int rtas_setup_phb(struct pci_controller *phb); 48extern int rtas_setup_phb(struct pci_controller *phb);
49 49
50/* From pSeries_pci.h */ 50/* From iSeries PCI */
51extern void pSeries_final_fixup(void); 51extern void iSeries_pcibios_init(void);
52 52
53extern unsigned long pci_probe_only; 53extern unsigned long pci_probe_only;
54 54
@@ -139,6 +139,9 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag);
139 */ 139 */
140struct device_node * find_device_pe(struct device_node *dn); 140struct device_node * find_device_pe(struct device_node *dn);
141 141
142void eeh_sysfs_add_device(struct pci_dev *pdev);
143void eeh_sysfs_remove_device(struct pci_dev *pdev);
144
142#endif /* CONFIG_EEH */ 145#endif /* CONFIG_EEH */
143 146
144#else /* CONFIG_PCI */ 147#else /* CONFIG_PCI */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index d947b1609491..e28b10805159 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -43,14 +43,6 @@ extern int _chrp_type;
43/* what kind of prep workstation we are */ 43/* what kind of prep workstation we are */
44extern int _prep_type; 44extern int _prep_type;
45 45
46/*
47 * This is used to identify the board type from a given PReP board
48 * vendor. Board revision is also made available. This will be moved
49 * elsewhere soon
50 */
51extern unsigned char ucBoardRev;
52extern unsigned char ucBoardRevMaj, ucBoardRevMin;
53
54#endif /* CONFIG_PPC_PREP */ 46#endif /* CONFIG_PPC_PREP */
55 47
56#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */ 48#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 6845af93ba91..672083787a1d 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -21,6 +21,13 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23 23
24#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
26
27#define of_compat_cmp(s1, s2, l) strncasecmp((s1), (s2), (l))
28#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
29#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
30
24/* Definitions used by the flattened device tree */ 31/* Definitions used by the flattened device tree */
25#define OF_DT_HEADER 0xd00dfeed /* marker */ 32#define OF_DT_HEADER 0xd00dfeed /* marker */
26#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ 33#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
@@ -97,11 +104,16 @@ struct device_node {
97 104
98extern struct device_node *of_chosen; 105extern struct device_node *of_chosen;
99 106
100/* flag descriptions */ 107static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
101#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 108{
109 return test_bit(flag, &n->_flags);
110}
111
112static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
113{
114 set_bit(flag, &n->_flags);
115}
102 116
103#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
104#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
105 117
106#define HAVE_ARCH_DEVTREE_FIXUPS 118#define HAVE_ARCH_DEVTREE_FIXUPS
107 119
@@ -111,28 +123,7 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
111} 123}
112 124
113 125
114/* New style node lookup */
115extern struct device_node *of_find_node_by_name(struct device_node *from,
116 const char *name);
117#define for_each_node_by_name(dn, name) \
118 for (dn = of_find_node_by_name(NULL, name); dn; \
119 dn = of_find_node_by_name(dn, name))
120extern struct device_node *of_find_node_by_type(struct device_node *from,
121 const char *type);
122#define for_each_node_by_type(dn, type) \
123 for (dn = of_find_node_by_type(NULL, type); dn; \
124 dn = of_find_node_by_type(dn, type))
125extern struct device_node *of_find_compatible_node(struct device_node *from,
126 const char *type, const char *compat);
127extern struct device_node *of_find_node_by_path(const char *path);
128extern struct device_node *of_find_node_by_phandle(phandle handle);
129extern struct device_node *of_find_all_nodes(struct device_node *prev); 126extern struct device_node *of_find_all_nodes(struct device_node *prev);
130extern struct device_node *of_get_parent(const struct device_node *node);
131extern struct device_node *of_get_next_child(const struct device_node *node,
132 struct device_node *prev);
133extern struct property *of_find_property(const struct device_node *np,
134 const char *name,
135 int *lenp);
136extern struct device_node *of_node_get(struct device_node *node); 127extern struct device_node *of_node_get(struct device_node *node);
137extern void of_node_put(struct device_node *node); 128extern void of_node_put(struct device_node *node);
138 129
@@ -148,23 +139,15 @@ extern unsigned long __init of_get_flat_dt_root(void);
148 139
149/* For updating the device tree at runtime */ 140/* For updating the device tree at runtime */
150extern void of_attach_node(struct device_node *); 141extern void of_attach_node(struct device_node *);
151extern void of_detach_node(const struct device_node *); 142extern void of_detach_node(struct device_node *);
152 143
153/* Other Prototypes */ 144/* Other Prototypes */
154extern void finish_device_tree(void); 145extern void finish_device_tree(void);
155extern void unflatten_device_tree(void); 146extern void unflatten_device_tree(void);
156extern void early_init_devtree(void *); 147extern void early_init_devtree(void *);
157extern int of_device_is_compatible(const struct device_node *device,
158 const char *);
159#define device_is_compatible(d, c) of_device_is_compatible((d), (c)) 148#define device_is_compatible(d, c) of_device_is_compatible((d), (c))
160extern int machine_is_compatible(const char *compat); 149extern int machine_is_compatible(const char *compat);
161extern const void *of_get_property(const struct device_node *node,
162 const char *name,
163 int *lenp);
164#define get_property(a, b, c) of_get_property((a), (b), (c))
165extern void print_properties(struct device_node *node); 150extern void print_properties(struct device_node *node);
166extern int of_n_addr_cells(struct device_node* np);
167extern int of_n_size_cells(struct device_node* np);
168extern int prom_n_intr_cells(struct device_node* np); 151extern int prom_n_intr_cells(struct device_node* np);
169extern void prom_get_irq_senses(unsigned char *senses, int off, int max); 152extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
170extern int prom_add_property(struct device_node* np, struct property* prop); 153extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -218,7 +201,6 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
218 201
219/* Translate an OF address block into a CPU physical address 202/* Translate an OF address block into a CPU physical address
220 */ 203 */
221#define OF_BAD_ADDR ((u64)-1)
222extern u64 of_translate_address(struct device_node *np, const u32 *addr); 204extern u64 of_translate_address(struct device_node *np, const u32 *addr);
223 205
224/* Extract an address from a device, returns the region size and 206/* Extract an address from a device, returns the region size and
@@ -345,5 +327,11 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
345 */ 327 */
346extern void __iomem *of_iomap(struct device_node *device, int index); 328extern void __iomem *of_iomap(struct device_node *device, int index);
347 329
330/*
331 * NB: This is here while we transition from using asm/prom.h
332 * to linux/of.h
333 */
334#include <linux/of.h>
335
348#endif /* __KERNEL__ */ 336#endif /* __KERNEL__ */
349#endif /* _POWERPC_PROM_H */ 337#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index 1e04651eedc4..a6f3f5ee7ca7 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -35,7 +35,8 @@ union ps3_firmware_version {
35 }; 35 };
36}; 36};
37 37
38int ps3_get_firmware_version(union ps3_firmware_version *v); 38void ps3_get_firmware_version(union ps3_firmware_version *v);
39int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev);
39 40
40/* 'Other OS' area */ 41/* 'Other OS' area */
41 42
@@ -48,18 +49,6 @@ enum ps3_param_av_multi_out {
48 49
49enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void); 50enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void);
50 51
51/**
52 * struct ps3_device_id - HV bus device identifier from the system repository
53 * @bus_id: HV bus id, {1..} (zero invalid)
54 * @dev_id: HV device id, {0..}
55 */
56
57struct ps3_device_id {
58 unsigned int bus_id;
59 unsigned int dev_id;
60};
61
62
63/* dma routines */ 52/* dma routines */
64 53
65enum ps3_dma_page_size { 54enum ps3_dma_page_size {
@@ -74,6 +63,8 @@ enum ps3_dma_region_type {
74 PS3_DMA_INTERNAL = 2, 63 PS3_DMA_INTERNAL = 2,
75}; 64};
76 65
66struct ps3_dma_region_ops;
67
77/** 68/**
78 * struct ps3_dma_region - A per device dma state variables structure 69 * struct ps3_dma_region - A per device dma state variables structure
79 * @did: The HV device id. 70 * @did: The HV device id.
@@ -81,21 +72,42 @@ enum ps3_dma_region_type {
81 * @region_type: The HV region type. 72 * @region_type: The HV region type.
82 * @bus_addr: The 'translated' bus address of the region. 73 * @bus_addr: The 'translated' bus address of the region.
83 * @len: The length in bytes of the region. 74 * @len: The length in bytes of the region.
75 * @offset: The offset from the start of memory of the region.
76 * @ioid: The IOID of the device who owns this region
84 * @chunk_list: Opaque variable used by the ioc page manager. 77 * @chunk_list: Opaque variable used by the ioc page manager.
78 * @region_ops: struct ps3_dma_region_ops - dma region operations
85 */ 79 */
86 80
87struct ps3_dma_region { 81struct ps3_dma_region {
88 struct ps3_device_id did; 82 struct ps3_system_bus_device *dev;
83 /* device variables */
84 const struct ps3_dma_region_ops *region_ops;
85 unsigned char ioid;
89 enum ps3_dma_page_size page_size; 86 enum ps3_dma_page_size page_size;
90 enum ps3_dma_region_type region_type; 87 enum ps3_dma_region_type region_type;
91 unsigned long bus_addr;
92 unsigned long len; 88 unsigned long len;
89 unsigned long offset;
90
91 /* driver variables (set by ps3_dma_region_create) */
92 unsigned long bus_addr;
93 struct { 93 struct {
94 spinlock_t lock; 94 spinlock_t lock;
95 struct list_head head; 95 struct list_head head;
96 } chunk_list; 96 } chunk_list;
97}; 97};
98 98
99struct ps3_dma_region_ops {
100 int (*create)(struct ps3_dma_region *);
101 int (*free)(struct ps3_dma_region *);
102 int (*map)(struct ps3_dma_region *,
103 unsigned long virt_addr,
104 unsigned long len,
105 unsigned long *bus_addr,
106 u64 iopte_pp);
107 int (*unmap)(struct ps3_dma_region *,
108 unsigned long bus_addr,
109 unsigned long len);
110};
99/** 111/**
100 * struct ps3_dma_region_init - Helper to initialize structure variables 112 * struct ps3_dma_region_init - Helper to initialize structure variables
101 * 113 *
@@ -103,18 +115,16 @@ struct ps3_dma_region {
103 * ps3_system_bus_device_register. 115 * ps3_system_bus_device_register.
104 */ 116 */
105 117
106static inline void ps3_dma_region_init(struct ps3_dma_region *r, 118struct ps3_system_bus_device;
107 const struct ps3_device_id* did, enum ps3_dma_page_size page_size, 119
108 enum ps3_dma_region_type region_type) 120int ps3_dma_region_init(struct ps3_system_bus_device *dev,
109{ 121 struct ps3_dma_region *r, enum ps3_dma_page_size page_size,
110 r->did = *did; 122 enum ps3_dma_region_type region_type, void *addr, unsigned long len);
111 r->page_size = page_size;
112 r->region_type = region_type;
113}
114int ps3_dma_region_create(struct ps3_dma_region *r); 123int ps3_dma_region_create(struct ps3_dma_region *r);
115int ps3_dma_region_free(struct ps3_dma_region *r); 124int ps3_dma_region_free(struct ps3_dma_region *r);
116int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, 125int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
117 unsigned long len, unsigned long *bus_addr); 126 unsigned long len, unsigned long *bus_addr,
127 u64 iopte_pp);
118int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, 128int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr,
119 unsigned long len); 129 unsigned long len);
120 130
@@ -125,6 +135,7 @@ enum ps3_mmio_page_size {
125 PS3_MMIO_64K = 16U 135 PS3_MMIO_64K = 16U
126}; 136};
127 137
138struct ps3_mmio_region_ops;
128/** 139/**
129 * struct ps3_mmio_region - a per device mmio state variables structure 140 * struct ps3_mmio_region - a per device mmio state variables structure
130 * 141 *
@@ -132,13 +143,18 @@ enum ps3_mmio_page_size {
132 */ 143 */
133 144
134struct ps3_mmio_region { 145struct ps3_mmio_region {
135 struct ps3_device_id did; 146 struct ps3_system_bus_device *dev;
147 const struct ps3_mmio_region_ops *mmio_ops;
136 unsigned long bus_addr; 148 unsigned long bus_addr;
137 unsigned long len; 149 unsigned long len;
138 enum ps3_mmio_page_size page_size; 150 enum ps3_mmio_page_size page_size;
139 unsigned long lpar_addr; 151 unsigned long lpar_addr;
140}; 152};
141 153
154struct ps3_mmio_region_ops {
155 int (*create)(struct ps3_mmio_region *);
156 int (*free)(struct ps3_mmio_region *);
157};
142/** 158/**
143 * struct ps3_mmio_region_init - Helper to initialize structure variables 159 * struct ps3_mmio_region_init - Helper to initialize structure variables
144 * 160 *
@@ -146,15 +162,9 @@ struct ps3_mmio_region {
146 * ps3_system_bus_device_register. 162 * ps3_system_bus_device_register.
147 */ 163 */
148 164
149static inline void ps3_mmio_region_init(struct ps3_mmio_region *r, 165int ps3_mmio_region_init(struct ps3_system_bus_device *dev,
150 const struct ps3_device_id* did, unsigned long bus_addr, 166 struct ps3_mmio_region *r, unsigned long bus_addr, unsigned long len,
151 unsigned long len, enum ps3_mmio_page_size page_size) 167 enum ps3_mmio_page_size page_size);
152{
153 r->did = *did;
154 r->bus_addr = bus_addr;
155 r->len = len;
156 r->page_size = page_size;
157}
158int ps3_mmio_region_create(struct ps3_mmio_region *r); 168int ps3_mmio_region_create(struct ps3_mmio_region *r);
159int ps3_free_mmio_region(struct ps3_mmio_region *r); 169int ps3_free_mmio_region(struct ps3_mmio_region *r);
160unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr); 170unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr);
@@ -187,11 +197,10 @@ int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id,
187 unsigned int class, unsigned int *virq); 197 unsigned int class, unsigned int *virq);
188int ps3_spe_irq_destroy(unsigned int virq); 198int ps3_spe_irq_destroy(unsigned int virq);
189 199
190int ps3_sb_event_receive_port_setup(enum ps3_cpu_binding cpu, 200int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev,
191 const struct ps3_device_id *did, unsigned int interrupt_id, 201 enum ps3_cpu_binding cpu, unsigned int *virq);
192 unsigned int *virq); 202int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev,
193int ps3_sb_event_receive_port_destroy(const struct ps3_device_id *did, 203 unsigned int virq);
194 unsigned int interrupt_id, unsigned int virq);
195 204
196/* lv1 result codes */ 205/* lv1 result codes */
197 206
@@ -289,11 +298,33 @@ static inline const char* ps3_result(int result)
289/* system bus routines */ 298/* system bus routines */
290 299
291enum ps3_match_id { 300enum ps3_match_id {
292 PS3_MATCH_ID_EHCI = 1, 301 PS3_MATCH_ID_EHCI = 1,
293 PS3_MATCH_ID_OHCI, 302 PS3_MATCH_ID_OHCI = 2,
294 PS3_MATCH_ID_GELIC, 303 PS3_MATCH_ID_GELIC = 3,
295 PS3_MATCH_ID_AV_SETTINGS, 304 PS3_MATCH_ID_AV_SETTINGS = 4,
296 PS3_MATCH_ID_SYSTEM_MANAGER, 305 PS3_MATCH_ID_SYSTEM_MANAGER = 5,
306 PS3_MATCH_ID_STOR_DISK = 6,
307 PS3_MATCH_ID_STOR_ROM = 7,
308 PS3_MATCH_ID_STOR_FLASH = 8,
309 PS3_MATCH_ID_SOUND = 9,
310 PS3_MATCH_ID_GRAPHICS = 10,
311};
312
313#define PS3_MODULE_ALIAS_EHCI "ps3:1"
314#define PS3_MODULE_ALIAS_OHCI "ps3:2"
315#define PS3_MODULE_ALIAS_GELIC "ps3:3"
316#define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4"
317#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5"
318#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6"
319#define PS3_MODULE_ALIAS_STOR_ROM "ps3:7"
320#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8"
321#define PS3_MODULE_ALIAS_SOUND "ps3:9"
322#define PS3_MODULE_ALIAS_GRAPHICS "ps3:10"
323
324enum ps3_system_bus_device_type {
325 PS3_DEVICE_TYPE_IOC0 = 1,
326 PS3_DEVICE_TYPE_SB,
327 PS3_DEVICE_TYPE_VUART,
297}; 328};
298 329
299/** 330/**
@@ -302,14 +333,23 @@ enum ps3_match_id {
302 333
303struct ps3_system_bus_device { 334struct ps3_system_bus_device {
304 enum ps3_match_id match_id; 335 enum ps3_match_id match_id;
305 struct ps3_device_id did; 336 enum ps3_system_bus_device_type dev_type;
306 unsigned int interrupt_id; 337
307/* struct iommu_table *iommu_table; -- waiting for Ben's cleanups */ 338 unsigned int bus_id; /* SB */
308 struct ps3_dma_region *d_region; 339 unsigned int dev_id; /* SB */
309 struct ps3_mmio_region *m_region; 340 unsigned int interrupt_id; /* SB */
341 struct ps3_dma_region *d_region; /* SB, IOC0 */
342 struct ps3_mmio_region *m_region; /* SB, IOC0*/
343 unsigned int port_number; /* VUART */
344
345/* struct iommu_table *iommu_table; -- waiting for BenH's cleanups */
310 struct device core; 346 struct device core;
347 void *driver_priv; /* private driver variables */
311}; 348};
312 349
350int ps3_open_hv_device(struct ps3_system_bus_device *dev);
351int ps3_close_hv_device(struct ps3_system_bus_device *dev);
352
313/** 353/**
314 * struct ps3_system_bus_driver - a driver for a device on the system bus 354 * struct ps3_system_bus_driver - a driver for a device on the system bus
315 */ 355 */
@@ -319,6 +359,7 @@ struct ps3_system_bus_driver {
319 struct device_driver core; 359 struct device_driver core;
320 int (*probe)(struct ps3_system_bus_device *); 360 int (*probe)(struct ps3_system_bus_device *);
321 int (*remove)(struct ps3_system_bus_device *); 361 int (*remove)(struct ps3_system_bus_device *);
362 int (*shutdown)(struct ps3_system_bus_device *);
322/* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */ 363/* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */
323/* int (*resume)(struct ps3_system_bus_device *); */ 364/* int (*resume)(struct ps3_system_bus_device *); */
324}; 365};
@@ -326,16 +367,24 @@ struct ps3_system_bus_driver {
326int ps3_system_bus_device_register(struct ps3_system_bus_device *dev); 367int ps3_system_bus_device_register(struct ps3_system_bus_device *dev);
327int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv); 368int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv);
328void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv); 369void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv);
329static inline struct ps3_system_bus_driver *to_ps3_system_bus_driver( 370
371static inline struct ps3_system_bus_driver *ps3_drv_to_system_bus_drv(
330 struct device_driver *_drv) 372 struct device_driver *_drv)
331{ 373{
332 return container_of(_drv, struct ps3_system_bus_driver, core); 374 return container_of(_drv, struct ps3_system_bus_driver, core);
333} 375}
334static inline struct ps3_system_bus_device *to_ps3_system_bus_device( 376static inline struct ps3_system_bus_device *ps3_dev_to_system_bus_dev(
335 struct device *_dev) 377 struct device *_dev)
336{ 378{
337 return container_of(_dev, struct ps3_system_bus_device, core); 379 return container_of(_dev, struct ps3_system_bus_device, core);
338} 380}
381static inline struct ps3_system_bus_driver *
382 ps3_system_bus_dev_to_system_bus_drv(struct ps3_system_bus_device *_dev)
383{
384 BUG_ON(!_dev);
385 BUG_ON(!_dev->core.driver);
386 return ps3_drv_to_system_bus_drv(_dev->core.driver);
387}
339 388
340/** 389/**
341 * ps3_system_bus_set_drvdata - 390 * ps3_system_bus_set_drvdata -
@@ -358,32 +407,17 @@ static inline void *ps3_system_bus_get_driver_data(
358 407
359extern struct bus_type ps3_system_bus_type; 408extern struct bus_type ps3_system_bus_type;
360 409
361/* vuart routines */ 410/* system manager */
362
363struct ps3_vuart_port_priv;
364
365/**
366 * struct ps3_vuart_port_device - a device on a vuart port
367 */
368
369struct ps3_vuart_port_device {
370 enum ps3_match_id match_id;
371 struct device core;
372 struct ps3_vuart_port_priv* priv; /* private driver variables */
373 411
412struct ps3_sys_manager_ops {
413 struct ps3_system_bus_device *dev;
414 void (*power_off)(struct ps3_system_bus_device *dev);
415 void (*restart)(struct ps3_system_bus_device *dev);
374}; 416};
375 417
376int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); 418void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops);
377
378/* system manager */
379
380#ifdef CONFIG_PS3_SYS_MANAGER
381void ps3_sys_manager_restart(void);
382void ps3_sys_manager_power_off(void); 419void ps3_sys_manager_power_off(void);
383#else 420void ps3_sys_manager_restart(void);
384static inline void ps3_sys_manager_restart(void) {}
385static inline void ps3_sys_manager_power_off(void) {}
386#endif
387 421
388struct ps3_prealloc { 422struct ps3_prealloc {
389 const char *name; 423 const char *name;
@@ -393,5 +427,7 @@ struct ps3_prealloc {
393}; 427};
394 428
395extern struct ps3_prealloc ps3fb_videomemory; 429extern struct ps3_prealloc ps3fb_videomemory;
430extern struct ps3_prealloc ps3flash_bounce_buffer;
431
396 432
397#endif 433#endif
diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h
index 9efc40f1c778..7df4250802de 100644
--- a/include/asm-powerpc/ps3av.h
+++ b/include/asm-powerpc/ps3av.h
@@ -1,20 +1,23 @@
1/* 1/*
2 * Copyright (C) 2006 Sony Computer Entertainment Inc. 2 * PS3 AV backend support.
3 * Copyright 2006, 2007 Sony Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify it 4 * Copyright (C) 2007 Sony Computer Entertainment Inc.
6 * under the terms of the GNU General Public License as published 5 * Copyright 2007 Sony Corp.
7 * by the Free Software Foundation; version 2 of the License.
8 * 6 *
9 * This program is distributed in the hope that it will be useful, but 7 * This program is free software; you can redistribute it and/or modify
10 * WITHOUT ANY WARRANTY; without even the implied warranty of 8 * it under the terms of the GNU General Public License as published by
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 * the Free Software Foundation; version 2 of the License.
12 * General Public License for more details.
13 * 10 *
14 * You should have received a copy of the GNU General Public License along 11 * This program is distributed in the hope that it will be useful,
15 * with this program; if not, write to the Free Software Foundation, Inc., 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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
17 */ 19 */
20
18#ifndef _ASM_POWERPC_PS3AV_H_ 21#ifndef _ASM_POWERPC_PS3AV_H_
19#define _ASM_POWERPC_PS3AV_H_ 22#define _ASM_POWERPC_PS3AV_H_
20 23
@@ -159,6 +162,9 @@
159#define PS3AV_CMD_VIDEO_FMT_X8R8G8B8 0x0000 162#define PS3AV_CMD_VIDEO_FMT_X8R8G8B8 0x0000
160/* video_out_format */ 163/* video_out_format */
161#define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT 0x0000 164#define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT 0x0000
165/* video_cl_cnv */
166#define PS3AV_CMD_VIDEO_CL_CNV_ENABLE_LUT 0x0000
167#define PS3AV_CMD_VIDEO_CL_CNV_DISABLE_LUT 0x0010
162/* video_sync */ 168/* video_sync */
163#define PS3AV_CMD_VIDEO_SYNC_VSYNC 0x0001 169#define PS3AV_CMD_VIDEO_SYNC_VSYNC 0x0001
164#define PS3AV_CMD_VIDEO_SYNC_CSYNC 0x0004 170#define PS3AV_CMD_VIDEO_SYNC_CSYNC 0x0004
@@ -311,6 +317,8 @@
311#define PS3AV_MODE_MASK 0x000F 317#define PS3AV_MODE_MASK 0x000F
312#define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */ 318#define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */
313#define PS3AV_MODE_DITHER 0x0800 319#define PS3AV_MODE_DITHER 0x0800
320#define PS3AV_MODE_COLOR 0x0400
321#define PS3AV_MODE_WHITE 0x0200
314#define PS3AV_MODE_FULL 0x0080 322#define PS3AV_MODE_FULL 0x0080
315#define PS3AV_MODE_DVI 0x0040 323#define PS3AV_MODE_DVI 0x0040
316#define PS3AV_MODE_RGB 0x0020 324#define PS3AV_MODE_RGB 0x0020
@@ -529,9 +537,9 @@ struct ps3av_pkt_video_mode {
529 u32 video_out_format; /* in: out format */ 537 u32 video_out_format; /* in: out format */
530 u32 video_format; /* in: input frame buffer format */ 538 u32 video_format; /* in: input frame buffer format */
531 u8 reserved3; 539 u8 reserved3;
532 u8 reserved4; 540 u8 video_cl_cnv; /* in: color conversion */
533 u16 video_order; /* in: input RGB order */ 541 u16 video_order; /* in: input RGB order */
534 u32 reserved5; 542 u32 reserved4;
535}; 543};
536 544
537/* video: format */ 545/* video: format */
@@ -539,7 +547,8 @@ struct ps3av_pkt_video_format {
539 struct ps3av_send_hdr send_hdr; 547 struct ps3av_send_hdr send_hdr;
540 u32 video_head; /* in: head */ 548 u32 video_head; /* in: head */
541 u32 video_format; /* in: frame buffer format */ 549 u32 video_format; /* in: frame buffer format */
542 u16 reserved; 550 u8 reserved;
551 u8 video_cl_cnv; /* in: color conversion */
543 u16 video_order; /* in: input RGB order */ 552 u16 video_order; /* in: input RGB order */
544}; 553};
545 554
@@ -698,12 +707,6 @@ static inline void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_
698extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, 707extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
699 u32); 708 u32);
700 709
701struct ps3_vuart_port_device;
702extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev,
703 const void *buf, unsigned long size);
704extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
705 unsigned long size, int timeout);
706
707extern int ps3av_set_video_mode(u32, int); 710extern int ps3av_set_video_mode(u32, int);
708extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32); 711extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
709extern int ps3av_get_auto_mode(int); 712extern int ps3av_get_auto_mode(int);
@@ -716,5 +719,8 @@ extern int ps3av_video_mute(int);
716extern int ps3av_audio_mute(int); 719extern int ps3av_audio_mute(int);
717extern int ps3av_dev_open(void); 720extern int ps3av_dev_open(void);
718extern int ps3av_dev_close(void); 721extern int ps3av_dev_close(void);
722extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
723 void *flip_data);
724extern void ps3av_flip_ctl(int on);
719 725
720#endif /* _ASM_POWERPC_PS3AV_H_ */ 726#endif /* _ASM_POWERPC_PS3AV_H_ */
diff --git a/include/asm-powerpc/ps3fb.h b/include/asm-powerpc/ps3fb.h
index ad81cf431964..3f121fe4010d 100644
--- a/include/asm-powerpc/ps3fb.h
+++ b/include/asm-powerpc/ps3fb.h
@@ -41,16 +41,4 @@ struct ps3fb_ioctl_res {
41 __u32 num_frames; /* num of frame buffers */ 41 __u32 num_frames; /* num of frame buffers */
42}; 42};
43 43
44#ifdef __KERNEL__
45
46#ifdef CONFIG_FB_PS3
47extern void ps3fb_flip_ctl(int on);
48extern void ps3fb_cleanup(void);
49#else
50static inline void ps3fb_flip_ctl(int on) {}
51static inline void ps3fb_cleanup(void) {}
52#endif
53
54#endif /* __KERNEL__ */
55
56#endif /* _ASM_POWERPC_PS3FB_H_ */ 44#endif /* _ASM_POWERPC_PS3FB_H_ */
diff --git a/include/asm-powerpc/ps3stor.h b/include/asm-powerpc/ps3stor.h
new file mode 100644
index 000000000000..6fcaf714fa50
--- /dev/null
+++ b/include/asm-powerpc/ps3stor.h
@@ -0,0 +1,71 @@
1/*
2 * PS3 Storage Devices
3 *
4 * Copyright (C) 2007 Sony Computer Entertainment Inc.
5 * Copyright 2007 Sony Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef _ASM_POWERPC_PS3STOR_H_
22#define _ASM_POWERPC_PS3STOR_H_
23
24#include <linux/interrupt.h>
25
26#include <asm/ps3.h>
27
28
29struct ps3_storage_region {
30 unsigned int id;
31 u64 start;
32 u64 size;
33};
34
35struct ps3_storage_device {
36 struct ps3_system_bus_device sbd;
37
38 struct ps3_dma_region dma_region;
39 unsigned int irq;
40 u64 blk_size;
41
42 u64 tag;
43 u64 lv1_status;
44 struct completion done;
45
46 unsigned long bounce_size;
47 void *bounce_buf;
48 u64 bounce_lpar;
49 dma_addr_t bounce_dma;
50
51 unsigned int num_regions;
52 unsigned long accessible_regions;
53 unsigned int region_idx; /* first accessible region */
54 struct ps3_storage_region regions[0]; /* Must be last */
55};
56
57static inline struct ps3_storage_device *to_ps3_storage_device(struct device *dev)
58{
59 return container_of(dev, struct ps3_storage_device, sbd.core);
60}
61
62extern int ps3stor_setup(struct ps3_storage_device *dev,
63 irq_handler_t handler);
64extern void ps3stor_teardown(struct ps3_storage_device *dev);
65extern u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
66 u64 start_sector, u64 sectors,
67 int write);
68extern u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd,
69 u64 arg1, u64 arg2, u64 arg3, u64 arg4);
70
71#endif /* _ASM_POWERPC_PS3STOR_H_ */
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 4ad77a13f865..13fccc5a4119 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -92,6 +92,11 @@ extern unsigned long profile_pc(struct pt_regs *regs);
92 set_thread_flag(TIF_NOERROR); \ 92 set_thread_flag(TIF_NOERROR); \
93 } while(0) 93 } while(0)
94 94
95struct task_struct;
96extern unsigned long ptrace_get_reg(struct task_struct *task, int regno);
97extern int ptrace_put_reg(struct task_struct *task, int regno,
98 unsigned long data);
99
95/* 100/*
96 * We use the least-significant bit of the trap field to indicate 101 * We use the least-significant bit of the trap field to indicate
97 * whether we have saved the full set of registers, or only a 102 * whether we have saved the full set of registers, or only a
@@ -158,9 +163,7 @@ do { \
158 163
159#define PT_NIP 32 164#define PT_NIP 32
160#define PT_MSR 33 165#define PT_MSR 33
161#ifdef __KERNEL__
162#define PT_ORIG_R3 34 166#define PT_ORIG_R3 34
163#endif
164#define PT_CTR 35 167#define PT_CTR 35
165#define PT_LNK 36 168#define PT_LNK 36
166#define PT_XER 37 169#define PT_XER 37
@@ -169,11 +172,12 @@ do { \
169#define PT_MQ 39 172#define PT_MQ 39
170#else 173#else
171#define PT_SOFTE 39 174#define PT_SOFTE 39
175#endif
172#define PT_TRAP 40 176#define PT_TRAP 40
173#define PT_DAR 41 177#define PT_DAR 41
174#define PT_DSISR 42 178#define PT_DSISR 42
175#define PT_RESULT 43 179#define PT_RESULT 43
176#endif 180#define PT_REGS_COUNT 44
177 181
178#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ 182#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
179 183
@@ -229,7 +233,17 @@ do { \
229#define PTRACE_GET_DEBUGREG 25 233#define PTRACE_GET_DEBUGREG 25
230#define PTRACE_SET_DEBUGREG 26 234#define PTRACE_SET_DEBUGREG 26
231 235
232/* Additional PTRACE requests implemented on PowerPC. */ 236/* (new) PTRACE requests using the same numbers as x86 and the same
237 * argument ordering. Additionally, they support more registers too
238 */
239#define PTRACE_GETREGS 12
240#define PTRACE_SETREGS 13
241#define PTRACE_GETFPREGS 14
242#define PTRACE_SETFPREGS 15
243#define PTRACE_GETREGS64 22
244#define PTRACE_SETREGS64 23
245
246/* (old) PTRACE requests with inverted arguments */
233#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 247#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
234#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 248#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
235#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 249#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 749c7f953b58..281011e953ec 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -453,6 +453,8 @@
453#define SPRN_MMCRA 0x312 453#define SPRN_MMCRA 0x312
454#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */ 454#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */
455#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */ 455#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */
456#define MMCRA_SLOT 0x07000000UL /* SLOT bits (37-39) */
457#define MMCRA_SLOT_SHIFT 24
456#define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */ 458#define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */
457#define POWER6_MMCRA_SIHV 0x0000040000000000ULL 459#define POWER6_MMCRA_SIHV 0x0000040000000000ULL
458#define POWER6_MMCRA_SIPR 0x0000020000000000ULL 460#define POWER6_MMCRA_SIPR 0x0000020000000000ULL
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 31d5054be20f..8836c0f1f2f7 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -106,6 +106,14 @@ struct spu_context;
106struct spu_runqueue; 106struct spu_runqueue;
107struct device_node; 107struct device_node;
108 108
109enum spu_utilization_state {
110 SPU_UTIL_USER,
111 SPU_UTIL_SYSTEM,
112 SPU_UTIL_IOWAIT,
113 SPU_UTIL_IDLE_LOADED,
114 SPU_UTIL_MAX
115};
116
109struct spu { 117struct spu {
110 const char *name; 118 const char *name;
111 unsigned long local_store_phys; 119 unsigned long local_store_phys;
@@ -113,9 +121,9 @@ struct spu {
113 unsigned long problem_phys; 121 unsigned long problem_phys;
114 struct spu_problem __iomem *problem; 122 struct spu_problem __iomem *problem;
115 struct spu_priv2 __iomem *priv2; 123 struct spu_priv2 __iomem *priv2;
116 struct list_head list; 124 struct list_head cbe_list;
117 struct list_head sched_list;
118 struct list_head full_list; 125 struct list_head full_list;
126 enum { SPU_FREE, SPU_USED } alloc_state;
119 int number; 127 int number;
120 unsigned int irqs[3]; 128 unsigned int irqs[3];
121 u32 node; 129 u32 node;
@@ -129,6 +137,7 @@ struct spu {
129 struct spu_runqueue *rq; 137 struct spu_runqueue *rq;
130 unsigned long long timestamp; 138 unsigned long long timestamp;
131 pid_t pid; 139 pid_t pid;
140 pid_t tgid;
132 int class_0_pending; 141 int class_0_pending;
133 spinlock_t register_lock; 142 spinlock_t register_lock;
134 143
@@ -156,15 +165,49 @@ struct spu {
156 u64 shadow_int_mask_RW[3]; 165 u64 shadow_int_mask_RW[3];
157 166
158 struct sys_device sysdev; 167 struct sys_device sysdev;
168
169 int has_mem_affinity;
170 struct list_head aff_list;
171
172 struct {
173 /* protected by interrupt reentrancy */
174 enum spu_utilization_state util_state;
175 unsigned long long tstamp;
176 unsigned long long times[SPU_UTIL_MAX];
177 unsigned long long vol_ctx_switch;
178 unsigned long long invol_ctx_switch;
179 unsigned long long min_flt;
180 unsigned long long maj_flt;
181 unsigned long long hash_flt;
182 unsigned long long slb_flt;
183 unsigned long long class2_intr;
184 unsigned long long libassist;
185 } stats;
159}; 186};
160 187
161struct spu *spu_alloc(void); 188struct cbe_spu_info {
162struct spu *spu_alloc_node(int node); 189 struct mutex list_mutex;
163void spu_free(struct spu *spu); 190 struct list_head spus;
191 int n_spus;
192 int nr_active;
193 atomic_t reserved_spus;
194};
195
196extern struct cbe_spu_info cbe_spu_info[];
197
198void spu_init_channels(struct spu *spu);
164int spu_irq_class_0_bottom(struct spu *spu); 199int spu_irq_class_0_bottom(struct spu *spu);
165int spu_irq_class_1_bottom(struct spu *spu); 200int spu_irq_class_1_bottom(struct spu *spu);
166void spu_irq_setaffinity(struct spu *spu, int cpu); 201void spu_irq_setaffinity(struct spu *spu, int cpu);
167 202
203#ifdef CONFIG_KEXEC
204void crash_register_spus(struct list_head *list);
205#else
206static inline void crash_register_spus(struct list_head *list)
207{
208}
209#endif
210
168extern void spu_invalidate_slbs(struct spu *spu); 211extern void spu_invalidate_slbs(struct spu *spu);
169extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm); 212extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
170 213
@@ -172,6 +215,20 @@ extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
172struct mm_struct; 215struct mm_struct;
173extern void spu_flush_all_slbs(struct mm_struct *mm); 216extern void spu_flush_all_slbs(struct mm_struct *mm);
174 217
218/* This interface allows a profiler (e.g., OProfile) to store a ref
219 * to spu context information that it creates. This caching technique
220 * avoids the need to recreate this information after a save/restore operation.
221 *
222 * Assumes the caller has already incremented the ref count to
223 * profile_info; then spu_context_destroy must call kref_put
224 * on prof_info_kref.
225 */
226void spu_set_profile_private_kref(struct spu_context *ctx,
227 struct kref *prof_info_kref,
228 void ( * prof_info_release) (struct kref *kref));
229
230void *spu_get_profile_private_kref(struct spu_context *ctx);
231
175/* system callbacks from the SPU */ 232/* system callbacks from the SPU */
176struct spu_syscall_block { 233struct spu_syscall_block {
177 u64 nr_ret; 234 u64 nr_ret;
@@ -183,7 +240,8 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
183struct file; 240struct file;
184extern struct spufs_calls { 241extern struct spufs_calls {
185 asmlinkage long (*create_thread)(const char __user *name, 242 asmlinkage long (*create_thread)(const char __user *name,
186 unsigned int flags, mode_t mode); 243 unsigned int flags, mode_t mode,
244 struct file *neighbor);
187 asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc, 245 asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc,
188 __u32 __user *ustatus); 246 __u32 __user *ustatus);
189 struct module *owner; 247 struct module *owner;
@@ -210,8 +268,10 @@ struct spu_coredump_calls {
210#define SPU_CREATE_GANG 0x0002 268#define SPU_CREATE_GANG 0x0002
211#define SPU_CREATE_NOSCHED 0x0004 269#define SPU_CREATE_NOSCHED 0x0004
212#define SPU_CREATE_ISOLATE 0x0008 270#define SPU_CREATE_ISOLATE 0x0008
271#define SPU_CREATE_AFFINITY_SPU 0x0010
272#define SPU_CREATE_AFFINITY_MEM 0x0020
213 273
214#define SPU_CREATE_FLAG_ALL 0x000f /* mask of all valid flags */ 274#define SPU_CREATE_FLAG_ALL 0x003f /* mask of all valid flags */
215 275
216 276
217#ifdef CONFIG_SPU_FS_MODULE 277#ifdef CONFIG_SPU_FS_MODULE
@@ -380,6 +440,7 @@ struct spu_priv2 {
380#define MFC_CNTL_RESUME_DMA_QUEUE (0ull << 0) 440#define MFC_CNTL_RESUME_DMA_QUEUE (0ull << 0)
381#define MFC_CNTL_SUSPEND_DMA_QUEUE (1ull << 0) 441#define MFC_CNTL_SUSPEND_DMA_QUEUE (1ull << 0)
382#define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK (1ull << 0) 442#define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK (1ull << 0)
443#define MFC_CNTL_SUSPEND_MASK (1ull << 4)
383#define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION (0ull << 8) 444#define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION (0ull << 8)
384#define MFC_CNTL_SUSPEND_IN_PROGRESS (1ull << 8) 445#define MFC_CNTL_SUSPEND_IN_PROGRESS (1ull << 8)
385#define MFC_CNTL_SUSPEND_COMPLETE (3ull << 8) 446#define MFC_CNTL_SUSPEND_COMPLETE (3ull << 8)
@@ -448,6 +509,7 @@ struct spu_priv1 {
448#define MFC_STATE1_PROBLEM_STATE_MASK 0x08ull 509#define MFC_STATE1_PROBLEM_STATE_MASK 0x08ull
449#define MFC_STATE1_RELOCATE_MASK 0x10ull 510#define MFC_STATE1_RELOCATE_MASK 0x10ull
450#define MFC_STATE1_MASTER_RUN_CONTROL_MASK 0x20ull 511#define MFC_STATE1_MASTER_RUN_CONTROL_MASK 0x20ull
512#define MFC_STATE1_TABLE_SEARCH_MASK 0x40ull
451 u64 mfc_lpid_RW; /* 0x008 */ 513 u64 mfc_lpid_RW; /* 0x008 */
452 u64 spu_idr_RW; /* 0x010 */ 514 u64 spu_idr_RW; /* 0x010 */
453 u64 mfc_vr_RO; /* 0x018 */ 515 u64 mfc_vr_RO; /* 0x018 */
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index c48ae185c874..e87794d5d4ea 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -50,6 +50,12 @@
50#define SPU_STOPPED_STATUS_P_I 8 50#define SPU_STOPPED_STATUS_P_I 8
51#define SPU_STOPPED_STATUS_R 9 51#define SPU_STOPPED_STATUS_R 9
52 52
53/*
54 * Definitions for software decrementer status flag.
55 */
56#define SPU_DECR_STATUS_RUNNING 0x1
57#define SPU_DECR_STATUS_WRAPPED 0x2
58
53#ifndef __ASSEMBLY__ 59#ifndef __ASSEMBLY__
54/** 60/**
55 * spu_reg128 - generic 128-bit register definition. 61 * spu_reg128 - generic 128-bit register definition.
@@ -63,7 +69,7 @@ struct spu_reg128 {
63 * @gprs: Array of saved registers. 69 * @gprs: Array of saved registers.
64 * @fpcr: Saved floating point status control register. 70 * @fpcr: Saved floating point status control register.
65 * @decr: Saved decrementer value. 71 * @decr: Saved decrementer value.
66 * @decr_status: Indicates decrementer run status. 72 * @decr_status: Indicates software decrementer status flags.
67 * @ppu_mb: Saved PPU mailbox data. 73 * @ppu_mb: Saved PPU mailbox data.
68 * @ppuint_mb: Saved PPU interrupting mailbox data. 74 * @ppuint_mb: Saved PPU interrupting mailbox data.
69 * @tag_mask: Saved tag group mask. 75 * @tag_mask: Saved tag group mask.
diff --git a/include/asm-powerpc/syscalls.h b/include/asm-powerpc/syscalls.h
index c2fe79d4f90f..b3ca41fc8bb1 100644
--- a/include/asm-powerpc/syscalls.h
+++ b/include/asm-powerpc/syscalls.h
@@ -43,16 +43,9 @@ asmlinkage long ppc_newuname(struct new_utsname __user * name);
43 43
44asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, 44asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset,
45 size_t sigsetsize); 45 size_t sigsetsize);
46
47#ifndef __powerpc64__
48asmlinkage long sys_sigaltstack(const stack_t __user *uss,
49 stack_t __user *uoss, int r5, int r6, int r7, int r8,
50 struct pt_regs *regs);
51#else /* __powerpc64__ */
52asmlinkage long sys_sigaltstack(const stack_t __user *uss, 46asmlinkage long sys_sigaltstack(const stack_t __user *uss,
53 stack_t __user *uoss, unsigned long r5, unsigned long r6, 47 stack_t __user *uoss, unsigned long r5, unsigned long r6,
54 unsigned long r7, unsigned long r8, struct pt_regs *regs); 48 unsigned long r7, unsigned long r8, struct pt_regs *regs);
55#endif /* __powerpc64__ */
56 49
57#endif /* __KERNEL__ */ 50#endif /* __KERNEL__ */
58#endif /* __ASM_POWERPC_SYSCALLS_H */ 51#endif /* __ASM_POWERPC_SYSCALLS_H */
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 1cc3f9cb6f4e..cc6d87228258 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -308,6 +308,7 @@ COMPAT_SYS_SPU(move_pages)
308SYSCALL_SPU(getcpu) 308SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait) 309COMPAT_SYS(epoll_pwait)
310COMPAT_SYS_SPU(utimensat) 310COMPAT_SYS_SPU(utimensat)
311COMPAT_SYS(fallocate)
311COMPAT_SYS_SPU(signalfd) 312COMPAT_SYS_SPU(signalfd)
312COMPAT_SYS_SPU(timerfd) 313COMPAT_SYS_SPU(timerfd)
313SYSCALL_SPU(eventfd) 314SYSCALL_SPU(eventfd)
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 09621f611dbc..41520b7a7b76 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -43,7 +43,7 @@
43#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
44#define smp_mb() mb() 44#define smp_mb() mb()
45#define smp_rmb() rmb() 45#define smp_rmb() rmb()
46#define smp_wmb() __asm__ __volatile__ ("eieio" : : : "memory") 46#define smp_wmb() eieio()
47#define smp_read_barrier_depends() read_barrier_depends() 47#define smp_read_barrier_depends() read_barrier_depends()
48#else 48#else
49#define smp_mb() barrier() 49#define smp_mb() barrier()
@@ -184,16 +184,6 @@ struct thread_struct;
184extern struct task_struct *_switch(struct thread_struct *prev, 184extern struct task_struct *_switch(struct thread_struct *prev,
185 struct thread_struct *next); 185 struct thread_struct *next);
186 186
187/*
188 * On SMP systems, when the scheduler does migration-cost autodetection,
189 * it needs a way to flush as much of the CPU's caches as possible.
190 *
191 * TODO: fill this in!
192 */
193static inline void sched_cacheflush(void)
194{
195}
196
197extern unsigned int rtas_data; 187extern unsigned int rtas_data;
198extern int mem_init_done; /* set on boot once kmalloc can be called */ 188extern int mem_init_done; /* set on boot once kmalloc can be called */
199extern unsigned long memory_limit; 189extern unsigned long memory_limit;
@@ -559,5 +549,7 @@ static inline void create_function_call(unsigned long addr, void * func)
559extern void account_system_vtime(struct task_struct *); 549extern void account_system_vtime(struct task_struct *);
560#endif 550#endif
561 551
552extern struct dentry *powerpc_debugfs_root;
553
562#endif /* __KERNEL__ */ 554#endif /* __KERNEL__ */
563#endif /* _ASM_POWERPC_SYSTEM_H */ 555#endif /* _ASM_POWERPC_SYSTEM_H */
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h
index 5e79198f7d18..6698188ca550 100644
--- a/include/asm-powerpc/termbits.h
+++ b/include/asm-powerpc/termbits.h
@@ -152,6 +152,10 @@ struct ktermios {
152#define B3000000 00034 152#define B3000000 00034
153#define B3500000 00035 153#define B3500000 00035
154#define B4000000 00036 154#define B4000000 00036
155#define BOTHER 00037
156
157#define CIBAUD 077600000
158#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
155 159
156#define CSIZE 00001400 160#define CSIZE 00001400
157#define CS5 00000000 161#define CS5 00000000
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index 3f32ca8bfec9..9d9aeca8ad22 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -113,8 +113,8 @@ static inline struct thread_info *current_thread_info(void)
113#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling 113#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
114 TIF_NEED_RESCHED */ 114 TIF_NEED_RESCHED */
115#define TIF_32BIT 5 /* 32 bit binary */ 115#define TIF_32BIT 5 /* 32 bit binary */
116#define TIF_RUNLATCH 6 /* Is the runlatch enabled? */ 116#define TIF_PERFMON_WORK 6 /* work for pfm_handle_work() */
117#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ 117#define TIF_PERFMON_CTXSW 7 /* perfmon needs ctxsw calls */
118#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ 118#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
119#define TIF_SINGLESTEP 9 /* singlestepping active */ 119#define TIF_SINGLESTEP 9 /* singlestepping active */
120#define TIF_MEMDIE 10 120#define TIF_MEMDIE 10
@@ -123,6 +123,8 @@ static inline struct thread_info *current_thread_info(void)
123#define TIF_NOERROR 14 /* Force successful syscall return */ 123#define TIF_NOERROR 14 /* Force successful syscall return */
124#define TIF_RESTORE_SIGMASK 15 /* Restore signal mask in do_signal */ 124#define TIF_RESTORE_SIGMASK 15 /* Restore signal mask in do_signal */
125#define TIF_FREEZE 16 /* Freezing for suspend */ 125#define TIF_FREEZE 16 /* Freezing for suspend */
126#define TIF_RUNLATCH 17 /* Is the runlatch enabled? */
127#define TIF_ABI_PENDING 18 /* 32/64 bit switch needed */
126 128
127/* as above, but as bit values */ 129/* as above, but as bit values */
128#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 130#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -131,8 +133,8 @@ static inline struct thread_info *current_thread_info(void)
131#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 133#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
132#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 134#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
133#define _TIF_32BIT (1<<TIF_32BIT) 135#define _TIF_32BIT (1<<TIF_32BIT)
134#define _TIF_RUNLATCH (1<<TIF_RUNLATCH) 136#define _TIF_PERFMON_WORK (1<<TIF_PERFMON_WORK)
135#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 137#define _TIF_PERFMON_CTXSW (1<<TIF_PERFMON_CTXSW)
136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 138#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 139#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
138#define _TIF_SECCOMP (1<<TIF_SECCOMP) 140#define _TIF_SECCOMP (1<<TIF_SECCOMP)
@@ -140,6 +142,8 @@ static inline struct thread_info *current_thread_info(void)
140#define _TIF_NOERROR (1<<TIF_NOERROR) 142#define _TIF_NOERROR (1<<TIF_NOERROR)
141#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 143#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
142#define _TIF_FREEZE (1<<TIF_FREEZE) 144#define _TIF_FREEZE (1<<TIF_FREEZE)
145#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
146#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
143#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) 147#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
144 148
145#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 149#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 3fd57c048f59..d7f5ddfbaac7 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -232,7 +232,7 @@ extern void account_process_vtime(struct task_struct *tsk);
232#define account_process_vtime(tsk) do { } while (0) 232#define account_process_vtime(tsk) do { } while (0)
233#endif 233#endif
234 234
235#if defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(CONFIG_PPC_SPLPAR) 235#if defined(CONFIG_VIRT_CPU_ACCOUNTING)
236extern void calculate_steal_time(void); 236extern void calculate_steal_time(void);
237extern void snapshot_timebases(void); 237extern void snapshot_timebases(void);
238#else 238#else
@@ -240,5 +240,7 @@ extern void snapshot_timebases(void);
240#define snapshot_timebases() do { } while (0) 240#define snapshot_timebases() do { } while (0)
241#endif 241#endif
242 242
243extern void iSeries_time_init_early(void);
244
243#endif /* __KERNEL__ */ 245#endif /* __KERNEL__ */
244#endif /* __POWERPC_TIME_H */ 246#endif /* __POWERPC_TIME_H */
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
index 86e6266a028b..99a0439baa50 100644
--- a/include/asm-powerpc/tlbflush.h
+++ b/include/asm-powerpc/tlbflush.h
@@ -155,6 +155,11 @@ static inline void flush_tlb_kernel_range(unsigned long start,
155{ 155{
156} 156}
157 157
158/* Private function for use by PCI IO mapping code */
159extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
160 unsigned long end);
161
162
158#endif 163#endif
159 164
160/* 165/*
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index f71c6061f1ec..97d82b6a9406 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -331,10 +331,11 @@
331#define __NR_timerfd 306 331#define __NR_timerfd 306
332#define __NR_eventfd 307 332#define __NR_eventfd 307
333#define __NR_sync_file_range2 308 333#define __NR_sync_file_range2 308
334#define __NR_fallocate 309
334 335
335#ifdef __KERNEL__ 336#ifdef __KERNEL__
336 337
337#define __NR_syscalls 309 338#define __NR_syscalls 310
338 339
339#define __NR__exit __NR_exit 340#define __NR__exit __NR_exit
340#define NR_syscalls __NR_syscalls 341#define NR_syscalls __NR_syscalls
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 9d0ce9ff5840..c159315d2c8f 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -533,9 +533,7 @@ static inline int pgd_present(pgd_t pgd) { return 1; }
533 * The following only work if pte_present() is true. 533 * The following only work if pte_present() is true.
534 * Undefined behaviour if not.. 534 * Undefined behaviour if not..
535 */ 535 */
536static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
537static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 536static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
538static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
539static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 537static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
540static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 538static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
541static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 539static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
@@ -543,21 +541,13 @@ static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
543static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 541static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
544static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 542static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
545 543
546static inline pte_t pte_rdprotect(pte_t pte) {
547 pte_val(pte) &= ~_PAGE_USER; return pte; }
548static inline pte_t pte_wrprotect(pte_t pte) { 544static inline pte_t pte_wrprotect(pte_t pte) {
549 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } 545 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; }
550static inline pte_t pte_exprotect(pte_t pte) {
551 pte_val(pte) &= ~_PAGE_EXEC; return pte; }
552static inline pte_t pte_mkclean(pte_t pte) { 546static inline pte_t pte_mkclean(pte_t pte) {
553 pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } 547 pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; }
554static inline pte_t pte_mkold(pte_t pte) { 548static inline pte_t pte_mkold(pte_t pte) {
555 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 549 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
556 550
557static inline pte_t pte_mkread(pte_t pte) {
558 pte_val(pte) |= _PAGE_USER; return pte; }
559static inline pte_t pte_mkexec(pte_t pte) {
560 pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; }
561static inline pte_t pte_mkwrite(pte_t pte) { 551static inline pte_t pte_mkwrite(pte_t pte) {
562 pte_val(pte) |= _PAGE_RW; return pte; } 552 pte_val(pte) |= _PAGE_RW; return pte; }
563static inline pte_t pte_mkdirty(pte_t pte) { 553static inline pte_t pte_mkdirty(pte_t pte) {
@@ -664,13 +654,6 @@ static inline int __ptep_test_and_clear_young(unsigned int context, unsigned lon
664#define ptep_test_and_clear_young(__vma, __addr, __ptep) \ 654#define ptep_test_and_clear_young(__vma, __addr, __ptep) \
665 __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep) 655 __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep)
666 656
667#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
668static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma,
669 unsigned long addr, pte_t *ptep)
670{
671 return (pte_update(ptep, (_PAGE_DIRTY | _PAGE_HWWRITE), 0) & _PAGE_DIRTY) != 0;
672}
673
674#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 657#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
675static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 658static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
676 pte_t *ptep) 659 pte_t *ptep)
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index d84a3cf4d033..cc45780421ca 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -54,6 +54,7 @@ extern void show_regs(struct pt_regs * regs);
54extern void flush_instruction_cache(void); 54extern void flush_instruction_cache(void);
55extern void hard_reset_now(void); 55extern void hard_reset_now(void);
56extern void poweroff_now(void); 56extern void poweroff_now(void);
57extern int set_dabr(unsigned long dabr);
57#ifdef CONFIG_6xx 58#ifdef CONFIG_6xx
58extern long _get_L2CR(void); 59extern long _get_L2CR(void);
59extern long _get_L3CR(void); 60extern long _get_L3CR(void);
@@ -129,16 +130,6 @@ extern struct task_struct *__switch_to(struct task_struct *,
129 struct task_struct *); 130 struct task_struct *);
130#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next))) 131#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
131 132
132/*
133 * On SMP systems, when the scheduler does migration-cost autodetection,
134 * it needs a way to flush as much of the CPU's caches as possible.
135 *
136 * TODO: fill this in!
137 */
138static inline void sched_cacheflush(void)
139{
140}
141
142struct thread_struct; 133struct thread_struct;
143extern struct task_struct *_switch(struct thread_struct *prev, 134extern struct task_struct *_switch(struct thread_struct *prev,
144 struct thread_struct *next); 135 struct thread_struct *next);
diff --git a/include/asm-s390/a.out.h b/include/asm-s390/a.out.h
index 72adee6ef338..46158dcaf517 100644
--- a/include/asm-s390/a.out.h
+++ b/include/asm-s390/a.out.h
@@ -32,6 +32,7 @@ struct exec
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33 33
34#define STACK_TOP TASK_SIZE 34#define STACK_TOP TASK_SIZE
35#define STACK_TOP_MAX DEFAULT_TASK_SIZE
35 36
36#endif 37#endif
37 38
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h
index 296f4f1a20e1..7f4ad623f7d5 100644
--- a/include/asm-s390/compat.h
+++ b/include/asm-s390/compat.h
@@ -60,8 +60,10 @@ typedef s32 compat_timer_t;
60 60
61typedef s32 compat_int_t; 61typedef s32 compat_int_t;
62typedef s32 compat_long_t; 62typedef s32 compat_long_t;
63typedef s64 compat_s64;
63typedef u32 compat_uint_t; 64typedef u32 compat_uint_t;
64typedef u32 compat_ulong_t; 65typedef u32 compat_ulong_t;
66typedef u64 compat_u64;
65 67
66struct compat_timespec { 68struct compat_timespec {
67 compat_time_t tv_sec; 69 compat_time_t tv_sec;
diff --git a/include/asm-s390/dma-mapping.h b/include/asm-s390/dma-mapping.h
deleted file mode 100644
index 3f8c12fde0f0..000000000000
--- a/include/asm-s390/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * include/asm-s390/dma-mapping.h
3 *
4 * S390 version
5 *
6 * This file exists so that #include <dma-mapping.h> doesn't break anything.
7 */
8
9#ifndef _ASM_DMA_MAPPING_H
10#define _ASM_DMA_MAPPING_H
11
12#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-s390/fb.h b/include/asm-s390/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-s390/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h
index 830fe4c4eea6..340ba10446ea 100644
--- a/include/asm-s390/kprobes.h
+++ b/include/asm-s390/kprobes.h
@@ -46,8 +46,6 @@ typedef u16 kprobe_opcode_t;
46 ? (MAX_STACK_SIZE) \ 46 ? (MAX_STACK_SIZE) \
47 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 47 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
48 48
49#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry)
50
51#define ARCH_SUPPORTS_KRETPROBES 49#define ARCH_SUPPORTS_KRETPROBES
52#define ARCH_INACTIVE_KPROBE_COUNT 0 50#define ARCH_INACTIVE_KPROBE_COUNT 0
53 51
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index 05ea6f172786..f326451ed6ec 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -64,7 +64,8 @@ static inline void copy_page(void *to, void *from)
64#define clear_user_page(page, vaddr, pg) clear_page(page) 64#define clear_user_page(page, vaddr, pg) clear_page(page)
65#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 65#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
66 66
67#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 67#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
68 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
68#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 69#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
69 70
70/* 71/*
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 9ea7f1023e57..545857e64443 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -41,6 +41,11 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
41 __attribute__((__section__(".data.percpu"))) \ 41 __attribute__((__section__(".data.percpu"))) \
42 __typeof__(type) per_cpu__##name 42 __typeof__(type) per_cpu__##name
43 43
44#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
45 __attribute__((__section__(".data.percpu.shared_aligned"))) \
46 __typeof__(type) per_cpu__##name \
47 ____cacheline_aligned_in_smp
48
44#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) 49#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
45#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) 50#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
46#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) 51#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
@@ -59,6 +64,8 @@ do { \
59 64
60#define DEFINE_PER_CPU(type, name) \ 65#define DEFINE_PER_CPU(type, name) \
61 __typeof__(type) per_cpu__##name 66 __typeof__(type) per_cpu__##name
67#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
68 DEFINE_PER_CPU(type, name)
62 69
63#define __get_cpu_var(var) __reloc_hide(var,0) 70#define __get_cpu_var(var) __reloc_hide(var,0)
64#define __raw_get_cpu_var(var) __reloc_hide(var,0) 71#define __raw_get_cpu_var(var) __reloc_hide(var,0)
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 0a307bb2f353..3208dc6c412c 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -530,14 +530,6 @@ static inline int pte_young(pte_t pte)
530 return 0; 530 return 0;
531} 531}
532 532
533static inline int pte_read(pte_t pte)
534{
535 /* All pages are readable since we don't use the fetch
536 * protection bit in the storage key.
537 */
538 return 1;
539}
540
541/* 533/*
542 * pgd/pmd/pte modification functions 534 * pgd/pmd/pte modification functions
543 */ 535 */
@@ -677,19 +669,6 @@ ptep_clear_flush_young(struct vm_area_struct *vma,
677 return ptep_test_and_clear_young(vma, address, ptep); 669 return ptep_test_and_clear_young(vma, address, ptep);
678} 670}
679 671
680static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
681{
682 return 0;
683}
684
685static inline int
686ptep_clear_flush_dirty(struct vm_area_struct *vma,
687 unsigned long address, pte_t *ptep)
688{
689 /* No need to flush TLB; bits are in storage key */
690 return ptep_test_and_clear_dirty(vma, address, ptep);
691}
692
693static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 672static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
694{ 673{
695 pte_t pte = *ptep; 674 pte_t pte = *ptep;
@@ -715,16 +694,19 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
715 pte_val(*ptep) = _PAGE_TYPE_EMPTY; 694 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
716} 695}
717 696
718static inline pte_t 697static inline void ptep_invalidate(unsigned long address, pte_t *ptep)
719ptep_clear_flush(struct vm_area_struct *vma,
720 unsigned long address, pte_t *ptep)
721{ 698{
722 pte_t pte = *ptep;
723 pte_t *shadow_pte = get_shadow_pte(ptep);
724
725 __ptep_ipte(address, ptep); 699 __ptep_ipte(address, ptep);
726 if (shadow_pte) 700 ptep = get_shadow_pte(ptep);
727 __ptep_ipte(address, shadow_pte); 701 if (ptep)
702 __ptep_ipte(address, ptep);
703}
704
705static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
706 unsigned long address, pte_t *ptep)
707{
708 pte_t pte = *ptep;
709 ptep_invalidate(address, ptep);
728 return pte; 710 return pte;
729} 711}
730 712
@@ -734,21 +716,14 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
734 set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); 716 set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
735} 717}
736 718
737static inline void 719#define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
738ptep_establish(struct vm_area_struct *vma, 720({ \
739 unsigned long address, pte_t *ptep, 721 int __changed = !pte_same(*(__ptep), __entry); \
740 pte_t entry) 722 if (__changed) { \
741{ 723 ptep_invalidate(__addr, __ptep); \
742 ptep_clear_flush(vma, address, ptep); 724 set_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \
743 set_pte(ptep, entry); 725 } \
744} 726 __changed; \
745
746#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
747({ \
748 int __changed = !pte_same(*(__ptep), __entry); \
749 if (__changed) \
750 ptep_establish(__vma, __address, __ptep, __entry); \
751 __changed; \
752}) 727})
753 728
754/* 729/*
@@ -948,12 +923,9 @@ extern int remove_shared_memory(unsigned long start, unsigned long size);
948#define __HAVE_ARCH_MEMMAP_INIT 923#define __HAVE_ARCH_MEMMAP_INIT
949extern void memmap_init(unsigned long, int, unsigned long, unsigned long); 924extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
950 925
951#define __HAVE_ARCH_PTEP_ESTABLISH
952#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 926#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
953#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 927#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
954#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH 928#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
955#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
956#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
957#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 929#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
958#define __HAVE_ARCH_PTEP_CLEAR_FLUSH 930#define __HAVE_ARCH_PTEP_CLEAR_FLUSH
959#define __HAVE_ARCH_PTEP_SET_WRPROTECT 931#define __HAVE_ARCH_PTEP_SET_WRPROTECT
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index bbe137c3ed69..64a3cd05cae1 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -97,16 +97,6 @@ static inline void restore_access_regs(unsigned int *acrs)
97 prev = __switch_to(prev,next); \ 97 prev = __switch_to(prev,next); \
98} while (0) 98} while (0)
99 99
100/*
101 * On SMP systems, when the scheduler does migration-cost autodetection,
102 * it needs a way to flush as much of the CPU's caches as possible.
103 *
104 * TODO: fill this in!
105 */
106static inline void sched_cacheflush(void)
107{
108}
109
110#ifdef CONFIG_VIRT_CPU_ACCOUNTING 100#ifdef CONFIG_VIRT_CPU_ACCOUNTING
111extern void account_vtime(struct task_struct *); 101extern void account_vtime(struct task_struct *);
112extern void account_tick_vtime(struct task_struct *); 102extern void account_tick_vtime(struct task_struct *);
diff --git a/include/asm-sh/a.out.h b/include/asm-sh/a.out.h
index 6e9fca9ee333..685d0f6125fa 100644
--- a/include/asm-sh/a.out.h
+++ b/include/asm-sh/a.out.h
@@ -20,6 +20,7 @@ struct exec
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#define STACK_TOP TASK_SIZE 22#define STACK_TOP TASK_SIZE
23#define STACK_TOP_MAX STACK_TOP
23 24
24#endif 25#endif
25 26
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h
index 5a117ec43c77..aeee8da9c54f 100644
--- a/include/asm-sh/bugs.h
+++ b/include/asm-sh/bugs.h
@@ -22,7 +22,7 @@ static void __init check_bugs(void)
22 current_cpu_data.loops_per_jiffy = loops_per_jiffy; 22 current_cpu_data.loops_per_jiffy = loops_per_jiffy;
23 23
24 switch (current_cpu_data.type) { 24 switch (current_cpu_data.type) {
25 case CPU_SH7604 ... CPU_SH7619: 25 case CPU_SH7619:
26 *p++ = '2'; 26 *p++ = '2';
27 break; 27 break;
28 case CPU_SH7206: 28 case CPU_SH7206:
@@ -35,7 +35,7 @@ static void __init check_bugs(void)
35 case CPU_SH7750 ... CPU_SH4_501: 35 case CPU_SH7750 ... CPU_SH4_501:
36 *p++ = '4'; 36 *p++ = '4';
37 break; 37 break;
38 case CPU_SH7770 ... CPU_SH7785: 38 case CPU_SH7770 ... CPU_SHX3:
39 *p++ = '4'; 39 *p++ = '4';
40 *p++ = 'a'; 40 *p++ = 'a';
41 break; 41 break;
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index 9a3cb6ba9d15..7a18649d1ccb 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -9,6 +9,7 @@
9#define __ASM_SH_CACHE_H 9#define __ASM_SH_CACHE_H
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <linux/init.h>
12#include <asm/cpu/cache.h> 13#include <asm/cpu/cache.h>
13 14
14#define SH_CACHE_VALID 1 15#define SH_CACHE_VALID 1
@@ -48,6 +49,9 @@ struct cache_info {
48 49
49 unsigned long flags; 50 unsigned long flags;
50}; 51};
52
53int __init detect_cpu_and_cache_system(void);
54
51#endif /* __ASSEMBLY__ */ 55#endif /* __ASSEMBLY__ */
52#endif /* __KERNEL__ */ 56#endif /* __KERNEL__ */
53#endif /* __ASM_SH_CACHE_H */ 57#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/clock.h b/include/asm-sh/clock.h
index 386d797d86b7..b550a27a7042 100644
--- a/include/asm-sh/clock.h
+++ b/include/asm-sh/clock.h
@@ -14,6 +14,7 @@ struct clk_ops {
14 void (*disable)(struct clk *clk); 14 void (*disable)(struct clk *clk);
15 void (*recalc)(struct clk *clk); 15 void (*recalc)(struct clk *clk);
16 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id); 16 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
17 long (*round_rate)(struct clk *clk, unsigned long rate);
17}; 18};
18 19
19struct clk { 20struct clk {
diff --git a/include/asm-sh/cpu-sh2/cache.h b/include/asm-sh/cpu-sh2/cache.h
index 20b9796842dc..f02ba7a672b2 100644
--- a/include/asm-sh/cpu-sh2/cache.h
+++ b/include/asm-sh/cpu-sh2/cache.h
@@ -12,23 +12,7 @@
12 12
13#define L1_CACHE_SHIFT 4 13#define L1_CACHE_SHIFT 4
14 14
15#if defined(CONFIG_CPU_SUBTYPE_SH7604) 15#if defined(CONFIG_CPU_SUBTYPE_SH7619)
16#define CCR 0xfffffe92 /* Address of Cache Control Register */
17
18#define CCR_CACHE_CE 0x01 /* Cache enable */
19#define CCR_CACHE_ID 0x02 /* Instruction Replacement disable */
20#define CCR_CACHE_OD 0x04 /* Data Replacement disable */
21#define CCR_CACHE_TW 0x08 /* Two-way mode */
22#define CCR_CACHE_CP 0x10 /* Cache purge */
23
24#define CACHE_OC_ADDRESS_ARRAY 0x60000000
25
26#define CCR_CACHE_ENABLE CCR_CACHE_CE
27#define CCR_CACHE_INVALIDATE CCR_CACHE_CP
28#define CCR_CACHE_ORA CCR_CACHE_TW
29#define CCR_CACHE_WT 0x00 /* SH-2 is _always_ write-through */
30
31#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
32#define CCR1 0xffffffec 16#define CCR1 0xffffffec
33#define CCR CCR1 17#define CCR CCR1
34 18
@@ -49,5 +33,5 @@
49#define CCR_CACHE_ENABLE CCR_CACHE_CE 33#define CCR_CACHE_ENABLE CCR_CACHE_CE
50#define CCR_CACHE_INVALIDATE CCR_CACHE_CF 34#define CCR_CACHE_INVALIDATE CCR_CACHE_CF
51#endif 35#endif
52#endif /* __ASM_CPU_SH2_CACHE_H */
53 36
37#endif /* __ASM_CPU_SH2_CACHE_H */
diff --git a/include/asm-sh/cpu-sh3/timer.h b/include/asm-sh/cpu-sh3/timer.h
index b2394cf76f49..4928b08f9d19 100644
--- a/include/asm-sh/cpu-sh3/timer.h
+++ b/include/asm-sh/cpu-sh3/timer.h
@@ -29,7 +29,7 @@
29#endif 29#endif
30 30
31#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710) 31#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710)
32#define TMU_TSTR 0xa412fe92 /* Byte access */ 32#define TMU_012_TSTR 0xa412fe92 /* Byte access */
33 33
34#define TMU0_TCOR 0xa412fe94 /* Long access */ 34#define TMU0_TCOR 0xa412fe94 /* Long access */
35#define TMU0_TCNT 0xa412fe98 /* Long access */ 35#define TMU0_TCNT 0xa412fe98 /* Long access */
@@ -44,7 +44,7 @@
44#define TMU2_TCR 0xa412feb4 /* Word access */ 44#define TMU2_TCR 0xa412feb4 /* Word access */
45 45
46#else 46#else
47#define TMU_TSTR 0xfffffe92 /* Byte access */ 47#define TMU_012_TSTR 0xfffffe92 /* Byte access */
48 48
49#define TMU0_TCOR 0xfffffe94 /* Long access */ 49#define TMU0_TCOR 0xfffffe94 /* Long access */
50#define TMU0_TCNT 0xfffffe98 /* Long access */ 50#define TMU0_TCNT 0xfffffe98 /* Long access */
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h
index 39f41fcd509d..026025b51cea 100644
--- a/include/asm-sh/cpu-sh4/freq.h
+++ b/include/asm-sh/cpu-sh4/freq.h
@@ -22,6 +22,8 @@
22#define FRQCR0 0xffc80000 22#define FRQCR0 0xffc80000
23#define FRQCR1 0xffc80004 23#define FRQCR1 0xffc80004
24#define FRQMR1 0xffc80014 24#define FRQMR1 0xffc80014
25#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
26#define FRQCR 0xffc00014
25#else 27#else
26#define FRQCR 0xffc00000 28#define FRQCR 0xffc00000
27#define FRQCR_PSTBY 0x0200 29#define FRQCR_PSTBY 0x0200
diff --git a/include/asm-sh/cpu-sh4/timer.h b/include/asm-sh/cpu-sh4/timer.h
index 8a4af126c890..d1e796b96888 100644
--- a/include/asm-sh/cpu-sh4/timer.h
+++ b/include/asm-sh/cpu-sh4/timer.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * include/asm-sh/cpu-sh4/timer.h 2 * include/asm-sh/cpu-sh4/timer.h
3 * 3 *
4 * Copyright (C) 2004 Lineo Solutions, Inc. 4 * Copyright (C) 2004 Lineo Solutions, Inc.
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
@@ -16,36 +16,45 @@
16 * SH7750S/SH7750R 16 * SH7750S/SH7750R
17 * SH7751/SH7751R 17 * SH7751/SH7751R
18 * SH7760 18 * SH7760
19 * SH-X3
19 * --------------------------------------------------------------------------- 20 * ---------------------------------------------------------------------------
20 */ 21 */
21 22#ifdef CONFIG_CPU_SUBTYPE_SHX3
22#if !defined(CONFIG_CPU_SUBTYPE_SH7760) 23#define TMU_012_BASE 0xffc10000
23#define TMU_TOCR 0xffd80000 /* Byte access */ 24#define TMU_345_BASE 0xffc20000
25#else
26#define TMU_012_BASE 0xffd80000
27#define TMU_345_BASE 0xfe100000
24#endif 28#endif
25#define TMU_TSTR 0xffd80004 /* Byte access */
26 29
27#define TMU0_TCOR 0xffd80008 /* Long access */ 30#define TMU_TOCR TMU_012_BASE /* Not supported on all CPUs */
28#define TMU0_TCNT 0xffd8000c /* Long access */
29#define TMU0_TCR 0xffd80010 /* Word access */
30 31
31#define TMU1_TCOR 0xffd80014 /* Long access */ 32#define TMU_012_TSTR (TMU_012_BASE + 0x04)
32#define TMU1_TCNT 0xffd80018 /* Long access */ 33#define TMU_345_TSTR (TMU_345_BASE + 0x04)
33#define TMU1_TCR 0xffd8001c /* Word access */
34 34
35#define TMU2_TCOR 0xffd80020 /* Long access */ 35#define TMU0_TCOR (TMU_012_BASE + 0x08)
36#define TMU2_TCNT 0xffd80024 /* Long access */ 36#define TMU0_TCNT (TMU_012_BASE + 0x0c)
37#define TMU2_TCR 0xffd80028 /* Word access */ 37#define TMU0_TCR (TMU_012_BASE + 0x10)
38#define TMU2_TCPR 0xffd8002c /* Long access */
39 38
40#if !defined(CONFIG_CPU_SUBTYPE_SH7760) 39#define TMU1_TCOR (TMU_012_BASE + 0x14)
41#define TMU3_TCOR 0xfe100008 /* Long access */ 40#define TMU1_TCNT (TMU_012_BASE + 0x18)
42#define TMU3_TCNT 0xfe10000c /* Long access */ 41#define TMU1_TCR (TMU_012_BASE + 0x1c)
43#define TMU3_TCR 0xfe100010 /* Word access */
44 42
45#define TMU4_TCOR 0xfe100014 /* Long access */ 43#define TMU2_TCOR (TMU_012_BASE + 0x20)
46#define TMU4_TCNT 0xfe100018 /* Long access */ 44#define TMU2_TCNT (TMU_012_BASE + 0x24)
47#define TMU4_TCR 0xfe10001c /* Word access */ 45#define TMU2_TCR (TMU_012_BASE + 0x28)
48#endif 46#define TMU2_TCPR (TMU_012_BASE + 0x2c)
49 47
50#endif /* __ASM_CPU_SH4_TIMER_H */ 48#define TMU3_TCOR (TMU_345_BASE + 0x08)
49#define TMU3_TCNT (TMU_345_BASE + 0x0c)
50#define TMU3_TCR (TMU_345_BASE + 0x10)
51 51
52#define TMU4_TCOR (TMU_345_BASE + 0x14)
53#define TMU4_TCNT (TMU_345_BASE + 0x18)
54#define TMU4_TCR (TMU_345_BASE + 0x1c)
55
56#define TMU5_TCOR (TMU_345_BASE + 0x20)
57#define TMU5_TCNT (TMU_345_BASE + 0x24)
58#define TMU5_TCR (TMU_345_BASE + 0x28)
59
60#endif /* __ASM_CPU_SH4_TIMER_H */
diff --git a/include/asm-sh/fb.h b/include/asm-sh/fb.h
new file mode 100644
index 000000000000..d92e99cd8c8a
--- /dev/null
+++ b/include/asm-sh/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sh/futex-irq.h b/include/asm-sh/futex-irq.h
new file mode 100644
index 000000000000..a9f16a7f9aea
--- /dev/null
+++ b/include/asm-sh/futex-irq.h
@@ -0,0 +1,111 @@
1#ifndef __ASM_SH_FUTEX_IRQ_H
2#define __ASM_SH_FUTEX_IRQ_H
3
4#include <asm/system.h>
5
6static inline int atomic_futex_op_xchg_set(int oparg, int __user *uaddr,
7 int *oldval)
8{
9 unsigned long flags;
10 int ret;
11
12 local_irq_save(flags);
13
14 ret = get_user(*oldval, uaddr);
15 if (!ret)
16 ret = put_user(oparg, uaddr);
17
18 local_irq_restore(flags);
19
20 return ret;
21}
22
23static inline int atomic_futex_op_xchg_add(int oparg, int __user *uaddr,
24 int *oldval)
25{
26 unsigned long flags;
27 int ret;
28
29 local_irq_save(flags);
30
31 ret = get_user(*oldval, uaddr);
32 if (!ret)
33 ret = put_user(*oldval + oparg, uaddr);
34
35 local_irq_restore(flags);
36
37 return ret;
38}
39
40static inline int atomic_futex_op_xchg_or(int oparg, int __user *uaddr,
41 int *oldval)
42{
43 unsigned long flags;
44 int ret;
45
46 local_irq_save(flags);
47
48 ret = get_user(*oldval, uaddr);
49 if (!ret)
50 ret = put_user(*oldval | oparg, uaddr);
51
52 local_irq_restore(flags);
53
54 return ret;
55}
56
57static inline int atomic_futex_op_xchg_and(int oparg, int __user *uaddr,
58 int *oldval)
59{
60 unsigned long flags;
61 int ret;
62
63 local_irq_save(flags);
64
65 ret = get_user(*oldval, uaddr);
66 if (!ret)
67 ret = put_user(*oldval & oparg, uaddr);
68
69 local_irq_restore(flags);
70
71 return ret;
72}
73
74static inline int atomic_futex_op_xchg_xor(int oparg, int __user *uaddr,
75 int *oldval)
76{
77 unsigned long flags;
78 int ret;
79
80 local_irq_save(flags);
81
82 ret = get_user(*oldval, uaddr);
83 if (!ret)
84 ret = put_user(*oldval ^ oparg, uaddr);
85
86 local_irq_restore(flags);
87
88 return ret;
89}
90
91static inline int atomic_futex_op_cmpxchg_inatomic(int __user *uaddr,
92 int oldval, int newval)
93{
94 unsigned long flags;
95 int ret, prev = 0;
96
97 local_irq_save(flags);
98
99 ret = get_user(prev, uaddr);
100 if (!ret && oldval == prev)
101 ret = put_user(newval, uaddr);
102
103 local_irq_restore(flags);
104
105 if (ret)
106 return ret;
107
108 return prev;
109}
110
111#endif /* __ASM_SH_FUTEX_IRQ_H */
diff --git a/include/asm-sh/futex.h b/include/asm-sh/futex.h
index 6a332a9f099c..74ed3681d33c 100644
--- a/include/asm-sh/futex.h
+++ b/include/asm-sh/futex.h
@@ -1,6 +1,77 @@
1#ifndef _ASM_FUTEX_H 1#ifndef __ASM_SH_FUTEX_H
2#define _ASM_FUTEX_H 2#define __ASM_SH_FUTEX_H
3 3
4#include <asm-generic/futex.h> 4#ifdef __KERNEL__
5 5
6#endif 6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10/* XXX: UP variants, fix for SH-4A and SMP.. */
11#include <asm/futex-irq.h>
12
13static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
14{
15 int op = (encoded_op >> 28) & 7;
16 int cmp = (encoded_op >> 24) & 15;
17 int oparg = (encoded_op << 8) >> 20;
18 int cmparg = (encoded_op << 20) >> 20;
19 int oldval = 0, ret;
20
21 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
22 oparg = 1 << oparg;
23
24 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
25 return -EFAULT;
26
27 pagefault_disable();
28
29 switch (op) {
30 case FUTEX_OP_SET:
31 ret = atomic_futex_op_xchg_set(oparg, uaddr, &oldval);
32 break;
33 case FUTEX_OP_ADD:
34 ret = atomic_futex_op_xchg_add(oparg, uaddr, &oldval);
35 break;
36 case FUTEX_OP_OR:
37 ret = atomic_futex_op_xchg_or(oparg, uaddr, &oldval);
38 break;
39 case FUTEX_OP_ANDN:
40 ret = atomic_futex_op_xchg_and(~oparg, uaddr, &oldval);
41 break;
42 case FUTEX_OP_XOR:
43 ret = atomic_futex_op_xchg_xor(oparg, uaddr, &oldval);
44 break;
45 default:
46 ret = -ENOSYS;
47 break;
48 }
49
50 pagefault_enable();
51
52 if (!ret) {
53 switch (cmp) {
54 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
55 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
56 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
57 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
58 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
59 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
60 default: ret = -ENOSYS;
61 }
62 }
63
64 return ret;
65}
66
67static inline int
68futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
69{
70 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
71 return -EFAULT;
72
73 return atomic_futex_op_cmpxchg_inatomic(uaddr, oldval, newval);
74}
75
76#endif /* __KERNEL__ */
77#endif /* __ASM_SH_FUTEX_H */
diff --git a/include/asm-sh/hd64461.h b/include/asm-sh/hd64461.h
index 27e5c34e2659..4dd8592ca014 100644
--- a/include/asm-sh/hd64461.h
+++ b/include/asm-sh/hd64461.h
@@ -1,200 +1,241 @@
1#ifndef __ASM_SH_HD64461 1#ifndef __ASM_SH_HD64461
2#define __ASM_SH_HD64461 2#define __ASM_SH_HD64461
3/* 3/*
4 * $Id: hd64461.h,v 1.5 2004/03/16 00:07:51 lethal Exp $ 4 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
5 * Copyright (C) 2004 Paul Mundt
5 * Copyright (C) 2000 YAEGASHI Takeshi 6 * Copyright (C) 2000 YAEGASHI Takeshi
6 * Hitachi HD64461 companion chip support 7 *
8 * Hitachi HD64461 companion chip support
9 * (please note manual reference 0x10000000 = 0xb0000000)
7 */ 10 */
8 11
9/* Constants for PCMCIA mappings */ 12/* Constants for PCMCIA mappings */
10#define HD64461_PCC_WINDOW 0x01000000 13#define HD64461_PCC_WINDOW 0x01000000
11 14
12#define HD64461_PCC0_BASE 0xb8000000 /* area 6 */ 15/* Area 6 - Slot 0 - memory and/or IO card */
13#define HD64461_PCC0_ATTR (HD64461_PCC0_BASE) 16#define HD64461_PCC0_BASE (CONFIG_HD64461_IOBASE + 0x8000000)
14#define HD64461_PCC0_COMM (HD64461_PCC0_BASE+HD64461_PCC_WINDOW) 17#define HD64461_PCC0_ATTR (HD64461_PCC0_BASE) /* 0xb80000000 */
15#define HD64461_PCC0_IO (HD64461_PCC0_BASE+2*HD64461_PCC_WINDOW) 18#define HD64461_PCC0_COMM (HD64461_PCC0_BASE+HD64461_PCC_WINDOW) /* 0xb90000000 */
16 19#define HD64461_PCC0_IO (HD64461_PCC0_BASE+2*HD64461_PCC_WINDOW) /* 0xba0000000 */
17#define HD64461_PCC1_BASE 0xb4000000 /* area 5 */ 20
18#define HD64461_PCC1_ATTR (HD64461_PCC1_BASE) 21/* Area 5 - Slot 1 - memory card only */
19#define HD64461_PCC1_COMM (HD64461_PCC1_BASE+HD64461_PCC_WINDOW) 22#define HD64461_PCC1_BASE (CONFIG_HD64461_IOBASE + 0x4000000)
20 23#define HD64461_PCC1_ATTR (HD64461_PCC1_BASE) /* 0xb4000000 */
21#define HD64461_STBCR 0x10000 24#define HD64461_PCC1_COMM (HD64461_PCC1_BASE+HD64461_PCC_WINDOW) /* 0xb5000000 */
22#define HD64461_STBCR_CKIO_STBY 0x2000 25
23#define HD64461_STBCR_SAFECKE_IST 0x1000 26/* Standby Control Register for HD64461 */
24#define HD64461_STBCR_SLCKE_IST 0x0800 27#define HD64461_STBCR CONFIG_HD64461_IOBASE
25#define HD64461_STBCR_SAFECKE_OST 0x0400 28#define HD64461_STBCR_CKIO_STBY 0x2000
26#define HD64461_STBCR_SLCKE_OST 0x0200 29#define HD64461_STBCR_SAFECKE_IST 0x1000
27#define HD64461_STBCR_SMIAST 0x0100 30#define HD64461_STBCR_SLCKE_IST 0x0800
28#define HD64461_STBCR_SLCDST 0x0080 31#define HD64461_STBCR_SAFECKE_OST 0x0400
29#define HD64461_STBCR_SPC0ST 0x0040 32#define HD64461_STBCR_SLCKE_OST 0x0200
30#define HD64461_STBCR_SPC1ST 0x0020 33#define HD64461_STBCR_SMIAST 0x0100
31#define HD64461_STBCR_SAFEST 0x0010 34#define HD64461_STBCR_SLCDST 0x0080
32#define HD64461_STBCR_STM0ST 0x0008 35#define HD64461_STBCR_SPC0ST 0x0040
33#define HD64461_STBCR_STM1ST 0x0004 36#define HD64461_STBCR_SPC1ST 0x0020
34#define HD64461_STBCR_SIRST 0x0002 37#define HD64461_STBCR_SAFEST 0x0010
35#define HD64461_STBCR_SURTST 0x0001 38#define HD64461_STBCR_STM0ST 0x0008
36 39#define HD64461_STBCR_STM1ST 0x0004
37#define HD64461_SYSCR 0x10002 40#define HD64461_STBCR_SIRST 0x0002
38#define HD64461_SCPUCR 0x10004 41#define HD64461_STBCR_SURTST 0x0001
39 42
40#define HD64461_LCDCBAR 0x11000 43/* System Configuration Register */
41#define HD64461_LCDCLOR 0x11002 44#define HD64461_SYSCR (CONFIG_HD64461_IOBASE + 0x02)
42#define HD64461_LCDCCR 0x11004 45
43#define HD64461_LCDCCR_STBACK 0x0400 46/* CPU Data Bus Control Register */
44#define HD64461_LCDCCR_STREQ 0x0100 47#define HD64461_SCPUCR (CONFIG_HD64461_IOBASE + 0x04)
45#define HD64461_LCDCCR_MOFF 0x0080 48
46#define HD64461_LCDCCR_REFSEL 0x0040 49/* Base Adress Register */
47#define HD64461_LCDCCR_EPON 0x0020 50#define HD64461_LCDCBAR (CONFIG_HD64461_IOBASE + 0x1000)
48#define HD64461_LCDCCR_SPON 0x0010 51
49 52/* Line increment adress */
50#define HD64461_LDR1 0x11010 53#define HD64461_LCDCLOR (CONFIG_HD64461_IOBASE + 0x1002)
51#define HD64461_LDR1_DON 0x01 54
52#define HD64461_LDR1_DINV 0x80 55/* Controls LCD controller */
53 56#define HD64461_LCDCCR (CONFIG_HD64461_IOBASE + 0x1004)
54#define HD64461_LDR2 0x11012 57
55#define HD64461_LDHNCR 0x11014 58/* LCCDR control bits */
56#define HD64461_LDHNSR 0x11016 59#define HD64461_LCDCCR_STBACK 0x0400 /* Standby Back */
57#define HD64461_LDVNTR 0x11018 60#define HD64461_LCDCCR_STREQ 0x0100 /* Standby Request */
58#define HD64461_LDVNDR 0x1101a 61#define HD64461_LCDCCR_MOFF 0x0080 /* Memory Off */
59#define HD64461_LDVSPR 0x1101c 62#define HD64461_LCDCCR_REFSEL 0x0040 /* Refresh Select */
60#define HD64461_LDR3 0x1101e 63#define HD64461_LCDCCR_EPON 0x0020 /* End Power On */
61 64#define HD64461_LCDCCR_SPON 0x0010 /* Start Power On */
62#define HD64461_CPTWAR 0x11030 65
63#define HD64461_CPTWDR 0x11032 66/* Controls LCD (1) */
64#define HD64461_CPTRAR 0x11034 67#define HD64461_LDR1 (CONFIG_HD64461_IOBASE + 0x1010)
65#define HD64461_CPTRDR 0x11036 68#define HD64461_LDR1_DON 0x01 /* Display On */
66 69#define HD64461_LDR1_DINV 0x80 /* Display Invert */
67#define HD64461_GRDOR 0x11040 70
68#define HD64461_GRSCR 0x11042 71/* Controls LCD (2) */
69#define HD64461_GRCFGR 0x11044 72#define HD64461_LDR2 (CONFIG_HD64461_IOBASE + 0x1012)
70#define HD64461_GRCFGR_ACCSTATUS 0x10 73#define HD64461_LDHNCR (CONFIG_HD64461_IOBASE + 0x1014) /* Number of horizontal characters */
71#define HD64461_GRCFGR_ACCRESET 0x08 74#define HD64461_LDHNSR (CONFIG_HD64461_IOBASE + 0x1016) /* Specify output start position + width of CL1 */
72#define HD64461_GRCFGR_ACCSTART_BITBLT 0x06 75#define HD64461_LDVNTR (CONFIG_HD64461_IOBASE + 0x1018) /* Specify total vertical lines */
73#define HD64461_GRCFGR_ACCSTART_LINE 0x04 76#define HD64461_LDVNDR (CONFIG_HD64461_IOBASE + 0x101a) /* specify number of display vertical lines */
74#define HD64461_GRCFGR_COLORDEPTH16 0x01 77#define HD64461_LDVSPR (CONFIG_HD64461_IOBASE + 0x101c) /* specify vertical synchronization pos and AC nr */
75 78
76#define HD64461_LNSARH 0x11046 79/* Controls LCD (3) */
77#define HD64461_LNSARL 0x11048 80#define HD64461_LDR3 (CONFIG_HD64461_IOBASE + 0x101e)
78#define HD64461_LNAXLR 0x1104a 81
79#define HD64461_LNDGR 0x1104c 82/* Palette Registers */
80#define HD64461_LNAXR 0x1104e 83#define HD64461_CPTWAR (CONFIG_HD64461_IOBASE + 0x1030) /* Color Palette Write Adress Register */
81#define HD64461_LNERTR 0x11050 84#define HD64461_CPTWDR (CONFIG_HD64461_IOBASE + 0x1032) /* Color Palette Write Data Register */
82#define HD64461_LNMDR 0x11052 85#define HD64461_CPTRAR (CONFIG_HD64461_IOBASE + 0x1034) /* Color Palette Read Adress Register */
83#define HD64461_BBTSSARH 0x11054 86#define HD64461_CPTRDR (CONFIG_HD64461_IOBASE + 0x1036) /* Color Palette Read Data Register */
84#define HD64461_BBTSSARL 0x11056 87
85#define HD64461_BBTDSARH 0x11058 88#define HD64461_GRDOR (CONFIG_HD64461_IOBASE + 0x1040) /* Display Resolution Offset Register */
86#define HD64461_BBTDSARL 0x1105a 89#define HD64461_GRSCR (CONFIG_HD64461_IOBASE + 0x1042) /* Solid Color Register */
87#define HD64461_BBTDWR 0x1105c 90#define HD64461_GRCFGR (CONFIG_HD64461_IOBASE + 0x1044) /* Accelerator Configuration Register */
88#define HD64461_BBTDHR 0x1105e 91
89#define HD64461_BBTPARH 0x11060 92#define HD64461_GRCFGR_ACCSTATUS 0x10 /* Accelerator Status */
90#define HD64461_BBTPARL 0x11062 93#define HD64461_GRCFGR_ACCRESET 0x08 /* Accelerator Reset */
91#define HD64461_BBTMARH 0x11064 94#define HD64461_GRCFGR_ACCSTART_BITBLT 0x06 /* Accelerator Start BITBLT */
92#define HD64461_BBTMARL 0x11066 95#define HD64461_GRCFGR_ACCSTART_LINE 0x04 /* Accelerator Start Line Drawing */
93#define HD64461_BBTROPR 0x11068 96#define HD64461_GRCFGR_COLORDEPTH16 0x01 /* Sets Colordepth 16 for Accelerator */
94#define HD64461_BBTMDR 0x1106a 97#define HD64461_GRCFGR_COLORDEPTH8 0x01 /* Sets Colordepth 8 for Accelerator */
98
99/* Line Drawing Registers */
100#define HD64461_LNSARH (CONFIG_HD64461_IOBASE + 0x1046) /* Line Start Adress Register (H) */
101#define HD64461_LNSARL (CONFIG_HD64461_IOBASE + 0x1048) /* Line Start Adress Register (L) */
102#define HD64461_LNAXLR (CONFIG_HD64461_IOBASE + 0x104a) /* Axis Pixel Length Register */
103#define HD64461_LNDGR (CONFIG_HD64461_IOBASE + 0x104c) /* Diagonal Register */
104#define HD64461_LNAXR (CONFIG_HD64461_IOBASE + 0x104e) /* Axial Register */
105#define HD64461_LNERTR (CONFIG_HD64461_IOBASE + 0x1050) /* Start Error Term Register */
106#define HD64461_LNMDR (CONFIG_HD64461_IOBASE + 0x1052) /* Line Mode Register */
107
108/* BitBLT Registers */
109#define HD64461_BBTSSARH (CONFIG_HD64461_IOBASE + 0x1054) /* Source Start Adress Register (H) */
110#define HD64461_BBTSSARL (CONFIG_HD64461_IOBASE + 0x1056) /* Source Start Adress Register (L) */
111#define HD64461_BBTDSARH (CONFIG_HD64461_IOBASE + 0x1058) /* Destination Start Adress Register (H) */
112#define HD64461_BBTDSARL (CONFIG_HD64461_IOBASE + 0x105a) /* Destination Start Adress Register (L) */
113#define HD64461_BBTDWR (CONFIG_HD64461_IOBASE + 0x105c) /* Destination Block Width Register */
114#define HD64461_BBTDHR (CONFIG_HD64461_IOBASE + 0x105e) /* Destination Block Height Register */
115#define HD64461_BBTPARH (CONFIG_HD64461_IOBASE + 0x1060) /* Pattern Start Adress Register (H) */
116#define HD64461_BBTPARL (CONFIG_HD64461_IOBASE + 0x1062) /* Pattern Start Adress Register (L) */
117#define HD64461_BBTMARH (CONFIG_HD64461_IOBASE + 0x1064) /* Mask Start Adress Register (H) */
118#define HD64461_BBTMARL (CONFIG_HD64461_IOBASE + 0x1066) /* Mask Start Adress Register (L) */
119#define HD64461_BBTROPR (CONFIG_HD64461_IOBASE + 0x1068) /* ROP Register */
120#define HD64461_BBTMDR (CONFIG_HD64461_IOBASE + 0x106a) /* BitBLT Mode Register */
95 121
96/* PC Card Controller Registers */ 122/* PC Card Controller Registers */
97#define HD64461_PCC0ISR 0x12000 /* socket 0 interface status */ 123/* Maps to Physical Area 6 */
98#define HD64461_PCC0GCR 0x12002 /* socket 0 general control */ 124#define HD64461_PCC0ISR (CONFIG_HD64461_IOBASE + 0x2000) /* socket 0 interface status */
99#define HD64461_PCC0CSCR 0x12004 /* socket 0 card status change */ 125#define HD64461_PCC0GCR (CONFIG_HD64461_IOBASE + 0x2002) /* socket 0 general control */
100#define HD64461_PCC0CSCIER 0x12006 /* socket 0 card status change interrupt enable */ 126#define HD64461_PCC0CSCR (CONFIG_HD64461_IOBASE + 0x2004) /* socket 0 card status change */
101#define HD64461_PCC0SCR 0x12008 /* socket 0 software control */ 127#define HD64461_PCC0CSCIER (CONFIG_HD64461_IOBASE + 0x2006) /* socket 0 card status change interrupt enable */
102#define HD64461_PCC1ISR 0x12010 /* socket 1 interface status */ 128#define HD64461_PCC0SCR (CONFIG_HD64461_IOBASE + 0x2008) /* socket 0 software control */
103#define HD64461_PCC1GCR 0x12012 /* socket 1 general control */ 129/* Maps to Physical Area 5 */
104#define HD64461_PCC1CSCR 0x12014 /* socket 1 card status change */ 130#define HD64461_PCC1ISR (CONFIG_HD64461_IOBASE + 0x2010) /* socket 1 interface status */
105#define HD64461_PCC1CSCIER 0x12016 /* socket 1 card status change interrupt enable */ 131#define HD64461_PCC1GCR (CONFIG_HD64461_IOBASE + 0x2012) /* socket 1 general control */
106#define HD64461_PCC1SCR 0x12018 /* socket 1 software control */ 132#define HD64461_PCC1CSCR (CONFIG_HD64461_IOBASE + 0x2014) /* socket 1 card status change */
133#define HD64461_PCC1CSCIER (CONFIG_HD64461_IOBASE + 0x2016) /* socket 1 card status change interrupt enable */
134#define HD64461_PCC1SCR (CONFIG_HD64461_IOBASE + 0x2018) /* socket 1 software control */
107 135
108/* PCC Interface Status Register */ 136/* PCC Interface Status Register */
109#define HD64461_PCCISR_READY 0x80 /* card ready */ 137#define HD64461_PCCISR_READY 0x80 /* card ready */
110#define HD64461_PCCISR_MWP 0x40 /* card write-protected */ 138#define HD64461_PCCISR_MWP 0x40 /* card write-protected */
111#define HD64461_PCCISR_VS2 0x20 /* voltage select pin 2 */ 139#define HD64461_PCCISR_VS2 0x20 /* voltage select pin 2 */
112#define HD64461_PCCISR_VS1 0x10 /* voltage select pin 1 */ 140#define HD64461_PCCISR_VS1 0x10 /* voltage select pin 1 */
113#define HD64461_PCCISR_CD2 0x08 /* card detect 2 */ 141#define HD64461_PCCISR_CD2 0x08 /* card detect 2 */
114#define HD64461_PCCISR_CD1 0x04 /* card detect 1 */ 142#define HD64461_PCCISR_CD1 0x04 /* card detect 1 */
115#define HD64461_PCCISR_BVD2 0x02 /* battery 1 */ 143#define HD64461_PCCISR_BVD2 0x02 /* battery 1 */
116#define HD64461_PCCISR_BVD1 0x01 /* battery 1 */ 144#define HD64461_PCCISR_BVD1 0x01 /* battery 1 */
117 145
118#define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */ 146#define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */
119#define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */ 147#define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */
120#define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */ 148#define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */
121#define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */ 149#define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */
122#define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */ 150#define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */
123#define HD64461_PCCISR_BVD_BATDEAD2 0x00 /* battery dead */ 151#define HD64461_PCCISR_BVD_BATDEAD2 0x00 /* battery dead */
124 152
125/* PCC General Control Register */ 153/* PCC General Control Register */
126#define HD64461_PCCGCR_DRVE 0x80 /* output drive */ 154#define HD64461_PCCGCR_DRVE 0x80 /* output drive */
127#define HD64461_PCCGCR_PCCR 0x40 /* PC card reset */ 155#define HD64461_PCCGCR_PCCR 0x40 /* PC card reset */
128#define HD64461_PCCGCR_PCCT 0x20 /* PC card type, 1=IO&mem, 0=mem */ 156#define HD64461_PCCGCR_PCCT 0x20 /* PC card type, 1=IO&mem, 0=mem */
129#define HD64461_PCCGCR_VCC0 0x10 /* voltage control pin VCC0SEL0 */ 157#define HD64461_PCCGCR_VCC0 0x10 /* voltage control pin VCC0SEL0 */
130#define HD64461_PCCGCR_PMMOD 0x08 /* memory mode */ 158#define HD64461_PCCGCR_PMMOD 0x08 /* memory mode */
131#define HD64461_PCCGCR_PA25 0x04 /* pin A25 */ 159#define HD64461_PCCGCR_PA25 0x04 /* pin A25 */
132#define HD64461_PCCGCR_PA24 0x02 /* pin A24 */ 160#define HD64461_PCCGCR_PA24 0x02 /* pin A24 */
133#define HD64461_PCCGCR_REG 0x01 /* pin PCC0REG# */ 161#define HD64461_PCCGCR_REG 0x01 /* pin PCC0REG# */
134 162
135/* PCC Card Status Change Register */ 163/* PCC Card Status Change Register */
136#define HD64461_PCCCSCR_SCDI 0x80 /* sw card detect intr */ 164#define HD64461_PCCCSCR_SCDI 0x80 /* sw card detect intr */
137#define HD64461_PCCCSCR_SRV1 0x40 /* reserved */ 165#define HD64461_PCCCSCR_SRV1 0x40 /* reserved */
138#define HD64461_PCCCSCR_IREQ 0x20 /* IREQ intr req */ 166#define HD64461_PCCCSCR_IREQ 0x20 /* IREQ intr req */
139#define HD64461_PCCCSCR_SC 0x10 /* STSCHG (status change) pin */ 167#define HD64461_PCCCSCR_SC 0x10 /* STSCHG (status change) pin */
140#define HD64461_PCCCSCR_CDC 0x08 /* CD (card detect) change */ 168#define HD64461_PCCCSCR_CDC 0x08 /* CD (card detect) change */
141#define HD64461_PCCCSCR_RC 0x04 /* READY change */ 169#define HD64461_PCCCSCR_RC 0x04 /* READY change */
142#define HD64461_PCCCSCR_BW 0x02 /* battery warning change */ 170#define HD64461_PCCCSCR_BW 0x02 /* battery warning change */
143#define HD64461_PCCCSCR_BD 0x01 /* battery dead change */ 171#define HD64461_PCCCSCR_BD 0x01 /* battery dead change */
144 172
145/* PCC Card Status Change Interrupt Enable Register */ 173/* PCC Card Status Change Interrupt Enable Register */
146#define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */ 174#define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */
147#define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */ 175#define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */
148#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */ 176#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */
149#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */ 177#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */
150#define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */ 178#define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */
151#define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */ 179#define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */
152 180
153#define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */ 181#define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */
154#define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */ 182#define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */
155#define HD64461_PCCCSCIER_RE 0x04 /* ready change enable */ 183#define HD64461_PCCCSCIER_RE 0x04 /* ready change enable */
156#define HD64461_PCCCSCIER_BWE 0x02 /* battery warn change enable */ 184#define HD64461_PCCCSCIER_BWE 0x02 /* battery warn change enable */
157#define HD64461_PCCCSCIER_BDE 0x01 /* battery dead change enable*/ 185#define HD64461_PCCCSCIER_BDE 0x01 /* battery dead change enable*/
158 186
159/* PCC Software Control Register */ 187/* PCC Software Control Register */
160#define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */ 188#define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */
161#define HD64461_PCCSCR_SWP 0x01 /* write protect */ 189#define HD64461_PCCSCR_SWP 0x01 /* write protect */
162 190
163#define HD64461_P0OCR 0x1202a 191/* PCC0 Output Pins Control Register */
164#define HD64461_P1OCR 0x1202c 192#define HD64461_P0OCR (CONFIG_HD64461_IOBASE + 0x202a)
165#define HD64461_PGCR 0x1202e 193
166 194/* PCC1 Output Pins Control Register */
167#define HD64461_GPACR 0x14000 195#define HD64461_P1OCR (CONFIG_HD64461_IOBASE + 0x202c)
168#define HD64461_GPBCR 0x14002 196
169#define HD64461_GPCCR 0x14004 197/* PC Card General Control Register */
170#define HD64461_GPDCR 0x14006 198#define HD64461_PGCR (CONFIG_HD64461_IOBASE + 0x202e)
171#define HD64461_GPADR 0x14010 199
172#define HD64461_GPBDR 0x14012 200/* Port Control Registers */
173#define HD64461_GPCDR 0x14014 201#define HD64461_GPACR (CONFIG_HD64461_IOBASE + 0x4000) /* Port A - Handles IRDA/TIMER */
174#define HD64461_GPDDR 0x14016 202#define HD64461_GPBCR (CONFIG_HD64461_IOBASE + 0x4002) /* Port B - Handles UART */
175#define HD64461_GPAICR 0x14020 203#define HD64461_GPCCR (CONFIG_HD64461_IOBASE + 0x4004) /* Port C - Handles PCMCIA 1 */
176#define HD64461_GPBICR 0x14022 204#define HD64461_GPDCR (CONFIG_HD64461_IOBASE + 0x4006) /* Port D - Handles PCMCIA 1 */
177#define HD64461_GPCICR 0x14024 205
178#define HD64461_GPDICR 0x14026 206/* Port Control Data Registers */
179#define HD64461_GPAISR 0x14040 207#define HD64461_GPADR (CONFIG_HD64461_IOBASE + 0x4010) /* A */
180#define HD64461_GPBISR 0x14042 208#define HD64461_GPBDR (CONFIG_HD64461_IOBASE + 0x4012) /* B */
181#define HD64461_GPCISR 0x14044 209#define HD64461_GPCDR (CONFIG_HD64461_IOBASE + 0x4014) /* C */
182#define HD64461_GPDISR 0x14046 210#define HD64461_GPDDR (CONFIG_HD64461_IOBASE + 0x4016) /* D */
183 211
184#define HD64461_NIRR 0x15000 212/* Interrupt Control Registers */
185#define HD64461_NIMR 0x15002 213#define HD64461_GPAICR (CONFIG_HD64461_IOBASE + 0x4020) /* A */
186 214#define HD64461_GPBICR (CONFIG_HD64461_IOBASE + 0x4022) /* B */
187#define HD64461_IRQBASE OFFCHIP_IRQ_BASE 215#define HD64461_GPCICR (CONFIG_HD64461_IOBASE + 0x4024) /* C */
188#define HD64461_IRQ_NUM 16 216#define HD64461_GPDICR (CONFIG_HD64461_IOBASE + 0x4026) /* D */
189 217
190#define HD64461_IRQ_UART (HD64461_IRQBASE+5) 218/* Interrupt Status Registers */
191#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6) 219#define HD64461_GPAISR (CONFIG_HD64461_IOBASE + 0x4040) /* A */
192#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9) 220#define HD64461_GPBISR (CONFIG_HD64461_IOBASE + 0x4042) /* B */
193#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10) 221#define HD64461_GPCISR (CONFIG_HD64461_IOBASE + 0x4044) /* C */
194#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11) 222#define HD64461_GPDISR (CONFIG_HD64461_IOBASE + 0x4046) /* D */
195#define HD64461_IRQ_AFE (HD64461_IRQBASE+12) 223
196#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13) 224/* Interrupt Request Register & Interrupt Mask Register */
197#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14) 225#define HD64461_NIRR (CONFIG_HD64461_IOBASE + 0x5000)
226#define HD64461_NIMR (CONFIG_HD64461_IOBASE + 0x5002)
227
228#define HD64461_IRQBASE OFFCHIP_IRQ_BASE
229#define HD64461_IRQ_NUM 16
230
231#define HD64461_IRQ_UART (HD64461_IRQBASE+5)
232#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6)
233#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9)
234#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10)
235#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11)
236#define HD64461_IRQ_AFE (HD64461_IRQBASE+12)
237#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13)
238#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14)
198 239
199#define __IO_PREFIX hd64461 240#define __IO_PREFIX hd64461
200#include <asm/io_generic.h> 241#include <asm/io_generic.h>
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h
index 80ee1cda7498..20d42959f52a 100644
--- a/include/asm-sh/hw_irq.h
+++ b/include/asm-sh/hw_irq.h
@@ -1,8 +1,121 @@
1#ifndef __ASM_SH_HW_IRQ_H 1#ifndef __ASM_SH_HW_IRQ_H
2#define __ASM_SH_HW_IRQ_H 2#define __ASM_SH_HW_IRQ_H
3 3
4#include <linux/init.h>
4#include <asm/atomic.h> 5#include <asm/atomic.h>
5 6
6extern atomic_t irq_err_count; 7extern atomic_t irq_err_count;
7 8
9struct intc2_data {
10 unsigned short irq;
11 unsigned char ipr_offset, ipr_shift;
12 unsigned char msk_offset, msk_shift;
13 unsigned char priority;
14};
15
16struct intc2_desc {
17 unsigned long prio_base;
18 unsigned long msk_base;
19 unsigned long mskclr_base;
20 struct intc2_data *intc2_data;
21 unsigned int nr_irqs;
22 struct irq_chip chip;
23};
24
25void register_intc2_controller(struct intc2_desc *);
26
27struct ipr_data {
28 unsigned char irq;
29 unsigned char ipr_idx; /* Index for the IPR registered */
30 unsigned char shift; /* Number of bits to shift the data */
31 unsigned char priority; /* The priority */
32};
33
34struct ipr_desc {
35 unsigned long *ipr_offsets;
36 unsigned int nr_offsets;
37 struct ipr_data *ipr_data;
38 unsigned int nr_irqs;
39 struct irq_chip chip;
40};
41
42void register_ipr_controller(struct ipr_desc *);
43
44/*
45 * Enable individual interrupt mode for external IPR IRQs.
46 */
47void __init ipr_irq_enable_irlm(void);
48
49typedef unsigned char intc_enum;
50
51struct intc_vect {
52 intc_enum enum_id;
53 unsigned short vect;
54};
55
56#define INTC_VECT(enum_id, vect) { enum_id, vect }
57
58struct intc_prio {
59 intc_enum enum_id;
60 unsigned char priority;
61};
62
63#define INTC_PRIO(enum_id, prio) { enum_id, prio }
64
65struct intc_group {
66 intc_enum enum_id;
67 intc_enum *enum_ids;
68};
69
70#define INTC_GROUP(enum_id, ids...) { enum_id, (intc_enum []) { ids, 0 } }
71
72struct intc_mask_reg {
73 unsigned long set_reg, clr_reg, reg_width;
74 intc_enum enum_ids[32];
75};
76
77struct intc_prio_reg {
78 unsigned long reg, reg_width, field_width;
79 intc_enum enum_ids[16];
80};
81
82struct intc_sense_reg {
83 unsigned long reg, reg_width, field_width;
84 intc_enum enum_ids[16];
85};
86
87struct intc_desc {
88 struct intc_vect *vectors;
89 unsigned int nr_vectors;
90 struct intc_group *groups;
91 unsigned int nr_groups;
92 struct intc_prio *priorities;
93 unsigned int nr_priorities;
94 struct intc_mask_reg *mask_regs;
95 unsigned int nr_mask_regs;
96 struct intc_prio_reg *prio_regs;
97 unsigned int nr_prio_regs;
98 struct intc_sense_reg *sense_regs;
99 unsigned int nr_sense_regs;
100 struct irq_chip chip;
101};
102
103#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
104#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
105 priorities, mask_regs, prio_regs, sense_regs) \
106struct intc_desc symbol = { \
107 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
108 _INTC_ARRAY(priorities), \
109 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
110 _INTC_ARRAY(sense_regs), \
111 .chip.name = chipname, \
112}
113
114void __init register_intc_controller(struct intc_desc *desc);
115
116void __init plat_irq_setup(void);
117
118enum { IRQ_MODE_IRQ, IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
119void __init plat_irq_setup_pins(int mode);
120
8#endif /* __ASM_SH_HW_IRQ_H */ 121#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index e81bf21c801e..c61d902b8bff 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -31,47 +31,7 @@ extern unsigned short *irq_mask_register;
31 * PINT IRQs 31 * PINT IRQs
32 */ 32 */
33void init_IRQ_pint(void); 33void init_IRQ_pint(void);
34
35/*
36 * The shift value is now the number of bits to shift, not the number of
37 * bits/4. This is to make it easier to read the value directly from the
38 * datasheets. The IPR address, addr, will be set from ipr_idx via the
39 * map_ipridx_to_addr function.
40 */
41struct ipr_data {
42 unsigned int irq;
43 int ipr_idx; /* Index for the IPR registered */
44 int shift; /* Number of bits to shift the data */
45 int priority; /* The priority */
46 unsigned int addr; /* Address of Interrupt Priority Register */
47};
48
49/*
50 * Given an IPR IDX, map the value to an IPR register address.
51 */
52unsigned int map_ipridx_to_addr(int idx);
53
54/*
55 * Enable individual interrupt mode for external IPR IRQs.
56 */
57void ipr_irq_enable_irlm(void);
58
59/*
60 * Function for "on chip support modules".
61 */
62void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs);
63void make_imask_irq(unsigned int irq); 34void make_imask_irq(unsigned int irq);
64void init_IRQ_ipr(void);
65
66struct intc2_data {
67 unsigned short irq;
68 unsigned char ipr_offset, ipr_shift;
69 unsigned char msk_offset, msk_shift;
70 unsigned char priority;
71};
72
73void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs);
74void init_IRQ_intc2(void);
75 35
76static inline int generic_irq_demux(int irq) 36static inline int generic_irq_demux(int irq)
77{ 37{
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h
index 70389b72ffef..088698bacf2f 100644
--- a/include/asm-sh/machvec.h
+++ b/include/asm-sh/machvec.h
@@ -13,7 +13,6 @@
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/time.h> 14#include <linux/time.h>
15#include <asm/machtypes.h> 15#include <asm/machtypes.h>
16#include <asm/machvec_init.h>
17 16
18struct device; 17struct device;
19 18
@@ -68,4 +67,7 @@ extern struct sh_machine_vector sh_mv;
68 67
69#define get_system_type() sh_mv.mv_name 68#define get_system_type() sh_mv.mv_name
70 69
70#define __initmv \
71 __attribute_used__ __attribute__((__section__ (".machvec.init")))
72
71#endif /* _ASM_SH_MACHVEC_H */ 73#endif /* _ASM_SH_MACHVEC_H */
diff --git a/include/asm-sh/machvec_init.h b/include/asm-sh/machvec_init.h
deleted file mode 100644
index e397798ebd94..000000000000
--- a/include/asm-sh/machvec_init.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * include/asm-sh/machvec_init.h
3 *
4 * Copyright 2000 Stuart Menefy (stuart.menefy@st.com)
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * This file has goodies to help simplify instantiation of machine vectors.
10 */
11
12#ifndef __SH_MACHVEC_INIT_H
13#define __SH_MACHVEC_INIT_H
14
15
16/*
17 * In a GENERIC kernel, we have lots of these vectors floating about,
18 * all but one of which we want to go away. In a non-GENERIC kernel,
19 * we want only one, ever.
20 *
21 * Accomplish this in the GENERIC kernel by puting all of the vectors
22 * in the .init.data section where they'll go away. We'll copy the
23 * one we want to the real alpha_mv vector in setup_arch.
24 *
25 * Accomplish this in a non-GENERIC kernel by ifdef'ing out all but
26 * one of the vectors, which will not reside in .init.data. We then
27 * alias this one vector to alpha_mv, so no copy is needed.
28 *
29 * Upshot: set __initdata to nothing for non-GENERIC kernels.
30 *
31 * Note we do the same thing for the UNKNOWN kernel, as we need to write
32 * to the machine vector while setting it up.
33 */
34
35#if defined(CONFIG_SH_GENERIC) || defined(CONFIG_SH_UNKNOWN)
36#define __initmv __attribute__((unused,__section__ (".machvec.init")))
37#define ALIAS_MV(x)
38#else
39#define __initmv
40
41/* GCC actually has a syntax for defining aliases, but is under some
42 delusion that you shouldn't be able to declare it extern somewhere
43 else beforehand. Fine. We'll do it ourselves. */
44#if 0
45#define ALIAS_MV(system) \
46 struct sh_machine_vector sh_mv __attribute__((alias("mv_"#system)));
47#else
48#define ALIAS_MV(system) \
49 asm(".global sh_mv\nsh_mv = mv_"#system );
50#endif
51#endif /* GENERIC */
52
53#endif /* __SH_MACHVEC_INIT_H */
diff --git a/include/asm-sh/mmzone.h b/include/asm-sh/mmzone.h
new file mode 100644
index 000000000000..7969f381dff2
--- /dev/null
+++ b/include/asm-sh/mmzone.h
@@ -0,0 +1,46 @@
1#ifndef __ASM_SH_MMZONE_H
2#define __ASM_SH_MMZONE_H
3
4#ifdef __KERNEL__
5
6#ifdef CONFIG_NEED_MULTIPLE_NODES
7extern struct pglist_data *node_data[];
8#define NODE_DATA(nid) (node_data[nid])
9
10#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
11#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
12 NODE_DATA(nid)->node_spanned_pages)
13
14static inline int pfn_to_nid(unsigned long pfn)
15{
16 int nid;
17
18 for (nid = 0; nid < MAX_NUMNODES; nid++)
19 if (pfn >= node_start_pfn(nid) && pfn <= node_end_pfn(nid))
20 break;
21
22 return nid;
23}
24
25static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
26{
27 return NODE_DATA(pfn_to_nid(pfn));
28}
29
30/* arch/sh/mm/numa.c */
31void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end);
32#else
33static inline void
34setup_bootmem_node(int nid, unsigned long start, unsigned long end)
35{
36}
37#endif /* CONFIG_NEED_MULTIPLE_NODES */
38
39/* Platform specific mem init */
40void __init plat_mem_setup(void);
41
42/* arch/sh/kernel/setup.c */
43void __init setup_bootmem_allocator(unsigned long start_pfn);
44
45#endif /* __KERNEL__ */
46#endif /* __ASM_SH_MMZONE_H */
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 7464de4ba07d..6bc9bba10105 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -60,6 +60,7 @@ extern void (*copy_page)(void *to, void *from);
60 60
61extern unsigned long shm_align_mask; 61extern unsigned long shm_align_mask;
62extern unsigned long max_low_pfn, min_low_pfn; 62extern unsigned long max_low_pfn, min_low_pfn;
63extern unsigned long memory_start, memory_end;
63 64
64#ifdef CONFIG_MMU 65#ifdef CONFIG_MMU
65extern void clear_page_slow(void *to); 66extern void clear_page_slow(void *to);
@@ -134,7 +135,9 @@ typedef struct { unsigned long pgd; } pgd_t;
134#define PFN_START (__MEMORY_START >> PAGE_SHIFT) 135#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
135#define ARCH_PFN_OFFSET (PFN_START) 136#define ARCH_PFN_OFFSET (PFN_START)
136#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 137#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
138#ifdef CONFIG_FLATMEM
137#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn) 139#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
140#endif
138#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 141#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
139 142
140#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 143#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
@@ -148,5 +151,12 @@ typedef struct { unsigned long pgd; } pgd_t;
148#define __HAVE_ARCH_GATE_AREA 151#define __HAVE_ARCH_GATE_AREA
149#endif 152#endif
150 153
154/*
155 * Slub defaults to 8-byte alignment, we're only interested in 4.
156 * Slab defaults to BYTES_PER_WORD, which ends up being the same anyways.
157 */
158#define ARCH_KMALLOC_MINALIGN 4
159#define ARCH_SLAB_MINALIGN 4
160
151#endif /* __KERNEL__ */ 161#endif /* __KERNEL__ */
152#endif /* __ASM_SH_PAGE_H */ 162#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/parport.h b/include/asm-sh/parport.h
new file mode 100644
index 000000000000..f67ba60a2acd
--- /dev/null
+++ b/include/asm-sh/parport.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
3 *
4 * This file should only be included by drivers/parport/parport_pc.c.
5 */
6#ifndef __ASM_SH_PARPORT_H
7#define __ASM_SH_PARPORT_H
8
9static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
10
11static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
12{
13 return parport_pc_find_isa_ports(autoirq, autodma);
14}
15
16#endif /* __ASM_SH_PARPORT_H */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 5b523c7e7d99..22efffe45019 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -402,12 +402,8 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
402#define pte_file(pte) (pte_val(pte) & _PAGE_FILE) 402#define pte_file(pte) (pte_val(pte) & _PAGE_FILE)
403 403
404#ifdef CONFIG_X2TLB 404#ifdef CONFIG_X2TLB
405#define pte_read(pte) ((pte).pte_high & _PAGE_EXT_USER_READ)
406#define pte_exec(pte) ((pte).pte_high & _PAGE_EXT_USER_EXEC)
407#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE) 405#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
408#else 406#else
409#define pte_read(pte) (pte_val(pte) & _PAGE_USER)
410#define pte_exec(pte) (pte_val(pte) & _PAGE_USER)
411#define pte_write(pte) (pte_val(pte) & _PAGE_RW) 407#define pte_write(pte) (pte_val(pte) & _PAGE_RW)
412#endif 408#endif
413 409
@@ -420,20 +416,12 @@ static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
420 * individually toggled (and user permissions are entirely decoupled from 416 * individually toggled (and user permissions are entirely decoupled from
421 * kernel permissions), we attempt to couple them a bit more sanely here. 417 * kernel permissions), we attempt to couple them a bit more sanely here.
422 */ 418 */
423PTE_BIT_FUNC(high, rdprotect, &= ~_PAGE_EXT_USER_READ);
424PTE_BIT_FUNC(high, mkread, |= _PAGE_EXT_USER_READ | _PAGE_EXT_KERN_READ);
425PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE); 419PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
426PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE); 420PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
427PTE_BIT_FUNC(high, exprotect, &= ~_PAGE_EXT_USER_EXEC);
428PTE_BIT_FUNC(high, mkexec, |= _PAGE_EXT_USER_EXEC | _PAGE_EXT_KERN_EXEC);
429PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE); 421PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
430#else 422#else
431PTE_BIT_FUNC(low, rdprotect, &= ~_PAGE_USER);
432PTE_BIT_FUNC(low, mkread, |= _PAGE_USER);
433PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW); 423PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW);
434PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW); 424PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW);
435PTE_BIT_FUNC(low, exprotect, &= ~_PAGE_USER);
436PTE_BIT_FUNC(low, mkexec, |= _PAGE_USER);
437PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE); 425PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE);
438#endif 426#endif
439 427
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index d42f68e724fa..2252e75daa26 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -36,7 +36,7 @@
36 */ 36 */
37enum cpu_type { 37enum cpu_type {
38 /* SH-2 types */ 38 /* SH-2 types */
39 CPU_SH7604, CPU_SH7619, 39 CPU_SH7619,
40 40
41 /* SH-2A types */ 41 /* SH-2A types */
42 CPU_SH7206, 42 CPU_SH7206,
@@ -52,7 +52,7 @@ enum cpu_type {
52 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, 52 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501,
53 53
54 /* SH-4A types */ 54 /* SH-4A types */
55 CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, 55 CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SHX3,
56 56
57 /* SH4AL-DSP types */ 57 /* SH4AL-DSP types */
58 CPU_SH73180, CPU_SH7343, CPU_SH7722, 58 CPU_SH73180, CPU_SH7343, CPU_SH7722,
@@ -228,11 +228,7 @@ static __inline__ void grab_fpu(struct pt_regs *regs)
228 regs->sr &= ~SR_FD; 228 regs->sr &= ~SR_FD;
229} 229}
230 230
231#ifdef CONFIG_CPU_SH4
232extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs); 231extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs);
233#else
234#define save_fpu(tsk) do { } while (0)
235#endif
236 232
237#define unlazy_fpu(tsk, regs) do { \ 233#define unlazy_fpu(tsk, regs) do { \
238 if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ 234 if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \
diff --git a/include/asm-sh/rwsem.h b/include/asm-sh/rwsem.h
index 4931ba817d73..1987f3ea7f1b 100644
--- a/include/asm-sh/rwsem.h
+++ b/include/asm-sh/rwsem.h
@@ -1,11 +1,15 @@
1/* 1/*
2 * include/asm-ppc/rwsem.h: R/W semaphores for SH using the stuff 2 * include/asm-sh/rwsem.h: R/W semaphores for SH using the stuff
3 * in lib/rwsem.c. 3 * in lib/rwsem.c.
4 */ 4 */
5 5
6#ifndef _ASM_SH_RWSEM_H 6#ifndef _ASM_SH_RWSEM_H
7#define _ASM_SH_RWSEM_H 7#define _ASM_SH_RWSEM_H
8 8
9#ifndef _LINUX_RWSEM_H
10#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
11#endif
12
9#ifdef __KERNEL__ 13#ifdef __KERNEL__
10#include <linux/list.h> 14#include <linux/list.h>
11#include <linux/spinlock.h> 15#include <linux/spinlock.h>
diff --git a/include/asm-sh/saturn/io.h b/include/asm-sh/saturn/io.h
deleted file mode 100644
index f1b9b5d633f4..000000000000
--- a/include/asm-sh/saturn/io.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * include/asm-sh/saturn/io.h
3 *
4 * I/O functions for use on the Sega Saturn.
5 *
6 * Copyright (C) 2002 Paul Mundt
7 *
8 * Released under the terms of the GNU GPL v2.0.
9 */
10#ifndef __ASM_SH_SATURN_IO_H
11#define __ASM_SH_SATURN_IO_H
12
13/* arch/sh/boards/saturn/io.c */
14extern unsigned long saturn_isa_port2addr(unsigned long offset);
15extern void *saturn_ioremap(unsigned long offset, unsigned long size);
16extern void saturn_iounmap(void *addr);
17
18#endif /* __ASM_SH_SATURN_IO_H */
19
diff --git a/include/asm-sh/saturn/smpc.h b/include/asm-sh/saturn/smpc.h
deleted file mode 100644
index 5de5c12d6347..000000000000
--- a/include/asm-sh/saturn/smpc.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * include/asm-sh/saturn/smpc.h
3 *
4 * System Manager / Peripheral Control definitions.
5 *
6 * Copyright (C) 2002 Paul Mundt
7 *
8 * Released under the terms of the GNU GPL v2.0.
9 */
10#ifndef __ASM_SH_SATURN_SMPC_H
11#define __ASM_SH_SATURN_SMPC_H
12
13#include <asm/io.h>
14
15#define SMPC_COMMAND 0x2010001f /* SMPC command register */
16#define SMPC_RESULT 0x2010005f /* SMPC result register */
17#define SMPC_STATUS 0x20100063 /* SMPC status register */
18
19#define SMPC_CMD_MSHON 0x0001 /* Master SH On */
20#define SMPC_CMD_SSHON 0x0002 /* Slave SH On */
21#define SMPC_CMD_SSHOFF 0x0003 /* Slave SH Off */
22#define SMPC_CMD_SNDON 0x0004 /* Sound On */
23#define SMPC_CMD_SNDOFF 0x0005 /* Sound Off */
24#define SMPC_CMD_CDON 0x0006 /* CD On */
25#define SMPC_CMD_CDOFF 0x0007 /* CD Off */
26
27static inline void smpc_barrier(void)
28{
29 while ((ctrl_inb(SMPC_STATUS) & 0x0001) == 0x0001)
30 ;
31}
32
33#endif /* __ASM_SH_SATURN_SMPC_H */
34
diff --git a/include/asm-sh/se7722.h b/include/asm-sh/se7722.h
index b3b31e4725c6..e0e89fcb8388 100644
--- a/include/asm-sh/se7722.h
+++ b/include/asm-sh/se7722.h
@@ -81,36 +81,32 @@
81/* IRQ */ 81/* IRQ */
82#define IRQ0_IRQ 32 82#define IRQ0_IRQ 32
83#define IRQ1_IRQ 33 83#define IRQ1_IRQ 33
84#define INTC_ICR0 0xA4140000UL
85#define INTC_ICR1 0xA414001CUL
86
87#define INTMSK0 0xa4140044
88#define INTMSKCLR0 0xa4140064
89#define INTC_INTPRI0 0xa4140010
90 84
91#define IRQ01_MODE 0xb1800000 85#define IRQ01_MODE 0xb1800000
92#define IRQ01_STS 0xb1800004 86#define IRQ01_STS 0xb1800004
93#define IRQ01_MASK 0xb1800008 87#define IRQ01_MASK 0xb1800008
94#define EXT_BIT (0x3fc0) /* SH IRQ1 */
95#define MRSHPC_BIT0 (0x0004) /* SH IRQ1 */
96#define MRSHPC_BIT1 (0x0008) /* SH IRQ1 */
97#define MRSHPC_BIT2 (0x0010) /* SH IRQ1 */
98#define MRSHPC_BIT3 (0x0020) /* SH IRQ1 */
99#define SMC_BIT (0x0002) /* SH IRQ0 */
100#define USB_BIT (0x0001) /* SH IRQ0 */
101
102#define MRSHPC_IRQ3 11
103#define MRSHPC_IRQ2 12
104#define MRSHPC_IRQ1 13
105#define MRSHPC_IRQ0 14
106#define SMC_IRQ 10
107#define EXT_IRQ 5
108#define USB_IRQ 6
109 88
89/* Bits in IRQ01_* registers */
90
91#define SE7722_FPGA_IRQ_USB 0 /* IRQ0 */
92#define SE7722_FPGA_IRQ_SMC 1 /* IRQ0 */
93#define SE7722_FPGA_IRQ_MRSHPC0 2 /* IRQ1 */
94#define SE7722_FPGA_IRQ_MRSHPC1 3 /* IRQ1 */
95#define SE7722_FPGA_IRQ_MRSHPC2 4 /* IRQ1 */
96#define SE7722_FPGA_IRQ_MRSHPC3 5 /* IRQ1 */
97
98#define SE7722_FPGA_IRQ_NR 6
99#define SE7722_FPGA_IRQ_BASE 110
100
101#define MRSHPC_IRQ3 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC3)
102#define MRSHPC_IRQ2 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC2)
103#define MRSHPC_IRQ1 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC1)
104#define MRSHPC_IRQ0 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC0)
105#define SMC_IRQ (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_SMC)
106#define USB_IRQ (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_USB)
110 107
111/* arch/sh/boards/se/7722/irq.c */ 108/* arch/sh/boards/se/7722/irq.c */
112void init_se7722_IRQ(void); 109void init_se7722_IRQ(void);
113int se7722_irq_demux(int);
114 110
115#define __IO_PREFIX se7722 111#define __IO_PREFIX se7722
116#include <asm/io_generic.h> 112#include <asm/io_generic.h>
diff --git a/include/asm-sh/sections.h b/include/asm-sh/sections.h
index 57abd708b236..2a696b8ee4f5 100644
--- a/include/asm-sh/sections.h
+++ b/include/asm-sh/sections.h
@@ -3,7 +3,7 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern char _end[]; 6extern long __machvec_start, __machvec_end;
7 7
8#endif /* __ASM_SH_SECTIONS_H */ 8#endif /* __ASM_SH_SECTIONS_H */
9 9
diff --git a/include/asm-sh/setup.h b/include/asm-sh/setup.h
index 1583c6b7bdaa..586a9711a75d 100644
--- a/include/asm-sh/setup.h
+++ b/include/asm-sh/setup.h
@@ -6,6 +6,7 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8int setup_early_printk(char *); 8int setup_early_printk(char *);
9void sh_mv_setup(void);
9 10
10#endif /* __KERNEL__ */ 11#endif /* __KERNEL__ */
11 12
diff --git a/include/asm-sh/sh03/io.h b/include/asm-sh/sh03/io.h
index df3b187ef883..4ff1eb900301 100644
--- a/include/asm-sh/sh03/io.h
+++ b/include/asm-sh/sh03/io.h
@@ -14,22 +14,18 @@
14#define INTC_IPRD 0xffd00010UL 14#define INTC_IPRD 0xffd00010UL
15 15
16#define IRL0_IRQ 2 16#define IRL0_IRQ 2
17#define IRL0_IPR_ADDR INTC_IPRD
18#define IRL0_IPR_POS 3 17#define IRL0_IPR_POS 3
19#define IRL0_PRIORITY 13 18#define IRL0_PRIORITY 13
20 19
21#define IRL1_IRQ 5 20#define IRL1_IRQ 5
22#define IRL1_IPR_ADDR INTC_IPRD
23#define IRL1_IPR_POS 2 21#define IRL1_IPR_POS 2
24#define IRL1_PRIORITY 10 22#define IRL1_PRIORITY 10
25 23
26#define IRL2_IRQ 8 24#define IRL2_IRQ 8
27#define IRL2_IPR_ADDR INTC_IPRD
28#define IRL2_IPR_POS 1 25#define IRL2_IPR_POS 1
29#define IRL2_PRIORITY 7 26#define IRL2_PRIORITY 7
30 27
31#define IRL3_IRQ 11 28#define IRL3_IRQ 11
32#define IRL3_IPR_ADDR INTC_IPRD
33#define IRL3_IPR_POS 0 29#define IRL3_IPR_POS 0
34#define IRL3_PRIORITY 4 30#define IRL3_PRIORITY 4
35 31
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h
index caa7b93f1bce..b99ca786c0c1 100644
--- a/include/asm-sh/smp.h
+++ b/include/asm-sh/smp.h
@@ -39,4 +39,6 @@ extern struct smp_fn_call_struct smp_fn_call;
39 39
40#endif /* CONFIG_SMP */ 40#endif /* CONFIG_SMP */
41 41
42#define hard_smp_processor_id() (0)
43
42#endif /* __ASM_SH_SMP_H */ 44#endif /* __ASM_SH_SMP_H */
diff --git a/include/asm-sh/snapgear.h b/include/asm-sh/snapgear.h
index 2d712e72c9e5..3554e3a74e99 100644
--- a/include/asm-sh/snapgear.h
+++ b/include/asm-sh/snapgear.h
@@ -20,22 +20,18 @@
20 */ 20 */
21 21
22#define IRL0_IRQ 2 22#define IRL0_IRQ 2
23#define IRL0_IPR_ADDR INTC_IPRD
24#define IRL0_IPR_POS 3 23#define IRL0_IPR_POS 3
25#define IRL0_PRIORITY 13 24#define IRL0_PRIORITY 13
26 25
27#define IRL1_IRQ 5 26#define IRL1_IRQ 5
28#define IRL1_IPR_ADDR INTC_IPRD
29#define IRL1_IPR_POS 2 27#define IRL1_IPR_POS 2
30#define IRL1_PRIORITY 10 28#define IRL1_PRIORITY 10
31 29
32#define IRL2_IRQ 8 30#define IRL2_IRQ 8
33#define IRL2_IPR_ADDR INTC_IPRD
34#define IRL2_IPR_POS 1 31#define IRL2_IPR_POS 1
35#define IRL2_PRIORITY 7 32#define IRL2_PRIORITY 7
36 33
37#define IRL3_IRQ 11 34#define IRL3_IRQ 11
38#define IRL3_IPR_ADDR INTC_IPRD
39#define IRL3_IPR_POS 0 35#define IRL3_IPR_POS 0
40#define IRL3_PRIORITY 4 36#define IRL3_PRIORITY 4
41#endif 37#endif
diff --git a/include/asm-sh/sparsemem.h b/include/asm-sh/sparsemem.h
new file mode 100644
index 000000000000..547a540b6667
--- /dev/null
+++ b/include/asm-sh/sparsemem.h
@@ -0,0 +1,16 @@
1#ifndef __ASM_SH_SPARSEMEM_H
2#define __ASM_SH_SPARSEMEM_H
3
4#ifdef __KERNEL__
5/*
6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSADDR_BITS 2^N: how much physical address space we have
8 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
9 */
10#define SECTION_SIZE_BITS 26
11#define MAX_PHYSADDR_BITS 32
12#define MAX_PHYSMEM_BITS 32
13
14#endif
15
16#endif /* __ASM_SH_SPARSEMEM_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 82f3e229e621..245042537205 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -8,9 +8,13 @@
8 8
9#include <linux/irqflags.h> 9#include <linux/irqflags.h>
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/linkage.h>
11#include <asm/types.h> 12#include <asm/types.h>
12#include <asm/ptrace.h> 13#include <asm/ptrace.h>
13 14
15struct task_struct *__switch_to(struct task_struct *prev,
16 struct task_struct *next);
17
14/* 18/*
15 * switch_to() should switch tasks to task nr n, first 19 * switch_to() should switch tasks to task nr n, first
16 */ 20 */
@@ -60,16 +64,6 @@
60 last = __last; \ 64 last = __last; \
61} while (0) 65} while (0)
62 66
63/*
64 * On SMP systems, when the scheduler does migration-cost autodetection,
65 * it needs a way to flush as much of the CPU's caches as possible.
66 *
67 * TODO: fill this in!
68 */
69static inline void sched_cacheflush(void)
70{
71}
72
73#ifdef CONFIG_CPU_SH4A 67#ifdef CONFIG_CPU_SH4A
74#define __icbi() \ 68#define __icbi() \
75{ \ 69{ \
@@ -122,7 +116,7 @@ static inline void sched_cacheflush(void)
122#define smp_read_barrier_depends() do { } while(0) 116#define smp_read_barrier_depends() do { } while(0)
123#endif 117#endif
124 118
125#define set_mb(var, value) do { xchg(&var, value); } while (0) 119#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
126 120
127/* 121/*
128 * Jump to P2 area. 122 * Jump to P2 area.
@@ -271,6 +265,16 @@ extern unsigned int instruction_size(unsigned int insn);
271void disable_hlt(void); 265void disable_hlt(void);
272void enable_hlt(void); 266void enable_hlt(void);
273 267
268void default_idle(void);
269
270asmlinkage void break_point_trap(void);
271asmlinkage void debug_trap_handler(unsigned long r4, unsigned long r5,
272 unsigned long r6, unsigned long r7,
273 struct pt_regs __regs);
274asmlinkage void bug_trap_handler(unsigned long r4, unsigned long r5,
275 unsigned long r6, unsigned long r7,
276 struct pt_regs __regs);
277
274#define arch_align_stack(x) (x) 278#define arch_align_stack(x) (x)
275 279
276#endif 280#endif
diff --git a/include/asm-sh/topology.h b/include/asm-sh/topology.h
index cff001c316fe..f402a3b1cfa4 100644
--- a/include/asm-sh/topology.h
+++ b/include/asm-sh/topology.h
@@ -1,6 +1,36 @@
1#ifndef _ASM_SH_TOPOLOGY_H 1#ifndef _ASM_SH_TOPOLOGY_H
2#define _ASM_SH_TOPOLOGY_H 2#define _ASM_SH_TOPOLOGY_H
3 3
4#ifdef CONFIG_NUMA
5
6/* sched_domains SD_NODE_INIT for sh machines */
7#define SD_NODE_INIT (struct sched_domain) { \
8 .span = CPU_MASK_NONE, \
9 .parent = NULL, \
10 .child = NULL, \
11 .groups = NULL, \
12 .min_interval = 8, \
13 .max_interval = 32, \
14 .busy_factor = 32, \
15 .imbalance_pct = 125, \
16 .cache_nice_tries = 2, \
17 .busy_idx = 3, \
18 .idle_idx = 2, \
19 .newidle_idx = 0, \
20 .wake_idx = 1, \
21 .forkexec_idx = 1, \
22 .flags = SD_LOAD_BALANCE \
23 | SD_BALANCE_FORK \
24 | SD_BALANCE_EXEC \
25 | SD_SERIALIZE \
26 | SD_WAKE_BALANCE, \
27 .last_balance = jiffies, \
28 .balance_interval = 1, \
29 .nr_balance_failed = 0, \
30}
31
32#endif
33
4#include <asm-generic/topology.h> 34#include <asm-generic/topology.h>
5 35
6#endif /* _ASM_SH_TOPOLOGY_H */ 36#endif /* _ASM_SH_TOPOLOGY_H */
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index 5c49ed6715f2..f18a1a5c95c0 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -61,8 +61,6 @@ static inline void set_fs(mm_segment_t s)
61 */ 61 */
62static inline int __access_ok(unsigned long addr, unsigned long size) 62static inline int __access_ok(unsigned long addr, unsigned long size)
63{ 63{
64 extern unsigned long memory_start, memory_end;
65
66 return ((addr >= memory_start) && ((addr + size) < memory_end)); 64 return ((addr >= memory_start) && ((addr + size) < memory_end));
67} 65}
68#else /* CONFIG_MMU */ 66#else /* CONFIG_MMU */
@@ -76,7 +74,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
76 * __access_ok: Check if address with size is OK or not. 74 * __access_ok: Check if address with size is OK or not.
77 * 75 *
78 * We do three checks: 76 * We do three checks:
79 * (1) is it user space? 77 * (1) is it user space?
80 * (2) addr + size --> carry? 78 * (2) addr + size --> carry?
81 * (3) addr + size >= 0x80000000 (PAGE_OFFSET) 79 * (3) addr + size >= 0x80000000 (PAGE_OFFSET)
82 * 80 *
@@ -142,11 +140,12 @@ static inline int access_ok(int type, const void __user *p, unsigned long size)
142 __get_user_nocheck((x),(ptr),sizeof(*(ptr))) 140 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
143 141
144struct __large_struct { unsigned long buf[100]; }; 142struct __large_struct { unsigned long buf[100]; };
145#define __m(x) (*(struct __large_struct *)(x)) 143#define __m(x) (*(struct __large_struct __user *)(x))
146 144
147#define __get_user_size(x,ptr,size,retval) \ 145#define __get_user_size(x,ptr,size,retval) \
148do { \ 146do { \
149 retval = 0; \ 147 retval = 0; \
148 __chk_user_ptr(ptr); \
150 switch (size) { \ 149 switch (size) { \
151 case 1: \ 150 case 1: \
152 __get_user_asm(x, ptr, retval, "b"); \ 151 __get_user_asm(x, ptr, retval, "b"); \
@@ -175,6 +174,7 @@ do { \
175#define __get_user_check(x,ptr,size) \ 174#define __get_user_check(x,ptr,size) \
176({ \ 175({ \
177 long __gu_err, __gu_val; \ 176 long __gu_err, __gu_val; \
177 __chk_user_ptr(ptr); \
178 switch (size) { \ 178 switch (size) { \
179 case 1: \ 179 case 1: \
180 __get_user_1(__gu_val, (ptr), __gu_err); \ 180 __get_user_1(__gu_val, (ptr), __gu_err); \
@@ -300,6 +300,7 @@ extern void __get_user_unknown(void);
300#define __put_user_size(x,ptr,size,retval) \ 300#define __put_user_size(x,ptr,size,retval) \
301do { \ 301do { \
302 retval = 0; \ 302 retval = 0; \
303 __chk_user_ptr(ptr); \
303 switch (size) { \ 304 switch (size) { \
304 case 1: \ 305 case 1: \
305 __put_user_asm(x, ptr, retval, "b"); \ 306 __put_user_asm(x, ptr, retval, "b"); \
@@ -328,7 +329,7 @@ do { \
328#define __put_user_check(x,ptr,size) \ 329#define __put_user_check(x,ptr,size) \
329({ \ 330({ \
330 long __pu_err = -EFAULT; \ 331 long __pu_err = -EFAULT; \
331 __typeof__(*(ptr)) *__pu_addr = (ptr); \ 332 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
332 \ 333 \
333 if (__access_ok((unsigned long)__pu_addr,size)) \ 334 if (__access_ok((unsigned long)__pu_addr,size)) \
334 __put_user_size((x),__pu_addr,(size),__pu_err); \ 335 __put_user_size((x),__pu_addr,(size),__pu_err); \
@@ -406,10 +407,10 @@ __asm__ __volatile__( \
406#endif 407#endif
407 408
408extern void __put_user_unknown(void); 409extern void __put_user_unknown(void);
409 410
410/* Generic arbitrary sized copy. */ 411/* Generic arbitrary sized copy. */
411/* Return the number of bytes NOT copied */ 412/* Return the number of bytes NOT copied */
412extern __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); 413__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
413 414
414#define copy_to_user(to,from,n) ({ \ 415#define copy_to_user(to,from,n) ({ \
415void *__copy_to = (void *) (to); \ 416void *__copy_to = (void *) (to); \
@@ -420,14 +421,6 @@ __copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \
420} else __copy_res = __copy_size; \ 421} else __copy_res = __copy_size; \
421__copy_res; }) 422__copy_res; })
422 423
423#define __copy_to_user(to,from,n) \
424 __copy_user((void *)(to), \
425 (void *)(from), n)
426
427#define __copy_to_user_inatomic __copy_to_user
428#define __copy_from_user_inatomic __copy_from_user
429
430
431#define copy_from_user(to,from,n) ({ \ 424#define copy_from_user(to,from,n) ({ \
432void *__copy_to = (void *) (to); \ 425void *__copy_to = (void *) (to); \
433void *__copy_from = (void *) (from); \ 426void *__copy_from = (void *) (from); \
@@ -438,9 +431,20 @@ __copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \
438} else __copy_res = __copy_size; \ 431} else __copy_res = __copy_size; \
439__copy_res; }) 432__copy_res; })
440 433
441#define __copy_from_user(to,from,n) \ 434static __always_inline unsigned long
442 __copy_user((void *)(to), \ 435__copy_from_user(void *to, const void __user *from, unsigned long n)
443 (void *)(from), n) 436{
437 return __copy_user(to, (__force void *)from, n);
438}
439
440static __always_inline unsigned long __must_check
441__copy_to_user(void __user *to, const void *from, unsigned long n)
442{
443 return __copy_user((__force void *)to, from, n);
444}
445
446#define __copy_to_user_inatomic __copy_to_user
447#define __copy_from_user_inatomic __copy_from_user
444 448
445/* 449/*
446 * Clear the area and return remaining number of bytes 450 * Clear the area and return remaining number of bytes
diff --git a/include/asm-sh/ubc.h b/include/asm-sh/ubc.h
index ae9bbdeefbe1..38d46e01b846 100644
--- a/include/asm-sh/ubc.h
+++ b/include/asm-sh/ubc.h
@@ -51,9 +51,14 @@
51#define BRCR_UBDE (1 << 0) 51#define BRCR_UBDE (1 << 0)
52 52
53#ifndef __ASSEMBLY__ 53#ifndef __ASSEMBLY__
54/* arch/sh/kernel/ubc.S */ 54/* arch/sh/kernel/cpu/ubc.S */
55extern void ubc_wakeup(void);
56extern void ubc_sleep(void); 55extern void ubc_sleep(void);
56
57#ifdef CONFIG_UBC_WAKEUP
58extern void ubc_wakeup(void);
59#else
60#define ubc_wakeup() do { } while (0)
61#endif
57#endif 62#endif
58 63
59#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 77bcb09d6ac8..b182b1cb05fd 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -332,8 +332,9 @@
332#define __NR_signalfd 321 332#define __NR_signalfd 321
333#define __NR_timerfd 322 333#define __NR_timerfd 322
334#define __NR_eventfd 323 334#define __NR_eventfd 323
335#define __NR_fallocate 324
335 336
336#define NR_syscalls 324 337#define NR_syscalls 325
337 338
338#ifdef __KERNEL__ 339#ifdef __KERNEL__
339 340
diff --git a/include/asm-sh64/a.out.h b/include/asm-sh64/a.out.h
index e1995e86b663..237ee4e5b72a 100644
--- a/include/asm-sh64/a.out.h
+++ b/include/asm-sh64/a.out.h
@@ -31,6 +31,7 @@ struct exec
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32 32
33#define STACK_TOP TASK_SIZE 33#define STACK_TOP TASK_SIZE
34#define STACK_TOP_MAX STACK_TOP
34 35
35#endif 36#endif
36 37
diff --git a/include/asm-sh64/fb.h b/include/asm-sh64/fb.h
new file mode 100644
index 000000000000..d92e99cd8c8a
--- /dev/null
+++ b/include/asm-sh64/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h
index b875482eb592..3488fe32e436 100644
--- a/include/asm-sh64/pgtable.h
+++ b/include/asm-sh64/pgtable.h
@@ -415,22 +415,15 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd);
415/* 415/*
416 * The following have defined behavior only work if pte_present() is true. 416 * The following have defined behavior only work if pte_present() is true.
417 */ 417 */
418static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
419static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXECUTE; }
420static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } 418static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; }
421static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } 419static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; }
422static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 420static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
423static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } 421static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; }
424 422
425static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; }
426static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } 423static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; }
427static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; }
428static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 424static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
429static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 425static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
430
431static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; }
432static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } 426static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; }
433static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; }
434static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 427static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
435static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 428static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
436static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } 429static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index ea3adc600b41..1a5197f369b2 100644
--- a/include/asm-sh64/unistd.h
+++ b/include/asm-sh64/unistd.h
@@ -374,10 +374,11 @@
374#define __NR_signalfd 349 374#define __NR_signalfd 349
375#define __NR_timerfd 350 375#define __NR_timerfd 350
376#define __NR_eventfd 351 376#define __NR_eventfd 351
377#define __NR_fallocate 352
377 378
378#ifdef __KERNEL__ 379#ifdef __KERNEL__
379 380
380#define NR_syscalls 352 381#define NR_syscalls 353
381 382
382#define __ARCH_WANT_IPC_PARSE_VERSION 383#define __ARCH_WANT_IPC_PARSE_VERSION
383#define __ARCH_WANT_OLD_READDIR 384#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h
index 9090060a23e6..917e04250696 100644
--- a/include/asm-sparc/a.out.h
+++ b/include/asm-sparc/a.out.h
@@ -92,6 +92,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
92#include <asm/page.h> 92#include <asm/page.h>
93 93
94#define STACK_TOP (PAGE_OFFSET - PAGE_SIZE) 94#define STACK_TOP (PAGE_OFFSET - PAGE_SIZE)
95#define STACK_TOP_MAX STACK_TOP
95 96
96#endif /* __KERNEL__ */ 97#endif /* __KERNEL__ */
97 98
diff --git a/include/asm-sparc/device.h b/include/asm-sparc/device.h
index d8f9872b0e2d..4a56d84d69c4 100644
--- a/include/asm-sparc/device.h
+++ b/include/asm-sparc/device.h
@@ -3,5 +3,17 @@
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_SPARC_DEVICE_H
7#define _ASM_SPARC_DEVICE_H
8
9struct device_node;
10struct of_device;
11
12struct dev_archdata {
13 struct device_node *prom_node;
14 struct of_device *op;
15};
16
17#endif /* _ASM_SPARC_DEVICE_H */
18
7 19
diff --git a/include/asm-sparc/fb.h b/include/asm-sparc/fb.h
new file mode 100644
index 000000000000..c73ca081e1f5
--- /dev/null
+++ b/include/asm-sparc/fb.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4#include <asm/prom.h>
5
6#define fb_pgprotect(...) do {} while (0)
7
8static inline int fb_is_primary_device(struct fb_info *info)
9{
10 struct device *dev = info->device;
11 struct device_node *node;
12
13 node = dev->archdata.prom_node;
14 if (node &&
15 node == of_console_device)
16 return 1;
17
18 return 0;
19}
20
21#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index ff520ea97473..afb88a5973f0 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -7,178 +7,16 @@
7#ifndef _SPARC_IRQ_H 7#ifndef _SPARC_IRQ_H
8#define _SPARC_IRQ_H 8#define _SPARC_IRQ_H
9 9
10#include <linux/linkage.h>
11#include <linux/threads.h> /* For NR_CPUS */
12#include <linux/interrupt.h> 10#include <linux/interrupt.h>
13 11
14#include <asm/system.h> /* For SUN4M_NCPUS */
15#include <asm/btfixup.h>
16
17#define __irq_ino(irq) irq
18#define __irq_pil(irq) irq
19
20#define NR_IRQS 16 12#define NR_IRQS 16
21 13
22#define irq_canonicalize(irq) (irq) 14#define irq_canonicalize(irq) (irq)
23 15
24/* Dave Redman (djhr@tadpole.co.uk) 16extern void disable_irq_nosync(unsigned int irq);
25 * changed these to function pointers.. it saves cycles and will allow 17extern void disable_irq(unsigned int irq);
26 * the irq dependencies to be split into different files at a later date 18extern void enable_irq(unsigned int irq);
27 * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
28 * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
29 * Changed these to btfixup entities... It saves cycles :)
30 */
31BTFIXUPDEF_CALL(void, disable_irq, unsigned int)
32BTFIXUPDEF_CALL(void, enable_irq, unsigned int)
33BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int)
34BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int)
35BTFIXUPDEF_CALL(void, clear_clock_irq, void)
36BTFIXUPDEF_CALL(void, clear_profile_irq, int)
37BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
38
39static inline void disable_irq_nosync(unsigned int irq)
40{
41 BTFIXUP_CALL(disable_irq)(irq);
42}
43
44static inline void disable_irq(unsigned int irq)
45{
46 BTFIXUP_CALL(disable_irq)(irq);
47}
48
49static inline void enable_irq(unsigned int irq)
50{
51 BTFIXUP_CALL(enable_irq)(irq);
52}
53
54static inline void disable_pil_irq(unsigned int irq)
55{
56 BTFIXUP_CALL(disable_pil_irq)(irq);
57}
58
59static inline void enable_pil_irq(unsigned int irq)
60{
61 BTFIXUP_CALL(enable_pil_irq)(irq);
62}
63
64static inline void clear_clock_irq(void)
65{
66 BTFIXUP_CALL(clear_clock_irq)();
67}
68
69static inline void clear_profile_irq(int irq)
70{
71 BTFIXUP_CALL(clear_profile_irq)(irq);
72}
73
74static inline void load_profile_irq(int cpu, int limit)
75{
76 BTFIXUP_CALL(load_profile_irq)(cpu, limit);
77}
78
79extern void (*sparc_init_timers)(irq_handler_t lvl10_irq);
80extern void claim_ticker14(irq_handler_t irq_handler,
81 int irq,
82 unsigned int timeout);
83
84#ifdef CONFIG_SMP
85BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
86BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
87BTFIXUPDEF_CALL(void, set_irq_udt, int)
88
89#define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
90#define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
91#define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
92#endif
93 19
94extern int request_fast_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, __const__ char *devname); 20extern int request_fast_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, __const__ char *devname);
95 21
96/* On the sun4m, just like the timers, we have both per-cpu and master
97 * interrupt registers.
98 */
99
100/* These registers are used for sending/receiving irqs from/to
101 * different cpu's.
102 */
103struct sun4m_intreg_percpu {
104 unsigned int tbt; /* Interrupts still pending for this cpu. */
105
106 /* These next two registers are WRITE-ONLY and are only
107 * "on bit" sensitive, "off bits" written have NO affect.
108 */
109 unsigned int clear; /* Clear this cpus irqs here. */
110 unsigned int set; /* Set this cpus irqs here. */
111 unsigned char space[PAGE_SIZE - 12];
112};
113
114/*
115 * djhr
116 * Actually the clear and set fields in this struct are misleading..
117 * according to the SLAVIO manual (and the same applies for the SEC)
118 * the clear field clears bits in the mask which will ENABLE that IRQ
119 * the set field sets bits in the mask to DISABLE the IRQ.
120 *
121 * Also the undirected_xx address in the SLAVIO is defined as
122 * RESERVED and write only..
123 *
124 * DAVEM_NOTE: The SLAVIO only specifies behavior on uniprocessor
125 * sun4m machines, for MP the layout makes more sense.
126 */
127struct sun4m_intregs {
128 struct sun4m_intreg_percpu cpu_intregs[SUN4M_NCPUS];
129 unsigned int tbt; /* IRQ's that are still pending. */
130 unsigned int irqs; /* Master IRQ bits. */
131
132 /* Again, like the above, two these registers are WRITE-ONLY. */
133 unsigned int clear; /* Clear master IRQ's by setting bits here. */
134 unsigned int set; /* Set master IRQ's by setting bits here. */
135
136 /* This register is both READ and WRITE. */
137 unsigned int undirected_target; /* Which cpu gets undirected irqs. */
138};
139
140extern struct sun4m_intregs *sun4m_interrupts;
141
142/*
143 * Bit field defines for the interrupt registers on various
144 * Sparc machines.
145 */
146
147/* The sun4c interrupt register. */
148#define SUN4C_INT_ENABLE 0x01 /* Allow interrupts. */
149#define SUN4C_INT_E14 0x80 /* Enable level 14 IRQ. */
150#define SUN4C_INT_E10 0x20 /* Enable level 10 IRQ. */
151#define SUN4C_INT_E8 0x10 /* Enable level 8 IRQ. */
152#define SUN4C_INT_E6 0x08 /* Enable level 6 IRQ. */
153#define SUN4C_INT_E4 0x04 /* Enable level 4 IRQ. */
154#define SUN4C_INT_E1 0x02 /* Enable level 1 IRQ. */
155
156/* Dave Redman (djhr@tadpole.co.uk)
157 * The sun4m interrupt registers.
158 */
159#define SUN4M_INT_ENABLE 0x80000000
160#define SUN4M_INT_E14 0x00000080
161#define SUN4M_INT_E10 0x00080000
162
163#define SUN4M_HARD_INT(x) (0x000000001 << (x))
164#define SUN4M_SOFT_INT(x) (0x000010000 << (x))
165
166#define SUN4M_INT_MASKALL 0x80000000 /* mask all interrupts */
167#define SUN4M_INT_MODULE_ERR 0x40000000 /* module error */
168#define SUN4M_INT_M2S_WRITE 0x20000000 /* write buffer error */
169#define SUN4M_INT_ECC 0x10000000 /* ecc memory error */
170#define SUN4M_INT_FLOPPY 0x00400000 /* floppy disk */
171#define SUN4M_INT_MODULE 0x00200000 /* module interrupt */
172#define SUN4M_INT_VIDEO 0x00100000 /* onboard video */
173#define SUN4M_INT_REALTIME 0x00080000 /* system timer */
174#define SUN4M_INT_SCSI 0x00040000 /* onboard scsi */
175#define SUN4M_INT_AUDIO 0x00020000 /* audio/isdn */
176#define SUN4M_INT_ETHERNET 0x00010000 /* onboard ethernet */
177#define SUN4M_INT_SERIAL 0x00008000 /* serial ports */
178#define SUN4M_INT_KBDMS 0x00004000 /* keyboard/mouse */
179#define SUN4M_INT_SBUSBITS 0x00003F80 /* sbus int bits */
180
181#define SUN4M_INT_SBUS(x) (1 << (x+7))
182#define SUN4M_INT_VME(x) (1 << (x))
183
184#endif 22#endif
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index 7cb00c1b09c6..e5f5aedc2293 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -3,13 +3,9 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/of.h>
6#include <linux/mod_devicetable.h> 7#include <linux/mod_devicetable.h>
7#include <asm/openprom.h> 8#include <asm/openprom.h>
8#include <asm/prom.h>
9
10extern struct bus_type ebus_bus_type;
11extern struct bus_type sbus_bus_type;
12extern struct bus_type of_bus_type;
13 9
14/* 10/*
15 * The of_device is a kind of "base class" that is a superset of 11 * The of_device is a kind of "base class" that is a superset of
@@ -30,50 +26,13 @@ struct of_device
30 int portid; 26 int portid;
31 int clock_freq; 27 int clock_freq;
32}; 28};
33#define to_of_device(d) container_of(d, struct of_device, dev)
34 29
35extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 30extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
36extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); 31extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
37 32
38extern struct of_device *of_find_device_by_node(struct device_node *); 33/* These are just here during the transition */
39 34#include <linux/of_device.h>
40extern const struct of_device_id *of_match_device( 35#include <linux/of_platform.h>
41 const struct of_device_id *matches, const struct of_device *dev);
42
43extern struct of_device *of_dev_get(struct of_device *dev);
44extern void of_dev_put(struct of_device *dev);
45
46/*
47 * An of_platform_driver driver is attached to a basic of_device on
48 * the ISA, EBUS, and SBUS busses on sparc64.
49 */
50struct of_platform_driver
51{
52 char *name;
53 struct of_device_id *match_table;
54 struct module *owner;
55
56 int (*probe)(struct of_device* dev, const struct of_device_id *match);
57 int (*remove)(struct of_device* dev);
58
59 int (*suspend)(struct of_device* dev, pm_message_t state);
60 int (*resume)(struct of_device* dev);
61 int (*shutdown)(struct of_device* dev);
62
63 struct device_driver driver;
64};
65#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
66
67extern int of_register_driver(struct of_platform_driver *drv,
68 struct bus_type *bus);
69extern void of_unregister_driver(struct of_platform_driver *drv);
70extern int of_device_register(struct of_device *ofdev);
71extern void of_device_unregister(struct of_device *ofdev);
72extern struct of_device *of_platform_device_create(struct device_node *np,
73 const char *bus_id,
74 struct device *parent,
75 struct bus_type *bus);
76extern void of_release_dev(struct device *dev);
77 36
78#endif /* __KERNEL__ */ 37#endif /* __KERNEL__ */
79#endif /* _ASM_SPARC_OF_DEVICE_H */ 38#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h
new file mode 100644
index 000000000000..64a230064ef2
--- /dev/null
+++ b/include/asm-sparc/of_platform.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_SPARC_OF_PLATFORM_H
2#define _ASM_SPARC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm-sparc/of_device.h
7 * by Stephen Rothwell
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
16/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type;
21extern struct bus_type of_platform_bus_type;
22#define of_bus_type of_platform_bus_type /* for compatibility */
23
24extern int of_register_driver(struct of_platform_driver *drv,
25 struct bus_type *bus);
26extern void of_unregister_driver(struct of_platform_driver *drv);
27extern struct of_device *of_platform_device_create(struct device_node *np,
28 const char *bus_id,
29 struct device *parent,
30 struct bus_type *bus);
31
32#endif /* _ASM_SPARC_OF_PLATFORM_H */
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h
index 91691e52c058..17ba82ee220a 100644
--- a/include/asm-sparc/oplib.h
+++ b/include/asm-sparc/oplib.h
@@ -158,32 +158,6 @@ extern void prom_putchar(char character);
158extern void prom_printf(char *fmt, ...); 158extern void prom_printf(char *fmt, ...);
159extern void prom_write(const char *buf, unsigned int len); 159extern void prom_write(const char *buf, unsigned int len);
160 160
161/* Query for input device type */
162
163enum prom_input_device {
164 PROMDEV_IKBD, /* input from keyboard */
165 PROMDEV_ITTYA, /* input from ttya */
166 PROMDEV_ITTYB, /* input from ttyb */
167 PROMDEV_IRSC, /* input from rsc */
168 PROMDEV_IVCONS, /* input from virtual-console */
169 PROMDEV_I_UNK,
170};
171
172extern enum prom_input_device prom_query_input_device(void);
173
174/* Query for output device type */
175
176enum prom_output_device {
177 PROMDEV_OSCREEN, /* to screen */
178 PROMDEV_OTTYA, /* to ttya */
179 PROMDEV_OTTYB, /* to ttyb */
180 PROMDEV_ORSC, /* to rsc */
181 PROMDEV_OVCONS, /* to virtual-console */
182 PROMDEV_O_UNK,
183};
184
185extern enum prom_output_device prom_query_output_device(void);
186
187/* Multiprocessor operations... */ 161/* Multiprocessor operations... */
188 162
189/* Start the CPU with the given device tree node, context table, and context 163/* Start the CPU with the given device tree node, context table, and context
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 59229aeba27b..2cc235b74d94 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -46,7 +46,6 @@ BTFIXUPDEF_SIMM13(user_ptrs_per_pgd)
46#define pgd_ERROR(e) __builtin_trap() 46#define pgd_ERROR(e) __builtin_trap()
47 47
48BTFIXUPDEF_INT(page_none) 48BTFIXUPDEF_INT(page_none)
49BTFIXUPDEF_INT(page_shared)
50BTFIXUPDEF_INT(page_copy) 49BTFIXUPDEF_INT(page_copy)
51BTFIXUPDEF_INT(page_readonly) 50BTFIXUPDEF_INT(page_readonly)
52BTFIXUPDEF_INT(page_kernel) 51BTFIXUPDEF_INT(page_kernel)
@@ -66,7 +65,7 @@ BTFIXUPDEF_INT(page_kernel)
66#define PTE_SIZE (PTRS_PER_PTE*4) 65#define PTE_SIZE (PTRS_PER_PTE*4)
67 66
68#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none)) 67#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none))
69#define PAGE_SHARED __pgprot(BTFIXUP_INT(page_shared)) 68extern pgprot_t PAGE_SHARED;
70#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy)) 69#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy))
71#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly)) 70#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly))
72 71
@@ -151,7 +150,6 @@ BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
151BTFIXUPDEF_SETHI(none_mask) 150BTFIXUPDEF_SETHI(none_mask)
152BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) 151BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
153BTFIXUPDEF_CALL(void, pte_clear, pte_t *) 152BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
154BTFIXUPDEF_CALL(int, pte_read, pte_t)
155 153
156static inline int pte_none(pte_t pte) 154static inline int pte_none(pte_t pte)
157{ 155{
@@ -160,7 +158,6 @@ static inline int pte_none(pte_t pte)
160 158
161#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) 159#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte)
162#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte) 160#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte)
163#define pte_read(pte) BTFIXUP_CALL(pte_read)(pte)
164 161
165BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) 162BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t)
166BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) 163BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t)
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 9ea105ebe2ff..350676c589f9 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -2,7 +2,6 @@
2#define _SPARC_PROM_H 2#define _SPARC_PROM_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5
6/* 5/*
7 * Definitions for talking to the Open Firmware PROM on 6 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers. 7 * Power Macintosh computers.
@@ -17,11 +16,17 @@
17 * as published by the Free Software Foundation; either version 16 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
19 */ 18 */
20
21#include <linux/types.h> 19#include <linux/types.h>
22#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
23#include <asm/atomic.h> 21#include <asm/atomic.h>
24 22
23#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2
24#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
25
26#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
27#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
28#define of_node_cmp(s1, s2) strcmp((s1), (s2))
29
25typedef u32 phandle; 30typedef u32 phandle;
26typedef u32 ihandle; 31typedef u32 ihandle;
27 32
@@ -55,53 +60,34 @@ struct device_node {
55 unsigned int unique_id; 60 unsigned int unique_id;
56}; 61};
57 62
58/* flag descriptions */
59#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
60
61#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 63#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
62#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 64#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
63 65
64#define OF_BAD_ADDR ((u64)-1)
65
66static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
67{
68 dn->pde = de;
69}
70
71extern struct device_node *of_find_node_by_name(struct device_node *from,
72 const char *name);
73#define for_each_node_by_name(dn, name) \
74 for (dn = of_find_node_by_name(NULL, name); dn; \
75 dn = of_find_node_by_name(dn, name))
76extern struct device_node *of_find_node_by_type(struct device_node *from,
77 const char *type);
78#define for_each_node_by_type(dn, type) \
79 for (dn = of_find_node_by_type(NULL, type); dn; \
80 dn = of_find_node_by_type(dn, type))
81extern struct device_node *of_find_compatible_node(struct device_node *from,
82 const char *type, const char *compat);
83extern struct device_node *of_find_node_by_path(const char *path);
84extern struct device_node *of_find_node_by_phandle(phandle handle);
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,
87 struct device_node *prev);
88extern struct property *of_find_property(const struct device_node *np,
89 const char *name,
90 int *lenp);
91extern int of_device_is_compatible(const struct device_node *device,
92 const char *);
93extern const void *of_get_property(const struct device_node *node,
94 const char *name,
95 int *lenp);
96#define get_property(node,name,lenp) of_get_property(node,name,lenp)
97extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 66extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
98extern int of_getintprop_default(struct device_node *np, 67extern int of_getintprop_default(struct device_node *np,
99 const char *name, 68 const char *name,
100 int def); 69 int def);
101extern int of_n_addr_cells(struct device_node *np);
102extern int of_n_size_cells(struct device_node *np);
103 70
104extern void prom_build_devicetree(void); 71extern void prom_build_devicetree(void);
105 72
73/* Dummy ref counting routines - to be implemented later */
74static inline struct device_node *of_node_get(struct device_node *node)
75{
76 return node;
77}
78static inline void of_node_put(struct device_node *node)
79{
80}
81
82/*
83 * NB: This is here while we transition from using asm/prom.h
84 * to linux/of.h
85 */
86#include <linux/of.h>
87
88extern struct device_node *of_console_device;
89extern char *of_console_path;
90extern char *of_console_options;
91
106#endif /* __KERNEL__ */ 92#endif /* __KERNEL__ */
107#endif /* _SPARC_PROM_H */ 93#endif /* _SPARC_PROM_H */
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 8b4e23b3bb38..d1a2572e3f55 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -165,16 +165,6 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
165 } while(0) 165 } while(0)
166 166
167/* 167/*
168 * On SMP systems, when the scheduler does migration-cost autodetection,
169 * it needs a way to flush as much of the CPU's caches as possible.
170 *
171 * TODO: fill this in!
172 */
173static inline void sched_cacheflush(void)
174{
175}
176
177/*
178 * Changing the IRQ level on the Sparc. 168 * Changing the IRQ level on the Sparc.
179 */ 169 */
180extern void local_irq_restore(unsigned long); 170extern void local_irq_restore(unsigned long);
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 64471bcd96f9..029b3e0d5e4c 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -1,4 +1,3 @@
1/* $Id: unistd.h,v 1.74 2002/02/08 03:57:18 davem Exp $ */
2#ifndef _SPARC_UNISTD_H 1#ifndef _SPARC_UNISTD_H
3#define _SPARC_UNISTD_H 2#define _SPARC_UNISTD_H
4 3
@@ -9,7 +8,7 @@
9 * think of right now to force the arguments into fixed registers 8 * think of right now to force the arguments into fixed registers
10 * before the trap into the system call with gcc 'asm' statements. 9 * before the trap into the system call with gcc 'asm' statements.
11 * 10 *
12 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
13 * 12 *
14 * SunOS compatibility based upon preliminary work which is: 13 * SunOS compatibility based upon preliminary work which is:
15 * 14 *
@@ -330,8 +329,9 @@
330#define __NR_signalfd 311 329#define __NR_signalfd 311
331#define __NR_timerfd 312 330#define __NR_timerfd 312
332#define __NR_eventfd 313 331#define __NR_eventfd 313
332#define __NR_fallocate 314
333 333
334#define NR_SYSCALLS 314 334#define NR_SYSCALLS 315
335 335
336#ifdef __KERNEL__ 336#ifdef __KERNEL__
337#define __ARCH_WANT_IPC_PARSE_VERSION 337#define __ARCH_WANT_IPC_PARSE_VERSION
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index eb3b8e90b279..902e07f89a42 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -101,6 +101,8 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
101#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ 101#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
102 STACK_TOP32 : STACK_TOP64) 102 STACK_TOP32 : STACK_TOP64)
103 103
104#define STACK_TOP_MAX STACK_TOP64
105
104#endif 106#endif
105 107
106#endif /* !(__ASSEMBLY__) */ 108#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/bugs.h b/include/asm-sparc64/bugs.h
index bf39d86c0c9e..11ade6841971 100644
--- a/include/asm-sparc64/bugs.h
+++ b/include/asm-sparc64/bugs.h
@@ -4,12 +4,7 @@
4 */ 4 */
5#include <asm/sstate.h> 5#include <asm/sstate.h>
6 6
7extern unsigned long loops_per_jiffy;
8
9static void __init check_bugs(void) 7static void __init check_bugs(void)
10{ 8{
11#ifndef CONFIG_SMP
12 cpu_data(0).udelay_val = loops_per_jiffy;
13#endif
14 sstate_running(); 9 sstate_running();
15} 10}
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
index 36511ca51416..01fe6682b405 100644
--- a/include/asm-sparc64/compat.h
+++ b/include/asm-sparc64/compat.h
@@ -31,8 +31,10 @@ typedef s32 compat_timer_t;
31 31
32typedef s32 compat_int_t; 32typedef s32 compat_int_t;
33typedef s32 compat_long_t; 33typedef s32 compat_long_t;
34typedef s64 compat_s64;
34typedef u32 compat_uint_t; 35typedef u32 compat_uint_t;
35typedef u32 compat_ulong_t; 36typedef u32 compat_ulong_t;
37typedef u64 compat_u64;
36 38
37struct compat_timespec { 39struct compat_timespec {
38 compat_time_t tv_sec; 40 compat_time_t tv_sec;
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 445026fbec35..98a6e609163e 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -19,7 +19,7 @@ typedef struct {
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 __pad0; 20 unsigned int __pad0;
21 unsigned long clock_tick; /* %tick's per second */ 21 unsigned long clock_tick; /* %tick's per second */
22 unsigned long udelay_val; 22 unsigned long __pad;
23 unsigned int __pad1; 23 unsigned int __pad1;
24 unsigned int __pad2; 24 unsigned int __pad2;
25 25
@@ -80,7 +80,8 @@ struct trap_per_cpu {
80 unsigned int dev_mondo_qmask; 80 unsigned int dev_mondo_qmask;
81 unsigned int resum_qmask; 81 unsigned int resum_qmask;
82 unsigned int nonresum_qmask; 82 unsigned int nonresum_qmask;
83 unsigned int __pad2[3]; 83 unsigned int __pad2[1];
84 void *hdesc;
84} __attribute__((aligned(64))); 85} __attribute__((aligned(64)));
85extern struct trap_per_cpu trap_block[NR_CPUS]; 86extern struct trap_per_cpu trap_block[NR_CPUS];
86extern void init_cur_cpu_trap(struct thread_info *); 87extern void init_cur_cpu_trap(struct thread_info *);
diff --git a/include/asm-sparc64/delay.h b/include/asm-sparc64/delay.h
index a4aae6f80627..a77aa622d762 100644
--- a/include/asm-sparc64/delay.h
+++ b/include/asm-sparc64/delay.h
@@ -1,37 +1,17 @@
1/* delay.h: Linux delay routines on sparc64. 1/* delay.h: Linux delay routines on sparc64.
2 * 2 *
3 * Copyright (C) 1996, 2004 David S. Miller (davem@davemloft.net). 3 * Copyright (C) 1996, 2004, 2007 David S. Miller (davem@davemloft.net).
4 *
5 * Based heavily upon x86 variant which is:
6 * Copyright (C) 1993 Linus Torvalds
7 *
8 * Delay routines calling functions in arch/sparc64/lib/delay.c
9 */ 4 */
10 5
11#ifndef __SPARC64_DELAY_H 6#ifndef _SPARC64_DELAY_H
12#define __SPARC64_DELAY_H 7#define _SPARC64_DELAY_H
13
14#include <linux/param.h>
15#include <asm/cpudata.h>
16 8
17#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
18 10
19extern void __bad_udelay(void);
20extern void __bad_ndelay(void);
21
22extern void __udelay(unsigned long usecs);
23extern void __ndelay(unsigned long nsecs);
24extern void __const_udelay(unsigned long usecs);
25extern void __delay(unsigned long loops); 11extern void __delay(unsigned long loops);
26 12extern void udelay(unsigned long usecs);
27#define udelay(n) (__builtin_constant_p(n) ? \ 13#define mdelay(n) udelay((n) * 1000)
28 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
29 __udelay(n))
30
31#define ndelay(n) (__builtin_constant_p(n) ? \
32 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
33 __ndelay(n))
34 14
35#endif /* !__ASSEMBLY__ */ 15#endif /* !__ASSEMBLY__ */
36 16
37#endif /* defined(__SPARC64_DELAY_H) */ 17#endif /* _SPARC64_DELAY_H */
diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h
new file mode 100644
index 000000000000..389012e5fbad
--- /dev/null
+++ b/include/asm-sparc64/fb.h
@@ -0,0 +1,27 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4#include <linux/fs.h>
5#include <asm/page.h>
6#include <asm/prom.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 struct device *dev = info->device;
17 struct device_node *node;
18
19 node = dev->archdata.prom_node;
20 if (node &&
21 node == of_console_device)
22 return 1;
23
24 return 0;
25}
26
27#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sparc64/hvtramp.h b/include/asm-sparc64/hvtramp.h
new file mode 100644
index 000000000000..c7dd6ad056df
--- /dev/null
+++ b/include/asm-sparc64/hvtramp.h
@@ -0,0 +1,37 @@
1#ifndef _SPARC64_HVTRAP_H
2#define _SPARC64_HVTRAP_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/types.h>
7
8struct hvtramp_mapping {
9 __u64 vaddr;
10 __u64 tte;
11};
12
13struct hvtramp_descr {
14 __u32 cpu;
15 __u32 num_mappings;
16 __u64 fault_info_va;
17 __u64 fault_info_pa;
18 __u64 thread_reg;
19 struct hvtramp_mapping maps[2];
20};
21
22extern void hv_cpu_startup(unsigned long hvdescr_pa);
23
24#endif
25
26#define HVTRAMP_DESCR_CPU 0x00
27#define HVTRAMP_DESCR_NUM_MAPPINGS 0x04
28#define HVTRAMP_DESCR_FAULT_INFO_VA 0x08
29#define HVTRAMP_DESCR_FAULT_INFO_PA 0x10
30#define HVTRAMP_DESCR_THREAD_REG 0x18
31#define HVTRAMP_DESCR_MAPS 0x20
32
33#define HVTRAMP_MAPPING_VADDR 0x00
34#define HVTRAMP_MAPPING_TTE 0x08
35#define HVTRAMP_MAPPING_SIZE 0x10
36
37#endif /* _SPARC64_HVTRAP_H */
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
index db2130a95d68..524d49835dfd 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -98,7 +98,7 @@
98#define HV_FAST_MACH_EXIT 0x00 98#define HV_FAST_MACH_EXIT 0x00
99 99
100#ifndef __ASSEMBLY__ 100#ifndef __ASSEMBLY__
101extern void sun4v_mach_exit(unsigned long exit_core); 101extern void sun4v_mach_exit(unsigned long exit_code);
102#endif 102#endif
103 103
104/* Domain services. */ 104/* Domain services. */
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index ad595b679842..9565a892801e 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -14,11 +14,6 @@
14#define __SLOW_DOWN_IO do { } while (0) 14#define __SLOW_DOWN_IO do { } while (0)
15#define SLOW_DOWN_IO do { } while (0) 15#define SLOW_DOWN_IO do { } while (0)
16 16
17extern unsigned long virt_to_bus_not_defined_use_pci_map(volatile void *addr);
18#define virt_to_bus virt_to_bus_not_defined_use_pci_map
19extern unsigned long bus_to_virt_not_defined_use_pci_map(volatile void *addr);
20#define bus_to_virt bus_to_virt_not_defined_use_pci_map
21
22/* BIO layer definitions. */ 17/* BIO layer definitions. */
23extern unsigned long kern_base, kern_size; 18extern unsigned long kern_base, kern_size;
24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 19#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index 90781e34a95c..e6c436ef9356 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -53,6 +53,8 @@ extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
53extern void sun4v_destroy_msi(unsigned int virt_irq); 53extern void sun4v_destroy_msi(unsigned int virt_irq);
54extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 54extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
55 55
56extern void fixup_irqs(void);
57
56static __inline__ void set_softint(unsigned long bits) 58static __inline__ void set_softint(unsigned long bits)
57{ 59{
58 __asm__ __volatile__("wr %0, 0x0, %%set_softint" 60 __asm__ __volatile__("wr %0, 0x0, %%set_softint"
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h
index a331b7b0dff2..7f6774dca5f4 100644
--- a/include/asm-sparc64/kprobes.h
+++ b/include/asm-sparc64/kprobes.h
@@ -10,7 +10,6 @@ typedef u32 kprobe_opcode_t;
10#define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */ 10#define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */
11#define MAX_INSN_SIZE 2 11#define MAX_INSN_SIZE 2
12 12
13#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
14#define arch_remove_kprobe(p) do {} while (0) 13#define arch_remove_kprobe(p) do {} while (0)
15#define ARCH_INACTIVE_KPROBE_COUNT 0 14#define ARCH_INACTIVE_KPROBE_COUNT 0
16 15
diff --git a/include/asm-sparc64/ldc.h b/include/asm-sparc64/ldc.h
new file mode 100644
index 000000000000..bdb524a7b814
--- /dev/null
+++ b/include/asm-sparc64/ldc.h
@@ -0,0 +1,138 @@
1#ifndef _SPARC64_LDC_H
2#define _SPARC64_LDC_H
3
4#include <asm/hypervisor.h>
5
6extern int ldom_domaining_enabled;
7extern void ldom_set_var(const char *var, const char *value);
8extern void ldom_reboot(const char *boot_command);
9extern void ldom_power_off(void);
10
11/* The event handler will be evoked when link state changes
12 * or data becomes available on the receive side.
13 *
14 * For non-RAW links, if the LDC_EVENT_RESET event arrives the
15 * driver should reset all of it's internal state and reinvoke
16 * ldc_connect() to try and bring the link up again.
17 *
18 * For RAW links, ldc_connect() is not used. Instead the driver
19 * just waits for the LDC_EVENT_UP event.
20 */
21struct ldc_channel_config {
22 void (*event)(void *arg, int event);
23
24 u32 mtu;
25 unsigned int rx_irq;
26 unsigned int tx_irq;
27 u8 mode;
28#define LDC_MODE_RAW 0x00
29#define LDC_MODE_UNRELIABLE 0x01
30#define LDC_MODE_RESERVED 0x02
31#define LDC_MODE_STREAM 0x03
32
33 u8 debug;
34#define LDC_DEBUG_HS 0x01
35#define LDC_DEBUG_STATE 0x02
36#define LDC_DEBUG_RX 0x04
37#define LDC_DEBUG_TX 0x08
38#define LDC_DEBUG_DATA 0x10
39};
40
41#define LDC_EVENT_RESET 0x01
42#define LDC_EVENT_UP 0x02
43#define LDC_EVENT_DATA_READY 0x04
44
45#define LDC_STATE_INVALID 0x00
46#define LDC_STATE_INIT 0x01
47#define LDC_STATE_BOUND 0x02
48#define LDC_STATE_READY 0x03
49#define LDC_STATE_CONNECTED 0x04
50
51struct ldc_channel;
52
53/* Allocate state for a channel. */
54extern struct ldc_channel *ldc_alloc(unsigned long id,
55 const struct ldc_channel_config *cfgp,
56 void *event_arg);
57
58/* Shut down and free state for a channel. */
59extern void ldc_free(struct ldc_channel *lp);
60
61/* Register TX and RX queues of the link with the hypervisor. */
62extern int ldc_bind(struct ldc_channel *lp, const char *name);
63
64/* For non-RAW protocols we need to complete a handshake before
65 * communication can proceed. ldc_connect() does that, if the
66 * handshake completes successfully, an LDC_EVENT_UP event will
67 * be sent up to the driver.
68 */
69extern int ldc_connect(struct ldc_channel *lp);
70extern int ldc_disconnect(struct ldc_channel *lp);
71
72extern int ldc_state(struct ldc_channel *lp);
73
74/* Read and write operations. Only valid when the link is up. */
75extern int ldc_write(struct ldc_channel *lp, const void *buf,
76 unsigned int size);
77extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);
78
79#define LDC_MAP_SHADOW 0x01
80#define LDC_MAP_DIRECT 0x02
81#define LDC_MAP_IO 0x04
82#define LDC_MAP_R 0x08
83#define LDC_MAP_W 0x10
84#define LDC_MAP_X 0x20
85#define LDC_MAP_RW (LDC_MAP_R | LDC_MAP_W)
86#define LDC_MAP_RWX (LDC_MAP_R | LDC_MAP_W | LDC_MAP_X)
87#define LDC_MAP_ALL 0x03f
88
89struct ldc_trans_cookie {
90 u64 cookie_addr;
91 u64 cookie_size;
92};
93
94struct scatterlist;
95extern int ldc_map_sg(struct ldc_channel *lp,
96 struct scatterlist *sg, int num_sg,
97 struct ldc_trans_cookie *cookies, int ncookies,
98 unsigned int map_perm);
99
100extern int ldc_map_single(struct ldc_channel *lp,
101 void *buf, unsigned int len,
102 struct ldc_trans_cookie *cookies, int ncookies,
103 unsigned int map_perm);
104
105extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies,
106 int ncookies);
107
108extern int ldc_copy(struct ldc_channel *lp, int copy_dir,
109 void *buf, unsigned int len, unsigned long offset,
110 struct ldc_trans_cookie *cookies, int ncookies);
111
112static inline int ldc_get_dring_entry(struct ldc_channel *lp,
113 void *buf, unsigned int len,
114 unsigned long offset,
115 struct ldc_trans_cookie *cookies,
116 int ncookies)
117{
118 return ldc_copy(lp, LDC_COPY_IN, buf, len, offset, cookies, ncookies);
119}
120
121static inline int ldc_put_dring_entry(struct ldc_channel *lp,
122 void *buf, unsigned int len,
123 unsigned long offset,
124 struct ldc_trans_cookie *cookies,
125 int ncookies)
126{
127 return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);
128}
129
130extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
131 struct ldc_trans_cookie *cookies,
132 int *ncookies, unsigned int map_perm);
133
134extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf,
135 unsigned int len,
136 struct ldc_trans_cookie *cookies, int ncookies);
137
138#endif /* _SPARC64_LDC_H */
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h
index c6383982b53d..1acc7272e537 100644
--- a/include/asm-sparc64/mdesc.h
+++ b/include/asm-sparc64/mdesc.h
@@ -2,38 +2,76 @@
2#define _SPARC64_MDESC_H 2#define _SPARC64_MDESC_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/cpumask.h>
5#include <asm/prom.h> 6#include <asm/prom.h>
6 7
7struct mdesc_node; 8struct mdesc_handle;
8struct mdesc_arc { 9
9 const char *name; 10/* Machine description operations are to be surrounded by grab and
10 struct mdesc_node *arc; 11 * release calls. The mdesc_handle returned from the grab is
11}; 12 * the first argument to all of the operational calls that work
13 * on mdescs.
14 */
15extern struct mdesc_handle *mdesc_grab(void);
16extern void mdesc_release(struct mdesc_handle *);
17
18#define MDESC_NODE_NULL (~(u64)0)
19
20extern u64 mdesc_node_by_name(struct mdesc_handle *handle,
21 u64 from_node, const char *name);
22#define mdesc_for_each_node_by_name(__hdl, __node, __name) \
23 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
24 (__node) != MDESC_NODE_NULL; \
25 __node = mdesc_node_by_name(__hdl, __node, __name))
26
27/* Access to property values returned from mdesc_get_property() are
28 * only valid inside of a mdesc_grab()/mdesc_release() sequence.
29 * Once mdesc_release() is called, the memory backed up by these
30 * pointers may reference freed up memory.
31 *
32 * Therefore callers must make copies of any property values
33 * they need.
34 *
35 * These same rules apply to mdesc_node_name().
36 */
37extern const void *mdesc_get_property(struct mdesc_handle *handle,
38 u64 node, const char *name, int *lenp);
39extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
40
41/* MD arc iteration, the standard sequence is:
42 *
43 * unsigned long arc;
44 * mdesc_for_each_arc(arc, handle, node, MDESC_ARC_TYPE_{FWD,BACK}) {
45 * unsigned long target = mdesc_arc_target(handle, arc);
46 * ...
47 * }
48 */
12 49
13struct mdesc_node { 50#define MDESC_ARC_TYPE_FWD "fwd"
14 const char *name; 51#define MDESC_ARC_TYPE_BACK "back"
15 u64 node; 52
16 unsigned int unique_id; 53extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
17 unsigned int num_arcs; 54 const char *arc_type);
18 unsigned int irqs[2]; 55#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
19 struct property *properties; 56 for (__arc = mdesc_next_arc(__hdl, __node, __type); \
20 struct mdesc_node *hash_next; 57 (__arc) != MDESC_NODE_NULL; \
21 struct mdesc_node *allnodes_next; 58 __arc = mdesc_next_arc(__hdl, __arc, __type))
22 struct mdesc_arc arcs[0]; 59
60extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
61
62extern void mdesc_update(void);
63
64struct mdesc_notifier_client {
65 void (*add)(struct mdesc_handle *handle, u64 node);
66 void (*remove)(struct mdesc_handle *handle, u64 node);
67
68 const char *node_name;
69 struct mdesc_notifier_client *next;
23}; 70};
24 71
25extern struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, 72extern void mdesc_register_notifier(struct mdesc_notifier_client *client);
26 const char *name); 73
27#define md_for_each_node_by_name(__mn, __name) \ 74extern void mdesc_fill_in_cpu_data(cpumask_t mask);
28 for (__mn = md_find_node_by_name(NULL, __name); __mn; \
29 __mn = md_find_node_by_name(__mn, __name))
30
31extern struct property *md_find_property(const struct mdesc_node *mp,
32 const char *name,
33 int *lenp);
34extern const void *md_get_property(const struct mdesc_node *mp,
35 const char *name,
36 int *lenp);
37 75
38extern void sun4v_mdesc_init(void); 76extern void sun4v_mdesc_init(void);
39 77
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 8d129032013e..9fc225ed5500 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -76,6 +76,9 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
76 unsigned long ctx_valid, flags; 76 unsigned long ctx_valid, flags;
77 int cpu; 77 int cpu;
78 78
79 if (unlikely(mm == &init_mm))
80 return;
81
79 spin_lock_irqsave(&mm->context.lock, flags); 82 spin_lock_irqsave(&mm->context.lock, flags);
80 ctx_valid = CTX_VALID(mm->context); 83 ctx_valid = CTX_VALID(mm->context);
81 if (!ctx_valid) 84 if (!ctx_valid)
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index 60e9173c9acb..46d69b3223c5 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -3,14 +3,9 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/of.h>
6#include <linux/mod_devicetable.h> 7#include <linux/mod_devicetable.h>
7#include <asm/openprom.h> 8#include <asm/openprom.h>
8#include <asm/prom.h>
9
10extern struct bus_type isa_bus_type;
11extern struct bus_type ebus_bus_type;
12extern struct bus_type sbus_bus_type;
13extern struct bus_type of_bus_type;
14 9
15/* 10/*
16 * The of_device is a kind of "base class" that is a superset of 11 * The of_device is a kind of "base class" that is a superset of
@@ -31,50 +26,13 @@ struct of_device
31 int portid; 26 int portid;
32 int clock_freq; 27 int clock_freq;
33}; 28};
34#define to_of_device(d) container_of(d, struct of_device, dev)
35 29
36extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 30extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
37extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); 31extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
38 32
39extern struct of_device *of_find_device_by_node(struct device_node *); 33/* These are just here during the transition */
40 34#include <linux/of_device.h>
41extern const struct of_device_id *of_match_device( 35#include <linux/of_platform.h>
42 const struct of_device_id *matches, const struct of_device *dev);
43
44extern struct of_device *of_dev_get(struct of_device *dev);
45extern void of_dev_put(struct of_device *dev);
46
47/*
48 * An of_platform_driver driver is attached to a basic of_device on
49 * the ISA, EBUS, and SBUS busses on sparc64.
50 */
51struct of_platform_driver
52{
53 char *name;
54 struct of_device_id *match_table;
55 struct module *owner;
56
57 int (*probe)(struct of_device* dev, const struct of_device_id *match);
58 int (*remove)(struct of_device* dev);
59
60 int (*suspend)(struct of_device* dev, pm_message_t state);
61 int (*resume)(struct of_device* dev);
62 int (*shutdown)(struct of_device* dev);
63
64 struct device_driver driver;
65};
66#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
67
68extern int of_register_driver(struct of_platform_driver *drv,
69 struct bus_type *bus);
70extern void of_unregister_driver(struct of_platform_driver *drv);
71extern int of_device_register(struct of_device *ofdev);
72extern void of_device_unregister(struct of_device *ofdev);
73extern struct of_device *of_platform_device_create(struct device_node *np,
74 const char *bus_id,
75 struct device *parent,
76 struct bus_type *bus);
77extern void of_release_dev(struct device *dev);
78 36
79#endif /* __KERNEL__ */ 37#endif /* __KERNEL__ */
80#endif /* _ASM_SPARC64_OF_DEVICE_H */ 38#endif /* _ASM_SPARC64_OF_DEVICE_H */
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h
new file mode 100644
index 000000000000..f7c1f17c7d52
--- /dev/null
+++ b/include/asm-sparc64/of_platform.h
@@ -0,0 +1,33 @@
1#ifndef _ASM_SPARC64_OF_PLATFORM_H
2#define _ASM_SPARC64_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm-sparc/of_device.h
7 * by Stephen Rothwell
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
16/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type;
22extern struct bus_type of_platform_bus_type;
23#define of_bus_type of_platform_bus_type /* for compatibility */
24
25extern int of_register_driver(struct of_platform_driver *drv,
26 struct bus_type *bus);
27extern void of_unregister_driver(struct of_platform_driver *drv);
28extern struct of_device *of_platform_device_create(struct device_node *np,
29 const char *bus_id,
30 struct device *parent,
31 struct bus_type *bus);
32
33#endif /* _ASM_SPARC64_OF_PLATFORM_H */
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index 992f9f7a476c..3f23c5dc5f21 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -140,32 +140,6 @@ extern void prom_putchar(char character);
140extern void prom_printf(const char *fmt, ...); 140extern void prom_printf(const char *fmt, ...);
141extern void prom_write(const char *buf, unsigned int len); 141extern void prom_write(const char *buf, unsigned int len);
142 142
143/* Query for input device type */
144
145enum prom_input_device {
146 PROMDEV_IKBD, /* input from keyboard */
147 PROMDEV_ITTYA, /* input from ttya */
148 PROMDEV_ITTYB, /* input from ttyb */
149 PROMDEV_IRSC, /* input from rsc */
150 PROMDEV_IVCONS, /* input from virtual-console */
151 PROMDEV_I_UNK,
152};
153
154extern enum prom_input_device prom_query_input_device(void);
155
156/* Query for output device type */
157
158enum prom_output_device {
159 PROMDEV_OSCREEN, /* to screen */
160 PROMDEV_OTTYA, /* to ttya */
161 PROMDEV_OTTYB, /* to ttyb */
162 PROMDEV_ORSC, /* to rsc */
163 PROMDEV_OVCONS, /* to virtual-console */
164 PROMDEV_O_UNK,
165};
166
167extern enum prom_output_device prom_query_output_device(void);
168
169/* Multiprocessor operations... */ 143/* Multiprocessor operations... */
170#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
171/* Start the CPU with the given device tree node at the passed program 145/* Start the CPU with the given device tree node at the passed program
@@ -319,6 +293,8 @@ extern int prom_inst2pkg(int);
319extern int prom_service_exists(const char *service_name); 293extern int prom_service_exists(const char *service_name);
320extern void prom_sun4v_guest_soft_state(void); 294extern void prom_sun4v_guest_soft_state(void);
321 295
296extern int prom_ihandle2path(int handle, char *buffer, int bufsize);
297
322/* Client interface level routines. */ 298/* Client interface level routines. */
323extern void prom_set_trap_table(unsigned long tba); 299extern void prom_set_trap_table(unsigned long tba);
324extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa); 300extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa);
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 23cc63f049a8..600afe5ae2e3 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -8,8 +8,9 @@
8#define _ASM_SPARC64_PARPORT_H 1 8#define _ASM_SPARC64_PARPORT_H 1
9 9
10#include <asm/ebus.h> 10#include <asm/ebus.h>
11#include <asm/isa.h>
12#include <asm/ns87303.h> 11#include <asm/ns87303.h>
12#include <asm/of_device.h>
13#include <asm/prom.h>
13 14
14#define PARPORT_PC_MAX_PORTS PARPORT_MAX 15#define PARPORT_PC_MAX_PORTS PARPORT_MAX
15 16
@@ -35,8 +36,12 @@ static struct sparc_ebus_info {
35 unsigned int addr; 36 unsigned int addr;
36 unsigned int count; 37 unsigned int count;
37 int lock; 38 int lock;
39
40 struct parport *port;
38} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; 41} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
39 42
43static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS);
44
40static __inline__ int request_dma(unsigned int dmanr, const char *device_id) 45static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
41{ 46{
42 if (dmanr >= PARPORT_PC_MAX_PORTS) 47 if (dmanr >= PARPORT_PC_MAX_PORTS)
@@ -98,117 +103,145 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
98 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
99} 104}
100 105
101static int ebus_ecpp_p(struct linux_ebus_device *edev) 106static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match)
102{ 107{
103 if (!strcmp(edev->prom_node->name, "ecpp")) 108 unsigned long base = op->resource[0].start;
104 return 1; 109 unsigned long config = op->resource[1].start;
105 if (!strcmp(edev->prom_node->name, "parallel")) { 110 unsigned long d_base = op->resource[2].start;
106 const char *compat; 111 unsigned long d_len;
107 112 struct device_node *parent;
108 compat = of_get_property(edev->prom_node, 113 struct parport *p;
109 "compatible", NULL); 114 int slot, err;
110 if (compat && 115
111 (!strcmp(compat, "ecpp") || 116 parent = op->node->parent;
112 !strcmp(compat, "ns87317-ecpp") || 117 if (!strcmp(parent->name, "dma")) {
113 !strcmp(compat + 13, "ecpp"))) 118 p = parport_pc_probe_port(base, base + 0x400,
114 return 1; 119 op->irqs[0], PARPORT_DMA_NOFIFO,
120 op->dev.parent);
121 if (!p)
122 return -ENOMEM;
123 dev_set_drvdata(&op->dev, p);
124 return 0;
115 } 125 }
126
127 for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) {
128 if (!test_and_set_bit(slot, dma_slot_map))
129 break;
130 }
131 err = -ENODEV;
132 if (slot >= PARPORT_PC_MAX_PORTS)
133 goto out_err;
134
135 spin_lock_init(&sparc_ebus_dmas[slot].info.lock);
136
137 d_len = (op->resource[2].end - d_base) + 1UL;
138 sparc_ebus_dmas[slot].info.regs =
139 of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA");
140
141 if (!sparc_ebus_dmas[slot].info.regs)
142 goto out_clear_map;
143
144 sparc_ebus_dmas[slot].info.flags = 0;
145 sparc_ebus_dmas[slot].info.callback = NULL;
146 sparc_ebus_dmas[slot].info.client_cookie = NULL;
147 sparc_ebus_dmas[slot].info.irq = 0xdeadbeef;
148 strcpy(sparc_ebus_dmas[slot].info.name, "parport");
149 if (ebus_dma_register(&sparc_ebus_dmas[slot].info))
150 goto out_unmap_regs;
151
152 ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1);
153
154 /* Configure IRQ to Push Pull, Level Low */
155 /* Enable ECP, set bit 2 of the CTR first */
156 outb(0x04, base + 0x02);
157 ns87303_modify(config, PCR,
158 PCR_EPP_ENABLE |
159 PCR_IRQ_ODRAIN,
160 PCR_ECP_ENABLE |
161 PCR_ECP_CLK_ENA |
162 PCR_IRQ_POLAR);
163
164 /* CTR bit 5 controls direction of port */
165 ns87303_modify(config, PTR,
166 0, PTR_LPT_REG_DIR);
167
168 p = parport_pc_probe_port(base, base + 0x400,
169 op->irqs[0],
170 slot,
171 op->dev.parent);
172 err = -ENOMEM;
173 if (!p)
174 goto out_disable_irq;
175
176 dev_set_drvdata(&op->dev, p);
177
116 return 0; 178 return 0;
179
180out_disable_irq:
181 ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
182 ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
183
184out_unmap_regs:
185 of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len);
186
187out_clear_map:
188 clear_bit(slot, dma_slot_map);
189
190out_err:
191 return err;
117} 192}
118 193
119static int parport_isa_probe(int count) 194static int __devexit ecpp_remove(struct of_device *op)
120{ 195{
121 struct sparc_isa_bridge *isa_br; 196 struct parport *p = dev_get_drvdata(&op->dev);
122 struct sparc_isa_device *isa_dev; 197 int slot = p->dma;
123 198
124 for_each_isa(isa_br) { 199 parport_pc_unregister_port(p);
125 for_each_isadev(isa_dev, isa_br) { 200
126 struct sparc_isa_device *child; 201 if (slot != PARPORT_DMA_NOFIFO) {
127 unsigned long base; 202 unsigned long d_base = op->resource[2].start;
128 203 unsigned long d_len;
129 if (strcmp(isa_dev->prom_node->name, "dma")) 204
130 continue; 205 d_len = (op->resource[2].end - d_base) + 1UL;
131 206
132 child = isa_dev->child; 207 ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
133 while (child) { 208 ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
134 if (!strcmp(child->prom_node->name, "parallel")) 209 of_iounmap(&op->resource[2],
135 break; 210 sparc_ebus_dmas[slot].info.regs,
136 child = child->next; 211 d_len);
137 } 212 clear_bit(slot, dma_slot_map);
138 if (!child)
139 continue;
140
141 base = child->resource.start;
142
143 /* No DMA, see commentary in
144 * asm-sparc64/floppy.h:isa_floppy_init()
145 */
146 if (parport_pc_probe_port(base, base + 0x400,
147 child->irq, PARPORT_DMA_NOFIFO,
148 &child->bus->self->dev))
149 count++;
150 }
151 } 213 }
152 214
153 return count; 215 return 0;
154} 216}
155 217
156static int parport_pc_find_nonpci_ports (int autoirq, int autodma) 218static struct of_device_id ecpp_match[] = {
219 {
220 .name = "ecpp",
221 },
222 {
223 .name = "parallel",
224 .compatible = "ecpp",
225 },
226 {
227 .name = "parallel",
228 .compatible = "ns87317-ecpp",
229 },
230 {},
231};
232
233static struct of_platform_driver ecpp_driver = {
234 .name = "ecpp",
235 .match_table = ecpp_match,
236 .probe = ecpp_probe,
237 .remove = __devexit_p(ecpp_remove),
238};
239
240static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
157{ 241{
158 struct linux_ebus *ebus; 242 of_register_driver(&ecpp_driver, &of_bus_type);
159 struct linux_ebus_device *edev;
160 int count = 0;
161
162 for_each_ebus(ebus) {
163 for_each_ebusdev(edev, ebus) {
164 if (ebus_ecpp_p(edev)) {
165 unsigned long base = edev->resource[0].start;
166 unsigned long config = edev->resource[1].start;
167 unsigned long d_base = edev->resource[2].start;
168 unsigned long d_len;
169
170 spin_lock_init(&sparc_ebus_dmas[count].info.lock);
171 d_len = (edev->resource[2].end -
172 d_base) + 1;
173 sparc_ebus_dmas[count].info.regs =
174 ioremap(d_base, d_len);
175 if (!sparc_ebus_dmas[count].info.regs)
176 continue;
177 sparc_ebus_dmas[count].info.flags = 0;
178 sparc_ebus_dmas[count].info.callback = NULL;
179 sparc_ebus_dmas[count].info.client_cookie = NULL;
180 sparc_ebus_dmas[count].info.irq = 0xdeadbeef;
181 strcpy(sparc_ebus_dmas[count].info.name, "parport");
182 if (ebus_dma_register(&sparc_ebus_dmas[count].info))
183 continue;
184 ebus_dma_irq_enable(&sparc_ebus_dmas[count].info, 1);
185
186 /* Configure IRQ to Push Pull, Level Low */
187 /* Enable ECP, set bit 2 of the CTR first */
188 outb(0x04, base + 0x02);
189 ns87303_modify(config, PCR,
190 PCR_EPP_ENABLE |
191 PCR_IRQ_ODRAIN,
192 PCR_ECP_ENABLE |
193 PCR_ECP_CLK_ENA |
194 PCR_IRQ_POLAR);
195
196 /* CTR bit 5 controls direction of port */
197 ns87303_modify(config, PTR,
198 0, PTR_LPT_REG_DIR);
199
200 if (parport_pc_probe_port(base, base + 0x400,
201 edev->irqs[0],
202 count,
203 &ebus->self->dev))
204 count++;
205 }
206 }
207 }
208 243
209 count = parport_isa_probe(count); 244 return 0;
210
211 return count;
212} 245}
213 246
214#endif /* !(_ASM_SPARC64_PARPORT_H */ 247#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index 88db872ce2f8..caf8750792ff 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -18,6 +18,11 @@ extern unsigned long __per_cpu_shift;
18#define DEFINE_PER_CPU(type, name) \ 18#define DEFINE_PER_CPU(type, name) \
19 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 19 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
20 20
21#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
22 __attribute__((__section__(".data.percpu.shared_aligned"))) \
23 __typeof__(type) per_cpu__##name \
24 ____cacheline_aligned_in_smp
25
21register unsigned long __local_per_cpu_offset asm("g5"); 26register unsigned long __local_per_cpu_offset asm("g5");
22 27
23/* var is in discarded region: offset to particular copy we want */ 28/* var is in discarded region: offset to particular copy we want */
@@ -38,6 +43,8 @@ do { \
38#define real_setup_per_cpu_areas() do { } while (0) 43#define real_setup_per_cpu_areas() do { } while (0)
39#define DEFINE_PER_CPU(type, name) \ 44#define DEFINE_PER_CPU(type, name) \
40 __typeof__(type) per_cpu__##name 45 __typeof__(type) per_cpu__##name
46#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
47 DEFINE_PER_CPU(type, name)
41 48
42#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 49#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
43#define __get_cpu_var(var) per_cpu__##var 50#define __get_cpu_var(var) per_cpu__##var
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 9e80ad43b29c..0393380d754a 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -573,24 +573,6 @@ static inline unsigned long pte_exec(pte_t pte)
573 return (pte_val(pte) & mask); 573 return (pte_val(pte) & mask);
574} 574}
575 575
576static inline unsigned long pte_read(pte_t pte)
577{
578 unsigned long mask;
579
580 __asm__ __volatile__(
581 "\n661: mov %1, %0\n"
582 " nop\n"
583 " .section .sun4v_2insn_patch, \"ax\"\n"
584 " .word 661b\n"
585 " sethi %%uhi(%2), %0\n"
586 " sllx %0, 32, %0\n"
587 " .previous\n"
588 : "=r" (mask)
589 : "i" (_PAGE_READ_4U), "i" (_PAGE_READ_4V));
590
591 return (pte_val(pte) & mask);
592}
593
594static inline unsigned long pte_file(pte_t pte) 576static inline unsigned long pte_file(pte_t pte)
595{ 577{
596 unsigned long val = pte_val(pte); 578 unsigned long val = pte_val(pte);
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index b4df3042add0..31dcb92fbae0 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -2,7 +2,6 @@
2#define _SPARC64_PROM_H 2#define _SPARC64_PROM_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5
6/* 5/*
7 * Definitions for talking to the Open Firmware PROM on 6 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers. 7 * Power Macintosh computers.
@@ -17,11 +16,17 @@
17 * as published by the Free Software Foundation; either version 16 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
19 */ 18 */
20
21#include <linux/types.h> 19#include <linux/types.h>
22#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
23#include <asm/atomic.h> 21#include <asm/atomic.h>
24 22
23#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2
24#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
25
26#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
27#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
28#define of_node_cmp(s1, s2) strcmp((s1), (s2))
29
25typedef u32 phandle; 30typedef u32 phandle;
26typedef u32 ihandle; 31typedef u32 ihandle;
27 32
@@ -63,54 +68,35 @@ struct of_irq_controller {
63 void *data; 68 void *data;
64}; 69};
65 70
66/* flag descriptions */
67#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
68
69#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 71#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
70#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 72#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
71 73
72#define OF_BAD_ADDR ((u64)-1)
73
74static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
75{
76 dn->pde = de;
77}
78
79extern struct device_node *of_find_node_by_name(struct device_node *from,
80 const char *name);
81#define for_each_node_by_name(dn, name) \
82 for (dn = of_find_node_by_name(NULL, name); dn; \
83 dn = of_find_node_by_name(dn, name))
84extern struct device_node *of_find_node_by_type(struct device_node *from,
85 const char *type);
86#define for_each_node_by_type(dn, type) \
87 for (dn = of_find_node_by_type(NULL, type); dn; \
88 dn = of_find_node_by_type(dn, type))
89extern struct device_node *of_find_compatible_node(struct device_node *from,
90 const char *type, const char *compat);
91extern struct device_node *of_find_node_by_path(const char *path);
92extern struct device_node *of_find_node_by_phandle(phandle handle);
93extern struct device_node *of_find_node_by_cpuid(int cpuid); 74extern struct device_node *of_find_node_by_cpuid(int cpuid);
94extern struct device_node *of_get_parent(const struct device_node *node);
95extern struct device_node *of_get_next_child(const struct device_node *node,
96 struct device_node *prev);
97extern struct property *of_find_property(const struct device_node *np,
98 const char *name,
99 int *lenp);
100extern int of_device_is_compatible(const struct device_node *device,
101 const char *);
102extern const void *of_get_property(const struct device_node *node,
103 const char *name,
104 int *lenp);
105#define get_property(node,name,lenp) of_get_property(node,name,lenp)
106extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 75extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
107extern int of_getintprop_default(struct device_node *np, 76extern int of_getintprop_default(struct device_node *np,
108 const char *name, 77 const char *name,
109 int def); 78 int def);
110extern int of_n_addr_cells(struct device_node *np);
111extern int of_n_size_cells(struct device_node *np);
112 79
113extern void prom_build_devicetree(void); 80extern void prom_build_devicetree(void);
114 81
82/* Dummy ref counting routines - to be implemented later */
83static inline struct device_node *of_node_get(struct device_node *node)
84{
85 return node;
86}
87static inline void of_node_put(struct device_node *node)
88{
89}
90
91/*
92 * NB: This is here while we transition from using asm/prom.h
93 * to linux/of.h
94 */
95#include <linux/of.h>
96
97extern struct device_node *of_console_device;
98extern char *of_console_path;
99extern char *of_console_options;
100
115#endif /* __KERNEL__ */ 101#endif /* __KERNEL__ */
116#endif /* _SPARC64_PROM_H */ 102#endif /* _SPARC64_PROM_H */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 4fb8c4bfb848..e8a96a31761b 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -29,9 +29,6 @@
29#include <asm/bitops.h> 29#include <asm/bitops.h>
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31 31
32extern cpumask_t phys_cpu_present_map;
33#define cpu_possible_map phys_cpu_present_map
34
35extern cpumask_t cpu_sibling_map[NR_CPUS]; 32extern cpumask_t cpu_sibling_map[NR_CPUS];
36extern cpumask_t cpu_core_map[NR_CPUS]; 33extern cpumask_t cpu_core_map[NR_CPUS];
37extern int sparc64_multi_core; 34extern int sparc64_multi_core;
@@ -44,7 +41,12 @@ extern int hard_smp_processor_id(void);
44#define raw_smp_processor_id() (current_thread_info()->cpu) 41#define raw_smp_processor_id() (current_thread_info()->cpu)
45 42
46extern void smp_fill_in_sib_core_maps(void); 43extern void smp_fill_in_sib_core_maps(void);
47extern unsigned char boot_cpu_id; 44extern void cpu_play_dead(void);
45
46#ifdef CONFIG_HOTPLUG_CPU
47extern int __cpu_disable(void);
48extern void __cpu_die(unsigned int cpu);
49#endif
48 50
49#endif /* !(__ASSEMBLY__) */ 51#endif /* !(__ASSEMBLY__) */
50 52
@@ -52,7 +54,6 @@ extern unsigned char boot_cpu_id;
52 54
53#define hard_smp_processor_id() 0 55#define hard_smp_processor_id() 0
54#define smp_fill_in_sib_core_maps() do { } while (0) 56#define smp_fill_in_sib_core_maps() do { } while (0)
55#define boot_cpu_id (0)
56 57
57#endif /* !(CONFIG_SMP) */ 58#endif /* !(CONFIG_SMP) */
58 59
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 8ba380ec6daa..64891cb10f05 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -115,14 +115,8 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
115#ifndef __ASSEMBLY__ 115#ifndef __ASSEMBLY__
116 116
117extern void sun_do_break(void); 117extern void sun_do_break(void);
118extern int serial_console;
119extern int stop_a_enabled; 118extern int stop_a_enabled;
120 119
121static __inline__ int con_is_present(void)
122{
123 return serial_console ? 0 : 1;
124}
125
126extern void synchronize_user_stack(void); 120extern void synchronize_user_stack(void);
127 121
128extern void __flushw_user(void); 122extern void __flushw_user(void);
@@ -204,16 +198,6 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
204 } \ 198 } \
205} while(0) 199} while(0)
206 200
207/*
208 * On SMP systems, when the scheduler does migration-cost autodetection,
209 * it needs a way to flush as much of the CPU's caches as possible.
210 *
211 * TODO: fill this in!
212 */
213static inline void sched_cacheflush(void)
214{
215}
216
217static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) 201static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val)
218{ 202{
219 unsigned long tmp1, tmp2; 203 unsigned long tmp1, tmp2;
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 53e96ed9c024..cb751b4d0f56 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -1,4 +1,3 @@
1/* $Id: unistd.h,v 1.50 2002/02/08 03:57:18 davem Exp $ */
2#ifndef _SPARC64_UNISTD_H 1#ifndef _SPARC64_UNISTD_H
3#define _SPARC64_UNISTD_H 2#define _SPARC64_UNISTD_H
4 3
@@ -9,7 +8,7 @@
9 * think of right now to force the arguments into fixed registers 8 * think of right now to force the arguments into fixed registers
10 * before the trap into the system call with gcc 'asm' statements. 9 * before the trap into the system call with gcc 'asm' statements.
11 * 10 *
12 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
13 * 12 *
14 * SunOS compatibility based upon preliminary work which is: 13 * SunOS compatibility based upon preliminary work which is:
15 * 14 *
@@ -332,8 +331,9 @@
332#define __NR_signalfd 311 331#define __NR_signalfd 311
333#define __NR_timerfd 312 332#define __NR_timerfd 312
334#define __NR_eventfd 313 333#define __NR_eventfd 313
334#define __NR_fallocate 314
335 335
336#define NR_SYSCALLS 314 336#define NR_SYSCALLS 315
337 337
338#ifdef __KERNEL__ 338#ifdef __KERNEL__
339/* sysconf options, for SunOS compatibility */ 339/* sysconf options, for SunOS compatibility */
diff --git a/include/asm-sparc64/vio.h b/include/asm-sparc64/vio.h
new file mode 100644
index 000000000000..f7417e91b170
--- /dev/null
+++ b/include/asm-sparc64/vio.h
@@ -0,0 +1,406 @@
1#ifndef _SPARC64_VIO_H
2#define _SPARC64_VIO_H
3
4#include <linux/kernel.h>
5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
7#include <linux/timer.h>
8#include <linux/spinlock.h>
9#include <linux/completion.h>
10#include <linux/list.h>
11
12#include <asm/ldc.h>
13#include <asm/mdesc.h>
14
15struct vio_msg_tag {
16 u8 type;
17#define VIO_TYPE_CTRL 0x01
18#define VIO_TYPE_DATA 0x02
19#define VIO_TYPE_ERR 0x04
20
21 u8 stype;
22#define VIO_SUBTYPE_INFO 0x01
23#define VIO_SUBTYPE_ACK 0x02
24#define VIO_SUBTYPE_NACK 0x04
25
26 u16 stype_env;
27#define VIO_VER_INFO 0x0001
28#define VIO_ATTR_INFO 0x0002
29#define VIO_DRING_REG 0x0003
30#define VIO_DRING_UNREG 0x0004
31#define VIO_RDX 0x0005
32#define VIO_PKT_DATA 0x0040
33#define VIO_DESC_DATA 0x0041
34#define VIO_DRING_DATA 0x0042
35#define VNET_MCAST_INFO 0x0101
36
37 u32 sid;
38};
39
40struct vio_rdx {
41 struct vio_msg_tag tag;
42 u64 resv[6];
43};
44
45struct vio_ver_info {
46 struct vio_msg_tag tag;
47 u16 major;
48 u16 minor;
49 u8 dev_class;
50#define VDEV_NETWORK 0x01
51#define VDEV_NETWORK_SWITCH 0x02
52#define VDEV_DISK 0x03
53#define VDEV_DISK_SERVER 0x04
54
55 u8 resv1[3];
56 u64 resv2[5];
57};
58
59struct vio_dring_register {
60 struct vio_msg_tag tag;
61 u64 dring_ident;
62 u32 num_descr;
63 u32 descr_size;
64 u16 options;
65#define VIO_TX_DRING 0x0001
66#define VIO_RX_DRING 0x0002
67 u16 resv;
68 u32 num_cookies;
69 struct ldc_trans_cookie cookies[0];
70};
71
72struct vio_dring_unregister {
73 struct vio_msg_tag tag;
74 u64 dring_ident;
75 u64 resv[5];
76};
77
78/* Data transfer modes */
79#define VIO_PKT_MODE 0x01 /* Packet based transfer */
80#define VIO_DESC_MODE 0x02 /* In-band descriptors */
81#define VIO_DRING_MODE 0x03 /* Descriptor rings */
82
83struct vio_dring_data {
84 struct vio_msg_tag tag;
85 u64 seq;
86 u64 dring_ident;
87 u32 start_idx;
88 u32 end_idx;
89 u8 state;
90#define VIO_DRING_ACTIVE 0x01
91#define VIO_DRING_STOPPED 0x02
92
93 u8 __pad1;
94 u16 __pad2;
95 u32 __pad3;
96 u64 __par4[2];
97};
98
99struct vio_dring_hdr {
100 u8 state;
101#define VIO_DESC_FREE 0x01
102#define VIO_DESC_READY 0x02
103#define VIO_DESC_ACCEPTED 0x03
104#define VIO_DESC_DONE 0x04
105 u8 ack;
106#define VIO_ACK_ENABLE 0x01
107#define VIO_ACK_DISABLE 0x00
108
109 u16 __pad1;
110 u32 __pad2;
111};
112
113/* VIO disk specific structures and defines */
114struct vio_disk_attr_info {
115 struct vio_msg_tag tag;
116 u8 xfer_mode;
117 u8 vdisk_type;
118#define VD_DISK_TYPE_SLICE 0x01 /* Slice in block device */
119#define VD_DISK_TYPE_DISK 0x02 /* Entire block device */
120 u16 resv1;
121 u32 vdisk_block_size;
122 u64 operations;
123 u64 vdisk_size;
124 u64 max_xfer_size;
125 u64 resv2[2];
126};
127
128struct vio_disk_desc {
129 struct vio_dring_hdr hdr;
130 u64 req_id;
131 u8 operation;
132#define VD_OP_BREAD 0x01 /* Block read */
133#define VD_OP_BWRITE 0x02 /* Block write */
134#define VD_OP_FLUSH 0x03 /* Flush disk contents */
135#define VD_OP_GET_WCE 0x04 /* Get write-cache status */
136#define VD_OP_SET_WCE 0x05 /* Enable/disable write-cache */
137#define VD_OP_GET_VTOC 0x06 /* Get VTOC */
138#define VD_OP_SET_VTOC 0x07 /* Set VTOC */
139#define VD_OP_GET_DISKGEOM 0x08 /* Get disk geometry */
140#define VD_OP_SET_DISKGEOM 0x09 /* Set disk geometry */
141#define VD_OP_SCSICMD 0x0a /* SCSI control command */
142#define VD_OP_GET_DEVID 0x0b /* Get device ID */
143#define VD_OP_GET_EFI 0x0c /* Get EFI */
144#define VD_OP_SET_EFI 0x0d /* Set EFI */
145 u8 slice;
146 u16 resv1;
147 u32 status;
148 u64 offset;
149 u64 size;
150 u32 ncookies;
151 u32 resv2;
152 struct ldc_trans_cookie cookies[0];
153};
154
155#define VIO_DISK_VNAME_LEN 8
156#define VIO_DISK_ALABEL_LEN 128
157#define VIO_DISK_NUM_PART 8
158
159struct vio_disk_vtoc {
160 u8 volume_name[VIO_DISK_VNAME_LEN];
161 u16 sector_size;
162 u16 num_partitions;
163 u8 ascii_label[VIO_DISK_ALABEL_LEN];
164 struct {
165 u16 id;
166 u16 perm_flags;
167 u32 resv;
168 u64 start_block;
169 u64 num_blocks;
170 } partitions[VIO_DISK_NUM_PART];
171};
172
173struct vio_disk_geom {
174 u16 num_cyl; /* Num data cylinders */
175 u16 alt_cyl; /* Num alternate cylinders */
176 u16 beg_cyl; /* Cyl off of fixed head area */
177 u16 num_hd; /* Num heads */
178 u16 num_sec; /* Num sectors */
179 u16 ifact; /* Interleave factor */
180 u16 apc; /* Alts per cylinder (SCSI) */
181 u16 rpm; /* Revolutions per minute */
182 u16 phy_cyl; /* Num physical cylinders */
183 u16 wr_skip; /* Num sects to skip, writes */
184 u16 rd_skip; /* Num sects to skip, writes */
185};
186
187struct vio_disk_devid {
188 u16 resv;
189 u16 type;
190 u32 len;
191 char id[0];
192};
193
194struct vio_disk_efi {
195 u64 lba;
196 u64 len;
197 char data[0];
198};
199
200/* VIO net specific structures and defines */
201struct vio_net_attr_info {
202 struct vio_msg_tag tag;
203 u8 xfer_mode;
204 u8 addr_type;
205#define VNET_ADDR_ETHERMAC 0x01
206 u16 ack_freq;
207 u32 resv1;
208 u64 addr;
209 u64 mtu;
210 u64 resv2[3];
211};
212
213#define VNET_NUM_MCAST 7
214
215struct vio_net_mcast_info {
216 struct vio_msg_tag tag;
217 u8 set;
218 u8 count;
219 u8 mcast_addr[VNET_NUM_MCAST * 6];
220 u32 resv;
221};
222
223struct vio_net_desc {
224 struct vio_dring_hdr hdr;
225 u32 size;
226 u32 ncookies;
227 struct ldc_trans_cookie cookies[0];
228};
229
230#define VIO_MAX_RING_COOKIES 24
231
232struct vio_dring_state {
233 u64 ident;
234 void *base;
235 u64 snd_nxt;
236 u64 rcv_nxt;
237 u32 entry_size;
238 u32 num_entries;
239 u32 prod;
240 u32 cons;
241 u32 pending;
242 int ncookies;
243 struct ldc_trans_cookie cookies[VIO_MAX_RING_COOKIES];
244};
245
246static inline void *vio_dring_cur(struct vio_dring_state *dr)
247{
248 return dr->base + (dr->entry_size * dr->prod);
249}
250
251static inline void *vio_dring_entry(struct vio_dring_state *dr,
252 unsigned int index)
253{
254 return dr->base + (dr->entry_size * index);
255}
256
257static inline u32 vio_dring_avail(struct vio_dring_state *dr,
258 unsigned int ring_size)
259{
260 /* Ensure build-time power-of-2. */
261 BUILD_BUG_ON(ring_size & (ring_size - 1));
262
263 return (dr->pending -
264 ((dr->prod - dr->cons) & (ring_size - 1)));
265}
266
267#define VIO_MAX_TYPE_LEN 32
268#define VIO_MAX_COMPAT_LEN 64
269
270struct vio_dev {
271 u64 mp;
272 struct device_node *dp;
273
274 char type[VIO_MAX_TYPE_LEN];
275 char compat[VIO_MAX_COMPAT_LEN];
276 int compat_len;
277
278 u64 dev_no;
279
280 unsigned long channel_id;
281
282 unsigned int tx_irq;
283 unsigned int rx_irq;
284
285 struct device dev;
286};
287
288struct vio_driver {
289 struct list_head node;
290 const struct vio_device_id *id_table;
291 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
292 int (*remove)(struct vio_dev *dev);
293 void (*shutdown)(struct vio_dev *dev);
294 unsigned long driver_data;
295 struct device_driver driver;
296};
297
298struct vio_version {
299 u16 major;
300 u16 minor;
301};
302
303struct vio_driver_state;
304struct vio_driver_ops {
305 int (*send_attr)(struct vio_driver_state *vio);
306 int (*handle_attr)(struct vio_driver_state *vio, void *pkt);
307 void (*handshake_complete)(struct vio_driver_state *vio);
308};
309
310struct vio_completion {
311 struct completion com;
312 int err;
313 int waiting_for;
314};
315
316struct vio_driver_state {
317 /* Protects VIO handshake and, optionally, driver private state. */
318 spinlock_t lock;
319
320 struct ldc_channel *lp;
321
322 u32 _peer_sid;
323 u32 _local_sid;
324 struct vio_dring_state drings[2];
325#define VIO_DRIVER_TX_RING 0
326#define VIO_DRIVER_RX_RING 1
327
328 u8 hs_state;
329#define VIO_HS_INVALID 0x00
330#define VIO_HS_GOTVERS 0x01
331#define VIO_HS_GOT_ATTR 0x04
332#define VIO_HS_SENT_DREG 0x08
333#define VIO_HS_SENT_RDX 0x10
334#define VIO_HS_GOT_RDX_ACK 0x20
335#define VIO_HS_GOT_RDX 0x40
336#define VIO_HS_SENT_RDX_ACK 0x80
337#define VIO_HS_COMPLETE (VIO_HS_GOT_RDX_ACK | VIO_HS_SENT_RDX_ACK)
338
339 u8 dev_class;
340
341 u8 dr_state;
342#define VIO_DR_STATE_TXREG 0x01
343#define VIO_DR_STATE_RXREG 0x02
344#define VIO_DR_STATE_TXREQ 0x10
345#define VIO_DR_STATE_RXREQ 0x20
346
347 u8 debug;
348#define VIO_DEBUG_HS 0x01
349#define VIO_DEBUG_DATA 0x02
350
351 void *desc_buf;
352 unsigned int desc_buf_len;
353
354 struct vio_completion *cmp;
355
356 struct vio_dev *vdev;
357
358 struct timer_list timer;
359
360 struct vio_version ver;
361
362 struct vio_version *ver_table;
363 int ver_table_entries;
364
365 char *name;
366
367 struct vio_driver_ops *ops;
368};
369
370#define viodbg(TYPE, f, a...) \
371do { if (vio->debug & VIO_DEBUG_##TYPE) \
372 printk(KERN_INFO "vio: ID[%lu] " f, \
373 vio->vdev->channel_id, ## a); \
374} while (0)
375
376extern int vio_register_driver(struct vio_driver *drv);
377extern void vio_unregister_driver(struct vio_driver *drv);
378
379static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
380{
381 return container_of(drv, struct vio_driver, driver);
382}
383
384static inline struct vio_dev *to_vio_dev(struct device *dev)
385{
386 return container_of(dev, struct vio_dev, dev);
387}
388
389extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len);
390extern void vio_link_state_change(struct vio_driver_state *vio, int event);
391extern void vio_conn_reset(struct vio_driver_state *vio);
392extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt);
393extern int vio_validate_sid(struct vio_driver_state *vio,
394 struct vio_msg_tag *tp);
395extern u32 vio_send_sid(struct vio_driver_state *vio);
396extern int vio_ldc_alloc(struct vio_driver_state *vio,
397 struct ldc_channel_config *base_cfg, void *event_arg);
398extern void vio_ldc_free(struct vio_driver_state *vio);
399extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
400 u8 dev_class, struct vio_version *ver_table,
401 int ver_table_size, struct vio_driver_ops *ops,
402 char *name);
403
404extern void vio_port_up(struct vio_driver_state *vio);
405
406#endif /* _SPARC64_VIO_H */
diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h
index 7016b893ac9d..78bc9eed26b2 100644
--- a/include/asm-um/a.out.h
+++ b/include/asm-um/a.out.h
@@ -17,4 +17,6 @@ extern int honeypot;
17#define STACK_TOP \ 17#define STACK_TOP \
18 CHOOSE_MODE((honeypot ? host_task_size : task_size), task_size) 18 CHOOSE_MODE((honeypot ? host_task_size : task_size), task_size)
19 19
20#define STACK_TOP_MAX STACK_TOP
21
20#endif 22#endif
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index 1b1090a91a58..830fc6e5d49d 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -175,12 +175,6 @@ static inline int pte_none(pte_t pte)
175 * The following only work if pte_present() is true. 175 * The following only work if pte_present() is true.
176 * Undefined behaviour if not.. 176 * Undefined behaviour if not..
177 */ 177 */
178static inline int pte_user(pte_t pte)
179{
180 return((pte_get_bits(pte, _PAGE_USER)) &&
181 !(pte_get_bits(pte, _PAGE_PROTNONE)));
182}
183
184static inline int pte_read(pte_t pte) 178static inline int pte_read(pte_t pte)
185{ 179{
186 return((pte_get_bits(pte, _PAGE_USER)) && 180 return((pte_get_bits(pte, _PAGE_USER)) &&
@@ -238,18 +232,6 @@ static inline pte_t pte_mknewprot(pte_t pte)
238 return(pte); 232 return(pte);
239} 233}
240 234
241static inline pte_t pte_rdprotect(pte_t pte)
242{
243 pte_clear_bits(pte, _PAGE_USER);
244 return(pte_mknewprot(pte));
245}
246
247static inline pte_t pte_exprotect(pte_t pte)
248{
249 pte_clear_bits(pte, _PAGE_USER);
250 return(pte_mknewprot(pte));
251}
252
253static inline pte_t pte_mkclean(pte_t pte) 235static inline pte_t pte_mkclean(pte_t pte)
254{ 236{
255 pte_clear_bits(pte, _PAGE_DIRTY); 237 pte_clear_bits(pte, _PAGE_DIRTY);
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
index 18a13ba74605..6e5fd5c892d0 100644
--- a/include/asm-um/thread_info.h
+++ b/include/asm-um/thread_info.h
@@ -52,10 +52,21 @@ static inline struct thread_info *current_thread_info(void)
52 return ti; 52 return ti;
53} 53}
54 54
55#ifdef CONFIG_DEBUG_STACK_USAGE
56
57#define alloc_thread_info(tsk) \
58 ((struct thread_info *) __get_free_pages(GFP_KERNEL | __GFP_ZERO, \
59 CONFIG_KERNEL_STACK_ORDER))
60#else
61
55/* thread information allocation */ 62/* thread information allocation */
56#define alloc_thread_info(tsk) \ 63#define alloc_thread_info(tsk) \
57 ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL)) 64 ((struct thread_info *) __get_free_pages(GFP_KERNEL, \
58#define free_thread_info(ti) kfree(ti) 65 CONFIG_KERNEL_STACK_ORDER))
66#endif
67
68#define free_thread_info(ti) \
69 free_pages((unsigned long)(ti),CONFIG_KERNEL_STACK_ORDER)
59 70
60#endif 71#endif
61 72
diff --git a/include/asm-v850/fb.h b/include/asm-v850/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-v850/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-v850/ioctls.h b/include/asm-v850/ioctls.h
index 05c0dc9ce1ea..5313abd5f388 100644
--- a/include/asm-v850/ioctls.h
+++ b/include/asm-v850/ioctls.h
@@ -46,6 +46,10 @@
46#define TIOCSBRK 0x5427 /* BSD compatibility */ 46#define TIOCSBRK 0x5427 /* BSD compatibility */
47#define TIOCCBRK 0x5428 /* BSD compatibility */ 47#define TIOCCBRK 0x5428 /* BSD compatibility */
48#define TIOCGSID 0x5429 /* Return the session ID of FD */ 48#define TIOCGSID 0x5429 /* Return the session ID of FD */
49#define TCGETS2 _IOR('T',0x2A, struct termios2)
50#define TCSETS2 _IOW('T',0x2B, struct termios2)
51#define TCSETSW2 _IOW('T',0x2C, struct termios2)
52#define TCSETSF2 _IOW('T',0x2D, struct termios2)
49#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 53#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
50#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 54#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
51 55
diff --git a/include/asm-v850/termbits.h b/include/asm-v850/termbits.h
index 35412f7f3eea..295d7bf69451 100644
--- a/include/asm-v850/termbits.h
+++ b/include/asm-v850/termbits.h
@@ -141,6 +141,7 @@ struct ktermios {
141#define HUPCL 0002000 141#define HUPCL 0002000
142#define CLOCAL 0004000 142#define CLOCAL 0004000
143#define CBAUDEX 0010000 143#define CBAUDEX 0010000
144#define BOTHER 0010000
144#define B57600 0010001 145#define B57600 0010001
145#define B115200 0010002 146#define B115200 0010002
146#define B230400 0010003 147#define B230400 0010003
@@ -156,10 +157,12 @@ struct ktermios {
156#define B3000000 0010015 157#define B3000000 0010015
157#define B3500000 0010016 158#define B3500000 0010016
158#define B4000000 0010017 159#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate (not used) */ 160#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */ 161#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */ 162#define CRTSCTS 020000000000 /* flow control */
162 163
164#define IBSHIFT 16 /* Shifr from CBAUD to CIBAUD */
165
163/* c_lflag bits */ 166/* c_lflag bits */
164#define ISIG 0000001 167#define ISIG 0000001
165#define ICANON 0000002 168#define ICANON 0000002
diff --git a/include/asm-v850/termios.h b/include/asm-v850/termios.h
index c2c2b1d58776..fcd171838d9c 100644
--- a/include/asm-v850/termios.h
+++ b/include/asm-v850/termios.h
@@ -80,8 +80,10 @@ struct termio {
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
81}) 81})
82 82
83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
85#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
86#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
85 87
86#endif /* __KERNEL__ */ 88#endif /* __KERNEL__ */
87 89
diff --git a/include/asm-x86_64/a.out.h b/include/asm-x86_64/a.out.h
index 7255cde06538..e789300e41a5 100644
--- a/include/asm-x86_64/a.out.h
+++ b/include/asm-x86_64/a.out.h
@@ -21,7 +21,8 @@ struct exec
21 21
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23#include <linux/thread_info.h> 23#include <linux/thread_info.h>
24#define STACK_TOP TASK_SIZE 24#define STACK_TOP TASK_SIZE
25#define STACK_TOP_MAX TASK_SIZE64
25#endif 26#endif
26 27
27#endif /* __A_OUT_GNU_H__ */ 28#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index a29f05087a31..1da8f49c0fe2 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -29,6 +29,7 @@
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30 30
31#include <acpi/pdc_intel.h> 31#include <acpi/pdc_intel.h>
32#include <asm/numa.h>
32 33
33#define COMPILER_DEPENDENT_INT64 long long 34#define COMPILER_DEPENDENT_INT64 long long
34#define COMPILER_DEPENDENT_UINT64 unsigned long long 35#define COMPILER_DEPENDENT_UINT64 unsigned long long
@@ -141,6 +142,16 @@ extern int acpi_pci_disabled;
141extern int acpi_skip_timer_override; 142extern int acpi_skip_timer_override;
142extern int acpi_use_timer_override; 143extern int acpi_use_timer_override;
143 144
145#ifdef CONFIG_ACPI_NUMA
146extern void __init acpi_fake_nodes(const struct bootnode *fake_nodes,
147 int num_nodes);
148#else
149static inline void acpi_fake_nodes(const struct bootnode *fake_nodes,
150 int num_nodes)
151{
152}
153#endif
154
144#endif /*__KERNEL__*/ 155#endif /*__KERNEL__*/
145 156
146#endif /*_ASM_ACPI_H*/ 157#endif /*_ASM_ACPI_H*/
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h
index eea7aecfac78..ab161e810151 100644
--- a/include/asm-x86_64/alternative.h
+++ b/include/asm-x86_64/alternative.h
@@ -154,4 +154,6 @@ apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end)
154#define __parainstructions_end NULL 154#define __parainstructions_end NULL
155#endif 155#endif
156 156
157extern void text_poke(void *addr, unsigned char *opcode, int len);
158
157#endif /* _X86_64_ALTERNATIVE_H */ 159#endif /* _X86_64_ALTERNATIVE_H */
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index 45e9fca1febc..85125ef3c414 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -83,8 +83,10 @@ extern void disable_APIC_timer(void);
83extern void enable_APIC_timer(void); 83extern void enable_APIC_timer(void);
84extern void setup_apic_routing(void); 84extern void setup_apic_routing(void);
85 85
86extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector, 86extern void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
87 unsigned char msg_type, unsigned char mask); 87 unsigned char msg_type, unsigned char mask);
88
89extern int apic_is_clustered_box(void);
88 90
89#define K8_APIC_EXT_LVT_BASE 0x500 91#define K8_APIC_EXT_LVT_BASE 0x500
90#define K8_APIC_EXT_INT_MSG_FIX 0x0 92#define K8_APIC_EXT_INT_MSG_FIX 0x0
diff --git a/include/asm-x86_64/auxvec.h b/include/asm-x86_64/auxvec.h
index 2403c4cfced2..1d5ab0d03950 100644
--- a/include/asm-x86_64/auxvec.h
+++ b/include/asm-x86_64/auxvec.h
@@ -1,4 +1,6 @@
1#ifndef __ASM_X86_64_AUXVEC_H 1#ifndef __ASM_X86_64_AUXVEC_H
2#define __ASM_X86_64_AUXVEC_H 2#define __ASM_X86_64_AUXVEC_H
3 3
4#define AT_SYSINFO_EHDR 33
5
4#endif 6#endif
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h
index 4d5747a0923c..67f60406e2d8 100644
--- a/include/asm-x86_64/calgary.h
+++ b/include/asm-x86_64/calgary.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Derived from include/asm-powerpc/iommu.h 2 * Derived from include/asm-powerpc/iommu.h
3 * 3 *
4 * Copyright (C) IBM Corporation, 2006 4 * Copyright IBM Corporation, 2006-2007
5 * 5 *
6 * Author: Jon Mason <jdmason@us.ibm.com> 6 * Author: Jon Mason <jdmason@us.ibm.com>
7 * Author: Muli Ben-Yehuda <muli@il.ibm.com> 7 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
@@ -31,6 +31,7 @@
31#include <asm/types.h> 31#include <asm/types.h>
32 32
33struct iommu_table { 33struct iommu_table {
34 struct cal_chipset_ops *chip_ops; /* chipset specific funcs */
34 unsigned long it_base; /* mapped address of tce table */ 35 unsigned long it_base; /* mapped address of tce table */
35 unsigned long it_hint; /* Hint for next alloc */ 36 unsigned long it_hint; /* Hint for next alloc */
36 unsigned long *it_map; /* A simple allocation bitmap for now */ 37 unsigned long *it_map; /* A simple allocation bitmap for now */
@@ -42,6 +43,12 @@ struct iommu_table {
42 unsigned char it_busno; /* Bus number this table belongs to */ 43 unsigned char it_busno; /* Bus number this table belongs to */
43}; 44};
44 45
46struct cal_chipset_ops {
47 void (*handle_quirks)(struct iommu_table *tbl, struct pci_dev *dev);
48 void (*tce_cache_blast)(struct iommu_table *tbl);
49 void (*dump_error_regs)(struct iommu_table *tbl);
50};
51
45#define TCE_TABLE_SIZE_UNSPECIFIED ~0 52#define TCE_TABLE_SIZE_UNSPECIFIED ~0
46#define TCE_TABLE_SIZE_64K 0 53#define TCE_TABLE_SIZE_64K 0
47#define TCE_TABLE_SIZE_128K 1 54#define TCE_TABLE_SIZE_128K 1
diff --git a/include/asm-x86_64/cmpxchg.h b/include/asm-x86_64/cmpxchg.h
index 09a6b6b6b74d..5e182062e6ec 100644
--- a/include/asm-x86_64/cmpxchg.h
+++ b/include/asm-x86_64/cmpxchg.h
@@ -128,7 +128,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
128 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 128 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
129 (unsigned long)(n),sizeof(*(ptr)))) 129 (unsigned long)(n),sizeof(*(ptr))))
130#define cmpxchg_local(ptr,o,n)\ 130#define cmpxchg_local(ptr,o,n)\
131 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 131 ((__typeof__(*(ptr)))__cmpxchg_local((ptr),(unsigned long)(o),\
132 (unsigned long)(n),sizeof(*(ptr)))) 132 (unsigned long)(n),sizeof(*(ptr))))
133 133
134#endif 134#endif
diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
index b37ab8218ef0..53cb96b68a62 100644
--- a/include/asm-x86_64/compat.h
+++ b/include/asm-x86_64/compat.h
@@ -33,8 +33,10 @@ typedef s32 compat_key_t;
33 33
34typedef s32 compat_int_t; 34typedef s32 compat_int_t;
35typedef s32 compat_long_t; 35typedef s32 compat_long_t;
36typedef s64 __attribute__((aligned(4))) compat_s64;
36typedef u32 compat_uint_t; 37typedef u32 compat_uint_t;
37typedef u32 compat_ulong_t; 38typedef u32 compat_ulong_t;
39typedef u64 __attribute__((aligned(4))) compat_u64;
38 40
39struct compat_timespec { 41struct compat_timespec {
40 compat_time_t tv_sec; 42 compat_time_t tv_sec;
diff --git a/include/asm-x86_64/dmi.h b/include/asm-x86_64/dmi.h
index 93b2b15d4325..d02e32e3c3f0 100644
--- a/include/asm-x86_64/dmi.h
+++ b/include/asm-x86_64/dmi.h
@@ -3,15 +3,12 @@
3 3
4#include <asm/io.h> 4#include <asm/io.h>
5 5
6extern void *dmi_ioremap(unsigned long addr, unsigned long size);
7extern void dmi_iounmap(void *addr, unsigned long size);
8
9#define DMI_MAX_DATA 2048 6#define DMI_MAX_DATA 2048
10 7
11extern int dmi_alloc_index; 8extern int dmi_alloc_index;
12extern char dmi_alloc_data[DMI_MAX_DATA]; 9extern char dmi_alloc_data[DMI_MAX_DATA];
13 10
14/* This is so early that there is no good way to allocate dynamic memory. 11/* This is so early that there is no good way to allocate dynamic memory.
15 Allocate data in an BSS array. */ 12 Allocate data in an BSS array. */
16static inline void *dmi_alloc(unsigned len) 13static inline void *dmi_alloc(unsigned len)
17{ 14{
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index 6d24ea7c4d9d..b4fbe47f6ccd 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -162,6 +162,19 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
162/* 1GB for 64bit, 8MB for 32bit */ 162/* 1GB for 64bit, 8MB for 32bit */
163#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff) 163#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff)
164 164
165
166#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
167struct linux_binprm;
168extern int arch_setup_additional_pages(struct linux_binprm *bprm,
169 int executable_stack);
170
171extern int vdso_enabled;
172
173#define ARCH_DLINFO \
174do if (vdso_enabled) { \
175 NEW_AUX_ENT(AT_SYSINFO_EHDR,(unsigned long)current->mm->context.vdso);\
176} while (0)
177
165#endif 178#endif
166 179
167#endif 180#endif
diff --git a/include/asm-x86_64/fb.h b/include/asm-x86_64/fb.h
new file mode 100644
index 000000000000..60548e651d12
--- /dev/null
+++ b/include/asm-x86_64/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 if (boot_cpu_data.x86 > 3)
11 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
index e90e1677531b..cdfbe4a6ae6f 100644
--- a/include/asm-x86_64/fixmap.h
+++ b/include/asm-x86_64/fixmap.h
@@ -22,9 +22,9 @@
22 * compile time, but to set the physical address only 22 * compile time, but to set the physical address only
23 * in the boot process. 23 * in the boot process.
24 * 24 *
25 * these 'compile-time allocated' memory buffers are 25 * These 'compile-time allocated' memory buffers are
26 * fixed-size 4k pages. (or larger if used with an increment 26 * fixed-size 4k pages (or larger if used with an increment
27 * highger than 1) use fixmap_set(idx,phys) to associate 27 * higher than 1). Use set_fixmap(idx,phys) to associate
28 * physical memory with fixmap indices. 28 * physical memory with fixmap indices.
29 * 29 *
30 * TLB entries of such buffers will not be flushed across 30 * TLB entries of such buffers will not be flushed across
@@ -35,6 +35,8 @@ enum fixed_addresses {
35 VSYSCALL_LAST_PAGE, 35 VSYSCALL_LAST_PAGE,
36 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, 36 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
37 VSYSCALL_HPET, 37 VSYSCALL_HPET,
38 FIX_DBGP_BASE,
39 FIX_EARLYCON_MEM_BASE,
38 FIX_HPET_BASE, 40 FIX_HPET_BASE,
39 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ 41 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
40 FIX_IO_APIC_BASE_0, 42 FIX_IO_APIC_BASE_0,
@@ -84,7 +86,7 @@ static __always_inline unsigned long fix_to_virt(const unsigned int idx)
84 if (idx >= __end_of_fixed_addresses) 86 if (idx >= __end_of_fixed_addresses)
85 __this_fixmap_does_not_exist(); 87 __this_fixmap_does_not_exist();
86 88
87 return __fix_to_virt(idx); 89 return __fix_to_virt(idx);
88} 90}
89 91
90#endif 92#endif
diff --git a/include/asm-x86_64/hpet.h b/include/asm-x86_64/hpet.h
index 59a66f084611..79bb950f82c5 100644
--- a/include/asm-x86_64/hpet.h
+++ b/include/asm-x86_64/hpet.h
@@ -1,78 +1,18 @@
1#ifndef _ASM_X8664_HPET_H 1#ifndef _ASM_X8664_HPET_H
2#define _ASM_X8664_HPET_H 1 2#define _ASM_X8664_HPET_H 1
3 3
4/* 4#include <asm-i386/hpet.h>
5 * Documentation on HPET can be found at:
6 * http://www.intel.com/ial/home/sp/pcmmspec.htm
7 * ftp://download.intel.com/ial/home/sp/mmts098.pdf
8 */
9
10#define HPET_MMAP_SIZE 1024
11
12#define HPET_ID 0x000
13#define HPET_PERIOD 0x004
14#define HPET_CFG 0x010
15#define HPET_STATUS 0x020
16#define HPET_COUNTER 0x0f0
17#define HPET_Tn_OFFSET 0x20
18#define HPET_Tn_CFG(n) (0x100 + (n) * HPET_Tn_OFFSET)
19#define HPET_Tn_ROUTE(n) (0x104 + (n) * HPET_Tn_OFFSET)
20#define HPET_Tn_CMP(n) (0x108 + (n) * HPET_Tn_OFFSET)
21#define HPET_T0_CFG HPET_Tn_CFG(0)
22#define HPET_T0_CMP HPET_Tn_CMP(0)
23#define HPET_T1_CFG HPET_Tn_CFG(1)
24#define HPET_T1_CMP HPET_Tn_CMP(1)
25
26#define HPET_ID_VENDOR 0xffff0000
27#define HPET_ID_LEGSUP 0x00008000
28#define HPET_ID_64BIT 0x00002000
29#define HPET_ID_NUMBER 0x00001f00
30#define HPET_ID_REV 0x000000ff
31#define HPET_ID_NUMBER_SHIFT 8
32
33#define HPET_ID_VENDOR_SHIFT 16
34#define HPET_ID_VENDOR_8086 0x8086
35
36#define HPET_CFG_ENABLE 0x001
37#define HPET_CFG_LEGACY 0x002
38#define HPET_LEGACY_8254 2
39#define HPET_LEGACY_RTC 8
40
41#define HPET_TN_LEVEL 0x0002
42#define HPET_TN_ENABLE 0x0004
43#define HPET_TN_PERIODIC 0x0008
44#define HPET_TN_PERIODIC_CAP 0x0010
45#define HPET_TN_64BIT_CAP 0x0020
46#define HPET_TN_SETVAL 0x0040
47#define HPET_TN_32BIT 0x0100
48#define HPET_TN_ROUTE 0x3e00
49#define HPET_TN_FSB 0x4000
50#define HPET_TN_FSB_CAP 0x8000
51
52#define HPET_TN_ROUTE_SHIFT 9
53 5
54#define HPET_TICK_RATE (HZ * 100000UL) 6#define HPET_TICK_RATE (HZ * 100000UL)
55 7
56extern int is_hpet_enabled(void);
57extern int hpet_rtc_timer_init(void); 8extern int hpet_rtc_timer_init(void);
58extern int apic_is_clustered_box(void);
59extern int hpet_arch_init(void); 9extern int hpet_arch_init(void);
60extern int hpet_timer_stop_set_go(unsigned long tick); 10extern int hpet_timer_stop_set_go(unsigned long tick);
61extern int hpet_reenable(void); 11extern int hpet_reenable(void);
62extern unsigned int hpet_calibrate_tsc(void); 12extern unsigned int hpet_calibrate_tsc(void);
63 13
64extern int hpet_use_timer; 14extern int hpet_use_timer;
65extern unsigned long hpet_address;
66extern unsigned long hpet_period; 15extern unsigned long hpet_period;
67extern unsigned long hpet_tick; 16extern unsigned long hpet_tick;
68 17
69#ifdef CONFIG_HPET_EMULATE_RTC
70extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
71extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
72extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec);
73extern int hpet_set_periodic_freq(unsigned long freq);
74extern int hpet_rtc_dropped_irq(void);
75extern int hpet_rtc_timer_init(void);
76#endif /* CONFIG_HPET_EMULATE_RTC */
77
78#endif 18#endif
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 6153ae5df2e8..09dfc18a6dd0 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -95,6 +95,26 @@
95 95
96 96
97#ifndef __ASSEMBLY__ 97#ifndef __ASSEMBLY__
98
99/* Interrupt handlers registered during init_IRQ */
100void apic_timer_interrupt(void);
101void spurious_interrupt(void);
102void error_interrupt(void);
103void reschedule_interrupt(void);
104void call_function_interrupt(void);
105void irq_move_cleanup_interrupt(void);
106void invalidate_interrupt0(void);
107void invalidate_interrupt1(void);
108void invalidate_interrupt2(void);
109void invalidate_interrupt3(void);
110void invalidate_interrupt4(void);
111void invalidate_interrupt5(void);
112void invalidate_interrupt6(void);
113void invalidate_interrupt7(void);
114void thermal_interrupt(void);
115void threshold_interrupt(void);
116void i8254_timer_resume(void);
117
98typedef int vector_irq_t[NR_VECTORS]; 118typedef int vector_irq_t[NR_VECTORS];
99DECLARE_PER_CPU(vector_irq_t, vector_irq); 119DECLARE_PER_CPU(vector_irq_t, vector_irq);
100extern void __setup_vector_irq(int cpu); 120extern void __setup_vector_irq(int cpu);
diff --git a/include/asm-x86_64/hypertransport.h b/include/asm-x86_64/hypertransport.h
index c16c6ff4bdd7..5cbf9fa5e0b5 100644
--- a/include/asm-x86_64/hypertransport.h
+++ b/include/asm-x86_64/hypertransport.h
@@ -1,42 +1 @@
1#ifndef ASM_HYPERTRANSPORT_H #include <asm-i386/hypertransport.h>
2#define ASM_HYPERTRANSPORT_H
3
4/*
5 * Constants for x86 Hypertransport Interrupts.
6 */
7
8#define HT_IRQ_LOW_BASE 0xf8000000
9
10#define HT_IRQ_LOW_VECTOR_SHIFT 16
11#define HT_IRQ_LOW_VECTOR_MASK 0x00ff0000
12#define HT_IRQ_LOW_VECTOR(v) (((v) << HT_IRQ_LOW_VECTOR_SHIFT) & HT_IRQ_LOW_VECTOR_MASK)
13
14#define HT_IRQ_LOW_DEST_ID_SHIFT 8
15#define HT_IRQ_LOW_DEST_ID_MASK 0x0000ff00
16#define HT_IRQ_LOW_DEST_ID(v) (((v) << HT_IRQ_LOW_DEST_ID_SHIFT) & HT_IRQ_LOW_DEST_ID_MASK)
17
18#define HT_IRQ_LOW_DM_PHYSICAL 0x0000000
19#define HT_IRQ_LOW_DM_LOGICAL 0x0000040
20
21#define HT_IRQ_LOW_RQEOI_EDGE 0x0000000
22#define HT_IRQ_LOW_RQEOI_LEVEL 0x0000020
23
24
25#define HT_IRQ_LOW_MT_FIXED 0x0000000
26#define HT_IRQ_LOW_MT_ARBITRATED 0x0000004
27#define HT_IRQ_LOW_MT_SMI 0x0000008
28#define HT_IRQ_LOW_MT_NMI 0x000000c
29#define HT_IRQ_LOW_MT_INIT 0x0000010
30#define HT_IRQ_LOW_MT_STARTUP 0x0000014
31#define HT_IRQ_LOW_MT_EXTINT 0x0000018
32#define HT_IRQ_LOW_MT_LINT1 0x000008c
33#define HT_IRQ_LOW_MT_LINT0 0x0000098
34
35#define HT_IRQ_LOW_IRQ_MASKED 0x0000001
36
37
38#define HT_IRQ_HIGH_DEST_ID_SHIFT 0
39#define HT_IRQ_HIGH_DEST_ID_MASK 0x00ffffff
40#define HT_IRQ_HIGH_DEST_ID(v) ((((v) >> 8) << HT_IRQ_HIGH_DEST_ID_SHIFT) & HT_IRQ_HIGH_DEST_ID_MASK)
41
42#endif /* ASM_HYPERTRANSPORT_H */
diff --git a/include/asm-x86_64/i8253.h b/include/asm-x86_64/i8253.h
new file mode 100644
index 000000000000..015d8df07690
--- /dev/null
+++ b/include/asm-x86_64/i8253.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_I8253_H__
2#define __ASM_I8253_H__
3
4extern spinlock_t i8253_lock;
5
6#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index de2cd9a2303a..7475095c5061 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -144,6 +144,7 @@ extern void early_iounmap(void *addr, unsigned long size);
144 */ 144 */
145extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 145extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
146extern void iounmap(volatile void __iomem *addr); 146extern void iounmap(volatile void __iomem *addr);
147extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
147 148
148/* 149/*
149 * ISA I/O bus memory addresses are 1:1 with the physical address. 150 * ISA I/O bus memory addresses are 1:1 with the physical address.
diff --git a/include/asm-x86_64/iommu.h b/include/asm-x86_64/iommu.h
new file mode 100644
index 000000000000..5af471f228ee
--- /dev/null
+++ b/include/asm-x86_64/iommu.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_X8664_IOMMU_H
2#define _ASM_X8664_IOMMU_H 1
3
4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void);
6extern int force_iommu, no_iommu;
7extern int iommu_detected;
8#ifdef CONFIG_IOMMU
9extern void gart_iommu_init(void);
10extern void gart_iommu_shutdown(void);
11extern void __init gart_parse_options(char *);
12extern void iommu_hole_init(void);
13extern int fallback_aper_order;
14extern int fallback_aper_force;
15extern int iommu_aperture;
16extern int iommu_aperture_allowed;
17extern int iommu_aperture_disabled;
18extern int fix_aperture;
19#else
20#define iommu_aperture 0
21#define iommu_aperture_allowed 0
22
23static inline void gart_iommu_shutdown(void)
24{
25}
26
27#endif
28
29#endif
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h
index cf5317898fb0..7db825403e01 100644
--- a/include/asm-x86_64/kprobes.h
+++ b/include/asm-x86_64/kprobes.h
@@ -41,7 +41,6 @@ typedef u8 kprobe_opcode_t;
41 ? (MAX_STACK_SIZE) \ 41 ? (MAX_STACK_SIZE) \
42 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 42 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
43 43
44#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
45#define ARCH_SUPPORTS_KRETPROBES 44#define ARCH_SUPPORTS_KRETPROBES
46#define ARCH_INACTIVE_KPROBE_COUNT 1 45#define ARCH_INACTIVE_KPROBE_COUNT 1
47 46
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index 177e92b4019b..7bc030a1996d 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -105,6 +105,11 @@ extern atomic_t mce_entry;
105 105
106extern void do_machine_check(struct pt_regs *, long); 106extern void do_machine_check(struct pt_regs *, long);
107 107
108extern int mce_notify_user(void);
109
110extern void stop_mce(void);
111extern void restart_mce(void);
112
108#endif 113#endif
109 114
110#endif 115#endif
diff --git a/include/asm-x86_64/mmu.h b/include/asm-x86_64/mmu.h
index 5dc6ed79859a..d2cd4a9d984d 100644
--- a/include/asm-x86_64/mmu.h
+++ b/include/asm-x86_64/mmu.h
@@ -15,6 +15,7 @@ typedef struct {
15 rwlock_t ldtlock; 15 rwlock_t ldtlock;
16 int size; 16 int size;
17 struct semaphore sem; 17 struct semaphore sem;
18 void *vdso;
18} mm_context_t; 19} mm_context_t;
19 20
20#endif 21#endif
diff --git a/include/asm-x86_64/msidef.h b/include/asm-x86_64/msidef.h
index 5b8acddb70fb..083ad5827e48 100644
--- a/include/asm-x86_64/msidef.h
+++ b/include/asm-x86_64/msidef.h
@@ -1,47 +1 @@
1#ifndef ASM_MSIDEF_H #include <asm-i386/msidef.h>
2#define ASM_MSIDEF_H
3
4/*
5 * Constants for Intel APIC based MSI messages.
6 */
7
8/*
9 * Shifts for MSI data
10 */
11
12#define MSI_DATA_VECTOR_SHIFT 0
13#define MSI_DATA_VECTOR_MASK 0x000000ff
14#define MSI_DATA_VECTOR(v) (((v) << MSI_DATA_VECTOR_SHIFT) & MSI_DATA_VECTOR_MASK)
15
16#define MSI_DATA_DELIVERY_MODE_SHIFT 8
17#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_MODE_SHIFT)
18#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_MODE_SHIFT)
19
20#define MSI_DATA_LEVEL_SHIFT 14
21#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT)
22#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT)
23
24#define MSI_DATA_TRIGGER_SHIFT 15
25#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT)
26#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT)
27
28/*
29 * Shift/mask fields for msi address
30 */
31
32#define MSI_ADDR_BASE_HI 0
33#define MSI_ADDR_BASE_LO 0xfee00000
34
35#define MSI_ADDR_DEST_MODE_SHIFT 2
36#define MSI_ADDR_DEST_MODE_PHYSICAL (0 << MSI_ADDR_DEST_MODE_SHIFT)
37#define MSI_ADDR_DEST_MODE_LOGICAL (1 << MSI_ADDR_DEST_MODE_SHIFT)
38
39#define MSI_ADDR_REDIRECTION_SHIFT 3
40#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) /* dedicated cpu */
41#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) /* lowest priority */
42
43#define MSI_ADDR_DEST_ID_SHIFT 12
44#define MSI_ADDR_DEST_ID_MASK 0x00ffff0
45#define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & MSI_ADDR_DEST_ID_MASK)
46
47#endif /* ASM_MSIDEF_H */
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
index d0a7f53b1497..5fb3c0de5ccc 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -88,5 +88,7 @@ unsigned lapic_adjust_nmi_hz(unsigned hz);
88int lapic_watchdog_ok(void); 88int lapic_watchdog_ok(void);
89void disable_lapic_nmi_watchdog(void); 89void disable_lapic_nmi_watchdog(void);
90void enable_lapic_nmi_watchdog(void); 90void enable_lapic_nmi_watchdog(void);
91void stop_nmi(void);
92void restart_nmi(void);
91 93
92#endif /* ASM_NMI_H */ 94#endif /* ASM_NMI_H */
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index e327c830da0c..88adf1afb0a2 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -48,7 +48,8 @@ void copy_page(void *, void *);
48#define clear_user_page(page, vaddr, pg) clear_page(page) 48#define clear_user_page(page, vaddr, pg) clear_page(page)
49#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 49#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
50 50
51#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 51#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
52 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
52#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 53#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
53/* 54/*
54 * These are used to make use of C type-checking.. 55 * These are used to make use of C type-checking..
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index bda94fd5176f..88926eb44f5c 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -5,6 +5,25 @@
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8struct pci_sysdata {
9 int node; /* NUMA node */
10 void* iommu; /* IOMMU private data */
11};
12
13#ifdef CONFIG_CALGARY_IOMMU
14static inline void* pci_iommu(struct pci_bus *bus)
15{
16 struct pci_sysdata *sd = bus->sysdata;
17 return sd->iommu;
18}
19
20static inline void set_pci_iommu(struct pci_bus *bus, void *val)
21{
22 struct pci_sysdata *sd = bus->sysdata;
23 sd->iommu = val;
24}
25#endif /* CONFIG_CALGARY_IOMMU */
26
8#include <linux/mm.h> /* for struct page */ 27#include <linux/mm.h> /* for struct page */
9 28
10/* Can be used to override the logic in pci_scan_bus for skipping 29/* Can be used to override the logic in pci_scan_bus for skipping
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index c6fbb67eac90..5abd48270101 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -20,6 +20,11 @@
20#define DEFINE_PER_CPU(type, name) \ 20#define DEFINE_PER_CPU(type, name) \
21 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 21 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
22 22
23#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
24 __attribute__((__section__(".data.percpu.shared_aligned"))) \
25 __typeof__(type) per_cpu__##name \
26 ____cacheline_internodealigned_in_smp
27
23/* var is in discarded region: offset to particular copy we want */ 28/* var is in discarded region: offset to particular copy we want */
24#define per_cpu(var, cpu) (*({ \ 29#define per_cpu(var, cpu) (*({ \
25 extern int simple_identifier_##var(void); \ 30 extern int simple_identifier_##var(void); \
@@ -46,6 +51,8 @@ extern void setup_per_cpu_areas(void);
46 51
47#define DEFINE_PER_CPU(type, name) \ 52#define DEFINE_PER_CPU(type, name) \
48 __typeof__(type) per_cpu__##name 53 __typeof__(type) per_cpu__##name
54#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
55 DEFINE_PER_CPU(type, name)
49 56
50#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 57#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
51#define __get_cpu_var(var) per_cpu__##var 58#define __get_cpu_var(var) per_cpu__##var
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 8bb564687860..b467be6d367f 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -4,6 +4,10 @@
4#include <asm/pda.h> 4#include <asm/pda.h>
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/quicklist.h>
8
9#define QUICK_PGD 0 /* We preserve special mappings over free */
10#define QUICK_PT 1 /* Other page table pages that are zero on free */
7 11
8#define pmd_populate_kernel(mm, pmd, pte) \ 12#define pmd_populate_kernel(mm, pmd, pte) \
9 set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte))) 13 set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte)))
@@ -20,23 +24,23 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
20static inline void pmd_free(pmd_t *pmd) 24static inline void pmd_free(pmd_t *pmd)
21{ 25{
22 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 26 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
23 free_page((unsigned long)pmd); 27 quicklist_free(QUICK_PT, NULL, pmd);
24} 28}
25 29
26static inline pmd_t *pmd_alloc_one (struct mm_struct *mm, unsigned long addr) 30static inline pmd_t *pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
27{ 31{
28 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 32 return (pmd_t *)quicklist_alloc(QUICK_PT, GFP_KERNEL|__GFP_REPEAT, NULL);
29} 33}
30 34
31static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) 35static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
32{ 36{
33 return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 37 return (pud_t *)quicklist_alloc(QUICK_PT, GFP_KERNEL|__GFP_REPEAT, NULL);
34} 38}
35 39
36static inline void pud_free (pud_t *pud) 40static inline void pud_free (pud_t *pud)
37{ 41{
38 BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); 42 BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
39 free_page((unsigned long)pud); 43 quicklist_free(QUICK_PT, NULL, pud);
40} 44}
41 45
42static inline void pgd_list_add(pgd_t *pgd) 46static inline void pgd_list_add(pgd_t *pgd)
@@ -57,41 +61,57 @@ static inline void pgd_list_del(pgd_t *pgd)
57 spin_unlock(&pgd_lock); 61 spin_unlock(&pgd_lock);
58} 62}
59 63
60static inline pgd_t *pgd_alloc(struct mm_struct *mm) 64static inline void pgd_ctor(void *x)
61{ 65{
62 unsigned boundary; 66 unsigned boundary;
63 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 67 pgd_t *pgd = x;
64 if (!pgd) 68 struct page *page = virt_to_page(pgd);
65 return NULL; 69
66 pgd_list_add(pgd);
67 /* 70 /*
68 * Copy kernel pointers in from init. 71 * Copy kernel pointers in from init.
69 * Could keep a freelist or slab cache of those because the kernel
70 * part never changes.
71 */ 72 */
72 boundary = pgd_index(__PAGE_OFFSET); 73 boundary = pgd_index(__PAGE_OFFSET);
73 memset(pgd, 0, boundary * sizeof(pgd_t));
74 memcpy(pgd + boundary, 74 memcpy(pgd + boundary,
75 init_level4_pgt + boundary, 75 init_level4_pgt + boundary,
76 (PTRS_PER_PGD - boundary) * sizeof(pgd_t)); 76 (PTRS_PER_PGD - boundary) * sizeof(pgd_t));
77
78 spin_lock(&pgd_lock);
79 list_add(&page->lru, &pgd_list);
80 spin_unlock(&pgd_lock);
81}
82
83static inline void pgd_dtor(void *x)
84{
85 pgd_t *pgd = x;
86 struct page *page = virt_to_page(pgd);
87
88 spin_lock(&pgd_lock);
89 list_del(&page->lru);
90 spin_unlock(&pgd_lock);
91}
92
93static inline pgd_t *pgd_alloc(struct mm_struct *mm)
94{
95 pgd_t *pgd = (pgd_t *)quicklist_alloc(QUICK_PGD,
96 GFP_KERNEL|__GFP_REPEAT, pgd_ctor);
77 return pgd; 97 return pgd;
78} 98}
79 99
80static inline void pgd_free(pgd_t *pgd) 100static inline void pgd_free(pgd_t *pgd)
81{ 101{
82 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1)); 102 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
83 pgd_list_del(pgd); 103 quicklist_free(QUICK_PGD, pgd_dtor, pgd);
84 free_page((unsigned long)pgd);
85} 104}
86 105
87static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) 106static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
88{ 107{
89 return (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 108 return (pte_t *)quicklist_alloc(QUICK_PT, GFP_KERNEL|__GFP_REPEAT, NULL);
90} 109}
91 110
92static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) 111static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
93{ 112{
94 void *p = (void *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 113 void *p = (void *)quicklist_alloc(QUICK_PT, GFP_KERNEL|__GFP_REPEAT, NULL);
114
95 if (!p) 115 if (!p)
96 return NULL; 116 return NULL;
97 return virt_to_page(p); 117 return virt_to_page(p);
@@ -103,17 +123,22 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add
103static inline void pte_free_kernel(pte_t *pte) 123static inline void pte_free_kernel(pte_t *pte)
104{ 124{
105 BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); 125 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
106 free_page((unsigned long)pte); 126 quicklist_free(QUICK_PT, NULL, pte);
107} 127}
108 128
109static inline void pte_free(struct page *pte) 129static inline void pte_free(struct page *pte)
110{ 130{
111 __free_page(pte); 131 quicklist_free_page(QUICK_PT, NULL, pte);
112} 132}
113 133
114#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 134#define __pte_free_tlb(tlb,pte) quicklist_free_page(QUICK_PT, NULL,(pte))
115 135
116#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) 136#define __pmd_free_tlb(tlb,x) quicklist_free(QUICK_PT, NULL, (x))
117#define __pud_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) 137#define __pud_free_tlb(tlb,x) quicklist_free(QUICK_PT, NULL, (x))
118 138
139static inline void check_pgt_cache(void)
140{
141 quicklist_trim(QUICK_PGD, pgd_dtor, 25, 16);
142 quicklist_trim(QUICK_PT, NULL, 25, 16);
143}
119#endif /* _X86_64_PGALLOC_H */ 144#endif /* _X86_64_PGALLOC_H */
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 0a71e0b9a619..c9d8764c89d1 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -266,21 +266,15 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
266 * Undefined behaviour if not.. 266 * Undefined behaviour if not..
267 */ 267 */
268#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) 268#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
269static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
270static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
271static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); }
272static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 269static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
273static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 270static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
274static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 271static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
275static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 272static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
276static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; } 273static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; }
277 274
278static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
279static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
280static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 275static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
281static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 276static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
282static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } 277static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
283static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
284static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } 278static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; }
285static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 279static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
286static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 280static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
@@ -290,13 +284,6 @@ static inline pte_t pte_clrhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) &
290 284
291struct vm_area_struct; 285struct vm_area_struct;
292 286
293static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
294{
295 if (!pte_dirty(*ptep))
296 return 0;
297 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte);
298}
299
300static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 287static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
301{ 288{
302 if (!pte_young(*ptep)) 289 if (!pte_young(*ptep))
@@ -416,13 +403,14 @@ extern struct list_head pgd_list;
416 403
417extern int kern_addr_valid(unsigned long addr); 404extern int kern_addr_valid(unsigned long addr);
418 405
406pte_t *lookup_address(unsigned long addr);
407
419#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ 408#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
420 remap_pfn_range(vma, vaddr, pfn, size, prot) 409 remap_pfn_range(vma, vaddr, pfn, size, prot)
421 410
422#define HAVE_ARCH_UNMAPPED_AREA 411#define HAVE_ARCH_UNMAPPED_AREA
423 412
424#define pgtable_cache_init() do { } while (0) 413#define pgtable_cache_init() do { } while (0)
425#define check_pgt_cache() do { } while (0)
426 414
427#define PAGE_AGP PAGE_KERNEL_NOCACHE 415#define PAGE_AGP PAGE_KERNEL_NOCACHE
428#define HAVE_PAGE_AGP 1 416#define HAVE_PAGE_AGP 1
@@ -433,7 +421,6 @@ extern int kern_addr_valid(unsigned long addr);
433 (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) 421 (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o))
434 422
435#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 423#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
436#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
437#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 424#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
438#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL 425#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
439#define __HAVE_ARCH_PTEP_SET_WRPROTECT 426#define __HAVE_ARCH_PTEP_SET_WRPROTECT
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index efc87a5aff7f..19525175b91c 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -83,7 +83,6 @@ struct cpuinfo_x86 {
83#define X86_VENDOR_UMC 3 83#define X86_VENDOR_UMC 3
84#define X86_VENDOR_NEXGEN 4 84#define X86_VENDOR_NEXGEN 4
85#define X86_VENDOR_CENTAUR 5 85#define X86_VENDOR_CENTAUR 5
86#define X86_VENDOR_RISE 6
87#define X86_VENDOR_TRANSMETA 7 86#define X86_VENDOR_TRANSMETA 7
88#define X86_VENDOR_NUM 8 87#define X86_VENDOR_NUM 8
89#define X86_VENDOR_UNKNOWN 0xff 88#define X86_VENDOR_UNKNOWN 0xff
@@ -390,17 +389,6 @@ static inline void prefetchw(void *x)
390 389
391#define cpu_relax() rep_nop() 390#define cpu_relax() rep_nop()
392 391
393/*
394 * NSC/Cyrix CPU indexed register access macros
395 */
396
397#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
398
399#define setCx86(reg, data) do { \
400 outb((reg), 0x22); \
401 outb((data), 0x23); \
402} while (0)
403
404static inline void serialize_cpu(void) 392static inline void serialize_cpu(void)
405{ 393{
406 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); 394 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 85255db1e82d..31f20ad65876 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -75,8 +75,6 @@ extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
75extern void early_quirks(void); 75extern void early_quirks(void);
76extern void check_efer(void); 76extern void check_efer(void);
77 77
78extern int unhandled_signal(struct task_struct *tsk, int sig);
79
80extern void select_idle_routine(const struct cpuinfo_x86 *c); 78extern void select_idle_routine(const struct cpuinfo_x86 *c);
81 79
82extern unsigned long table_start, table_end; 80extern unsigned long table_start, table_end;
@@ -85,24 +83,6 @@ extern int exception_trace;
85extern unsigned cpu_khz; 83extern unsigned cpu_khz;
86extern unsigned tsc_khz; 84extern unsigned tsc_khz;
87 85
88extern void no_iommu_init(void);
89extern int force_iommu, no_iommu;
90extern int iommu_detected;
91#ifdef CONFIG_IOMMU
92extern void gart_iommu_init(void);
93extern void __init gart_parse_options(char *);
94extern void iommu_hole_init(void);
95extern int fallback_aper_order;
96extern int fallback_aper_force;
97extern int iommu_aperture;
98extern int iommu_aperture_allowed;
99extern int iommu_aperture_disabled;
100extern int fix_aperture;
101#else
102#define iommu_aperture 0
103#define iommu_aperture_allowed 0
104#endif
105
106extern int reboot_force; 86extern int reboot_force;
107extern int notsc_setup(char *); 87extern int notsc_setup(char *);
108 88
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h
index 5ea84dbb1e9c..7f166ccb0606 100644
--- a/include/asm-x86_64/ptrace.h
+++ b/include/asm-x86_64/ptrace.h
@@ -1,6 +1,7 @@
1#ifndef _X86_64_PTRACE_H 1#ifndef _X86_64_PTRACE_H
2#define _X86_64_PTRACE_H 2#define _X86_64_PTRACE_H
3 3
4#include <linux/compiler.h> /* For __user */
4#include <asm/ptrace-abi.h> 5#include <asm/ptrace-abi.h>
5 6
6#ifndef __ASSEMBLY__ 7#ifndef __ASSEMBLY__
diff --git a/include/asm-x86_64/resume-trace.h b/include/asm-x86_64/resume-trace.h
new file mode 100644
index 000000000000..34bf998fdf62
--- /dev/null
+++ b/include/asm-x86_64/resume-trace.h
@@ -0,0 +1,13 @@
1#define TRACE_RESUME(user) do { \
2 if (pm_trace_enabled) { \
3 void *tracedata; \
4 asm volatile("movq $1f,%0\n" \
5 ".section .tracedata,\"a\"\n" \
6 "1:\t.word %c1\n" \
7 "\t.quad %c2\n" \
8 ".previous" \
9 :"=r" (tracedata) \
10 : "i" (__LINE__), "i" (__FILE__)); \
11 generate_resume_trace(tracedata, user); \
12 } \
13} while (0)
diff --git a/include/asm-x86_64/string.h b/include/asm-x86_64/string.h
index 9505d9f4bead..e583da7918fb 100644
--- a/include/asm-x86_64/string.h
+++ b/include/asm-x86_64/string.h
@@ -29,6 +29,9 @@ return (to);
29 function. */ 29 function. */
30 30
31#define __HAVE_ARCH_MEMCPY 1 31#define __HAVE_ARCH_MEMCPY 1
32#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
33extern void *memcpy(void *to, const void *from, size_t len);
34#else
32extern void *__memcpy(void *to, const void *from, size_t len); 35extern void *__memcpy(void *to, const void *from, size_t len);
33#define memcpy(dst,src,len) \ 36#define memcpy(dst,src,len) \
34 ({ size_t __len = (len); \ 37 ({ size_t __len = (len); \
@@ -38,7 +41,7 @@ extern void *__memcpy(void *to, const void *from, size_t len);
38 else \ 41 else \
39 __ret = __builtin_memcpy((dst),(src),__len); \ 42 __ret = __builtin_memcpy((dst),(src),__len); \
40 __ret; }) 43 __ret; })
41 44#endif
42 45
43#define __HAVE_ARCH_MEMSET 46#define __HAVE_ARCH_MEMSET
44void *memset(void *s, int c, size_t n); 47void *memset(void *s, int c, size_t n);
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index ead9f9a56234..02175aa1d16a 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -75,19 +75,31 @@ static inline unsigned long read_cr0(void)
75 unsigned long cr0; 75 unsigned long cr0;
76 asm volatile("movq %%cr0,%0" : "=r" (cr0)); 76 asm volatile("movq %%cr0,%0" : "=r" (cr0));
77 return cr0; 77 return cr0;
78} 78}
79 79
80static inline void write_cr0(unsigned long val) 80static inline void write_cr0(unsigned long val)
81{ 81{
82 asm volatile("movq %0,%%cr0" :: "r" (val)); 82 asm volatile("movq %0,%%cr0" :: "r" (val));
83} 83}
84
85static inline unsigned long read_cr2(void)
86{
87 unsigned long cr2;
88 asm("movq %%cr2,%0" : "=r" (cr2));
89 return cr2;
90}
91
92static inline void write_cr2(unsigned long val)
93{
94 asm volatile("movq %0,%%cr2" :: "r" (val));
95}
84 96
85static inline unsigned long read_cr3(void) 97static inline unsigned long read_cr3(void)
86{ 98{
87 unsigned long cr3; 99 unsigned long cr3;
88 asm("movq %%cr3,%0" : "=r" (cr3)); 100 asm("movq %%cr3,%0" : "=r" (cr3));
89 return cr3; 101 return cr3;
90} 102}
91 103
92static inline void write_cr3(unsigned long val) 104static inline void write_cr3(unsigned long val)
93{ 105{
@@ -99,27 +111,30 @@ static inline unsigned long read_cr4(void)
99 unsigned long cr4; 111 unsigned long cr4;
100 asm("movq %%cr4,%0" : "=r" (cr4)); 112 asm("movq %%cr4,%0" : "=r" (cr4));
101 return cr4; 113 return cr4;
102} 114}
103 115
104static inline void write_cr4(unsigned long val) 116static inline void write_cr4(unsigned long val)
105{ 117{
106 asm volatile("movq %0,%%cr4" :: "r" (val) : "memory"); 118 asm volatile("movq %0,%%cr4" :: "r" (val) : "memory");
107} 119}
108
109#define stts() write_cr0(8 | read_cr0())
110 120
111#define wbinvd() \ 121static inline unsigned long read_cr8(void)
112 __asm__ __volatile__ ("wbinvd": : :"memory"); 122{
123 unsigned long cr8;
124 asm("movq %%cr8,%0" : "=r" (cr8));
125 return cr8;
126}
113 127
114/* 128static inline void write_cr8(unsigned long val)
115 * On SMP systems, when the scheduler does migration-cost autodetection,
116 * it needs a way to flush as much of the CPU's caches as possible.
117 */
118static inline void sched_cacheflush(void)
119{ 129{
120 wbinvd(); 130 asm volatile("movq %0,%%cr8" :: "r" (val) : "memory");
121} 131}
122 132
133#define stts() write_cr0(8 | read_cr0())
134
135#define wbinvd() \
136 __asm__ __volatile__ ("wbinvd": : :"memory")
137
123#endif /* __KERNEL__ */ 138#endif /* __KERNEL__ */
124 139
125#define nop() __asm__ __volatile__ ("nop") 140#define nop() __asm__ __volatile__ ("nop")
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h
index 10bb5a8ed688..33c72ef15a0c 100644
--- a/include/asm-x86_64/thread_info.h
+++ b/include/asm-x86_64/thread_info.h
@@ -115,6 +115,7 @@ static inline struct thread_info *stack_thread_info(void)
115#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 115#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
116#define TIF_SECCOMP 8 /* secure computing */ 116#define TIF_SECCOMP 8 /* secure computing */
117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */ 117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
118#define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */
118/* 16 free */ 119/* 16 free */
119#define TIF_IA32 17 /* 32bit process */ 120#define TIF_IA32 17 /* 32bit process */
120#define TIF_FORK 18 /* ret_from_fork */ 121#define TIF_FORK 18 /* ret_from_fork */
@@ -133,6 +134,7 @@ static inline struct thread_info *stack_thread_info(void)
133#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 134#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
134#define _TIF_SECCOMP (1<<TIF_SECCOMP) 135#define _TIF_SECCOMP (1<<TIF_SECCOMP)
135#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 136#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
137#define _TIF_MCE_NOTIFY (1<<TIF_MCE_NOTIFY)
136#define _TIF_IA32 (1<<TIF_IA32) 138#define _TIF_IA32 (1<<TIF_IA32)
137#define _TIF_FORK (1<<TIF_FORK) 139#define _TIF_FORK (1<<TIF_FORK)
138#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 140#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index f6527e1b6c1c..6ed21f44d308 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -9,7 +9,6 @@
9#include <asm/8253pit.h> 9#include <asm/8253pit.h>
10#include <asm/msr.h> 10#include <asm/msr.h>
11#include <asm/vsyscall.h> 11#include <asm/vsyscall.h>
12#include <asm/hpet.h>
13#include <asm/system.h> 12#include <asm/system.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/tsc.h> 14#include <asm/tsc.h>
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
index 8516225a8389..888eb4abdd07 100644
--- a/include/asm-x86_64/tlbflush.h
+++ b/include/asm-x86_64/tlbflush.h
@@ -92,7 +92,11 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st
92 92
93#endif 93#endif
94 94
95#define flush_tlb_kernel_range(start, end) flush_tlb_all() 95static inline void flush_tlb_kernel_range(unsigned long start,
96 unsigned long end)
97{
98 flush_tlb_all();
99}
96 100
97static inline void flush_tlb_pgtables(struct mm_struct *mm, 101static inline void flush_tlb_pgtables(struct mm_struct *mm,
98 unsigned long start, unsigned long end) 102 unsigned long start, unsigned long end)
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index 4fd6fb23953e..36e52fba7960 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -22,7 +22,7 @@ extern int __node_distance(int, int);
22#define parent_node(node) (node) 22#define parent_node(node) (node)
23#define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node])) 23#define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node]))
24#define node_to_cpumask(node) (node_to_cpumask[node]) 24#define node_to_cpumask(node) (node_to_cpumask[node])
25#define pcibus_to_node(bus) ((long)(bus->sysdata)) 25#define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node
26#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); 26#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
27 27
28#define numa_node_id() read_pda(nodenumber) 28#define numa_node_id() read_pda(nodenumber)
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 8696f8ad401e..fc4e73f5f1fa 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -630,6 +630,8 @@ __SYSCALL(__NR_signalfd, sys_signalfd)
630__SYSCALL(__NR_timerfd, sys_timerfd) 630__SYSCALL(__NR_timerfd, sys_timerfd)
631#define __NR_eventfd 284 631#define __NR_eventfd 284
632__SYSCALL(__NR_eventfd, sys_eventfd) 632__SYSCALL(__NR_eventfd, sys_eventfd)
633#define __NR_fallocate 285
634__SYSCALL(__NR_fallocate, sys_fallocate)
633 635
634#ifndef __NO_STUBS 636#ifndef __NO_STUBS
635#define __ARCH_WANT_OLD_READDIR 637#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-x86_64/vgtod.h b/include/asm-x86_64/vgtod.h
new file mode 100644
index 000000000000..3301f0929342
--- /dev/null
+++ b/include/asm-x86_64/vgtod.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_VGTOD_H
2#define _ASM_VGTOD_H 1
3
4#include <asm/vsyscall.h>
5#include <linux/clocksource.h>
6
7struct vsyscall_gtod_data {
8 seqlock_t lock;
9
10 /* open coded 'struct timespec' */
11 time_t wall_time_sec;
12 u32 wall_time_nsec;
13
14 int sysctl_enabled;
15 struct timezone sys_tz;
16 struct { /* extract of a clocksource struct */
17 cycle_t (*vread)(void);
18 cycle_t cycle_last;
19 cycle_t mask;
20 u32 mult;
21 u32 shift;
22 } clock;
23 struct timespec wall_to_monotonic;
24};
25extern struct vsyscall_gtod_data __vsyscall_gtod_data
26__section_vsyscall_gtod_data;
27extern struct vsyscall_gtod_data vsyscall_gtod_data;
28
29#endif
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 82b4afe65c91..3b8ceb4af2cf 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -22,6 +22,8 @@ enum vsyscall_num {
22/* Definitions for CONFIG_GENERIC_TIME definitions */ 22/* Definitions for CONFIG_GENERIC_TIME definitions */
23#define __section_vsyscall_gtod_data __attribute__ \ 23#define __section_vsyscall_gtod_data __attribute__ \
24 ((unused, __section__ (".vsyscall_gtod_data"),aligned(16))) 24 ((unused, __section__ (".vsyscall_gtod_data"),aligned(16)))
25#define __section_vsyscall_clock __attribute__ \
26 ((unused, __section__ (".vsyscall_clock"),aligned(16)))
25#define __vsyscall_fn __attribute__ ((unused,__section__(".vsyscall_fn"))) 27#define __vsyscall_fn __attribute__ ((unused,__section__(".vsyscall_fn")))
26 28
27#define VGETCPU_RDTSCP 1 29#define VGETCPU_RDTSCP 1
@@ -36,7 +38,6 @@ extern volatile unsigned long __jiffies;
36/* kernel space (writeable) */ 38/* kernel space (writeable) */
37extern int vgetcpu_mode; 39extern int vgetcpu_mode;
38extern struct timezone sys_tz; 40extern struct timezone sys_tz;
39extern struct vsyscall_gtod_data_t vsyscall_gtod_data;
40 41
41#endif /* __KERNEL__ */ 42#endif /* __KERNEL__ */
42 43
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h
index ffc4dcfd6ac1..05a2f67c6768 100644
--- a/include/asm-xtensa/a.out.h
+++ b/include/asm-xtensa/a.out.h
@@ -17,6 +17,7 @@
17/* Note: the kernel needs the a.out definitions, even if only ELF is used. */ 17/* Note: the kernel needs the a.out definitions, even if only ELF is used. */
18 18
19#define STACK_TOP TASK_SIZE 19#define STACK_TOP TASK_SIZE
20#define STACK_TOP_MAX STACK_TOP
20 21
21struct exec 22struct exec
22{ 23{
diff --git a/include/asm-xtensa/fb.h b/include/asm-xtensa/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/include/asm-xtensa/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index 2d4b5db6ea63..06850f3b26a7 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -197,16 +197,13 @@ extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)];
197 197
198/* Note: We use the _PAGE_USER bit to indicate write-protect kernel memory */ 198/* Note: We use the _PAGE_USER bit to indicate write-protect kernel memory */
199 199
200static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
201static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 200static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
202static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 201static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
203static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 202static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
204static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 203static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
205static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; } 204static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; }
206static inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; }
207static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 205static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
208static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 206static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
209static inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; }
210static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 207static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
211static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 208static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
212static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } 209static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; }
@@ -270,17 +267,6 @@ ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr,
270 return 1; 267 return 1;
271} 268}
272 269
273static inline int
274ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr,
275 pte_t *ptep)
276{
277 pte_t pte = *ptep;
278 if (!pte_dirty(pte))
279 return 0;
280 update_pte(ptep, pte_mkclean(pte));
281 return 1;
282}
283
284static inline pte_t 270static inline pte_t
285ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 271ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
286{ 272{
@@ -421,7 +407,6 @@ typedef pte_t *pte_addr_t;
421#endif /* !defined (__ASSEMBLY__) */ 407#endif /* !defined (__ASSEMBLY__) */
422 408
423#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 409#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
424#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
425#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 410#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
426#define __HAVE_ARCH_PTEP_SET_WRPROTECT 411#define __HAVE_ARCH_PTEP_SET_WRPROTECT
427#define __HAVE_ARCH_PTEP_MKDIRTY 412#define __HAVE_ARCH_PTEP_MKDIRTY
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 127d2d192b5a..bcf875e844fe 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -247,7 +247,6 @@ unifdef-y += isdn.h
247unifdef-y += isdnif.h 247unifdef-y += isdnif.h
248unifdef-y += isdn_divertif.h 248unifdef-y += isdn_divertif.h
249unifdef-y += isdn_ppp.h 249unifdef-y += isdn_ppp.h
250unifdef-y += isicom.h
251unifdef-y += jbd.h 250unifdef-y += jbd.h
252unifdef-y += joystick.h 251unifdef-y += joystick.h
253unifdef-y += kdev_t.h 252unifdef-y += kdev_t.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index fccd8b548d93..d5680cd7746a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -88,10 +88,8 @@ int acpi_table_parse (char *id, acpi_table_handler handler);
88int __init acpi_table_parse_entries(char *id, unsigned long table_size, 88int __init acpi_table_parse_entries(char *id, unsigned long table_size,
89 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries); 89 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
90int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries); 90int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
91int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
92int acpi_parse_mcfg (struct acpi_table_header *header); 91int acpi_parse_mcfg (struct acpi_table_header *header);
93void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); 92void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
94void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
95 93
96/* the following four functions are architecture-dependent */ 94/* the following four functions are architecture-dependent */
97#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT 95#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
@@ -122,7 +120,7 @@ extern struct acpi_mcfg_allocation *pci_mmcfg_config;
122extern int pci_mmcfg_config_num; 120extern int pci_mmcfg_config_num;
123 121
124extern int sbf_port; 122extern int sbf_port;
125extern unsigned long acpi_video_flags; 123extern unsigned long acpi_realmode_flags;
126 124
127#else /* !CONFIG_ACPI */ 125#else /* !CONFIG_ACPI */
128 126
@@ -233,6 +231,9 @@ extern int acpi_paddr_to_node(u64 start_addr, u64 size);
233 231
234extern int pnpacpi_disabled; 232extern int pnpacpi_disabled;
235 233
234#define PXM_INVAL (-1)
235#define NID_INVAL (-1)
236
236#else /* CONFIG_ACPI */ 237#else /* CONFIG_ACPI */
237 238
238static inline int acpi_boot_init(void) 239static inline int acpi_boot_init(void)
diff --git a/include/linux/aio.h b/include/linux/aio.h
index b903fc02bdb7..d10e608f232d 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -86,7 +86,7 @@ struct kioctx;
86 */ 86 */
87struct kiocb { 87struct kiocb {
88 struct list_head ki_run_list; 88 struct list_head ki_run_list;
89 long ki_flags; 89 unsigned long ki_flags;
90 int ki_users; 90 int ki_users;
91 unsigned ki_key; /* id of this request */ 91 unsigned ki_key; /* id of this request */
92 92
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index ff1255079fa1..bdca3f1b3213 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -51,10 +51,6 @@ struct dma_chan_ref {
51 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 51 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
52 * dependency chain 52 * dependency chain
53 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. 53 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining.
54 * @ASYNC_TX_KMAP_SRC: if the transaction is to be performed synchronously
55 * take an atomic mapping (KM_USER0) on the source page(s)
56 * @ASYNC_TX_KMAP_DST: if the transaction is to be performed synchronously
57 * take an atomic mapping (KM_USER0) on the dest page(s)
58 */ 54 */
59enum async_tx_flags { 55enum async_tx_flags {
60 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 56 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
@@ -62,8 +58,6 @@ enum async_tx_flags {
62 ASYNC_TX_ASSUME_COHERENT = (1 << 2), 58 ASYNC_TX_ASSUME_COHERENT = (1 << 2),
63 ASYNC_TX_ACK = (1 << 3), 59 ASYNC_TX_ACK = (1 << 3),
64 ASYNC_TX_DEP_ACK = (1 << 4), 60 ASYNC_TX_DEP_ACK = (1 << 4),
65 ASYNC_TX_KMAP_SRC = (1 << 5),
66 ASYNC_TX_KMAP_DST = (1 << 6),
67}; 61};
68 62
69#ifdef CONFIG_DMA_ENGINE 63#ifdef CONFIG_DMA_ENGINE
diff --git a/include/linux/ata.h b/include/linux/ata.h
index b5a20162af32..23a22df039d8 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -64,6 +64,15 @@ enum {
64 ATA_ID_PROD_LEN = 40, 64 ATA_ID_PROD_LEN = 40,
65 65
66 ATA_PCI_CTL_OFS = 2, 66 ATA_PCI_CTL_OFS = 2,
67
68 ATA_PIO0 = (1 << 0),
69 ATA_PIO1 = ATA_PIO0 | (1 << 1),
70 ATA_PIO2 = ATA_PIO1 | (1 << 2),
71 ATA_PIO3 = ATA_PIO2 | (1 << 3),
72 ATA_PIO4 = ATA_PIO3 | (1 << 4),
73 ATA_PIO5 = ATA_PIO4 | (1 << 5),
74 ATA_PIO6 = ATA_PIO5 | (1 << 6),
75
67 ATA_UDMA0 = (1 << 0), 76 ATA_UDMA0 = (1 << 0),
68 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 77 ATA_UDMA1 = ATA_UDMA0 | (1 << 1),
69 ATA_UDMA2 = ATA_UDMA1 | (1 << 2), 78 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 93bfb0beb62a..8ff274933948 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -12,7 +12,6 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/klist.h> 14#include <linux/klist.h>
15#include <linux/spinlock.h>
16 15
17struct attribute_container { 16struct attribute_container {
18 struct list_head node; 17 struct list_head node;
diff --git a/include/linux/audit.h b/include/linux/audit.h
index fccc6e50298a..4bbd8601b8f0 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -63,9 +63,12 @@
63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ 63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ 64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ 65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
66#define AUDIT_TTY_GET 1014 /* Get TTY auditing status */
67#define AUDIT_TTY_SET 1015 /* Set TTY auditing status */
66 68
67#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 69#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
68#define AUDIT_USER_AVC 1107 /* We filter this differently */ 70#define AUDIT_USER_AVC 1107 /* We filter this differently */
71#define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */
69#define AUDIT_LAST_USER_MSG 1199 72#define AUDIT_LAST_USER_MSG 1199
70#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */ 73#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
71#define AUDIT_LAST_USER_MSG2 2999 74#define AUDIT_LAST_USER_MSG2 2999
@@ -92,6 +95,7 @@
92#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */ 95#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
93#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ 96#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
94#define AUDIT_OBJ_PID 1318 /* ptrace target */ 97#define AUDIT_OBJ_PID 1318 /* ptrace target */
98#define AUDIT_TTY 1319 /* Input on an administrative TTY */
95 99
96#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 100#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
97#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 101#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -157,7 +161,7 @@
157 * are currently used in an audit field constant understood by the kernel. 161 * are currently used in an audit field constant understood by the kernel.
158 * If you are adding a new #define AUDIT_<whatever>, please ensure that 162 * If you are adding a new #define AUDIT_<whatever>, please ensure that
159 * AUDIT_UNUSED_BITS is updated if need be. */ 163 * AUDIT_UNUSED_BITS is updated if need be. */
160#define AUDIT_UNUSED_BITS 0x0FFFFC00 164#define AUDIT_UNUSED_BITS 0x07FFFC00
161 165
162 166
163/* Rule fields */ 167/* Rule fields */
@@ -209,25 +213,29 @@
209#define AUDIT_NEGATE 0x80000000 213#define AUDIT_NEGATE 0x80000000
210 214
211/* These are the supported operators. 215/* These are the supported operators.
212 * 4 2 1 216 * 4 2 1 8
213 * = > < 217 * = > < ?
214 * ------- 218 * ----------
215 * 0 0 0 0 nonsense 219 * 0 0 0 0 00 nonsense
216 * 0 0 1 1 < 220 * 0 0 0 1 08 & bit mask
217 * 0 1 0 2 > 221 * 0 0 1 0 10 <
218 * 0 1 1 3 != 222 * 0 1 0 0 20 >
219 * 1 0 0 4 = 223 * 0 1 1 0 30 !=
220 * 1 0 1 5 <= 224 * 1 0 0 0 40 =
221 * 1 1 0 6 >= 225 * 1 0 0 1 48 &= bit test
222 * 1 1 1 7 all operators 226 * 1 0 1 0 50 <=
227 * 1 1 0 0 60 >=
228 * 1 1 1 1 78 all operators
223 */ 229 */
230#define AUDIT_BIT_MASK 0x08000000
224#define AUDIT_LESS_THAN 0x10000000 231#define AUDIT_LESS_THAN 0x10000000
225#define AUDIT_GREATER_THAN 0x20000000 232#define AUDIT_GREATER_THAN 0x20000000
226#define AUDIT_NOT_EQUAL 0x30000000 233#define AUDIT_NOT_EQUAL 0x30000000
227#define AUDIT_EQUAL 0x40000000 234#define AUDIT_EQUAL 0x40000000
235#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL)
228#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL) 236#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
229#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) 237#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
230#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL) 238#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
231 239
232/* Status symbols */ 240/* Status symbols */
233 /* Mask values */ 241 /* Mask values */
@@ -289,6 +297,10 @@ struct audit_status {
289 __u32 backlog; /* messages waiting in queue */ 297 __u32 backlog; /* messages waiting in queue */
290}; 298};
291 299
300struct audit_tty_status {
301 __u32 enabled; /* 1 = enabled, 0 = disabled */
302};
303
292/* audit_rule_data supports filter rules with both integer and string 304/* audit_rule_data supports filter rules with both integer and string
293 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and 305 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
294 * AUDIT_LIST_RULES requests. 306 * AUDIT_LIST_RULES requests.
@@ -399,7 +411,6 @@ extern int audit_bprm(struct linux_binprm *bprm);
399extern int audit_socketcall(int nargs, unsigned long *args); 411extern int audit_socketcall(int nargs, unsigned long *args);
400extern int audit_sockaddr(int len, void *addr); 412extern int audit_sockaddr(int len, void *addr);
401extern int __audit_fd_pair(int fd1, int fd2); 413extern int __audit_fd_pair(int fd1, int fd2);
402extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
403extern int audit_set_macxattr(const char *name); 414extern int audit_set_macxattr(const char *name);
404extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); 415extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr);
405extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout); 416extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout);
@@ -479,7 +490,6 @@ extern int audit_signals;
479#define audit_socketcall(n,a) ({ 0; }) 490#define audit_socketcall(n,a) ({ 0; })
480#define audit_fd_pair(n,a) ({ 0; }) 491#define audit_fd_pair(n,a) ({ 0; })
481#define audit_sockaddr(len, addr) ({ 0; }) 492#define audit_sockaddr(len, addr) ({ 0; })
482#define audit_avc_path(dentry, mnt) ({ 0; })
483#define audit_set_macxattr(n) do { ; } while (0) 493#define audit_set_macxattr(n) do { ; } while (0)
484#define audit_mq_open(o,m,a) ({ 0; }) 494#define audit_mq_open(o,m,a) ({ 0; })
485#define audit_mq_timedsend(d,l,p,t) ({ 0; }) 495#define audit_mq_timedsend(d,l,p,t) ({ 0; })
@@ -515,11 +525,13 @@ extern void audit_log_d_path(struct audit_buffer *ab,
515 const char *prefix, 525 const char *prefix,
516 struct dentry *dentry, 526 struct dentry *dentry,
517 struct vfsmount *vfsmnt); 527 struct vfsmount *vfsmnt);
528extern void audit_log_lost(const char *message);
518 /* Private API (for audit.c only) */ 529 /* Private API (for audit.c only) */
519extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 530extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
520extern int audit_filter_type(int type); 531extern int audit_filter_type(int type);
521extern int audit_receive_filter(int type, int pid, int uid, int seq, 532extern int audit_receive_filter(int type, int pid, int uid, int seq,
522 void *data, size_t datasz, uid_t loginuid, u32 sid); 533 void *data, size_t datasz, uid_t loginuid, u32 sid);
534extern int audit_enabled;
523#else 535#else
524#define audit_log(c,g,t,f,...) do { ; } while (0) 536#define audit_log(c,g,t,f,...) do { ; } while (0)
525#define audit_log_start(c,g,t) ({ NULL; }) 537#define audit_log_start(c,g,t) ({ NULL; })
@@ -530,6 +542,7 @@ extern int audit_receive_filter(int type, int pid, int uid, int seq,
530#define audit_log_untrustedstring(a,s) do { ; } while (0) 542#define audit_log_untrustedstring(a,s) do { ; } while (0)
531#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) 543#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
532#define audit_log_d_path(b,p,d,v) do { ; } while (0) 544#define audit_log_d_path(b,p,d,v) do { ; } while (0)
545#define audit_enabled 0
533#endif 546#endif
534#endif 547#endif
535#endif 548#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index f2542c24b328..7011d6255593 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -93,7 +93,6 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw); 93void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw); 94void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout); 95long congestion_wait(int rw, long timeout);
96long congestion_wait_interruptible(int rw, long timeout);
97void congestion_end(int rw); 96void congestion_end(int rw);
98 97
99#define bdi_cap_writeback_dirty(bdi) \ 98#define bdi_cap_writeback_dirty(bdi) \
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index e1a708337be3..91c8c07fe8b7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -6,11 +6,13 @@
6struct pt_regs; 6struct pt_regs;
7 7
8/* 8/*
9 * MAX_ARG_PAGES defines the number of pages allocated for arguments 9 * These are the maximum length and maximum number of strings passed to the
10 * and envelope for the new program. 32 should suffice, this gives 10 * execve() system call. MAX_ARG_STRLEN is essentially random but serves to
11 * a maximum env+arg of 128kB w/4KB pages! 11 * prevent the kernel from being unduly impacted by misaddressed pointers.
12 * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
12 */ 13 */
13#define MAX_ARG_PAGES 32 14#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
15#define MAX_ARG_STRINGS 0x7FFFFFFF
14 16
15/* sizeof(linux_binprm->buf) */ 17/* sizeof(linux_binprm->buf) */
16#define BINPRM_BUF_SIZE 128 18#define BINPRM_BUF_SIZE 128
@@ -24,7 +26,12 @@ struct pt_regs;
24 */ 26 */
25struct linux_binprm{ 27struct linux_binprm{
26 char buf[BINPRM_BUF_SIZE]; 28 char buf[BINPRM_BUF_SIZE];
29#ifdef CONFIG_MMU
30 struct vm_area_struct *vma;
31#else
32# define MAX_ARG_PAGES 32
27 struct page *page[MAX_ARG_PAGES]; 33 struct page *page[MAX_ARG_PAGES];
34#endif
28 struct mm_struct *mm; 35 struct mm_struct *mm;
29 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
30 int sh_bang; 37 int sh_bang;
@@ -40,6 +47,7 @@ struct linux_binprm{
40 unsigned interp_flags; 47 unsigned interp_flags;
41 unsigned interp_data; 48 unsigned interp_data;
42 unsigned long loader, exec; 49 unsigned long loader, exec;
50 unsigned long argv_len;
43}; 51};
44 52
45#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 53#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
@@ -68,7 +76,7 @@ extern int register_binfmt(struct linux_binfmt *);
68extern int unregister_binfmt(struct linux_binfmt *); 76extern int unregister_binfmt(struct linux_binfmt *);
69 77
70extern int prepare_binprm(struct linux_binprm *); 78extern int prepare_binprm(struct linux_binprm *);
71extern void remove_arg_zero(struct linux_binprm *); 79extern int __must_check remove_arg_zero(struct linux_binprm *);
72extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); 80extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
73extern int flush_old_exec(struct linux_binprm * bprm); 81extern int flush_old_exec(struct linux_binprm * bprm);
74 82
@@ -85,6 +93,7 @@ extern int suid_dumpable;
85extern int setup_arg_pages(struct linux_binprm * bprm, 93extern int setup_arg_pages(struct linux_binprm * bprm,
86 unsigned long stack_top, 94 unsigned long stack_top,
87 int executable_stack); 95 int executable_stack);
96extern int bprm_mm_init(struct linux_binprm *bprm);
88extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 97extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
89extern void compute_creds(struct linux_binprm *binprm); 98extern void compute_creds(struct linux_binprm *binprm);
90extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 99extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fae138bd2207..f78965fc6426 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -14,6 +14,7 @@
14#include <linux/bio.h> 14#include <linux/bio.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/stringify.h> 16#include <linux/stringify.h>
17#include <linux/bsg.h>
17 18
18#include <asm/scatterlist.h> 19#include <asm/scatterlist.h>
19 20
@@ -41,6 +42,8 @@ struct elevator_queue;
41typedef struct elevator_queue elevator_t; 42typedef struct elevator_queue elevator_t;
42struct request_pm_state; 43struct request_pm_state;
43struct blk_trace; 44struct blk_trace;
45struct request;
46struct sg_io_hdr;
44 47
45#define BLKDEV_MIN_RQ 4 48#define BLKDEV_MIN_RQ 4
46#define BLKDEV_MAX_RQ 128 /* Default maximum */ 49#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -314,6 +317,9 @@ struct request {
314 */ 317 */
315 rq_end_io_fn *end_io; 318 rq_end_io_fn *end_io;
316 void *end_io_data; 319 void *end_io_data;
320
321 /* for bidi */
322 struct request *next_rq;
317}; 323};
318 324
319/* 325/*
@@ -468,6 +474,10 @@ struct request_queue
468 unsigned int bi_size; 474 unsigned int bi_size;
469 475
470 struct mutex sysfs_lock; 476 struct mutex sysfs_lock;
477
478#if defined(CONFIG_BLK_DEV_BSG)
479 struct bsg_class_device bsg_dev;
480#endif
471}; 481};
472 482
473#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 483#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
@@ -479,6 +489,7 @@ struct request_queue
479#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 489#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
480#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 490#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
481#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 491#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
492#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */
482 493
483enum { 494enum {
484 /* 495 /*
@@ -543,6 +554,7 @@ enum {
543#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) 554#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
544#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) 555#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
545#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 556#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
557#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
546 558
547#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 559#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
548 560
@@ -607,7 +619,12 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
607#define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT) 619#define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT)
608#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) 620#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD)
609 621
610#ifdef CONFIG_MMU 622/*
623 * default timeout for SG_IO if none specified
624 */
625#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
626
627#ifdef CONFIG_BOUNCE
611extern int init_emergency_isa_pool(void); 628extern int init_emergency_isa_pool(void);
612extern void blk_queue_bounce(request_queue_t *q, struct bio **bio); 629extern void blk_queue_bounce(request_queue_t *q, struct bio **bio);
613#else 630#else
@@ -637,7 +654,8 @@ extern void blk_requeue_request(request_queue_t *, struct request *);
637extern void blk_plug_device(request_queue_t *); 654extern void blk_plug_device(request_queue_t *);
638extern int blk_remove_plug(request_queue_t *); 655extern int blk_remove_plug(request_queue_t *);
639extern void blk_recount_segments(request_queue_t *, struct bio *); 656extern void blk_recount_segments(request_queue_t *, struct bio *);
640extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); 657extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
658 struct gendisk *, unsigned int, void __user *);
641extern int sg_scsi_ioctl(struct file *, struct request_queue *, 659extern int sg_scsi_ioctl(struct file *, struct request_queue *,
642 struct gendisk *, struct scsi_ioctl_command __user *); 660 struct gendisk *, struct scsi_ioctl_command __user *);
643 661
@@ -680,6 +698,12 @@ extern int blk_execute_rq(request_queue_t *, struct gendisk *,
680 struct request *, int); 698 struct request *, int);
681extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, 699extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
682 struct request *, int, rq_end_io_fn *); 700 struct request *, int, rq_end_io_fn *);
701extern int blk_fill_sghdr_rq(request_queue_t *, struct request *,
702 struct sg_io_hdr *, int);
703extern int blk_unmap_sghdr_rq(struct request *, struct sg_io_hdr *);
704extern int blk_complete_sghdr_rq(struct request *, struct sg_io_hdr *,
705 struct bio *);
706extern int blk_verify_command(unsigned char *, int);
683 707
684static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 708static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
685{ 709{
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
new file mode 100644
index 000000000000..8547b10c388b
--- /dev/null
+++ b/include/linux/bsg.h
@@ -0,0 +1,69 @@
1#ifndef BSG_H
2#define BSG_H
3
4#define BSG_PROTOCOL_SCSI 0
5
6#define BSG_SUB_PROTOCOL_SCSI_CMD 0
7#define BSG_SUB_PROTOCOL_SCSI_TMF 1
8#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
9
10struct sg_io_v4 {
11 __s32 guard; /* [i] 'Q' to differentiate from v3 */
12 __u32 protocol; /* [i] 0 -> SCSI , .... */
13 __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task
14 management function, .... */
15
16 __u32 request_len; /* [i] in bytes */
17 __u64 request; /* [i], [*i] {SCSI: cdb} */
18 __u32 request_attr; /* [i] {SCSI: task attribute} */
19 __u32 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
20 __u32 request_priority; /* [i] {SCSI: task priority} */
21 __u32 max_response_len; /* [i] in bytes */
22 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */
23
24 /* "din_" for data in (from device); "dout_" for data out (to device) */
25 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */
26 __u32 din_xfer_len; /* [i] bytes to be transferred from device */
27 __u64 dout_xferp; /* [i], [*i] */
28 __u64 din_xferp; /* [i], [*o] */
29
30 __u32 timeout; /* [i] units: millisecond */
31 __u32 flags; /* [i] bit mask */
32 __u64 usr_ptr; /* [i->o] unused internally */
33 __u32 spare_in; /* [i] */
34
35 __u32 driver_status; /* [o] 0 -> ok */
36 __u32 transport_status; /* [o] 0 -> ok */
37 __u32 device_status; /* [o] {SCSI: command completion status} */
38 __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */
39 __u32 info; /* [o] additional information */
40 __u32 duration; /* [o] time to complete, in milliseconds */
41 __u32 response_len; /* [o] bytes of response actually written */
42 __s32 din_resid; /* [o] actual_din_xfer_len - din_xfer_len */
43 __u32 generated_tag; /* [o] {SCSI: task tag that transport chose} */
44 __u32 spare_out; /* [o] */
45
46 __u32 padding;
47};
48
49#ifdef __KERNEL__
50
51#if defined(CONFIG_BLK_DEV_BSG)
52struct bsg_class_device {
53 struct class_device *class_dev;
54 struct device *dev;
55 int minor;
56 struct list_head list;
57 struct request_queue *queue;
58};
59
60extern int bsg_register_queue(struct request_queue *, const char *);
61extern void bsg_unregister_queue(struct request_queue *);
62#else
63#define bsg_register_queue(disk, name) (0)
64#define bsg_unregister_queue(disk) do { } while (0)
65#endif
66
67#endif /* __KERNEL__ */
68
69#endif
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 5c6e12853a9b..35cadad84b14 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -209,6 +209,8 @@ int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
209int generic_cont_expand(struct inode *inode, loff_t size); 209int generic_cont_expand(struct inode *inode, loff_t size);
210int generic_cont_expand_simple(struct inode *inode, loff_t size); 210int generic_cont_expand_simple(struct inode *inode, loff_t size);
211int block_commit_write(struct page *page, unsigned from, unsigned to); 211int block_commit_write(struct page *page, unsigned from, unsigned to);
212int block_page_mkwrite(struct vm_area_struct *vma, struct page *page,
213 get_block_t get_block);
212void block_sync_page(struct page *); 214void block_sync_page(struct page *);
213sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 215sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
214int generic_commit_write(struct file *, struct page *, unsigned, unsigned); 216int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 42aa0a54b6f4..54398d2c6d8d 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -10,6 +10,8 @@ enum bug_trap_type {
10 BUG_TRAP_TYPE_BUG = 2, 10 BUG_TRAP_TYPE_BUG = 2,
11}; 11};
12 12
13struct pt_regs;
14
13#ifdef CONFIG_GENERIC_BUG 15#ifdef CONFIG_GENERIC_BUG
14#include <asm-generic/bug.h> 16#include <asm-generic/bug.h>
15 17
@@ -20,7 +22,7 @@ static inline int is_warning_bug(const struct bug_entry *bug)
20 22
21const struct bug_entry *find_bug(unsigned long bugaddr); 23const struct bug_entry *find_bug(unsigned long bugaddr);
22 24
23enum bug_trap_type report_bug(unsigned long bug_addr); 25enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
24 26
25int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, 27int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
26 struct module *); 28 struct module *);
@@ -31,7 +33,8 @@ int is_valid_bugaddr(unsigned long addr);
31 33
32#else /* !CONFIG_GENERIC_BUG */ 34#else /* !CONFIG_GENERIC_BUG */
33 35
34static inline enum bug_trap_type report_bug(unsigned long bug_addr) 36static inline enum bug_trap_type report_bug(unsigned long bug_addr,
37 struct pt_regs *regs)
35{ 38{
36 return BUG_TRAP_TYPE_BUG; 39 return BUG_TRAP_TYPE_BUG;
37} 40}
diff --git a/include/linux/capability.h b/include/linux/capability.h
index bbf8df7de28f..2dfa58555934 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -44,7 +44,6 @@ typedef struct __user_cap_data_struct {
44 44
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46 46
47#include <linux/spinlock.h>
48#include <asm/current.h> 47#include <asm/current.h>
49 48
50/* #define STRICT_CAP_T_TYPECHECKS */ 49/* #define STRICT_CAP_T_TYPECHECKS */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index f50f04bdbc16..2b641b176e7f 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -414,8 +414,8 @@ struct cdrom_generic_command
414#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ 414#define CDO_CHECK_TYPE 0x10 /* check type on open for data */
415 415
416/* Special codes used when specifying changer slots. */ 416/* Special codes used when specifying changer slots. */
417#define CDSL_NONE ((int) (~0U>>1)-1) 417#define CDSL_NONE (INT_MAX-1)
418#define CDSL_CURRENT ((int) (~0U>>1)) 418#define CDSL_CURRENT INT_MAX
419 419
420/* For partition based multisession access. IDE can handle 64 partitions 420/* For partition based multisession access. IDE can handle 64 partitions
421 * per drive - SCSI CD-ROM's use minors to differentiate between the 421 * per drive - SCSI CD-ROM's use minors to differentiate between the
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 8486e78f7335..e0bd46eb2414 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -23,6 +23,7 @@ enum clock_event_mode {
23 CLOCK_EVT_MODE_SHUTDOWN, 23 CLOCK_EVT_MODE_SHUTDOWN,
24 CLOCK_EVT_MODE_PERIODIC, 24 CLOCK_EVT_MODE_PERIODIC,
25 CLOCK_EVT_MODE_ONESHOT, 25 CLOCK_EVT_MODE_ONESHOT,
26 CLOCK_EVT_MODE_RESUME,
26}; 27};
27 28
28/* Clock event notification values */ 29/* Clock event notification values */
@@ -119,10 +120,6 @@ extern void clockevents_register_device(struct clock_event_device *dev);
119 120
120extern void clockevents_exchange_device(struct clock_event_device *old, 121extern void clockevents_exchange_device(struct clock_event_device *old,
121 struct clock_event_device *new); 122 struct clock_event_device *new);
122extern
123struct clock_event_device *clockevents_request_device(unsigned int features,
124 cpumask_t cpumask);
125extern void clockevents_release_device(struct clock_event_device *dev);
126extern void clockevents_set_mode(struct clock_event_device *dev, 123extern void clockevents_set_mode(struct clock_event_device *dev,
127 enum clock_event_mode mode); 124 enum clock_event_mode mode);
128extern int clockevents_register_notifier(struct notifier_block *nb); 125extern int clockevents_register_notifier(struct notifier_block *nb);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index bf297b03a4e4..16ea3374dddf 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -67,6 +67,12 @@ struct clocksource {
67 unsigned long flags; 67 unsigned long flags;
68 cycle_t (*vread)(void); 68 cycle_t (*vread)(void);
69 void (*resume)(void); 69 void (*resume)(void);
70#ifdef CONFIG_IA64
71 void *fsys_mmio; /* used by fsyscall asm code */
72#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
73#else
74#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
75#endif
70 76
71 /* timekeeping specific data, ignore */ 77 /* timekeeping specific data, ignore */
72 cycle_t cycle_interval; 78 cycle_t cycle_interval;
diff --git a/include/linux/cobalt-nvram.h b/include/linux/cobalt-nvram.h
deleted file mode 100644
index ea429562ff36..000000000000
--- a/include/linux/cobalt-nvram.h
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * $Id: cobalt-nvram.h,v 1.20 2001/10/17 23:16:55 thockin Exp $
3 * cobalt-nvram.h : defines for the various fields in the cobalt NVRAM
4 *
5 * Copyright 2001,2002 Sun Microsystems, Inc.
6 */
7
8#ifndef COBALT_NVRAM_H
9#define COBALT_NVRAM_H
10
11#include <linux/nvram.h>
12
13#define COBT_CMOS_INFO_MAX 0x7f /* top address allowed */
14#define COBT_CMOS_BIOS_DRIVE_INFO 0x12 /* drive info would go here */
15
16#define COBT_CMOS_CKS_START NVRAM_OFFSET(0x0e)
17#define COBT_CMOS_CKS_END NVRAM_OFFSET(0x7f)
18
19/* flag bytes - 16 flags for now, leave room for more */
20#define COBT_CMOS_FLAG_BYTE_0 NVRAM_OFFSET(0x10)
21#define COBT_CMOS_FLAG_BYTE_1 NVRAM_OFFSET(0x11)
22
23/* flags in flag bytes - up to 16 */
24#define COBT_CMOS_FLAG_MIN 0x0001
25#define COBT_CMOS_CONSOLE_FLAG 0x0001 /* console on/off */
26#define COBT_CMOS_DEBUG_FLAG 0x0002 /* ROM debug messages */
27#define COBT_CMOS_AUTO_PROMPT_FLAG 0x0004 /* boot to ROM prompt? */
28#define COBT_CMOS_CLEAN_BOOT_FLAG 0x0008 /* set by a clean shutdown */
29#define COBT_CMOS_HW_NOPROBE_FLAG 0x0010 /* go easy on the probing */
30#define COBT_CMOS_SYSFAULT_FLAG 0x0020 /* system fault detected */
31#define COBT_CMOS_OOPSPANIC_FLAG 0x0040 /* panic on oops */
32#define COBT_CMOS_DELAY_CACHE_FLAG 0x0080 /* delay cache initialization */
33#define COBT_CMOS_NOLOGO_FLAG 0x0100 /* hide "C" logo @ boot */
34#define COBT_CMOS_VERSION_FLAG 0x0200 /* the version field is valid */
35#define COBT_CMOS_FLAG_MAX 0x0200
36
37/* leave byte 0x12 blank - Linux looks for drive info here */
38
39/* CMOS structure version, valid if COBT_CMOS_VERSION_FLAG is true */
40#define COBT_CMOS_VERSION NVRAM_OFFSET(0x13)
41#define COBT_CMOS_VER_BTOCODE 1 /* min. version needed for btocode */
42
43/* index of default boot method */
44#define COBT_CMOS_BOOT_METHOD NVRAM_OFFSET(0x20)
45#define COBT_CMOS_BOOT_METHOD_DISK 0
46#define COBT_CMOS_BOOT_METHOD_ROM 1
47#define COBT_CMOS_BOOT_METHOD_NET 2
48
49#define COBT_CMOS_BOOT_DEV_MIN NVRAM_OFFSET(0x21)
50/* major #, minor # of first through fourth boot device */
51#define COBT_CMOS_BOOT_DEV0_MAJ NVRAM_OFFSET(0x21)
52#define COBT_CMOS_BOOT_DEV0_MIN NVRAM_OFFSET(0x22)
53#define COBT_CMOS_BOOT_DEV1_MAJ NVRAM_OFFSET(0x23)
54#define COBT_CMOS_BOOT_DEV1_MIN NVRAM_OFFSET(0x24)
55#define COBT_CMOS_BOOT_DEV2_MAJ NVRAM_OFFSET(0x25)
56#define COBT_CMOS_BOOT_DEV2_MIN NVRAM_OFFSET(0x26)
57#define COBT_CMOS_BOOT_DEV3_MAJ NVRAM_OFFSET(0x27)
58#define COBT_CMOS_BOOT_DEV3_MIN NVRAM_OFFSET(0x28)
59#define COBT_CMOS_BOOT_DEV_MAX NVRAM_OFFSET(0x28)
60
61/* checksum of bytes 0xe-0x7f */
62#define COBT_CMOS_CHECKSUM NVRAM_OFFSET(0x2e)
63
64/* running uptime counter, units of 5 minutes (32 bits =~ 41000 years) */
65#define COBT_CMOS_UPTIME_0 NVRAM_OFFSET(0x30)
66#define COBT_CMOS_UPTIME_1 NVRAM_OFFSET(0x31)
67#define COBT_CMOS_UPTIME_2 NVRAM_OFFSET(0x32)
68#define COBT_CMOS_UPTIME_3 NVRAM_OFFSET(0x33)
69
70/* count of successful boots (32 bits) */
71#define COBT_CMOS_BOOTCOUNT_0 NVRAM_OFFSET(0x38)
72#define COBT_CMOS_BOOTCOUNT_1 NVRAM_OFFSET(0x39)
73#define COBT_CMOS_BOOTCOUNT_2 NVRAM_OFFSET(0x3a)
74#define COBT_CMOS_BOOTCOUNT_3 NVRAM_OFFSET(0x3b)
75
76/* 13 bytes: system serial number, same as on the back of the system */
77#define COBT_CMOS_SYS_SERNUM_LEN 13
78#define COBT_CMOS_SYS_SERNUM_0 NVRAM_OFFSET(0x40)
79#define COBT_CMOS_SYS_SERNUM_1 NVRAM_OFFSET(0x41)
80#define COBT_CMOS_SYS_SERNUM_2 NVRAM_OFFSET(0x42)
81#define COBT_CMOS_SYS_SERNUM_3 NVRAM_OFFSET(0x43)
82#define COBT_CMOS_SYS_SERNUM_4 NVRAM_OFFSET(0x44)
83#define COBT_CMOS_SYS_SERNUM_5 NVRAM_OFFSET(0x45)
84#define COBT_CMOS_SYS_SERNUM_6 NVRAM_OFFSET(0x46)
85#define COBT_CMOS_SYS_SERNUM_7 NVRAM_OFFSET(0x47)
86#define COBT_CMOS_SYS_SERNUM_8 NVRAM_OFFSET(0x48)
87#define COBT_CMOS_SYS_SERNUM_9 NVRAM_OFFSET(0x49)
88#define COBT_CMOS_SYS_SERNUM_10 NVRAM_OFFSET(0x4a)
89#define COBT_CMOS_SYS_SERNUM_11 NVRAM_OFFSET(0x4b)
90#define COBT_CMOS_SYS_SERNUM_12 NVRAM_OFFSET(0x4c)
91/* checksum for serial num - 1 byte */
92#define COBT_CMOS_SYS_SERNUM_CSUM NVRAM_OFFSET(0x4f)
93
94#define COBT_CMOS_ROM_REV_MAJ NVRAM_OFFSET(0x50)
95#define COBT_CMOS_ROM_REV_MIN NVRAM_OFFSET(0x51)
96#define COBT_CMOS_ROM_REV_REV NVRAM_OFFSET(0x52)
97
98#define COBT_CMOS_BTO_CODE_0 NVRAM_OFFSET(0x53)
99#define COBT_CMOS_BTO_CODE_1 NVRAM_OFFSET(0x54)
100#define COBT_CMOS_BTO_CODE_2 NVRAM_OFFSET(0x55)
101#define COBT_CMOS_BTO_CODE_3 NVRAM_OFFSET(0x56)
102
103#define COBT_CMOS_BTO_IP_CSUM NVRAM_OFFSET(0x57)
104#define COBT_CMOS_BTO_IP_0 NVRAM_OFFSET(0x58)
105#define COBT_CMOS_BTO_IP_1 NVRAM_OFFSET(0x59)
106#define COBT_CMOS_BTO_IP_2 NVRAM_OFFSET(0x5a)
107#define COBT_CMOS_BTO_IP_3 NVRAM_OFFSET(0x5b)
108
109#endif /* COBALT_NVRAM_H */
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index e4ac016ad272..1c47a34aa794 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -36,16 +36,12 @@ extern const struct file_operations coda_ioctl_operations;
36 36
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
39int coda_flush(struct file *f, fl_owner_t id);
40int coda_release(struct inode *i, struct file *f); 39int coda_release(struct inode *i, struct file *f);
41int coda_permission(struct inode *inode, int mask, struct nameidata *nd); 40int coda_permission(struct inode *inode, int mask, struct nameidata *nd);
42int coda_revalidate_inode(struct dentry *); 41int coda_revalidate_inode(struct dentry *);
43int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); 42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
44int coda_setattr(struct dentry *, struct iattr *); 43int coda_setattr(struct dentry *, struct iattr *);
45 44
46/* global variables */
47extern int coda_fake_statfs;
48
49/* this file: heloers */ 45/* this file: heloers */
50static __inline__ struct CodaFid *coda_i2f(struct inode *); 46static __inline__ struct CodaFid *coda_i2f(struct inode *);
51static __inline__ char *coda_i2s(struct inode *); 47static __inline__ char *coda_i2s(struct inode *);
diff --git a/include/linux/coda_proc.h b/include/linux/coda_proc.h
deleted file mode 100644
index 0dc1b0458e75..000000000000
--- a/include/linux/coda_proc.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * coda_statis.h
3 *
4 * CODA operation statistics
5 *
6 * (c) March, 1998
7 * by Michihiro Kuramochi, Zhenyu Xia and Zhanyong Wan
8 * zhanyong.wan@yale.edu
9 *
10 */
11
12#ifndef _CODA_PROC_H
13#define _CODA_PROC_H
14
15void coda_sysctl_init(void);
16void coda_sysctl_clean(void);
17
18#include <linux/sysctl.h>
19#include <linux/coda_fs_i.h>
20#include <linux/coda.h>
21
22/* these four files are presented to show the result of the statistics:
23 *
24 * /proc/fs/coda/vfs_stats
25 * cache_inv_stats
26 *
27 * these four files are presented to reset the statistics to 0:
28 *
29 * /proc/sys/coda/vfs_stats
30 * cache_inv_stats
31 */
32
33/* VFS operation statistics */
34struct coda_vfs_stats
35{
36 /* file operations */
37 int open;
38 int flush;
39 int release;
40 int fsync;
41
42 /* dir operations */
43 int readdir;
44
45 /* inode operations */
46 int create;
47 int lookup;
48 int link;
49 int unlink;
50 int symlink;
51 int mkdir;
52 int rmdir;
53 int rename;
54 int permission;
55
56 /* symlink operatoins*/
57 int follow_link;
58 int readlink;
59};
60
61/* cache invalidation statistics */
62struct coda_cache_inv_stats
63{
64 int flush;
65 int purge_user;
66 int zap_dir;
67 int zap_file;
68 int zap_vnode;
69 int purge_fid;
70 int replace;
71};
72
73/* these global variables hold the actual statistics data */
74extern struct coda_vfs_stats coda_vfs_stat;
75
76#endif /* _CODA_PROC_H */
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index b541bb3d1f4b..07ae8f846055 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -8,11 +8,6 @@
8 8
9struct kstatfs; 9struct kstatfs;
10 10
11struct coda_sb_info
12{
13 struct venus_comm *sbi_vcomm;
14};
15
16/* communication pending/processing queues */ 11/* communication pending/processing queues */
17struct venus_comm { 12struct venus_comm {
18 u_long vc_seq; 13 u_long vc_seq;
@@ -24,9 +19,9 @@ struct venus_comm {
24}; 19};
25 20
26 21
27static inline struct coda_sb_info *coda_sbp(struct super_block *sb) 22static inline struct venus_comm *coda_vcp(struct super_block *sb)
28{ 23{
29 return ((struct coda_sb_info *)((sb)->s_fs_info)); 24 return (struct venus_comm *)((sb)->s_fs_info);
30} 25}
31 26
32 27
@@ -38,9 +33,6 @@ int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
38int venus_lookup(struct super_block *sb, struct CodaFid *fid, 33int venus_lookup(struct super_block *sb, struct CodaFid *fid,
39 const char *name, int length, int *type, 34 const char *name, int length, int *type,
40 struct CodaFid *resfid); 35 struct CodaFid *resfid);
41int venus_store(struct super_block *sb, struct CodaFid *fid, int flags,
42 vuid_t uid);
43int venus_release(struct super_block *sb, struct CodaFid *fid, int flags);
44int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, 36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
45 vuid_t uid); 37 vuid_t uid);
46int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, 38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
@@ -74,8 +66,6 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
74 66
75 67
76/* messages between coda filesystem in kernel and Venus */ 68/* messages between coda filesystem in kernel and Venus */
77extern int coda_hard;
78extern unsigned long coda_timeout;
79struct upc_req { 69struct upc_req {
80 struct list_head uc_chain; 70 struct list_head uc_chain;
81 caddr_t uc_data; 71 caddr_t uc_data;
@@ -85,7 +75,6 @@ struct upc_req {
85 u_short uc_opcode; /* copied from data to save lookup */ 75 u_short uc_opcode; /* copied from data to save lookup */
86 int uc_unique; 76 int uc_unique;
87 wait_queue_head_t uc_sleep; /* process' wait queue */ 77 wait_queue_head_t uc_sleep; /* process' wait queue */
88 unsigned long uc_posttime;
89}; 78};
90 79
91#define REQ_ASYNC 0x1 80#define REQ_ASYNC 0x1
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index a03e9398a6c2..14f7494280f0 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -23,3 +23,21 @@
23 * code 23 * code
24 */ 24 */
25#define uninitialized_var(x) x = x 25#define uninitialized_var(x) x = x
26
27#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3)
28/* Mark functions as cold. gcc will assume any path leading to a call
29 to them will be unlikely. This means a lot of manual unlikely()s
30 are unnecessary now for any paths leading to the usual suspects
31 like BUG(), printk(), panic() etc. [but let's keep them for now for
32 older compilers]
33
34 Early snapshots of gcc 4.3 don't support this and we can't detect this
35 in the preprocessor, but we can live with this because they're unreleased.
36 Maketime probing would be overkill here.
37
38 gcc also has a __attribute__((__hot__)) to move hot functions into
39 a special section, but I don't see any sense in this right now in
40 the kernel context */
41#define __cold __attribute__((__cold__))
42
43#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 8287a72bb6a9..12a1291855e2 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -174,4 +174,13 @@ extern void __chk_io_ptr(const void __iomem *);
174# define __attribute_const__ /* unimplemented */ 174# define __attribute_const__ /* unimplemented */
175#endif 175#endif
176 176
177/*
178 * Tell gcc if a function is cold. The compiler will assume any path
179 * directly leading to the call is unlikely.
180 */
181
182#ifndef __cold
183#define __cold
184#endif
185
177#endif /* __LINUX_COMPILER_H */ 186#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index fef6f3d0a4a7..8c6967f3fb11 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -40,9 +40,9 @@
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/list.h> 41#include <linux/list.h>
42#include <linux/kref.h> 42#include <linux/kref.h>
43#include <linux/mutex.h>
43 44
44#include <asm/atomic.h> 45#include <asm/atomic.h>
45#include <asm/semaphore.h>
46 46
47#define CONFIGFS_ITEM_NAME_LEN 20 47#define CONFIGFS_ITEM_NAME_LEN 20
48 48
@@ -75,7 +75,6 @@ extern void config_item_init(struct config_item *);
75extern void config_item_init_type_name(struct config_item *item, 75extern void config_item_init_type_name(struct config_item *item,
76 const char *name, 76 const char *name,
77 struct config_item_type *type); 77 struct config_item_type *type);
78extern void config_item_cleanup(struct config_item *);
79 78
80extern struct config_item * config_item_get(struct config_item *); 79extern struct config_item * config_item_get(struct config_item *);
81extern void config_item_put(struct config_item *); 80extern void config_item_put(struct config_item *);
@@ -87,12 +86,10 @@ struct config_item_type {
87 struct configfs_attribute **ct_attrs; 86 struct configfs_attribute **ct_attrs;
88}; 87};
89 88
90
91/** 89/**
92 * group - a group of config_items of a specific type, belonging 90 * group - a group of config_items of a specific type, belonging
93 * to a specific subsystem. 91 * to a specific subsystem.
94 */ 92 */
95
96struct config_group { 93struct config_group {
97 struct config_item cg_item; 94 struct config_item cg_item;
98 struct list_head cg_children; 95 struct list_head cg_children;
@@ -100,13 +97,11 @@ struct config_group {
100 struct config_group **default_groups; 97 struct config_group **default_groups;
101}; 98};
102 99
103
104extern void config_group_init(struct config_group *group); 100extern void config_group_init(struct config_group *group);
105extern void config_group_init_type_name(struct config_group *group, 101extern void config_group_init_type_name(struct config_group *group,
106 const char *name, 102 const char *name,
107 struct config_item_type *type); 103 struct config_item_type *type);
108 104
109
110static inline struct config_group *to_config_group(struct config_item *item) 105static inline struct config_group *to_config_group(struct config_item *item)
111{ 106{
112 return item ? container_of(item,struct config_group,cg_item) : NULL; 107 return item ? container_of(item,struct config_group,cg_item) : NULL;
@@ -122,7 +117,8 @@ static inline void config_group_put(struct config_group *group)
122 config_item_put(&group->cg_item); 117 config_item_put(&group->cg_item);
123} 118}
124 119
125extern struct config_item *config_group_find_obj(struct config_group *, const char *); 120extern struct config_item *config_group_find_item(struct config_group *,
121 const char *);
126 122
127 123
128struct configfs_attribute { 124struct configfs_attribute {
@@ -131,6 +127,22 @@ struct configfs_attribute {
131 mode_t ca_mode; 127 mode_t ca_mode;
132}; 128};
133 129
130/*
131 * Users often need to create attribute structures for their configurable
132 * attributes, containing a configfs_attribute member and function pointers
133 * for the show() and store() operations on that attribute. They can use
134 * this macro (similar to sysfs' __ATTR) to make defining attributes easier.
135 */
136#define __CONFIGFS_ATTR(_name, _mode, _show, _store) \
137{ \
138 .attr = { \
139 .ca_name = __stringify(_name), \
140 .ca_mode = _mode, \
141 .ca_owner = THIS_MODULE, \
142 }, \
143 .show = _show, \
144 .store = _store, \
145}
134 146
135/* 147/*
136 * If allow_link() exists, the item can symlink(2) out to other 148 * If allow_link() exists, the item can symlink(2) out to other
@@ -157,12 +169,13 @@ struct configfs_group_operations {
157 struct config_item *(*make_item)(struct config_group *group, const char *name); 169 struct config_item *(*make_item)(struct config_group *group, const char *name);
158 struct config_group *(*make_group)(struct config_group *group, const char *name); 170 struct config_group *(*make_group)(struct config_group *group, const char *name);
159 int (*commit_item)(struct config_item *item); 171 int (*commit_item)(struct config_item *item);
172 void (*disconnect_notify)(struct config_group *group, struct config_item *item);
160 void (*drop_item)(struct config_group *group, struct config_item *item); 173 void (*drop_item)(struct config_group *group, struct config_item *item);
161}; 174};
162 175
163struct configfs_subsystem { 176struct configfs_subsystem {
164 struct config_group su_group; 177 struct config_group su_group;
165 struct semaphore su_sem; 178 struct mutex su_mutex;
166}; 179};
167 180
168static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group) 181static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)
@@ -175,6 +188,11 @@ static inline struct configfs_subsystem *to_configfs_subsystem(struct config_gro
175int configfs_register_subsystem(struct configfs_subsystem *subsys); 188int configfs_register_subsystem(struct configfs_subsystem *subsys);
176void configfs_unregister_subsystem(struct configfs_subsystem *subsys); 189void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
177 190
191/* These functions can sleep and can alloc with GFP_KERNEL */
192/* WARNING: These cannot be called underneath configfs callbacks!! */
193int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target);
194void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target);
195
178#endif /* __KERNEL__ */ 196#endif /* __KERNEL__ */
179 197
180#endif /* _CONFIGFS_H_ */ 198#endif /* _CONFIGFS_H_ */
diff --git a/include/linux/console.h b/include/linux/console.h
index 62ef6e11d0d2..56a7bcda49cb 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -15,7 +15,6 @@
15#define _LINUX_CONSOLE_H_ 1 15#define _LINUX_CONSOLE_H_ 1
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/spinlock.h>
19 18
20struct vc_data; 19struct vc_data;
21struct console_font_op; 20struct console_font_op;
@@ -99,6 +98,7 @@ struct console {
99 struct tty_driver *(*device)(struct console *, int *); 98 struct tty_driver *(*device)(struct console *, int *);
100 void (*unblank)(void); 99 void (*unblank)(void);
101 int (*setup)(struct console *, char *); 100 int (*setup)(struct console *, char *);
101 int (*early_setup)(void);
102 short flags; 102 short flags;
103 short index; 103 short index;
104 int cflag; 104 int cflag;
@@ -107,6 +107,7 @@ struct console {
107}; 107};
108 108
109extern int add_preferred_console(char *name, int idx, char *options); 109extern int add_preferred_console(char *name, int idx, char *options);
110extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options);
110extern void register_console(struct console *); 111extern void register_console(struct console *);
111extern int unregister_console(struct console *); 112extern int unregister_console(struct console *);
112extern struct console *console_drivers; 113extern struct console *console_drivers;
diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h
index 82c9a1f11020..06b2768c603f 100644
--- a/include/linux/consolemap.h
+++ b/include/linux/consolemap.h
@@ -8,9 +8,12 @@
8#define IBMPC_MAP 2 8#define IBMPC_MAP 2
9#define USER_MAP 3 9#define USER_MAP 3
10 10
11#include <linux/types.h>
12
11struct vc_data; 13struct vc_data;
12 14
13extern unsigned char inverse_translate(struct vc_data *conp, int glyph); 15extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode);
14extern unsigned short *set_translate(int m, struct vc_data *vc); 16extern unsigned short *set_translate(int m, struct vc_data *vc);
15extern int conv_uni_to_pc(struct vc_data *conp, long ucs); 17extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
18extern u32 conv_8bit_to_uni(unsigned char c);
16void console_map_init(void); 19void console_map_init(void);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 3b2df2523f1d..c2236bbff412 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -120,7 +120,6 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
120 120
121#define lock_cpu_hotplug() do { } while (0) 121#define lock_cpu_hotplug() do { } while (0)
122#define unlock_cpu_hotplug() do { } while (0) 122#define unlock_cpu_hotplug() do { } while (0)
123#define lock_cpu_hotplug_interruptible() 0
124#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 123#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
125#define register_hotcpu_notifier(nb) do { (void)(nb); } while (0) 124#define register_hotcpu_notifier(nb) do { (void)(nb); } while (0)
126#define unregister_hotcpu_notifier(nb) do { (void)(nb); } while (0) 125#define unregister_hotcpu_notifier(nb) do { (void)(nb); } while (0)
diff --git a/include/linux/crc7.h b/include/linux/crc7.h
new file mode 100644
index 000000000000..1786e772d5c6
--- /dev/null
+++ b/include/linux/crc7.h
@@ -0,0 +1,14 @@
1#ifndef _LINUX_CRC7_H
2#define _LINUX_CRC7_H
3#include <linux/types.h>
4
5extern const u8 crc7_syndrome_table[256];
6
7static inline u8 crc7_byte(u8 crc, u8 data)
8{
9 return crc7_syndrome_table[(crc << 1) ^ data];
10}
11
12extern u8 crc7(u8 crc, const u8 *buffer, size_t len);
13
14#endif
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index 0fe7cdf326f7..98c69ab80c84 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -12,6 +12,7 @@
12 12
13#ifdef CONFIG_PROFILING 13#ifdef CONFIG_PROFILING
14 14
15#include <linux/dcache.h>
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17struct dcookie_user; 18struct dcookie_user;
diff --git a/include/linux/device.h b/include/linux/device.h
index be2debed70d2..d9f0a57f5a2f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -572,6 +572,16 @@ dev_dbg(struct device * dev, const char * fmt, ...)
572} 572}
573#endif 573#endif
574 574
575#ifdef VERBOSE_DEBUG
576#define dev_vdbg dev_dbg
577#else
578static inline int __attribute__ ((format (printf, 2, 3)))
579dev_vdbg(struct device * dev, const char * fmt, ...)
580{
581 return 0;
582}
583#endif
584
575#define dev_err(dev, format, arg...) \ 585#define dev_err(dev, format, arg...) \
576 dev_printk(KERN_ERR , dev , format , ## arg) 586 dev_printk(KERN_ERR , dev , format , ## arg)
577#define dev_info(dev, format, arg...) \ 587#define dev_info(dev, format, arg...) \
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 9a663c6db16a..2dc21cbeb304 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -31,7 +31,11 @@ static inline int valid_dma_direction(int dma_direction)
31 (dma_direction == DMA_FROM_DEVICE)); 31 (dma_direction == DMA_FROM_DEVICE));
32} 32}
33 33
34#ifdef CONFIG_HAS_DMA
34#include <asm/dma-mapping.h> 35#include <asm/dma-mapping.h>
36#else
37#include <asm-generic/dma-mapping-broken.h>
38#endif
35 39
36/* Backwards compat, remove in 2.7.x */ 40/* Backwards compat, remove in 2.7.x */
37#define dma_sync_single dma_sync_single_for_cpu 41#define dma_sync_single dma_sync_single_for_cpu
diff --git a/include/linux/ds17287rtc.h b/include/linux/ds17287rtc.h
index c281ba42e28f..d85d3f497b96 100644
--- a/include/linux/ds17287rtc.h
+++ b/include/linux/ds17287rtc.h
@@ -11,7 +11,6 @@
11#define __LINUX_DS17287RTC_H 11#define __LINUX_DS17287RTC_H
12 12
13#include <linux/rtc.h> /* get the user-level API */ 13#include <linux/rtc.h> /* get the user-level API */
14#include <linux/spinlock.h> /* spinlock_t */
15#include <linux/mc146818rtc.h> 14#include <linux/mc146818rtc.h>
16 15
17/* Register A */ 16/* Register A */
diff --git a/include/linux/edac.h b/include/linux/edac.h
new file mode 100644
index 000000000000..eab451e69a91
--- /dev/null
+++ b/include/linux/edac.h
@@ -0,0 +1,29 @@
1/*
2 * Generic EDAC defs
3 *
4 * Author: Dave Jiang <djiang@mvista.com>
5 *
6 * 2006-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 */
12#ifndef _LINUX_EDAC_H_
13#define _LINUX_EDAC_H_
14
15#include <asm/atomic.h>
16
17#define EDAC_OPSTATE_INVAL -1
18#define EDAC_OPSTATE_POLL 0
19#define EDAC_OPSTATE_NMI 1
20#define EDAC_OPSTATE_INT 2
21
22extern int edac_op_state;
23extern int edac_err_assert;
24extern atomic_t edac_handlers;
25
26extern int edac_handler_set(void);
27extern void edac_atomic_assert_error(void);
28
29#endif
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index dfed8009ebff..16cb25cbf7c5 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -45,6 +45,7 @@ extern efs_block_t efs_map_block(struct inode *, efs_block_t);
45extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int); 45extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int);
46 46
47extern struct dentry *efs_lookup(struct inode *, struct dentry *, struct nameidata *); 47extern struct dentry *efs_lookup(struct inode *, struct dentry *, struct nameidata *);
48extern struct dentry *efs_get_dentry(struct super_block *sb, void *vobjp);
48extern struct dentry *efs_get_parent(struct dentry *); 49extern struct dentry *efs_get_parent(struct dentry *);
49extern int efs_bmap(struct inode *, int); 50extern int efs_bmap(struct inode *, int);
50 51
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 0311bad838b1..5834e843a946 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -20,7 +20,8 @@
20#define EM_PARISC 15 /* HPPA */ 20#define EM_PARISC 15 /* HPPA */
21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ 21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
22#define EM_PPC 20 /* PowerPC */ 22#define EM_PPC 20 /* PowerPC */
23#define EM_PPC64 21 /* PowerPC64 */ 23#define EM_PPC64 21 /* PowerPC64 */
24#define EM_SPU 23 /* Cell BE SPU */
24#define EM_SH 42 /* SuperH */ 25#define EM_SH 42 /* SuperH */
25#define EM_SPARCV9 43 /* SPARC v9 64-bit */ 26#define EM_SPARCV9 43 /* SPARC v9 64-bit */
26#define EM_IA_64 50 /* HP/Intel IA-64 */ 27#define EM_IA_64 50 /* HP/Intel IA-64 */
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index 9a1e0674e56c..e831759b2fb5 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -38,17 +38,25 @@
38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two") 38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef) 39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
40 */ 40 */
41#define ELFNOTE(name, type, desctype, descdata) \ 41#define ELFNOTE_START(name, type, flags) \
42.pushsection .note.name, "",@note ; \ 42.pushsection .note.name, flags,@note ; \
43 .align 4 ; \ 43 .balign 4 ; \
44 .long 2f - 1f /* namesz */ ; \ 44 .long 2f - 1f /* namesz */ ; \
45 .long 4f - 3f /* descsz */ ; \ 45 .long 4484f - 3f /* descsz */ ; \
46 .long type ; \ 46 .long type ; \
471:.asciz #name ; \ 471:.asciz #name ; \
482:.align 4 ; \ 482:.balign 4 ; \
493:desctype descdata ; \ 493:
504:.align 4 ; \ 50
51#define ELFNOTE_END \
524484:.balign 4 ; \
51.popsection ; 53.popsection ;
54
55#define ELFNOTE(name, type, desc) \
56 ELFNOTE_START(name, type, "") \
57 desc ; \
58 ELFNOTE_END
59
52#else /* !__ASSEMBLER__ */ 60#else /* !__ASSEMBLER__ */
53#include <linux/elf.h> 61#include <linux/elf.h>
54/* 62/*
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
new file mode 100644
index 000000000000..8872fe8392d6
--- /dev/null
+++ b/include/linux/exportfs.h
@@ -0,0 +1,126 @@
1#ifndef LINUX_EXPORTFS_H
2#define LINUX_EXPORTFS_H 1
3
4#include <linux/types.h>
5
6struct dentry;
7struct super_block;
8struct vfsmount;
9
10
11/**
12 * struct export_operations - for nfsd to communicate with file systems
13 * @decode_fh: decode a file handle fragment and return a &struct dentry
14 * @encode_fh: encode a file handle fragment from a dentry
15 * @get_name: find the name for a given inode in a given directory
16 * @get_parent: find the parent of a given directory
17 * @get_dentry: find a dentry for the inode given a file handle sub-fragment
18 * @find_exported_dentry:
19 * set by the exporting module to a standard helper function.
20 *
21 * Description:
22 * The export_operations structure provides a means for nfsd to communicate
23 * with a particular exported file system - particularly enabling nfsd and
24 * the filesystem to co-operate when dealing with file handles.
25 *
26 * export_operations contains two basic operation for dealing with file
27 * handles, decode_fh() and encode_fh(), and allows for some other
28 * operations to be defined which standard helper routines use to get
29 * specific information from the filesystem.
30 *
31 * nfsd encodes information use to determine which filesystem a filehandle
32 * applies to in the initial part of the file handle. The remainder, termed
33 * a file handle fragment, is controlled completely by the filesystem. The
34 * standard helper routines assume that this fragment will contain one or
35 * two sub-fragments, one which identifies the file, and one which may be
36 * used to identify the (a) directory containing the file.
37 *
38 * In some situations, nfsd needs to get a dentry which is connected into a
39 * specific part of the file tree. To allow for this, it passes the
40 * function acceptable() together with a @context which can be used to see
41 * if the dentry is acceptable. As there can be multiple dentrys for a
42 * given file, the filesystem should check each one for acceptability before
43 * looking for the next. As soon as an acceptable one is found, it should
44 * be returned.
45 *
46 * decode_fh:
47 * @decode_fh is given a &struct super_block (@sb), a file handle fragment
48 * (@fh, @fh_len) and an acceptability testing function (@acceptable,
49 * @context). It should return a &struct dentry which refers to the same
50 * file that the file handle fragment refers to, and which passes the
51 * acceptability test. If it cannot, it should return a %NULL pointer if
52 * the file was found but no acceptable &dentries were available, or a
53 * %ERR_PTR error code indicating why it couldn't be found (e.g. %ENOENT or
54 * %ENOMEM).
55 *
56 * encode_fh:
57 * @encode_fh should store in the file handle fragment @fh (using at most
58 * @max_len bytes) information that can be used by @decode_fh to recover the
59 * file refered to by the &struct dentry @de. If the @connectable flag is
60 * set, the encode_fh() should store sufficient information so that a good
61 * attempt can be made to find not only the file but also it's place in the
62 * filesystem. This typically means storing a reference to de->d_parent in
63 * the filehandle fragment. encode_fh() should return the number of bytes
64 * stored or a negative error code such as %-ENOSPC
65 *
66 * get_name:
67 * @get_name should find a name for the given @child in the given @parent
68 * directory. The name should be stored in the @name (with the
69 * understanding that it is already pointing to a a %NAME_MAX+1 sized
70 * buffer. get_name() should return %0 on success, a negative error code
71 * or error. @get_name will be called without @parent->i_mutex held.
72 *
73 * get_parent:
74 * @get_parent should find the parent directory for the given @child which
75 * is also a directory. In the event that it cannot be found, or storage
76 * space cannot be allocated, a %ERR_PTR should be returned.
77 *
78 * get_dentry:
79 * Given a &super_block (@sb) and a pointer to a file-system specific inode
80 * identifier, possibly an inode number, (@inump) get_dentry() should find
81 * the identified inode and return a dentry for that inode. Any suitable
82 * dentry can be returned including, if necessary, a new dentry created with
83 * d_alloc_root. The caller can then find any other extant dentrys by
84 * following the d_alias links. If a new dentry was created using
85 * d_alloc_root, DCACHE_NFSD_DISCONNECTED should be set, and the dentry
86 * should be d_rehash()ed.
87 *
88 * If the inode cannot be found, either a %NULL pointer or an %ERR_PTR code
89 * can be returned. The @inump will be whatever was passed to
90 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
91 *
92 * Locking rules:
93 * get_parent is called with child->d_inode->i_mutex down
94 * get_name is not (which is possibly inconsistent)
95 */
96
97struct export_operations {
98 struct dentry *(*decode_fh)(struct super_block *sb, __u32 *fh,
99 int fh_len, int fh_type,
100 int (*acceptable)(void *context, struct dentry *de),
101 void *context);
102 int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len,
103 int connectable);
104 int (*get_name)(struct dentry *parent, char *name,
105 struct dentry *child);
106 struct dentry * (*get_parent)(struct dentry *child);
107 struct dentry * (*get_dentry)(struct super_block *sb, void *inump);
108
109 /* This is set by the exporting module to a standard helper */
110 struct dentry * (*find_exported_dentry)(
111 struct super_block *sb, void *obj, void *parent,
112 int (*acceptable)(void *context, struct dentry *de),
113 void *context);
114};
115
116extern struct dentry *find_exported_dentry(struct super_block *sb, void *obj,
117 void *parent, int (*acceptable)(void *context, struct dentry *de),
118 void *context);
119
120extern int exportfs_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len,
121 int connectable);
122extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, __u32 *fh,
123 int fh_len, int fileid_type, int (*acceptable)(void *, struct dentry *),
124 void *context);
125
126#endif /* LINUX_EXPORTFS_H */
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index 4eda0ed76a48..d149f2959e67 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -33,6 +33,8 @@ struct ext2_sb_info {
33 unsigned long s_gdb_count; /* Number of group descriptor blocks */ 33 unsigned long s_gdb_count; /* Number of group descriptor blocks */
34 unsigned long s_desc_per_block; /* Number of group descriptors per block */ 34 unsigned long s_desc_per_block; /* Number of group descriptors per block */
35 unsigned long s_groups_count; /* Number of groups in the fs */ 35 unsigned long s_groups_count; /* Number of groups in the fs */
36 unsigned long s_overhead_last; /* Last calculated overhead */
37 unsigned long s_blocks_last; /* Last seen block count */
36 struct buffer_head * s_sbh; /* Buffer containing the super block */ 38 struct buffer_head * s_sbh; /* Buffer containing the super block */
37 struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */ 39 struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
38 struct buffer_head ** s_group_desc; 40 struct buffer_head ** s_group_desc;
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index f61309c81cc4..d3c08353edf6 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -38,6 +38,8 @@ struct ext3_sb_info {
38 unsigned long s_gdb_count; /* Number of group descriptor blocks */ 38 unsigned long s_gdb_count; /* Number of group descriptor blocks */
39 unsigned long s_desc_per_block; /* Number of group descriptors per block */ 39 unsigned long s_desc_per_block; /* Number of group descriptors per block */
40 unsigned long s_groups_count; /* Number of groups in the fs */ 40 unsigned long s_groups_count; /* Number of groups in the fs */
41 unsigned long s_overhead_last; /* Last calculated overhead */
42 unsigned long s_blocks_last; /* Last seen block count */
41 struct buffer_head * s_sbh; /* Buffer containing the super block */ 43 struct buffer_head * s_sbh; /* Buffer containing the super block */
42 struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */ 44 struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */
43 struct buffer_head ** s_group_desc; 45 struct buffer_head ** s_group_desc;
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index de1f9f78625a..cdee7aaa57aa 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -71,7 +71,7 @@
71/* 71/*
72 * Maximal count of links to a file 72 * Maximal count of links to a file
73 */ 73 */
74#define EXT4_LINK_MAX 32000 74#define EXT4_LINK_MAX 65000
75 75
76/* 76/*
77 * Macro-instructions used to manage several block sizes 77 * Macro-instructions used to manage several block sizes
@@ -102,6 +102,7 @@
102 EXT4_GOOD_OLD_FIRST_INO : \ 102 EXT4_GOOD_OLD_FIRST_INO : \
103 (s)->s_first_ino) 103 (s)->s_first_ino)
104#endif 104#endif
105#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits)))
105 106
106/* 107/*
107 * Macro-instructions used to manage fragments 108 * Macro-instructions used to manage fragments
@@ -201,6 +202,7 @@ struct ext4_group_desc
201#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ 202#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */
202#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ 203#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */
203#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ 204#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */
205#define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */
204 206
205/* Used to pass group descriptor data when online resize is done */ 207/* Used to pass group descriptor data when online resize is done */
206struct ext4_new_group_input { 208struct ext4_new_group_input {
@@ -225,6 +227,11 @@ struct ext4_new_group_data {
225 __u32 free_blocks_count; 227 __u32 free_blocks_count;
226}; 228};
227 229
230/*
231 * Following is used by preallocation code to tell get_blocks() that we
232 * want uninitialzed extents.
233 */
234#define EXT4_CREATE_UNINITIALIZED_EXT 2
228 235
229/* 236/*
230 * ioctl commands 237 * ioctl commands
@@ -237,7 +244,7 @@ struct ext4_new_group_data {
237#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) 244#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
238#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION 245#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
239#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION 246#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION
240#ifdef CONFIG_JBD_DEBUG 247#ifdef CONFIG_JBD2_DEBUG
241#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) 248#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
242#endif 249#endif
243#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) 250#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
@@ -253,7 +260,7 @@ struct ext4_new_group_data {
253#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) 260#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)
254#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) 261#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int)
255#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) 262#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
256#ifdef CONFIG_JBD_DEBUG 263#ifdef CONFIG_JBD2_DEBUG
257#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) 264#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
258#endif 265#endif
259#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION 266#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
@@ -282,7 +289,7 @@ struct ext4_inode {
282 __le16 i_uid; /* Low 16 bits of Owner Uid */ 289 __le16 i_uid; /* Low 16 bits of Owner Uid */
283 __le32 i_size; /* Size in bytes */ 290 __le32 i_size; /* Size in bytes */
284 __le32 i_atime; /* Access time */ 291 __le32 i_atime; /* Access time */
285 __le32 i_ctime; /* Creation time */ 292 __le32 i_ctime; /* Inode Change time */
286 __le32 i_mtime; /* Modification time */ 293 __le32 i_mtime; /* Modification time */
287 __le32 i_dtime; /* Deletion Time */ 294 __le32 i_dtime; /* Deletion Time */
288 __le16 i_gid; /* Low 16 bits of Group Id */ 295 __le16 i_gid; /* Low 16 bits of Group Id */
@@ -331,10 +338,85 @@ struct ext4_inode {
331 } osd2; /* OS dependent 2 */ 338 } osd2; /* OS dependent 2 */
332 __le16 i_extra_isize; 339 __le16 i_extra_isize;
333 __le16 i_pad1; 340 __le16 i_pad1;
341 __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
342 __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
343 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
344 __le32 i_crtime; /* File Creation time */
345 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
334}; 346};
335 347
336#define i_size_high i_dir_acl 348#define i_size_high i_dir_acl
337 349
350#define EXT4_EPOCH_BITS 2
351#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
352#define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS)
353
354/*
355 * Extended fields will fit into an inode if the filesystem was formatted
356 * with large inodes (-I 256 or larger) and there are not currently any EAs
357 * consuming all of the available space. For new inodes we always reserve
358 * enough space for the kernel's known extended fields, but for inodes
359 * created with an old kernel this might not have been the case. None of
360 * the extended inode fields is critical for correct filesystem operation.
361 * This macro checks if a certain field fits in the inode. Note that
362 * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
363 */
364#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \
365 ((offsetof(typeof(*ext4_inode), field) + \
366 sizeof((ext4_inode)->field)) \
367 <= (EXT4_GOOD_OLD_INODE_SIZE + \
368 (einode)->i_extra_isize)) \
369
370static inline __le32 ext4_encode_extra_time(struct timespec *time)
371{
372 return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
373 time->tv_sec >> 32 : 0) |
374 ((time->tv_nsec << 2) & EXT4_NSEC_MASK));
375}
376
377static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
378{
379 if (sizeof(time->tv_sec) > 4)
380 time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
381 << 32;
382 time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2;
383}
384
385#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
386do { \
387 (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
388 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
389 (raw_inode)->xtime ## _extra = \
390 ext4_encode_extra_time(&(inode)->xtime); \
391} while (0)
392
393#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
394do { \
395 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
396 (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
397 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
398 (raw_inode)->xtime ## _extra = \
399 ext4_encode_extra_time(&(einode)->xtime); \
400} while (0)
401
402#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \
403do { \
404 (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \
405 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
406 ext4_decode_extra_time(&(inode)->xtime, \
407 raw_inode->xtime ## _extra); \
408} while (0)
409
410#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
411do { \
412 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
413 (einode)->xtime.tv_sec = \
414 (signed)le32_to_cpu((raw_inode)->xtime); \
415 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
416 ext4_decode_extra_time(&(einode)->xtime, \
417 raw_inode->xtime ## _extra); \
418} while (0)
419
338#if defined(__KERNEL__) || defined(__linux__) 420#if defined(__KERNEL__) || defined(__linux__)
339#define i_reserved1 osd1.linux1.l_i_reserved1 421#define i_reserved1 osd1.linux1.l_i_reserved1
340#define i_frag osd2.linux2.l_i_frag 422#define i_frag osd2.linux2.l_i_frag
@@ -533,6 +615,13 @@ static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
533 return container_of(inode, struct ext4_inode_info, vfs_inode); 615 return container_of(inode, struct ext4_inode_info, vfs_inode);
534} 616}
535 617
618static inline struct timespec ext4_current_time(struct inode *inode)
619{
620 return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
621 current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
622}
623
624
536static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) 625static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
537{ 626{
538 return ino == EXT4_ROOT_INO || 627 return ino == EXT4_ROOT_INO ||
@@ -603,6 +692,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
603#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 692#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
604#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 693#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
605#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 694#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
695#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
696#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
606 697
607#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 698#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
608#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 699#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
@@ -620,6 +711,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
620 EXT4_FEATURE_INCOMPAT_64BIT) 711 EXT4_FEATURE_INCOMPAT_64BIT)
621#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 712#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
622 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ 713 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
714 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
715 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
623 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 716 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
624 717
625/* 718/*
@@ -862,6 +955,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int);
862extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); 955extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
863extern void ext4_truncate (struct inode *); 956extern void ext4_truncate (struct inode *);
864extern void ext4_set_inode_flags(struct inode *); 957extern void ext4_set_inode_flags(struct inode *);
958extern void ext4_get_inode_flags(struct ext4_inode_info *);
865extern void ext4_set_aops(struct inode *inode); 959extern void ext4_set_aops(struct inode *inode);
866extern int ext4_writepage_trans_blocks(struct inode *); 960extern int ext4_writepage_trans_blocks(struct inode *);
867extern int ext4_block_truncate_page(handle_t *handle, struct page *page, 961extern int ext4_block_truncate_page(handle_t *handle, struct page *page,
@@ -983,6 +1077,8 @@ extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
983extern void ext4_ext_truncate(struct inode *, struct page *); 1077extern void ext4_ext_truncate(struct inode *, struct page *);
984extern void ext4_ext_init(struct super_block *); 1078extern void ext4_ext_init(struct super_block *);
985extern void ext4_ext_release(struct super_block *); 1079extern void ext4_ext_release(struct super_block *);
1080extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1081 loff_t len);
986static inline int 1082static inline int
987ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1083ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
988 unsigned long max_blocks, struct buffer_head *bh, 1084 unsigned long max_blocks, struct buffer_head *bh,
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index acfe59740b03..81406f3655d4 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -141,7 +141,25 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
141 141
142#define EXT_MAX_BLOCK 0xffffffff 142#define EXT_MAX_BLOCK 0xffffffff
143 143
144#define EXT_MAX_LEN ((1UL << 15) - 1) 144/*
145 * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
146 * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
147 * MSB of ee_len field in the extent datastructure to signify if this
148 * particular extent is an initialized extent or an uninitialized (i.e.
149 * preallocated).
150 * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
151 * uninitialized extent.
152 * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
153 * uninitialized one. In other words, if MSB of ee_len is set, it is an
154 * uninitialized extent with only one special scenario when ee_len = 0x8000.
155 * In this case we can not have an uninitialized extent of zero length and
156 * thus we make it as a special case of initialized extent with 0x8000 length.
157 * This way we get better extent-to-group alignment for initialized extents.
158 * Hence, the maximum number of blocks we can have in an *initialized*
159 * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
160 */
161#define EXT_INIT_MAX_LEN (1UL << 15)
162#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
145 163
146 164
147#define EXT_FIRST_EXTENT(__hdr__) \ 165#define EXT_FIRST_EXTENT(__hdr__) \
@@ -188,8 +206,31 @@ ext4_ext_invalidate_cache(struct inode *inode)
188 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO; 206 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO;
189} 207}
190 208
209static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext)
210{
211 /* We can not have an uninitialized extent of zero length! */
212 BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0);
213 ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN);
214}
215
216static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext)
217{
218 /* Extent with ee_len of 0x8000 is treated as an initialized extent */
219 return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN);
220}
221
222static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
223{
224 return (le16_to_cpu(ext->ee_len) <= EXT_INIT_MAX_LEN ?
225 le16_to_cpu(ext->ee_len) :
226 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
227}
228
191extern int ext4_extent_tree_init(handle_t *, struct inode *); 229extern int ext4_extent_tree_init(handle_t *, struct inode *);
192extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 230extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
231extern int ext4_ext_try_to_merge(struct inode *inode,
232 struct ext4_ext_path *path,
233 struct ext4_extent *);
193extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); 234extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
194extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); 235extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
195extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); 236extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *);
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 9de494406995..1a511e9905aa 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -153,6 +153,11 @@ struct ext4_inode_info {
153 153
154 unsigned long i_ext_generation; 154 unsigned long i_ext_generation;
155 struct ext4_ext_cache i_cached_extent; 155 struct ext4_ext_cache i_cached_extent;
156 /*
157 * File creation time. Its function is same as that of
158 * struct timespec i_{a,c,m}time in the generic inode.
159 */
160 struct timespec i_crtime;
156}; 161};
157 162
158#endif /* _LINUX_EXT4_FS_I */ 163#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index 691a713139ce..1b2ffee12be9 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -39,6 +39,8 @@ struct ext4_sb_info {
39 unsigned long s_gdb_count; /* Number of group descriptor blocks */ 39 unsigned long s_gdb_count; /* Number of group descriptor blocks */
40 unsigned long s_desc_per_block; /* Number of group descriptors per block */ 40 unsigned long s_desc_per_block; /* Number of group descriptors per block */
41 unsigned long s_groups_count; /* Number of groups in the fs */ 41 unsigned long s_groups_count; /* Number of groups in the fs */
42 unsigned long s_overhead_last; /* Last calculated overhead */
43 unsigned long s_blocks_last; /* Last seen block count */
42 struct buffer_head * s_sbh; /* Buffer containing the super block */ 44 struct buffer_head * s_sbh; /* Buffer containing the super block */
43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 45 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
44 struct buffer_head ** s_group_desc; 46 struct buffer_head ** s_group_desc;
@@ -71,7 +73,7 @@ struct ext4_sb_info {
71 struct list_head s_orphan; 73 struct list_head s_orphan;
72 unsigned long s_commit_interval; 74 unsigned long s_commit_interval;
73 struct block_device *journal_bdev; 75 struct block_device *journal_bdev;
74#ifdef CONFIG_JBD_DEBUG 76#ifdef CONFIG_JBD2_DEBUG
75 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ 77 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
76 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ 78 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
77#endif 79#endif
@@ -79,6 +81,7 @@ struct ext4_sb_info {
79 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ 81 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
80 int s_jquota_fmt; /* Format of quota to use */ 82 int s_jquota_fmt; /* Format of quota to use */
81#endif 83#endif
84 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
82 85
83#ifdef EXTENTS_STATS 86#ifdef EXTENTS_STATS
84 /* ext4 extents stats */ 87 /* ext4 extents stats */
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
new file mode 100644
index 000000000000..8e912ab6a072
--- /dev/null
+++ b/include/linux/falloc.h
@@ -0,0 +1,6 @@
1#ifndef _FALLOC_H_
2#define _FALLOC_H_
3
4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
5
6#endif /* _FALLOC_H_ */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 66226824ab68..cec54106aa87 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -119,6 +119,7 @@ struct dentry;
119#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ 119#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */
120#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ 120#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */
121#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ 121#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
122#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */
122#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ 123#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
123#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ 124#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
124#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ 125#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
@@ -529,6 +530,8 @@ struct fb_cursor_user {
529#define FB_EVENT_CONBLANK 0x0C 530#define FB_EVENT_CONBLANK 0x0C
530/* Get drawing requirements */ 531/* Get drawing requirements */
531#define FB_EVENT_GET_REQ 0x0D 532#define FB_EVENT_GET_REQ 0x0D
533/* Unbind from the console if possible */
534#define FB_EVENT_FB_UNBIND 0x0E
532 535
533struct fb_event { 536struct fb_event {
534 struct fb_info *info; 537 struct fb_info *info;
diff --git a/include/linux/file.h b/include/linux/file.h
index a59001e9ea58..0114fbc78061 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -73,6 +73,7 @@ extern struct file * FASTCALL(fget_light(unsigned int fd, int *fput_needed));
73extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag)); 73extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag));
74extern void put_filp(struct file *); 74extern void put_filp(struct file *);
75extern int get_unused_fd(void); 75extern int get_unused_fd(void);
76extern int get_unused_fd_flags(int flags);
76extern void FASTCALL(put_unused_fd(unsigned int fd)); 77extern void FASTCALL(put_unused_fd(unsigned int fd));
77struct kmem_cache; 78struct kmem_cache;
78 79
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 4631086f5060..c8e02de737f6 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -1,5 +1,8 @@
1/* Freezer declarations */ 1/* Freezer declarations */
2 2
3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED
5
3#include <linux/sched.h> 6#include <linux/sched.h>
4 7
5#ifdef CONFIG_PM 8#ifdef CONFIG_PM
@@ -22,7 +25,7 @@ static inline int freezing(struct task_struct *p)
22/* 25/*
23 * Request that a process be frozen 26 * Request that a process be frozen
24 */ 27 */
25static inline void freeze(struct task_struct *p) 28static inline void set_freeze_flag(struct task_struct *p)
26{ 29{
27 set_tsk_thread_flag(p, TIF_FREEZE); 30 set_tsk_thread_flag(p, TIF_FREEZE);
28} 31}
@@ -30,7 +33,7 @@ static inline void freeze(struct task_struct *p)
30/* 33/*
31 * Sometimes we may need to cancel the previous 'freeze' request 34 * Sometimes we may need to cancel the previous 'freeze' request
32 */ 35 */
33static inline void do_not_freeze(struct task_struct *p) 36static inline void clear_freeze_flag(struct task_struct *p)
34{ 37{
35 clear_tsk_thread_flag(p, TIF_FREEZE); 38 clear_tsk_thread_flag(p, TIF_FREEZE);
36} 39}
@@ -53,7 +56,7 @@ static inline int thaw_process(struct task_struct *p)
53 wake_up_process(p); 56 wake_up_process(p);
54 return 1; 57 return 1;
55 } 58 }
56 clear_tsk_thread_flag(p, TIF_FREEZE); 59 clear_freeze_flag(p);
57 task_unlock(p); 60 task_unlock(p);
58 return 0; 61 return 0;
59} 62}
@@ -115,10 +118,19 @@ static inline int freezer_should_skip(struct task_struct *p)
115 return !!(p->flags & PF_FREEZER_SKIP); 118 return !!(p->flags & PF_FREEZER_SKIP);
116} 119}
117 120
121/*
122 * Tell the freezer that the current task should be frozen by it
123 */
124static inline void set_freezable(void)
125{
126 current->flags &= ~PF_NOFREEZE;
127}
128
118#else 129#else
119static inline int frozen(struct task_struct *p) { return 0; } 130static inline int frozen(struct task_struct *p) { return 0; }
120static inline int freezing(struct task_struct *p) { return 0; } 131static inline int freezing(struct task_struct *p) { return 0; }
121static inline void freeze(struct task_struct *p) { BUG(); } 132static inline void set_freeze_flag(struct task_struct *p) {}
133static inline void clear_freeze_flag(struct task_struct *p) {}
122static inline int thaw_process(struct task_struct *p) { return 1; } 134static inline int thaw_process(struct task_struct *p) { return 1; }
123 135
124static inline void refrigerator(void) {} 136static inline void refrigerator(void) {}
@@ -130,4 +142,7 @@ static inline int try_to_freeze(void) { return 0; }
130static inline void freezer_do_not_count(void) {} 142static inline void freezer_do_not_count(void) {}
131static inline void freezer_count(void) {} 143static inline void freezer_count(void) {}
132static inline int freezer_should_skip(struct task_struct *p) { return 0; } 144static inline int freezer_should_skip(struct task_struct *p) { return 0; }
145static inline void set_freezable(void) {}
133#endif 146#endif
147
148#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f0b3bf5983c..d33beadd9a43 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -44,7 +44,7 @@ extern int get_max_files(void);
44struct inodes_stat_t { 44struct inodes_stat_t {
45 int nr_inodes; 45 int nr_inodes;
46 int nr_unused; 46 int nr_unused;
47 int dummy[5]; 47 int dummy[5]; /* padding for sysctl ABI compatibility */
48}; 48};
49extern struct inodes_stat_t inodes_stat; 49extern struct inodes_stat_t inodes_stat;
50 50
@@ -283,11 +283,14 @@ extern int dir_notify_enable;
283#include <linux/init.h> 283#include <linux/init.h>
284#include <linux/pid.h> 284#include <linux/pid.h>
285#include <linux/mutex.h> 285#include <linux/mutex.h>
286#include <linux/sysctl.h>
287#include <linux/capability.h>
286 288
287#include <asm/atomic.h> 289#include <asm/atomic.h>
288#include <asm/semaphore.h> 290#include <asm/semaphore.h>
289#include <asm/byteorder.h> 291#include <asm/byteorder.h>
290 292
293struct export_operations;
291struct hd_geometry; 294struct hd_geometry;
292struct iovec; 295struct iovec;
293struct nameidata; 296struct nameidata;
@@ -694,20 +697,26 @@ struct fown_struct {
694 * Track a single file's readahead state 697 * Track a single file's readahead state
695 */ 698 */
696struct file_ra_state { 699struct file_ra_state {
697 unsigned long start; /* Current window */ 700 pgoff_t start; /* where readahead started */
698 unsigned long size; 701 unsigned long size; /* # of readahead pages */
699 unsigned long flags; /* ra flags RA_FLAG_xxx*/ 702 unsigned long async_size; /* do asynchronous readahead when
700 unsigned long cache_hit; /* cache hit count*/ 703 there are only # of pages ahead */
701 unsigned long prev_index; /* Cache last read() position */ 704
702 unsigned long ahead_start; /* Ahead window */
703 unsigned long ahead_size;
704 unsigned long ra_pages; /* Maximum readahead window */ 705 unsigned long ra_pages; /* Maximum readahead window */
705 unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ 706 unsigned long mmap_hit; /* Cache hit stat for mmap accesses */
706 unsigned long mmap_miss; /* Cache miss stat for mmap accesses */ 707 unsigned long mmap_miss; /* Cache miss stat for mmap accesses */
708 unsigned long prev_index; /* Cache last read() position */
707 unsigned int prev_offset; /* Offset where last read() ended in a page */ 709 unsigned int prev_offset; /* Offset where last read() ended in a page */
708}; 710};
709#define RA_FLAG_MISS 0x01 /* a cache miss occured against this file */ 711
710#define RA_FLAG_INCACHE 0x02 /* file is already in cache */ 712/*
713 * Check if @index falls in the readahead windows.
714 */
715static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
716{
717 return (index >= ra->start &&
718 index < ra->start + ra->size);
719}
711 720
712struct file { 721struct file {
713 /* 722 /*
@@ -820,6 +829,10 @@ struct file_lock {
820 union { 829 union {
821 struct nfs_lock_info nfs_fl; 830 struct nfs_lock_info nfs_fl;
822 struct nfs4_lock_info nfs4_fl; 831 struct nfs4_lock_info nfs4_fl;
832 struct {
833 struct list_head link; /* link in AFS vnode's pending_locks list */
834 int state; /* state of grant or error if -ve */
835 } afs;
823 } fl_u; 836 } fl_u;
824}; 837};
825 838
@@ -855,7 +868,7 @@ extern void locks_init_lock(struct file_lock *);
855extern void locks_copy_lock(struct file_lock *, struct file_lock *); 868extern void locks_copy_lock(struct file_lock *, struct file_lock *);
856extern void locks_remove_posix(struct file *, fl_owner_t); 869extern void locks_remove_posix(struct file *, fl_owner_t);
857extern void locks_remove_flock(struct file *); 870extern void locks_remove_flock(struct file *);
858extern int posix_test_lock(struct file *, struct file_lock *); 871extern void posix_test_lock(struct file *, struct file_lock *);
859extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 872extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
860extern int posix_lock_file_wait(struct file *, struct file_lock *); 873extern int posix_lock_file_wait(struct file *, struct file_lock *);
861extern int posix_unblock_lock(struct file *, struct file_lock *); 874extern int posix_unblock_lock(struct file *, struct file_lock *);
@@ -866,6 +879,7 @@ extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
866extern int __break_lease(struct inode *inode, unsigned int flags); 879extern int __break_lease(struct inode *inode, unsigned int flags);
867extern void lease_get_mtime(struct inode *, struct timespec *time); 880extern void lease_get_mtime(struct inode *, struct timespec *time);
868extern int setlease(struct file *, long, struct file_lock **); 881extern int setlease(struct file *, long, struct file_lock **);
882extern int vfs_setlease(struct file *, long, struct file_lock **);
869extern int lease_modify(struct file_lock **, int); 883extern int lease_modify(struct file_lock **, int);
870extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 884extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
871extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 885extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
@@ -984,6 +998,9 @@ enum {
984#define put_fs_excl() atomic_dec(&current->fs_excl) 998#define put_fs_excl() atomic_dec(&current->fs_excl)
985#define has_fs_excl() atomic_read(&current->fs_excl) 999#define has_fs_excl() atomic_read(&current->fs_excl)
986 1000
1001#define is_owner_or_cap(inode) \
1002 ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
1003
987/* not quite ready to be deprecated, but... */ 1004/* not quite ready to be deprecated, but... */
988extern void lock_super(struct super_block *); 1005extern void lock_super(struct super_block *);
989extern void unlock_super(struct super_block *); 1006extern void unlock_super(struct super_block *);
@@ -1112,6 +1129,7 @@ struct file_operations {
1112 int (*flock) (struct file *, int, struct file_lock *); 1129 int (*flock) (struct file *, int, struct file_lock *);
1113 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1130 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1114 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1131 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1132 int (*setlease)(struct file *, long, struct file_lock **);
1115}; 1133};
1116 1134
1117struct inode_operations { 1135struct inode_operations {
@@ -1137,6 +1155,8 @@ struct inode_operations {
1137 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1155 ssize_t (*listxattr) (struct dentry *, char *, size_t);
1138 int (*removexattr) (struct dentry *, const char *); 1156 int (*removexattr) (struct dentry *, const char *);
1139 void (*truncate_range)(struct inode *, loff_t, loff_t); 1157 void (*truncate_range)(struct inode *, loff_t, loff_t);
1158 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1159 loff_t len);
1140}; 1160};
1141 1161
1142struct seq_file; 1162struct seq_file;
@@ -1273,119 +1293,6 @@ static inline void file_accessed(struct file *file)
1273 1293
1274int sync_inode(struct inode *inode, struct writeback_control *wbc); 1294int sync_inode(struct inode *inode, struct writeback_control *wbc);
1275 1295
1276/**
1277 * struct export_operations - for nfsd to communicate with file systems
1278 * @decode_fh: decode a file handle fragment and return a &struct dentry
1279 * @encode_fh: encode a file handle fragment from a dentry
1280 * @get_name: find the name for a given inode in a given directory
1281 * @get_parent: find the parent of a given directory
1282 * @get_dentry: find a dentry for the inode given a file handle sub-fragment
1283 * @find_exported_dentry:
1284 * set by the exporting module to a standard helper function.
1285 *
1286 * Description:
1287 * The export_operations structure provides a means for nfsd to communicate
1288 * with a particular exported file system - particularly enabling nfsd and
1289 * the filesystem to co-operate when dealing with file handles.
1290 *
1291 * export_operations contains two basic operation for dealing with file
1292 * handles, decode_fh() and encode_fh(), and allows for some other
1293 * operations to be defined which standard helper routines use to get
1294 * specific information from the filesystem.
1295 *
1296 * nfsd encodes information use to determine which filesystem a filehandle
1297 * applies to in the initial part of the file handle. The remainder, termed
1298 * a file handle fragment, is controlled completely by the filesystem. The
1299 * standard helper routines assume that this fragment will contain one or
1300 * two sub-fragments, one which identifies the file, and one which may be
1301 * used to identify the (a) directory containing the file.
1302 *
1303 * In some situations, nfsd needs to get a dentry which is connected into a
1304 * specific part of the file tree. To allow for this, it passes the
1305 * function acceptable() together with a @context which can be used to see
1306 * if the dentry is acceptable. As there can be multiple dentrys for a
1307 * given file, the filesystem should check each one for acceptability before
1308 * looking for the next. As soon as an acceptable one is found, it should
1309 * be returned.
1310 *
1311 * decode_fh:
1312 * @decode_fh is given a &struct super_block (@sb), a file handle fragment
1313 * (@fh, @fh_len) and an acceptability testing function (@acceptable,
1314 * @context). It should return a &struct dentry which refers to the same
1315 * file that the file handle fragment refers to, and which passes the
1316 * acceptability test. If it cannot, it should return a %NULL pointer if
1317 * the file was found but no acceptable &dentries were available, or a
1318 * %ERR_PTR error code indicating why it couldn't be found (e.g. %ENOENT or
1319 * %ENOMEM).
1320 *
1321 * encode_fh:
1322 * @encode_fh should store in the file handle fragment @fh (using at most
1323 * @max_len bytes) information that can be used by @decode_fh to recover the
1324 * file refered to by the &struct dentry @de. If the @connectable flag is
1325 * set, the encode_fh() should store sufficient information so that a good
1326 * attempt can be made to find not only the file but also it's place in the
1327 * filesystem. This typically means storing a reference to de->d_parent in
1328 * the filehandle fragment. encode_fh() should return the number of bytes
1329 * stored or a negative error code such as %-ENOSPC
1330 *
1331 * get_name:
1332 * @get_name should find a name for the given @child in the given @parent
1333 * directory. The name should be stored in the @name (with the
1334 * understanding that it is already pointing to a a %NAME_MAX+1 sized
1335 * buffer. get_name() should return %0 on success, a negative error code
1336 * or error. @get_name will be called without @parent->i_mutex held.
1337 *
1338 * get_parent:
1339 * @get_parent should find the parent directory for the given @child which
1340 * is also a directory. In the event that it cannot be found, or storage
1341 * space cannot be allocated, a %ERR_PTR should be returned.
1342 *
1343 * get_dentry:
1344 * Given a &super_block (@sb) and a pointer to a file-system specific inode
1345 * identifier, possibly an inode number, (@inump) get_dentry() should find
1346 * the identified inode and return a dentry for that inode. Any suitable
1347 * dentry can be returned including, if necessary, a new dentry created with
1348 * d_alloc_root. The caller can then find any other extant dentrys by
1349 * following the d_alias links. If a new dentry was created using
1350 * d_alloc_root, DCACHE_NFSD_DISCONNECTED should be set, and the dentry
1351 * should be d_rehash()ed.
1352 *
1353 * If the inode cannot be found, either a %NULL pointer or an %ERR_PTR code
1354 * can be returned. The @inump will be whatever was passed to
1355 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1356 *
1357 * Locking rules:
1358 * get_parent is called with child->d_inode->i_mutex down
1359 * get_name is not (which is possibly inconsistent)
1360 */
1361
1362struct export_operations {
1363 struct dentry *(*decode_fh)(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,
1364 int (*acceptable)(void *context, struct dentry *de),
1365 void *context);
1366 int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len,
1367 int connectable);
1368
1369 /* the following are only called from the filesystem itself */
1370 int (*get_name)(struct dentry *parent, char *name,
1371 struct dentry *child);
1372 struct dentry * (*get_parent)(struct dentry *child);
1373 struct dentry * (*get_dentry)(struct super_block *sb, void *inump);
1374
1375 /* This is set by the exporting module to a standard helper */
1376 struct dentry * (*find_exported_dentry)(
1377 struct super_block *sb, void *obj, void *parent,
1378 int (*acceptable)(void *context, struct dentry *de),
1379 void *context);
1380
1381
1382};
1383
1384extern struct dentry *
1385find_exported_dentry(struct super_block *sb, void *obj, void *parent,
1386 int (*acceptable)(void *context, struct dentry *de),
1387 void *context);
1388
1389struct file_system_type { 1296struct file_system_type {
1390 const char *name; 1297 const char *name;
1391 int fs_flags; 1298 int fs_flags;
@@ -1522,7 +1429,7 @@ extern void putname(const char *name);
1522 1429
1523#ifdef CONFIG_BLOCK 1430#ifdef CONFIG_BLOCK
1524extern int register_blkdev(unsigned int, const char *); 1431extern int register_blkdev(unsigned int, const char *);
1525extern int unregister_blkdev(unsigned int, const char *); 1432extern void unregister_blkdev(unsigned int, const char *);
1526extern struct block_device *bdget(dev_t); 1433extern struct block_device *bdget(dev_t);
1527extern void bd_set_size(struct block_device *, loff_t size); 1434extern void bd_set_size(struct block_device *, loff_t size);
1528extern void bd_forget(struct inode *inode); 1435extern void bd_forget(struct inode *inode);
@@ -1562,7 +1469,7 @@ extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
1562extern int register_chrdev_region(dev_t, unsigned, const char *); 1469extern int register_chrdev_region(dev_t, unsigned, const char *);
1563extern int register_chrdev(unsigned int, const char *, 1470extern int register_chrdev(unsigned int, const char *,
1564 const struct file_operations *); 1471 const struct file_operations *);
1565extern int unregister_chrdev(unsigned int, const char *); 1472extern void unregister_chrdev(unsigned int, const char *);
1566extern void unregister_chrdev_region(dev_t, unsigned); 1473extern void unregister_chrdev_region(dev_t, unsigned);
1567extern int chrdev_open(struct inode *, struct file *); 1474extern int chrdev_open(struct inode *, struct file *);
1568extern void chrdev_show(struct seq_file *,off_t); 1475extern void chrdev_show(struct seq_file *,off_t);
@@ -1610,6 +1517,9 @@ extern int __invalidate_device(struct block_device *);
1610extern int invalidate_partition(struct gendisk *, int); 1517extern int invalidate_partition(struct gendisk *, int);
1611#endif 1518#endif
1612extern int invalidate_inodes(struct super_block *); 1519extern int invalidate_inodes(struct super_block *);
1520unsigned long __invalidate_mapping_pages(struct address_space *mapping,
1521 pgoff_t start, pgoff_t end,
1522 bool be_atomic);
1613unsigned long invalidate_mapping_pages(struct address_space *mapping, 1523unsigned long invalidate_mapping_pages(struct address_space *mapping,
1614 pgoff_t start, pgoff_t end); 1524 pgoff_t start, pgoff_t end);
1615 1525
@@ -2043,5 +1953,9 @@ static inline void free_secdata(void *secdata)
2043{ } 1953{ }
2044#endif /* CONFIG_SECURITY */ 1954#endif /* CONFIG_SECURITY */
2045 1955
1956int proc_nr_files(ctl_table *table, int write, struct file *filp,
1957 void __user *buffer, size_t *lenp, loff_t *ppos);
1958
1959
2046#endif /* __KERNEL__ */ 1960#endif /* __KERNEL__ */
2047#endif /* _LINUX_FS_H */ 1961#endif /* _LINUX_FS_H */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 73710d617775..1831b196c70a 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -53,6 +53,7 @@ struct gianfar_platform_data {
53 u32 bus_id; 53 u32 bus_id;
54 u32 phy_id; 54 u32 phy_id;
55 u8 mac_addr[6]; 55 u8 mac_addr[6];
56 phy_interface_t interface;
56}; 57};
57 58
58struct gianfar_mdio_data { 59struct gianfar_mdio_data {
@@ -112,7 +113,7 @@ struct fsl_usb2_platform_data {
112struct fsl_spi_platform_data { 113struct fsl_spi_platform_data {
113 u32 initial_spmode; /* initial SPMODE value */ 114 u32 initial_spmode; /* initial SPMODE value */
114 u16 bus_num; 115 u16 bus_num;
115 116 bool qe_mode;
116 /* board specific information */ 117 /* board specific information */
117 u16 max_chipselect; 118 u16 max_chipselect;
118 void (*activate_cs)(u8 cs, u8 polarity); 119 void (*activate_cs)(u8 cs, u8 polarity);
@@ -120,5 +121,10 @@ struct fsl_spi_platform_data {
120 u32 sysclk; 121 u32 sysclk;
121}; 122};
122 123
124struct mpc8xx_pcmcia_ops {
125 void(*hw_ctrl)(int slot, int enable);
126 int(*voltage_set)(int slot, int vcc, int vpp);
127};
128
123#endif /* _FSL_DEVICE_H_ */ 129#endif /* _FSL_DEVICE_H_ */
124#endif /* __KERNEL__ */ 130#endif /* __KERNEL__ */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 534744efe30d..9fbe9d258e22 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -339,7 +339,7 @@ struct fuse_dirent {
339 char name[0]; 339 char name[0];
340}; 340};
341 341
342#define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name) 342#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
343#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) 343#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
344#define FUSE_DIRENT_SIZE(d) \ 344#define FUSE_DIRENT_SIZE(d) \
345 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 345 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index f7a93770e1be..7da02c93002b 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -39,6 +39,9 @@ enum {
39 CTRL_CMD_NEWOPS, 39 CTRL_CMD_NEWOPS,
40 CTRL_CMD_DELOPS, 40 CTRL_CMD_DELOPS,
41 CTRL_CMD_GETOPS, 41 CTRL_CMD_GETOPS,
42 CTRL_CMD_NEWMCAST_GRP,
43 CTRL_CMD_DELMCAST_GRP,
44 CTRL_CMD_GETMCAST_GRP, /* unused */
42 __CTRL_CMD_MAX, 45 __CTRL_CMD_MAX,
43}; 46};
44 47
@@ -52,6 +55,7 @@ enum {
52 CTRL_ATTR_HDRSIZE, 55 CTRL_ATTR_HDRSIZE,
53 CTRL_ATTR_MAXATTR, 56 CTRL_ATTR_MAXATTR,
54 CTRL_ATTR_OPS, 57 CTRL_ATTR_OPS,
58 CTRL_ATTR_MCAST_GROUPS,
55 __CTRL_ATTR_MAX, 59 __CTRL_ATTR_MAX,
56}; 60};
57 61
@@ -66,4 +70,13 @@ enum {
66 70
67#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) 71#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
68 72
73enum {
74 CTRL_ATTR_MCAST_GRP_UNSPEC,
75 CTRL_ATTR_MCAST_GRP_NAME,
76 CTRL_ATTR_MCAST_GRP_ID,
77 __CTRL_ATTR_MCAST_GRP_MAX,
78};
79
80#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
81
69#endif /* __LINUX_GENERIC_NETLINK_H */ 82#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0d2ef0b082a6..bc68dd9a6d41 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -30,6 +30,9 @@ struct vm_area_struct;
30 * cannot handle allocation failures. 30 * cannot handle allocation failures.
31 * 31 *
32 * __GFP_NORETRY: The VM implementation must not retry indefinitely. 32 * __GFP_NORETRY: The VM implementation must not retry indefinitely.
33 *
34 * __GFP_MOVABLE: Flag that this page will be movable by the page migration
35 * mechanism or reclaimed
33 */ 36 */
34#define __GFP_WAIT ((__force gfp_t)0x10u) /* Can wait and reschedule? */ 37#define __GFP_WAIT ((__force gfp_t)0x10u) /* Can wait and reschedule? */
35#define __GFP_HIGH ((__force gfp_t)0x20u) /* Should access emergency pools? */ 38#define __GFP_HIGH ((__force gfp_t)0x20u) /* Should access emergency pools? */
@@ -45,6 +48,7 @@ struct vm_area_struct;
45#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 48#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
46#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 49#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
47#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ 50#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
51#define __GFP_MOVABLE ((__force gfp_t)0x80000u) /* Page is movable */
48 52
49#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 53#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
50#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 54#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
@@ -53,7 +57,8 @@ struct vm_area_struct;
53#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 57#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
54 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 58 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
55 __GFP_NOFAIL|__GFP_NORETRY|__GFP_COMP| \ 59 __GFP_NOFAIL|__GFP_NORETRY|__GFP_COMP| \
56 __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE) 60 __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE| \
61 __GFP_MOVABLE)
57 62
58/* This equals 0, but use constants in case they ever change */ 63/* This equals 0, but use constants in case they ever change */
59#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) 64#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
@@ -65,6 +70,15 @@ struct vm_area_struct;
65#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL) 70#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
66#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ 71#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
67 __GFP_HIGHMEM) 72 __GFP_HIGHMEM)
73#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
74 __GFP_HARDWALL | __GFP_HIGHMEM | \
75 __GFP_MOVABLE)
76#define GFP_NOFS_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_MOVABLE)
77#define GFP_USER_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
78 __GFP_HARDWALL | __GFP_MOVABLE)
79#define GFP_HIGHUSER_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
80 __GFP_HARDWALL | __GFP_HIGHMEM | \
81 __GFP_MOVABLE)
68 82
69#ifdef CONFIG_NUMA 83#ifdef CONFIG_NUMA
70#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 84#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
@@ -92,6 +106,9 @@ static inline enum zone_type gfp_zone(gfp_t flags)
92 if (flags & __GFP_DMA32) 106 if (flags & __GFP_DMA32)
93 return ZONE_DMA32; 107 return ZONE_DMA32;
94#endif 108#endif
109 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
110 (__GFP_HIGHMEM | __GFP_MOVABLE))
111 return ZONE_MOVABLE;
95#ifdef CONFIG_HIGHMEM 112#ifdef CONFIG_HIGHMEM
96 if (flags & __GFP_HIGHMEM) 113 if (flags & __GFP_HIGHMEM)
97 return ZONE_HIGHMEM; 114 return ZONE_HIGHMEM;
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 98e2cce996a4..1fcb0033179e 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -73,10 +73,27 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
73} 73}
74 74
75#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 75#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
76/**
77 * __alloc_zeroed_user_highpage - Allocate a zeroed HIGHMEM page for a VMA with caller-specified movable GFP flags
78 * @movableflags: The GFP flags related to the pages future ability to move like __GFP_MOVABLE
79 * @vma: The VMA the page is to be allocated for
80 * @vaddr: The virtual address the page will be inserted into
81 *
82 * This function will allocate a page for a VMA but the caller is expected
83 * to specify via movableflags whether the page will be movable in the
84 * future or not
85 *
86 * An architecture may override this function by defining
87 * __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE and providing their own
88 * implementation.
89 */
76static inline struct page * 90static inline struct page *
77alloc_zeroed_user_highpage(struct vm_area_struct *vma, unsigned long vaddr) 91__alloc_zeroed_user_highpage(gfp_t movableflags,
92 struct vm_area_struct *vma,
93 unsigned long vaddr)
78{ 94{
79 struct page *page = alloc_page_vma(GFP_HIGHUSER, vma, vaddr); 95 struct page *page = alloc_page_vma(GFP_HIGHUSER | movableflags,
96 vma, vaddr);
80 97
81 if (page) 98 if (page)
82 clear_user_highpage(page, vaddr); 99 clear_user_highpage(page, vaddr);
@@ -85,6 +102,21 @@ alloc_zeroed_user_highpage(struct vm_area_struct *vma, unsigned long vaddr)
85} 102}
86#endif 103#endif
87 104
105/**
106 * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a VMA that the caller knows can move
107 * @vma: The VMA the page is to be allocated for
108 * @vaddr: The virtual address the page will be inserted into
109 *
110 * This function will allocate a page for a VMA that the caller knows will
111 * be able to migrate in the future using move_pages() or reclaimed
112 */
113static inline struct page *
114alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma,
115 unsigned long vaddr)
116{
117 return __alloc_zeroed_user_highpage(__GFP_MOVABLE, vma, vaddr);
118}
119
88static inline void clear_highpage(struct page *page) 120static inline void clear_highpage(struct page *page)
89{ 121{
90 void *kaddr = kmap_atomic(page, KM_USER0); 122 void *kaddr = kmap_atomic(page, KM_USER0);
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 17c29dca8354..540799bc85f8 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -329,12 +329,13 @@ extern void sysrq_timer_list_show(void);
329#ifdef CONFIG_TIMER_STATS 329#ifdef CONFIG_TIMER_STATS
330 330
331extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, 331extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
332 void *timerf, char * comm); 332 void *timerf, char *comm,
333 unsigned int timer_flag);
333 334
334static inline void timer_stats_account_hrtimer(struct hrtimer *timer) 335static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
335{ 336{
336 timer_stats_update_stats(timer, timer->start_pid, timer->start_site, 337 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
337 timer->function, timer->start_comm); 338 timer->function, timer->start_comm, 0);
338} 339}
339 340
340extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, 341extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 2c13715e9dde..49b7053043ad 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -15,6 +15,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
15} 15}
16 16
17int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 17int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
18int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
18int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 19int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
19int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); 20int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
20void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 21void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
@@ -29,6 +30,7 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to);
29void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 30void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
30 31
31extern unsigned long max_huge_pages; 32extern unsigned long max_huge_pages;
33extern unsigned long hugepages_treat_as_movable;
32extern const unsigned long hugetlb_zero, hugetlb_infinity; 34extern const unsigned long hugetlb_zero, hugetlb_infinity;
33extern int sysctl_hugetlb_shm_group; 35extern int sysctl_hugetlb_shm_group;
34 36
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index aa83d4163096..b69014865714 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -115,9 +115,10 @@
115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
117#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */ 117#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
118#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ 118#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */
119#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ 119#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */
120#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ 120#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */
121#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
121 122
122#define I2C_DRIVERID_I2CDEV 900 123#define I2C_DRIVERID_I2CDEV 900
123#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 124#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/linux/i2c-isa.h b/include/linux/i2c-isa.h
deleted file mode 100644
index 67e3598c4cec..000000000000
--- a/include/linux/i2c-isa.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * i2c-isa.h - definitions for the i2c-isa pseudo-i2c-adapter interface
3 *
4 * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _LINUX_I2C_ISA_H
22#define _LINUX_I2C_ISA_H
23
24#include <linux/i2c.h>
25
26extern int i2c_isa_add_driver(struct i2c_driver *driver);
27extern int i2c_isa_del_driver(struct i2c_driver *driver);
28
29/* Detect whether we are on the isa bus. This is only useful to hybrid
30 (i2c+isa) drivers. */
31#define i2c_is_isa_adapter(adapptr) \
32 ((adapptr)->id == I2C_HW_ISA)
33#define i2c_is_isa_client(clientptr) \
34 i2c_is_isa_adapter((clientptr)->adapter)
35
36#endif /* _LINUX_I2C_ISA_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2eaba21b9b1a..0c37a737a2b2 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -368,7 +368,6 @@ struct i2c_client_address_data {
368 368
369/* The numbers to use to set I2C bus address */ 369/* The numbers to use to set I2C bus address */
370#define ANY_I2C_BUS 0xffff 370#define ANY_I2C_BUS 0xffff
371#define ANY_I2C_ISA_BUS 9191
372 371
373 372
374/* ----- functions exported by i2c.o */ 373/* ----- functions exported by i2c.o */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 52f53e2e70c3..9752307d16ba 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -31,6 +31,7 @@
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/workqueue.h> /* work_struct */ 32#include <linux/workqueue.h> /* work_struct */
33#include <linux/mempool.h> 33#include <linux/mempool.h>
34#include <linux/mutex.h>
34 35
35#include <asm/io.h> 36#include <asm/io.h>
36#include <asm/semaphore.h> /* Needed for MUTEX init macros */ 37#include <asm/semaphore.h> /* Needed for MUTEX init macros */
@@ -425,7 +426,7 @@ struct i2o_device {
425 426
426 struct device device; 427 struct device device;
427 428
428 struct semaphore lock; /* device lock */ 429 struct mutex lock; /* device lock */
429}; 430};
430 431
431/* 432/*
@@ -544,7 +545,7 @@ struct i2o_controller {
544 struct i2o_dma hrt; /* HW Resource Table */ 545 struct i2o_dma hrt; /* HW Resource Table */
545 i2o_lct *lct; /* Logical Config Table */ 546 i2o_lct *lct; /* Logical Config Table */
546 struct i2o_dma dlct; /* Temp LCT */ 547 struct i2o_dma dlct; /* Temp LCT */
547 struct semaphore lct_lock; /* Lock for LCT updates */ 548 struct mutex lct_lock; /* Lock for LCT updates */
548 struct i2o_dma status_block; /* IOP status block */ 549 struct i2o_dma status_block; /* IOP status block */
549 550
550 struct i2o_io base; /* controller messaging unit */ 551 struct i2o_io base; /* controller messaging unit */
@@ -945,8 +946,7 @@ static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
945 strcpy(pool->name, name); 946 strcpy(pool->name, name);
946 947
947 pool->slab = 948 pool->slab =
948 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL, 949 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL);
949 NULL);
950 if (!pool->slab) 950 if (!pool->slab)
951 goto free_name; 951 goto free_name;
952 952
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 19ab25804056..5f5daad8bc54 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -681,6 +681,10 @@ typedef struct hwif_s {
681 u8 straight8; /* Alan's straight 8 check */ 681 u8 straight8; /* Alan's straight 8 check */
682 u8 bus_state; /* power state of the IDE bus */ 682 u8 bus_state; /* power state of the IDE bus */
683 683
684 u8 host_flags;
685
686 u8 pio_mask;
687
684 u8 atapi_dma; /* host supports atapi_dma */ 688 u8 atapi_dma; /* host supports atapi_dma */
685 u8 ultra_mask; 689 u8 ultra_mask;
686 u8 mwdma_mask; 690 u8 mwdma_mask;
@@ -1244,7 +1248,13 @@ typedef struct ide_pci_enablebit_s {
1244 1248
1245enum { 1249enum {
1246 /* Uses ISA control ports not PCI ones. */ 1250 /* Uses ISA control ports not PCI ones. */
1247 IDEPCI_FLAG_ISA_PORTS = (1 << 0), 1251 IDE_HFLAG_ISA_PORTS = (1 << 0),
1252 /* single port device */
1253 IDE_HFLAG_SINGLE = (1 << 1),
1254 /* don't use legacy PIO blacklist */
1255 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
1256 /* don't use conservative PIO "downgrade" */
1257 IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3),
1248}; 1258};
1249 1259
1250typedef struct ide_pci_device_s { 1260typedef struct ide_pci_device_s {
@@ -1256,13 +1266,13 @@ typedef struct ide_pci_device_s {
1256 void (*init_hwif)(ide_hwif_t *); 1266 void (*init_hwif)(ide_hwif_t *);
1257 void (*init_dma)(ide_hwif_t *, unsigned long); 1267 void (*init_dma)(ide_hwif_t *, unsigned long);
1258 void (*fixup)(ide_hwif_t *); 1268 void (*fixup)(ide_hwif_t *);
1259 u8 channels;
1260 u8 autodma; 1269 u8 autodma;
1261 ide_pci_enablebit_t enablebits[2]; 1270 ide_pci_enablebit_t enablebits[2];
1262 u8 bootable; 1271 u8 bootable;
1263 unsigned int extra; 1272 unsigned int extra;
1264 struct ide_pci_device_s *next; 1273 struct ide_pci_device_s *next;
1265 u8 flags; 1274 u8 host_flags;
1275 u8 pio_mask;
1266 u8 udma_mask; 1276 u8 udma_mask;
1267} ide_pci_device_t; 1277} ide_pci_device_t;
1268 1278
@@ -1363,6 +1373,11 @@ extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1363extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1373extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1364int ide_use_fast_pio(ide_drive_t *); 1374int ide_use_fast_pio(ide_drive_t *);
1365 1375
1376static inline int ide_dev_has_iordy(struct hd_driveid *id)
1377{
1378 return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
1379}
1380
1366u8 ide_dump_status(ide_drive_t *, const char *, u8); 1381u8 ide_dump_status(ide_drive_t *, const char *, u8);
1367 1382
1368typedef struct ide_pio_timings_s { 1383typedef struct ide_pio_timings_s {
@@ -1372,14 +1387,8 @@ typedef struct ide_pio_timings_s {
1372 /* active + recovery (+ setup for some chips) */ 1387 /* active + recovery (+ setup for some chips) */
1373} ide_pio_timings_t; 1388} ide_pio_timings_t;
1374 1389
1375typedef struct ide_pio_data_s { 1390unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1376 u8 pio_mode; 1391u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1377 u8 use_iordy;
1378 u8 overridden;
1379 unsigned int cycle_time;
1380} ide_pio_data_t;
1381
1382extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
1383extern const ide_pio_timings_t ide_pio_timings[6]; 1392extern const ide_pio_timings_t ide_pio_timings[6];
1384 1393
1385 1394
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 915572fa030b..0edda411959c 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -78,8 +78,11 @@ void *idr_find(struct idr *idp, int id);
78int idr_pre_get(struct idr *idp, gfp_t gfp_mask); 78int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
79int idr_get_new(struct idr *idp, void *ptr, int *id); 79int idr_get_new(struct idr *idp, void *ptr, int *id);
80int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 80int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
81int idr_for_each(struct idr *idp,
82 int (*fn)(int id, void *p, void *data), void *data);
81void *idr_replace(struct idr *idp, void *ptr, int id); 83void *idr_replace(struct idr *idp, void *ptr, int id);
82void idr_remove(struct idr *idp, int id); 84void idr_remove(struct idr *idp, int id);
85void idr_remove_all(struct idr *idp);
83void idr_destroy(struct idr *idp); 86void idr_destroy(struct idr *idp);
84void idr_init(struct idr *idp); 87void idr_init(struct idr *idp);
85 88
diff --git a/include/linux/init.h b/include/linux/init.h
index 56ec4c62eee0..f0d0e3295a9b 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,10 +40,10 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __attribute__ ((__section__ (".init.text"))) 43#define __init __attribute__ ((__section__ (".init.text"))) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __attribute__ ((__section__ (".init.data")))
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __attribute__ ((__section__(".exit.data")))
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) __cold
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
@@ -59,9 +59,9 @@
59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) 59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
60 60
61#ifdef MODULE 61#ifdef MODULE
62#define __exit __attribute__ ((__section__(".exit.text"))) 62#define __exit __attribute__ ((__section__(".exit.text"))) __cold
63#else 63#else
64#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) 64#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold
65#endif 65#endif
66 66
67/* For assembly routines */ 67/* For assembly routines */
@@ -171,9 +171,6 @@ struct obs_kernel_param {
171#define __setup(str, fn) \ 171#define __setup(str, fn) \
172 __setup_param(str, fn, fn, 0) 172 __setup_param(str, fn, fn, 0)
173 173
174#define __obsolete_setup(str) \
175 __setup_null_param(str, __LINE__)
176
177/* NOTE: fn is as per module_param, not __setup! Emits warning if fn 174/* NOTE: fn is as per module_param, not __setup! Emits warning if fn
178 * returns non-zero. */ 175 * returns non-zero. */
179#define early_param(str, fn) \ 176#define early_param(str, fn) \
@@ -239,7 +236,6 @@ void __init parse_early_param(void);
239#define __setup_param(str, unique_id, fn) /* nothing */ 236#define __setup_param(str, unique_id, fn) /* nothing */
240#define __setup_null_param(str, unique_id) /* nothing */ 237#define __setup_null_param(str, unique_id) /* nothing */
241#define __setup(str, func) /* nothing */ 238#define __setup(str, func) /* nothing */
242#define __obsolete_setup(str) /* nothing */
243#endif 239#endif
244 240
245/* Data marked not to be saved by software suspend */ 241/* Data marked not to be saved by software suspend */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 276ccaa2670c..cab741c2d603 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -8,6 +8,7 @@
8#include <linux/lockdep.h> 8#include <linux/lockdep.h>
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h>
11 12
12#define INIT_FDTABLE \ 13#define INIT_FDTABLE \
13{ \ 14{ \
@@ -78,6 +79,7 @@ extern struct nsproxy init_nsproxy;
78 .uts_ns = &init_uts_ns, \ 79 .uts_ns = &init_uts_ns, \
79 .mnt_ns = NULL, \ 80 .mnt_ns = NULL, \
80 INIT_IPC_NS(ipc_ns) \ 81 INIT_IPC_NS(ipc_ns) \
82 .user_ns = &init_user_ns, \
81} 83}
82 84
83#define INIT_SIGHAND(sighand) { \ 85#define INIT_SIGHAND(sighand) { \
diff --git a/include/linux/input.h b/include/linux/input.h
index 18c98b543030..e02c6a66b2ba 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -344,7 +344,8 @@ struct input_absinfo {
344#define KEY_BRIGHTNESSUP 225 344#define KEY_BRIGHTNESSUP 225
345#define KEY_MEDIA 226 345#define KEY_MEDIA 226
346 346
347#define KEY_SWITCHVIDEOMODE 227 347#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
348 outputs (Monitor/LCD/TV-out/etc) */
348#define KEY_KBDILLUMTOGGLE 228 349#define KEY_KBDILLUMTOGGLE 228
349#define KEY_KBDILLUMDOWN 229 350#define KEY_KBDILLUMDOWN 229
350#define KEY_KBDILLUMUP 230 351#define KEY_KBDILLUMUP 230
diff --git a/include/linux/io.h b/include/linux/io.h
index 8423dd376514..e3b2dda6c8eb 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -63,32 +63,7 @@ void __iomem * devm_ioremap(struct device *dev, unsigned long offset,
63void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset, 63void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset,
64 unsigned long size); 64 unsigned long size);
65void devm_iounmap(struct device *dev, void __iomem *addr); 65void devm_iounmap(struct device *dev, void __iomem *addr);
66 66int check_signature(const volatile void __iomem *io_addr,
67/** 67 const unsigned char *signature, int length);
68 * check_signature - find BIOS signatures
69 * @io_addr: mmio address to check
70 * @signature: signature block
71 * @length: length of signature
72 *
73 * Perform a signature comparison with the mmio address io_addr. This
74 * address should have been obtained by ioremap.
75 * Returns 1 on a match.
76 */
77
78static inline int check_signature(const volatile void __iomem *io_addr,
79 const unsigned char *signature, int length)
80{
81 int retval = 0;
82 do {
83 if (readb(io_addr) != *signature)
84 goto out;
85 io_addr++;
86 signature++;
87 length--;
88 } while (length);
89 retval = 1;
90out:
91 return retval;
92}
93 68
94#endif /* _LINUX_IO_H */ 69#endif /* _LINUX_IO_H */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 2eaa142cd061..baf29387cab4 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -53,6 +53,14 @@ static inline int task_ioprio(struct task_struct *task)
53 return IOPRIO_NORM; 53 return IOPRIO_NORM;
54} 54}
55 55
56static inline int task_ioprio_class(struct task_struct *task)
57{
58 if (ioprio_valid(task->ioprio))
59 return IOPRIO_PRIO_CLASS(task->ioprio);
60
61 return IOPRIO_CLASS_BE;
62}
63
56static inline int task_nice_ioprio(struct task_struct *task) 64static inline int task_nice_ioprio(struct task_struct *task)
57{ 65{
58 return (task_nice(task) + 20) / 5; 66 return (task_nice(task) + 20) / 5;
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 1980867a64a4..3fd3ddd5f0d9 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -52,6 +52,7 @@ struct ipc_perm
52#ifdef __KERNEL__ 52#ifdef __KERNEL__
53 53
54#include <linux/kref.h> 54#include <linux/kref.h>
55#include <linux/spinlock.h>
55 56
56#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 57#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
57 58
@@ -92,6 +93,7 @@ extern struct ipc_namespace init_ipc_ns;
92 93
93#ifdef CONFIG_SYSVIPC 94#ifdef CONFIG_SYSVIPC
94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 95#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
96extern void free_ipc_ns(struct kref *kref);
95extern struct ipc_namespace *copy_ipcs(unsigned long flags, 97extern struct ipc_namespace *copy_ipcs(unsigned long flags,
96 struct ipc_namespace *ns); 98 struct ipc_namespace *ns);
97#else 99#else
@@ -103,13 +105,9 @@ static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
103} 105}
104#endif 106#endif
105 107
106#ifdef CONFIG_IPC_NS
107extern void free_ipc_ns(struct kref *kref);
108#endif
109
110static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 108static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
111{ 109{
112#ifdef CONFIG_IPC_NS 110#ifdef CONFIG_SYSVIPC
113 if (ns) 111 if (ns)
114 kref_get(&ns->kref); 112 kref_get(&ns->kref);
115#endif 113#endif
@@ -118,7 +116,7 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
118 116
119static inline void put_ipc_ns(struct ipc_namespace *ns) 117static inline void put_ipc_ns(struct ipc_namespace *ns)
120{ 118{
121#ifdef CONFIG_IPC_NS 119#ifdef CONFIG_SYSVIPC
122 kref_put(&ns->kref, free_ipc_ns); 120 kref_put(&ns->kref, free_ipc_ns);
123#endif 121#endif
124} 122}
@@ -126,5 +124,3 @@ static inline void put_ipc_ns(struct ipc_namespace *ns)
126#endif /* __KERNEL__ */ 124#endif /* __KERNEL__ */
127 125
128#endif /* _LINUX_IPC_H */ 126#endif /* _LINUX_IPC_H */
129
130
diff --git a/include/linux/irda.h b/include/linux/irda.h
index 8e3735714c1c..28f88ecba344 100644
--- a/include/linux/irda.h
+++ b/include/linux/irda.h
@@ -77,6 +77,7 @@ typedef enum {
77 IRDA_ACT200L_DONGLE = 10, 77 IRDA_ACT200L_DONGLE = 10,
78 IRDA_MA600_DONGLE = 11, 78 IRDA_MA600_DONGLE = 11,
79 IRDA_TOIM3232_DONGLE = 12, 79 IRDA_TOIM3232_DONGLE = 12,
80 IRDA_EP7211_DONGLE = 13,
80} IRDA_DONGLE; 81} IRDA_DONGLE;
81 82
82/* Protocol types to be used for SOCK_DGRAM */ 83/* Protocol types to be used for SOCK_DGRAM */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 1695054e8c63..44657197fcb0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -161,6 +161,7 @@ struct irq_desc {
161 unsigned int wake_depth; /* nested wake enables */ 161 unsigned int wake_depth; /* nested wake enables */
162 unsigned int irq_count; /* For detecting broken IRQs */ 162 unsigned int irq_count; /* For detecting broken IRQs */
163 unsigned int irqs_unhandled; 163 unsigned int irqs_unhandled;
164 unsigned long last_unhandled; /* Aging timer for unhandled count */
164 spinlock_t lock; 165 spinlock_t lock;
165#ifdef CONFIG_SMP 166#ifdef CONFIG_SMP
166 cpumask_t affinity; 167 cpumask_t affinity;
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 0e0fedd2039a..260d6d76c5f3 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -50,14 +50,14 @@
50 */ 50 */
51#define JBD_DEFAULT_MAX_COMMIT_AGE 5 51#define JBD_DEFAULT_MAX_COMMIT_AGE 5
52 52
53#ifdef CONFIG_JBD_DEBUG 53#ifdef CONFIG_JBD2_DEBUG
54/* 54/*
55 * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal 55 * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
56 * consistency checks. By default we don't do this unless 56 * consistency checks. By default we don't do this unless
57 * CONFIG_JBD_DEBUG is on. 57 * CONFIG_JBD2_DEBUG is on.
58 */ 58 */
59#define JBD_EXPENSIVE_CHECKING 59#define JBD_EXPENSIVE_CHECKING
60extern int jbd2_journal_enable_debug; 60extern u8 jbd2_journal_enable_debug;
61 61
62#define jbd_debug(n, f, a...) \ 62#define jbd_debug(n, f, a...) \
63 do { \ 63 do { \
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 5f06527dca21..f73de6fb5c68 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -7,9 +7,9 @@
7 7
8#include <linux/errno.h> 8#include <linux/errno.h>
9 9
10#define KSYM_NAME_LEN 127 10#define KSYM_NAME_LEN 128
11#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN + \ 11#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
12 2*(BITS_PER_LONG*3/10) + MODULE_NAME_LEN + 1) 12 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
13 13
14#ifdef CONFIG_KALLSYMS 14#ifdef CONFIG_KALLSYMS
15/* Lookup the address for a symbol. Returns 0 if not found. */ 15/* Lookup the address for a symbol. Returns 0 if not found. */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7a4852505914..4300bb462d29 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -106,7 +106,7 @@ extern int cond_resched(void);
106extern struct atomic_notifier_head panic_notifier_list; 106extern struct atomic_notifier_head panic_notifier_list;
107extern long (*panic_blink)(long time); 107extern long (*panic_blink)(long time);
108NORET_TYPE void panic(const char * fmt, ...) 108NORET_TYPE void panic(const char * fmt, ...)
109 __attribute__ ((NORET_AND format (printf, 1, 2))); 109 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
110extern void oops_enter(void); 110extern void oops_enter(void);
111extern void oops_exit(void); 111extern void oops_exit(void);
112extern int oops_may_print(void); 112extern int oops_may_print(void);
@@ -155,14 +155,14 @@ extern void dump_thread(struct pt_regs *regs, struct user *dump);
155asmlinkage int vprintk(const char *fmt, va_list args) 155asmlinkage int vprintk(const char *fmt, va_list args)
156 __attribute__ ((format (printf, 1, 0))); 156 __attribute__ ((format (printf, 1, 0)));
157asmlinkage int printk(const char * fmt, ...) 157asmlinkage int printk(const char * fmt, ...)
158 __attribute__ ((format (printf, 1, 2))); 158 __attribute__ ((format (printf, 1, 2))) __cold;
159#else 159#else
160static inline int vprintk(const char *s, va_list args) 160static inline int vprintk(const char *s, va_list args)
161 __attribute__ ((format (printf, 1, 0))); 161 __attribute__ ((format (printf, 1, 0)));
162static inline int vprintk(const char *s, va_list args) { return 0; } 162static inline int vprintk(const char *s, va_list args) { return 0; }
163static inline int printk(const char *s, ...) 163static inline int printk(const char *s, ...)
164 __attribute__ ((format (printf, 1, 2))); 164 __attribute__ ((format (printf, 1, 2)));
165static inline int printk(const char *s, ...) { return 0; } 165static inline int __cold printk(const char *s, ...) { return 0; }
166#endif 166#endif
167 167
168unsigned long int_sqrt(unsigned long); 168unsigned long int_sqrt(unsigned long);
@@ -210,8 +210,9 @@ extern enum system_states {
210#define TAINT_MACHINE_CHECK (1<<4) 210#define TAINT_MACHINE_CHECK (1<<4)
211#define TAINT_BAD_PAGE (1<<5) 211#define TAINT_BAD_PAGE (1<<5)
212#define TAINT_USER (1<<6) 212#define TAINT_USER (1<<6)
213#define TAINT_DIE (1<<7)
213 214
214extern void dump_stack(void); 215extern void dump_stack(void) __cold;
215 216
216enum { 217enum {
217 DUMP_PREFIX_NONE, 218 DUMP_PREFIX_NONE,
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index aea34e74c496..8c4350a9ed87 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -64,7 +64,7 @@ struct capi20_appl {
64 unsigned long nrecvdatapkt; 64 unsigned long nrecvdatapkt;
65 unsigned long nsentctlpkt; 65 unsigned long nsentctlpkt;
66 unsigned long nsentdatapkt; 66 unsigned long nsentdatapkt;
67 struct semaphore recv_sem; 67 struct mutex recv_mtx;
68 struct sk_buff_head recv_queue; 68 struct sk_buff_head recv_queue;
69 struct work_struct recv_work; 69 struct work_struct recv_work;
70 int release_in_progress; 70 int release_in_progress;
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 10f505c8431d..5dc13848891b 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -36,13 +36,57 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; }
36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) 36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
37 37
38struct key; 38struct key;
39extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[], 39struct file;
40 struct key *session_keyring, int wait); 40struct subprocess_info;
41
42/* Allocate a subprocess_info structure */
43struct subprocess_info *call_usermodehelper_setup(char *path,
44 char **argv, char **envp);
45
46/* Set various pieces of state into the subprocess_info structure */
47void call_usermodehelper_setkeys(struct subprocess_info *info,
48 struct key *session_keyring);
49int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info,
50 struct file **filp);
51void call_usermodehelper_setcleanup(struct subprocess_info *info,
52 void (*cleanup)(char **argv, char **envp));
53
54enum umh_wait {
55 UMH_NO_WAIT = -1, /* don't wait at all */
56 UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
57 UMH_WAIT_PROC = 1, /* wait for the process to complete */
58};
59
60/* Actually execute the sub-process */
61int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
62
63/* Free the subprocess_info. This is only needed if you're not going
64 to call call_usermodehelper_exec */
65void call_usermodehelper_freeinfo(struct subprocess_info *info);
41 66
42static inline int 67static inline int
43call_usermodehelper(char *path, char **argv, char **envp, int wait) 68call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
44{ 69{
45 return call_usermodehelper_keys(path, argv, envp, NULL, wait); 70 struct subprocess_info *info;
71
72 info = call_usermodehelper_setup(path, argv, envp);
73 if (info == NULL)
74 return -ENOMEM;
75 return call_usermodehelper_exec(info, wait);
76}
77
78static inline int
79call_usermodehelper_keys(char *path, char **argv, char **envp,
80 struct key *session_keyring, enum umh_wait wait)
81{
82 struct subprocess_info *info;
83
84 info = call_usermodehelper_setup(path, argv, envp);
85 if (info == NULL)
86 return -ENOMEM;
87
88 call_usermodehelper_setkeys(info, session_keyring);
89 return call_usermodehelper_exec(info, wait);
46} 90}
47 91
48extern void usermodehelper_init(void); 92extern void usermodehelper_init(void);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 06cbf41d32d2..aa2fe22b1baa 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -36,15 +36,24 @@ extern char uevent_helper[];
36/* counter to tag the uevent, read only except for the kobject core */ 36/* counter to tag the uevent, read only except for the kobject core */
37extern u64 uevent_seqnum; 37extern u64 uevent_seqnum;
38 38
39/* the actions here must match the proper string in lib/kobject_uevent.c */ 39/*
40typedef int __bitwise kobject_action_t; 40 * The actions here must match the index to the string array
41 * in lib/kobject_uevent.c
42 *
43 * Do not add new actions here without checking with the driver-core
44 * maintainers. Action strings are not meant to express subsystem
45 * or device specific properties. In most cases you want to send a
46 * kobject_uevent_env(kobj, KOBJ_CHANGE, env) with additional event
47 * specific variables added to the event environment.
48 */
41enum kobject_action { 49enum kobject_action {
42 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ 50 KOBJ_ADD,
43 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ 51 KOBJ_REMOVE,
44 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ 52 KOBJ_CHANGE,
45 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */ 53 KOBJ_MOVE,
46 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */ 54 KOBJ_ONLINE,
47 KOBJ_MOVE = (__force kobject_action_t) 0x06, /* device move */ 55 KOBJ_OFFLINE,
56 KOBJ_MAX
48}; 57};
49 58
50struct kobject { 59struct kobject {
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 23adf6075ae4..51464d12a4e5 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -116,9 +116,12 @@ struct kprobe {
116 */ 116 */
117struct jprobe { 117struct jprobe {
118 struct kprobe kp; 118 struct kprobe kp;
119 kprobe_opcode_t *entry; /* probe handling code to jump to */ 119 void *entry; /* probe handling code to jump to */
120}; 120};
121 121
122/* For backward compatibility with old code using JPROBE_ENTRY() */
123#define JPROBE_ENTRY(handler) (handler)
124
122DECLARE_PER_CPU(struct kprobe *, current_kprobe); 125DECLARE_PER_CPU(struct kprobe *, current_kprobe);
123DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 126DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
124 127
@@ -211,6 +214,7 @@ int longjmp_break_handler(struct kprobe *, struct pt_regs *);
211int register_jprobe(struct jprobe *p); 214int register_jprobe(struct jprobe *p);
212void unregister_jprobe(struct jprobe *p); 215void unregister_jprobe(struct jprobe *p);
213void jprobe_return(void); 216void jprobe_return(void);
217unsigned long arch_deref_entry_point(void *);
214 218
215int register_kretprobe(struct kretprobe *rp); 219int register_kretprobe(struct kretprobe *rp);
216void unregister_kretprobe(struct kretprobe *rp); 220void unregister_kretprobe(struct kretprobe *rp);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 88afceffb7cb..494bed7c2fc1 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -13,7 +13,6 @@
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h>
17 16
18struct device; 17struct device;
19struct class_device; 18struct class_device;
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
new file mode 100644
index 000000000000..500aace21ca7
--- /dev/null
+++ b/include/linux/lguest.h
@@ -0,0 +1,85 @@
1/* Things the lguest guest needs to know. Note: like all lguest interfaces,
2 * this is subject to wild and random change between versions. */
3#ifndef _ASM_LGUEST_H
4#define _ASM_LGUEST_H
5
6#ifndef __ASSEMBLY__
7#include <asm/irq.h>
8
9#define LHCALL_FLUSH_ASYNC 0
10#define LHCALL_LGUEST_INIT 1
11#define LHCALL_CRASH 2
12#define LHCALL_LOAD_GDT 3
13#define LHCALL_NEW_PGTABLE 4
14#define LHCALL_FLUSH_TLB 5
15#define LHCALL_LOAD_IDT_ENTRY 6
16#define LHCALL_SET_STACK 7
17#define LHCALL_TS 8
18#define LHCALL_SET_CLOCKEVENT 9
19#define LHCALL_HALT 10
20#define LHCALL_GET_WALLCLOCK 11
21#define LHCALL_BIND_DMA 12
22#define LHCALL_SEND_DMA 13
23#define LHCALL_SET_PTE 14
24#define LHCALL_SET_PMD 15
25#define LHCALL_LOAD_TLS 16
26
27#define LG_CLOCK_MIN_DELTA 100UL
28#define LG_CLOCK_MAX_DELTA ULONG_MAX
29
30#define LGUEST_TRAP_ENTRY 0x1F
31
32static inline unsigned long
33hcall(unsigned long call,
34 unsigned long arg1, unsigned long arg2, unsigned long arg3)
35{
36 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
37 : "=a"(call)
38 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
39 : "memory");
40 return call;
41}
42
43void async_hcall(unsigned long call,
44 unsigned long arg1, unsigned long arg2, unsigned long arg3);
45
46/* Can't use our min() macro here: needs to be a constant */
47#define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32)
48
49#define LHCALL_RING_SIZE 64
50struct hcall_ring
51{
52 u32 eax, edx, ebx, ecx;
53};
54
55/* All the good stuff happens here: guest registers it with LGUEST_INIT */
56struct lguest_data
57{
58/* Fields which change during running: */
59 /* 512 == enabled (same as eflags) */
60 unsigned int irq_enabled;
61 /* Interrupts blocked by guest. */
62 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
63
64 /* Virtual address of page fault. */
65 unsigned long cr2;
66
67 /* Async hypercall ring. 0xFF == done, 0 == pending. */
68 u8 hcall_status[LHCALL_RING_SIZE];
69 struct hcall_ring hcalls[LHCALL_RING_SIZE];
70
71/* Fields initialized by the hypervisor at boot: */
72 /* Memory not to try to access */
73 unsigned long reserve_mem;
74 /* ID of this guest (used by network driver to set ethernet address) */
75 u16 guestid;
76 /* KHz for the TSC clock. */
77 u32 tsc_khz;
78
79/* Fields initialized by the guest at boot: */
80 /* Instruction range to suppress interrupts even if enabled */
81 unsigned long noirq_start, noirq_end;
82};
83extern struct lguest_data lguest_data;
84#endif /* __ASSEMBLY__ */
85#endif /* _ASM_LGUEST_H */
diff --git a/include/linux/lguest_bus.h b/include/linux/lguest_bus.h
new file mode 100644
index 000000000000..c9b4e05fee49
--- /dev/null
+++ b/include/linux/lguest_bus.h
@@ -0,0 +1,48 @@
1#ifndef _ASM_LGUEST_DEVICE_H
2#define _ASM_LGUEST_DEVICE_H
3/* Everything you need to know about lguest devices. */
4#include <linux/device.h>
5#include <linux/lguest.h>
6#include <linux/lguest_launcher.h>
7
8struct lguest_device {
9 /* Unique busid, and index into lguest_page->devices[] */
10 unsigned int index;
11
12 struct device dev;
13
14 /* Driver can hang data off here. */
15 void *private;
16};
17
18/* By convention, each device can use irq index+1 if it wants to. */
19static inline int lgdev_irq(const struct lguest_device *dev)
20{
21 return dev->index + 1;
22}
23
24/* dma args must not be vmalloced! */
25void lguest_send_dma(unsigned long key, struct lguest_dma *dma);
26int lguest_bind_dma(unsigned long key, struct lguest_dma *dmas,
27 unsigned int num, u8 irq);
28void lguest_unbind_dma(unsigned long key, struct lguest_dma *dmas);
29
30/* Map the virtual device space */
31void *lguest_map(unsigned long phys_addr, unsigned long pages);
32void lguest_unmap(void *);
33
34struct lguest_driver {
35 const char *name;
36 struct module *owner;
37 u16 device_type;
38 int (*probe)(struct lguest_device *dev);
39 void (*remove)(struct lguest_device *dev);
40
41 struct device_driver drv;
42};
43
44extern int register_lguest_driver(struct lguest_driver *drv);
45extern void unregister_lguest_driver(struct lguest_driver *drv);
46
47extern struct lguest_device_desc *lguest_devices; /* Just past max_pfn */
48#endif /* _ASM_LGUEST_DEVICE_H */
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
new file mode 100644
index 000000000000..0ba414a40c80
--- /dev/null
+++ b/include/linux/lguest_launcher.h
@@ -0,0 +1,73 @@
1#ifndef _ASM_LGUEST_USER
2#define _ASM_LGUEST_USER
3/* Everything the "lguest" userspace program needs to know. */
4/* They can register up to 32 arrays of lguest_dma. */
5#define LGUEST_MAX_DMA 32
6/* At most we can dma 16 lguest_dma in one op. */
7#define LGUEST_MAX_DMA_SECTIONS 16
8
9/* How many devices? Assume each one wants up to two dma arrays per device. */
10#define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2)
11
12struct lguest_dma
13{
14 /* 0 if free to be used, filled by hypervisor. */
15 u32 used_len;
16 unsigned long addr[LGUEST_MAX_DMA_SECTIONS];
17 u16 len[LGUEST_MAX_DMA_SECTIONS];
18};
19
20struct lguest_block_page
21{
22 /* 0 is a read, 1 is a write. */
23 int type;
24 u32 sector; /* Offset in device = sector * 512. */
25 u32 bytes; /* Length expected to be read/written in bytes */
26 /* 0 = pending, 1 = done, 2 = done, error */
27 int result;
28 u32 num_sectors; /* Disk length = num_sectors * 512 */
29};
30
31/* There is a shared page of these. */
32struct lguest_net
33{
34 /* Simply the mac address (with multicast bit meaning promisc). */
35 unsigned char mac[6];
36};
37
38/* Where the Host expects the Guest to SEND_DMA console output to. */
39#define LGUEST_CONSOLE_DMA_KEY 0
40
41/* We have a page of these descriptors in the lguest_device page. */
42struct lguest_device_desc {
43 u16 type;
44#define LGUEST_DEVICE_T_CONSOLE 1
45#define LGUEST_DEVICE_T_NET 2
46#define LGUEST_DEVICE_T_BLOCK 3
47
48 u16 features;
49#define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */
50#define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */
51
52 u16 status;
53/* 256 and above are device specific. */
54#define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */
55#define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */
56#define LGUEST_DEVICE_S_DRIVER_OK 4 /* Driver says OK! */
57#define LGUEST_DEVICE_S_REMOVED 8 /* Device has gone away. */
58#define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */
59#define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */
60
61 u16 num_pages;
62 u32 pfn;
63};
64
65/* Write command first word is a request. */
66enum lguest_req
67{
68 LHREQ_INITIALIZE, /* + pfnlimit, pgdir, start, pageoffset */
69 LHREQ_GETDMA, /* + addr (returns &lguest_dma, irq in ->used_len) */
70 LHREQ_IRQ, /* + irq */
71 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
72};
73#endif /* _ASM_LGUEST_USER */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 47cd2a1c5544..be5a43928c84 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -323,6 +323,7 @@ enum ata_completion_errors {
323 AC_ERR_INVALID = (1 << 7), /* invalid argument */ 323 AC_ERR_INVALID = (1 << 7), /* invalid argument */
324 AC_ERR_OTHER = (1 << 8), /* unknown */ 324 AC_ERR_OTHER = (1 << 8), /* unknown */
325 AC_ERR_NODEV_HINT = (1 << 9), /* polling device detection hint */ 325 AC_ERR_NODEV_HINT = (1 << 9), /* polling device detection hint */
326 AC_ERR_NCQ = (1 << 10), /* marker for offending NCQ qc */
326}; 327};
327 328
328/* forward declarations */ 329/* forward declarations */
@@ -530,6 +531,7 @@ struct ata_port {
530 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 531 unsigned int cbl; /* cable type; ATA_CBL_xxx */
531 unsigned int hw_sata_spd_limit; 532 unsigned int hw_sata_spd_limit;
532 unsigned int sata_spd_limit; /* SATA PHY speed limit */ 533 unsigned int sata_spd_limit; /* SATA PHY speed limit */
534 unsigned int sata_spd; /* current SATA PHY speed */
533 535
534 /* record runtime error info, protected by host lock */ 536 /* record runtime error info, protected by host lock */
535 struct ata_eh_info eh_info; 537 struct ata_eh_info eh_info;
@@ -563,6 +565,9 @@ struct ata_port {
563 pm_message_t pm_mesg; 565 pm_message_t pm_mesg;
564 int *pm_result; 566 int *pm_result;
565 567
568 struct timer_list fastdrain_timer;
569 unsigned long fastdrain_cnt;
570
566 void *private_data; 571 void *private_data;
567 572
568#ifdef CONFIG_ATA_ACPI 573#ifdef CONFIG_ATA_ACPI
@@ -619,9 +624,8 @@ struct ata_port_operations {
619 u8 (*irq_on) (struct ata_port *); 624 u8 (*irq_on) (struct ata_port *);
620 u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq); 625 u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
621 626
622 u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); 627 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val);
623 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, 628 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val);
624 u32 val);
625 629
626 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 630 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
627 int (*port_resume) (struct ata_port *ap); 631 int (*port_resume) (struct ata_port *ap);
@@ -764,7 +768,8 @@ extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *);
764 */ 768 */
765extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); 769extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
766extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 770extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
767extern void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp); 771extern void ata_tf_to_fis(const struct ata_taskfile *tf,
772 u8 pmp, int is_cmd, u8 *fis);
768extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); 773extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
769extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); 774extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device);
770extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); 775extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
@@ -909,27 +914,21 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
909/* 914/*
910 * ata_eh_info helpers 915 * ata_eh_info helpers
911 */ 916 */
912#define ata_ehi_push_desc(ehi, fmt, args...) do { \ 917extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...);
913 (ehi)->desc_len += scnprintf((ehi)->desc + (ehi)->desc_len, \ 918extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...);
914 ATA_EH_DESC_LEN - (ehi)->desc_len, \ 919extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
915 fmt , ##args); \ 920
916} while (0) 921static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
917
918#define ata_ehi_clear_desc(ehi) do { \
919 (ehi)->desc[0] = '\0'; \
920 (ehi)->desc_len = 0; \
921} while (0)
922
923static inline void __ata_ehi_hotplugged(struct ata_eh_info *ehi)
924{ 922{
925 ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK; 923 ehi->flags |= ATA_EHI_RESUME_LINK;
926 ehi->action |= ATA_EH_SOFTRESET; 924 ehi->action |= ATA_EH_SOFTRESET;
927 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; 925 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
928} 926}
929 927
930static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) 928static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
931{ 929{
932 __ata_ehi_hotplugged(ehi); 930 ata_ehi_schedule_probe(ehi);
931 ehi->flags |= ATA_EHI_HOTPLUGGED;
933 ehi->err_mask |= AC_ERR_ATA_BUS; 932 ehi->err_mask |= AC_ERR_ATA_BUS;
934} 933}
935 934
diff --git a/include/linux/limits.h b/include/linux/limits.h
index eaf2e099f125..2d0f94162fb3 100644
--- a/include/linux/limits.h
+++ b/include/linux/limits.h
@@ -5,8 +5,6 @@
5 5
6#define NGROUPS_MAX 65536 /* supplemental group IDs are available */ 6#define NGROUPS_MAX 65536 /* supplemental group IDs are available */
7#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ 7#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
8#define CHILD_MAX 999 /* no limit :-) */
9#define OPEN_MAX 256 /* # open files a process may have */
10#define LINK_MAX 127 /* # links a file may have */ 8#define LINK_MAX 127 /* # links a file may have */
11#define MAX_CANON 255 /* size of the canonical input queue */ 9#define MAX_CANON 255 /* size of the canonical input queue */
12#define MAX_INPUT 255 /* size of the type-ahead buffer */ 10#define MAX_INPUT 255 /* size of the type-ahead buffer */
diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h
index 9c01bde5bf1b..08a92969c76e 100644
--- a/include/linux/linux_logo.h
+++ b/include/linux/linux_logo.h
@@ -33,5 +33,13 @@ struct linux_logo {
33}; 33};
34 34
35extern const struct linux_logo *fb_find_logo(int depth); 35extern const struct linux_logo *fb_find_logo(int depth);
36#ifdef CONFIG_FB_LOGO_EXTRA
37extern void fb_append_extra_logo(const struct linux_logo *logo,
38 unsigned int n);
39#else
40static inline void fb_append_extra_logo(const struct linux_logo *logo,
41 unsigned int n)
42{}
43#endif
36 44
37#endif /* _LINUX_LINUX_LOGO_H */ 45#endif /* _LINUX_LINUX_LOGO_H */
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 246de1d84a26..6f1637c61e10 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -27,6 +27,7 @@ struct nlmsvc_binding {
27 struct nfs_fh *, 27 struct nfs_fh *,
28 struct file **); 28 struct file **);
29 void (*fclose)(struct file *); 29 void (*fclose)(struct file *);
30 unsigned long (*get_grace_period)(void);
30}; 31};
31 32
32extern struct nlmsvc_binding * nlmsvc_ops; 33extern struct nlmsvc_binding * nlmsvc_ops;
@@ -38,4 +39,12 @@ extern int nlmclnt_proc(struct inode *, int, struct file_lock *);
38extern int lockd_up(int proto); 39extern int lockd_up(int proto);
39extern void lockd_down(void); 40extern void lockd_down(void);
40 41
42unsigned long get_nfs_grace_period(void);
43
44#ifdef CONFIG_NFSD_V4
45unsigned long get_nfs4_grace_period(void);
46#else
47static inline unsigned long get_nfs4_grace_period(void) {return 0;}
48#endif
49
41#endif /* LINUX_LOCKD_BIND_H */ 50#endif /* LINUX_LOCKD_BIND_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 14c937d345cb..0e843bf65877 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * Runtime locking correctness validator 2 * Runtime locking correctness validator
3 * 3 *
4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
5 * 6 *
6 * see Documentation/lockdep-design.txt for more details. 7 * see Documentation/lockdep-design.txt for more details.
7 */ 8 */
@@ -9,6 +10,7 @@
9#define __LINUX_LOCKDEP_H 10#define __LINUX_LOCKDEP_H
10 11
11struct task_struct; 12struct task_struct;
13struct lockdep_map;
12 14
13#ifdef CONFIG_LOCKDEP 15#ifdef CONFIG_LOCKDEP
14 16
@@ -114,8 +116,44 @@ struct lock_class {
114 116
115 const char *name; 117 const char *name;
116 int name_version; 118 int name_version;
119
120#ifdef CONFIG_LOCK_STAT
121 unsigned long contention_point[4];
122#endif
123};
124
125#ifdef CONFIG_LOCK_STAT
126struct lock_time {
127 s64 min;
128 s64 max;
129 s64 total;
130 unsigned long nr;
131};
132
133enum bounce_type {
134 bounce_acquired_write,
135 bounce_acquired_read,
136 bounce_contended_write,
137 bounce_contended_read,
138 nr_bounce_types,
139
140 bounce_acquired = bounce_acquired_write,
141 bounce_contended = bounce_contended_write,
117}; 142};
118 143
144struct lock_class_stats {
145 unsigned long contention_point[4];
146 struct lock_time read_waittime;
147 struct lock_time write_waittime;
148 struct lock_time read_holdtime;
149 struct lock_time write_holdtime;
150 unsigned long bounces[nr_bounce_types];
151};
152
153struct lock_class_stats lock_stats(struct lock_class *class);
154void clear_lock_stats(struct lock_class *class);
155#endif
156
119/* 157/*
120 * Map the lock object (the lock instance) to the lock-class object. 158 * Map the lock object (the lock instance) to the lock-class object.
121 * This is embedded into specific lock instances: 159 * This is embedded into specific lock instances:
@@ -124,6 +162,9 @@ struct lockdep_map {
124 struct lock_class_key *key; 162 struct lock_class_key *key;
125 struct lock_class *class_cache; 163 struct lock_class *class_cache;
126 const char *name; 164 const char *name;
165#ifdef CONFIG_LOCK_STAT
166 int cpu;
167#endif
127}; 168};
128 169
129/* 170/*
@@ -165,6 +206,10 @@ struct held_lock {
165 unsigned long acquire_ip; 206 unsigned long acquire_ip;
166 struct lockdep_map *instance; 207 struct lockdep_map *instance;
167 208
209#ifdef CONFIG_LOCK_STAT
210 u64 waittime_stamp;
211 u64 holdtime_stamp;
212#endif
168 /* 213 /*
169 * The lock-stack is unified in that the lock chains of interrupt 214 * The lock-stack is unified in that the lock chains of interrupt
170 * contexts nest ontop of process context chains, but we 'separate' 215 * contexts nest ontop of process context chains, but we 'separate'
@@ -281,6 +326,30 @@ struct lock_class_key { };
281 326
282#endif /* !LOCKDEP */ 327#endif /* !LOCKDEP */
283 328
329#ifdef CONFIG_LOCK_STAT
330
331extern void lock_contended(struct lockdep_map *lock, unsigned long ip);
332extern void lock_acquired(struct lockdep_map *lock);
333
334#define LOCK_CONTENDED(_lock, try, lock) \
335do { \
336 if (!try(_lock)) { \
337 lock_contended(&(_lock)->dep_map, _RET_IP_); \
338 lock(_lock); \
339 } \
340 lock_acquired(&(_lock)->dep_map); \
341} while (0)
342
343#else /* CONFIG_LOCK_STAT */
344
345#define lock_contended(lockdep_map, ip) do {} while (0)
346#define lock_acquired(lockdep_map) do {} while (0)
347
348#define LOCK_CONTENDED(_lock, try, lock) \
349 lock(_lock)
350
351#endif /* CONFIG_LOCK_STAT */
352
284#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) 353#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS)
285extern void early_init_irq_lock_class(void); 354extern void early_init_irq_lock_class(void);
286#else 355#else
diff --git a/include/linux/lzo.h b/include/linux/lzo.h
index 582d8b711a13..d793497ec1ca 100644
--- a/include/linux/lzo.h
+++ b/include/linux/lzo.h
@@ -17,7 +17,7 @@
17#define LZO1X_MEM_COMPRESS (16384 * sizeof(unsigned char *)) 17#define LZO1X_MEM_COMPRESS (16384 * sizeof(unsigned char *))
18#define LZO1X_1_MEM_COMPRESS LZO1X_MEM_COMPRESS 18#define LZO1X_1_MEM_COMPRESS LZO1X_MEM_COMPRESS
19 19
20#define lzo1x_worst_compress(x) (x + (x / 64) + 16 + 3) 20#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
21 21
22/* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */ 22/* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */
23int lzo1x_1_compress(const unsigned char *src, size_t src_len, 23int lzo1x_1_compress(const unsigned char *src, size_t src_len,
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 9d713c03e3da..36cc20dfd142 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -13,7 +13,6 @@
13#define HPFS_SUPER_MAGIC 0xf995e849 13#define HPFS_SUPER_MAGIC 0xf995e849
14#define ISOFS_SUPER_MAGIC 0x9660 14#define ISOFS_SUPER_MAGIC 0x9660
15#define JFFS2_SUPER_MAGIC 0x72b6 15#define JFFS2_SUPER_MAGIC 0x72b6
16#define KVMFS_SUPER_MAGIC 0x19700426
17#define ANON_INODE_FS_MAGIC 0x09041934 16#define ANON_INODE_FS_MAGIC 0x09041934
18 17
19#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ 18#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
diff --git a/include/linux/major.h b/include/linux/major.h
index 7e7c9093919a..0cb98053537a 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -158,6 +158,8 @@
158#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */ 158#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */
159#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */ 159#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */
160 160
161#define XENVBD_MAJOR 202 /* Xen virtual block device */
162
161#define MSR_MAJOR 202 163#define MSR_MAJOR 202
162#define CPUID_MAJOR 203 164#define CPUID_MAJOR 203
163 165
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index daabb3aa1ec6..e147cf50529f 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -159,7 +159,7 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p);
159 159
160extern struct mempolicy default_policy; 160extern struct mempolicy default_policy;
161extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 161extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
162 unsigned long addr); 162 unsigned long addr, gfp_t gfp_flags);
163extern unsigned slab_node(struct mempolicy *policy); 163extern unsigned slab_node(struct mempolicy *policy);
164 164
165extern enum zone_type policy_zone; 165extern enum zone_type policy_zone;
@@ -256,9 +256,9 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
256#define set_cpuset_being_rebound(x) do {} while (0) 256#define set_cpuset_being_rebound(x) do {} while (0)
257 257
258static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 258static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
259 unsigned long addr) 259 unsigned long addr, gfp_t gfp_flags)
260{ 260{
261 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER); 261 return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags);
262} 262}
263 263
264static inline int do_migrate_pages(struct mm_struct *mm, 264static inline int do_migrate_pages(struct mm_struct *mm,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1c1207472bb4..c456c3a1c28e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2,7 +2,6 @@
2#define _LINUX_MM_H 2#define _LINUX_MM_H
3 3
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/capability.h>
6 5
7#ifdef __KERNEL__ 6#ifdef __KERNEL__
8 7
@@ -27,7 +26,6 @@ extern unsigned long max_mapnr;
27 26
28extern unsigned long num_physpages; 27extern unsigned long num_physpages;
29extern void * high_memory; 28extern void * high_memory;
30extern unsigned long vmalloc_earlyreserve;
31extern int page_cluster; 29extern int page_cluster;
32 30
33#ifdef CONFIG_SYSCTL 31#ifdef CONFIG_SYSCTL
@@ -170,6 +168,8 @@ extern unsigned int kobjsize(const void *objp);
170#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ 168#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
171#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 169#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
172 170
171#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
172
173#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 173#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
174#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 174#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
175#endif 175#endif
@@ -192,6 +192,30 @@ extern unsigned int kobjsize(const void *objp);
192 */ 192 */
193extern pgprot_t protection_map[16]; 193extern pgprot_t protection_map[16];
194 194
195#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
196#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
197
198
199/*
200 * vm_fault is filled by the the pagefault handler and passed to the vma's
201 * ->fault function. The vma's ->fault is responsible for returning a bitmask
202 * of VM_FAULT_xxx flags that give details about how the fault was handled.
203 *
204 * pgoff should be used in favour of virtual_address, if possible. If pgoff
205 * is used, one may set VM_CAN_NONLINEAR in the vma->vm_flags to get nonlinear
206 * mapping support.
207 */
208struct vm_fault {
209 unsigned int flags; /* FAULT_FLAG_xxx flags */
210 pgoff_t pgoff; /* Logical page offset based on vma */
211 void __user *virtual_address; /* Faulting virtual address */
212
213 struct page *page; /* ->fault handlers should return a
214 * page here, unless VM_FAULT_NOPAGE
215 * is set (which is also implied by
216 * VM_FAULT_ERROR).
217 */
218};
195 219
196/* 220/*
197 * These are the virtual MM functions - opening of an area, closing and 221 * These are the virtual MM functions - opening of an area, closing and
@@ -201,9 +225,11 @@ extern pgprot_t protection_map[16];
201struct vm_operations_struct { 225struct vm_operations_struct {
202 void (*open)(struct vm_area_struct * area); 226 void (*open)(struct vm_area_struct * area);
203 void (*close)(struct vm_area_struct * area); 227 void (*close)(struct vm_area_struct * area);
204 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 228 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
205 unsigned long (*nopfn)(struct vm_area_struct * area, unsigned long address); 229 struct page *(*nopage)(struct vm_area_struct *area,
206 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); 230 unsigned long address, int *type);
231 unsigned long (*nopfn)(struct vm_area_struct *area,
232 unsigned long address);
207 233
208 /* notification that a previously read-only page is about to become 234 /* notification that a previously read-only page is about to become
209 * writable, if an error is returned it will cause a SIGBUS */ 235 * writable, if an error is returned it will cause a SIGBUS */
@@ -601,6 +627,7 @@ static inline struct address_space *page_mapping(struct page *page)
601{ 627{
602 struct address_space *mapping = page->mapping; 628 struct address_space *mapping = page->mapping;
603 629
630 VM_BUG_ON(PageSlab(page));
604 if (unlikely(PageSwapCache(page))) 631 if (unlikely(PageSwapCache(page)))
605 mapping = &swapper_space; 632 mapping = &swapper_space;
606#ifdef CONFIG_SLUB 633#ifdef CONFIG_SLUB
@@ -656,7 +683,6 @@ static inline int page_mapped(struct page *page)
656 */ 683 */
657#define NOPAGE_SIGBUS (NULL) 684#define NOPAGE_SIGBUS (NULL)
658#define NOPAGE_OOM ((struct page *) (-1)) 685#define NOPAGE_OOM ((struct page *) (-1))
659#define NOPAGE_REFAULT ((struct page *) (-2)) /* Return to userspace, rerun */
660 686
661/* 687/*
662 * Error return values for the *_nopfn functions 688 * Error return values for the *_nopfn functions
@@ -670,16 +696,18 @@ static inline int page_mapped(struct page *page)
670 * Used to decide whether a process gets delivered SIGBUS or 696 * Used to decide whether a process gets delivered SIGBUS or
671 * just gets major/minor fault counters bumped up. 697 * just gets major/minor fault counters bumped up.
672 */ 698 */
673#define VM_FAULT_OOM 0x00 699
674#define VM_FAULT_SIGBUS 0x01 700#define VM_FAULT_MINOR 0 /* For backwards compat. Remove me quickly. */
675#define VM_FAULT_MINOR 0x02 701
676#define VM_FAULT_MAJOR 0x03 702#define VM_FAULT_OOM 0x0001
677 703#define VM_FAULT_SIGBUS 0x0002
678/* 704#define VM_FAULT_MAJOR 0x0004
679 * Special case for get_user_pages. 705#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
680 * Must be in a distinct bit from the above VM_FAULT_ flags. 706
681 */ 707#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
682#define VM_FAULT_WRITE 0x10 708#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
709
710#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS)
683 711
684#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 712#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
685 713
@@ -763,20 +791,10 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
763 791
764extern int vmtruncate(struct inode * inode, loff_t offset); 792extern int vmtruncate(struct inode * inode, loff_t offset);
765extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); 793extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
766extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
767extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
768 794
769#ifdef CONFIG_MMU 795#ifdef CONFIG_MMU
770extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, 796extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
771 unsigned long address, int write_access); 797 unsigned long address, int write_access);
772
773static inline int handle_mm_fault(struct mm_struct *mm,
774 struct vm_area_struct *vma, unsigned long address,
775 int write_access)
776{
777 return __handle_mm_fault(mm, vma, address, write_access) &
778 (~VM_FAULT_WRITE);
779}
780#else 798#else
781static inline int handle_mm_fault(struct mm_struct *mm, 799static inline int handle_mm_fault(struct mm_struct *mm,
782 struct vm_area_struct *vma, unsigned long address, 800 struct vm_area_struct *vma, unsigned long address,
@@ -790,7 +808,6 @@ static inline int handle_mm_fault(struct mm_struct *mm,
790 808
791extern int make_pages_present(unsigned long addr, unsigned long end); 809extern int make_pages_present(unsigned long addr, unsigned long end);
792extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 810extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
793void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
794 811
795int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 812int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
796 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 813 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
@@ -807,32 +824,42 @@ int FASTCALL(set_page_dirty(struct page *page));
807int set_page_dirty_lock(struct page *page); 824int set_page_dirty_lock(struct page *page);
808int clear_page_dirty_for_io(struct page *page); 825int clear_page_dirty_for_io(struct page *page);
809 826
827extern unsigned long move_page_tables(struct vm_area_struct *vma,
828 unsigned long old_addr, struct vm_area_struct *new_vma,
829 unsigned long new_addr, unsigned long len);
810extern unsigned long do_mremap(unsigned long addr, 830extern unsigned long do_mremap(unsigned long addr,
811 unsigned long old_len, unsigned long new_len, 831 unsigned long old_len, unsigned long new_len,
812 unsigned long flags, unsigned long new_addr); 832 unsigned long flags, unsigned long new_addr);
833extern int mprotect_fixup(struct vm_area_struct *vma,
834 struct vm_area_struct **pprev, unsigned long start,
835 unsigned long end, unsigned long newflags);
813 836
814/* 837/*
815 * Prototype to add a shrinker callback for ageable caches. 838 * A callback you can register to apply pressure to ageable caches.
816 *
817 * These functions are passed a count `nr_to_scan' and a gfpmask. They should
818 * scan `nr_to_scan' objects, attempting to free them.
819 * 839 *
820 * The callback must return the number of objects which remain in the cache. 840 * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should
841 * look through the least-recently-used 'nr_to_scan' entries and
842 * attempt to free them up. It should return the number of objects
843 * which remain in the cache. If it returns -1, it means it cannot do
844 * any scanning at this time (eg. there is a risk of deadlock).
821 * 845 *
822 * The callback will be passed nr_to_scan == 0 when the VM is querying the 846 * The 'gfpmask' refers to the allocation we are currently trying to
823 * cache size, so a fastpath for that case is appropriate. 847 * fulfil.
824 */ 848 *
825typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask); 849 * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is
826 850 * querying the cache size, so a fastpath for that case is appropriate.
827/*
828 * Add an aging callback. The int is the number of 'seeks' it takes
829 * to recreate one of the objects that these functions age.
830 */ 851 */
852struct shrinker {
853 int (*shrink)(int nr_to_scan, gfp_t gfp_mask);
854 int seeks; /* seeks to recreate an obj */
831 855
832#define DEFAULT_SEEKS 2 856 /* These are for internal use */
833struct shrinker; 857 struct list_head list;
834extern struct shrinker *set_shrinker(int, shrinker_t); 858 long nr; /* objs pending delete */
835extern void remove_shrinker(struct shrinker *shrinker); 859};
860#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
861extern void register_shrinker(struct shrinker *);
862extern void unregister_shrinker(struct shrinker *);
836 863
837/* 864/*
838 * Some shared mappigns will want the pages marked read-only 865 * Some shared mappigns will want the pages marked read-only
@@ -1072,6 +1099,10 @@ extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned lo
1072extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, 1099extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1073 unsigned long len, unsigned long prot, 1100 unsigned long len, unsigned long prot,
1074 unsigned long flag, unsigned long pgoff); 1101 unsigned long flag, unsigned long pgoff);
1102extern unsigned long mmap_region(struct file *file, unsigned long addr,
1103 unsigned long len, unsigned long flags,
1104 unsigned int vm_flags, unsigned long pgoff,
1105 int accountable);
1075 1106
1076static inline unsigned long do_mmap(struct file *file, unsigned long addr, 1107static inline unsigned long do_mmap(struct file *file, unsigned long addr,
1077 unsigned long len, unsigned long prot, 1108 unsigned long len, unsigned long prot,
@@ -1097,9 +1128,7 @@ extern void truncate_inode_pages_range(struct address_space *,
1097 loff_t lstart, loff_t lend); 1128 loff_t lstart, loff_t lend);
1098 1129
1099/* generic vm_area_ops exported for stackable file systems */ 1130/* generic vm_area_ops exported for stackable file systems */
1100extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *); 1131extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
1101extern int filemap_populate(struct vm_area_struct *, unsigned long,
1102 unsigned long, pgprot_t, unsigned long, int);
1103 1132
1104/* mm/page-writeback.c */ 1133/* mm/page-writeback.c */
1105int write_one_page(struct page *page, int wait); 1134int write_one_page(struct page *page, int wait);
@@ -1114,13 +1143,20 @@ int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
1114 pgoff_t offset, unsigned long nr_to_read); 1143 pgoff_t offset, unsigned long nr_to_read);
1115int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 1144int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
1116 pgoff_t offset, unsigned long nr_to_read); 1145 pgoff_t offset, unsigned long nr_to_read);
1117unsigned long page_cache_readahead(struct address_space *mapping, 1146
1118 struct file_ra_state *ra, 1147void page_cache_sync_readahead(struct address_space *mapping,
1119 struct file *filp, 1148 struct file_ra_state *ra,
1120 pgoff_t offset, 1149 struct file *filp,
1121 unsigned long size); 1150 pgoff_t offset,
1122void handle_ra_miss(struct address_space *mapping, 1151 unsigned long size);
1123 struct file_ra_state *ra, pgoff_t offset); 1152
1153void page_cache_async_readahead(struct address_space *mapping,
1154 struct file_ra_state *ra,
1155 struct file *filp,
1156 struct page *pg,
1157 pgoff_t offset,
1158 unsigned long size);
1159
1124unsigned long max_sane_readahead(unsigned long nr); 1160unsigned long max_sane_readahead(unsigned long nr);
1125 1161
1126/* Do stack extension */ 1162/* Do stack extension */
@@ -1128,6 +1164,8 @@ extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
1128#ifdef CONFIG_IA64 1164#ifdef CONFIG_IA64
1129extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); 1165extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
1130#endif 1166#endif
1167extern int expand_stack_downwards(struct vm_area_struct *vma,
1168 unsigned long address);
1131 1169
1132/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ 1170/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
1133extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr); 1171extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index d09b1345a3a1..da8eb8ad9e9b 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -24,6 +24,14 @@
24#endif 24#endif
25#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1)) 25#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
26 26
27/*
28 * PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed
29 * costly to service. That is between allocation orders which should
30 * coelesce naturally under reasonable reclaim pressure and those which
31 * will not.
32 */
33#define PAGE_ALLOC_COSTLY_ORDER 3
34
27struct free_area { 35struct free_area {
28 struct list_head free_list; 36 struct list_head free_list;
29 unsigned long nr_free; 37 unsigned long nr_free;
@@ -146,6 +154,7 @@ enum zone_type {
146 */ 154 */
147 ZONE_HIGHMEM, 155 ZONE_HIGHMEM,
148#endif 156#endif
157 ZONE_MOVABLE,
149 MAX_NR_ZONES 158 MAX_NR_ZONES
150}; 159};
151 160
@@ -167,6 +176,7 @@ enum zone_type {
167 + defined(CONFIG_ZONE_DMA32) \ 176 + defined(CONFIG_ZONE_DMA32) \
168 + 1 \ 177 + 1 \
169 + defined(CONFIG_HIGHMEM) \ 178 + defined(CONFIG_HIGHMEM) \
179 + 1 \
170) 180)
171#if __ZONE_COUNT < 2 181#if __ZONE_COUNT < 2
172#define ZONES_SHIFT 0 182#define ZONES_SHIFT 0
@@ -499,10 +509,22 @@ static inline int populated_zone(struct zone *zone)
499 return (!!zone->present_pages); 509 return (!!zone->present_pages);
500} 510}
501 511
512extern int movable_zone;
513
514static inline int zone_movable_is_highmem(void)
515{
516#if defined(CONFIG_HIGHMEM) && defined(CONFIG_ARCH_POPULATES_NODE_MAP)
517 return movable_zone == ZONE_HIGHMEM;
518#else
519 return 0;
520#endif
521}
522
502static inline int is_highmem_idx(enum zone_type idx) 523static inline int is_highmem_idx(enum zone_type idx)
503{ 524{
504#ifdef CONFIG_HIGHMEM 525#ifdef CONFIG_HIGHMEM
505 return (idx == ZONE_HIGHMEM); 526 return (idx == ZONE_HIGHMEM ||
527 (idx == ZONE_MOVABLE && zone_movable_is_highmem()));
506#else 528#else
507 return 0; 529 return 0;
508#endif 530#endif
@@ -522,7 +544,9 @@ static inline int is_normal_idx(enum zone_type idx)
522static inline int is_highmem(struct zone *zone) 544static inline int is_highmem(struct zone *zone)
523{ 545{
524#ifdef CONFIG_HIGHMEM 546#ifdef CONFIG_HIGHMEM
525 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; 547 int zone_idx = zone - zone->zone_pgdat->node_zones;
548 return zone_idx == ZONE_HIGHMEM ||
549 (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem());
526#else 550#else
527 return 0; 551 return 0;
528#endif 552#endif
@@ -566,6 +590,11 @@ int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
566int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, 590int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
567 struct file *, void __user *, size_t *, loff_t *); 591 struct file *, void __user *, size_t *, loff_t *);
568 592
593extern int numa_zonelist_order_handler(struct ctl_table *, int,
594 struct file *, void __user *, size_t *, loff_t *);
595extern char numa_zonelist_order[];
596#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
597
569#include <linux/topology.h> 598#include <linux/topology.h>
570/* Returns the number of the current Node. */ 599/* Returns the number of the current Node. */
571#ifndef numa_node_id 600#ifndef numa_node_id
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 1fa4d9813b31..8eed44f8ca73 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -14,7 +14,7 @@ struct mnt_namespace {
14 int event; 14 int event;
15}; 15};
16 16
17extern struct mnt_namespace *copy_mnt_ns(int, struct mnt_namespace *, 17extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
18 struct fs_struct *); 18 struct fs_struct *);
19extern void __put_mnt_ns(struct mnt_namespace *ns); 19extern void __put_mnt_ns(struct mnt_namespace *ns);
20 20
diff --git a/include/linux/module.h b/include/linux/module.h
index e6e0f86ef5fc..b6a646cea1cb 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -6,7 +6,6 @@
6 * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 6 * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
7 * Rewritten again by Rusty Russell, 2002 7 * Rewritten again by Rusty Russell, 2002
8 */ 8 */
9#include <linux/spinlock.h>
10#include <linux/list.h> 9#include <linux/list.h>
11#include <linux/stat.h> 10#include <linux/stat.h>
12#include <linux/compiler.h> 11#include <linux/compiler.h>
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 0e09c005dda8..f950921523f5 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -146,7 +146,7 @@ struct fat_boot_fsinfo {
146}; 146};
147 147
148struct msdos_dir_entry { 148struct msdos_dir_entry {
149 __u8 name[8],ext[3]; /* name and extension */ 149 __u8 name[MSDOS_NAME];/* name and extension */
150 __u8 attr; /* attribute bits */ 150 __u8 attr; /* attribute bits */
151 __u8 lcase; /* Case for base and extension */ 151 __u8 lcase; /* Case for base and extension */
152 __u8 ctime_cs; /* Creation time, centiseconds (0-199) */ 152 __u8 ctime_cs; /* Creation time, centiseconds (0-199) */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index b7dd24917f0d..6c38efbd810f 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -69,8 +69,8 @@ extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struc
69#define user_path_walk_link(name,nd) \ 69#define user_path_walk_link(name,nd) \
70 __user_walk_fd(AT_FDCWD, name, 0, nd) 70 __user_walk_fd(AT_FDCWD, name, 0, nd)
71extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); 71extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
72extern int FASTCALL(path_walk(const char *, struct nameidata *)); 72extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
73extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); 73 const char *, unsigned int, struct nameidata *);
74extern void path_release(struct nameidata *); 74extern void path_release(struct nameidata *);
75extern void path_release_on_umount(struct nameidata *); 75extern void path_release_on_umount(struct nameidata *);
76 76
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 83e39eb054d3..88766e43e121 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -148,8 +148,6 @@ struct ncp_nls_ioctl
148#include <linux/ncp_fs_i.h> 148#include <linux/ncp_fs_i.h>
149#include <linux/ncp_fs_sb.h> 149#include <linux/ncp_fs_sb.h>
150 150
151/* undef because public define in umsdos_fs.h (ncp_fs.h isn't public) */
152#undef PRINTK
153/* define because it is easy to change PRINTK to {*}PRINTK */ 151/* define because it is easy to change PRINTK to {*}PRINTK */
154#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args) 152#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
155 153
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 322b5eae57dd..4a616d73cc25 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -262,8 +262,6 @@ enum netdev_state_t
262 __LINK_STATE_LINKWATCH_PENDING, 262 __LINK_STATE_LINKWATCH_PENDING,
263 __LINK_STATE_DORMANT, 263 __LINK_STATE_DORMANT,
264 __LINK_STATE_QDISC_RUNNING, 264 __LINK_STATE_QDISC_RUNNING,
265 /* Set by the netpoll NAPI code */
266 __LINK_STATE_POLL_LIST_FROZEN,
267}; 265};
268 266
269 267
@@ -577,7 +575,7 @@ struct net_device
577 575
578 /* The TX queue control structures */ 576 /* The TX queue control structures */
579 unsigned int egress_subqueue_count; 577 unsigned int egress_subqueue_count;
580 struct net_device_subqueue egress_subqueue[0]; 578 struct net_device_subqueue egress_subqueue[1];
581}; 579};
582#define to_net_dev(d) container_of(d, struct net_device, dev) 580#define to_net_dev(d) container_of(d, struct net_device, dev)
583 581
@@ -1022,14 +1020,6 @@ static inline void netif_rx_complete(struct net_device *dev)
1022{ 1020{
1023 unsigned long flags; 1021 unsigned long flags;
1024 1022
1025#ifdef CONFIG_NETPOLL
1026 /* Prevent race with netpoll - yes, this is a kludge.
1027 * But at least it doesn't penalize the non-netpoll
1028 * code path. */
1029 if (test_bit(__LINK_STATE_POLL_LIST_FROZEN, &dev->state))
1030 return;
1031#endif
1032
1033 local_irq_save(flags); 1023 local_irq_save(flags);
1034 __netif_rx_complete(dev); 1024 __netif_rx_complete(dev);
1035 local_irq_restore(flags); 1025 local_irq_restore(flags);
@@ -1108,10 +1098,8 @@ extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all
1108extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); 1098extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1109extern int dev_mc_sync(struct net_device *to, struct net_device *from); 1099extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1110extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 1100extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1111extern void dev_mc_discard(struct net_device *dev);
1112extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all); 1101extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1113extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); 1102extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1114extern void __dev_addr_discard(struct dev_addr_list **list);
1115extern void dev_set_promiscuity(struct net_device *dev, int inc); 1103extern void dev_set_promiscuity(struct net_device *dev, int inc);
1116extern void dev_set_allmulti(struct net_device *dev, int inc); 1104extern void dev_set_allmulti(struct net_device *dev, int inc);
1117extern void netdev_state_change(struct net_device *dev); 1105extern void netdev_state_change(struct net_device *dev);
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index 34ab0fb736e2..a92fefc3c7ec 100644
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ b/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_IPRANGE_H 1#ifndef _IPT_IPRANGE_H
2#define _IPT_IPRANGE_H 2#define _IPT_IPRANGE_H
3 3
4#include <linux/types.h>
5
4#define IPRANGE_SRC 0x01 /* Match source IP address */ 6#define IPRANGE_SRC 0x01 /* Match source IP address */
5#define IPRANGE_DST 0x02 /* Match destination IP address */ 7#define IPRANGE_DST 0x02 /* Match destination IP address */
6#define IPRANGE_SRC_INV 0x10 /* Negate the condition */ 8#define IPRANGE_SRC_INV 0x10 /* Negate the condition */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2e23353c28a5..83d8239f0cce 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -161,6 +161,8 @@ extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
161 void (*input)(struct sock *sk, int len), 161 void (*input)(struct sock *sk, int len),
162 struct mutex *cb_mutex, 162 struct mutex *cb_mutex,
163 struct module *module); 163 struct module *module);
164extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
165extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 166extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
165extern int netlink_has_listeners(struct sock *sk, unsigned int group); 167extern int netlink_has_listeners(struct sock *sk, unsigned int group);
166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 168extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c098ae194f79..9ba4aec37c50 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -407,8 +407,8 @@ extern void nfs_release_automount_timer(void);
407/* 407/*
408 * linux/fs/nfs/unlink.c 408 * linux/fs/nfs/unlink.c
409 */ 409 */
410extern int nfs_async_unlink(struct dentry *); 410extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry);
411extern void nfs_complete_unlink(struct dentry *); 411extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
412 412
413/* 413/*
414 * linux/fs/nfs/write.c 414 * linux/fs/nfs/write.c
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 38d77681cf27..cf74a4db84a5 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -278,6 +278,21 @@ struct nfs_writeres {
278}; 278};
279 279
280/* 280/*
281 * Common arguments to the unlink call
282 */
283struct nfs_removeargs {
284 const struct nfs_fh *fh;
285 struct qstr name;
286 const u32 * bitmask;
287};
288
289struct nfs_removeres {
290 const struct nfs_server *server;
291 struct nfs4_change_info cinfo;
292 struct nfs_fattr dir_attr;
293};
294
295/*
281 * Argument struct for decode_entry function 296 * Argument struct for decode_entry function
282 */ 297 */
283struct nfs_entry { 298struct nfs_entry {
@@ -631,18 +646,6 @@ struct nfs4_readlink {
631 struct page ** pages; /* zero-copy data */ 646 struct page ** pages; /* zero-copy data */
632}; 647};
633 648
634struct nfs4_remove_arg {
635 const struct nfs_fh * fh;
636 const struct qstr * name;
637 const u32 * bitmask;
638};
639
640struct nfs4_remove_res {
641 const struct nfs_server * server;
642 struct nfs4_change_info cinfo;
643 struct nfs_fattr * dir_attr;
644};
645
646struct nfs4_rename_arg { 649struct nfs4_rename_arg {
647 const struct nfs_fh * old_dir; 650 const struct nfs_fh * old_dir;
648 const struct nfs_fh * new_dir; 651 const struct nfs_fh * new_dir;
@@ -788,9 +791,8 @@ struct nfs_rpc_ops {
788 int (*create) (struct inode *, struct dentry *, 791 int (*create) (struct inode *, struct dentry *,
789 struct iattr *, int, struct nameidata *); 792 struct iattr *, int, struct nameidata *);
790 int (*remove) (struct inode *, struct qstr *); 793 int (*remove) (struct inode *, struct qstr *);
791 int (*unlink_setup) (struct rpc_message *, 794 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
792 struct dentry *, struct qstr *); 795 int (*unlink_done) (struct rpc_task *, struct inode *);
793 int (*unlink_done) (struct dentry *, struct rpc_task *);
794 int (*rename) (struct inode *, struct qstr *, 796 int (*rename) (struct inode *, struct qstr *,
795 struct inode *, struct qstr *); 797 struct inode *, struct qstr *);
796 int (*link) (struct inode *, struct inode *, struct qstr *); 798 int (*link) (struct inode *, struct inode *, struct qstr *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 9f62d6182d32..5cd192469096 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -42,6 +42,9 @@
42#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ 42#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
43#define NFSEXP_ALLFLAGS 0xFE3F 43#define NFSEXP_ALLFLAGS 0xFE3F
44 44
45/* The flags that may vary depending on security flavor: */
46#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
47 | NFSEXP_ALLSQUASH)
45 48
46#ifdef __KERNEL__ 49#ifdef __KERNEL__
47 50
@@ -64,6 +67,19 @@ struct nfsd4_fs_locations {
64 int migrated; 67 int migrated;
65}; 68};
66 69
70/*
71 * We keep an array of pseudoflavors with the export, in order from most
72 * to least preferred. For the forseeable future, we don't expect more
73 * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
74 * spkm3i, and spkm3p (and using all 8 at once should be rare).
75 */
76#define MAX_SECINFO_LIST 8
77
78struct exp_flavor_info {
79 u32 pseudoflavor;
80 u32 flags;
81};
82
67struct svc_export { 83struct svc_export {
68 struct cache_head h; 84 struct cache_head h;
69 struct auth_domain * ex_client; 85 struct auth_domain * ex_client;
@@ -76,6 +92,8 @@ struct svc_export {
76 int ex_fsid; 92 int ex_fsid;
77 unsigned char * ex_uuid; /* 16 byte fsid */ 93 unsigned char * ex_uuid; /* 16 byte fsid */
78 struct nfsd4_fs_locations ex_fslocs; 94 struct nfsd4_fs_locations ex_fslocs;
95 int ex_nflavors;
96 struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST];
79}; 97};
80 98
81/* an "export key" (expkey) maps a filehandlefragement to an 99/* an "export key" (expkey) maps a filehandlefragement to an
@@ -95,10 +113,11 @@ struct svc_expkey {
95 113
96#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) 114#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
97#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) 115#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
98#define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY)
99#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) 116#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
100#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) 117#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
101 118
119int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
120__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
102 121
103/* 122/*
104 * Function declarations 123 * Function declarations
@@ -112,13 +131,19 @@ struct svc_export * exp_get_by_name(struct auth_domain *clp,
112 struct vfsmount *mnt, 131 struct vfsmount *mnt,
113 struct dentry *dentry, 132 struct dentry *dentry,
114 struct cache_req *reqp); 133 struct cache_req *reqp);
134struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
135 struct vfsmount *,
136 struct dentry *);
115struct svc_export * exp_parent(struct auth_domain *clp, 137struct svc_export * exp_parent(struct auth_domain *clp,
116 struct vfsmount *mnt, 138 struct vfsmount *mnt,
117 struct dentry *dentry, 139 struct dentry *dentry,
118 struct cache_req *reqp); 140 struct cache_req *reqp);
141struct svc_export * rqst_exp_parent(struct svc_rqst *,
142 struct vfsmount *mnt,
143 struct dentry *dentry);
119int exp_rootfh(struct auth_domain *, 144int exp_rootfh(struct auth_domain *,
120 char *path, struct knfsd_fh *, int maxsize); 145 char *path, struct knfsd_fh *, int maxsize);
121__be32 exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 146__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
122__be32 nfserrno(int errno); 147__be32 nfserrno(int errno);
123 148
124extern struct cache_detail svc_export_cache; 149extern struct cache_detail svc_export_cache;
@@ -135,6 +160,7 @@ static inline void exp_get(struct svc_export *exp)
135extern struct svc_export * 160extern struct svc_export *
136exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, 161exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
137 struct cache_req *reqp); 162 struct cache_req *reqp);
163struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
138 164
139#endif /* __KERNEL__ */ 165#endif /* __KERNEL__ */
140 166
diff --git a/include/linux/nfsd/interface.h b/include/linux/nfsd/interface.h
deleted file mode 100644
index af0979704afb..000000000000
--- a/include/linux/nfsd/interface.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * include/linux/nfsd/interface.h
3 *
4 * defines interface between nfsd and other bits of
5 * the kernel. Particularly filesystems (eventually).
6 *
7 * Copyright (C) 2000 Neil Brown <neilb@cse.unsw.edu.au>
8 */
9
10#ifndef LINUX_NFSD_INTERFACE_H
11#define LINUX_NFSD_INTERFACE_H
12
13#endif /* LINUX_NFSD_INTERFACE_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 72feac581aa3..e452256d3f72 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -22,7 +22,6 @@
22#include <linux/nfsd/export.h> 22#include <linux/nfsd/export.h>
23#include <linux/nfsd/auth.h> 23#include <linux/nfsd/auth.h>
24#include <linux/nfsd/stats.h> 24#include <linux/nfsd/stats.h>
25#include <linux/nfsd/interface.h>
26/* 25/*
27 * nfsd version 26 * nfsd version
28 */ 27 */
@@ -72,6 +71,9 @@ int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
72 struct svc_export **expp); 71 struct svc_export **expp);
73__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, 72__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
74 const char *, int, struct svc_fh *); 73 const char *, int, struct svc_fh *);
74__be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
75 const char *, int,
76 struct svc_export **, struct dentry **);
75__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, 77__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
76 struct iattr *, int, time_t); 78 struct iattr *, int, time_t);
77#ifdef CONFIG_NFSD_V4 79#ifdef CONFIG_NFSD_V4
@@ -120,7 +122,8 @@ __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
120 struct kstatfs *); 122 struct kstatfs *);
121 123
122int nfsd_notify_change(struct inode *, struct iattr *); 124int nfsd_notify_change(struct inode *, struct iattr *);
123__be32 nfsd_permission(struct svc_export *, struct dentry *, int); 125__be32 nfsd_permission(struct svc_rqst *, struct svc_export *,
126 struct dentry *, int);
124int nfsd_sync_dir(struct dentry *dp); 127int nfsd_sync_dir(struct dentry *dp);
125 128
126#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -149,6 +152,7 @@ extern int nfsd_max_blksize;
149 * NFSv4 State 152 * NFSv4 State
150 */ 153 */
151#ifdef CONFIG_NFSD_V4 154#ifdef CONFIG_NFSD_V4
155extern unsigned int max_delegations;
152void nfs4_state_init(void); 156void nfs4_state_init(void);
153int nfs4_state_start(void); 157int nfs4_state_start(void);
154void nfs4_state_shutdown(void); 158void nfs4_state_shutdown(void);
@@ -236,6 +240,7 @@ void nfsd_lockd_shutdown(void);
236#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 240#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
237#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 241#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
238#define nfserr_locked __constant_htonl(NFSERR_LOCKED) 242#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
243#define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC)
239#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME) 244#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME)
240 245
241/* error codes for internal use */ 246/* error codes for internal use */
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index ab5c236bd9a7..db348f749376 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -67,7 +67,7 @@ struct nfs4_cb_recall {
67 int cbr_trunc; 67 int cbr_trunc;
68 stateid_t cbr_stateid; 68 stateid_t cbr_stateid;
69 u32 cbr_fhlen; 69 u32 cbr_fhlen;
70 u32 cbr_fhval[NFS4_FHSIZE]; 70 char cbr_fhval[NFS4_FHSIZE];
71 struct nfs4_delegation *cbr_dp; 71 struct nfs4_delegation *cbr_dp;
72}; 72};
73 73
@@ -224,6 +224,7 @@ struct nfs4_file {
224 struct inode *fi_inode; 224 struct inode *fi_inode;
225 u32 fi_id; /* used with stateowner->so_id 225 u32 fi_id; /* used with stateowner->so_id
226 * for stateid_hashtbl hash */ 226 * for stateid_hashtbl hash */
227 bool fi_had_conflict;
227}; 228};
228 229
229/* 230/*
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 09799bcee0ac..1b653267133a 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -293,6 +293,12 @@ struct nfsd4_rename {
293 struct nfsd4_change_info rn_tinfo; /* response */ 293 struct nfsd4_change_info rn_tinfo; /* response */
294}; 294};
295 295
296struct nfsd4_secinfo {
297 u32 si_namelen; /* request */
298 char *si_name; /* request */
299 struct svc_export *si_exp; /* response */
300};
301
296struct nfsd4_setattr { 302struct nfsd4_setattr {
297 stateid_t sa_stateid; /* request */ 303 stateid_t sa_stateid; /* request */
298 u32 sa_bmval[2]; /* request */ 304 u32 sa_bmval[2]; /* request */
@@ -365,6 +371,7 @@ struct nfsd4_op {
365 struct nfsd4_remove remove; 371 struct nfsd4_remove remove;
366 struct nfsd4_rename rename; 372 struct nfsd4_rename rename;
367 clientid_t renew; 373 clientid_t renew;
374 struct nfsd4_secinfo secinfo;
368 struct nfsd4_setattr setattr; 375 struct nfsd4_setattr setattr;
369 struct nfsd4_setclientid setclientid; 376 struct nfsd4_setclientid setclientid;
370 struct nfsd4_setclientid_confirm setclientid_confirm; 377 struct nfsd4_setclientid_confirm setclientid_confirm;
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 9431101bf876..be3f2bb6fcf3 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -196,6 +196,8 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
196#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ 196#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
197#define CPU_LOCK_ACQUIRE 0x0008 /* Acquire all hotcpu locks */ 197#define CPU_LOCK_ACQUIRE 0x0008 /* Acquire all hotcpu locks */
198#define CPU_LOCK_RELEASE 0x0009 /* Release all hotcpu locks */ 198#define CPU_LOCK_RELEASE 0x0009 /* Release all hotcpu locks */
199#define CPU_DYING 0x000A /* CPU (unsigned)v not running any task,
200 * not handling interrupts, soon dead */
199 201
200/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 202/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
201 * operation in progress 203 * operation in progress
@@ -208,6 +210,13 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
208#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN) 210#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
209#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) 211#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
210#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) 212#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
213#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
214
215/* Hibernation and suspend events */
216#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
217#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */
218#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
219#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
211 220
212#endif /* __KERNEL__ */ 221#endif /* __KERNEL__ */
213#endif /* _LINUX_NOTIFIER_H */ 222#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 189e0dc993ab..ce06188b7a56 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -28,10 +28,11 @@ struct nsproxy {
28 struct ipc_namespace *ipc_ns; 28 struct ipc_namespace *ipc_ns;
29 struct mnt_namespace *mnt_ns; 29 struct mnt_namespace *mnt_ns;
30 struct pid_namespace *pid_ns; 30 struct pid_namespace *pid_ns;
31 struct user_namespace *user_ns;
31}; 32};
32extern struct nsproxy init_nsproxy; 33extern struct nsproxy init_nsproxy;
33 34
34int copy_namespaces(int flags, struct task_struct *tsk); 35int copy_namespaces(unsigned long flags, struct task_struct *tsk);
35void get_task_namespaces(struct task_struct *tsk); 36void get_task_namespaces(struct task_struct *tsk);
36void free_nsproxy(struct nsproxy *ns); 37void free_nsproxy(struct nsproxy *ns);
37int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **, 38int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
diff --git a/include/linux/of.h b/include/linux/of.h
new file mode 100644
index 000000000000..47734ffd9745
--- /dev/null
+++ b/include/linux/of.h
@@ -0,0 +1,61 @@
1#ifndef _LINUX_OF_H
2#define _LINUX_OF_H
3/*
4 * Definitions for talking to the Open Firmware PROM on
5 * Power Macintosh and other computers.
6 *
7 * Copyright (C) 1996-2005 Paul Mackerras.
8 *
9 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
10 * Updates for SPARC64 by David S. Miller
11 * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#include <linux/types.h>
19
20#include <asm/bitops.h>
21#include <asm/prom.h>
22
23/* flag descriptions */
24#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
25#define OF_DETACHED 2 /* node has been detached from the device tree */
26
27#define OF_BAD_ADDR ((u64)-1)
28
29extern struct device_node *of_find_node_by_name(struct device_node *from,
30 const char *name);
31#define for_each_node_by_name(dn, name) \
32 for (dn = of_find_node_by_name(NULL, name); dn; \
33 dn = of_find_node_by_name(dn, name))
34extern struct device_node *of_find_node_by_type(struct device_node *from,
35 const char *type);
36#define for_each_node_by_type(dn, type) \
37 for (dn = of_find_node_by_type(NULL, type); dn; \
38 dn = of_find_node_by_type(dn, type))
39extern struct device_node *of_find_compatible_node(struct device_node *from,
40 const char *type, const char *compat);
41#define for_each_compatible_node(dn, type, compatible) \
42 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
43 dn = of_find_compatible_node(dn, type, compatible))
44extern struct device_node *of_find_node_by_path(const char *path);
45extern struct device_node *of_find_node_by_phandle(phandle handle);
46extern struct device_node *of_get_parent(const struct device_node *node);
47extern struct device_node *of_get_next_child(const struct device_node *node,
48 struct device_node *prev);
49extern struct property *of_find_property(const struct device_node *np,
50 const char *name,
51 int *lenp);
52extern int of_device_is_compatible(const struct device_node *device,
53 const char *);
54extern const void *of_get_property(const struct device_node *node,
55 const char *name,
56 int *lenp);
57#define get_property(a, b, c) of_get_property((a), (b), (c))
58extern int of_n_addr_cells(struct device_node *np);
59extern int of_n_size_cells(struct device_node *np);
60
61#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
new file mode 100644
index 000000000000..91bf84b9d144
--- /dev/null
+++ b/include/linux/of_device.h
@@ -0,0 +1,26 @@
1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/of.h>
7#include <linux/mod_devicetable.h>
8
9#include <asm/of_device.h>
10
11#define to_of_device(d) container_of(d, struct of_device, dev)
12
13extern const struct of_device_id *of_match_node(
14 const struct of_device_id *matches, const struct device_node *node);
15extern const struct of_device_id *of_match_device(
16 const struct of_device_id *matches, const struct of_device *dev);
17
18extern struct of_device *of_dev_get(struct of_device *dev);
19extern void of_dev_put(struct of_device *dev);
20
21extern int of_device_register(struct of_device *ofdev);
22extern void of_device_unregister(struct of_device *ofdev);
23extern void of_release_dev(struct device *dev);
24
25#endif /* __KERNEL__ */
26#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
new file mode 100644
index 000000000000..448f70b30a0c
--- /dev/null
+++ b/include/linux/of_platform.h
@@ -0,0 +1,57 @@
1#ifndef _LINUX_OF_PLATFORM_H
2#define _LINUX_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
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#include <linux/module.h>
15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
17#include <linux/pm.h>
18#include <linux/of_device.h>
19
20/*
21 * The of_platform_bus_type is a bus type used by drivers that do not
22 * attach to a macio or similar bus but still use OF probing
23 * mechanism
24 */
25extern struct bus_type of_platform_bus_type;
26
27/*
28 * An of_platform_driver driver is attached to a basic of_device on
29 * the "platform bus" (of_platform_bus_type) (or ISA, EBUS and SBUS
30 * busses on sparc).
31 */
32struct of_platform_driver
33{
34 const char *name;
35 const struct of_device_id *match_table;
36 struct module *owner;
37
38 int (*probe)(struct of_device* dev,
39 const struct of_device_id *match);
40 int (*remove)(struct of_device* dev);
41
42 int (*suspend)(struct of_device* dev, pm_message_t state);
43 int (*resume)(struct of_device* dev);
44 int (*shutdown)(struct of_device* dev);
45
46 struct device_driver driver;
47};
48#define to_of_platform_driver(drv) \
49 container_of(drv,struct of_platform_driver, driver)
50
51#include <asm/of_platform.h>
52
53extern struct of_device *of_find_device_by_node(struct device_node *np);
54
55extern int of_bus_type_init(struct bus_type *bus, const char *name);
56
57#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 0d514b252454..041bb31100f4 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -17,6 +17,26 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19 19
20/* Each escaped entry is prefixed by ESCAPE_CODE
21 * then one of the following codes, then the
22 * relevant data.
23 * These #defines live in this file so that arch-specific
24 * buffer sync'ing code can access them.
25 */
26#define ESCAPE_CODE ~0UL
27#define CTX_SWITCH_CODE 1
28#define CPU_SWITCH_CODE 2
29#define COOKIE_SWITCH_CODE 3
30#define KERNEL_ENTER_SWITCH_CODE 4
31#define KERNEL_EXIT_SWITCH_CODE 5
32#define MODULE_LOADED_CODE 6
33#define CTX_TGID_CODE 7
34#define TRACE_BEGIN_CODE 8
35#define TRACE_END_CODE 9
36#define XEN_ENTER_SWITCH_CODE 10
37#define SPU_PROFILING_CODE 11
38#define SPU_CTX_SWITCH_CODE 12
39
20struct super_block; 40struct super_block;
21struct dentry; 41struct dentry;
22struct file_operations; 42struct file_operations;
@@ -35,6 +55,14 @@ struct oprofile_operations {
35 int (*start)(void); 55 int (*start)(void);
36 /* Stop delivering interrupts. */ 56 /* Stop delivering interrupts. */
37 void (*stop)(void); 57 void (*stop)(void);
58 /* Arch-specific buffer sync functions.
59 * Return value = 0: Success
60 * Return value = -1: Failure
61 * Return value = 1: Run generic sync function
62 */
63 int (*sync_start)(void);
64 int (*sync_stop)(void);
65
38 /* Initiate a stack backtrace. Optional. */ 66 /* Initiate a stack backtrace. Optional. */
39 void (*backtrace)(struct pt_regs * const regs, unsigned int depth); 67 void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
40 /* CPU identification string. */ 68 /* CPU identification string. */
@@ -56,6 +84,13 @@ int oprofile_arch_init(struct oprofile_operations * ops);
56void oprofile_arch_exit(void); 84void oprofile_arch_exit(void);
57 85
58/** 86/**
87 * Add data to the event buffer.
88 * The data passed is free-form, but typically consists of
89 * file offsets, dcookies, context information, and ESCAPE codes.
90 */
91void add_event_entry(unsigned long data);
92
93/**
59 * Add a sample. This may be called from any context. Pass 94 * Add a sample. This may be called from any context. Pass
60 * smp_processor_id() as cpu. 95 * smp_processor_id() as cpu.
61 */ 96 */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index ae2d79f2107e..209d3a47f50f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -90,8 +90,12 @@
90#define PG_reclaim 17 /* To be reclaimed asap */ 90#define PG_reclaim 17 /* To be reclaimed asap */
91#define PG_buddy 19 /* Page is free, on buddy lists */ 91#define PG_buddy 19 /* Page is free, on buddy lists */
92 92
93/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
94#define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
95
93/* PG_owner_priv_1 users should have descriptive aliases */ 96/* PG_owner_priv_1 users should have descriptive aliases */
94#define PG_checked PG_owner_priv_1 /* Used by some filesystems */ 97#define PG_checked PG_owner_priv_1 /* Used by some filesystems */
98#define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */
95 99
96#if (BITS_PER_LONG > 32) 100#if (BITS_PER_LONG > 32)
97/* 101/*
@@ -170,6 +174,10 @@ static inline void SetPageUptodate(struct page *page)
170#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags) 174#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
171#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags) 175#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags)
172 176
177#define PagePinned(page) test_bit(PG_pinned, &(page)->flags)
178#define SetPagePinned(page) set_bit(PG_pinned, &(page)->flags)
179#define ClearPagePinned(page) clear_bit(PG_pinned, &(page)->flags)
180
173#define PageReserved(page) test_bit(PG_reserved, &(page)->flags) 181#define PageReserved(page) test_bit(PG_reserved, &(page)->flags)
174#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags) 182#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags)
175#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags) 183#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags)
@@ -181,37 +189,15 @@ static inline void SetPageUptodate(struct page *page)
181#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags) 189#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags)
182#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags) 190#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
183 191
192/*
193 * Only test-and-set exist for PG_writeback. The unconditional operators are
194 * risky: they bypass page accounting.
195 */
184#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags) 196#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags)
185#define SetPageWriteback(page) \ 197#define TestSetPageWriteback(page) test_and_set_bit(PG_writeback, \
186 do { \ 198 &(page)->flags)
187 if (!test_and_set_bit(PG_writeback, \ 199#define TestClearPageWriteback(page) test_and_clear_bit(PG_writeback, \
188 &(page)->flags)) \ 200 &(page)->flags)
189 inc_zone_page_state(page, NR_WRITEBACK); \
190 } while (0)
191#define TestSetPageWriteback(page) \
192 ({ \
193 int ret; \
194 ret = test_and_set_bit(PG_writeback, \
195 &(page)->flags); \
196 if (!ret) \
197 inc_zone_page_state(page, NR_WRITEBACK); \
198 ret; \
199 })
200#define ClearPageWriteback(page) \
201 do { \
202 if (test_and_clear_bit(PG_writeback, \
203 &(page)->flags)) \
204 dec_zone_page_state(page, NR_WRITEBACK); \
205 } while (0)
206#define TestClearPageWriteback(page) \
207 ({ \
208 int ret; \
209 ret = test_and_clear_bit(PG_writeback, \
210 &(page)->flags); \
211 if (ret) \
212 dec_zone_page_state(page, NR_WRITEBACK); \
213 ret; \
214 })
215 201
216#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags) 202#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags)
217#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags) 203#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags)
@@ -221,6 +207,10 @@ static inline void SetPageUptodate(struct page *page)
221#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags) 207#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
222#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags) 208#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
223 209
210#define PageReadahead(page) test_bit(PG_readahead, &(page)->flags)
211#define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags)
212#define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags)
213
224#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags) 214#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags)
225#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags) 215#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags)
226#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) 216#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 37a71580ad8a..5e84f2e8d54c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -432,6 +432,8 @@ extern struct bus_type pci_bus_type;
432 * code, or pci core code. */ 432 * code, or pci core code. */
433extern struct list_head pci_root_buses; /* list of all known PCI buses */ 433extern struct list_head pci_root_buses; /* list of all known PCI buses */
434extern struct list_head pci_devices; /* list of all devices */ 434extern struct list_head pci_devices; /* list of all devices */
435/* Some device drivers need know if pci is initiated */
436extern int no_pci_devices(void);
435 437
436void pcibios_fixup_bus(struct pci_bus *); 438void pcibios_fixup_bus(struct pci_bus *);
437int __must_check pcibios_enable_device(struct pci_dev *, int mask); 439int __must_check pcibios_enable_device(struct pci_dev *, int mask);
@@ -724,6 +726,7 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *
724{ return NULL; } 726{ return NULL; }
725 727
726#define pci_dev_present(ids) (0) 728#define pci_dev_present(ids) (0)
729#define no_pci_devices() (1)
727#define pci_find_present(ids) (NULL) 730#define pci_find_present(ids) (NULL)
728#define pci_dev_put(dev) do { } while (0) 731#define pci_dev_put(dev) do { } while (0)
729 732
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2c7add169539..ced4d3f76104 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -495,6 +495,8 @@
495 495
496#define PCI_VENDOR_ID_AMD 0x1022 496#define PCI_VENDOR_ID_AMD 0x1022
497#define PCI_DEVICE_ID_AMD_K8_NB 0x1100 497#define PCI_DEVICE_ID_AMD_K8_NB 0x1100
498#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101
499#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102
498#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 500#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103
499#define PCI_DEVICE_ID_AMD_LANCE 0x2000 501#define PCI_DEVICE_ID_AMD_LANCE 0x2000
500#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 502#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
@@ -2038,6 +2040,8 @@
2038#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea 2040#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
2039#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb 2041#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
2040 2042
2043#define PCI_VENDOR_ID_LENOVO 0x17aa
2044
2041#define PCI_VENDOR_ID_ARECA 0x17d3 2045#define PCI_VENDOR_ID_ARECA 0x17d3
2042#define PCI_DEVICE_ID_ARECA_1110 0x1110 2046#define PCI_DEVICE_ID_ARECA_1110 0x1110
2043#define PCI_DEVICE_ID_ARECA_1120 0x1120 2047#define PCI_DEVICE_ID_ARECA_1120 0x1120
@@ -2209,6 +2213,7 @@
2209#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 2213#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
2210#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 2214#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
2211#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 2215#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
2216#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778
2212#define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0 2217#define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0
2213#define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2 2218#define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2
2214#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 2219#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index b72be2f79e6a..926adaae0f96 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_PERCPU_H 1#ifndef __LINUX_PERCPU_H
2#define __LINUX_PERCPU_H 2#define __LINUX_PERCPU_H
3 3
4#include <linux/spinlock.h> /* For preempt_disable() */ 4#include <linux/preempt.h>
5#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/string.h> /* For memset() */ 7#include <linux/string.h> /* For memset() */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index f5aa593ccf32..3d9f70972cdf 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/smp.h> 10#include <linux/smp.h>
11#include <linux/list.h>
11#include <linux/threads.h> 12#include <linux/threads.h>
12#include <linux/percpu.h> 13#include <linux/percpu.h>
13#include <linux/types.h> 14#include <linux/types.h>
@@ -17,6 +18,9 @@
17struct percpu_counter { 18struct percpu_counter {
18 spinlock_t lock; 19 spinlock_t lock;
19 s64 count; 20 s64 count;
21#ifdef CONFIG_HOTPLUG_CPU
22 struct list_head list; /* All percpu_counters are on a list */
23#endif
20 s32 *counters; 24 s32 *counters;
21}; 25};
22 26
@@ -26,18 +30,8 @@ struct percpu_counter {
26#define FBC_BATCH (NR_CPUS*4) 30#define FBC_BATCH (NR_CPUS*4)
27#endif 31#endif
28 32
29static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount) 33void percpu_counter_init(struct percpu_counter *fbc, s64 amount);
30{ 34void percpu_counter_destroy(struct percpu_counter *fbc);
31 spin_lock_init(&fbc->lock);
32 fbc->count = amount;
33 fbc->counters = alloc_percpu(s32);
34}
35
36static inline void percpu_counter_destroy(struct percpu_counter *fbc)
37{
38 free_percpu(fbc->counters);
39}
40
41void percpu_counter_mod(struct percpu_counter *fbc, s32 amount); 35void percpu_counter_mod(struct percpu_counter *fbc, s32 amount);
42s64 percpu_counter_sum(struct percpu_counter *fbc); 36s64 percpu_counter_sum(struct percpu_counter *fbc);
43 37
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 169c6c24209b..b9a17e08ff0f 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -29,7 +29,7 @@ static inline void get_pid_ns(struct pid_namespace *ns)
29 kref_get(&ns->kref); 29 kref_get(&ns->kref);
30} 30}
31 31
32extern struct pid_namespace *copy_pid_ns(int flags, struct pid_namespace *ns); 32extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
33extern void free_pid_ns(struct kref *kref); 33extern void free_pid_ns(struct kref *kref);
34 34
35static inline void put_pid_ns(struct pid_namespace *ns) 35static inline void put_pid_ns(struct pid_namespace *ns)
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 273781c82e4d..ad3cc2eb0d34 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -101,6 +101,7 @@ struct pm_dev
101 */ 101 */
102extern void (*pm_idle)(void); 102extern void (*pm_idle)(void);
103extern void (*pm_power_off)(void); 103extern void (*pm_power_off)(void);
104extern void (*pm_power_off_prepare)(void);
104 105
105typedef int __bitwise suspend_state_t; 106typedef int __bitwise suspend_state_t;
106 107
@@ -284,8 +285,6 @@ extern int device_prepare_suspend(pm_message_t state);
284#define device_may_wakeup(dev) \ 285#define device_may_wakeup(dev) \
285 (device_can_wakeup(dev) && (dev)->power.should_wakeup) 286 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
286 287
287extern int dpm_runtime_suspend(struct device *, pm_message_t);
288extern void dpm_runtime_resume(struct device *);
289extern void __suspend_report_result(const char *function, void *fn, int ret); 288extern void __suspend_report_result(const char *function, void *fn, int ret);
290 289
291#define suspend_report_result(fn, ret) \ 290#define suspend_report_result(fn, ret) \
@@ -317,15 +316,6 @@ static inline int device_suspend(pm_message_t state)
317#define device_set_wakeup_enable(dev,val) do{}while(0) 316#define device_set_wakeup_enable(dev,val) do{}while(0)
318#define device_may_wakeup(dev) (0) 317#define device_may_wakeup(dev) (0)
319 318
320static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
321{
322 return 0;
323}
324
325static inline void dpm_runtime_resume(struct device * dev)
326{
327}
328
329#define suspend_report_result(fn, ret) do { } while (0) 319#define suspend_report_result(fn, ret) do { } while (0)
330 320
331static inline int call_platform_enable_wakeup(struct device *dev, int is_on) 321static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 52a9be41250d..e2eff9079fe9 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -59,4 +59,8 @@
59# define PR_ENDIAN_LITTLE 1 /* True little endian mode */ 59# define PR_ENDIAN_LITTLE 1 /* True little endian mode */
60# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ 60# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */
61 61
62/* Get/set process seccomp mode */
63#define PR_GET_SECCOMP 21
64#define PR_SET_SECCOMP 22
65
62#endif /* _LINUX_PRCTL_H */ 66#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h
index fc86f274147f..1adfe668d031 100644
--- a/include/linux/prefetch.h
+++ b/include/linux/prefetch.h
@@ -27,7 +27,7 @@
27 27
28 prefetch(x) - prefetches the cacheline at "x" for read 28 prefetch(x) - prefetches the cacheline at "x" for read
29 prefetchw(x) - prefetches the cacheline at "x" for write 29 prefetchw(x) - prefetches the cacheline at "x" for write
30 spin_lock_prefetch(x) - prefectches the spinlock *x for taking 30 spin_lock_prefetch(x) - prefetches the spinlock *x for taking
31 31
32 there is also PREFETCH_STRIDE which is the architecure-prefered 32 there is also PREFETCH_STRIDE which is the architecure-prefered
33 "lookahead" size for prefetching streamed operations. 33 "lookahead" size for prefetching streamed operations.
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 3469f96bc8b2..28e3664fdf1b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -7,6 +7,8 @@
7#include <linux/magic.h> 7#include <linux/magic.h>
8#include <asm/atomic.h> 8#include <asm/atomic.h>
9 9
10struct completion;
11
10/* 12/*
11 * The proc filesystem constants/structures 13 * The proc filesystem constants/structures
12 */ 14 */
@@ -56,6 +58,14 @@ struct proc_dir_entry {
56 gid_t gid; 58 gid_t gid;
57 loff_t size; 59 loff_t size;
58 const struct inode_operations *proc_iops; 60 const struct inode_operations *proc_iops;
61 /*
62 * NULL ->proc_fops means "PDE is going away RSN" or
63 * "PDE is just created". In either case, e.g. ->read_proc won't be
64 * called because it's too late or too early, respectively.
65 *
66 * If you're allocating ->proc_fops dynamically, save a pointer
67 * somewhere.
68 */
59 const struct file_operations *proc_fops; 69 const struct file_operations *proc_fops;
60 get_info_t *get_info; 70 get_info_t *get_info;
61 struct module *owner; 71 struct module *owner;
@@ -66,6 +76,9 @@ struct proc_dir_entry {
66 atomic_t count; /* use count */ 76 atomic_t count; /* use count */
67 int deleted; /* delete flag */ 77 int deleted; /* delete flag */
68 void *set; 78 void *set;
79 int pde_users; /* number of callers into module in progress */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 struct completion *pde_unload_completion;
69}; 82};
70 83
71struct kcore_list { 84struct kcore_list {
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index eeb1976ef7bf..ae8146abd746 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -110,6 +110,8 @@ static inline void ptrace_unlink(struct task_struct *child)
110 __ptrace_unlink(child); 110 __ptrace_unlink(child);
111} 111}
112 112
113int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
114int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
113 115
114#ifndef force_successful_syscall_return 116#ifndef force_successful_syscall_return
115/* 117/*
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index dd5a05d03d4f..75e17a05540e 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -262,7 +262,7 @@ int bitmap_active(struct bitmap *bitmap);
262 262
263char *file_path(struct file *file, char *buf, int count); 263char *file_path(struct file *file, char *buf, int count);
264void bitmap_print_sb(struct bitmap *bitmap); 264void bitmap_print_sb(struct bitmap *bitmap);
265int bitmap_update_sb(struct bitmap *bitmap); 265void bitmap_update_sb(struct bitmap *bitmap);
266 266
267int bitmap_setallbits(struct bitmap *bitmap); 267int bitmap_setallbits(struct bitmap *bitmap);
268void bitmap_write_all(struct bitmap *bitmap); 268void bitmap_write_all(struct bitmap *bitmap);
@@ -278,8 +278,8 @@ int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int d
278void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); 278void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
279void bitmap_close_sync(struct bitmap *bitmap); 279void bitmap_close_sync(struct bitmap *bitmap);
280 280
281int bitmap_unplug(struct bitmap *bitmap); 281void bitmap_unplug(struct bitmap *bitmap);
282int bitmap_daemon_work(struct bitmap *bitmap); 282void bitmap_daemon_work(struct bitmap *bitmap);
283#endif 283#endif
284 284
285#endif 285#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index de72c49747c8..28ac632b42dd 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -51,7 +51,7 @@ struct mdk_rdev_s
51 51
52 sector_t size; /* Device size (in blocks) */ 52 sector_t size; /* Device size (in blocks) */
53 mddev_t *mddev; /* RAID array if running */ 53 mddev_t *mddev; /* RAID array if running */
54 unsigned long last_events; /* IO event timestamp */ 54 long last_events; /* IO event timestamp */
55 55
56 struct block_device *bdev; /* block device handle */ 56 struct block_device *bdev; /* block device handle */
57 57
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 1dd1c707311f..85ea63f462af 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -67,6 +67,11 @@ extern void kernel_power_off(void);
67 67
68void ctrl_alt_del(void); 68void ctrl_alt_del(void);
69 69
70#define POWEROFF_CMD_PATH_LEN 256
71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
72
73extern int orderly_poweroff(bool force);
74
70/* 75/*
71 * Emergency restart, callable from an interrupt handler. 76 * Emergency restart, callable from an interrupt handler.
72 */ 77 */
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index 81e9299ca148..f3f4f28c6960 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -2,6 +2,7 @@
2#define RESUME_TRACE_H 2#define RESUME_TRACE_H
3 3
4#ifdef CONFIG_PM_TRACE 4#ifdef CONFIG_PM_TRACE
5#include <asm/resume-trace.h>
5 6
6extern int pm_trace_enabled; 7extern int pm_trace_enabled;
7 8
@@ -9,20 +10,10 @@ struct device;
9extern void set_trace_device(struct device *); 10extern void set_trace_device(struct device *);
10extern void generate_resume_trace(void *tracedata, unsigned int user); 11extern void generate_resume_trace(void *tracedata, unsigned int user);
11 12
12#define TRACE_DEVICE(dev) set_trace_device(dev) 13#define TRACE_DEVICE(dev) do { \
13#define TRACE_RESUME(user) do { \ 14 if (pm_trace_enabled) \
14 if (pm_trace_enabled) { \ 15 set_trace_device(dev); \
15 void *tracedata; \ 16 } while(0)
16 asm volatile("movl $1f,%0\n" \
17 ".section .tracedata,\"a\"\n" \
18 "1:\t.word %c1\n" \
19 "\t.long %c2\n" \
20 ".previous" \
21 :"=r" (tracedata) \
22 : "i" (__LINE__), "i" (__FILE__)); \
23 generate_resume_trace(tracedata, user); \
24 } \
25} while (0)
26 17
27#else 18#else
28 19
diff --git a/include/linux/rtc/m48t59.h b/include/linux/rtc/m48t59.h
new file mode 100644
index 000000000000..e8c7c21ceb1f
--- /dev/null
+++ b/include/linux/rtc/m48t59.h
@@ -0,0 +1,57 @@
1/*
2 * include/linux/rtc/m48t59.h
3 *
4 * Definitions for the platform data of m48t59 RTC chip driver.
5 *
6 * Copyright (c) 2007 Wind River Systems, Inc.
7 *
8 * Mark Zhan <rongkai.zhan@windriver.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef _LINUX_RTC_M48T59_H_
16#define _LINUX_RTC_M48T59_H_
17
18/*
19 * M48T59 Register Offset
20 */
21#define M48T59_YEAR 0x1fff
22#define M48T59_MONTH 0x1ffe
23#define M48T59_MDAY 0x1ffd /* Day of Month */
24#define M48T59_WDAY 0x1ffc /* Day of Week */
25#define M48T59_WDAY_CB 0x20 /* Century Bit */
26#define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */
27#define M48T59_HOUR 0x1ffb
28#define M48T59_MIN 0x1ffa
29#define M48T59_SEC 0x1ff9
30#define M48T59_CNTL 0x1ff8
31#define M48T59_CNTL_READ 0x40
32#define M48T59_CNTL_WRITE 0x80
33#define M48T59_WATCHDOG 0x1ff7
34#define M48T59_INTR 0x1ff6
35#define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */
36#define M48T59_INTR_ABE 0x20
37#define M48T59_ALARM_DATE 0x1ff5
38#define M48T59_ALARM_HOUR 0x1ff4
39#define M48T59_ALARM_MIN 0x1ff3
40#define M48T59_ALARM_SEC 0x1ff2
41#define M48T59_UNUSED 0x1ff1
42#define M48T59_FLAGS 0x1ff0
43#define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */
44#define M48T59_FLAGS_AF 0x40 /* alarm */
45#define M48T59_FLAGS_BF 0x10 /* low battery */
46
47#define M48T59_NVRAM_SIZE 0x1ff0
48
49struct m48t59_plat_data {
50 /* The method to access M48T59 registers,
51 * NOTE: The 'ofs' should be 0x00~0x1fff
52 */
53 void (*write_byte)(struct device *dev, u32 ofs, u8 val);
54 unsigned char (*read_byte)(struct device *dev, u32 ofs);
55};
56
57#endif /* _LINUX_RTC_M48T59_H_ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cfb680585ab8..33b9b4841ee7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -26,6 +26,7 @@
26#define CLONE_STOPPED 0x02000000 /* Start in stopped state */ 26#define CLONE_STOPPED 0x02000000 /* Start in stopped state */
27#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ 27#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
28#define CLONE_NEWIPC 0x08000000 /* New ipcs */ 28#define CLONE_NEWIPC 0x08000000 /* New ipcs */
29#define CLONE_NEWUSER 0x10000000 /* New user namespace */
29 30
30/* 31/*
31 * Scheduling policies 32 * Scheduling policies
@@ -287,6 +288,7 @@ extern signed long schedule_timeout_uninterruptible(signed long timeout);
287asmlinkage void schedule(void); 288asmlinkage void schedule(void);
288 289
289struct nsproxy; 290struct nsproxy;
291struct user_namespace;
290 292
291/* Maximum number of active map areas.. This is a random (large) number */ 293/* Maximum number of active map areas.. This is a random (large) number */
292#define DEFAULT_MAX_MAP_COUNT 65536 294#define DEFAULT_MAX_MAP_COUNT 65536
@@ -343,6 +345,27 @@ typedef unsigned long mm_counter_t;
343 (mm)->hiwater_vm = (mm)->total_vm; \ 345 (mm)->hiwater_vm = (mm)->total_vm; \
344} while (0) 346} while (0)
345 347
348extern void set_dumpable(struct mm_struct *mm, int value);
349extern int get_dumpable(struct mm_struct *mm);
350
351/* mm flags */
352/* dumpable bits */
353#define MMF_DUMPABLE 0 /* core dump is permitted */
354#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
355#define MMF_DUMPABLE_BITS 2
356
357/* coredump filter bits */
358#define MMF_DUMP_ANON_PRIVATE 2
359#define MMF_DUMP_ANON_SHARED 3
360#define MMF_DUMP_MAPPED_PRIVATE 4
361#define MMF_DUMP_MAPPED_SHARED 5
362#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
363#define MMF_DUMP_FILTER_BITS 4
364#define MMF_DUMP_FILTER_MASK \
365 (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
366#define MMF_DUMP_FILTER_DEFAULT \
367 ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED))
368
346struct mm_struct { 369struct mm_struct {
347 struct vm_area_struct * mmap; /* list of VMAs */ 370 struct vm_area_struct * mmap; /* list of VMAs */
348 struct rb_root mm_rb; 371 struct rb_root mm_rb;
@@ -400,7 +423,7 @@ struct mm_struct {
400 unsigned int token_priority; 423 unsigned int token_priority;
401 unsigned int last_interval; 424 unsigned int last_interval;
402 425
403 unsigned char dumpable:2; 426 unsigned long flags; /* Must use atomic bitops to access the bits */
404 427
405 /* coredumping support */ 428 /* coredumping support */
406 int core_waiters; 429 int core_waiters;
@@ -529,6 +552,10 @@ struct signal_struct {
529#ifdef CONFIG_TASKSTATS 552#ifdef CONFIG_TASKSTATS
530 struct taskstats *stats; 553 struct taskstats *stats;
531#endif 554#endif
555#ifdef CONFIG_AUDIT
556 unsigned audit_tty;
557 struct tty_audit_buf *tty_audit_buf;
558#endif
532}; 559};
533 560
534/* Context switch must be unlocked if interrupts are to be enabled */ 561/* Context switch must be unlocked if interrupts are to be enabled */
@@ -972,7 +999,8 @@ struct task_struct {
972 unsigned int rt_priority; 999 unsigned int rt_priority;
973 cputime_t utime, stime; 1000 cputime_t utime, stime;
974 unsigned long nvcsw, nivcsw; /* context switch counts */ 1001 unsigned long nvcsw, nivcsw; /* context switch counts */
975 struct timespec start_time; 1002 struct timespec start_time; /* monotonic time */
1003 struct timespec real_start_time; /* boot based time */
976/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ 1004/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
977 unsigned long min_flt, maj_flt; 1005 unsigned long min_flt, maj_flt;
978 1006
@@ -1320,6 +1348,13 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1320#endif 1348#endif
1321 1349
1322extern unsigned long long sched_clock(void); 1350extern unsigned long long sched_clock(void);
1351
1352/*
1353 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
1354 * clock constructed from sched_clock():
1355 */
1356extern unsigned long long cpu_clock(int cpu);
1357
1323extern unsigned long long 1358extern unsigned long long
1324task_sched_runtime(struct task_struct *task); 1359task_sched_runtime(struct task_struct *task);
1325 1360
@@ -1403,7 +1438,7 @@ extern struct task_struct *find_task_by_pid_type(int type, int pid);
1403extern void __set_special_pids(pid_t session, pid_t pgrp); 1438extern void __set_special_pids(pid_t session, pid_t pgrp);
1404 1439
1405/* per-UID process charging. */ 1440/* per-UID process charging. */
1406extern struct user_struct * alloc_uid(uid_t); 1441extern struct user_struct * alloc_uid(struct user_namespace *, uid_t);
1407static inline struct user_struct *get_uid(struct user_struct *u) 1442static inline struct user_struct *get_uid(struct user_struct *u)
1408{ 1443{
1409 atomic_inc(&u->__count); 1444 atomic_inc(&u->__count);
diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h
index 1a82d30c4b17..d2b058130eb1 100644
--- a/include/linux/scx200_gpio.h
+++ b/include/linux/scx200_gpio.h
@@ -1,5 +1,3 @@
1#include <linux/spinlock.h>
2
3u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear); 1u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear);
4 2
5extern unsigned scx200_gpio_base; 3extern unsigned scx200_gpio_base;
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 3e8b1cf54303..262a8dccfa81 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -4,8 +4,6 @@
4 4
5#ifdef CONFIG_SECCOMP 5#ifdef CONFIG_SECCOMP
6 6
7#define NR_SECCOMP_MODES 1
8
9#include <linux/thread_info.h> 7#include <linux/thread_info.h>
10#include <asm/seccomp.h> 8#include <asm/seccomp.h>
11 9
@@ -18,20 +16,23 @@ static inline void secure_computing(int this_syscall)
18 __secure_computing(this_syscall); 16 __secure_computing(this_syscall);
19} 17}
20 18
21static inline int has_secure_computing(struct thread_info *ti) 19extern long prctl_get_seccomp(void);
22{ 20extern long prctl_set_seccomp(unsigned long);
23 return unlikely(test_ti_thread_flag(ti, TIF_SECCOMP));
24}
25 21
26#else /* CONFIG_SECCOMP */ 22#else /* CONFIG_SECCOMP */
27 23
28typedef struct { } seccomp_t; 24typedef struct { } seccomp_t;
29 25
30#define secure_computing(x) do { } while (0) 26#define secure_computing(x) do { } while (0)
31/* static inline to preserve typechecking */ 27
32static inline int has_secure_computing(struct thread_info *ti) 28static inline long prctl_get_seccomp(void)
29{
30 return -EINVAL;
31}
32
33static inline long prctl_set_seccomp(unsigned long arg2)
33{ 34{
34 return 0; 35 return -EINVAL;
35} 36}
36 37
37#endif /* CONFIG_SECCOMP */ 38#endif /* CONFIG_SECCOMP */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 33fc8cb8ddfb..deb714314fb1 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -177,11 +177,5 @@ struct serial_icounter_struct {
177#ifdef __KERNEL__ 177#ifdef __KERNEL__
178#include <linux/compiler.h> 178#include <linux/compiler.h>
179 179
180/* Allow architectures to override entries in serial8250_ports[] at run time: */
181struct uart_port; /* forward declaration */
182extern int early_serial_setup(struct uart_port *port);
183extern int early_serial_console_init(char *options);
184extern int serial8250_start_console(struct uart_port *port, char *options);
185
186#endif /* __KERNEL__ */ 180#endif /* __KERNEL__ */
187#endif /* _LINUX_SERIAL_H */ 181#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 71310d80c09a..8518fa2a6f89 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -60,4 +60,10 @@ void serial8250_unregister_port(int line);
60void serial8250_suspend_port(int line); 60void serial8250_suspend_port(int line);
61void serial8250_resume_port(int line); 61void serial8250_resume_port(int line);
62 62
63extern int early_serial_setup(struct uart_port *port);
64
65extern int serial8250_find_port(struct uart_port *p);
66extern int serial8250_find_port_for_earlycon(void);
67extern int setup_early_serial8250_console(char *cmdline);
68
63#endif 69#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 7f2c99d66e9d..773d8d8828ad 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -62,8 +62,9 @@
62/* NEC v850. */ 62/* NEC v850. */
63#define PORT_V850E_UART 40 63#define PORT_V850E_UART 40
64 64
65/* DZ */ 65/* DEC */
66#define PORT_DZ 47 66#define PORT_DZ 46
67#define PORT_ZS 47
67 68
68/* Parisc type numbers. */ 69/* Parisc type numbers. */
69#define PORT_MUX 48 70#define PORT_MUX 48
@@ -142,6 +143,9 @@
142/* Micrel KS8695 */ 143/* Micrel KS8695 */
143#define PORT_KS8695 76 144#define PORT_KS8695 76
144 145
146/* Broadcom SB1250, etc. SOC */
147#define PORT_SB1250_DUART 77
148
145 149
146#ifdef __KERNEL__ 150#ifdef __KERNEL__
147 151
diff --git a/include/linux/serio.h b/include/linux/serio.h
index d9377ce9ffd1..9f3825014674 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -210,5 +210,6 @@ static inline void serio_unpin_driver(struct serio *serio)
210#define SERIO_TOUCHRIGHT 0x32 210#define SERIO_TOUCHRIGHT 0x32
211#define SERIO_TOUCHWIN 0x33 211#define SERIO_TOUCHWIN 0x33
212#define SERIO_TAOSEVM 0x34 212#define SERIO_TAOSEVM 0x34
213#define SERIO_FUJITSU 0x35
213 214
214#endif 215#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 9a5eac508e5e..0ae338866240 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -6,7 +6,6 @@
6 6
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/spinlock.h>
10 9
11/* 10/*
12 * Real Time signals may be queued. 11 * Real Time signals may be queued.
@@ -238,12 +237,15 @@ extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct
238extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
239extern long do_sigpending(void __user *, unsigned long); 238extern long do_sigpending(void __user *, unsigned long);
240extern int sigprocmask(int, sigset_t *, sigset_t *); 239extern int sigprocmask(int, sigset_t *, sigset_t *);
240extern int show_unhandled_signals;
241 241
242struct pt_regs; 242struct pt_regs;
243extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 243extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
244 244
245extern struct kmem_cache *sighand_cachep; 245extern struct kmem_cache *sighand_cachep;
246 246
247int unhandled_signal(struct task_struct *tsk, int sig);
248
247/* 249/*
248 * In POSIX a signal is sent either to a specific thread (Linux task) 250 * In POSIX a signal is sent either to a specific thread (Linux task)
249 * or to the process as a whole (Linux thread group). How the signal 251 * or to the process as a whole (Linux thread group). How the signal
diff --git a/include/linux/slab.h b/include/linux/slab.h
index cebcd3833c76..d859354b9e51 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -14,8 +14,6 @@
14#include <linux/gfp.h> 14#include <linux/gfp.h>
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17typedef struct kmem_cache kmem_cache_t __deprecated;
18
19/* 17/*
20 * Flags to pass to kmem_cache_create(). 18 * Flags to pass to kmem_cache_create().
21 * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set. 19 * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set.
@@ -33,6 +31,19 @@ typedef struct kmem_cache kmem_cache_t __deprecated;
33#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ 31#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */
34 32
35/* 33/*
34 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
35 *
36 * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
37 *
38 * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
39 * Both make kfree a no-op.
40 */
41#define ZERO_SIZE_PTR ((void *)16)
42
43#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
44 (unsigned long)ZERO_SIZE_PTR)
45
46/*
36 * struct kmem_cache related prototypes 47 * struct kmem_cache related prototypes
37 */ 48 */
38void __init kmem_cache_init(void); 49void __init kmem_cache_init(void);
@@ -40,12 +51,9 @@ int slab_is_available(void);
40 51
41struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 52struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
42 unsigned long, 53 unsigned long,
43 void (*)(void *, struct kmem_cache *, unsigned long),
44 void (*)(void *, struct kmem_cache *, unsigned long)); 54 void (*)(void *, struct kmem_cache *, unsigned long));
45void kmem_cache_destroy(struct kmem_cache *); 55void kmem_cache_destroy(struct kmem_cache *);
46int kmem_cache_shrink(struct kmem_cache *); 56int kmem_cache_shrink(struct kmem_cache *);
47void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
48void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
49void kmem_cache_free(struct kmem_cache *, void *); 57void kmem_cache_free(struct kmem_cache *, void *);
50unsigned int kmem_cache_size(struct kmem_cache *); 58unsigned int kmem_cache_size(struct kmem_cache *);
51const char *kmem_cache_name(struct kmem_cache *); 59const char *kmem_cache_name(struct kmem_cache *);
@@ -61,17 +69,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
61 */ 69 */
62#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\ 70#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
63 sizeof(struct __struct), __alignof__(struct __struct),\ 71 sizeof(struct __struct), __alignof__(struct __struct),\
64 (__flags), NULL, NULL) 72 (__flags), NULL)
65
66#ifdef CONFIG_NUMA
67extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
68#else
69static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
70 gfp_t flags, int node)
71{
72 return kmem_cache_alloc(cachep, flags);
73}
74#endif
75 73
76/* 74/*
77 * The largest kmalloc size supported by the slab allocators is 75 * The largest kmalloc size supported by the slab allocators is
@@ -91,59 +89,50 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
91/* 89/*
92 * Common kmalloc functions provided by all allocators 90 * Common kmalloc functions provided by all allocators
93 */ 91 */
94void *__kmalloc(size_t, gfp_t);
95void *__kzalloc(size_t, gfp_t);
96void * __must_check krealloc(const void *, size_t, gfp_t); 92void * __must_check krealloc(const void *, size_t, gfp_t);
97void kfree(const void *); 93void kfree(const void *);
98size_t ksize(const void *); 94size_t ksize(const void *);
99 95
100/**
101 * kcalloc - allocate memory for an array. The memory is set to zero.
102 * @n: number of elements.
103 * @size: element size.
104 * @flags: the type of memory to allocate.
105 */
106static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
107{
108 if (n != 0 && size > ULONG_MAX / n)
109 return NULL;
110 return __kzalloc(n * size, flags);
111}
112
113/* 96/*
114 * Allocator specific definitions. These are mainly used to establish optimized 97 * Allocator specific definitions. These are mainly used to establish optimized
115 * ways to convert kmalloc() calls to kmem_cache_alloc() invocations by selecting 98 * ways to convert kmalloc() calls to kmem_cache_alloc() invocations by
116 * the appropriate general cache at compile time. 99 * selecting the appropriate general cache at compile time.
100 *
101 * Allocators must define at least:
102 *
103 * kmem_cache_alloc()
104 * __kmalloc()
105 * kmalloc()
106 *
107 * Those wishing to support NUMA must also define:
108 *
109 * kmem_cache_alloc_node()
110 * kmalloc_node()
111 *
112 * See each allocator definition file for additional comments and
113 * implementation notes.
117 */ 114 */
118
119#if defined(CONFIG_SLAB) || defined(CONFIG_SLUB)
120#ifdef CONFIG_SLUB 115#ifdef CONFIG_SLUB
121#include <linux/slub_def.h> 116#include <linux/slub_def.h>
117#elif defined(CONFIG_SLOB)
118#include <linux/slob_def.h>
122#else 119#else
123#include <linux/slab_def.h> 120#include <linux/slab_def.h>
124#endif /* !CONFIG_SLUB */ 121#endif
125#else
126
127/*
128 * Fallback definitions for an allocator not wanting to provide
129 * its own optimized kmalloc definitions (like SLOB).
130 */
131 122
132/** 123/**
133 * kmalloc - allocate memory 124 * kcalloc - allocate memory for an array. The memory is set to zero.
134 * @size: how many bytes of memory are required. 125 * @n: number of elements.
126 * @size: element size.
135 * @flags: the type of memory to allocate. 127 * @flags: the type of memory to allocate.
136 * 128 *
137 * kmalloc is the normal method of allocating memory
138 * in the kernel.
139 *
140 * The @flags argument may be one of: 129 * The @flags argument may be one of:
141 * 130 *
142 * %GFP_USER - Allocate memory on behalf of user. May sleep. 131 * %GFP_USER - Allocate memory on behalf of user. May sleep.
143 * 132 *
144 * %GFP_KERNEL - Allocate normal kernel ram. May sleep. 133 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
145 * 134 *
146 * %GFP_ATOMIC - Allocation will not sleep. 135 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
147 * For example, use this inside interrupt handlers. 136 * For example, use this inside interrupt handlers.
148 * 137 *
149 * %GFP_HIGHUSER - Allocate pages from high memory. 138 * %GFP_HIGHUSER - Allocate pages from high memory.
@@ -152,18 +141,22 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
152 * 141 *
153 * %GFP_NOFS - Do not make any fs calls while trying to get memory. 142 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
154 * 143 *
144 * %GFP_NOWAIT - Allocation will not sleep.
145 *
146 * %GFP_THISNODE - Allocate node-local memory only.
147 *
148 * %GFP_DMA - Allocation suitable for DMA.
149 * Should only be used for kmalloc() caches. Otherwise, use a
150 * slab created with SLAB_DMA.
151 *
155 * Also it is possible to set different flags by OR'ing 152 * Also it is possible to set different flags by OR'ing
156 * in one or more of the following additional @flags: 153 * in one or more of the following additional @flags:
157 * 154 *
158 * %__GFP_COLD - Request cache-cold pages instead of 155 * %__GFP_COLD - Request cache-cold pages instead of
159 * trying to return cache-warm pages. 156 * trying to return cache-warm pages.
160 * 157 *
161 * %__GFP_DMA - Request memory from the DMA-capable zone.
162 *
163 * %__GFP_HIGH - This allocation has high priority and may use emergency pools. 158 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
164 * 159 *
165 * %__GFP_HIGHMEM - Allocated memory may be from highmem.
166 *
167 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail 160 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
168 * (think twice before using). 161 * (think twice before using).
169 * 162 *
@@ -173,24 +166,29 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
173 * %__GFP_NOWARN - If allocation fails, don't issue any warnings. 166 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
174 * 167 *
175 * %__GFP_REPEAT - If allocation fails initially, try once more before failing. 168 * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
169 *
170 * There are other flags available as well, but these are not intended
171 * for general use, and so are not documented here. For a full list of
172 * potential flags, always refer to linux/gfp.h.
176 */ 173 */
177static inline void *kmalloc(size_t size, gfp_t flags) 174static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
178{ 175{
179 return __kmalloc(size, flags); 176 if (n != 0 && size > ULONG_MAX / n)
177 return NULL;
178 return __kmalloc(n * size, flags | __GFP_ZERO);
180} 179}
181 180
181#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
182/** 182/**
183 * kzalloc - allocate memory. The memory is set to zero. 183 * kmalloc_node - allocate memory from a specific node
184 * @size: how many bytes of memory are required. 184 * @size: how many bytes of memory are required.
185 * @flags: the type of memory to allocate (see kmalloc). 185 * @flags: the type of memory to allocate (see kcalloc).
186 * @node: node to allocate from.
187 *
188 * kmalloc() for non-local nodes, used to allocate from a specific node
189 * if available. Equivalent to kmalloc() in the non-NUMA single-node
190 * case.
186 */ 191 */
187static inline void *kzalloc(size_t size, gfp_t flags)
188{
189 return __kzalloc(size, flags);
190}
191#endif
192
193#ifndef CONFIG_NUMA
194static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 192static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
195{ 193{
196 return kmalloc(size, flags); 194 return kmalloc(size, flags);
@@ -200,7 +198,15 @@ static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
200{ 198{
201 return __kmalloc(size, flags); 199 return __kmalloc(size, flags);
202} 200}
203#endif /* !CONFIG_NUMA */ 201
202void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
203
204static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
205 gfp_t flags, int node)
206{
207 return kmem_cache_alloc(cachep, flags);
208}
209#endif /* !CONFIG_NUMA && !CONFIG_SLOB */
204 210
205/* 211/*
206 * kmalloc_track_caller is a special version of kmalloc that records the 212 * kmalloc_track_caller is a special version of kmalloc that records the
@@ -245,6 +251,23 @@ extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *);
245 251
246#endif /* DEBUG_SLAB */ 252#endif /* DEBUG_SLAB */
247 253
254/*
255 * Shortcuts
256 */
257static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags)
258{
259 return kmem_cache_alloc(k, flags | __GFP_ZERO);
260}
261
262/**
263 * kzalloc - allocate memory. The memory is set to zero.
264 * @size: how many bytes of memory are required.
265 * @flags: the type of memory to allocate (see kmalloc).
266 */
267static inline void *kzalloc(size_t size, gfp_t flags)
268{
269 return kmalloc(size, flags | __GFP_ZERO);
270}
271
248#endif /* __KERNEL__ */ 272#endif /* __KERNEL__ */
249#endif /* _LINUX_SLAB_H */ 273#endif /* _LINUX_SLAB_H */
250
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 8d81a60518e4..32bdc2ffd715 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -25,10 +25,17 @@ struct cache_sizes {
25}; 25};
26extern struct cache_sizes malloc_sizes[]; 26extern struct cache_sizes malloc_sizes[];
27 27
28void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
29void *__kmalloc(size_t size, gfp_t flags);
30
28static inline void *kmalloc(size_t size, gfp_t flags) 31static inline void *kmalloc(size_t size, gfp_t flags)
29{ 32{
30 if (__builtin_constant_p(size)) { 33 if (__builtin_constant_p(size)) {
31 int i = 0; 34 int i = 0;
35
36 if (!size)
37 return ZERO_SIZE_PTR;
38
32#define CACHE(x) \ 39#define CACHE(x) \
33 if (size <= x) \ 40 if (size <= x) \
34 goto found; \ 41 goto found; \
@@ -51,39 +58,18 @@ found:
51 return __kmalloc(size, flags); 58 return __kmalloc(size, flags);
52} 59}
53 60
54static inline void *kzalloc(size_t size, gfp_t flags)
55{
56 if (__builtin_constant_p(size)) {
57 int i = 0;
58#define CACHE(x) \
59 if (size <= x) \
60 goto found; \
61 else \
62 i++;
63#include "kmalloc_sizes.h"
64#undef CACHE
65 {
66 extern void __you_cannot_kzalloc_that_much(void);
67 __you_cannot_kzalloc_that_much();
68 }
69found:
70#ifdef CONFIG_ZONE_DMA
71 if (flags & GFP_DMA)
72 return kmem_cache_zalloc(malloc_sizes[i].cs_dmacachep,
73 flags);
74#endif
75 return kmem_cache_zalloc(malloc_sizes[i].cs_cachep, flags);
76 }
77 return __kzalloc(size, flags);
78}
79
80#ifdef CONFIG_NUMA 61#ifdef CONFIG_NUMA
81extern void *__kmalloc_node(size_t size, gfp_t flags, int node); 62extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
63extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
82 64
83static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 65static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
84{ 66{
85 if (__builtin_constant_p(size)) { 67 if (__builtin_constant_p(size)) {
86 int i = 0; 68 int i = 0;
69
70 if (!size)
71 return ZERO_SIZE_PTR;
72
87#define CACHE(x) \ 73#define CACHE(x) \
88 if (size <= x) \ 74 if (size <= x) \
89 goto found; \ 75 goto found; \
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
new file mode 100644
index 000000000000..59a3fa476ab9
--- /dev/null
+++ b/include/linux/slob_def.h
@@ -0,0 +1,36 @@
1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H
3
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5
6static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
7{
8 return kmem_cache_alloc_node(cachep, flags, -1);
9}
10
11void *__kmalloc_node(size_t size, gfp_t flags, int node);
12
13static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
14{
15 return __kmalloc_node(size, flags, node);
16}
17
18/**
19 * kmalloc - allocate memory
20 * @size: how many bytes of memory are required.
21 * @flags: the type of memory to allocate (see kcalloc).
22 *
23 * kmalloc is the normal method of allocating memory
24 * in the kernel.
25 */
26static inline void *kmalloc(size_t size, gfp_t flags)
27{
28 return __kmalloc_node(size, flags, -1);
29}
30
31static inline void *__kmalloc(size_t size, gfp_t flags)
32{
33 return kmalloc(size, flags);
34}
35
36#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 6207a3d8da71..124270df8734 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -16,7 +16,9 @@ struct kmem_cache_node {
16 unsigned long nr_partial; 16 unsigned long nr_partial;
17 atomic_long_t nr_slabs; 17 atomic_long_t nr_slabs;
18 struct list_head partial; 18 struct list_head partial;
19#ifdef CONFIG_SLUB_DEBUG
19 struct list_head full; 20 struct list_head full;
21#endif
20}; 22};
21 23
22/* 24/*
@@ -44,7 +46,9 @@ struct kmem_cache {
44 int align; /* Alignment */ 46 int align; /* Alignment */
45 const char *name; /* Name (only for display!) */ 47 const char *name; /* Name (only for display!) */
46 struct list_head list; /* List of slab caches */ 48 struct list_head list; /* List of slab caches */
49#ifdef CONFIG_SLUB_DEBUG
47 struct kobject kobj; /* For sysfs */ 50 struct kobject kobj; /* For sysfs */
51#endif
48 52
49#ifdef CONFIG_NUMA 53#ifdef CONFIG_NUMA
50 int defrag_ratio; 54 int defrag_ratio;
@@ -156,20 +160,11 @@ static inline struct kmem_cache *kmalloc_slab(size_t size)
156#define SLUB_DMA __GFP_DMA 160#define SLUB_DMA __GFP_DMA
157#else 161#else
158/* Disable DMA functionality */ 162/* Disable DMA functionality */
159#define SLUB_DMA 0 163#define SLUB_DMA (__force gfp_t)0
160#endif 164#endif
161 165
162 166void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
163/* 167void *__kmalloc(size_t size, gfp_t flags);
164 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
165 *
166 * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
167 *
168 * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
169 * Both make kfree a no-op.
170 */
171#define ZERO_SIZE_PTR ((void *)16)
172
173 168
174static inline void *kmalloc(size_t size, gfp_t flags) 169static inline void *kmalloc(size_t size, gfp_t flags)
175{ 170{
@@ -184,21 +179,9 @@ static inline void *kmalloc(size_t size, gfp_t flags)
184 return __kmalloc(size, flags); 179 return __kmalloc(size, flags);
185} 180}
186 181
187static inline void *kzalloc(size_t size, gfp_t flags)
188{
189 if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) {
190 struct kmem_cache *s = kmalloc_slab(size);
191
192 if (!s)
193 return ZERO_SIZE_PTR;
194
195 return kmem_cache_zalloc(s, flags);
196 } else
197 return __kzalloc(size, flags);
198}
199
200#ifdef CONFIG_NUMA 182#ifdef CONFIG_NUMA
201extern void *__kmalloc_node(size_t size, gfp_t flags, int node); 183void *__kmalloc_node(size_t size, gfp_t flags, int node);
184void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
202 185
203static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 186static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
204{ 187{
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 96ac21f8dd73..259a13c3bd98 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -99,11 +99,14 @@ static inline int up_smp_call_function(void)
99static inline void smp_send_reschedule(int cpu) { } 99static inline void smp_send_reschedule(int cpu) { }
100#define num_booting_cpus() 1 100#define num_booting_cpus() 1
101#define smp_prepare_boot_cpu() do {} while (0) 101#define smp_prepare_boot_cpu() do {} while (0)
102static inline int smp_call_function_single(int cpuid, void (*func) (void *info), 102#define smp_call_function_single(cpuid, func, info, retry, wait) \
103 void *info, int retry, int wait) 103({ \
104{ 104 WARN_ON(cpuid != 0); \
105 return -EBUSY; 105 local_irq_disable(); \
106} 106 (func)(info); \
107 local_irq_enable(); \
108 0; \
109})
107 110
108#endif /* !SMP */ 111#endif /* !SMP */
109 112
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index cf715a40d833..58962c51dee1 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -3,7 +3,6 @@
3 3
4#ifdef CONFIG_LOCK_KERNEL 4#ifdef CONFIG_LOCK_KERNEL
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/spinlock.h>
7 6
8#define kernel_locked() (current->lock_depth >= 0) 7#define kernel_locked() (current->lock_depth >= 0)
9 8
diff --git a/include/linux/socket.h b/include/linux/socket.h
index fe195c97a89d..f852e1afd65a 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -253,6 +253,9 @@ struct ucred {
253 253
254#define MSG_EOF MSG_FIN 254#define MSG_EOF MSG_FIN
255 255
256#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file
257 descriptor received through
258 SCM_RIGHTS */
256#if defined(CONFIG_COMPAT) 259#if defined(CONFIG_COMPAT)
257#define MSG_CMSG_COMPAT 0x80000000 /* This message needs 32 bit fixups */ 260#define MSG_CMSG_COMPAT 0x80000000 /* This message needs 32 bit fixups */
258#else 261#else
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 34d4b075f7b8..40c7b5d993b9 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -153,8 +153,6 @@
153#define SONYPI_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */ 153#define SONYPI_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */
154#define SONYPI_COMMAND_GETCAMERAREVISION 19 /* obsolete */ 154#define SONYPI_COMMAND_GETCAMERAREVISION 19 /* obsolete */
155 155
156int sonypi_camera_command(int command, u8 value);
157
158#endif /* __KERNEL__ */ 156#endif /* __KERNEL__ */
159 157
160#endif /* _SONYPI_H_ */ 158#endif /* _SONYPI_H_ */
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 3387e44dfd13..334d31411629 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -16,6 +16,20 @@ struct ads7846_platform_data {
16 u16 vref_delay_usecs; /* 0 for external vref; etc */ 16 u16 vref_delay_usecs; /* 0 for external vref; etc */
17 int keep_vref_on:1; /* set to keep vref on for differential 17 int keep_vref_on:1; /* set to keep vref on for differential
18 * measurements as well */ 18 * measurements as well */
19
20 /* Settling time of the analog signals; a function of Vcc and the
21 * capacitance on the X/Y drivers. If set to non-zero, two samples
22 * are taken with settle_delay us apart, and the second one is used.
23 * ~150 uSec with 0.01uF caps.
24 */
25 u16 settle_delay_usecs;
26
27 /* If set to non-zero, after samples are taken this delay is applied
28 * and penirq is rechecked, to help avoid false events. This value
29 * is affected by the material used to build the touch layer.
30 */
31 u16 penirq_recheck_delay_usecs;
32
19 u16 x_plate_ohms; 33 u16 x_plate_ohms;
20 u16 y_plate_ohms; 34 u16 y_plate_ohms;
21 35
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 1be5ea059477..302b81d1d117 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -76,6 +76,7 @@ struct spi_device {
76#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) 76#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
77#define SPI_CS_HIGH 0x04 /* chipselect active high? */ 77#define SPI_CS_HIGH 0x04 /* chipselect active high? */
78#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ 78#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
79#define SPI_3WIRE 0x10 /* SI/SO signals shared */
79 u8 bits_per_word; 80 u8 bits_per_word;
80 int irq; 81 int irq;
81 void *controller_state; 82 void *controller_state;
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 9dbca629dcfb..b8db32cea1de 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -26,6 +26,7 @@ struct spi_bitbang {
26 struct list_head queue; 26 struct list_head queue;
27 u8 busy; 27 u8 busy;
28 u8 use_dma; 28 u8 use_dma;
29 u8 flags; /* extra spi->mode support */
29 30
30 struct spi_master *master; 31 struct spi_master *master;
31 32
diff --git a/include/linux/spi/tle62x0.h b/include/linux/spi/tle62x0.h
new file mode 100644
index 000000000000..60b59187e590
--- /dev/null
+++ b/include/linux/spi/tle62x0.h
@@ -0,0 +1,24 @@
1/*
2 * tle62x0.h - platform glue to Infineon TLE62x0 driver chips
3 *
4 * Copyright 2007 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * 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
21struct tle62x0_pdata {
22 unsigned int init_state;
23 unsigned int gpio_count;
24};
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index a946176db638..c376f3b36c89 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -282,6 +282,13 @@ do { \
282 1 : ({ local_irq_restore(flags); 0; }); \ 282 1 : ({ local_irq_restore(flags); 0; }); \
283}) 283})
284 284
285#define write_trylock_irqsave(lock, flags) \
286({ \
287 local_irq_save(flags); \
288 write_trylock(lock) ? \
289 1 : ({ local_irq_restore(flags); 0; }); \
290})
291
285/* 292/*
286 * Locks two spinlocks l1 and l2. 293 * Locks two spinlocks l1 and l2.
287 * l1_first indicates if spinlock l1 should be taken first. 294 * l1_first indicates if spinlock l1 should be taken first.
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 210549ba4ef4..f6a3a951b79e 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -9,14 +9,14 @@
9 * Released under the General Public License (GPL). 9 * Released under the General Public License (GPL).
10 */ 10 */
11 11
12#include <linux/lockdep.h>
13
14#if defined(CONFIG_SMP) 12#if defined(CONFIG_SMP)
15# include <asm/spinlock_types.h> 13# include <asm/spinlock_types.h>
16#else 14#else
17# include <linux/spinlock_types_up.h> 15# include <linux/spinlock_types_up.h>
18#endif 16#endif
19 17
18#include <linux/lockdep.h>
19
20typedef struct { 20typedef struct {
21 raw_spinlock_t raw_lock; 21 raw_spinlock_t raw_lock;
22#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) 22#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index 27644af20b7c..04135b0e198e 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -12,14 +12,10 @@
12 * Released under the General Public License (GPL). 12 * Released under the General Public License (GPL).
13 */ 13 */
14 14
15#if defined(CONFIG_DEBUG_SPINLOCK) || \ 15#ifdef CONFIG_DEBUG_SPINLOCK
16 defined(CONFIG_DEBUG_LOCK_ALLOC)
17 16
18typedef struct { 17typedef struct {
19 volatile unsigned int slock; 18 volatile unsigned int slock;
20#ifdef CONFIG_DEBUG_LOCK_ALLOC
21 struct lockdep_map dep_map;
22#endif
23} raw_spinlock_t; 19} raw_spinlock_t;
24 20
25#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 21#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
@@ -34,9 +30,6 @@ typedef struct { } raw_spinlock_t;
34 30
35typedef struct { 31typedef struct {
36 /* no debug version on UP */ 32 /* no debug version on UP */
37#ifdef CONFIG_DEBUG_LOCK_ALLOC
38 struct lockdep_map dep_map;
39#endif
40} raw_rwlock_t; 33} raw_rwlock_t;
41 34
42#define __RAW_RW_LOCK_UNLOCKED { } 35#define __RAW_RW_LOCK_UNLOCKED { }
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 1d2b084c0185..e7fa657d0c49 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -13,7 +13,7 @@ extern void save_stack_trace(struct stack_trace *trace);
13extern void print_stack_trace(struct stack_trace *trace, int spaces); 13extern void print_stack_trace(struct stack_trace *trace, int spaces);
14#else 14#else
15# define save_stack_trace(trace) do { } while (0) 15# define save_stack_trace(trace) do { } while (0)
16# define print_stack_trace(trace) do { } while (0) 16# define print_stack_trace(trace, spaces) do { } while (0)
17#endif 17#endif
18 18
19#endif 19#endif
diff --git a/include/linux/string.h b/include/linux/string.h
index 7f2eb6a477f9..836062b7582a 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -105,8 +105,12 @@ extern void * memchr(const void *,int,__kernel_size_t);
105#endif 105#endif
106 106
107extern char *kstrdup(const char *s, gfp_t gfp); 107extern char *kstrdup(const char *s, gfp_t gfp);
108extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
108extern void *kmemdup(const void *src, size_t len, gfp_t gfp); 109extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
109 110
111extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
112extern void argv_free(char **argv);
113
110#ifdef __cplusplus 114#ifdef __cplusplus
111} 115}
112#endif 116#endif
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index bbac101ac372..459c5fc11d51 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -58,6 +58,7 @@ u32 gss_unwrap(
58u32 gss_delete_sec_context( 58u32 gss_delete_sec_context(
59 struct gss_ctx **ctx_id); 59 struct gss_ctx **ctx_id);
60 60
61u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service);
61u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor); 62u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
62char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service); 63char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
63 64
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 129d50f2225c..8531a70da73d 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -212,6 +212,7 @@ struct svc_rqst {
212 struct svc_pool * rq_pool; /* thread pool */ 212 struct svc_pool * rq_pool; /* thread pool */
213 struct svc_procedure * rq_procinfo; /* procedure info */ 213 struct svc_procedure * rq_procinfo; /* procedure info */
214 struct auth_ops * rq_authop; /* authentication flavour */ 214 struct auth_ops * rq_authop; /* authentication flavour */
215 u32 rq_flavor; /* pseudoflavor */
215 struct svc_cred rq_cred; /* auth info */ 216 struct svc_cred rq_cred; /* auth info */
216 struct sk_buff * rq_skbuff; /* fast recv inet buffer */ 217 struct sk_buff * rq_skbuff; /* fast recv inet buffer */
217 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 218 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
@@ -248,6 +249,7 @@ struct svc_rqst {
248 */ 249 */
249 /* Catering to nfsd */ 250 /* Catering to nfsd */
250 struct auth_domain * rq_client; /* RPC peer info */ 251 struct auth_domain * rq_client; /* RPC peer info */
252 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
251 struct svc_cacherep * rq_cacherep; /* cache info */ 253 struct svc_cacherep * rq_cacherep; /* cache info */
252 struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to 254 struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to
253 * determine what device number 255 * determine what device number
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index de92619b0826..22e1ef8e200e 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -127,6 +127,7 @@ extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
127extern int auth_unix_forget_old(struct auth_domain *dom); 127extern int auth_unix_forget_old(struct auth_domain *dom);
128extern void svcauth_unix_purge(void); 128extern void svcauth_unix_purge(void);
129extern void svcauth_unix_info_release(void *); 129extern void svcauth_unix_info_release(void *);
130extern int svcauth_unix_set_client(struct svc_rqst *rqstp);
130 131
131static inline unsigned long hash_str(char *name, int bits) 132static inline unsigned long hash_str(char *name, int bits)
132{ 133{
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index 5a5db16ab660..417a1def56db 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -22,6 +22,7 @@
22int gss_svc_init(void); 22int gss_svc_init(void);
23void gss_svc_shutdown(void); 23void gss_svc_shutdown(void);
24int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); 24int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
25u32 svcauth_gss_flavor(struct auth_domain *dom);
25 26
26#endif /* __KERNEL__ */ 27#endif /* __KERNEL__ */
27#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ 28#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 9e340fa23c06..c6b53d181bfa 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -12,6 +12,7 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <linux/smp_lock.h>
15 16
16/* 17/*
17 * Buffer adjustment 18 * Buffer adjustment
@@ -36,6 +37,21 @@ struct xdr_netobj {
36typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); 37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
37 38
38/* 39/*
40 * We're still requiring the BKL in the xdr code until it's been
41 * more carefully audited, at which point this wrapper will become
42 * unnecessary.
43 */
44static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
45{
46 int ret;
47
48 lock_kernel();
49 ret = xdrproc(rqstp, data, obj);
50 unlock_kernel();
51 return ret;
52}
53
54/*
39 * Basic structure for transmission/reception of a client XDR message. 55 * Basic structure for transmission/reception of a client XDR message.
40 * Features a header (for a linear buffer containing RPC headers 56 * Features a header (for a linear buffer containing RPC headers
41 * and the data payload for short messages), and then an array of 57 * and the data payload for short messages), and then an array of
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 9c7cb6430666..e8e6da394c92 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -43,14 +43,19 @@ static inline void pm_restore_console(void) {}
43 * @prepare: prepare system for hibernation 43 * @prepare: prepare system for hibernation
44 * @enter: shut down system after state has been saved to disk 44 * @enter: shut down system after state has been saved to disk
45 * @finish: finish/clean up after state has been reloaded 45 * @finish: finish/clean up after state has been reloaded
46 * @pre_restore: prepare system for the restoration from a hibernation image
47 * @restore_cleanup: clean up after a failing image restoration
46 */ 48 */
47struct hibernation_ops { 49struct hibernation_ops {
48 int (*prepare)(void); 50 int (*prepare)(void);
49 int (*enter)(void); 51 int (*enter)(void);
50 void (*finish)(void); 52 void (*finish)(void);
53 int (*pre_restore)(void);
54 void (*restore_cleanup)(void);
51}; 55};
52 56
53#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) 57#ifdef CONFIG_PM
58#ifdef CONFIG_SOFTWARE_SUSPEND
54/* kernel/power/snapshot.c */ 59/* kernel/power/snapshot.c */
55extern void __register_nosave_region(unsigned long b, unsigned long e, int km); 60extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
56static inline void register_nosave_region(unsigned long b, unsigned long e) 61static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -68,16 +73,14 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
68 73
69extern void hibernation_set_ops(struct hibernation_ops *ops); 74extern void hibernation_set_ops(struct hibernation_ops *ops);
70extern int hibernate(void); 75extern int hibernate(void);
71#else 76#else /* CONFIG_SOFTWARE_SUSPEND */
72static inline void register_nosave_region(unsigned long b, unsigned long e) {}
73static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
74static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 77static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
75static inline void swsusp_set_page_free(struct page *p) {} 78static inline void swsusp_set_page_free(struct page *p) {}
76static inline void swsusp_unset_page_free(struct page *p) {} 79static inline void swsusp_unset_page_free(struct page *p) {}
77 80
78static inline void hibernation_set_ops(struct hibernation_ops *ops) {} 81static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
79static inline int hibernate(void) { return -ENOSYS; } 82static inline int hibernate(void) { return -ENOSYS; }
80#endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */ 83#endif /* CONFIG_SOFTWARE_SUSPEND */
81 84
82void save_processor_state(void); 85void save_processor_state(void);
83void restore_processor_state(void); 86void restore_processor_state(void);
@@ -85,4 +88,43 @@ struct saved_context;
85void __save_processor_state(struct saved_context *ctxt); 88void __save_processor_state(struct saved_context *ctxt);
86void __restore_processor_state(struct saved_context *ctxt); 89void __restore_processor_state(struct saved_context *ctxt);
87 90
91/* kernel/power/main.c */
92extern struct blocking_notifier_head pm_chain_head;
93
94static inline int register_pm_notifier(struct notifier_block *nb)
95{
96 return blocking_notifier_chain_register(&pm_chain_head, nb);
97}
98
99static inline int unregister_pm_notifier(struct notifier_block *nb)
100{
101 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
102}
103
104#define pm_notifier(fn, pri) { \
105 static struct notifier_block fn##_nb = \
106 { .notifier_call = fn, .priority = pri }; \
107 register_pm_notifier(&fn##_nb); \
108}
109#else /* CONFIG_PM */
110
111static inline int register_pm_notifier(struct notifier_block *nb)
112{
113 return 0;
114}
115
116static inline int unregister_pm_notifier(struct notifier_block *nb)
117{
118 return 0;
119}
120
121#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
122#endif /* CONFIG_PM */
123
124#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
125static inline void register_nosave_region(unsigned long b, unsigned long e)
126{
127}
128#endif
129
88#endif /* _LINUX_SWSUSP_H */ 130#endif /* _LINUX_SWSUSP_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 006868881346..665f85f2a3af 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -188,7 +188,8 @@ extern int rotate_reclaimable_page(struct page *page);
188extern void swap_setup(void); 188extern void swap_setup(void);
189 189
190/* linux/mm/vmscan.c */ 190/* linux/mm/vmscan.c */
191extern unsigned long try_to_free_pages(struct zone **, gfp_t); 191extern unsigned long try_to_free_pages(struct zone **zones, int order,
192 gfp_t gfp_mask);
192extern unsigned long shrink_all_memory(unsigned long nr_pages); 193extern unsigned long shrink_all_memory(unsigned long nr_pages);
193extern int vm_swappiness; 194extern int vm_swappiness;
194extern int remove_mapping(struct address_space *mapping, struct page *page); 195extern int remove_mapping(struct address_space *mapping, struct page *page);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 83d0ec11235e..61def7c8fbb3 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -549,7 +549,7 @@ asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
549asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 549asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
550 __u32 __user *ustatus); 550 __u32 __user *ustatus);
551asmlinkage long sys_spu_create(const char __user *name, 551asmlinkage long sys_spu_create(const char __user *name,
552 unsigned int flags, mode_t mode); 552 unsigned int flags, mode_t mode, int fd);
553 553
554asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode, 554asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode,
555 unsigned dev); 555 unsigned dev);
@@ -610,6 +610,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas
610asmlinkage long sys_timerfd(int ufd, int clockid, int flags, 610asmlinkage long sys_timerfd(int ufd, int clockid, int flags,
611 const struct itimerspec __user *utmr); 611 const struct itimerspec __user *utmr);
612asmlinkage long sys_eventfd(unsigned int count); 612asmlinkage long sys_eventfd(unsigned int count);
613asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
613 614
614int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 615int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
615 616
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index a46104a28f66..dce1ed204972 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 4 34#define TASKSTATS_VERSION 5
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
@@ -149,6 +149,9 @@ struct taskstats {
149 __u64 read_bytes; /* bytes of read I/O */ 149 __u64 read_bytes; /* bytes of read I/O */
150 __u64 write_bytes; /* bytes of write I/O */ 150 __u64 write_bytes; /* bytes of write I/O */
151 __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */ 151 __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */
152
153 __u64 nvcsw; /* voluntary_ctxt_switches */
154 __u64 nivcsw; /* nonvoluntary_ctxt_switches */
152}; 155};
153 156
154 157
diff --git a/include/linux/time.h b/include/linux/time.h
index dda9be685ab6..e6aea5146e5d 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7# include <linux/cache.h>
7# include <linux/seqlock.h> 8# include <linux/seqlock.h>
8#endif 9#endif
9 10
@@ -36,7 +37,8 @@ struct timezone {
36#define NSEC_PER_SEC 1000000000L 37#define NSEC_PER_SEC 1000000000L
37#define FSEC_PER_SEC 1000000000000000L 38#define FSEC_PER_SEC 1000000000000000L
38 39
39static inline int timespec_equal(struct timespec *a, struct timespec *b) 40static inline int timespec_equal(const struct timespec *a,
41 const struct timespec *b)
40{ 42{
41 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 43 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
42} 44}
@@ -93,6 +95,8 @@ extern struct timespec wall_to_monotonic;
93extern seqlock_t xtime_lock __attribute__((weak)); 95extern seqlock_t xtime_lock __attribute__((weak));
94 96
95extern unsigned long read_persistent_clock(void); 97extern unsigned long read_persistent_clock(void);
98extern int update_persistent_clock(struct timespec now);
99extern int no_sync_cmos_clock __read_mostly;
96void timekeeping_init(void); 100void timekeeping_init(void);
97 101
98static inline unsigned long get_seconds(void) 102static inline unsigned long get_seconds(void)
@@ -116,6 +120,8 @@ extern int do_setitimer(int which, struct itimerval *value,
116extern unsigned int alarm_setitimer(unsigned int seconds); 120extern unsigned int alarm_setitimer(unsigned int seconds);
117extern int do_getitimer(int which, struct itimerval *value); 121extern int do_getitimer(int which, struct itimerval *value);
118extern void getnstimeofday(struct timespec *tv); 122extern void getnstimeofday(struct timespec *tv);
123extern void getboottime(struct timespec *ts);
124extern void monotonic_to_bootbased(struct timespec *ts);
119 125
120extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 126extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
121extern int timekeeping_is_continuous(void); 127extern int timekeeping_is_continuous(void);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index c661710d3627..78cf899b4409 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/spinlock.h>
7#include <linux/stddef.h> 6#include <linux/stddef.h>
8 7
9struct tvec_t_base_s; 8struct tvec_t_base_s;
@@ -91,16 +90,13 @@ extern unsigned long get_next_timer_interrupt(unsigned long now);
91 */ 90 */
92#ifdef CONFIG_TIMER_STATS 91#ifdef CONFIG_TIMER_STATS
93 92
93#define TIMER_STATS_FLAG_DEFERRABLE 0x1
94
94extern void init_timer_stats(void); 95extern void init_timer_stats(void);
95 96
96extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, 97extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
97 void *timerf, char * comm); 98 void *timerf, char *comm,
98 99 unsigned int timer_flag);
99static inline void timer_stats_account_timer(struct timer_list *timer)
100{
101 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
102 timer->function, timer->start_comm);
103}
104 100
105extern void __timer_stats_timer_set_start_info(struct timer_list *timer, 101extern void __timer_stats_timer_set_start_info(struct timer_list *timer,
106 void *addr); 102 void *addr);
@@ -119,10 +115,6 @@ static inline void init_timer_stats(void)
119{ 115{
120} 116}
121 117
122static inline void timer_stats_account_timer(struct timer_list *timer)
123{
124}
125
126static inline void timer_stats_timer_set_start_info(struct timer_list *timer) 118static inline void timer_stats_timer_set_start_info(struct timer_list *timer)
127{ 119{
128} 120}
diff --git a/include/linux/timex.h b/include/linux/timex.h
index da929dbbea2a..37ac3ff90faf 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -224,66 +224,6 @@ static inline int ntp_synced(void)
224 __x < 0 ? -(-__x >> __s) : __x >> __s; \ 224 __x < 0 ? -(-__x >> __s) : __x >> __s; \
225}) 225})
226 226
227
228#ifdef CONFIG_TIME_INTERPOLATION
229
230#define TIME_SOURCE_CPU 0
231#define TIME_SOURCE_MMIO64 1
232#define TIME_SOURCE_MMIO32 2
233#define TIME_SOURCE_FUNCTION 3
234
235/* For proper operations time_interpolator clocks must run slightly slower
236 * than the standard clock since the interpolator may only correct by having
237 * time jump forward during a tick. A slower clock is usually a side effect
238 * of the integer divide of the nanoseconds in a second by the frequency.
239 * The accuracy of the division can be increased by specifying a shift.
240 * However, this may cause the clock not to be slow enough.
241 * The interpolator will self-tune the clock by slowing down if no
242 * resets occur or speeding up if the time jumps per analysis cycle
243 * become too high.
244 *
245 * Setting jitter compensates for a fluctuating timesource by comparing
246 * to the last value read from the timesource to insure that an earlier value
247 * is not returned by a later call. The price to pay
248 * for the compensation is that the timer routines are not as scalable anymore.
249 */
250
251struct time_interpolator {
252 u16 source; /* time source flags */
253 u8 shift; /* increases accuracy of multiply by shifting. */
254 /* Note that bits may be lost if shift is set too high */
255 u8 jitter; /* if set compensate for fluctuations */
256 u32 nsec_per_cyc; /* set by register_time_interpolator() */
257 void *addr; /* address of counter or function */
258 cycles_t mask; /* mask the valid bits of the counter */
259 unsigned long offset; /* nsec offset at last update of interpolator */
260 u64 last_counter; /* counter value in units of the counter at last update */
261 cycles_t last_cycle; /* Last timer value if TIME_SOURCE_JITTER is set */
262 u64 frequency; /* frequency in counts/second */
263 long drift; /* drift in parts-per-million (or -1) */
264 unsigned long skips; /* skips forward */
265 unsigned long ns_skipped; /* nanoseconds skipped */
266 struct time_interpolator *next;
267};
268
269extern void register_time_interpolator(struct time_interpolator *);
270extern void unregister_time_interpolator(struct time_interpolator *);
271extern void time_interpolator_reset(void);
272extern unsigned long time_interpolator_get_offset(void);
273extern void time_interpolator_update(long delta_nsec);
274
275#else /* !CONFIG_TIME_INTERPOLATION */
276
277static inline void time_interpolator_reset(void)
278{
279}
280
281static inline void time_interpolator_update(long delta_nsec)
282{
283}
284
285#endif /* !CONFIG_TIME_INTERPOLATION */
286
287#define TICK_LENGTH_SHIFT 32 227#define TICK_LENGTH_SHIFT 32
288 228
289#ifdef CONFIG_NO_HZ 229#ifdef CONFIG_NO_HZ
diff --git a/include/linux/tty.h b/include/linux/tty.h
index bb4576085203..691a1748d9d2 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -178,6 +178,7 @@ struct tty_bufhead {
178#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) 178#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN)
179 179
180struct device; 180struct device;
181struct signal_struct;
181/* 182/*
182 * Where all of the state associated with a tty is kept while the tty 183 * Where all of the state associated with a tty is kept while the tty
183 * is open. Since the termios state should be kept even if the tty 184 * is open. Since the termios state should be kept even if the tty
@@ -310,6 +311,7 @@ extern void tty_hangup(struct tty_struct * tty);
310extern void tty_vhangup(struct tty_struct * tty); 311extern void tty_vhangup(struct tty_struct * tty);
311extern void tty_unhangup(struct file *filp); 312extern void tty_unhangup(struct file *filp);
312extern int tty_hung_up_p(struct file * filp); 313extern int tty_hung_up_p(struct file * filp);
314extern int is_tty(struct file *filp);
313extern void do_SAK(struct tty_struct *tty); 315extern void do_SAK(struct tty_struct *tty);
314extern void __do_SAK(struct tty_struct *tty); 316extern void __do_SAK(struct tty_struct *tty);
315extern void disassociate_ctty(int priv); 317extern void disassociate_ctty(int priv);
@@ -338,9 +340,46 @@ extern struct tty_struct *get_current_tty(void);
338 340
339extern struct mutex tty_mutex; 341extern struct mutex tty_mutex;
340 342
343extern void tty_write_unlock(struct tty_struct *tty);
344extern int tty_write_lock(struct tty_struct *tty, int ndelay);
345#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
346
347
348
341/* n_tty.c */ 349/* n_tty.c */
342extern struct tty_ldisc tty_ldisc_N_TTY; 350extern struct tty_ldisc tty_ldisc_N_TTY;
343 351
352/* tty_audit.c */
353#ifdef CONFIG_AUDIT
354extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
355 size_t size);
356extern void tty_audit_exit(void);
357extern void tty_audit_fork(struct signal_struct *sig);
358extern void tty_audit_push(struct tty_struct *tty);
359extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid);
360extern void tty_audit_opening(void);
361#else
362static inline void tty_audit_add_data(struct tty_struct *tty,
363 unsigned char *data, size_t size)
364{
365}
366static inline void tty_audit_exit(void)
367{
368}
369static inline void tty_audit_fork(struct signal_struct *sig)
370{
371}
372static inline void tty_audit_push(struct tty_struct *tty)
373{
374}
375static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid)
376{
377}
378static inline void tty_audit_opening(void)
379{
380}
381#endif
382
344/* tty_ioctl.c */ 383/* tty_ioctl.c */
345extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, 384extern int n_tty_ioctl(struct tty_struct * tty, struct file * file,
346 unsigned int cmd, unsigned long arg); 385 unsigned int cmd, unsigned long arg);
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 9af8bbcd8963..b7fe13883bdb 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -13,10 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16
17/* A word of warning: Our uio structure will clash with the C library one (which is now obsolete). Remove the C
18 library one from sys/uio.h if you have a very old library set */
19
20struct iovec 16struct iovec
21{ 17{
22 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ 18 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
@@ -38,11 +34,6 @@ struct kvec {
38 34
39#define UIO_FASTIOV 8 35#define UIO_FASTIOV 8
40#define UIO_MAXIOV 1024 36#define UIO_MAXIOV 1024
41#if 0
42#define UIO_MAXIOV 16 /* Maximum iovec's in one operation
43 16 matches BSD */
44 /* Beg pardon: BSD has 1024 --ANK */
45#endif
46 37
47/* 38/*
48 * Total number of bytes covered by an iovec. 39 * Total number of bytes covered by an iovec.
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
new file mode 100644
index 000000000000..44c28e94df50
--- /dev/null
+++ b/include/linux/uio_driver.h
@@ -0,0 +1,91 @@
1/*
2 * include/linux/uio_driver.h
3 *
4 * Copyright(C) 2005, Benedikt Spranger <b.spranger@linutronix.de>
5 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
6 * Copyright(C) 2006, Hans J. Koch <hjk@linutronix.de>
7 * Copyright(C) 2006, Greg Kroah-Hartman <greg@kroah.com>
8 *
9 * Userspace IO driver.
10 *
11 * Licensed under the GPLv2 only.
12 */
13
14#ifndef _UIO_DRIVER_H_
15#define _UIO_DRIVER_H_
16
17#include <linux/module.h>
18#include <linux/fs.h>
19#include <linux/interrupt.h>
20
21/**
22 * struct uio_mem - description of a UIO memory region
23 * @kobj: kobject for this mapping
24 * @addr: address of the device's memory
25 * @size: size of IO
26 * @memtype: type of memory addr points to
27 * @internal_addr: ioremap-ped version of addr, for driver internal use
28 */
29struct uio_mem {
30 struct kobject kobj;
31 unsigned long addr;
32 unsigned long size;
33 int memtype;
34 void __iomem *internal_addr;
35};
36
37#define MAX_UIO_MAPS 5
38
39struct uio_device;
40
41/**
42 * struct uio_info - UIO device capabilities
43 * @uio_dev: the UIO device this info belongs to
44 * @name: device name
45 * @version: device driver version
46 * @mem: list of mappable memory regions, size==0 for end of list
47 * @irq: interrupt number or UIO_IRQ_CUSTOM
48 * @irq_flags: flags for request_irq()
49 * @priv: optional private data
50 * @handler: the device's irq handler
51 * @mmap: mmap operation for this uio device
52 * @open: open operation for this uio device
53 * @release: release operation for this uio device
54 */
55struct uio_info {
56 struct uio_device *uio_dev;
57 char *name;
58 char *version;
59 struct uio_mem mem[MAX_UIO_MAPS];
60 long irq;
61 unsigned long irq_flags;
62 void *priv;
63 irqreturn_t (*handler)(int irq, struct uio_info *dev_info);
64 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
65 int (*open)(struct uio_info *info, struct inode *inode);
66 int (*release)(struct uio_info *info, struct inode *inode);
67};
68
69extern int __must_check
70 __uio_register_device(struct module *owner,
71 struct device *parent,
72 struct uio_info *info);
73static inline int __must_check
74 uio_register_device(struct device *parent, struct uio_info *info)
75{
76 return __uio_register_device(THIS_MODULE, parent, info);
77}
78extern void uio_unregister_device(struct uio_info *info);
79extern void uio_event_notify(struct uio_info *info);
80
81/* defines for uio_device->irq */
82#define UIO_IRQ_CUSTOM -1
83#define UIO_IRQ_NONE -2
84
85/* defines for uio_device->memtype */
86#define UIO_MEM_NONE 0
87#define UIO_MEM_PHYS 1
88#define UIO_MEM_LOGICAL 2
89#define UIO_MEM_VIRTUAL 3
90
91#endif /* _LINUX_UIO_DRIVER_H_ */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
new file mode 100644
index 000000000000..1101b0ce878f
--- /dev/null
+++ b/include/linux/user_namespace.h
@@ -0,0 +1,61 @@
1#ifndef _LINUX_USER_NAMESPACE_H
2#define _LINUX_USER_NAMESPACE_H
3
4#include <linux/kref.h>
5#include <linux/nsproxy.h>
6#include <linux/sched.h>
7#include <linux/err.h>
8
9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8)
10#define UIDHASH_SZ (1 << UIDHASH_BITS)
11
12struct user_namespace {
13 struct kref kref;
14 struct list_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *root_user;
16};
17
18extern struct user_namespace init_user_ns;
19
20#ifdef CONFIG_USER_NS
21
22static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
23{
24 if (ns)
25 kref_get(&ns->kref);
26 return ns;
27}
28
29extern struct user_namespace *copy_user_ns(int flags,
30 struct user_namespace *old_ns);
31extern void free_user_ns(struct kref *kref);
32
33static inline void put_user_ns(struct user_namespace *ns)
34{
35 if (ns)
36 kref_put(&ns->kref, free_user_ns);
37}
38
39#else
40
41static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
42{
43 return &init_user_ns;
44}
45
46static inline struct user_namespace *copy_user_ns(int flags,
47 struct user_namespace *old_ns)
48{
49 if (flags & CLONE_NEWUSER)
50 return ERR_PTR(-EINVAL);
51
52 return old_ns;
53}
54
55static inline void put_user_ns(struct user_namespace *ns)
56{
57}
58
59#endif
60
61#endif /* _LINUX_USER_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index f8d3b326e93a..923db99175f2 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -48,26 +48,14 @@ static inline void get_uts_ns(struct uts_namespace *ns)
48 kref_get(&ns->kref); 48 kref_get(&ns->kref);
49} 49}
50 50
51#ifdef CONFIG_UTS_NS 51extern struct uts_namespace *copy_utsname(unsigned long flags,
52extern struct uts_namespace *copy_utsname(int flags, struct uts_namespace *ns); 52 struct uts_namespace *ns);
53extern void free_uts_ns(struct kref *kref); 53extern void free_uts_ns(struct kref *kref);
54 54
55static inline void put_uts_ns(struct uts_namespace *ns) 55static inline void put_uts_ns(struct uts_namespace *ns)
56{ 56{
57 kref_put(&ns->kref, free_uts_ns); 57 kref_put(&ns->kref, free_uts_ns);
58} 58}
59#else
60static inline struct uts_namespace *copy_utsname(int flags,
61 struct uts_namespace *ns)
62{
63 return ns;
64}
65
66static inline void put_uts_ns(struct uts_namespace *ns)
67{
68}
69#endif
70
71static inline struct new_utsname *utsname(void) 59static inline struct new_utsname *utsname(void)
72{ 60{
73 return &current->nsproxy->uts_ns->name; 61 return &current->nsproxy->uts_ns->name;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index d16a2b57dc81..c66c8a3410b9 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -60,6 +60,7 @@
60#include <linux/compiler.h> /* need __user */ 60#include <linux/compiler.h> /* need __user */
61#else 61#else
62#define __user 62#define __user
63#include <sys/time.h>
63#endif 64#endif
64#include <linux/types.h> 65#include <linux/types.h>
65 66
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4b7ee83787c1..89338b468d0d 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -58,6 +58,13 @@ void vmalloc_sync_all(void);
58/* 58/*
59 * Lowlevel-APIs (not for driver use!) 59 * Lowlevel-APIs (not for driver use!)
60 */ 60 */
61
62static inline size_t get_vm_area_size(const struct vm_struct *area)
63{
64 /* return actual size without guard page */
65 return area->size - PAGE_SIZE;
66}
67
61extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); 68extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
62extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 69extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
63 unsigned long start, unsigned long end); 70 unsigned long start, unsigned long end);
@@ -65,9 +72,14 @@ extern struct vm_struct *get_vm_area_node(unsigned long size,
65 unsigned long flags, int node, 72 unsigned long flags, int node,
66 gfp_t gfp_mask); 73 gfp_t gfp_mask);
67extern struct vm_struct *remove_vm_area(void *addr); 74extern struct vm_struct *remove_vm_area(void *addr);
75
68extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 76extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
69 struct page ***pages); 77 struct page ***pages);
70extern void unmap_vm_area(struct vm_struct *area); 78extern void unmap_kernel_range(unsigned long addr, unsigned long size);
79
80/* Allocate/destroy a 'vmalloc' VM area. */
81extern struct vm_struct *alloc_vm_area(size_t size);
82extern void free_vm_area(struct vm_struct *area);
71 83
72/* 84/*
73 * Internals. Dont't use.. 85 * Internals. Dont't use..
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index d9325cf8a134..75370ec0923e 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -25,7 +25,7 @@
25#define HIGHMEM_ZONE(xx) 25#define HIGHMEM_ZONE(xx)
26#endif 26#endif
27 27
28#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) 28#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE
29 29
30enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, 30enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
31 FOR_ALL_ZONES(PGALLOC), 31 FOR_ALL_ZONES(PGALLOC),
@@ -170,7 +170,8 @@ static inline unsigned long node_page_state(int node,
170#ifdef CONFIG_HIGHMEM 170#ifdef CONFIG_HIGHMEM
171 zone_page_state(&zones[ZONE_HIGHMEM], item) + 171 zone_page_state(&zones[ZONE_HIGHMEM], item) +
172#endif 172#endif
173 zone_page_state(&zones[ZONE_NORMAL], item); 173 zone_page_state(&zones[ZONE_NORMAL], item) +
174 zone_page_state(&zones[ZONE_MOVABLE], item);
174} 175}
175 176
176extern void zone_statistics(struct zonelist *, struct zone *); 177extern void zone_statistics(struct zonelist *, struct zone *);
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index d961635d0e61..699b7e9864fa 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -75,6 +75,8 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
75int vt_waitactive(int vt); 75int vt_waitactive(int vt);
76void change_console(struct vc_data *new_vc); 76void change_console(struct vc_data *new_vc);
77void reset_vc(struct vc_data *vc); 77void reset_vc(struct vc_data *vc);
78extern int unbind_con_driver(const struct consw *csw, int first, int last,
79 int deflt);
78 80
79/* 81/*
80 * vc_screen.c shares this temporary buffer with the console write code so that 82 * vc_screen.c shares this temporary buffer with the console write code so that
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index ce0719a2cfeb..ce6badc98f6d 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -148,7 +148,7 @@ extern int keventd_up(void);
148extern void init_workqueues(void); 148extern void init_workqueues(void);
149int execute_in_process_context(work_func_t fn, struct execute_work *); 149int execute_in_process_context(work_func_t fn, struct execute_work *);
150 150
151extern void cancel_work_sync(struct work_struct *work); 151extern int cancel_work_sync(struct work_struct *work);
152 152
153/* 153/*
154 * Kill off a pending schedule_delayed_work(). Note that the work callback 154 * Kill off a pending schedule_delayed_work(). Note that the work callback
@@ -166,14 +166,21 @@ static inline int cancel_delayed_work(struct delayed_work *work)
166 return ret; 166 return ret;
167} 167}
168 168
169extern void cancel_rearming_delayed_work(struct delayed_work *work); 169extern int cancel_delayed_work_sync(struct delayed_work *work);
170 170
171/* Obsolete. use cancel_rearming_delayed_work() */ 171/* Obsolete. use cancel_delayed_work_sync() */
172static inline 172static inline
173void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, 173void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
174 struct delayed_work *work) 174 struct delayed_work *work)
175{ 175{
176 cancel_rearming_delayed_work(work); 176 cancel_delayed_work_sync(work);
177}
178
179/* Obsolete. use cancel_delayed_work_sync() */
180static inline
181void cancel_rearming_delayed_work(struct delayed_work *work)
182{
183 cancel_delayed_work_sync(work);
177} 184}
178 185
179#endif 186#endif
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index d3f4f5a38214..67703249b245 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -114,7 +114,7 @@ struct saa7146_dev
114 struct mutex lock; 114 struct mutex lock;
115 115
116 unsigned char __iomem *mem; /* pointer to mapped IO memory */ 116 unsigned char __iomem *mem; /* pointer to mapped IO memory */
117 int revision; /* chip revision; needed for bug-workarounds*/ 117 u32 revision; /* chip revision; needed for bug-workarounds*/
118 118
119 /* pci-device & irq stuff*/ 119 /* pci-device & irq stuff*/
120 char name[32]; 120 char name[32];
@@ -157,8 +157,8 @@ struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc);
157int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); 157int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt);
158void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); 158void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt);
159int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); 159int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length );
160char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt); 160void *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt);
161void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, char *mem, struct saa7146_pgtable *pt); 161void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, void *mem, struct saa7146_pgtable *pt);
162void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data); 162void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data);
163int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop); 163int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop);
164 164
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 6dcf3c45707d..160381c72e4b 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -23,8 +23,6 @@
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>
27#include <media/tuner-types.h>
28 26
29extern int tuner_debug; 27extern int tuner_debug;
30 28
@@ -124,6 +122,7 @@ extern int tuner_debug;
124#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */ 122#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
125#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */ 123#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */
126#define TUNER_TDA9887 74 /* This tuner should be used only internally */ 124#define TUNER_TDA9887 74 /* This tuner should be used only internally */
125#define TUNER_TEA5761 75 /* Only FM Radio Tuner */
127 126
128/* tv card specific */ 127/* tv card specific */
129#define TDA9887_PRESENT (1<<0) 128#define TDA9887_PRESENT (1<<0)
@@ -182,74 +181,6 @@ struct tuner_setup {
182 int (*tuner_callback) (void *dev, int command,int arg); 181 int (*tuner_callback) (void *dev, int command,int arg);
183}; 182};
184 183
185struct tuner {
186 /* device */
187 struct i2c_client i2c;
188
189 unsigned int type; /* chip type */
190
191 unsigned int mode;
192 unsigned int mode_mask; /* Combination of allowable modes */
193
194 unsigned int tv_freq; /* keep track of the current settings */
195 unsigned int radio_freq;
196 u16 last_div;
197 unsigned int audmode;
198 v4l2_std_id std;
199
200 int using_v4l2;
201
202 /* used by tda9887 */
203 unsigned int tda9887_config;
204 unsigned char tda9887_data[4];
205
206 /* used by MT2032 */
207 unsigned int xogc;
208 unsigned int radio_if2;
209
210 /* used by tda8290 */
211 unsigned char tda8290_easy_mode;
212 unsigned char tda827x_lpsel;
213 unsigned char tda827x_addr;
214 unsigned char tda827x_ver;
215 unsigned int sgIF;
216
217 unsigned int config;
218 int (*tuner_callback) (void *dev, int command,int arg);
219
220 /* function ptrs */
221 void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);
222 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
223 int (*has_signal)(struct i2c_client *c);
224 int (*is_stereo)(struct i2c_client *c);
225 int (*get_afc)(struct i2c_client *c);
226 void (*tuner_status)(struct i2c_client *c);
227 void (*standby)(struct i2c_client *c);
228};
229
230extern unsigned const int tuner_count;
231
232extern int microtune_init(struct i2c_client *c);
233extern int xc3028_init(struct i2c_client *c);
234extern int tda8290_init(struct i2c_client *c);
235extern int tda8290_probe(struct i2c_client *c);
236extern int tea5767_tuner_init(struct i2c_client *c);
237extern int default_tuner_init(struct i2c_client *c);
238extern int tea5767_autodetection(struct i2c_client *c);
239extern int tda9887_tuner_init(struct i2c_client *c);
240
241#define tuner_warn(fmt, arg...) do {\
242 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
243 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
244#define tuner_info(fmt, arg...) do {\
245 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
246 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
247#define tuner_dbg(fmt, arg...) do {\
248 extern int tuner_debug; \
249 if (tuner_debug) \
250 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
251 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
252
253#endif /* __KERNEL__ */ 184#endif /* __KERNEL__ */
254 185
255#endif /* _TUNER_H */ 186#endif /* _TUNER_H */
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h
index fa479c71aa34..74efa7763479 100644
--- a/include/mtd/ubi-header.h
+++ b/include/mtd/ubi-header.h
@@ -74,42 +74,13 @@ enum {
74 UBI_COMPAT_REJECT = 5 74 UBI_COMPAT_REJECT = 5
75}; 75};
76 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 */ 77/* Sizes of UBI headers */
107#define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr) 78#define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr)
108#define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr) 79#define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr)
109 80
110/* Sizes of UBI headers without the ending CRC */ 81/* Sizes of UBI headers without the ending CRC */
111#define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(ubi32_t)) 82#define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(__be32))
112#define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(ubi32_t)) 83#define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(__be32))
113 84
114/** 85/**
115 * struct ubi_ec_hdr - UBI erase counter header. 86 * struct ubi_ec_hdr - UBI erase counter header.
@@ -137,14 +108,14 @@ typedef struct {
137 * eraseblocks. 108 * eraseblocks.
138 */ 109 */
139struct ubi_ec_hdr { 110struct ubi_ec_hdr {
140 ubi32_t magic; 111 __be32 magic;
141 uint8_t version; 112 __u8 version;
142 uint8_t padding1[3]; 113 __u8 padding1[3];
143 ubi64_t ec; /* Warning: the current limit is 31-bit anyway! */ 114 __be64 ec; /* Warning: the current limit is 31-bit anyway! */
144 ubi32_t vid_hdr_offset; 115 __be32 vid_hdr_offset;
145 ubi32_t data_offset; 116 __be32 data_offset;
146 uint8_t padding2[36]; 117 __u8 padding2[36];
147 ubi32_t hdr_crc; 118 __be32 hdr_crc;
148} __attribute__ ((packed)); 119} __attribute__ ((packed));
149 120
150/** 121/**
@@ -262,22 +233,22 @@ struct ubi_ec_hdr {
262 * software (say, cramfs) on top of the UBI volume. 233 * software (say, cramfs) on top of the UBI volume.
263 */ 234 */
264struct ubi_vid_hdr { 235struct ubi_vid_hdr {
265 ubi32_t magic; 236 __be32 magic;
266 uint8_t version; 237 __u8 version;
267 uint8_t vol_type; 238 __u8 vol_type;
268 uint8_t copy_flag; 239 __u8 copy_flag;
269 uint8_t compat; 240 __u8 compat;
270 ubi32_t vol_id; 241 __be32 vol_id;
271 ubi32_t lnum; 242 __be32 lnum;
272 ubi32_t leb_ver; /* obsolete, to be removed, don't use */ 243 __be32 leb_ver; /* obsolete, to be removed, don't use */
273 ubi32_t data_size; 244 __be32 data_size;
274 ubi32_t used_ebs; 245 __be32 used_ebs;
275 ubi32_t data_pad; 246 __be32 data_pad;
276 ubi32_t data_crc; 247 __be32 data_crc;
277 uint8_t padding1[4]; 248 __u8 padding1[4];
278 ubi64_t sqnum; 249 __be64 sqnum;
279 uint8_t padding2[12]; 250 __u8 padding2[12];
280 ubi32_t hdr_crc; 251 __be32 hdr_crc;
281} __attribute__ ((packed)); 252} __attribute__ ((packed));
282 253
283/* Internal UBI volumes count */ 254/* Internal UBI volumes count */
@@ -306,7 +277,7 @@ struct ubi_vid_hdr {
306#define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record) 277#define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record)
307 278
308/* Size of the volume table record without the ending CRC */ 279/* Size of the volume table record without the ending CRC */
309#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(ubi32_t)) 280#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(__be32))
310 281
311/** 282/**
312 * struct ubi_vtbl_record - a record in the volume table. 283 * struct ubi_vtbl_record - a record in the volume table.
@@ -346,15 +317,15 @@ struct ubi_vid_hdr {
346 * Empty records contain all zeroes and the CRC checksum of those zeroes. 317 * Empty records contain all zeroes and the CRC checksum of those zeroes.
347 */ 318 */
348struct ubi_vtbl_record { 319struct ubi_vtbl_record {
349 ubi32_t reserved_pebs; 320 __be32 reserved_pebs;
350 ubi32_t alignment; 321 __be32 alignment;
351 ubi32_t data_pad; 322 __be32 data_pad;
352 uint8_t vol_type; 323 __u8 vol_type;
353 uint8_t upd_marker; 324 __u8 upd_marker;
354 ubi16_t name_len; 325 __be16 name_len;
355 uint8_t name[UBI_VOL_NAME_MAX+1]; 326 __u8 name[UBI_VOL_NAME_MAX+1];
356 uint8_t padding2[24]; 327 __u8 padding2[24];
357 ubi32_t crc; 328 __be32 crc;
358} __attribute__ ((packed)); 329} __attribute__ ((packed));
359 330
360#endif /* !__UBI_HEADER_H__ */ 331#endif /* !__UBI_HEADER_H__ */
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b6eaca122db8..decdda546829 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -5,6 +5,22 @@
5#include <net/netlink.h> 5#include <net/netlink.h>
6 6
7/** 7/**
8 * struct genl_multicast_group - generic netlink multicast group
9 * @name: name of the multicast group, names are per-family
10 * @id: multicast group ID, assigned by the core, to use with
11 * genlmsg_multicast().
12 * @list: list entry for linking
13 * @family: pointer to family, need not be set before registering
14 */
15struct genl_multicast_group
16{
17 struct genl_family *family; /* private */
18 struct list_head list; /* private */
19 char name[GENL_NAMSIZ];
20 u32 id;
21};
22
23/**
8 * struct genl_family - generic netlink family 24 * struct genl_family - generic netlink family
9 * @id: protocol family idenfitier 25 * @id: protocol family idenfitier
10 * @hdrsize: length of user specific header in bytes 26 * @hdrsize: length of user specific header in bytes
@@ -14,6 +30,7 @@
14 * @attrbuf: buffer to store parsed attributes 30 * @attrbuf: buffer to store parsed attributes
15 * @ops_list: list of all assigned operations 31 * @ops_list: list of all assigned operations
16 * @family_list: family list 32 * @family_list: family list
33 * @mcast_groups: multicast groups list
17 */ 34 */
18struct genl_family 35struct genl_family
19{ 36{
@@ -25,6 +42,7 @@ struct genl_family
25 struct nlattr ** attrbuf; /* private */ 42 struct nlattr ** attrbuf; /* private */
26 struct list_head ops_list; /* private */ 43 struct list_head ops_list; /* private */
27 struct list_head family_list; /* private */ 44 struct list_head family_list; /* private */
45 struct list_head mcast_groups; /* private */
28}; 46};
29 47
30/** 48/**
@@ -73,6 +91,10 @@ extern int genl_register_family(struct genl_family *family);
73extern int genl_unregister_family(struct genl_family *family); 91extern int genl_unregister_family(struct genl_family *family);
74extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 92extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
75extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 93extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
94extern int genl_register_mc_group(struct genl_family *family,
95 struct genl_multicast_group *grp);
96extern void genl_unregister_mc_group(struct genl_family *family,
97 struct genl_multicast_group *grp);
76 98
77extern struct sock *genl_sock; 99extern struct sock *genl_sock;
78 100
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 9b7d6f2ac9a3..ffbc7f28335a 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -144,10 +144,9 @@ struct netlbl_lsm_secattr {
144}; 144};
145 145
146/* 146/*
147 * LSM security attribute operations 147 * LSM security attribute operations (inline)
148 */ 148 */
149 149
150
151/** 150/**
152 * netlbl_secattr_cache_alloc - Allocate and initialize a secattr cache 151 * netlbl_secattr_cache_alloc - Allocate and initialize a secattr cache
153 * @flags: the memory allocation flags 152 * @flags: the memory allocation flags
@@ -283,6 +282,9 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
283} 282}
284 283
285#ifdef CONFIG_NETLABEL 284#ifdef CONFIG_NETLABEL
285/*
286 * LSM security attribute operations
287 */
286int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap, 288int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap,
287 u32 offset); 289 u32 offset);
288int netlbl_secattr_catmap_walk_rng(struct netlbl_lsm_secattr_catmap *catmap, 290int netlbl_secattr_catmap_walk_rng(struct netlbl_lsm_secattr_catmap *catmap,
@@ -294,6 +296,25 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
294 u32 start, 296 u32 start,
295 u32 end, 297 u32 end,
296 gfp_t flags); 298 gfp_t flags);
299
300/*
301 * LSM protocol operations
302 */
303int netlbl_enabled(void);
304int netlbl_sock_setattr(struct sock *sk,
305 const struct netlbl_lsm_secattr *secattr);
306int netlbl_sock_getattr(struct sock *sk,
307 struct netlbl_lsm_secattr *secattr);
308int netlbl_skbuff_getattr(const struct sk_buff *skb,
309 struct netlbl_lsm_secattr *secattr);
310void netlbl_skbuff_err(struct sk_buff *skb, int error);
311
312/*
313 * LSM label mapping cache operations
314 */
315void netlbl_cache_invalidate(void);
316int netlbl_cache_add(const struct sk_buff *skb,
317 const struct netlbl_lsm_secattr *secattr);
297#else 318#else
298static inline int netlbl_secattr_catmap_walk( 319static inline int netlbl_secattr_catmap_walk(
299 struct netlbl_lsm_secattr_catmap *catmap, 320 struct netlbl_lsm_secattr_catmap *catmap,
@@ -301,14 +322,12 @@ static inline int netlbl_secattr_catmap_walk(
301{ 322{
302 return -ENOENT; 323 return -ENOENT;
303} 324}
304
305static inline int netlbl_secattr_catmap_walk_rng( 325static inline int netlbl_secattr_catmap_walk_rng(
306 struct netlbl_lsm_secattr_catmap *catmap, 326 struct netlbl_lsm_secattr_catmap *catmap,
307 u32 offset) 327 u32 offset)
308{ 328{
309 return -ENOENT; 329 return -ENOENT;
310} 330}
311
312static inline int netlbl_secattr_catmap_setbit( 331static inline int netlbl_secattr_catmap_setbit(
313 struct netlbl_lsm_secattr_catmap *catmap, 332 struct netlbl_lsm_secattr_catmap *catmap,
314 u32 bit, 333 u32 bit,
@@ -316,7 +335,6 @@ static inline int netlbl_secattr_catmap_setbit(
316{ 335{
317 return 0; 336 return 0;
318} 337}
319
320static inline int netlbl_secattr_catmap_setrng( 338static inline int netlbl_secattr_catmap_setrng(
321 struct netlbl_lsm_secattr_catmap *catmap, 339 struct netlbl_lsm_secattr_catmap *catmap,
322 u32 start, 340 u32 start,
@@ -325,59 +343,33 @@ static inline int netlbl_secattr_catmap_setrng(
325{ 343{
326 return 0; 344 return 0;
327} 345}
328#endif 346static inline int netlbl_enabled(void)
329 347{
330/* 348 return 0;
331 * LSM protocol operations 349}
332 */
333
334#ifdef CONFIG_NETLABEL
335int netlbl_sock_setattr(struct sock *sk,
336 const struct netlbl_lsm_secattr *secattr);
337int netlbl_sock_getattr(struct sock *sk,
338 struct netlbl_lsm_secattr *secattr);
339int netlbl_skbuff_getattr(const struct sk_buff *skb,
340 struct netlbl_lsm_secattr *secattr);
341void netlbl_skbuff_err(struct sk_buff *skb, int error);
342#else
343static inline int netlbl_sock_setattr(struct sock *sk, 350static inline int netlbl_sock_setattr(struct sock *sk,
344 const struct netlbl_lsm_secattr *secattr) 351 const struct netlbl_lsm_secattr *secattr)
345{ 352{
346 return -ENOSYS; 353 return -ENOSYS;
347} 354}
348
349static inline int netlbl_sock_getattr(struct sock *sk, 355static inline int netlbl_sock_getattr(struct sock *sk,
350 struct netlbl_lsm_secattr *secattr) 356 struct netlbl_lsm_secattr *secattr)
351{ 357{
352 return -ENOSYS; 358 return -ENOSYS;
353} 359}
354
355static inline int netlbl_skbuff_getattr(const struct sk_buff *skb, 360static inline int netlbl_skbuff_getattr(const struct sk_buff *skb,
356 struct netlbl_lsm_secattr *secattr) 361 struct netlbl_lsm_secattr *secattr)
357{ 362{
358 return -ENOSYS; 363 return -ENOSYS;
359} 364}
360
361static inline void netlbl_skbuff_err(struct sk_buff *skb, int error) 365static inline void netlbl_skbuff_err(struct sk_buff *skb, int error)
362{ 366{
363 return; 367 return;
364} 368}
365#endif /* CONFIG_NETLABEL */
366
367/*
368 * LSM label mapping cache operations
369 */
370
371#ifdef CONFIG_NETLABEL
372void netlbl_cache_invalidate(void);
373int netlbl_cache_add(const struct sk_buff *skb,
374 const struct netlbl_lsm_secattr *secattr);
375#else
376static inline void netlbl_cache_invalidate(void) 369static inline void netlbl_cache_invalidate(void)
377{ 370{
378 return; 371 return;
379} 372}
380
381static inline int netlbl_cache_add(const struct sk_buff *skb, 373static inline int netlbl_cache_add(const struct sk_buff *skb,
382 const struct netlbl_lsm_secattr *secattr) 374 const struct netlbl_lsm_secattr *secattr)
383{ 375{
diff --git a/include/net/scm.h b/include/net/scm.h
index 5637d5e22d5f..423cb1d5ac25 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -8,7 +8,7 @@
8/* Well, we should have at least one descriptor open 8/* Well, we should have at least one descriptor open
9 * to accept passed FDs 8) 9 * to accept passed FDs 8)
10 */ 10 */
11#define SCM_MAX_FD (OPEN_MAX-1) 11#define SCM_MAX_FD 255
12 12
13struct scm_fp_list 13struct scm_fp_list
14{ 14{
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a8af9ae00177..8b404b1ef7c8 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -652,8 +652,7 @@ struct tcp_congestion_ops {
652 /* lower bound for congestion window (optional) */ 652 /* lower bound for congestion window (optional) */
653 u32 (*min_cwnd)(const struct sock *sk); 653 u32 (*min_cwnd)(const struct sock *sk);
654 /* do new cwnd calculation (required) */ 654 /* do new cwnd calculation (required) */
655 void (*cong_avoid)(struct sock *sk, u32 ack, 655 void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight, int good_ack);
656 u32 rtt, u32 in_flight, int good_ack);
657 /* call before changing ca_state (optional) */ 656 /* call before changing ca_state (optional) */
658 void (*set_state)(struct sock *sk, u8 new_state); 657 void (*set_state)(struct sock *sk, u8 new_state);
659 /* call when cwnd event occurs (optional) */ 658 /* call when cwnd event occurs (optional) */
@@ -684,8 +683,7 @@ extern void tcp_slow_start(struct tcp_sock *tp);
684 683
685extern struct tcp_congestion_ops tcp_init_congestion_ops; 684extern struct tcp_congestion_ops tcp_init_congestion_ops;
686extern u32 tcp_reno_ssthresh(struct sock *sk); 685extern u32 tcp_reno_ssthresh(struct sock *sk);
687extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, 686extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight, int flag);
688 u32 rtt, u32 in_flight, int flag);
689extern u32 tcp_reno_min_cwnd(const struct sock *sk); 687extern u32 tcp_reno_min_cwnd(const struct sock *sk);
690extern struct tcp_congestion_ops tcp_reno; 688extern struct tcp_congestion_ops tcp_reno;
691 689
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ae959e950174..a5f80bfbaaa4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -585,7 +585,6 @@ static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ct
585struct xfrm_dst 585struct xfrm_dst
586{ 586{
587 union { 587 union {
588 struct xfrm_dst *next;
589 struct dst_entry dst; 588 struct dst_entry dst;
590 struct rtable rt; 589 struct rtable rt;
591 struct rt6_info rt6; 590 struct rt6_info rt6;
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index aa49dda4f410..fd0a6c46f497 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -43,6 +43,7 @@ struct snd_ak4xxx_ops {
43struct snd_akm4xxx_dac_channel { 43struct snd_akm4xxx_dac_channel {
44 char *name; /* mixer volume name */ 44 char *name; /* mixer volume name */
45 unsigned int num_channels; 45 unsigned int num_channels;
46 char *switch_name; /* mixer switch*/
46}; 47};
47 48
48/* ADC labels and channels */ 49/* ADC labels and channels */
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 685928e6f65a..353910ce9755 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1723,6 +1723,10 @@ struct snd_cs46xx {
1723 struct snd_cs46xx_pcm *playback_pcm; 1723 struct snd_cs46xx_pcm *playback_pcm;
1724 unsigned int play_ctl; 1724 unsigned int play_ctl;
1725#endif 1725#endif
1726
1727#ifdef CONFIG_PM
1728 u32 *saved_regs;
1729#endif
1726}; 1730};
1727 1731
1728int snd_cs46xx_create(struct snd_card *card, 1732int snd_cs46xx_create(struct snd_card *card,
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h
index da934def31e9..d9da9e59cf37 100644
--- a/include/sound/cs46xx_dsp_spos.h
+++ b/include/sound/cs46xx_dsp_spos.h
@@ -107,6 +107,7 @@ struct dsp_scb_descriptor {
107 char scb_name[DSP_MAX_SCB_NAME]; 107 char scb_name[DSP_MAX_SCB_NAME];
108 u32 address; 108 u32 address;
109 int index; 109 int index;
110 u32 *data;
110 111
111 struct dsp_scb_descriptor * sub_list_ptr; 112 struct dsp_scb_descriptor * sub_list_ptr;
112 struct dsp_scb_descriptor * next_scb_ptr; 113 struct dsp_scb_descriptor * next_scb_ptr;
@@ -127,6 +128,7 @@ struct dsp_task_descriptor {
127 int size; 128 int size;
128 u32 address; 129 u32 address;
129 int index; 130 int index;
131 u32 *data;
130}; 132};
131 133
132struct dsp_pcm_channel_descriptor { 134struct dsp_pcm_channel_descriptor {
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 23e45a4cf0e4..529d0a564367 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1120,6 +1120,16 @@
1120/************************************************************************************************/ 1120/************************************************************************************************/
1121/* EMU1010m HANA Destinations */ 1121/* EMU1010m HANA Destinations */
1122/************************************************************************************************/ 1122/************************************************************************************************/
1123/* 32-bit destinations of signal in the Hana FPGA. Destinations are either
1124 * physical outputs of Hana, or outputs going to Alice2 (audigy) for capture
1125 * - 16 x EMU_DST_ALICE2_EMU32_X.
1126 */
1127/* EMU32 = 32-bit serial channel between Alice2 (audigy) and Hana (FPGA) */
1128/* EMU_DST_ALICE2_EMU32_X - data channels from Hana to Alice2 used for capture.
1129 * Which data is fed into a EMU_DST_ALICE2_EMU32_X channel in Hana depends on
1130 * setup of mixer control for each destination - see emumixer.c -
1131 * snd_emu1010_output_enum_ctls[], snd_emu1010_input_enum_ctls[]
1132 */
1123#define EMU_DST_ALICE2_EMU32_0 0x000f /* 16 EMU32 channels to Alice2 +0 to +0xf */ 1133#define EMU_DST_ALICE2_EMU32_0 0x000f /* 16 EMU32 channels to Alice2 +0 to +0xf */
1124#define EMU_DST_ALICE2_EMU32_1 0x0000 /* 16 EMU32 channels to Alice2 +0 to +0xf */ 1134#define EMU_DST_ALICE2_EMU32_1 0x0000 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1125#define EMU_DST_ALICE2_EMU32_2 0x0001 /* 16 EMU32 channels to Alice2 +0 to +0xf */ 1135#define EMU_DST_ALICE2_EMU32_2 0x0001 /* 16 EMU32 channels to Alice2 +0 to +0xf */
@@ -1199,6 +1209,12 @@
1199/************************************************************************************************/ 1209/************************************************************************************************/
1200/* EMU1010m HANA Sources */ 1210/* EMU1010m HANA Sources */
1201/************************************************************************************************/ 1211/************************************************************************************************/
1212/* 32-bit sources of signal in the Hana FPGA. The sources are routed to
1213 * destinations using mixer control for each destination - see emumixer.c
1214 * Sources are either physical inputs of FPGA,
1215 * or outputs from Alice (audigy) - 16 x EMU_SRC_ALICE_EMU32A +
1216 * 16 x EMU_SRC_ALICE_EMU32B
1217 */
1202#define EMU_SRC_SILENCE 0x0000 /* Silence */ 1218#define EMU_SRC_SILENCE 0x0000 /* Silence */
1203#define EMU_SRC_DOCK_MIC_A1 0x0100 /* Audio Dock Mic A, 1st or 48kHz only */ 1219#define EMU_SRC_DOCK_MIC_A1 0x0100 /* Audio Dock Mic A, 1st or 48kHz only */
1204#define EMU_SRC_DOCK_MIC_A2 0x0101 /* Audio Dock Mic A, 2nd or 96kHz */ 1220#define EMU_SRC_DOCK_MIC_A2 0x0101 /* Audio Dock Mic A, 2nd or 96kHz */
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 2dd5c8e5b4fe..3ad854b397d2 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -38,6 +38,7 @@ enum sb_hw_type {
38 SB_HW_ALS100, /* Avance Logic ALS100 chip */ 38 SB_HW_ALS100, /* Avance Logic ALS100 chip */
39 SB_HW_ALS4000, /* Avance Logic ALS4000 chip */ 39 SB_HW_ALS4000, /* Avance Logic ALS4000 chip */
40 SB_HW_DT019X, /* Diamond Tech. DT-019X / Avance Logic ALS-007 */ 40 SB_HW_DT019X, /* Diamond Tech. DT-019X / Avance Logic ALS-007 */
41 SB_HW_CS5530, /* Cyrix/NatSemi 5530 VSA1 */
41}; 42};
42 43
43#define SB_OPEN_PCM 0x01 44#define SB_OPEN_PCM 0x01
diff --git a/include/sound/version.h b/include/sound/version.h
index 8e5b2f0f5946..6bbcfefd2c38 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.14" 2#define CONFIG_SND_VERSION "1.0.14"
3#define CONFIG_SND_DATE " (Thu May 31 09:03:25 2007 UTC)" 3#define CONFIG_SND_DATE " (Fri Jul 20 09:12:58 2007 UTC)"
diff --git a/include/sound/wavefront_fx.h b/include/sound/wavefront_fx.h
deleted file mode 100644
index cec92b141796..000000000000
--- a/include/sound/wavefront_fx.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __SOUND_WAVEFRONT_FX_H
2#define __SOUND_WAVEFRONT_FX_H
3
4extern int snd_wavefront_fx_detect (snd_wavefront_t *);
5extern void snd_wavefront_fx_ioctl (snd_synth_t *sdev,
6 unsigned int cmd,
7 unsigned long arg);
8
9#endif __SOUND_WAVEFRONT_FX_H
diff --git a/include/video/tgafb.h b/include/video/tgafb.h
index 03d0dbe293a8..7bc5e2c14826 100644
--- a/include/video/tgafb.h
+++ b/include/video/tgafb.h
@@ -216,6 +216,7 @@ struct tga_par {
216 u32 pll_freq; /* pixclock in mhz */ 216 u32 pll_freq; /* pixclock in mhz */
217 u32 bits_per_pixel; /* bits per pixel */ 217 u32 bits_per_pixel; /* bits per pixel */
218 u32 sync_on_green; /* set if sync is on green */ 218 u32 sync_on_green; /* set if sync is on green */
219 u32 palette[16];
219}; 220};
220 221
221 222
diff --git a/include/xen/events.h b/include/xen/events.h
new file mode 100644
index 000000000000..2bde54d29be5
--- /dev/null
+++ b/include/xen/events.h
@@ -0,0 +1,48 @@
1#ifndef _XEN_EVENTS_H
2#define _XEN_EVENTS_H
3
4#include <linux/interrupt.h>
5
6#include <xen/interface/event_channel.h>
7#include <asm/xen/hypercall.h>
8
9enum ipi_vector {
10 XEN_RESCHEDULE_VECTOR,
11 XEN_CALL_FUNCTION_VECTOR,
12
13 XEN_NR_IPIS,
14};
15
16int bind_evtchn_to_irq(unsigned int evtchn);
17int bind_evtchn_to_irqhandler(unsigned int evtchn,
18 irq_handler_t handler,
19 unsigned long irqflags, const char *devname,
20 void *dev_id);
21int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
22 irq_handler_t handler,
23 unsigned long irqflags, const char *devname,
24 void *dev_id);
25int bind_ipi_to_irqhandler(enum ipi_vector ipi,
26 unsigned int cpu,
27 irq_handler_t handler,
28 unsigned long irqflags,
29 const char *devname,
30 void *dev_id);
31
32/*
33 * Common unbind function for all event sources. Takes IRQ to unbind from.
34 * Automatically closes the underlying event channel (even for bindings
35 * made with bind_evtchn_to_irqhandler()).
36 */
37void unbind_from_irqhandler(unsigned int irq, void *dev_id);
38
39void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
40
41static inline void notify_remote_via_evtchn(int port)
42{
43 struct evtchn_send send = { .port = port };
44 (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
45}
46
47extern void notify_remote_via_irq(int irq);
48#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/features.h b/include/xen/features.h
new file mode 100644
index 000000000000..27292d4d2a6a
--- /dev/null
+++ b/include/xen/features.h
@@ -0,0 +1,23 @@
1/******************************************************************************
2 * features.h
3 *
4 * Query the features reported by Xen.
5 *
6 * Copyright (c) 2006, Ian Campbell
7 */
8
9#ifndef __XEN_FEATURES_H__
10#define __XEN_FEATURES_H__
11
12#include <xen/interface/features.h>
13
14void xen_setup_features(void);
15
16extern u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
17
18static inline int xen_feature(int flag)
19{
20 return xen_features[flag];
21}
22
23#endif /* __ASM_XEN_FEATURES_H__ */
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
new file mode 100644
index 000000000000..761c83498e03
--- /dev/null
+++ b/include/xen/grant_table.h
@@ -0,0 +1,107 @@
1/******************************************************************************
2 * grant_table.h
3 *
4 * Two sets of functionality:
5 * 1. Granting foreign access to our memory reservation.
6 * 2. Accessing others' memory reservations via grant references.
7 * (i.e., mechanisms for both sender and recipient of grant references)
8 *
9 * Copyright (c) 2004-2005, K A Fraser
10 * Copyright (c) 2005, Christopher Clark
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation; or, when distributed
15 * separately from the Linux kernel or incorporated into other
16 * software packages, subject to the following license:
17 *
18 * Permission is hereby granted, free of charge, to any person obtaining a copy
19 * of this source file (the "Software"), to deal in the Software without
20 * restriction, including without limitation the rights to use, copy, modify,
21 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
22 * and to permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be included in
26 * all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34 * IN THE SOFTWARE.
35 */
36
37#ifndef __ASM_GNTTAB_H__
38#define __ASM_GNTTAB_H__
39
40#include <asm/xen/hypervisor.h>
41#include <xen/interface/grant_table.h>
42
43/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
44#define NR_GRANT_FRAMES 4
45
46struct gnttab_free_callback {
47 struct gnttab_free_callback *next;
48 void (*fn)(void *);
49 void *arg;
50 u16 count;
51};
52
53int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
54 int readonly);
55
56/*
57 * End access through the given grant reference, iff the grant entry is no
58 * longer in use. Return 1 if the grant entry was freed, 0 if it is still in
59 * use.
60 */
61int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
62
63/*
64 * Eventually end access through the given grant reference, and once that
65 * access has been ended, free the given page too. Access will be ended
66 * immediately iff the grant entry is not in use, otherwise it will happen
67 * some time later. page may be 0, in which case no freeing will occur.
68 */
69void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
70 unsigned long page);
71
72int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
73
74unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
75unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
76
77int gnttab_query_foreign_access(grant_ref_t ref);
78
79/*
80 * operations on reserved batches of grant references
81 */
82int gnttab_alloc_grant_references(u16 count, grant_ref_t *pprivate_head);
83
84void gnttab_free_grant_reference(grant_ref_t ref);
85
86void gnttab_free_grant_references(grant_ref_t head);
87
88int gnttab_empty_grant_references(const grant_ref_t *pprivate_head);
89
90int gnttab_claim_grant_reference(grant_ref_t *pprivate_head);
91
92void gnttab_release_grant_reference(grant_ref_t *private_head,
93 grant_ref_t release);
94
95void gnttab_request_free_callback(struct gnttab_free_callback *callback,
96 void (*fn)(void *), void *arg, u16 count);
97void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
98
99void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
100 unsigned long frame, int readonly);
101
102void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
103 unsigned long pfn);
104
105#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
106
107#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/hvc-console.h b/include/xen/hvc-console.h
new file mode 100644
index 000000000000..21c0ecfd786d
--- /dev/null
+++ b/include/xen/hvc-console.h
@@ -0,0 +1,6 @@
1#ifndef XEN_HVC_CONSOLE_H
2#define XEN_HVC_CONSOLE_H
3
4extern struct console xenboot_console;
5
6#endif /* XEN_HVC_CONSOLE_H */
diff --git a/include/xen/interface/elfnote.h b/include/xen/interface/elfnote.h
new file mode 100644
index 000000000000..a64d3df5bd95
--- /dev/null
+++ b/include/xen/interface/elfnote.h
@@ -0,0 +1,133 @@
1/******************************************************************************
2 * elfnote.h
3 *
4 * Definitions used for the Xen ELF notes.
5 *
6 * Copyright (c) 2006, Ian Campbell, XenSource Ltd.
7 */
8
9#ifndef __XEN_PUBLIC_ELFNOTE_H__
10#define __XEN_PUBLIC_ELFNOTE_H__
11
12/*
13 * The notes should live in a SHT_NOTE segment and have "Xen" in the
14 * name field.
15 *
16 * Numeric types are either 4 or 8 bytes depending on the content of
17 * the desc field.
18 *
19 * LEGACY indicated the fields in the legacy __xen_guest string which
20 * this a note type replaces.
21 */
22
23/*
24 * NAME=VALUE pair (string).
25 *
26 * LEGACY: FEATURES and PAE
27 */
28#define XEN_ELFNOTE_INFO 0
29
30/*
31 * The virtual address of the entry point (numeric).
32 *
33 * LEGACY: VIRT_ENTRY
34 */
35#define XEN_ELFNOTE_ENTRY 1
36
37/* The virtual address of the hypercall transfer page (numeric).
38 *
39 * LEGACY: HYPERCALL_PAGE. (n.b. legacy value is a physical page
40 * number not a virtual address)
41 */
42#define XEN_ELFNOTE_HYPERCALL_PAGE 2
43
44/* The virtual address where the kernel image should be mapped (numeric).
45 *
46 * Defaults to 0.
47 *
48 * LEGACY: VIRT_BASE
49 */
50#define XEN_ELFNOTE_VIRT_BASE 3
51
52/*
53 * The offset of the ELF paddr field from the acutal required
54 * psuedo-physical address (numeric).
55 *
56 * This is used to maintain backwards compatibility with older kernels
57 * which wrote __PAGE_OFFSET into that field. This field defaults to 0
58 * if not present.
59 *
60 * LEGACY: ELF_PADDR_OFFSET. (n.b. legacy default is VIRT_BASE)
61 */
62#define XEN_ELFNOTE_PADDR_OFFSET 4
63
64/*
65 * The version of Xen that we work with (string).
66 *
67 * LEGACY: XEN_VER
68 */
69#define XEN_ELFNOTE_XEN_VERSION 5
70
71/*
72 * The name of the guest operating system (string).
73 *
74 * LEGACY: GUEST_OS
75 */
76#define XEN_ELFNOTE_GUEST_OS 6
77
78/*
79 * The version of the guest operating system (string).
80 *
81 * LEGACY: GUEST_VER
82 */
83#define XEN_ELFNOTE_GUEST_VERSION 7
84
85/*
86 * The loader type (string).
87 *
88 * LEGACY: LOADER
89 */
90#define XEN_ELFNOTE_LOADER 8
91
92/*
93 * The kernel supports PAE (x86/32 only, string = "yes" or "no").
94 *
95 * LEGACY: PAE (n.b. The legacy interface included a provision to
96 * indicate 'extended-cr3' support allowing L3 page tables to be
97 * placed above 4G. It is assumed that any kernel new enough to use
98 * these ELF notes will include this and therefore "yes" here is
99 * equivalent to "yes[entended-cr3]" in the __xen_guest interface.
100 */
101#define XEN_ELFNOTE_PAE_MODE 9
102
103/*
104 * The features supported/required by this kernel (string).
105 *
106 * The string must consist of a list of feature names (as given in
107 * features.h, without the "XENFEAT_" prefix) separated by '|'
108 * characters. If a feature is required for the kernel to function
109 * then the feature name must be preceded by a '!' character.
110 *
111 * LEGACY: FEATURES
112 */
113#define XEN_ELFNOTE_FEATURES 10
114
115/*
116 * The kernel requires the symbol table to be loaded (string = "yes" or "no")
117 * LEGACY: BSD_SYMTAB (n.b. The legacy treated the presence or absence
118 * of this string as a boolean flag rather than requiring "yes" or
119 * "no".
120 */
121#define XEN_ELFNOTE_BSD_SYMTAB 11
122
123#endif /* __XEN_PUBLIC_ELFNOTE_H__ */
124
125/*
126 * Local variables:
127 * mode: C
128 * c-set-style: "BSD"
129 * c-basic-offset: 4
130 * tab-width: 4
131 * indent-tabs-mode: nil
132 * End:
133 */
diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h
new file mode 100644
index 000000000000..919b5bdcb2bd
--- /dev/null
+++ b/include/xen/interface/event_channel.h
@@ -0,0 +1,195 @@
1/******************************************************************************
2 * event_channel.h
3 *
4 * Event channels between domains.
5 *
6 * Copyright (c) 2003-2004, K A Fraser.
7 */
8
9#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
10#define __XEN_PUBLIC_EVENT_CHANNEL_H__
11
12typedef uint32_t evtchn_port_t;
13DEFINE_GUEST_HANDLE(evtchn_port_t);
14
15/*
16 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
17 * accepting interdomain bindings from domain <remote_dom>. A fresh port
18 * is allocated in <dom> and returned as <port>.
19 * NOTES:
20 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
21 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
22 */
23#define EVTCHNOP_alloc_unbound 6
24struct evtchn_alloc_unbound {
25 /* IN parameters */
26 domid_t dom, remote_dom;
27 /* OUT parameters */
28 evtchn_port_t port;
29};
30
31/*
32 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
33 * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
34 * a port that is unbound and marked as accepting bindings from the calling
35 * domain. A fresh port is allocated in the calling domain and returned as
36 * <local_port>.
37 * NOTES:
38 * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
39 */
40#define EVTCHNOP_bind_interdomain 0
41struct evtchn_bind_interdomain {
42 /* IN parameters. */
43 domid_t remote_dom;
44 evtchn_port_t remote_port;
45 /* OUT parameters. */
46 evtchn_port_t local_port;
47};
48
49/*
50 * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
51 * vcpu.
52 * NOTES:
53 * 1. A virtual IRQ may be bound to at most one event channel per vcpu.
54 * 2. The allocated event channel is bound to the specified vcpu. The binding
55 * may not be changed.
56 */
57#define EVTCHNOP_bind_virq 1
58struct evtchn_bind_virq {
59 /* IN parameters. */
60 uint32_t virq;
61 uint32_t vcpu;
62 /* OUT parameters. */
63 evtchn_port_t port;
64};
65
66/*
67 * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
68 * NOTES:
69 * 1. A physical IRQ may be bound to at most one event channel per domain.
70 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
71 */
72#define EVTCHNOP_bind_pirq 2
73struct evtchn_bind_pirq {
74 /* IN parameters. */
75 uint32_t pirq;
76#define BIND_PIRQ__WILL_SHARE 1
77 uint32_t flags; /* BIND_PIRQ__* */
78 /* OUT parameters. */
79 evtchn_port_t port;
80};
81
82/*
83 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
84 * NOTES:
85 * 1. The allocated event channel is bound to the specified vcpu. The binding
86 * may not be changed.
87 */
88#define EVTCHNOP_bind_ipi 7
89struct evtchn_bind_ipi {
90 uint32_t vcpu;
91 /* OUT parameters. */
92 evtchn_port_t port;
93};
94
95/*
96 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
97 * interdomain then the remote end is placed in the unbound state
98 * (EVTCHNSTAT_unbound), awaiting a new connection.
99 */
100#define EVTCHNOP_close 3
101struct evtchn_close {
102 /* IN parameters. */
103 evtchn_port_t port;
104};
105
106/*
107 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
108 * endpoint is <port>.
109 */
110#define EVTCHNOP_send 4
111struct evtchn_send {
112 /* IN parameters. */
113 evtchn_port_t port;
114};
115
116/*
117 * EVTCHNOP_status: Get the current status of the communication channel which
118 * has an endpoint at <dom, port>.
119 * NOTES:
120 * 1. <dom> may be specified as DOMID_SELF.
121 * 2. Only a sufficiently-privileged domain may obtain the status of an event
122 * channel for which <dom> is not DOMID_SELF.
123 */
124#define EVTCHNOP_status 5
125struct evtchn_status {
126 /* IN parameters */
127 domid_t dom;
128 evtchn_port_t port;
129 /* OUT parameters */
130#define EVTCHNSTAT_closed 0 /* Channel is not in use. */
131#define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
132#define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
133#define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
134#define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
135#define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
136 uint32_t status;
137 uint32_t vcpu; /* VCPU to which this channel is bound. */
138 union {
139 struct {
140 domid_t dom;
141 } unbound; /* EVTCHNSTAT_unbound */
142 struct {
143 domid_t dom;
144 evtchn_port_t port;
145 } interdomain; /* EVTCHNSTAT_interdomain */
146 uint32_t pirq; /* EVTCHNSTAT_pirq */
147 uint32_t virq; /* EVTCHNSTAT_virq */
148 } u;
149};
150
151/*
152 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
153 * event is pending.
154 * NOTES:
155 * 1. IPI- and VIRQ-bound channels always notify the vcpu that initialised
156 * the binding. This binding cannot be changed.
157 * 2. All other channels notify vcpu0 by default. This default is set when
158 * the channel is allocated (a port that is freed and subsequently reused
159 * has its binding reset to vcpu0).
160 */
161#define EVTCHNOP_bind_vcpu 8
162struct evtchn_bind_vcpu {
163 /* IN parameters. */
164 evtchn_port_t port;
165 uint32_t vcpu;
166};
167
168/*
169 * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
170 * a notification to the appropriate VCPU if an event is pending.
171 */
172#define EVTCHNOP_unmask 9
173struct evtchn_unmask {
174 /* IN parameters. */
175 evtchn_port_t port;
176};
177
178struct evtchn_op {
179 uint32_t cmd; /* EVTCHNOP_* */
180 union {
181 struct evtchn_alloc_unbound alloc_unbound;
182 struct evtchn_bind_interdomain bind_interdomain;
183 struct evtchn_bind_virq bind_virq;
184 struct evtchn_bind_pirq bind_pirq;
185 struct evtchn_bind_ipi bind_ipi;
186 struct evtchn_close close;
187 struct evtchn_send send;
188 struct evtchn_status status;
189 struct evtchn_bind_vcpu bind_vcpu;
190 struct evtchn_unmask unmask;
191 } u;
192};
193DEFINE_GUEST_HANDLE_STRUCT(evtchn_op);
194
195#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
new file mode 100644
index 000000000000..d73228d16488
--- /dev/null
+++ b/include/xen/interface/features.h
@@ -0,0 +1,43 @@
1/******************************************************************************
2 * features.h
3 *
4 * Feature flags, reported by XENVER_get_features.
5 *
6 * Copyright (c) 2006, Keir Fraser <keir@xensource.com>
7 */
8
9#ifndef __XEN_PUBLIC_FEATURES_H__
10#define __XEN_PUBLIC_FEATURES_H__
11
12/*
13 * If set, the guest does not need to write-protect its pagetables, and can
14 * update them via direct writes.
15 */
16#define XENFEAT_writable_page_tables 0
17
18/*
19 * If set, the guest does not need to write-protect its segment descriptor
20 * tables, and can update them via direct writes.
21 */
22#define XENFEAT_writable_descriptor_tables 1
23
24/*
25 * If set, translation between the guest's 'pseudo-physical' address space
26 * and the host's machine address space are handled by the hypervisor. In this
27 * mode the guest does not need to perform phys-to/from-machine translations
28 * when performing page table operations.
29 */
30#define XENFEAT_auto_translated_physmap 2
31
32/* If set, the guest is running in supervisor mode (e.g., x86 ring 0). */
33#define XENFEAT_supervisor_mode_kernel 3
34
35/*
36 * If set, the guest does not need to allocate x86 PAE page directories
37 * below 4GB. This flag is usually implied by auto_translated_physmap.
38 */
39#define XENFEAT_pae_pgdir_above_4gb 4
40
41#define XENFEAT_NR_SUBMAPS 1
42
43#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
new file mode 100644
index 000000000000..219049802cf2
--- /dev/null
+++ b/include/xen/interface/grant_table.h
@@ -0,0 +1,375 @@
1/******************************************************************************
2 * grant_table.h
3 *
4 * Interface for granting foreign access to page frames, and receiving
5 * page-ownership transfers.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to
9 * deal in the Software without restriction, including without limitation the
10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 *
25 * Copyright (c) 2004, K A Fraser
26 */
27
28#ifndef __XEN_PUBLIC_GRANT_TABLE_H__
29#define __XEN_PUBLIC_GRANT_TABLE_H__
30
31
32/***********************************
33 * GRANT TABLE REPRESENTATION
34 */
35
36/* Some rough guidelines on accessing and updating grant-table entries
37 * in a concurrency-safe manner. For more information, Linux contains a
38 * reference implementation for guest OSes (arch/xen/kernel/grant_table.c).
39 *
40 * NB. WMB is a no-op on current-generation x86 processors. However, a
41 * compiler barrier will still be required.
42 *
43 * Introducing a valid entry into the grant table:
44 * 1. Write ent->domid.
45 * 2. Write ent->frame:
46 * GTF_permit_access: Frame to which access is permitted.
47 * GTF_accept_transfer: Pseudo-phys frame slot being filled by new
48 * frame, or zero if none.
49 * 3. Write memory barrier (WMB).
50 * 4. Write ent->flags, inc. valid type.
51 *
52 * Invalidating an unused GTF_permit_access entry:
53 * 1. flags = ent->flags.
54 * 2. Observe that !(flags & (GTF_reading|GTF_writing)).
55 * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
56 * NB. No need for WMB as reuse of entry is control-dependent on success of
57 * step 3, and all architectures guarantee ordering of ctrl-dep writes.
58 *
59 * Invalidating an in-use GTF_permit_access entry:
60 * This cannot be done directly. Request assistance from the domain controller
61 * which can set a timeout on the use of a grant entry and take necessary
62 * action. (NB. This is not yet implemented!).
63 *
64 * Invalidating an unused GTF_accept_transfer entry:
65 * 1. flags = ent->flags.
66 * 2. Observe that !(flags & GTF_transfer_committed). [*]
67 * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
68 * NB. No need for WMB as reuse of entry is control-dependent on success of
69 * step 3, and all architectures guarantee ordering of ctrl-dep writes.
70 * [*] If GTF_transfer_committed is set then the grant entry is 'committed'.
71 * The guest must /not/ modify the grant entry until the address of the
72 * transferred frame is written. It is safe for the guest to spin waiting
73 * for this to occur (detect by observing GTF_transfer_completed in
74 * ent->flags).
75 *
76 * Invalidating a committed GTF_accept_transfer entry:
77 * 1. Wait for (ent->flags & GTF_transfer_completed).
78 *
79 * Changing a GTF_permit_access from writable to read-only:
80 * Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
81 *
82 * Changing a GTF_permit_access from read-only to writable:
83 * Use SMP-safe bit-setting instruction.
84 */
85
86/*
87 * A grant table comprises a packed array of grant entries in one or more
88 * page frames shared between Xen and a guest.
89 * [XEN]: This field is written by Xen and read by the sharing guest.
90 * [GST]: This field is written by the guest and read by Xen.
91 */
92struct grant_entry {
93 /* GTF_xxx: various type and flag information. [XEN,GST] */
94 uint16_t flags;
95 /* The domain being granted foreign privileges. [GST] */
96 domid_t domid;
97 /*
98 * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
99 * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
100 */
101 uint32_t frame;
102};
103
104/*
105 * Type of grant entry.
106 * GTF_invalid: This grant entry grants no privileges.
107 * GTF_permit_access: Allow @domid to map/access @frame.
108 * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
109 * to this guest. Xen writes the page number to @frame.
110 */
111#define GTF_invalid (0U<<0)
112#define GTF_permit_access (1U<<0)
113#define GTF_accept_transfer (2U<<0)
114#define GTF_type_mask (3U<<0)
115
116/*
117 * Subflags for GTF_permit_access.
118 * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
119 * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
120 * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
121 */
122#define _GTF_readonly (2)
123#define GTF_readonly (1U<<_GTF_readonly)
124#define _GTF_reading (3)
125#define GTF_reading (1U<<_GTF_reading)
126#define _GTF_writing (4)
127#define GTF_writing (1U<<_GTF_writing)
128
129/*
130 * Subflags for GTF_accept_transfer:
131 * GTF_transfer_committed: Xen sets this flag to indicate that it is committed
132 * to transferring ownership of a page frame. When a guest sees this flag
133 * it must /not/ modify the grant entry until GTF_transfer_completed is
134 * set by Xen.
135 * GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
136 * after reading GTF_transfer_committed. Xen will always write the frame
137 * address, followed by ORing this flag, in a timely manner.
138 */
139#define _GTF_transfer_committed (2)
140#define GTF_transfer_committed (1U<<_GTF_transfer_committed)
141#define _GTF_transfer_completed (3)
142#define GTF_transfer_completed (1U<<_GTF_transfer_completed)
143
144
145/***********************************
146 * GRANT TABLE QUERIES AND USES
147 */
148
149/*
150 * Reference to a grant entry in a specified domain's grant table.
151 */
152typedef uint32_t grant_ref_t;
153
154/*
155 * Handle to track a mapping created via a grant reference.
156 */
157typedef uint32_t grant_handle_t;
158
159/*
160 * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
161 * by devices and/or host CPUs. If successful, <handle> is a tracking number
162 * that must be presented later to destroy the mapping(s). On error, <handle>
163 * is a negative status code.
164 * NOTES:
165 * 1. If GNTMAP_device_map is specified then <dev_bus_addr> is the address
166 * via which I/O devices may access the granted frame.
167 * 2. If GNTMAP_host_map is specified then a mapping will be added at
168 * either a host virtual address in the current address space, or at
169 * a PTE at the specified machine address. The type of mapping to
170 * perform is selected through the GNTMAP_contains_pte flag, and the
171 * address is specified in <host_addr>.
172 * 3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
173 * host mapping is destroyed by other means then it is *NOT* guaranteed
174 * to be accounted to the correct grant reference!
175 */
176#define GNTTABOP_map_grant_ref 0
177struct gnttab_map_grant_ref {
178 /* IN parameters. */
179 uint64_t host_addr;
180 uint32_t flags; /* GNTMAP_* */
181 grant_ref_t ref;
182 domid_t dom;
183 /* OUT parameters. */
184 int16_t status; /* GNTST_* */
185 grant_handle_t handle;
186 uint64_t dev_bus_addr;
187};
188
189/*
190 * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
191 * tracked by <handle>. If <host_addr> or <dev_bus_addr> is zero, that
192 * field is ignored. If non-zero, they must refer to a device/host mapping
193 * that is tracked by <handle>
194 * NOTES:
195 * 1. The call may fail in an undefined manner if either mapping is not
196 * tracked by <handle>.
197 * 3. After executing a batch of unmaps, it is guaranteed that no stale
198 * mappings will remain in the device or host TLBs.
199 */
200#define GNTTABOP_unmap_grant_ref 1
201struct gnttab_unmap_grant_ref {
202 /* IN parameters. */
203 uint64_t host_addr;
204 uint64_t dev_bus_addr;
205 grant_handle_t handle;
206 /* OUT parameters. */
207 int16_t status; /* GNTST_* */
208};
209
210/*
211 * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
212 * <nr_frames> pages. The frame addresses are written to the <frame_list>.
213 * Only <nr_frames> addresses are written, even if the table is larger.
214 * NOTES:
215 * 1. <dom> may be specified as DOMID_SELF.
216 * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
217 * 3. Xen may not support more than a single grant-table page per domain.
218 */
219#define GNTTABOP_setup_table 2
220struct gnttab_setup_table {
221 /* IN parameters. */
222 domid_t dom;
223 uint32_t nr_frames;
224 /* OUT parameters. */
225 int16_t status; /* GNTST_* */
226 ulong *frame_list;
227};
228
229/*
230 * GNTTABOP_dump_table: Dump the contents of the grant table to the
231 * xen console. Debugging use only.
232 */
233#define GNTTABOP_dump_table 3
234struct gnttab_dump_table {
235 /* IN parameters. */
236 domid_t dom;
237 /* OUT parameters. */
238 int16_t status; /* GNTST_* */
239};
240
241/*
242 * GNTTABOP_transfer_grant_ref: Transfer <frame> to a foreign domain. The
243 * foreign domain has previously registered its interest in the transfer via
244 * <domid, ref>.
245 *
246 * Note that, even if the transfer fails, the specified page no longer belongs
247 * to the calling domain *unless* the error is GNTST_bad_page.
248 */
249#define GNTTABOP_transfer 4
250struct gnttab_transfer {
251 /* IN parameters. */
252 unsigned long mfn;
253 domid_t domid;
254 grant_ref_t ref;
255 /* OUT parameters. */
256 int16_t status;
257};
258
259
260/*
261 * GNTTABOP_copy: Hypervisor based copy
262 * source and destinations can be eithers MFNs or, for foreign domains,
263 * grant references. the foreign domain has to grant read/write access
264 * in its grant table.
265 *
266 * The flags specify what type source and destinations are (either MFN
267 * or grant reference).
268 *
269 * Note that this can also be used to copy data between two domains
270 * via a third party if the source and destination domains had previously
271 * grant appropriate access to their pages to the third party.
272 *
273 * source_offset specifies an offset in the source frame, dest_offset
274 * the offset in the target frame and len specifies the number of
275 * bytes to be copied.
276 */
277
278#define _GNTCOPY_source_gref (0)
279#define GNTCOPY_source_gref (1<<_GNTCOPY_source_gref)
280#define _GNTCOPY_dest_gref (1)
281#define GNTCOPY_dest_gref (1<<_GNTCOPY_dest_gref)
282
283#define GNTTABOP_copy 5
284struct gnttab_copy {
285 /* IN parameters. */
286 struct {
287 union {
288 grant_ref_t ref;
289 unsigned long gmfn;
290 } u;
291 domid_t domid;
292 uint16_t offset;
293 } source, dest;
294 uint16_t len;
295 uint16_t flags; /* GNTCOPY_* */
296 /* OUT parameters. */
297 int16_t status;
298};
299
300/*
301 * GNTTABOP_query_size: Query the current and maximum sizes of the shared
302 * grant table.
303 * NOTES:
304 * 1. <dom> may be specified as DOMID_SELF.
305 * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
306 */
307#define GNTTABOP_query_size 6
308struct gnttab_query_size {
309 /* IN parameters. */
310 domid_t dom;
311 /* OUT parameters. */
312 uint32_t nr_frames;
313 uint32_t max_nr_frames;
314 int16_t status; /* GNTST_* */
315};
316
317
318/*
319 * Bitfield values for update_pin_status.flags.
320 */
321 /* Map the grant entry for access by I/O devices. */
322#define _GNTMAP_device_map (0)
323#define GNTMAP_device_map (1<<_GNTMAP_device_map)
324 /* Map the grant entry for access by host CPUs. */
325#define _GNTMAP_host_map (1)
326#define GNTMAP_host_map (1<<_GNTMAP_host_map)
327 /* Accesses to the granted frame will be restricted to read-only access. */
328#define _GNTMAP_readonly (2)
329#define GNTMAP_readonly (1<<_GNTMAP_readonly)
330 /*
331 * GNTMAP_host_map subflag:
332 * 0 => The host mapping is usable only by the guest OS.
333 * 1 => The host mapping is usable by guest OS + current application.
334 */
335#define _GNTMAP_application_map (3)
336#define GNTMAP_application_map (1<<_GNTMAP_application_map)
337
338 /*
339 * GNTMAP_contains_pte subflag:
340 * 0 => This map request contains a host virtual address.
341 * 1 => This map request contains the machine addess of the PTE to update.
342 */
343#define _GNTMAP_contains_pte (4)
344#define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte)
345
346/*
347 * Values for error status returns. All errors are -ve.
348 */
349#define GNTST_okay (0) /* Normal return. */
350#define GNTST_general_error (-1) /* General undefined error. */
351#define GNTST_bad_domain (-2) /* Unrecognsed domain id. */
352#define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref. */
353#define GNTST_bad_handle (-4) /* Unrecognised or inappropriate handle. */
354#define GNTST_bad_virt_addr (-5) /* Inappropriate virtual address to map. */
355#define GNTST_bad_dev_addr (-6) /* Inappropriate device address to unmap.*/
356#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */
357#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */
358#define GNTST_bad_page (-9) /* Specified page was invalid for op. */
359#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */
360
361#define GNTTABOP_error_msgs { \
362 "okay", \
363 "undefined error", \
364 "unrecognised domain id", \
365 "invalid grant reference", \
366 "invalid mapping handle", \
367 "invalid virtual address", \
368 "invalid device address", \
369 "no spare translation slot in the I/O MMU", \
370 "permission denied", \
371 "bad page", \
372 "copy arguments cross page boundary" \
373}
374
375#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
new file mode 100644
index 000000000000..c2d1fa4dc1ee
--- /dev/null
+++ b/include/xen/interface/io/blkif.h
@@ -0,0 +1,94 @@
1/******************************************************************************
2 * blkif.h
3 *
4 * Unified block-device I/O interface for Xen guest OSes.
5 *
6 * Copyright (c) 2003-2004, Keir Fraser
7 */
8
9#ifndef __XEN_PUBLIC_IO_BLKIF_H__
10#define __XEN_PUBLIC_IO_BLKIF_H__
11
12#include "ring.h"
13#include "../grant_table.h"
14
15/*
16 * Front->back notifications: When enqueuing a new request, sending a
17 * notification can be made conditional on req_event (i.e., the generic
18 * hold-off mechanism provided by the ring macros). Backends must set
19 * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
20 *
21 * Back->front notifications: When enqueuing a new response, sending a
22 * notification can be made conditional on rsp_event (i.e., the generic
23 * hold-off mechanism provided by the ring macros). Frontends must set
24 * rsp_event appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()).
25 */
26
27typedef uint16_t blkif_vdev_t;
28typedef uint64_t blkif_sector_t;
29
30/*
31 * REQUEST CODES.
32 */
33#define BLKIF_OP_READ 0
34#define BLKIF_OP_WRITE 1
35/*
36 * Recognised only if "feature-barrier" is present in backend xenbus info.
37 * The "feature_barrier" node contains a boolean indicating whether barrier
38 * requests are likely to succeed or fail. Either way, a barrier request
39 * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
40 * the underlying block-device hardware. The boolean simply indicates whether
41 * or not it is worthwhile for the frontend to attempt barrier requests.
42 * If a backend does not recognise BLKIF_OP_WRITE_BARRIER, it should *not*
43 * create the "feature-barrier" node!
44 */
45#define BLKIF_OP_WRITE_BARRIER 2
46
47/*
48 * Maximum scatter/gather segments per request.
49 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
50 * NB. This could be 12 if the ring indexes weren't stored in the same page.
51 */
52#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
53
54struct blkif_request {
55 uint8_t operation; /* BLKIF_OP_??? */
56 uint8_t nr_segments; /* number of segments */
57 blkif_vdev_t handle; /* only for read/write requests */
58 uint64_t id; /* private guest value, echoed in resp */
59 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
60 struct blkif_request_segment {
61 grant_ref_t gref; /* reference to I/O buffer frame */
62 /* @first_sect: first sector in frame to transfer (inclusive). */
63 /* @last_sect: last sector in frame to transfer (inclusive). */
64 uint8_t first_sect, last_sect;
65 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
66};
67
68struct blkif_response {
69 uint64_t id; /* copied from request */
70 uint8_t operation; /* copied from request */
71 int16_t status; /* BLKIF_RSP_??? */
72};
73
74/*
75 * STATUS RETURN CODES.
76 */
77 /* Operation not supported (only happens on barrier writes). */
78#define BLKIF_RSP_EOPNOTSUPP -2
79 /* Operation failed for some unspecified reason (-EIO). */
80#define BLKIF_RSP_ERROR -1
81 /* Operation completed successfully. */
82#define BLKIF_RSP_OKAY 0
83
84/*
85 * Generate blkif ring structures and types.
86 */
87
88DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
89
90#define VDISK_CDROM 0x1
91#define VDISK_REMOVABLE 0x2
92#define VDISK_READONLY 0x4
93
94#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
diff --git a/include/xen/interface/io/console.h b/include/xen/interface/io/console.h
new file mode 100644
index 000000000000..e563de70f784
--- /dev/null
+++ b/include/xen/interface/io/console.h
@@ -0,0 +1,23 @@
1/******************************************************************************
2 * console.h
3 *
4 * Console I/O interface for Xen guest OSes.
5 *
6 * Copyright (c) 2005, Keir Fraser
7 */
8
9#ifndef __XEN_PUBLIC_IO_CONSOLE_H__
10#define __XEN_PUBLIC_IO_CONSOLE_H__
11
12typedef uint32_t XENCONS_RING_IDX;
13
14#define MASK_XENCONS_IDX(idx, ring) ((idx) & (sizeof(ring)-1))
15
16struct xencons_interface {
17 char in[1024];
18 char out[2048];
19 XENCONS_RING_IDX in_cons, in_prod;
20 XENCONS_RING_IDX out_cons, out_prod;
21};
22
23#endif /* __XEN_PUBLIC_IO_CONSOLE_H__ */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
new file mode 100644
index 000000000000..518481c95f18
--- /dev/null
+++ b/include/xen/interface/io/netif.h
@@ -0,0 +1,158 @@
1/******************************************************************************
2 * netif.h
3 *
4 * Unified network-device I/O interface for Xen guest OSes.
5 *
6 * Copyright (c) 2003-2004, Keir Fraser
7 */
8
9#ifndef __XEN_PUBLIC_IO_NETIF_H__
10#define __XEN_PUBLIC_IO_NETIF_H__
11
12#include "ring.h"
13#include "../grant_table.h"
14
15/*
16 * Notifications after enqueuing any type of message should be conditional on
17 * the appropriate req_event or rsp_event field in the shared ring.
18 * If the client sends notification for rx requests then it should specify
19 * feature 'feature-rx-notify' via xenbus. Otherwise the backend will assume
20 * that it cannot safely queue packets (as it may not be kicked to send them).
21 */
22
23/*
24 * This is the 'wire' format for packets:
25 * Request 1: netif_tx_request -- NETTXF_* (any flags)
26 * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info)
27 * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE)
28 * Request 4: netif_tx_request -- NETTXF_more_data
29 * Request 5: netif_tx_request -- NETTXF_more_data
30 * ...
31 * Request N: netif_tx_request -- 0
32 */
33
34/* Protocol checksum field is blank in the packet (hardware offload)? */
35#define _NETTXF_csum_blank (0)
36#define NETTXF_csum_blank (1U<<_NETTXF_csum_blank)
37
38/* Packet data has been validated against protocol checksum. */
39#define _NETTXF_data_validated (1)
40#define NETTXF_data_validated (1U<<_NETTXF_data_validated)
41
42/* Packet continues in the next request descriptor. */
43#define _NETTXF_more_data (2)
44#define NETTXF_more_data (1U<<_NETTXF_more_data)
45
46/* Packet to be followed by extra descriptor(s). */
47#define _NETTXF_extra_info (3)
48#define NETTXF_extra_info (1U<<_NETTXF_extra_info)
49
50struct xen_netif_tx_request {
51 grant_ref_t gref; /* Reference to buffer page */
52 uint16_t offset; /* Offset within buffer page */
53 uint16_t flags; /* NETTXF_* */
54 uint16_t id; /* Echoed in response message. */
55 uint16_t size; /* Packet size in bytes. */
56};
57
58/* Types of netif_extra_info descriptors. */
59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
61#define XEN_NETIF_EXTRA_TYPE_MAX (2)
62
63/* netif_extra_info flags. */
64#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
66
67/* GSO types - only TCPv4 currently supported. */
68#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
69
70/*
71 * This structure needs to fit within both netif_tx_request and
72 * netif_rx_response for compatibility.
73 */
74struct xen_netif_extra_info {
75 uint8_t type; /* XEN_NETIF_EXTRA_TYPE_* */
76 uint8_t flags; /* XEN_NETIF_EXTRA_FLAG_* */
77
78 union {
79 struct {
80 /*
81 * Maximum payload size of each segment. For
82 * example, for TCP this is just the path MSS.
83 */
84 uint16_t size;
85
86 /*
87 * GSO type. This determines the protocol of
88 * the packet and any extra features required
89 * to segment the packet properly.
90 */
91 uint8_t type; /* XEN_NETIF_GSO_TYPE_* */
92
93 /* Future expansion. */
94 uint8_t pad;
95
96 /*
97 * GSO features. This specifies any extra GSO
98 * features required to process this packet,
99 * such as ECN support for TCPv4.
100 */
101 uint16_t features; /* XEN_NETIF_GSO_FEAT_* */
102 } gso;
103
104 uint16_t pad[3];
105 } u;
106};
107
108struct xen_netif_tx_response {
109 uint16_t id;
110 int16_t status; /* NETIF_RSP_* */
111};
112
113struct xen_netif_rx_request {
114 uint16_t id; /* Echoed in response message. */
115 grant_ref_t gref; /* Reference to incoming granted frame */
116};
117
118/* Packet data has been validated against protocol checksum. */
119#define _NETRXF_data_validated (0)
120#define NETRXF_data_validated (1U<<_NETRXF_data_validated)
121
122/* Protocol checksum field is blank in the packet (hardware offload)? */
123#define _NETRXF_csum_blank (1)
124#define NETRXF_csum_blank (1U<<_NETRXF_csum_blank)
125
126/* Packet continues in the next request descriptor. */
127#define _NETRXF_more_data (2)
128#define NETRXF_more_data (1U<<_NETRXF_more_data)
129
130/* Packet to be followed by extra descriptor(s). */
131#define _NETRXF_extra_info (3)
132#define NETRXF_extra_info (1U<<_NETRXF_extra_info)
133
134struct xen_netif_rx_response {
135 uint16_t id;
136 uint16_t offset; /* Offset in page of start of received packet */
137 uint16_t flags; /* NETRXF_* */
138 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
139};
140
141/*
142 * Generate netif ring structures and types.
143 */
144
145DEFINE_RING_TYPES(xen_netif_tx,
146 struct xen_netif_tx_request,
147 struct xen_netif_tx_response);
148DEFINE_RING_TYPES(xen_netif_rx,
149 struct xen_netif_rx_request,
150 struct xen_netif_rx_response);
151
152#define NETIF_RSP_DROPPED -2
153#define NETIF_RSP_ERROR -1
154#define NETIF_RSP_OKAY 0
155/* No response: used for auxiliary requests (e.g., netif_tx_extra). */
156#define NETIF_RSP_NULL 1
157
158#endif
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
new file mode 100644
index 000000000000..e8cbf431c8cc
--- /dev/null
+++ b/include/xen/interface/io/ring.h
@@ -0,0 +1,260 @@
1/******************************************************************************
2 * ring.h
3 *
4 * Shared producer-consumer ring macros.
5 *
6 * Tim Deegan and Andrew Warfield November 2004.
7 */
8
9#ifndef __XEN_PUBLIC_IO_RING_H__
10#define __XEN_PUBLIC_IO_RING_H__
11
12typedef unsigned int RING_IDX;
13
14/* Round a 32-bit unsigned constant down to the nearest power of two. */
15#define __RD2(_x) (((_x) & 0x00000002) ? 0x2 : ((_x) & 0x1))
16#define __RD4(_x) (((_x) & 0x0000000c) ? __RD2((_x)>>2)<<2 : __RD2(_x))
17#define __RD8(_x) (((_x) & 0x000000f0) ? __RD4((_x)>>4)<<4 : __RD4(_x))
18#define __RD16(_x) (((_x) & 0x0000ff00) ? __RD8((_x)>>8)<<8 : __RD8(_x))
19#define __RD32(_x) (((_x) & 0xffff0000) ? __RD16((_x)>>16)<<16 : __RD16(_x))
20
21/*
22 * Calculate size of a shared ring, given the total available space for the
23 * ring and indexes (_sz), and the name tag of the request/response structure.
24 * A ring contains as many entries as will fit, rounded down to the nearest
25 * power of two (so we can mask with (size-1) to loop around).
26 */
27#define __RING_SIZE(_s, _sz) \
28 (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
29
30/*
31 * Macros to make the correct C datatypes for a new kind of ring.
32 *
33 * To make a new ring datatype, you need to have two message structures,
34 * let's say struct request, and struct response already defined.
35 *
36 * In a header where you want the ring datatype declared, you then do:
37 *
38 * DEFINE_RING_TYPES(mytag, struct request, struct response);
39 *
40 * These expand out to give you a set of types, as you can see below.
41 * The most important of these are:
42 *
43 * struct mytag_sring - The shared ring.
44 * struct mytag_front_ring - The 'front' half of the ring.
45 * struct mytag_back_ring - The 'back' half of the ring.
46 *
47 * To initialize a ring in your code you need to know the location and size
48 * of the shared memory area (PAGE_SIZE, for instance). To initialise
49 * the front half:
50 *
51 * struct mytag_front_ring front_ring;
52 * SHARED_RING_INIT((struct mytag_sring *)shared_page);
53 * FRONT_RING_INIT(&front_ring, (struct mytag_sring *)shared_page,
54 * PAGE_SIZE);
55 *
56 * Initializing the back follows similarly (note that only the front
57 * initializes the shared ring):
58 *
59 * struct mytag_back_ring back_ring;
60 * BACK_RING_INIT(&back_ring, (struct mytag_sring *)shared_page,
61 * PAGE_SIZE);
62 */
63
64#define DEFINE_RING_TYPES(__name, __req_t, __rsp_t) \
65 \
66/* Shared ring entry */ \
67union __name##_sring_entry { \
68 __req_t req; \
69 __rsp_t rsp; \
70}; \
71 \
72/* Shared ring page */ \
73struct __name##_sring { \
74 RING_IDX req_prod, req_event; \
75 RING_IDX rsp_prod, rsp_event; \
76 uint8_t pad[48]; \
77 union __name##_sring_entry ring[1]; /* variable-length */ \
78}; \
79 \
80/* "Front" end's private variables */ \
81struct __name##_front_ring { \
82 RING_IDX req_prod_pvt; \
83 RING_IDX rsp_cons; \
84 unsigned int nr_ents; \
85 struct __name##_sring *sring; \
86}; \
87 \
88/* "Back" end's private variables */ \
89struct __name##_back_ring { \
90 RING_IDX rsp_prod_pvt; \
91 RING_IDX req_cons; \
92 unsigned int nr_ents; \
93 struct __name##_sring *sring; \
94};
95
96/*
97 * Macros for manipulating rings.
98 *
99 * FRONT_RING_whatever works on the "front end" of a ring: here
100 * requests are pushed on to the ring and responses taken off it.
101 *
102 * BACK_RING_whatever works on the "back end" of a ring: here
103 * requests are taken off the ring and responses put on.
104 *
105 * N.B. these macros do NO INTERLOCKS OR FLOW CONTROL.
106 * This is OK in 1-for-1 request-response situations where the
107 * requestor (front end) never has more than RING_SIZE()-1
108 * outstanding requests.
109 */
110
111/* Initialising empty rings */
112#define SHARED_RING_INIT(_s) do { \
113 (_s)->req_prod = (_s)->rsp_prod = 0; \
114 (_s)->req_event = (_s)->rsp_event = 1; \
115 memset((_s)->pad, 0, sizeof((_s)->pad)); \
116} while(0)
117
118#define FRONT_RING_INIT(_r, _s, __size) do { \
119 (_r)->req_prod_pvt = 0; \
120 (_r)->rsp_cons = 0; \
121 (_r)->nr_ents = __RING_SIZE(_s, __size); \
122 (_r)->sring = (_s); \
123} while (0)
124
125#define BACK_RING_INIT(_r, _s, __size) do { \
126 (_r)->rsp_prod_pvt = 0; \
127 (_r)->req_cons = 0; \
128 (_r)->nr_ents = __RING_SIZE(_s, __size); \
129 (_r)->sring = (_s); \
130} while (0)
131
132/* Initialize to existing shared indexes -- for recovery */
133#define FRONT_RING_ATTACH(_r, _s, __size) do { \
134 (_r)->sring = (_s); \
135 (_r)->req_prod_pvt = (_s)->req_prod; \
136 (_r)->rsp_cons = (_s)->rsp_prod; \
137 (_r)->nr_ents = __RING_SIZE(_s, __size); \
138} while (0)
139
140#define BACK_RING_ATTACH(_r, _s, __size) do { \
141 (_r)->sring = (_s); \
142 (_r)->rsp_prod_pvt = (_s)->rsp_prod; \
143 (_r)->req_cons = (_s)->req_prod; \
144 (_r)->nr_ents = __RING_SIZE(_s, __size); \
145} while (0)
146
147/* How big is this ring? */
148#define RING_SIZE(_r) \
149 ((_r)->nr_ents)
150
151/* Number of free requests (for use on front side only). */
152#define RING_FREE_REQUESTS(_r) \
153 (RING_SIZE(_r) - ((_r)->req_prod_pvt - (_r)->rsp_cons))
154
155/* Test if there is an empty slot available on the front ring.
156 * (This is only meaningful from the front. )
157 */
158#define RING_FULL(_r) \
159 (RING_FREE_REQUESTS(_r) == 0)
160
161/* Test if there are outstanding messages to be processed on a ring. */
162#define RING_HAS_UNCONSUMED_RESPONSES(_r) \
163 ((_r)->sring->rsp_prod - (_r)->rsp_cons)
164
165#define RING_HAS_UNCONSUMED_REQUESTS(_r) \
166 ({ \
167 unsigned int req = (_r)->sring->req_prod - (_r)->req_cons; \
168 unsigned int rsp = RING_SIZE(_r) - \
169 ((_r)->req_cons - (_r)->rsp_prod_pvt); \
170 req < rsp ? req : rsp; \
171 })
172
173/* Direct access to individual ring elements, by index. */
174#define RING_GET_REQUEST(_r, _idx) \
175 (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))
176
177#define RING_GET_RESPONSE(_r, _idx) \
178 (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp))
179
180/* Loop termination condition: Would the specified index overflow the ring? */
181#define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \
182 (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
183
184#define RING_PUSH_REQUESTS(_r) do { \
185 wmb(); /* back sees requests /before/ updated producer index */ \
186 (_r)->sring->req_prod = (_r)->req_prod_pvt; \
187} while (0)
188
189#define RING_PUSH_RESPONSES(_r) do { \
190 wmb(); /* front sees responses /before/ updated producer index */ \
191 (_r)->sring->rsp_prod = (_r)->rsp_prod_pvt; \
192} while (0)
193
194/*
195 * Notification hold-off (req_event and rsp_event):
196 *
197 * When queueing requests or responses on a shared ring, it may not always be
198 * necessary to notify the remote end. For example, if requests are in flight
199 * in a backend, the front may be able to queue further requests without
200 * notifying the back (if the back checks for new requests when it queues
201 * responses).
202 *
203 * When enqueuing requests or responses:
204 *
205 * Use RING_PUSH_{REQUESTS,RESPONSES}_AND_CHECK_NOTIFY(). The second argument
206 * is a boolean return value. True indicates that the receiver requires an
207 * asynchronous notification.
208 *
209 * After dequeuing requests or responses (before sleeping the connection):
210 *
211 * Use RING_FINAL_CHECK_FOR_REQUESTS() or RING_FINAL_CHECK_FOR_RESPONSES().
212 * The second argument is a boolean return value. True indicates that there
213 * are pending messages on the ring (i.e., the connection should not be put
214 * to sleep).
215 *
216 * These macros will set the req_event/rsp_event field to trigger a
217 * notification on the very next message that is enqueued. If you want to
218 * create batches of work (i.e., only receive a notification after several
219 * messages have been enqueued) then you will need to create a customised
220 * version of the FINAL_CHECK macro in your own code, which sets the event
221 * field appropriately.
222 */
223
224#define RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(_r, _notify) do { \
225 RING_IDX __old = (_r)->sring->req_prod; \
226 RING_IDX __new = (_r)->req_prod_pvt; \
227 wmb(); /* back sees requests /before/ updated producer index */ \
228 (_r)->sring->req_prod = __new; \
229 mb(); /* back sees new requests /before/ we check req_event */ \
230 (_notify) = ((RING_IDX)(__new - (_r)->sring->req_event) < \
231 (RING_IDX)(__new - __old)); \
232} while (0)
233
234#define RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(_r, _notify) do { \
235 RING_IDX __old = (_r)->sring->rsp_prod; \
236 RING_IDX __new = (_r)->rsp_prod_pvt; \
237 wmb(); /* front sees responses /before/ updated producer index */ \
238 (_r)->sring->rsp_prod = __new; \
239 mb(); /* front sees new responses /before/ we check rsp_event */ \
240 (_notify) = ((RING_IDX)(__new - (_r)->sring->rsp_event) < \
241 (RING_IDX)(__new - __old)); \
242} while (0)
243
244#define RING_FINAL_CHECK_FOR_REQUESTS(_r, _work_to_do) do { \
245 (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r); \
246 if (_work_to_do) break; \
247 (_r)->sring->req_event = (_r)->req_cons + 1; \
248 mb(); \
249 (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r); \
250} while (0)
251
252#define RING_FINAL_CHECK_FOR_RESPONSES(_r, _work_to_do) do { \
253 (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r); \
254 if (_work_to_do) break; \
255 (_r)->sring->rsp_event = (_r)->rsp_cons + 1; \
256 mb(); \
257 (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r); \
258} while (0)
259
260#endif /* __XEN_PUBLIC_IO_RING_H__ */
diff --git a/include/xen/interface/io/xenbus.h b/include/xen/interface/io/xenbus.h
new file mode 100644
index 000000000000..46508c7fa399
--- /dev/null
+++ b/include/xen/interface/io/xenbus.h
@@ -0,0 +1,44 @@
1/*****************************************************************************
2 * xenbus.h
3 *
4 * Xenbus protocol details.
5 *
6 * Copyright (C) 2005 XenSource Ltd.
7 */
8
9#ifndef _XEN_PUBLIC_IO_XENBUS_H
10#define _XEN_PUBLIC_IO_XENBUS_H
11
12/* The state of either end of the Xenbus, i.e. the current communication
13 status of initialisation across the bus. States here imply nothing about
14 the state of the connection between the driver and the kernel's device
15 layers. */
16enum xenbus_state
17{
18 XenbusStateUnknown = 0,
19 XenbusStateInitialising = 1,
20 XenbusStateInitWait = 2, /* Finished early
21 initialisation, but waiting
22 for information from the peer
23 or hotplug scripts. */
24 XenbusStateInitialised = 3, /* Initialised and waiting for a
25 connection from the peer. */
26 XenbusStateConnected = 4,
27 XenbusStateClosing = 5, /* The device is being closed
28 due to an error or an unplug
29 event. */
30 XenbusStateClosed = 6
31
32};
33
34#endif /* _XEN_PUBLIC_IO_XENBUS_H */
35
36/*
37 * Local variables:
38 * c-file-style: "linux"
39 * indent-tabs-mode: t
40 * c-indent-level: 8
41 * c-basic-offset: 8
42 * tab-width: 8
43 * End:
44 */
diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h
new file mode 100644
index 000000000000..99fcffb372d1
--- /dev/null
+++ b/include/xen/interface/io/xs_wire.h
@@ -0,0 +1,87 @@
1/*
2 * Details of the "wire" protocol between Xen Store Daemon and client
3 * library or guest kernel.
4 * Copyright (C) 2005 Rusty Russell IBM Corporation
5 */
6
7#ifndef _XS_WIRE_H
8#define _XS_WIRE_H
9
10enum xsd_sockmsg_type
11{
12 XS_DEBUG,
13 XS_DIRECTORY,
14 XS_READ,
15 XS_GET_PERMS,
16 XS_WATCH,
17 XS_UNWATCH,
18 XS_TRANSACTION_START,
19 XS_TRANSACTION_END,
20 XS_INTRODUCE,
21 XS_RELEASE,
22 XS_GET_DOMAIN_PATH,
23 XS_WRITE,
24 XS_MKDIR,
25 XS_RM,
26 XS_SET_PERMS,
27 XS_WATCH_EVENT,
28 XS_ERROR,
29 XS_IS_DOMAIN_INTRODUCED
30};
31
32#define XS_WRITE_NONE "NONE"
33#define XS_WRITE_CREATE "CREATE"
34#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
35
36/* We hand errors as strings, for portability. */
37struct xsd_errors
38{
39 int errnum;
40 const char *errstring;
41};
42#define XSD_ERROR(x) { x, #x }
43static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
44 XSD_ERROR(EINVAL),
45 XSD_ERROR(EACCES),
46 XSD_ERROR(EEXIST),
47 XSD_ERROR(EISDIR),
48 XSD_ERROR(ENOENT),
49 XSD_ERROR(ENOMEM),
50 XSD_ERROR(ENOSPC),
51 XSD_ERROR(EIO),
52 XSD_ERROR(ENOTEMPTY),
53 XSD_ERROR(ENOSYS),
54 XSD_ERROR(EROFS),
55 XSD_ERROR(EBUSY),
56 XSD_ERROR(EAGAIN),
57 XSD_ERROR(EISCONN)
58};
59
60struct xsd_sockmsg
61{
62 uint32_t type; /* XS_??? */
63 uint32_t req_id;/* Request identifier, echoed in daemon's response. */
64 uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
65 uint32_t len; /* Length of data following this. */
66
67 /* Generally followed by nul-terminated string(s). */
68};
69
70enum xs_watch_type
71{
72 XS_WATCH_PATH = 0,
73 XS_WATCH_TOKEN
74};
75
76/* Inter-domain shared memory communications. */
77#define XENSTORE_RING_SIZE 1024
78typedef uint32_t XENSTORE_RING_IDX;
79#define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))
80struct xenstore_domain_interface {
81 char req[XENSTORE_RING_SIZE]; /* Requests to xenstore daemon. */
82 char rsp[XENSTORE_RING_SIZE]; /* Replies and async watch events. */
83 XENSTORE_RING_IDX req_cons, req_prod;
84 XENSTORE_RING_IDX rsp_cons, rsp_prod;
85};
86
87#endif /* _XS_WIRE_H */
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
new file mode 100644
index 000000000000..af36ead16817
--- /dev/null
+++ b/include/xen/interface/memory.h
@@ -0,0 +1,145 @@
1/******************************************************************************
2 * memory.h
3 *
4 * Memory reservation and information.
5 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
8
9#ifndef __XEN_PUBLIC_MEMORY_H__
10#define __XEN_PUBLIC_MEMORY_H__
11
12/*
13 * Increase or decrease the specified domain's memory reservation. Returns a
14 * -ve errcode on failure, or the # extents successfully allocated or freed.
15 * arg == addr of struct xen_memory_reservation.
16 */
17#define XENMEM_increase_reservation 0
18#define XENMEM_decrease_reservation 1
19#define XENMEM_populate_physmap 6
20struct xen_memory_reservation {
21
22 /*
23 * XENMEM_increase_reservation:
24 * OUT: MFN (*not* GMFN) bases of extents that were allocated
25 * XENMEM_decrease_reservation:
26 * IN: GMFN bases of extents to free
27 * XENMEM_populate_physmap:
28 * IN: GPFN bases of extents to populate with memory
29 * OUT: GMFN bases of extents that were allocated
30 * (NB. This command also updates the mach_to_phys translation table)
31 */
32 GUEST_HANDLE(ulong) extent_start;
33
34 /* Number of extents, and size/alignment of each (2^extent_order pages). */
35 unsigned long nr_extents;
36 unsigned int extent_order;
37
38 /*
39 * Maximum # bits addressable by the user of the allocated region (e.g.,
40 * I/O devices often have a 32-bit limitation even in 64-bit systems). If
41 * zero then the user has no addressing restriction.
42 * This field is not used by XENMEM_decrease_reservation.
43 */
44 unsigned int address_bits;
45
46 /*
47 * Domain whose reservation is being changed.
48 * Unprivileged domains can specify only DOMID_SELF.
49 */
50 domid_t domid;
51
52};
53DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
54
55/*
56 * Returns the maximum machine frame number of mapped RAM in this system.
57 * This command always succeeds (it never returns an error code).
58 * arg == NULL.
59 */
60#define XENMEM_maximum_ram_page 2
61
62/*
63 * Returns the current or maximum memory reservation, in pages, of the
64 * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
65 * arg == addr of domid_t.
66 */
67#define XENMEM_current_reservation 3
68#define XENMEM_maximum_reservation 4
69
70/*
71 * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
72 * mapping table. Architectures which do not have a m2p table do not implement
73 * this command.
74 * arg == addr of xen_machphys_mfn_list_t.
75 */
76#define XENMEM_machphys_mfn_list 5
77struct xen_machphys_mfn_list {
78 /*
79 * Size of the 'extent_start' array. Fewer entries will be filled if the
80 * machphys table is smaller than max_extents * 2MB.
81 */
82 unsigned int max_extents;
83
84 /*
85 * Pointer to buffer to fill with list of extent starts. If there are
86 * any large discontiguities in the machine address space, 2MB gaps in
87 * the machphys table will be represented by an MFN base of zero.
88 */
89 GUEST_HANDLE(ulong) extent_start;
90
91 /*
92 * Number of extents written to the above array. This will be smaller
93 * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
94 */
95 unsigned int nr_extents;
96};
97DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
98
99/*
100 * Sets the GPFN at which a particular page appears in the specified guest's
101 * pseudophysical address space.
102 * arg == addr of xen_add_to_physmap_t.
103 */
104#define XENMEM_add_to_physmap 7
105struct xen_add_to_physmap {
106 /* Which domain to change the mapping for. */
107 domid_t domid;
108
109 /* Source mapping space. */
110#define XENMAPSPACE_shared_info 0 /* shared info page */
111#define XENMAPSPACE_grant_table 1 /* grant table page */
112 unsigned int space;
113
114 /* Index into source mapping space. */
115 unsigned long idx;
116
117 /* GPFN where the source mapping page should appear. */
118 unsigned long gpfn;
119};
120DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
121
122/*
123 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
124 * code on failure. This call only works for auto-translated guests.
125 */
126#define XENMEM_translate_gpfn_list 8
127struct xen_translate_gpfn_list {
128 /* Which domain to translate for? */
129 domid_t domid;
130
131 /* Length of list. */
132 unsigned long nr_gpfns;
133
134 /* List of GPFNs to translate. */
135 GUEST_HANDLE(ulong) gpfn_list;
136
137 /*
138 * Output list to contain MFN translations. May be the same as the input
139 * list (in which case each input GPFN is overwritten with the output MFN).
140 */
141 GUEST_HANDLE(ulong) mfn_list;
142};
143DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
144
145#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
new file mode 100644
index 000000000000..cd6939147cb6
--- /dev/null
+++ b/include/xen/interface/physdev.h
@@ -0,0 +1,145 @@
1/*
2 * Permission is hereby granted, free of charge, to any person obtaining a copy
3 * of this software and associated documentation files (the "Software"), to
4 * deal in the Software without restriction, including without limitation the
5 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 * sell copies of the Software, and to permit persons to whom the Software is
7 * furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in
10 * all copies or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 * DEALINGS IN THE SOFTWARE.
19 */
20
21#ifndef __XEN_PUBLIC_PHYSDEV_H__
22#define __XEN_PUBLIC_PHYSDEV_H__
23
24/*
25 * Prototype for this hypercall is:
26 * int physdev_op(int cmd, void *args)
27 * @cmd == PHYSDEVOP_??? (physdev operation).
28 * @args == Operation-specific extra arguments (NULL if none).
29 */
30
31/*
32 * Notify end-of-interrupt (EOI) for the specified IRQ.
33 * @arg == pointer to physdev_eoi structure.
34 */
35#define PHYSDEVOP_eoi 12
36struct physdev_eoi {
37 /* IN */
38 uint32_t irq;
39};
40
41/*
42 * Query the status of an IRQ line.
43 * @arg == pointer to physdev_irq_status_query structure.
44 */
45#define PHYSDEVOP_irq_status_query 5
46struct physdev_irq_status_query {
47 /* IN */
48 uint32_t irq;
49 /* OUT */
50 uint32_t flags; /* XENIRQSTAT_* */
51};
52
53/* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
54#define _XENIRQSTAT_needs_eoi (0)
55#define XENIRQSTAT_needs_eoi (1U<<_XENIRQSTAT_needs_eoi)
56
57/* IRQ shared by multiple guests? */
58#define _XENIRQSTAT_shared (1)
59#define XENIRQSTAT_shared (1U<<_XENIRQSTAT_shared)
60
61/*
62 * Set the current VCPU's I/O privilege level.
63 * @arg == pointer to physdev_set_iopl structure.
64 */
65#define PHYSDEVOP_set_iopl 6
66struct physdev_set_iopl {
67 /* IN */
68 uint32_t iopl;
69};
70
71/*
72 * Set the current VCPU's I/O-port permissions bitmap.
73 * @arg == pointer to physdev_set_iobitmap structure.
74 */
75#define PHYSDEVOP_set_iobitmap 7
76struct physdev_set_iobitmap {
77 /* IN */
78 uint8_t * bitmap;
79 uint32_t nr_ports;
80};
81
82/*
83 * Read or write an IO-APIC register.
84 * @arg == pointer to physdev_apic structure.
85 */
86#define PHYSDEVOP_apic_read 8
87#define PHYSDEVOP_apic_write 9
88struct physdev_apic {
89 /* IN */
90 unsigned long apic_physbase;
91 uint32_t reg;
92 /* IN or OUT */
93 uint32_t value;
94};
95
96/*
97 * Allocate or free a physical upcall vector for the specified IRQ line.
98 * @arg == pointer to physdev_irq structure.
99 */
100#define PHYSDEVOP_alloc_irq_vector 10
101#define PHYSDEVOP_free_irq_vector 11
102struct physdev_irq {
103 /* IN */
104 uint32_t irq;
105 /* IN or OUT */
106 uint32_t vector;
107};
108
109/*
110 * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
111 * hypercall since 0x00030202.
112 */
113struct physdev_op {
114 uint32_t cmd;
115 union {
116 struct physdev_irq_status_query irq_status_query;
117 struct physdev_set_iopl set_iopl;
118 struct physdev_set_iobitmap set_iobitmap;
119 struct physdev_apic apic_op;
120 struct physdev_irq irq_op;
121 } u;
122};
123
124/*
125 * Notify that some PIRQ-bound event channels have been unmasked.
126 * ** This command is obsolete since interface version 0x00030202 and is **
127 * ** unsupported by newer versions of Xen. **
128 */
129#define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
130
131/*
132 * These all-capitals physdev operation names are superceded by the new names
133 * (defined above) since interface version 0x00030202.
134 */
135#define PHYSDEVOP_IRQ_STATUS_QUERY PHYSDEVOP_irq_status_query
136#define PHYSDEVOP_SET_IOPL PHYSDEVOP_set_iopl
137#define PHYSDEVOP_SET_IOBITMAP PHYSDEVOP_set_iobitmap
138#define PHYSDEVOP_APIC_READ PHYSDEVOP_apic_read
139#define PHYSDEVOP_APIC_WRITE PHYSDEVOP_apic_write
140#define PHYSDEVOP_ASSIGN_VECTOR PHYSDEVOP_alloc_irq_vector
141#define PHYSDEVOP_FREE_VECTOR PHYSDEVOP_free_irq_vector
142#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
143#define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared
144
145#endif /* __XEN_PUBLIC_PHYSDEV_H__ */
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
new file mode 100644
index 000000000000..5fec575a800a
--- /dev/null
+++ b/include/xen/interface/sched.h
@@ -0,0 +1,77 @@
1/******************************************************************************
2 * sched.h
3 *
4 * Scheduler state interactions
5 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
8
9#ifndef __XEN_PUBLIC_SCHED_H__
10#define __XEN_PUBLIC_SCHED_H__
11
12#include "event_channel.h"
13
14/*
15 * The prototype for this hypercall is:
16 * long sched_op_new(int cmd, void *arg)
17 * @cmd == SCHEDOP_??? (scheduler operation).
18 * @arg == Operation-specific extra argument(s), as described below.
19 *
20 * **NOTE**:
21 * Versions of Xen prior to 3.0.2 provide only the following legacy version
22 * of this hypercall, supporting only the commands yield, block and shutdown:
23 * long sched_op(int cmd, unsigned long arg)
24 * @cmd == SCHEDOP_??? (scheduler operation).
25 * @arg == 0 (SCHEDOP_yield and SCHEDOP_block)
26 * == SHUTDOWN_* code (SCHEDOP_shutdown)
27 */
28
29/*
30 * Voluntarily yield the CPU.
31 * @arg == NULL.
32 */
33#define SCHEDOP_yield 0
34
35/*
36 * Block execution of this VCPU until an event is received for processing.
37 * If called with event upcalls masked, this operation will atomically
38 * reenable event delivery and check for pending events before blocking the
39 * VCPU. This avoids a "wakeup waiting" race.
40 * @arg == NULL.
41 */
42#define SCHEDOP_block 1
43
44/*
45 * Halt execution of this domain (all VCPUs) and notify the system controller.
46 * @arg == pointer to sched_shutdown structure.
47 */
48#define SCHEDOP_shutdown 2
49struct sched_shutdown {
50 unsigned int reason; /* SHUTDOWN_* */
51};
52DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
53
54/*
55 * Poll a set of event-channel ports. Return when one or more are pending. An
56 * optional timeout may be specified.
57 * @arg == pointer to sched_poll structure.
58 */
59#define SCHEDOP_poll 3
60struct sched_poll {
61 GUEST_HANDLE(evtchn_port_t) ports;
62 unsigned int nr_ports;
63 uint64_t timeout;
64};
65DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
66
67/*
68 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
69 * software to determine the appropriate action. For the most part, Xen does
70 * not care about the shutdown code.
71 */
72#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
73#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
74#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
75#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
76
77#endif /* __XEN_PUBLIC_SCHED_H__ */
diff --git a/include/xen/interface/vcpu.h b/include/xen/interface/vcpu.h
new file mode 100644
index 000000000000..ff61ea365997
--- /dev/null
+++ b/include/xen/interface/vcpu.h
@@ -0,0 +1,167 @@
1/******************************************************************************
2 * vcpu.h
3 *
4 * VCPU initialisation, query, and hotplug.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
25 */
26
27#ifndef __XEN_PUBLIC_VCPU_H__
28#define __XEN_PUBLIC_VCPU_H__
29
30/*
31 * Prototype for this hypercall is:
32 * int vcpu_op(int cmd, int vcpuid, void *extra_args)
33 * @cmd == VCPUOP_??? (VCPU operation).
34 * @vcpuid == VCPU to operate on.
35 * @extra_args == Operation-specific extra arguments (NULL if none).
36 */
37
38/*
39 * Initialise a VCPU. Each VCPU can be initialised only once. A
40 * newly-initialised VCPU will not run until it is brought up by VCPUOP_up.
41 *
42 * @extra_arg == pointer to vcpu_guest_context structure containing initial
43 * state for the VCPU.
44 */
45#define VCPUOP_initialise 0
46
47/*
48 * Bring up a VCPU. This makes the VCPU runnable. This operation will fail
49 * if the VCPU has not been initialised (VCPUOP_initialise).
50 */
51#define VCPUOP_up 1
52
53/*
54 * Bring down a VCPU (i.e., make it non-runnable).
55 * There are a few caveats that callers should observe:
56 * 1. This operation may return, and VCPU_is_up may return false, before the
57 * VCPU stops running (i.e., the command is asynchronous). It is a good
58 * idea to ensure that the VCPU has entered a non-critical loop before
59 * bringing it down. Alternatively, this operation is guaranteed
60 * synchronous if invoked by the VCPU itself.
61 * 2. After a VCPU is initialised, there is currently no way to drop all its
62 * references to domain memory. Even a VCPU that is down still holds
63 * memory references via its pagetable base pointer and GDT. It is good
64 * practise to move a VCPU onto an 'idle' or default page table, LDT and
65 * GDT before bringing it down.
66 */
67#define VCPUOP_down 2
68
69/* Returns 1 if the given VCPU is up. */
70#define VCPUOP_is_up 3
71
72/*
73 * Return information about the state and running time of a VCPU.
74 * @extra_arg == pointer to vcpu_runstate_info structure.
75 */
76#define VCPUOP_get_runstate_info 4
77struct vcpu_runstate_info {
78 /* VCPU's current state (RUNSTATE_*). */
79 int state;
80 /* When was current state entered (system time, ns)? */
81 uint64_t state_entry_time;
82 /*
83 * Time spent in each RUNSTATE_* (ns). The sum of these times is
84 * guaranteed not to drift from system time.
85 */
86 uint64_t time[4];
87};
88
89/* VCPU is currently running on a physical CPU. */
90#define RUNSTATE_running 0
91
92/* VCPU is runnable, but not currently scheduled on any physical CPU. */
93#define RUNSTATE_runnable 1
94
95/* VCPU is blocked (a.k.a. idle). It is therefore not runnable. */
96#define RUNSTATE_blocked 2
97
98/*
99 * VCPU is not runnable, but it is not blocked.
100 * This is a 'catch all' state for things like hotplug and pauses by the
101 * system administrator (or for critical sections in the hypervisor).
102 * RUNSTATE_blocked dominates this state (it is the preferred state).
103 */
104#define RUNSTATE_offline 3
105
106/*
107 * Register a shared memory area from which the guest may obtain its own
108 * runstate information without needing to execute a hypercall.
109 * Notes:
110 * 1. The registered address may be virtual or physical, depending on the
111 * platform. The virtual address should be registered on x86 systems.
112 * 2. Only one shared area may be registered per VCPU. The shared area is
113 * updated by the hypervisor each time the VCPU is scheduled. Thus
114 * runstate.state will always be RUNSTATE_running and
115 * runstate.state_entry_time will indicate the system time at which the
116 * VCPU was last scheduled to run.
117 * @extra_arg == pointer to vcpu_register_runstate_memory_area structure.
118 */
119#define VCPUOP_register_runstate_memory_area 5
120struct vcpu_register_runstate_memory_area {
121 union {
122 struct vcpu_runstate_info *v;
123 uint64_t p;
124 } addr;
125};
126
127/*
128 * Set or stop a VCPU's periodic timer. Every VCPU has one periodic timer
129 * which can be set via these commands. Periods smaller than one millisecond
130 * may not be supported.
131 */
132#define VCPUOP_set_periodic_timer 6 /* arg == vcpu_set_periodic_timer_t */
133#define VCPUOP_stop_periodic_timer 7 /* arg == NULL */
134struct vcpu_set_periodic_timer {
135 uint64_t period_ns;
136};
137
138/*
139 * Set or stop a VCPU's single-shot timer. Every VCPU has one single-shot
140 * timer which can be set via these commands.
141 */
142#define VCPUOP_set_singleshot_timer 8 /* arg == vcpu_set_singleshot_timer_t */
143#define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
144struct vcpu_set_singleshot_timer {
145 uint64_t timeout_abs_ns;
146 uint32_t flags; /* VCPU_SSHOTTMR_??? */
147};
148
149/* Flags to VCPUOP_set_singleshot_timer. */
150 /* Require the timeout to be in the future (return -ETIME if it's passed). */
151#define _VCPU_SSHOTTMR_future (0)
152#define VCPU_SSHOTTMR_future (1U << _VCPU_SSHOTTMR_future)
153
154/*
155 * Register a memory location in the guest address space for the
156 * vcpu_info structure. This allows the guest to place the vcpu_info
157 * structure in a convenient place, such as in a per-cpu data area.
158 * The pointer need not be page aligned, but the structure must not
159 * cross a page boundary.
160 */
161#define VCPUOP_register_vcpu_info 10 /* arg == struct vcpu_info */
162struct vcpu_register_vcpu_info {
163 uint32_t mfn; /* mfn of page to place vcpu_info */
164 uint32_t offset; /* offset within page */
165};
166
167#endif /* __XEN_PUBLIC_VCPU_H__ */
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
new file mode 100644
index 000000000000..453235e923f0
--- /dev/null
+++ b/include/xen/interface/version.h
@@ -0,0 +1,60 @@
1/******************************************************************************
2 * version.h
3 *
4 * Xen version, type, and compile information.
5 *
6 * Copyright (c) 2005, Nguyen Anh Quynh <aquynh@gmail.com>
7 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
8 */
9
10#ifndef __XEN_PUBLIC_VERSION_H__
11#define __XEN_PUBLIC_VERSION_H__
12
13/* NB. All ops return zero on success, except XENVER_version. */
14
15/* arg == NULL; returns major:minor (16:16). */
16#define XENVER_version 0
17
18/* arg == xen_extraversion_t. */
19#define XENVER_extraversion 1
20struct xen_extraversion {
21 char extraversion[16];
22};
23#define XEN_EXTRAVERSION_LEN (sizeof(struct xen_extraversion))
24
25/* arg == xen_compile_info_t. */
26#define XENVER_compile_info 2
27struct xen_compile_info {
28 char compiler[64];
29 char compile_by[16];
30 char compile_domain[32];
31 char compile_date[32];
32};
33
34#define XENVER_capabilities 3
35struct xen_capabilities_info {
36 char info[1024];
37};
38#define XEN_CAPABILITIES_INFO_LEN (sizeof(struct xen_capabilities_info))
39
40#define XENVER_changeset 4
41struct xen_changeset_info {
42 char info[64];
43};
44#define XEN_CHANGESET_INFO_LEN (sizeof(struct xen_changeset_info))
45
46#define XENVER_platform_parameters 5
47struct xen_platform_parameters {
48 unsigned long virt_start;
49};
50
51#define XENVER_get_features 6
52struct xen_feature_info {
53 unsigned int submap_idx; /* IN: which 32-bit submap to return */
54 uint32_t submap; /* OUT: 32-bit submap */
55};
56
57/* Declares the features reported by XENVER_get_features. */
58#include "features.h"
59
60#endif /* __XEN_PUBLIC_VERSION_H__ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
new file mode 100644
index 000000000000..518a5bf79ed3
--- /dev/null
+++ b/include/xen/interface/xen.h
@@ -0,0 +1,447 @@
1/******************************************************************************
2 * xen.h
3 *
4 * Guest OS interface to Xen.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
8
9#ifndef __XEN_PUBLIC_XEN_H__
10#define __XEN_PUBLIC_XEN_H__
11
12#include <asm/xen/interface.h>
13
14/*
15 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
16 */
17
18/*
19 * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5.
20 * EAX = return value
21 * (argument registers may be clobbered on return)
22 * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6.
23 * RAX = return value
24 * (argument registers not clobbered on return; RCX, R11 are)
25 */
26#define __HYPERVISOR_set_trap_table 0
27#define __HYPERVISOR_mmu_update 1
28#define __HYPERVISOR_set_gdt 2
29#define __HYPERVISOR_stack_switch 3
30#define __HYPERVISOR_set_callbacks 4
31#define __HYPERVISOR_fpu_taskswitch 5
32#define __HYPERVISOR_sched_op 6
33#define __HYPERVISOR_dom0_op 7
34#define __HYPERVISOR_set_debugreg 8
35#define __HYPERVISOR_get_debugreg 9
36#define __HYPERVISOR_update_descriptor 10
37#define __HYPERVISOR_memory_op 12
38#define __HYPERVISOR_multicall 13
39#define __HYPERVISOR_update_va_mapping 14
40#define __HYPERVISOR_set_timer_op 15
41#define __HYPERVISOR_event_channel_op_compat 16
42#define __HYPERVISOR_xen_version 17
43#define __HYPERVISOR_console_io 18
44#define __HYPERVISOR_physdev_op_compat 19
45#define __HYPERVISOR_grant_table_op 20
46#define __HYPERVISOR_vm_assist 21
47#define __HYPERVISOR_update_va_mapping_otherdomain 22
48#define __HYPERVISOR_iret 23 /* x86 only */
49#define __HYPERVISOR_vcpu_op 24
50#define __HYPERVISOR_set_segment_base 25 /* x86/64 only */
51#define __HYPERVISOR_mmuext_op 26
52#define __HYPERVISOR_acm_op 27
53#define __HYPERVISOR_nmi_op 28
54#define __HYPERVISOR_sched_op_new 29
55#define __HYPERVISOR_callback_op 30
56#define __HYPERVISOR_xenoprof_op 31
57#define __HYPERVISOR_event_channel_op 32
58#define __HYPERVISOR_physdev_op 33
59#define __HYPERVISOR_hvm_op 34
60
61/*
62 * VIRTUAL INTERRUPTS
63 *
64 * Virtual interrupts that a guest OS may receive from Xen.
65 */
66#define VIRQ_TIMER 0 /* Timebase update, and/or requested timeout. */
67#define VIRQ_DEBUG 1 /* Request guest to dump debug info. */
68#define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */
69#define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */
70#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */
71#define NR_VIRQS 8
72
73/*
74 * MMU-UPDATE REQUESTS
75 *
76 * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
77 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
78 * Where the FD has some effect, it is described below.
79 * ptr[1:0] specifies the appropriate MMU_* command.
80 *
81 * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
82 * Updates an entry in a page table. If updating an L1 table, and the new
83 * table entry is valid/present, the mapped frame must belong to the FD, if
84 * an FD has been specified. If attempting to map an I/O page then the
85 * caller assumes the privilege of the FD.
86 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
87 * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
88 * ptr[:2] -- Machine address of the page-table entry to modify.
89 * val -- Value to write.
90 *
91 * ptr[1:0] == MMU_MACHPHYS_UPDATE:
92 * Updates an entry in the machine->pseudo-physical mapping table.
93 * ptr[:2] -- Machine address within the frame whose mapping to modify.
94 * The frame must belong to the FD, if one is specified.
95 * val -- Value to write into the mapping entry.
96 */
97#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
98#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
99
100/*
101 * MMU EXTENDED OPERATIONS
102 *
103 * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
104 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
105 * Where the FD has some effect, it is described below.
106 *
107 * cmd: MMUEXT_(UN)PIN_*_TABLE
108 * mfn: Machine frame number to be (un)pinned as a p.t. page.
109 * The frame must belong to the FD, if one is specified.
110 *
111 * cmd: MMUEXT_NEW_BASEPTR
112 * mfn: Machine frame number of new page-table base to install in MMU.
113 *
114 * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
115 * mfn: Machine frame number of new page-table base to install in MMU
116 * when in user space.
117 *
118 * cmd: MMUEXT_TLB_FLUSH_LOCAL
119 * No additional arguments. Flushes local TLB.
120 *
121 * cmd: MMUEXT_INVLPG_LOCAL
122 * linear_addr: Linear address to be flushed from the local TLB.
123 *
124 * cmd: MMUEXT_TLB_FLUSH_MULTI
125 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
126 *
127 * cmd: MMUEXT_INVLPG_MULTI
128 * linear_addr: Linear address to be flushed.
129 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
130 *
131 * cmd: MMUEXT_TLB_FLUSH_ALL
132 * No additional arguments. Flushes all VCPUs' TLBs.
133 *
134 * cmd: MMUEXT_INVLPG_ALL
135 * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
136 *
137 * cmd: MMUEXT_FLUSH_CACHE
138 * No additional arguments. Writes back and flushes cache contents.
139 *
140 * cmd: MMUEXT_SET_LDT
141 * linear_addr: Linear address of LDT base (NB. must be page-aligned).
142 * nr_ents: Number of entries in LDT.
143 */
144#define MMUEXT_PIN_L1_TABLE 0
145#define MMUEXT_PIN_L2_TABLE 1
146#define MMUEXT_PIN_L3_TABLE 2
147#define MMUEXT_PIN_L4_TABLE 3
148#define MMUEXT_UNPIN_TABLE 4
149#define MMUEXT_NEW_BASEPTR 5
150#define MMUEXT_TLB_FLUSH_LOCAL 6
151#define MMUEXT_INVLPG_LOCAL 7
152#define MMUEXT_TLB_FLUSH_MULTI 8
153#define MMUEXT_INVLPG_MULTI 9
154#define MMUEXT_TLB_FLUSH_ALL 10
155#define MMUEXT_INVLPG_ALL 11
156#define MMUEXT_FLUSH_CACHE 12
157#define MMUEXT_SET_LDT 13
158#define MMUEXT_NEW_USER_BASEPTR 15
159
160#ifndef __ASSEMBLY__
161struct mmuext_op {
162 unsigned int cmd;
163 union {
164 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
165 unsigned long mfn;
166 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
167 unsigned long linear_addr;
168 } arg1;
169 union {
170 /* SET_LDT */
171 unsigned int nr_ents;
172 /* TLB_FLUSH_MULTI, INVLPG_MULTI */
173 void *vcpumask;
174 } arg2;
175};
176DEFINE_GUEST_HANDLE_STRUCT(mmuext_op);
177#endif
178
179/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
180/* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap. */
181/* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer. */
182#define UVMF_NONE (0UL<<0) /* No flushing at all. */
183#define UVMF_TLB_FLUSH (1UL<<0) /* Flush entire TLB(s). */
184#define UVMF_INVLPG (2UL<<0) /* Flush only one entry. */
185#define UVMF_FLUSHTYPE_MASK (3UL<<0)
186#define UVMF_MULTI (0UL<<2) /* Flush subset of TLBs. */
187#define UVMF_LOCAL (0UL<<2) /* Flush local TLB. */
188#define UVMF_ALL (1UL<<2) /* Flush all TLBs. */
189
190/*
191 * Commands to HYPERVISOR_console_io().
192 */
193#define CONSOLEIO_write 0
194#define CONSOLEIO_read 1
195
196/*
197 * Commands to HYPERVISOR_vm_assist().
198 */
199#define VMASST_CMD_enable 0
200#define VMASST_CMD_disable 1
201#define VMASST_TYPE_4gb_segments 0
202#define VMASST_TYPE_4gb_segments_notify 1
203#define VMASST_TYPE_writable_pagetables 2
204#define VMASST_TYPE_pae_extended_cr3 3
205#define MAX_VMASST_TYPE 3
206
207#ifndef __ASSEMBLY__
208
209typedef uint16_t domid_t;
210
211/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
212#define DOMID_FIRST_RESERVED (0x7FF0U)
213
214/* DOMID_SELF is used in certain contexts to refer to oneself. */
215#define DOMID_SELF (0x7FF0U)
216
217/*
218 * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
219 * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
220 * is useful to ensure that no mappings to the OS's own heap are accidentally
221 * installed. (e.g., in Linux this could cause havoc as reference counts
222 * aren't adjusted on the I/O-mapping code path).
223 * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
224 * be specified by any calling domain.
225 */
226#define DOMID_IO (0x7FF1U)
227
228/*
229 * DOMID_XEN is used to allow privileged domains to map restricted parts of
230 * Xen's heap space (e.g., the machine_to_phys table).
231 * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
232 * the caller is privileged.
233 */
234#define DOMID_XEN (0x7FF2U)
235
236/*
237 * Send an array of these to HYPERVISOR_mmu_update().
238 * NB. The fields are natural pointer/address size for this architecture.
239 */
240struct mmu_update {
241 uint64_t ptr; /* Machine address of PTE. */
242 uint64_t val; /* New contents of PTE. */
243};
244DEFINE_GUEST_HANDLE_STRUCT(mmu_update);
245
246/*
247 * Send an array of these to HYPERVISOR_multicall().
248 * NB. The fields are natural register size for this architecture.
249 */
250struct multicall_entry {
251 unsigned long op;
252 long result;
253 unsigned long args[6];
254};
255DEFINE_GUEST_HANDLE_STRUCT(multicall_entry);
256
257/*
258 * Event channel endpoints per domain:
259 * 1024 if a long is 32 bits; 4096 if a long is 64 bits.
260 */
261#define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
262
263struct vcpu_time_info {
264 /*
265 * Updates to the following values are preceded and followed
266 * by an increment of 'version'. The guest can therefore
267 * detect updates by looking for changes to 'version'. If the
268 * least-significant bit of the version number is set then an
269 * update is in progress and the guest must wait to read a
270 * consistent set of values. The correct way to interact with
271 * the version number is similar to Linux's seqlock: see the
272 * implementations of read_seqbegin/read_seqretry.
273 */
274 uint32_t version;
275 uint32_t pad0;
276 uint64_t tsc_timestamp; /* TSC at last update of time vals. */
277 uint64_t system_time; /* Time, in nanosecs, since boot. */
278 /*
279 * Current system time:
280 * system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
281 * CPU frequency (Hz):
282 * ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
283 */
284 uint32_t tsc_to_system_mul;
285 int8_t tsc_shift;
286 int8_t pad1[3];
287}; /* 32 bytes */
288
289struct vcpu_info {
290 /*
291 * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
292 * a pending notification for a particular VCPU. It is then cleared
293 * by the guest OS /before/ checking for pending work, thus avoiding
294 * a set-and-check race. Note that the mask is only accessed by Xen
295 * on the CPU that is currently hosting the VCPU. This means that the
296 * pending and mask flags can be updated by the guest without special
297 * synchronisation (i.e., no need for the x86 LOCK prefix).
298 * This may seem suboptimal because if the pending flag is set by
299 * a different CPU then an IPI may be scheduled even when the mask
300 * is set. However, note:
301 * 1. The task of 'interrupt holdoff' is covered by the per-event-
302 * channel mask bits. A 'noisy' event that is continually being
303 * triggered can be masked at source at this very precise
304 * granularity.
305 * 2. The main purpose of the per-VCPU mask is therefore to restrict
306 * reentrant execution: whether for concurrency control, or to
307 * prevent unbounded stack usage. Whatever the purpose, we expect
308 * that the mask will be asserted only for short periods at a time,
309 * and so the likelihood of a 'spurious' IPI is suitably small.
310 * The mask is read before making an event upcall to the guest: a
311 * non-zero mask therefore guarantees that the VCPU will not receive
312 * an upcall activation. The mask is cleared when the VCPU requests
313 * to block: this avoids wakeup-waiting races.
314 */
315 uint8_t evtchn_upcall_pending;
316 uint8_t evtchn_upcall_mask;
317 unsigned long evtchn_pending_sel;
318 struct arch_vcpu_info arch;
319 struct vcpu_time_info time;
320}; /* 64 bytes (x86) */
321
322/*
323 * Xen/kernel shared data -- pointer provided in start_info.
324 * NB. We expect that this struct is smaller than a page.
325 */
326struct shared_info {
327 struct vcpu_info vcpu_info[MAX_VIRT_CPUS];
328
329 /*
330 * A domain can create "event channels" on which it can send and receive
331 * asynchronous event notifications. There are three classes of event that
332 * are delivered by this mechanism:
333 * 1. Bi-directional inter- and intra-domain connections. Domains must
334 * arrange out-of-band to set up a connection (usually by allocating
335 * an unbound 'listener' port and avertising that via a storage service
336 * such as xenstore).
337 * 2. Physical interrupts. A domain with suitable hardware-access
338 * privileges can bind an event-channel port to a physical interrupt
339 * source.
340 * 3. Virtual interrupts ('events'). A domain can bind an event-channel
341 * port to a virtual interrupt source, such as the virtual-timer
342 * device or the emergency console.
343 *
344 * Event channels are addressed by a "port index". Each channel is
345 * associated with two bits of information:
346 * 1. PENDING -- notifies the domain that there is a pending notification
347 * to be processed. This bit is cleared by the guest.
348 * 2. MASK -- if this bit is clear then a 0->1 transition of PENDING
349 * will cause an asynchronous upcall to be scheduled. This bit is only
350 * updated by the guest. It is read-only within Xen. If a channel
351 * becomes pending while the channel is masked then the 'edge' is lost
352 * (i.e., when the channel is unmasked, the guest must manually handle
353 * pending notifications as no upcall will be scheduled by Xen).
354 *
355 * To expedite scanning of pending notifications, any 0->1 pending
356 * transition on an unmasked channel causes a corresponding bit in a
357 * per-vcpu selector word to be set. Each bit in the selector covers a
358 * 'C long' in the PENDING bitfield array.
359 */
360 unsigned long evtchn_pending[sizeof(unsigned long) * 8];
361 unsigned long evtchn_mask[sizeof(unsigned long) * 8];
362
363 /*
364 * Wallclock time: updated only by control software. Guests should base
365 * their gettimeofday() syscall on this wallclock-base value.
366 */
367 uint32_t wc_version; /* Version counter: see vcpu_time_info_t. */
368 uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
369 uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
370
371 struct arch_shared_info arch;
372
373};
374
375/*
376 * Start-of-day memory layout for the initial domain (DOM0):
377 * 1. The domain is started within contiguous virtual-memory region.
378 * 2. The contiguous region begins and ends on an aligned 4MB boundary.
379 * 3. The region start corresponds to the load address of the OS image.
380 * If the load address is not 4MB aligned then the address is rounded down.
381 * 4. This the order of bootstrap elements in the initial virtual region:
382 * a. relocated kernel image
383 * b. initial ram disk [mod_start, mod_len]
384 * c. list of allocated page frames [mfn_list, nr_pages]
385 * d. start_info_t structure [register ESI (x86)]
386 * e. bootstrap page tables [pt_base, CR3 (x86)]
387 * f. bootstrap stack [register ESP (x86)]
388 * 5. Bootstrap elements are packed together, but each is 4kB-aligned.
389 * 6. The initial ram disk may be omitted.
390 * 7. The list of page frames forms a contiguous 'pseudo-physical' memory
391 * layout for the domain. In particular, the bootstrap virtual-memory
392 * region is a 1:1 mapping to the first section of the pseudo-physical map.
393 * 8. All bootstrap elements are mapped read-writable for the guest OS. The
394 * only exception is the bootstrap page table, which is mapped read-only.
395 * 9. There is guaranteed to be at least 512kB padding after the final
396 * bootstrap element. If necessary, the bootstrap virtual region is
397 * extended by an extra 4MB to ensure this.
398 */
399
400#define MAX_GUEST_CMDLINE 1024
401struct start_info {
402 /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
403 char magic[32]; /* "xen-<version>-<platform>". */
404 unsigned long nr_pages; /* Total pages allocated to this domain. */
405 unsigned long shared_info; /* MACHINE address of shared info struct. */
406 uint32_t flags; /* SIF_xxx flags. */
407 unsigned long store_mfn; /* MACHINE page number of shared page. */
408 uint32_t store_evtchn; /* Event channel for store communication. */
409 union {
410 struct {
411 unsigned long mfn; /* MACHINE page number of console page. */
412 uint32_t evtchn; /* Event channel for console page. */
413 } domU;
414 struct {
415 uint32_t info_off; /* Offset of console_info struct. */
416 uint32_t info_size; /* Size of console_info struct from start.*/
417 } dom0;
418 } console;
419 /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
420 unsigned long pt_base; /* VIRTUAL address of page directory. */
421 unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */
422 unsigned long mfn_list; /* VIRTUAL address of page-frame list. */
423 unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */
424 unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
425 int8_t cmd_line[MAX_GUEST_CMDLINE];
426};
427
428/* These flags are passed in the 'flags' field of start_info_t. */
429#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
430#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
431
432typedef uint64_t cpumap_t;
433
434typedef uint8_t xen_domain_handle_t[16];
435
436/* Turn a plain number into a C unsigned long constant. */
437#define __mk_unsigned_long(x) x ## UL
438#define mk_unsigned_long(x) __mk_unsigned_long(x)
439
440#else /* __ASSEMBLY__ */
441
442/* In assembly code we cannot use C numeric constant suffixes. */
443#define mk_unsigned_long(x) x
444
445#endif /* !__ASSEMBLY__ */
446
447#endif /* __XEN_PUBLIC_XEN_H__ */
diff --git a/include/xen/page.h b/include/xen/page.h
new file mode 100644
index 000000000000..1df6c1930578
--- /dev/null
+++ b/include/xen/page.h
@@ -0,0 +1,179 @@
1#ifndef __XEN_PAGE_H
2#define __XEN_PAGE_H
3
4#include <linux/pfn.h>
5
6#include <asm/uaccess.h>
7
8#include <xen/features.h>
9
10#ifdef CONFIG_X86_PAE
11/* Xen machine address */
12typedef struct xmaddr {
13 unsigned long long maddr;
14} xmaddr_t;
15
16/* Xen pseudo-physical address */
17typedef struct xpaddr {
18 unsigned long long paddr;
19} xpaddr_t;
20#else
21/* Xen machine address */
22typedef struct xmaddr {
23 unsigned long maddr;
24} xmaddr_t;
25
26/* Xen pseudo-physical address */
27typedef struct xpaddr {
28 unsigned long paddr;
29} xpaddr_t;
30#endif
31
32#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
33#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
34
35/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
36#define INVALID_P2M_ENTRY (~0UL)
37#define FOREIGN_FRAME_BIT (1UL<<31)
38#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
39
40extern unsigned long *phys_to_machine_mapping;
41
42static inline unsigned long pfn_to_mfn(unsigned long pfn)
43{
44 if (xen_feature(XENFEAT_auto_translated_physmap))
45 return pfn;
46
47 return phys_to_machine_mapping[(unsigned int)(pfn)] &
48 ~FOREIGN_FRAME_BIT;
49}
50
51static inline int phys_to_machine_mapping_valid(unsigned long pfn)
52{
53 if (xen_feature(XENFEAT_auto_translated_physmap))
54 return 1;
55
56 return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
57}
58
59static inline unsigned long mfn_to_pfn(unsigned long mfn)
60{
61 unsigned long pfn;
62
63 if (xen_feature(XENFEAT_auto_translated_physmap))
64 return mfn;
65
66#if 0
67 if (unlikely((mfn >> machine_to_phys_order) != 0))
68 return max_mapnr;
69#endif
70
71 pfn = 0;
72 /*
73 * The array access can fail (e.g., device space beyond end of RAM).
74 * In such cases it doesn't matter what we return (we return garbage),
75 * but we must handle the fault without crashing!
76 */
77 __get_user(pfn, &machine_to_phys_mapping[mfn]);
78
79 return pfn;
80}
81
82static inline xmaddr_t phys_to_machine(xpaddr_t phys)
83{
84 unsigned offset = phys.paddr & ~PAGE_MASK;
85 return XMADDR(PFN_PHYS((u64)pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
86}
87
88static inline xpaddr_t machine_to_phys(xmaddr_t machine)
89{
90 unsigned offset = machine.maddr & ~PAGE_MASK;
91 return XPADDR(PFN_PHYS((u64)mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
92}
93
94/*
95 * We detect special mappings in one of two ways:
96 * 1. If the MFN is an I/O page then Xen will set the m2p entry
97 * to be outside our maximum possible pseudophys range.
98 * 2. If the MFN belongs to a different domain then we will certainly
99 * not have MFN in our p2m table. Conversely, if the page is ours,
100 * then we'll have p2m(m2p(MFN))==MFN.
101 * If we detect a special mapping then it doesn't have a 'struct page'.
102 * We force !pfn_valid() by returning an out-of-range pointer.
103 *
104 * NB. These checks require that, for any MFN that is not in our reservation,
105 * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
106 * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
107 * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
108 *
109 * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
110 * use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
111 * require. In all the cases we care about, the FOREIGN_FRAME bit is
112 * masked (e.g., pfn_to_mfn()) so behaviour there is correct.
113 */
114static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
115{
116 extern unsigned long max_mapnr;
117 unsigned long pfn = mfn_to_pfn(mfn);
118 if ((pfn < max_mapnr)
119 && !xen_feature(XENFEAT_auto_translated_physmap)
120 && (phys_to_machine_mapping[pfn] != mfn))
121 return max_mapnr; /* force !pfn_valid() */
122 return pfn;
123}
124
125static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
126{
127 if (xen_feature(XENFEAT_auto_translated_physmap)) {
128 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
129 return;
130 }
131 phys_to_machine_mapping[pfn] = mfn;
132}
133
134/* VIRT <-> MACHINE conversion */
135#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
136#define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v))))
137#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
138
139#ifdef CONFIG_X86_PAE
140#define pte_mfn(_pte) (((_pte).pte_low >> PAGE_SHIFT) | \
141 (((_pte).pte_high & 0xfff) << (32-PAGE_SHIFT)))
142
143static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
144{
145 pte_t pte;
146
147 pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) |
148 (pgprot_val(pgprot) >> 32);
149 pte.pte_high &= (__supported_pte_mask >> 32);
150 pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot));
151 pte.pte_low &= __supported_pte_mask;
152
153 return pte;
154}
155
156static inline unsigned long long pte_val_ma(pte_t x)
157{
158 return ((unsigned long long)x.pte_high << 32) | x.pte_low;
159}
160#define pmd_val_ma(v) ((v).pmd)
161#define pud_val_ma(v) ((v).pgd.pgd)
162#define __pte_ma(x) ((pte_t) { .pte_low = (x), .pte_high = (x)>>32 } )
163#define __pmd_ma(x) ((pmd_t) { (x) } )
164#else /* !X86_PAE */
165#define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT)
166#define mfn_pte(pfn, prot) __pte_ma(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
167#define pte_val_ma(x) ((x).pte_low)
168#define pmd_val_ma(v) ((v).pud.pgd.pgd)
169#define __pte_ma(x) ((pte_t) { (x) } )
170#endif /* CONFIG_X86_PAE */
171
172#define pgd_val_ma(x) ((x).pgd)
173
174
175xmaddr_t arbitrary_virt_to_machine(unsigned long address);
176void make_lowmem_page_readonly(void *vaddr);
177void make_lowmem_page_readwrite(void *vaddr);
178
179#endif /* __XEN_PAGE_H */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
new file mode 100644
index 000000000000..6f7c290651ae
--- /dev/null
+++ b/include/xen/xenbus.h
@@ -0,0 +1,234 @@
1/******************************************************************************
2 * xenbus.h
3 *
4 * Talks to Xen Store to figure out what devices we have.
5 *
6 * Copyright (C) 2005 Rusty Russell, IBM Corporation
7 * Copyright (C) 2005 XenSource Ltd.
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 version 2
11 * as published by the Free Software Foundation; or, when distributed
12 * separately from the Linux kernel or incorporated into other
13 * software packages, subject to the following license:
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 * IN THE SOFTWARE.
32 */
33
34#ifndef _XEN_XENBUS_H
35#define _XEN_XENBUS_H
36
37#include <linux/device.h>
38#include <linux/notifier.h>
39#include <linux/mutex.h>
40#include <linux/completion.h>
41#include <linux/init.h>
42#include <xen/interface/xen.h>
43#include <xen/interface/grant_table.h>
44#include <xen/interface/io/xenbus.h>
45#include <xen/interface/io/xs_wire.h>
46
47/* Register callback to watch this node. */
48struct xenbus_watch
49{
50 struct list_head list;
51
52 /* Path being watched. */
53 const char *node;
54
55 /* Callback (executed in a process context with no locks held). */
56 void (*callback)(struct xenbus_watch *,
57 const char **vec, unsigned int len);
58};
59
60
61/* A xenbus device. */
62struct xenbus_device {
63 const char *devicetype;
64 const char *nodename;
65 const char *otherend;
66 int otherend_id;
67 struct xenbus_watch otherend_watch;
68 struct device dev;
69 enum xenbus_state state;
70 struct completion down;
71};
72
73static inline struct xenbus_device *to_xenbus_device(struct device *dev)
74{
75 return container_of(dev, struct xenbus_device, dev);
76}
77
78struct xenbus_device_id
79{
80 /* .../device/<device_type>/<identifier> */
81 char devicetype[32]; /* General class of device. */
82};
83
84/* A xenbus driver. */
85struct xenbus_driver {
86 char *name;
87 struct module *owner;
88 const struct xenbus_device_id *ids;
89 int (*probe)(struct xenbus_device *dev,
90 const struct xenbus_device_id *id);
91 void (*otherend_changed)(struct xenbus_device *dev,
92 enum xenbus_state backend_state);
93 int (*remove)(struct xenbus_device *dev);
94 int (*suspend)(struct xenbus_device *dev);
95 int (*suspend_cancel)(struct xenbus_device *dev);
96 int (*resume)(struct xenbus_device *dev);
97 int (*uevent)(struct xenbus_device *, char **, int, char *, int);
98 struct device_driver driver;
99 int (*read_otherend_details)(struct xenbus_device *dev);
100};
101
102static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
103{
104 return container_of(drv, struct xenbus_driver, driver);
105}
106
107int __must_check __xenbus_register_frontend(struct xenbus_driver *drv,
108 struct module *owner,
109 const char *mod_name);
110
111static inline int __must_check
112xenbus_register_frontend(struct xenbus_driver *drv)
113{
114 WARN_ON(drv->owner != THIS_MODULE);
115 return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
116}
117
118int __must_check __xenbus_register_backend(struct xenbus_driver *drv,
119 struct module *owner,
120 const char *mod_name);
121static inline int __must_check
122xenbus_register_backend(struct xenbus_driver *drv)
123{
124 WARN_ON(drv->owner != THIS_MODULE);
125 return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
126}
127
128void xenbus_unregister_driver(struct xenbus_driver *drv);
129
130struct xenbus_transaction
131{
132 u32 id;
133};
134
135/* Nil transaction ID. */
136#define XBT_NIL ((struct xenbus_transaction) { 0 })
137
138int __init xenbus_dev_init(void);
139
140char **xenbus_directory(struct xenbus_transaction t,
141 const char *dir, const char *node, unsigned int *num);
142void *xenbus_read(struct xenbus_transaction t,
143 const char *dir, const char *node, unsigned int *len);
144int xenbus_write(struct xenbus_transaction t,
145 const char *dir, const char *node, const char *string);
146int xenbus_mkdir(struct xenbus_transaction t,
147 const char *dir, const char *node);
148int xenbus_exists(struct xenbus_transaction t,
149 const char *dir, const char *node);
150int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *node);
151int xenbus_transaction_start(struct xenbus_transaction *t);
152int xenbus_transaction_end(struct xenbus_transaction t, int abort);
153
154/* Single read and scanf: returns -errno or num scanned if > 0. */
155int xenbus_scanf(struct xenbus_transaction t,
156 const char *dir, const char *node, const char *fmt, ...)
157 __attribute__((format(scanf, 4, 5)));
158
159/* Single printf and write: returns -errno or 0. */
160int xenbus_printf(struct xenbus_transaction t,
161 const char *dir, const char *node, const char *fmt, ...)
162 __attribute__((format(printf, 4, 5)));
163
164/* Generic read function: NULL-terminated triples of name,
165 * sprintf-style type string, and pointer. Returns 0 or errno.*/
166int xenbus_gather(struct xenbus_transaction t, const char *dir, ...);
167
168/* notifer routines for when the xenstore comes up */
169extern int xenstored_ready;
170int register_xenstore_notifier(struct notifier_block *nb);
171void unregister_xenstore_notifier(struct notifier_block *nb);
172
173int register_xenbus_watch(struct xenbus_watch *watch);
174void unregister_xenbus_watch(struct xenbus_watch *watch);
175void xs_suspend(void);
176void xs_resume(void);
177void xs_suspend_cancel(void);
178
179/* Used by xenbus_dev to borrow kernel's store connection. */
180void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg);
181
182struct work_struct;
183
184/* Prepare for domain suspend: then resume or cancel the suspend. */
185void xenbus_suspend(void);
186void xenbus_resume(void);
187void xenbus_probe(struct work_struct *);
188void xenbus_suspend_cancel(void);
189
190#define XENBUS_IS_ERR_READ(str) ({ \
191 if (!IS_ERR(str) && strlen(str) == 0) { \
192 kfree(str); \
193 str = ERR_PTR(-ERANGE); \
194 } \
195 IS_ERR(str); \
196})
197
198#define XENBUS_EXIST_ERR(err) ((err) == -ENOENT || (err) == -ERANGE)
199
200int xenbus_watch_path(struct xenbus_device *dev, const char *path,
201 struct xenbus_watch *watch,
202 void (*callback)(struct xenbus_watch *,
203 const char **, unsigned int));
204int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
205 void (*callback)(struct xenbus_watch *,
206 const char **, unsigned int),
207 const char *pathfmt, ...)
208 __attribute__ ((format (printf, 4, 5)));
209
210int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state new_state);
211int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn);
212int xenbus_map_ring_valloc(struct xenbus_device *dev,
213 int gnt_ref, void **vaddr);
214int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
215 grant_handle_t *handle, void *vaddr);
216
217int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr);
218int xenbus_unmap_ring(struct xenbus_device *dev,
219 grant_handle_t handle, void *vaddr);
220
221int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port);
222int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port);
223int xenbus_free_evtchn(struct xenbus_device *dev, int port);
224
225enum xenbus_state xenbus_read_driver_state(const char *path);
226
227void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt, ...);
228void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt, ...);
229
230const char *xenbus_strstate(enum xenbus_state state);
231int xenbus_dev_is_online(struct xenbus_device *dev);
232int xenbus_frontend_closed(struct xenbus_device *dev);
233
234#endif /* _XEN_XENBUS_H */