aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/spinlock.h4
-rw-r--r--include/asm-alpha/unistd.h69
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200.h118
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_sys.h3
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_twi.h57
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_usart.h123
-rw-r--r--include/asm-arm/arch-at91rm9200/board.h5
-rw-r--r--include/asm-arm/arch-at91rm9200/gpio.h18
-rw-r--r--include/asm-arm/arch-at91rm9200/hardware.h30
-rw-r--r--include/asm-arm/arch-at91rm9200/irqs.h2
-rw-r--r--include/asm-arm/arch-clps711x/entry-macro.S2
-rw-r--r--include/asm-arm/arch-clps711x/time.h2
-rw-r--r--include/asm-arm/arch-ebsa285/entry-macro.S2
-rw-r--r--include/asm-arm/arch-h720x/system.h2
-rw-r--r--include/asm-arm/arch-iop32x/debug-macro.S20
-rw-r--r--include/asm-arm/arch-iop32x/dma.h (renamed from include/asm-arm/arch-iop3xx/dma.h)4
-rw-r--r--include/asm-arm/arch-iop32x/entry-macro.S21
-rw-r--r--include/asm-arm/arch-iop32x/glantank.h13
-rw-r--r--include/asm-arm/arch-iop32x/hardware.h44
-rw-r--r--include/asm-arm/arch-iop32x/io.h (renamed from include/asm-arm/arch-iop3xx/io.h)11
-rw-r--r--include/asm-arm/arch-iop32x/iop32x.h28
-rw-r--r--include/asm-arm/arch-iop32x/iq31244.h (renamed from include/asm-arm/arch-iop3xx/iq31244.h)15
-rw-r--r--include/asm-arm/arch-iop32x/iq80321.h (renamed from include/asm-arm/arch-iop3xx/iq80321.h)15
-rw-r--r--include/asm-arm/arch-iop32x/irqs.h50
-rw-r--r--include/asm-arm/arch-iop32x/memory.h26
-rw-r--r--include/asm-arm/arch-iop32x/n2100.h19
-rw-r--r--include/asm-arm/arch-iop32x/system.h33
-rw-r--r--include/asm-arm/arch-iop32x/timex.h9
-rw-r--r--include/asm-arm/arch-iop32x/uncompress.h39
-rw-r--r--include/asm-arm/arch-iop32x/vmalloc.h5
-rw-r--r--include/asm-arm/arch-iop33x/debug-macro.S24
-rw-r--r--include/asm-arm/arch-iop33x/dma.h9
-rw-r--r--include/asm-arm/arch-iop33x/entry-macro.S22
-rw-r--r--include/asm-arm/arch-iop33x/hardware.h46
-rw-r--r--include/asm-arm/arch-iop33x/io.h21
-rw-r--r--include/asm-arm/arch-iop33x/iop33x.h33
-rw-r--r--include/asm-arm/arch-iop33x/iq80331.h (renamed from include/asm-arm/arch-iop3xx/iq80331.h)15
-rw-r--r--include/asm-arm/arch-iop33x/iq80332.h (renamed from include/asm-arm/arch-iop3xx/iq80332.h)15
-rw-r--r--include/asm-arm/arch-iop33x/irqs.h60
-rw-r--r--include/asm-arm/arch-iop33x/memory.h26
-rw-r--r--include/asm-arm/arch-iop33x/system.h22
-rw-r--r--include/asm-arm/arch-iop33x/timex.h9
-rw-r--r--include/asm-arm/arch-iop33x/uncompress.h37
-rw-r--r--include/asm-arm/arch-iop33x/vmalloc.h5
-rw-r--r--include/asm-arm/arch-iop3xx/debug-macro.S35
-rw-r--r--include/asm-arm/arch-iop3xx/entry-macro.S57
-rw-r--r--include/asm-arm/arch-iop3xx/hardware.h57
-rw-r--r--include/asm-arm/arch-iop3xx/iop321-irqs.h100
-rw-r--r--include/asm-arm/arch-iop3xx/iop321.h345
-rw-r--r--include/asm-arm/arch-iop3xx/iop331-irqs.h132
-rw-r--r--include/asm-arm/arch-iop3xx/iop331.h363
-rw-r--r--include/asm-arm/arch-iop3xx/irqs.h21
-rw-r--r--include/asm-arm/arch-iop3xx/memory.h38
-rw-r--r--include/asm-arm/arch-iop3xx/system.h35
-rw-r--r--include/asm-arm/arch-iop3xx/timex.h20
-rw-r--r--include/asm-arm/arch-iop3xx/uncompress.h48
-rw-r--r--include/asm-arm/arch-iop3xx/vmalloc.h16
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h5
-rw-r--r--include/asm-arm/arch-ixp4xx/system.h2
-rw-r--r--include/asm-arm/arch-l7200/io.h8
-rw-r--r--include/asm-arm/arch-l7200/time.h2
-rw-r--r--include/asm-arm/arch-lh7a40x/clocks.h2
-rw-r--r--include/asm-arm/arch-omap/board-ams-delta.h11
-rw-r--r--include/asm-arm/arch-omap/clock.h1
-rw-r--r--include/asm-arm/arch-omap/dma.h16
-rw-r--r--include/asm-arm/arch-omap/dmtimer.h4
-rw-r--r--include/asm-arm/arch-omap/gpmc.h4
-rw-r--r--include/asm-arm/arch-omap/irqs.h2
-rw-r--r--include/asm-arm/arch-omap/keypad.h3
-rw-r--r--include/asm-arm/arch-omap/mcbsp.h2
-rw-r--r--include/asm-arm/arch-omap/mux.h25
-rw-r--r--include/asm-arm/arch-omap/pm.h2
-rw-r--r--include/asm-arm/arch-pnx4008/clock.h1
-rw-r--r--include/asm-arm/arch-pnx4008/platform.h2
-rw-r--r--include/asm-arm/arch-pxa/pxafb.h14
-rw-r--r--include/asm-arm/arch-pxa/spitz.h4
-rw-r--r--include/asm-arm/arch-pxa/udc.h8
-rw-r--r--include/asm-arm/arch-s3c2410/dma.h66
-rw-r--r--include/asm-arm/arch-s3c2410/fb.h2
-rw-r--r--include/asm-arm/arch-s3c2410/map.h5
-rw-r--r--include/asm-arm/arch-s3c2410/osiris-map.h18
-rw-r--r--include/asm-arm/arch-s3c2410/regs-ac97.h23
-rw-r--r--include/asm-arm/arch-s3c2410/regs-adc.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-clock.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-dsc.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpioj.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-iis.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-irq.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-lcd.h32
-rw-r--r--include/asm-arm/arch-s3c2410/regs-rtc.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-sdi.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-timer.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-udc.h2
-rw-r--r--include/asm-arm/arch-s3c2410/spi-gpio.h2
-rw-r--r--include/asm-arm/arch-sa1100/neponset.h2
-rw-r--r--include/asm-arm/arch-sa1100/uncompress.h2
-rw-r--r--include/asm-arm/arch-shark/vmalloc.h2
-rw-r--r--include/asm-arm/atomic.h16
-rw-r--r--include/asm-arm/bitops.h24
-rw-r--r--include/asm-arm/cacheflush.h22
-rw-r--r--include/asm-arm/flat.h16
-rw-r--r--include/asm-arm/hardware/debug-8250.S2
-rw-r--r--include/asm-arm/hardware/debug-pl01x.S2
-rw-r--r--include/asm-arm/hardware/entry-macro-iomd.S2
-rw-r--r--include/asm-arm/hardware/iop3xx.h301
-rw-r--r--include/asm-arm/hardware/locomo.h33
-rw-r--r--include/asm-arm/hardware/sa1111.h2
-rw-r--r--include/asm-arm/hardware/sharpsl_pm.h1
-rw-r--r--include/asm-arm/io.h4
-rw-r--r--include/asm-arm/irqflags.h132
-rw-r--r--include/asm-arm/mach/pci.h10
-rw-r--r--include/asm-arm/mach/serial_at91.h8
-rw-r--r--include/asm-arm/mach/time.h2
-rw-r--r--include/asm-arm/page.h3
-rw-r--r--include/asm-arm/pgtable-nommu.h1
-rw-r--r--include/asm-arm/pgtable.h7
-rw-r--r--include/asm-arm/proc-fns.h40
-rw-r--r--include/asm-arm/setup.h12
-rw-r--r--include/asm-arm/spinlock.h4
-rw-r--r--include/asm-arm/system.h137
-rw-r--r--include/asm-arm/tlbflush.h76
-rw-r--r--include/asm-arm/unaligned.h62
-rw-r--r--include/asm-arm/unistd.h27
-rw-r--r--include/asm-arm26/assembler.h2
-rw-r--r--include/asm-arm26/namei.h2
-rw-r--r--include/asm-arm26/semaphore.h2
-rw-r--r--include/asm-arm26/unistd.h27
-rw-r--r--include/asm-avr32/arch-at32ap/at91rm9200_usart.h123
-rw-r--r--include/asm-avr32/arch-at32ap/board.h10
-rw-r--r--include/asm-avr32/arch-at32ap/init.h1
-rw-r--r--include/asm-avr32/mach/serial_at91.h8
-rw-r--r--include/asm-avr32/unistd.h80
-rw-r--r--include/asm-cris/arch-v32/spinlock.h4
-rw-r--r--include/asm-cris/unistd.h61
-rw-r--r--include/asm-frv/namei.h2
-rw-r--r--include/asm-frv/pgtable.h2
-rw-r--r--include/asm-frv/timex.h5
-rw-r--r--include/asm-frv/unistd.h28
-rw-r--r--include/asm-generic/bug.h32
-rw-r--r--include/asm-generic/mutex-dec.h2
-rw-r--r--include/asm-generic/mutex-null.h2
-rw-r--r--include/asm-generic/mutex-xchg.h2
-rw-r--r--include/asm-generic/pgtable.h37
-rw-r--r--include/asm-generic/rtc.h2
-rw-r--r--include/asm-generic/tlb.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h6
-rw-r--r--include/asm-h8300/keyboard.h8
-rw-r--r--include/asm-h8300/unistd.h57
-rw-r--r--include/asm-i386/acpi.h14
-rw-r--r--include/asm-i386/alternative-asm.i12
-rw-r--r--include/asm-i386/apic.h16
-rw-r--r--include/asm-i386/bugs.h2
-rw-r--r--include/asm-i386/desc.h121
-rw-r--r--include/asm-i386/dma-mapping.h12
-rw-r--r--include/asm-i386/dwarf2.h11
-rw-r--r--include/asm-i386/e820.h2
-rw-r--r--include/asm-i386/elf.h2
-rw-r--r--include/asm-i386/frame.i23
-rw-r--r--include/asm-i386/genapic.h69
-rw-r--r--include/asm-i386/hw_irq.h3
-rw-r--r--include/asm-i386/hypertransport.h42
-rw-r--r--include/asm-i386/intel_arch_perfmon.h14
-rw-r--r--include/asm-i386/io_apic.h53
-rw-r--r--include/asm-i386/kexec.h27
-rw-r--r--include/asm-i386/mach-default/do_timer.h2
-rw-r--r--include/asm-i386/mach-default/irq_vectors_limits.h5
-rw-r--r--include/asm-i386/mach-es7000/mach_apic.h4
-rw-r--r--include/asm-i386/mach-summit/mach_apic.h13
-rw-r--r--include/asm-i386/mach-visws/do_timer.h2
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h2
-rw-r--r--include/asm-i386/mca_dma.h3
-rw-r--r--include/asm-i386/msi.h23
-rw-r--r--include/asm-i386/msidef.h47
-rw-r--r--include/asm-i386/mutex.h16
-rw-r--r--include/asm-i386/nmi.h43
-rw-r--r--include/asm-i386/pgtable-2level.h1
-rw-r--r--include/asm-i386/pgtable-3level.h16
-rw-r--r--include/asm-i386/pgtable.h82
-rw-r--r--include/asm-i386/ptrace.h12
-rw-r--r--include/asm-i386/rwlock.h48
-rw-r--r--include/asm-i386/rwsem.h62
-rw-r--r--include/asm-i386/segment.h17
-rw-r--r--include/asm-i386/semaphore.h53
-rw-r--r--include/asm-i386/smp.h24
-rw-r--r--include/asm-i386/spinlock.h138
-rw-r--r--include/asm-i386/stacktrace.h1
-rw-r--r--include/asm-i386/therm_throt.h9
-rw-r--r--include/asm-i386/tlbflush.h4
-rw-r--r--include/asm-i386/topology.h1
-rw-r--r--include/asm-i386/tsc.h1
-rw-r--r--include/asm-i386/unistd.h47
-rw-r--r--include/asm-i386/unwind.h8
-rw-r--r--include/asm-ia64/esi.h30
-rw-r--r--include/asm-ia64/futex.h122
-rw-r--r--include/asm-ia64/kprobes.h9
-rw-r--r--include/asm-ia64/machvec.h21
-rw-r--r--include/asm-ia64/machvec_sn2.h9
-rw-r--r--include/asm-ia64/mca_asm.h2
-rw-r--r--include/asm-ia64/meminit.h1
-rw-r--r--include/asm-ia64/module.h3
-rw-r--r--include/asm-ia64/msi.h29
-rw-r--r--include/asm-ia64/numa.h2
-rw-r--r--include/asm-ia64/pal.h16
-rw-r--r--include/asm-ia64/processor.h13
-rw-r--r--include/asm-ia64/ptrace.h3
-rw-r--r--include/asm-ia64/smp.h1
-rw-r--r--include/asm-ia64/spinlock.h4
-rw-r--r--include/asm-ia64/topology.h2
-rw-r--r--include/asm-ia64/unistd.h75
-rw-r--r--include/asm-m32r/m32104ut/m32104ut_pld.h2
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_lan.h2
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_lcd.h2
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_pld.h2
-rw-r--r--include/asm-m32r/mappi2/mappi2_pld.h2
-rw-r--r--include/asm-m32r/mappi3/mappi3_pld.h2
-rw-r--r--include/asm-m32r/opsput/opsput_lan.h2
-rw-r--r--include/asm-m32r/opsput/opsput_lcd.h2
-rw-r--r--include/asm-m32r/opsput/opsput_pld.h2
-rw-r--r--include/asm-m32r/pgtable-2level.h2
-rw-r--r--include/asm-m32r/spinlock.h13
-rw-r--r--include/asm-m32r/system.h4
-rw-r--r--include/asm-m32r/timex.h3
-rw-r--r--include/asm-m32r/unistd.h42
-rw-r--r--include/asm-m68k/rtc.h2
-rw-r--r--include/asm-m68k/unistd.h11
-rw-r--r--include/asm-m68knommu/processor.h2
-rw-r--r--include/asm-m68knommu/unistd.h60
-rw-r--r--include/asm-mips/Kbuild2
-rw-r--r--include/asm-mips/bootinfo.h15
-rw-r--r--include/asm-mips/cacheflush.h12
-rw-r--r--include/asm-mips/fcntl.h2
-rw-r--r--include/asm-mips/galileo-boards/ev96100.h55
-rw-r--r--include/asm-mips/galileo-boards/ev96100int.h12
-rw-r--r--include/asm-mips/galileo-boards/gt96100.h427
-rw-r--r--include/asm-mips/hazards.h360
-rw-r--r--include/asm-mips/irq.h4
-rw-r--r--include/asm-mips/irqflags.h25
-rw-r--r--include/asm-mips/it8172/it8172.h348
-rw-r--r--include/asm-mips/it8172/it8172_cir.h140
-rw-r--r--include/asm-mips/it8172/it8172_dbg.h38
-rw-r--r--include/asm-mips/it8172/it8172_int.h144
-rw-r--r--include/asm-mips/it8172/it8172_pci.h108
-rw-r--r--include/asm-mips/it8712.h28
-rw-r--r--include/asm-mips/mach-atlas/mc146818rtc.h4
-rw-r--r--include/asm-mips/mach-ev64120/mach-gt64120.h1
-rw-r--r--include/asm-mips/mach-ev96100/mach-gt64120.h46
-rw-r--r--include/asm-mips/mach-excite/excite.h2
-rw-r--r--include/asm-mips/mach-excite/excite_fpga.h80
-rw-r--r--include/asm-mips/mach-ip27/topology.h1
-rw-r--r--include/asm-mips/mach-pnx8550/uart.h14
-rw-r--r--include/asm-mips/mach-qemu/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mips-boards/atlasint.h124
-rw-r--r--include/asm-mips/mmu_context.h8
-rw-r--r--include/asm-mips/page.h11
-rw-r--r--include/asm-mips/pgtable-64.h6
-rw-r--r--include/asm-mips/ptrace.h6
-rw-r--r--include/asm-mips/serial.h55
-rw-r--r--include/asm-mips/sibyte/sb1250_defs.h6
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h2
-rw-r--r--include/asm-mips/signal.h11
-rw-r--r--include/asm-mips/spinlock.h51
-rw-r--r--include/asm-mips/stacktrace.h44
-rw-r--r--include/asm-mips/timex.h4
-rw-r--r--include/asm-mips/tx4938/tx4938_mips.h2
-rw-r--r--include/asm-mips/unistd.h63
-rw-r--r--include/asm-mips/user.h4
-rw-r--r--include/asm-parisc/agp.h25
-rw-r--r--include/asm-parisc/assembly.h6
-rw-r--r--include/asm-parisc/cacheflush.h30
-rw-r--r--include/asm-parisc/compat.h4
-rw-r--r--include/asm-parisc/dma.h7
-rw-r--r--include/asm-parisc/futex.h71
-rw-r--r--include/asm-parisc/io.h2
-rw-r--r--include/asm-parisc/iosapic.h53
-rw-r--r--include/asm-parisc/irq.h6
-rw-r--r--include/asm-parisc/mckinley.h9
-rw-r--r--include/asm-parisc/page.h22
-rw-r--r--include/asm-parisc/param.h10
-rw-r--r--include/asm-parisc/parisc-device.h5
-rw-r--r--include/asm-parisc/pci.h5
-rw-r--r--include/asm-parisc/prefetch.h39
-rw-r--r--include/asm-parisc/processor.h39
-rw-r--r--include/asm-parisc/ropes.h322
-rw-r--r--include/asm-parisc/rtc.h2
-rw-r--r--include/asm-parisc/serial.h16
-rw-r--r--include/asm-parisc/spinlock.h119
-rw-r--r--include/asm-parisc/unistd.h86
-rw-r--r--include/asm-powerpc/bug.h12
-rw-r--r--include/asm-powerpc/firmware.h67
-rw-r--r--include/asm-powerpc/fs_pd.h45
-rw-r--r--include/asm-powerpc/immap_qe.h477
-rw-r--r--include/asm-powerpc/io.h1
-rw-r--r--include/asm-powerpc/ipic.h2
-rw-r--r--include/asm-powerpc/irq.h1
-rw-r--r--include/asm-powerpc/kprobes.h22
-rw-r--r--include/asm-powerpc/mpc85xx.h53
-rw-r--r--include/asm-powerpc/pci-bridge.h1
-rw-r--r--include/asm-powerpc/ptrace.h2
-rw-r--r--include/asm-powerpc/qe.h457
-rw-r--r--include/asm-powerpc/qe_ic.h64
-rw-r--r--include/asm-powerpc/spinlock.h4
-rw-r--r--include/asm-powerpc/system.h4
-rw-r--r--include/asm-powerpc/time.h6
-rw-r--r--include/asm-powerpc/topology.h1
-rw-r--r--include/asm-powerpc/ucc.h84
-rw-r--r--include/asm-powerpc/ucc_fast.h243
-rw-r--r--include/asm-powerpc/ucc_slow.h289
-rw-r--r--include/asm-powerpc/unistd.h7
-rw-r--r--include/asm-powerpc/xmon.h26
-rw-r--r--include/asm-ppc/cpm2.h63
-rw-r--r--include/asm-ppc/fs_pd.h36
-rw-r--r--include/asm-ppc/mv64x60_defs.h2
-rw-r--r--include/asm-ppc/rheap.h6
-rw-r--r--include/asm-ppc/rtc.h2
-rw-r--r--include/asm-ppc/spinlock.h4
-rw-r--r--include/asm-s390/appldata.h2
-rw-r--r--include/asm-s390/atomic.h120
-rw-r--r--include/asm-s390/bitops.h626
-rw-r--r--include/asm-s390/byteorder.h50
-rw-r--r--include/asm-s390/checksum.h176
-rw-r--r--include/asm-s390/div64.h48
-rw-r--r--include/asm-s390/ebcdic.h20
-rw-r--r--include/asm-s390/io.h19
-rw-r--r--include/asm-s390/irq.h3
-rw-r--r--include/asm-s390/irqflags.h110
-rw-r--r--include/asm-s390/lowcore.h2
-rw-r--r--include/asm-s390/page.h112
-rw-r--r--include/asm-s390/pgalloc.h2
-rw-r--r--include/asm-s390/pgtable.h94
-rw-r--r--include/asm-s390/processor.h130
-rw-r--r--include/asm-s390/ptrace.h3
-rw-r--r--include/asm-s390/qdio.h2
-rw-r--r--include/asm-s390/rwsem.h238
-rw-r--r--include/asm-s390/semaphore.h16
-rw-r--r--include/asm-s390/setup.h1
-rw-r--r--include/asm-s390/sfp-machine.h64
-rw-r--r--include/asm-s390/sigp.h65
-rw-r--r--include/asm-s390/smp.h2
-rw-r--r--include/asm-s390/spinlock.h62
-rw-r--r--include/asm-s390/spinlock_types.h6
-rw-r--r--include/asm-s390/string.h56
-rw-r--r--include/asm-s390/system.h342
-rw-r--r--include/asm-s390/timex.h19
-rw-r--r--include/asm-s390/tlbflush.h32
-rw-r--r--include/asm-s390/uaccess.h13
-rw-r--r--include/asm-s390/unistd.h317
-rw-r--r--include/asm-sh/.gitignore3
-rw-r--r--include/asm-sh/addrspace.h8
-rw-r--r--include/asm-sh/adx/io.h86
-rw-r--r--include/asm-sh/apm.h46
-rw-r--r--include/asm-sh/atomic.h106
-rw-r--r--include/asm-sh/auxvec.h14
-rw-r--r--include/asm-sh/bigsur/io.h2
-rw-r--r--include/asm-sh/bigsur/serial.h2
-rw-r--r--include/asm-sh/bitops.h16
-rw-r--r--include/asm-sh/bugs.h6
-rw-r--r--include/asm-sh/cache.h30
-rw-r--r--include/asm-sh/cacheflush.h3
-rw-r--r--include/asm-sh/cat68701/io.h22
-rw-r--r--include/asm-sh/checksum.h2
-rw-r--r--include/asm-sh/cpu-features.h24
-rw-r--r--include/asm-sh/cpu-sh2/shmparam.h16
-rw-r--r--include/asm-sh/cpu-sh3/cache.h4
-rw-r--r--include/asm-sh/cpu-sh3/cacheflush.h52
-rw-r--r--include/asm-sh/cpu-sh3/freq.h4
-rw-r--r--include/asm-sh/cpu-sh3/mmu_context.h8
-rw-r--r--include/asm-sh/cpu-sh3/rtc.h25
-rw-r--r--include/asm-sh/cpu-sh3/shmparam.h16
-rw-r--r--include/asm-sh/cpu-sh3/timer.h8
-rw-r--r--include/asm-sh/cpu-sh3/ubc.h15
-rw-r--r--include/asm-sh/cpu-sh4/addrspace.h3
-rw-r--r--include/asm-sh/cpu-sh4/cache.h2
-rw-r--r--include/asm-sh/cpu-sh4/cacheflush.h36
-rw-r--r--include/asm-sh/cpu-sh4/dma-sh7780.h39
-rw-r--r--include/asm-sh/cpu-sh4/dma.h11
-rw-r--r--include/asm-sh/cpu-sh4/rtc.h25
-rw-r--r--include/asm-sh/cpu-sh4/shmparam.h19
-rw-r--r--include/asm-sh/cpu-sh4/sq.h23
-rw-r--r--include/asm-sh/cqreek/cqreek.h27
-rw-r--r--include/asm-sh/dma-mapping.h42
-rw-r--r--include/asm-sh/dma.h1
-rw-r--r--include/asm-sh/dmida/io.h10
-rw-r--r--include/asm-sh/dreamcast/sysasic.h2
-rw-r--r--include/asm-sh/ec3104/keyboard.h2
-rw-r--r--include/asm-sh/elf.h29
-rw-r--r--include/asm-sh/fixmap.h2
-rw-r--r--include/asm-sh/flat.h2
-rw-r--r--include/asm-sh/harp/harp.h43
-rw-r--r--include/asm-sh/harp/io.h10
-rw-r--r--include/asm-sh/hd64461.h (renamed from include/asm-sh/hd64461/hd64461.h)56
-rw-r--r--include/asm-sh/hd64461/io.h43
-rw-r--r--include/asm-sh/hd64465/io.h2
-rw-r--r--include/asm-sh/hp6xx/hp6xx.h53
-rw-r--r--include/asm-sh/hp6xx/io.h2
-rw-r--r--include/asm-sh/hs7751rvoip/hs7751rvoip.h11
-rw-r--r--include/asm-sh/hs7751rvoip/io.h39
-rw-r--r--include/asm-sh/io.h16
-rw-r--r--include/asm-sh/irq-sh73180.h2
-rw-r--r--include/asm-sh/irq-sh7343.h317
-rw-r--r--include/asm-sh/irq-sh7780.h5
-rw-r--r--include/asm-sh/irq.h137
-rw-r--r--include/asm-sh/kexec.h9
-rw-r--r--include/asm-sh/kgdb.h15
-rw-r--r--include/asm-sh/landisk/gio.h45
-rw-r--r--include/asm-sh/landisk/ide.h14
-rw-r--r--include/asm-sh/landisk/iodata_landisk.h79
-rw-r--r--include/asm-sh/machvec.h7
-rw-r--r--include/asm-sh/mc146818rtc.h169
-rw-r--r--include/asm-sh/mmu.h77
-rw-r--r--include/asm-sh/mmu_context.h15
-rw-r--r--include/asm-sh/mpc1211/io.h2
-rw-r--r--include/asm-sh/mpc1211/keyboard.h4
-rw-r--r--include/asm-sh/overdrive/fpga.h15
-rw-r--r--include/asm-sh/overdrive/gt64111.h109
-rw-r--r--include/asm-sh/overdrive/io.h39
-rw-r--r--include/asm-sh/overdrive/overdrive.h88
-rw-r--r--include/asm-sh/page.h33
-rw-r--r--include/asm-sh/pci.h44
-rw-r--r--include/asm-sh/pgalloc.h37
-rw-r--r--include/asm-sh/pgtable.h154
-rw-r--r--include/asm-sh/pm.h17
-rw-r--r--include/asm-sh/processor.h52
-rw-r--r--include/asm-sh/r7780rp/ide.h8
-rw-r--r--include/asm-sh/r7780rp/r7780rp.h177
-rw-r--r--include/asm-sh/rtc.h25
-rw-r--r--include/asm-sh/rts7751r2d/io.h37
-rw-r--r--include/asm-sh/rts7751r2d/rts7751r2d.h5
-rw-r--r--include/asm-sh/scatterlist.h9
-rw-r--r--include/asm-sh/sci.h34
-rw-r--r--include/asm-sh/se.h (renamed from include/asm-sh/se/se.h)3
-rw-r--r--include/asm-sh/se/io.h35
-rw-r--r--include/asm-sh/se7300.h (renamed from include/asm-sh/se7300/se7300.h)3
-rw-r--r--include/asm-sh/se7300/io.h29
-rw-r--r--include/asm-sh/se73180.h (renamed from include/asm-sh/se73180/se73180.h)3
-rw-r--r--include/asm-sh/se73180/io.h32
-rw-r--r--include/asm-sh/se7343.h82
-rw-r--r--include/asm-sh/se7751.h (renamed from include/asm-sh/se7751/se7751.h)3
-rw-r--r--include/asm-sh/se7751/io.h42
-rw-r--r--include/asm-sh/setup.h2
-rw-r--r--include/asm-sh/sfp-machine.h84
-rw-r--r--include/asm-sh/sh03/io.h10
-rw-r--r--include/asm-sh/sh2000/sh2000.h8
-rw-r--r--include/asm-sh/shmin/shmin.h9
-rw-r--r--include/asm-sh/shmparam.h20
-rw-r--r--include/asm-sh/smc37c93x.h (renamed from include/asm-sh/se/smc37c93x.h)0
-rw-r--r--include/asm-sh/smp.h5
-rw-r--r--include/asm-sh/snapgear.h (renamed from include/asm-sh/snapgear/io.h)31
-rw-r--r--include/asm-sh/spinlock.h13
-rw-r--r--include/asm-sh/string.h15
-rw-r--r--include/asm-sh/system.h199
-rw-r--r--include/asm-sh/systemh/io.h43
-rw-r--r--include/asm-sh/systemh7751.h (renamed from include/asm-sh/systemh/7751systemh.h)3
-rw-r--r--include/asm-sh/thread_info.h43
-rw-r--r--include/asm-sh/timer.h2
-rw-r--r--include/asm-sh/titan.h43
-rw-r--r--include/asm-sh/uaccess.h79
-rw-r--r--include/asm-sh/unistd.h121
-rw-r--r--include/asm-sh/voyagergx.h (renamed from include/asm-sh/rts7751r2d/voyagergx_reg.h)2
-rw-r--r--include/asm-sh/watchdog.h3
-rw-r--r--include/asm-sh64/keyboard.h4
-rw-r--r--include/asm-sh64/serial.h2
-rw-r--r--include/asm-sh64/timex.h3
-rw-r--r--include/asm-sh64/unistd.h47
-rw-r--r--include/asm-sparc/reg.h2
-rw-r--r--include/asm-sparc/spinlock.h4
-rw-r--r--include/asm-sparc/unistd.h47
-rw-r--r--include/asm-sparc64/compat_signal.h29
-rw-r--r--include/asm-sparc64/signal.h42
-rw-r--r--include/asm-sparc64/spinlock.h4
-rw-r--r--include/asm-sparc64/unistd.h42
-rw-r--r--include/asm-um/alternative-asm.i6
-rw-r--r--include/asm-um/frame.i6
-rw-r--r--include/asm-um/pgtable.h6
-rw-r--r--include/asm-um/processor-generic.h6
-rw-r--r--include/asm-um/ptrace-x86_64.h3
-rw-r--r--include/asm-um/unistd.h28
-rw-r--r--include/asm-v850/unistd.h56
-rw-r--r--include/asm-x86_64/acpi.h2
-rw-r--r--include/asm-x86_64/alternative-asm.i12
-rw-r--r--include/asm-x86_64/apic.h9
-rw-r--r--include/asm-x86_64/bitops.h2
-rw-r--r--include/asm-x86_64/cache.h2
-rw-r--r--include/asm-x86_64/calgary.h7
-rw-r--r--include/asm-x86_64/dma-mapping.h7
-rw-r--r--include/asm-x86_64/dwarf2.h8
-rw-r--r--include/asm-x86_64/e820.h14
-rw-r--r--include/asm-x86_64/fixmap.h4
-rw-r--r--include/asm-x86_64/genapic.h1
-rw-r--r--include/asm-x86_64/hardirq.h3
-rw-r--r--include/asm-x86_64/hw_irq.h8
-rw-r--r--include/asm-x86_64/hypertransport.h42
-rw-r--r--include/asm-x86_64/i387.h9
-rw-r--r--include/asm-x86_64/intel_arch_perfmon.h14
-rw-r--r--include/asm-x86_64/io_apic.h49
-rw-r--r--include/asm-x86_64/irq.h9
-rw-r--r--include/asm-x86_64/kexec.h29
-rw-r--r--include/asm-x86_64/linkage.h2
-rw-r--r--include/asm-x86_64/mach_apic.h1
-rw-r--r--include/asm-x86_64/mce.h2
-rw-r--r--include/asm-x86_64/mmx.h14
-rw-r--r--include/asm-x86_64/mpspec.h11
-rw-r--r--include/asm-x86_64/msi.h24
-rw-r--r--include/asm-x86_64/msidef.h47
-rw-r--r--include/asm-x86_64/msr.h11
-rw-r--r--include/asm-x86_64/mutex.h20
-rw-r--r--include/asm-x86_64/nmi.h45
-rw-r--r--include/asm-x86_64/pci-direct.h42
-rw-r--r--include/asm-x86_64/pda.h109
-rw-r--r--include/asm-x86_64/percpu.h10
-rw-r--r--include/asm-x86_64/pgtable.h8
-rw-r--r--include/asm-x86_64/proto.h17
-rw-r--r--include/asm-x86_64/ptrace.h2
-rw-r--r--include/asm-x86_64/rwlock.h64
-rw-r--r--include/asm-x86_64/segment.h5
-rw-r--r--include/asm-x86_64/semaphore.h44
-rw-r--r--include/asm-x86_64/signal.h4
-rw-r--r--include/asm-x86_64/smp.h29
-rw-r--r--include/asm-x86_64/spinlock.h84
-rw-r--r--include/asm-x86_64/stacktrace.h18
-rw-r--r--include/asm-x86_64/system.h5
-rw-r--r--include/asm-x86_64/tce.h1
-rw-r--r--include/asm-x86_64/therm_throt.h1
-rw-r--r--include/asm-x86_64/thread_info.h9
-rw-r--r--include/asm-x86_64/tlbflush.h70
-rw-r--r--include/asm-x86_64/topology.h1
-rw-r--r--include/asm-x86_64/uaccess.h71
-rw-r--r--include/asm-x86_64/unistd.h103
-rw-r--r--include/asm-x86_64/unwind.h9
-rw-r--r--include/asm-x86_64/vsyscall.h12
-rw-r--r--include/asm-xtensa/a.out.h2
-rw-r--r--include/asm-xtensa/cache.h2
-rw-r--r--include/asm-xtensa/coprocessor.h2
-rw-r--r--include/asm-xtensa/dma-mapping.h2
-rw-r--r--include/asm-xtensa/ioctls.h2
-rw-r--r--include/asm-xtensa/pgtable.h2
-rw-r--r--include/asm-xtensa/siginfo.h2
-rw-r--r--include/asm-xtensa/timex.h3
-rw-r--r--include/asm-xtensa/unistd.h5
-rw-r--r--include/linux/Kbuild12
-rw-r--r--include/linux/ac97_codec.h5
-rw-r--r--include/linux/acct.h4
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/aio.h12
-rw-r--r--include/linux/aio_abi.h4
-rw-r--r--include/linux/atalk.h40
-rw-r--r--include/linux/atmlec.h119
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/awe_voice.h2
-rw-r--r--include/linux/bio.h5
-rw-r--r--include/linux/blkdev.h345
-rw-r--r--include/linux/blktrace_api.h3
-rw-r--r--include/linux/buffer_head.h19
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/compat_ioctl.h22
-rw-r--r--include/linux/compiler.h17
-rw-r--r--include/linux/config.h1
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/console_struct.h2
-rw-r--r--include/linux/consolemap.h1
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/cramfs_fs.h2
-rw-r--r--include/linux/debug_locks.h2
-rw-r--r--include/linux/device-mapper.h14
-rw-r--r--include/linux/device.h99
-rw-r--r--include/linux/dlm.h302
-rw-r--r--include/linux/dlm_device.h86
-rw-r--r--include/linux/dm-ioctl.h4
-rw-r--r--include/linux/dma-mapping.h7
-rw-r--r--include/linux/dmi.h3
-rw-r--r--include/linux/edd.h1
-rw-r--r--include/linux/eisa.h8
-rw-r--r--include/linux/elevator.h68
-rw-r--r--include/linux/err.h4
-rw-r--r--include/linux/errqueue.h2
-rw-r--r--include/linux/ext2_fs.h64
-rw-r--r--include/linux/ext3_fs.h30
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/ext3_jbd.h10
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/fs.h152
-rw-r--r--include/linux/fs_enet_pd.h47
-rw-r--r--include/linux/fs_uart_pd.h14
-rw-r--r--include/linux/fsl_devices.h65
-rw-r--r--include/linux/genalloc.h1
-rw-r--r--include/linux/generic_acl.h36
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/getcpu.h18
-rw-r--r--include/linux/gfp.h5
-rw-r--r--include/linux/gfs2_ondisk.h443
-rw-r--r--include/linux/hardirq.h7
-rw-r--r--include/linux/harrier_defs.h2
-rw-r--r--include/linux/hdlc.h201
-rw-r--r--include/linux/hdlc/ioctl.h33
-rw-r--r--include/linux/hrtimer.h1
-rw-r--r--include/linux/htirq.h15
-rw-r--r--include/linux/i2c-algo-bit.h1
-rw-r--r--include/linux/i2c-algo-pcf.h1
-rw-r--r--include/linux/i2c-algo-sibyte.h33
-rw-r--r--include/linux/i2c-id.h1
-rw-r--r--include/linux/i2c.h14
-rw-r--r--include/linux/icmp.h12
-rw-r--r--include/linux/ide.h12
-rw-r--r--include/linux/if.h132
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_link.h136
-rw-r--r--include/linux/igmp.h38
-rw-r--r--include/linux/in.h13
-rw-r--r--include/linux/in6.h6
-rw-r--r--include/linux/inet_diag.h10
-rw-r--r--include/linux/inetdevice.h24
-rw-r--r--include/linux/init.h1
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/input.h272
-rw-r--r--include/linux/interrupt.h16
-rw-r--r--include/linux/io.h4
-rw-r--r--include/linux/ip.h23
-rw-r--r--include/linux/ipc.h55
-rw-r--r--include/linux/ipmi.h48
-rw-r--r--include/linux/ipsec.h3
-rw-r--r--include/linux/ipv6.h16
-rw-r--r--include/linux/irq.h57
-rw-r--r--include/linux/ite_gpio.h66
-rw-r--r--include/linux/jbd.h71
-rw-r--r--include/linux/jiffies.h15
-rw-r--r--include/linux/kallsyms.h11
-rw-r--r--include/linux/kernel.h14
-rw-r--r--include/linux/kmod.h4
-rw-r--r--include/linux/kobject.h16
-rw-r--r--include/linux/kprobes.h8
-rw-r--r--include/linux/latency.h25
-rw-r--r--include/linux/leds.h3
-rw-r--r--include/linux/libata.h9
-rw-r--r--include/linux/libps2.h1
-rw-r--r--include/linux/linkage.h6
-rw-r--r--include/linux/list.h15
-rw-r--r--include/linux/lm_interface.h273
-rw-r--r--include/linux/lock_dlm_plock.h41
-rw-r--r--include/linux/lockd/bind.h2
-rw-r--r--include/linux/lockd/lockd.h63
-rw-r--r--include/linux/lockd/share.h3
-rw-r--r--include/linux/lockd/sm_inter.h5
-rw-r--r--include/linux/lockd/xdr4.h2
-rw-r--r--include/linux/lockdep.h4
-rw-r--r--include/linux/loop.h5
-rw-r--r--include/linux/memory.h4
-rw-r--r--include/linux/memory_hotplug.h2
-rw-r--r--include/linux/mm.h133
-rw-r--r--include/linux/mm_types.h67
-rw-r--r--include/linux/mmc/host.h2
-rw-r--r--include/linux/mmc/mmc.h1
-rw-r--r--include/linux/mmzone.h17
-rw-r--r--include/linux/mod_devicetable.h12
-rw-r--r--include/linux/module.h6
-rw-r--r--include/linux/mpage.h7
-rw-r--r--include/linux/mroute.h14
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/msi.h49
-rw-r--r--include/linux/mtd/nand.h25
-rw-r--r--include/linux/mtd/onenand.h6
-rw-r--r--include/linux/mtd/onenand_regs.h4
-rw-r--r--include/linux/mtd/plat-ram.h2
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/namespace.h6
-rw-r--r--include/linux/ncp_fs.h1
-rw-r--r--include/linux/netdevice.h10
-rw-r--r--include/linux/netfilter_arp/arp_tables.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_mark_t.h12
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h16
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h2
-rw-r--r--include/linux/nfs_fs.h14
-rw-r--r--include/linux/nfsd/const.h20
-rw-r--r--include/linux/nfsd/export.h21
-rw-r--r--include/linux/nfsd/nfsd.h10
-rw-r--r--include/linux/nfsd/nfsfh.h21
-rw-r--r--include/linux/nfsd/stats.h2
-rw-r--r--include/linux/nfsd/syscall.h17
-rw-r--r--include/linux/nfsd/xdr.h4
-rw-r--r--include/linux/nfsd/xdr3.h2
-rw-r--r--include/linux/nfsd/xdr4.h2
-rw-r--r--include/linux/nmi.h3
-rw-r--r--include/linux/nodemask.h2
-rw-r--r--include/linux/notifier.h43
-rw-r--r--include/linux/nsproxy.h52
-rw-r--r--include/linux/page-flags.h11
-rw-r--r--include/linux/pci.h53
-rw-r--r--include/linux/pci_ids.h15
-rw-r--r--include/linux/pci_regs.h23
-rw-r--r--include/linux/pcieport_if.h6
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/pid.h51
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm.h63
-rw-r--r--include/linux/posix-timers.h4
-rw-r--r--include/linux/ppdev.h2
-rw-r--r--include/linux/proc_fs.h12
-rw-r--r--include/linux/pspace.h23
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/raid/bitmap.h2
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h14
-rw-r--r--include/linux/raid/md_u.h2
-rw-r--r--include/linux/raid/raid1.h1
-rw-r--r--include/linux/raid/raid10.h1
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/ramfs.h1
-rw-r--r--include/linux/rbtree.h2
-rw-r--r--include/linux/rcupdate.h7
-rw-r--r--include/linux/reiserfs_acl.h17
-rw-r--r--include/linux/reiserfs_fs.h41
-rw-r--r--include/linux/reiserfs_fs_i.h5
-rw-r--r--include/linux/reiserfs_fs_sb.h2
-rw-r--r--include/linux/reiserfs_xattr.h8
-rw-r--r--include/linux/rtc.h4
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/sched.h110
-rw-r--r--include/linux/scx200.h2
-rw-r--r--include/linux/scx200_gpio.h1
-rw-r--r--include/linux/security.h1
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/serio.h3
-rw-r--r--include/linux/shmem_fs.h24
-rw-r--r--include/linux/slab.h32
-rw-r--r--include/linux/smb.h1
-rw-r--r--include/linux/sound.h2
-rw-r--r--include/linux/spinlock.h14
-rw-r--r--include/linux/spinlock_api_smp.h50
-rw-r--r--include/linux/srcu.h53
-rw-r--r--include/linux/stacktrace.h7
-rw-r--r--include/linux/stat.h2
-rw-r--r--include/linux/stddef.h6
-rw-r--r--include/linux/string.h1
-rw-r--r--include/linux/sunrpc/auth.h19
-rw-r--r--include/linux/sunrpc/auth_gss.h2
-rw-r--r--include/linux/sunrpc/cache.h11
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/msg_prot.h44
-rw-r--r--include/linux/sunrpc/svc.h213
-rw-r--r--include/linux/sunrpc/svcauth.h5
-rw-r--r--include/linux/sunrpc/svcauth_gss.h2
-rw-r--r--include/linux/sunrpc/svcsock.h18
-rw-r--r--include/linux/sunrpc/xdr.h38
-rw-r--r--include/linux/sunrpc/xprt.h20
-rw-r--r--include/linux/synclink.h4
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h28
-rw-r--r--include/linux/sysrq.h4
-rw-r--r--include/linux/taskstats.h64
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/tifm.h158
-rw-r--r--include/linux/timex.h58
-rw-r--r--include/linux/topology.h46
-rw-r--r--include/linux/trdevice.h2
-rw-r--r--include/linux/tsacct_kern.h34
-rw-r--r--include/linux/tty.h6
-rw-r--r--include/linux/tty_driver.h3
-rw-r--r--include/linux/types.h8
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/udp.h8
-rw-r--r--include/linux/uinput.h35
-rw-r--r--include/linux/unistd.h6
-rw-r--r--include/linux/unwind.h2
-rw-r--r--include/linux/usb.h156
-rw-r--r--include/linux/usb/audio.h53
-rw-r--r--include/linux/usb/midi.h112
-rw-r--r--include/linux/usb/otg.h (renamed from include/linux/usb_otg.h)4
-rw-r--r--include/linux/usb_usual.h3
-rw-r--r--include/linux/utime.h2
-rw-r--r--include/linux/utsname.h62
-rw-r--r--include/linux/vermagic.h4
-rw-r--r--include/linux/videodev2.h85
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--include/linux/vmstat.h1
-rw-r--r--include/linux/vt_kern.h10
-rw-r--r--include/linux/wavefront.h675
-rw-r--r--include/linux/wireless.h24
-rw-r--r--include/linux/writeback.h5
-rw-r--r--include/linux/xfrm.h19
-rw-r--r--include/media/audiochip.h4
-rw-r--r--include/media/ir-common.h2
-rw-r--r--include/media/tuner-types.h3
-rw-r--r--include/media/tuner.h1
-rw-r--r--include/media/v4l2-common.h16
-rw-r--r--include/media/v4l2-dev.h12
-rw-r--r--include/mtd/Kbuild3
-rw-r--r--include/mtd/mtd-abi.h6
-rw-r--r--include/net/arp.h8
-rw-r--r--include/net/bluetooth/hci.h11
-rw-r--r--include/net/bluetooth/hci_core.h18
-rw-r--r--include/net/cipso_ipv4.h5
-rw-r--r--include/net/dst.h2
-rw-r--r--include/net/flow.h10
-rw-r--r--include/net/genetlink.h18
-rw-r--r--include/net/icmp.h2
-rw-r--r--include/net/inet_connection_sock.h6
-rw-r--r--include/net/inet_hashtables.h56
-rw-r--r--include/net/inet_sock.h34
-rw-r--r--include/net/inet_timewait_sock.h10
-rw-r--r--include/net/inetpeer.h4
-rw-r--r--include/net/ip.h10
-rw-r--r--include/net/ip_fib.h28
-rw-r--r--include/net/ip_mp_alg.h4
-rw-r--r--include/net/ip_vs.h68
-rw-r--r--include/net/ipv6.h6
-rw-r--r--include/net/irda/irlan_common.h10
-rw-r--r--include/net/irda/irlap_frame.h31
-rw-r--r--include/net/irda/irlmp.h2
-rw-r--r--include/net/netdma.h1
-rw-r--r--include/net/netlabel.h8
-rw-r--r--include/net/netlink.h12
-rw-r--r--include/net/route.h24
-rw-r--r--include/net/sock.h1
-rw-r--r--include/net/xfrm.h26
-rw-r--r--include/scsi/scsi_tcq.h25
-rw-r--r--include/sound/pcm.h1
-rw-r--r--include/video/s1d13xxxfb.h2
-rw-r--r--include/video/sstfb.h4
825 files changed, 15063 insertions, 11832 deletions
diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h
index 0c294c9b0c55..aeeb125f6851 100644
--- a/include/asm-alpha/spinlock.h
+++ b/include/asm-alpha/spinlock.h
@@ -166,4 +166,8 @@ static inline void __raw_write_unlock(raw_rwlock_t * lock)
166 lock->lock = 0; 166 lock->lock = 0;
167} 167}
168 168
169#define _raw_spin_relax(lock) cpu_relax()
170#define _raw_read_relax(lock) cpu_relax()
171#define _raw_write_relax(lock) cpu_relax()
172
169#endif /* _ALPHA_SPINLOCK_H */ 173#endif /* _ALPHA_SPINLOCK_H */
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index bc6e6a9259dc..2cabbd465c0c 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -580,75 +580,6 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\
580#define __ARCH_WANT_SYS_OLDUMOUNT 580#define __ARCH_WANT_SYS_OLDUMOUNT
581#define __ARCH_WANT_SYS_SIGPENDING 581#define __ARCH_WANT_SYS_SIGPENDING
582 582
583#ifdef __KERNEL_SYSCALLS__
584
585#include <linux/compiler.h>
586#include <linux/types.h>
587#include <linux/string.h>
588#include <linux/signal.h>
589#include <linux/syscalls.h>
590#include <asm/ptrace.h>
591
592static inline long open(const char * name, int mode, int flags)
593{
594 return sys_open(name, mode, flags);
595}
596
597static inline long dup(int fd)
598{
599 return sys_dup(fd);
600}
601
602static inline long close(int fd)
603{
604 return sys_close(fd);
605}
606
607static inline off_t lseek(int fd, off_t off, int whence)
608{
609 return sys_lseek(fd, off, whence);
610}
611
612static inline void _exit(int value)
613{
614 sys_exit(value);
615}
616
617#define exit(x) _exit(x)
618
619static inline long write(int fd, const char * buf, size_t nr)
620{
621 return sys_write(fd, buf, nr);
622}
623
624static inline long read(int fd, char * buf, size_t nr)
625{
626 return sys_read(fd, buf, nr);
627}
628
629extern int execve(char *, char **, char **);
630
631static inline long setsid(void)
632{
633 return sys_setsid();
634}
635
636static inline pid_t waitpid(int pid, int * wait_stat, int flags)
637{
638 return sys_wait4(pid, wait_stat, flags, NULL);
639}
640
641asmlinkage int sys_execve(char *ufilename, char **argv, char **envp,
642 unsigned long a3, unsigned long a4, unsigned long a5,
643 struct pt_regs regs);
644asmlinkage long sys_rt_sigaction(int sig,
645 const struct sigaction __user *act,
646 struct sigaction __user *oact,
647 size_t sigsetsize,
648 void *restorer);
649
650#endif /* __KERNEL_SYSCALLS__ */
651
652/* "Conditional" syscalls. What we want is 583/* "Conditional" syscalls. What we want is
653 584
654 __attribute__((weak,alias("sys_ni_syscall"))) 585 __attribute__((weak,alias("sys_ni_syscall")))
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200.h b/include/asm-arm/arch-at91rm9200/at91rm9200.h
index 58f40931a5c1..a5a86b1ff886 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200.h
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200.h
@@ -19,67 +19,80 @@
19/* 19/*
20 * Peripheral identifiers/interrupts. 20 * Peripheral identifiers/interrupts.
21 */ 21 */
22#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */ 22#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
23#define AT91_ID_SYS 1 /* System Peripheral */ 23#define AT91_ID_SYS 1 /* System Peripheral */
24#define AT91_ID_PIOA 2 /* Parallel IO Controller A */ 24#define AT91RM9200_ID_PIOA 2 /* Parallel IO Controller A */
25#define AT91_ID_PIOB 3 /* Parallel IO Controller B */ 25#define AT91RM9200_ID_PIOB 3 /* Parallel IO Controller B */
26#define AT91_ID_PIOC 4 /* Parallel IO Controller C */ 26#define AT91RM9200_ID_PIOC 4 /* Parallel IO Controller C */
27#define AT91_ID_PIOD 5 /* Parallel IO Controller D */ 27#define AT91RM9200_ID_PIOD 5 /* Parallel IO Controller D */
28#define AT91_ID_US0 6 /* USART 0 */ 28#define AT91RM9200_ID_US0 6 /* USART 0 */
29#define AT91_ID_US1 7 /* USART 1 */ 29#define AT91RM9200_ID_US1 7 /* USART 1 */
30#define AT91_ID_US2 8 /* USART 2 */ 30#define AT91RM9200_ID_US2 8 /* USART 2 */
31#define AT91_ID_US3 9 /* USART 3 */ 31#define AT91RM9200_ID_US3 9 /* USART 3 */
32#define AT91_ID_MCI 10 /* Multimedia Card Interface */ 32#define AT91RM9200_ID_MCI 10 /* Multimedia Card Interface */
33#define AT91_ID_UDP 11 /* USB Device Port */ 33#define AT91RM9200_ID_UDP 11 /* USB Device Port */
34#define AT91_ID_TWI 12 /* Two-Wire Interface */ 34#define AT91RM9200_ID_TWI 12 /* Two-Wire Interface */
35#define AT91_ID_SPI 13 /* Serial Peripheral Interface */ 35#define AT91RM9200_ID_SPI 13 /* Serial Peripheral Interface */
36#define AT91_ID_SSC0 14 /* Serial Synchronous Controller 0 */ 36#define AT91RM9200_ID_SSC0 14 /* Serial Synchronous Controller 0 */
37#define AT91_ID_SSC1 15 /* Serial Synchronous Controller 1 */ 37#define AT91RM9200_ID_SSC1 15 /* Serial Synchronous Controller 1 */
38#define AT91_ID_SSC2 16 /* Serial Synchronous Controller 2 */ 38#define AT91RM9200_ID_SSC2 16 /* Serial Synchronous Controller 2 */
39#define AT91_ID_TC0 17 /* Timer Counter 0 */ 39#define AT91RM9200_ID_TC0 17 /* Timer Counter 0 */
40#define AT91_ID_TC1 18 /* Timer Counter 1 */ 40#define AT91RM9200_ID_TC1 18 /* Timer Counter 1 */
41#define AT91_ID_TC2 19 /* Timer Counter 2 */ 41#define AT91RM9200_ID_TC2 19 /* Timer Counter 2 */
42#define AT91_ID_TC3 20 /* Timer Counter 3 */ 42#define AT91RM9200_ID_TC3 20 /* Timer Counter 3 */
43#define AT91_ID_TC4 21 /* Timer Counter 4 */ 43#define AT91RM9200_ID_TC4 21 /* Timer Counter 4 */
44#define AT91_ID_TC5 22 /* Timer Counter 5 */ 44#define AT91RM9200_ID_TC5 22 /* Timer Counter 5 */
45#define AT91_ID_UHP 23 /* USB Host port */ 45#define AT91RM9200_ID_UHP 23 /* USB Host port */
46#define AT91_ID_EMAC 24 /* Ethernet MAC */ 46#define AT91RM9200_ID_EMAC 24 /* Ethernet MAC */
47#define AT91_ID_IRQ0 25 /* Advanced Interrupt Controller (IRQ0) */ 47#define AT91RM9200_ID_IRQ0 25 /* Advanced Interrupt Controller (IRQ0) */
48#define AT91_ID_IRQ1 26 /* Advanced Interrupt Controller (IRQ1) */ 48#define AT91RM9200_ID_IRQ1 26 /* Advanced Interrupt Controller (IRQ1) */
49#define AT91_ID_IRQ2 27 /* Advanced Interrupt Controller (IRQ2) */ 49#define AT91RM9200_ID_IRQ2 27 /* Advanced Interrupt Controller (IRQ2) */
50#define AT91_ID_IRQ3 28 /* Advanced Interrupt Controller (IRQ3) */ 50#define AT91RM9200_ID_IRQ3 28 /* Advanced Interrupt Controller (IRQ3) */
51#define AT91_ID_IRQ4 29 /* Advanced Interrupt Controller (IRQ4) */ 51#define AT91RM9200_ID_IRQ4 29 /* Advanced Interrupt Controller (IRQ4) */
52#define AT91_ID_IRQ5 30 /* Advanced Interrupt Controller (IRQ5) */ 52#define AT91RM9200_ID_IRQ5 30 /* Advanced Interrupt Controller (IRQ5) */
53#define AT91_ID_IRQ6 31 /* Advanced Interrupt Controller (IRQ6) */ 53#define AT91RM9200_ID_IRQ6 31 /* Advanced Interrupt Controller (IRQ6) */
54 54
55 55
56/* 56/*
57 * Peripheral physical base addresses. 57 * Peripheral physical base addresses.
58 */ 58 */
59#define AT91_BASE_TCB0 0xfffa0000 59#define AT91RM9200_BASE_TCB0 0xfffa0000
60#define AT91_BASE_TC0 0xfffa0000 60#define AT91RM9200_BASE_TC0 0xfffa0000
61#define AT91_BASE_TC1 0xfffa0040 61#define AT91RM9200_BASE_TC1 0xfffa0040
62#define AT91_BASE_TC2 0xfffa0080 62#define AT91RM9200_BASE_TC2 0xfffa0080
63#define AT91_BASE_TCB1 0xfffa4000 63#define AT91RM9200_BASE_TCB1 0xfffa4000
64#define AT91_BASE_TC3 0xfffa4000 64#define AT91RM9200_BASE_TC3 0xfffa4000
65#define AT91_BASE_TC4 0xfffa4040 65#define AT91RM9200_BASE_TC4 0xfffa4040
66#define AT91_BASE_TC5 0xfffa4080 66#define AT91RM9200_BASE_TC5 0xfffa4080
67#define AT91_BASE_UDP 0xfffb0000 67#define AT91RM9200_BASE_UDP 0xfffb0000
68#define AT91_BASE_MCI 0xfffb4000 68#define AT91RM9200_BASE_MCI 0xfffb4000
69#define AT91_BASE_TWI 0xfffb8000 69#define AT91RM9200_BASE_TWI 0xfffb8000
70#define AT91_BASE_EMAC 0xfffbc000 70#define AT91RM9200_BASE_EMAC 0xfffbc000
71#define AT91_BASE_US0 0xfffc0000 71#define AT91RM9200_BASE_US0 0xfffc0000
72#define AT91_BASE_US1 0xfffc4000 72#define AT91RM9200_BASE_US1 0xfffc4000
73#define AT91_BASE_US2 0xfffc8000 73#define AT91RM9200_BASE_US2 0xfffc8000
74#define AT91_BASE_US3 0xfffcc000 74#define AT91RM9200_BASE_US3 0xfffcc000
75#define AT91_BASE_SSC0 0xfffd0000 75#define AT91RM9200_BASE_SSC0 0xfffd0000
76#define AT91_BASE_SSC1 0xfffd4000 76#define AT91RM9200_BASE_SSC1 0xfffd4000
77#define AT91_BASE_SSC2 0xfffd8000 77#define AT91RM9200_BASE_SSC2 0xfffd8000
78#define AT91_BASE_SPI 0xfffe0000 78#define AT91RM9200_BASE_SPI 0xfffe0000
79#define AT91_BASE_SYS 0xfffff000 79#define AT91_BASE_SYS 0xfffff000
80 80
81 81
82/* 82/*
83 * Internal Memory.
84 */
85#define AT91RM9200_ROM_BASE 0x00100000 /* Internal ROM base address */
86#define AT91RM9200_ROM_SIZE SZ_128K /* Internal ROM size (128Kb) */
87
88#define AT91RM9200_SRAM_BASE 0x00200000 /* Internal SRAM base address */
89#define AT91RM9200_SRAM_SIZE SZ_16K /* Internal SRAM size (16Kb) */
90
91#define AT91RM9200_UHP_BASE 0x00300000 /* USB Host controller */
92
93
94#if 0
95/*
83 * PIO pin definitions (peripheral A/B multiplexing). 96 * PIO pin definitions (peripheral A/B multiplexing).
84 */ 97 */
85#define AT91_PA0_MISO (1 << 0) /* A: SPI Master-In Slave-Out */ 98#define AT91_PA0_MISO (1 << 0) /* A: SPI Master-In Slave-Out */
@@ -257,5 +270,6 @@
257#define AT91_PD25_TPK13 (1 << 25) /* B: ETM Trace Packet Port 13 */ 270#define AT91_PD25_TPK13 (1 << 25) /* B: ETM Trace Packet Port 13 */
258#define AT91_PD26_TPK14 (1 << 26) /* B: ETM Trace Packet Port 14 */ 271#define AT91_PD26_TPK14 (1 << 26) /* B: ETM Trace Packet Port 14 */
259#define AT91_PD27_TPK15 (1 << 27) /* B: ETM Trace Packet Port 15 */ 272#define AT91_PD27_TPK15 (1 << 27) /* B: ETM Trace Packet Port 15 */
273#endif
260 274
261#endif 275#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
index 0f4c12d5f0cd..73693fea76a2 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
@@ -80,6 +80,9 @@
80#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */ 80#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */
81#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */ 81#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */
82 82
83#define AT91_AIC_FFER (AT91_AIC + 0x140) /* Fast Forcing Enable Register [SAM9 only] */
84#define AT91_AIC_FFDR (AT91_AIC + 0x144) /* Fast Forcing Disable Register [SAM9 only] */
85#define AT91_AIC_FFSR (AT91_AIC + 0x148) /* Fast Forcing Status Register [SAM9 only] */
83 86
84/* 87/*
85 * PIO Controllers. 88 * PIO Controllers.
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_twi.h b/include/asm-arm/arch-at91rm9200/at91rm9200_twi.h
new file mode 100644
index 000000000000..93547d7482bd
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_twi.h
@@ -0,0 +1,57 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_twi.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Two-wire Interface (TWI) registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_TWI_H
17#define AT91RM9200_TWI_H
18
19#define AT91_TWI_CR 0x00 /* Control Register */
20#define AT91_TWI_START (1 << 0) /* Send a Start Condition */
21#define AT91_TWI_STOP (1 << 1) /* Send a Stop Condition */
22#define AT91_TWI_MSEN (1 << 2) /* Master Transfer Enable */
23#define AT91_TWI_MSDIS (1 << 3) /* Master Transfer Disable */
24#define AT91_TWI_SWRST (1 << 7) /* Software Reset */
25
26#define AT91_TWI_MMR 0x04 /* Master Mode Register */
27#define AT91_TWI_IADRSZ (3 << 8) /* Internal Device Address Size */
28#define AT91_TWI_IADRSZ_NO (0 << 8)
29#define AT91_TWI_IADRSZ_1 (1 << 8)
30#define AT91_TWI_IADRSZ_2 (2 << 8)
31#define AT91_TWI_IADRSZ_3 (3 << 8)
32#define AT91_TWI_MREAD (1 << 12) /* Master Read Direction */
33#define AT91_TWI_DADR (0x7f << 16) /* Device Address */
34
35#define AT91_TWI_IADR 0x0c /* Internal Address Register */
36
37#define AT91_TWI_CWGR 0x10 /* Clock Waveform Generator Register */
38#define AT91_TWI_CLDIV (0xff << 0) /* Clock Low Divisor */
39#define AT91_TWI_CHDIV (0xff << 8) /* Clock High Divisor */
40#define AT91_TWI_CKDIV (7 << 16) /* Clock Divider */
41
42#define AT91_TWI_SR 0x20 /* Status Register */
43#define AT91_TWI_TXCOMP (1 << 0) /* Transmission Complete */
44#define AT91_TWI_RXRDY (1 << 1) /* Receive Holding Register Ready */
45#define AT91_TWI_TXRDY (1 << 2) /* Transmit Holding Register Ready */
46#define AT91_TWI_OVRE (1 << 6) /* Overrun Error */
47#define AT91_TWI_UNRE (1 << 7) /* Underrun Error */
48#define AT91_TWI_NACK (1 << 8) /* Not Acknowledged */
49
50#define AT91_TWI_IER 0x24 /* Interrupt Enable Register */
51#define AT91_TWI_IDR 0x28 /* Interrupt Disable Register */
52#define AT91_TWI_IMR 0x2c /* Interrupt Mask Register */
53#define AT91_TWI_RHR 0x30 /* Receive Holding Register */
54#define AT91_TWI_THR 0x34 /* Transmit Holding Register */
55
56#endif
57
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h b/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
deleted file mode 100644
index 79f851e31b9c..000000000000
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USART registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_USART_H
17#define AT91RM9200_USART_H
18
19#define AT91_US_CR 0x00 /* Control Register */
20#define AT91_US_RSTRX (1 << 2) /* Reset Receiver */
21#define AT91_US_RSTTX (1 << 3) /* Reset Transmitter */
22#define AT91_US_RXEN (1 << 4) /* Receiver Enable */
23#define AT91_US_RXDIS (1 << 5) /* Receiver Disable */
24#define AT91_US_TXEN (1 << 6) /* Transmitter Enable */
25#define AT91_US_TXDIS (1 << 7) /* Transmitter Disable */
26#define AT91_US_RSTSTA (1 << 8) /* Reset Status Bits */
27#define AT91_US_STTBRK (1 << 9) /* Start Break */
28#define AT91_US_STPBRK (1 << 10) /* Stop Break */
29#define AT91_US_STTTO (1 << 11) /* Start Time-out */
30#define AT91_US_SENDA (1 << 12) /* Send Address */
31#define AT91_US_RSTIT (1 << 13) /* Reset Iterations */
32#define AT91_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */
33#define AT91_US_RETTO (1 << 15) /* Rearm Time-out */
34#define AT91_US_DTREN (1 << 16) /* Data Terminal Ready Enable */
35#define AT91_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable */
36#define AT91_US_RTSEN (1 << 18) /* Request To Send Enable */
37#define AT91_US_RTSDIS (1 << 19) /* Request To Send Disable */
38
39#define AT91_US_MR 0x04 /* Mode Register */
40#define AT91_US_USMODE (0xf << 0) /* Mode of the USART */
41#define AT91_US_USMODE_NORMAL 0
42#define AT91_US_USMODE_RS485 1
43#define AT91_US_USMODE_HWHS 2
44#define AT91_US_USMODE_MODEM 3
45#define AT91_US_USMODE_ISO7816_T0 4
46#define AT91_US_USMODE_ISO7816_T1 6
47#define AT91_US_USMODE_IRDA 8
48#define AT91_US_USCLKS (3 << 4) /* Clock Selection */
49#define AT91_US_CHRL (3 << 6) /* Character Length */
50#define AT91_US_CHRL_5 (0 << 6)
51#define AT91_US_CHRL_6 (1 << 6)
52#define AT91_US_CHRL_7 (2 << 6)
53#define AT91_US_CHRL_8 (3 << 6)
54#define AT91_US_SYNC (1 << 8) /* Synchronous Mode Select */
55#define AT91_US_PAR (7 << 9) /* Parity Type */
56#define AT91_US_PAR_EVEN (0 << 9)
57#define AT91_US_PAR_ODD (1 << 9)
58#define AT91_US_PAR_SPACE (2 << 9)
59#define AT91_US_PAR_MARK (3 << 9)
60#define AT91_US_PAR_NONE (4 << 9)
61#define AT91_US_PAR_MULTI_DROP (6 << 9)
62#define AT91_US_NBSTOP (3 << 12) /* Number of Stop Bits */
63#define AT91_US_NBSTOP_1 (0 << 12)
64#define AT91_US_NBSTOP_1_5 (1 << 12)
65#define AT91_US_NBSTOP_2 (2 << 12)
66#define AT91_US_CHMODE (3 << 14) /* Channel Mode */
67#define AT91_US_CHMODE_NORMAL (0 << 14)
68#define AT91_US_CHMODE_ECHO (1 << 14)
69#define AT91_US_CHMODE_LOC_LOOP (2 << 14)
70#define AT91_US_CHMODE_REM_LOOP (3 << 14)
71#define AT91_US_MSBF (1 << 16) /* Bit Order */
72#define AT91_US_MODE9 (1 << 17) /* 9-bit Character Length */
73#define AT91_US_CLKO (1 << 18) /* Clock Output Select */
74#define AT91_US_OVER (1 << 19) /* Oversampling Mode */
75#define AT91_US_INACK (1 << 20) /* Inhibit Non Acknowledge */
76#define AT91_US_DSNACK (1 << 21) /* Disable Successive NACK */
77#define AT91_US_MAX_ITER (7 << 24) /* Max Iterations */
78#define AT91_US_FILTER (1 << 28) /* Infrared Receive Line Filter */
79
80#define AT91_US_IER 0x08 /* Interrupt Enable Register */
81#define AT91_US_RXRDY (1 << 0) /* Receiver Ready */
82#define AT91_US_TXRDY (1 << 1) /* Transmitter Ready */
83#define AT91_US_RXBRK (1 << 2) /* Break Received / End of Break */
84#define AT91_US_ENDRX (1 << 3) /* End of Receiver Transfer */
85#define AT91_US_ENDTX (1 << 4) /* End of Transmitter Transfer */
86#define AT91_US_OVRE (1 << 5) /* Overrun Error */
87#define AT91_US_FRAME (1 << 6) /* Framing Error */
88#define AT91_US_PARE (1 << 7) /* Parity Error */
89#define AT91_US_TIMEOUT (1 << 8) /* Receiver Time-out */
90#define AT91_US_TXEMPTY (1 << 9) /* Transmitter Empty */
91#define AT91_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */
92#define AT91_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */
93#define AT91_US_RXBUFF (1 << 12) /* Reception Buffer Full */
94#define AT91_US_NACK (1 << 13) /* Non Acknowledge */
95#define AT91_US_RIIC (1 << 16) /* Ring Indicator Input Change */
96#define AT91_US_DSRIC (1 << 17) /* Data Set Ready Input Change */
97#define AT91_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change */
98#define AT91_US_CTSIC (1 << 19) /* Clear to Send Input Change */
99#define AT91_US_RI (1 << 20) /* RI */
100#define AT91_US_DSR (1 << 21) /* DSR */
101#define AT91_US_DCD (1 << 22) /* DCD */
102#define AT91_US_CTS (1 << 23) /* CTS */
103
104#define AT91_US_IDR 0x0c /* Interrupt Disable Register */
105#define AT91_US_IMR 0x10 /* Interrupt Mask Register */
106#define AT91_US_CSR 0x14 /* Channel Status Register */
107#define AT91_US_RHR 0x18 /* Receiver Holding Register */
108#define AT91_US_THR 0x1c /* Transmitter Holding Register */
109
110#define AT91_US_BRGR 0x20 /* Baud Rate Generator Register */
111#define AT91_US_CD (0xffff << 0) /* Clock Divider */
112
113#define AT91_US_RTOR 0x24 /* Receiver Time-out Register */
114#define AT91_US_TO (0xffff << 0) /* Time-out Value */
115
116#define AT91_US_TTGR 0x28 /* Transmitter Timeguard Register */
117#define AT91_US_TG (0xff << 0) /* Timeguard Value */
118
119#define AT91_US_FIDI 0x40 /* FI DI Ratio Register */
120#define AT91_US_NER 0x44 /* Number of Errors Register */
121#define AT91_US_IF 0x4c /* IrDA Filter Register */
122
123#endif
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91rm9200/board.h
index c1ca9a4658ec..3cc9aec80f9d 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -97,12 +97,13 @@ struct at91_uart_config {
97 unsigned short nr_tty; /* number of serial tty's */ 97 unsigned short nr_tty; /* number of serial tty's */
98 short tty_map[]; /* map UART to tty number */ 98 short tty_map[]; /* map UART to tty number */
99}; 99};
100extern struct platform_device *at91_default_console_device; 100extern struct platform_device *atmel_default_console_device;
101extern void __init at91_init_serial(struct at91_uart_config *config); 101extern void __init at91_init_serial(struct at91_uart_config *config);
102 102
103struct at91_uart_data { 103struct atmel_uart_data {
104 short use_dma_tx; /* use transmit DMA? */ 104 short use_dma_tx; /* use transmit DMA? */
105 short use_dma_rx; /* use receive DMA? */ 105 short use_dma_rx; /* use receive DMA? */
106 void __iomem *regs; /* virtual base address, if any */
106}; 107};
107extern void __init at91_add_device_serial(void); 108extern void __init at91_add_device_serial(void);
108 109
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91rm9200/gpio.h
index dbde1baaf251..a011d27876a2 100644
--- a/include/asm-arm/arch-at91rm9200/gpio.h
+++ b/include/asm-arm/arch-at91rm9200/gpio.h
@@ -17,10 +17,9 @@
17 17
18#define PIN_BASE NR_AIC_IRQS 18#define PIN_BASE NR_AIC_IRQS
19 19
20#define PQFP_GPIO_BANKS 3 /* PQFP package has 3 banks */ 20#define MAX_GPIO_BANKS 4
21#define BGA_GPIO_BANKS 4 /* BGA package has 4 banks */
22 21
23/* these pin numbers double as IRQ numbers, like AT91_ID_* values */ 22/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
24 23
25#define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0) 24#define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0)
26#define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1) 25#define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1)
@@ -180,17 +179,18 @@
180 179
181#ifndef __ASSEMBLY__ 180#ifndef __ASSEMBLY__
182/* setup setup routines, called from board init or driver probe() */ 181/* setup setup routines, called from board init or driver probe() */
183extern int at91_set_A_periph(unsigned pin, int use_pullup); 182extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup);
184extern int at91_set_B_periph(unsigned pin, int use_pullup); 183extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
185extern int at91_set_gpio_input(unsigned pin, int use_pullup); 184extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
186extern int at91_set_gpio_output(unsigned pin, int value); 185extern int __init_or_module at91_set_gpio_output(unsigned pin, int value);
187extern int at91_set_deglitch(unsigned pin, int is_on); 186extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on);
188extern int at91_set_multi_drive(unsigned pin, int is_on); 187extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on);
189 188
190/* callable at any time */ 189/* callable at any time */
191extern int at91_set_gpio_value(unsigned pin, int value); 190extern int at91_set_gpio_value(unsigned pin, int value);
192extern int at91_get_gpio_value(unsigned pin); 191extern int at91_get_gpio_value(unsigned pin);
193 192
193/* callable only from core power-management code */
194extern void at91_gpio_suspend(void); 194extern void at91_gpio_suspend(void);
195extern void at91_gpio_resume(void); 195extern void at91_gpio_resume(void);
196#endif 196#endif
diff --git a/include/asm-arm/arch-at91rm9200/hardware.h b/include/asm-arm/arch-at91rm9200/hardware.h
index 235d39d91107..9ca4cc9c0b2e 100644
--- a/include/asm-arm/arch-at91rm9200/hardware.h
+++ b/include/asm-arm/arch-at91rm9200/hardware.h
@@ -34,30 +34,17 @@
34 * Virtual to Physical Address mapping for IO devices. 34 * Virtual to Physical Address mapping for IO devices.
35 */ 35 */
36#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS) 36#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
37#define AT91_VA_BASE_SPI AT91_IO_P2V(AT91_BASE_SPI) 37#define AT91_VA_BASE_SPI AT91_IO_P2V(AT91RM9200_BASE_SPI)
38#define AT91_VA_BASE_SSC2 AT91_IO_P2V(AT91_BASE_SSC2) 38#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91RM9200_BASE_EMAC)
39#define AT91_VA_BASE_SSC1 AT91_IO_P2V(AT91_BASE_SSC1) 39#define AT91_VA_BASE_TWI AT91_IO_P2V(AT91RM9200_BASE_TWI)
40#define AT91_VA_BASE_SSC0 AT91_IO_P2V(AT91_BASE_SSC0) 40#define AT91_VA_BASE_MCI AT91_IO_P2V(AT91RM9200_BASE_MCI)
41#define AT91_VA_BASE_US3 AT91_IO_P2V(AT91_BASE_US3) 41#define AT91_VA_BASE_UDP AT91_IO_P2V(AT91RM9200_BASE_UDP)
42#define AT91_VA_BASE_US2 AT91_IO_P2V(AT91_BASE_US2)
43#define AT91_VA_BASE_US1 AT91_IO_P2V(AT91_BASE_US1)
44#define AT91_VA_BASE_US0 AT91_IO_P2V(AT91_BASE_US0)
45#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91_BASE_EMAC)
46#define AT91_VA_BASE_TWI AT91_IO_P2V(AT91_BASE_TWI)
47#define AT91_VA_BASE_MCI AT91_IO_P2V(AT91_BASE_MCI)
48#define AT91_VA_BASE_UDP AT91_IO_P2V(AT91_BASE_UDP)
49#define AT91_VA_BASE_TCB1 AT91_IO_P2V(AT91_BASE_TCB1)
50#define AT91_VA_BASE_TCB0 AT91_IO_P2V(AT91_BASE_TCB0)
51
52/* Internal SRAM */
53#define AT91_SRAM_BASE 0x00200000 /* Internal SRAM base address */
54#define AT91_SRAM_SIZE 0x00004000 /* Internal SRAM SIZE (16Kb) */
55 42
56 /* Internal SRAM is mapped below the IO devices */ 43 /* Internal SRAM is mapped below the IO devices */
57#define AT91_SRAM_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_SIZE) 44#define AT91_SRAM_VIRT_BASE (AT91_IO_VIRT_BASE - AT91RM9200_SRAM_SIZE)
58 45
59/* Serial ports */ 46/* Serial ports */
60#define AT91_NR_UART 5 /* 4 USART3's and one DBGU port */ 47#define ATMEL_MAX_UART 5 /* 4 USART3's and one DBGU port */
61 48
62/* FLASH */ 49/* FLASH */
63#define AT91_FLASH_BASE 0x10000000 /* NCS0: Flash physical base address */ 50#define AT91_FLASH_BASE 0x10000000 /* NCS0: Flash physical base address */
@@ -71,9 +58,6 @@
71/* Compact Flash */ 58/* Compact Flash */
72#define AT91_CF_BASE 0x50000000 /* NCS4-NCS6: Compact Flash physical base address */ 59#define AT91_CF_BASE 0x50000000 /* NCS4-NCS6: Compact Flash physical base address */
73 60
74/* Multi-Master Memory controller */
75#define AT91_UHP_BASE 0x00300000 /* USB Host controller */
76
77/* Clocks */ 61/* Clocks */
78#define AT91_SLOW_CLOCK 32768 /* slow clock */ 62#define AT91_SLOW_CLOCK 32768 /* slow clock */
79 63
diff --git a/include/asm-arm/arch-at91rm9200/irqs.h b/include/asm-arm/arch-at91rm9200/irqs.h
index f63842c2c093..763cb96c418b 100644
--- a/include/asm-arm/arch-at91rm9200/irqs.h
+++ b/include/asm-arm/arch-at91rm9200/irqs.h
@@ -32,7 +32,7 @@
32 32
33 33
34/* 34/*
35 * IRQ interrupt symbols are the AT91_ID_* symbols in at91rm9200.h 35 * IRQ interrupt symbols are the AT91xxx_ID_* symbols
36 * for IRQs handled directly through the AIC, or else the AT91_PIN_* 36 * for IRQs handled directly through the AIC, or else the AT91_PIN_*
37 * symbols in gpio.h for ones handled indirectly as GPIOs. 37 * symbols in gpio.h for ones handled indirectly as GPIOs.
38 * We make provision for 4 banks of GPIO. 38 * We make provision for 4 banks of GPIO.
diff --git a/include/asm-arm/arch-clps711x/entry-macro.S b/include/asm-arm/arch-clps711x/entry-macro.S
index 21f6ee485819..de4481dd8ba0 100644
--- a/include/asm-arm/arch-clps711x/entry-macro.S
+++ b/include/asm-arm/arch-clps711x/entry-macro.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-CLPS711x/entry-macro.S 2 * include/asm-arm/arch-clps711x/entry-macro.S
3 * 3 *
4 * Low-level IRQ helper macros for CLPS711X-based platforms 4 * Low-level IRQ helper macros for CLPS711X-based platforms
5 * 5 *
diff --git a/include/asm-arm/arch-clps711x/time.h b/include/asm-arm/arch-clps711x/time.h
index 9cb27cd4e6ae..0e4a3901d3b3 100644
--- a/include/asm-arm/arch-clps711x/time.h
+++ b/include/asm-arm/arch-clps711x/time.h
@@ -29,7 +29,7 @@ static irqreturn_t
29p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 29p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
30{ 30{
31 do_leds(); 31 do_leds();
32 do_timer(regs); 32 do_timer(1);
33#ifndef CONFIG_SMP 33#ifndef CONFIG_SMP
34 update_process_times(user_mode(regs)); 34 update_process_times(user_mode(regs));
35#endif 35#endif
diff --git a/include/asm-arm/arch-ebsa285/entry-macro.S b/include/asm-arm/arch-ebsa285/entry-macro.S
index cf10ac96fdde..ce812d4f4a33 100644
--- a/include/asm-arm/arch-ebsa285/entry-macro.S
+++ b/include/asm-arm/arch-ebsa285/entry-macro.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-footbridge/entry-macro.S 2 * include/asm-arm/arch-ebsa285/entry-macro.S
3 * 3 *
4 * Low-level IRQ helper macros for footbridge-based platforms 4 * Low-level IRQ helper macros for footbridge-based platforms
5 * 5 *
diff --git a/include/asm-arm/arch-h720x/system.h b/include/asm-arm/arch-h720x/system.h
index 09eda84592ff..8dc1460b2305 100644
--- a/include/asm-arm/arch-h720x/system.h
+++ b/include/asm-arm/arch-h720x/system.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-h720x/system.h 2 * linux/include/asm-arm/arch-h720x/system.h
3 * 3 *
4 * Copyright (C) 2001-2002 Jungjun Kim, Hynix Semiconductor Inc. 4 * Copyright (C) 2001-2002 Jungjun Kim, Hynix Semiconductor Inc.
5 * 5 *
diff --git a/include/asm-arm/arch-iop32x/debug-macro.S b/include/asm-arm/arch-iop32x/debug-macro.S
new file mode 100644
index 000000000000..9022b6849e23
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-iop32x/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 .macro addruart, rx
15 mov \rx, #0xfe000000 @ physical as well as virtual
16 orr \rx, \rx, #0x00800000 @ location of the UART
17 .endm
18
19#define UART_SHIFT 0
20#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-iop3xx/dma.h b/include/asm-arm/arch-iop32x/dma.h
index 1e808db8af2a..e977a9ef3160 100644
--- a/include/asm-arm/arch-iop3xx/dma.h
+++ b/include/asm-arm/arch-iop32x/dma.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-iop3xx/dma.h 2 * include/asm-arm/arch-iop32x/dma.h
3 * 3 *
4 * Copyright (C) 2004 Intel Corp. 4 * Copyright (C) 2004 Intel Corp.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/asm-arm/arch-iop32x/entry-macro.S b/include/asm-arm/arch-iop32x/entry-macro.S
new file mode 100644
index 000000000000..1500cbbd2295
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/entry-macro.S
@@ -0,0 +1,21 @@
1/*
2 * include/asm-arm/arch-iop32x/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IOP32x-based platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <asm/arch/iop32x.h>
11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16 ldr \base, =IOP3XX_REG_ADDR(0x07D8)
17 ldr \irqstat, [\base] @ Read IINTSRC
18 cmp \irqstat, #0
19 clzne \irqnr, \irqstat
20 rsbne \irqnr, \irqnr, #31
21 .endm
diff --git a/include/asm-arm/arch-iop32x/glantank.h b/include/asm-arm/arch-iop32x/glantank.h
new file mode 100644
index 000000000000..3b065618dd00
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/glantank.h
@@ -0,0 +1,13 @@
1/*
2 * include/asm/arch-iop32x/glantank.h
3 *
4 * IO-Data GLAN Tank board registers
5 */
6
7#ifndef __GLANTANK_H
8#define __GLANTANK_H
9
10#define GLANTANK_UART 0xfe800000 /* UART */
11
12
13#endif
diff --git a/include/asm-arm/arch-iop32x/hardware.h b/include/asm-arm/arch-iop32x/hardware.h
new file mode 100644
index 000000000000..6556ed5eee31
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/hardware.h
@@ -0,0 +1,44 @@
1/*
2 * include/asm-arm/arch-iop32x/hardware.h
3 */
4
5#ifndef __HARDWARE_H
6#define __HARDWARE_H
7
8#include <asm/types.h>
9
10/*
11 * Note about PCI IO space mappings
12 *
13 * To make IO space accesses efficient, we store virtual addresses in
14 * the IO resources.
15 *
16 * The PCI IO space is located at virtual 0xfe000000 from physical
17 * 0x90000000. The PCI BARs must be programmed with physical addresses,
18 * but when we read them, we convert them to virtual addresses. See
19 * arch/arm/plat-iop/pci.c.
20 */
21#define pcibios_assign_all_busses() 1
22#define PCIBIOS_MIN_IO 0x00000000
23#define PCIBIOS_MIN_MEM 0x00000000
24
25#ifndef __ASSEMBLY__
26void iop32x_init_irq(void);
27#endif
28
29
30/*
31 * Generic chipset bits
32 */
33#include "iop32x.h"
34
35/*
36 * Board specific bits
37 */
38#include "glantank.h"
39#include "iq80321.h"
40#include "iq31244.h"
41#include "n2100.h"
42
43
44#endif
diff --git a/include/asm-arm/arch-iop3xx/io.h b/include/asm-arm/arch-iop32x/io.h
index 36adbdf5055a..12d9ee02cde3 100644
--- a/include/asm-arm/arch-iop3xx/io.h
+++ b/include/asm-arm/arch-iop32x/io.h
@@ -1,21 +1,22 @@
1/* 1/*
2 * linux/include/asm-arm/arch-iop3xx/io.h 2 * include/asm-arm/arch-iop32x/io.h
3 * 3 *
4 * Copyright (C) 2001 MontaVista Software, Inc. 4 * Copyright (C) 2001 MontaVista Software, Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef __ASM_ARM_ARCH_IO_H 11#ifndef __IO_H
12#define __ASM_ARM_ARCH_IO_H 12#define __IO_H
13 13
14#include <asm/hardware.h> 14#include <asm/hardware.h>
15 15
16#define IO_SPACE_LIMIT 0xffffffff 16#define IO_SPACE_LIMIT 0xffffffff
17 17
18#define __io(p) ((void __iomem *)(p)) 18#define __io(p) ((void __iomem *)(p))
19#define __mem_pci(a) (a) 19#define __mem_pci(a) (a)
20 20
21
21#endif 22#endif
diff --git a/include/asm-arm/arch-iop32x/iop32x.h b/include/asm-arm/arch-iop32x/iop32x.h
new file mode 100644
index 000000000000..4bbd85f3ed2a
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/iop32x.h
@@ -0,0 +1,28 @@
1/*
2 * include/asm-arm/arch-iop32x/iop32x.h
3 *
4 * Intel IOP32X Chip definitions
5 *
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright (C) 2004 Intel Corp.
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 __IOP32X_H
16#define __IOP32X_H
17
18/*
19 * Peripherals that are shared between the iop32x and iop33x but
20 * located at different addresses.
21 */
22#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07c0 + (reg))
23#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg))
24
25#include <asm/hardware/iop3xx.h>
26
27
28#endif
diff --git a/include/asm-arm/arch-iop3xx/iq31244.h b/include/asm-arm/arch-iop32x/iq31244.h
index 4177cfa8100f..fff4eafa1f6b 100644
--- a/include/asm-arm/arch-iop3xx/iq31244.h
+++ b/include/asm-arm/arch-iop32x/iq31244.h
@@ -1,15 +1,11 @@
1/* 1/*
2 * linux/include/asm/arch-iop3xx/iq31244.h 2 * include/asm-arm/arch-iop32x/iq31244.h
3 * 3 *
4 * Intel IQ31244 evaluation board registers 4 * Intel IQ31244 evaluation board registers
5 */ 5 */
6 6
7#ifndef _IQ31244_H_ 7#ifndef __IQ31244_H
8#define _IQ31244_H_ 8#define __IQ31244_H
9
10#define IQ31244_FLASHBASE 0xf0000000 /* Flash */
11#define IQ31244_FLASHSIZE 0x00800000
12#define IQ31244_FLASHWIDTH 2
13 9
14#define IQ31244_UART 0xfe800000 /* UART #1 */ 10#define IQ31244_UART 0xfe800000 /* UART #1 */
15#define IQ31244_7SEG_1 0xfe840000 /* 7-Segment MSB */ 11#define IQ31244_7SEG_1 0xfe840000 /* 7-Segment MSB */
@@ -17,8 +13,5 @@
17#define IQ31244_ROTARY_SW 0xfe8d0000 /* Rotary Switch */ 13#define IQ31244_ROTARY_SW 0xfe8d0000 /* Rotary Switch */
18#define IQ31244_BATT_STAT 0xfe8f0000 /* Battery Status */ 14#define IQ31244_BATT_STAT 0xfe8f0000 /* Battery Status */
19 15
20#ifndef __ASSEMBLY__
21extern void iq31244_map_io(void);
22#endif
23 16
24#endif // _IQ31244_H_ 17#endif
diff --git a/include/asm-arm/arch-iop3xx/iq80321.h b/include/asm-arm/arch-iop32x/iq80321.h
index cb8725979ffa..eb69db9b9a06 100644
--- a/include/asm-arm/arch-iop3xx/iq80321.h
+++ b/include/asm-arm/arch-iop32x/iq80321.h
@@ -1,15 +1,11 @@
1/* 1/*
2 * linux/include/asm/arch-iop3xx/iq80321.h 2 * include/asm-arm/arch-iop32x/iq80321.h
3 * 3 *
4 * Intel IQ80321 evaluation board registers 4 * Intel IQ80321 evaluation board registers
5 */ 5 */
6 6
7#ifndef _IQ80321_H_ 7#ifndef __IQ80321_H
8#define _IQ80321_H_ 8#define __IQ80321_H
9
10#define IQ80321_FLASHBASE 0xf0000000 /* Flash */
11#define IQ80321_FLASHSIZE 0x00800000
12#define IQ80321_FLASHWIDTH 1
13 9
14#define IQ80321_UART 0xfe800000 /* UART #1 */ 10#define IQ80321_UART 0xfe800000 /* UART #1 */
15#define IQ80321_7SEG_1 0xfe840000 /* 7-Segment MSB */ 11#define IQ80321_7SEG_1 0xfe840000 /* 7-Segment MSB */
@@ -17,8 +13,5 @@
17#define IQ80321_ROTARY_SW 0xfe8d0000 /* Rotary Switch */ 13#define IQ80321_ROTARY_SW 0xfe8d0000 /* Rotary Switch */
18#define IQ80321_BATT_STAT 0xfe8f0000 /* Battery Status */ 14#define IQ80321_BATT_STAT 0xfe8f0000 /* Battery Status */
19 15
20#ifndef __ASSEMBLY__
21extern void iq80321_map_io(void);
22#endif
23 16
24#endif // _IQ80321_H_ 17#endif
diff --git a/include/asm-arm/arch-iop32x/irqs.h b/include/asm-arm/arch-iop32x/irqs.h
new file mode 100644
index 000000000000..bbaef873afce
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/irqs.h
@@ -0,0 +1,50 @@
1/*
2 * include/asm-arm/arch-iop32x/irqs.h
3 *
4 * Author: Rory Bolt <rorybolt@pacbell.net>
5 * Copyright: (C) 2002 Rory Bolt
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __IRQS_H
13#define __IRQS_H
14
15/*
16 * IOP80321 chipset interrupts
17 */
18#define IRQ_IOP32X_DMA0_EOT 0
19#define IRQ_IOP32X_DMA0_EOC 1
20#define IRQ_IOP32X_DMA1_EOT 2
21#define IRQ_IOP32X_DMA1_EOC 3
22#define IRQ_IOP32X_AA_EOT 6
23#define IRQ_IOP32X_AA_EOC 7
24#define IRQ_IOP32X_CORE_PMON 8
25#define IRQ_IOP32X_TIMER0 9
26#define IRQ_IOP32X_TIMER1 10
27#define IRQ_IOP32X_I2C_0 11
28#define IRQ_IOP32X_I2C_1 12
29#define IRQ_IOP32X_MESSAGING 13
30#define IRQ_IOP32X_ATU_BIST 14
31#define IRQ_IOP32X_PERFMON 15
32#define IRQ_IOP32X_CORE_PMU 16
33#define IRQ_IOP32X_BIU_ERR 17
34#define IRQ_IOP32X_ATU_ERR 18
35#define IRQ_IOP32X_MCU_ERR 19
36#define IRQ_IOP32X_DMA0_ERR 20
37#define IRQ_IOP32X_DMA1_ERR 21
38#define IRQ_IOP32X_AA_ERR 23
39#define IRQ_IOP32X_MSG_ERR 24
40#define IRQ_IOP32X_SSP 25
41#define IRQ_IOP32X_XINT0 27
42#define IRQ_IOP32X_XINT1 28
43#define IRQ_IOP32X_XINT2 29
44#define IRQ_IOP32X_XINT3 30
45#define IRQ_IOP32X_HPI 31
46
47#define NR_IRQS 32
48
49
50#endif
diff --git a/include/asm-arm/arch-iop32x/memory.h b/include/asm-arm/arch-iop32x/memory.h
new file mode 100644
index 000000000000..764cd3f0d416
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/memory.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-arm/arch-iop32x/memory.h
3 */
4
5#ifndef __MEMORY_H
6#define __MEMORY_H
7
8#include <asm/hardware.h>
9
10/*
11 * Physical DRAM offset.
12 */
13#define PHYS_OFFSET UL(0xa0000000)
14
15/*
16 * Virtual view <-> PCI DMA view memory address translations
17 * virt_to_bus: Used to translate the virtual address to an
18 * address suitable to be passed to set_dma_addr
19 * bus_to_virt: Used to convert an address for DMA operations
20 * to an address that the kernel can use.
21 */
22#define __virt_to_bus(x) (((__virt_to_phys(x)) & ~(*IOP3XX_IATVR2)) | ((*IOP3XX_IABAR2) & 0xfffffff0))
23#define __bus_to_virt(x) (__phys_to_virt(((x) & ~(*IOP3XX_IALR2)) | ( *IOP3XX_IATVR2)))
24
25
26#endif
diff --git a/include/asm-arm/arch-iop32x/n2100.h b/include/asm-arm/arch-iop32x/n2100.h
new file mode 100644
index 000000000000..fed31a648425
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/n2100.h
@@ -0,0 +1,19 @@
1/*
2 * include/asm/arch-iop32x/n2100.h
3 *
4 * Thecus N2100 board registers
5 */
6
7#ifndef __N2100_H
8#define __N2100_H
9
10#define N2100_UART 0xfe800000 /* UART */
11
12#define N2100_COPY_BUTTON IOP3XX_GPIO_LINE(0)
13#define N2100_PCA9532_RESET IOP3XX_GPIO_LINE(2)
14#define N2100_RESET_BUTTON IOP3XX_GPIO_LINE(3)
15#define N2100_HARDWARE_RESET IOP3XX_GPIO_LINE(4)
16#define N2100_POWER_BUTTON IOP3XX_GPIO_LINE(5)
17
18
19#endif
diff --git a/include/asm-arm/arch-iop32x/system.h b/include/asm-arm/arch-iop32x/system.h
new file mode 100644
index 000000000000..17b7eb7e9c0d
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/system.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-arm/arch-iop32x/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <asm/mach-types.h>
12
13static inline void arch_idle(void)
14{
15 cpu_do_idle();
16}
17
18static inline void arch_reset(char mode)
19{
20 local_irq_disable();
21
22 if (machine_is_n2100()) {
23 gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW);
24 gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT);
25 while (1)
26 ;
27 }
28
29 *IOP3XX_PCSR = 0x30;
30
31 /* Jump into ROM at address 0 */
32 cpu_reset(0);
33}
diff --git a/include/asm-arm/arch-iop32x/timex.h b/include/asm-arm/arch-iop32x/timex.h
new file mode 100644
index 000000000000..9934b087311b
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/timex.h
@@ -0,0 +1,9 @@
1/*
2 * include/asm-arm/arch-iop32x/timex.h
3 *
4 * IOP32x architecture timex specifications
5 */
6
7#include <asm/hardware.h>
8
9#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/include/asm-arm/arch-iop32x/uncompress.h b/include/asm-arm/arch-iop32x/uncompress.h
new file mode 100644
index 000000000000..e64f52bf2bce
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/uncompress.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-arm/arch-iop32x/uncompress.h
3 */
4
5#include <asm/types.h>
6#include <asm/mach-types.h>
7#include <linux/serial_reg.h>
8#include <asm/hardware.h>
9
10static volatile u8 *uart_base;
11
12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
13
14static inline void putc(char c)
15{
16 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
17 barrier();
18 uart_base[UART_TX] = c;
19}
20
21static inline void flush(void)
22{
23}
24
25static __inline__ void __arch_decomp_setup(unsigned long arch_id)
26{
27 if (machine_is_iq80321())
28 uart_base = (volatile u8 *)IQ80321_UART;
29 else if (machine_is_iq31244())
30 uart_base = (volatile u8 *)IQ31244_UART;
31 else
32 uart_base = (volatile u8 *)0xfe800000;
33}
34
35/*
36 * nothing to do
37 */
38#define arch_decomp_setup() __arch_decomp_setup(arch_id)
39#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-iop32x/vmalloc.h b/include/asm-arm/arch-iop32x/vmalloc.h
new file mode 100644
index 000000000000..0a70baa19517
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * include/asm-arm/arch-iop32x/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe000000
diff --git a/include/asm-arm/arch-iop33x/debug-macro.S b/include/asm-arm/arch-iop33x/debug-macro.S
new file mode 100644
index 000000000000..9e7132ebe6a7
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/debug-macro.S
@@ -0,0 +1,24 @@
1/*
2 * include/asm-arm/arch-iop33x/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 .macro addruart, rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ mmu enabled?
17 moveq \rx, #0xff000000 @ physical
18 movne \rx, #0xfe000000 @ virtual
19 orr \rx, \rx, #0x00ff0000
20 orr \rx, \rx, #0x0000f700
21 .endm
22
23#define UART_SHIFT 2
24#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-iop33x/dma.h b/include/asm-arm/arch-iop33x/dma.h
new file mode 100644
index 000000000000..b7775fdc5ad3
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/dma.h
@@ -0,0 +1,9 @@
1/*
2 * include/asm-arm/arch-iop33x/dma.h
3 *
4 * Copyright (C) 2004 Intel Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
diff --git a/include/asm-arm/arch-iop33x/entry-macro.S b/include/asm-arm/arch-iop33x/entry-macro.S
new file mode 100644
index 000000000000..92b791702e34
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/entry-macro.S
@@ -0,0 +1,22 @@
1/*
2 * include/asm-arm/arch-iop33x/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IOP33x-based platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <asm/arch/iop33x.h>
11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16 ldr \base, =IOP3XX_REG_ADDR(0x07C8)
17 ldr \irqstat, [\base] @ Read IINTVEC
18 cmp \irqstat, #0
19 ldreq \irqstat, [\base] @ erratum 63 workaround
20 adds \irqnr, \irqstat, #1
21 movne \irqnr, \irqstat, lsr #2
22 .endm
diff --git a/include/asm-arm/arch-iop33x/hardware.h b/include/asm-arm/arch-iop33x/hardware.h
new file mode 100644
index 000000000000..0659cf94d040
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/hardware.h
@@ -0,0 +1,46 @@
1/*
2 * include/asm-arm/arch-iop33x/hardware.h
3 */
4
5#ifndef __HARDWARE_H
6#define __HARDWARE_H
7
8#include <asm/types.h>
9
10/*
11 * Note about PCI IO space mappings
12 *
13 * To make IO space accesses efficient, we store virtual addresses in
14 * the IO resources.
15 *
16 * The PCI IO space is located at virtual 0xfe000000 from physical
17 * 0x90000000. The PCI BARs must be programmed with physical addresses,
18 * but when we read them, we convert them to virtual addresses. See
19 * arch/arm/mach-iop3xx/iop3xx-pci.c
20 */
21#define pcibios_assign_all_busses() 1
22#define PCIBIOS_MIN_IO 0x00000000
23#define PCIBIOS_MIN_MEM 0x00000000
24
25#ifndef __ASSEMBLY__
26void iop33x_init_irq(void);
27
28extern struct platform_device iop33x_uart0_device;
29extern struct platform_device iop33x_uart1_device;
30#endif
31
32
33/*
34 * Generic chipset bits
35 *
36 */
37#include "iop33x.h"
38
39/*
40 * Board specific bits
41 */
42#include "iq80331.h"
43#include "iq80332.h"
44
45
46#endif
diff --git a/include/asm-arm/arch-iop33x/io.h b/include/asm-arm/arch-iop33x/io.h
new file mode 100644
index 000000000000..c017402bab96
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/io.h
@@ -0,0 +1,21 @@
1/*
2 * include/asm-arm/arch-iop33x/io.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __IO_H
12#define __IO_H
13
14#include <asm/hardware.h>
15
16#define IO_SPACE_LIMIT 0xffffffff
17#define __io(p) ((void __iomem *)(p))
18#define __mem_pci(a) (a)
19
20
21#endif
diff --git a/include/asm-arm/arch-iop33x/iop33x.h b/include/asm-arm/arch-iop33x/iop33x.h
new file mode 100644
index 000000000000..7ac6e93db5ff
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/iop33x.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-arm/arch-iop33x/iop33x.h
3 *
4 * Intel IOP33X Chip definitions
5 *
6 * Author: Dave Jiang (dave.jiang@intel.com)
7 * Copyright (C) 2003, 2004 Intel Corp.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __IOP33X_H
15#define __IOP33X_H
16
17/*
18 * Peripherals that are shared between the iop32x and iop33x but
19 * located at different addresses.
20 */
21#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1780 + (reg))
22#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07d0 + (reg))
23
24#include <asm/hardware/iop3xx.h>
25
26/* UARTs */
27#define IOP33X_UART0_PHYS (IOP3XX_PERIPHERAL_PHYS_BASE + 0x1700)
28#define IOP33X_UART0_VIRT (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1700)
29#define IOP33X_UART1_PHYS (IOP3XX_PERIPHERAL_PHYS_BASE + 0x1740)
30#define IOP33X_UART1_VIRT (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1740)
31
32
33#endif
diff --git a/include/asm-arm/arch-iop3xx/iq80331.h b/include/asm-arm/arch-iop33x/iq80331.h
index 0668e78d483e..79b9302017ea 100644
--- a/include/asm-arm/arch-iop3xx/iq80331.h
+++ b/include/asm-arm/arch-iop33x/iq80331.h
@@ -1,23 +1,16 @@
1/* 1/*
2 * linux/include/asm/arch-iop3xx/iq80331.h 2 * include/asm-arm/arch-iop33x/iq80331.h
3 * 3 *
4 * Intel IQ80331 evaluation board registers 4 * Intel IQ80331 evaluation board registers
5 */ 5 */
6 6
7#ifndef _IQ80331_H_ 7#ifndef __IQ80331_H
8#define _IQ80331_H_ 8#define __IQ80331_H
9
10#define IQ80331_FLASHBASE 0xc0000000 /* Flash */
11#define IQ80331_FLASHSIZE 0x00800000
12#define IQ80331_FLASHWIDTH 1
13 9
14#define IQ80331_7SEG_1 0xce840000 /* 7-Segment MSB */ 10#define IQ80331_7SEG_1 0xce840000 /* 7-Segment MSB */
15#define IQ80331_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */ 11#define IQ80331_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */
16#define IQ80331_ROTARY_SW 0xce8d0000 /* Rotary Switch */ 12#define IQ80331_ROTARY_SW 0xce8d0000 /* Rotary Switch */
17#define IQ80331_BATT_STAT 0xce8f0000 /* Battery Status */ 13#define IQ80331_BATT_STAT 0xce8f0000 /* Battery Status */
18 14
19#ifndef __ASSEMBLY__
20extern void iq80331_map_io(void);
21#endif
22 15
23#endif // _IQ80331_H_ 16#endif
diff --git a/include/asm-arm/arch-iop3xx/iq80332.h b/include/asm-arm/arch-iop33x/iq80332.h
index e5fff1775d1a..053165629492 100644
--- a/include/asm-arm/arch-iop3xx/iq80332.h
+++ b/include/asm-arm/arch-iop33x/iq80332.h
@@ -1,23 +1,16 @@
1/* 1/*
2 * linux/include/asm/arch-iop3xx/iq80332.h 2 * include/asm-arm/arch-iop33x/iq80332.h
3 * 3 *
4 * Intel IQ80332 evaluation board registers 4 * Intel IQ80332 evaluation board registers
5 */ 5 */
6 6
7#ifndef _IQ80332_H_ 7#ifndef __IQ80332_H
8#define _IQ80332_H_ 8#define __IQ80332_H
9
10#define IQ80332_FLASHBASE 0xc0000000 /* Flash */
11#define IQ80332_FLASHSIZE 0x00800000
12#define IQ80332_FLASHWIDTH 1
13 9
14#define IQ80332_7SEG_1 0xce840000 /* 7-Segment MSB */ 10#define IQ80332_7SEG_1 0xce840000 /* 7-Segment MSB */
15#define IQ80332_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */ 11#define IQ80332_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */
16#define IQ80332_ROTARY_SW 0xce8d0000 /* Rotary Switch */ 12#define IQ80332_ROTARY_SW 0xce8d0000 /* Rotary Switch */
17#define IQ80332_BATT_STAT 0xce8f0000 /* Battery Status */ 13#define IQ80332_BATT_STAT 0xce8f0000 /* Battery Status */
18 14
19#ifndef __ASSEMBLY__
20extern void iq80332_map_io(void);
21#endif
22 15
23#endif // _IQ80332_H_ 16#endif
diff --git a/include/asm-arm/arch-iop33x/irqs.h b/include/asm-arm/arch-iop33x/irqs.h
new file mode 100644
index 000000000000..d045f8403396
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/irqs.h
@@ -0,0 +1,60 @@
1/*
2 * include/asm-arm/arch-iop33x/irqs.h
3 *
4 * Author: Dave Jiang (dave.jiang@intel.com)
5 * Copyright: (C) 2003 Intel Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __IRQS_H
13#define __IRQS_H
14
15/*
16 * IOP80331 chipset interrupts
17 */
18#define IRQ_IOP33X_DMA0_EOT 0
19#define IRQ_IOP33X_DMA0_EOC 1
20#define IRQ_IOP33X_DMA1_EOT 2
21#define IRQ_IOP33X_DMA1_EOC 3
22#define IRQ_IOP33X_AA_EOT 6
23#define IRQ_IOP33X_AA_EOC 7
24#define IRQ_IOP33X_TIMER0 8
25#define IRQ_IOP33X_TIMER1 9
26#define IRQ_IOP33X_I2C_0 10
27#define IRQ_IOP33X_I2C_1 11
28#define IRQ_IOP33X_MSG 12
29#define IRQ_IOP33X_MSGIBQ 13
30#define IRQ_IOP33X_ATU_BIST 14
31#define IRQ_IOP33X_PERFMON 15
32#define IRQ_IOP33X_CORE_PMU 16
33#define IRQ_IOP33X_XINT0 24
34#define IRQ_IOP33X_XINT1 25
35#define IRQ_IOP33X_XINT2 26
36#define IRQ_IOP33X_XINT3 27
37#define IRQ_IOP33X_XINT8 32
38#define IRQ_IOP33X_XINT9 33
39#define IRQ_IOP33X_XINT10 34
40#define IRQ_IOP33X_XINT11 35
41#define IRQ_IOP33X_XINT12 36
42#define IRQ_IOP33X_XINT13 37
43#define IRQ_IOP33X_XINT14 38
44#define IRQ_IOP33X_XINT15 39
45#define IRQ_IOP33X_UART0 51
46#define IRQ_IOP33X_UART1 52
47#define IRQ_IOP33X_PBIE 53
48#define IRQ_IOP33X_ATU_CRW 54
49#define IRQ_IOP33X_ATU_ERR 55
50#define IRQ_IOP33X_MCU_ERR 56
51#define IRQ_IOP33X_DMA0_ERR 57
52#define IRQ_IOP33X_DMA1_ERR 58
53#define IRQ_IOP33X_AA_ERR 60
54#define IRQ_IOP33X_MSG_ERR 62
55#define IRQ_IOP33X_HPI 63
56
57#define NR_IRQS 64
58
59
60#endif
diff --git a/include/asm-arm/arch-iop33x/memory.h b/include/asm-arm/arch-iop33x/memory.h
new file mode 100644
index 000000000000..0d39139b241e
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/memory.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-arm/arch-iop33x/memory.h
3 */
4
5#ifndef __MEMORY_H
6#define __MEMORY_H
7
8#include <asm/hardware.h>
9
10/*
11 * Physical DRAM offset.
12 */
13#define PHYS_OFFSET UL(0x00000000)
14
15/*
16 * Virtual view <-> PCI DMA view memory address translations
17 * virt_to_bus: Used to translate the virtual address to an
18 * address suitable to be passed to set_dma_addr
19 * bus_to_virt: Used to convert an address for DMA operations
20 * to an address that the kernel can use.
21 */
22#define __virt_to_bus(x) (((__virt_to_phys(x)) & ~(*IOP3XX_IATVR2)) | ((*IOP3XX_IABAR2) & 0xfffffff0))
23#define __bus_to_virt(x) (__phys_to_virt(((x) & ~(*IOP3XX_IALR2)) | ( *IOP3XX_IATVR2)))
24
25
26#endif
diff --git a/include/asm-arm/arch-iop33x/system.h b/include/asm-arm/arch-iop33x/system.h
new file mode 100644
index 000000000000..00dd07ece262
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/system.h
@@ -0,0 +1,22 @@
1/*
2 * include/asm-arm/arch-iop33x/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
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
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
15
16static inline void arch_reset(char mode)
17{
18 *IOP3XX_PCSR = 0x30;
19
20 /* Jump into ROM at address 0 */
21 cpu_reset(0);
22}
diff --git a/include/asm-arm/arch-iop33x/timex.h b/include/asm-arm/arch-iop33x/timex.h
new file mode 100644
index 000000000000..fe3e1e369ff9
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/timex.h
@@ -0,0 +1,9 @@
1/*
2 * include/asm-arm/arch-iop33x/timex.h
3 *
4 * IOP3xx architecture timex specifications
5 */
6
7#include <asm/hardware.h>
8
9#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/include/asm-arm/arch-iop33x/uncompress.h b/include/asm-arm/arch-iop33x/uncompress.h
new file mode 100644
index 000000000000..e17fbc05877b
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/uncompress.h
@@ -0,0 +1,37 @@
1/*
2 * include/asm-arm/arch-iop33x/uncompress.h
3 */
4
5#include <asm/types.h>
6#include <asm/mach-types.h>
7#include <linux/serial_reg.h>
8#include <asm/hardware.h>
9
10static volatile u32 *uart_base;
11
12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
13
14static inline void putc(char c)
15{
16 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
17 barrier();
18 uart_base[UART_TX] = c;
19}
20
21static inline void flush(void)
22{
23}
24
25static __inline__ void __arch_decomp_setup(unsigned long arch_id)
26{
27 if (machine_is_iq80331() || machine_is_iq80332())
28 uart_base = (volatile u32 *)IOP33X_UART0_PHYS;
29 else
30 uart_base = (volatile u32 *)0xfe800000;
31}
32
33/*
34 * nothing to do
35 */
36#define arch_decomp_setup() __arch_decomp_setup(arch_id)
37#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-iop33x/vmalloc.h b/include/asm-arm/arch-iop33x/vmalloc.h
new file mode 100644
index 000000000000..66f545a7f4fc
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * include/asm-arm/arch-iop33x/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe000000
diff --git a/include/asm-arm/arch-iop3xx/debug-macro.S b/include/asm-arm/arch-iop3xx/debug-macro.S
deleted file mode 100644
index ce007e531994..000000000000
--- a/include/asm-arm/arch-iop3xx/debug-macro.S
+++ /dev/null
@@ -1,35 +0,0 @@
1/* linux/include/asm-arm/arch-iop3xx/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .macro addruart,rx
15 mov \rx, #0xfe000000 @ physical
16#if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244)
17 orr \rx, \rx, #0x00800000 @ location of the UART
18#elif defined(CONFIG_ARCH_IOP331)
19 mrc p15, 0, \rx, c1, c0
20 tst \rx, #1 @ MMU enabled?
21 moveq \rx, #0x000fe000 @ Physical Base
22 movne \rx, #0
23 orr \rx, \rx, #0xfe000000
24 orr \rx, \rx, #0x00f00000 @ Virtual Base
25 orr \rx, \rx, #0x00001700 @ location of the UART
26#else
27#error Unknown IOP3XX implementation
28#endif
29 .endm
30
31#if !defined(CONFIG_ARCH_IQ80321) || !defined(CONFIG_ARCH_IQ31244) || !defined(CONFIG_ARCH_IQ80331)
32#define FLOW_CONTROL
33#endif
34#define UART_SHIFT 0
35#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-iop3xx/entry-macro.S b/include/asm-arm/arch-iop3xx/entry-macro.S
deleted file mode 100644
index 926668c098a5..000000000000
--- a/include/asm-arm/arch-iop3xx/entry-macro.S
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * include/asm-arm/arch-iop3xx/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IOP3xx-based platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <asm/arch/irqs.h>
11
12#if defined(CONFIG_ARCH_IOP321)
13 .macro disable_fiq
14 .endm
15
16 /*
17 * Note: only deal with normal interrupts, not FIQ
18 */
19 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
20 mov \irqnr, #0
21 mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC
22 cmp \irqstat, #0
23 beq 1001f
24 clz \irqnr, \irqstat
25 mov \base, #31
26 subs \irqnr,\base,\irqnr
27 add \irqnr,\irqnr,#IRQ_IOP321_DMA0_EOT
281001:
29 .endm
30
31#elif defined(CONFIG_ARCH_IOP331)
32 .macro disable_fiq
33 .endm
34
35 /*
36 * Note: only deal with normal interrupts, not FIQ
37 */
38 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
39 mov \irqnr, #0
40 mrc p6, 0, \irqstat, c4, c0, 0 @ Read IINTSRC0
41 cmp \irqstat, #0
42 bne 1002f
43 mrc p6, 0, \irqstat, c5, c0, 0 @ Read IINTSRC1
44 cmp \irqstat, #0
45 beq 1001f
46 clz \irqnr, \irqstat
47 rsbs \irqnr,\irqnr,#31 @ recommend by RMK
48 add \irqnr,\irqnr,#IRQ_IOP331_XINT8
49 b 1001f
501002: clz \irqnr, \irqstat
51 rsbs \irqnr,\irqnr,#31 @ recommend by RMK
52 add \irqnr,\irqnr,#IRQ_IOP331_DMA0_EOT
531001:
54 .endm
55
56#endif
57
diff --git a/include/asm-arm/arch-iop3xx/hardware.h b/include/asm-arm/arch-iop3xx/hardware.h
deleted file mode 100644
index 3b138171d086..000000000000
--- a/include/asm-arm/arch-iop3xx/hardware.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/hardware.h
3 */
4#ifndef __ASM_ARCH_HARDWARE_H
5#define __ASM_ARCH_HARDWARE_H
6
7#include <asm/types.h>
8
9/*
10 * Note about PCI IO space mappings
11 *
12 * To make IO space accesses efficient, we store virtual addresses in
13 * the IO resources.
14 *
15 * The PCI IO space is located at virtual 0xfe000000 from physical
16 * 0x90000000. The PCI BARs must be programmed with physical addresses,
17 * but when we read them, we convert them to virtual addresses. See
18 * arch/arm/mach-iop3xx/iop3xx-pci.c
19 */
20
21#define pcibios_assign_all_busses() 1
22
23
24/*
25 * The min PCI I/O and MEM space are dependent on what specific
26 * chipset/platform we are running on, so instead of hardcoding with
27 * #ifdefs, we just fill these in the platform level PCI init code.
28 */
29#ifndef __ASSEMBLY__
30extern unsigned long iop3xx_pcibios_min_io;
31extern unsigned long iop3xx_pcibios_min_mem;
32
33extern unsigned int processor_id;
34#endif
35
36/*
37 * We just set these to zero since they are really bogus anyways
38 */
39#define PCIBIOS_MIN_IO (iop3xx_pcibios_min_io)
40#define PCIBIOS_MIN_MEM (iop3xx_pcibios_min_mem)
41
42/*
43 * Generic chipset bits
44 *
45 */
46#include "iop321.h"
47#include "iop331.h"
48
49/*
50 * Board specific bits
51 */
52#include "iq80321.h"
53#include "iq31244.h"
54#include "iq80331.h"
55#include "iq80332.h"
56
57#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-iop3xx/iop321-irqs.h b/include/asm-arm/arch-iop3xx/iop321-irqs.h
deleted file mode 100644
index 2fcc1654cb9d..000000000000
--- a/include/asm-arm/arch-iop3xx/iop321-irqs.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/irqs.h
3 *
4 * Author: Rory Bolt <rorybolt@pacbell.net>
5 * Copyright: (C) 2002 Rory Bolt
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#ifndef _IOP321_IRQS_H_
13#define _IOP321_IRQS_H_
14
15/*
16 * IOP80321 chipset interrupts
17 */
18#define IOP321_IRQ_OFS 0
19#define IOP321_IRQ(x) (IOP321_IRQ_OFS + (x))
20
21/*
22 * On IRQ or FIQ register
23 */
24#define IRQ_IOP321_DMA0_EOT IOP321_IRQ(0)
25#define IRQ_IOP321_DMA0_EOC IOP321_IRQ(1)
26#define IRQ_IOP321_DMA1_EOT IOP321_IRQ(2)
27#define IRQ_IOP321_DMA1_EOC IOP321_IRQ(3)
28#define IRQ_IOP321_RSVD_4 IOP321_IRQ(4)
29#define IRQ_IOP321_RSVD_5 IOP321_IRQ(5)
30#define IRQ_IOP321_AA_EOT IOP321_IRQ(6)
31#define IRQ_IOP321_AA_EOC IOP321_IRQ(7)
32#define IRQ_IOP321_CORE_PMON IOP321_IRQ(8)
33#define IRQ_IOP321_TIMER0 IOP321_IRQ(9)
34#define IRQ_IOP321_TIMER1 IOP321_IRQ(10)
35#define IRQ_IOP321_I2C_0 IOP321_IRQ(11)
36#define IRQ_IOP321_I2C_1 IOP321_IRQ(12)
37#define IRQ_IOP321_MESSAGING IOP321_IRQ(13)
38#define IRQ_IOP321_ATU_BIST IOP321_IRQ(14)
39#define IRQ_IOP321_PERFMON IOP321_IRQ(15)
40#define IRQ_IOP321_CORE_PMU IOP321_IRQ(16)
41#define IRQ_IOP321_BIU_ERR IOP321_IRQ(17)
42#define IRQ_IOP321_ATU_ERR IOP321_IRQ(18)
43#define IRQ_IOP321_MCU_ERR IOP321_IRQ(19)
44#define IRQ_IOP321_DMA0_ERR IOP321_IRQ(20)
45#define IRQ_IOP321_DMA1_ERR IOP321_IRQ(21)
46#define IRQ_IOP321_RSVD_22 IOP321_IRQ(22)
47#define IRQ_IOP321_AA_ERR IOP321_IRQ(23)
48#define IRQ_IOP321_MSG_ERR IOP321_IRQ(24)
49#define IRQ_IOP321_SSP IOP321_IRQ(25)
50#define IRQ_IOP321_RSVD_26 IOP321_IRQ(26)
51#define IRQ_IOP321_XINT0 IOP321_IRQ(27)
52#define IRQ_IOP321_XINT1 IOP321_IRQ(28)
53#define IRQ_IOP321_XINT2 IOP321_IRQ(29)
54#define IRQ_IOP321_XINT3 IOP321_IRQ(30)
55#define IRQ_IOP321_HPI IOP321_IRQ(31)
56
57#define NR_IOP321_IRQS (IOP321_IRQ(31) + 1)
58
59#define NR_IRQS NR_IOP321_IRQS
60
61
62/*
63 * Interrupts available on the IQ80321 board
64 */
65
66/*
67 * On board devices
68 */
69#define IRQ_IQ80321_I82544 IRQ_IOP321_XINT0
70#define IRQ_IQ80321_UART IRQ_IOP321_XINT1
71
72/*
73 * PCI interrupts
74 */
75#define IRQ_IQ80321_INTA IRQ_IOP321_XINT0
76#define IRQ_IQ80321_INTB IRQ_IOP321_XINT1
77#define IRQ_IQ80321_INTC IRQ_IOP321_XINT2
78#define IRQ_IQ80321_INTD IRQ_IOP321_XINT3
79
80/*
81 * Interrupts on the IQ31244 board
82 */
83
84/*
85 * On board devices
86 */
87#define IRQ_IQ31244_UART IRQ_IOP321_XINT1
88#define IRQ_IQ31244_I82546 IRQ_IOP321_XINT0
89#define IRQ_IQ31244_SATA IRQ_IOP321_XINT2
90#define IRQ_IQ31244_PCIX_SLOT IRQ_IOP321_XINT3
91
92/*
93 * PCI interrupts
94 */
95#define IRQ_IQ31244_INTA IRQ_IOP321_XINT0
96#define IRQ_IQ31244_INTB IRQ_IOP321_XINT1
97#define IRQ_IQ31244_INTC IRQ_IOP321_XINT2
98#define IRQ_IQ31244_INTD IRQ_IOP321_XINT3
99
100#endif // _IOP321_IRQ_H_
diff --git a/include/asm-arm/arch-iop3xx/iop321.h b/include/asm-arm/arch-iop3xx/iop321.h
deleted file mode 100644
index f8df778a356f..000000000000
--- a/include/asm-arm/arch-iop3xx/iop321.h
+++ /dev/null
@@ -1,345 +0,0 @@
1/*
2 * linux/include/asm/arch-iop3xx/iop321.h
3 *
4 * Intel IOP321 Chip definitions
5 *
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright (C) 2004 Intel Corp.
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 _IOP321_HW_H_
16#define _IOP321_HW_H_
17
18
19/*
20 * This is needed for mixed drivers that need to work on all
21 * IOP3xx variants but behave slightly differently on each.
22 */
23#ifndef __ASSEMBLY__
24#ifdef CONFIG_ARCH_IOP321
25#define iop_is_321() (((processor_id & 0xfffff5e0) == 0x69052420))
26#else
27#define iop_is_321() 0
28#endif
29#endif
30
31/*
32 * IOP321 I/O and Mem space regions for PCI autoconfiguration
33 */
34#define IOP321_PCI_IO_WINDOW_SIZE 0x00010000
35#define IOP321_PCI_LOWER_IO_PA 0x90000000
36#define IOP321_PCI_LOWER_IO_VA 0xfe000000
37#define IOP321_PCI_LOWER_IO_BA (*IOP321_OIOWTVR)
38#define IOP321_PCI_UPPER_IO_PA (IOP321_PCI_LOWER_IO_PA + IOP321_PCI_IO_WINDOW_SIZE - 1)
39#define IOP321_PCI_UPPER_IO_VA (IOP321_PCI_LOWER_IO_VA + IOP321_PCI_IO_WINDOW_SIZE - 1)
40#define IOP321_PCI_UPPER_IO_BA (IOP321_PCI_LOWER_IO_BA + IOP321_PCI_IO_WINDOW_SIZE - 1)
41#define IOP321_PCI_IO_OFFSET (IOP321_PCI_LOWER_IO_VA - IOP321_PCI_LOWER_IO_BA)
42
43/* #define IOP321_PCI_MEM_WINDOW_SIZE (~*IOP321_IALR1 + 1) */
44#define IOP321_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */
45#define IOP321_PCI_LOWER_MEM_PA 0x80000000
46#define IOP321_PCI_LOWER_MEM_BA (*IOP321_OMWTVR0)
47#define IOP321_PCI_UPPER_MEM_PA (IOP321_PCI_LOWER_MEM_PA + IOP321_PCI_MEM_WINDOW_SIZE - 1)
48#define IOP321_PCI_UPPER_MEM_BA (IOP321_PCI_LOWER_MEM_BA + IOP321_PCI_MEM_WINDOW_SIZE - 1)
49#define IOP321_PCI_MEM_OFFSET (IOP321_PCI_LOWER_MEM_PA - IOP321_PCI_LOWER_MEM_BA)
50
51
52/*
53 * IOP321 chipset registers
54 */
55#define IOP321_VIRT_MEM_BASE 0xfeffe000 /* chip virtual mem address*/
56#define IOP321_PHYS_MEM_BASE 0xffffe000 /* chip physical memory address */
57#define IOP321_REG_ADDR(reg) (IOP321_VIRT_MEM_BASE | (reg))
58
59/* Reserved 0x00000000 through 0x000000FF */
60
61/* Address Translation Unit 0x00000100 through 0x000001FF */
62#define IOP321_ATUVID (volatile u16 *)IOP321_REG_ADDR(0x00000100)
63#define IOP321_ATUDID (volatile u16 *)IOP321_REG_ADDR(0x00000102)
64#define IOP321_ATUCMD (volatile u16 *)IOP321_REG_ADDR(0x00000104)
65#define IOP321_ATUSR (volatile u16 *)IOP321_REG_ADDR(0x00000106)
66#define IOP321_ATURID (volatile u8 *)IOP321_REG_ADDR(0x00000108)
67#define IOP321_ATUCCR (volatile u32 *)IOP321_REG_ADDR(0x00000109)
68#define IOP321_ATUCLSR (volatile u8 *)IOP321_REG_ADDR(0x0000010C)
69#define IOP321_ATULT (volatile u8 *)IOP321_REG_ADDR(0x0000010D)
70#define IOP321_ATUHTR (volatile u8 *)IOP321_REG_ADDR(0x0000010E)
71#define IOP321_ATUBIST (volatile u8 *)IOP321_REG_ADDR(0x0000010F)
72#define IOP321_IABAR0 (volatile u32 *)IOP321_REG_ADDR(0x00000110)
73#define IOP321_IAUBAR0 (volatile u32 *)IOP321_REG_ADDR(0x00000114)
74#define IOP321_IABAR1 (volatile u32 *)IOP321_REG_ADDR(0x00000118)
75#define IOP321_IAUBAR1 (volatile u32 *)IOP321_REG_ADDR(0x0000011C)
76#define IOP321_IABAR2 (volatile u32 *)IOP321_REG_ADDR(0x00000120)
77#define IOP321_IAUBAR2 (volatile u32 *)IOP321_REG_ADDR(0x00000124)
78#define IOP321_ASVIR (volatile u16 *)IOP321_REG_ADDR(0x0000012C)
79#define IOP321_ASIR (volatile u16 *)IOP321_REG_ADDR(0x0000012E)
80#define IOP321_ERBAR (volatile u32 *)IOP321_REG_ADDR(0x00000130)
81/* Reserved 0x00000134 through 0x0000013B */
82#define IOP321_ATUILR (volatile u8 *)IOP321_REG_ADDR(0x0000013C)
83#define IOP321_ATUIPR (volatile u8 *)IOP321_REG_ADDR(0x0000013D)
84#define IOP321_ATUMGNT (volatile u8 *)IOP321_REG_ADDR(0x0000013E)
85#define IOP321_ATUMLAT (volatile u8 *)IOP321_REG_ADDR(0x0000013F)
86#define IOP321_IALR0 (volatile u32 *)IOP321_REG_ADDR(0x00000140)
87#define IOP321_IATVR0 (volatile u32 *)IOP321_REG_ADDR(0x00000144)
88#define IOP321_ERLR (volatile u32 *)IOP321_REG_ADDR(0x00000148)
89#define IOP321_ERTVR (volatile u32 *)IOP321_REG_ADDR(0x0000014C)
90#define IOP321_IALR1 (volatile u32 *)IOP321_REG_ADDR(0x00000150)
91#define IOP321_IALR2 (volatile u32 *)IOP321_REG_ADDR(0x00000154)
92#define IOP321_IATVR2 (volatile u32 *)IOP321_REG_ADDR(0x00000158)
93#define IOP321_OIOWTVR (volatile u32 *)IOP321_REG_ADDR(0x0000015C)
94#define IOP321_OMWTVR0 (volatile u32 *)IOP321_REG_ADDR(0x00000160)
95#define IOP321_OUMWTVR0 (volatile u32 *)IOP321_REG_ADDR(0x00000164)
96#define IOP321_OMWTVR1 (volatile u32 *)IOP321_REG_ADDR(0x00000168)
97#define IOP321_OUMWTVR1 (volatile u32 *)IOP321_REG_ADDR(0x0000016C)
98/* Reserved 0x00000170 through 0x00000177*/
99#define IOP321_OUDWTVR (volatile u32 *)IOP321_REG_ADDR(0x00000178)
100/* Reserved 0x0000017C through 0x0000017F*/
101#define IOP321_ATUCR (volatile u32 *)IOP321_REG_ADDR(0x00000180)
102#define IOP321_PCSR (volatile u32 *)IOP321_REG_ADDR(0x00000184)
103#define IOP321_ATUISR (volatile u32 *)IOP321_REG_ADDR(0x00000188)
104#define IOP321_ATUIMR (volatile u32 *)IOP321_REG_ADDR(0x0000018C)
105#define IOP321_IABAR3 (volatile u32 *)IOP321_REG_ADDR(0x00000190)
106#define IOP321_IAUBAR3 (volatile u32 *)IOP321_REG_ADDR(0x00000194)
107#define IOP321_IALR3 (volatile u32 *)IOP321_REG_ADDR(0x00000198)
108#define IOP321_IATVR3 (volatile u32 *)IOP321_REG_ADDR(0x0000019C)
109/* Reserved 0x000001A0 through 0x000001A3*/
110#define IOP321_OCCAR (volatile u32 *)IOP321_REG_ADDR(0x000001A4)
111/* Reserved 0x000001A8 through 0x000001AB*/
112#define IOP321_OCCDR (volatile u32 *)IOP321_REG_ADDR(0x000001AC)
113/* Reserved 0x000001B0 through 0x000001BB*/
114#define IOP321_PDSCR (volatile u32 *)IOP321_REG_ADDR(0x000001BC)
115#define IOP321_PMCAPID (volatile u8 *)IOP321_REG_ADDR(0x000001C0)
116#define IOP321_PMNEXT (volatile u8 *)IOP321_REG_ADDR(0x000001C1)
117#define IOP321_APMCR (volatile u16 *)IOP321_REG_ADDR(0x000001C2)
118#define IOP321_APMCSR (volatile u16 *)IOP321_REG_ADDR(0x000001C4)
119/* Reserved 0x000001C6 through 0x000001DF */
120#define IOP321_PCIXCAPID (volatile u8 *)IOP321_REG_ADDR(0x000001E0)
121#define IOP321_PCIXNEXT (volatile u8 *)IOP321_REG_ADDR(0x000001E1)
122#define IOP321_PCIXCMD (volatile u16 *)IOP321_REG_ADDR(0x000001E2)
123#define IOP321_PCIXSR (volatile u32 *)IOP321_REG_ADDR(0x000001E4)
124#define IOP321_PCIIRSR (volatile u32 *)IOP321_REG_ADDR(0x000001EC)
125
126/* Messaging Unit 0x00000300 through 0x000003FF */
127
128/* Reserved 0x00000300 through 0x0000030c */
129#define IOP321_IMR0 (volatile u32 *)IOP321_REG_ADDR(0x00000310)
130#define IOP321_IMR1 (volatile u32 *)IOP321_REG_ADDR(0x00000314)
131#define IOP321_OMR0 (volatile u32 *)IOP321_REG_ADDR(0x00000318)
132#define IOP321_OMR1 (volatile u32 *)IOP321_REG_ADDR(0x0000031C)
133#define IOP321_IDR (volatile u32 *)IOP321_REG_ADDR(0x00000320)
134#define IOP321_IISR (volatile u32 *)IOP321_REG_ADDR(0x00000324)
135#define IOP321_IIMR (volatile u32 *)IOP321_REG_ADDR(0x00000328)
136#define IOP321_ODR (volatile u32 *)IOP321_REG_ADDR(0x0000032C)
137#define IOP321_OISR (volatile u32 *)IOP321_REG_ADDR(0x00000330)
138#define IOP321_OIMR (volatile u32 *)IOP321_REG_ADDR(0x00000334)
139/* Reserved 0x00000338 through 0x0000034F */
140#define IOP321_MUCR (volatile u32 *)IOP321_REG_ADDR(0x00000350)
141#define IOP321_QBAR (volatile u32 *)IOP321_REG_ADDR(0x00000354)
142/* Reserved 0x00000358 through 0x0000035C */
143#define IOP321_IFHPR (volatile u32 *)IOP321_REG_ADDR(0x00000360)
144#define IOP321_IFTPR (volatile u32 *)IOP321_REG_ADDR(0x00000364)
145#define IOP321_IPHPR (volatile u32 *)IOP321_REG_ADDR(0x00000368)
146#define IOP321_IPTPR (volatile u32 *)IOP321_REG_ADDR(0x0000036C)
147#define IOP321_OFHPR (volatile u32 *)IOP321_REG_ADDR(0x00000370)
148#define IOP321_OFTPR (volatile u32 *)IOP321_REG_ADDR(0x00000374)
149#define IOP321_OPHPR (volatile u32 *)IOP321_REG_ADDR(0x00000378)
150#define IOP321_OPTPR (volatile u32 *)IOP321_REG_ADDR(0x0000037C)
151#define IOP321_IAR (volatile u32 *)IOP321_REG_ADDR(0x00000380)
152
153#define IOP321_IIxR_MASK 0x7f /* masks all */
154#define IOP321_IIxR_IRI 0x40 /* RC Index Register Interrupt */
155#define IOP321_IIxR_OFQF 0x20 /* RC Output Free Q Full (ERROR) */
156#define IOP321_IIxR_ipq 0x10 /* RC Inbound Post Q (post) */
157#define IOP321_IIxR_ERRDI 0x08 /* RO Error Doorbell Interrupt */
158#define IOP321_IIxR_IDI 0x04 /* RO Inbound Doorbell Interrupt */
159#define IOP321_IIxR_IM1 0x02 /* RC Inbound Message 1 Interrupt */
160#define IOP321_IIxR_IM0 0x01 /* RC Inbound Message 0 Interrupt */
161
162/* Reserved 0x00000384 through 0x000003FF */
163
164/* DMA Controller 0x00000400 through 0x000004FF */
165#define IOP321_DMA0_CCR (volatile u32 *)IOP321_REG_ADDR(0x00000400)
166#define IOP321_DMA0_CSR (volatile u32 *)IOP321_REG_ADDR(0x00000404)
167#define IOP321_DMA0_DAR (volatile u32 *)IOP321_REG_ADDR(0x0000040C)
168#define IOP321_DMA0_NDAR (volatile u32 *)IOP321_REG_ADDR(0x00000410)
169#define IOP321_DMA0_PADR (volatile u32 *)IOP321_REG_ADDR(0x00000414)
170#define IOP321_DMA0_PUADR (volatile u32 *)IOP321_REG_ADDR(0x00000418)
171#define IOP321_DMA0_LADR (volatile u32 *)IOP321_REG_ADDR(0X0000041C)
172#define IOP321_DMA0_BCR (volatile u32 *)IOP321_REG_ADDR(0x00000420)
173#define IOP321_DMA0_DCR (volatile u32 *)IOP321_REG_ADDR(0x00000424)
174/* Reserved 0x00000428 through 0x0000043C */
175#define IOP321_DMA1_CCR (volatile u32 *)IOP321_REG_ADDR(0x00000440)
176#define IOP321_DMA1_CSR (volatile u32 *)IOP321_REG_ADDR(0x00000444)
177#define IOP321_DMA1_DAR (volatile u32 *)IOP321_REG_ADDR(0x0000044C)
178#define IOP321_DMA1_NDAR (volatile u32 *)IOP321_REG_ADDR(0x00000450)
179#define IOP321_DMA1_PADR (volatile u32 *)IOP321_REG_ADDR(0x00000454)
180#define IOP321_DMA1_PUADR (volatile u32 *)IOP321_REG_ADDR(0x00000458)
181#define IOP321_DMA1_LADR (volatile u32 *)IOP321_REG_ADDR(0x0000045C)
182#define IOP321_DMA1_BCR (volatile u32 *)IOP321_REG_ADDR(0x00000460)
183#define IOP321_DMA1_DCR (volatile u32 *)IOP321_REG_ADDR(0x00000464)
184/* Reserved 0x00000468 through 0x000004FF */
185
186/* Memory controller 0x00000500 through 0x0005FF */
187
188/* Peripheral bus interface unit 0x00000680 through 0x0006FF */
189#define IOP321_PBCR (volatile u32 *)IOP321_REG_ADDR(0x00000680)
190#define IOP321_PBISR (volatile u32 *)IOP321_REG_ADDR(0x00000684)
191#define IOP321_PBBAR0 (volatile u32 *)IOP321_REG_ADDR(0x00000688)
192#define IOP321_PBLR0 (volatile u32 *)IOP321_REG_ADDR(0x0000068C)
193#define IOP321_PBBAR1 (volatile u32 *)IOP321_REG_ADDR(0x00000690)
194#define IOP321_PBLR1 (volatile u32 *)IOP321_REG_ADDR(0x00000694)
195#define IOP321_PBBAR2 (volatile u32 *)IOP321_REG_ADDR(0x00000698)
196#define IOP321_PBLR2 (volatile u32 *)IOP321_REG_ADDR(0x0000069C)
197#define IOP321_PBBAR3 (volatile u32 *)IOP321_REG_ADDR(0x000006A0)
198#define IOP321_PBLR3 (volatile u32 *)IOP321_REG_ADDR(0x000006A4)
199#define IOP321_PBBAR4 (volatile u32 *)IOP321_REG_ADDR(0x000006A8)
200#define IOP321_PBLR4 (volatile u32 *)IOP321_REG_ADDR(0x000006AC)
201#define IOP321_PBBAR5 (volatile u32 *)IOP321_REG_ADDR(0x000006B0)
202#define IOP321_PBLR5 (volatile u32 *)IOP321_REG_ADDR(0x000006B4)
203#define IOP321_PBDSCR (volatile u32 *)IOP321_REG_ADDR(0x000006B8)
204/* Reserved 0x000006BC */
205#define IOP321_PMBR0 (volatile u32 *)IOP321_REG_ADDR(0x000006C0)
206/* Reserved 0x000006C4 through 0x000006DC */
207#define IOP321_PMBR1 (volatile u32 *)IOP321_REG_ADDR(0x000006E0)
208#define IOP321_PMBR2 (volatile u32 *)IOP321_REG_ADDR(0x000006E4)
209
210#define IOP321_PBCR_EN 0x1
211
212#define IOP321_PBISR_BOOR_ERR 0x1
213
214/* Peripheral performance monitoring unit 0x00000700 through 0x00077F */
215#define IOP321_GTMR (volatile u32 *)IOP321_REG_ADDR(0x00000700)
216#define IOP321_ESR (volatile u32 *)IOP321_REG_ADDR(0x00000704)
217#define IOP321_EMISR (volatile u32 *)IOP321_REG_ADDR(0x00000708)
218/* reserved 0x00000070c */
219#define IOP321_GTSR (volatile u32 *)IOP321_REG_ADDR(0x00000710)
220/* PERC0 DOESN'T EXIST - index from 1! */
221#define IOP321_PERCR0 (volatile u32 *)IOP321_REG_ADDR(0x00000710)
222
223#define IOP321_GTMR_NGCE 0x04 /* (Not) Global Counter Enable */
224
225/* Internal arbitration unit 0x00000780 through 0x0007BF */
226#define IOP321_IACR (volatile u32 *)IOP321_REG_ADDR(0x00000780)
227#define IOP321_MTTR1 (volatile u32 *)IOP321_REG_ADDR(0x00000784)
228#define IOP321_MTTR2 (volatile u32 *)IOP321_REG_ADDR(0x00000788)
229
230/* General Purpose I/O Registers */
231#define IOP321_GPOE (volatile u32 *)IOP321_REG_ADDR(0x000007C4)
232#define IOP321_GPID (volatile u32 *)IOP321_REG_ADDR(0x000007C8)
233#define IOP321_GPOD (volatile u32 *)IOP321_REG_ADDR(0x000007CC)
234
235/* Interrupt Controller */
236#define IOP321_INTCTL (volatile u32 *)IOP321_REG_ADDR(0x000007D0)
237#define IOP321_INTSTR (volatile u32 *)IOP321_REG_ADDR(0x000007D4)
238#define IOP321_IINTSRC (volatile u32 *)IOP321_REG_ADDR(0x000007D8)
239#define IOP321_FINTSRC (volatile u32 *)IOP321_REG_ADDR(0x000007DC)
240
241/* Timers */
242
243#define IOP321_TU_TMR0 (volatile u32 *)IOP321_REG_ADDR(0x000007E0)
244#define IOP321_TU_TMR1 (volatile u32 *)IOP321_REG_ADDR(0x000007E4)
245
246#ifdef CONFIG_ARCH_IQ80321
247#define IOP321_TICK_RATE 200000000 /* 200 MHz clock */
248#elif defined(CONFIG_ARCH_IQ31244)
249#define IOP321_TICK_RATE 198000000 /* 33.000 MHz crystal */
250#endif
251
252#ifdef CONFIG_ARCH_EP80219
253#undef IOP321_TICK_RATE
254#define IOP321_TICK_RATE 200000000 /* 33.333333 Mhz crystal */
255#endif
256
257#define IOP321_TMR_TC 0x01
258#define IOP321_TMR_EN 0x02
259#define IOP321_TMR_RELOAD 0x04
260#define IOP321_TMR_PRIVILEGED 0x09
261
262#define IOP321_TMR_RATIO_1_1 0x00
263#define IOP321_TMR_RATIO_4_1 0x10
264#define IOP321_TMR_RATIO_8_1 0x20
265#define IOP321_TMR_RATIO_16_1 0x30
266
267#define IOP321_TU_TCR0 (volatile u32 *)IOP321_REG_ADDR(0x000007E8)
268#define IOP321_TU_TCR1 (volatile u32 *)IOP321_REG_ADDR(0x000007EC)
269#define IOP321_TU_TRR0 (volatile u32 *)IOP321_REG_ADDR(0x000007F0)
270#define IOP321_TU_TRR1 (volatile u32 *)IOP321_REG_ADDR(0x000007F4)
271#define IOP321_TU_TISR (volatile u32 *)IOP321_REG_ADDR(0x000007F8)
272#define IOP321_TU_WDTCR (volatile u32 *)IOP321_REG_ADDR(0x000007FC)
273
274/* Application accelerator unit 0x00000800 - 0x000008FF */
275#define IOP321_AAU_ACR (volatile u32 *)IOP321_REG_ADDR(0x00000800)
276#define IOP321_AAU_ASR (volatile u32 *)IOP321_REG_ADDR(0x00000804)
277#define IOP321_AAU_ADAR (volatile u32 *)IOP321_REG_ADDR(0x00000808)
278#define IOP321_AAU_ANDAR (volatile u32 *)IOP321_REG_ADDR(0x0000080C)
279#define IOP321_AAU_SAR1 (volatile u32 *)IOP321_REG_ADDR(0x00000810)
280#define IOP321_AAU_SAR2 (volatile u32 *)IOP321_REG_ADDR(0x00000814)
281#define IOP321_AAU_SAR3 (volatile u32 *)IOP321_REG_ADDR(0x00000818)
282#define IOP321_AAU_SAR4 (volatile u32 *)IOP321_REG_ADDR(0x0000081C)
283#define IOP321_AAU_SAR5 (volatile u32 *)IOP321_REG_ADDR(0x0000082C)
284#define IOP321_AAU_SAR6 (volatile u32 *)IOP321_REG_ADDR(0x00000830)
285#define IOP321_AAU_SAR7 (volatile u32 *)IOP321_REG_ADDR(0x00000834)
286#define IOP321_AAU_SAR8 (volatile u32 *)IOP321_REG_ADDR(0x00000838)
287#define IOP321_AAU_SAR9 (volatile u32 *)IOP321_REG_ADDR(0x00000840)
288#define IOP321_AAU_SAR10 (volatile u32 *)IOP321_REG_ADDR(0x00000844)
289#define IOP321_AAU_SAR11 (volatile u32 *)IOP321_REG_ADDR(0x00000848)
290#define IOP321_AAU_SAR12 (volatile u32 *)IOP321_REG_ADDR(0x0000084C)
291#define IOP321_AAU_SAR13 (volatile u32 *)IOP321_REG_ADDR(0x00000850)
292#define IOP321_AAU_SAR14 (volatile u32 *)IOP321_REG_ADDR(0x00000854)
293#define IOP321_AAU_SAR15 (volatile u32 *)IOP321_REG_ADDR(0x00000858)
294#define IOP321_AAU_SAR16 (volatile u32 *)IOP321_REG_ADDR(0x0000085C)
295#define IOP321_AAU_SAR17 (volatile u32 *)IOP321_REG_ADDR(0x00000864)
296#define IOP321_AAU_SAR18 (volatile u32 *)IOP321_REG_ADDR(0x00000868)
297#define IOP321_AAU_SAR19 (volatile u32 *)IOP321_REG_ADDR(0x0000086C)
298#define IOP321_AAU_SAR20 (volatile u32 *)IOP321_REG_ADDR(0x00000870)
299#define IOP321_AAU_SAR21 (volatile u32 *)IOP321_REG_ADDR(0x00000874)
300#define IOP321_AAU_SAR22 (volatile u32 *)IOP321_REG_ADDR(0x00000878)
301#define IOP321_AAU_SAR23 (volatile u32 *)IOP321_REG_ADDR(0x0000087C)
302#define IOP321_AAU_SAR24 (volatile u32 *)IOP321_REG_ADDR(0x00000880)
303#define IOP321_AAU_SAR25 (volatile u32 *)IOP321_REG_ADDR(0x00000888)
304#define IOP321_AAU_SAR26 (volatile u32 *)IOP321_REG_ADDR(0x0000088C)
305#define IOP321_AAU_SAR27 (volatile u32 *)IOP321_REG_ADDR(0x00000890)
306#define IOP321_AAU_SAR28 (volatile u32 *)IOP321_REG_ADDR(0x00000894)
307#define IOP321_AAU_SAR29 (volatile u32 *)IOP321_REG_ADDR(0x00000898)
308#define IOP321_AAU_SAR30 (volatile u32 *)IOP321_REG_ADDR(0x0000089C)
309#define IOP321_AAU_SAR31 (volatile u32 *)IOP321_REG_ADDR(0x000008A0)
310#define IOP321_AAU_SAR32 (volatile u32 *)IOP321_REG_ADDR(0x000008A4)
311#define IOP321_AAU_DAR (volatile u32 *)IOP321_REG_ADDR(0x00000820)
312#define IOP321_AAU_ABCR (volatile u32 *)IOP321_REG_ADDR(0x00000824)
313#define IOP321_AAU_ADCR (volatile u32 *)IOP321_REG_ADDR(0x00000828)
314#define IOP321_AAU_EDCR0 (volatile u32 *)IOP321_REG_ADDR(0x0000083c)
315#define IOP321_AAU_EDCR1 (volatile u32 *)IOP321_REG_ADDR(0x00000860)
316#define IOP321_AAU_EDCR2 (volatile u32 *)IOP321_REG_ADDR(0x00000884)
317
318
319/* SSP serial port unit 0x00001600 - 0x0000167F */
320/* I2C bus interface unit 0x00001680 - 0x000016FF */
321#define IOP321_ICR0 (volatile u32 *)IOP321_REG_ADDR(0x00001680)
322#define IOP321_ISR0 (volatile u32 *)IOP321_REG_ADDR(0x00001684)
323#define IOP321_ISAR0 (volatile u32 *)IOP321_REG_ADDR(0x00001688)
324#define IOP321_IDBR0 (volatile u32 *)IOP321_REG_ADDR(0x0000168C)
325/* Reserved 0x00001690 */
326#define IOP321_IBMR0 (volatile u32 *)IOP321_REG_ADDR(0x00001694)
327/* Reserved 0x00001698 */
328/* Reserved 0x0000169C */
329#define IOP321_ICR1 (volatile u32 *)IOP321_REG_ADDR(0x000016A0)
330#define IOP321_ISR1 (volatile u32 *)IOP321_REG_ADDR(0x000016A4)
331#define IOP321_ISAR1 (volatile u32 *)IOP321_REG_ADDR(0x000016A8)
332#define IOP321_IDBR1 (volatile u32 *)IOP321_REG_ADDR(0x000016AC)
333#define IOP321_IBMR1 (volatile u32 *)IOP321_REG_ADDR(0x000016B4)
334/* Reserved 0x000016B8 through 0x000016FC */
335
336/* for I2C bit defs see drivers/i2c/i2c-iop3xx.h */
337
338
339#ifndef __ASSEMBLY__
340extern void iop321_map_io(void);
341extern void iop321_init_irq(void);
342extern void iop321_time_init(void);
343#endif
344
345#endif // _IOP321_HW_H_
diff --git a/include/asm-arm/arch-iop3xx/iop331-irqs.h b/include/asm-arm/arch-iop3xx/iop331-irqs.h
deleted file mode 100644
index 7135ad7e335e..000000000000
--- a/include/asm-arm/arch-iop3xx/iop331-irqs.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/irqs.h
3 *
4 * Author: Dave Jiang (dave.jiang@intel.com)
5 * Copyright: (C) 2003 Intel Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#ifndef _IOP331_IRQS_H_
13#define _IOP331_IRQS_H_
14
15/*
16 * IOP80331 chipset interrupts
17 */
18#define IOP331_IRQ_OFS 0
19#define IOP331_IRQ(x) (IOP331_IRQ_OFS + (x))
20
21/*
22 * On IRQ or FIQ register
23 */
24#define IRQ_IOP331_DMA0_EOT IOP331_IRQ(0)
25#define IRQ_IOP331_DMA0_EOC IOP331_IRQ(1)
26#define IRQ_IOP331_DMA1_EOT IOP331_IRQ(2)
27#define IRQ_IOP331_DMA1_EOC IOP331_IRQ(3)
28#define IRQ_IOP331_RSVD_4 IOP331_IRQ(4)
29#define IRQ_IOP331_RSVD_5 IOP331_IRQ(5)
30#define IRQ_IOP331_AA_EOT IOP331_IRQ(6)
31#define IRQ_IOP331_AA_EOC IOP331_IRQ(7)
32#define IRQ_IOP331_TIMER0 IOP331_IRQ(8)
33#define IRQ_IOP331_TIMER1 IOP331_IRQ(9)
34#define IRQ_IOP331_I2C_0 IOP331_IRQ(10)
35#define IRQ_IOP331_I2C_1 IOP331_IRQ(11)
36#define IRQ_IOP331_MSG IOP331_IRQ(12)
37#define IRQ_IOP331_MSGIBQ IOP331_IRQ(13)
38#define IRQ_IOP331_ATU_BIST IOP331_IRQ(14)
39#define IRQ_IOP331_PERFMON IOP331_IRQ(15)
40#define IRQ_IOP331_CORE_PMU IOP331_IRQ(16)
41#define IRQ_IOP331_RSVD_17 IOP331_IRQ(17)
42#define IRQ_IOP331_RSVD_18 IOP331_IRQ(18)
43#define IRQ_IOP331_RSVD_19 IOP331_IRQ(19)
44#define IRQ_IOP331_RSVD_20 IOP331_IRQ(20)
45#define IRQ_IOP331_RSVD_21 IOP331_IRQ(21)
46#define IRQ_IOP331_RSVD_22 IOP331_IRQ(22)
47#define IRQ_IOP331_RSVD_23 IOP331_IRQ(23)
48#define IRQ_IOP331_XINT0 IOP331_IRQ(24)
49#define IRQ_IOP331_XINT1 IOP331_IRQ(25)
50#define IRQ_IOP331_XINT2 IOP331_IRQ(26)
51#define IRQ_IOP331_XINT3 IOP331_IRQ(27)
52#define IRQ_IOP331_RSVD_28 IOP331_IRQ(28)
53#define IRQ_IOP331_RSVD_29 IOP331_IRQ(29)
54#define IRQ_IOP331_RSVD_30 IOP331_IRQ(30)
55#define IRQ_IOP331_RSVD_31 IOP331_IRQ(31)
56#define IRQ_IOP331_XINT8 IOP331_IRQ(32) // 0
57#define IRQ_IOP331_XINT9 IOP331_IRQ(33) // 1
58#define IRQ_IOP331_XINT10 IOP331_IRQ(34) // 2
59#define IRQ_IOP331_XINT11 IOP331_IRQ(35) // 3
60#define IRQ_IOP331_XINT12 IOP331_IRQ(36) // 4
61#define IRQ_IOP331_XINT13 IOP331_IRQ(37) // 5
62#define IRQ_IOP331_XINT14 IOP331_IRQ(38) // 6
63#define IRQ_IOP331_XINT15 IOP331_IRQ(39) // 7
64#define IRQ_IOP331_RSVD_40 IOP331_IRQ(40) // 8
65#define IRQ_IOP331_RSVD_41 IOP331_IRQ(41) // 9
66#define IRQ_IOP331_RSVD_42 IOP331_IRQ(42) // 10
67#define IRQ_IOP331_RSVD_43 IOP331_IRQ(43) // 11
68#define IRQ_IOP331_RSVD_44 IOP331_IRQ(44) // 12
69#define IRQ_IOP331_RSVD_45 IOP331_IRQ(45) // 13
70#define IRQ_IOP331_RSVD_46 IOP331_IRQ(46) // 14
71#define IRQ_IOP331_RSVD_47 IOP331_IRQ(47) // 15
72#define IRQ_IOP331_RSVD_48 IOP331_IRQ(48) // 16
73#define IRQ_IOP331_RSVD_49 IOP331_IRQ(49) // 17
74#define IRQ_IOP331_RSVD_50 IOP331_IRQ(50) // 18
75#define IRQ_IOP331_UART0 IOP331_IRQ(51) // 19
76#define IRQ_IOP331_UART1 IOP331_IRQ(52) // 20
77#define IRQ_IOP331_PBIE IOP331_IRQ(53) // 21
78#define IRQ_IOP331_ATU_CRW IOP331_IRQ(54) // 22
79#define IRQ_IOP331_ATU_ERR IOP331_IRQ(55) // 23
80#define IRQ_IOP331_MCU_ERR IOP331_IRQ(56) // 24
81#define IRQ_IOP331_DMA0_ERR IOP331_IRQ(57) // 25
82#define IRQ_IOP331_DMA1_ERR IOP331_IRQ(58) // 26
83#define IRQ_IOP331_RSVD_59 IOP331_IRQ(59) // 27
84#define IRQ_IOP331_AA_ERR IOP331_IRQ(60) // 28
85#define IRQ_IOP331_RSVD_61 IOP331_IRQ(61) // 29
86#define IRQ_IOP331_MSG_ERR IOP331_IRQ(62) // 30
87#define IRQ_IOP331_HPI IOP331_IRQ(63) // 31
88
89#define NR_IOP331_IRQS (IOP331_IRQ(63) + 1)
90
91#define NR_IRQS NR_IOP331_IRQS
92
93
94/*
95 * Interrupts available on the IQ80331 board
96 */
97
98/*
99 * On board devices
100 */
101#define IRQ_IQ80331_I82544 IRQ_IOP331_XINT0
102#define IRQ_IQ80331_UART0 IRQ_IOP331_UART0
103#define IRQ_IQ80331_UART1 IRQ_IOP331_UART1
104
105/*
106 * PCI interrupts
107 */
108#define IRQ_IQ80331_INTA IRQ_IOP331_XINT0
109#define IRQ_IQ80331_INTB IRQ_IOP331_XINT1
110#define IRQ_IQ80331_INTC IRQ_IOP331_XINT2
111#define IRQ_IQ80331_INTD IRQ_IOP331_XINT3
112
113/*
114 * Interrupts available on the IQ80332 board
115 */
116
117/*
118 * On board devices
119 */
120#define IRQ_IQ80332_I82544 IRQ_IOP331_XINT0
121#define IRQ_IQ80332_UART0 IRQ_IOP331_UART0
122#define IRQ_IQ80332_UART1 IRQ_IOP331_UART1
123
124/*
125 * PCI interrupts
126 */
127#define IRQ_IQ80332_INTA IRQ_IOP331_XINT0
128#define IRQ_IQ80332_INTB IRQ_IOP331_XINT1
129#define IRQ_IQ80332_INTC IRQ_IOP331_XINT2
130#define IRQ_IQ80332_INTD IRQ_IOP331_XINT3
131
132#endif // _IOP331_IRQ_H_
diff --git a/include/asm-arm/arch-iop3xx/iop331.h b/include/asm-arm/arch-iop3xx/iop331.h
deleted file mode 100644
index fbf0cc11bdd9..000000000000
--- a/include/asm-arm/arch-iop3xx/iop331.h
+++ /dev/null
@@ -1,363 +0,0 @@
1/*
2 * linux/include/asm/arch-iop3xx/iop331.h
3 *
4 * Intel IOP331 Chip definitions
5 *
6 * Author: Dave Jiang (dave.jiang@intel.com)
7 * Copyright (C) 2003, 2004 Intel Corp.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef _IOP331_HW_H_
15#define _IOP331_HW_H_
16
17
18/*
19 * This is needed for mixed drivers that need to work on all
20 * IOP3xx variants but behave slightly differently on each.
21 */
22#ifndef __ASSEMBLY__
23#ifdef CONFIG_ARCH_IOP331
24/*#define iop_is_331() ((processor_id & 0xffffffb0) == 0x69054090) */
25#define iop_is_331() ((processor_id & 0xffffff30) == 0x69054010)
26#else
27#define iop_is_331() 0
28#endif
29#endif
30
31/*
32 * IOP331 I/O and Mem space regions for PCI autoconfiguration
33 */
34#define IOP331_PCI_IO_WINDOW_SIZE 0x00010000
35#define IOP331_PCI_LOWER_IO_PA 0x90000000
36#define IOP331_PCI_LOWER_IO_VA 0xfe000000
37#define IOP331_PCI_LOWER_IO_BA (*IOP331_OIOWTVR)
38#define IOP331_PCI_UPPER_IO_PA (IOP331_PCI_LOWER_IO_PA + IOP331_PCI_IO_WINDOW_SIZE - 1)
39#define IOP331_PCI_UPPER_IO_VA (IOP331_PCI_LOWER_IO_VA + IOP331_PCI_IO_WINDOW_SIZE - 1)
40#define IOP331_PCI_UPPER_IO_BA (IOP331_PCI_LOWER_IO_BA + IOP331_PCI_IO_WINDOW_SIZE - 1)
41#define IOP331_PCI_IO_OFFSET (IOP331_PCI_LOWER_IO_VA - IOP331_PCI_LOWER_IO_BA)
42
43/* this can be 128M if OMWTVR1 is set */
44#define IOP331_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */
45/* #define IOP331_PCI_MEM_WINDOW_SIZE (~*IOP331_IALR1 + 1) */
46#define IOP331_PCI_LOWER_MEM_PA 0x80000000
47#define IOP331_PCI_LOWER_MEM_BA (*IOP331_OMWTVR0)
48#define IOP331_PCI_UPPER_MEM_PA (IOP331_PCI_LOWER_MEM_PA + IOP331_PCI_MEM_WINDOW_SIZE - 1)
49#define IOP331_PCI_UPPER_MEM_BA (IOP331_PCI_LOWER_MEM_BA + IOP331_PCI_MEM_WINDOW_SIZE - 1)
50#define IOP331_PCI_MEM_OFFSET (IOP331_PCI_LOWER_MEM_PA - IOP331_PCI_LOWER_MEM_BA)
51
52/*
53 * IOP331 chipset registers
54 */
55#define IOP331_VIRT_MEM_BASE 0xfeffe000 /* chip virtual mem address*/
56#define IOP331_PHYS_MEM_BASE 0xffffe000 /* chip physical memory address */
57#define IOP331_REG_ADDR(reg) (IOP331_VIRT_MEM_BASE | (reg))
58
59/* Reserved 0x00000000 through 0x000000FF */
60
61/* Address Translation Unit 0x00000100 through 0x000001FF */
62#define IOP331_ATUVID (volatile u16 *)IOP331_REG_ADDR(0x00000100)
63#define IOP331_ATUDID (volatile u16 *)IOP331_REG_ADDR(0x00000102)
64#define IOP331_ATUCMD (volatile u16 *)IOP331_REG_ADDR(0x00000104)
65#define IOP331_ATUSR (volatile u16 *)IOP331_REG_ADDR(0x00000106)
66#define IOP331_ATURID (volatile u8 *)IOP331_REG_ADDR(0x00000108)
67#define IOP331_ATUCCR (volatile u32 *)IOP331_REG_ADDR(0x00000109)
68#define IOP331_ATUCLSR (volatile u8 *)IOP331_REG_ADDR(0x0000010C)
69#define IOP331_ATULT (volatile u8 *)IOP331_REG_ADDR(0x0000010D)
70#define IOP331_ATUHTR (volatile u8 *)IOP331_REG_ADDR(0x0000010E)
71#define IOP331_ATUBIST (volatile u8 *)IOP331_REG_ADDR(0x0000010F)
72#define IOP331_IABAR0 (volatile u32 *)IOP331_REG_ADDR(0x00000110)
73#define IOP331_IAUBAR0 (volatile u32 *)IOP331_REG_ADDR(0x00000114)
74#define IOP331_IABAR1 (volatile u32 *)IOP331_REG_ADDR(0x00000118)
75#define IOP331_IAUBAR1 (volatile u32 *)IOP331_REG_ADDR(0x0000011C)
76#define IOP331_IABAR2 (volatile u32 *)IOP331_REG_ADDR(0x00000120)
77#define IOP331_IAUBAR2 (volatile u32 *)IOP331_REG_ADDR(0x00000124)
78#define IOP331_ASVIR (volatile u16 *)IOP331_REG_ADDR(0x0000012C)
79#define IOP331_ASIR (volatile u16 *)IOP331_REG_ADDR(0x0000012E)
80#define IOP331_ERBAR (volatile u32 *)IOP331_REG_ADDR(0x00000130)
81#define IOP331_ATU_CAPPTR (volatile u32 *)IOP331_REG_ADDR(0x00000134)
82/* Reserved 0x00000138 through 0x0000013B */
83#define IOP331_ATUILR (volatile u8 *)IOP331_REG_ADDR(0x0000013C)
84#define IOP331_ATUIPR (volatile u8 *)IOP331_REG_ADDR(0x0000013D)
85#define IOP331_ATUMGNT (volatile u8 *)IOP331_REG_ADDR(0x0000013E)
86#define IOP331_ATUMLAT (volatile u8 *)IOP331_REG_ADDR(0x0000013F)
87#define IOP331_IALR0 (volatile u32 *)IOP331_REG_ADDR(0x00000140)
88#define IOP331_IATVR0 (volatile u32 *)IOP331_REG_ADDR(0x00000144)
89#define IOP331_ERLR (volatile u32 *)IOP331_REG_ADDR(0x00000148)
90#define IOP331_ERTVR (volatile u32 *)IOP331_REG_ADDR(0x0000014C)
91#define IOP331_IALR1 (volatile u32 *)IOP331_REG_ADDR(0x00000150)
92#define IOP331_IALR2 (volatile u32 *)IOP331_REG_ADDR(0x00000154)
93#define IOP331_IATVR2 (volatile u32 *)IOP331_REG_ADDR(0x00000158)
94#define IOP331_OIOWTVR (volatile u32 *)IOP331_REG_ADDR(0x0000015C)
95#define IOP331_OMWTVR0 (volatile u32 *)IOP331_REG_ADDR(0x00000160)
96#define IOP331_OUMWTVR0 (volatile u32 *)IOP331_REG_ADDR(0x00000164)
97#define IOP331_OMWTVR1 (volatile u32 *)IOP331_REG_ADDR(0x00000168)
98#define IOP331_OUMWTVR1 (volatile u32 *)IOP331_REG_ADDR(0x0000016C)
99/* Reserved 0x00000170 through 0x00000177*/
100#define IOP331_OUDWTVR (volatile u32 *)IOP331_REG_ADDR(0x00000178)
101/* Reserved 0x0000017C through 0x0000017F*/
102#define IOP331_ATUCR (volatile u32 *)IOP331_REG_ADDR(0x00000180)
103#define IOP331_PCSR (volatile u32 *)IOP331_REG_ADDR(0x00000184)
104#define IOP331_ATUISR (volatile u32 *)IOP331_REG_ADDR(0x00000188)
105#define IOP331_ATUIMR (volatile u32 *)IOP331_REG_ADDR(0x0000018C)
106#define IOP331_IABAR3 (volatile u32 *)IOP331_REG_ADDR(0x00000190)
107#define IOP331_IAUBAR3 (volatile u32 *)IOP331_REG_ADDR(0x00000194)
108#define IOP331_IALR3 (volatile u32 *)IOP331_REG_ADDR(0x00000198)
109#define IOP331_IATVR3 (volatile u32 *)IOP331_REG_ADDR(0x0000019C)
110/* Reserved 0x000001A0 through 0x000001A3*/
111#define IOP331_OCCAR (volatile u32 *)IOP331_REG_ADDR(0x000001A4)
112/* Reserved 0x000001A8 through 0x000001AB*/
113#define IOP331_OCCDR (volatile u32 *)IOP331_REG_ADDR(0x000001AC)
114/* Reserved 0x000001B0 through 0x000001BB*/
115#define IOP331_VPDCAPID (volatile u8 *)IOP331_REG_ADDR(0x000001B8)
116#define IOP331_VPDNXTP (volatile u8 *)IOP331_REG_ADDR(0x000001B9)
117#define IOP331_VPDAR (volatile u16 *)IOP331_REG_ADDR(0x000001BA)
118#define IOP331_VPDDR (volatile u32 *)IOP331_REG_ADDR(0x000001BC)
119#define IOP331_PMCAPID (volatile u8 *)IOP331_REG_ADDR(0x000001C0)
120#define IOP331_PMNEXT (volatile u8 *)IOP331_REG_ADDR(0x000001C1)
121#define IOP331_APMCR (volatile u16 *)IOP331_REG_ADDR(0x000001C2)
122#define IOP331_APMCSR (volatile u16 *)IOP331_REG_ADDR(0x000001C4)
123/* Reserved 0x000001C6 through 0x000001CF */
124#define IOP331_MSICAPID (volatile u8 *)IOP331_REG_ADDR(0x000001D0)
125#define IOP331_MSINXTP (volatile u8 *)IOP331_REG_ADDR(0x000001D1)
126#define IOP331_MSIMCR (volatile u16 *)IOP331_REG_ADDR(0x000001D2)
127#define IOP331_MSIMAR (volatile u32 *)IOP331_REG_ADDR(0x000001D4)
128#define IOP331_MSIMUAR (volatile u32 *)IOP331_REG_ADDR(0x000001D8)
129#define IOP331_MSIMDR (volatile u32 *)IOP331_REG_ADDR(0x000001DC)
130#define IOP331_PCIXCAPID (volatile u8 *)IOP331_REG_ADDR(0x000001E0)
131#define IOP331_PCIXNEXT (volatile u8 *)IOP331_REG_ADDR(0x000001E1)
132#define IOP331_PCIXCMD (volatile u16 *)IOP331_REG_ADDR(0x000001E2)
133#define IOP331_PCIXSR (volatile u32 *)IOP331_REG_ADDR(0x000001E4)
134#define IOP331_PCIIRSR (volatile u32 *)IOP331_REG_ADDR(0x000001EC)
135
136/* Messaging Unit 0x00000300 through 0x000003FF */
137
138/* Reserved 0x00000300 through 0x0000030c */
139#define IOP331_IMR0 (volatile u32 *)IOP331_REG_ADDR(0x00000310)
140#define IOP331_IMR1 (volatile u32 *)IOP331_REG_ADDR(0x00000314)
141#define IOP331_OMR0 (volatile u32 *)IOP331_REG_ADDR(0x00000318)
142#define IOP331_OMR1 (volatile u32 *)IOP331_REG_ADDR(0x0000031C)
143#define IOP331_IDR (volatile u32 *)IOP331_REG_ADDR(0x00000320)
144#define IOP331_IISR (volatile u32 *)IOP331_REG_ADDR(0x00000324)
145#define IOP331_IIMR (volatile u32 *)IOP331_REG_ADDR(0x00000328)
146#define IOP331_ODR (volatile u32 *)IOP331_REG_ADDR(0x0000032C)
147#define IOP331_OISR (volatile u32 *)IOP331_REG_ADDR(0x00000330)
148#define IOP331_OIMR (volatile u32 *)IOP331_REG_ADDR(0x00000334)
149/* Reserved 0x00000338 through 0x0000034F */
150#define IOP331_MUCR (volatile u32 *)IOP331_REG_ADDR(0x00000350)
151#define IOP331_QBAR (volatile u32 *)IOP331_REG_ADDR(0x00000354)
152/* Reserved 0x00000358 through 0x0000035C */
153#define IOP331_IFHPR (volatile u32 *)IOP331_REG_ADDR(0x00000360)
154#define IOP331_IFTPR (volatile u32 *)IOP331_REG_ADDR(0x00000364)
155#define IOP331_IPHPR (volatile u32 *)IOP331_REG_ADDR(0x00000368)
156#define IOP331_IPTPR (volatile u32 *)IOP331_REG_ADDR(0x0000036C)
157#define IOP331_OFHPR (volatile u32 *)IOP331_REG_ADDR(0x00000370)
158#define IOP331_OFTPR (volatile u32 *)IOP331_REG_ADDR(0x00000374)
159#define IOP331_OPHPR (volatile u32 *)IOP331_REG_ADDR(0x00000378)
160#define IOP331_OPTPR (volatile u32 *)IOP331_REG_ADDR(0x0000037C)
161#define IOP331_IAR (volatile u32 *)IOP331_REG_ADDR(0x00000380)
162/* Reserved 0x00000384 through 0x000003FF */
163
164/* DMA Controller 0x00000400 through 0x000004FF */
165#define IOP331_DMA0_CCR (volatile u32 *)IOP331_REG_ADDR(0x00000400)
166#define IOP331_DMA0_CSR (volatile u32 *)IOP331_REG_ADDR(0x00000404)
167#define IOP331_DMA0_DAR (volatile u32 *)IOP331_REG_ADDR(0x0000040C)
168#define IOP331_DMA0_NDAR (volatile u32 *)IOP331_REG_ADDR(0x00000410)
169#define IOP331_DMA0_PADR (volatile u32 *)IOP331_REG_ADDR(0x00000414)
170#define IOP331_DMA0_PUADR (volatile u32 *)IOP331_REG_ADDR(0x00000418)
171#define IOP331_DMA0_LADR (volatile u32 *)IOP331_REG_ADDR(0X0000041C)
172#define IOP331_DMA0_BCR (volatile u32 *)IOP331_REG_ADDR(0x00000420)
173#define IOP331_DMA0_DCR (volatile u32 *)IOP331_REG_ADDR(0x00000424)
174/* Reserved 0x00000428 through 0x0000043C */
175#define IOP331_DMA1_CCR (volatile u32 *)IOP331_REG_ADDR(0x00000440)
176#define IOP331_DMA1_CSR (volatile u32 *)IOP331_REG_ADDR(0x00000444)
177#define IOP331_DMA1_DAR (volatile u32 *)IOP331_REG_ADDR(0x0000044C)
178#define IOP331_DMA1_NDAR (volatile u32 *)IOP331_REG_ADDR(0x00000450)
179#define IOP331_DMA1_PADR (volatile u32 *)IOP331_REG_ADDR(0x00000454)
180#define IOP331_DMA1_PUADR (volatile u32 *)IOP331_REG_ADDR(0x00000458)
181#define IOP331_DMA1_LADR (volatile u32 *)IOP331_REG_ADDR(0x0000045C)
182#define IOP331_DMA1_BCR (volatile u32 *)IOP331_REG_ADDR(0x00000460)
183#define IOP331_DMA1_DCR (volatile u32 *)IOP331_REG_ADDR(0x00000464)
184/* Reserved 0x00000468 through 0x000004FF */
185
186/* Memory controller 0x00000500 through 0x0005FF */
187
188/* Peripheral bus interface unit 0x00000680 through 0x0006FF */
189#define IOP331_PBCR (volatile u32 *)IOP331_REG_ADDR(0x00000680)
190#define IOP331_PBISR (volatile u32 *)IOP331_REG_ADDR(0x00000684)
191#define IOP331_PBBAR0 (volatile u32 *)IOP331_REG_ADDR(0x00000688)
192#define IOP331_PBLR0 (volatile u32 *)IOP331_REG_ADDR(0x0000068C)
193#define IOP331_PBBAR1 (volatile u32 *)IOP331_REG_ADDR(0x00000690)
194#define IOP331_PBLR1 (volatile u32 *)IOP331_REG_ADDR(0x00000694)
195#define IOP331_PBBAR2 (volatile u32 *)IOP331_REG_ADDR(0x00000698)
196#define IOP331_PBLR2 (volatile u32 *)IOP331_REG_ADDR(0x0000069C)
197#define IOP331_PBBAR3 (volatile u32 *)IOP331_REG_ADDR(0x000006A0)
198#define IOP331_PBLR3 (volatile u32 *)IOP331_REG_ADDR(0x000006A4)
199#define IOP331_PBBAR4 (volatile u32 *)IOP331_REG_ADDR(0x000006A8)
200#define IOP331_PBLR4 (volatile u32 *)IOP331_REG_ADDR(0x000006AC)
201#define IOP331_PBBAR5 (volatile u32 *)IOP331_REG_ADDR(0x000006B0)
202#define IOP331_PBLR5 (volatile u32 *)IOP331_REG_ADDR(0x000006B4)
203#define IOP331_PBDSCR (volatile u32 *)IOP331_REG_ADDR(0x000006B8)
204/* Reserved 0x000006BC */
205#define IOP331_PMBR0 (volatile u32 *)IOP331_REG_ADDR(0x000006C0)
206/* Reserved 0x000006C4 through 0x000006DC */
207#define IOP331_PMBR1 (volatile u32 *)IOP331_REG_ADDR(0x000006E0)
208#define IOP331_PMBR2 (volatile u32 *)IOP331_REG_ADDR(0x000006E4)
209
210#define IOP331_PBCR_EN 0x1
211
212#define IOP331_PBISR_BOOR_ERR 0x1
213
214
215
216/* Peripheral performance monitoring unit 0x00000700 through 0x00077F */
217/* Internal arbitration unit 0x00000780 through 0x0007BF */
218
219/* Interrupt Controller */
220#define IOP331_INTCTL0 (volatile u32 *)IOP331_REG_ADDR(0x00000790)
221#define IOP331_INTCTL1 (volatile u32 *)IOP331_REG_ADDR(0x00000794)
222#define IOP331_INTSTR0 (volatile u32 *)IOP331_REG_ADDR(0x00000798)
223#define IOP331_INTSTR1 (volatile u32 *)IOP331_REG_ADDR(0x0000079C)
224#define IOP331_IINTSRC0 (volatile u32 *)IOP331_REG_ADDR(0x000007A0)
225#define IOP331_IINTSRC1 (volatile u32 *)IOP331_REG_ADDR(0x000007A4)
226#define IOP331_FINTSRC0 (volatile u32 *)IOP331_REG_ADDR(0x000007A8)
227#define IOP331_FINTSRC1 (volatile u32 *)IOP331_REG_ADDR(0x000007AC)
228#define IOP331_IPR0 (volatile u32 *)IOP331_REG_ADDR(0x000007B0)
229#define IOP331_IPR1 (volatile u32 *)IOP331_REG_ADDR(0x000007B4)
230#define IOP331_IPR2 (volatile u32 *)IOP331_REG_ADDR(0x000007B8)
231#define IOP331_IPR3 (volatile u32 *)IOP331_REG_ADDR(0x000007BC)
232#define IOP331_INTBASE (volatile u32 *)IOP331_REG_ADDR(0x000007C0)
233#define IOP331_INTSIZE (volatile u32 *)IOP331_REG_ADDR(0x000007C4)
234#define IOP331_IINTVEC (volatile u32 *)IOP331_REG_ADDR(0x000007C8)
235#define IOP331_FINTVEC (volatile u32 *)IOP331_REG_ADDR(0x000007CC)
236
237
238/* Timers */
239
240#define IOP331_TU_TMR0 (volatile u32 *)IOP331_REG_ADDR(0x000007D0)
241#define IOP331_TU_TMR1 (volatile u32 *)IOP331_REG_ADDR(0x000007D4)
242
243#define IOP331_TMR_TC 0x01
244#define IOP331_TMR_EN 0x02
245#define IOP331_TMR_RELOAD 0x04
246#define IOP331_TMR_PRIVILEGED 0x09
247
248#define IOP331_TMR_RATIO_1_1 0x00
249#define IOP331_TMR_RATIO_4_1 0x10
250#define IOP331_TMR_RATIO_8_1 0x20
251#define IOP331_TMR_RATIO_16_1 0x30
252
253#define IOP331_TU_TCR0 (volatile u32 *)IOP331_REG_ADDR(0x000007D8)
254#define IOP331_TU_TCR1 (volatile u32 *)IOP331_REG_ADDR(0x000007DC)
255#define IOP331_TU_TRR0 (volatile u32 *)IOP331_REG_ADDR(0x000007E0)
256#define IOP331_TU_TRR1 (volatile u32 *)IOP331_REG_ADDR(0x000007E4)
257#define IOP331_TU_TISR (volatile u32 *)IOP331_REG_ADDR(0x000007E8)
258#define IOP331_TU_WDTCR (volatile u32 *)IOP331_REG_ADDR(0x000007EC)
259
260#if defined(CONFIG_ARCH_IOP331)
261#define IOP331_TICK_RATE 266000000 /* 266 MHz IB clock */
262#endif
263
264#if defined(CONFIG_IOP331_STEPD) || defined(CONFIG_ARCH_IQ80333)
265#undef IOP331_TICK_RATE
266#define IOP331_TICK_RATE 333000000 /* 333 Mhz IB clock */
267#endif
268
269/* Application accelerator unit 0x00000800 - 0x000008FF */
270#define IOP331_AAU_ACR (volatile u32 *)IOP331_REG_ADDR(0x00000800)
271#define IOP331_AAU_ASR (volatile u32 *)IOP331_REG_ADDR(0x00000804)
272#define IOP331_AAU_ADAR (volatile u32 *)IOP331_REG_ADDR(0x00000808)
273#define IOP331_AAU_ANDAR (volatile u32 *)IOP331_REG_ADDR(0x0000080C)
274#define IOP331_AAU_SAR1 (volatile u32 *)IOP331_REG_ADDR(0x00000810)
275#define IOP331_AAU_SAR2 (volatile u32 *)IOP331_REG_ADDR(0x00000814)
276#define IOP331_AAU_SAR3 (volatile u32 *)IOP331_REG_ADDR(0x00000818)
277#define IOP331_AAU_SAR4 (volatile u32 *)IOP331_REG_ADDR(0x0000081C)
278#define IOP331_AAU_SAR5 (volatile u32 *)IOP331_REG_ADDR(0x0000082C)
279#define IOP331_AAU_SAR6 (volatile u32 *)IOP331_REG_ADDR(0x00000830)
280#define IOP331_AAU_SAR7 (volatile u32 *)IOP331_REG_ADDR(0x00000834)
281#define IOP331_AAU_SAR8 (volatile u32 *)IOP331_REG_ADDR(0x00000838)
282#define IOP331_AAU_SAR9 (volatile u32 *)IOP331_REG_ADDR(0x00000840)
283#define IOP331_AAU_SAR10 (volatile u32 *)IOP331_REG_ADDR(0x00000844)
284#define IOP331_AAU_SAR11 (volatile u32 *)IOP331_REG_ADDR(0x00000848)
285#define IOP331_AAU_SAR12 (volatile u32 *)IOP331_REG_ADDR(0x0000084C)
286#define IOP331_AAU_SAR13 (volatile u32 *)IOP331_REG_ADDR(0x00000850)
287#define IOP331_AAU_SAR14 (volatile u32 *)IOP331_REG_ADDR(0x00000854)
288#define IOP331_AAU_SAR15 (volatile u32 *)IOP331_REG_ADDR(0x00000858)
289#define IOP331_AAU_SAR16 (volatile u32 *)IOP331_REG_ADDR(0x0000085C)
290#define IOP331_AAU_SAR17 (volatile u32 *)IOP331_REG_ADDR(0x00000864)
291#define IOP331_AAU_SAR18 (volatile u32 *)IOP331_REG_ADDR(0x00000868)
292#define IOP331_AAU_SAR19 (volatile u32 *)IOP331_REG_ADDR(0x0000086C)
293#define IOP331_AAU_SAR20 (volatile u32 *)IOP331_REG_ADDR(0x00000870)
294#define IOP331_AAU_SAR21 (volatile u32 *)IOP331_REG_ADDR(0x00000874)
295#define IOP331_AAU_SAR22 (volatile u32 *)IOP331_REG_ADDR(0x00000878)
296#define IOP331_AAU_SAR23 (volatile u32 *)IOP331_REG_ADDR(0x0000087C)
297#define IOP331_AAU_SAR24 (volatile u32 *)IOP331_REG_ADDR(0x00000880)
298#define IOP331_AAU_SAR25 (volatile u32 *)IOP331_REG_ADDR(0x00000888)
299#define IOP331_AAU_SAR26 (volatile u32 *)IOP331_REG_ADDR(0x0000088C)
300#define IOP331_AAU_SAR27 (volatile u32 *)IOP331_REG_ADDR(0x00000890)
301#define IOP331_AAU_SAR28 (volatile u32 *)IOP331_REG_ADDR(0x00000894)
302#define IOP331_AAU_SAR29 (volatile u32 *)IOP331_REG_ADDR(0x00000898)
303#define IOP331_AAU_SAR30 (volatile u32 *)IOP331_REG_ADDR(0x0000089C)
304#define IOP331_AAU_SAR31 (volatile u32 *)IOP331_REG_ADDR(0x000008A0)
305#define IOP331_AAU_SAR32 (volatile u32 *)IOP331_REG_ADDR(0x000008A4)
306#define IOP331_AAU_DAR (volatile u32 *)IOP331_REG_ADDR(0x00000820)
307#define IOP331_AAU_ABCR (volatile u32 *)IOP331_REG_ADDR(0x00000824)
308#define IOP331_AAU_ADCR (volatile u32 *)IOP331_REG_ADDR(0x00000828)
309#define IOP331_AAU_EDCR0 (volatile u32 *)IOP331_REG_ADDR(0x0000083c)
310#define IOP331_AAU_EDCR1 (volatile u32 *)IOP331_REG_ADDR(0x00000860)
311#define IOP331_AAU_EDCR2 (volatile u32 *)IOP331_REG_ADDR(0x00000884)
312
313
314#define IOP331_SPDSCR (volatile u32 *)IOP331_REG_ADDR(0x000015C0)
315#define IOP331_PPDSCR (volatile u32 *)IOP331_REG_ADDR(0x000015C8)
316/* SSP serial port unit 0x00001600 - 0x0000167F */
317
318/* I2C bus interface unit 0x00001680 - 0x000016FF */
319/* for I2C bit defs see drivers/i2c/i2c-iop3xx.h */
320
321#define IOP331_ICR0 (volatile u32 *)IOP331_REG_ADDR(0x00001680)
322#define IOP331_ISR0 (volatile u32 *)IOP331_REG_ADDR(0x00001684)
323#define IOP331_ISAR0 (volatile u32 *)IOP331_REG_ADDR(0x00001688)
324#define IOP331_IDBR0 (volatile u32 *)IOP331_REG_ADDR(0x0000168C)
325/* Reserved 0x00001690 */
326#define IOP331_IBMR0 (volatile u32 *)IOP331_REG_ADDR(0x00001694)
327/* Reserved 0x00001698 */
328/* Reserved 0x0000169C */
329#define IOP331_ICR1 (volatile u32 *)IOP331_REG_ADDR(0x000016A0)
330#define IOP331_ISR1 (volatile u32 *)IOP331_REG_ADDR(0x000016A4)
331#define IOP331_ISAR1 (volatile u32 *)IOP331_REG_ADDR(0x000016A8)
332#define IOP331_IDBR1 (volatile u32 *)IOP331_REG_ADDR(0x000016AC)
333#define IOP331_IBMR1 (volatile u32 *)IOP331_REG_ADDR(0x000016B4)
334/* Reserved 0x000016B8 through 0x000016FF */
335
336/* 0x00001700 through 0x0000172C UART 0 */
337
338/* Reserved 0x00001730 through 0x0000173F */
339
340/* 0x00001740 through 0x0000176C UART 1 */
341
342#define IOP331_UART0_PHYS (IOP331_PHYS_MEM_BASE | 0x00001700) /* UART #1 physical */
343#define IOP331_UART1_PHYS (IOP331_PHYS_MEM_BASE | 0x00001740) /* UART #2 physical */
344#define IOP331_UART0_VIRT (IOP331_VIRT_MEM_BASE | 0x00001700) /* UART #1 virtual addr */
345#define IOP331_UART1_VIRT (IOP331_VIRT_MEM_BASE | 0x00001740) /* UART #2 virtual addr */
346
347/* Reserved 0x00001770 through 0x0000177F */
348
349/* General Purpose I/O Registers */
350#define IOP331_GPOE (volatile u32 *)IOP331_REG_ADDR(0x00001780)
351#define IOP331_GPID (volatile u32 *)IOP331_REG_ADDR(0x00001784)
352#define IOP331_GPOD (volatile u32 *)IOP331_REG_ADDR(0x00001788)
353
354/* Reserved 0x0000178c through 0x000019ff */
355
356
357#ifndef __ASSEMBLY__
358extern void iop331_map_io(void);
359extern void iop331_init_irq(void);
360extern void iop331_time_init(void);
361#endif
362
363#endif // _IOP331_HW_H_
diff --git a/include/asm-arm/arch-iop3xx/irqs.h b/include/asm-arm/arch-iop3xx/irqs.h
deleted file mode 100644
index b2c03f4c269c..000000000000
--- a/include/asm-arm/arch-iop3xx/irqs.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/irqs.h
3 *
4 * Copyright: (C) 2001-2003 MontaVista Software Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12/*
13 * Chipset-specific bits
14 */
15#ifdef CONFIG_ARCH_IOP321
16#include "iop321-irqs.h"
17#endif
18
19#ifdef CONFIG_ARCH_IOP331
20#include "iop331-irqs.h"
21#endif
diff --git a/include/asm-arm/arch-iop3xx/memory.h b/include/asm-arm/arch-iop3xx/memory.h
deleted file mode 100644
index e43ebd984745..000000000000
--- a/include/asm-arm/arch-iop3xx/memory.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#include <asm/hardware.h>
9
10/*
11 * Physical DRAM offset.
12 */
13#ifndef CONFIG_ARCH_IOP331
14#define PHYS_OFFSET UL(0xa0000000)
15#else
16#define PHYS_OFFSET UL(0x00000000)
17#endif
18
19/*
20 * Virtual view <-> PCI DMA view memory address translations
21 * virt_to_bus: Used to translate the virtual address to an
22 * address suitable to be passed to set_dma_addr
23 * bus_to_virt: Used to convert an address for DMA operations
24 * to an address that the kernel can use.
25 */
26#if defined(CONFIG_ARCH_IOP321)
27
28#define __virt_to_bus(x) (((__virt_to_phys(x)) & ~(*IOP321_IATVR2)) | ((*IOP321_IABAR2) & 0xfffffff0))
29#define __bus_to_virt(x) (__phys_to_virt(((x) & ~(*IOP321_IALR2)) | ( *IOP321_IATVR2)))
30
31#elif defined(CONFIG_ARCH_IOP331)
32
33#define __virt_to_bus(x) (((__virt_to_phys(x)) & ~(*IOP331_IATVR2)) | ((*IOP331_IABAR2) & 0xfffffff0))
34#define __bus_to_virt(x) (__phys_to_virt(((x) & ~(*IOP331_IALR2)) | ( *IOP331_IATVR2)))
35
36#endif
37
38#endif
diff --git a/include/asm-arm/arch-iop3xx/system.h b/include/asm-arm/arch-iop3xx/system.h
deleted file mode 100644
index af6ae8cd36c9..000000000000
--- a/include/asm-arm/arch-iop3xx/system.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
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
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
15
16
17static inline void arch_reset(char mode)
18{
19#ifdef CONFIG_ARCH_IOP321
20 *IOP321_PCSR = 0x30;
21#endif
22
23#ifdef CONFIG_ARCH_IOP331
24 *IOP331_PCSR = 0x30;
25#endif
26
27 if ( 1 && mode == 's') {
28 /* Jump into ROM at address 0 */
29 cpu_reset(0);
30 } else {
31 /* No on-chip reset capability */
32 cpu_reset(0);
33 }
34}
35
diff --git a/include/asm-arm/arch-iop3xx/timex.h b/include/asm-arm/arch-iop3xx/timex.h
deleted file mode 100644
index 14ca8d0f7b29..000000000000
--- a/include/asm-arm/arch-iop3xx/timex.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/timex.h
3 *
4 * IOP3xx architecture timex specifications
5 */
6#include <asm/hardware.h>
7
8#if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244)
9
10#define CLOCK_TICK_RATE IOP321_TICK_RATE
11
12#elif defined(CONFIG_ARCH_IQ80331) || defined(CONFIG_MACH_IQ80332)
13
14#define CLOCK_TICK_RATE IOP331_TICK_RATE
15
16#else
17
18#error "No IOP3xx timex information for this architecture"
19
20#endif
diff --git a/include/asm-arm/arch-iop3xx/uncompress.h b/include/asm-arm/arch-iop3xx/uncompress.h
deleted file mode 100644
index fbdd5af644fe..000000000000
--- a/include/asm-arm/arch-iop3xx/uncompress.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/uncompress.h
3 */
4#include <asm/types.h>
5#include <asm/mach-types.h>
6#include <linux/serial_reg.h>
7#include <asm/hardware.h>
8
9#ifdef CONFIG_ARCH_IOP321
10#define UTYPE unsigned char *
11#elif defined(CONFIG_ARCH_IOP331)
12#define UTYPE u32 *
13#else
14#error "Missing IOP3xx arch type def"
15#endif
16
17static volatile UTYPE uart_base;
18
19#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
20
21static inline void putc(char c)
22{
23 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
24 barrier();
25 *uart_base = c;
26}
27
28static inline void flush(void)
29{
30}
31
32static __inline__ void __arch_decomp_setup(unsigned long arch_id)
33{
34 if(machine_is_iq80321())
35 uart_base = (volatile UTYPE)IQ80321_UART;
36 else if(machine_is_iq31244())
37 uart_base = (volatile UTYPE)IQ31244_UART;
38 else if(machine_is_iq80331() || machine_is_iq80332())
39 uart_base = (volatile UTYPE)IOP331_UART0_PHYS;
40 else
41 uart_base = (volatile UTYPE)0xfe800000;
42}
43
44/*
45 * nothing to do
46 */
47#define arch_decomp_setup() __arch_decomp_setup(arch_id)
48#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-iop3xx/vmalloc.h b/include/asm-arm/arch-iop3xx/vmalloc.h
deleted file mode 100644
index 0f2f6847f93c..000000000000
--- a/include/asm-arm/arch-iop3xx/vmalloc.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/vmalloc.h
3 */
4
5/*
6 * Just any arbitrary offset to the start of the vmalloc VM area: the
7 * current 8MB value just means that there will be a 8MB "hole" after the
8 * physical memory until the kernel virtual memory starts. That means that
9 * any out-of-bounds memory accesses will hopefully be caught.
10 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
11 * area for the same reason. ;)
12 */
13//#define VMALLOC_END (0xe8000000)
14/* increase usable physical RAM to ~992M per RMK */
15#define VMALLOC_END (0xfe000000)
16
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 13aee17b0475..8d10a9187693 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -90,6 +90,11 @@ struct ixp4xx_i2c_pins {
90struct sys_timer; 90struct sys_timer;
91 91
92/* 92/*
93 * Frequency of clock used for primary clocksource
94 */
95extern unsigned long ixp4xx_timer_freq;
96
97/*
93 * Functions used by platform-level setup code 98 * Functions used by platform-level setup code
94 */ 99 */
95extern void ixp4xx_map_io(void); 100extern void ixp4xx_map_io(void);
diff --git a/include/asm-arm/arch-ixp4xx/system.h b/include/asm-arm/arch-ixp4xx/system.h
index 73589aad8dd6..8e1db423b1cc 100644
--- a/include/asm-arm/arch-ixp4xx/system.h
+++ b/include/asm-arm/arch-ixp4xx/system.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-ixp4x//system.h 2 * include/asm-arm/arch-ixp4xx/system.h
3 * 3 *
4 * Copyright (C) 2002 Intel Corporation. 4 * Copyright (C) 2002 Intel Corporation.
5 * 5 *
diff --git a/include/asm-arm/arch-l7200/io.h b/include/asm-arm/arch-l7200/io.h
index cd080d8384d9..d744d97c18a5 100644
--- a/include/asm-arm/arch-l7200/io.h
+++ b/include/asm-arm/arch-l7200/io.h
@@ -31,9 +31,9 @@
31static inline unsigned int __arch_getw(unsigned long a) 31static inline unsigned int __arch_getw(unsigned long a)
32{ 32{
33 unsigned int value; 33 unsigned int value;
34 __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw" 34 __asm__ __volatile__("ldrh %0, [%1, #0] @ getw"
35 : "=&r" (value) 35 : "=&r" (value)
36 : "r" (a)); 36 : "r" (a) : "cc");
37 return value; 37 return value;
38} 38}
39 39
@@ -42,8 +42,8 @@ static inline unsigned int __arch_getw(unsigned long a)
42 42
43static inline void __arch_putw(unsigned int value, unsigned long a) 43static inline void __arch_putw(unsigned int value, unsigned long a)
44{ 44{
45 __asm__ __volatile__("str%?h %0, [%1, #0] @ putw" 45 __asm__ __volatile__("strh %0, [%1, #0] @ putw"
46 : : "r" (value), "r" (a)); 46 : : "r" (value), "r" (a) : "cc");
47} 47}
48 48
49/* 49/*
diff --git a/include/asm-arm/arch-l7200/time.h b/include/asm-arm/arch-l7200/time.h
index 7b98b533e63a..c69cb508735f 100644
--- a/include/asm-arm/arch-l7200/time.h
+++ b/include/asm-arm/arch-l7200/time.h
@@ -45,7 +45,7 @@
45static irqreturn_t 45static irqreturn_t
46timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 46timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
47{ 47{
48 do_timer(regs); 48 do_timer(1);
49#ifndef CONFIG_SMP 49#ifndef CONFIG_SMP
50 update_process_times(user_mode(regs)); 50 update_process_times(user_mode(regs));
51#endif 51#endif
diff --git a/include/asm-arm/arch-lh7a40x/clocks.h b/include/asm-arm/arch-lh7a40x/clocks.h
index bee02fd8dab1..7d0ba18ad578 100644
--- a/include/asm-arm/arch-lh7a40x/clocks.h
+++ b/include/asm-arm/arch-lh7a40x/clocks.h
@@ -8,8 +8,6 @@
8 * 8 *
9 */ 9 */
10 10
11#include <linux/config.h>
12
13#ifndef __ASM_ARCH_CLOCKS_H 11#ifndef __ASM_ARCH_CLOCKS_H
14#define __ASM_ARCH_CLOCKS_H 12#define __ASM_ARCH_CLOCKS_H
15 13
diff --git a/include/asm-arm/arch-omap/board-ams-delta.h b/include/asm-arm/arch-omap/board-ams-delta.h
index 0070f6d3b75c..9aee15d97145 100644
--- a/include/asm-arm/arch-omap/board-ams-delta.h
+++ b/include/asm-arm/arch-omap/board-ams-delta.h
@@ -50,9 +50,20 @@
50#define AMS_DELTA_LATCH2_NAND_NWE 0x0020 50#define AMS_DELTA_LATCH2_NAND_NWE 0x0020
51#define AMS_DELTA_LATCH2_NAND_ALE 0x0040 51#define AMS_DELTA_LATCH2_NAND_ALE 0x0040
52#define AMS_DELTA_LATCH2_NAND_CLE 0x0080 52#define AMS_DELTA_LATCH2_NAND_CLE 0x0080
53#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
54#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
55#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
56#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
53#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000 57#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
54#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 58#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
55 59
60#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
61#define AMS_DELTA_GPIO_PIN_KEYBRD_CLK 1
62#define AMS_DELTA_GPIO_PIN_MODEM_IRQ 2
63#define AMS_DELTA_GPIO_PIN_HOOK_SWITCH 4
64#define AMS_DELTA_GPIO_PIN_SCARD_NOFF 6
65#define AMS_DELTA_GPIO_PIN_SCARD_IO 7
66#define AMS_DELTA_GPIO_PIN_CONFIG 11
56#define AMS_DELTA_GPIO_PIN_NAND_RB 12 67#define AMS_DELTA_GPIO_PIN_NAND_RB 12
57 68
58#ifndef __ASSEMBLY__ 69#ifndef __ASSEMBLY__
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
index f83003f5287b..fa6881049903 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -45,6 +45,7 @@ struct clk_functions {
45 struct clk * (*clk_get_parent)(struct clk *clk); 45 struct clk * (*clk_get_parent)(struct clk *clk);
46 void (*clk_allow_idle)(struct clk *clk); 46 void (*clk_allow_idle)(struct clk *clk);
47 void (*clk_deny_idle)(struct clk *clk); 47 void (*clk_deny_idle)(struct clk *clk);
48 void (*clk_disable_unused)(struct clk *clk);
48}; 49};
49 50
50extern unsigned int mpurate; 51extern unsigned int mpurate;
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index 1b1b02307e77..d591d0585bba 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -331,6 +331,12 @@ enum omap_dma_color_mode {
331 OMAP_DMA_TRANSPARENT_COPY 331 OMAP_DMA_TRANSPARENT_COPY
332}; 332};
333 333
334enum omap_dma_write_mode {
335 OMAP_DMA_WRITE_NON_POSTED = 0,
336 OMAP_DMA_WRITE_POSTED,
337 OMAP_DMA_WRITE_LAST_NON_POSTED
338};
339
334struct omap_dma_channel_params { 340struct omap_dma_channel_params {
335 int data_type; /* data type 8,16,32 */ 341 int data_type; /* data type 8,16,32 */
336 int elem_count; /* number of elements in a frame */ 342 int elem_count; /* number of elements in a frame */
@@ -338,13 +344,13 @@ struct omap_dma_channel_params {
338 344
339 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */ 345 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
340 int src_amode; /* constant , post increment, indexed , double indexed */ 346 int src_amode; /* constant , post increment, indexed , double indexed */
341 int src_start; /* source address : physical */ 347 unsigned long src_start; /* source address : physical */
342 int src_ei; /* source element index */ 348 int src_ei; /* source element index */
343 int src_fi; /* source frame index */ 349 int src_fi; /* source frame index */
344 350
345 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */ 351 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
346 int dst_amode; /* constant , post increment, indexed , double indexed */ 352 int dst_amode; /* constant , post increment, indexed , double indexed */
347 int dst_start; /* source address : physical */ 353 unsigned long dst_start; /* source address : physical */
348 int dst_ei; /* source element index */ 354 int dst_ei; /* source element index */
349 int dst_fi; /* source frame index */ 355 int dst_fi; /* source frame index */
350 356
@@ -356,7 +362,7 @@ struct omap_dma_channel_params {
356}; 362};
357 363
358 364
359extern void omap_set_dma_priority(int dst_port, int priority); 365extern void omap_set_dma_priority(int lch, int dst_port, int priority);
360extern int omap_request_dma(int dev_id, const char *dev_name, 366extern int omap_request_dma(int dev_id, const char *dev_name,
361 void (* callback)(int lch, u16 ch_status, void *data), 367 void (* callback)(int lch, u16 ch_status, void *data),
362 void *data, int *dma_ch); 368 void *data, int *dma_ch);
@@ -371,6 +377,7 @@ extern void omap_set_dma_transfer_params(int lch, int data_type,
371 int dma_trigger, int src_or_dst_synch); 377 int dma_trigger, int src_or_dst_synch);
372extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, 378extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
373 u32 color); 379 u32 color);
380extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
374 381
375extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, 382extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
376 unsigned long src_start, 383 unsigned long src_start,
@@ -394,6 +401,9 @@ extern void omap_set_dma_params(int lch,
394extern void omap_dma_link_lch (int lch_head, int lch_queue); 401extern void omap_dma_link_lch (int lch_head, int lch_queue);
395extern void omap_dma_unlink_lch (int lch_head, int lch_queue); 402extern void omap_dma_unlink_lch (int lch_head, int lch_queue);
396 403
404extern int omap_set_dma_callback(int lch,
405 void (* callback)(int lch, u16 ch_status, void *data),
406 void *data);
397extern dma_addr_t omap_get_dma_src_pos(int lch); 407extern dma_addr_t omap_get_dma_src_pos(int lch);
398extern dma_addr_t omap_get_dma_dst_pos(int lch); 408extern dma_addr_t omap_get_dma_dst_pos(int lch);
399extern int omap_get_dma_src_addr_counter(int lch); 409extern int omap_get_dma_src_addr_counter(int lch);
diff --git a/include/asm-arm/arch-omap/dmtimer.h b/include/asm-arm/arch-omap/dmtimer.h
index 7a289ff07404..fefb276ed402 100644
--- a/include/asm-arm/arch-omap/dmtimer.h
+++ b/include/asm-arm/arch-omap/dmtimer.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/arm/arch-omap/dmtimer.h 2 * linux/include/asm-arm/arch-omap/dmtimer.h
3 * 3 *
4 * OMAP Dual-Mode Timers 4 * OMAP Dual-Mode Timers
5 * 5 *
@@ -52,6 +52,8 @@ int omap_dm_timer_init(void);
52struct omap_dm_timer *omap_dm_timer_request(void); 52struct omap_dm_timer *omap_dm_timer_request(void);
53struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); 53struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
54void omap_dm_timer_free(struct omap_dm_timer *timer); 54void omap_dm_timer_free(struct omap_dm_timer *timer);
55void omap_dm_timer_enable(struct omap_dm_timer *timer);
56void omap_dm_timer_disable(struct omap_dm_timer *timer);
55 57
56int omap_dm_timer_get_irq(struct omap_dm_timer *timer); 58int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
57 59
diff --git a/include/asm-arm/arch-omap/gpmc.h b/include/asm-arm/arch-omap/gpmc.h
index 1a0a5207822d..7c03ef6c14c4 100644
--- a/include/asm-arm/arch-omap/gpmc.h
+++ b/include/asm-arm/arch-omap/gpmc.h
@@ -85,7 +85,7 @@ extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
85extern u32 gpmc_cs_read_reg(int cs, int idx); 85extern u32 gpmc_cs_read_reg(int cs, int idx);
86extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk); 86extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk);
87extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 87extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
88extern unsigned long gpmc_cs_get_base_addr(int cs); 88extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
89 89extern void gpmc_cs_free(int cs);
90 90
91#endif 91#endif
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h
index 2542495d8a43..c5bb05a69b81 100644
--- a/include/asm-arm/arch-omap/irqs.h
+++ b/include/asm-arm/arch-omap/irqs.h
@@ -237,6 +237,7 @@
237#define INT_24XX_SDMA_IRQ1 13 237#define INT_24XX_SDMA_IRQ1 13
238#define INT_24XX_SDMA_IRQ2 14 238#define INT_24XX_SDMA_IRQ2 14
239#define INT_24XX_SDMA_IRQ3 15 239#define INT_24XX_SDMA_IRQ3 15
240#define INT_24XX_CAM_IRQ 24
240#define INT_24XX_DSS_IRQ 25 241#define INT_24XX_DSS_IRQ 25
241#define INT_24XX_GPIO_BANK1 29 242#define INT_24XX_GPIO_BANK1 29
242#define INT_24XX_GPIO_BANK2 30 243#define INT_24XX_GPIO_BANK2 30
@@ -261,6 +262,7 @@
261#define INT_24XX_UART1_IRQ 72 262#define INT_24XX_UART1_IRQ 72
262#define INT_24XX_UART2_IRQ 73 263#define INT_24XX_UART2_IRQ 73
263#define INT_24XX_UART3_IRQ 74 264#define INT_24XX_UART3_IRQ 74
265#define INT_24XX_MMC_IRQ 83
264 266
265/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and 267/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
266 * 16 MPUIO lines */ 268 * 16 MPUIO lines */
diff --git a/include/asm-arm/arch-omap/keypad.h b/include/asm-arm/arch-omap/keypad.h
index 8a023a984acb..b7f83075436e 100644
--- a/include/asm-arm/arch-omap/keypad.h
+++ b/include/asm-arm/arch-omap/keypad.h
@@ -14,7 +14,10 @@ struct omap_kp_platform_data {
14 int rows; 14 int rows;
15 int cols; 15 int cols;
16 int *keymap; 16 int *keymap;
17 unsigned int keymapsize;
17 unsigned int rep:1; 18 unsigned int rep:1;
19 unsigned long delay;
20 unsigned int dbounce:1;
18 /* specific to OMAP242x*/ 21 /* specific to OMAP242x*/
19 unsigned int *row_gpios; 22 unsigned int *row_gpios;
20 unsigned int *col_gpios; 23 unsigned int *col_gpios;
diff --git a/include/asm-arm/arch-omap/mcbsp.h b/include/asm-arm/arch-omap/mcbsp.h
index ed0dde4f7219..c7a0cc1c4e93 100644
--- a/include/asm-arm/arch-omap/mcbsp.h
+++ b/include/asm-arm/arch-omap/mcbsp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/arch-omap/gpio.h 2 * linux/include/asm-arm/arch-omap/mcbsp.h
3 * 3 *
4 * Defines for Multi-Channel Buffered Serial Port 4 * Defines for Multi-Channel Buffered Serial Port
5 * 5 *
diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h
index 679869c5e68f..828cc5c114e1 100644
--- a/include/asm-arm/arch-omap/mux.h
+++ b/include/asm-arm/arch-omap/mux.h
@@ -320,6 +320,17 @@ enum omap1xxx_index {
320 P15_1610_UWIRE_CS3, 320 P15_1610_UWIRE_CS3,
321 N15_1610_UWIRE_CS1, 321 N15_1610_UWIRE_CS1,
322 322
323 /* OMAP-1610 SPI */
324 U19_1610_SPIF_SCK,
325 U18_1610_SPIF_DIN,
326 P20_1610_SPIF_DIN,
327 W21_1610_SPIF_DOUT,
328 R18_1610_SPIF_DOUT,
329 N14_1610_SPIF_CS0,
330 N15_1610_SPIF_CS1,
331 T19_1610_SPIF_CS2,
332 P15_1610_SPIF_CS3,
333
323 /* OMAP-1610 Flash */ 334 /* OMAP-1610 Flash */
324 L3_1610_FLASH_CS2B_OE, 335 L3_1610_FLASH_CS2B_OE,
325 M8_1610_FLASH_CS2B_WE, 336 M8_1610_FLASH_CS2B_WE,
@@ -461,6 +472,20 @@ enum omap24xx_index {
461 K15_24XX_UART3_TX, 472 K15_24XX_UART3_TX,
462 K14_24XX_UART3_RX, 473 K14_24XX_UART3_RX,
463 474
475 /* MMC/SDIO */
476 G19_24XX_MMC_CLKO,
477 H18_24XX_MMC_CMD,
478 F20_24XX_MMC_DAT0,
479 H14_24XX_MMC_DAT1,
480 E19_24XX_MMC_DAT2,
481 D19_24XX_MMC_DAT3,
482 F19_24XX_MMC_DAT_DIR0,
483 E20_24XX_MMC_DAT_DIR1,
484 F18_24XX_MMC_DAT_DIR2,
485 E18_24XX_MMC_DAT_DIR3,
486 G18_24XX_MMC_CMD_DIR,
487 H15_24XX_MMC_CLKI,
488
464 /* Keypad GPIO*/ 489 /* Keypad GPIO*/
465 T19_24XX_KBR0, 490 T19_24XX_KBR0,
466 R19_24XX_KBR1, 491 R19_24XX_KBR1,
diff --git a/include/asm-arm/arch-omap/pm.h b/include/asm-arm/arch-omap/pm.h
index e46623c61a72..14588059981f 100644
--- a/include/asm-arm/arch-omap/pm.h
+++ b/include/asm-arm/arch-omap/pm.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm/arch-omap/pm.h 2 * linux/include/asm-arm/arch-omap/pm.h
3 * 3 *
4 * Header file for OMAP Power Management Routines 4 * Header file for OMAP Power Management Routines
5 * 5 *
diff --git a/include/asm-arm/arch-pnx4008/clock.h b/include/asm-arm/arch-pnx4008/clock.h
index 91ae0030fdf2..ce155e161269 100644
--- a/include/asm-arm/arch-pnx4008/clock.h
+++ b/include/asm-arm/arch-pnx4008/clock.h
@@ -32,6 +32,7 @@ struct clk;
32#define KEYCLKCTRL_REG (PWRMAN_VA_BASE + 0xb0) 32#define KEYCLKCTRL_REG (PWRMAN_VA_BASE + 0xb0)
33#define TSCLKCTRL_REG (PWRMAN_VA_BASE + 0xb4) 33#define TSCLKCTRL_REG (PWRMAN_VA_BASE + 0xb4)
34#define PWMCLKCTRL_REG (PWRMAN_VA_BASE + 0xb8) 34#define PWMCLKCTRL_REG (PWRMAN_VA_BASE + 0xb8)
35#define TIMCLKCTRL_REG (PWRMAN_VA_BASE + 0xbc)
35#define SPICTRL_REG (PWRMAN_VA_BASE + 0xc4) 36#define SPICTRL_REG (PWRMAN_VA_BASE + 0xc4)
36#define FLASHCLKCTRL_REG (PWRMAN_VA_BASE + 0xc8) 37#define FLASHCLKCTRL_REG (PWRMAN_VA_BASE + 0xc8)
37#define UART3CLK_REG (PWRMAN_VA_BASE + 0xd0) 38#define UART3CLK_REG (PWRMAN_VA_BASE + 0xd0)
diff --git a/include/asm-arm/arch-pnx4008/platform.h b/include/asm-arm/arch-pnx4008/platform.h
index 485a3651b4d7..2613c7c669b1 100644
--- a/include/asm-arm/arch-pnx4008/platform.h
+++ b/include/asm-arm/arch-pnx4008/platform.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-pnx4008/platfrom.h 2 * include/asm-arm/arch-pnx4008/platform.h
3 * 3 *
4 * PNX4008 Base addresses - header file 4 * PNX4008 Base addresses - header file
5 * 5 *
diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h
index aba9b30f4249..81c3928d608c 100644
--- a/include/asm-arm/arch-pxa/pxafb.h
+++ b/include/asm-arm/arch-pxa/pxafb.h
@@ -12,12 +12,14 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/fb.h>
16
15/* 17/*
16 * This structure describes the machine which we are running on. 18 * This structure describes the machine which we are running on.
17 * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine 19 * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine
18 * of linux/drivers/video/pxafb.c 20 * of linux/drivers/video/pxafb.c
19 */ 21 */
20struct pxafb_mach_info { 22struct pxafb_mode_info {
21 u_long pixclock; 23 u_long pixclock;
22 24
23 u_short xres; 25 u_short xres;
@@ -34,6 +36,14 @@ struct pxafb_mach_info {
34 u_char sync; 36 u_char sync;
35 37
36 u_int cmap_greyscale:1, 38 u_int cmap_greyscale:1,
39 unused:31;
40};
41
42struct pxafb_mach_info {
43 struct pxafb_mode_info *modes;
44 unsigned int num_modes;
45
46 u_int fixed_modes:1,
37 cmap_inverse:1, 47 cmap_inverse:1,
38 cmap_static:1, 48 cmap_static:1,
39 unused:29; 49 unused:29;
@@ -62,7 +72,7 @@ struct pxafb_mach_info {
62 u_int lccr3; 72 u_int lccr3;
63 73
64 void (*pxafb_backlight_power)(int); 74 void (*pxafb_backlight_power)(int);
65 void (*pxafb_lcd_power)(int); 75 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
66 76
67}; 77};
68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); 78void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
diff --git a/include/asm-arm/arch-pxa/spitz.h b/include/asm-arm/arch-pxa/spitz.h
index 62e1fe4d025f..4953dd324d4d 100644
--- a/include/asm-arm/arch-pxa/spitz.h
+++ b/include/asm-arm/arch-pxa/spitz.h
@@ -15,6 +15,8 @@
15#define __ASM_ARCH_SPITZ_H 1 15#define __ASM_ARCH_SPITZ_H 1
16#endif 16#endif
17 17
18#include <linux/fb.h>
19
18/* Spitz/Akita GPIOs */ 20/* Spitz/Akita GPIOs */
19 21
20#define SPITZ_GPIO_KEY_INT (0) /* Key Interrupt */ 22#define SPITZ_GPIO_KEY_INT (0) /* Key Interrupt */
@@ -155,4 +157,4 @@ extern struct platform_device spitzscoop2_device;
155extern struct platform_device spitzssp_device; 157extern struct platform_device spitzssp_device;
156extern struct sharpsl_charger_machinfo spitz_pm_machinfo; 158extern struct sharpsl_charger_machinfo spitz_pm_machinfo;
157 159
158extern void spitz_lcd_power(int on); 160extern void spitz_lcd_power(int on, struct fb_var_screeninfo *var);
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h
index 30548a30c773..121cd241115d 100644
--- a/include/asm-arm/arch-pxa/udc.h
+++ b/include/asm-arm/arch-pxa/udc.h
@@ -12,6 +12,14 @@ struct pxa2xx_udc_mach_info {
12 void (*udc_command)(int cmd); 12 void (*udc_command)(int cmd);
13#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */ 13#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
14#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ 14#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
15
16 /* Boards following the design guidelines in the developer's manual,
17 * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane
18 * VBUS IRQ and omit the methods above. Store the GPIO number
19 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
20 */
21 u16 gpio_vbus; /* high == vbus present */
22 u16 gpio_pullup; /* high == pullup activated */
15}; 23};
16 24
17extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); 25extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
diff --git a/include/asm-arm/arch-s3c2410/dma.h b/include/asm-arm/arch-s3c2410/dma.h
index 3661e465b0a5..7ac224836971 100644
--- a/include/asm-arm/arch-s3c2410/dma.h
+++ b/include/asm-arm/arch-s3c2410/dma.h
@@ -23,6 +23,39 @@
23#define MAX_DMA_ADDRESS 0x40000000 23#define MAX_DMA_ADDRESS 0x40000000
24#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 24#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
25 25
26/* We use `virtual` dma channels to hide the fact we have only a limited
27 * number of DMA channels, and not of all of them (dependant on the device)
28 * can be attached to any DMA source. We therefore let the DMA core handle
29 * the allocation of hardware channels to clients.
30*/
31
32enum dma_ch {
33 DMACH_XD0,
34 DMACH_XD1,
35 DMACH_SDI,
36 DMACH_SPI0,
37 DMACH_SPI1,
38 DMACH_UART0,
39 DMACH_UART1,
40 DMACH_UART2,
41 DMACH_TIMER,
42 DMACH_I2S_IN,
43 DMACH_I2S_OUT,
44 DMACH_PCM_IN,
45 DMACH_PCM_OUT,
46 DMACH_MIC_IN,
47 DMACH_USB_EP1,
48 DMACH_USB_EP2,
49 DMACH_USB_EP3,
50 DMACH_USB_EP4,
51 DMACH_UART0_SRC2, /* s3c2412 second uart sources */
52 DMACH_UART1_SRC2,
53 DMACH_UART2_SRC2,
54 DMACH_MAX, /* the end entry */
55};
56
57#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
58
26/* we have 4 dma channels */ 59/* we have 4 dma channels */
27#define S3C2410_DMA_CHANNELS (4) 60#define S3C2410_DMA_CHANNELS (4)
28 61
@@ -149,6 +182,8 @@ struct s3c2410_dma_stats {
149 unsigned long timeout_failed; 182 unsigned long timeout_failed;
150}; 183};
151 184
185struct s3c2410_dma_map;
186
152/* struct s3c2410_dma_chan 187/* struct s3c2410_dma_chan
153 * 188 *
154 * full state information for each DMA channel 189 * full state information for each DMA channel
@@ -174,6 +209,8 @@ struct s3c2410_dma_chan {
174 unsigned long load_timeout; 209 unsigned long load_timeout;
175 unsigned int flags; /* channel flags */ 210 unsigned int flags; /* channel flags */
176 211
212 struct s3c24xx_dma_map *map; /* channel hw maps */
213
177 /* channel's hardware position and configuration */ 214 /* channel's hardware position and configuration */
178 void __iomem *regs; /* channels registers */ 215 void __iomem *regs; /* channels registers */
179 void __iomem *addr_reg; /* data address register */ 216 void __iomem *addr_reg; /* data address register */
@@ -283,6 +320,7 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
283#define S3C2410_DMA_DCSRC (0x18) 320#define S3C2410_DMA_DCSRC (0x18)
284#define S3C2410_DMA_DCDST (0x1C) 321#define S3C2410_DMA_DCDST (0x1C)
285#define S3C2410_DMA_DMASKTRIG (0x20) 322#define S3C2410_DMA_DMASKTRIG (0x20)
323#define S3C2412_DMA_DMAREQSEL (0x24)
286 324
287#define S3C2410_DISRCC_INC (1<<0) 325#define S3C2410_DISRCC_INC (1<<0)
288#define S3C2410_DISRCC_APB (1<<1) 326#define S3C2410_DISRCC_APB (1<<1)
@@ -349,4 +387,32 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
349#define S3C2440_DCON_CH3_PCMOUT (6<<24) 387#define S3C2440_DCON_CH3_PCMOUT (6<<24)
350#endif 388#endif
351 389
390#ifdef CONFIG_CPU_S3C2412
391
392#define S3C2412_DMAREQSEL_SRC(x) ((x)<<1)
393
394#define S3C2412_DMAREQSEL_HW (1)
395
396#define S3C2412_DMAREQSEL_SPI0TX S3C2412_DMAREQSEL_SRC(0)
397#define S3C2412_DMAREQSEL_SPI0RX S3C2412_DMAREQSEL_SRC(1)
398#define S3C2412_DMAREQSEL_SPI1TX S3C2412_DMAREQSEL_SRC(2)
399#define S3C2412_DMAREQSEL_SPI1RX S3C2412_DMAREQSEL_SRC(3)
400#define S3C2412_DMAREQSEL_I2STX S3C2412_DMAREQSEL_SRC(4)
401#define S3C2412_DMAREQSEL_I2SRX S3C2412_DMAREQSEL_SRC(5)
402#define S3C2412_DMAREQSEL_TIMER S3C2412_DMAREQSEL_SRC(9)
403#define S3C2412_DMAREQSEL_SDI S3C2412_DMAREQSEL_SRC(10)
404#define S3C2412_DMAREQSEL_USBEP1 S3C2412_DMAREQSEL_SRC(13)
405#define S3C2412_DMAREQSEL_USBEP2 S3C2412_DMAREQSEL_SRC(14)
406#define S3C2412_DMAREQSEL_USBEP3 S3C2412_DMAREQSEL_SRC(15)
407#define S3C2412_DMAREQSEL_USBEP4 S3C2412_DMAREQSEL_SRC(16)
408#define S3C2412_DMAREQSEL_XDREQ0 S3C2412_DMAREQSEL_SRC(17)
409#define S3C2412_DMAREQSEL_XDREQ1 S3C2412_DMAREQSEL_SRC(18)
410#define S3C2412_DMAREQSEL_UART0_0 S3C2412_DMAREQSEL_SRC(19)
411#define S3C2412_DMAREQSEL_UART0_1 S3C2412_DMAREQSEL_SRC(20)
412#define S3C2412_DMAREQSEL_UART1_0 S3C2412_DMAREQSEL_SRC(21)
413#define S3C2412_DMAREQSEL_UART1_1 S3C2412_DMAREQSEL_SRC(22)
414#define S3C2412_DMAREQSEL_UART2_0 S3C2412_DMAREQSEL_SRC(23)
415#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24)
416
417#endif
352#endif /* __ASM_ARCH_DMA_H */ 418#endif /* __ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-s3c2410/fb.h b/include/asm-arm/arch-s3c2410/fb.h
index 71161797bc89..90894214cace 100644
--- a/include/asm-arm/arch-s3c2410/fb.h
+++ b/include/asm-arm/arch-s3c2410/fb.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/fb.h 1/* linux/include/asm-arm/arch-s3c2410/fb.h
2 * 2 *
3 * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org> 3 * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
4 * 4 *
diff --git a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h
index 27ba0ac3fdd5..7895042d176b 100644
--- a/include/asm-arm/arch-s3c2410/map.h
+++ b/include/asm-arm/arch-s3c2410/map.h
@@ -160,6 +160,11 @@
160#define S3C2440_PA_CAMIF (0x4F000000) 160#define S3C2440_PA_CAMIF (0x4F000000)
161#define S3C2440_SZ_CAMIF SZ_1M 161#define S3C2440_SZ_CAMIF SZ_1M
162 162
163/* AC97 */
164
165#define S3C2440_PA_AC97 (0x5B000000)
166#define S3C2440_SZ_AC97 SZ_1M
167
163/* ISA style IO, for each machine to sort out mappings for, if it 168/* ISA style IO, for each machine to sort out mappings for, if it
164 * implements it. We reserve two 16M regions for ISA. 169 * implements it. We reserve two 16M regions for ISA.
165 */ 170 */
diff --git a/include/asm-arm/arch-s3c2410/osiris-map.h b/include/asm-arm/arch-s3c2410/osiris-map.h
index e2d406218ae5..a14164dfa525 100644
--- a/include/asm-arm/arch-s3c2410/osiris-map.h
+++ b/include/asm-arm/arch-s3c2410/osiris-map.h
@@ -18,22 +18,22 @@
18 18
19/* start peripherals off after the S3C2410 */ 19/* start peripherals off after the S3C2410 */
20 20
21#define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x05000000)) 21#define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x04000000))
22 22
23#define OSIRIS_PA_CPLD (S3C2410_CS1 | (3<<25)) 23#define OSIRIS_PA_CPLD (S3C2410_CS1 | (1<<26))
24 24
25/* we put the CPLD registers next, to get them out of the way */ 25/* we put the CPLD registers next, to get them out of the way */
26 26
27#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00000000) /* 0x01300000 */ 27#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00000000)
28#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD) 28#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD)
29 29
30#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00100000) /* 0x01400000 */ 30#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00100000)
31#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (1<<24)) 31#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (1<<23))
32 32
33#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00200000) /* 0x01500000 */ 33#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00200000)
34#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<24)) 34#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<23))
35 35
36#define OSIRIS_VA_CTRL4 OSIRIS_IOADDR(0x00300000) /* 0x01600000 */ 36#define OSIRIS_VA_CTRL4 OSIRIS_IOADDR(0x00300000)
37#define OSIRIS_PA_CTRL4 (OSIRIS_PA_CPLD + (3<<24)) 37#define OSIRIS_PA_CTRL4 (OSIRIS_PA_CPLD + (3<<23))
38 38
39#endif /* __ASM_ARCH_OSIRISMAP_H */ 39#endif /* __ASM_ARCH_OSIRISMAP_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-ac97.h b/include/asm-arm/arch-s3c2410/regs-ac97.h
new file mode 100644
index 000000000000..bdd6a4f93d7f
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/regs-ac97.h
@@ -0,0 +1,23 @@
1/* linux/include/asm-arm/arch-s3c2410/regs-ac97.h
2 *
3 * Copyright (c) 2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2440 AC97 Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_AC97_H
14#define __ASM_ARCH_REGS_AC97_H __FILE__
15
16#define S3C_AC97_GLBCTRL (0x00)
17#define S3C_AC97_GLBSTAT (0x04)
18#define S3C_AC97_CODEC_CMD (0x08)
19#define S3C_AC97_PCM_ADDR (0x10)
20#define S3C_AC97_PCM_DATA (0x18)
21#define S3C_AC97_MIC_DATA (0x1C)
22
23#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-adc.h b/include/asm-arm/arch-s3c2410/regs-adc.h
index c7b90b3ecc9e..3196a2849e8a 100644
--- a/include/asm-arm/arch-s3c2410/regs-adc.h
+++ b/include/asm-arm/arch-s3c2410/regs-adc.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-adc.h 1/* linux/include/asm-arm/arch-s3c2410/regs-adc.h
2 * 2 *
3 * Copyright (c) 2004 Shannon Holland <holland@loser.net> 3 * Copyright (c) 2004 Shannon Holland <holland@loser.net>
4 * 4 *
diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h
index b2f4690c0791..e39656b7a086 100644
--- a/include/asm-arm/arch-s3c2410/regs-clock.h
+++ b/include/asm-arm/arch-s3c2410/regs-clock.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-clock.h 1/* linux/include/asm-arm/arch-s3c2410/regs-clock.h
2 * 2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
diff --git a/include/asm-arm/arch-s3c2410/regs-dsc.h b/include/asm-arm/arch-s3c2410/regs-dsc.h
index a0a124875164..c0748511edbc 100644
--- a/include/asm-arm/arch-s3c2410/regs-dsc.h
+++ b/include/asm-arm/arch-s3c2410/regs-dsc.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/hardware/s3c2410/regs-dsc.h 1/* linux/include/asm-arm/arch-s3c2410/regs-dsc.h
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index 93c49432db95..b2893e32a236 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/hardware/s3c2410/regs-gpio.h 1/* linux/include/asm-arm/arch-s3c2410/regs-gpio.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003,2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-gpioj.h b/include/asm-arm/arch-s3c2410/regs-gpioj.h
index 91cefa260497..02131a5a1d3a 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpioj.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpioj.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/hardware/s3c2410/regs-gpioj.h 1/* linux/include/asm-arm/arch-s3c2410/regs-gpioj.h
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-iis.h b/include/asm-arm/arch-s3c2410/regs-iis.h
index 72cd2509822e..eaf77916a602 100644
--- a/include/asm-arm/arch-s3c2410/regs-iis.h
+++ b/include/asm-arm/arch-s3c2410/regs-iis.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-iis.h 1/* linux/include/asm-arm/arch-s3c2410/regs-iis.h
2 * 2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-irq.h b/include/asm-arm/arch-s3c2410/regs-irq.h
index 29fb8ef670f0..498184cb8adc 100644
--- a/include/asm-arm/arch-s3c2410/regs-irq.h
+++ b/include/asm-arm/arch-s3c2410/regs-irq.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-irq.h 1/* linux/include/asm-arm/arch-s3c2410/regs-irq.h
2 * 2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-lcd.h b/include/asm-arm/arch-s3c2410/regs-lcd.h
index b306d6e3135d..b7faeb04c0ff 100644
--- a/include/asm-arm/arch-s3c2410/regs-lcd.h
+++ b/include/asm-arm/arch-s3c2410/regs-lcd.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-lcd.h 1/* linux/include/asm-arm/arch-s3c2410/regs-lcd.h
2 * 2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
@@ -63,6 +63,8 @@
63#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F) 63#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
64#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF) 64#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF)
65 65
66/* LDCCON4 changes for STN mode on the S3C2412 */
67
66#define S3C2410_LCDCON4_MVAL(x) ((x) << 8) 68#define S3C2410_LCDCON4_MVAL(x) ((x) << 8)
67#define S3C2410_LCDCON4_HSPW(x) ((x) << 0) 69#define S3C2410_LCDCON4_HSPW(x) ((x) << 0)
68#define S3C2410_LCDCON4_WLH(x) ((x) << 0) 70#define S3C2410_LCDCON4_WLH(x) ((x) << 0)
@@ -113,10 +115,38 @@
113#define S3C2410_LCDINT_FRSYNC (1<<1) 115#define S3C2410_LCDINT_FRSYNC (1<<1)
114#define S3C2410_LCDINT_FICNT (1<<0) 116#define S3C2410_LCDINT_FICNT (1<<0)
115 117
118/* s3c2442 extra stn registers */
119
120#define S3C2442_REDLUT S3C2410_LCDREG(0x20)
121#define S3C2442_GREENLUT S3C2410_LCDREG(0x24)
122#define S3C2442_BLUELUT S3C2410_LCDREG(0x28)
123#define S3C2442_DITHMODE S3C2410_LCDREG(0x20)
124
116#define S3C2410_LPCSEL S3C2410_LCDREG(0x60) 125#define S3C2410_LPCSEL S3C2410_LCDREG(0x60)
117 126
118#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) 127#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4))
119 128
129/* S3C2412 registers */
130
131#define S3C2412_TPAL S3C2410_LCDREG(0x20)
132
133#define S3C2412_LCDINTPND S3C2410_LCDREG(0x24)
134#define S3C2412_LCDSRCPND S3C2410_LCDREG(0x28)
135#define S3C2412_LCDINTMSK S3C2410_LCDREG(0x2C)
136
137#define S3C2412_TCONSEL S3C2410_LCDREG(0x30)
138
139#define S3C2412_LCDCON6 S3C2410_LCDREG(0x34)
140#define S3C2412_LCDCON7 S3C2410_LCDREG(0x38)
141#define S3C2412_LCDCON8 S3C2410_LCDREG(0x3C)
142#define S3C2412_LCDCON9 S3C2410_LCDREG(0x40)
143
144#define S3C2412_REDLUT(x) S3C2410_LCDREG(0x44 + ((x)*4))
145#define S3C2412_GREENLUT(x) S3C2410_LCDREG(0x60 + ((x)*4))
146#define S3C2412_BLUELUT(x) S3C2410_LCDREG(0x98 + ((x)*4))
147
148#define S3C2412_FRCPAT(x) S3C2410_LCDREG(0xB4 + ((x)*4))
149
120#endif /* ___ASM_ARCH_REGS_LCD_H */ 150#endif /* ___ASM_ARCH_REGS_LCD_H */
121 151
122 152
diff --git a/include/asm-arm/arch-s3c2410/regs-rtc.h b/include/asm-arm/arch-s3c2410/regs-rtc.h
index cd88fd634d12..93b03c49710a 100644
--- a/include/asm-arm/arch-s3c2410/regs-rtc.h
+++ b/include/asm-arm/arch-s3c2410/regs-rtc.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-rtc.h 1/* linux/include/asm-arm/arch-s3c2410/regs-rtc.h
2 * 2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-sdi.h b/include/asm-arm/arch-s3c2410/regs-sdi.h
index 06e716e5b46d..bb9d30b72952 100644
--- a/include/asm-arm/arch-s3c2410/regs-sdi.h
+++ b/include/asm-arm/arch-s3c2410/regs-sdi.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-sdi.h 1/* linux/include/asm-arm/arch-s3c2410/regs-sdi.h
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-timer.h b/include/asm-arm/arch-s3c2410/regs-timer.h
index 731918e77831..6f8fe432fe3a 100644
--- a/include/asm-arm/arch-s3c2410/regs-timer.h
+++ b/include/asm-arm/arch-s3c2410/regs-timer.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-timer.h 1/* linux/include/asm-arm/arch-s3c2410/regs-timer.h
2 * 2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/asm-arm/arch-s3c2410/regs-udc.h b/include/asm-arm/arch-s3c2410/regs-udc.h
index 3aa31a27da1a..487861d5b49a 100644
--- a/include/asm-arm/arch-s3c2410/regs-udc.h
+++ b/include/asm-arm/arch-s3c2410/regs-udc.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs-udc.h 1/* linux/include/asm-arm/arch-s3c2410/regs-udc.h
2 * 2 *
3 * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at> 3 * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
4 * 4 *
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h
index 258c00bca270..c1e4db7c9710 100644
--- a/include/asm-arm/arch-s3c2410/spi-gpio.h
+++ b/include/asm-arm/arch-s3c2410/spi-gpio.h
@@ -1,4 +1,4 @@
1/* linux/include/asm-arm/arch-s3c2410/spi.h 1/* linux/include/asm-arm/arch-s3c2410/spi-gpio.h
2 * 2 *
3 * Copyright (c) 2006 Simtec Electronics 3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
diff --git a/include/asm-arm/arch-sa1100/neponset.h b/include/asm-arm/arch-sa1100/neponset.h
index 8051fd73a80b..09ec9e2bd182 100644
--- a/include/asm-arm/arch-sa1100/neponset.h
+++ b/include/asm-arm/arch-sa1100/neponset.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/arch-sa1100/assabet.h 2 * linux/include/asm-arm/arch-sa1100/neponset.h
3 * 3 *
4 * Created 2000/06/05 by Nicolas Pitre <nico@cam.org> 4 * Created 2000/06/05 by Nicolas Pitre <nico@cam.org>
5 * 5 *
diff --git a/include/asm-arm/arch-sa1100/uncompress.h b/include/asm-arm/arch-sa1100/uncompress.h
index 2601a77a6dda..17e64d232e7d 100644
--- a/include/asm-arm/arch-sa1100/uncompress.h
+++ b/include/asm-arm/arch-sa1100/uncompress.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/arch-brutus/uncompress.h 2 * linux/include/asm-arm/arch-sa1100/uncompress.h
3 * 3 *
4 * (C) 1999 Nicolas Pitre <nico@cam.org> 4 * (C) 1999 Nicolas Pitre <nico@cam.org>
5 * 5 *
diff --git a/include/asm-arm/arch-shark/vmalloc.h b/include/asm-arm/arch-shark/vmalloc.h
index 10db5d188231..fac37c636b38 100644
--- a/include/asm-arm/arch-shark/vmalloc.h
+++ b/include/asm-arm/arch-shark/vmalloc.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * linux/include/asm-arm/arch-rpc/vmalloc.h 2 * linux/include/asm-arm/arch-shark/vmalloc.h
3 */ 3 */
4#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 4#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index 4b0ce3e7de9a..ea88aa6bfc78 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -128,10 +128,10 @@ static inline int atomic_add_return(int i, atomic_t *v)
128 unsigned long flags; 128 unsigned long flags;
129 int val; 129 int val;
130 130
131 local_irq_save(flags); 131 raw_local_irq_save(flags);
132 val = v->counter; 132 val = v->counter;
133 v->counter = val += i; 133 v->counter = val += i;
134 local_irq_restore(flags); 134 raw_local_irq_restore(flags);
135 135
136 return val; 136 return val;
137} 137}
@@ -141,10 +141,10 @@ static inline int atomic_sub_return(int i, atomic_t *v)
141 unsigned long flags; 141 unsigned long flags;
142 int val; 142 int val;
143 143
144 local_irq_save(flags); 144 raw_local_irq_save(flags);
145 val = v->counter; 145 val = v->counter;
146 v->counter = val -= i; 146 v->counter = val -= i;
147 local_irq_restore(flags); 147 raw_local_irq_restore(flags);
148 148
149 return val; 149 return val;
150} 150}
@@ -154,11 +154,11 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
154 int ret; 154 int ret;
155 unsigned long flags; 155 unsigned long flags;
156 156
157 local_irq_save(flags); 157 raw_local_irq_save(flags);
158 ret = v->counter; 158 ret = v->counter;
159 if (likely(ret == old)) 159 if (likely(ret == old))
160 v->counter = new; 160 v->counter = new;
161 local_irq_restore(flags); 161 raw_local_irq_restore(flags);
162 162
163 return ret; 163 return ret;
164} 164}
@@ -167,9 +167,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
167{ 167{
168 unsigned long flags; 168 unsigned long flags;
169 169
170 local_irq_save(flags); 170 raw_local_irq_save(flags);
171 *addr &= ~mask; 171 *addr &= ~mask;
172 local_irq_restore(flags); 172 raw_local_irq_restore(flags);
173} 173}
174 174
175#endif /* __LINUX_ARM_ARCH__ */ 175#endif /* __LINUX_ARM_ARCH__ */
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index 0ac54b1a8bad..b41831b6432f 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -37,9 +37,9 @@ static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *
37 37
38 p += bit >> 5; 38 p += bit >> 5;
39 39
40 local_irq_save(flags); 40 raw_local_irq_save(flags);
41 *p |= mask; 41 *p |= mask;
42 local_irq_restore(flags); 42 raw_local_irq_restore(flags);
43} 43}
44 44
45static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p) 45static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
@@ -49,9 +49,9 @@ static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long
49 49
50 p += bit >> 5; 50 p += bit >> 5;
51 51
52 local_irq_save(flags); 52 raw_local_irq_save(flags);
53 *p &= ~mask; 53 *p &= ~mask;
54 local_irq_restore(flags); 54 raw_local_irq_restore(flags);
55} 55}
56 56
57static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p) 57static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
@@ -61,9 +61,9 @@ static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned lon
61 61
62 p += bit >> 5; 62 p += bit >> 5;
63 63
64 local_irq_save(flags); 64 raw_local_irq_save(flags);
65 *p ^= mask; 65 *p ^= mask;
66 local_irq_restore(flags); 66 raw_local_irq_restore(flags);
67} 67}
68 68
69static inline int 69static inline int
@@ -75,10 +75,10 @@ ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
75 75
76 p += bit >> 5; 76 p += bit >> 5;
77 77
78 local_irq_save(flags); 78 raw_local_irq_save(flags);
79 res = *p; 79 res = *p;
80 *p = res | mask; 80 *p = res | mask;
81 local_irq_restore(flags); 81 raw_local_irq_restore(flags);
82 82
83 return res & mask; 83 return res & mask;
84} 84}
@@ -92,10 +92,10 @@ ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
92 92
93 p += bit >> 5; 93 p += bit >> 5;
94 94
95 local_irq_save(flags); 95 raw_local_irq_save(flags);
96 res = *p; 96 res = *p;
97 *p = res & ~mask; 97 *p = res & ~mask;
98 local_irq_restore(flags); 98 raw_local_irq_restore(flags);
99 99
100 return res & mask; 100 return res & mask;
101} 101}
@@ -109,10 +109,10 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
109 109
110 p += bit >> 5; 110 p += bit >> 5;
111 111
112 local_irq_save(flags); 112 raw_local_irq_save(flags);
113 res = *p; 113 res = *p;
114 *p = res ^ mask; 114 *p = res ^ mask;
115 local_irq_restore(flags); 115 raw_local_irq_restore(flags);
116 116
117 return res & mask; 117 return res & mask;
118} 118}
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index e4a2569c636c..f0845646aacb 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -25,7 +25,7 @@
25#undef _CACHE 25#undef _CACHE
26#undef MULTI_CACHE 26#undef MULTI_CACHE
27 27
28#if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710) 28#if defined(CONFIG_CPU_CACHE_V3)
29# ifdef _CACHE 29# ifdef _CACHE
30# define MULTI_CACHE 1 30# define MULTI_CACHE 1
31# else 31# else
@@ -33,7 +33,7 @@
33# endif 33# endif
34#endif 34#endif
35 35
36#if defined(CONFIG_CPU_ARM720T) 36#if defined(CONFIG_CPU_CACHE_V4)
37# ifdef _CACHE 37# ifdef _CACHE
38# define MULTI_CACHE 1 38# define MULTI_CACHE 1
39# else 39# else
@@ -54,7 +54,23 @@
54# endif 54# endif
55#endif 55#endif
56 56
57#if defined(CONFIG_CPU_SA110) || defined(CONFIG_CPU_SA1100) 57#if defined(CONFIG_CPU_ARM940T)
58# ifdef _CACHE
59# define MULTI_CACHE 1
60# else
61# define _CACHE arm940
62# endif
63#endif
64
65#if defined(CONFIG_CPU_ARM946E)
66# ifdef _CACHE
67# define MULTI_CACHE 1
68# else
69# define _CACHE arm946
70# endif
71#endif
72
73#if defined(CONFIG_CPU_CACHE_V4WB)
58# ifdef _CACHE 74# ifdef _CACHE
59# define MULTI_CACHE 1 75# define MULTI_CACHE 1
60# else 76# else
diff --git a/include/asm-arm/flat.h b/include/asm-arm/flat.h
new file mode 100644
index 000000000000..966946478589
--- /dev/null
+++ b/include/asm-arm/flat.h
@@ -0,0 +1,16 @@
1/*
2 * include/asm-arm/flat.h -- uClinux flat-format executables
3 */
4
5#ifndef __ARM_FLAT_H__
6#define __ARM_FLAT_H__
7
8#define flat_stack_align(sp) /* nothing needed */
9#define flat_argvp_envp_on_stack() 1
10#define flat_old_ram_flag(flags) (flags)
11#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
12#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp)
13#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
14#define flat_get_relocate_addr(rel) (rel)
15
16#endif /* __ARM_FLAT_H__ */
diff --git a/include/asm-arm/hardware/debug-8250.S b/include/asm-arm/hardware/debug-8250.S
index 4594fea91ec1..07c97fb233fc 100644
--- a/include/asm-arm/hardware/debug-8250.S
+++ b/include/asm-arm/hardware/debug-8250.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/hardware/debug-8250.h 2 * linux/include/asm-arm/hardware/debug-8250.S
3 * 3 *
4 * Copyright (C) 1994-1999 Russell King 4 * Copyright (C) 1994-1999 Russell King
5 * 5 *
diff --git a/include/asm-arm/hardware/debug-pl01x.S b/include/asm-arm/hardware/debug-pl01x.S
index db0d0f7de5e9..23c541a9e89a 100644
--- a/include/asm-arm/hardware/debug-pl01x.S
+++ b/include/asm-arm/hardware/debug-pl01x.S
@@ -1,4 +1,4 @@
1/* linux/include/asm-arm/arch-integrator/debug-macro.S 1/* linux/include/asm-arm/hardware/debug-pl01x.S
2 * 2 *
3 * Debugging macro include header 3 * Debugging macro include header
4 * 4 *
diff --git a/include/asm-arm/hardware/entry-macro-iomd.S b/include/asm-arm/hardware/entry-macro-iomd.S
index 30c7b92c2416..fbed08f298d0 100644
--- a/include/asm-arm/hardware/entry-macro-iomd.S
+++ b/include/asm-arm/hardware/entry-macro-iomd.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/commond/entry-macro-iomd.S 2 * include/asm-arm/hardware/entry-macro-iomd.S
3 * 3 *
4 * Low-level IRQ helper macros for IOC/IOMD based platforms 4 * Low-level IRQ helper macros for IOC/IOMD based platforms
5 * 5 *
diff --git a/include/asm-arm/hardware/iop3xx.h b/include/asm-arm/hardware/iop3xx.h
new file mode 100644
index 000000000000..1018a7486ab7
--- /dev/null
+++ b/include/asm-arm/hardware/iop3xx.h
@@ -0,0 +1,301 @@
1/*
2 * include/asm-arm/hardware/iop3xx.h
3 *
4 * Intel IOP32X and IOP33X register definitions
5 *
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright (C) 2004 Intel Corp.
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 __IOP3XX_H
16#define __IOP3XX_H
17
18/*
19 * IOP3XX GPIO handling
20 */
21#define GPIO_IN 0
22#define GPIO_OUT 1
23#define GPIO_LOW 0
24#define GPIO_HIGH 1
25#define IOP3XX_GPIO_LINE(x) (x)
26
27#ifndef __ASSEMBLY__
28extern void gpio_line_config(int line, int direction);
29extern int gpio_line_get(int line);
30extern void gpio_line_set(int line, int value);
31#endif
32
33
34/*
35 * IOP3XX processor registers
36 */
37#define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000
38#define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000
39#define IOP3XX_PERIPHERAL_SIZE 0x00002000
40#define IOP3XX_REG_ADDR(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + (reg))
41
42/* Address Translation Unit */
43#define IOP3XX_ATUVID (volatile u16 *)IOP3XX_REG_ADDR(0x0100)
44#define IOP3XX_ATUDID (volatile u16 *)IOP3XX_REG_ADDR(0x0102)
45#define IOP3XX_ATUCMD (volatile u16 *)IOP3XX_REG_ADDR(0x0104)
46#define IOP3XX_ATUSR (volatile u16 *)IOP3XX_REG_ADDR(0x0106)
47#define IOP3XX_ATURID (volatile u8 *)IOP3XX_REG_ADDR(0x0108)
48#define IOP3XX_ATUCCR (volatile u32 *)IOP3XX_REG_ADDR(0x0109)
49#define IOP3XX_ATUCLSR (volatile u8 *)IOP3XX_REG_ADDR(0x010c)
50#define IOP3XX_ATULT (volatile u8 *)IOP3XX_REG_ADDR(0x010d)
51#define IOP3XX_ATUHTR (volatile u8 *)IOP3XX_REG_ADDR(0x010e)
52#define IOP3XX_ATUBIST (volatile u8 *)IOP3XX_REG_ADDR(0x010f)
53#define IOP3XX_IABAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0110)
54#define IOP3XX_IAUBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0114)
55#define IOP3XX_IABAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0118)
56#define IOP3XX_IAUBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x011c)
57#define IOP3XX_IABAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0120)
58#define IOP3XX_IAUBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0124)
59#define IOP3XX_ASVIR (volatile u16 *)IOP3XX_REG_ADDR(0x012c)
60#define IOP3XX_ASIR (volatile u16 *)IOP3XX_REG_ADDR(0x012e)
61#define IOP3XX_ERBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0130)
62#define IOP3XX_ATUILR (volatile u8 *)IOP3XX_REG_ADDR(0x013c)
63#define IOP3XX_ATUIPR (volatile u8 *)IOP3XX_REG_ADDR(0x013d)
64#define IOP3XX_ATUMGNT (volatile u8 *)IOP3XX_REG_ADDR(0x013e)
65#define IOP3XX_ATUMLAT (volatile u8 *)IOP3XX_REG_ADDR(0x013f)
66#define IOP3XX_IALR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0140)
67#define IOP3XX_IATVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0144)
68#define IOP3XX_ERLR (volatile u32 *)IOP3XX_REG_ADDR(0x0148)
69#define IOP3XX_ERTVR (volatile u32 *)IOP3XX_REG_ADDR(0x014c)
70#define IOP3XX_IALR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0150)
71#define IOP3XX_IALR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0154)
72#define IOP3XX_IATVR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0158)
73#define IOP3XX_OIOWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x015c)
74#define IOP3XX_OMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0160)
75#define IOP3XX_OUMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0164)
76#define IOP3XX_OMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0168)
77#define IOP3XX_OUMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x016c)
78#define IOP3XX_OUDWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x0178)
79#define IOP3XX_ATUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0180)
80#define IOP3XX_PCSR (volatile u32 *)IOP3XX_REG_ADDR(0x0184)
81#define IOP3XX_ATUISR (volatile u32 *)IOP3XX_REG_ADDR(0x0188)
82#define IOP3XX_ATUIMR (volatile u32 *)IOP3XX_REG_ADDR(0x018c)
83#define IOP3XX_IABAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0190)
84#define IOP3XX_IAUBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0194)
85#define IOP3XX_IALR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0198)
86#define IOP3XX_IATVR3 (volatile u32 *)IOP3XX_REG_ADDR(0x019c)
87#define IOP3XX_OCCAR (volatile u32 *)IOP3XX_REG_ADDR(0x01a4)
88#define IOP3XX_OCCDR (volatile u32 *)IOP3XX_REG_ADDR(0x01ac)
89#define IOP3XX_PDSCR (volatile u32 *)IOP3XX_REG_ADDR(0x01bc)
90#define IOP3XX_PMCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01c0)
91#define IOP3XX_PMNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01c1)
92#define IOP3XX_APMCR (volatile u16 *)IOP3XX_REG_ADDR(0x01c2)
93#define IOP3XX_APMCSR (volatile u16 *)IOP3XX_REG_ADDR(0x01c4)
94#define IOP3XX_PCIXCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01e0)
95#define IOP3XX_PCIXNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01e1)
96#define IOP3XX_PCIXCMD (volatile u16 *)IOP3XX_REG_ADDR(0x01e2)
97#define IOP3XX_PCIXSR (volatile u32 *)IOP3XX_REG_ADDR(0x01e4)
98#define IOP3XX_PCIIRSR (volatile u32 *)IOP3XX_REG_ADDR(0x01ec)
99
100/* Messaging Unit */
101#define IOP3XX_IMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0310)
102#define IOP3XX_IMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0314)
103#define IOP3XX_OMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0318)
104#define IOP3XX_OMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x031c)
105#define IOP3XX_IDR (volatile u32 *)IOP3XX_REG_ADDR(0x0320)
106#define IOP3XX_IISR (volatile u32 *)IOP3XX_REG_ADDR(0x0324)
107#define IOP3XX_IIMR (volatile u32 *)IOP3XX_REG_ADDR(0x0328)
108#define IOP3XX_ODR (volatile u32 *)IOP3XX_REG_ADDR(0x032c)
109#define IOP3XX_OISR (volatile u32 *)IOP3XX_REG_ADDR(0x0330)
110#define IOP3XX_OIMR (volatile u32 *)IOP3XX_REG_ADDR(0x0334)
111#define IOP3XX_MUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0350)
112#define IOP3XX_QBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0354)
113#define IOP3XX_IFHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0360)
114#define IOP3XX_IFTPR (volatile u32 *)IOP3XX_REG_ADDR(0x0364)
115#define IOP3XX_IPHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0368)
116#define IOP3XX_IPTPR (volatile u32 *)IOP3XX_REG_ADDR(0x036c)
117#define IOP3XX_OFHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0370)
118#define IOP3XX_OFTPR (volatile u32 *)IOP3XX_REG_ADDR(0x0374)
119#define IOP3XX_OPHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0378)
120#define IOP3XX_OPTPR (volatile u32 *)IOP3XX_REG_ADDR(0x037c)
121#define IOP3XX_IAR (volatile u32 *)IOP3XX_REG_ADDR(0x0380)
122
123/* DMA Controller */
124#define IOP3XX_DMA0_CCR (volatile u32 *)IOP3XX_REG_ADDR(0x0400)
125#define IOP3XX_DMA0_CSR (volatile u32 *)IOP3XX_REG_ADDR(0x0404)
126#define IOP3XX_DMA0_DAR (volatile u32 *)IOP3XX_REG_ADDR(0x040c)
127#define IOP3XX_DMA0_NDAR (volatile u32 *)IOP3XX_REG_ADDR(0x0410)
128#define IOP3XX_DMA0_PADR (volatile u32 *)IOP3XX_REG_ADDR(0x0414)
129#define IOP3XX_DMA0_PUADR (volatile u32 *)IOP3XX_REG_ADDR(0x0418)
130#define IOP3XX_DMA0_LADR (volatile u32 *)IOP3XX_REG_ADDR(0x041c)
131#define IOP3XX_DMA0_BCR (volatile u32 *)IOP3XX_REG_ADDR(0x0420)
132#define IOP3XX_DMA0_DCR (volatile u32 *)IOP3XX_REG_ADDR(0x0424)
133#define IOP3XX_DMA1_CCR (volatile u32 *)IOP3XX_REG_ADDR(0x0440)
134#define IOP3XX_DMA1_CSR (volatile u32 *)IOP3XX_REG_ADDR(0x0444)
135#define IOP3XX_DMA1_DAR (volatile u32 *)IOP3XX_REG_ADDR(0x044c)
136#define IOP3XX_DMA1_NDAR (volatile u32 *)IOP3XX_REG_ADDR(0x0450)
137#define IOP3XX_DMA1_PADR (volatile u32 *)IOP3XX_REG_ADDR(0x0454)
138#define IOP3XX_DMA1_PUADR (volatile u32 *)IOP3XX_REG_ADDR(0x0458)
139#define IOP3XX_DMA1_LADR (volatile u32 *)IOP3XX_REG_ADDR(0x045c)
140#define IOP3XX_DMA1_BCR (volatile u32 *)IOP3XX_REG_ADDR(0x0460)
141#define IOP3XX_DMA1_DCR (volatile u32 *)IOP3XX_REG_ADDR(0x0464)
142
143/* Peripheral bus interface */
144#define IOP3XX_PBCR (volatile u32 *)IOP3XX_REG_ADDR(0x0680)
145#define IOP3XX_PBISR (volatile u32 *)IOP3XX_REG_ADDR(0x0684)
146#define IOP3XX_PBBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0688)
147#define IOP3XX_PBLR0 (volatile u32 *)IOP3XX_REG_ADDR(0x068c)
148#define IOP3XX_PBBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0690)
149#define IOP3XX_PBLR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0694)
150#define IOP3XX_PBBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0698)
151#define IOP3XX_PBLR2 (volatile u32 *)IOP3XX_REG_ADDR(0x069c)
152#define IOP3XX_PBBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x06a0)
153#define IOP3XX_PBLR3 (volatile u32 *)IOP3XX_REG_ADDR(0x06a4)
154#define IOP3XX_PBBAR4 (volatile u32 *)IOP3XX_REG_ADDR(0x06a8)
155#define IOP3XX_PBLR4 (volatile u32 *)IOP3XX_REG_ADDR(0x06ac)
156#define IOP3XX_PBBAR5 (volatile u32 *)IOP3XX_REG_ADDR(0x06b0)
157#define IOP3XX_PBLR5 (volatile u32 *)IOP3XX_REG_ADDR(0x06b4)
158#define IOP3XX_PMBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x06c0)
159#define IOP3XX_PMBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x06e0)
160#define IOP3XX_PMBR2 (volatile u32 *)IOP3XX_REG_ADDR(0x06e4)
161
162/* Peripheral performance monitoring unit */
163#define IOP3XX_GTMR (volatile u32 *)IOP3XX_REG_ADDR(0x0700)
164#define IOP3XX_ESR (volatile u32 *)IOP3XX_REG_ADDR(0x0704)
165#define IOP3XX_EMISR (volatile u32 *)IOP3XX_REG_ADDR(0x0708)
166#define IOP3XX_GTSR (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
167/* PERCR0 DOESN'T EXIST - index from 1! */
168#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
169
170/* General Purpose I/O */
171#define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
172#define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
173#define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x000c)
174
175/* Timers */
176#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
177#define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004)
178#define IOP3XX_TU_TCR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0008)
179#define IOP3XX_TU_TCR1 (volatile u32 *)IOP3XX_TIMER_REG(0x000c)
180#define IOP3XX_TU_TRR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0010)
181#define IOP3XX_TU_TRR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0014)
182#define IOP3XX_TU_TISR (volatile u32 *)IOP3XX_TIMER_REG(0x0018)
183#define IOP3XX_TU_WDTCR (volatile u32 *)IOP3XX_TIMER_REG(0x001c)
184#define IOP3XX_TMR_TC 0x01
185#define IOP3XX_TMR_EN 0x02
186#define IOP3XX_TMR_RELOAD 0x04
187#define IOP3XX_TMR_PRIVILEGED 0x09
188#define IOP3XX_TMR_RATIO_1_1 0x00
189#define IOP3XX_TMR_RATIO_4_1 0x10
190#define IOP3XX_TMR_RATIO_8_1 0x20
191#define IOP3XX_TMR_RATIO_16_1 0x30
192
193/* Application accelerator unit */
194#define IOP3XX_AAU_ACR (volatile u32 *)IOP3XX_REG_ADDR(0x0800)
195#define IOP3XX_AAU_ASR (volatile u32 *)IOP3XX_REG_ADDR(0x0804)
196#define IOP3XX_AAU_ADAR (volatile u32 *)IOP3XX_REG_ADDR(0x0808)
197#define IOP3XX_AAU_ANDAR (volatile u32 *)IOP3XX_REG_ADDR(0x080c)
198#define IOP3XX_AAU_SAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0810)
199#define IOP3XX_AAU_SAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0814)
200#define IOP3XX_AAU_SAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0818)
201#define IOP3XX_AAU_SAR4 (volatile u32 *)IOP3XX_REG_ADDR(0x081c)
202#define IOP3XX_AAU_DAR (volatile u32 *)IOP3XX_REG_ADDR(0x0820)
203#define IOP3XX_AAU_ABCR (volatile u32 *)IOP3XX_REG_ADDR(0x0824)
204#define IOP3XX_AAU_ADCR (volatile u32 *)IOP3XX_REG_ADDR(0x0828)
205#define IOP3XX_AAU_SAR5 (volatile u32 *)IOP3XX_REG_ADDR(0x082c)
206#define IOP3XX_AAU_SAR6 (volatile u32 *)IOP3XX_REG_ADDR(0x0830)
207#define IOP3XX_AAU_SAR7 (volatile u32 *)IOP3XX_REG_ADDR(0x0834)
208#define IOP3XX_AAU_SAR8 (volatile u32 *)IOP3XX_REG_ADDR(0x0838)
209#define IOP3XX_AAU_EDCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x083c)
210#define IOP3XX_AAU_SAR9 (volatile u32 *)IOP3XX_REG_ADDR(0x0840)
211#define IOP3XX_AAU_SAR10 (volatile u32 *)IOP3XX_REG_ADDR(0x0844)
212#define IOP3XX_AAU_SAR11 (volatile u32 *)IOP3XX_REG_ADDR(0x0848)
213#define IOP3XX_AAU_SAR12 (volatile u32 *)IOP3XX_REG_ADDR(0x084c)
214#define IOP3XX_AAU_SAR13 (volatile u32 *)IOP3XX_REG_ADDR(0x0850)
215#define IOP3XX_AAU_SAR14 (volatile u32 *)IOP3XX_REG_ADDR(0x0854)
216#define IOP3XX_AAU_SAR15 (volatile u32 *)IOP3XX_REG_ADDR(0x0858)
217#define IOP3XX_AAU_SAR16 (volatile u32 *)IOP3XX_REG_ADDR(0x085c)
218#define IOP3XX_AAU_EDCR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0860)
219#define IOP3XX_AAU_SAR17 (volatile u32 *)IOP3XX_REG_ADDR(0x0864)
220#define IOP3XX_AAU_SAR18 (volatile u32 *)IOP3XX_REG_ADDR(0x0868)
221#define IOP3XX_AAU_SAR19 (volatile u32 *)IOP3XX_REG_ADDR(0x086c)
222#define IOP3XX_AAU_SAR20 (volatile u32 *)IOP3XX_REG_ADDR(0x0870)
223#define IOP3XX_AAU_SAR21 (volatile u32 *)IOP3XX_REG_ADDR(0x0874)
224#define IOP3XX_AAU_SAR22 (volatile u32 *)IOP3XX_REG_ADDR(0x0878)
225#define IOP3XX_AAU_SAR23 (volatile u32 *)IOP3XX_REG_ADDR(0x087c)
226#define IOP3XX_AAU_SAR24 (volatile u32 *)IOP3XX_REG_ADDR(0x0880)
227#define IOP3XX_AAU_EDCR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0884)
228#define IOP3XX_AAU_SAR25 (volatile u32 *)IOP3XX_REG_ADDR(0x0888)
229#define IOP3XX_AAU_SAR26 (volatile u32 *)IOP3XX_REG_ADDR(0x088c)
230#define IOP3XX_AAU_SAR27 (volatile u32 *)IOP3XX_REG_ADDR(0x0890)
231#define IOP3XX_AAU_SAR28 (volatile u32 *)IOP3XX_REG_ADDR(0x0894)
232#define IOP3XX_AAU_SAR29 (volatile u32 *)IOP3XX_REG_ADDR(0x0898)
233#define IOP3XX_AAU_SAR30 (volatile u32 *)IOP3XX_REG_ADDR(0x089c)
234#define IOP3XX_AAU_SAR31 (volatile u32 *)IOP3XX_REG_ADDR(0x08a0)
235#define IOP3XX_AAU_SAR32 (volatile u32 *)IOP3XX_REG_ADDR(0x08a4)
236
237/* I2C bus interface unit */
238#define IOP3XX_ICR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1680)
239#define IOP3XX_ISR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1684)
240#define IOP3XX_ISAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1688)
241#define IOP3XX_IDBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x168c)
242#define IOP3XX_IBMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1694)
243#define IOP3XX_ICR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a0)
244#define IOP3XX_ISR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a4)
245#define IOP3XX_ISAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a8)
246#define IOP3XX_IDBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16ac)
247#define IOP3XX_IBMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16b4)
248
249
250/*
251 * IOP3XX I/O and Mem space regions for PCI autoconfiguration
252 */
253#define IOP3XX_PCI_MEM_WINDOW_SIZE 0x04000000
254#define IOP3XX_PCI_LOWER_MEM_PA 0x80000000
255#define IOP3XX_PCI_LOWER_MEM_BA (*IOP3XX_OMWTVR0)
256
257#define IOP3XX_PCI_IO_WINDOW_SIZE 0x00010000
258#define IOP3XX_PCI_LOWER_IO_PA 0x90000000
259#define IOP3XX_PCI_LOWER_IO_VA 0xfe000000
260#define IOP3XX_PCI_LOWER_IO_BA (*IOP3XX_OIOWTVR)
261
262
263#ifndef __ASSEMBLY__
264void iop3xx_map_io(void);
265void iop3xx_init_time(unsigned long);
266unsigned long iop3xx_gettimeoffset(void);
267
268extern struct platform_device iop3xx_i2c0_device;
269extern struct platform_device iop3xx_i2c1_device;
270
271extern inline void iop3xx_cp6_enable(void)
272{
273 u32 temp;
274
275 asm volatile (
276 "mrc p15, 0, %0, c15, c1, 0\n\t"
277 "orr %0, %0, #(1 << 6)\n\t"
278 "mcr p15, 0, %0, c15, c1, 0\n\t"
279 "mrc p15, 0, %0, c15, c1, 0\n\t"
280 "mov %0, %0\n\t"
281 "sub pc, pc, #4\n\t"
282 : "=r" (temp) );
283}
284
285extern inline void iop3xx_cp6_disable(void)
286{
287 u32 temp;
288
289 asm volatile (
290 "mrc p15, 0, %0, c15, c1, 0\n\t"
291 "bic %0, %0, #(1 << 6)\n\t"
292 "mcr p15, 0, %0, c15, c1, 0\n\t"
293 "mrc p15, 0, %0, c15, c1, 0\n\t"
294 "mov %0, %0\n\t"
295 "sub pc, pc, #4\n\t"
296 : "=r" (temp) );
297}
298#endif
299
300
301#endif
diff --git a/include/asm-arm/hardware/locomo.h b/include/asm-arm/hardware/locomo.h
index 22dfb1737768..adab77780ed3 100644
--- a/include/asm-arm/hardware/locomo.h
+++ b/include/asm-arm/hardware/locomo.h
@@ -54,17 +54,18 @@
54#define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */ 54#define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */
55 55
56/* SPI interface */ 56/* SPI interface */
57#define LOCOMO_SPIMD 0x60 /* SPI mode setting */ 57#define LOCOMO_SPI 0x60
58#define LOCOMO_SPICT 0x64 /* SPI mode control */ 58#define LOCOMO_SPIMD 0x00 /* SPI mode setting */
59#define LOCOMO_SPIST 0x68 /* SPI status */ 59#define LOCOMO_SPICT 0x04 /* SPI mode control */
60#define LOCOMO_SPIIS 0x70 /* SPI interrupt status */ 60#define LOCOMO_SPIST 0x08 /* SPI status */
61#define LOCOMO_SPIWE 0x74 /* SPI interrupt status write enable */ 61#define LOCOMO_SPIIS 0x10 /* SPI interrupt status */
62#define LOCOMO_SPIIE 0x78 /* SPI interrupt enable */ 62#define LOCOMO_SPIWE 0x14 /* SPI interrupt status write enable */
63#define LOCOMO_SPIIR 0x7c /* SPI interrupt request */ 63#define LOCOMO_SPIIE 0x18 /* SPI interrupt enable */
64#define LOCOMO_SPITD 0x80 /* SPI transfer data write */ 64#define LOCOMO_SPIIR 0x1c /* SPI interrupt request */
65#define LOCOMO_SPIRD 0x84 /* SPI receive data read */ 65#define LOCOMO_SPITD 0x20 /* SPI transfer data write */
66#define LOCOMO_SPITS 0x88 /* SPI transfer data shift */ 66#define LOCOMO_SPIRD 0x24 /* SPI receive data read */
67#define LOCOMO_SPIRS 0x8C /* SPI receive data shift */ 67#define LOCOMO_SPITS 0x28 /* SPI transfer data shift */
68#define LOCOMO_SPIRS 0x2C /* SPI receive data shift */
68#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */ 69#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */
69#define LOCOMO_SPI_OVRN (1 << 2) /* Over Run bit */ 70#define LOCOMO_SPI_OVRN (1 << 2) /* Over Run bit */
70#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */ 71#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */
@@ -161,6 +162,7 @@ extern struct bus_type locomo_bus_type;
161#define LOCOMO_DEVID_AUDIO 3 162#define LOCOMO_DEVID_AUDIO 3
162#define LOCOMO_DEVID_LED 4 163#define LOCOMO_DEVID_LED 4
163#define LOCOMO_DEVID_UART 5 164#define LOCOMO_DEVID_UART 5
165#define LOCOMO_DEVID_SPI 6
164 166
165struct locomo_dev { 167struct locomo_dev {
166 struct device dev; 168 struct device dev;
@@ -197,10 +199,11 @@ int locomo_driver_register(struct locomo_driver *);
197void locomo_driver_unregister(struct locomo_driver *); 199void locomo_driver_unregister(struct locomo_driver *);
198 200
199/* GPIO control functions */ 201/* GPIO control functions */
200void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir); 202void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir);
201unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits); 203int locomo_gpio_read_level(struct device *dev, unsigned int bits);
202unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits); 204int locomo_gpio_read_output(struct device *dev, unsigned int bits);
203void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set); 205void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
206
204 207
205/* M62332 control function */ 208/* M62332 control function */
206void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel); 209void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
diff --git a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h
index 319aea064c36..6aa0a5b75b69 100644
--- a/include/asm-arm/hardware/sa1111.h
+++ b/include/asm-arm/hardware/sa1111.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/hardware/SA-1111.h 2 * linux/include/asm-arm/hardware/sa1111.h
3 * 3 *
4 * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu> 4 * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
5 * 5 *
diff --git a/include/asm-arm/hardware/sharpsl_pm.h b/include/asm-arm/hardware/sharpsl_pm.h
index ecf15b83956f..a836e76a14f7 100644
--- a/include/asm-arm/hardware/sharpsl_pm.h
+++ b/include/asm-arm/hardware/sharpsl_pm.h
@@ -25,6 +25,7 @@ struct sharpsl_charger_machinfo {
25 void (*measure_temp)(int); 25 void (*measure_temp)(int);
26 void (*presuspend)(void); 26 void (*presuspend)(void);
27 void (*postsuspend)(void); 27 void (*postsuspend)(void);
28 void (*earlyresume)(void);
28 unsigned long (*read_devdata)(int); 29 unsigned long (*read_devdata)(int);
29#define SHARPSL_BATT_VOLT 1 30#define SHARPSL_BATT_VOLT 1
30#define SHARPSL_BATT_TEMP 2 31#define SHARPSL_BATT_TEMP 2
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index bf7b9dea30f1..8076a85c3675 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -280,6 +280,10 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
280#define BIOVEC_MERGEABLE(vec1, vec2) \ 280#define BIOVEC_MERGEABLE(vec1, vec2) \
281 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) 281 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
282 282
283#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
284extern int valid_phys_addr_range(unsigned long addr, size_t size);
285extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
286
283/* 287/*
284 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 288 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
285 * access 289 * access
diff --git a/include/asm-arm/irqflags.h b/include/asm-arm/irqflags.h
new file mode 100644
index 000000000000..6d09974e6646
--- /dev/null
+++ b/include/asm-arm/irqflags.h
@@ -0,0 +1,132 @@
1#ifndef __ASM_ARM_IRQFLAGS_H
2#define __ASM_ARM_IRQFLAGS_H
3
4#ifdef __KERNEL__
5
6#include <asm/ptrace.h>
7
8/*
9 * CPU interrupt mask handling.
10 */
11#if __LINUX_ARM_ARCH__ >= 6
12
13#define raw_local_irq_save(x) \
14 ({ \
15 __asm__ __volatile__( \
16 "mrs %0, cpsr @ local_irq_save\n" \
17 "cpsid i" \
18 : "=r" (x) : : "memory", "cc"); \
19 })
20
21#define raw_local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc")
22#define raw_local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc")
23#define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
24#define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
25
26#else
27
28/*
29 * Save the current interrupt enable state & disable IRQs
30 */
31#define raw_local_irq_save(x) \
32 ({ \
33 unsigned long temp; \
34 (void) (&temp == &x); \
35 __asm__ __volatile__( \
36 "mrs %0, cpsr @ local_irq_save\n" \
37" orr %1, %0, #128\n" \
38" msr cpsr_c, %1" \
39 : "=r" (x), "=r" (temp) \
40 : \
41 : "memory", "cc"); \
42 })
43
44/*
45 * Enable IRQs
46 */
47#define raw_local_irq_enable() \
48 ({ \
49 unsigned long temp; \
50 __asm__ __volatile__( \
51 "mrs %0, cpsr @ local_irq_enable\n" \
52" bic %0, %0, #128\n" \
53" msr cpsr_c, %0" \
54 : "=r" (temp) \
55 : \
56 : "memory", "cc"); \
57 })
58
59/*
60 * Disable IRQs
61 */
62#define raw_local_irq_disable() \
63 ({ \
64 unsigned long temp; \
65 __asm__ __volatile__( \
66 "mrs %0, cpsr @ local_irq_disable\n" \
67" orr %0, %0, #128\n" \
68" msr cpsr_c, %0" \
69 : "=r" (temp) \
70 : \
71 : "memory", "cc"); \
72 })
73
74/*
75 * Enable FIQs
76 */
77#define local_fiq_enable() \
78 ({ \
79 unsigned long temp; \
80 __asm__ __volatile__( \
81 "mrs %0, cpsr @ stf\n" \
82" bic %0, %0, #64\n" \
83" msr cpsr_c, %0" \
84 : "=r" (temp) \
85 : \
86 : "memory", "cc"); \
87 })
88
89/*
90 * Disable FIQs
91 */
92#define local_fiq_disable() \
93 ({ \
94 unsigned long temp; \
95 __asm__ __volatile__( \
96 "mrs %0, cpsr @ clf\n" \
97" orr %0, %0, #64\n" \
98" msr cpsr_c, %0" \
99 : "=r" (temp) \
100 : \
101 : "memory", "cc"); \
102 })
103
104#endif
105
106/*
107 * Save the current interrupt enable state.
108 */
109#define raw_local_save_flags(x) \
110 ({ \
111 __asm__ __volatile__( \
112 "mrs %0, cpsr @ local_save_flags" \
113 : "=r" (x) : : "memory", "cc"); \
114 })
115
116/*
117 * restore saved IRQ & FIQ state
118 */
119#define raw_local_irq_restore(x) \
120 __asm__ __volatile__( \
121 "msr cpsr_c, %0 @ local_irq_restore\n" \
122 : \
123 : "r" (x) \
124 : "memory", "cc")
125
126#define raw_irqs_disabled_flags(flags) \
127({ \
128 (int)((flags) & PSR_I_BIT); \
129})
130
131#endif
132#endif
diff --git a/include/asm-arm/mach/pci.h b/include/asm-arm/mach/pci.h
index 923e0ca66200..24621c49a0c7 100644
--- a/include/asm-arm/mach/pci.h
+++ b/include/asm-arm/mach/pci.h
@@ -52,13 +52,9 @@ void pci_common_init(struct hw_pci *);
52/* 52/*
53 * PCI controllers 53 * PCI controllers
54 */ 54 */
55extern int iop321_setup(int nr, struct pci_sys_data *); 55extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
56extern struct pci_bus *iop321_scan_bus(int nr, struct pci_sys_data *); 56extern struct pci_bus *iop3xx_pci_scan_bus(int nr, struct pci_sys_data *);
57extern void iop321_init(void); 57extern void iop3xx_pci_preinit(void);
58
59extern int iop331_setup(int nr, struct pci_sys_data *);
60extern struct pci_bus *iop331_scan_bus(int nr, struct pci_sys_data *);
61extern void iop331_init(void);
62 58
63extern int dc21285_setup(int nr, struct pci_sys_data *); 59extern int dc21285_setup(int nr, struct pci_sys_data *);
64extern struct pci_bus *dc21285_scan_bus(int nr, struct pci_sys_data *); 60extern struct pci_bus *dc21285_scan_bus(int nr, struct pci_sys_data *);
diff --git a/include/asm-arm/mach/serial_at91.h b/include/asm-arm/mach/serial_at91.h
index 1290bb32802d..55b317a89061 100644
--- a/include/asm-arm/mach/serial_at91.h
+++ b/include/asm-arm/mach/serial_at91.h
@@ -14,7 +14,7 @@ struct uart_port;
14 * This is a temporary structure for registering these 14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot. 15 * functions; it is intended to be discarded after boot.
16 */ 16 */
17struct at91_port_fns { 17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int); 18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *); 19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *); 20 void (*enable_ms)(struct uart_port *);
@@ -24,10 +24,10 @@ struct at91_port_fns {
24 void (*close)(struct uart_port *); 24 void (*close)(struct uart_port *);
25}; 25};
26 26
27#if defined(CONFIG_SERIAL_AT91) 27#if defined(CONFIG_SERIAL_ATMEL)
28void at91_register_uart_fns(struct at91_port_fns *fns); 28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else 29#else
30#define at91_register_uart_fns(fns) do { } while (0) 30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif 31#endif
32 32
33 33
diff --git a/include/asm-arm/mach/time.h b/include/asm-arm/mach/time.h
index dee0bc336fe8..1eb93f5c0d6c 100644
--- a/include/asm-arm/mach/time.h
+++ b/include/asm-arm/mach/time.h
@@ -38,7 +38,9 @@ struct sys_timer {
38 void (*init)(void); 38 void (*init)(void);
39 void (*suspend)(void); 39 void (*suspend)(void);
40 void (*resume)(void); 40 void (*resume)(void);
41#ifndef CONFIG_GENERIC_TIME
41 unsigned long (*offset)(void); 42 unsigned long (*offset)(void);
43#endif
42 44
43#ifdef CONFIG_NO_IDLE_HZ 45#ifdef CONFIG_NO_IDLE_HZ
44 struct dyn_tick_timer *dyn_tick; 46 struct dyn_tick_timer *dyn_tick;
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 02bd3ee935b0..7e85db77d99b 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -174,9 +174,6 @@ typedef unsigned long pgprot_t;
174 174
175#endif /* STRICT_MM_TYPECHECKS */ 175#endif /* STRICT_MM_TYPECHECKS */
176 176
177/* the upper-most page table pointer */
178extern pmd_t *top_pmd;
179
180#endif /* CONFIG_MMU */ 177#endif /* CONFIG_MMU */
181 178
182#include <asm/memory.h> 179#include <asm/memory.h>
diff --git a/include/asm-arm/pgtable-nommu.h b/include/asm-arm/pgtable-nommu.h
index b13322dccf41..c1b264dff287 100644
--- a/include/asm-arm/pgtable-nommu.h
+++ b/include/asm-arm/pgtable-nommu.h
@@ -13,7 +13,6 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/config.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
18#include <asm/processor.h> 17#include <asm/processor.h>
19#include <asm/page.h> 18#include <asm/page.h>
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 4d10d319fa34..ed8cb5963e99 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -136,6 +136,13 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
136#define USER_PTRS_PER_PGD ((TASK_SIZE/PGDIR_SIZE) - FIRST_USER_PGD_NR) 136#define USER_PTRS_PER_PGD ((TASK_SIZE/PGDIR_SIZE) - FIRST_USER_PGD_NR)
137 137
138/* 138/*
139 * section address mask and size definitions.
140 */
141#define SECTION_SHIFT 20
142#define SECTION_SIZE (1UL << SECTION_SHIFT)
143#define SECTION_MASK (~(SECTION_SIZE-1))
144
145/*
139 * ARMv6 supersection address mask and size definitions. 146 * ARMv6 supersection address mask and size definitions.
140 */ 147 */
141#define SUPERSECTION_SHIFT 24 148#define SUPERSECTION_SHIFT 24
diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h
index 1bde92cdaebd..ea7e54c319be 100644
--- a/include/asm-arm/proc-fns.h
+++ b/include/asm-arm/proc-fns.h
@@ -33,6 +33,14 @@
33# define CPU_NAME cpu_arm6 33# define CPU_NAME cpu_arm6
34# endif 34# endif
35# endif 35# endif
36# ifdef CONFIG_CPU_ARM7TDMI
37# ifdef CPU_NAME
38# undef MULTI_CPU
39# define MULTI_CPU
40# else
41# define CPU_NAME cpu_arm7tdmi
42# endif
43# endif
36# ifdef CONFIG_CPU_ARM710 44# ifdef CONFIG_CPU_ARM710
37# ifdef CPU_NAME 45# ifdef CPU_NAME
38# undef MULTI_CPU 46# undef MULTI_CPU
@@ -49,6 +57,22 @@
49# define CPU_NAME cpu_arm720 57# define CPU_NAME cpu_arm720
50# endif 58# endif
51# endif 59# endif
60# ifdef CONFIG_CPU_ARM740T
61# ifdef CPU_NAME
62# undef MULTI_CPU
63# define MULTI_CPU
64# else
65# define CPU_NAME cpu_arm740
66# endif
67# endif
68# ifdef CONFIG_CPU_ARM9TDMI
69# ifdef CPU_NAME
70# undef MULTI_CPU
71# define MULTI_CPU
72# else
73# define CPU_NAME cpu_arm9tdmi
74# endif
75# endif
52# ifdef CONFIG_CPU_ARM920T 76# ifdef CONFIG_CPU_ARM920T
53# ifdef CPU_NAME 77# ifdef CPU_NAME
54# undef MULTI_CPU 78# undef MULTI_CPU
@@ -81,6 +105,22 @@
81# define CPU_NAME cpu_arm926 105# define CPU_NAME cpu_arm926
82# endif 106# endif
83# endif 107# endif
108# ifdef CONFIG_CPU_ARM940T
109# ifdef CPU_NAME
110# undef MULTI_CPU
111# define MULTI_CPU
112# else
113# define CPU_NAME cpu_arm940
114# endif
115# endif
116# ifdef CONFIG_CPU_ARM946E
117# ifdef CPU_NAME
118# undef MULTI_CPU
119# define MULTI_CPU
120# else
121# define CPU_NAME cpu_arm946
122# endif
123# endif
84# ifdef CONFIG_CPU_SA110 124# ifdef CONFIG_CPU_SA110
85# ifdef CPU_NAME 125# ifdef CPU_NAME
86# undef MULTI_CPU 126# undef MULTI_CPU
diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h
index ea3ed2465233..aa4b5782f0c9 100644
--- a/include/asm-arm/setup.h
+++ b/include/asm-arm/setup.h
@@ -194,13 +194,15 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }
194# define NR_BANKS 8 194# define NR_BANKS 8
195#endif 195#endif
196 196
197struct membank {
198 unsigned long start;
199 unsigned long size;
200 int node;
201};
202
197struct meminfo { 203struct meminfo {
198 int nr_banks; 204 int nr_banks;
199 struct { 205 struct membank bank[NR_BANKS];
200 unsigned long start;
201 unsigned long size;
202 int node;
203 } bank[NR_BANKS];
204}; 206};
205 207
206/* 208/*
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 01b7c26a3038..861092fbaa53 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -218,4 +218,8 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
218/* read_can_lock - would read_trylock() succeed? */ 218/* read_can_lock - would read_trylock() succeed? */
219#define __raw_read_can_lock(x) ((x)->lock < 0x80000000) 219#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)
220 220
221#define _raw_spin_relax(lock) cpu_relax()
222#define _raw_read_relax(lock) cpu_relax()
223#define _raw_write_relax(lock) cpu_relax()
224
221#endif /* __ASM_SPINLOCK_H */ 225#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 0947cbf9b69a..f05fbe31576c 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -46,6 +46,7 @@
46#define CPUID_TCM 2 46#define CPUID_TCM 2
47#define CPUID_TLBTYPE 3 47#define CPUID_TLBTYPE 3
48 48
49#ifdef CONFIG_CPU_CP15
49#define read_cpuid(reg) \ 50#define read_cpuid(reg) \
50 ({ \ 51 ({ \
51 unsigned int __val; \ 52 unsigned int __val; \
@@ -55,6 +56,9 @@
55 : "cc"); \ 56 : "cc"); \
56 __val; \ 57 __val; \
57 }) 58 })
59#else
60#define read_cpuid(reg) (processor_id)
61#endif
58 62
59/* 63/*
60 * This is used to ensure the compiler did actually allocate the register we 64 * This is used to ensure the compiler did actually allocate the register we
@@ -207,130 +211,7 @@ static inline void sched_cacheflush(void)
207{ 211{
208} 212}
209 213
210/* 214#include <linux/irqflags.h>
211 * CPU interrupt mask handling.
212 */
213#if __LINUX_ARM_ARCH__ >= 6
214
215#define local_irq_save(x) \
216 ({ \
217 __asm__ __volatile__( \
218 "mrs %0, cpsr @ local_irq_save\n" \
219 "cpsid i" \
220 : "=r" (x) : : "memory", "cc"); \
221 })
222
223#define local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc")
224#define local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc")
225#define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
226#define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
227
228#else
229
230/*
231 * Save the current interrupt enable state & disable IRQs
232 */
233#define local_irq_save(x) \
234 ({ \
235 unsigned long temp; \
236 (void) (&temp == &x); \
237 __asm__ __volatile__( \
238 "mrs %0, cpsr @ local_irq_save\n" \
239" orr %1, %0, #128\n" \
240" msr cpsr_c, %1" \
241 : "=r" (x), "=r" (temp) \
242 : \
243 : "memory", "cc"); \
244 })
245
246/*
247 * Enable IRQs
248 */
249#define local_irq_enable() \
250 ({ \
251 unsigned long temp; \
252 __asm__ __volatile__( \
253 "mrs %0, cpsr @ local_irq_enable\n" \
254" bic %0, %0, #128\n" \
255" msr cpsr_c, %0" \
256 : "=r" (temp) \
257 : \
258 : "memory", "cc"); \
259 })
260
261/*
262 * Disable IRQs
263 */
264#define local_irq_disable() \
265 ({ \
266 unsigned long temp; \
267 __asm__ __volatile__( \
268 "mrs %0, cpsr @ local_irq_disable\n" \
269" orr %0, %0, #128\n" \
270" msr cpsr_c, %0" \
271 : "=r" (temp) \
272 : \
273 : "memory", "cc"); \
274 })
275
276/*
277 * Enable FIQs
278 */
279#define local_fiq_enable() \
280 ({ \
281 unsigned long temp; \
282 __asm__ __volatile__( \
283 "mrs %0, cpsr @ stf\n" \
284" bic %0, %0, #64\n" \
285" msr cpsr_c, %0" \
286 : "=r" (temp) \
287 : \
288 : "memory", "cc"); \
289 })
290
291/*
292 * Disable FIQs
293 */
294#define local_fiq_disable() \
295 ({ \
296 unsigned long temp; \
297 __asm__ __volatile__( \
298 "mrs %0, cpsr @ clf\n" \
299" orr %0, %0, #64\n" \
300" msr cpsr_c, %0" \
301 : "=r" (temp) \
302 : \
303 : "memory", "cc"); \
304 })
305
306#endif
307
308/*
309 * Save the current interrupt enable state.
310 */
311#define local_save_flags(x) \
312 ({ \
313 __asm__ __volatile__( \
314 "mrs %0, cpsr @ local_save_flags" \
315 : "=r" (x) : : "memory", "cc"); \
316 })
317
318/*
319 * restore saved IRQ & FIQ state
320 */
321#define local_irq_restore(x) \
322 __asm__ __volatile__( \
323 "msr cpsr_c, %0 @ local_irq_restore\n" \
324 : \
325 : "r" (x) \
326 : "memory", "cc")
327
328#define irqs_disabled() \
329({ \
330 unsigned long flags; \
331 local_save_flags(flags); \
332 (int)(flags & PSR_I_BIT); \
333})
334 215
335#ifdef CONFIG_SMP 216#ifdef CONFIG_SMP
336 217
@@ -405,17 +286,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
405#error SMP is not supported on this platform 286#error SMP is not supported on this platform
406#endif 287#endif
407 case 1: 288 case 1:
408 local_irq_save(flags); 289 raw_local_irq_save(flags);
409 ret = *(volatile unsigned char *)ptr; 290 ret = *(volatile unsigned char *)ptr;
410 *(volatile unsigned char *)ptr = x; 291 *(volatile unsigned char *)ptr = x;
411 local_irq_restore(flags); 292 raw_local_irq_restore(flags);
412 break; 293 break;
413 294
414 case 4: 295 case 4:
415 local_irq_save(flags); 296 raw_local_irq_save(flags);
416 ret = *(volatile unsigned long *)ptr; 297 ret = *(volatile unsigned long *)ptr;
417 *(volatile unsigned long *)ptr = x; 298 *(volatile unsigned long *)ptr = x;
418 local_irq_restore(flags); 299 raw_local_irq_restore(flags);
419 break; 300 break;
420#else 301#else
421 case 1: 302 case 1:
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h
index d97fc76189a5..cd10a0b5f8ae 100644
--- a/include/asm-arm/tlbflush.h
+++ b/include/asm-arm/tlbflush.h
@@ -247,16 +247,16 @@ static inline void local_flush_tlb_all(void)
247 const unsigned int __tlb_flag = __cpu_tlb_flags; 247 const unsigned int __tlb_flag = __cpu_tlb_flags;
248 248
249 if (tlb_flag(TLB_WB)) 249 if (tlb_flag(TLB_WB))
250 asm("mcr%? p15, 0, %0, c7, c10, 4" : : "r" (zero)); 250 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc");
251 251
252 if (tlb_flag(TLB_V3_FULL)) 252 if (tlb_flag(TLB_V3_FULL))
253 asm("mcr%? p15, 0, %0, c6, c0, 0" : : "r" (zero)); 253 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
254 if (tlb_flag(TLB_V4_U_FULL | TLB_V6_U_FULL)) 254 if (tlb_flag(TLB_V4_U_FULL | TLB_V6_U_FULL))
255 asm("mcr%? p15, 0, %0, c8, c7, 0" : : "r" (zero)); 255 asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc");
256 if (tlb_flag(TLB_V4_D_FULL | TLB_V6_D_FULL)) 256 if (tlb_flag(TLB_V4_D_FULL | TLB_V6_D_FULL))
257 asm("mcr%? p15, 0, %0, c8, c6, 0" : : "r" (zero)); 257 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
258 if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL)) 258 if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL))
259 asm("mcr%? p15, 0, %0, c8, c5, 0" : : "r" (zero)); 259 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
260} 260}
261 261
262static inline void local_flush_tlb_mm(struct mm_struct *mm) 262static inline void local_flush_tlb_mm(struct mm_struct *mm)
@@ -266,25 +266,25 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
266 const unsigned int __tlb_flag = __cpu_tlb_flags; 266 const unsigned int __tlb_flag = __cpu_tlb_flags;
267 267
268 if (tlb_flag(TLB_WB)) 268 if (tlb_flag(TLB_WB))
269 asm("mcr%? p15, 0, %0, c7, c10, 4" : : "r" (zero)); 269 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc");
270 270
271 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) { 271 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) {
272 if (tlb_flag(TLB_V3_FULL)) 272 if (tlb_flag(TLB_V3_FULL))
273 asm("mcr%? p15, 0, %0, c6, c0, 0" : : "r" (zero)); 273 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
274 if (tlb_flag(TLB_V4_U_FULL)) 274 if (tlb_flag(TLB_V4_U_FULL))
275 asm("mcr%? p15, 0, %0, c8, c7, 0" : : "r" (zero)); 275 asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc");
276 if (tlb_flag(TLB_V4_D_FULL)) 276 if (tlb_flag(TLB_V4_D_FULL))
277 asm("mcr%? p15, 0, %0, c8, c6, 0" : : "r" (zero)); 277 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
278 if (tlb_flag(TLB_V4_I_FULL)) 278 if (tlb_flag(TLB_V4_I_FULL))
279 asm("mcr%? p15, 0, %0, c8, c5, 0" : : "r" (zero)); 279 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
280 } 280 }
281 281
282 if (tlb_flag(TLB_V6_U_ASID)) 282 if (tlb_flag(TLB_V6_U_ASID))
283 asm("mcr%? p15, 0, %0, c8, c7, 2" : : "r" (asid)); 283 asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc");
284 if (tlb_flag(TLB_V6_D_ASID)) 284 if (tlb_flag(TLB_V6_D_ASID))
285 asm("mcr%? p15, 0, %0, c8, c6, 2" : : "r" (asid)); 285 asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc");
286 if (tlb_flag(TLB_V6_I_ASID)) 286 if (tlb_flag(TLB_V6_I_ASID))
287 asm("mcr%? p15, 0, %0, c8, c5, 2" : : "r" (asid)); 287 asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc");
288} 288}
289 289
290static inline void 290static inline void
@@ -296,27 +296,27 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
296 uaddr = (uaddr & PAGE_MASK) | ASID(vma->vm_mm); 296 uaddr = (uaddr & PAGE_MASK) | ASID(vma->vm_mm);
297 297
298 if (tlb_flag(TLB_WB)) 298 if (tlb_flag(TLB_WB))
299 asm("mcr%? p15, 0, %0, c7, c10, 4" : : "r" (zero)); 299 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero));
300 300
301 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) { 301 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
302 if (tlb_flag(TLB_V3_PAGE)) 302 if (tlb_flag(TLB_V3_PAGE))
303 asm("mcr%? p15, 0, %0, c6, c0, 0" : : "r" (uaddr)); 303 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (uaddr) : "cc");
304 if (tlb_flag(TLB_V4_U_PAGE)) 304 if (tlb_flag(TLB_V4_U_PAGE))
305 asm("mcr%? p15, 0, %0, c8, c7, 1" : : "r" (uaddr)); 305 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc");
306 if (tlb_flag(TLB_V4_D_PAGE)) 306 if (tlb_flag(TLB_V4_D_PAGE))
307 asm("mcr%? p15, 0, %0, c8, c6, 1" : : "r" (uaddr)); 307 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
308 if (tlb_flag(TLB_V4_I_PAGE)) 308 if (tlb_flag(TLB_V4_I_PAGE))
309 asm("mcr%? p15, 0, %0, c8, c5, 1" : : "r" (uaddr)); 309 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
310 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) 310 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
311 asm("mcr%? p15, 0, %0, c8, c5, 0" : : "r" (zero)); 311 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
312 } 312 }
313 313
314 if (tlb_flag(TLB_V6_U_PAGE)) 314 if (tlb_flag(TLB_V6_U_PAGE))
315 asm("mcr%? p15, 0, %0, c8, c7, 1" : : "r" (uaddr)); 315 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc");
316 if (tlb_flag(TLB_V6_D_PAGE)) 316 if (tlb_flag(TLB_V6_D_PAGE))
317 asm("mcr%? p15, 0, %0, c8, c6, 1" : : "r" (uaddr)); 317 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
318 if (tlb_flag(TLB_V6_I_PAGE)) 318 if (tlb_flag(TLB_V6_I_PAGE))
319 asm("mcr%? p15, 0, %0, c8, c5, 1" : : "r" (uaddr)); 319 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
320} 320}
321 321
322static inline void local_flush_tlb_kernel_page(unsigned long kaddr) 322static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
@@ -327,31 +327,31 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
327 kaddr &= PAGE_MASK; 327 kaddr &= PAGE_MASK;
328 328
329 if (tlb_flag(TLB_WB)) 329 if (tlb_flag(TLB_WB))
330 asm("mcr%? p15, 0, %0, c7, c10, 4" : : "r" (zero)); 330 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc");
331 331
332 if (tlb_flag(TLB_V3_PAGE)) 332 if (tlb_flag(TLB_V3_PAGE))
333 asm("mcr%? p15, 0, %0, c6, c0, 0" : : "r" (kaddr)); 333 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc");
334 if (tlb_flag(TLB_V4_U_PAGE)) 334 if (tlb_flag(TLB_V4_U_PAGE))
335 asm("mcr%? p15, 0, %0, c8, c7, 1" : : "r" (kaddr)); 335 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc");
336 if (tlb_flag(TLB_V4_D_PAGE)) 336 if (tlb_flag(TLB_V4_D_PAGE))
337 asm("mcr%? p15, 0, %0, c8, c6, 1" : : "r" (kaddr)); 337 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
338 if (tlb_flag(TLB_V4_I_PAGE)) 338 if (tlb_flag(TLB_V4_I_PAGE))
339 asm("mcr%? p15, 0, %0, c8, c5, 1" : : "r" (kaddr)); 339 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
340 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) 340 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
341 asm("mcr%? p15, 0, %0, c8, c5, 0" : : "r" (zero)); 341 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
342 342
343 if (tlb_flag(TLB_V6_U_PAGE)) 343 if (tlb_flag(TLB_V6_U_PAGE))
344 asm("mcr%? p15, 0, %0, c8, c7, 1" : : "r" (kaddr)); 344 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc");
345 if (tlb_flag(TLB_V6_D_PAGE)) 345 if (tlb_flag(TLB_V6_D_PAGE))
346 asm("mcr%? p15, 0, %0, c8, c6, 1" : : "r" (kaddr)); 346 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
347 if (tlb_flag(TLB_V6_I_PAGE)) 347 if (tlb_flag(TLB_V6_I_PAGE))
348 asm("mcr%? p15, 0, %0, c8, c5, 1" : : "r" (kaddr)); 348 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
349 349
350 /* The ARM ARM states that the completion of a TLB maintenance 350 /* The ARM ARM states that the completion of a TLB maintenance
351 * operation is only guaranteed by a DSB instruction 351 * operation is only guaranteed by a DSB instruction
352 */ 352 */
353 if (tlb_flag(TLB_V6_U_PAGE | TLB_V6_D_PAGE | TLB_V6_I_PAGE)) 353 if (tlb_flag(TLB_V6_U_PAGE | TLB_V6_D_PAGE | TLB_V6_I_PAGE))
354 asm("mcr%? p15, 0, %0, c7, c10, 4" : : "r" (zero)); 354 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc");
355} 355}
356 356
357/* 357/*
@@ -373,11 +373,11 @@ static inline void flush_pmd_entry(pmd_t *pmd)
373 const unsigned int __tlb_flag = __cpu_tlb_flags; 373 const unsigned int __tlb_flag = __cpu_tlb_flags;
374 374
375 if (tlb_flag(TLB_DCLEAN)) 375 if (tlb_flag(TLB_DCLEAN))
376 asm("mcr%? p15, 0, %0, c7, c10, 1 @ flush_pmd" 376 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
377 : : "r" (pmd)); 377 : : "r" (pmd) : "cc");
378 if (tlb_flag(TLB_WB)) 378 if (tlb_flag(TLB_WB))
379 asm("mcr%? p15, 0, %0, c7, c10, 4 @ flush_pmd" 379 asm("mcr p15, 0, %0, c7, c10, 4 @ flush_pmd"
380 : : "r" (zero)); 380 : : "r" (zero) : "cc");
381} 381}
382 382
383static inline void clean_pmd_entry(pmd_t *pmd) 383static inline void clean_pmd_entry(pmd_t *pmd)
@@ -385,8 +385,8 @@ static inline void clean_pmd_entry(pmd_t *pmd)
385 const unsigned int __tlb_flag = __cpu_tlb_flags; 385 const unsigned int __tlb_flag = __cpu_tlb_flags;
386 386
387 if (tlb_flag(TLB_DCLEAN)) 387 if (tlb_flag(TLB_DCLEAN))
388 asm("mcr%? p15, 0, %0, c7, c10, 1 @ flush_pmd" 388 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
389 : : "r" (pmd)); 389 : : "r" (pmd) : "cc");
390} 390}
391 391
392#undef tlb_flag 392#undef tlb_flag
diff --git a/include/asm-arm/unaligned.h b/include/asm-arm/unaligned.h
index 1b39c2f322c9..795b9e5b9e6a 100644
--- a/include/asm-arm/unaligned.h
+++ b/include/asm-arm/unaligned.h
@@ -3,7 +3,7 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6extern int __bug_unaligned_x(void *ptr); 6extern int __bug_unaligned_x(const void *ptr);
7 7
8/* 8/*
9 * What is the most efficient way of loading/storing an unaligned value? 9 * What is the most efficient way of loading/storing an unaligned value?
@@ -51,44 +51,32 @@ extern int __bug_unaligned_x(void *ptr);
51#define __get_unaligned_4_be(__p) \ 51#define __get_unaligned_4_be(__p) \
52 (__p[0] << 24 | __p[1] << 16 | __p[2] << 8 | __p[3]) 52 (__p[0] << 24 | __p[1] << 16 | __p[2] << 8 | __p[3])
53 53
54#define __get_unaligned_le(ptr) \ 54#define __get_unaligned_8_le(__p) \
55 ({ \ 55 ((unsigned long long)__get_unaligned_4_le((__p+4)) << 32 | \
56 __typeof__(*(ptr)) __v; \ 56 __get_unaligned_4_le(__p))
57 __u8 *__p = (__u8 *)(ptr); \ 57
58 switch (sizeof(*(ptr))) { \ 58#define __get_unaligned_8_be(__p) \
59 case 1: __v = *(ptr); break; \ 59 ((unsigned long long)__get_unaligned_4_be(__p) << 32 | \
60 case 2: __v = __get_unaligned_2_le(__p); break; \ 60 __get_unaligned_4_be((__p+4)))
61 case 4: __v = __get_unaligned_4_le(__p); break; \ 61
62 case 8: { \ 62#define __get_unaligned_le(ptr) \
63 unsigned int __v1, __v2; \ 63 ({ \
64 __v2 = __get_unaligned_4_le((__p+4)); \ 64 const __u8 *__p = (const __u8 *)(ptr); \
65 __v1 = __get_unaligned_4_le(__p); \ 65 __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \
66 __v = ((unsigned long long)__v2 << 32 | __v1); \ 66 __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_le(__p), \
67 } \ 67 __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_le(__p), \
68 break; \ 68 __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_le(__p), \
69 default: __v = __bug_unaligned_x(__p); break; \ 69 (void)__bug_unaligned_x(__p))))); \
70 } \
71 __v; \
72 }) 70 })
73 71
74#define __get_unaligned_be(ptr) \ 72#define __get_unaligned_be(ptr) \
75 ({ \ 73 ({ \
76 __typeof__(*(ptr)) __v; \ 74 const __u8 *__p = (const __u8 *)(ptr); \
77 __u8 *__p = (__u8 *)(ptr); \ 75 __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \
78 switch (sizeof(*(ptr))) { \ 76 __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_be(__p), \
79 case 1: __v = *(ptr); break; \ 77 __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_be(__p), \
80 case 2: __v = __get_unaligned_2_be(__p); break; \ 78 __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_be(__p), \
81 case 4: __v = __get_unaligned_4_be(__p); break; \ 79 (void)__bug_unaligned_x(__p))))); \
82 case 8: { \
83 unsigned int __v1, __v2; \
84 __v2 = __get_unaligned_4_be(__p); \
85 __v1 = __get_unaligned_4_be((__p+4)); \
86 __v = ((unsigned long long)__v2 << 32 | __v1); \
87 } \
88 break; \
89 default: __v = __bug_unaligned_x(__p); break; \
90 } \
91 __v; \
92 }) 80 })
93 81
94 82
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 1e891f860ef3..14a87eec5a2d 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -377,6 +377,7 @@
377#endif 377#endif
378 378
379#ifdef __KERNEL__ 379#ifdef __KERNEL__
380#include <linux/err.h>
380#include <linux/linkage.h> 381#include <linux/linkage.h>
381 382
382#define __sys2(x) #x 383#define __sys2(x) #x
@@ -396,7 +397,7 @@
396 397
397#define __syscall_return(type, res) \ 398#define __syscall_return(type, res) \
398do { \ 399do { \
399 if ((unsigned long)(res) >= (unsigned long)(-129)) { \ 400 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
400 errno = -(res); \ 401 errno = -(res); \
401 res = -1; \ 402 res = -1; \
402 } \ 403 } \
@@ -548,30 +549,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
548#define __ARCH_WANT_SYS_SOCKETCALL 549#define __ARCH_WANT_SYS_SOCKETCALL
549#endif 550#endif
550 551
551#ifdef __KERNEL_SYSCALLS__
552
553#include <linux/compiler.h>
554#include <linux/types.h>
555#include <linux/syscalls.h>
556
557extern long execve(const char *file, char **argv, char **envp);
558
559struct pt_regs;
560asmlinkage int sys_execve(char *filenamei, char **argv, char **envp,
561 struct pt_regs *regs);
562asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
563 struct pt_regs *regs);
564asmlinkage int sys_fork(struct pt_regs *regs);
565asmlinkage int sys_vfork(struct pt_regs *regs);
566asmlinkage int sys_pipe(unsigned long *fildes);
567struct sigaction;
568asmlinkage long sys_rt_sigaction(int sig,
569 const struct sigaction __user *act,
570 struct sigaction __user *oact,
571 size_t sigsetsize);
572
573#endif /* __KERNEL_SYSCALLS__ */
574
575/* 552/*
576 * "Conditional" syscalls 553 * "Conditional" syscalls
577 * 554 *
diff --git a/include/asm-arm26/assembler.h b/include/asm-arm26/assembler.h
index 83f9aec55e4f..bb507a9a4a55 100644
--- a/include/asm-arm26/assembler.h
+++ b/include/asm-arm26/assembler.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/asm/assembler.h 2 * linux/include/asm-arm26/assembler.h
3 * 3 *
4 * This file contains arm architecture specific defines 4 * This file contains arm architecture specific defines
5 * for the different processors. 5 * for the different processors.
diff --git a/include/asm-arm26/namei.h b/include/asm-arm26/namei.h
index a402d3b9d0f7..3f5d340110eb 100644
--- a/include/asm-arm26/namei.h
+++ b/include/asm-arm26/namei.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/namei.h 2 * linux/include/asm-arm26/namei.h
3 * 3 *
4 * Routines to handle famous /usr/gnemul 4 * Routines to handle famous /usr/gnemul
5 * Derived from the Sparc version of this file 5 * Derived from the Sparc version of this file
diff --git a/include/asm-arm26/semaphore.h b/include/asm-arm26/semaphore.h
index ccf15e704109..1fda54375ed8 100644
--- a/include/asm-arm26/semaphore.h
+++ b/include/asm-arm26/semaphore.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/semaphore.h 2 * linux/include/asm-arm26/semaphore.h
3 */ 3 */
4#ifndef __ASM_ARM_SEMAPHORE_H 4#ifndef __ASM_ARM_SEMAPHORE_H
5#define __ASM_ARM_SEMAPHORE_H 5#define __ASM_ARM_SEMAPHORE_H
diff --git a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h
index 70eb6d91cfd0..25a5eead85be 100644
--- a/include/asm-arm26/unistd.h
+++ b/include/asm-arm26/unistd.h
@@ -311,6 +311,7 @@
311#define __ARM_NR_usr26 (__ARM_NR_BASE+3) 311#define __ARM_NR_usr26 (__ARM_NR_BASE+3)
312 312
313#ifdef __KERNEL__ 313#ifdef __KERNEL__
314#include <linux/err.h>
314#include <linux/linkage.h> 315#include <linux/linkage.h>
315 316
316#define __sys2(x) #x 317#define __sys2(x) #x
@@ -322,7 +323,7 @@
322 323
323#define __syscall_return(type, res) \ 324#define __syscall_return(type, res) \
324do { \ 325do { \
325 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 326 if ((unsigned long)(res) >= (unsigned long)-MAX_ERRNO) { \
326 errno = -(res); \ 327 errno = -(res); \
327 res = -1; \ 328 res = -1; \
328 } \ 329 } \
@@ -463,30 +464,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
463#define __ARCH_WANT_SYS_SIGPROCMASK 464#define __ARCH_WANT_SYS_SIGPROCMASK
464#define __ARCH_WANT_SYS_RT_SIGACTION 465#define __ARCH_WANT_SYS_RT_SIGACTION
465 466
466#ifdef __KERNEL_SYSCALLS__
467
468#include <linux/compiler.h>
469#include <linux/types.h>
470#include <linux/syscalls.h>
471
472extern long execve(const char *file, char **argv, char **envp);
473
474struct pt_regs;
475asmlinkage int sys_execve(char *filenamei, char **argv, char **envp,
476 struct pt_regs *regs);
477asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
478 struct pt_regs *regs);
479asmlinkage int sys_fork(struct pt_regs *regs);
480asmlinkage int sys_vfork(struct pt_regs *regs);
481asmlinkage int sys_pipe(unsigned long *fildes);
482struct sigaction;
483asmlinkage long sys_rt_sigaction(int sig,
484 const struct sigaction __user *act,
485 struct sigaction __user *oact,
486 size_t sigsetsize);
487
488#endif /* __KERNEL_SYSCALLS__ */
489
490/* 467/*
491 * "Conditional" syscalls 468 * "Conditional" syscalls
492 * 469 *
diff --git a/include/asm-avr32/arch-at32ap/at91rm9200_usart.h b/include/asm-avr32/arch-at32ap/at91rm9200_usart.h
deleted file mode 100644
index 79f851e31b9c..000000000000
--- a/include/asm-avr32/arch-at32ap/at91rm9200_usart.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USART registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_USART_H
17#define AT91RM9200_USART_H
18
19#define AT91_US_CR 0x00 /* Control Register */
20#define AT91_US_RSTRX (1 << 2) /* Reset Receiver */
21#define AT91_US_RSTTX (1 << 3) /* Reset Transmitter */
22#define AT91_US_RXEN (1 << 4) /* Receiver Enable */
23#define AT91_US_RXDIS (1 << 5) /* Receiver Disable */
24#define AT91_US_TXEN (1 << 6) /* Transmitter Enable */
25#define AT91_US_TXDIS (1 << 7) /* Transmitter Disable */
26#define AT91_US_RSTSTA (1 << 8) /* Reset Status Bits */
27#define AT91_US_STTBRK (1 << 9) /* Start Break */
28#define AT91_US_STPBRK (1 << 10) /* Stop Break */
29#define AT91_US_STTTO (1 << 11) /* Start Time-out */
30#define AT91_US_SENDA (1 << 12) /* Send Address */
31#define AT91_US_RSTIT (1 << 13) /* Reset Iterations */
32#define AT91_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */
33#define AT91_US_RETTO (1 << 15) /* Rearm Time-out */
34#define AT91_US_DTREN (1 << 16) /* Data Terminal Ready Enable */
35#define AT91_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable */
36#define AT91_US_RTSEN (1 << 18) /* Request To Send Enable */
37#define AT91_US_RTSDIS (1 << 19) /* Request To Send Disable */
38
39#define AT91_US_MR 0x04 /* Mode Register */
40#define AT91_US_USMODE (0xf << 0) /* Mode of the USART */
41#define AT91_US_USMODE_NORMAL 0
42#define AT91_US_USMODE_RS485 1
43#define AT91_US_USMODE_HWHS 2
44#define AT91_US_USMODE_MODEM 3
45#define AT91_US_USMODE_ISO7816_T0 4
46#define AT91_US_USMODE_ISO7816_T1 6
47#define AT91_US_USMODE_IRDA 8
48#define AT91_US_USCLKS (3 << 4) /* Clock Selection */
49#define AT91_US_CHRL (3 << 6) /* Character Length */
50#define AT91_US_CHRL_5 (0 << 6)
51#define AT91_US_CHRL_6 (1 << 6)
52#define AT91_US_CHRL_7 (2 << 6)
53#define AT91_US_CHRL_8 (3 << 6)
54#define AT91_US_SYNC (1 << 8) /* Synchronous Mode Select */
55#define AT91_US_PAR (7 << 9) /* Parity Type */
56#define AT91_US_PAR_EVEN (0 << 9)
57#define AT91_US_PAR_ODD (1 << 9)
58#define AT91_US_PAR_SPACE (2 << 9)
59#define AT91_US_PAR_MARK (3 << 9)
60#define AT91_US_PAR_NONE (4 << 9)
61#define AT91_US_PAR_MULTI_DROP (6 << 9)
62#define AT91_US_NBSTOP (3 << 12) /* Number of Stop Bits */
63#define AT91_US_NBSTOP_1 (0 << 12)
64#define AT91_US_NBSTOP_1_5 (1 << 12)
65#define AT91_US_NBSTOP_2 (2 << 12)
66#define AT91_US_CHMODE (3 << 14) /* Channel Mode */
67#define AT91_US_CHMODE_NORMAL (0 << 14)
68#define AT91_US_CHMODE_ECHO (1 << 14)
69#define AT91_US_CHMODE_LOC_LOOP (2 << 14)
70#define AT91_US_CHMODE_REM_LOOP (3 << 14)
71#define AT91_US_MSBF (1 << 16) /* Bit Order */
72#define AT91_US_MODE9 (1 << 17) /* 9-bit Character Length */
73#define AT91_US_CLKO (1 << 18) /* Clock Output Select */
74#define AT91_US_OVER (1 << 19) /* Oversampling Mode */
75#define AT91_US_INACK (1 << 20) /* Inhibit Non Acknowledge */
76#define AT91_US_DSNACK (1 << 21) /* Disable Successive NACK */
77#define AT91_US_MAX_ITER (7 << 24) /* Max Iterations */
78#define AT91_US_FILTER (1 << 28) /* Infrared Receive Line Filter */
79
80#define AT91_US_IER 0x08 /* Interrupt Enable Register */
81#define AT91_US_RXRDY (1 << 0) /* Receiver Ready */
82#define AT91_US_TXRDY (1 << 1) /* Transmitter Ready */
83#define AT91_US_RXBRK (1 << 2) /* Break Received / End of Break */
84#define AT91_US_ENDRX (1 << 3) /* End of Receiver Transfer */
85#define AT91_US_ENDTX (1 << 4) /* End of Transmitter Transfer */
86#define AT91_US_OVRE (1 << 5) /* Overrun Error */
87#define AT91_US_FRAME (1 << 6) /* Framing Error */
88#define AT91_US_PARE (1 << 7) /* Parity Error */
89#define AT91_US_TIMEOUT (1 << 8) /* Receiver Time-out */
90#define AT91_US_TXEMPTY (1 << 9) /* Transmitter Empty */
91#define AT91_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */
92#define AT91_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */
93#define AT91_US_RXBUFF (1 << 12) /* Reception Buffer Full */
94#define AT91_US_NACK (1 << 13) /* Non Acknowledge */
95#define AT91_US_RIIC (1 << 16) /* Ring Indicator Input Change */
96#define AT91_US_DSRIC (1 << 17) /* Data Set Ready Input Change */
97#define AT91_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change */
98#define AT91_US_CTSIC (1 << 19) /* Clear to Send Input Change */
99#define AT91_US_RI (1 << 20) /* RI */
100#define AT91_US_DSR (1 << 21) /* DSR */
101#define AT91_US_DCD (1 << 22) /* DCD */
102#define AT91_US_CTS (1 << 23) /* CTS */
103
104#define AT91_US_IDR 0x0c /* Interrupt Disable Register */
105#define AT91_US_IMR 0x10 /* Interrupt Mask Register */
106#define AT91_US_CSR 0x14 /* Channel Status Register */
107#define AT91_US_RHR 0x18 /* Receiver Holding Register */
108#define AT91_US_THR 0x1c /* Transmitter Holding Register */
109
110#define AT91_US_BRGR 0x20 /* Baud Rate Generator Register */
111#define AT91_US_CD (0xffff << 0) /* Clock Divider */
112
113#define AT91_US_RTOR 0x24 /* Receiver Time-out Register */
114#define AT91_US_TO (0xffff << 0) /* Time-out Value */
115
116#define AT91_US_TTGR 0x28 /* Transmitter Timeguard Register */
117#define AT91_US_TG (0xff << 0) /* Timeguard Value */
118
119#define AT91_US_FIDI 0x40 /* FI DI Ratio Register */
120#define AT91_US_NER 0x44 /* Number of Errors Register */
121#define AT91_US_IF 0x4c /* IrDA Filter Register */
122
123#endif
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 39368e18ab20..a39b3e999f18 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -9,9 +9,15 @@
9/* Add basic devices: system manager, interrupt controller, portmuxes, etc. */ 9/* Add basic devices: system manager, interrupt controller, portmuxes, etc. */
10void at32_add_system_devices(void); 10void at32_add_system_devices(void);
11 11
12#define AT91_NR_UART 4 12#define ATMEL_MAX_UART 4
13extern struct platform_device *at91_default_console_device; 13extern struct platform_device *atmel_default_console_device;
14 14
15struct atmel_uart_data {
16 short use_dma_tx; /* use transmit DMA? */
17 short use_dma_rx; /* use receive DMA? */
18 void __iomem *regs; /* virtual base address, if any */
19};
20void at32_map_usart(unsigned int hw_id, unsigned int line);
15struct platform_device *at32_add_device_usart(unsigned int id); 21struct platform_device *at32_add_device_usart(unsigned int id);
16 22
17struct eth_platform_data { 23struct eth_platform_data {
diff --git a/include/asm-avr32/arch-at32ap/init.h b/include/asm-avr32/arch-at32ap/init.h
index 43722634e069..5e75d850d707 100644
--- a/include/asm-avr32/arch-at32ap/init.h
+++ b/include/asm-avr32/arch-at32ap/init.h
@@ -11,6 +11,7 @@
11#define __ASM_AVR32_AT32AP_INIT_H__ 11#define __ASM_AVR32_AT32AP_INIT_H__
12 12
13void setup_platform(void); 13void setup_platform(void);
14void setup_board(void);
14 15
15/* Called by setup_platform */ 16/* Called by setup_platform */
16void at32_clock_init(void); 17void at32_clock_init(void);
diff --git a/include/asm-avr32/mach/serial_at91.h b/include/asm-avr32/mach/serial_at91.h
index 1290bb32802d..55b317a89061 100644
--- a/include/asm-avr32/mach/serial_at91.h
+++ b/include/asm-avr32/mach/serial_at91.h
@@ -14,7 +14,7 @@ struct uart_port;
14 * This is a temporary structure for registering these 14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot. 15 * functions; it is intended to be discarded after boot.
16 */ 16 */
17struct at91_port_fns { 17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int); 18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *); 19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *); 20 void (*enable_ms)(struct uart_port *);
@@ -24,10 +24,10 @@ struct at91_port_fns {
24 void (*close)(struct uart_port *); 24 void (*close)(struct uart_port *);
25}; 25};
26 26
27#if defined(CONFIG_SERIAL_AT91) 27#if defined(CONFIG_SERIAL_ATMEL)
28void at91_register_uart_fns(struct at91_port_fns *fns); 28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else 29#else
30#define at91_register_uart_fns(fns) do { } while (0) 30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif 31#endif
32 32
33 33
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h
index 1f528f92690d..a50e5004550c 100644
--- a/include/asm-avr32/unistd.h
+++ b/include/asm-avr32/unistd.h
@@ -281,30 +281,10 @@
281#define __NR_tee 263 281#define __NR_tee 263
282#define __NR_vmsplice 264 282#define __NR_vmsplice 264
283 283
284#ifdef __KERNEL__
284#define NR_syscalls 265 285#define NR_syscalls 265
285 286
286 287
287/*
288 * AVR32 calling convention for system calls:
289 * - System call number in r8
290 * - Parameters in r12 and downwards to r9 as well as r6 and r5.
291 * - Return value in r12
292 */
293
294/*
295 * user-visible error numbers are in the range -1 - -124: see
296 * <asm-generic/errno.h>
297 */
298
299#define __syscall_return(type, res) do { \
300 if ((unsigned long)(res) >= (unsigned long)(-125)) { \
301 errno = -(res); \
302 res = -1; \
303 } \
304 return (type) (res); \
305 } while (0)
306
307#ifdef __KERNEL__
308#define __ARCH_WANT_IPC_PARSE_VERSION 288#define __ARCH_WANT_IPC_PARSE_VERSION
309#define __ARCH_WANT_STAT64 289#define __ARCH_WANT_STAT64
310#define __ARCH_WANT_SYS_ALARM 290#define __ARCH_WANT_SYS_ALARM
@@ -319,62 +299,6 @@
319#define __ARCH_WANT_SYS_GETPGRP 299#define __ARCH_WANT_SYS_GETPGRP
320#define __ARCH_WANT_SYS_RT_SIGACTION 300#define __ARCH_WANT_SYS_RT_SIGACTION
321#define __ARCH_WANT_SYS_RT_SIGSUSPEND 301#define __ARCH_WANT_SYS_RT_SIGSUSPEND
322#endif
323
324#if defined(__KERNEL_SYSCALLS__) || defined(__CHECKER__)
325
326#include <linux/types.h>
327#include <linux/linkage.h>
328#include <asm/signal.h>
329
330struct pt_regs;
331
332/*
333 * we need this inline - forking from kernel space will result
334 * in NO COPY ON WRITE (!!!), until an execve is executed. This
335 * is no problem, but for the stack. This is handled by not letting
336 * main() use the stack at all after fork(). Thus, no function
337 * calls - which means inline code for fork too, as otherwise we
338 * would use the stack upon exit from 'fork()'.
339 *
340 * Actually only pause and fork are needed inline, so that there
341 * won't be any messing with the stack from main(), but we define
342 * some others too.
343 */
344static inline int execve(const char *file, char **argv, char **envp)
345{
346 register long scno asm("r8") = __NR_execve;
347 register long sc1 asm("r12") = (long)file;
348 register long sc2 asm("r11") = (long)argv;
349 register long sc3 asm("r10") = (long)envp;
350 int res;
351
352 asm volatile("scall"
353 : "=r"(sc1)
354 : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3)
355 : "lr", "memory");
356 res = sc1;
357 __syscall_return(int, res);
358}
359
360asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
361asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
362 struct pt_regs *regs);
363asmlinkage int sys_rt_sigreturn(struct pt_regs *regs);
364asmlinkage int sys_pipe(unsigned long __user *filedes);
365asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
366 unsigned long prot, unsigned long flags,
367 unsigned long fd, off_t offset);
368asmlinkage int sys_cacheflush(int operation, void __user *addr, size_t len);
369asmlinkage int sys_fork(struct pt_regs *regs);
370asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
371 unsigned long parent_tidptr,
372 unsigned long child_tidptr, struct pt_regs *regs);
373asmlinkage int sys_vfork(struct pt_regs *regs);
374asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv,
375 char __user *__user *uenvp, struct pt_regs *regs);
376
377#endif
378 302
379/* 303/*
380 * "Conditional" syscalls 304 * "Conditional" syscalls
@@ -384,4 +308,6 @@ asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv,
384 */ 308 */
385#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); 309#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
386 310
311#endif /* __KERNEL__ */
312
387#endif /* __ASM_AVR32_UNISTD_H */ 313#endif /* __ASM_AVR32_UNISTD_H */
diff --git a/include/asm-cris/arch-v32/spinlock.h b/include/asm-cris/arch-v32/spinlock.h
index 52df72a62232..5f43df0a5fb4 100644
--- a/include/asm-cris/arch-v32/spinlock.h
+++ b/include/asm-cris/arch-v32/spinlock.h
@@ -160,4 +160,8 @@ static __inline__ int is_write_locked(rwlock_t *rw)
160 return rw->counter < 0; 160 return rw->counter < 0;
161} 161}
162 162
163#define _raw_spin_relax(lock) cpu_relax()
164#define _raw_read_relax(lock) cpu_relax()
165#define _raw_write_relax(lock) cpu_relax()
166
163#endif /* __ASM_ARCH_SPINLOCK_H */ 167#endif /* __ASM_ARCH_SPINLOCK_H */
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index 7372efae0516..7c90fa970c38 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -322,67 +322,6 @@
322#define __ARCH_WANT_SYS_SIGPROCMASK 322#define __ARCH_WANT_SYS_SIGPROCMASK
323#define __ARCH_WANT_SYS_RT_SIGACTION 323#define __ARCH_WANT_SYS_RT_SIGACTION
324 324
325#ifdef __KERNEL_SYSCALLS__
326
327#include <linux/compiler.h>
328#include <linux/types.h>
329#include <linux/linkage.h>
330
331/*
332 * we need this inline - forking from kernel space will result
333 * in NO COPY ON WRITE (!!!), until an execve is executed. This
334 * is no problem, but for the stack. This is handled by not letting
335 * main() use the stack at all after fork(). Thus, no function
336 * calls - which means inline code for fork too, as otherwise we
337 * would use the stack upon exit from 'fork()'.
338 *
339 * Actually only pause and fork are needed inline, so that there
340 * won't be any messing with the stack from main(), but we define
341 * some others too.
342 */
343#define __NR__exit __NR_exit
344static inline _syscall0(pid_t,setsid)
345static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
346static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
347static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
348static inline _syscall1(int,dup,int,fd)
349static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
350static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
351static inline _syscall1(int,close,int,fd)
352
353struct pt_regs;
354asmlinkage long sys_mmap2(
355 unsigned long addr, unsigned long len,
356 unsigned long prot, unsigned long flags,
357 unsigned long fd, unsigned long pgoff);
358asmlinkage int sys_execve(const char *fname, char **argv, char **envp,
359 long r13, long mof, long srp, struct pt_regs *regs);
360asmlinkage int sys_clone(unsigned long newusp, unsigned long flags,
361 int* parent_tid, int* child_tid, long mof, long srp,
362 struct pt_regs *regs);
363asmlinkage int sys_fork(long r10, long r11, long r12, long r13,
364 long mof, long srp, struct pt_regs *regs);
365asmlinkage int sys_vfork(long r10, long r11, long r12, long r13,
366 long mof, long srp, struct pt_regs *regs);
367asmlinkage int sys_pipe(unsigned long __user *fildes);
368struct sigaction;
369asmlinkage long sys_rt_sigaction(int sig,
370 const struct sigaction __user *act,
371 struct sigaction __user *oact,
372 size_t sigsetsize);
373
374/*
375 * Since we define it "external", it collides with the built-in
376 * definition, which has the "noreturn" attribute and will cause
377 * complaints. We don't want to use -fno-builtin, so just use a
378 * different name when in the kernel.
379 */
380#define _exit kernel_syscall_exit
381static inline _syscall1(int,_exit,int,exitcode)
382static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
383#endif /* __KERNEL_SYSCALLS__ */
384
385
386/* 325/*
387 * "Conditional" syscalls 326 * "Conditional" syscalls
388 * 327 *
diff --git a/include/asm-frv/namei.h b/include/asm-frv/namei.h
index 84ddd6445f23..4ea57171d951 100644
--- a/include/asm-frv/namei.h
+++ b/include/asm-frv/namei.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * asm/namei.h 2 * include/asm-frv/namei.h
3 * 3 *
4 * Included from linux/fs/namei.c 4 * Included from linux/fs/namei.c
5 */ 5 */
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 2fb3c6f05e03..ba1b37df69d5 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -176,8 +176,6 @@ do { \
176} while(0) 176} while(0)
177#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 177#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
178 178
179#define set_pte_atomic(pteptr, pteval) set_pte((pteptr), (pteval))
180
181/* 179/*
182 * pgd_offset() returns a (pgd_t *) 180 * pgd_offset() returns a (pgd_t *)
183 * pgd_index() is used get the offset into the pgd page's array of pgd_t's; 181 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
diff --git a/include/asm-frv/timex.h b/include/asm-frv/timex.h
index 2aa562fa067b..a89bddefdacf 100644
--- a/include/asm-frv/timex.h
+++ b/include/asm-frv/timex.h
@@ -6,11 +6,6 @@
6#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ 6#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
7#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ 7#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
8 8
9#define FINETUNE \
10((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
11 (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
12 << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
13
14typedef unsigned long cycles_t; 9typedef unsigned long cycles_t;
15 10
16static inline cycles_t get_cycles(void) 11static inline cycles_t get_cycles(void)
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index b80dbd839475..725e854928cf 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -320,6 +320,7 @@
320#ifdef __KERNEL__ 320#ifdef __KERNEL__
321 321
322#define NR_syscalls 310 322#define NR_syscalls 310
323#include <linux/err.h>
323 324
324/* 325/*
325 * process the return value of a syscall, consigning it to one of two possible fates 326 * process the return value of a syscall, consigning it to one of two possible fates
@@ -329,7 +330,7 @@
329#define __syscall_return(type, res) \ 330#define __syscall_return(type, res) \
330do { \ 331do { \
331 unsigned long __sr2 = (res); \ 332 unsigned long __sr2 = (res); \
332 if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) { \ 333 if (__builtin_expect(__sr2 >= (unsigned long)(-MAX_ERRNO), 0)) { \
333 errno = (-__sr2); \ 334 errno = (-__sr2); \
334 __sr2 = ~0UL; \ 335 __sr2 = ~0UL; \
335 } \ 336 } \
@@ -439,31 +440,6 @@ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg
439 __syscall_return(type, __sc0); \ 440 __syscall_return(type, __sc0); \
440} 441}
441 442
442
443#ifdef __KERNEL_SYSCALLS__
444
445#include <linux/compiler.h>
446#include <linux/types.h>
447#include <linux/linkage.h>
448#include <asm/ptrace.h>
449
450/*
451 * we need this inline - forking from kernel space will result
452 * in NO COPY ON WRITE (!!!), until an execve is executed. This
453 * is no problem, but for the stack. This is handled by not letting
454 * main() use the stack at all after fork(). Thus, no function
455 * calls - which means inline code for fork too, as otherwise we
456 * would use the stack upon exit from 'fork()'.
457 *
458 * Actually only pause and fork are needed inline, so that there
459 * won't be any messing with the stack from main(), but we define
460 * some others too.
461 */
462#define __NR__exit __NR_exit
463static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
464
465#endif /* __KERNEL_SYSCALLS__ */
466
467#define __ARCH_WANT_IPC_PARSE_VERSION 443#define __ARCH_WANT_IPC_PARSE_VERSION
468/* #define __ARCH_WANT_OLD_READDIR */ 444/* #define __ARCH_WANT_OLD_READDIR */
469#define __ARCH_WANT_OLD_STAT 445#define __ARCH_WANT_OLD_STAT
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 8ceab7bcd8b4..a5250895155e 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -16,12 +16,15 @@
16#endif 16#endif
17 17
18#ifndef HAVE_ARCH_WARN_ON 18#ifndef HAVE_ARCH_WARN_ON
19#define WARN_ON(condition) do { \ 19#define WARN_ON(condition) ({ \
20 if (unlikely((condition)!=0)) { \ 20 typeof(condition) __ret_warn_on = (condition); \
21 printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \ 21 if (unlikely(__ret_warn_on)) { \
22 dump_stack(); \ 22 printk("BUG: warning at %s:%d/%s()\n", __FILE__, \
23 } \ 23 __LINE__, __FUNCTION__); \
24} while (0) 24 dump_stack(); \
25 } \
26 unlikely(__ret_warn_on); \
27})
25#endif 28#endif
26 29
27#else /* !CONFIG_BUG */ 30#else /* !CONFIG_BUG */
@@ -34,21 +37,18 @@
34#endif 37#endif
35 38
36#ifndef HAVE_ARCH_WARN_ON 39#ifndef HAVE_ARCH_WARN_ON
37#define WARN_ON(condition) do { if (condition) ; } while(0) 40#define WARN_ON(condition) unlikely((condition))
38#endif 41#endif
39#endif 42#endif
40 43
41#define WARN_ON_ONCE(condition) \ 44#define WARN_ON_ONCE(condition) ({ \
42({ \
43 static int __warn_once = 1; \ 45 static int __warn_once = 1; \
44 int __ret = 0; \ 46 typeof(condition) __ret_warn_once = (condition);\
45 \ 47 \
46 if (unlikely((condition) && __warn_once)) { \ 48 if (likely(__warn_once)) \
47 __warn_once = 0; \ 49 if (WARN_ON(__ret_warn_once)) \
48 WARN_ON(1); \ 50 __warn_once = 0; \
49 __ret = 1; \ 51 unlikely(__ret_warn_once); \
50 } \
51 __ret; \
52}) 52})
53 53
54#ifdef CONFIG_SMP 54#ifdef CONFIG_SMP
diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h
index 29c6ac34e236..0134151656af 100644
--- a/include/asm-generic/mutex-dec.h
+++ b/include/asm-generic/mutex-dec.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * asm-generic/mutex-dec.h 2 * include/asm-generic/mutex-dec.h
3 * 3 *
4 * Generic implementation of the mutex fastpath, based on atomic 4 * Generic implementation of the mutex fastpath, based on atomic
5 * decrement/increment. 5 * decrement/increment.
diff --git a/include/asm-generic/mutex-null.h b/include/asm-generic/mutex-null.h
index 254a126ede5c..e1bbbc72b6a2 100644
--- a/include/asm-generic/mutex-null.h
+++ b/include/asm-generic/mutex-null.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * asm-generic/mutex-null.h 2 * include/asm-generic/mutex-null.h
3 * 3 *
4 * Generic implementation of the mutex fastpath, based on NOP :-) 4 * Generic implementation of the mutex fastpath, based on NOP :-)
5 * 5 *
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index 32a2100c1aeb..6a7e8c141b53 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * asm-generic/mutex-xchg.h 2 * include/asm-generic/mutex-xchg.h
3 * 3 *
4 * Generic implementation of the mutex fastpath, based on xchg(). 4 * Generic implementation of the mutex fastpath, based on xchg().
5 * 5 *
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 349260cd86ed..9d774d07d95b 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -15,19 +15,11 @@
15 * Note: the old pte is known to not be writable, so we don't need to 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. 16 * worry about dirty bits etc getting lost.
17 */ 17 */
18#ifndef __HAVE_ARCH_SET_PTE_ATOMIC
19#define ptep_establish(__vma, __address, __ptep, __entry) \ 18#define ptep_establish(__vma, __address, __ptep, __entry) \
20do { \ 19do { \
21 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \ 20 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
22 flush_tlb_page(__vma, __address); \ 21 flush_tlb_page(__vma, __address); \
23} while (0) 22} while (0)
24#else /* __HAVE_ARCH_SET_PTE_ATOMIC */
25#define ptep_establish(__vma, __address, __ptep, __entry) \
26do { \
27 set_pte_atomic(__ptep, __entry); \
28 flush_tlb_page(__vma, __address); \
29} while (0)
30#endif /* __HAVE_ARCH_SET_PTE_ATOMIC */
31#endif 23#endif
32 24
33#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 25#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
@@ -112,8 +104,13 @@ do { \
112}) 104})
113#endif 105#endif
114 106
115#ifndef __HAVE_ARCH_PTE_CLEAR_FULL 107/*
116#define pte_clear_full(__mm, __address, __ptep, __full) \ 108 * Some architectures may be able to avoid expensive synchronization
109 * primitives when modifications are made to PTE's which are already
110 * not present, or in the process of an address space destruction.
111 */
112#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL
113#define pte_clear_not_present_full(__mm, __address, __ptep, __full) \
117do { \ 114do { \
118 pte_clear((__mm), (__address), (__ptep)); \ 115 pte_clear((__mm), (__address), (__ptep)); \
119} while (0) 116} while (0)
@@ -166,6 +163,26 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
166#endif 163#endif
167 164
168/* 165/*
166 * A facility to provide lazy MMU batching. This allows PTE updates and
167 * page invalidations to be delayed until a call to leave lazy MMU mode
168 * is issued. Some architectures may benefit from doing this, and it is
169 * beneficial for both shadow and direct mode hypervisors, which may batch
170 * the PTE updates which happen during this window. Note that using this
171 * interface requires that read hazards be removed from the code. A read
172 * hazard could result in the direct mode hypervisor case, since the actual
173 * write to the page tables may not yet have taken place, so reads though
174 * a raw PTE pointer after it has been modified are not guaranteed to be
175 * up to date. This mode can only be entered and left under the protection of
176 * the page table locks for all page tables which may be modified. In the UP
177 * case, this is required so that preemption is disabled, and in the SMP case,
178 * it must synchronize the delayed page table writes properly on other CPUs.
179 */
180#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
181#define arch_enter_lazy_mmu_mode() do {} while (0)
182#define arch_leave_lazy_mmu_mode() do {} while (0)
183#endif
184
185/*
169 * When walking page tables, get the address of the next boundary, 186 * When walking page tables, get the address of the next boundary,
170 * or the end address of the range if that comes earlier. Although no 187 * or the end address of the range if that comes earlier. Although no
171 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout. 188 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index 4087037a4225..d3238f1f70a6 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * inclue/asm-generic/rtc.h 2 * include/asm-generic/rtc.h
3 * 3 *
4 * Author: Tom Rini <trini@mvista.com> 4 * Author: Tom Rini <trini@mvista.com>
5 * 5 *
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 867d9008fafa..f490e43a90b9 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -1,4 +1,4 @@
1/* asm-generic/tlb.h 1/* include/asm-generic/tlb.h
2 * 2 *
3 * Generic TLB shootdown code 3 * Generic TLB shootdown code
4 * 4 *
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 253ae1328271..69240b52f8e1 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -118,15 +118,15 @@
118 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ 118 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
119 *(__ksymtab_strings) \ 119 *(__ksymtab_strings) \
120 } \ 120 } \
121 __end_rodata = .; \
122 . = ALIGN(4096); \
123 \ 121 \
124 /* Built-in module parameters. */ \ 122 /* Built-in module parameters. */ \
125 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 123 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
126 VMLINUX_SYMBOL(__start___param) = .; \ 124 VMLINUX_SYMBOL(__start___param) = .; \
127 *(__param) \ 125 *(__param) \
128 VMLINUX_SYMBOL(__stop___param) = .; \ 126 VMLINUX_SYMBOL(__stop___param) = .; \
129 } 127 } \
128 __end_rodata = .; \
129 . = ALIGN(4096);
130 130
131#define SECURITY_INIT \ 131#define SECURITY_INIT \
132 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ 132 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
diff --git a/include/asm-h8300/keyboard.h b/include/asm-h8300/keyboard.h
index fbad65e8a5c0..90efbd655390 100644
--- a/include/asm-h8300/keyboard.h
+++ b/include/asm-h8300/keyboard.h
@@ -18,14 +18,6 @@
18#define kbd_enable_irq(x...) do {;} while (0) 18#define kbd_enable_irq(x...) do {;} while (0)
19#define kbd_disable_irq(x...) do {;} while (0) 19#define kbd_disable_irq(x...) do {;} while (0)
20 20
21
22/* needed if MAGIC_SYSRQ is enabled for serial console */
23#ifndef SYSRQ_KEY
24#define SYSRQ_KEY ((unsigned char)(-1))
25#define kbd_sysrq_xlate ((unsigned char *)NULL)
26#endif
27
28
29#endif /* _H8300_KEYBOARD_H */ 21#endif /* _H8300_KEYBOARD_H */
30 22
31 23
diff --git a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h
index 226dd596c2da..747788d629ae 100644
--- a/include/asm-h8300/unistd.h
+++ b/include/asm-h8300/unistd.h
@@ -295,14 +295,14 @@
295#ifdef __KERNEL__ 295#ifdef __KERNEL__
296 296
297#define NR_syscalls 289 297#define NR_syscalls 289
298#include <linux/err.h>
298 299
299 300/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
300/* user-visible error numbers are in the range -1 - -122: see
301 <asm-m68k/errno.h> */ 301 <asm-m68k/errno.h> */
302 302
303#define __syscall_return(type, res) \ 303#define __syscall_return(type, res) \
304do { \ 304do { \
305 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 305 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
306 /* avoid using res which is declared to be in register d0; \ 306 /* avoid using res which is declared to be in register d0; \
307 errno might expand to a function call and clobber it. */ \ 307 errno might expand to a function call and clobber it. */ \
308 int __err = -(res); \ 308 int __err = -(res); \
@@ -485,57 +485,6 @@ type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \
485#define __ARCH_WANT_SYS_SIGPROCMASK 485#define __ARCH_WANT_SYS_SIGPROCMASK
486#define __ARCH_WANT_SYS_RT_SIGACTION 486#define __ARCH_WANT_SYS_RT_SIGACTION
487 487
488#ifdef __KERNEL_SYSCALLS__
489
490#include <linux/compiler.h>
491#include <linux/types.h>
492
493/*
494 * we need this inline - forking from kernel space will result
495 * in NO COPY ON WRITE (!!!), until an execve is executed. This
496 * is no problem, but for the stack. This is handled by not letting
497 * main() use the stack at all after fork(). Thus, no function
498 * calls - which means inline code for fork too, as otherwise we
499 * would use the stack upon exit from 'fork()'.
500 *
501 * Actually only pause and fork are needed inline, so that there
502 * won't be any messing with the stack from main(), but we define
503 * some others too.
504 */
505#define __NR__exit __NR_exit
506static inline _syscall0(int,pause)
507static inline _syscall0(int,sync)
508static inline _syscall0(pid_t,setsid)
509static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
510static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
511static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
512static inline _syscall1(int,dup,int,fd)
513static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
514static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
515static inline _syscall1(int,close,int,fd)
516static inline _syscall1(int,_exit,int,exitcode)
517static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
518static inline _syscall1(int,delete_module,const char *,name)
519
520static inline pid_t wait(int * wait_stat)
521{
522 return waitpid(-1,wait_stat,0);
523}
524
525asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
526 unsigned long prot, unsigned long flags,
527 unsigned long fd, unsigned long pgoff);
528asmlinkage int sys_execve(char *name, char **argv, char **envp,
529 int dummy, ...);
530asmlinkage int sys_pipe(unsigned long *fildes);
531struct sigaction;
532asmlinkage long sys_rt_sigaction(int sig,
533 const struct sigaction __user *act,
534 struct sigaction __user *oact,
535 size_t sigsetsize);
536
537#endif /* __KERNEL_SYSCALLS__ */
538
539/* 488/*
540 * "Conditional" syscalls 489 * "Conditional" syscalls
541 */ 490 */
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index 20f523954218..6016632d032f 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -131,21 +131,7 @@ static inline void disable_acpi(void)
131extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); 131extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
132 132
133#ifdef CONFIG_X86_IO_APIC 133#ifdef CONFIG_X86_IO_APIC
134extern int skip_ioapic_setup;
135extern int acpi_skip_timer_override; 134extern int acpi_skip_timer_override;
136
137static inline void disable_ioapic_setup(void)
138{
139 skip_ioapic_setup = 1;
140}
141
142static inline int ioapic_setup_disabled(void)
143{
144 return skip_ioapic_setup;
145}
146
147#else
148static inline void disable_ioapic_setup(void) { }
149#endif 135#endif
150 136
151static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 137static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
diff --git a/include/asm-i386/alternative-asm.i b/include/asm-i386/alternative-asm.i
new file mode 100644
index 000000000000..f0510209ccbe
--- /dev/null
+++ b/include/asm-i386/alternative-asm.i
@@ -0,0 +1,12 @@
1#ifdef CONFIG_SMP
2 .macro LOCK_PREFIX
31: lock
4 .section .smp_locks,"a"
5 .align 4
6 .long 1b
7 .previous
8 .endm
9#else
10 .macro LOCK_PREFIX
11 .endm
12#endif
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 2c1e371cebb6..3a42b7d6fc92 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -16,20 +16,8 @@
16#define APIC_VERBOSE 1 16#define APIC_VERBOSE 1
17#define APIC_DEBUG 2 17#define APIC_DEBUG 2
18 18
19extern int enable_local_apic;
20extern int apic_verbosity; 19extern int apic_verbosity;
21 20
22static inline void lapic_disable(void)
23{
24 enable_local_apic = -1;
25 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
26}
27
28static inline void lapic_enable(void)
29{
30 enable_local_apic = 1;
31}
32
33/* 21/*
34 * Define the default level of output to be very little 22 * Define the default level of output to be very little
35 * This can be turned up by using apic=verbose for more 23 * This can be turned up by using apic=verbose for more
@@ -42,6 +30,8 @@ static inline void lapic_enable(void)
42 } while (0) 30 } while (0)
43 31
44 32
33extern void generic_apic_probe(void);
34
45#ifdef CONFIG_X86_LOCAL_APIC 35#ifdef CONFIG_X86_LOCAL_APIC
46 36
47/* 37/*
@@ -117,8 +107,6 @@ extern void enable_APIC_timer(void);
117 107
118extern void enable_NMI_through_LVT0 (void * dummy); 108extern void enable_NMI_through_LVT0 (void * dummy);
119 109
120extern int disable_timer_pin_1;
121
122void smp_send_timer_broadcast_ipi(struct pt_regs *regs); 110void smp_send_timer_broadcast_ipi(struct pt_regs *regs);
123void switch_APIC_timer_to_ipi(void *cpumask); 111void switch_APIC_timer_to_ipi(void *cpumask);
124void switch_ipi_to_APIC_timer(void *cpumask); 112void switch_ipi_to_APIC_timer(void *cpumask);
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 2a9e4ee5904d..592ffeeda45e 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -189,6 +189,6 @@ static void __init check_bugs(void)
189 check_fpu(); 189 check_fpu();
190 check_hlt(); 190 check_hlt();
191 check_popad(); 191 check_popad();
192 system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); 192 init_utsname()->machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
193 alternative_instructions(); 193 alternative_instructions();
194} 194}
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 89b8b82c82b3..5874ef119ffd 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -33,50 +33,99 @@ static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
33 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; 33 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address;
34} 34}
35 35
36/*
37 * This is the ldt that every process will get unless we need
38 * something other than this.
39 */
40extern struct desc_struct default_ldt[];
41extern struct desc_struct idt_table[];
42extern void set_intr_gate(unsigned int irq, void * addr);
43
44static inline void pack_descriptor(__u32 *a, __u32 *b,
45 unsigned long base, unsigned long limit, unsigned char type, unsigned char flags)
46{
47 *a = ((base & 0xffff) << 16) | (limit & 0xffff);
48 *b = (base & 0xff000000) | ((base & 0xff0000) >> 16) |
49 (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20);
50}
51
52static inline void pack_gate(__u32 *a, __u32 *b,
53 unsigned long base, unsigned short seg, unsigned char type, unsigned char flags)
54{
55 *a = (seg << 16) | (base & 0xffff);
56 *b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff);
57}
58
59#define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */
60#define DESCTYPE_TSS 0x89 /* present, system, DPL-0, 32-bit TSS */
61#define DESCTYPE_TASK 0x85 /* present, system, DPL-0, task gate */
62#define DESCTYPE_INT 0x8e /* present, system, DPL-0, interrupt gate */
63#define DESCTYPE_TRAP 0x8f /* present, system, DPL-0, trap gate */
64#define DESCTYPE_DPL3 0x60 /* DPL-3 */
65#define DESCTYPE_S 0x10 /* !system */
66
36#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 67#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
37#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) 68#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
38 69
39#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) 70#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr))
40#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) 71#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr))
41#define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr)) 72#define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr))
42#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt)) 73#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt))
43 74
44#define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) 75#define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr))
45#define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) 76#define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr))
46#define store_tr(tr) __asm__ ("str %0":"=mr" (tr)) 77#define store_tr(tr) __asm__ ("str %0":"=m" (tr))
47#define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt)) 78#define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt))
48 79
49/* 80#if TLS_SIZE != 24
50 * This is the ldt that every process will get unless we need 81# error update this code.
51 * something other than this. 82#endif
52 */
53extern struct desc_struct default_ldt[];
54extern void set_intr_gate(unsigned int irq, void * addr);
55 83
56#define _set_tssldt_desc(n,addr,limit,type) \ 84static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
57__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
58 "movw %w1,2(%2)\n\t" \
59 "rorl $16,%1\n\t" \
60 "movb %b1,4(%2)\n\t" \
61 "movb %4,5(%2)\n\t" \
62 "movb $0,6(%2)\n\t" \
63 "movb %h1,7(%2)\n\t" \
64 "rorl $16,%1" \
65 : "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type))
66
67static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr)
68{ 85{
69 _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr, 86#define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]
70 offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); 87 C(0); C(1); C(2);
88#undef C
71} 89}
72 90
73#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) 91static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b)
92{
93 __u32 *lp = (__u32 *)((char *)dt + entry*8);
94 *lp = entry_a;
95 *(lp+1) = entry_b;
96}
97
98#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
99#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
100#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
101
102static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
103{
104 __u32 a, b;
105 pack_gate(&a, &b, (unsigned long)addr, seg, type, 0);
106 write_idt_entry(idt_table, gate, a, b);
107}
74 108
75static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) 109static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
76{ 110{
77 _set_tssldt_desc(&get_cpu_gdt_table(cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); 111 __u32 a, b;
112 pack_descriptor(&a, &b, (unsigned long)addr,
113 offsetof(struct tss_struct, __cacheline_filler) - 1,
114 DESCTYPE_TSS, 0);
115 write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b);
78} 116}
79 117
118static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entries)
119{
120 __u32 a, b;
121 pack_descriptor(&a, &b, (unsigned long)addr,
122 entries * sizeof(struct desc_struct) - 1,
123 DESCTYPE_LDT, 0);
124 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b);
125}
126
127#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
128
80#define LDT_entry_a(info) \ 129#define LDT_entry_a(info) \
81 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) 130 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
82 131
@@ -102,24 +151,6 @@ static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size)
102 (info)->seg_not_present == 1 && \ 151 (info)->seg_not_present == 1 && \
103 (info)->useable == 0 ) 152 (info)->useable == 0 )
104 153
105static inline void write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
106{
107 __u32 *lp = (__u32 *)((char *)ldt + entry*8);
108 *lp = entry_a;
109 *(lp+1) = entry_b;
110}
111
112#if TLS_SIZE != 24
113# error update this code.
114#endif
115
116static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
117{
118#define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]
119 C(0); C(1); C(2);
120#undef C
121}
122
123static inline void clear_LDT(void) 154static inline void clear_LDT(void)
124{ 155{
125 int cpu = get_cpu(); 156 int cpu = get_cpu();
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index 576ae01d71c8..81999a3ebe7c 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -21,7 +21,7 @@ static inline dma_addr_t
21dma_map_single(struct device *dev, void *ptr, size_t size, 21dma_map_single(struct device *dev, void *ptr, size_t size,
22 enum dma_data_direction direction) 22 enum dma_data_direction direction)
23{ 23{
24 BUG_ON(direction == DMA_NONE); 24 BUG_ON(!valid_dma_direction(direction));
25 WARN_ON(size == 0); 25 WARN_ON(size == 0);
26 flush_write_buffers(); 26 flush_write_buffers();
27 return virt_to_phys(ptr); 27 return virt_to_phys(ptr);
@@ -31,7 +31,7 @@ static inline void
31dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 31dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
32 enum dma_data_direction direction) 32 enum dma_data_direction direction)
33{ 33{
34 BUG_ON(direction == DMA_NONE); 34 BUG_ON(!valid_dma_direction(direction));
35} 35}
36 36
37static inline int 37static inline int
@@ -40,7 +40,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
40{ 40{
41 int i; 41 int i;
42 42
43 BUG_ON(direction == DMA_NONE); 43 BUG_ON(!valid_dma_direction(direction));
44 WARN_ON(nents == 0 || sg[0].length == 0); 44 WARN_ON(nents == 0 || sg[0].length == 0);
45 45
46 for (i = 0; i < nents; i++ ) { 46 for (i = 0; i < nents; i++ ) {
@@ -57,7 +57,7 @@ static inline dma_addr_t
57dma_map_page(struct device *dev, struct page *page, unsigned long offset, 57dma_map_page(struct device *dev, struct page *page, unsigned long offset,
58 size_t size, enum dma_data_direction direction) 58 size_t size, enum dma_data_direction direction)
59{ 59{
60 BUG_ON(direction == DMA_NONE); 60 BUG_ON(!valid_dma_direction(direction));
61 return page_to_phys(page) + offset; 61 return page_to_phys(page) + offset;
62} 62}
63 63
@@ -65,7 +65,7 @@ static inline void
65dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, 65dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
66 enum dma_data_direction direction) 66 enum dma_data_direction direction)
67{ 67{
68 BUG_ON(direction == DMA_NONE); 68 BUG_ON(!valid_dma_direction(direction));
69} 69}
70 70
71 71
@@ -73,7 +73,7 @@ static inline void
73dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 73dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
74 enum dma_data_direction direction) 74 enum dma_data_direction direction)
75{ 75{
76 BUG_ON(direction == DMA_NONE); 76 BUG_ON(!valid_dma_direction(direction));
77} 77}
78 78
79static inline void 79static inline void
diff --git a/include/asm-i386/dwarf2.h b/include/asm-i386/dwarf2.h
index 2280f6272f80..6d66398a307d 100644
--- a/include/asm-i386/dwarf2.h
+++ b/include/asm-i386/dwarf2.h
@@ -1,8 +1,6 @@
1#ifndef _DWARF2_H 1#ifndef _DWARF2_H
2#define _DWARF2_H 2#define _DWARF2_H
3 3
4#include <linux/config.h>
5
6#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
7#warning "asm/dwarf2.h should be only included in pure assembly files" 5#warning "asm/dwarf2.h should be only included in pure assembly files"
8#endif 6#endif
@@ -28,6 +26,13 @@
28#define CFI_RESTORE .cfi_restore 26#define CFI_RESTORE .cfi_restore
29#define CFI_REMEMBER_STATE .cfi_remember_state 27#define CFI_REMEMBER_STATE .cfi_remember_state
30#define CFI_RESTORE_STATE .cfi_restore_state 28#define CFI_RESTORE_STATE .cfi_restore_state
29#define CFI_UNDEFINED .cfi_undefined
30
31#ifdef CONFIG_AS_CFI_SIGNAL_FRAME
32#define CFI_SIGNAL_FRAME .cfi_signal_frame
33#else
34#define CFI_SIGNAL_FRAME
35#endif
31 36
32#else 37#else
33 38
@@ -48,6 +53,8 @@
48#define CFI_RESTORE ignore 53#define CFI_RESTORE ignore
49#define CFI_REMEMBER_STATE ignore 54#define CFI_REMEMBER_STATE ignore
50#define CFI_RESTORE_STATE ignore 55#define CFI_RESTORE_STATE ignore
56#define CFI_UNDEFINED ignore
57#define CFI_SIGNAL_FRAME ignore
51 58
52#endif 59#endif
53 60
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index ca82acb8cb1f..f7514fb6e8e4 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -18,7 +18,7 @@
18 18
19#define E820_RAM 1 19#define E820_RAM 1
20#define E820_RESERVED 2 20#define E820_RESERVED 2
21#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ 21#define E820_ACPI 3
22#define E820_NVS 4 22#define E820_NVS 4
23 23
24#define HIGH_MEMORY (1024*1024) 24#define HIGH_MEMORY (1024*1024)
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index db4344d9f73f..3a05436f31c0 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -112,7 +112,7 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
112 For the moment, we have only optimizations for the Intel generations, 112 For the moment, we have only optimizations for the Intel generations,
113 but that could change... */ 113 but that could change... */
114 114
115#define ELF_PLATFORM (system_utsname.machine) 115#define ELF_PLATFORM (utsname()->machine)
116 116
117#define SET_PERSONALITY(ex, ibcs2) do { } while (0) 117#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
118 118
diff --git a/include/asm-i386/frame.i b/include/asm-i386/frame.i
new file mode 100644
index 000000000000..03620251ae17
--- /dev/null
+++ b/include/asm-i386/frame.i
@@ -0,0 +1,23 @@
1#include <asm/dwarf2.h>
2
3/* The annotation hides the frame from the unwinder and makes it look
4 like a ordinary ebp save/restore. This avoids some special cases for
5 frame pointer later */
6#ifdef CONFIG_FRAME_POINTER
7 .macro FRAME
8 pushl %ebp
9 CFI_ADJUST_CFA_OFFSET 4
10 CFI_REL_OFFSET ebp,0
11 movl %esp,%ebp
12 .endm
13 .macro ENDFRAME
14 popl %ebp
15 CFI_ADJUST_CFA_OFFSET -4
16 CFI_RESTORE ebp
17 .endm
18#else
19 .macro FRAME
20 .endm
21 .macro ENDFRAME
22 .endm
23#endif
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h
index b3783a32abee..8ffbb0f07457 100644
--- a/include/asm-i386/genapic.h
+++ b/include/asm-i386/genapic.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_GENAPIC_H 1#ifndef _ASM_GENAPIC_H
2#define _ASM_GENAPIC_H 1 2#define _ASM_GENAPIC_H 1
3 3
4#include <asm/mpspec.h>
5
4/* 6/*
5 * Generic APIC driver interface. 7 * Generic APIC driver interface.
6 * 8 *
@@ -63,14 +65,25 @@ struct genapic {
63 unsigned (*get_apic_id)(unsigned long x); 65 unsigned (*get_apic_id)(unsigned long x);
64 unsigned long apic_id_mask; 66 unsigned long apic_id_mask;
65 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); 67 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
66 68
69#ifdef CONFIG_SMP
67 /* ipi */ 70 /* ipi */
68 void (*send_IPI_mask)(cpumask_t mask, int vector); 71 void (*send_IPI_mask)(cpumask_t mask, int vector);
69 void (*send_IPI_allbutself)(int vector); 72 void (*send_IPI_allbutself)(int vector);
70 void (*send_IPI_all)(int vector); 73 void (*send_IPI_all)(int vector);
74#endif
71}; 75};
72 76
73#define APICFUNC(x) .x = x 77#define APICFUNC(x) .x = x,
78
79/* More functions could be probably marked IPIFUNC and save some space
80 in UP GENERICARCH kernels, but I don't have the nerve right now
81 to untangle this mess. -AK */
82#ifdef CONFIG_SMP
83#define IPIFUNC(x) APICFUNC(x)
84#else
85#define IPIFUNC(x)
86#endif
74 87
75#define APIC_INIT(aname, aprobe) { \ 88#define APIC_INIT(aname, aprobe) { \
76 .name = aname, \ 89 .name = aname, \
@@ -80,33 +93,33 @@ struct genapic {
80 .no_balance_irq = NO_BALANCE_IRQ, \ 93 .no_balance_irq = NO_BALANCE_IRQ, \
81 .ESR_DISABLE = esr_disable, \ 94 .ESR_DISABLE = esr_disable, \
82 .apic_destination_logical = APIC_DEST_LOGICAL, \ 95 .apic_destination_logical = APIC_DEST_LOGICAL, \
83 APICFUNC(apic_id_registered), \ 96 APICFUNC(apic_id_registered) \
84 APICFUNC(target_cpus), \ 97 APICFUNC(target_cpus) \
85 APICFUNC(check_apicid_used), \ 98 APICFUNC(check_apicid_used) \
86 APICFUNC(check_apicid_present), \ 99 APICFUNC(check_apicid_present) \
87 APICFUNC(init_apic_ldr), \ 100 APICFUNC(init_apic_ldr) \
88 APICFUNC(ioapic_phys_id_map), \ 101 APICFUNC(ioapic_phys_id_map) \
89 APICFUNC(clustered_apic_check), \ 102 APICFUNC(clustered_apic_check) \
90 APICFUNC(multi_timer_check), \ 103 APICFUNC(multi_timer_check) \
91 APICFUNC(apicid_to_node), \ 104 APICFUNC(apicid_to_node) \
92 APICFUNC(cpu_to_logical_apicid), \ 105 APICFUNC(cpu_to_logical_apicid) \
93 APICFUNC(cpu_present_to_apicid), \ 106 APICFUNC(cpu_present_to_apicid) \
94 APICFUNC(apicid_to_cpu_present), \ 107 APICFUNC(apicid_to_cpu_present) \
95 APICFUNC(mpc_apic_id), \ 108 APICFUNC(mpc_apic_id) \
96 APICFUNC(setup_portio_remap), \ 109 APICFUNC(setup_portio_remap) \
97 APICFUNC(check_phys_apicid_present), \ 110 APICFUNC(check_phys_apicid_present) \
98 APICFUNC(mpc_oem_bus_info), \ 111 APICFUNC(mpc_oem_bus_info) \
99 APICFUNC(mpc_oem_pci_bus), \ 112 APICFUNC(mpc_oem_pci_bus) \
100 APICFUNC(mps_oem_check), \ 113 APICFUNC(mps_oem_check) \
101 APICFUNC(get_apic_id), \ 114 APICFUNC(get_apic_id) \
102 .apic_id_mask = APIC_ID_MASK, \ 115 .apic_id_mask = APIC_ID_MASK, \
103 APICFUNC(cpu_mask_to_apicid), \ 116 APICFUNC(cpu_mask_to_apicid) \
104 APICFUNC(acpi_madt_oem_check), \ 117 APICFUNC(acpi_madt_oem_check) \
105 APICFUNC(send_IPI_mask), \ 118 IPIFUNC(send_IPI_mask) \
106 APICFUNC(send_IPI_allbutself), \ 119 IPIFUNC(send_IPI_allbutself) \
107 APICFUNC(send_IPI_all), \ 120 IPIFUNC(send_IPI_all) \
108 APICFUNC(enable_apic_mode), \ 121 APICFUNC(enable_apic_mode) \
109 APICFUNC(phys_pkg_id), \ 122 APICFUNC(phys_pkg_id) \
110 } 123 }
111 124
112extern struct genapic *genapic; 125extern struct genapic *genapic;
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
index 87e5a351d881..88f02a073561 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -17,8 +17,6 @@
17#include <asm/irq.h> 17#include <asm/irq.h>
18#include <asm/sections.h> 18#include <asm/sections.h>
19 19
20struct hw_interrupt_type;
21
22#define NMI_VECTOR 0x02 20#define NMI_VECTOR 0x02
23 21
24/* 22/*
@@ -30,7 +28,6 @@ struct hw_interrupt_type;
30 28
31extern u8 irq_vector[NR_IRQ_VECTORS]; 29extern u8 irq_vector[NR_IRQ_VECTORS];
32#define IO_APIC_VECTOR(irq) (irq_vector[irq]) 30#define IO_APIC_VECTOR(irq) (irq_vector[irq])
33#define AUTO_ASSIGN -1
34 31
35extern void (*interrupt[NR_IRQS])(void); 32extern void (*interrupt[NR_IRQS])(void);
36 33
diff --git a/include/asm-i386/hypertransport.h b/include/asm-i386/hypertransport.h
new file mode 100644
index 000000000000..c16c6ff4bdd7
--- /dev/null
+++ b/include/asm-i386/hypertransport.h
@@ -0,0 +1,42 @@
1#ifndef ASM_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-i386/intel_arch_perfmon.h b/include/asm-i386/intel_arch_perfmon.h
index 134ea9cc5283..b52cd60a075b 100644
--- a/include/asm-i386/intel_arch_perfmon.h
+++ b/include/asm-i386/intel_arch_perfmon.h
@@ -14,6 +14,18 @@
14 14
15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) 15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c)
16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) 16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
17#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) 17#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0)
18#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
19 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
20
21union cpuid10_eax {
22 struct {
23 unsigned int version_id:8;
24 unsigned int num_counters:8;
25 unsigned int bit_width:8;
26 unsigned int mask_length:8;
27 } split;
28 unsigned int full;
29};
18 30
19#endif /* X86_INTEL_ARCH_PERFMON_H */ 31#endif /* X86_INTEL_ARCH_PERFMON_H */
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 5092e819b8a2..276ea7e8144a 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -12,46 +12,6 @@
12 12
13#ifdef CONFIG_X86_IO_APIC 13#ifdef CONFIG_X86_IO_APIC
14 14
15#ifdef CONFIG_PCI_MSI
16static inline int use_pci_vector(void) {return 1;}
17static inline void disable_edge_ioapic_vector(unsigned int vector) { }
18static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { }
19static inline void end_edge_ioapic_vector (unsigned int vector) { }
20#define startup_level_ioapic startup_level_ioapic_vector
21#define shutdown_level_ioapic mask_IO_APIC_vector
22#define enable_level_ioapic unmask_IO_APIC_vector
23#define disable_level_ioapic mask_IO_APIC_vector
24#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_vector
25#define end_level_ioapic end_level_ioapic_vector
26#define set_ioapic_affinity set_ioapic_affinity_vector
27
28#define startup_edge_ioapic startup_edge_ioapic_vector
29#define shutdown_edge_ioapic disable_edge_ioapic_vector
30#define enable_edge_ioapic unmask_IO_APIC_vector
31#define disable_edge_ioapic disable_edge_ioapic_vector
32#define ack_edge_ioapic ack_edge_ioapic_vector
33#define end_edge_ioapic end_edge_ioapic_vector
34#else
35static inline int use_pci_vector(void) {return 0;}
36static inline void disable_edge_ioapic_irq(unsigned int irq) { }
37static inline void mask_and_ack_level_ioapic_irq(unsigned int irq) { }
38static inline void end_edge_ioapic_irq (unsigned int irq) { }
39#define startup_level_ioapic startup_level_ioapic_irq
40#define shutdown_level_ioapic mask_IO_APIC_irq
41#define enable_level_ioapic unmask_IO_APIC_irq
42#define disable_level_ioapic mask_IO_APIC_irq
43#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_irq
44#define end_level_ioapic end_level_ioapic_irq
45#define set_ioapic_affinity set_ioapic_affinity_irq
46
47#define startup_edge_ioapic startup_edge_ioapic_irq
48#define shutdown_edge_ioapic disable_edge_ioapic_irq
49#define enable_edge_ioapic unmask_IO_APIC_irq
50#define disable_edge_ioapic disable_edge_ioapic_irq
51#define ack_edge_ioapic ack_edge_ioapic_irq
52#define end_edge_ioapic end_edge_ioapic_irq
53#endif
54
55#define IO_APIC_BASE(idx) \ 15#define IO_APIC_BASE(idx) \
56 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \ 16 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
57 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK))) 17 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
@@ -188,6 +148,16 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
188/* 1 if "noapic" boot option passed */ 148/* 1 if "noapic" boot option passed */
189extern int skip_ioapic_setup; 149extern int skip_ioapic_setup;
190 150
151static inline void disable_ioapic_setup(void)
152{
153 skip_ioapic_setup = 1;
154}
155
156static inline int ioapic_setup_disabled(void)
157{
158 return skip_ioapic_setup;
159}
160
191/* 161/*
192 * If we use the IO-APIC for IRQ routing, disable automatic 162 * If we use the IO-APIC for IRQ routing, disable automatic
193 * assignment of PCI IRQ's. 163 * assignment of PCI IRQ's.
@@ -206,8 +176,7 @@ extern int (*ioapic_renumber_irq)(int ioapic, int irq);
206 176
207#else /* !CONFIG_X86_IO_APIC */ 177#else /* !CONFIG_X86_IO_APIC */
208#define io_apic_assign_pci_irqs 0 178#define io_apic_assign_pci_irqs 0
179static inline void disable_ioapic_setup(void) { }
209#endif 180#endif
210 181
211extern int assign_irq_vector(int irq);
212
213#endif 182#endif
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h
index 53f0e06672dc..4dfc9f5ed031 100644
--- a/include/asm-i386/kexec.h
+++ b/include/asm-i386/kexec.h
@@ -1,6 +1,26 @@
1#ifndef _I386_KEXEC_H 1#ifndef _I386_KEXEC_H
2#define _I386_KEXEC_H 2#define _I386_KEXEC_H
3 3
4#define PA_CONTROL_PAGE 0
5#define VA_CONTROL_PAGE 1
6#define PA_PGD 2
7#define VA_PGD 3
8#define PA_PTE_0 4
9#define VA_PTE_0 5
10#define PA_PTE_1 6
11#define VA_PTE_1 7
12#ifdef CONFIG_X86_PAE
13#define PA_PMD_0 8
14#define VA_PMD_0 9
15#define PA_PMD_1 10
16#define VA_PMD_1 11
17#define PAGES_NR 12
18#else
19#define PAGES_NR 8
20#endif
21
22#ifndef __ASSEMBLY__
23
4#include <asm/fixmap.h> 24#include <asm/fixmap.h>
5#include <asm/ptrace.h> 25#include <asm/ptrace.h>
6#include <asm/string.h> 26#include <asm/string.h>
@@ -72,5 +92,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
72 newregs->eip = (unsigned long)current_text_addr(); 92 newregs->eip = (unsigned long)current_text_addr();
73 } 93 }
74} 94}
95asmlinkage NORET_TYPE void
96relocate_kernel(unsigned long indirection_page,
97 unsigned long control_page,
98 unsigned long start_address,
99 unsigned int has_pae) ATTRIB_NORET;
100
101#endif /* __ASSEMBLY__ */
75 102
76#endif /* _I386_KEXEC_H */ 103#endif /* _I386_KEXEC_H */
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 6312c3e79814..4182c347ef85 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -16,7 +16,7 @@
16 16
17static inline void do_timer_interrupt_hook(struct pt_regs *regs) 17static inline void do_timer_interrupt_hook(struct pt_regs *regs)
18{ 18{
19 do_timer(regs); 19 do_timer(1);
20#ifndef CONFIG_SMP 20#ifndef CONFIG_SMP
21 update_process_times(user_mode_vm(regs)); 21 update_process_times(user_mode_vm(regs));
22#endif 22#endif
diff --git a/include/asm-i386/mach-default/irq_vectors_limits.h b/include/asm-i386/mach-default/irq_vectors_limits.h
index b330026e6f7f..7f161e760be6 100644
--- a/include/asm-i386/mach-default/irq_vectors_limits.h
+++ b/include/asm-i386/mach-default/irq_vectors_limits.h
@@ -1,10 +1,6 @@
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_PCI_MSI
5#define NR_IRQS FIRST_SYSTEM_VECTOR
6#define NR_IRQ_VECTORS NR_IRQS
7#else
8#ifdef CONFIG_X86_IO_APIC 4#ifdef CONFIG_X86_IO_APIC
9#define NR_IRQS 224 5#define NR_IRQS 224
10# if (224 >= 32 * NR_CPUS) 6# if (224 >= 32 * NR_CPUS)
@@ -16,6 +12,5 @@
16#define NR_IRQS 16 12#define NR_IRQS 16
17#define NR_IRQ_VECTORS NR_IRQS 13#define NR_IRQ_VECTORS NR_IRQS
18#endif 14#endif
19#endif
20 15
21#endif /* _ASM_IRQ_VECTORS_LIMITS_H */ 16#endif /* _ASM_IRQ_VECTORS_LIMITS_H */
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h
index b5f3f0d0b2bc..26333685a7fb 100644
--- a/include/asm-i386/mach-es7000/mach_apic.h
+++ b/include/asm-i386/mach-es7000/mach_apic.h
@@ -123,9 +123,13 @@ extern u8 cpu_2_logical_apicid[];
123/* Mapping from cpu number to logical apicid */ 123/* Mapping from cpu number to logical apicid */
124static inline int cpu_to_logical_apicid(int cpu) 124static inline int cpu_to_logical_apicid(int cpu)
125{ 125{
126#ifdef CONFIG_SMP
126 if (cpu >= NR_CPUS) 127 if (cpu >= NR_CPUS)
127 return BAD_APICID; 128 return BAD_APICID;
128 return (int)cpu_2_logical_apicid[cpu]; 129 return (int)cpu_2_logical_apicid[cpu];
130#else
131 return logical_smp_processor_id();
132#endif
129} 133}
130 134
131static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused) 135static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused)
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h
index 9fd073286289..ef0671e5d5c5 100644
--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -46,10 +46,12 @@ extern u8 cpu_2_logical_apicid[];
46static inline void init_apic_ldr(void) 46static inline void init_apic_ldr(void)
47{ 47{
48 unsigned long val, id; 48 unsigned long val, id;
49 int i, count; 49 int count = 0;
50 u8 lid;
51 u8 my_id = (u8)hard_smp_processor_id(); 50 u8 my_id = (u8)hard_smp_processor_id();
52 u8 my_cluster = (u8)apicid_cluster(my_id); 51 u8 my_cluster = (u8)apicid_cluster(my_id);
52#ifdef CONFIG_SMP
53 u8 lid;
54 int i;
53 55
54 /* Create logical APIC IDs by counting CPUs already in cluster. */ 56 /* Create logical APIC IDs by counting CPUs already in cluster. */
55 for (count = 0, i = NR_CPUS; --i >= 0; ) { 57 for (count = 0, i = NR_CPUS; --i >= 0; ) {
@@ -57,6 +59,7 @@ static inline void init_apic_ldr(void)
57 if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) 59 if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster)
58 ++count; 60 ++count;
59 } 61 }
62#endif
60 /* We only have a 4 wide bitmap in cluster mode. If a deranged 63 /* We only have a 4 wide bitmap in cluster mode. If a deranged
61 * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ 64 * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */
62 BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); 65 BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT);
@@ -85,15 +88,19 @@ static inline void clustered_apic_check(void)
85 88
86static inline int apicid_to_node(int logical_apicid) 89static inline int apicid_to_node(int logical_apicid)
87{ 90{
88 return logical_apicid >> 5; /* 2 clusterids per CEC */ 91 return apicid_2_node[hard_smp_processor_id()];
89} 92}
90 93
91/* Mapping from cpu number to logical apicid */ 94/* Mapping from cpu number to logical apicid */
92static inline int cpu_to_logical_apicid(int cpu) 95static inline int cpu_to_logical_apicid(int cpu)
93{ 96{
97#ifdef CONFIG_SMP
94 if (cpu >= NR_CPUS) 98 if (cpu >= NR_CPUS)
95 return BAD_APICID; 99 return BAD_APICID;
96 return (int)cpu_2_logical_apicid[cpu]; 100 return (int)cpu_2_logical_apicid[cpu];
101#else
102 return logical_smp_processor_id();
103#endif
97} 104}
98 105
99static inline int cpu_present_to_apicid(int mps_cpu) 106static inline int cpu_present_to_apicid(int mps_cpu)
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 95568e6ca91c..8db618c5a72b 100644
--- a/include/asm-i386/mach-visws/do_timer.h
+++ b/include/asm-i386/mach-visws/do_timer.h
@@ -9,7 +9,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
9 /* Clear the interrupt */ 9 /* Clear the interrupt */
10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR); 10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
11 11
12 do_timer(regs); 12 do_timer(1);
13#ifndef CONFIG_SMP 13#ifndef CONFIG_SMP
14 update_process_times(user_mode_vm(regs)); 14 update_process_times(user_mode_vm(regs));
15#endif 15#endif
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index eaf518098981..099fe9f5c1b2 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -3,7 +3,7 @@
3 3
4static inline void do_timer_interrupt_hook(struct pt_regs *regs) 4static inline void do_timer_interrupt_hook(struct pt_regs *regs)
5{ 5{
6 do_timer(regs); 6 do_timer(1);
7#ifndef CONFIG_SMP 7#ifndef CONFIG_SMP
8 update_process_times(user_mode_vm(regs)); 8 update_process_times(user_mode_vm(regs));
9#endif 9#endif
diff --git a/include/asm-i386/mca_dma.h b/include/asm-i386/mca_dma.h
index 4b3b526c5a3f..fbb1f3b71279 100644
--- a/include/asm-i386/mca_dma.h
+++ b/include/asm-i386/mca_dma.h
@@ -181,7 +181,7 @@ static __inline__ void mca_set_dma_io(unsigned int dmanr, unsigned int io_addr)
181 * @mode: mode to set 181 * @mode: mode to set
182 * 182 *
183 * The DMA controller supports several modes. The mode values you can 183 * The DMA controller supports several modes. The mode values you can
184 * set are : 184 * set are-
185 * 185 *
186 * %MCA_DMA_MODE_READ when reading from the DMA device. 186 * %MCA_DMA_MODE_READ when reading from the DMA device.
187 * 187 *
@@ -190,7 +190,6 @@ static __inline__ void mca_set_dma_io(unsigned int dmanr, unsigned int io_addr)
190 * %MCA_DMA_MODE_IO to do DMA to or from an I/O port. 190 * %MCA_DMA_MODE_IO to do DMA to or from an I/O port.
191 * 191 *
192 * %MCA_DMA_MODE_16 to do 16bit transfers. 192 * %MCA_DMA_MODE_16 to do 16bit transfers.
193 *
194 */ 193 */
195 194
196static __inline__ void mca_set_dma_mode(unsigned int dmanr, unsigned int mode) 195static __inline__ void mca_set_dma_mode(unsigned int dmanr, unsigned int mode)
diff --git a/include/asm-i386/msi.h b/include/asm-i386/msi.h
deleted file mode 100644
index b11c4b7dfaef..000000000000
--- a/include/asm-i386/msi.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2003-2004 Intel
3 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
4 */
5
6#ifndef ASM_MSI_H
7#define ASM_MSI_H
8
9#include <asm/desc.h>
10#include <mach_apic.h>
11
12#define LAST_DEVICE_VECTOR (FIRST_SYSTEM_VECTOR - 1)
13#define MSI_TARGET_CPU_SHIFT 12
14
15extern struct msi_ops msi_apic_ops;
16
17static inline int msi_arch_init(void)
18{
19 msi_register(&msi_apic_ops);
20 return 0;
21}
22
23#endif /* ASM_MSI_H */
diff --git a/include/asm-i386/msidef.h b/include/asm-i386/msidef.h
new file mode 100644
index 000000000000..5b8acddb70fb
--- /dev/null
+++ b/include/asm-i386/msidef.h
@@ -0,0 +1,47 @@
1#ifndef ASM_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-i386/mutex.h b/include/asm-i386/mutex.h
index 05a538531229..7a17d9e58ad6 100644
--- a/include/asm-i386/mutex.h
+++ b/include/asm-i386/mutex.h
@@ -30,14 +30,10 @@ do { \
30 \ 30 \
31 __asm__ __volatile__( \ 31 __asm__ __volatile__( \
32 LOCK_PREFIX " decl (%%eax) \n" \ 32 LOCK_PREFIX " decl (%%eax) \n" \
33 " js 2f \n" \ 33 " jns 1f \n" \
34 " call "#fail_fn" \n" \
34 "1: \n" \ 35 "1: \n" \
35 \ 36 \
36 LOCK_SECTION_START("") \
37 "2: call "#fail_fn" \n" \
38 " jmp 1b \n" \
39 LOCK_SECTION_END \
40 \
41 :"=a" (dummy) \ 37 :"=a" (dummy) \
42 : "a" (count) \ 38 : "a" (count) \
43 : "memory", "ecx", "edx"); \ 39 : "memory", "ecx", "edx"); \
@@ -86,14 +82,10 @@ do { \
86 \ 82 \
87 __asm__ __volatile__( \ 83 __asm__ __volatile__( \
88 LOCK_PREFIX " incl (%%eax) \n" \ 84 LOCK_PREFIX " incl (%%eax) \n" \
89 " jle 2f \n" \ 85 " jg 1f \n" \
86 " call "#fail_fn" \n" \
90 "1: \n" \ 87 "1: \n" \
91 \ 88 \
92 LOCK_SECTION_START("") \
93 "2: call "#fail_fn" \n" \
94 " jmp 1b \n" \
95 LOCK_SECTION_END \
96 \
97 :"=a" (dummy) \ 89 :"=a" (dummy) \
98 : "a" (count) \ 90 : "a" (count) \
99 : "memory", "ecx", "edx"); \ 91 : "memory", "ecx", "edx"); \
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h
index 67d994799999..269d315719ca 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -6,32 +6,29 @@
6 6
7#include <linux/pm.h> 7#include <linux/pm.h>
8 8
9struct pt_regs;
10
11typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu);
12
13/**
14 * set_nmi_callback
15 *
16 * Set a handler for an NMI. Only one handler may be
17 * set. Return 1 if the NMI was handled.
18 */
19void set_nmi_callback(nmi_callback_t callback);
20
21/** 9/**
22 * unset_nmi_callback 10 * do_nmi_callback
23 * 11 *
24 * Remove the handler previously set. 12 * Check to see if a callback exists and execute it. Return 1
13 * if the handler exists and was handled successfully.
25 */ 14 */
26void unset_nmi_callback(void); 15int do_nmi_callback(struct pt_regs *regs, int cpu);
27 16
28extern void setup_apic_nmi_watchdog (void); 17extern int nmi_watchdog_enabled;
29extern int reserve_lapic_nmi(void); 18extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
30extern void release_lapic_nmi(void); 19extern int avail_to_resrv_perfctr_nmi(unsigned int);
20extern int reserve_perfctr_nmi(unsigned int);
21extern void release_perfctr_nmi(unsigned int);
22extern int reserve_evntsel_nmi(unsigned int);
23extern void release_evntsel_nmi(unsigned int);
24
25extern void setup_apic_nmi_watchdog (void *);
26extern void stop_apic_nmi_watchdog (void *);
31extern void disable_timer_nmi_watchdog(void); 27extern void disable_timer_nmi_watchdog(void);
32extern void enable_timer_nmi_watchdog(void); 28extern void enable_timer_nmi_watchdog(void);
33extern void nmi_watchdog_tick (struct pt_regs * regs); 29extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
34 30
31extern atomic_t nmi_active;
35extern unsigned int nmi_watchdog; 32extern unsigned int nmi_watchdog;
36#define NMI_DEFAULT -1 33#define NMI_DEFAULT -1
37#define NMI_NONE 0 34#define NMI_NONE 0
@@ -39,4 +36,10 @@ extern unsigned int nmi_watchdog;
39#define NMI_LOCAL_APIC 2 36#define NMI_LOCAL_APIC 2
40#define NMI_INVALID 3 37#define NMI_INVALID 3
41 38
39struct ctl_table;
40struct file;
41extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
42 void __user *, size_t *, loff_t *);
43extern int unknown_nmi_panic;
44
42#endif /* ASM_NMI_H */ 45#endif /* ASM_NMI_H */
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index 201c86a6711e..8d8d3b9ecdb0 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -16,6 +16,7 @@
16#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 16#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
17#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 17#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
18#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval) 18#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
19#define set_pte_present(mm,addr,ptep,pteval) set_pte_at(mm,addr,ptep,pteval)
19#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) 20#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
20 21
21#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 22#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index 0d899173232e..c2d701ea35be 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -58,7 +58,21 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
58} 58}
59#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 59#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
60 60
61#define __HAVE_ARCH_SET_PTE_ATOMIC 61/*
62 * Since this is only called on user PTEs, and the page fault handler
63 * must handle the already racy situation of simultaneous page faults,
64 * we are justified in merely clearing the PTE present bit, followed
65 * by a set. The ordering here is important.
66 */
67static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
68{
69 ptep->pte_low = 0;
70 smp_wmb();
71 ptep->pte_high = pte.pte_high;
72 smp_wmb();
73 ptep->pte_low = pte.pte_low;
74}
75
62#define set_pte_atomic(pteptr,pteval) \ 76#define set_pte_atomic(pteptr,pteval) \
63 set_64bit((unsigned long long *)(pteptr),pte_val(pteval)) 77 set_64bit((unsigned long long *)(pteptr),pte_val(pteval))
64#define set_pmd(pmdptr,pmdval) \ 78#define set_pmd(pmdptr,pmdval) \
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 0dc051a8078b..7d398f493dde 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -247,6 +247,23 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
247#endif 247#endif
248 248
249/* 249/*
250 * Rules for using pte_update - it must be called after any PTE update which
251 * has not been done using the set_pte / clear_pte interfaces. It is used by
252 * shadow mode hypervisors to resynchronize the shadow page tables. Kernel PTE
253 * updates should either be sets, clears, or set_pte_atomic for P->P
254 * transitions, which means this hook should only be called for user PTEs.
255 * This hook implies a P->P protection or access change has taken place, which
256 * requires a subsequent TLB flush. The notification can optionally be delayed
257 * until the TLB flush event by using the pte_update_defer form of the
258 * interface, but care must be taken to assure that the flush happens while
259 * still holding the same page table lock so that the shadow and primary pages
260 * do not become out of sync on SMP.
261 */
262#define pte_update(mm, addr, ptep) do { } while (0)
263#define pte_update_defer(mm, addr, ptep) do { } while (0)
264
265
266/*
250 * We only update the dirty/accessed state if we set 267 * We only update the dirty/accessed state if we set
251 * the dirty bit by hand in the kernel, since the hardware 268 * the dirty bit by hand in the kernel, since the hardware
252 * will do the accessed bit for us, and we don't want to 269 * will do the accessed bit for us, and we don't want to
@@ -258,25 +275,54 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
258do { \ 275do { \
259 if (dirty) { \ 276 if (dirty) { \
260 (ptep)->pte_low = (entry).pte_low; \ 277 (ptep)->pte_low = (entry).pte_low; \
278 pte_update_defer((vma)->vm_mm, (addr), (ptep)); \
261 flush_tlb_page(vma, address); \ 279 flush_tlb_page(vma, address); \
262 } \ 280 } \
263} while (0) 281} while (0)
264 282
283/*
284 * We don't actually have these, but we want to advertise them so that
285 * we can encompass the flush here.
286 */
265#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 287#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
266static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
267{
268 if (!pte_dirty(*ptep))
269 return 0;
270 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low);
271}
272
273#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 288#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
274static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 289
275{ 290/*
276 if (!pte_young(*ptep)) 291 * Rules for using ptep_establish: the pte MUST be a user pte, and
277 return 0; 292 * must be a present->present transition.
278 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); 293 */
279} 294#define __HAVE_ARCH_PTEP_ESTABLISH
295#define ptep_establish(vma, address, ptep, pteval) \
296do { \
297 set_pte_present((vma)->vm_mm, address, ptep, pteval); \
298 flush_tlb_page(vma, address); \
299} while (0)
300
301#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
302#define ptep_clear_flush_dirty(vma, address, ptep) \
303({ \
304 int __dirty; \
305 __dirty = pte_dirty(*(ptep)); \
306 if (__dirty) { \
307 clear_bit(_PAGE_BIT_DIRTY, &(ptep)->pte_low); \
308 pte_update_defer((vma)->vm_mm, (addr), (ptep)); \
309 flush_tlb_page(vma, address); \
310 } \
311 __dirty; \
312})
313
314#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
315#define ptep_clear_flush_young(vma, address, ptep) \
316({ \
317 int __young; \
318 __young = pte_young(*(ptep)); \
319 if (__young) { \
320 clear_bit(_PAGE_BIT_ACCESSED, &(ptep)->pte_low); \
321 pte_update_defer((vma)->vm_mm, (addr), (ptep)); \
322 flush_tlb_page(vma, address); \
323 } \
324 __young; \
325})
280 326
281#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL 327#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
282static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) 328static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
@@ -295,6 +341,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
295static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 341static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
296{ 342{
297 clear_bit(_PAGE_BIT_RW, &ptep->pte_low); 343 clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
344 pte_update(mm, addr, ptep);
298} 345}
299 346
300/* 347/*
@@ -411,8 +458,6 @@ extern pte_t *lookup_address(unsigned long address);
411 static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} 458 static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;}
412#endif 459#endif
413 460
414extern void noexec_setup(const char *str);
415
416#if defined(CONFIG_HIGHPTE) 461#if defined(CONFIG_HIGHPTE)
417#define pte_offset_map(dir, address) \ 462#define pte_offset_map(dir, address) \
418 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) 463 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
@@ -428,6 +473,13 @@ extern void noexec_setup(const char *str);
428#define pte_unmap_nested(pte) do { } while (0) 473#define pte_unmap_nested(pte) do { } while (0)
429#endif 474#endif
430 475
476/* Clear a kernel PTE and flush it from the TLB */
477#define kpte_clear_flush(ptep, vaddr) \
478do { \
479 pte_clear(&init_mm, vaddr, ptep); \
480 __flush_tlb_one(vaddr); \
481} while (0)
482
431/* 483/*
432 * The i386 doesn't have any external MMU info: the kernel page 484 * The i386 doesn't have any external MMU info: the kernel page
433 * tables contain all the necessary information. 485 * tables contain all the necessary information.
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index 1910880fcd40..d505f501077a 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -27,6 +27,7 @@ struct pt_regs {
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28 28
29#include <asm/vm86.h> 29#include <asm/vm86.h>
30#include <asm/segment.h>
30 31
31struct task_struct; 32struct task_struct;
32extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); 33extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
@@ -40,18 +41,17 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int erro
40 */ 41 */
41static inline int user_mode(struct pt_regs *regs) 42static inline int user_mode(struct pt_regs *regs)
42{ 43{
43 return (regs->xcs & 3) != 0; 44 return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL;
44} 45}
45static inline int user_mode_vm(struct pt_regs *regs) 46static inline int user_mode_vm(struct pt_regs *regs)
46{ 47{
47 return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0; 48 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
48} 49}
50
49#define instruction_pointer(regs) ((regs)->eip) 51#define instruction_pointer(regs) ((regs)->eip)
50#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) 52#define regs_return_value(regs) ((regs)->eax)
53
51extern unsigned long profile_pc(struct pt_regs *regs); 54extern unsigned long profile_pc(struct pt_regs *regs);
52#else
53#define profile_pc(regs) instruction_pointer(regs)
54#endif
55#endif /* __KERNEL__ */ 55#endif /* __KERNEL__ */
56 56
57#endif 57#endif
diff --git a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h
index 87c069ccba08..c3e5db32fa48 100644
--- a/include/asm-i386/rwlock.h
+++ b/include/asm-i386/rwlock.h
@@ -20,52 +20,6 @@
20#define RW_LOCK_BIAS 0x01000000 20#define RW_LOCK_BIAS 0x01000000
21#define RW_LOCK_BIAS_STR "0x01000000" 21#define RW_LOCK_BIAS_STR "0x01000000"
22 22
23#define __build_read_lock_ptr(rw, helper) \ 23/* Code is in asm-i386/spinlock.h */
24 asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" \
25 "jns 1f\n" \
26 "call " helper "\n\t" \
27 "1:\n" \
28 ::"a" (rw) : "memory")
29
30#define __build_read_lock_const(rw, helper) \
31 asm volatile(LOCK_PREFIX " subl $1,%0\n\t" \
32 "jns 1f\n" \
33 "pushl %%eax\n\t" \
34 "leal %0,%%eax\n\t" \
35 "call " helper "\n\t" \
36 "popl %%eax\n\t" \
37 "1:\n" \
38 :"+m" (*(volatile int *)rw) : : "memory")
39
40#define __build_read_lock(rw, helper) do { \
41 if (__builtin_constant_p(rw)) \
42 __build_read_lock_const(rw, helper); \
43 else \
44 __build_read_lock_ptr(rw, helper); \
45 } while (0)
46
47#define __build_write_lock_ptr(rw, helper) \
48 asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
49 "jz 1f\n" \
50 "call " helper "\n\t" \
51 "1:\n" \
52 ::"a" (rw) : "memory")
53
54#define __build_write_lock_const(rw, helper) \
55 asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",%0\n\t" \
56 "jz 1f\n" \
57 "pushl %%eax\n\t" \
58 "leal %0,%%eax\n\t" \
59 "call " helper "\n\t" \
60 "popl %%eax\n\t" \
61 "1:\n" \
62 :"+m" (*(volatile int *)rw) : : "memory")
63
64#define __build_write_lock(rw, helper) do { \
65 if (__builtin_constant_p(rw)) \
66 __build_write_lock_const(rw, helper); \
67 else \
68 __build_write_lock_ptr(rw, helper); \
69 } while (0)
70 24
71#endif 25#endif
diff --git a/include/asm-i386/rwsem.h b/include/asm-i386/rwsem.h
index 43113f5608eb..bc598d6388e3 100644
--- a/include/asm-i386/rwsem.h
+++ b/include/asm-i386/rwsem.h
@@ -99,17 +99,9 @@ static inline void __down_read(struct rw_semaphore *sem)
99 __asm__ __volatile__( 99 __asm__ __volatile__(
100 "# beginning down_read\n\t" 100 "# beginning down_read\n\t"
101LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ 101LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */
102 " js 2f\n\t" /* jump if we weren't granted the lock */ 102 " jns 1f\n"
103 " call call_rwsem_down_read_failed\n"
103 "1:\n\t" 104 "1:\n\t"
104 LOCK_SECTION_START("")
105 "2:\n\t"
106 " pushl %%ecx\n\t"
107 " pushl %%edx\n\t"
108 " call rwsem_down_read_failed\n\t"
109 " popl %%edx\n\t"
110 " popl %%ecx\n\t"
111 " jmp 1b\n"
112 LOCK_SECTION_END
113 "# ending down_read\n\t" 105 "# ending down_read\n\t"
114 : "+m" (sem->count) 106 : "+m" (sem->count)
115 : "a" (sem) 107 : "a" (sem)
@@ -151,15 +143,9 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
151 "# beginning down_write\n\t" 143 "# beginning down_write\n\t"
152LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ 144LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
153 " testl %%edx,%%edx\n\t" /* was the count 0 before? */ 145 " testl %%edx,%%edx\n\t" /* was the count 0 before? */
154 " jnz 2f\n\t" /* jump if we weren't granted the lock */ 146 " jz 1f\n"
155 "1:\n\t" 147 " call call_rwsem_down_write_failed\n"
156 LOCK_SECTION_START("") 148 "1:\n"
157 "2:\n\t"
158 " pushl %%ecx\n\t"
159 " call rwsem_down_write_failed\n\t"
160 " popl %%ecx\n\t"
161 " jmp 1b\n"
162 LOCK_SECTION_END
163 "# ending down_write" 149 "# ending down_write"
164 : "+m" (sem->count), "=d" (tmp) 150 : "+m" (sem->count), "=d" (tmp)
165 : "a" (sem), "1" (tmp) 151 : "a" (sem), "1" (tmp)
@@ -193,17 +179,9 @@ static inline void __up_read(struct rw_semaphore *sem)
193 __asm__ __volatile__( 179 __asm__ __volatile__(
194 "# beginning __up_read\n\t" 180 "# beginning __up_read\n\t"
195LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ 181LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
196 " js 2f\n\t" /* jump if the lock is being waited upon */ 182 " jns 1f\n\t"
197 "1:\n\t" 183 " call call_rwsem_wake\n"
198 LOCK_SECTION_START("") 184 "1:\n"
199 "2:\n\t"
200 " decw %%dx\n\t" /* do nothing if still outstanding active readers */
201 " jnz 1b\n\t"
202 " pushl %%ecx\n\t"
203 " call rwsem_wake\n\t"
204 " popl %%ecx\n\t"
205 " jmp 1b\n"
206 LOCK_SECTION_END
207 "# ending __up_read\n" 185 "# ending __up_read\n"
208 : "+m" (sem->count), "=d" (tmp) 186 : "+m" (sem->count), "=d" (tmp)
209 : "a" (sem), "1" (tmp) 187 : "a" (sem), "1" (tmp)
@@ -219,17 +197,9 @@ static inline void __up_write(struct rw_semaphore *sem)
219 "# beginning __up_write\n\t" 197 "# beginning __up_write\n\t"
220 " movl %2,%%edx\n\t" 198 " movl %2,%%edx\n\t"
221LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ 199LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
222 " jnz 2f\n\t" /* jump if the lock is being waited upon */ 200 " jz 1f\n"
201 " call call_rwsem_wake\n"
223 "1:\n\t" 202 "1:\n\t"
224 LOCK_SECTION_START("")
225 "2:\n\t"
226 " decw %%dx\n\t" /* did the active count reduce to 0? */
227 " jnz 1b\n\t" /* jump back if not */
228 " pushl %%ecx\n\t"
229 " call rwsem_wake\n\t"
230 " popl %%ecx\n\t"
231 " jmp 1b\n"
232 LOCK_SECTION_END
233 "# ending __up_write\n" 203 "# ending __up_write\n"
234 : "+m" (sem->count) 204 : "+m" (sem->count)
235 : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS) 205 : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS)
@@ -244,17 +214,9 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
244 __asm__ __volatile__( 214 __asm__ __volatile__(
245 "# beginning __downgrade_write\n\t" 215 "# beginning __downgrade_write\n\t"
246LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ 216LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
247 " js 2f\n\t" /* jump if the lock is being waited upon */ 217 " jns 1f\n\t"
218 " call call_rwsem_downgrade_wake\n"
248 "1:\n\t" 219 "1:\n\t"
249 LOCK_SECTION_START("")
250 "2:\n\t"
251 " pushl %%ecx\n\t"
252 " pushl %%edx\n\t"
253 " call rwsem_downgrade_wake\n\t"
254 " popl %%edx\n\t"
255 " popl %%ecx\n\t"
256 " jmp 1b\n"
257 LOCK_SECTION_END
258 "# ending __downgrade_write\n" 220 "# ending __downgrade_write\n"
259 : "+m" (sem->count) 221 : "+m" (sem->count)
260 : "a" (sem), "i" (-RWSEM_WAITING_BIAS) 222 : "a" (sem), "i" (-RWSEM_WAITING_BIAS)
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index faf995307b9e..b7ab59685ba7 100644
--- a/include/asm-i386/segment.h
+++ b/include/asm-i386/segment.h
@@ -83,6 +83,11 @@
83 83
84#define GDT_SIZE (GDT_ENTRIES * 8) 84#define GDT_SIZE (GDT_ENTRIES * 8)
85 85
86/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
87#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
88/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
89#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
90
86/* Simple and small GDT entries for booting only */ 91/* Simple and small GDT entries for booting only */
87 92
88#define GDT_ENTRY_BOOT_CS 2 93#define GDT_ENTRY_BOOT_CS 2
@@ -112,4 +117,16 @@
112 */ 117 */
113#define IDT_ENTRIES 256 118#define IDT_ENTRIES 256
114 119
120/* Bottom two bits of selector give the ring privilege level */
121#define SEGMENT_RPL_MASK 0x3
122/* Bit 2 is table indicator (LDT/GDT) */
123#define SEGMENT_TI_MASK 0x4
124
125/* User mode is privilege level 3 */
126#define USER_RPL 0x3
127/* LDT segment has TI set, GDT has it cleared */
128#define SEGMENT_LDT 0x4
129#define SEGMENT_GDT 0x0
130
131#define get_kernel_rpl() 0
115#endif 132#endif
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h
index d51e800acf29..4e34a468c383 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -100,13 +100,10 @@ static inline void down(struct semaphore * sem)
100 __asm__ __volatile__( 100 __asm__ __volatile__(
101 "# atomic down operation\n\t" 101 "# atomic down operation\n\t"
102 LOCK_PREFIX "decl %0\n\t" /* --sem->count */ 102 LOCK_PREFIX "decl %0\n\t" /* --sem->count */
103 "js 2f\n" 103 "jns 2f\n"
104 "1:\n" 104 "\tlea %0,%%eax\n\t"
105 LOCK_SECTION_START("") 105 "call __down_failed\n"
106 "2:\tlea %0,%%eax\n\t" 106 "2:"
107 "call __down_failed\n\t"
108 "jmp 1b\n"
109 LOCK_SECTION_END
110 :"+m" (sem->count) 107 :"+m" (sem->count)
111 : 108 :
112 :"memory","ax"); 109 :"memory","ax");
@@ -123,16 +120,13 @@ static inline int down_interruptible(struct semaphore * sem)
123 might_sleep(); 120 might_sleep();
124 __asm__ __volatile__( 121 __asm__ __volatile__(
125 "# atomic interruptible down operation\n\t" 122 "# atomic interruptible down operation\n\t"
123 "xorl %0,%0\n\t"
126 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 124 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
127 "js 2f\n\t" 125 "jns 2f\n\t"
128 "xorl %0,%0\n" 126 "lea %1,%%eax\n\t"
129 "1:\n" 127 "call __down_failed_interruptible\n"
130 LOCK_SECTION_START("") 128 "2:"
131 "2:\tlea %1,%%eax\n\t" 129 :"=&a" (result), "+m" (sem->count)
132 "call __down_failed_interruptible\n\t"
133 "jmp 1b\n"
134 LOCK_SECTION_END
135 :"=a" (result), "+m" (sem->count)
136 : 130 :
137 :"memory"); 131 :"memory");
138 return result; 132 return result;
@@ -148,16 +142,13 @@ static inline int down_trylock(struct semaphore * sem)
148 142
149 __asm__ __volatile__( 143 __asm__ __volatile__(
150 "# atomic interruptible down operation\n\t" 144 "# atomic interruptible down operation\n\t"
145 "xorl %0,%0\n\t"
151 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 146 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
152 "js 2f\n\t" 147 "jns 2f\n\t"
153 "xorl %0,%0\n" 148 "lea %1,%%eax\n\t"
154 "1:\n"
155 LOCK_SECTION_START("")
156 "2:\tlea %1,%%eax\n\t"
157 "call __down_failed_trylock\n\t" 149 "call __down_failed_trylock\n\t"
158 "jmp 1b\n" 150 "2:\n"
159 LOCK_SECTION_END 151 :"=&a" (result), "+m" (sem->count)
160 :"=a" (result), "+m" (sem->count)
161 : 152 :
162 :"memory"); 153 :"memory");
163 return result; 154 return result;
@@ -166,22 +157,16 @@ static inline int down_trylock(struct semaphore * sem)
166/* 157/*
167 * Note! This is subtle. We jump to wake people up only if 158 * Note! This is subtle. We jump to wake people up only if
168 * the semaphore was negative (== somebody was waiting on it). 159 * the semaphore was negative (== somebody was waiting on it).
169 * The default case (no contention) will result in NO
170 * jumps for both down() and up().
171 */ 160 */
172static inline void up(struct semaphore * sem) 161static inline void up(struct semaphore * sem)
173{ 162{
174 __asm__ __volatile__( 163 __asm__ __volatile__(
175 "# atomic up operation\n\t" 164 "# atomic up operation\n\t"
176 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ 165 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
177 "jle 2f\n" 166 "jg 1f\n\t"
178 "1:\n" 167 "lea %0,%%eax\n\t"
179 LOCK_SECTION_START("") 168 "call __up_wakeup\n"
180 "2:\tlea %0,%%eax\n\t" 169 "1:"
181 "call __up_wakeup\n\t"
182 "jmp 1b\n"
183 LOCK_SECTION_END
184 ".subsection 0\n"
185 :"+m" (sem->count) 170 :"+m" (sem->count)
186 : 171 :
187 :"memory","ax"); 172 :"memory","ax");
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 142d10e34ade..6aa1206f6e2a 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -46,6 +46,8 @@ extern u8 x86_cpu_to_apicid[];
46 46
47#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 47#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
48 48
49extern u8 apicid_2_node[];
50
49#ifdef CONFIG_HOTPLUG_CPU 51#ifdef CONFIG_HOTPLUG_CPU
50extern void cpu_exit_clear(void); 52extern void cpu_exit_clear(void);
51extern void cpu_uninit(void); 53extern void cpu_uninit(void);
@@ -80,24 +82,32 @@ static inline int hard_smp_processor_id(void)
80 return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); 82 return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
81} 83}
82#endif 84#endif
83
84static __inline int logical_smp_processor_id(void)
85{
86 /* we don't want to mark this access volatile - bad code generation */
87 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
88}
89
90#endif 85#endif
91 86
87extern int safe_smp_processor_id(void);
92extern int __cpu_disable(void); 88extern int __cpu_disable(void);
93extern void __cpu_die(unsigned int cpu); 89extern void __cpu_die(unsigned int cpu);
90extern unsigned int num_processors;
91
94#endif /* !__ASSEMBLY__ */ 92#endif /* !__ASSEMBLY__ */
95 93
96#else /* CONFIG_SMP */ 94#else /* CONFIG_SMP */
97 95
96#define safe_smp_processor_id() 0
98#define cpu_physical_id(cpu) boot_cpu_physical_apicid 97#define cpu_physical_id(cpu) boot_cpu_physical_apicid
99 98
100#define NO_PROC_ID 0xFF /* No processor magic marker */ 99#define NO_PROC_ID 0xFF /* No processor magic marker */
101 100
102#endif 101#endif
102
103#ifndef __ASSEMBLY__
104#ifdef CONFIG_X86_LOCAL_APIC
105static __inline int logical_smp_processor_id(void)
106{
107 /* we don't want to mark this access volatile - bad code generation */
108 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
109}
110#endif
111#endif
112
103#endif 113#endif
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index d1020363c41a..c18b71fae6b3 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -4,8 +4,12 @@
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5#include <asm/rwlock.h> 5#include <asm/rwlock.h>
6#include <asm/page.h> 6#include <asm/page.h>
7#include <asm/processor.h>
7#include <linux/compiler.h> 8#include <linux/compiler.h>
8 9
10#define CLI_STRING "cli"
11#define STI_STRING "sti"
12
9/* 13/*
10 * Your basic SMP spinlocks, allowing only a single CPU anywhere 14 * Your basic SMP spinlocks, allowing only a single CPU anywhere
11 * 15 *
@@ -17,67 +21,64 @@
17 * (the type definitions are in asm/spinlock_types.h) 21 * (the type definitions are in asm/spinlock_types.h)
18 */ 22 */
19 23
20#define __raw_spin_is_locked(x) \ 24static inline int __raw_spin_is_locked(raw_spinlock_t *x)
21 (*(volatile signed char *)(&(x)->slock) <= 0) 25{
22 26 return *(volatile signed char *)(&(x)->slock) <= 0;
23#define __raw_spin_lock_string \ 27}
24 "\n1:\t" \
25 LOCK_PREFIX " ; decb %0\n\t" \
26 "jns 3f\n" \
27 "2:\t" \
28 "rep;nop\n\t" \
29 "cmpb $0,%0\n\t" \
30 "jle 2b\n\t" \
31 "jmp 1b\n" \
32 "3:\n\t"
33
34/*
35 * NOTE: there's an irqs-on section here, which normally would have to be
36 * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use
37 * __raw_spin_lock_string_flags().
38 */
39#define __raw_spin_lock_string_flags \
40 "\n1:\t" \
41 LOCK_PREFIX " ; decb %0\n\t" \
42 "jns 5f\n" \
43 "2:\t" \
44 "testl $0x200, %1\n\t" \
45 "jz 4f\n\t" \
46 "sti\n" \
47 "3:\t" \
48 "rep;nop\n\t" \
49 "cmpb $0, %0\n\t" \
50 "jle 3b\n\t" \
51 "cli\n\t" \
52 "jmp 1b\n" \
53 "4:\t" \
54 "rep;nop\n\t" \
55 "cmpb $0, %0\n\t" \
56 "jg 1b\n\t" \
57 "jmp 4b\n" \
58 "5:\n\t"
59 28
60static inline void __raw_spin_lock(raw_spinlock_t *lock) 29static inline void __raw_spin_lock(raw_spinlock_t *lock)
61{ 30{
62 asm(__raw_spin_lock_string : "+m" (lock->slock) : : "memory"); 31 asm volatile("\n1:\t"
32 LOCK_PREFIX " ; decb %0\n\t"
33 "jns 3f\n"
34 "2:\t"
35 "rep;nop\n\t"
36 "cmpb $0,%0\n\t"
37 "jle 2b\n\t"
38 "jmp 1b\n"
39 "3:\n\t"
40 : "+m" (lock->slock) : : "memory");
63} 41}
64 42
65/* 43/*
66 * It is easier for the lock validator if interrupts are not re-enabled 44 * It is easier for the lock validator if interrupts are not re-enabled
67 * in the middle of a lock-acquire. This is a performance feature anyway 45 * in the middle of a lock-acquire. This is a performance feature anyway
68 * so we turn it off: 46 * so we turn it off:
47 *
48 * NOTE: there's an irqs-on section here, which normally would have to be
49 * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use this variant.
69 */ 50 */
70#ifndef CONFIG_PROVE_LOCKING 51#ifndef CONFIG_PROVE_LOCKING
71static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) 52static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
72{ 53{
73 asm(__raw_spin_lock_string_flags : "+m" (lock->slock) : "r" (flags) : "memory"); 54 asm volatile(
55 "\n1:\t"
56 LOCK_PREFIX " ; decb %0\n\t"
57 "jns 5f\n"
58 "2:\t"
59 "testl $0x200, %1\n\t"
60 "jz 4f\n\t"
61 STI_STRING "\n"
62 "3:\t"
63 "rep;nop\n\t"
64 "cmpb $0, %0\n\t"
65 "jle 3b\n\t"
66 CLI_STRING "\n\t"
67 "jmp 1b\n"
68 "4:\t"
69 "rep;nop\n\t"
70 "cmpb $0, %0\n\t"
71 "jg 1b\n\t"
72 "jmp 4b\n"
73 "5:\n\t"
74 : "+m" (lock->slock) : "r" (flags) : "memory");
74} 75}
75#endif 76#endif
76 77
77static inline int __raw_spin_trylock(raw_spinlock_t *lock) 78static inline int __raw_spin_trylock(raw_spinlock_t *lock)
78{ 79{
79 char oldval; 80 char oldval;
80 __asm__ __volatile__( 81 asm volatile(
81 "xchgb %b0,%1" 82 "xchgb %b0,%1"
82 :"=q" (oldval), "+m" (lock->slock) 83 :"=q" (oldval), "+m" (lock->slock)
83 :"0" (0) : "memory"); 84 :"0" (0) : "memory");
@@ -93,38 +94,29 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
93 94
94#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) 95#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE)
95 96
96#define __raw_spin_unlock_string \
97 "movb $1,%0" \
98 :"+m" (lock->slock) : : "memory"
99
100
101static inline void __raw_spin_unlock(raw_spinlock_t *lock) 97static inline void __raw_spin_unlock(raw_spinlock_t *lock)
102{ 98{
103 __asm__ __volatile__( 99 asm volatile("movb $1,%0" : "+m" (lock->slock) :: "memory");
104 __raw_spin_unlock_string
105 );
106} 100}
107 101
108#else 102#else
109 103
110#define __raw_spin_unlock_string \
111 "xchgb %b0, %1" \
112 :"=q" (oldval), "+m" (lock->slock) \
113 :"0" (oldval) : "memory"
114
115static inline void __raw_spin_unlock(raw_spinlock_t *lock) 104static inline void __raw_spin_unlock(raw_spinlock_t *lock)
116{ 105{
117 char oldval = 1; 106 char oldval = 1;
118 107
119 __asm__ __volatile__( 108 asm volatile("xchgb %b0, %1"
120 __raw_spin_unlock_string 109 : "=q" (oldval), "+m" (lock->slock)
121 ); 110 : "0" (oldval) : "memory");
122} 111}
123 112
124#endif 113#endif
125 114
126#define __raw_spin_unlock_wait(lock) \ 115static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
127 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 116{
117 while (__raw_spin_is_locked(lock))
118 cpu_relax();
119}
128 120
129/* 121/*
130 * Read-write spinlocks, allowing multiple readers 122 * Read-write spinlocks, allowing multiple readers
@@ -151,22 +143,36 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
151 * read_can_lock - would read_trylock() succeed? 143 * read_can_lock - would read_trylock() succeed?
152 * @lock: the rwlock in question. 144 * @lock: the rwlock in question.
153 */ 145 */
154#define __raw_read_can_lock(x) ((int)(x)->lock > 0) 146static inline int __raw_read_can_lock(raw_rwlock_t *x)
147{
148 return (int)(x)->lock > 0;
149}
155 150
156/** 151/**
157 * write_can_lock - would write_trylock() succeed? 152 * write_can_lock - would write_trylock() succeed?
158 * @lock: the rwlock in question. 153 * @lock: the rwlock in question.
159 */ 154 */
160#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) 155static inline int __raw_write_can_lock(raw_rwlock_t *x)
156{
157 return (x)->lock == RW_LOCK_BIAS;
158}
161 159
162static inline void __raw_read_lock(raw_rwlock_t *rw) 160static inline void __raw_read_lock(raw_rwlock_t *rw)
163{ 161{
164 __build_read_lock(rw, "__read_lock_failed"); 162 asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t"
163 "jns 1f\n"
164 "call __read_lock_failed\n\t"
165 "1:\n"
166 ::"a" (rw) : "memory");
165} 167}
166 168
167static inline void __raw_write_lock(raw_rwlock_t *rw) 169static inline void __raw_write_lock(raw_rwlock_t *rw)
168{ 170{
169 __build_write_lock(rw, "__write_lock_failed"); 171 asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t"
172 "jz 1f\n"
173 "call __write_lock_failed\n\t"
174 "1:\n"
175 ::"a" (rw) : "memory");
170} 176}
171 177
172static inline int __raw_read_trylock(raw_rwlock_t *lock) 178static inline int __raw_read_trylock(raw_rwlock_t *lock)
@@ -199,4 +205,8 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
199 : "+m" (rw->lock) : : "memory"); 205 : "+m" (rw->lock) : : "memory");
200} 206}
201 207
208#define _raw_spin_relax(lock) cpu_relax()
209#define _raw_read_relax(lock) cpu_relax()
210#define _raw_write_relax(lock) cpu_relax()
211
202#endif /* __ASM_SPINLOCK_H */ 212#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-i386/stacktrace.h b/include/asm-i386/stacktrace.h
new file mode 100644
index 000000000000..7d1f6a5cbfca
--- /dev/null
+++ b/include/asm-i386/stacktrace.h
@@ -0,0 +1 @@
#include <asm-x86_64/stacktrace.h>
diff --git a/include/asm-i386/therm_throt.h b/include/asm-i386/therm_throt.h
new file mode 100644
index 000000000000..399bf6026b16
--- /dev/null
+++ b/include/asm-i386/therm_throt.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_I386_THERM_THROT_H__
2#define __ASM_I386_THERM_THROT_H__ 1
3
4#include <asm/atomic.h>
5
6extern atomic_t therm_throt_en;
7int therm_throt_process(int curr);
8
9#endif /* __ASM_I386_THERM_THROT_H__ */
diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
index d57ca5c540b6..360648b0f2b3 100644
--- a/include/asm-i386/tlbflush.h
+++ b/include/asm-i386/tlbflush.h
@@ -36,8 +36,6 @@
36 : "memory"); \ 36 : "memory"); \
37 } while (0) 37 } while (0)
38 38
39extern unsigned long pgkern_mask;
40
41# define __flush_tlb_all() \ 39# define __flush_tlb_all() \
42 do { \ 40 do { \
43 if (cpu_has_pge) \ 41 if (cpu_has_pge) \
@@ -49,7 +47,7 @@ extern unsigned long pgkern_mask;
49#define cpu_has_invlpg (boot_cpu_data.x86 > 3) 47#define cpu_has_invlpg (boot_cpu_data.x86 > 3)
50 48
51#define __flush_tlb_single(addr) \ 49#define __flush_tlb_single(addr) \
52 __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) 50 __asm__ __volatile__("invlpg (%0)" ::"r" (addr) : "memory")
53 51
54#ifdef CONFIG_X86_INVLPG 52#ifdef CONFIG_X86_INVLPG
55# define __flush_tlb_one(addr) __flush_tlb_single(addr) 53# define __flush_tlb_one(addr) __flush_tlb_single(addr)
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index 6adbd9b1ae88..978d09596130 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -74,6 +74,7 @@ static inline int node_to_first_cpu(int node)
74#define SD_NODE_INIT (struct sched_domain) { \ 74#define SD_NODE_INIT (struct sched_domain) { \
75 .span = CPU_MASK_NONE, \ 75 .span = CPU_MASK_NONE, \
76 .parent = NULL, \ 76 .parent = NULL, \
77 .child = NULL, \
77 .groups = NULL, \ 78 .groups = NULL, \
78 .min_interval = 8, \ 79 .min_interval = 8, \
79 .max_interval = 32, \ 80 .max_interval = 32, \
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index 97b828ce31e0..c13933185c1c 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -6,7 +6,6 @@
6#ifndef _ASM_i386_TSC_H 6#ifndef _ASM_i386_TSC_H
7#define _ASM_i386_TSC_H 7#define _ASM_i386_TSC_H
8 8
9#include <linux/config.h>
10#include <asm/processor.h> 9#include <asm/processor.h>
11 10
12/* 11/*
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index fc1c8ddae149..3ca7ab963d7d 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -323,18 +323,20 @@
323#define __NR_tee 315 323#define __NR_tee 315
324#define __NR_vmsplice 316 324#define __NR_vmsplice 316
325#define __NR_move_pages 317 325#define __NR_move_pages 317
326#define __NR_getcpu 318
326 327
327#ifdef __KERNEL__ 328#ifdef __KERNEL__
328 329
329#define NR_syscalls 318 330#define NR_syscalls 319
331#include <linux/err.h>
330 332
331/* 333/*
332 * user-visible error numbers are in the range -1 - -128: see 334 * user-visible error numbers are in the range -1 - -MAX_ERRNO: see
333 * <asm-i386/errno.h> 335 * <asm-i386/errno.h>
334 */ 336 */
335#define __syscall_return(type, res) \ 337#define __syscall_return(type, res) \
336do { \ 338do { \
337 if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ 339 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
338 errno = -(res); \ 340 errno = -(res); \
339 res = -1; \ 341 res = -1; \
340 } \ 342 } \
@@ -449,45 +451,6 @@ __syscall_return(type,__res); \
449#define __ARCH_WANT_SYS_RT_SIGACTION 451#define __ARCH_WANT_SYS_RT_SIGACTION
450#define __ARCH_WANT_SYS_RT_SIGSUSPEND 452#define __ARCH_WANT_SYS_RT_SIGSUSPEND
451 453
452#ifdef __KERNEL_SYSCALLS__
453
454#include <linux/compiler.h>
455#include <linux/types.h>
456#include <linux/linkage.h>
457#include <asm/ptrace.h>
458
459/*
460 * we need this inline - forking from kernel space will result
461 * in NO COPY ON WRITE (!!!), until an execve is executed. This
462 * is no problem, but for the stack. This is handled by not letting
463 * main() use the stack at all after fork(). Thus, no function
464 * calls - which means inline code for fork too, as otherwise we
465 * would use the stack upon exit from 'fork()'.
466 *
467 * Actually only pause and fork are needed inline, so that there
468 * won't be any messing with the stack from main(), but we define
469 * some others too.
470 */
471static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
472
473asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount);
474asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
475 unsigned long prot, unsigned long flags,
476 unsigned long fd, unsigned long pgoff);
477asmlinkage int sys_execve(struct pt_regs regs);
478asmlinkage int sys_clone(struct pt_regs regs);
479asmlinkage int sys_fork(struct pt_regs regs);
480asmlinkage int sys_vfork(struct pt_regs regs);
481asmlinkage int sys_pipe(unsigned long __user *fildes);
482asmlinkage long sys_iopl(unsigned long unused);
483struct sigaction;
484asmlinkage long sys_rt_sigaction(int sig,
485 const struct sigaction __user *act,
486 struct sigaction __user *oact,
487 size_t sigsetsize);
488
489#endif /* __KERNEL_SYSCALLS__ */
490
491/* 454/*
492 * "Conditional" syscalls 455 * "Conditional" syscalls
493 * 456 *
diff --git a/include/asm-i386/unwind.h b/include/asm-i386/unwind.h
index 4c1a0b968569..5031d693b89d 100644
--- a/include/asm-i386/unwind.h
+++ b/include/asm-i386/unwind.h
@@ -18,6 +18,7 @@ struct unwind_frame_info
18{ 18{
19 struct pt_regs regs; 19 struct pt_regs regs;
20 struct task_struct *task; 20 struct task_struct *task;
21 unsigned call_frame:1;
21}; 22};
22 23
23#define UNW_PC(frame) (frame)->regs.eip 24#define UNW_PC(frame) (frame)->regs.eip
@@ -28,6 +29,8 @@ struct unwind_frame_info
28#define FRAME_LINK_OFFSET 0 29#define FRAME_LINK_OFFSET 0
29#define STACK_BOTTOM(tsk) STACK_LIMIT((tsk)->thread.esp0) 30#define STACK_BOTTOM(tsk) STACK_LIMIT((tsk)->thread.esp0)
30#define STACK_TOP(tsk) ((tsk)->thread.esp0) 31#define STACK_TOP(tsk) ((tsk)->thread.esp0)
32#else
33#define UNW_FP(frame) ((void)(frame), 0)
31#endif 34#endif
32#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) 35#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
33 36
@@ -42,6 +45,10 @@ struct unwind_frame_info
42 PTREGS_INFO(edi), \ 45 PTREGS_INFO(edi), \
43 PTREGS_INFO(eip) 46 PTREGS_INFO(eip)
44 47
48#define UNW_DEFAULT_RA(raItem, dataAlign) \
49 ((raItem).where == Memory && \
50 !((raItem).value * (dataAlign) + 4))
51
45static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, 52static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
46 /*const*/ struct pt_regs *regs) 53 /*const*/ struct pt_regs *regs)
47{ 54{
@@ -88,6 +95,7 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
88 95
89#define UNW_PC(frame) ((void)(frame), 0) 96#define UNW_PC(frame) ((void)(frame), 0)
90#define UNW_SP(frame) ((void)(frame), 0) 97#define UNW_SP(frame) ((void)(frame), 0)
98#define UNW_FP(frame) ((void)(frame), 0)
91 99
92static inline int arch_unw_user_mode(const void *info) 100static inline int arch_unw_user_mode(const void *info)
93{ 101{
diff --git a/include/asm-ia64/esi.h b/include/asm-ia64/esi.h
new file mode 100644
index 000000000000..84aac0e0b583
--- /dev/null
+++ b/include/asm-ia64/esi.h
@@ -0,0 +1,30 @@
1/*
2 * ESI service calls.
3 *
4 * Copyright (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P.
5 * Alex Williamson <alex.williamson@hp.com>
6 */
7#ifndef esi_h
8#define esi_h
9
10#include <linux/efi.h>
11
12#define ESI_QUERY 0x00000001
13#define ESI_OPEN_HANDLE 0x02000000
14#define ESI_CLOSE_HANDLE 0x02000001
15
16enum esi_proc_type {
17 ESI_PROC_SERIALIZED, /* calls need to be serialized */
18 ESI_PROC_MP_SAFE, /* MP-safe, but not reentrant */
19 ESI_PROC_REENTRANT /* MP-safe and reentrant */
20};
21
22extern int ia64_esi_init (void);
23extern struct ia64_sal_retval esi_call_phys (void *, u64 *);
24extern int ia64_esi_call(efi_guid_t, struct ia64_sal_retval *,
25 enum esi_proc_type,
26 u64, u64, u64, u64, u64, u64, u64, u64);
27extern int ia64_esi_call_phys(efi_guid_t, struct ia64_sal_retval *, u64, u64,
28 u64, u64, u64, u64, u64, u64);
29
30#endif /* esi_h */
diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h
index 6a332a9f099c..07d77f3a8cbe 100644
--- a/include/asm-ia64/futex.h
+++ b/include/asm-ia64/futex.h
@@ -1,6 +1,124 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#include <asm-generic/futex.h> 4#include <linux/futex.h>
5#include <asm/errno.h>
6#include <asm/system.h>
7#include <asm/uaccess.h>
5 8
6#endif 9#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
10do { \
11 register unsigned long r8 __asm ("r8") = 0; \
12 __asm__ __volatile__( \
13 " mf;; \n" \
14 "[1:] " insn ";; \n" \
15 " .xdata4 \"__ex_table\", 1b-., 2f-. \n" \
16 "[2:]" \
17 : "+r" (r8), "=r" (oldval) \
18 : "r" (uaddr), "r" (oparg) \
19 : "memory"); \
20 ret = r8; \
21} while (0)
22
23#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
24do { \
25 register unsigned long r8 __asm ("r8") = 0; \
26 int val, newval; \
27 do { \
28 __asm__ __volatile__( \
29 " mf;; \n" \
30 "[1:] ld4 %3=[%4];; \n" \
31 " mov %2=%3 \n" \
32 insn ";; \n" \
33 " mov ar.ccv=%2;; \n" \
34 "[2:] cmpxchg4.acq %1=[%4],%3,ar.ccv;; \n" \
35 " .xdata4 \"__ex_table\", 1b-., 3f-.\n" \
36 " .xdata4 \"__ex_table\", 2b-., 3f-.\n" \
37 "[3:]" \
38 : "+r" (r8), "=r" (val), "=&r" (oldval), \
39 "=&r" (newval) \
40 : "r" (uaddr), "r" (oparg) \
41 : "memory"); \
42 if (unlikely (r8)) \
43 break; \
44 } while (unlikely (val != oldval)); \
45 ret = r8; \
46} while (0)
47
48static inline int
49futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
50{
51 int op = (encoded_op >> 28) & 7;
52 int cmp = (encoded_op >> 24) & 15;
53 int oparg = (encoded_op << 8) >> 20;
54 int cmparg = (encoded_op << 20) >> 20;
55 int oldval = 0, ret;
56 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
57 oparg = 1 << oparg;
58
59 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
60 return -EFAULT;
61
62 inc_preempt_count();
63
64 switch (op) {
65 case FUTEX_OP_SET:
66 __futex_atomic_op1("xchg4 %1=[%2],%3", ret, oldval, uaddr,
67 oparg);
68 break;
69 case FUTEX_OP_ADD:
70 __futex_atomic_op2("add %3=%3,%5", ret, oldval, uaddr, oparg);
71 break;
72 case FUTEX_OP_OR:
73 __futex_atomic_op2("or %3=%3,%5", ret, oldval, uaddr, oparg);
74 break;
75 case FUTEX_OP_ANDN:
76 __futex_atomic_op2("and %3=%3,%5", ret, oldval, uaddr,
77 ~oparg);
78 break;
79 case FUTEX_OP_XOR:
80 __futex_atomic_op2("xor %3=%3,%5", ret, oldval, uaddr, oparg);
81 break;
82 default:
83 ret = -ENOSYS;
84 }
85
86 dec_preempt_count();
87
88 if (!ret) {
89 switch (cmp) {
90 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
91 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
92 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
93 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
94 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
95 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
96 default: ret = -ENOSYS;
97 }
98 }
99 return ret;
100}
101
102static inline int
103futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
104{
105 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
106 return -EFAULT;
107
108 {
109 register unsigned long r8 __asm ("r8");
110 __asm__ __volatile__(
111 " mf;; \n"
112 " mov ar.ccv=%3;; \n"
113 "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n"
114 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
115 "[2:]"
116 : "=r" (r8)
117 : "r" (uaddr), "r" (newval),
118 "rO" ((long) (unsigned) oldval)
119 : "memory");
120 return r8;
121 }
122}
123
124#endif /* _ASM_FUTEX_H */
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 938904910115..1b45b71c79b9 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -29,7 +29,8 @@
29#include <linux/percpu.h> 29#include <linux/percpu.h>
30#include <asm/break.h> 30#include <asm/break.h>
31 31
32#define MAX_INSN_SIZE 16 32#define __ARCH_WANT_KPROBES_INSN_SLOT
33#define MAX_INSN_SIZE 1
33#define BREAK_INST (long)(__IA64_BREAK_KPROBE << 6) 34#define BREAK_INST (long)(__IA64_BREAK_KPROBE << 6)
34 35
35typedef union cmp_inst { 36typedef union cmp_inst {
@@ -94,7 +95,7 @@ struct kprobe_ctlblk {
94#define IP_RELATIVE_PREDICT_OPCODE (7) 95#define IP_RELATIVE_PREDICT_OPCODE (7)
95#define LONG_BRANCH_OPCODE (0xC) 96#define LONG_BRANCH_OPCODE (0xC)
96#define LONG_CALL_OPCODE (0xD) 97#define LONG_CALL_OPCODE (0xD)
97#define arch_remove_kprobe(p) do {} while (0) 98#define flush_insn_slot(p) do { } while (0)
98 99
99typedef struct kprobe_opcode { 100typedef struct kprobe_opcode {
100 bundle_t bundle; 101 bundle_t bundle;
@@ -108,7 +109,7 @@ struct fnptr {
108/* Architecture specific copy of original instruction*/ 109/* Architecture specific copy of original instruction*/
109struct arch_specific_insn { 110struct arch_specific_insn {
110 /* copy of the instruction to be emulated */ 111 /* copy of the instruction to be emulated */
111 kprobe_opcode_t insn; 112 kprobe_opcode_t *insn;
112 #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 113 #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1
113 #define INST_FLAG_FIX_BRANCH_REG 2 114 #define INST_FLAG_FIX_BRANCH_REG 2
114 #define INST_FLAG_BREAK_INST 4 115 #define INST_FLAG_BREAK_INST 4
@@ -125,6 +126,6 @@ static inline void jprobe_return(void)
125} 126}
126extern void invalidate_stacked_regs(void); 127extern void invalidate_stacked_regs(void);
127extern void flush_register_stack(void); 128extern void flush_register_stack(void);
128extern void flush_insn_slot(struct kprobe *p); 129extern void arch_remove_kprobe(struct kprobe *p);
129 130
130#endif /* _ASM_KPROBES_H */ 131#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 15b545a897a4..90cba967df35 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -20,6 +20,7 @@ struct page;
20struct mm_struct; 20struct mm_struct;
21struct pci_bus; 21struct pci_bus;
22struct task_struct; 22struct task_struct;
23struct pci_dev;
23 24
24typedef void ia64_mv_setup_t (char **); 25typedef void ia64_mv_setup_t (char **);
25typedef void ia64_mv_cpu_init_t (void); 26typedef void ia64_mv_cpu_init_t (void);
@@ -75,7 +76,9 @@ typedef unsigned char ia64_mv_readb_relaxed_t (const volatile void __iomem *);
75typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *); 76typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *);
76typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *); 77typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *);
77typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *); 78typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *);
78typedef int ia64_mv_msi_init_t (void); 79
80typedef int ia64_mv_setup_msi_irq_t (unsigned int irq, struct pci_dev *pdev);
81typedef void ia64_mv_teardown_msi_irq_t (unsigned int irq);
79 82
80static inline void 83static inline void
81machvec_noop (void) 84machvec_noop (void)
@@ -154,7 +157,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
154# define platform_readl_relaxed ia64_mv.readl_relaxed 157# define platform_readl_relaxed ia64_mv.readl_relaxed
155# define platform_readq_relaxed ia64_mv.readq_relaxed 158# define platform_readq_relaxed ia64_mv.readq_relaxed
156# define platform_migrate ia64_mv.migrate 159# define platform_migrate ia64_mv.migrate
157# define platform_msi_init ia64_mv.msi_init 160# define platform_setup_msi_irq ia64_mv.setup_msi_irq
161# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq
158# endif 162# endif
159 163
160/* __attribute__((__aligned__(16))) is required to make size of the 164/* __attribute__((__aligned__(16))) is required to make size of the
@@ -204,7 +208,8 @@ struct ia64_machine_vector {
204 ia64_mv_readl_relaxed_t *readl_relaxed; 208 ia64_mv_readl_relaxed_t *readl_relaxed;
205 ia64_mv_readq_relaxed_t *readq_relaxed; 209 ia64_mv_readq_relaxed_t *readq_relaxed;
206 ia64_mv_migrate_t *migrate; 210 ia64_mv_migrate_t *migrate;
207 ia64_mv_msi_init_t *msi_init; 211 ia64_mv_setup_msi_irq_t *setup_msi_irq;
212 ia64_mv_teardown_msi_irq_t *teardown_msi_irq;
208} __attribute__((__aligned__(16))); /* align attrib? see above comment */ 213} __attribute__((__aligned__(16))); /* align attrib? see above comment */
209 214
210#define MACHVEC_INIT(name) \ 215#define MACHVEC_INIT(name) \
@@ -250,7 +255,8 @@ struct ia64_machine_vector {
250 platform_readl_relaxed, \ 255 platform_readl_relaxed, \
251 platform_readq_relaxed, \ 256 platform_readq_relaxed, \
252 platform_migrate, \ 257 platform_migrate, \
253 platform_msi_init, \ 258 platform_setup_msi_irq, \
259 platform_teardown_msi_irq, \
254} 260}
255 261
256extern struct ia64_machine_vector ia64_mv; 262extern struct ia64_machine_vector ia64_mv;
@@ -404,8 +410,11 @@ extern int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size
404#ifndef platform_migrate 410#ifndef platform_migrate
405# define platform_migrate machvec_noop_task 411# define platform_migrate machvec_noop_task
406#endif 412#endif
407#ifndef platform_msi_init 413#ifndef platform_setup_msi_irq
408# define platform_msi_init ((ia64_mv_msi_init_t*)NULL) 414# define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL)
415#endif
416#ifndef platform_teardown_msi_irq
417# define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
409#endif 418#endif
410 419
411#endif /* _ASM_IA64_MACHVEC_H */ 420#endif /* _ASM_IA64_MACHVEC_H */
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index cf724dc79d8c..c54b165b1c17 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -67,7 +67,8 @@ extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device;
67extern ia64_mv_dma_mapping_error sn_dma_mapping_error; 67extern ia64_mv_dma_mapping_error sn_dma_mapping_error;
68extern ia64_mv_dma_supported sn_dma_supported; 68extern ia64_mv_dma_supported sn_dma_supported;
69extern ia64_mv_migrate_t sn_migrate; 69extern ia64_mv_migrate_t sn_migrate;
70extern ia64_mv_msi_init_t sn_msi_init; 70extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq;
71extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq;
71 72
72 73
73/* 74/*
@@ -120,9 +121,11 @@ extern ia64_mv_msi_init_t sn_msi_init;
120#define platform_dma_supported sn_dma_supported 121#define platform_dma_supported sn_dma_supported
121#define platform_migrate sn_migrate 122#define platform_migrate sn_migrate
122#ifdef CONFIG_PCI_MSI 123#ifdef CONFIG_PCI_MSI
123#define platform_msi_init sn_msi_init 124#define platform_setup_msi_irq sn_setup_msi_irq
125#define platform_teardown_msi_irq sn_teardown_msi_irq
124#else 126#else
125#define platform_msi_init ((ia64_mv_msi_init_t*)NULL) 127#define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL)
128#define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
126#endif 129#endif
127 130
128#include <asm/sn/io.h> 131#include <asm/sn/io.h>
diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h
index 27c9203d8ce3..76203f9a8718 100644
--- a/include/asm-ia64/mca_asm.h
+++ b/include/asm-ia64/mca_asm.h
@@ -197,9 +197,9 @@
197 movl temp2 = start_addr; \ 197 movl temp2 = start_addr; \
198 ;; \ 198 ;; \
199 mov cr.iip = temp2; \ 199 mov cr.iip = temp2; \
200 movl gp = __gp \
200 ;; \ 201 ;; \
201 DATA_PA_TO_VA(sp, temp1); \ 202 DATA_PA_TO_VA(sp, temp1); \
202 DATA_PA_TO_VA(gp, temp2); \
203 srlz.i; \ 203 srlz.i; \
204 ;; \ 204 ;; \
205 nop 1; \ 205 nop 1; \
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
index 6a33a07b3f1d..c3b1f862e6e7 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -55,6 +55,7 @@ extern void efi_memmap_init(unsigned long *, unsigned long *);
55 extern unsigned long vmalloc_end; 55 extern unsigned long vmalloc_end;
56 extern struct page *vmem_map; 56 extern struct page *vmem_map;
57 extern int find_largest_hole (u64 start, u64 end, void *arg); 57 extern int find_largest_hole (u64 start, u64 end, void *arg);
58 extern int register_active_ranges (u64 start, u64 end, void *arg);
58 extern int create_mem_map_page_table (u64 start, u64 end, void *arg); 59 extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
59 extern int vmemmap_find_next_valid_pfn(int, int); 60 extern int vmemmap_find_next_valid_pfn(int, int);
60#else 61#else
diff --git a/include/asm-ia64/module.h b/include/asm-ia64/module.h
index 85c82bd819f2..d2da61e4c49b 100644
--- a/include/asm-ia64/module.h
+++ b/include/asm-ia64/module.h
@@ -28,7 +28,8 @@ struct mod_arch_specific {
28#define Elf_Ehdr Elf64_Ehdr 28#define Elf_Ehdr Elf64_Ehdr
29 29
30#define MODULE_PROC_FAMILY "ia64" 30#define MODULE_PROC_FAMILY "ia64"
31#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY 31#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \
32 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)
32 33
33#define ARCH_SHF_SMALL SHF_IA_64_SHORT 34#define ARCH_SHF_SMALL SHF_IA_64_SHORT
34 35
diff --git a/include/asm-ia64/msi.h b/include/asm-ia64/msi.h
deleted file mode 100644
index bb92b0dbde2f..000000000000
--- a/include/asm-ia64/msi.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2003-2004 Intel
3 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
4 */
5
6#ifndef ASM_MSI_H
7#define ASM_MSI_H
8
9#define NR_VECTORS NR_IRQS
10#define FIRST_DEVICE_VECTOR IA64_FIRST_DEVICE_VECTOR
11#define LAST_DEVICE_VECTOR IA64_LAST_DEVICE_VECTOR
12static inline void set_intr_gate (int nr, void *func) {}
13#define IO_APIC_VECTOR(irq) (irq)
14#define ack_APIC_irq ia64_eoi
15#define MSI_TARGET_CPU_SHIFT 4
16
17extern struct msi_ops msi_apic_ops;
18
19static inline int msi_arch_init(void)
20{
21 if (platform_msi_init)
22 return platform_msi_init();
23
24 /* default ops for most ia64 platforms */
25 msi_register(&msi_apic_ops);
26 return 0;
27}
28
29#endif /* ASM_MSI_H */
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
index e0a1d173e42d..7d5e2ccc37a0 100644
--- a/include/asm-ia64/numa.h
+++ b/include/asm-ia64/numa.h
@@ -69,6 +69,8 @@ extern void unmap_cpu_from_node(int cpu, int nid);
69 69
70 70
71#else /* !CONFIG_NUMA */ 71#else /* !CONFIG_NUMA */
72#define map_cpu_to_node(cpu, nid) do{}while(0)
73#define unmap_cpu_from_node(cpu, nid) do{}while(0)
72 74
73#define paddr_to_nid(addr) 0 75#define paddr_to_nid(addr) 0
74 76
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 20a8d618c845..2c8fd92d0ece 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -78,6 +78,7 @@
78#define PAL_VM_TR_READ 261 /* read contents of translation register */ 78#define PAL_VM_TR_READ 261 /* read contents of translation register */
79#define PAL_GET_PSTATE 262 /* get the current P-state */ 79#define PAL_GET_PSTATE 262 /* get the current P-state */
80#define PAL_SET_PSTATE 263 /* set the P-state */ 80#define PAL_SET_PSTATE 263 /* set the P-state */
81#define PAL_BRAND_INFO 274 /* Processor branding information */
81 82
82#ifndef __ASSEMBLY__ 83#ifndef __ASSEMBLY__
83 84
@@ -963,7 +964,8 @@ static inline s64
963ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr) 964ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
964{ 965{
965 struct ia64_pal_retval iprv; 966 struct ia64_pal_retval iprv;
966 PAL_CALL(iprv, PAL_CACHE_READ, line_id.pclid_data, physical_addr, 0); 967 PAL_CALL_PHYS_STK(iprv, PAL_CACHE_READ, line_id.pclid_data,
968 physical_addr, 0);
967 return iprv.status; 969 return iprv.status;
968} 970}
969 971
@@ -985,7 +987,8 @@ static inline s64
985ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data) 987ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data)
986{ 988{
987 struct ia64_pal_retval iprv; 989 struct ia64_pal_retval iprv;
988 PAL_CALL(iprv, PAL_CACHE_WRITE, line_id.pclid_data, physical_addr, data); 990 PAL_CALL_PHYS_STK(iprv, PAL_CACHE_WRITE, line_id.pclid_data,
991 physical_addr, data);
989 return iprv.status; 992 return iprv.status;
990} 993}
991 994
@@ -1133,6 +1136,15 @@ ia64_pal_set_pstate (u64 pstate_index)
1133 return iprv.status; 1136 return iprv.status;
1134} 1137}
1135 1138
1139/* Processor branding information*/
1140static inline s64
1141ia64_pal_get_brand_info (char *brand_info)
1142{
1143 struct ia64_pal_retval iprv;
1144 PAL_CALL_STK(iprv, PAL_BRAND_INFO, 0, (u64)brand_info, 0);
1145 return iprv.status;
1146}
1147
1136/* Cause the processor to enter LIGHT HALT state, where prefetching and execution are 1148/* Cause the processor to enter LIGHT HALT state, where prefetching and execution are
1137 * suspended, but cache and TLB coherency is maintained. 1149 * suspended, but cache and TLB coherency is maintained.
1138 */ 1150 */
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 265f4824db0e..5830d36fd8e6 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -20,12 +20,6 @@
20#include <asm/ustack.h> 20#include <asm/ustack.h>
21 21
22#define IA64_NUM_DBG_REGS 8 22#define IA64_NUM_DBG_REGS 8
23/*
24 * Limits for PMC and PMD are set to less than maximum architected values
25 * but should be sufficient for a while
26 */
27#define IA64_NUM_PMC_REGS 64
28#define IA64_NUM_PMD_REGS 64
29 23
30#define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000) 24#define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000)
31#define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000) 25#define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000)
@@ -163,6 +157,7 @@ struct cpuinfo_ia64 {
163 __u8 family; 157 __u8 family;
164 __u8 archrev; 158 __u8 archrev;
165 char vendor[16]; 159 char vendor[16];
160 char *model_name;
166 161
167#ifdef CONFIG_NUMA 162#ifdef CONFIG_NUMA
168 struct ia64_node_data *node_data; 163 struct ia64_node_data *node_data;
@@ -262,13 +257,9 @@ struct thread_struct {
262# define INIT_THREAD_IA32 257# define INIT_THREAD_IA32
263#endif /* CONFIG_IA32_SUPPORT */ 258#endif /* CONFIG_IA32_SUPPORT */
264#ifdef CONFIG_PERFMON 259#ifdef CONFIG_PERFMON
265 __u64 pmcs[IA64_NUM_PMC_REGS];
266 __u64 pmds[IA64_NUM_PMD_REGS];
267 void *pfm_context; /* pointer to detailed PMU context */ 260 void *pfm_context; /* pointer to detailed PMU context */
268 unsigned long pfm_needs_checking; /* when >0, pending perfmon work on kernel exit */ 261 unsigned long pfm_needs_checking; /* when >0, pending perfmon work on kernel exit */
269# define INIT_THREAD_PM .pmcs = {0UL, }, \ 262# define INIT_THREAD_PM .pfm_context = NULL, \
270 .pmds = {0UL, }, \
271 .pfm_context = NULL, \
272 .pfm_needs_checking = 0UL, 263 .pfm_needs_checking = 0UL,
273#else 264#else
274# define INIT_THREAD_PM 265# define INIT_THREAD_PM
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h
index 1414316efd40..f4ef87a36236 100644
--- a/include/asm-ia64/ptrace.h
+++ b/include/asm-ia64/ptrace.h
@@ -241,6 +241,9 @@ struct switch_stack {
241 * the canonical representation by adding to instruction pointer. 241 * the canonical representation by adding to instruction pointer.
242 */ 242 */
243# define instruction_pointer(regs) ((regs)->cr_iip + ia64_psr(regs)->ri) 243# define instruction_pointer(regs) ((regs)->cr_iip + ia64_psr(regs)->ri)
244
245#define regs_return_value(regs) ((regs)->r8)
246
244/* Conserve space in histogram by encoding slot bits in address 247/* Conserve space in histogram by encoding slot bits in address
245 * bits 2 and 3 rather than bits 0 and 1. 248 * bits 2 and 3 rather than bits 0 and 1.
246 */ 249 */
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 74bde1c2bb1a..60fd4ae014f6 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -126,6 +126,7 @@ extern void smp_send_reschedule (int cpu);
126extern void lock_ipi_calllock(void); 126extern void lock_ipi_calllock(void);
127extern void unlock_ipi_calllock(void); 127extern void unlock_ipi_calllock(void);
128extern void identify_siblings (struct cpuinfo_ia64 *); 128extern void identify_siblings (struct cpuinfo_ia64 *);
129extern int is_multithreading_enabled(void);
129 130
130#else 131#else
131 132
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index 9e83210dc312..ff857e31738a 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -213,4 +213,8 @@ static inline int __raw_read_trylock(raw_rwlock_t *x)
213 return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word; 213 return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word;
214} 214}
215 215
216#define _raw_spin_relax(lock) cpu_relax()
217#define _raw_read_relax(lock) cpu_relax()
218#define _raw_write_relax(lock) cpu_relax()
219
216#endif /* _ASM_IA64_SPINLOCK_H */ 220#endif /* _ASM_IA64_SPINLOCK_H */
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index 937c21257523..a6e38565ab4c 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -59,6 +59,7 @@ void build_cpu_to_node_map(void);
59#define SD_CPU_INIT (struct sched_domain) { \ 59#define SD_CPU_INIT (struct sched_domain) { \
60 .span = CPU_MASK_NONE, \ 60 .span = CPU_MASK_NONE, \
61 .parent = NULL, \ 61 .parent = NULL, \
62 .child = NULL, \
62 .groups = NULL, \ 63 .groups = NULL, \
63 .min_interval = 1, \ 64 .min_interval = 1, \
64 .max_interval = 4, \ 65 .max_interval = 4, \
@@ -84,6 +85,7 @@ void build_cpu_to_node_map(void);
84#define SD_NODE_INIT (struct sched_domain) { \ 85#define SD_NODE_INIT (struct sched_domain) { \
85 .span = CPU_MASK_NONE, \ 86 .span = CPU_MASK_NONE, \
86 .parent = NULL, \ 87 .parent = NULL, \
88 .child = NULL, \
87 .groups = NULL, \ 89 .groups = NULL, \
88 .min_interval = 8, \ 90 .min_interval = 8, \
89 .max_interval = 8*(min(num_online_cpus(), 32)), \ 91 .max_interval = 8*(min(num_online_cpus(), 32)), \
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index f581662c5ab8..53c5c0ee122c 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -286,7 +286,8 @@
286/* 1294, 1295 reserved for pselect/ppoll */ 286/* 1294, 1295 reserved for pselect/ppoll */
287#define __NR_unshare 1296 287#define __NR_unshare 1296
288#define __NR_splice 1297 288#define __NR_splice 1297
289/* 1298, 1299 reserved for set_robust_list/get_robust_list */ 289#define __NR_set_robust_list 1298
290#define __NR_get_robust_list 1299
290#define __NR_sync_file_range 1300 291#define __NR_sync_file_range 1300
291#define __NR_tee 1301 292#define __NR_tee 1301
292#define __NR_vmsplice 1302 293#define __NR_vmsplice 1302
@@ -318,78 +319,6 @@
318 319
319extern long __ia64_syscall (long a0, long a1, long a2, long a3, long a4, long nr); 320extern long __ia64_syscall (long a0, long a1, long a2, long a3, long a4, long nr);
320 321
321#ifdef __KERNEL_SYSCALLS__
322
323#include <linux/compiler.h>
324#include <linux/string.h>
325#include <linux/signal.h>
326#include <asm/ptrace.h>
327#include <linux/stringify.h>
328#include <linux/syscalls.h>
329
330static inline long
331open (const char * name, int mode, int flags)
332{
333 return sys_open(name, mode, flags);
334}
335
336static inline long
337dup (int fd)
338{
339 return sys_dup(fd);
340}
341
342static inline long
343close (int fd)
344{
345 return sys_close(fd);
346}
347
348static inline off_t
349lseek (int fd, off_t off, int whence)
350{
351 return sys_lseek(fd, off, whence);
352}
353
354static inline void
355_exit (int value)
356{
357 sys_exit(value);
358}
359
360#define exit(x) _exit(x)
361
362static inline long
363write (int fd, const char * buf, size_t nr)
364{
365 return sys_write(fd, buf, nr);
366}
367
368static inline long
369read (int fd, char * buf, size_t nr)
370{
371 return sys_read(fd, buf, nr);
372}
373
374
375static inline long
376setsid (void)
377{
378 return sys_setsid();
379}
380
381static inline pid_t
382waitpid (int pid, int * wait_stat, int flags)
383{
384 return sys_wait4(pid, wait_stat, flags, NULL);
385}
386
387
388extern int execve (const char *filename, char *const av[], char *const ep[]);
389extern pid_t clone (unsigned long flags, void *sp);
390
391#endif /* __KERNEL_SYSCALLS__ */
392
393asmlinkage unsigned long sys_mmap( 322asmlinkage unsigned long sys_mmap(
394 unsigned long addr, unsigned long len, 323 unsigned long addr, unsigned long len,
395 int prot, int flags, 324 int prot, int flags,
diff --git a/include/asm-m32r/m32104ut/m32104ut_pld.h b/include/asm-m32r/m32104ut/m32104ut_pld.h
index 6ba4ddf7dcf7..cbdbc5891445 100644
--- a/include/asm-m32r/m32104ut/m32104ut_pld.h
+++ b/include/asm-m32r/m32104ut/m32104ut_pld.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/m32104ut/m32104ut_pld.h 2 * include/asm-m32r/m32104ut/m32104ut_pld.h
3 * 3 *
4 * Definitions for Programable Logic Device(PLD) on M32104UT board. 4 * Definitions for Programable Logic Device(PLD) on M32104UT board.
5 * Based on m32700ut_pld.h 5 * Based on m32700ut_pld.h
diff --git a/include/asm-m32r/m32700ut/m32700ut_lan.h b/include/asm-m32r/m32700ut/m32700ut_lan.h
index c050b19e8101..f1e47ae1f891 100644
--- a/include/asm-m32r/m32700ut/m32700ut_lan.h
+++ b/include/asm-m32r/m32700ut/m32700ut_lan.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/m32700ut_lan.h 2 * include/asm-m32r/m32700ut/m32700ut_lan.h
3 * 3 *
4 * M32700UT-LAN board 4 * M32700UT-LAN board
5 * 5 *
diff --git a/include/asm-m32r/m32700ut/m32700ut_lcd.h b/include/asm-m32r/m32700ut/m32700ut_lcd.h
index 4da4e822e2f3..e41c4aa48b4c 100644
--- a/include/asm-m32r/m32700ut/m32700ut_lcd.h
+++ b/include/asm-m32r/m32700ut/m32700ut_lcd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/m32700ut_lcd.h 2 * include/asm-m32r/m32700ut/m32700ut_lcd.h
3 * 3 *
4 * M32700UT-LCD board 4 * M32700UT-LCD board
5 * 5 *
diff --git a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h
index f35f9159acff..a48c22c978ca 100644
--- a/include/asm-m32r/m32700ut/m32700ut_pld.h
+++ b/include/asm-m32r/m32700ut/m32700ut_pld.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/m32700ut/m32700ut_pld.h 2 * include/asm-m32r/m32700ut/m32700ut_pld.h
3 * 3 *
4 * Definitions for Programable Logic Device(PLD) on M32700UT board. 4 * Definitions for Programable Logic Device(PLD) on M32700UT board.
5 * 5 *
diff --git a/include/asm-m32r/mappi2/mappi2_pld.h b/include/asm-m32r/mappi2/mappi2_pld.h
index 01dcdd19dbe6..56a2b12f2bfc 100644
--- a/include/asm-m32r/mappi2/mappi2_pld.h
+++ b/include/asm-m32r/mappi2/mappi2_pld.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/mappi2/mappi2_pld.h 2 * include/asm-m32r/mappi2/mappi2_pld.h
3 * 3 *
4 * Definitions for Extended IO Logic on MAPPI2 board. 4 * Definitions for Extended IO Logic on MAPPI2 board.
5 * based on m32700ut_pld.h by 5 * based on m32700ut_pld.h by
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h
index 031369a7afc8..92f10defaef8 100644
--- a/include/asm-m32r/mappi3/mappi3_pld.h
+++ b/include/asm-m32r/mappi3/mappi3_pld.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/mappi3/mappi3_pld.h 2 * include/asm-m32r/mappi3/mappi3_pld.h
3 * 3 *
4 * Definitions for Extended IO Logic on MAPPI3 board. 4 * Definitions for Extended IO Logic on MAPPI3 board.
5 * based on m32700ut_pld.h 5 * based on m32700ut_pld.h
diff --git a/include/asm-m32r/opsput/opsput_lan.h b/include/asm-m32r/opsput/opsput_lan.h
index 61948296f445..f53e10187c03 100644
--- a/include/asm-m32r/opsput/opsput_lan.h
+++ b/include/asm-m32r/opsput/opsput_lan.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/opsput_lan.h 2 * include/asm-m32r/opsput/opsput_lan.h
3 * 3 *
4 * OPSPUT-LAN board 4 * OPSPUT-LAN board
5 * 5 *
diff --git a/include/asm-m32r/opsput/opsput_lcd.h b/include/asm-m32r/opsput/opsput_lcd.h
index 44cfd7fe2d88..99f296e1b61b 100644
--- a/include/asm-m32r/opsput/opsput_lcd.h
+++ b/include/asm-m32r/opsput/opsput_lcd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/opsput_lcd.h 2 * include/asm-m32r/opsput/opsput_lcd.h
3 * 3 *
4 * OPSPUT-LCD board 4 * OPSPUT-LCD board
5 * 5 *
diff --git a/include/asm-m32r/opsput/opsput_pld.h b/include/asm-m32r/opsput/opsput_pld.h
index 46296fe1ec1a..a8d6452076f1 100644
--- a/include/asm-m32r/opsput/opsput_pld.h
+++ b/include/asm-m32r/opsput/opsput_pld.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/opsput/opsput_pld.h 2 * include/asm-m32r/opsput/opsput_pld.h
3 * 3 *
4 * Definitions for Programable Logic Device(PLD) on OPSPUT board. 4 * Definitions for Programable Logic Device(PLD) on OPSPUT board.
5 * 5 *
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
index 6a674e3d37a2..84152760e0b5 100644
--- a/include/asm-m32r/pgtable-2level.h
+++ b/include/asm-m32r/pgtable-2level.h
@@ -44,7 +44,7 @@ static inline int pgd_present(pgd_t pgd) { return 1; }
44 */ 44 */
45#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 45#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
46#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 46#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
47#define set_pte_atomic(pteptr, pteval) set_pte(pteptr, pteval) 47
48/* 48/*
49 * (pmds are folded into pgds so this doesnt get actually called, 49 * (pmds are folded into pgds so this doesnt get actually called,
50 * but the define is needed for a generic inline function.) 50 * but the define is needed for a generic inline function.)
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index f94c1a673569..f5cfba81ee10 100644
--- a/include/asm-m32r/spinlock.h
+++ b/include/asm-m32r/spinlock.h
@@ -298,7 +298,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
298 ); 298 );
299} 299}
300 300
301#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 301static inline int __raw_read_trylock(raw_rwlock_t *lock)
302{
303 atomic_t *count = (atomic_t*)lock;
304 if (atomic_dec_return(count) >= 0)
305 return 1;
306 atomic_inc(count);
307 return 0;
308}
302 309
303static inline int __raw_write_trylock(raw_rwlock_t *lock) 310static inline int __raw_write_trylock(raw_rwlock_t *lock)
304{ 311{
@@ -309,4 +316,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
309 return 0; 316 return 0;
310} 317}
311 318
319#define _raw_spin_relax(lock) cpu_relax()
320#define _raw_read_relax(lock) cpu_relax()
321#define _raw_write_relax(lock) cpu_relax()
322
312#endif /* _ASM_M32R_SPINLOCK_H */ 323#endif /* _ASM_M32R_SPINLOCK_H */
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 9e618afec6ed..4ce0619f6989 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -328,15 +328,15 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
328#define smp_rmb() rmb() 328#define smp_rmb() rmb()
329#define smp_wmb() wmb() 329#define smp_wmb() wmb()
330#define smp_read_barrier_depends() read_barrier_depends() 330#define smp_read_barrier_depends() read_barrier_depends()
331#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
331#else 332#else
332#define smp_mb() barrier() 333#define smp_mb() barrier()
333#define smp_rmb() barrier() 334#define smp_rmb() barrier()
334#define smp_wmb() barrier() 335#define smp_wmb() barrier()
335#define smp_read_barrier_depends() do { } while (0) 336#define smp_read_barrier_depends() do { } while (0)
337#define set_mb(var, value) do { var = value; barrier(); } while (0)
336#endif 338#endif
337 339
338#define set_mb(var, value) do { xchg(&var, value); } while (0)
339
340#define arch_align_stack(x) (x) 340#define arch_align_stack(x) (x)
341 341
342#endif /* _ASM_M32R_SYSTEM_H */ 342#endif /* _ASM_M32R_SYSTEM_H */
diff --git a/include/asm-m32r/timex.h b/include/asm-m32r/timex.h
index e89bfd17db51..019441c1d7a0 100644
--- a/include/asm-m32r/timex.h
+++ b/include/asm-m32r/timex.h
@@ -12,9 +12,6 @@
12 12
13#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE) 13#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE)
14#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ 14#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
15#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
16 (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
17 << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
18 15
19#ifdef __KERNEL__ 16#ifdef __KERNEL__
20/* 17/*
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index 89f376e6229f..95aa34298d82 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -296,8 +296,9 @@
296#ifdef __KERNEL__ 296#ifdef __KERNEL__
297 297
298#define NR_syscalls 285 298#define NR_syscalls 285
299#include <linux/err.h>
299 300
300/* user-visible error numbers are in the range -1 - -124: see 301/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
301 * <asm-m32r/errno.h> 302 * <asm-m32r/errno.h>
302 */ 303 */
303 304
@@ -305,7 +306,7 @@
305 306
306#define __syscall_return(type, res) \ 307#define __syscall_return(type, res) \
307do { \ 308do { \
308 if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \ 309 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
309 /* Avoid using "res" which is declared to be in register r0; \ 310 /* Avoid using "res" which is declared to be in register r0; \
310 errno might expand to a function call and clobber it. */ \ 311 errno might expand to a function call and clobber it. */ \
311 int __err = -(res); \ 312 int __err = -(res); \
@@ -423,43 +424,6 @@ __syscall_return(type,__res); \
423#define __ARCH_WANT_SYS_OLDUMOUNT 424#define __ARCH_WANT_SYS_OLDUMOUNT
424#define __ARCH_WANT_SYS_RT_SIGACTION 425#define __ARCH_WANT_SYS_RT_SIGACTION
425 426
426#ifdef __KERNEL_SYSCALLS__
427
428#include <linux/compiler.h>
429#include <linux/types.h>
430#include <linux/linkage.h>
431#include <asm/ptrace.h>
432
433/*
434 * we need this inline - forking from kernel space will result
435 * in NO COPY ON WRITE (!!!), until an execve is executed. This
436 * is no problem, but for the stack. This is handled by not letting
437 * main() use the stack at all after fork(). Thus, no function
438 * calls - which means inline code for fork too, as otherwise we
439 * would use the stack upon exit from 'fork()'.
440 *
441 * Actually only pause and fork are needed inline, so that there
442 * won't be any messing with the stack from main(), but we define
443 * some others too.
444 */
445static __inline__ _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
446
447asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
448 unsigned long prot, unsigned long flags,
449 unsigned long fd, unsigned long pgoff);
450asmlinkage int sys_execve(struct pt_regs regs);
451asmlinkage int sys_clone(struct pt_regs regs);
452asmlinkage int sys_fork(struct pt_regs regs);
453asmlinkage int sys_vfork(struct pt_regs regs);
454asmlinkage int sys_pipe(unsigned long __user *fildes);
455struct sigaction;
456asmlinkage long sys_rt_sigaction(int sig,
457 const struct sigaction __user *act,
458 struct sigaction __user *oact,
459 size_t sigsetsize);
460
461#endif /* __KERNEL_SYSCALLS__ */
462
463/* 427/*
464 * "Conditional" syscalls 428 * "Conditional" syscalls
465 * 429 *
diff --git a/include/asm-m68k/rtc.h b/include/asm-m68k/rtc.h
index 71406fc4e599..5d3e03859844 100644
--- a/include/asm-m68k/rtc.h
+++ b/include/asm-m68k/rtc.h
@@ -1,4 +1,4 @@
1/* asm-m68k/rtc.h 1/* include/asm-m68k/rtc.h
2 * 2 *
3 * Copyright Richard Zidlicky 3 * Copyright Richard Zidlicky
4 * implementation details for genrtc/q40rtc driver 4 * implementation details for genrtc/q40rtc driver
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index 7c0b6296b45c..3ab716f0fc18 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -288,13 +288,14 @@
288#ifdef __KERNEL__ 288#ifdef __KERNEL__
289 289
290#define NR_syscalls 282 290#define NR_syscalls 282
291#include <linux/err.h>
291 292
292/* user-visible error numbers are in the range -1 - -124: see 293/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
293 <asm-m68k/errno.h> */ 294 <asm-m68k/errno.h> */
294 295
295#define __syscall_return(type, res) \ 296#define __syscall_return(type, res) \
296do { \ 297do { \
297 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 298 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
298 /* avoid using res which is declared to be in register d0; \ 299 /* avoid using res which is declared to be in register d0; \
299 errno might expand to a function call and clobber it. */ \ 300 errno might expand to a function call and clobber it. */ \
300 int __err = -(res); \ 301 int __err = -(res); \
@@ -408,12 +409,6 @@ __syscall_return(type,__res); \
408#define __ARCH_WANT_SYS_SIGPROCMASK 409#define __ARCH_WANT_SYS_SIGPROCMASK
409#define __ARCH_WANT_SYS_RT_SIGACTION 410#define __ARCH_WANT_SYS_RT_SIGACTION
410 411
411#ifdef __KERNEL_SYSCALLS__
412
413static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
414
415#endif /* __KERNEL_SYSCALLS__ */
416
417/* 412/*
418 * "Conditional" syscalls 413 * "Conditional" syscalls
419 * 414 *
diff --git a/include/asm-m68knommu/processor.h b/include/asm-m68knommu/processor.h
index 9d3a1bf41231..91cba18acdd3 100644
--- a/include/asm-m68knommu/processor.h
+++ b/include/asm-m68knommu/processor.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-m68k/processor.h 2 * include/asm-m68knommu/processor.h
3 * 3 *
4 * Copyright (C) 1995 Hamish Macdonald 4 * Copyright (C) 1995 Hamish Macdonald
5 */ 5 */
diff --git a/include/asm-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h
index 1b2abdf281e1..daafb5d43ef1 100644
--- a/include/asm-m68knommu/unistd.h
+++ b/include/asm-m68knommu/unistd.h
@@ -289,13 +289,14 @@
289#ifdef __KERNEL__ 289#ifdef __KERNEL__
290 290
291#define NR_syscalls 282 291#define NR_syscalls 282
292#include <linux/err.h>
292 293
293/* user-visible error numbers are in the range -1 - -122: see 294/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
294 <asm-m68k/errno.h> */ 295 <asm-m68k/errno.h> */
295 296
296#define __syscall_return(type, res) \ 297#define __syscall_return(type, res) \
297do { \ 298do { \
298 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 299 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
299 /* avoid using res which is declared to be in register d0; \ 300 /* avoid using res which is declared to be in register d0; \
300 errno might expand to a function call and clobber it. */ \ 301 errno might expand to a function call and clobber it. */ \
301 int __err = -(res); \ 302 int __err = -(res); \
@@ -462,61 +463,6 @@ type name(atype a, btype b, ctype c, dtype d, etype e) \
462#define __ARCH_WANT_SYS_SIGPROCMASK 463#define __ARCH_WANT_SYS_SIGPROCMASK
463#define __ARCH_WANT_SYS_RT_SIGACTION 464#define __ARCH_WANT_SYS_RT_SIGACTION
464 465
465#ifdef __KERNEL_SYSCALLS__
466
467#include <linux/compiler.h>
468#include <linux/interrupt.h>
469#include <linux/types.h>
470
471/*
472 * we need this inline - forking from kernel space will result
473 * in NO COPY ON WRITE (!!!), until an execve is executed. This
474 * is no problem, but for the stack. This is handled by not letting
475 * main() use the stack at all after fork(). Thus, no function
476 * calls - which means inline code for fork too, as otherwise we
477 * would use the stack upon exit from 'fork()'.
478 *
479 * Actually only pause and fork are needed inline, so that there
480 * won't be any messing with the stack from main(), but we define
481 * some others too.
482 */
483#define __NR__exit __NR_exit
484static inline _syscall0(int,pause)
485static inline _syscall0(int,sync)
486static inline _syscall0(pid_t,setsid)
487static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
488static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
489static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
490static inline _syscall1(int,dup,int,fd)
491static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
492static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
493static inline _syscall1(int,close,int,fd)
494static inline _syscall1(int,_exit,int,exitcode)
495static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
496static inline _syscall1(int,delete_module,const char *,name)
497
498static inline pid_t wait(int * wait_stat)
499{
500 return waitpid(-1,wait_stat,0);
501}
502asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
503 unsigned long prot, unsigned long flags,
504 unsigned long fd, unsigned long pgoff);
505asmlinkage int sys_execve(char *name, char **argv, char **envp);
506asmlinkage int sys_pipe(unsigned long *fildes);
507struct pt_regs;
508int sys_request_irq(unsigned int,
509 irqreturn_t (*)(int, void *, struct pt_regs *),
510 unsigned long, const char *, void *);
511void sys_free_irq(unsigned int, void *);
512struct sigaction;
513asmlinkage long sys_rt_sigaction(int sig,
514 const struct sigaction __user *act,
515 struct sigaction __user *oact,
516 size_t sigsetsize);
517
518#endif /* __KERNEL_SYSCALLS__ */
519
520/* 466/*
521 * "Conditional" syscalls 467 * "Conditional" syscalls
522 * 468 *
diff --git a/include/asm-mips/Kbuild b/include/asm-mips/Kbuild
index c68e1680da01..7897f05e3165 100644
--- a/include/asm-mips/Kbuild
+++ b/include/asm-mips/Kbuild
@@ -1 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3header-y += cachectl.h sgidefs.h sysmips.h
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 3b745e76f429..1e5ccdad3b02 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -112,8 +112,7 @@
112 * Valid machtype for group GALILEO 112 * Valid machtype for group GALILEO
113 */ 113 */
114#define MACH_GROUP_GALILEO 11 /* Galileo Eval Boards */ 114#define MACH_GROUP_GALILEO 11 /* Galileo Eval Boards */
115#define MACH_EV96100 0 /* EV96100 */ 115#define MACH_EV64120A 0 /* EV64120A */
116#define MACH_EV64120A 1 /* EV64120A */
117 116
118/* 117/*
119 * Valid machtype for group MOMENCO 118 * Valid machtype for group MOMENCO
@@ -126,12 +125,6 @@
126#define MACH_MOMENCO_OCELOT_3 4 125#define MACH_MOMENCO_OCELOT_3 4
127 126
128/* 127/*
129 * Valid machtype for group ITE
130 */
131#define MACH_GROUP_ITE 13 /* ITE Semi Eval Boards */
132#define MACH_QED_4N_S01B 0 /* ITE8172 based eval board */
133
134/*
135 * Valid machtype for group PHILIPS 128 * Valid machtype for group PHILIPS
136 */ 129 */
137#define MACH_GROUP_PHILIPS 14 130#define MACH_GROUP_PHILIPS 14
@@ -140,12 +133,6 @@
140#define MACH_PHILIPS_JBS 2 /* JBS */ 133#define MACH_PHILIPS_JBS 2 /* JBS */
141 134
142/* 135/*
143 * Valid machtype for group Globespan
144 */
145#define MACH_GROUP_GLOBESPAN 15 /* Globespan */
146#define MACH_IVR 0 /* IVR eval board */
147
148/*
149 * Valid machtype for group SIBYTE 136 * Valid machtype for group SIBYTE
150 */ 137 */
151#define MACH_GROUP_SIBYTE 16 /* Sibyte / Broadcom */ 138#define MACH_GROUP_SIBYTE 16 /* Sibyte / Broadcom */
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 47bc8f6c20d2..9ab59e2bb233 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -21,7 +21,6 @@
21 * - flush_cache_range(vma, start, end) flushes a range of pages 21 * - flush_cache_range(vma, start, end) flushes a range of pages
22 * - flush_icache_range(start, end) flush a range of instructions 22 * - flush_icache_range(start, end) flush a range of instructions
23 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache 23 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 * 24 *
26 * MIPS specific flush operations: 25 * MIPS specific flush operations:
27 * 26 *
@@ -39,7 +38,7 @@ extern void __flush_dcache_page(struct page *page);
39 38
40static inline void flush_dcache_page(struct page *page) 39static inline void flush_dcache_page(struct page *page)
41{ 40{
42 if (cpu_has_dc_aliases) 41 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
43 __flush_dcache_page(page); 42 __flush_dcache_page(page);
44 43
45} 44}
@@ -47,8 +46,11 @@ static inline void flush_dcache_page(struct page *page)
47#define flush_dcache_mmap_lock(mapping) do { } while (0) 46#define flush_dcache_mmap_lock(mapping) do { } while (0)
48#define flush_dcache_mmap_unlock(mapping) do { } while (0) 47#define flush_dcache_mmap_unlock(mapping) do { } while (0)
49 48
50extern void (*flush_icache_page)(struct vm_area_struct *vma, 49static inline void flush_icache_page(struct vm_area_struct *vma,
51 struct page *page); 50 struct page *page)
51{
52}
53
52extern void (*flush_icache_range)(unsigned long start, unsigned long end); 54extern void (*flush_icache_range)(unsigned long start, unsigned long end);
53#define flush_cache_vmap(start, end) flush_cache_all() 55#define flush_cache_vmap(start, end) flush_cache_all()
54#define flush_cache_vunmap(start, end) flush_cache_all() 56#define flush_cache_vunmap(start, end) flush_cache_all()
@@ -60,7 +62,7 @@ static inline void copy_to_user_page(struct vm_area_struct *vma,
60 if (cpu_has_dc_aliases) 62 if (cpu_has_dc_aliases)
61 flush_cache_page(vma, vaddr, page_to_pfn(page)); 63 flush_cache_page(vma, vaddr, page_to_pfn(page));
62 memcpy(dst, src, len); 64 memcpy(dst, src, len);
63 flush_icache_page(vma, page); 65 __flush_icache_page(vma, page);
64} 66}
65 67
66static inline void copy_from_user_page(struct vm_area_struct *vma, 68static inline void copy_from_user_page(struct vm_area_struct *vma,
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
index 787220e6c1fc..00a50ec1c19f 100644
--- a/include/asm-mips/fcntl.h
+++ b/include/asm-mips/fcntl.h
@@ -25,8 +25,6 @@
25 25
26#define F_SETOWN 24 /* for sockets. */ 26#define F_SETOWN 24 /* for sockets. */
27#define F_GETOWN 23 /* for sockets. */ 27#define F_GETOWN 23 /* for sockets. */
28#define F_SETSIG 10 /* for sockets. */
29#define F_GETSIG 11 /* for sockets. */
30 28
31#ifndef __mips64 29#ifndef __mips64
32#define F_GETLK64 33 /* using 'struct flock64' */ 30#define F_GETLK64 33 /* using 'struct flock64' */
diff --git a/include/asm-mips/galileo-boards/ev96100.h b/include/asm-mips/galileo-boards/ev96100.h
deleted file mode 100644
index 070dfd84a8e8..000000000000
--- a/include/asm-mips/galileo-boards/ev96100.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 *
3 */
4#ifndef _MIPS_EV96100_H
5#define _MIPS_EV96100_H
6
7#include <asm/addrspace.h>
8
9/*
10 * GT64120 config space base address
11 */
12#define GT64120_BASE (KSEG1ADDR(0x14000000))
13#define MIPS_GT_BASE GT64120_BASE
14
15/*
16 * PCI Bus allocation
17 */
18#define GT_PCI_MEM_BASE 0x12000000UL
19#define GT_PCI_MEM_SIZE 0x02000000UL
20#define GT_PCI_IO_BASE 0x10000000UL
21#define GT_PCI_IO_SIZE 0x02000000UL
22#define GT_ISA_IO_BASE PCI_IO_BASE
23
24/*
25 * Duart I/O ports.
26 */
27#define EV96100_COM1_BASE_ADDR (0xBD000000 + 0x20)
28#define EV96100_COM2_BASE_ADDR (0xBD000000 + 0x00)
29
30
31/*
32 * EV96100 interrupt controller register base.
33 */
34#define EV96100_ICTRL_REGS_BASE (KSEG1ADDR(0x1f000000))
35
36/*
37 * EV96100 UART register base.
38 */
39#define EV96100_UART0_REGS_BASE EV96100_COM1_BASE_ADDR
40#define EV96100_UART1_REGS_BASE EV96100_COM2_BASE_ADDR
41#define EV96100_BASE_BAUD ( 3686400 / 16 )
42
43
44/*
45 * Because of an error/peculiarity in the Galileo chip, we need to swap the
46 * bytes when running bigendian.
47 */
48#define __GT_READ(ofs) \
49 (*(volatile u32 *)(GT64120_BASE+(ofs)))
50#define __GT_WRITE(ofs, data) \
51 do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
52#define GT_READ(ofs) le32_to_cpu(__GT_READ(ofs))
53#define GT_WRITE(ofs, data) __GT_WRITE(ofs, cpu_to_le32(data))
54
55#endif /* !(_MIPS_EV96100_H) */
diff --git a/include/asm-mips/galileo-boards/ev96100int.h b/include/asm-mips/galileo-boards/ev96100int.h
deleted file mode 100644
index c58b16d06d6e..000000000000
--- a/include/asm-mips/galileo-boards/ev96100int.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 *
3 */
4#ifndef _MIPS_EV96100INT_H
5#define _MIPS_EV96100INT_H
6
7#define EV96100INT_UART_0 6 /* IP 6 */
8#define EV96100INT_TIMER 7 /* IP 7 */
9
10extern void ev96100int_init(void);
11
12#endif /* !(_MIPS_EV96100_H) */
diff --git a/include/asm-mips/galileo-boards/gt96100.h b/include/asm-mips/galileo-boards/gt96100.h
deleted file mode 100644
index aabd1b629c19..000000000000
--- a/include/asm-mips/galileo-boards/gt96100.h
+++ /dev/null
@@ -1,427 +0,0 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * stevel@mvista.com or source@mvista.com
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Register offsets of the MIPS GT96100 Advanced Communication Controller.
20 */
21#ifndef _GT96100_H
22#define _GT96100_H
23
24/*
25 * Galileo GT96100 internal register base.
26 */
27#define MIPS_GT96100_BASE (KSEG1ADDR(0x14000000))
28
29#define GT96100_WRITE(ofs, data) \
30 *(volatile u32 *)(MIPS_GT96100_BASE+ofs) = cpu_to_le32(data)
31#define GT96100_READ(ofs) \
32 le32_to_cpu(*(volatile u32 *)(MIPS_GT96100_BASE+ofs))
33
34#define GT96100_ETH_IO_SIZE 0x4000
35
36/************************************************************************
37 * Register offset addresses follow
38 ************************************************************************/
39
40/* CPU Interface Control Registers */
41#define GT96100_CPU_INTERF_CONFIG 0x000000
42
43/* Ethernet Ports */
44#define GT96100_ETH_PHY_ADDR_REG 0x080800
45#define GT96100_ETH_SMI_REG 0x080810
46/*
47 These are offsets to port 0 registers. Add GT96100_ETH_IO_SIZE to
48 get offsets to port 1 registers.
49*/
50#define GT96100_ETH_PORT_CONFIG 0x084800
51#define GT96100_ETH_PORT_CONFIG_EXT 0x084808
52#define GT96100_ETH_PORT_COMM 0x084810
53#define GT96100_ETH_PORT_STATUS 0x084818
54#define GT96100_ETH_SER_PARAM 0x084820
55#define GT96100_ETH_HASH_TBL_PTR 0x084828
56#define GT96100_ETH_FLOW_CNTRL_SRC_ADDR_L 0x084830
57#define GT96100_ETH_FLOW_CNTRL_SRC_ADDR_H 0x084838
58#define GT96100_ETH_SDMA_CONFIG 0x084840
59#define GT96100_ETH_SDMA_COMM 0x084848
60#define GT96100_ETH_INT_CAUSE 0x084850
61#define GT96100_ETH_INT_MASK 0x084858
62#define GT96100_ETH_1ST_RX_DESC_PTR0 0x084880
63#define GT96100_ETH_1ST_RX_DESC_PTR1 0x084884
64#define GT96100_ETH_1ST_RX_DESC_PTR2 0x084888
65#define GT96100_ETH_1ST_RX_DESC_PTR3 0x08488C
66#define GT96100_ETH_CURR_RX_DESC_PTR0 0x0848A0
67#define GT96100_ETH_CURR_RX_DESC_PTR1 0x0848A4
68#define GT96100_ETH_CURR_RX_DESC_PTR2 0x0848A8
69#define GT96100_ETH_CURR_RX_DESC_PTR3 0x0848AC
70#define GT96100_ETH_CURR_TX_DESC_PTR0 0x0848E0
71#define GT96100_ETH_CURR_TX_DESC_PTR1 0x0848E4
72#define GT96100_ETH_MIB_COUNT_BASE 0x085800
73
74/* SDMAs */
75#define GT96100_SDMA_GROUP_CONFIG 0x101AF0
76/* SDMA Group 0 */
77#define GT96100_SDMA_G0_CHAN0_CONFIG 0x000900
78#define GT96100_SDMA_G0_CHAN0_COMM 0x000908
79#define GT96100_SDMA_G0_CHAN0_RX_DESC_BASE 0x008900
80#define GT96100_SDMA_G0_CHAN0_CURR_RX_DESC_PTR 0x008910
81#define GT96100_SDMA_G0_CHAN0_TX_DESC_BASE 0x00C900
82#define GT96100_SDMA_G0_CHAN0_CURR_TX_DESC_PTR 0x00C910
83#define GT96100_SDMA_G0_CHAN0_1ST_TX_DESC_PTR 0x00C914
84#define GT96100_SDMA_G0_CHAN1_CONFIG 0x010900
85#define GT96100_SDMA_G0_CHAN1_COMM 0x010908
86#define GT96100_SDMA_G0_CHAN1_RX_DESC_BASE 0x018900
87#define GT96100_SDMA_G0_CHAN1_CURR_RX_DESC_PTR 0x018910
88#define GT96100_SDMA_G0_CHAN1_TX_DESC_BASE 0x01C900
89#define GT96100_SDMA_G0_CHAN1_CURR_TX_DESC_PTR 0x01C910
90#define GT96100_SDMA_G0_CHAN1_1ST_TX_DESC_PTR 0x01C914
91#define GT96100_SDMA_G0_CHAN2_CONFIG 0x020900
92#define GT96100_SDMA_G0_CHAN2_COMM 0x020908
93#define GT96100_SDMA_G0_CHAN2_RX_DESC_BASE 0x028900
94#define GT96100_SDMA_G0_CHAN2_CURR_RX_DESC_PTR 0x028910
95#define GT96100_SDMA_G0_CHAN2_TX_DESC_BASE 0x02C900
96#define GT96100_SDMA_G0_CHAN2_CURR_TX_DESC_PTR 0x02C910
97#define GT96100_SDMA_G0_CHAN2_1ST_TX_DESC_PTR 0x02C914
98#define GT96100_SDMA_G0_CHAN3_CONFIG 0x030900
99#define GT96100_SDMA_G0_CHAN3_COMM 0x030908
100#define GT96100_SDMA_G0_CHAN3_RX_DESC_BASE 0x038900
101#define GT96100_SDMA_G0_CHAN3_CURR_RX_DESC_PTR 0x038910
102#define GT96100_SDMA_G0_CHAN3_TX_DESC_BASE 0x03C900
103#define GT96100_SDMA_G0_CHAN3_CURR_TX_DESC_PTR 0x03C910
104#define GT96100_SDMA_G0_CHAN3_1ST_TX_DESC_PTR 0x03C914
105#define GT96100_SDMA_G0_CHAN4_CONFIG 0x040900
106#define GT96100_SDMA_G0_CHAN4_COMM 0x040908
107#define GT96100_SDMA_G0_CHAN4_RX_DESC_BASE 0x048900
108#define GT96100_SDMA_G0_CHAN4_CURR_RX_DESC_PTR 0x048910
109#define GT96100_SDMA_G0_CHAN4_TX_DESC_BASE 0x04C900
110#define GT96100_SDMA_G0_CHAN4_CURR_TX_DESC_PTR 0x04C910
111#define GT96100_SDMA_G0_CHAN4_1ST_TX_DESC_PTR 0x04C914
112#define GT96100_SDMA_G0_CHAN5_CONFIG 0x050900
113#define GT96100_SDMA_G0_CHAN5_COMM 0x050908
114#define GT96100_SDMA_G0_CHAN5_RX_DESC_BASE 0x058900
115#define GT96100_SDMA_G0_CHAN5_CURR_RX_DESC_PTR 0x058910
116#define GT96100_SDMA_G0_CHAN5_TX_DESC_BASE 0x05C900
117#define GT96100_SDMA_G0_CHAN5_CURR_TX_DESC_PTR 0x05C910
118#define GT96100_SDMA_G0_CHAN5_1ST_TX_DESC_PTR 0x05C914
119#define GT96100_SDMA_G0_CHAN6_CONFIG 0x060900
120#define GT96100_SDMA_G0_CHAN6_COMM 0x060908
121#define GT96100_SDMA_G0_CHAN6_RX_DESC_BASE 0x068900
122#define GT96100_SDMA_G0_CHAN6_CURR_RX_DESC_PTR 0x068910
123#define GT96100_SDMA_G0_CHAN6_TX_DESC_BASE 0x06C900
124#define GT96100_SDMA_G0_CHAN6_CURR_TX_DESC_PTR 0x06C910
125#define GT96100_SDMA_G0_CHAN6_1ST_TX_DESC_PTR 0x06C914
126#define GT96100_SDMA_G0_CHAN7_CONFIG 0x070900
127#define GT96100_SDMA_G0_CHAN7_COMM 0x070908
128#define GT96100_SDMA_G0_CHAN7_RX_DESC_BASE 0x078900
129#define GT96100_SDMA_G0_CHAN7_CURR_RX_DESC_PTR 0x078910
130#define GT96100_SDMA_G0_CHAN7_TX_DESC_BASE 0x07C900
131#define GT96100_SDMA_G0_CHAN7_CURR_TX_DESC_PTR 0x07C910
132#define GT96100_SDMA_G0_CHAN7_1ST_TX_DESC_PTR 0x07C914
133/* SDMA Group 1 */
134#define GT96100_SDMA_G1_CHAN0_CONFIG 0x100900
135#define GT96100_SDMA_G1_CHAN0_COMM 0x100908
136#define GT96100_SDMA_G1_CHAN0_RX_DESC_BASE 0x108900
137#define GT96100_SDMA_G1_CHAN0_CURR_RX_DESC_PTR 0x108910
138#define GT96100_SDMA_G1_CHAN0_TX_DESC_BASE 0x10C900
139#define GT96100_SDMA_G1_CHAN0_CURR_TX_DESC_PTR 0x10C910
140#define GT96100_SDMA_G1_CHAN0_1ST_TX_DESC_PTR 0x10C914
141#define GT96100_SDMA_G1_CHAN1_CONFIG 0x110900
142#define GT96100_SDMA_G1_CHAN1_COMM 0x110908
143#define GT96100_SDMA_G1_CHAN1_RX_DESC_BASE 0x118900
144#define GT96100_SDMA_G1_CHAN1_CURR_RX_DESC_PTR 0x118910
145#define GT96100_SDMA_G1_CHAN1_TX_DESC_BASE 0x11C900
146#define GT96100_SDMA_G1_CHAN1_CURR_TX_DESC_PTR 0x11C910
147#define GT96100_SDMA_G1_CHAN1_1ST_TX_DESC_PTR 0x11C914
148#define GT96100_SDMA_G1_CHAN2_CONFIG 0x120900
149#define GT96100_SDMA_G1_CHAN2_COMM 0x120908
150#define GT96100_SDMA_G1_CHAN2_RX_DESC_BASE 0x128900
151#define GT96100_SDMA_G1_CHAN2_CURR_RX_DESC_PTR 0x128910
152#define GT96100_SDMA_G1_CHAN2_TX_DESC_BASE 0x12C900
153#define GT96100_SDMA_G1_CHAN2_CURR_TX_DESC_PTR 0x12C910
154#define GT96100_SDMA_G1_CHAN2_1ST_TX_DESC_PTR 0x12C914
155#define GT96100_SDMA_G1_CHAN3_CONFIG 0x130900
156#define GT96100_SDMA_G1_CHAN3_COMM 0x130908
157#define GT96100_SDMA_G1_CHAN3_RX_DESC_BASE 0x138900
158#define GT96100_SDMA_G1_CHAN3_CURR_RX_DESC_PTR 0x138910
159#define GT96100_SDMA_G1_CHAN3_TX_DESC_BASE 0x13C900
160#define GT96100_SDMA_G1_CHAN3_CURR_TX_DESC_PTR 0x13C910
161#define GT96100_SDMA_G1_CHAN3_1ST_TX_DESC_PTR 0x13C914
162#define GT96100_SDMA_G1_CHAN4_CONFIG 0x140900
163#define GT96100_SDMA_G1_CHAN4_COMM 0x140908
164#define GT96100_SDMA_G1_CHAN4_RX_DESC_BASE 0x148900
165#define GT96100_SDMA_G1_CHAN4_CURR_RX_DESC_PTR 0x148910
166#define GT96100_SDMA_G1_CHAN4_TX_DESC_BASE 0x14C900
167#define GT96100_SDMA_G1_CHAN4_CURR_TX_DESC_PTR 0x14C910
168#define GT96100_SDMA_G1_CHAN4_1ST_TX_DESC_PTR 0x14C914
169#define GT96100_SDMA_G1_CHAN5_CONFIG 0x150900
170#define GT96100_SDMA_G1_CHAN5_COMM 0x150908
171#define GT96100_SDMA_G1_CHAN5_RX_DESC_BASE 0x158900
172#define GT96100_SDMA_G1_CHAN5_CURR_RX_DESC_PTR 0x158910
173#define GT96100_SDMA_G1_CHAN5_TX_DESC_BASE 0x15C900
174#define GT96100_SDMA_G1_CHAN5_CURR_TX_DESC_PTR 0x15C910
175#define GT96100_SDMA_G1_CHAN5_1ST_TX_DESC_PTR 0x15C914
176#define GT96100_SDMA_G1_CHAN6_CONFIG 0x160900
177#define GT96100_SDMA_G1_CHAN6_COMM 0x160908
178#define GT96100_SDMA_G1_CHAN6_RX_DESC_BASE 0x168900
179#define GT96100_SDMA_G1_CHAN6_CURR_RX_DESC_PTR 0x168910
180#define GT96100_SDMA_G1_CHAN6_TX_DESC_BASE 0x16C900
181#define GT96100_SDMA_G1_CHAN6_CURR_TX_DESC_PTR 0x16C910
182#define GT96100_SDMA_G1_CHAN6_1ST_TX_DESC_PTR 0x16C914
183#define GT96100_SDMA_G1_CHAN7_CONFIG 0x170900
184#define GT96100_SDMA_G1_CHAN7_COMM 0x170908
185#define GT96100_SDMA_G1_CHAN7_RX_DESC_BASE 0x178900
186#define GT96100_SDMA_G1_CHAN7_CURR_RX_DESC_PTR 0x178910
187#define GT96100_SDMA_G1_CHAN7_TX_DESC_BASE 0x17C900
188#define GT96100_SDMA_G1_CHAN7_CURR_TX_DESC_PTR 0x17C910
189#define GT96100_SDMA_G1_CHAN7_1ST_TX_DESC_PTR 0x17C914
190/* MPSCs */
191#define GT96100_MPSC0_MAIN_CONFIG_LOW 0x000A00
192#define GT96100_MPSC0_MAIN_CONFIG_HIGH 0x000A04
193#define GT96100_MPSC0_PROTOCOL_CONFIG 0x000A08
194#define GT96100_MPSC_CHAN0_REG1 0x000A0C
195#define GT96100_MPSC_CHAN0_REG2 0x000A10
196#define GT96100_MPSC_CHAN0_REG3 0x000A14
197#define GT96100_MPSC_CHAN0_REG4 0x000A18
198#define GT96100_MPSC_CHAN0_REG5 0x000A1C
199#define GT96100_MPSC_CHAN0_REG6 0x000A20
200#define GT96100_MPSC_CHAN0_REG7 0x000A24
201#define GT96100_MPSC_CHAN0_REG8 0x000A28
202#define GT96100_MPSC_CHAN0_REG9 0x000A2C
203#define GT96100_MPSC_CHAN0_REG10 0x000A30
204#define GT96100_MPSC_CHAN0_REG11 0x000A34
205#define GT96100_MPSC1_MAIN_CONFIG_LOW 0x008A00
206#define GT96100_MPSC1_MAIN_CONFIG_HIGH 0x008A04
207#define GT96100_MPSC1_PROTOCOL_CONFIG 0x008A08
208#define GT96100_MPSC_CHAN1_REG1 0x008A0C
209#define GT96100_MPSC_CHAN1_REG2 0x008A10
210#define GT96100_MPSC_CHAN1_REG3 0x008A14
211#define GT96100_MPSC_CHAN1_REG4 0x008A18
212#define GT96100_MPSC_CHAN1_REG5 0x008A1C
213#define GT96100_MPSC_CHAN1_REG6 0x008A20
214#define GT96100_MPSC_CHAN1_REG7 0x008A24
215#define GT96100_MPSC_CHAN1_REG8 0x008A28
216#define GT96100_MPSC_CHAN1_REG9 0x008A2C
217#define GT96100_MPSC_CHAN1_REG10 0x008A30
218#define GT96100_MPSC_CHAN1_REG11 0x008A34
219#define GT96100_MPSC2_MAIN_CONFIG_LOW 0x010A00
220#define GT96100_MPSC2_MAIN_CONFIG_HIGH 0x010A04
221#define GT96100_MPSC2_PROTOCOL_CONFIG 0x010A08
222#define GT96100_MPSC_CHAN2_REG1 0x010A0C
223#define GT96100_MPSC_CHAN2_REG2 0x010A10
224#define GT96100_MPSC_CHAN2_REG3 0x010A14
225#define GT96100_MPSC_CHAN2_REG4 0x010A18
226#define GT96100_MPSC_CHAN2_REG5 0x010A1C
227#define GT96100_MPSC_CHAN2_REG6 0x010A20
228#define GT96100_MPSC_CHAN2_REG7 0x010A24
229#define GT96100_MPSC_CHAN2_REG8 0x010A28
230#define GT96100_MPSC_CHAN2_REG9 0x010A2C
231#define GT96100_MPSC_CHAN2_REG10 0x010A30
232#define GT96100_MPSC_CHAN2_REG11 0x010A34
233#define GT96100_MPSC3_MAIN_CONFIG_LOW 0x018A00
234#define GT96100_MPSC3_MAIN_CONFIG_HIGH 0x018A04
235#define GT96100_MPSC3_PROTOCOL_CONFIG 0x018A08
236#define GT96100_MPSC_CHAN3_REG1 0x018A0C
237#define GT96100_MPSC_CHAN3_REG2 0x018A10
238#define GT96100_MPSC_CHAN3_REG3 0x018A14
239#define GT96100_MPSC_CHAN3_REG4 0x018A18
240#define GT96100_MPSC_CHAN3_REG5 0x018A1C
241#define GT96100_MPSC_CHAN3_REG6 0x018A20
242#define GT96100_MPSC_CHAN3_REG7 0x018A24
243#define GT96100_MPSC_CHAN3_REG8 0x018A28
244#define GT96100_MPSC_CHAN3_REG9 0x018A2C
245#define GT96100_MPSC_CHAN3_REG10 0x018A30
246#define GT96100_MPSC_CHAN3_REG11 0x018A34
247#define GT96100_MPSC4_MAIN_CONFIG_LOW 0x020A00
248#define GT96100_MPSC4_MAIN_CONFIG_HIGH 0x020A04
249#define GT96100_MPSC4_PROTOCOL_CONFIG 0x020A08
250#define GT96100_MPSC_CHAN4_REG1 0x020A0C
251#define GT96100_MPSC_CHAN4_REG2 0x020A10
252#define GT96100_MPSC_CHAN4_REG3 0x020A14
253#define GT96100_MPSC_CHAN4_REG4 0x020A18
254#define GT96100_MPSC_CHAN4_REG5 0x020A1C
255#define GT96100_MPSC_CHAN4_REG6 0x020A20
256#define GT96100_MPSC_CHAN4_REG7 0x020A24
257#define GT96100_MPSC_CHAN4_REG8 0x020A28
258#define GT96100_MPSC_CHAN4_REG9 0x020A2C
259#define GT96100_MPSC_CHAN4_REG10 0x020A30
260#define GT96100_MPSC_CHAN4_REG11 0x020A34
261#define GT96100_MPSC5_MAIN_CONFIG_LOW 0x028A00
262#define GT96100_MPSC5_MAIN_CONFIG_HIGH 0x028A04
263#define GT96100_MPSC5_PROTOCOL_CONFIG 0x028A08
264#define GT96100_MPSC_CHAN5_REG1 0x028A0C
265#define GT96100_MPSC_CHAN5_REG2 0x028A10
266#define GT96100_MPSC_CHAN5_REG3 0x028A14
267#define GT96100_MPSC_CHAN5_REG4 0x028A18
268#define GT96100_MPSC_CHAN5_REG5 0x028A1C
269#define GT96100_MPSC_CHAN5_REG6 0x028A20
270#define GT96100_MPSC_CHAN5_REG7 0x028A24
271#define GT96100_MPSC_CHAN5_REG8 0x028A28
272#define GT96100_MPSC_CHAN5_REG9 0x028A2C
273#define GT96100_MPSC_CHAN5_REG10 0x028A30
274#define GT96100_MPSC_CHAN5_REG11 0x028A34
275#define GT96100_MPSC6_MAIN_CONFIG_LOW 0x030A00
276#define GT96100_MPSC6_MAIN_CONFIG_HIGH 0x030A04
277#define GT96100_MPSC6_PROTOCOL_CONFIG 0x030A08
278#define GT96100_MPSC_CHAN6_REG1 0x030A0C
279#define GT96100_MPSC_CHAN6_REG2 0x030A10
280#define GT96100_MPSC_CHAN6_REG3 0x030A14
281#define GT96100_MPSC_CHAN6_REG4 0x030A18
282#define GT96100_MPSC_CHAN6_REG5 0x030A1C
283#define GT96100_MPSC_CHAN6_REG6 0x030A20
284#define GT96100_MPSC_CHAN6_REG7 0x030A24
285#define GT96100_MPSC_CHAN6_REG8 0x030A28
286#define GT96100_MPSC_CHAN6_REG9 0x030A2C
287#define GT96100_MPSC_CHAN6_REG10 0x030A30
288#define GT96100_MPSC_CHAN6_REG11 0x030A34
289#define GT96100_MPSC7_MAIN_CONFIG_LOW 0x038A00
290#define GT96100_MPSC7_MAIN_CONFIG_HIGH 0x038A04
291#define GT96100_MPSC7_PROTOCOL_CONFIG 0x038A08
292#define GT96100_MPSC_CHAN7_REG1 0x038A0C
293#define GT96100_MPSC_CHAN7_REG2 0x038A10
294#define GT96100_MPSC_CHAN7_REG3 0x038A14
295#define GT96100_MPSC_CHAN7_REG4 0x038A18
296#define GT96100_MPSC_CHAN7_REG5 0x038A1C
297#define GT96100_MPSC_CHAN7_REG6 0x038A20
298#define GT96100_MPSC_CHAN7_REG7 0x038A24
299#define GT96100_MPSC_CHAN7_REG8 0x038A28
300#define GT96100_MPSC_CHAN7_REG9 0x038A2C
301#define GT96100_MPSC_CHAN7_REG10 0x038A30
302#define GT96100_MPSC_CHAN7_REG11 0x038A34
303/* FlexTDMs */
304/* TDPR0 - Transmit Dual Port RAM. block size 0xff */
305#define GT96100_FXTDM0_TDPR0_BLK0_BASE 0x000B00
306#define GT96100_FXTDM0_TDPR0_BLK1_BASE 0x001B00
307#define GT96100_FXTDM0_TDPR0_BLK2_BASE 0x002B00
308#define GT96100_FXTDM0_TDPR0_BLK3_BASE 0x003B00
309/* RDPR0 - Receive Dual Port RAM. block size 0xff */
310#define GT96100_FXTDM0_RDPR0_BLK0_BASE 0x004B00
311#define GT96100_FXTDM0_RDPR0_BLK1_BASE 0x005B00
312#define GT96100_FXTDM0_RDPR0_BLK2_BASE 0x006B00
313#define GT96100_FXTDM0_RDPR0_BLK3_BASE 0x007B00
314#define GT96100_FXTDM0_TX_READ_PTR 0x008B00
315#define GT96100_FXTDM0_RX_READ_PTR 0x008B04
316#define GT96100_FXTDM0_CONFIG 0x008B08
317#define GT96100_FXTDM0_AUX_CHANA_TX 0x008B0C
318#define GT96100_FXTDM0_AUX_CHANA_RX 0x008B10
319#define GT96100_FXTDM0_AUX_CHANB_TX 0x008B14
320#define GT96100_FXTDM0_AUX_CHANB_RX 0x008B18
321#define GT96100_FXTDM1_TDPR1_BLK0_BASE 0x010B00
322#define GT96100_FXTDM1_TDPR1_BLK1_BASE 0x011B00
323#define GT96100_FXTDM1_TDPR1_BLK2_BASE 0x012B00
324#define GT96100_FXTDM1_TDPR1_BLK3_BASE 0x013B00
325#define GT96100_FXTDM1_RDPR1_BLK0_BASE 0x014B00
326#define GT96100_FXTDM1_RDPR1_BLK1_BASE 0x015B00
327#define GT96100_FXTDM1_RDPR1_BLK2_BASE 0x016B00
328#define GT96100_FXTDM1_RDPR1_BLK3_BASE 0x017B00
329#define GT96100_FXTDM1_TX_READ_PTR 0x018B00
330#define GT96100_FXTDM1_RX_READ_PTR 0x018B04
331#define GT96100_FXTDM1_CONFIG 0x018B08
332#define GT96100_FXTDM1_AUX_CHANA_TX 0x018B0C
333#define GT96100_FXTDM1_AUX_CHANA_RX 0x018B10
334#define GT96100_FLTDM1_AUX_CHANB_TX 0x018B14
335#define GT96100_FLTDM1_AUX_CHANB_RX 0x018B18
336#define GT96100_FLTDM2_TDPR2_BLK0_BASE 0x020B00
337#define GT96100_FLTDM2_TDPR2_BLK1_BASE 0x021B00
338#define GT96100_FLTDM2_TDPR2_BLK2_BASE 0x022B00
339#define GT96100_FLTDM2_TDPR2_BLK3_BASE 0x023B00
340#define GT96100_FLTDM2_RDPR2_BLK0_BASE 0x024B00
341#define GT96100_FLTDM2_RDPR2_BLK1_BASE 0x025B00
342#define GT96100_FLTDM2_RDPR2_BLK2_BASE 0x026B00
343#define GT96100_FLTDM2_RDPR2_BLK3_BASE 0x027B00
344#define GT96100_FLTDM2_TX_READ_PTR 0x028B00
345#define GT96100_FLTDM2_RX_READ_PTR 0x028B04
346#define GT96100_FLTDM2_CONFIG 0x028B08
347#define GT96100_FLTDM2_AUX_CHANA_TX 0x028B0C
348#define GT96100_FLTDM2_AUX_CHANA_RX 0x028B10
349#define GT96100_FLTDM2_AUX_CHANB_TX 0x028B14
350#define GT96100_FLTDM2_AUX_CHANB_RX 0x028B18
351#define GT96100_FLTDM3_TDPR3_BLK0_BASE 0x030B00
352#define GT96100_FLTDM3_TDPR3_BLK1_BASE 0x031B00
353#define GT96100_FLTDM3_TDPR3_BLK2_BASE 0x032B00
354#define GT96100_FLTDM3_TDPR3_BLK3_BASE 0x033B00
355#define GT96100_FXTDM3_RDPR3_BLK0_BASE 0x034B00
356#define GT96100_FXTDM3_RDPR3_BLK1_BASE 0x035B00
357#define GT96100_FXTDM3_RDPR3_BLK2_BASE 0x036B00
358#define GT96100_FXTDM3_RDPR3_BLK3_BASE 0x037B00
359#define GT96100_FXTDM3_TX_READ_PTR 0x038B00
360#define GT96100_FXTDM3_RX_READ_PTR 0x038B04
361#define GT96100_FXTDM3_CONFIG 0x038B08
362#define GT96100_FXTDM3_AUX_CHANA_TX 0x038B0C
363#define GT96100_FXTDM3_AUX_CHANA_RX 0x038B10
364#define GT96100_FXTDM3_AUX_CHANB_TX 0x038B14
365#define GT96100_FXTDM3_AUX_CHANB_RX 0x038B18
366/* Baud Rate Generators */
367#define GT96100_BRG0_CONFIG 0x102A00
368#define GT96100_BRG0_BAUD_TUNE 0x102A04
369#define GT96100_BRG1_CONFIG 0x102A08
370#define GT96100_BRG1_BAUD_TUNE 0x102A0C
371#define GT96100_BRG2_CONFIG 0x102A10
372#define GT96100_BRG2_BAUD_TUNE 0x102A14
373#define GT96100_BRG3_CONFIG 0x102A18
374#define GT96100_BRG3_BAUD_TUNE 0x102A1C
375#define GT96100_BRG4_CONFIG 0x102A20
376#define GT96100_BRG4_BAUD_TUNE 0x102A24
377#define GT96100_BRG5_CONFIG 0x102A28
378#define GT96100_BRG5_BAUD_TUNE 0x102A2C
379#define GT96100_BRG6_CONFIG 0x102A30
380#define GT96100_BRG6_BAUD_TUNE 0x102A34
381#define GT96100_BRG7_CONFIG 0x102A38
382#define GT96100_BRG7_BAUD_TUNE 0x102A3C
383/* Routing Registers */
384#define GT96100_ROUTE_MAIN 0x101A00
385#define GT96100_ROUTE_RX_CLOCK 0x101A10
386#define GT96100_ROUTE_TX_CLOCK 0x101A20
387/* General Purpose Ports */
388#define GT96100_GPP_CONFIG0 0x100A00
389#define GT96100_GPP_CONFIG1 0x100A04
390#define GT96100_GPP_CONFIG2 0x100A08
391#define GT96100_GPP_CONFIG3 0x100A0C
392#define GT96100_GPP_IO0 0x100A20
393#define GT96100_GPP_IO1 0x100A24
394#define GT96100_GPP_IO2 0x100A28
395#define GT96100_GPP_IO3 0x100A2C
396#define GT96100_GPP_DATA0 0x100A40
397#define GT96100_GPP_DATA1 0x100A44
398#define GT96100_GPP_DATA2 0x100A48
399#define GT96100_GPP_DATA3 0x100A4C
400#define GT96100_GPP_LEVEL0 0x100A60
401#define GT96100_GPP_LEVEL1 0x100A64
402#define GT96100_GPP_LEVEL2 0x100A68
403#define GT96100_GPP_LEVEL3 0x100A6C
404/* Watchdog */
405#define GT96100_WD_CONFIG 0x101A80
406#define GT96100_WD_VALUE 0x101A84
407/* Communication Unit Arbiter */
408#define GT96100_COMM_UNIT_ARBTR_CONFIG 0x101AC0
409/* PCI Arbiters */
410#define GT96100_PCI0_ARBTR_CONFIG 0x101AE0
411#define GT96100_PCI1_ARBTR_CONFIG 0x101AE4
412/* CIU Arbiter */
413#define GT96100_CIU_ARBITER_CONFIG 0x101AC0
414/* Interrupt Controller */
415#define GT96100_MAIN_CAUSE 0x000C18
416#define GT96100_INT0_MAIN_MASK 0x000C1C
417#define GT96100_INT1_MAIN_MASK 0x000C24
418#define GT96100_HIGH_CAUSE 0x000C98
419#define GT96100_INT0_HIGH_MASK 0x000C9C
420#define GT96100_INT1_HIGH_MASK 0x000CA4
421#define GT96100_INT0_SELECT 0x000C70
422#define GT96100_INT1_SELECT 0x000C74
423#define GT96100_SERIAL_CAUSE 0x103A00
424#define GT96100_SERINT0_MASK 0x103A80
425#define GT96100_SERINT1_MASK 0x103A88
426
427#endif /* _GT96100_H */
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 25f5e8a4177d..0fe02945feba 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -12,102 +12,95 @@
12 12
13 13
14#ifdef __ASSEMBLY__ 14#ifdef __ASSEMBLY__
15 15#define ASMMACRO(name, code...) .macro name; code; .endm
16 .macro _ssnop
17 sll $0, $0, 1
18 .endm
19
20 .macro _ehb
21 sll $0, $0, 3
22 .endm
23
24/*
25 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
26 * use of the JTLB for instructions should not occur for 4 cpu cycles and use
27 * for data translations should not occur for 3 cpu cycles.
28 */
29#ifdef CONFIG_CPU_RM9000
30
31 .macro mtc0_tlbw_hazard
32 .set push
33 .set mips32
34 _ssnop; _ssnop; _ssnop; _ssnop
35 .set pop
36 .endm
37
38 .macro tlbw_eret_hazard
39 .set push
40 .set mips32
41 _ssnop; _ssnop; _ssnop; _ssnop
42 .set pop
43 .endm
44
45#else 16#else
46 17
47/* 18#define ASMMACRO(name, code...) \
48 * The taken branch will result in a two cycle penalty for the two killed 19__asm__(".macro " #name "; " #code "; .endm"); \
49 * instructions on R4000 / R4400. Other processors only have a single cycle 20 \
50 * hazard so this is nice trick to have an optimal code for a range of 21static inline void name(void) \
51 * processors. 22{ \
52 */ 23 __asm__ __volatile__ (#name); \
53 .macro mtc0_tlbw_hazard 24}
54 b . + 8
55 .endm
56 25
57 .macro tlbw_eret_hazard
58 .endm
59#endif 26#endif
60 27
28ASMMACRO(_ssnop,
29 sll $0, $0, 1
30 )
31
32ASMMACRO(_ehb,
33 sll $0, $0, 3
34 )
35
61/* 36/*
62 * mtc0->mfc0 hazard 37 * TLB hazards
63 * The 24K has a 2 cycle mtc0/mfc0 execution hazard.
64 * It is a MIPS32R2 processor so ehb will clear the hazard.
65 */ 38 */
39#if defined(CONFIG_CPU_MIPSR2)
66 40
67#ifdef CONFIG_CPU_MIPSR2
68/* 41/*
69 * Use a macro for ehb unless explicit support for MIPSR2 is enabled 42 * MIPSR2 defines ehb for hazard avoidance
70 */ 43 */
71 44
72#define irq_enable_hazard \ 45ASMMACRO(mtc0_tlbw_hazard,
46 _ehb
47 )
48ASMMACRO(tlbw_use_hazard,
49 _ehb
50 )
51ASMMACRO(tlb_probe_hazard,
52 _ehb
53 )
54ASMMACRO(irq_enable_hazard,
55 )
56ASMMACRO(irq_disable_hazard,
73 _ehb 57 _ehb
74 58 )
75#define irq_disable_hazard \ 59ASMMACRO(back_to_back_c0_hazard,
76 _ehb 60 _ehb
77 61 )
78#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000)
79
80/* 62/*
81 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 63 * gcc has a tradition of misscompiling the previous construct using the
64 * address of a label as argument to inline assembler. Gas otoh has the
65 * annoying difference between la and dla which are only usable for 32-bit
66 * rsp. 64-bit code, so can't be used without conditional compilation.
67 * The alterantive is switching the assembler to 64-bit code which happens
68 * to work right even for 32-bit code ...
82 */ 69 */
70#define instruction_hazard() \
71do { \
72 unsigned long tmp; \
73 \
74 __asm__ __volatile__( \
75 " .set mips64r2 \n" \
76 " dla %0, 1f \n" \
77 " jr.hb %0 \n" \
78 " .set mips0 \n" \
79 "1: \n" \
80 : "=r" (tmp)); \
81} while (0)
83 82
84#define irq_enable_hazard 83#elif defined(CONFIG_CPU_R10000)
85
86#define irq_disable_hazard
87
88#else
89 84
90/* 85/*
91 * Classic MIPS needs 1 - 3 nops or ssnops 86 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
92 */ 87 */
93#define irq_enable_hazard
94#define irq_disable_hazard \
95 _ssnop; _ssnop; _ssnop
96 88
97#endif 89ASMMACRO(mtc0_tlbw_hazard,
98 90 )
99#else /* __ASSEMBLY__ */ 91ASMMACRO(tlbw_use_hazard,
100 92 )
101__asm__( 93ASMMACRO(tlb_probe_hazard,
102 " .macro _ssnop \n" 94 )
103 " sll $0, $0, 1 \n" 95ASMMACRO(irq_enable_hazard,
104 " .endm \n" 96 )
105 " \n" 97ASMMACRO(irq_disable_hazard,
106 " .macro _ehb \n" 98 )
107 " sll $0, $0, 3 \n" 99ASMMACRO(back_to_back_c0_hazard,
108 " .endm \n"); 100 )
101#define instruction_hazard() do { } while (0)
109 102
110#ifdef CONFIG_CPU_RM9000 103#elif defined(CONFIG_CPU_RM9000)
111 104
112/* 105/*
113 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent 106 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
@@ -115,176 +108,73 @@ __asm__(
115 * for data translations should not occur for 3 cpu cycles. 108 * for data translations should not occur for 3 cpu cycles.
116 */ 109 */
117 110
118#define mtc0_tlbw_hazard() \ 111ASMMACRO(mtc0_tlbw_hazard,
119 __asm__ __volatile__( \ 112 _ssnop; _ssnop; _ssnop; _ssnop
120 " .set mips32 \n" \ 113 )
121 " _ssnop \n" \ 114ASMMACRO(tlbw_use_hazard,
122 " _ssnop \n" \ 115 _ssnop; _ssnop; _ssnop; _ssnop
123 " _ssnop \n" \ 116 )
124 " _ssnop \n" \ 117ASMMACRO(tlb_probe_hazard,
125 " .set mips0 \n") 118 _ssnop; _ssnop; _ssnop; _ssnop
126 119 )
127#define tlbw_use_hazard() \ 120ASMMACRO(irq_enable_hazard,
128 __asm__ __volatile__( \ 121 )
129 " .set mips32 \n" \ 122ASMMACRO(irq_disable_hazard,
130 " _ssnop \n" \ 123 )
131 " _ssnop \n" \ 124ASMMACRO(back_to_back_c0_hazard,
132 " _ssnop \n" \ 125 )
133 " _ssnop \n" \ 126#define instruction_hazard() do { } while (0)
134 " .set mips0 \n")
135
136#else
137
138/*
139 * Overkill warning ...
140 */
141#define mtc0_tlbw_hazard() \
142 __asm__ __volatile__( \
143 " .set noreorder \n" \
144 " nop \n" \
145 " nop \n" \
146 " nop \n" \
147 " nop \n" \
148 " nop \n" \
149 " nop \n" \
150 " .set reorder \n")
151
152#define tlbw_use_hazard() \
153 __asm__ __volatile__( \
154 " .set noreorder \n" \
155 " nop \n" \
156 " nop \n" \
157 " nop \n" \
158 " nop \n" \
159 " nop \n" \
160 " nop \n" \
161 " .set reorder \n")
162
163#endif
164
165/*
166 * Interrupt enable/disable hazards
167 * Some processors have hazards when modifying
168 * the status register to change the interrupt state
169 */
170
171#ifdef CONFIG_CPU_MIPSR2
172
173__asm__(" .macro irq_enable_hazard \n"
174 " _ehb \n"
175 " .endm \n"
176 " \n"
177 " .macro irq_disable_hazard \n"
178 " _ehb \n"
179 " .endm \n");
180 127
181#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) 128#elif defined(CONFIG_CPU_SB1)
182 129
183/* 130/*
184 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 131 * Mostly like R4000 for historic reasons
185 */ 132 */
186 133ASMMACRO(mtc0_tlbw_hazard,
187__asm__( 134 )
188 " .macro irq_enable_hazard \n" 135ASMMACRO(tlbw_use_hazard,
189 " .endm \n" 136 )
190 " \n" 137ASMMACRO(tlb_probe_hazard,
191 " .macro irq_disable_hazard \n" 138 )
192 " .endm \n"); 139ASMMACRO(irq_enable_hazard,
140 )
141ASMMACRO(irq_disable_hazard,
142 _ssnop; _ssnop; _ssnop
143 )
144ASMMACRO(back_to_back_c0_hazard,
145 )
146#define instruction_hazard() do { } while (0)
193 147
194#else 148#else
195 149
196/* 150/*
197 * Default for classic MIPS processors. Assume worst case hazards but don't 151 * Finally the catchall case for all other processors including R4000, R4400,
198 * care about the irq_enable_hazard - sooner or later the hardware will 152 * R4600, R4700, R5000, RM7000, NEC VR41xx etc.
199 * enable it and we don't care when exactly.
200 */
201
202__asm__(
203 " # \n"
204 " # There is a hazard but we do not care \n"
205 " # \n"
206 " .macro\tirq_enable_hazard \n"
207 " .endm \n"
208 " \n"
209 " .macro\tirq_disable_hazard \n"
210 " _ssnop \n"
211 " _ssnop \n"
212 " _ssnop \n"
213 " .endm \n");
214
215#endif
216
217#define irq_enable_hazard() \
218 __asm__ __volatile__("irq_enable_hazard")
219#define irq_disable_hazard() \
220 __asm__ __volatile__("irq_disable_hazard")
221
222
223/*
224 * Back-to-back hazards -
225 * 153 *
226 * What is needed to separate a move to cp0 from a subsequent read from the 154 * The taken branch will result in a two cycle penalty for the two killed
227 * same cp0 register? 155 * instructions on R4000 / R4400. Other processors only have a single cycle
228 */ 156 * hazard so this is nice trick to have an optimal code for a range of
229#ifdef CONFIG_CPU_MIPSR2 157 * processors.
230
231__asm__(" .macro back_to_back_c0_hazard \n"
232 " _ehb \n"
233 " .endm \n");
234
235#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \
236 defined(CONFIG_CPU_SB1)
237
238__asm__(" .macro back_to_back_c0_hazard \n"
239 " .endm \n");
240
241#else
242
243__asm__(" .macro back_to_back_c0_hazard \n"
244 " .set noreorder \n"
245 " _ssnop \n"
246 " _ssnop \n"
247 " _ssnop \n"
248 " .set reorder \n"
249 " .endm");
250
251#endif
252
253#define back_to_back_c0_hazard() \
254 __asm__ __volatile__("back_to_back_c0_hazard")
255
256
257/*
258 * Instruction execution hazard
259 */
260#ifdef CONFIG_CPU_MIPSR2
261/*
262 * gcc has a tradition of misscompiling the previous construct using the
263 * address of a label as argument to inline assembler. Gas otoh has the
264 * annoying difference between la and dla which are only usable for 32-bit
265 * rsp. 64-bit code, so can't be used without conditional compilation.
266 * The alterantive is switching the assembler to 64-bit code which happens
267 * to work right even for 32-bit code ...
268 */ 158 */
269#define instruction_hazard() \ 159ASMMACRO(mtc0_tlbw_hazard,
270do { \ 160 nop
271 unsigned long tmp; \ 161 )
272 \ 162ASMMACRO(tlbw_use_hazard,
273 __asm__ __volatile__( \ 163 nop; nop; nop
274 " .set mips64r2 \n" \ 164 )
275 " dla %0, 1f \n" \ 165ASMMACRO(tlb_probe_hazard,
276 " jr.hb %0 \n" \ 166 nop; nop; nop
277 " .set mips0 \n" \ 167 )
278 "1: \n" \ 168ASMMACRO(irq_enable_hazard,
279 : "=r" (tmp)); \ 169 )
280} while (0) 170ASMMACRO(irq_disable_hazard,
281 171 nop; nop; nop
282#else 172 )
173ASMMACRO(back_to_back_c0_hazard,
174 _ssnop; _ssnop; _ssnop;
175 )
283#define instruction_hazard() do { } while (0) 176#define instruction_hazard() do { } while (0)
284#endif
285
286extern void mips_ihb(void);
287 177
288#endif /* __ASSEMBLY__ */ 178#endif
289 179
290#endif /* _ASM_HAZARDS_H */ 180#endif /* _ASM_HAZARDS_H */
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 896550bad322..d35c61776a02 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -76,8 +76,4 @@ extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
76 unsigned long hwmask); 76 unsigned long hwmask);
77#endif /* CONFIG_MIPS_MT_SMTC */ 77#endif /* CONFIG_MIPS_MT_SMTC */
78 78
79#ifdef CONFIG_SMP
80#define ARCH_HAS_IRQ_PER_CPU
81#endif
82
83#endif /* _ASM_IRQ_H */ 79#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
index 43ca09a3a3d0..46bf5de5ac72 100644
--- a/include/asm-mips/irqflags.h
+++ b/include/asm-mips/irqflags.h
@@ -213,12 +213,37 @@ static inline int raw_irqs_disabled_flags(unsigned long flags)
213 * Do the CPU's IRQ-state tracing from assembly code. 213 * Do the CPU's IRQ-state tracing from assembly code.
214 */ 214 */
215#ifdef CONFIG_TRACE_IRQFLAGS 215#ifdef CONFIG_TRACE_IRQFLAGS
216/* Reload some registers clobbered by trace_hardirqs_on */
217#ifdef CONFIG_64BIT
218# define TRACE_IRQS_RELOAD_REGS \
219 LONG_L $11, PT_R11(sp); \
220 LONG_L $10, PT_R10(sp); \
221 LONG_L $9, PT_R9(sp); \
222 LONG_L $8, PT_R8(sp); \
223 LONG_L $7, PT_R7(sp); \
224 LONG_L $6, PT_R6(sp); \
225 LONG_L $5, PT_R5(sp); \
226 LONG_L $4, PT_R4(sp); \
227 LONG_L $2, PT_R2(sp)
228#else
229# define TRACE_IRQS_RELOAD_REGS \
230 LONG_L $7, PT_R7(sp); \
231 LONG_L $6, PT_R6(sp); \
232 LONG_L $5, PT_R5(sp); \
233 LONG_L $4, PT_R4(sp); \
234 LONG_L $2, PT_R2(sp)
235#endif
216# define TRACE_IRQS_ON \ 236# define TRACE_IRQS_ON \
237 CLI; /* make sure trace_hardirqs_on() is called in kernel level */ \
217 jal trace_hardirqs_on 238 jal trace_hardirqs_on
239# define TRACE_IRQS_ON_RELOAD \
240 TRACE_IRQS_ON; \
241 TRACE_IRQS_RELOAD_REGS
218# define TRACE_IRQS_OFF \ 242# define TRACE_IRQS_OFF \
219 jal trace_hardirqs_off 243 jal trace_hardirqs_off
220#else 244#else
221# define TRACE_IRQS_ON 245# define TRACE_IRQS_ON
246# define TRACE_IRQS_ON_RELOAD
222# define TRACE_IRQS_OFF 247# define TRACE_IRQS_OFF
223#endif 248#endif
224 249
diff --git a/include/asm-mips/it8172/it8172.h b/include/asm-mips/it8172/it8172.h
deleted file mode 100644
index 8f23af0a1ee8..000000000000
--- a/include/asm-mips/it8172/it8172.h
+++ /dev/null
@@ -1,348 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller defines.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef __IT8172__H__
32#define __IT8172__H__
33
34#include <asm/addrspace.h>
35
36#define IT8172_BASE 0x18000000
37#define IT8172_PCI_IO_BASE 0x14000000
38#define IT8172_PCI_MEM_BASE 0x10000000
39
40// System registers offsets from IT8172_BASE
41#define IT_CMFPCR 0x0
42#define IT_DSRR 0x2
43#define IT_PCDCR 0x4
44#define IT_SPLLCR 0x6
45#define IT_CIDR 0x10
46#define IT_CRNR 0x12
47#define IT_CPUTR 0x14
48#define IT_CTCR 0x16
49#define IT_SDPR 0xF0
50
51// Power management register offset from IT8172_PCI_IO_BASE
52// Power Management Device Standby Register
53#define IT_PM_DSR 0x15800
54
55#define IT_PM_DSR_TMR0SB 0x0001
56#define IT_PM_DSR_TMR1SB 0x0002
57#define IT_PM_DSR_CIR0SB 0x0004
58#define IT_PM_DSR_CIR1SB 0x0008
59#define IT_PM_DSR_SCR0SB 0x0010
60#define IT_PM_DSR_SCR1SB 0x0020
61#define IT_PM_DSR_PPSB 0x0040
62#define IT_PM_DSR_I2CSB 0x0080
63#define IT_PM_DSR_UARTSB 0x0100
64#define IT_PM_DSR_IDESB 0x0200
65#define IT_PM_DSR_ACSB 0x0400
66#define IT_PM_DSR_M68KSB 0x0800
67
68// Power Management PCI Device Software Reset Register
69#define IT_PM_PCISR 0x15802
70
71#define IT_PM_PCISR_IDESR 0x0001
72#define IT_PM_PCISR_CDMASR 0x0002
73#define IT_PM_PCISR_USBSR 0x0004
74#define IT_PM_PCISR_DMASR 0x0008
75#define IT_PM_PCISR_ACSR 0x0010
76#define IT_PM_PCISR_MEMSR 0x0020
77#define IT_PM_PCISR_68KSR 0x0040
78
79
80// PCI Configuration address and data register offsets
81// from IT8172_BASE
82#define IT_CONFADDR 0x4000
83#define IT_BUSNUM_SHF 16
84#define IT_DEVNUM_SHF 11
85#define IT_FUNCNUM_SHF 8
86#define IT_REGNUM_SHF 2
87
88#define IT_CONFDATA 0x4004
89
90// PCI configuration header common register offsets
91#define IT_VID 0x00
92#define IT_DID 0x02
93#define IT_PCICMD 0x04
94#define IT_PCISTS 0x06
95#define IT_RID 0x08
96#define IT_CLASSC 0x09
97#define IT_HEADT 0x0E
98#define IT_SERIRQC 0x49
99
100// PCI to Internal/LPC Bus Bridge configuration header register offset
101#define IT_P2I_BCR 0x4C
102#define IT_P2I_D0IOSC 0x50
103#define IT_P2I_D1IOSC 0x54
104#define IT_P2I_D2IOSC 0x58
105#define IT_P2I_D3IOSC 0x5C
106#define IT_P2I_D4IOSC 0x60
107#define IT_P2I_D5IOSC 0x64
108#define IT_P2I_D6IOSC 0x68
109#define IT_P2I_D7IOSC 0x6C
110#define IT_P2I_D8IOSC 0x70
111#define IT_P2I_D9IOSC 0x74
112#define IT_P2I_D10IOSC 0x78
113#define IT_P2I_D11IOSC 0x7C
114
115// Memory controller register offsets from IT8172_BASE
116#define IT_MC_SDRMR 0x1000
117#define IT_MC_SDRTR 0x1004
118#define IT_MC_MCR 0x1008
119#define IT_MC_SDTYPE 0x100C
120#define IT_MC_WPBA 0x1010
121#define IT_MC_WPTA 0x1014
122#define IT_MC_HATR 0x1018
123#define IT_MC_PCICR 0x101C
124
125// Flash/ROM control register offsets from IT8172_BASE
126#define IT_FC_BRCR 0x2000
127#define IT_FC_FCR 0x2004
128#define IT_FC_DCR 0x2008
129
130// M68K interface bridge configuration header register offset
131#define IT_M68K_MBCSR 0x54
132#define IT_M68K_TMR 0x58
133#define IT_M68K_BCR 0x5C
134#define IT_M68K_BSR 0x5D
135#define IT_M68K_DTR 0x5F
136
137// Register offset from IT8172_PCI_IO_BASE
138// These registers are accessible through 8172 PCI IO window.
139
140// INTC
141#define IT_INTC_BASE 0x10000
142#define IT_INTC_LBDNIRR 0x10000
143#define IT_INTC_LBDNIMR 0x10002
144#define IT_INTC_LBDNITR 0x10004
145#define IT_INTC_LBDNIAR 0x10006
146#define IT_INTC_LPCNIRR 0x10010
147#define IT_INTC_LPCNIMR 0x10012
148#define IT_INTC_LPCNITR 0x10014
149#define IT_INTC_LPCNIAR 0x10016
150#define IT_INTC_PDNIRR 0x10020
151#define IT_INTC_PDNIMR 0x10022
152#define IT_INTC_PDNITR 0x10024
153#define IT_INTC_PDNIAR 0x10026
154#define IT_INTC_UMNIRR 0x10030
155#define IT_INTC_UMNITR 0x10034
156#define IT_INTC_UMNIAR 0x10036
157#define IT_INTC_TYPER 0x107FE
158
159// IT8172 PCI device number
160#define IT_C2P_DEVICE 0
161#define IT_AUDIO_DEVICE 1
162#define IT_DMAC_DEVICE 1
163#define IT_CDMAC_DEVICE 1
164#define IT_USB_DEVICE 1
165#define IT_P2I_DEVICE 1
166#define IT_IDE_DEVICE 1
167#define IT_M68K_DEVICE 1
168
169// IT8172 PCI function number
170#define IT_C2P_FUNCION 0
171#define IT_AUDIO_FUNCTION 0
172#define IT_DMAC_FUNCTION 1
173#define IT_CDMAC_FUNCTION 2
174#define IT_USB_FUNCTION 3
175#define IT_P2I_FUNCTION 4
176#define IT_IDE_FUNCTION 5
177#define IT_M68K_FUNCTION 6
178
179// IT8172 GPIO
180#define IT_GPADR 0x13800
181#define IT_GPBDR 0x13808
182#define IT_GPCDR 0x13810
183#define IT_GPACR 0x13802
184#define IT_GPBCR 0x1380A
185#define IT_GPCCR 0x13812
186#define IT_GPAICR 0x13804
187#define IT_GPBICR 0x1380C
188#define IT_GPCICR 0x13814
189#define IT_GPAISR 0x13806
190#define IT_GPBISR 0x1380E
191#define IT_GPCISR 0x13816
192#define IT_GCR 0x13818
193
194// IT8172 RTC
195#define IT_RTC_BASE 0x14800
196#define IT_RTC_CENTURY 0x14808
197
198#define IT_RTC_RIR0 0x00
199#define IT_RTC_RTR0 0x01
200#define IT_RTC_RIR1 0x02
201#define IT_RTC_RTR1 0x03
202#define IT_RTC_RIR2 0x04
203#define IT_RTC_RTR2 0x05
204#define IT_RTC_RCTR 0x08
205#define IT_RTC_RA 0x0A
206#define IT_RTC_RB 0x0B
207#define IT_RTC_RC 0x0C
208#define IT_RTC_RD 0x0D
209
210#define RTC_SEC_INDEX 0x00
211#define RTC_MIN_INDEX 0x02
212#define RTC_HOUR_INDEX 0x04
213#define RTC_DAY_INDEX 0x06
214#define RTC_DATE_INDEX 0x07
215#define RTC_MONTH_INDEX 0x08
216#define RTC_YEAR_INDEX 0x09
217
218// IT8172 internal device registers
219#define IT_TIMER_BASE 0x10800
220#define IT_CIR0_BASE 0x11000
221#define IT_UART_BASE 0x11800
222#define IT_SCR0_BASE 0x12000
223#define IT_SCR1_BASE 0x12800
224#define IT_PP_BASE 0x13000
225#define IT_I2C_BASE 0x14000
226#define IT_CIR1_BASE 0x15000
227
228// IT8172 Smart Card Reader offsets from IT_SCR*_BASE
229#define IT_SCR_SFR 0x08
230#define IT_SCR_SCDR 0x09
231
232// IT8172 IT_SCR_SFR bit definition & mask
233#define IT_SCR_SFR_GATE_UART 0x40
234#define IT_SCR_SFR_GATE_UART_BIT 6
235#define IT_SCR_SFR_GATE_UART_OFF 0
236#define IT_SCR_SFR_GATE_UART_ON 1
237#define IT_SCR_SFR_FET_CHARGE 0x30
238#define IT_SCR_SFR_FET_CHARGE_BIT 4
239#define IT_SCR_SFR_FET_CHARGE_3_3_US 3
240#define IT_SCR_SFR_FET_CHARGE_13_US 2
241#define IT_SCR_SFR_FET_CHARGE_53_US 1
242#define IT_SCR_SFR_FET_CHARGE_213_US 0
243#define IT_SCR_SFR_CARD_FREQ 0x0C
244#define IT_SCR_SFR_CARD_FREQ_BIT 2
245#define IT_SCR_SFR_CARD_FREQ_STOP 3
246#define IT_SCR_SFR_CARD_FREQ_3_5_MHZ 0
247#define IT_SCR_SFR_CARD_FREQ_7_1_MHZ 2
248#define IT_SCR_SFR_CARD_FREQ_96_DIV_MHZ 1
249#define IT_SCR_SFR_FET_ACTIVE 0x02
250#define IT_SCR_SFR_FET_ACTIVE_BIT 1
251#define IT_SCR_SFR_FET_ACTIVE_INVERT 0
252#define IT_SCR_SFR_FET_ACTIVE_NONINVERT 1
253#define IT_SCR_SFR_ENABLE 0x01
254#define IT_SCR_SFR_ENABLE_BIT 0
255#define IT_SCR_SFR_ENABLE_OFF 0
256#define IT_SCR_SFR_ENABLE_ON 1
257
258// IT8172 IT_SCR_SCDR bit definition & mask
259#define IT_SCR_SCDR_RESET_MODE 0x80
260#define IT_SCR_SCDR_RESET_MODE_BIT 7
261#define IT_SCR_SCDR_RESET_MODE_ASYNC 0
262#define IT_SCR_SCDR_RESET_MODE_SYNC 1
263#define IT_SCR_SCDR_DIVISOR 0x7F
264#define IT_SCR_SCDR_DIVISOR_BIT 0
265#define IT_SCR_SCDR_DIVISOR_STOP_VAL_1 0x00
266#define IT_SCR_SCDR_DIVISOR_STOP_VAL_2 0x01
267#define IT_SCR_SCDR_DIVISOR_STOP_VAL_3 0x7F
268
269// IT8172 DMA
270#define IT_DMAC_BASE 0x16000
271#define IT_DMAC_BCAR0 0x00
272#define IT_DMAC_BCAR1 0x04
273#define IT_DMAC_BCAR2 0x08
274#define IT_DMAC_BCAR3 0x0C
275#define IT_DMAC_BCCR0 0x02
276#define IT_DMAC_BCCR1 0x06
277#define IT_DMAC_BCCR2 0x0a
278#define IT_DMAC_BCCR3 0x0e
279#define IT_DMAC_CR 0x10
280#define IT_DMAC_SR 0x12
281#define IT_DMAC_ESR 0x13
282#define IT_DMAC_RQR 0x14
283#define IT_DMAC_MR 0x16
284#define IT_DMAC_EMR 0x17
285#define IT_DMAC_MKR 0x18
286#define IT_DMAC_PAR0 0x20
287#define IT_DMAC_PAR1 0x22
288#define IT_DMAC_PAR2 0x24
289#define IT_DMAC_PAR3 0x26
290
291// IT8172 IDE
292#define IT_IDE_BASE 0x17800
293#define IT_IDE_STATUS 0x1F7
294
295// IT8172 Audio Controller
296#define IT_AC_BASE 0x17000
297#define IT_AC_PCMOV 0x00
298#define IT_AC_FMOV 0x02
299#define IT_AC_I2SV 0x04
300#define IT_AC_DRSS 0x06
301#define IT_AC_PCC 0x08
302#define IT_AC_PCDL 0x0A
303#define IT_AC_PCB1STA 0x0C
304#define IT_AC_PCB2STA 0x10
305#define IT_AC_CAPCC 0x14
306#define IT_AC_CAPCDL 0x16
307#define IT_AC_CAPB1STA 0x18
308#define IT_AC_CAPB2STA 0x1C
309#define IT_AC_CODECC 0x22
310#define IT_AC_I2SMC 0x24
311#define IT_AC_VS 0x26
312#define IT_AC_SRCS 0x28
313#define IT_AC_CIRCP 0x2A
314#define IT_AC_CIRDP 0x2C
315#define IT_AC_TM 0x4A
316#define IT_AC_PFDP 0x4C
317#define IT_AC_GC 0x54
318#define IT_AC_IMC 0x56
319#define IT_AC_ISC 0x5B
320#define IT_AC_OPL3SR 0x68
321#define IT_AC_OPL3DWDR 0x69
322#define IT_AC_OPL3AB1W 0x6A
323#define IT_AC_OPL3DW 0x6B
324#define IT_AC_BPDC 0x70
325
326
327// IT8172 Timer
328#define IT_TIMER_BASE 0x10800
329#define TIMER_TCVR0 0x00
330#define TIMER_TRVR0 0x02
331#define TIMER_TCR0 0x04
332#define TIMER_TIRR 0x06
333#define TIMER_TCVR1 0x08
334#define TIMER_TRVR1 0x0A
335#define TIMER_TCR1 0x0C
336#define TIMER_TIDR 0x0E
337
338
339#define IT_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs)) = data
340#define IT_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs))
341
342#define IT_IO_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
343#define IT_IO_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
344
345#define IT_IO_WRITE16(ofs, data) *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
346#define IT_IO_READ16(ofs, data) data = *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
347
348#endif
diff --git a/include/asm-mips/it8172/it8172_cir.h b/include/asm-mips/it8172/it8172_cir.h
deleted file mode 100644
index 6a1dbd29f6d1..000000000000
--- a/include/asm-mips/it8172/it8172_cir.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 Consumer IR port defines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#define NUM_CIR_PORTS 2
32
33/* Master Control Register */
34#define CIR_RESET 0x1
35#define CIR_FIFO_CLEAR 0x2
36#define CIR_SET_FIFO_TL(x) (((x)&0x3)<<2)
37#define CIR_ILE 0x10
38#define CIR_ILSEL 0x20
39
40/* Interrupt Enable Register */
41#define CIR_TLDLIE 0x1
42#define CIR_RDAIE 0x2
43#define CIR_RFOIE 0x4
44#define CIR_IEC 0x80
45
46/* Interrupt Identification Register */
47#define CIR_TLDLI 0x1
48#define CIR_RDAI 0x2
49#define CIR_RFOI 0x4
50#define CIR_NIP 0x80
51
52/* Carrier Frequency Register */
53#define CIR_SET_CF(x) ((x)&0x1f)
54 #define CFQ_38_480 0xB /* 38 KHz low, 480 KHz high */
55#define CIR_HCFS 0x20
56 #define CIR_SET_HS(x) (((x)&0x1)<<5)
57
58
59/* Receiver Control Register */
60#define CIR_SET_RXDCR(x) ((x)&0x7)
61#define CIR_RXACT 0x8
62#define CIR_RXEND 0x10
63#define CIR_RDWOS 0x20
64 #define CIR_SET_RDWOS(x) (((x)&0x1)<<5)
65#define CIR_RXEN 0x80
66
67/* Transmitter Control Register */
68#define CIR_SET_TXMPW(x) ((x)&0x7)
69#define CIR_SET_TXMPM(x) (((x)&0x3)<<3)
70#define CIR_TXENDF 0x20
71#define CIR_TXRLE 0x40
72
73/* Receiver FIFO Status Register */
74#define CIR_RXFBC_MASK 0x3f
75#define CIR_RXFTO 0x80
76
77/* Wakeup Code Length Register */
78#define CIR_SET_WCL ((x)&0x3f)
79#define CIR_WCL_MASK(x) ((x)&0x3f)
80
81/* Wakeup Power Control/Status Register */
82#define CIR_BTMON 0x2
83#define CIR_CIRON 0x4
84#define CIR_RCRST 0x10
85#define CIR_WCRST 0x20
86
87struct cir_port {
88 int port;
89 unsigned short baud_rate;
90 unsigned char fifo_tl;
91 unsigned char cfq;
92 unsigned char hcfs;
93 unsigned char rdwos;
94 unsigned char rxdcr;
95};
96
97struct it8172_cir_regs {
98 unsigned char dr; /* data */
99 char pad;
100 unsigned char mstcr; /* master control */
101 char pad1;
102 unsigned char ier; /* interrupt enable */
103 char pad2;
104 unsigned char iir; /* interrupt identification */
105 char pad3;
106 unsigned char cfr; /* carrier frequency */
107 char pad4;
108 unsigned char rcr; /* receiver control */
109 char pad5;
110 unsigned char tcr; /* transmitter control */
111 char pad6;
112 char pad7;
113 char pad8;
114 unsigned char bdlr; /* baud rate divisor low byte */
115 char pad9;
116 unsigned char bdhr; /* baud rate divisor high byte */
117 char pad10;
118 unsigned char tfsr; /* tx fifo byte count */
119 char pad11;
120 unsigned char rfsr; /* rx fifo status */
121 char pad12;
122 unsigned char wcl; /* wakeup code length */
123 char pad13;
124 unsigned char wcr; /* wakeup code read/write */
125 char pad14;
126 unsigned char wps; /* wakeup power control/status */
127};
128
129int cir_port_init(struct cir_port *cir);
130extern void clear_fifo(struct cir_port *cir);
131extern void enable_receiver(struct cir_port *cir);
132extern void disable_receiver(struct cir_port *cir);
133extern void enable_rx_demodulation(struct cir_port *cir);
134extern void disable_rx_demodulation(struct cir_port *cir);
135extern void set_rx_active(struct cir_port *cir);
136extern void int_enable(struct cir_port *cir);
137extern void rx_int_enable(struct cir_port *cir);
138extern char get_int_status(struct cir_port *cir);
139extern int cir_get_rx_count(struct cir_port *cir);
140extern char cir_read_data(struct cir_port *cir);
diff --git a/include/asm-mips/it8172/it8172_dbg.h b/include/asm-mips/it8172/it8172_dbg.h
deleted file mode 100644
index f404ec7c03ac..000000000000
--- a/include/asm-mips/it8172/it8172_dbg.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Function prototypes for low level uart routines to
5 * directly access a 16550 uart.
6 *
7 * Copyright 2000 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * ppopov@mvista.com or source@mvista.com
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32#include <linux/types.h>
33
34extern void putch(const unsigned char c);
35extern void puts(unsigned char *cp);
36extern void fputs(unsigned char *cp);
37extern void put64(uint64_t ul);
38extern void put32(unsigned u);
diff --git a/include/asm-mips/it8172/it8172_int.h b/include/asm-mips/it8172/it8172_int.h
deleted file mode 100644
index 837e83ac25f5..000000000000
--- a/include/asm-mips/it8172/it8172_int.h
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE 8172 Interrupt Numbering
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef _MIPS_ITEINT_H
32#define _MIPS_ITEINT_H
33
34/*
35 * Here's the "strategy":
36 * We number the LPC serial irqs from 0 to 15,
37 * the local bus irqs from 16 to 31,
38 * the pci dev register interrupts from 32 to 47,
39 * and the non-maskable ints from 48 to 53.
40 */
41
42#define IT8172_LPC_IRQ_BASE 0 /* first LPC int number */
43#define IT8172_SERIRQ_0 (IT8172_LPC_IRQ_BASE + 0)
44#define IT8172_SERIRQ_1 (IT8172_LPC_IRQ_BASE + 1)
45#define IT8172_SERIRQ_2 (IT8172_LPC_IRQ_BASE + 2)
46#define IT8172_SERIRQ_3 (IT8172_LPC_IRQ_BASE + 3)
47#define IT8172_SERIRQ_4 (IT8172_LPC_IRQ_BASE + 4)
48#define IT8172_SERIRQ_5 (IT8172_LPC_IRQ_BASE + 5)
49#define IT8172_SERIRQ_6 (IT8172_LPC_IRQ_BASE + 6)
50#define IT8172_SERIRQ_7 (IT8172_LPC_IRQ_BASE + 7)
51#define IT8172_SERIRQ_8 (IT8172_LPC_IRQ_BASE + 8)
52#define IT8172_SERIRQ_9 (IT8172_LPC_IRQ_BASE + 9)
53#define IT8172_SERIRQ_10 (IT8172_LPC_IRQ_BASE + 10)
54#define IT8172_SERIRQ_11 (IT8172_LPC_IRQ_BASE + 11)
55#define IT8172_SERIRQ_12 (IT8172_LPC_IRQ_BASE + 12)
56#define IT8172_SERIRQ_13 (IT8172_LPC_IRQ_BASE + 13)
57#define IT8172_SERIRQ_14 (IT8172_LPC_IRQ_BASE + 14)
58#define IT8172_SERIRQ_15 (IT8172_LPC_IRQ_BASE + 15)
59
60#define IT8172_LB_IRQ_BASE 16 /* first local bus int number */
61#define IT8172_PPR_IRQ (IT8172_LB_IRQ_BASE + 0) /* parallel port */
62#define IT8172_TIMER0_IRQ (IT8172_LB_IRQ_BASE + 1)
63#define IT8172_TIMER1_IRQ (IT8172_LB_IRQ_BASE + 2)
64#define IT8172_I2C_IRQ (IT8172_LB_IRQ_BASE + 3)
65#define IT8172_GPIO_IRQ (IT8172_LB_IRQ_BASE + 4)
66#define IT8172_CIR0_IRQ (IT8172_LB_IRQ_BASE + 5)
67#define IT8172_CIR1_IRQ (IT8172_LB_IRQ_BASE + 6)
68#define IT8172_UART_IRQ (IT8172_LB_IRQ_BASE + 7)
69#define IT8172_SCR0_IRQ (IT8172_LB_IRQ_BASE + 8)
70#define IT8172_SCR1_IRQ (IT8172_LB_IRQ_BASE + 9)
71#define IT8172_RTC_IRQ (IT8172_LB_IRQ_BASE + 10)
72#define IT8172_IOCHK_IRQ (IT8172_LB_IRQ_BASE + 11)
73/* 12 - 15 reserved */
74
75/*
76 * Note here that the pci dev registers includes bits for more than
77 * just the pci devices.
78 */
79#define IT8172_PCI_DEV_IRQ_BASE 32 /* first pci dev irq */
80#define IT8172_AC97_IRQ (IT8172_PCI_DEV_IRQ_BASE + 0)
81#define IT8172_MC68K_IRQ (IT8172_PCI_DEV_IRQ_BASE + 1)
82#define IT8172_IDE_IRQ (IT8172_PCI_DEV_IRQ_BASE + 2)
83#define IT8172_USB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 3)
84#define IT8172_BRIDGE_MASTER_IRQ (IT8172_PCI_DEV_IRQ_BASE + 4)
85#define IT8172_BRIDGE_TARGET_IRQ (IT8172_PCI_DEV_IRQ_BASE + 5)
86#define IT8172_PCI_INTA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 6)
87#define IT8172_PCI_INTB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 7)
88#define IT8172_PCI_INTC_IRQ (IT8172_PCI_DEV_IRQ_BASE + 8)
89#define IT8172_PCI_INTD_IRQ (IT8172_PCI_DEV_IRQ_BASE + 9)
90#define IT8172_S_INTA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 10)
91#define IT8172_S_INTB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 11)
92#define IT8172_S_INTC_IRQ (IT8172_PCI_DEV_IRQ_BASE + 12)
93#define IT8172_S_INTD_IRQ (IT8172_PCI_DEV_IRQ_BASE + 13)
94#define IT8172_CDMA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 14)
95#define IT8172_DMA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 15)
96
97#define IT8172_NMI_IRQ_BASE 48
98#define IT8172_SER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 0)
99#define IT8172_PCI_NMI_IRQ (IT8172_NMI_IRQ_BASE + 1)
100#define IT8172_RTC_NMI_IRQ (IT8172_NMI_IRQ_BASE + 2)
101#define IT8172_CPUIF_NMI_IRQ (IT8172_NMI_IRQ_BASE + 3)
102#define IT8172_PMER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 4)
103#define IT8172_POWER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 5)
104
105#define IT8172_LAST_IRQ (IT8172_POWER_NMI_IRQ)
106/* Finally, let's move over here the mips cpu timer interrupt.
107 */
108#define MIPS_CPU_TIMER_IRQ (NR_IRQS-1)
109
110/*
111 * IT8172 Interrupt Controller Registers
112 */
113struct it8172_intc_regs {
114 volatile unsigned short lb_req; /* offset 0 */
115 volatile unsigned short lb_mask;
116 volatile unsigned short lb_trigger;
117 volatile unsigned short lb_level;
118 unsigned char pad0[8];
119
120 volatile unsigned short lpc_req; /* offset 0x10 */
121 volatile unsigned short lpc_mask;
122 volatile unsigned short lpc_trigger;
123 volatile unsigned short lpc_level;
124 unsigned char pad1[8];
125
126 volatile unsigned short pci_req; /* offset 0x20 */
127 volatile unsigned short pci_mask;
128 volatile unsigned short pci_trigger;
129 volatile unsigned short pci_level;
130 unsigned char pad2[8];
131
132 volatile unsigned short nmi_req; /* offset 0x30 */
133 volatile unsigned short nmi_mask;
134 volatile unsigned short nmi_trigger;
135 volatile unsigned short nmi_level;
136 unsigned char pad3[6];
137
138 volatile unsigned short nmi_redir; /* offset 0x3E */
139 unsigned char pad4[0xBE];
140
141 volatile unsigned short intstatus; /* offset 0xFE */
142};
143
144#endif /* _MIPS_ITEINT_H */
diff --git a/include/asm-mips/it8172/it8172_pci.h b/include/asm-mips/it8172/it8172_pci.h
deleted file mode 100644
index 42c61f56eeba..000000000000
--- a/include/asm-mips/it8172/it8172_pci.h
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller specific pci defines.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef _8172PCI_H_
32#define _8172PCI_H_
33
34// PCI configuration space Type0
35#define PCI_IDREG 0x00
36#define PCI_CMDSTSREG 0x04
37#define PCI_CLASSREG 0x08
38#define PCI_BHLCREG 0x0C
39#define PCI_BASE1REG 0x10
40#define PCI_BASE2REG 0x14
41#define PCI_BASE3REG 0x18
42#define PCI_BASE4REG 0x1C
43#define PCI_BASE5REG 0x20
44#define PCI_BASE6REG 0x24
45#define PCI_ROMBASEREG 0x30
46#define PCI_INTRREG 0x3C
47
48// PCI configuration space Type1
49#define PCI_BUSNOREG 0x18
50
51#define IT_PCI_VENDORID(x) ((x) & 0xFFFF)
52#define IT_PCI_DEVICEID(x) (((x)>>16) & 0xFFFF)
53
54// Command register
55#define PCI_CMD_IOEN 0x00000001
56#define PCI_CMD_MEMEN 0x00000002
57#define PCI_CMD_BUSMASTER 0x00000004
58#define PCI_CMD_SPCYCLE 0x00000008
59#define PCI_CMD_WRINV 0x00000010
60#define PCI_CMD_VGASNOOP 0x00000020
61#define PCI_CMD_PERR 0x00000040
62#define PCI_CMD_WAITCTRL 0x00000080
63#define PCI_CMD_SERR 0x00000100
64#define PCI_CMD_FAST_BACKTOBACK 0x00000200
65
66// Status register
67#define PCI_STS_66MHZ 0x00200000
68#define PCI_STS_SUPPORT_UDF 0x00400000
69#define PCI_STS_FAST_BACKTOBACK 0x00800000
70#define PCI_STS_DATA_PERR 0x01000000
71#define PCI_STS_DEVSEL0 0x02000000
72#define PCI_STS_DEVSEL1 0x04000000
73#define PCI_STS_SIG_TGTABORT 0x08000000
74#define PCI_STS_RCV_TGTABORT 0x10000000
75#define PCI_STS_RCV_MSTABORT 0x20000000
76#define PCI_STS_SYSERR 0x40000000
77#define PCI_STS_DETCT_PERR 0x80000000
78
79#define IT_PCI_CLASS(x) (((x)>>24) & 0xFF)
80#define IT_PCI_SUBCLASS(x) (((x)>>16) & 0xFF)
81#define IT_PCI_INTERFACE(x) (((x)>>8) & 0xFF)
82#define IT_PCI_REVISION(x) ((x) & 0xFF)
83
84// PCI class code
85#define PCI_CLASS_BRIDGE 0x06
86
87// bridge subclass
88#define PCI_SUBCLASS_BRIDGE_HOST 0x00
89#define PCI_SUBCLASS_BRIDGE_PCI 0x04
90
91// BHLCREG
92#define IT_PCI_BIST(x) (((x)>>24) & 0xFF)
93#define IT_PCI_HEADERTYPE(x) (((x)>>16) & 0xFF)
94#define IT_PCI_LATENCYTIMER(x) (((x)>>8) & 0xFF)
95#define IT_PCI_CACHELINESIZE(x) ((x) & 0xFF)
96
97#define PCI_MULTIFUNC 0x80
98
99// INTRREG
100#define IT_PCI_MAXLAT(x) (((x)>>24) & 0xFF)
101#define IT_PCI_MINGNT(x) (((x)>>16) & 0xFF)
102#define IT_PCI_INTRPIN(x) (((x)>>8) & 0xFF)
103#define IT_PCI_INTRLINE(x) ((x) & 0xFF)
104
105#define PCI_VENDOR_NEC 0x1033
106#define PCI_VENDOR_DEC 0x1101
107
108#endif // _8172PCI_H_
diff --git a/include/asm-mips/it8712.h b/include/asm-mips/it8712.h
deleted file mode 100644
index ca2dee02a011..000000000000
--- a/include/asm-mips/it8712.h
+++ /dev/null
@@ -1,28 +0,0 @@
1
2#ifndef __IT8712_H__
3#define __IT8712_H__
4
5#define LPC_BASE_ADDR 0x14000000
6
7// MB PnP configuration register
8#define LPC_KEY_ADDR 0x1400002E
9#define LPC_DATA_ADDR 0x1400002F
10
11// Device LDN
12#define LDN_SERIAL1 0x01
13#define LDN_SERIAL2 0x02
14#define LDN_PARALLEL 0x03
15#define LDN_KEYBOARD 0x05
16#define LDN_MOUSE 0x06
17
18#define IT8712_UART1_PORT 0x3F8
19#define IT8712_UART2_PORT 0x2F8
20
21#ifndef ASM_ONLY
22
23void LPCSetConfig(char LdnNumber, char Index, char data);
24char LPCGetConfig(char LdnNumber, char Index);
25
26#endif
27
28#endif
diff --git a/include/asm-mips/mach-atlas/mc146818rtc.h b/include/asm-mips/mach-atlas/mc146818rtc.h
index 397522ea5565..a73a5698420c 100644
--- a/include/asm-mips/mach-atlas/mc146818rtc.h
+++ b/include/asm-mips/mach-atlas/mc146818rtc.h
@@ -28,10 +28,12 @@
28#include <asm/mips-boards/atlas.h> 28#include <asm/mips-boards/atlas.h>
29#include <asm/mips-boards/atlasint.h> 29#include <asm/mips-boards/atlasint.h>
30 30
31#define ARCH_RTC_LOCATION
32
31#define RTC_PORT(x) (ATLAS_RTC_ADR_REG + (x) * 8) 33#define RTC_PORT(x) (ATLAS_RTC_ADR_REG + (x) * 8)
32#define RTC_IO_EXTENT 0x100 34#define RTC_IO_EXTENT 0x100
33#define RTC_IOMAPPED 0 35#define RTC_IOMAPPED 0
34#define RTC_IRQ ATLASINT_RTC 36#define RTC_IRQ ATLAS_INT_RTC
35 37
36static inline unsigned char CMOS_READ(unsigned long addr) 38static inline unsigned char CMOS_READ(unsigned long addr)
37{ 39{
diff --git a/include/asm-mips/mach-ev64120/mach-gt64120.h b/include/asm-mips/mach-ev64120/mach-gt64120.h
index 13b1443a7a65..7e272ce57ea3 100644
--- a/include/asm-mips/mach-ev64120/mach-gt64120.h
+++ b/include/asm-mips/mach-ev64120/mach-gt64120.h
@@ -42,6 +42,7 @@ extern unsigned long gt64120_base;
42#define EV64120_UART0_REGS_BASE (KSEG1ADDR(EV64120_COM1_BASE_ADDR)) 42#define EV64120_UART0_REGS_BASE (KSEG1ADDR(EV64120_COM1_BASE_ADDR))
43#define EV64120_UART1_REGS_BASE (KSEG1ADDR(EV64120_COM2_BASE_ADDR)) 43#define EV64120_UART1_REGS_BASE (KSEG1ADDR(EV64120_COM2_BASE_ADDR))
44#define EV64120_BASE_BAUD ( 3686400 / 16 ) 44#define EV64120_BASE_BAUD ( 3686400 / 16 )
45#define EV64120_UART_IRQ 6
45 46
46/* 47/*
47 * PCI interrupts will come in on either the INTA or INTD interrups lines, 48 * PCI interrupts will come in on either the INTA or INTD interrups lines,
diff --git a/include/asm-mips/mach-ev96100/mach-gt64120.h b/include/asm-mips/mach-ev96100/mach-gt64120.h
deleted file mode 100644
index 0ef1e6c25acf..000000000000
--- a/include/asm-mips/mach-ev96100/mach-gt64120.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef _ASM_GT64120_EV96100_GT64120_DEP_H
9#define _ASM_GT64120_EV96100_GT64120_DEP_H
10
11/*
12 * GT96100 config space base address
13 */
14#define GT64120_BASE (KSEG1ADDR(0x14000000))
15
16/*
17 * PCI Bus allocation
18 *
19 * (Guessing ...)
20 */
21#define GT_PCI_MEM_BASE 0x12000000UL
22#define GT_PCI_MEM_SIZE 0x02000000UL
23#define GT_PCI_IO_BASE 0x10000000UL
24#define GT_PCI_IO_SIZE 0x02000000UL
25#define GT_ISA_IO_BASE PCI_IO_BASE
26
27/*
28 * Duart I/O ports.
29 */
30#define EV96100_COM1_BASE_ADDR (0xBD000000 + 0x20)
31#define EV96100_COM2_BASE_ADDR (0xBD000000 + 0x00)
32
33
34/*
35 * EV96100 interrupt controller register base.
36 */
37#define EV96100_ICTRL_REGS_BASE (KSEG1ADDR(0x1f000000))
38
39/*
40 * EV96100 UART register base.
41 */
42#define EV96100_UART0_REGS_BASE EV96100_COM1_BASE_ADDR
43#define EV96100_UART1_REGS_BASE EV96100_COM2_BASE_ADDR
44#define EV96100_BASE_BAUD ( 3686400 / 16 )
45
46#endif /* _ASM_GT64120_EV96100_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-excite/excite.h b/include/asm-mips/mach-excite/excite.h
index 130bd4b8edce..4c29ba44992c 100644
--- a/include/asm-mips/mach-excite/excite.h
+++ b/include/asm-mips/mach-excite/excite.h
@@ -7,7 +7,7 @@
7 7
8#define EXCITE_CPU_EXT_CLOCK 100000000 8#define EXCITE_CPU_EXT_CLOCK 100000000
9 9
10#if !defined(__ASSEMBLER__) 10#if !defined(__ASSEMBLY__)
11void __init excite_kgdb_init(void); 11void __init excite_kgdb_init(void);
12void excite_procfs_init(void); 12void excite_procfs_init(void);
13extern unsigned long memsize; 13extern unsigned long memsize;
diff --git a/include/asm-mips/mach-excite/excite_fpga.h b/include/asm-mips/mach-excite/excite_fpga.h
new file mode 100644
index 000000000000..38fcda703a0b
--- /dev/null
+++ b/include/asm-mips/mach-excite/excite_fpga.h
@@ -0,0 +1,80 @@
1#ifndef EXCITE_FPGA_H_INCLUDED
2#define EXCITE_FPGA_H_INCLUDED
3
4
5/**
6 * Adress alignment of the individual FPGA bytes.
7 * The address arrangement of the individual bytes of the FPGA is two
8 * byte aligned at the embedded MK2 platform.
9 */
10#ifdef EXCITE_CCI_FPGA_MK2
11typedef unsigned char excite_cci_fpga_align_t __attribute__ ((aligned(2)));
12#else
13typedef unsigned char excite_cci_fpga_align_t;
14#endif
15
16
17/**
18 * Size of Dual Ported RAM.
19 */
20#define EXCITE_DPR_SIZE 263
21
22
23/**
24 * Size of Reserved Status Fields in Dual Ported RAM.
25 */
26#define EXCITE_DPR_STATUS_SIZE 7
27
28
29
30/**
31 * FPGA.
32 * Hardware register layout of the FPGA interface. The FPGA must accessed
33 * byte wise solely.
34 * @see EXCITE_CCI_DPR_MK2
35 */
36typedef struct excite_fpga {
37
38 /**
39 * Dual Ported RAM.
40 */
41 excite_cci_fpga_align_t dpr[EXCITE_DPR_SIZE];
42
43 /**
44 * Status.
45 */
46 excite_cci_fpga_align_t status[EXCITE_DPR_STATUS_SIZE];
47
48#ifdef EXCITE_CCI_FPGA_MK2
49 /**
50 * RM9000 Interrupt.
51 * Write access initiates interrupt at the RM9000 (MIPS) processor of the eXcite.
52 */
53 excite_cci_fpga_align_t rm9k_int;
54#else
55 /**
56 * MK2 Interrupt.
57 * Write access initiates interrupt at the ARM processor of the MK2.
58 */
59 excite_cci_fpga_align_t mk2_int;
60
61 excite_cci_fpga_align_t gap[0x1000-0x10f];
62
63 /**
64 * IRQ Source/Acknowledge.
65 */
66 excite_cci_fpga_align_t rm9k_irq_src;
67
68 /**
69 * IRQ Mask.
70 * Set bits enable the related interrupt.
71 */
72 excite_cci_fpga_align_t rm9k_irq_mask;
73#endif
74
75
76} excite_fpga;
77
78
79
80#endif /* ndef EXCITE_FPGA_H_INCLUDED */
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h
index 59d26b52ba32..a13b715fd9ca 100644
--- a/include/asm-mips/mach-ip27/topology.h
+++ b/include/asm-mips/mach-ip27/topology.h
@@ -22,6 +22,7 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
22#define SD_NODE_INIT (struct sched_domain) { \ 22#define SD_NODE_INIT (struct sched_domain) { \
23 .span = CPU_MASK_NONE, \ 23 .span = CPU_MASK_NONE, \
24 .parent = NULL, \ 24 .parent = NULL, \
25 .child = NULL, \
25 .groups = NULL, \ 26 .groups = NULL, \
26 .min_interval = 8, \ 27 .min_interval = 8, \
27 .max_interval = 32, \ 28 .max_interval = 32, \
diff --git a/include/asm-mips/mach-pnx8550/uart.h b/include/asm-mips/mach-pnx8550/uart.h
index e32b9a23d70e..814a7a15ab49 100644
--- a/include/asm-mips/mach-pnx8550/uart.h
+++ b/include/asm-mips/mach-pnx8550/uart.h
@@ -13,4 +13,18 @@
13#define PNX8550_UART_INT(x) (PNX8550_INT_GIC_MIN+19+x) 13#define PNX8550_UART_INT(x) (PNX8550_INT_GIC_MIN+19+x)
14#define IRQ_TO_UART(x) (x-PNX8550_INT_GIC_MIN-19) 14#define IRQ_TO_UART(x) (x-PNX8550_INT_GIC_MIN-19)
15 15
16/* early macros needed for prom/kgdb */
17
18#define ip3106_lcr(base,port) *(volatile u32 *)(base+(port*0x1000) + 0x000)
19#define ip3106_mcr(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x004)
20#define ip3106_baud(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x008)
21#define ip3106_cfg(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x00C)
22#define ip3106_fifo(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x028)
23#define ip3106_istat(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE0)
24#define ip3106_ien(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE4)
25#define ip3106_iclr(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE8)
26#define ip3106_iset(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFEC)
27#define ip3106_pd(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFF4)
28#define ip3106_mid(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFFC)
29
16#endif 30#endif
diff --git a/include/asm-mips/mach-qemu/cpu-feature-overrides.h b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
index f4e370e27168..529445dacedb 100644
--- a/include/asm-mips/mach-qemu/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
@@ -20,7 +20,7 @@
20 20
21#define cpu_has_llsc 1 21#define cpu_has_llsc 1
22#define cpu_has_vtag_icache 0 22#define cpu_has_vtag_icache 0
23#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 23#define cpu_has_dc_aliases 0
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
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h
index fd7ebc54fa90..b15e4ea0b091 100644
--- a/include/asm-mips/mips-boards/atlasint.h
+++ b/include/asm-mips/mips-boards/atlasint.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Carsten Langgaard, carstenl@mips.com 2 * Copyright (C) 1999, 2006 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved. 3 * Authors: Carsten Langgaard <carstenl@mips.com>
4 * Maciej W. Rozycki <macro@mips.com>
4 * 5 *
5 * ######################################################################## 6 * ########################################################################
6 * 7 *
@@ -25,41 +26,88 @@
25#ifndef _MIPS_ATLASINT_H 26#ifndef _MIPS_ATLASINT_H
26#define _MIPS_ATLASINT_H 27#define _MIPS_ATLASINT_H
27 28
28#define ATLASINT_BASE 1 29/*
29#define ATLASINT_UART (ATLASINT_BASE+0) 30 * Interrupts 0..7 are used for Atlas CPU interrupts (nonEIC mode)
30#define ATLASINT_TIM0 (ATLASINT_BASE+1) 31 */
31#define ATLASINT_RES2 (ATLASINT_BASE+2) 32#define MIPSCPU_INT_BASE 0
32#define ATLASINT_RES3 (ATLASINT_BASE+3) 33
33#define ATLASINT_RTC (ATLASINT_BASE+4) 34/* CPU interrupt offsets */
34#define ATLASINT_COREHI (ATLASINT_BASE+5) 35#define MIPSCPU_INT_SW0 0
35#define ATLASINT_CORELO (ATLASINT_BASE+6) 36#define MIPSCPU_INT_SW1 1
36#define ATLASINT_RES7 (ATLASINT_BASE+7) 37#define MIPSCPU_INT_MB0 2
37#define ATLASINT_PCIA (ATLASINT_BASE+8) 38#define MIPSCPU_INT_ATLAS MIPSCPU_INT_MB0
38#define ATLASINT_PCIB (ATLASINT_BASE+9) 39#define MIPSCPU_INT_MB1 3
39#define ATLASINT_PCIC (ATLASINT_BASE+10) 40#define MIPSCPU_INT_MB2 4
40#define ATLASINT_PCID (ATLASINT_BASE+11) 41#define MIPSCPU_INT_MB3 5
41#define ATLASINT_ENUM (ATLASINT_BASE+12) 42#define MIPSCPU_INT_MB4 6
42#define ATLASINT_DEG (ATLASINT_BASE+13) 43#define MIPSCPU_INT_CPUCTR 7
43#define ATLASINT_ATXFAIL (ATLASINT_BASE+14) 44
44#define ATLASINT_INTA (ATLASINT_BASE+15) 45/*
45#define ATLASINT_INTB (ATLASINT_BASE+16) 46 * Interrupts 8..39 are used for Atlas interrupt controller interrupts
46#define ATLASINT_ETH ATLASINT_INTB 47 */
47#define ATLASINT_INTC (ATLASINT_BASE+17) 48#define ATLAS_INT_BASE 8
48#define ATLASINT_SCSI ATLASINT_INTC 49#define ATLAS_INT_UART (ATLAS_INT_BASE + 0)
49#define ATLASINT_INTD (ATLASINT_BASE+18) 50#define ATLAS_INT_TIM0 (ATLAS_INT_BASE + 1)
50#define ATLASINT_SERR (ATLASINT_BASE+19) 51#define ATLAS_INT_RES2 (ATLAS_INT_BASE + 2)
51#define ATLASINT_RES20 (ATLASINT_BASE+20) 52#define ATLAS_INT_RES3 (ATLAS_INT_BASE + 3)
52#define ATLASINT_RES21 (ATLASINT_BASE+21) 53#define ATLAS_INT_RTC (ATLAS_INT_BASE + 4)
53#define ATLASINT_RES22 (ATLASINT_BASE+22) 54#define ATLAS_INT_COREHI (ATLAS_INT_BASE + 5)
54#define ATLASINT_RES23 (ATLASINT_BASE+23) 55#define ATLAS_INT_CORELO (ATLAS_INT_BASE + 6)
55#define ATLASINT_RES24 (ATLASINT_BASE+24) 56#define ATLAS_INT_RES7 (ATLAS_INT_BASE + 7)
56#define ATLASINT_RES25 (ATLASINT_BASE+25) 57#define ATLAS_INT_PCIA (ATLAS_INT_BASE + 8)
57#define ATLASINT_RES26 (ATLASINT_BASE+26) 58#define ATLAS_INT_PCIB (ATLAS_INT_BASE + 9)
58#define ATLASINT_RES27 (ATLASINT_BASE+27) 59#define ATLAS_INT_PCIC (ATLAS_INT_BASE + 10)
59#define ATLASINT_RES28 (ATLASINT_BASE+28) 60#define ATLAS_INT_PCID (ATLAS_INT_BASE + 11)
60#define ATLASINT_RES29 (ATLASINT_BASE+29) 61#define ATLAS_INT_ENUM (ATLAS_INT_BASE + 12)
61#define ATLASINT_RES30 (ATLASINT_BASE+30) 62#define ATLAS_INT_DEG (ATLAS_INT_BASE + 13)
62#define ATLASINT_RES31 (ATLASINT_BASE+31) 63#define ATLAS_INT_ATXFAIL (ATLAS_INT_BASE + 14)
63#define ATLASINT_END (ATLASINT_BASE+31) 64#define ATLAS_INT_INTA (ATLAS_INT_BASE + 15)
65#define ATLAS_INT_INTB (ATLAS_INT_BASE + 16)
66#define ATLAS_INT_ETH ATLAS_INT_INTB
67#define ATLAS_INT_INTC (ATLAS_INT_BASE + 17)
68#define ATLAS_INT_SCSI ATLAS_INT_INTC
69#define ATLAS_INT_INTD (ATLAS_INT_BASE + 18)
70#define ATLAS_INT_SERR (ATLAS_INT_BASE + 19)
71#define ATLAS_INT_RES20 (ATLAS_INT_BASE + 20)
72#define ATLAS_INT_RES21 (ATLAS_INT_BASE + 21)
73#define ATLAS_INT_RES22 (ATLAS_INT_BASE + 22)
74#define ATLAS_INT_RES23 (ATLAS_INT_BASE + 23)
75#define ATLAS_INT_RES24 (ATLAS_INT_BASE + 24)
76#define ATLAS_INT_RES25 (ATLAS_INT_BASE + 25)
77#define ATLAS_INT_RES26 (ATLAS_INT_BASE + 26)
78#define ATLAS_INT_RES27 (ATLAS_INT_BASE + 27)
79#define ATLAS_INT_RES28 (ATLAS_INT_BASE + 28)
80#define ATLAS_INT_RES29 (ATLAS_INT_BASE + 29)
81#define ATLAS_INT_RES30 (ATLAS_INT_BASE + 30)
82#define ATLAS_INT_RES31 (ATLAS_INT_BASE + 31)
83#define ATLAS_INT_END (ATLAS_INT_BASE + 31)
84
85/*
86 * Interrupts 64..127 are used for Soc-it Classic interrupts
87 */
88#define MSC01C_INT_BASE 64
89
90/* SOC-it Classic interrupt offsets */
91#define MSC01C_INT_TMR 0
92#define MSC01C_INT_PCI 1
93
94/*
95 * Interrupts 64..127 are used for Soc-it EIC interrupts
96 */
97#define MSC01E_INT_BASE 64
98
99/* SOC-it EIC interrupt offsets */
100#define MSC01E_INT_SW0 1
101#define MSC01E_INT_SW1 2
102#define MSC01E_INT_MB0 3
103#define MSC01E_INT_ATLAS MSC01E_INT_MB0
104#define MSC01E_INT_MB1 4
105#define MSC01E_INT_MB2 5
106#define MSC01E_INT_MB3 6
107#define MSC01E_INT_MB4 7
108#define MSC01E_INT_TMR 8
109#define MSC01E_INT_PCI 9
110#define MSC01E_INT_PERFCTR 10
111#define MSC01E_INT_CPUCTR 11
64 112
65#endif /* !(_MIPS_ATLASINT_H) */ 113#endif /* !(_MIPS_ATLASINT_H) */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 18b69de87daa..fe065d6070ca 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -262,10 +262,10 @@ drop_mmu_context(struct mm_struct *mm, unsigned cpu)
262 /* See comments for similar code above */ 262 /* See comments for similar code above */
263 prevvpe = dvpe(); 263 prevvpe = dvpe();
264 oldasid = (read_c0_entryhi() & ASID_MASK); 264 oldasid = (read_c0_entryhi() & ASID_MASK);
265 if(smtc_live_asid[mytlb][oldasid]) { 265 if (smtc_live_asid[mytlb][oldasid]) {
266 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu); 266 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
267 if(smtc_live_asid[mytlb][oldasid] == 0) 267 if(smtc_live_asid[mytlb][oldasid] == 0)
268 smtc_flush_tlb_asid(oldasid); 268 smtc_flush_tlb_asid(oldasid);
269 } 269 }
270 /* See comments for similar code above */ 270 /* See comments for similar code above */
271 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) 271 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK)
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 219d359861f3..85b258ee7090 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -34,6 +34,8 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36 36
37#include <asm/cpu-features.h>
38
37extern void clear_page(void * page); 39extern void clear_page(void * page);
38extern void copy_page(void * to, void * from); 40extern void copy_page(void * to, void * from);
39 41
@@ -53,7 +55,7 @@ static inline void clear_user_page(void *addr, unsigned long vaddr,
53 extern void (*flush_data_cache_page)(unsigned long addr); 55 extern void (*flush_data_cache_page)(unsigned long addr);
54 56
55 clear_page(addr); 57 clear_page(addr);
56 if (pages_do_alias((unsigned long) addr, vaddr)) 58 if (pages_do_alias((unsigned long) addr, vaddr & PAGE_MASK))
57 flush_data_cache_page((unsigned long)addr); 59 flush_data_cache_page((unsigned long)addr);
58} 60}
59 61
@@ -63,7 +65,8 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
63 extern void (*flush_data_cache_page)(unsigned long addr); 65 extern void (*flush_data_cache_page)(unsigned long addr);
64 66
65 copy_page(vto, vfrom); 67 copy_page(vto, vfrom);
66 if (pages_do_alias((unsigned long)vto, vaddr)) 68 if (!cpu_has_ic_fills_f_dc ||
69 pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
67 flush_data_cache_page((unsigned long)vto); 70 flush_data_cache_page((unsigned long)vto);
68} 71}
69 72
@@ -74,15 +77,17 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
74 #ifdef CONFIG_CPU_MIPS32 77 #ifdef CONFIG_CPU_MIPS32
75 typedef struct { unsigned long pte_low, pte_high; } pte_t; 78 typedef struct { unsigned long pte_low, pte_high; } pte_t;
76 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) 79 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
80 #define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
77 #else 81 #else
78 typedef struct { unsigned long long pte; } pte_t; 82 typedef struct { unsigned long long pte; } pte_t;
79 #define pte_val(x) ((x).pte) 83 #define pte_val(x) ((x).pte)
84 #define __pte(x) ((pte_t) { (x) } )
80 #endif 85 #endif
81#else 86#else
82typedef struct { unsigned long pte; } pte_t; 87typedef struct { unsigned long pte; } pte_t;
83#define pte_val(x) ((x).pte) 88#define pte_val(x) ((x).pte)
84#endif
85#define __pte(x) ((pte_t) { (x) } ) 89#define __pte(x) ((pte_t) { (x) } )
90#endif
86 91
87/* 92/*
88 * For 3-level pagetables we defines these ourselves, for 2-level the 93 * For 3-level pagetables we defines these ourselves, for 2-level the
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index c59a1e21f5b0..d05fb6f38aa7 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -93,8 +93,12 @@
93#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t)) 93#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
94#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) 94#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
95 95
96#if PGDIR_SIZE >= TASK_SIZE
97#define USER_PTRS_PER_PGD (1)
98#else
96#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 99#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
97#define FIRST_USER_ADDRESS 0 100#endif
101#define FIRST_USER_ADDRESS 0UL
98 102
99#define VMALLOC_START MAP_BASE 103#define VMALLOC_START MAP_BASE
100#define VMALLOC_END \ 104#define VMALLOC_END \
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 4113316ee0da..5f3a9075cd28 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -10,8 +10,6 @@
10#define _ASM_PTRACE_H 10#define _ASM_PTRACE_H
11 11
12 12
13#include <asm/isadep.h>
14
15/* 0 - 31 are integer registers, 32 - 63 are fp registers. */ 13/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
16#define FPR_BASE 32 14#define FPR_BASE 32
17#define PC 64 15#define PC 64
@@ -46,9 +44,8 @@ struct pt_regs {
46 unsigned long cp0_epc; 44 unsigned long cp0_epc;
47#ifdef CONFIG_MIPS_MT_SMTC 45#ifdef CONFIG_MIPS_MT_SMTC
48 unsigned long cp0_tcstatus; 46 unsigned long cp0_tcstatus;
49 unsigned long smtc_pad;
50#endif /* CONFIG_MIPS_MT_SMTC */ 47#endif /* CONFIG_MIPS_MT_SMTC */
51}; 48} __attribute__ ((aligned (8)));
52 49
53/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 50/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
54#define PTRACE_GETREGS 12 51#define PTRACE_GETREGS 12
@@ -73,6 +70,7 @@ struct pt_regs {
73#ifdef __KERNEL__ 70#ifdef __KERNEL__
74 71
75#include <linux/linkage.h> 72#include <linux/linkage.h>
73#include <asm/isadep.h>
76 74
77/* 75/*
78 * Does the process account for user or for system time? 76 * Does the process account for user or for system time?
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
index 584bd9c0ab2e..d7a65135d837 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -52,54 +52,21 @@
52#endif 52#endif
53 53
54/* 54/*
55 * Both Galileo boards have the same UART mappings. 55 * Galileo EV64120 evaluation board
56 */ 56 */
57#if defined (CONFIG_MIPS_EV96100) || defined (CONFIG_MIPS_EV64120) 57#ifdef CONFIG_MIPS_EV64120
58#include <asm/galileo-boards/ev96100.h> 58#include <mach-gt64120.h>
59#include <asm/galileo-boards/ev96100int.h> 59#define EV64120_SERIAL_PORT_DEFNS \
60#define EV96100_SERIAL_PORT_DEFNS \ 60 { .baud_base = EV64120_BASE_BAUD, .irq = EV64120_UART_IRQ, \
61 { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \
62 .flags = STD_COM_FLAGS, \ 61 .flags = STD_COM_FLAGS, \
63 .iomem_base = EV96100_UART0_REGS_BASE, .iomem_reg_shift = 2, \ 62 .iomem_base = EV64120_UART0_REGS_BASE, .iomem_reg_shift = 2, \
64 .io_type = SERIAL_IO_MEM }, \ 63 .io_type = SERIAL_IO_MEM }, \
65 { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \ 64 { .baud_base = EV64120_BASE_BAUD, .irq = EV64120_UART_IRQ, \
66 .flags = STD_COM_FLAGS, \ 65 .flags = STD_COM_FLAGS, \
67 .iomem_base = EV96100_UART1_REGS_BASE, .iomem_reg_shift = 2, \ 66 .iomem_base = EV64120_UART1_REGS_BASE, .iomem_reg_shift = 2, \
68 .io_type = SERIAL_IO_MEM }, 67 .io_type = SERIAL_IO_MEM },
69#else 68#else
70#define EV96100_SERIAL_PORT_DEFNS 69#define EV64120_SERIAL_PORT_DEFNS
71#endif
72
73#ifdef CONFIG_MIPS_ITE8172
74#include <asm/it8172/it8172.h>
75#include <asm/it8172/it8172_int.h>
76#include <asm/it8712.h>
77#define ITE_SERIAL_PORT_DEFNS \
78 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
79 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
80 { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
81 .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
82 /* Smart Card Reader 0 */ \
83 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \
84 .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
85 /* Smart Card Reader 1 */ \
86 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
87 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
88#else
89#define ITE_SERIAL_PORT_DEFNS
90#endif
91
92#ifdef CONFIG_MIPS_IVR
93#include <asm/it8172/it8172.h>
94#include <asm/it8172/it8172_int.h>
95#define IVR_SERIAL_PORT_DEFNS \
96 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
97 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
98 /* Smart Card Reader 1 */ \
99 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
100 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
101#else
102#define IVR_SERIAL_PORT_DEFNS
103#endif 70#endif
104 71
105#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT 72#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
@@ -239,10 +206,8 @@
239 206
240#define SERIAL_PORT_DFNS \ 207#define SERIAL_PORT_DFNS \
241 DDB5477_SERIAL_PORT_DEFNS \ 208 DDB5477_SERIAL_PORT_DEFNS \
242 EV96100_SERIAL_PORT_DEFNS \ 209 EV64120_SERIAL_PORT_DEFNS \
243 IP32_SERIAL_PORT_DEFNS \ 210 IP32_SERIAL_PORT_DEFNS \
244 ITE_SERIAL_PORT_DEFNS \
245 IVR_SERIAL_PORT_DEFNS \
246 JAZZ_SERIAL_PORT_DEFNS \ 211 JAZZ_SERIAL_PORT_DEFNS \
247 STD_SERIAL_PORT_DEFNS \ 212 STD_SERIAL_PORT_DEFNS \
248 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \ 213 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h
index 335dbaf1d831..a885491217c1 100644
--- a/include/asm-mips/sibyte/sb1250_defs.h
+++ b/include/asm-mips/sibyte/sb1250_defs.h
@@ -212,7 +212,7 @@
212 * Note: you'll need to define uint32_t and uint64_t in your headers. 212 * Note: you'll need to define uint32_t and uint64_t in your headers.
213 */ 213 */
214 214
215#if !defined(__ASSEMBLER__) 215#if !defined(__ASSEMBLY__)
216#define _SB_MAKE64(x) ((uint64_t)(x)) 216#define _SB_MAKE64(x) ((uint64_t)(x))
217#define _SB_MAKE32(x) ((uint32_t)(x)) 217#define _SB_MAKE32(x) ((uint32_t)(x))
218#else 218#else
@@ -251,9 +251,9 @@
251 */ 251 */
252 252
253 253
254#if defined(__mips64) && !defined(__ASSEMBLER__) 254#if defined(__mips64) && !defined(__ASSEMBLY__)
255#define SBWRITECSR(csr,val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val) 255#define SBWRITECSR(csr,val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val)
256#define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr))) 256#define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr)))
257#endif /* __ASSEMBLER__ */ 257#endif /* __ASSEMBLY__ */
258 258
259#endif 259#endif
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index f4178bdcfcb0..7ed0bb611e56 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -149,7 +149,7 @@
149 * (For the assembler version, sysrev and dest may be the same register. 149 * (For the assembler version, sysrev and dest may be the same register.
150 * Also, it clobbers AT.) 150 * Also, it clobbers AT.)
151 */ 151 */
152#ifdef __ASSEMBLER__ 152#ifdef __ASSEMBLY__
153#define SYS_SOC_TYPE(dest, sysrev) \ 153#define SYS_SOC_TYPE(dest, sysrev) \
154 .set push ; \ 154 .set push ; \
155 .set reorder ; \ 155 .set reorder ; \
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
index 87a1dff95199..8b391a2f0814 100644
--- a/include/asm-mips/signal.h
+++ b/include/asm-mips/signal.h
@@ -108,17 +108,8 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
108#define SIG_BLOCK 1 /* for blocking signals */ 108#define SIG_BLOCK 1 /* for blocking signals */
109#define SIG_UNBLOCK 2 /* for unblocking signals */ 109#define SIG_UNBLOCK 2 /* for unblocking signals */
110#define SIG_SETMASK 3 /* for setting the signal mask */ 110#define SIG_SETMASK 3 /* for setting the signal mask */
111#define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility:
112 set only the low 32 bit of the sigset. */
113 111
114/* Type of a signal handler. */ 112#include <asm-generic/signal.h>
115typedef void __signalfn_t(int);
116typedef __signalfn_t __user *__sighandler_t;
117
118/* Fake signal functions */
119#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
120#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
121#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
122 113
123struct sigaction { 114struct sigaction {
124 unsigned int sa_flags; 115 unsigned int sa_flags;
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 669b8e349ff2..c8d5587467bb 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -239,7 +239,51 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
239 : "memory"); 239 : "memory");
240} 240}
241 241
242#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 242static inline int __raw_read_trylock(raw_rwlock_t *rw)
243{
244 unsigned int tmp;
245 int ret;
246
247 if (R10000_LLSC_WAR) {
248 __asm__ __volatile__(
249 " .set noreorder # __raw_read_trylock \n"
250 " li %2, 0 \n"
251 "1: ll %1, %3 \n"
252 " bnez %1, 2f \n"
253 " addu %1, 1 \n"
254 " sc %1, %0 \n"
255 " beqzl %1, 1b \n"
256 " .set reorder \n"
257#ifdef CONFIG_SMP
258 " sync \n"
259#endif
260 " li %2, 1 \n"
261 "2: \n"
262 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
263 : "m" (rw->lock)
264 : "memory");
265 } else {
266 __asm__ __volatile__(
267 " .set noreorder # __raw_read_trylock \n"
268 " li %2, 0 \n"
269 "1: ll %1, %3 \n"
270 " bnez %1, 2f \n"
271 " addu %1, 1 \n"
272 " sc %1, %0 \n"
273 " beqz %1, 1b \n"
274 " .set reorder \n"
275#ifdef CONFIG_SMP
276 " sync \n"
277#endif
278 " li %2, 1 \n"
279 "2: \n"
280 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
281 : "m" (rw->lock)
282 : "memory");
283 }
284
285 return ret;
286}
243 287
244static inline int __raw_write_trylock(raw_rwlock_t *rw) 288static inline int __raw_write_trylock(raw_rwlock_t *rw)
245{ 289{
@@ -283,4 +327,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
283 return ret; 327 return ret;
284} 328}
285 329
330
331#define _raw_spin_relax(lock) cpu_relax()
332#define _raw_read_relax(lock) cpu_relax()
333#define _raw_write_relax(lock) cpu_relax()
334
286#endif /* _ASM_SPINLOCK_H */ 335#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips/stacktrace.h b/include/asm-mips/stacktrace.h
new file mode 100644
index 000000000000..07f873351a86
--- /dev/null
+++ b/include/asm-mips/stacktrace.h
@@ -0,0 +1,44 @@
1#ifndef _ASM_STACKTRACE_H
2#define _ASM_STACKTRACE_H
3
4#include <asm/ptrace.h>
5
6#ifdef CONFIG_KALLSYMS
7extern int raw_show_trace;
8extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
9 unsigned long pc, unsigned long *ra);
10#else
11#define raw_show_trace 1
12#define unwind_stack(task, sp, pc, ra) 0
13#endif
14
15static __always_inline void prepare_frametrace(struct pt_regs *regs)
16{
17#ifndef CONFIG_KALLSYMS
18 /*
19 * Remove any garbage that may be in regs (specially func
20 * addresses) to avoid show_raw_backtrace() to report them
21 */
22 memset(regs, 0, sizeof(*regs));
23#endif
24 __asm__ __volatile__(
25 ".set push\n\t"
26 ".set noat\n\t"
27#ifdef CONFIG_64BIT
28 "1: dla $1, 1b\n\t"
29 "sd $1, %0\n\t"
30 "sd $29, %1\n\t"
31 "sd $31, %2\n\t"
32#else
33 "1: la $1, 1b\n\t"
34 "sw $1, %0\n\t"
35 "sw $29, %1\n\t"
36 "sw $31, %2\n\t"
37#endif
38 ".set pop\n\t"
39 : "=m" (regs->cp0_epc),
40 "=m" (regs->regs[29]), "=m" (regs->regs[31])
41 : : "memory");
42}
43
44#endif /* _ASM_STACKTRACE_H */
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h
index 98aa737b34aa..b80de8e0fbbd 100644
--- a/include/asm-mips/timex.h
+++ b/include/asm-mips/timex.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_TIMEX_H 8#ifndef _ASM_TIMEX_H
9#define _ASM_TIMEX_H 9#define _ASM_TIMEX_H
10 10
11#ifdef __KERNEL__
12
11#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
12 14
13/* 15/*
@@ -51,4 +53,6 @@ static inline cycles_t get_cycles (void)
51 return read_c0_count(); 53 return read_c0_count();
52} 54}
53 55
56#endif /* __KERNEL__ */
57
54#endif /* _ASM_TIMEX_H */ 58#endif /* _ASM_TIMEX_H */
diff --git a/include/asm-mips/tx4938/tx4938_mips.h b/include/asm-mips/tx4938/tx4938_mips.h
index cf89b205f103..5f8498fef005 100644
--- a/include/asm-mips/tx4938/tx4938_mips.h
+++ b/include/asm-mips/tx4938/tx4938_mips.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-mips/tx4938/tx4938_bitmask.h 2 * linux/include/asm-mips/tx4938/tx4938_mips.h
3 * Generic bitmask definitions 3 * Generic bitmask definitions
4 * 4 *
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 610ccb8a50b3..685c91467e63 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -313,7 +313,7 @@
313#define __NR_mknodat (__NR_Linux + 290) 313#define __NR_mknodat (__NR_Linux + 290)
314#define __NR_fchownat (__NR_Linux + 291) 314#define __NR_fchownat (__NR_Linux + 291)
315#define __NR_futimesat (__NR_Linux + 292) 315#define __NR_futimesat (__NR_Linux + 292)
316#define __NR_fstatat (__NR_Linux + 293) 316#define __NR_fstatat64 (__NR_Linux + 293)
317#define __NR_unlinkat (__NR_Linux + 294) 317#define __NR_unlinkat (__NR_Linux + 294)
318#define __NR_renameat (__NR_Linux + 295) 318#define __NR_renameat (__NR_Linux + 295)
319#define __NR_linkat (__NR_Linux + 296) 319#define __NR_linkat (__NR_Linux + 296)
@@ -329,16 +329,18 @@
329#define __NR_tee (__NR_Linux + 306) 329#define __NR_tee (__NR_Linux + 306)
330#define __NR_vmsplice (__NR_Linux + 307) 330#define __NR_vmsplice (__NR_Linux + 307)
331#define __NR_move_pages (__NR_Linux + 308) 331#define __NR_move_pages (__NR_Linux + 308)
332#define __NR_set_robust_list (__NR_Linux + 309)
333#define __NR_get_robust_list (__NR_Linux + 310)
332 334
333/* 335/*
334 * Offset of the last Linux o32 flavoured syscall 336 * Offset of the last Linux o32 flavoured syscall
335 */ 337 */
336#define __NR_Linux_syscalls 308 338#define __NR_Linux_syscalls 310
337 339
338#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 340#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
339 341
340#define __NR_O32_Linux 4000 342#define __NR_O32_Linux 4000
341#define __NR_O32_Linux_syscalls 308 343#define __NR_O32_Linux_syscalls 310
342 344
343#if _MIPS_SIM == _MIPS_SIM_ABI64 345#if _MIPS_SIM == _MIPS_SIM_ABI64
344 346
@@ -598,7 +600,7 @@
598#define __NR_mknodat (__NR_Linux + 249) 600#define __NR_mknodat (__NR_Linux + 249)
599#define __NR_fchownat (__NR_Linux + 250) 601#define __NR_fchownat (__NR_Linux + 250)
600#define __NR_futimesat (__NR_Linux + 251) 602#define __NR_futimesat (__NR_Linux + 251)
601#define __NR_fstatat (__NR_Linux + 252) 603#define __NR_newfstatat (__NR_Linux + 252)
602#define __NR_unlinkat (__NR_Linux + 253) 604#define __NR_unlinkat (__NR_Linux + 253)
603#define __NR_renameat (__NR_Linux + 254) 605#define __NR_renameat (__NR_Linux + 254)
604#define __NR_linkat (__NR_Linux + 255) 606#define __NR_linkat (__NR_Linux + 255)
@@ -614,16 +616,18 @@
614#define __NR_tee (__NR_Linux + 265) 616#define __NR_tee (__NR_Linux + 265)
615#define __NR_vmsplice (__NR_Linux + 266) 617#define __NR_vmsplice (__NR_Linux + 266)
616#define __NR_move_pages (__NR_Linux + 267) 618#define __NR_move_pages (__NR_Linux + 267)
619#define __NR_set_robust_list (__NR_Linux + 268)
620#define __NR_get_robust_list (__NR_Linux + 269)
617 621
618/* 622/*
619 * Offset of the last Linux 64-bit flavoured syscall 623 * Offset of the last Linux 64-bit flavoured syscall
620 */ 624 */
621#define __NR_Linux_syscalls 267 625#define __NR_Linux_syscalls 269
622 626
623#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 627#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
624 628
625#define __NR_64_Linux 5000 629#define __NR_64_Linux 5000
626#define __NR_64_Linux_syscalls 267 630#define __NR_64_Linux_syscalls 269
627 631
628#if _MIPS_SIM == _MIPS_SIM_NABI32 632#if _MIPS_SIM == _MIPS_SIM_NABI32
629 633
@@ -887,7 +891,7 @@
887#define __NR_mknodat (__NR_Linux + 253) 891#define __NR_mknodat (__NR_Linux + 253)
888#define __NR_fchownat (__NR_Linux + 254) 892#define __NR_fchownat (__NR_Linux + 254)
889#define __NR_futimesat (__NR_Linux + 255) 893#define __NR_futimesat (__NR_Linux + 255)
890#define __NR_fstatat (__NR_Linux + 256) 894#define __NR_newfstatat (__NR_Linux + 256)
891#define __NR_unlinkat (__NR_Linux + 257) 895#define __NR_unlinkat (__NR_Linux + 257)
892#define __NR_renameat (__NR_Linux + 258) 896#define __NR_renameat (__NR_Linux + 258)
893#define __NR_linkat (__NR_Linux + 259) 897#define __NR_linkat (__NR_Linux + 259)
@@ -903,16 +907,18 @@
903#define __NR_tee (__NR_Linux + 269) 907#define __NR_tee (__NR_Linux + 269)
904#define __NR_vmsplice (__NR_Linux + 270) 908#define __NR_vmsplice (__NR_Linux + 270)
905#define __NR_move_pages (__NR_Linux + 271) 909#define __NR_move_pages (__NR_Linux + 271)
910#define __NR_set_robust_list (__NR_Linux + 272)
911#define __NR_get_robust_list (__NR_Linux + 273)
906 912
907/* 913/*
908 * Offset of the last N32 flavoured syscall 914 * Offset of the last N32 flavoured syscall
909 */ 915 */
910#define __NR_Linux_syscalls 271 916#define __NR_Linux_syscalls 273
911 917
912#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 918#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
913 919
914#define __NR_N32_Linux 6000 920#define __NR_N32_Linux 6000
915#define __NR_N32_Linux_syscalls 271 921#define __NR_N32_Linux_syscalls 273
916 922
917#ifdef __KERNEL__ 923#ifdef __KERNEL__
918 924
@@ -1206,45 +1212,6 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
1206# define __ARCH_WANT_COMPAT_SYS_TIME 1212# define __ARCH_WANT_COMPAT_SYS_TIME
1207# endif 1213# endif
1208 1214
1209#ifdef __KERNEL_SYSCALLS__
1210
1211#include <linux/compiler.h>
1212#include <linux/types.h>
1213#include <linux/linkage.h>
1214#include <asm/ptrace.h>
1215#include <asm/sim.h>
1216
1217/*
1218 * we need this inline - forking from kernel space will result
1219 * in NO COPY ON WRITE (!!!), until an execve is executed. This
1220 * is no problem, but for the stack. This is handled by not letting
1221 * main() use the stack at all after fork(). Thus, no function
1222 * calls - which means inline code for fork too, as otherwise we
1223 * would use the stack upon exit from 'fork()'.
1224 *
1225 * Actually only pause and fork are needed inline, so that there
1226 * won't be any messing with the stack from main(), but we define
1227 * some others too.
1228 */
1229static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
1230
1231asmlinkage unsigned long sys_mmap(
1232 unsigned long addr, size_t len,
1233 int prot, int flags,
1234 int fd, off_t offset);
1235asmlinkage long sys_mmap2(
1236 unsigned long addr, unsigned long len,
1237 unsigned long prot, unsigned long flags,
1238 unsigned long fd, unsigned long pgoff);
1239asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs);
1240asmlinkage int sys_pipe(nabi_no_regargs struct pt_regs regs);
1241struct sigaction;
1242asmlinkage long sys_rt_sigaction(int sig,
1243 const struct sigaction __user *act,
1244 struct sigaction __user *oact,
1245 size_t sigsetsize);
1246
1247#endif /* __KERNEL_SYSCALLS__ */
1248#endif /* !__ASSEMBLY__ */ 1215#endif /* !__ASSEMBLY__ */
1249 1216
1250/* 1217/*
diff --git a/include/asm-mips/user.h b/include/asm-mips/user.h
index 89bf8b4cab3c..61f2a093b91b 100644
--- a/include/asm-mips/user.h
+++ b/include/asm-mips/user.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_USER_H 8#ifndef _ASM_USER_H
9#define _ASM_USER_H 9#define _ASM_USER_H
10 10
11#ifdef __KERNEL__
12
11#include <asm/page.h> 13#include <asm/page.h>
12#include <asm/reg.h> 14#include <asm/reg.h>
13 15
@@ -55,4 +57,6 @@ struct user {
55#define HOST_DATA_START_ADDR (u.start_data) 57#define HOST_DATA_START_ADDR (u.start_data)
56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 58#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
57 59
60#endif /* __KERNEL__ */
61
58#endif /* _ASM_USER_H */ 62#endif /* _ASM_USER_H */
diff --git a/include/asm-parisc/agp.h b/include/asm-parisc/agp.h
new file mode 100644
index 000000000000..9f61d4eb6c01
--- /dev/null
+++ b/include/asm-parisc/agp.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_PARISC_AGP_H
2#define _ASM_PARISC_AGP_H
3
4/*
5 * PARISC specific AGP definitions.
6 * Copyright (c) 2006 Kyle McMartin <kyle@parisc-linux.org>
7 *
8 */
9
10#define map_page_into_agp(page) /* nothing */
11#define unmap_page_from_agp(page) /* nothing */
12#define flush_agp_mappings() /* nothing */
13#define flush_agp_cache() mb()
14
15/* Convert a physical address to an address suitable for the GART. */
16#define phys_to_gart(x) (x)
17#define gart_to_phys(x) (x)
18
19/* GATT allocation. Returns/accepts GATT kernel virtual address. */
20#define alloc_gatt_pages(order) \
21 ((char *)__get_free_pages(GFP_KERNEL, (order)))
22#define free_gatt_pages(table, order) \
23 free_pages((unsigned long)(table), (order))
24
25#endif /* _ASM_PARISC_AGP_H */
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
index 1a7bfe699e0c..5a1e0e8b1c32 100644
--- a/include/asm-parisc/assembly.h
+++ b/include/asm-parisc/assembly.h
@@ -29,7 +29,8 @@
29#define LDREGX ldd,s 29#define LDREGX ldd,s
30#define LDREGM ldd,mb 30#define LDREGM ldd,mb
31#define STREGM std,ma 31#define STREGM std,ma
32#define SHRREG shrd 32#define SHRREG shrd
33#define SHLREG shld
33#define RP_OFFSET 16 34#define RP_OFFSET 16
34#define FRAME_SIZE 128 35#define FRAME_SIZE 128
35#define CALLEE_REG_FRAME_SIZE 144 36#define CALLEE_REG_FRAME_SIZE 144
@@ -39,7 +40,8 @@
39#define LDREGX ldwx,s 40#define LDREGX ldwx,s
40#define LDREGM ldwm 41#define LDREGM ldwm
41#define STREGM stwm 42#define STREGM stwm
42#define SHRREG shr 43#define SHRREG shr
44#define SHLREG shlw
43#define RP_OFFSET 20 45#define RP_OFFSET 20
44#define FRAME_SIZE 64 46#define FRAME_SIZE 64
45#define CALLEE_REG_FRAME_SIZE 128 47#define CALLEE_REG_FRAME_SIZE 128
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index 0b459cdfbd6f..2bc41f2e0271 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -191,16 +191,38 @@ flush_anon_page(struct page *page, unsigned long vmaddr)
191} 191}
192#define ARCH_HAS_FLUSH_ANON_PAGE 192#define ARCH_HAS_FLUSH_ANON_PAGE
193 193
194static inline void 194#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
195flush_kernel_dcache_page(struct page *page) 195void flush_kernel_dcache_page_addr(void *addr);
196static inline void flush_kernel_dcache_page(struct page *page)
196{ 197{
197 flush_kernel_dcache_page_asm(page_address(page)); 198 flush_kernel_dcache_page_addr(page_address(page));
198} 199}
199#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
200 200
201#ifdef CONFIG_DEBUG_RODATA 201#ifdef CONFIG_DEBUG_RODATA
202void mark_rodata_ro(void); 202void mark_rodata_ro(void);
203#endif 203#endif
204 204
205#ifdef CONFIG_PA8X00
206/* Only pa8800, pa8900 needs this */
207#define ARCH_HAS_KMAP
208
209void kunmap_parisc(void *addr);
210
211static inline void *kmap(struct page *page)
212{
213 might_sleep();
214 return page_address(page);
215}
216
217#define kunmap(page) kunmap_parisc(page_address(page))
218
219#define kmap_atomic(page, idx) page_address(page)
220
221#define kunmap_atomic(addr, idx) kunmap_parisc(addr)
222
223#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
224#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
225#endif
226
205#endif /* _PARISC_CACHEFLUSH_H */ 227#endif /* _PARISC_CACHEFLUSH_H */
206 228
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 71b4eeea205a..fe8579023531 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -5,7 +5,7 @@
5 */ 5 */
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/personality.h> 8#include <linux/thread_info.h>
9 9
10#define COMPAT_USER_HZ 100 10#define COMPAT_USER_HZ 100
11 11
@@ -152,7 +152,7 @@ static __inline__ void __user *compat_alloc_user_space(long len)
152 152
153static inline int __is_compat_task(struct task_struct *t) 153static inline int __is_compat_task(struct task_struct *t)
154{ 154{
155 return personality(t->personality) == PER_LINUX32; 155 return test_ti_thread_flag(t->thread_info, TIF_32BIT);
156} 156}
157 157
158static inline int is_compat_task(void) 158static inline int is_compat_task(void)
diff --git a/include/asm-parisc/dma.h b/include/asm-parisc/dma.h
index 9979c3cb3745..da2cf373e31c 100644
--- a/include/asm-parisc/dma.h
+++ b/include/asm-parisc/dma.h
@@ -72,18 +72,13 @@
72#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ 72#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
73#define DMA2_EXT_MODE_REG (0x400 | DMA2_MODE_REG) 73#define DMA2_EXT_MODE_REG (0x400 | DMA2_MODE_REG)
74 74
75extern spinlock_t dma_spin_lock;
76
77static __inline__ unsigned long claim_dma_lock(void) 75static __inline__ unsigned long claim_dma_lock(void)
78{ 76{
79 unsigned long flags; 77 return 0;
80 spin_lock_irqsave(&dma_spin_lock, flags);
81 return flags;
82} 78}
83 79
84static __inline__ void release_dma_lock(unsigned long flags) 80static __inline__ void release_dma_lock(unsigned long flags)
85{ 81{
86 spin_unlock_irqrestore(&dma_spin_lock, flags);
87} 82}
88 83
89 84
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h
index 6a332a9f099c..d84bbb283fd1 100644
--- a/include/asm-parisc/futex.h
+++ b/include/asm-parisc/futex.h
@@ -1,6 +1,71 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_PARISC_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_PARISC_FUTEX_H
3 3
4#include <asm-generic/futex.h> 4#ifdef __KERNEL__
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52/* Non-atomic version */
53static inline int
54futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
55{
56 int err = 0;
57 int uval;
58
59 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
60 return -EFAULT;
61
62 err = get_user(uval, uaddr);
63 if (err) return -EFAULT;
64 if (uval == oldval)
65 err = put_user(newval, uaddr);
66 if (err) return -EFAULT;
67 return uval;
68}
69
70#endif
6#endif 71#endif
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index b9eb245b8874..c1963ce19dd2 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -134,7 +134,7 @@ extern inline void __iomem * ioremap(unsigned long offset, unsigned long size)
134} 134}
135#define ioremap_nocache(off, sz) ioremap((off), (sz)) 135#define ioremap_nocache(off, sz) ioremap((off), (sz))
136 136
137extern void iounmap(void __iomem *addr); 137extern void iounmap(const volatile void __iomem *addr);
138 138
139static inline unsigned char __raw_readb(const volatile void __iomem *addr) 139static inline unsigned char __raw_readb(const volatile void __iomem *addr)
140{ 140{
diff --git a/include/asm-parisc/iosapic.h b/include/asm-parisc/iosapic.h
deleted file mode 100644
index 613390e6805c..000000000000
--- a/include/asm-parisc/iosapic.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2** This file is private to iosapic driver.
3** If stuff needs to be used by another driver, move it to a common file.
4**
5** WARNING: fields most data structures here are ordered to make sure
6** they pack nicely for 64-bit compilation. (ie sizeof(long) == 8)
7*/
8
9
10/*
11** I/O SAPIC init function
12** Caller knows where an I/O SAPIC is. LBA has an integrated I/O SAPIC.
13** Call setup as part of per instance initialization.
14** (ie *not* init_module() function unless only one is present.)
15** fixup_irq is to initialize PCI IRQ line support and
16** virtualize pcidev->irq value. To be called by pci_fixup_bus().
17*/
18extern void *iosapic_register(unsigned long hpa);
19extern int iosapic_fixup_irq(void *obj, struct pci_dev *pcidev);
20
21
22#ifdef __IA64__
23/*
24** PA: PIB (Processor Interrupt Block) is handled by Runway bus adapter.
25** and is hardcoded to 0xfeeNNNN0 where NNNN is id_eid field.
26**
27** IA64: PIB is handled by "Local SAPIC" (integrated in the processor).
28*/
29struct local_sapic_info {
30 struct local_sapic_info *lsi_next; /* point to next CPU info */
31 int *lsi_cpu_id; /* point to logical CPU id */
32 unsigned long *lsi_id_eid; /* point to IA-64 CPU id */
33 int *lsi_status; /* point to CPU status */
34 void *lsi_private; /* point to special info */
35};
36
37/*
38** "root" data structure which ties everything together.
39** Should always be able to start with sapic_root and locate
40** the desired information.
41*/
42struct sapic_info {
43 struct sapic_info *si_next; /* info is per cell */
44 int si_cellid; /* cell id */
45 unsigned int si_status; /* status */
46 char *si_pib_base; /* intr blk base address */
47 local_sapic_info_t *si_local_info;
48 io_sapic_info_t *si_io_info;
49 extint_info_t *si_extint_info;/* External Intr info */
50};
51
52#endif /* IA64 */
53
diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h
index 5cae260615a2..399c81981ed5 100644
--- a/include/asm-parisc/irq.h
+++ b/include/asm-parisc/irq.h
@@ -31,7 +31,7 @@ static __inline__ int irq_canonicalize(int irq)
31 return (irq == 2) ? 9 : irq; 31 return (irq == 2) ? 9 : irq;
32} 32}
33 33
34struct hw_interrupt_type; 34struct irq_chip;
35 35
36/* 36/*
37 * Some useful "we don't have to do anything here" handlers. Should 37 * Some useful "we don't have to do anything here" handlers. Should
@@ -39,6 +39,8 @@ struct hw_interrupt_type;
39 */ 39 */
40void no_ack_irq(unsigned int irq); 40void no_ack_irq(unsigned int irq);
41void no_end_irq(unsigned int irq); 41void no_end_irq(unsigned int irq);
42void cpu_ack_irq(unsigned int irq);
43void cpu_end_irq(unsigned int irq);
42 44
43extern int txn_alloc_irq(unsigned int nbits); 45extern int txn_alloc_irq(unsigned int nbits);
44extern int txn_claim_irq(int); 46extern int txn_claim_irq(int);
@@ -46,7 +48,7 @@ extern unsigned int txn_alloc_data(unsigned int);
46extern unsigned long txn_alloc_addr(unsigned int); 48extern unsigned long txn_alloc_addr(unsigned int);
47extern unsigned long txn_affinity_addr(unsigned int irq, int cpu); 49extern unsigned long txn_affinity_addr(unsigned int irq, int cpu);
48 50
49extern int cpu_claim_irq(unsigned int irq, struct hw_interrupt_type *, void *); 51extern int cpu_claim_irq(unsigned int irq, struct irq_chip *, void *);
50extern int cpu_check_affinity(unsigned int irq, cpumask_t *dest); 52extern int cpu_check_affinity(unsigned int irq, cpumask_t *dest);
51 53
52/* soft power switch support (power.c) */ 54/* soft power switch support (power.c) */
diff --git a/include/asm-parisc/mckinley.h b/include/asm-parisc/mckinley.h
new file mode 100644
index 000000000000..d1ea6f12915e
--- /dev/null
+++ b/include/asm-parisc/mckinley.h
@@ -0,0 +1,9 @@
1#ifndef ASM_PARISC_MCKINLEY_H
2#define ASM_PARISC_MCKINLEY_H
3#ifdef __KERNEL__
4
5/* declared in arch/parisc/kernel/setup.c */
6extern struct proc_dir_entry * proc_mckinley_root;
7
8#endif /*__KERNEL__*/
9#endif /*ASM_PARISC_MCKINLEY_H*/
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 57d6d82756dd..3567208191e3 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -26,24 +26,10 @@
26 26
27struct page; 27struct page;
28 28
29extern void purge_kernel_dcache_page(unsigned long); 29void copy_user_page_asm(void *to, void *from);
30extern void copy_user_page_asm(void *to, void *from); 30void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
31extern void clear_user_page_asm(void *page, unsigned long vaddr); 31 struct page *pg);
32 32void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
33static inline void
34copy_user_page(void *vto, void *vfrom, unsigned long vaddr, struct page *pg)
35{
36 copy_user_page_asm(vto, vfrom);
37 flush_kernel_dcache_page_asm(vto);
38 /* XXX: ppc flushes icache too, should we? */
39}
40
41static inline void
42clear_user_page(void *page, unsigned long vaddr, struct page *pg)
43{
44 purge_kernel_dcache_page((unsigned long)page);
45 clear_user_page_asm(page, vaddr);
46}
47 33
48/* 34/*
49 * These are used to make use of C type-checking.. 35 * These are used to make use of C type-checking..
diff --git a/include/asm-parisc/param.h b/include/asm-parisc/param.h
index 07cb9b93cfe2..32e03d877858 100644
--- a/include/asm-parisc/param.h
+++ b/include/asm-parisc/param.h
@@ -2,13 +2,9 @@
2#define _ASMPARISC_PARAM_H 2#define _ASMPARISC_PARAM_H
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5# ifdef CONFIG_PA20 5#define HZ CONFIG_HZ
6# define HZ 1000 /* Faster machines */ 6#define USER_HZ 100 /* some user API use "ticks" */
7# else 7#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
8# define HZ 100 /* Internal kernel timer frequency */
9# endif
10# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
11# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
12#endif 8#endif
13 9
14#ifndef HZ 10#ifndef HZ
diff --git a/include/asm-parisc/parisc-device.h b/include/asm-parisc/parisc-device.h
index 1d247e32a608..e12624d8941d 100644
--- a/include/asm-parisc/parisc-device.h
+++ b/include/asm-parisc/parisc-device.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_PARISC_PARISC_DEVICE_H_
2#define _ASM_PARISC_PARISC_DEVICE_H_
3
1#include <linux/device.h> 4#include <linux/device.h>
2 5
3struct parisc_device { 6struct parisc_device {
@@ -57,3 +60,5 @@ parisc_get_drvdata(struct parisc_device *d)
57} 60}
58 61
59extern struct bus_type parisc_bus_type; 62extern struct bus_type parisc_bus_type;
63
64#endif /*_ASM_PARISC_PARISC_DEVICE_H_*/
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index 8b631f47eb25..7b8ad118d2fe 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -293,4 +293,9 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
293 /* We don't need to penalize isa irq's */ 293 /* We don't need to penalize isa irq's */
294} 294}
295 295
296static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
297{
298 return channel ? 15 : 14;
299}
300
296#endif /* __ASM_PARISC_PCI_H */ 301#endif /* __ASM_PARISC_PCI_H */
diff --git a/include/asm-parisc/prefetch.h b/include/asm-parisc/prefetch.h
new file mode 100644
index 000000000000..5d021726fa33
--- /dev/null
+++ b/include/asm-parisc/prefetch.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-parisc/prefetch.h
3 *
4 * PA 2.0 defines data prefetch instructions on page 6-11 of the Kane book.
5 * In addition, many implementations do hardware prefetching of both
6 * instructions and data.
7 *
8 * PA7300LC (page 14-4 of the ERS) also implements prefetching by a load
9 * to gr0 but not in a way that Linux can use. If the load would cause an
10 * interruption (eg due to prefetching 0), it is suppressed on PA2.0
11 * processors, but not on 7300LC.
12 *
13 */
14
15#ifndef __ASM_PARISC_PREFETCH_H
16#define __ASM_PARISC_PREFETCH_H
17
18#ifndef __ASSEMBLY__
19#ifdef CONFIG_PREFETCH
20
21#define ARCH_HAS_PREFETCH
22extern inline void prefetch(const void *addr)
23{
24 __asm__("ldw 0(%0), %%r0" : : "r" (addr));
25}
26
27/* LDD is a PA2.0 addition. */
28#ifdef CONFIG_PA20
29#define ARCH_HAS_PREFETCHW
30extern inline void prefetchw(const void *addr)
31{
32 __asm__("ldd 0(%0), %%r0" : : "r" (addr));
33}
34#endif /* CONFIG_PA20 */
35
36#endif /* CONFIG_PREFETCH */
37#endif /* __ASSEMBLY__ */
38
39#endif /* __ASM_PARISC_PROCESSOR_H */
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index b73626f040da..fd7866dc8c83 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -9,6 +9,8 @@
9#define __ASM_PARISC_PROCESSOR_H 9#define __ASM_PARISC_PROCESSOR_H
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12#include <asm/prefetch.h> /* lockdep.h needs <linux/prefetch.h> */
13
12#include <linux/threads.h> 14#include <linux/threads.h>
13#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
14 16
@@ -276,7 +278,7 @@ on downward growing arches, it looks like this:
276 */ 278 */
277 279
278#ifdef __LP64__ 280#ifdef __LP64__
279#define USER_WIDE_MODE (personality(current->personality) == PER_LINUX) 281#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
280#else 282#else
281#define USER_WIDE_MODE 0 283#define USER_WIDE_MODE 0
282#endif 284#endif
@@ -328,33 +330,20 @@ extern unsigned long get_wchan(struct task_struct *p);
328#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) 330#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
329#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30]) 331#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
330 332
333#define cpu_relax() barrier()
331 334
332/* 335/* Used as a macro to identify the combined VIPT/PIPT cached
333 * PA 2.0 defines data prefetch instructions on page 6-11 of the Kane book. 336 * CPUs which require a guarantee of coherency (no inequivalent
334 * In addition, many implementations do hardware prefetching of both 337 * aliases with different data, whether clean or not) to operate */
335 * instructions and data. 338static inline int parisc_requires_coherency(void)
336 *
337 * PA7300LC (page 14-4 of the ERS) also implements prefetching by a load
338 * to gr0 but not in a way that Linux can use. If the load would cause an
339 * interruption (eg due to prefetching 0), it is suppressed on PA2.0
340 * processors, but not on 7300LC.
341 */
342#ifdef CONFIG_PREFETCH
343#define ARCH_HAS_PREFETCH
344#define ARCH_HAS_PREFETCHW
345
346extern inline void prefetch(const void *addr)
347{
348 __asm__("ldw 0(%0), %%r0" : : "r" (addr));
349}
350
351extern inline void prefetchw(const void *addr)
352{ 339{
353 __asm__("ldd 0(%0), %%r0" : : "r" (addr)); 340#ifdef CONFIG_PA8X00
354} 341 /* FIXME: also pa8900 - when we see one */
342 return boot_cpu_data.cpu_type == mako;
343#else
344 return 0;
355#endif 345#endif
356 346}
357#define cpu_relax() barrier()
358 347
359#endif /* __ASSEMBLY__ */ 348#endif /* __ASSEMBLY__ */
360 349
diff --git a/include/asm-parisc/ropes.h b/include/asm-parisc/ropes.h
new file mode 100644
index 000000000000..5542dd00472b
--- /dev/null
+++ b/include/asm-parisc/ropes.h
@@ -0,0 +1,322 @@
1#ifndef _ASM_PARISC_ROPES_H_
2#define _ASM_PARISC_ROPES_H_
3
4#include <asm-parisc/parisc-device.h>
5
6#ifdef CONFIG_64BIT
7/* "low end" PA8800 machines use ZX1 chipset: PAT PDC and only run 64-bit */
8#define ZX1_SUPPORT
9#endif
10
11#ifdef CONFIG_PROC_FS
12/* depends on proc fs support. But costs CPU performance */
13#undef SBA_COLLECT_STATS
14#endif
15
16/*
17** The number of pdir entries to "free" before issueing
18** a read to PCOM register to flush out PCOM writes.
19** Interacts with allocation granularity (ie 4 or 8 entries
20** allocated and free'd/purged at a time might make this
21** less interesting).
22*/
23#define DELAYED_RESOURCE_CNT 16
24
25#define MAX_IOC 2 /* per Ike. Pluto/Astro only have 1. */
26#define ROPES_PER_IOC 8 /* per Ike half or Pluto/Astro */
27
28struct ioc {
29 void __iomem *ioc_hpa; /* I/O MMU base address */
30 char *res_map; /* resource map, bit == pdir entry */
31 u64 *pdir_base; /* physical base address */
32 unsigned long ibase; /* pdir IOV Space base - shared w/lba_pci */
33 unsigned long imask; /* pdir IOV Space mask - shared w/lba_pci */
34#ifdef ZX1_SUPPORT
35 unsigned long iovp_mask; /* help convert IOVA to IOVP */
36#endif
37 unsigned long *res_hint; /* next avail IOVP - circular search */
38 spinlock_t res_lock;
39 unsigned int res_bitshift; /* from the LEFT! */
40 unsigned int res_size; /* size of resource map in bytes */
41#ifdef SBA_HINT_SUPPORT
42/* FIXME : DMA HINTs not used */
43 unsigned long hint_mask_pdir; /* bits used for DMA hints */
44 unsigned int hint_shift_pdir;
45#endif
46#if DELAYED_RESOURCE_CNT > 0
47 int saved_cnt;
48 struct sba_dma_pair {
49 dma_addr_t iova;
50 size_t size;
51 } saved[DELAYED_RESOURCE_CNT];
52#endif
53
54#ifdef SBA_COLLECT_STATS
55#define SBA_SEARCH_SAMPLE 0x100
56 unsigned long avg_search[SBA_SEARCH_SAMPLE];
57 unsigned long avg_idx; /* current index into avg_search */
58 unsigned long used_pages;
59 unsigned long msingle_calls;
60 unsigned long msingle_pages;
61 unsigned long msg_calls;
62 unsigned long msg_pages;
63 unsigned long usingle_calls;
64 unsigned long usingle_pages;
65 unsigned long usg_calls;
66 unsigned long usg_pages;
67#endif
68 /* STUFF We don't need in performance path */
69 unsigned int pdir_size; /* in bytes, determined by IOV Space size */
70};
71
72struct sba_device {
73 struct sba_device *next; /* list of SBA's in system */
74 struct parisc_device *dev; /* dev found in bus walk */
75 const char *name;
76 void __iomem *sba_hpa; /* base address */
77 spinlock_t sba_lock;
78 unsigned int flags; /* state/functionality enabled */
79 unsigned int hw_rev; /* HW revision of chip */
80
81 struct resource chip_resv; /* MMIO reserved for chip */
82 struct resource iommu_resv; /* MMIO reserved for iommu */
83
84 unsigned int num_ioc; /* number of on-board IOC's */
85 struct ioc ioc[MAX_IOC];
86};
87
88#define ASTRO_RUNWAY_PORT 0x582
89#define IKE_MERCED_PORT 0x803
90#define REO_MERCED_PORT 0x804
91#define REOG_MERCED_PORT 0x805
92#define PLUTO_MCKINLEY_PORT 0x880
93
94static inline int IS_ASTRO(struct parisc_device *d) {
95 return d->id.hversion == ASTRO_RUNWAY_PORT;
96}
97
98static inline int IS_IKE(struct parisc_device *d) {
99 return d->id.hversion == IKE_MERCED_PORT;
100}
101
102static inline int IS_PLUTO(struct parisc_device *d) {
103 return d->id.hversion == PLUTO_MCKINLEY_PORT;
104}
105
106#define PLUTO_IOVA_BASE (1UL*1024*1024*1024) /* 1GB */
107#define PLUTO_IOVA_SIZE (1UL*1024*1024*1024) /* 1GB */
108#define PLUTO_GART_SIZE (PLUTO_IOVA_SIZE / 2)
109
110#define SBA_PDIR_VALID_BIT 0x8000000000000000ULL
111
112#define SBA_AGPGART_COOKIE 0x0000badbadc0ffeeULL
113
114#define SBA_FUNC_ID 0x0000 /* function id */
115#define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */
116
117#define SBA_FUNC_SIZE 4096 /* SBA configuration function reg set */
118
119#define ASTRO_IOC_OFFSET (32 * SBA_FUNC_SIZE)
120#define PLUTO_IOC_OFFSET (1 * SBA_FUNC_SIZE)
121/* Ike's IOC's occupy functions 2 and 3 */
122#define IKE_IOC_OFFSET(p) ((p+2) * SBA_FUNC_SIZE)
123
124#define IOC_CTRL 0x8 /* IOC_CTRL offset */
125#define IOC_CTRL_TC (1 << 0) /* TOC Enable */
126#define IOC_CTRL_CE (1 << 1) /* Coalesce Enable */
127#define IOC_CTRL_DE (1 << 2) /* Dillon Enable */
128#define IOC_CTRL_RM (1 << 8) /* Real Mode */
129#define IOC_CTRL_NC (1 << 9) /* Non Coherent Mode */
130#define IOC_CTRL_D4 (1 << 11) /* Disable 4-byte coalescing */
131#define IOC_CTRL_DD (1 << 13) /* Disable distr. LMMIO range coalescing */
132
133/*
134** Offsets into MBIB (Function 0 on Ike and hopefully Astro)
135** Firmware programs this stuff. Don't touch it.
136*/
137#define LMMIO_DIRECT0_BASE 0x300
138#define LMMIO_DIRECT0_MASK 0x308
139#define LMMIO_DIRECT0_ROUTE 0x310
140
141#define LMMIO_DIST_BASE 0x360
142#define LMMIO_DIST_MASK 0x368
143#define LMMIO_DIST_ROUTE 0x370
144
145#define IOS_DIST_BASE 0x390
146#define IOS_DIST_MASK 0x398
147#define IOS_DIST_ROUTE 0x3A0
148
149#define IOS_DIRECT_BASE 0x3C0
150#define IOS_DIRECT_MASK 0x3C8
151#define IOS_DIRECT_ROUTE 0x3D0
152
153/*
154** Offsets into I/O TLB (Function 2 and 3 on Ike)
155*/
156#define ROPE0_CTL 0x200 /* "regbus pci0" */
157#define ROPE1_CTL 0x208
158#define ROPE2_CTL 0x210
159#define ROPE3_CTL 0x218
160#define ROPE4_CTL 0x220
161#define ROPE5_CTL 0x228
162#define ROPE6_CTL 0x230
163#define ROPE7_CTL 0x238
164
165#define IOC_ROPE0_CFG 0x500 /* pluto only */
166#define IOC_ROPE_AO 0x10 /* Allow "Relaxed Ordering" */
167
168#define HF_ENABLE 0x40
169
170#define IOC_IBASE 0x300 /* IO TLB */
171#define IOC_IMASK 0x308
172#define IOC_PCOM 0x310
173#define IOC_TCNFG 0x318
174#define IOC_PDIR_BASE 0x320
175
176/*
177** IOC supports 4/8/16/64KB page sizes (see TCNFG register)
178** It's safer (avoid memory corruption) to keep DMA page mappings
179** equivalently sized to VM PAGE_SIZE.
180**
181** We really can't avoid generating a new mapping for each
182** page since the Virtual Coherence Index has to be generated
183** and updated for each page.
184**
185** PAGE_SIZE could be greater than IOVP_SIZE. But not the inverse.
186*/
187#define IOVP_SIZE PAGE_SIZE
188#define IOVP_SHIFT PAGE_SHIFT
189#define IOVP_MASK PAGE_MASK
190
191#define SBA_PERF_CFG 0x708 /* Performance Counter stuff */
192#define SBA_PERF_MASK1 0x718
193#define SBA_PERF_MASK2 0x730
194
195/*
196** Offsets into PCI Performance Counters (functions 12 and 13)
197** Controlled by PERF registers in function 2 & 3 respectively.
198*/
199#define SBA_PERF_CNT1 0x200
200#define SBA_PERF_CNT2 0x208
201#define SBA_PERF_CNT3 0x210
202
203/*
204** lba_device: Per instance Elroy data structure
205*/
206struct lba_device {
207 struct pci_hba_data hba;
208
209 spinlock_t lba_lock;
210 void *iosapic_obj;
211
212#ifdef CONFIG_64BIT
213 void __iomem *iop_base; /* PA_VIEW - for IO port accessor funcs */
214#endif
215
216 int flags; /* state/functionality enabled */
217 int hw_rev; /* HW revision of chip */
218};
219
220#define ELROY_HVERS 0x782
221#define MERCURY_HVERS 0x783
222#define QUICKSILVER_HVERS 0x784
223
224static inline int IS_ELROY(struct parisc_device *d) {
225 return (d->id.hversion == ELROY_HVERS);
226}
227
228static inline int IS_MERCURY(struct parisc_device *d) {
229 return (d->id.hversion == MERCURY_HVERS);
230}
231
232static inline int IS_QUICKSILVER(struct parisc_device *d) {
233 return (d->id.hversion == QUICKSILVER_HVERS);
234}
235
236static inline int agp_mode_mercury(void __iomem *hpa) {
237 u64 bus_mode;
238
239 bus_mode = readl(hpa + 0x0620);
240 if (bus_mode & 1)
241 return 1;
242
243 return 0;
244}
245
246/*
247** I/O SAPIC init function
248** Caller knows where an I/O SAPIC is. LBA has an integrated I/O SAPIC.
249** Call setup as part of per instance initialization.
250** (ie *not* init_module() function unless only one is present.)
251** fixup_irq is to initialize PCI IRQ line support and
252** virtualize pcidev->irq value. To be called by pci_fixup_bus().
253*/
254extern void *iosapic_register(unsigned long hpa);
255extern int iosapic_fixup_irq(void *obj, struct pci_dev *pcidev);
256
257#define LBA_FUNC_ID 0x0000 /* function id */
258#define LBA_FCLASS 0x0008 /* function class, bist, header, rev... */
259#define LBA_CAPABLE 0x0030 /* capabilities register */
260
261#define LBA_PCI_CFG_ADDR 0x0040 /* poke CFG address here */
262#define LBA_PCI_CFG_DATA 0x0048 /* read or write data here */
263
264#define LBA_PMC_MTLT 0x0050 /* Firmware sets this - read only. */
265#define LBA_FW_SCRATCH 0x0058 /* Firmware writes the PCI bus number here. */
266#define LBA_ERROR_ADDR 0x0070 /* On error, address gets logged here */
267
268#define LBA_ARB_MASK 0x0080 /* bit 0 enable arbitration. PAT/PDC enables */
269#define LBA_ARB_PRI 0x0088 /* firmware sets this. */
270#define LBA_ARB_MODE 0x0090 /* firmware sets this. */
271#define LBA_ARB_MTLT 0x0098 /* firmware sets this. */
272
273#define LBA_MOD_ID 0x0100 /* Module ID. PDC_PAT_CELL reports 4 */
274
275#define LBA_STAT_CTL 0x0108 /* Status & Control */
276#define LBA_BUS_RESET 0x01 /* Deassert PCI Bus Reset Signal */
277#define CLEAR_ERRLOG 0x10 /* "Clear Error Log" cmd */
278#define CLEAR_ERRLOG_ENABLE 0x20 /* "Clear Error Log" Enable */
279#define HF_ENABLE 0x40 /* enable HF mode (default is -1 mode) */
280
281#define LBA_LMMIO_BASE 0x0200 /* < 4GB I/O address range */
282#define LBA_LMMIO_MASK 0x0208
283
284#define LBA_GMMIO_BASE 0x0210 /* > 4GB I/O address range */
285#define LBA_GMMIO_MASK 0x0218
286
287#define LBA_WLMMIO_BASE 0x0220 /* All < 4GB ranges under the same *SBA* */
288#define LBA_WLMMIO_MASK 0x0228
289
290#define LBA_WGMMIO_BASE 0x0230 /* All > 4GB ranges under the same *SBA* */
291#define LBA_WGMMIO_MASK 0x0238
292
293#define LBA_IOS_BASE 0x0240 /* I/O port space for this LBA */
294#define LBA_IOS_MASK 0x0248
295
296#define LBA_ELMMIO_BASE 0x0250 /* Extra LMMIO range */
297#define LBA_ELMMIO_MASK 0x0258
298
299#define LBA_EIOS_BASE 0x0260 /* Extra I/O port space */
300#define LBA_EIOS_MASK 0x0268
301
302#define LBA_GLOBAL_MASK 0x0270 /* Mercury only: Global Address Mask */
303#define LBA_DMA_CTL 0x0278 /* firmware sets this */
304
305#define LBA_IBASE 0x0300 /* SBA DMA support */
306#define LBA_IMASK 0x0308
307
308/* FIXME: ignore DMA Hint stuff until we can measure performance */
309#define LBA_HINT_CFG 0x0310
310#define LBA_HINT_BASE 0x0380 /* 14 registers at every 8 bytes. */
311
312#define LBA_BUS_MODE 0x0620
313
314/* ERROR regs are needed for config cycle kluges */
315#define LBA_ERROR_CONFIG 0x0680
316#define LBA_SMART_MODE 0x20
317#define LBA_ERROR_STATUS 0x0688
318#define LBA_ROPE_CTL 0x06A0
319
320#define LBA_IOSAPIC_BASE 0x800 /* Offset of IRQ logic */
321
322#endif /*_ASM_PARISC_ROPES_H_*/
diff --git a/include/asm-parisc/rtc.h b/include/asm-parisc/rtc.h
index f3d3d6b110ba..f4ebff11dcbd 100644
--- a/include/asm-parisc/rtc.h
+++ b/include/asm-parisc/rtc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * inclue/asm-parisc/rtc.h 2 * include/asm-parisc/rtc.h
3 * 3 *
4 * Copyright 2002 Randolph CHung <tausq@debian.org> 4 * Copyright 2002 Randolph CHung <tausq@debian.org>
5 * 5 *
diff --git a/include/asm-parisc/serial.h b/include/asm-parisc/serial.h
index 82fd820d684f..d7e3cc60dbc3 100644
--- a/include/asm-parisc/serial.h
+++ b/include/asm-parisc/serial.h
@@ -3,20 +3,8 @@
3 */ 3 */
4 4
5/* 5/*
6 * This assumes you have a 7.272727 MHz clock for your UART. 6 * This is used for 16550-compatible UARTs
7 * The documentation implies a 40Mhz clock, and elsewhere a 7Mhz clock
8 * Clarified: 7.2727MHz on LASI. Not yet clarified for DINO
9 */ 7 */
8#define BASE_BAUD ( 1843200 / 16 )
10 9
11#define LASI_BASE_BAUD ( 7272727 / 16 )
12#define BASE_BAUD LASI_BASE_BAUD
13
14/*
15 * We don't use the ISA probing code, so these entries are just to reserve
16 * space. Some example (maximal) configurations:
17 * - 712 w/ additional Lasi & RJ16 ports: 4
18 * - J5k w/ PCI serial cards: 2 + 4 * card ~= 34
19 * A500 w/ PCI serial cards: 5 + 4 * card ~= 17
20 */
21
22#define SERIAL_PORT_DFNS 10#define SERIAL_PORT_DFNS
diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h
index a93960e232cf..f3d2090a18dc 100644
--- a/include/asm-parisc/spinlock.h
+++ b/include/asm-parisc/spinlock.h
@@ -56,50 +56,79 @@ static inline int __raw_spin_trylock(raw_spinlock_t *x)
56} 56}
57 57
58/* 58/*
59 * Read-write spinlocks, allowing multiple readers 59 * Read-write spinlocks, allowing multiple readers but only one writer.
60 * but only one writer. 60 * Linux rwlocks are unfair to writers; they can be starved for an indefinite
61 * time by readers. With care, they can also be taken in interrupt context.
62 *
63 * In the PA-RISC implementation, we have a spinlock and a counter.
64 * Readers use the lock to serialise their access to the counter (which
65 * records how many readers currently hold the lock).
66 * Writers hold the spinlock, preventing any readers or other writers from
67 * grabbing the rwlock.
61 */ 68 */
62 69
63#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 70/* Note that we have to ensure interrupts are disabled in case we're
64 71 * interrupted by some other code that wants to grab the same read lock */
65/* read_lock, read_unlock are pretty straightforward. Of course it somehow
66 * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */
67
68static __inline__ void __raw_read_lock(raw_rwlock_t *rw) 72static __inline__ void __raw_read_lock(raw_rwlock_t *rw)
69{ 73{
70 __raw_spin_lock(&rw->lock); 74 unsigned long flags;
71 75 local_irq_save(flags);
76 __raw_spin_lock_flags(&rw->lock, flags);
72 rw->counter++; 77 rw->counter++;
73
74 __raw_spin_unlock(&rw->lock); 78 __raw_spin_unlock(&rw->lock);
79 local_irq_restore(flags);
75} 80}
76 81
82/* Note that we have to ensure interrupts are disabled in case we're
83 * interrupted by some other code that wants to grab the same read lock */
77static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) 84static __inline__ void __raw_read_unlock(raw_rwlock_t *rw)
78{ 85{
79 __raw_spin_lock(&rw->lock); 86 unsigned long flags;
80 87 local_irq_save(flags);
88 __raw_spin_lock_flags(&rw->lock, flags);
81 rw->counter--; 89 rw->counter--;
82
83 __raw_spin_unlock(&rw->lock); 90 __raw_spin_unlock(&rw->lock);
91 local_irq_restore(flags);
84} 92}
85 93
86/* write_lock is less trivial. We optimistically grab the lock and check 94/* Note that we have to ensure interrupts are disabled in case we're
87 * if we surprised any readers. If so we release the lock and wait till 95 * interrupted by some other code that wants to grab the same read lock */
88 * they're all gone before trying again 96static __inline__ int __raw_read_trylock(raw_rwlock_t *rw)
89 * 97{
90 * Also note that we don't use the _irqsave / _irqrestore suffixes here. 98 unsigned long flags;
91 * If we're called with interrupts enabled and we've got readers (or other 99 retry:
92 * writers) in interrupt handlers someone fucked up and we'd dead-lock 100 local_irq_save(flags);
93 * sooner or later anyway. prumpf */ 101 if (__raw_spin_trylock(&rw->lock)) {
102 rw->counter++;
103 __raw_spin_unlock(&rw->lock);
104 local_irq_restore(flags);
105 return 1;
106 }
107
108 local_irq_restore(flags);
109 /* If write-locked, we fail to acquire the lock */
110 if (rw->counter < 0)
111 return 0;
112
113 /* Wait until we have a realistic chance at the lock */
114 while (__raw_spin_is_locked(&rw->lock) && rw->counter >= 0)
115 cpu_relax();
116
117 goto retry;
118}
94 119
95static __inline__ void __raw_write_lock(raw_rwlock_t *rw) 120/* Note that we have to ensure interrupts are disabled in case we're
121 * interrupted by some other code that wants to read_trylock() this lock */
122static __inline__ void __raw_write_lock(raw_rwlock_t *rw)
96{ 123{
124 unsigned long flags;
97retry: 125retry:
98 __raw_spin_lock(&rw->lock); 126 local_irq_save(flags);
127 __raw_spin_lock_flags(&rw->lock, flags);
99 128
100 if(rw->counter != 0) { 129 if (rw->counter != 0) {
101 /* this basically never happens */
102 __raw_spin_unlock(&rw->lock); 130 __raw_spin_unlock(&rw->lock);
131 local_irq_restore(flags);
103 132
104 while (rw->counter != 0) 133 while (rw->counter != 0)
105 cpu_relax(); 134 cpu_relax();
@@ -107,31 +136,37 @@ retry:
107 goto retry; 136 goto retry;
108 } 137 }
109 138
110 /* got it. now leave without unlocking */ 139 rw->counter = -1; /* mark as write-locked */
111 rw->counter = -1; /* remember we are locked */ 140 mb();
141 local_irq_restore(flags);
112} 142}
113 143
114/* write_unlock is absolutely trivial - we don't have to wait for anything */ 144static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
115
116static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
117{ 145{
118 rw->counter = 0; 146 rw->counter = 0;
119 __raw_spin_unlock(&rw->lock); 147 __raw_spin_unlock(&rw->lock);
120} 148}
121 149
122static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) 150/* Note that we have to ensure interrupts are disabled in case we're
151 * interrupted by some other code that wants to read_trylock() this lock */
152static __inline__ int __raw_write_trylock(raw_rwlock_t *rw)
123{ 153{
124 __raw_spin_lock(&rw->lock); 154 unsigned long flags;
125 if (rw->counter != 0) { 155 int result = 0;
126 /* this basically never happens */ 156
127 __raw_spin_unlock(&rw->lock); 157 local_irq_save(flags);
128 158 if (__raw_spin_trylock(&rw->lock)) {
129 return 0; 159 if (rw->counter == 0) {
160 rw->counter = -1;
161 result = 1;
162 } else {
163 /* Read-locked. Oh well. */
164 __raw_spin_unlock(&rw->lock);
165 }
130 } 166 }
167 local_irq_restore(flags);
131 168
132 /* got it. now leave without unlocking */ 169 return result;
133 rw->counter = -1; /* remember we are locked */
134 return 1;
135} 170}
136 171
137/* 172/*
@@ -152,4 +187,8 @@ static __inline__ int __raw_write_can_lock(raw_rwlock_t *rw)
152 return !rw->counter; 187 return !rw->counter;
153} 188}
154 189
190#define _raw_spin_relax(lock) cpu_relax()
191#define _raw_read_relax(lock) cpu_relax()
192#define _raw_write_relax(lock) cpu_relax()
193
155#endif /* __ASM_SPINLOCK_H */ 194#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
index 27bcfad1c3e3..53b0f5d290e4 100644
--- a/include/asm-parisc/unistd.h
+++ b/include/asm-parisc/unistd.h
@@ -952,92 +952,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
952#define __ARCH_WANT_SYS_SIGPROCMASK 952#define __ARCH_WANT_SYS_SIGPROCMASK
953#define __ARCH_WANT_SYS_RT_SIGACTION 953#define __ARCH_WANT_SYS_RT_SIGACTION
954 954
955/* mmap & mmap2 take 6 arguments */
956#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
957type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
958{ \
959 return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \
960}
961
962#ifdef __KERNEL_SYSCALLS__
963
964#include <asm/current.h>
965#include <linux/compiler.h>
966#include <linux/types.h>
967#include <linux/syscalls.h>
968
969static inline pid_t setsid(void)
970{
971 return sys_setsid();
972}
973
974static inline int write(int fd, const char *buf, off_t count)
975{
976 return sys_write(fd, buf, count);
977}
978
979static inline int read(int fd, char *buf, off_t count)
980{
981 return sys_read(fd, buf, count);
982}
983
984static inline off_t lseek(int fd, off_t offset, int count)
985{
986 return sys_lseek(fd, offset, count);
987}
988
989static inline int dup(int fd)
990{
991 return sys_dup(fd);
992}
993
994static inline int execve(char *filename, char * argv [],
995 char * envp[])
996{
997 extern int __execve(char *, char **, char **, struct task_struct *);
998 return __execve(filename, argv, envp, current);
999}
1000
1001static inline int open(const char *file, int flag, int mode)
1002{
1003 return sys_open(file, flag, mode);
1004}
1005
1006static inline int close(int fd)
1007{
1008 return sys_close(fd);
1009}
1010
1011static inline void _exit(int exitcode)
1012{
1013 sys_exit(exitcode);
1014}
1015
1016static inline pid_t waitpid(pid_t pid, int *wait_stat, int options)
1017{
1018 return sys_wait4(pid, wait_stat, options, NULL);
1019}
1020
1021asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
1022 unsigned long prot, unsigned long flags,
1023 unsigned long fd, unsigned long offset);
1024asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
1025 unsigned long prot, unsigned long flags,
1026 unsigned long fd, unsigned long pgoff);
1027struct pt_regs;
1028asmlinkage int sys_execve(struct pt_regs *regs);
1029int sys_clone(unsigned long clone_flags, unsigned long usp,
1030 struct pt_regs *regs);
1031int sys_vfork(struct pt_regs *regs);
1032int sys_pipe(int *fildes);
1033struct sigaction;
1034asmlinkage long sys_rt_sigaction(int sig,
1035 const struct sigaction __user *act,
1036 struct sigaction __user *oact,
1037 size_t sigsetsize);
1038
1039#endif /* __KERNEL_SYSCALLS__ */
1040
1041#endif /* __ASSEMBLY__ */ 955#endif /* __ASSEMBLY__ */
1042 956
1043#undef STR 957#undef STR
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index f44b529e3298..978b2c7e84ea 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -70,9 +70,10 @@ struct bug_entry *find_bug(unsigned long bugaddr);
70 "i" (__FILE__), "i" (__FUNCTION__)); \ 70 "i" (__FILE__), "i" (__FUNCTION__)); \
71} while (0) 71} while (0)
72 72
73#define WARN_ON(x) do { \ 73#define WARN_ON(x) ({ \
74 if (__builtin_constant_p(x)) { \ 74 typeof(x) __ret_warn_on = (x); \
75 if (x) \ 75 if (__builtin_constant_p(__ret_warn_on)) { \
76 if (__ret_warn_on) \
76 __WARN(); \ 77 __WARN(); \
77 } else { \ 78 } else { \
78 __asm__ __volatile__( \ 79 __asm__ __volatile__( \
@@ -80,11 +81,12 @@ struct bug_entry *find_bug(unsigned long bugaddr);
80 ".section __bug_table,\"a\"\n" \ 81 ".section __bug_table,\"a\"\n" \
81 "\t"PPC_LONG" 1b,%1,%2,%3\n" \ 82 "\t"PPC_LONG" 1b,%1,%2,%3\n" \
82 ".previous" \ 83 ".previous" \
83 : : "r" ((long)(x)), \ 84 : : "r" (__ret_warn_on), \
84 "i" (__LINE__ + BUG_WARNING_TRAP), \ 85 "i" (__LINE__ + BUG_WARNING_TRAP), \
85 "i" (__FILE__), "i" (__FUNCTION__)); \ 86 "i" (__FILE__), "i" (__FUNCTION__)); \
86 } \ 87 } \
87} while (0) 88 unlikely(__ret_warn_on); \
89})
88 90
89#define HAVE_ARCH_BUG 91#define HAVE_ARCH_BUG
90#define HAVE_ARCH_BUG_ON 92#define HAVE_ARCH_BUG_ON
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index 77069df92bf8..1022737f4f34 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -14,34 +14,36 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#ifndef __ASSEMBLY__ 17#include <asm/asm-compat.h>
18 18
19/* firmware feature bitmask values */ 19/* firmware feature bitmask values */
20#define FIRMWARE_MAX_FEATURES 63 20#define FIRMWARE_MAX_FEATURES 63
21 21
22#define FW_FEATURE_PFT (1UL<<0) 22#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001)
23#define FW_FEATURE_TCE (1UL<<1) 23#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002)
24#define FW_FEATURE_SPRG0 (1UL<<2) 24#define FW_FEATURE_SPRG0 ASM_CONST(0x0000000000000004)
25#define FW_FEATURE_DABR (1UL<<3) 25#define FW_FEATURE_DABR ASM_CONST(0x0000000000000008)
26#define FW_FEATURE_COPY (1UL<<4) 26#define FW_FEATURE_COPY ASM_CONST(0x0000000000000010)
27#define FW_FEATURE_ASR (1UL<<5) 27#define FW_FEATURE_ASR ASM_CONST(0x0000000000000020)
28#define FW_FEATURE_DEBUG (1UL<<6) 28#define FW_FEATURE_DEBUG ASM_CONST(0x0000000000000040)
29#define FW_FEATURE_TERM (1UL<<7) 29#define FW_FEATURE_TERM ASM_CONST(0x0000000000000080)
30#define FW_FEATURE_PERF (1UL<<8) 30#define FW_FEATURE_PERF ASM_CONST(0x0000000000000100)
31#define FW_FEATURE_DUMP (1UL<<9) 31#define FW_FEATURE_DUMP ASM_CONST(0x0000000000000200)
32#define FW_FEATURE_INTERRUPT (1UL<<10) 32#define FW_FEATURE_INTERRUPT ASM_CONST(0x0000000000000400)
33#define FW_FEATURE_MIGRATE (1UL<<11) 33#define FW_FEATURE_MIGRATE ASM_CONST(0x0000000000000800)
34#define FW_FEATURE_PERFMON (1UL<<12) 34#define FW_FEATURE_PERFMON ASM_CONST(0x0000000000001000)
35#define FW_FEATURE_CRQ (1UL<<13) 35#define FW_FEATURE_CRQ ASM_CONST(0x0000000000002000)
36#define FW_FEATURE_VIO (1UL<<14) 36#define FW_FEATURE_VIO ASM_CONST(0x0000000000004000)
37#define FW_FEATURE_RDMA (1UL<<15) 37#define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000)
38#define FW_FEATURE_LLAN (1UL<<16) 38#define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000)
39#define FW_FEATURE_BULK (1UL<<17) 39#define FW_FEATURE_BULK ASM_CONST(0x0000000000020000)
40#define FW_FEATURE_XDABR (1UL<<18) 40#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000)
41#define FW_FEATURE_MULTITCE (1UL<<19) 41#define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000)
42#define FW_FEATURE_SPLPAR (1UL<<20) 42#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000)
43#define FW_FEATURE_ISERIES (1UL<<21) 43#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000)
44#define FW_FEATURE_LPAR (1UL<<22) 44#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000)
45
46#ifndef __ASSEMBLY__
45 47
46enum { 48enum {
47#ifdef CONFIG_PPC64 49#ifdef CONFIG_PPC64
@@ -94,6 +96,23 @@ extern void machine_check_fwnmi(void);
94/* This is true if we are using the firmware NMI handler (typically LPAR) */ 96/* This is true if we are using the firmware NMI handler (typically LPAR) */
95extern int fwnmi_active; 97extern int fwnmi_active;
96 98
99#else /* __ASSEMBLY__ */
100
101#define BEGIN_FW_FTR_SECTION 96:
102
103#define END_FW_FTR_SECTION(msk, val) \
10497: \
105 .section __fw_ftr_fixup,"a"; \
106 .align 3; \
107 .llong msk; \
108 .llong val; \
109 .llong 96b; \
110 .llong 97b; \
111 .previous
112
113#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
114#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
115
97#endif /* __ASSEMBLY__ */ 116#endif /* __ASSEMBLY__ */
98#endif /* __KERNEL__ */ 117#endif /* __KERNEL__ */
99#endif /* __ASM_POWERPC_FIRMWARE_H */ 118#endif /* __ASM_POWERPC_FIRMWARE_H */
diff --git a/include/asm-powerpc/fs_pd.h b/include/asm-powerpc/fs_pd.h
new file mode 100644
index 000000000000..3d0e819d37f1
--- /dev/null
+++ b/include/asm-powerpc/fs_pd.h
@@ -0,0 +1,45 @@
1/*
2 * Platform information definitions.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_PD_H
13#define FS_PD_H
14#include <asm/cpm2.h>
15#include <sysdev/fsl_soc.h>
16#include <asm/time.h>
17
18static inline int uart_baudrate(void)
19{
20 return get_baudrate();
21}
22
23static inline int uart_clock(void)
24{
25 return ppc_proc_freq;
26}
27
28#define cpm2_map(member) \
29({ \
30 u32 offset = offsetof(cpm2_map_t, member); \
31 void *addr = ioremap (CPM_MAP_ADDR + offset, \
32 sizeof( ((cpm2_map_t*)0)->member)); \
33 addr; \
34})
35
36#define cpm2_map_size(member, size) \
37({ \
38 u32 offset = offsetof(cpm2_map_t, member); \
39 void *addr = ioremap (CPM_MAP_ADDR + offset, size); \
40 addr; \
41})
42
43#define cpm2_unmap(addr) iounmap(addr)
44
45#endif
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
new file mode 100644
index 000000000000..ce12f85fff9b
--- /dev/null
+++ b/include/asm-powerpc/immap_qe.h
@@ -0,0 +1,477 @@
1/*
2 * include/asm-powerpc/immap_qe.h
3 *
4 * QUICC Engine (QE) Internal Memory Map.
5 * The Internal Memory Map for devices with QE on them. This
6 * is the superset of all QE devices (8360, etc.).
7
8 * Copyright (C) 2006. Freescale Semicondutor, Inc. All rights reserved.
9 *
10 * Authors: Shlomi Gridish <gridish@freescale.com>
11 * Li Yang <leoli@freescale.com>
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18#ifndef _ASM_POWERPC_IMMAP_QE_H
19#define _ASM_POWERPC_IMMAP_QE_H
20#ifdef __KERNEL__
21
22#include <linux/kernel.h>
23
24#define QE_IMMAP_SIZE (1024 * 1024) /* 1MB from 1MB+IMMR */
25
26/* QE I-RAM */
27struct qe_iram {
28 __be32 iadd; /* I-RAM Address Register */
29 __be32 idata; /* I-RAM Data Register */
30 u8 res0[0x78];
31} __attribute__ ((packed));
32
33/* QE Interrupt Controller */
34struct qe_ic_regs {
35 __be32 qicr;
36 __be32 qivec;
37 __be32 qripnr;
38 __be32 qipnr;
39 __be32 qipxcc;
40 __be32 qipycc;
41 __be32 qipwcc;
42 __be32 qipzcc;
43 __be32 qimr;
44 __be32 qrimr;
45 __be32 qicnr;
46 u8 res0[0x4];
47 __be32 qiprta;
48 __be32 qiprtb;
49 u8 res1[0x4];
50 __be32 qricr;
51 u8 res2[0x20];
52 __be32 qhivec;
53 u8 res3[0x1C];
54} __attribute__ ((packed));
55
56/* Communications Processor */
57struct cp_qe {
58 __be32 cecr; /* QE command register */
59 __be32 ceccr; /* QE controller configuration register */
60 __be32 cecdr; /* QE command data register */
61 u8 res0[0xA];
62 __be16 ceter; /* QE timer event register */
63 u8 res1[0x2];
64 __be16 cetmr; /* QE timers mask register */
65 __be32 cetscr; /* QE time-stamp timer control register */
66 __be32 cetsr1; /* QE time-stamp register 1 */
67 __be32 cetsr2; /* QE time-stamp register 2 */
68 u8 res2[0x8];
69 __be32 cevter; /* QE virtual tasks event register */
70 __be32 cevtmr; /* QE virtual tasks mask register */
71 __be16 cercr; /* QE RAM control register */
72 u8 res3[0x2];
73 u8 res4[0x24];
74 __be16 ceexe1; /* QE external request 1 event register */
75 u8 res5[0x2];
76 __be16 ceexm1; /* QE external request 1 mask register */
77 u8 res6[0x2];
78 __be16 ceexe2; /* QE external request 2 event register */
79 u8 res7[0x2];
80 __be16 ceexm2; /* QE external request 2 mask register */
81 u8 res8[0x2];
82 __be16 ceexe3; /* QE external request 3 event register */
83 u8 res9[0x2];
84 __be16 ceexm3; /* QE external request 3 mask register */
85 u8 res10[0x2];
86 __be16 ceexe4; /* QE external request 4 event register */
87 u8 res11[0x2];
88 __be16 ceexm4; /* QE external request 4 mask register */
89 u8 res12[0x2];
90 u8 res13[0x280];
91} __attribute__ ((packed));
92
93/* QE Multiplexer */
94struct qe_mux {
95 __be32 cmxgcr; /* CMX general clock route register */
96 __be32 cmxsi1cr_l; /* CMX SI1 clock route low register */
97 __be32 cmxsi1cr_h; /* CMX SI1 clock route high register */
98 __be32 cmxsi1syr; /* CMX SI1 SYNC route register */
99 __be32 cmxucr1; /* CMX UCC1, UCC3 clock route register */
100 __be32 cmxucr2; /* CMX UCC5, UCC7 clock route register */
101 __be32 cmxucr3; /* CMX UCC2, UCC4 clock route register */
102 __be32 cmxucr4; /* CMX UCC6, UCC8 clock route register */
103 __be32 cmxupcr; /* CMX UPC clock route register */
104 u8 res0[0x1C];
105} __attribute__ ((packed));
106
107/* QE Timers */
108struct qe_timers {
109 u8 gtcfr1; /* Timer 1 and Timer 2 global config register*/
110 u8 res0[0x3];
111 u8 gtcfr2; /* Timer 3 and timer 4 global config register*/
112 u8 res1[0xB];
113 __be16 gtmdr1; /* Timer 1 mode register */
114 __be16 gtmdr2; /* Timer 2 mode register */
115 __be16 gtrfr1; /* Timer 1 reference register */
116 __be16 gtrfr2; /* Timer 2 reference register */
117 __be16 gtcpr1; /* Timer 1 capture register */
118 __be16 gtcpr2; /* Timer 2 capture register */
119 __be16 gtcnr1; /* Timer 1 counter */
120 __be16 gtcnr2; /* Timer 2 counter */
121 __be16 gtmdr3; /* Timer 3 mode register */
122 __be16 gtmdr4; /* Timer 4 mode register */
123 __be16 gtrfr3; /* Timer 3 reference register */
124 __be16 gtrfr4; /* Timer 4 reference register */
125 __be16 gtcpr3; /* Timer 3 capture register */
126 __be16 gtcpr4; /* Timer 4 capture register */
127 __be16 gtcnr3; /* Timer 3 counter */
128 __be16 gtcnr4; /* Timer 4 counter */
129 __be16 gtevr1; /* Timer 1 event register */
130 __be16 gtevr2; /* Timer 2 event register */
131 __be16 gtevr3; /* Timer 3 event register */
132 __be16 gtevr4; /* Timer 4 event register */
133 __be16 gtps; /* Timer 1 prescale register */
134 u8 res2[0x46];
135} __attribute__ ((packed));
136
137/* BRG */
138struct qe_brg {
139 __be32 brgc1; /* BRG1 configuration register */
140 __be32 brgc2; /* BRG2 configuration register */
141 __be32 brgc3; /* BRG3 configuration register */
142 __be32 brgc4; /* BRG4 configuration register */
143 __be32 brgc5; /* BRG5 configuration register */
144 __be32 brgc6; /* BRG6 configuration register */
145 __be32 brgc7; /* BRG7 configuration register */
146 __be32 brgc8; /* BRG8 configuration register */
147 __be32 brgc9; /* BRG9 configuration register */
148 __be32 brgc10; /* BRG10 configuration register */
149 __be32 brgc11; /* BRG11 configuration register */
150 __be32 brgc12; /* BRG12 configuration register */
151 __be32 brgc13; /* BRG13 configuration register */
152 __be32 brgc14; /* BRG14 configuration register */
153 __be32 brgc15; /* BRG15 configuration register */
154 __be32 brgc16; /* BRG16 configuration register */
155 u8 res0[0x40];
156} __attribute__ ((packed));
157
158/* SPI */
159struct spi {
160 u8 res0[0x20];
161 __be32 spmode; /* SPI mode register */
162 u8 res1[0x2];
163 u8 spie; /* SPI event register */
164 u8 res2[0x1];
165 u8 res3[0x2];
166 u8 spim; /* SPI mask register */
167 u8 res4[0x1];
168 u8 res5[0x1];
169 u8 spcom; /* SPI command register */
170 u8 res6[0x2];
171 __be32 spitd; /* SPI transmit data register (cpu mode) */
172 __be32 spird; /* SPI receive data register (cpu mode) */
173 u8 res7[0x8];
174} __attribute__ ((packed));
175
176/* SI */
177struct si1 {
178 __be16 siamr1; /* SI1 TDMA mode register */
179 __be16 sibmr1; /* SI1 TDMB mode register */
180 __be16 sicmr1; /* SI1 TDMC mode register */
181 __be16 sidmr1; /* SI1 TDMD mode register */
182 u8 siglmr1_h; /* SI1 global mode register high */
183 u8 res0[0x1];
184 u8 sicmdr1_h; /* SI1 command register high */
185 u8 res2[0x1];
186 u8 sistr1_h; /* SI1 status register high */
187 u8 res3[0x1];
188 __be16 sirsr1_h; /* SI1 RAM shadow address register high */
189 u8 sitarc1; /* SI1 RAM counter Tx TDMA */
190 u8 sitbrc1; /* SI1 RAM counter Tx TDMB */
191 u8 sitcrc1; /* SI1 RAM counter Tx TDMC */
192 u8 sitdrc1; /* SI1 RAM counter Tx TDMD */
193 u8 sirarc1; /* SI1 RAM counter Rx TDMA */
194 u8 sirbrc1; /* SI1 RAM counter Rx TDMB */
195 u8 sircrc1; /* SI1 RAM counter Rx TDMC */
196 u8 sirdrc1; /* SI1 RAM counter Rx TDMD */
197 u8 res4[0x8];
198 __be16 siemr1; /* SI1 TDME mode register 16 bits */
199 __be16 sifmr1; /* SI1 TDMF mode register 16 bits */
200 __be16 sigmr1; /* SI1 TDMG mode register 16 bits */
201 __be16 sihmr1; /* SI1 TDMH mode register 16 bits */
202 u8 siglmg1_l; /* SI1 global mode register low 8 bits */
203 u8 res5[0x1];
204 u8 sicmdr1_l; /* SI1 command register low 8 bits */
205 u8 res6[0x1];
206 u8 sistr1_l; /* SI1 status register low 8 bits */
207 u8 res7[0x1];
208 __be16 sirsr1_l; /* SI1 RAM shadow address register low 16 bits*/
209 u8 siterc1; /* SI1 RAM counter Tx TDME 8 bits */
210 u8 sitfrc1; /* SI1 RAM counter Tx TDMF 8 bits */
211 u8 sitgrc1; /* SI1 RAM counter Tx TDMG 8 bits */
212 u8 sithrc1; /* SI1 RAM counter Tx TDMH 8 bits */
213 u8 sirerc1; /* SI1 RAM counter Rx TDME 8 bits */
214 u8 sirfrc1; /* SI1 RAM counter Rx TDMF 8 bits */
215 u8 sirgrc1; /* SI1 RAM counter Rx TDMG 8 bits */
216 u8 sirhrc1; /* SI1 RAM counter Rx TDMH 8 bits */
217 u8 res8[0x8];
218 __be32 siml1; /* SI1 multiframe limit register */
219 u8 siedm1; /* SI1 extended diagnostic mode register */
220 u8 res9[0xBB];
221} __attribute__ ((packed));
222
223/* SI Routing Tables */
224struct sir {
225 u8 tx[0x400];
226 u8 rx[0x400];
227 u8 res0[0x800];
228} __attribute__ ((packed));
229
230/* USB Controller */
231struct usb_ctlr {
232 u8 usb_usmod;
233 u8 usb_usadr;
234 u8 usb_uscom;
235 u8 res1[1];
236 __be16 usb_usep1;
237 __be16 usb_usep2;
238 __be16 usb_usep3;
239 __be16 usb_usep4;
240 u8 res2[4];
241 __be16 usb_usber;
242 u8 res3[2];
243 __be16 usb_usbmr;
244 u8 res4[1];
245 u8 usb_usbs;
246 __be16 usb_ussft;
247 u8 res5[2];
248 __be16 usb_usfrn;
249 u8 res6[0x22];
250} __attribute__ ((packed));
251
252/* MCC */
253struct mcc {
254 __be32 mcce; /* MCC event register */
255 __be32 mccm; /* MCC mask register */
256 __be32 mccf; /* MCC configuration register */
257 __be32 merl; /* MCC emergency request level register */
258 u8 res0[0xF0];
259} __attribute__ ((packed));
260
261/* QE UCC Slow */
262struct ucc_slow {
263 __be32 gumr_l; /* UCCx general mode register (low) */
264 __be32 gumr_h; /* UCCx general mode register (high) */
265 __be16 upsmr; /* UCCx protocol-specific mode register */
266 u8 res0[0x2];
267 __be16 utodr; /* UCCx transmit on demand register */
268 __be16 udsr; /* UCCx data synchronization register */
269 __be16 ucce; /* UCCx event register */
270 u8 res1[0x2];
271 __be16 uccm; /* UCCx mask register */
272 u8 res2[0x1];
273 u8 uccs; /* UCCx status register */
274 u8 res3[0x24];
275 __be16 utpt;
276 u8 guemr; /* UCC general extended mode register */
277 u8 res4[0x200 - 0x091];
278} __attribute__ ((packed));
279
280/* QE UCC Fast */
281struct ucc_fast {
282 __be32 gumr; /* UCCx general mode register */
283 __be32 upsmr; /* UCCx protocol-specific mode register */
284 __be16 utodr; /* UCCx transmit on demand register */
285 u8 res0[0x2];
286 __be16 udsr; /* UCCx data synchronization register */
287 u8 res1[0x2];
288 __be32 ucce; /* UCCx event register */
289 __be32 uccm; /* UCCx mask register */
290 u8 uccs; /* UCCx status register */
291 u8 res2[0x7];
292 __be32 urfb; /* UCC receive FIFO base */
293 __be16 urfs; /* UCC receive FIFO size */
294 u8 res3[0x2];
295 __be16 urfet; /* UCC receive FIFO emergency threshold */
296 __be16 urfset; /* UCC receive FIFO special emergency
297 threshold */
298 __be32 utfb; /* UCC transmit FIFO base */
299 __be16 utfs; /* UCC transmit FIFO size */
300 u8 res4[0x2];
301 __be16 utfet; /* UCC transmit FIFO emergency threshold */
302 u8 res5[0x2];
303 __be16 utftt; /* UCC transmit FIFO transmit threshold */
304 u8 res6[0x2];
305 __be16 utpt; /* UCC transmit polling timer */
306 u8 res7[0x2];
307 __be32 urtry; /* UCC retry counter register */
308 u8 res8[0x4C];
309 u8 guemr; /* UCC general extended mode register */
310 u8 res9[0x100 - 0x091];
311} __attribute__ ((packed));
312
313/* QE UCC */
314struct ucc_common {
315 u8 res1[0x90];
316 u8 guemr;
317 u8 res2[0x200 - 0x091];
318} __attribute__ ((packed));
319
320struct ucc {
321 union {
322 struct ucc_slow slow;
323 struct ucc_fast fast;
324 struct ucc_common common;
325 };
326} __attribute__ ((packed));
327
328/* MultiPHY UTOPIA POS Controllers (UPC) */
329struct upc {
330 __be32 upgcr; /* UTOPIA/POS general configuration register */
331 __be32 uplpa; /* UTOPIA/POS last PHY address */
332 __be32 uphec; /* ATM HEC register */
333 __be32 upuc; /* UTOPIA/POS UCC configuration */
334 __be32 updc1; /* UTOPIA/POS device 1 configuration */
335 __be32 updc2; /* UTOPIA/POS device 2 configuration */
336 __be32 updc3; /* UTOPIA/POS device 3 configuration */
337 __be32 updc4; /* UTOPIA/POS device 4 configuration */
338 __be32 upstpa; /* UTOPIA/POS STPA threshold */
339 u8 res0[0xC];
340 __be32 updrs1_h; /* UTOPIA/POS device 1 rate select */
341 __be32 updrs1_l; /* UTOPIA/POS device 1 rate select */
342 __be32 updrs2_h; /* UTOPIA/POS device 2 rate select */
343 __be32 updrs2_l; /* UTOPIA/POS device 2 rate select */
344 __be32 updrs3_h; /* UTOPIA/POS device 3 rate select */
345 __be32 updrs3_l; /* UTOPIA/POS device 3 rate select */
346 __be32 updrs4_h; /* UTOPIA/POS device 4 rate select */
347 __be32 updrs4_l; /* UTOPIA/POS device 4 rate select */
348 __be32 updrp1; /* UTOPIA/POS device 1 receive priority low */
349 __be32 updrp2; /* UTOPIA/POS device 2 receive priority low */
350 __be32 updrp3; /* UTOPIA/POS device 3 receive priority low */
351 __be32 updrp4; /* UTOPIA/POS device 4 receive priority low */
352 __be32 upde1; /* UTOPIA/POS device 1 event */
353 __be32 upde2; /* UTOPIA/POS device 2 event */
354 __be32 upde3; /* UTOPIA/POS device 3 event */
355 __be32 upde4; /* UTOPIA/POS device 4 event */
356 __be16 uprp1;
357 __be16 uprp2;
358 __be16 uprp3;
359 __be16 uprp4;
360 u8 res1[0x8];
361 __be16 uptirr1_0; /* Device 1 transmit internal rate 0 */
362 __be16 uptirr1_1; /* Device 1 transmit internal rate 1 */
363 __be16 uptirr1_2; /* Device 1 transmit internal rate 2 */
364 __be16 uptirr1_3; /* Device 1 transmit internal rate 3 */
365 __be16 uptirr2_0; /* Device 2 transmit internal rate 0 */
366 __be16 uptirr2_1; /* Device 2 transmit internal rate 1 */
367 __be16 uptirr2_2; /* Device 2 transmit internal rate 2 */
368 __be16 uptirr2_3; /* Device 2 transmit internal rate 3 */
369 __be16 uptirr3_0; /* Device 3 transmit internal rate 0 */
370 __be16 uptirr3_1; /* Device 3 transmit internal rate 1 */
371 __be16 uptirr3_2; /* Device 3 transmit internal rate 2 */
372 __be16 uptirr3_3; /* Device 3 transmit internal rate 3 */
373 __be16 uptirr4_0; /* Device 4 transmit internal rate 0 */
374 __be16 uptirr4_1; /* Device 4 transmit internal rate 1 */
375 __be16 uptirr4_2; /* Device 4 transmit internal rate 2 */
376 __be16 uptirr4_3; /* Device 4 transmit internal rate 3 */
377 __be32 uper1; /* Device 1 port enable register */
378 __be32 uper2; /* Device 2 port enable register */
379 __be32 uper3; /* Device 3 port enable register */
380 __be32 uper4; /* Device 4 port enable register */
381 u8 res2[0x150];
382} __attribute__ ((packed));
383
384/* SDMA */
385struct sdma {
386 __be32 sdsr; /* Serial DMA status register */
387 __be32 sdmr; /* Serial DMA mode register */
388 __be32 sdtr1; /* SDMA system bus threshold register */
389 __be32 sdtr2; /* SDMA secondary bus threshold register */
390 __be32 sdhy1; /* SDMA system bus hysteresis register */
391 __be32 sdhy2; /* SDMA secondary bus hysteresis register */
392 __be32 sdta1; /* SDMA system bus address register */
393 __be32 sdta2; /* SDMA secondary bus address register */
394 __be32 sdtm1; /* SDMA system bus MSNUM register */
395 __be32 sdtm2; /* SDMA secondary bus MSNUM register */
396 u8 res0[0x10];
397 __be32 sdaqr; /* SDMA address bus qualify register */
398 __be32 sdaqmr; /* SDMA address bus qualify mask register */
399 u8 res1[0x4];
400 __be32 sdebcr; /* SDMA CAM entries base register */
401 u8 res2[0x38];
402} __attribute__ ((packed));
403
404/* Debug Space */
405struct dbg {
406 __be32 bpdcr; /* Breakpoint debug command register */
407 __be32 bpdsr; /* Breakpoint debug status register */
408 __be32 bpdmr; /* Breakpoint debug mask register */
409 __be32 bprmrr0; /* Breakpoint request mode risc register 0 */
410 __be32 bprmrr1; /* Breakpoint request mode risc register 1 */
411 u8 res0[0x8];
412 __be32 bprmtr0; /* Breakpoint request mode trb register 0 */
413 __be32 bprmtr1; /* Breakpoint request mode trb register 1 */
414 u8 res1[0x8];
415 __be32 bprmir; /* Breakpoint request mode immediate register */
416 __be32 bprmsr; /* Breakpoint request mode serial register */
417 __be32 bpemr; /* Breakpoint exit mode register */
418 u8 res2[0x48];
419} __attribute__ ((packed));
420
421/* RISC Special Registers (Trap and Breakpoint) */
422struct rsp {
423 u8 fixme[0x100];
424} __attribute__ ((packed));
425
426struct qe_immap {
427 struct qe_iram iram; /* I-RAM */
428 struct qe_ic_regs ic; /* Interrupt Controller */
429 struct cp_qe cp; /* Communications Processor */
430 struct qe_mux qmx; /* QE Multiplexer */
431 struct qe_timers qet; /* QE Timers */
432 struct spi spi[0x2]; /* spi */
433 struct mcc mcc; /* mcc */
434 struct qe_brg brg; /* brg */
435 struct usb_ctlr usb; /* USB */
436 struct si1 si1; /* SI */
437 u8 res11[0x800];
438 struct sir sir; /* SI Routing Tables */
439 struct ucc ucc1; /* ucc1 */
440 struct ucc ucc3; /* ucc3 */
441 struct ucc ucc5; /* ucc5 */
442 struct ucc ucc7; /* ucc7 */
443 u8 res12[0x600];
444 struct upc upc1; /* MultiPHY UTOPIA POS Ctrlr 1*/
445 struct ucc ucc2; /* ucc2 */
446 struct ucc ucc4; /* ucc4 */
447 struct ucc ucc6; /* ucc6 */
448 struct ucc ucc8; /* ucc8 */
449 u8 res13[0x600];
450 struct upc upc2; /* MultiPHY UTOPIA POS Ctrlr 2*/
451 struct sdma sdma; /* SDMA */
452 struct dbg dbg; /* Debug Space */
453 struct rsp rsp[0x2]; /* RISC Special Registers
454 (Trap and Breakpoint) */
455 u8 res14[0x300];
456 u8 res15[0x3A00];
457 u8 res16[0x8000]; /* 0x108000 - 0x110000 */
458 u8 muram[0xC000]; /* 0x110000 - 0x11C000
459 Multi-user RAM */
460 u8 res17[0x24000]; /* 0x11C000 - 0x140000 */
461 u8 res18[0xC0000]; /* 0x140000 - 0x200000 */
462} __attribute__ ((packed));
463
464extern struct qe_immap *qe_immr;
465extern phys_addr_t get_qe_base(void);
466
467static inline unsigned long immrbar_virt_to_phys(volatile void * address)
468{
469 if ( ((u32)address >= (u32)qe_immr) &&
470 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) )
471 return (unsigned long)(address - (u32)qe_immr +
472 (u32)get_qe_base());
473 return (unsigned long)virt_to_phys(address);
474}
475
476#endif /* __KERNEL__ */
477#endif /* _ASM_POWERPC_IMMAP_QE_H */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 46bae1cf385b..cbbd8c648df1 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -11,6 +11,7 @@
11 11
12/* Check of existence of legacy devices */ 12/* Check of existence of legacy devices */
13extern int check_legacy_ioport(unsigned long base_port); 13extern int check_legacy_ioport(unsigned long base_port);
14#define PNPBIOS_BASE 0xf000 /* only relevant for PReP */
14 15
15#ifndef CONFIG_PPC64 16#ifndef CONFIG_PPC64
16#include <asm-ppc/io.h> 17#include <asm-ppc/io.h>
diff --git a/include/asm-powerpc/ipic.h b/include/asm-powerpc/ipic.h
index 53079ec3a515..1ce09a35906e 100644
--- a/include/asm-powerpc/ipic.h
+++ b/include/asm-powerpc/ipic.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-ppc/ipic.h 2 * include/asm-powerpc/ipic.h
3 * 3 *
4 * IPIC external definitions and structure. 4 * IPIC external definitions and structure.
5 * 5 *
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 4da41efb1319..89ed545b446b 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <linux/threads.h> 12#include <linux/threads.h>
14#include <linux/list.h> 13#include <linux/list.h>
15#include <linux/radix-tree.h> 14#include <linux/radix-tree.h>
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 34e1f89a5fa0..2dafa376a63f 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -44,6 +44,28 @@ typedef unsigned int kprobe_opcode_t;
44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) 44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) 45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
46 46
47/*
48 * 64bit powerpc uses function descriptors.
49 * Handle cases where:
50 * - User passes a <.symbol> or <module:.symbol>
51 * - User passes a <symbol> or <module:symbol>
52 * - User passes a non-existant symbol, kallsyms_lookup_name
53 * returns 0. Don't deref the NULL pointer in that case
54 */
55#define kprobe_lookup_name(name, addr) \
56{ \
57 addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); \
58 if (addr) { \
59 char *colon; \
60 if ((colon = strchr(name, ':')) != NULL) { \
61 colon++; \
62 if (*colon != '\0' && *colon != '.') \
63 addr = *(kprobe_opcode_t **)addr; \
64 } else if (name[0] != '.') \
65 addr = *(kprobe_opcode_t **)addr; \
66 } \
67}
68
47#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry) 69#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry)
48 70
49#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ 71#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
diff --git a/include/asm-powerpc/mpc85xx.h b/include/asm-powerpc/mpc85xx.h
new file mode 100644
index 000000000000..ccdb8a21138f
--- /dev/null
+++ b/include/asm-powerpc/mpc85xx.h
@@ -0,0 +1,53 @@
1/*
2 * include/asm-powerpc/mpc85xx.h
3 *
4 * MPC85xx definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * Copyright 2004 Freescale Semiconductor, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifdef __KERNEL__
17#ifndef __ASM_MPC85xx_H__
18#define __ASM_MPC85xx_H__
19
20#include <asm/mmu.h>
21
22#ifdef CONFIG_85xx
23
24#if defined(CONFIG_MPC8540_ADS) || defined(CONFIG_MPC8560_ADS)
25#include <platforms/85xx/mpc85xx_ads.h>
26#endif
27#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
28#include <platforms/85xx/mpc8555_cds.h>
29#endif
30#ifdef CONFIG_MPC85xx_CDS
31#include <platforms/85xx/mpc85xx_cds.h>
32#endif
33
34#define _IO_BASE isa_io_base
35#define _ISA_MEM_BASE isa_mem_base
36#ifdef CONFIG_PCI
37#define PCI_DRAM_OFFSET pci_dram_offset
38#else
39#define PCI_DRAM_OFFSET 0
40#endif
41
42/* Let modules/drivers get at CCSRBAR */
43extern phys_addr_t get_ccsrbar(void);
44
45#ifdef MODULE
46#define CCSRBAR get_ccsrbar()
47#else
48#define CCSRBAR BOARD_CCSRBAR
49#endif
50
51#endif /* CONFIG_85xx */
52#endif /* __ASM_MPC85xx_H__ */
53#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 4f55573762bb..86ee46b09b8a 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -6,7 +6,6 @@
6#include <asm-ppc/pci-bridge.h> 6#include <asm-ppc/pci-bridge.h>
7#else 7#else
8 8
9#include <linux/config.h>
10#include <linux/pci.h> 9#include <linux/pci.h>
11#include <linux/list.h> 10#include <linux/list.h>
12 11
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 4435efe85d0e..4ad77a13f865 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -73,6 +73,8 @@ struct pt_regs {
73#ifndef __ASSEMBLY__ 73#ifndef __ASSEMBLY__
74 74
75#define instruction_pointer(regs) ((regs)->nip) 75#define instruction_pointer(regs) ((regs)->nip)
76#define regs_return_value(regs) ((regs)->gpr[3])
77
76#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
77extern unsigned long profile_pc(struct pt_regs *regs); 79extern unsigned long profile_pc(struct pt_regs *regs);
78#else 80#else
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
new file mode 100644
index 000000000000..a62168ec535f
--- /dev/null
+++ b/include/asm-powerpc/qe.h
@@ -0,0 +1,457 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * QUICC Engine (QE) external definitions and structure.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15#ifndef _ASM_POWERPC_QE_H
16#define _ASM_POWERPC_QE_H
17#ifdef __KERNEL__
18
19#include <asm/immap_qe.h>
20
21#define QE_NUM_OF_SNUM 28
22#define QE_NUM_OF_BRGS 16
23#define QE_NUM_OF_PORTS 1024
24
25/* Memory partitions
26*/
27#define MEM_PART_SYSTEM 0
28#define MEM_PART_SECONDARY 1
29#define MEM_PART_MURAM 2
30
31/* Export QE common operations */
32extern void qe_reset(void);
33extern int par_io_init(struct device_node *np);
34extern int par_io_of_config(struct device_node *np);
35
36/* QE internal API */
37int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
38void qe_setbrg(u32 brg, u32 rate);
39int qe_get_snum(void);
40void qe_put_snum(u8 snum);
41u32 qe_muram_alloc(u32 size, u32 align);
42int qe_muram_free(u32 offset);
43u32 qe_muram_alloc_fixed(u32 offset, u32 size);
44void qe_muram_dump(void);
45void *qe_muram_addr(u32 offset);
46
47/* Buffer descriptors */
48struct qe_bd {
49 u16 status;
50 u16 length;
51 u32 buf;
52} __attribute__ ((packed));
53
54#define BD_STATUS_MASK 0xffff0000
55#define BD_LENGTH_MASK 0x0000ffff
56
57/* Alignment */
58#define QE_INTR_TABLE_ALIGN 16 /* ??? */
59#define QE_ALIGNMENT_OF_BD 8
60#define QE_ALIGNMENT_OF_PRAM 64
61
62/* RISC allocation */
63enum qe_risc_allocation {
64 QE_RISC_ALLOCATION_RISC1 = 1, /* RISC 1 */
65 QE_RISC_ALLOCATION_RISC2 = 2, /* RISC 2 */
66 QE_RISC_ALLOCATION_RISC1_AND_RISC2 = 3 /* Dynamically choose
67 RISC 1 or RISC 2 */
68};
69
70/* QE extended filtering Table Lookup Key Size */
71enum qe_fltr_tbl_lookup_key_size {
72 QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES
73 = 0x3f, /* LookupKey parsed by the Generate LookupKey
74 CMD is truncated to 8 bytes */
75 QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES
76 = 0x5f, /* LookupKey parsed by the Generate LookupKey
77 CMD is truncated to 16 bytes */
78};
79
80/* QE FLTR extended filtering Largest External Table Lookup Key Size */
81enum qe_fltr_largest_external_tbl_lookup_key_size {
82 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE
83 = 0x0,/* not used */
84 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES
85 = QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES, /* 8 bytes */
86 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES
87 = QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES, /* 16 bytes */
88};
89
90/* structure representing QE parameter RAM */
91struct qe_timer_tables {
92 u16 tm_base; /* QE timer table base adr */
93 u16 tm_ptr; /* QE timer table pointer */
94 u16 r_tmr; /* QE timer mode register */
95 u16 r_tmv; /* QE timer valid register */
96 u32 tm_cmd; /* QE timer cmd register */
97 u32 tm_cnt; /* QE timer internal cnt */
98} __attribute__ ((packed));
99
100#define QE_FLTR_TAD_SIZE 8
101
102/* QE extended filtering Termination Action Descriptor (TAD) */
103struct qe_fltr_tad {
104 u8 serialized[QE_FLTR_TAD_SIZE];
105} __attribute__ ((packed));
106
107/* Communication Direction */
108enum comm_dir {
109 COMM_DIR_NONE = 0,
110 COMM_DIR_RX = 1,
111 COMM_DIR_TX = 2,
112 COMM_DIR_RX_AND_TX = 3
113};
114
115/* Clocks and BRGs */
116enum qe_clock {
117 QE_CLK_NONE = 0,
118 QE_BRG1, /* Baud Rate Generator 1 */
119 QE_BRG2, /* Baud Rate Generator 2 */
120 QE_BRG3, /* Baud Rate Generator 3 */
121 QE_BRG4, /* Baud Rate Generator 4 */
122 QE_BRG5, /* Baud Rate Generator 5 */
123 QE_BRG6, /* Baud Rate Generator 6 */
124 QE_BRG7, /* Baud Rate Generator 7 */
125 QE_BRG8, /* Baud Rate Generator 8 */
126 QE_BRG9, /* Baud Rate Generator 9 */
127 QE_BRG10, /* Baud Rate Generator 10 */
128 QE_BRG11, /* Baud Rate Generator 11 */
129 QE_BRG12, /* Baud Rate Generator 12 */
130 QE_BRG13, /* Baud Rate Generator 13 */
131 QE_BRG14, /* Baud Rate Generator 14 */
132 QE_BRG15, /* Baud Rate Generator 15 */
133 QE_BRG16, /* Baud Rate Generator 16 */
134 QE_CLK1, /* Clock 1 */
135 QE_CLK2, /* Clock 2 */
136 QE_CLK3, /* Clock 3 */
137 QE_CLK4, /* Clock 4 */
138 QE_CLK5, /* Clock 5 */
139 QE_CLK6, /* Clock 6 */
140 QE_CLK7, /* Clock 7 */
141 QE_CLK8, /* Clock 8 */
142 QE_CLK9, /* Clock 9 */
143 QE_CLK10, /* Clock 10 */
144 QE_CLK11, /* Clock 11 */
145 QE_CLK12, /* Clock 12 */
146 QE_CLK13, /* Clock 13 */
147 QE_CLK14, /* Clock 14 */
148 QE_CLK15, /* Clock 15 */
149 QE_CLK16, /* Clock 16 */
150 QE_CLK17, /* Clock 17 */
151 QE_CLK18, /* Clock 18 */
152 QE_CLK19, /* Clock 19 */
153 QE_CLK20, /* Clock 20 */
154 QE_CLK21, /* Clock 21 */
155 QE_CLK22, /* Clock 22 */
156 QE_CLK23, /* Clock 23 */
157 QE_CLK24, /* Clock 24 */
158 QE_CLK_DUMMY,
159};
160
161/* QE CMXUCR Registers.
162 * There are two UCCs represented in each of the four CMXUCR registers.
163 * These values are for the UCC in the LSBs
164 */
165#define QE_CMXUCR_MII_ENET_MNG 0x00007000
166#define QE_CMXUCR_MII_ENET_MNG_SHIFT 12
167#define QE_CMXUCR_GRANT 0x00008000
168#define QE_CMXUCR_TSA 0x00004000
169#define QE_CMXUCR_BKPT 0x00000100
170#define QE_CMXUCR_TX_CLK_SRC_MASK 0x0000000F
171
172/* QE CMXGCR Registers.
173*/
174#define QE_CMXGCR_MII_ENET_MNG 0x00007000
175#define QE_CMXGCR_MII_ENET_MNG_SHIFT 12
176#define QE_CMXGCR_USBCS 0x0000000f
177
178/* QE CECR Commands.
179*/
180#define QE_CR_FLG 0x00010000
181#define QE_RESET 0x80000000
182#define QE_INIT_TX_RX 0x00000000
183#define QE_INIT_RX 0x00000001
184#define QE_INIT_TX 0x00000002
185#define QE_ENTER_HUNT_MODE 0x00000003
186#define QE_STOP_TX 0x00000004
187#define QE_GRACEFUL_STOP_TX 0x00000005
188#define QE_RESTART_TX 0x00000006
189#define QE_CLOSE_RX_BD 0x00000007
190#define QE_SWITCH_COMMAND 0x00000007
191#define QE_SET_GROUP_ADDRESS 0x00000008
192#define QE_START_IDMA 0x00000009
193#define QE_MCC_STOP_RX 0x00000009
194#define QE_ATM_TRANSMIT 0x0000000a
195#define QE_HPAC_CLEAR_ALL 0x0000000b
196#define QE_GRACEFUL_STOP_RX 0x0000001a
197#define QE_RESTART_RX 0x0000001b
198#define QE_HPAC_SET_PRIORITY 0x0000010b
199#define QE_HPAC_STOP_TX 0x0000020b
200#define QE_HPAC_STOP_RX 0x0000030b
201#define QE_HPAC_GRACEFUL_STOP_TX 0x0000040b
202#define QE_HPAC_GRACEFUL_STOP_RX 0x0000050b
203#define QE_HPAC_START_TX 0x0000060b
204#define QE_HPAC_START_RX 0x0000070b
205#define QE_USB_STOP_TX 0x0000000a
206#define QE_USB_RESTART_TX 0x0000000b
207#define QE_QMC_STOP_TX 0x0000000c
208#define QE_QMC_STOP_RX 0x0000000d
209#define QE_SS7_SU_FIL_RESET 0x0000000e
210/* jonathbr added from here down for 83xx */
211#define QE_RESET_BCS 0x0000000a
212#define QE_MCC_INIT_TX_RX_16 0x00000003
213#define QE_MCC_STOP_TX 0x00000004
214#define QE_MCC_INIT_TX_1 0x00000005
215#define QE_MCC_INIT_RX_1 0x00000006
216#define QE_MCC_RESET 0x00000007
217#define QE_SET_TIMER 0x00000008
218#define QE_RANDOM_NUMBER 0x0000000c
219#define QE_ATM_MULTI_THREAD_INIT 0x00000011
220#define QE_ASSIGN_PAGE 0x00000012
221#define QE_ADD_REMOVE_HASH_ENTRY 0x00000013
222#define QE_START_FLOW_CONTROL 0x00000014
223#define QE_STOP_FLOW_CONTROL 0x00000015
224#define QE_ASSIGN_PAGE_TO_DEVICE 0x00000016
225
226#define QE_ASSIGN_RISC 0x00000010
227#define QE_CR_MCN_NORMAL_SHIFT 6
228#define QE_CR_MCN_USB_SHIFT 4
229#define QE_CR_MCN_RISC_ASSIGN_SHIFT 8
230#define QE_CR_SNUM_SHIFT 17
231
232/* QE CECR Sub Block - sub block of QE command.
233*/
234#define QE_CR_SUBBLOCK_INVALID 0x00000000
235#define QE_CR_SUBBLOCK_USB 0x03200000
236#define QE_CR_SUBBLOCK_UCCFAST1 0x02000000
237#define QE_CR_SUBBLOCK_UCCFAST2 0x02200000
238#define QE_CR_SUBBLOCK_UCCFAST3 0x02400000
239#define QE_CR_SUBBLOCK_UCCFAST4 0x02600000
240#define QE_CR_SUBBLOCK_UCCFAST5 0x02800000
241#define QE_CR_SUBBLOCK_UCCFAST6 0x02a00000
242#define QE_CR_SUBBLOCK_UCCFAST7 0x02c00000
243#define QE_CR_SUBBLOCK_UCCFAST8 0x02e00000
244#define QE_CR_SUBBLOCK_UCCSLOW1 0x00000000
245#define QE_CR_SUBBLOCK_UCCSLOW2 0x00200000
246#define QE_CR_SUBBLOCK_UCCSLOW3 0x00400000
247#define QE_CR_SUBBLOCK_UCCSLOW4 0x00600000
248#define QE_CR_SUBBLOCK_UCCSLOW5 0x00800000
249#define QE_CR_SUBBLOCK_UCCSLOW6 0x00a00000
250#define QE_CR_SUBBLOCK_UCCSLOW7 0x00c00000
251#define QE_CR_SUBBLOCK_UCCSLOW8 0x00e00000
252#define QE_CR_SUBBLOCK_MCC1 0x03800000
253#define QE_CR_SUBBLOCK_MCC2 0x03a00000
254#define QE_CR_SUBBLOCK_MCC3 0x03000000
255#define QE_CR_SUBBLOCK_IDMA1 0x02800000
256#define QE_CR_SUBBLOCK_IDMA2 0x02a00000
257#define QE_CR_SUBBLOCK_IDMA3 0x02c00000
258#define QE_CR_SUBBLOCK_IDMA4 0x02e00000
259#define QE_CR_SUBBLOCK_HPAC 0x01e00000
260#define QE_CR_SUBBLOCK_SPI1 0x01400000
261#define QE_CR_SUBBLOCK_SPI2 0x01600000
262#define QE_CR_SUBBLOCK_RAND 0x01c00000
263#define QE_CR_SUBBLOCK_TIMER 0x01e00000
264#define QE_CR_SUBBLOCK_GENERAL 0x03c00000
265
266/* QE CECR Protocol - For non-MCC, specifies mode for QE CECR command */
267#define QE_CR_PROTOCOL_UNSPECIFIED 0x00 /* For all other protocols */
268#define QE_CR_PROTOCOL_HDLC_TRANSPARENT 0x00
269#define QE_CR_PROTOCOL_ATM_POS 0x0A
270#define QE_CR_PROTOCOL_ETHERNET 0x0C
271#define QE_CR_PROTOCOL_L2_SWITCH 0x0D
272
273/* BMR byte order */
274#define QE_BMR_BYTE_ORDER_BO_PPC 0x08 /* powerpc little endian */
275#define QE_BMR_BYTE_ORDER_BO_MOT 0x10 /* motorola big endian */
276#define QE_BMR_BYTE_ORDER_BO_MAX 0x18
277
278/* BRG configuration register */
279#define QE_BRGC_ENABLE 0x00010000
280#define QE_BRGC_DIVISOR_SHIFT 1
281#define QE_BRGC_DIVISOR_MAX 0xFFF
282#define QE_BRGC_DIV16 1
283
284/* QE Timers registers */
285#define QE_GTCFR1_PCAS 0x80
286#define QE_GTCFR1_STP2 0x20
287#define QE_GTCFR1_RST2 0x10
288#define QE_GTCFR1_GM2 0x08
289#define QE_GTCFR1_GM1 0x04
290#define QE_GTCFR1_STP1 0x02
291#define QE_GTCFR1_RST1 0x01
292
293/* SDMA registers */
294#define QE_SDSR_BER1 0x02000000
295#define QE_SDSR_BER2 0x01000000
296
297#define QE_SDMR_GLB_1_MSK 0x80000000
298#define QE_SDMR_ADR_SEL 0x20000000
299#define QE_SDMR_BER1_MSK 0x02000000
300#define QE_SDMR_BER2_MSK 0x01000000
301#define QE_SDMR_EB1_MSK 0x00800000
302#define QE_SDMR_ER1_MSK 0x00080000
303#define QE_SDMR_ER2_MSK 0x00040000
304#define QE_SDMR_CEN_MASK 0x0000E000
305#define QE_SDMR_SBER_1 0x00000200
306#define QE_SDMR_SBER_2 0x00000200
307#define QE_SDMR_EB1_PR_MASK 0x000000C0
308#define QE_SDMR_ER1_PR 0x00000008
309
310#define QE_SDMR_CEN_SHIFT 13
311#define QE_SDMR_EB1_PR_SHIFT 6
312
313#define QE_SDTM_MSNUM_SHIFT 24
314
315#define QE_SDEBCR_BA_MASK 0x01FFFFFF
316
317/* UPC */
318#define UPGCR_PROTOCOL 0x80000000 /* protocol ul2 or pl2 */
319#define UPGCR_TMS 0x40000000 /* Transmit master/slave mode */
320#define UPGCR_RMS 0x20000000 /* Receive master/slave mode */
321#define UPGCR_ADDR 0x10000000 /* Master MPHY Addr multiplexing */
322#define UPGCR_DIAG 0x01000000 /* Diagnostic mode */
323
324/* UCC */
325#define UCC_GUEMR_MODE_MASK_RX 0x02
326#define UCC_GUEMR_MODE_MASK_TX 0x01
327#define UCC_GUEMR_MODE_FAST_RX 0x02
328#define UCC_GUEMR_MODE_FAST_TX 0x01
329#define UCC_GUEMR_MODE_SLOW_RX 0x00
330#define UCC_GUEMR_MODE_SLOW_TX 0x00
331#define UCC_GUEMR_SET_RESERVED3 0x10 /* Bit 3 in the guemr is reserved but
332 must be set 1 */
333
334/* structure representing UCC SLOW parameter RAM */
335struct ucc_slow_pram {
336 u16 rbase; /* RX BD base address */
337 u16 tbase; /* TX BD base address */
338 u8 rfcr; /* Rx function code */
339 u8 tfcr; /* Tx function code */
340 u16 mrblr; /* Rx buffer length */
341 u32 rstate; /* Rx internal state */
342 u32 rptr; /* Rx internal data pointer */
343 u16 rbptr; /* rb BD Pointer */
344 u16 rcount; /* Rx internal byte count */
345 u32 rtemp; /* Rx temp */
346 u32 tstate; /* Tx internal state */
347 u32 tptr; /* Tx internal data pointer */
348 u16 tbptr; /* Tx BD pointer */
349 u16 tcount; /* Tx byte count */
350 u32 ttemp; /* Tx temp */
351 u32 rcrc; /* temp receive CRC */
352 u32 tcrc; /* temp transmit CRC */
353} __attribute__ ((packed));
354
355/* General UCC SLOW Mode Register (GUMRH & GUMRL) */
356#define UCC_SLOW_GUMR_H_CRC16 0x00004000
357#define UCC_SLOW_GUMR_H_CRC16CCITT 0x00000000
358#define UCC_SLOW_GUMR_H_CRC32CCITT 0x00008000
359#define UCC_SLOW_GUMR_H_REVD 0x00002000
360#define UCC_SLOW_GUMR_H_TRX 0x00001000
361#define UCC_SLOW_GUMR_H_TTX 0x00000800
362#define UCC_SLOW_GUMR_H_CDP 0x00000400
363#define UCC_SLOW_GUMR_H_CTSP 0x00000200
364#define UCC_SLOW_GUMR_H_CDS 0x00000100
365#define UCC_SLOW_GUMR_H_CTSS 0x00000080
366#define UCC_SLOW_GUMR_H_TFL 0x00000040
367#define UCC_SLOW_GUMR_H_RFW 0x00000020
368#define UCC_SLOW_GUMR_H_TXSY 0x00000010
369#define UCC_SLOW_GUMR_H_4SYNC 0x00000004
370#define UCC_SLOW_GUMR_H_8SYNC 0x00000008
371#define UCC_SLOW_GUMR_H_16SYNC 0x0000000c
372#define UCC_SLOW_GUMR_H_RTSM 0x00000002
373#define UCC_SLOW_GUMR_H_RSYN 0x00000001
374
375#define UCC_SLOW_GUMR_L_TCI 0x10000000
376#define UCC_SLOW_GUMR_L_RINV 0x02000000
377#define UCC_SLOW_GUMR_L_TINV 0x01000000
378#define UCC_SLOW_GUMR_L_TEND 0x00020000
379#define UCC_SLOW_GUMR_L_ENR 0x00000020
380#define UCC_SLOW_GUMR_L_ENT 0x00000010
381
382/* General UCC FAST Mode Register */
383#define UCC_FAST_GUMR_TCI 0x20000000
384#define UCC_FAST_GUMR_TRX 0x10000000
385#define UCC_FAST_GUMR_TTX 0x08000000
386#define UCC_FAST_GUMR_CDP 0x04000000
387#define UCC_FAST_GUMR_CTSP 0x02000000
388#define UCC_FAST_GUMR_CDS 0x01000000
389#define UCC_FAST_GUMR_CTSS 0x00800000
390#define UCC_FAST_GUMR_TXSY 0x00020000
391#define UCC_FAST_GUMR_RSYN 0x00010000
392#define UCC_FAST_GUMR_RTSM 0x00002000
393#define UCC_FAST_GUMR_REVD 0x00000400
394#define UCC_FAST_GUMR_ENR 0x00000020
395#define UCC_FAST_GUMR_ENT 0x00000010
396
397/* Slow UCC Event Register (UCCE) */
398#define UCC_SLOW_UCCE_GLR 0x1000
399#define UCC_SLOW_UCCE_GLT 0x0800
400#define UCC_SLOW_UCCE_DCC 0x0400
401#define UCC_SLOW_UCCE_FLG 0x0200
402#define UCC_SLOW_UCCE_AB 0x0200
403#define UCC_SLOW_UCCE_IDLE 0x0100
404#define UCC_SLOW_UCCE_GRA 0x0080
405#define UCC_SLOW_UCCE_TXE 0x0010
406#define UCC_SLOW_UCCE_RXF 0x0008
407#define UCC_SLOW_UCCE_CCR 0x0008
408#define UCC_SLOW_UCCE_RCH 0x0008
409#define UCC_SLOW_UCCE_BSY 0x0004
410#define UCC_SLOW_UCCE_TXB 0x0002
411#define UCC_SLOW_UCCE_TX 0x0002
412#define UCC_SLOW_UCCE_RX 0x0001
413#define UCC_SLOW_UCCE_GOV 0x0001
414#define UCC_SLOW_UCCE_GUN 0x0002
415#define UCC_SLOW_UCCE_GINT 0x0004
416#define UCC_SLOW_UCCE_IQOV 0x0008
417
418#define UCC_SLOW_UCCE_HDLC_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \
419 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_RXF | \
420 UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR)
421#define UCC_SLOW_UCCE_ENET_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \
422 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_RXF)
423#define UCC_SLOW_UCCE_TRANS_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \
424 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TX | UCC_SLOW_UCCE_RX | \
425 UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR)
426#define UCC_SLOW_UCCE_UART_SET (UCC_SLOW_UCCE_BSY | UCC_SLOW_UCCE_GRA | \
427 UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_TX | UCC_SLOW_UCCE_RX | \
428 UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR)
429#define UCC_SLOW_UCCE_QMC_SET (UCC_SLOW_UCCE_IQOV | UCC_SLOW_UCCE_GINT | \
430 UCC_SLOW_UCCE_GUN | UCC_SLOW_UCCE_GOV)
431
432#define UCC_SLOW_UCCE_OTHER (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \
433 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | \
434 UCC_SLOW_UCCE_GLR)
435
436#define UCC_SLOW_INTR_TX UCC_SLOW_UCCE_TXB
437#define UCC_SLOW_INTR_RX (UCC_SLOW_UCCE_RXF | UCC_SLOW_UCCE_RX)
438#define UCC_SLOW_INTR (UCC_SLOW_INTR_TX | UCC_SLOW_INTR_RX)
439
440/* UCC Transmit On Demand Register (UTODR) */
441#define UCC_SLOW_TOD 0x8000
442#define UCC_FAST_TOD 0x8000
443
444/* Function code masks */
445#define FC_GBL 0x20
446#define FC_DTB_LCL 0x02
447#define UCC_FAST_FUNCTION_CODE_GBL 0x20
448#define UCC_FAST_FUNCTION_CODE_DTB_LCL 0x02
449#define UCC_FAST_FUNCTION_CODE_BDB_LCL 0x01
450
451static inline long IS_MURAM_ERR(const u32 offset)
452{
453 return offset > (u32) - 1000L;
454}
455
456#endif /* __KERNEL__ */
457#endif /* _ASM_POWERPC_QE_H */
diff --git a/include/asm-powerpc/qe_ic.h b/include/asm-powerpc/qe_ic.h
new file mode 100644
index 000000000000..e386fb7e44b0
--- /dev/null
+++ b/include/asm-powerpc/qe_ic.h
@@ -0,0 +1,64 @@
1/*
2 * include/asm-powerpc/qe_ic.h
3 *
4 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
5 *
6 * Authors: Shlomi Gridish <gridish@freescale.com>
7 * Li Yang <leoli@freescale.com>
8 *
9 * Description:
10 * QE IC external definitions and structure.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#ifndef _ASM_POWERPC_QE_IC_H
18#define _ASM_POWERPC_QE_IC_H
19
20#include <linux/irq.h>
21
22#define NUM_OF_QE_IC_GROUPS 6
23
24/* Flags when we init the QE IC */
25#define QE_IC_SPREADMODE_GRP_W 0x00000001
26#define QE_IC_SPREADMODE_GRP_X 0x00000002
27#define QE_IC_SPREADMODE_GRP_Y 0x00000004
28#define QE_IC_SPREADMODE_GRP_Z 0x00000008
29#define QE_IC_SPREADMODE_GRP_RISCA 0x00000010
30#define QE_IC_SPREADMODE_GRP_RISCB 0x00000020
31
32#define QE_IC_LOW_SIGNAL 0x00000100
33#define QE_IC_HIGH_SIGNAL 0x00000200
34
35#define QE_IC_GRP_W_PRI0_DEST_SIGNAL_HIGH 0x00001000
36#define QE_IC_GRP_W_PRI1_DEST_SIGNAL_HIGH 0x00002000
37#define QE_IC_GRP_X_PRI0_DEST_SIGNAL_HIGH 0x00004000
38#define QE_IC_GRP_X_PRI1_DEST_SIGNAL_HIGH 0x00008000
39#define QE_IC_GRP_Y_PRI0_DEST_SIGNAL_HIGH 0x00010000
40#define QE_IC_GRP_Y_PRI1_DEST_SIGNAL_HIGH 0x00020000
41#define QE_IC_GRP_Z_PRI0_DEST_SIGNAL_HIGH 0x00040000
42#define QE_IC_GRP_Z_PRI1_DEST_SIGNAL_HIGH 0x00080000
43#define QE_IC_GRP_RISCA_PRI0_DEST_SIGNAL_HIGH 0x00100000
44#define QE_IC_GRP_RISCA_PRI1_DEST_SIGNAL_HIGH 0x00200000
45#define QE_IC_GRP_RISCB_PRI0_DEST_SIGNAL_HIGH 0x00400000
46#define QE_IC_GRP_RISCB_PRI1_DEST_SIGNAL_HIGH 0x00800000
47#define QE_IC_GRP_W_DEST_SIGNAL_SHIFT (12)
48
49/* QE interrupt sources groups */
50enum qe_ic_grp_id {
51 QE_IC_GRP_W = 0, /* QE interrupt controller group W */
52 QE_IC_GRP_X, /* QE interrupt controller group X */
53 QE_IC_GRP_Y, /* QE interrupt controller group Y */
54 QE_IC_GRP_Z, /* QE interrupt controller group Z */
55 QE_IC_GRP_RISCA, /* QE interrupt controller RISC group A */
56 QE_IC_GRP_RISCB /* QE interrupt controller RISC group B */
57};
58
59void qe_ic_init(struct device_node *node, unsigned int flags);
60void qe_ic_set_highest_priority(unsigned int virq, int high);
61int qe_ic_set_priority(unsigned int virq, unsigned int priority);
62int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high);
63
64#endif /* _ASM_POWERPC_QE_IC_H */
diff --git a/include/asm-powerpc/spinlock.h b/include/asm-powerpc/spinlock.h
index c31e4382a775..cc4cfceac67c 100644
--- a/include/asm-powerpc/spinlock.h
+++ b/include/asm-powerpc/spinlock.h
@@ -285,5 +285,9 @@ static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
285 rw->lock = 0; 285 rw->lock = 0;
286} 286}
287 287
288#define _raw_spin_relax(lock) __spin_yield(lock)
289#define _raw_read_relax(lock) __rw_yield(lock)
290#define _raw_write_relax(lock) __rw_yield(lock)
291
288#endif /* __KERNEL__ */ 292#endif /* __KERNEL__ */
289#endif /* __ASM_SPINLOCK_H */ 293#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 4b41deaa8d8d..43627596003b 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -91,10 +91,6 @@ DEBUGGER_BOILERPLATE(debugger_iabr_match)
91DEBUGGER_BOILERPLATE(debugger_dabr_match) 91DEBUGGER_BOILERPLATE(debugger_dabr_match)
92DEBUGGER_BOILERPLATE(debugger_fault_handler) 92DEBUGGER_BOILERPLATE(debugger_fault_handler)
93 93
94#ifdef CONFIG_XMON
95extern void xmon_init(int enable);
96#endif
97
98#else 94#else
99static inline int debugger(struct pt_regs *regs) { return 0; } 95static inline int debugger(struct pt_regs *regs) { return 0; }
100static inline int debugger_ipi(struct pt_regs *regs) { return 0; } 96static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 5785ac4737b5..b051d4c88c3b 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -39,6 +39,10 @@ extern void generic_calibrate_decr(void);
39extern void wakeup_decrementer(void); 39extern void wakeup_decrementer(void);
40extern void snapshot_timebase(void); 40extern void snapshot_timebase(void);
41 41
42#ifdef CONFIG_RTC_CLASS
43extern int __init rtc_class_hookup(void);
44#endif
45
42/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 46/* Some sane defaults: 125 MHz timebase, 1GHz processor */
43extern unsigned long ppc_proc_freq; 47extern unsigned long ppc_proc_freq;
44#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) 48#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
@@ -234,4 +238,4 @@ extern void snapshot_timebases(void);
234#endif 238#endif
235 239
236#endif /* __KERNEL__ */ 240#endif /* __KERNEL__ */
237#endif /* __PPC64_TIME_H */ 241#endif /* __POWERPC_TIME_H */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index bbc3844b086f..8f7ee16781a4 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -43,6 +43,7 @@ extern int pcibus_to_node(struct pci_bus *bus);
43#define SD_NODE_INIT (struct sched_domain) { \ 43#define SD_NODE_INIT (struct sched_domain) { \
44 .span = CPU_MASK_NONE, \ 44 .span = CPU_MASK_NONE, \
45 .parent = NULL, \ 45 .parent = NULL, \
46 .child = NULL, \
46 .groups = NULL, \ 47 .groups = NULL, \
47 .min_interval = 8, \ 48 .min_interval = 8, \
48 .max_interval = 32, \ 49 .max_interval = 32, \
diff --git a/include/asm-powerpc/ucc.h b/include/asm-powerpc/ucc.h
new file mode 100644
index 000000000000..afe3076bdc03
--- /dev/null
+++ b/include/asm-powerpc/ucc.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * Internal header file for UCC unit routines.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15#ifndef __UCC_H__
16#define __UCC_H__
17
18#include <asm/immap_qe.h>
19#include <asm/qe.h>
20
21#define STATISTICS
22
23#define UCC_MAX_NUM 8
24
25/* Slow or fast type for UCCs.
26*/
27enum ucc_speed_type {
28 UCC_SPEED_TYPE_FAST, UCC_SPEED_TYPE_SLOW
29};
30
31/* Initial UCCs Parameter RAM address relative to: MEM_MAP_BASE (IMMR).
32*/
33enum ucc_pram_initial_offset {
34 UCC_PRAM_OFFSET_UCC1 = 0x8400,
35 UCC_PRAM_OFFSET_UCC2 = 0x8500,
36 UCC_PRAM_OFFSET_UCC3 = 0x8600,
37 UCC_PRAM_OFFSET_UCC4 = 0x9000,
38 UCC_PRAM_OFFSET_UCC5 = 0x8000,
39 UCC_PRAM_OFFSET_UCC6 = 0x8100,
40 UCC_PRAM_OFFSET_UCC7 = 0x8200,
41 UCC_PRAM_OFFSET_UCC8 = 0x8300
42};
43
44/* ucc_set_type
45 * Sets UCC to slow or fast mode.
46 *
47 * ucc_num - (In) number of UCC (0-7).
48 * regs - (In) pointer to registers base for the UCC.
49 * speed - (In) slow or fast mode for UCC.
50 */
51int ucc_set_type(int ucc_num, struct ucc_common *regs,
52 enum ucc_speed_type speed);
53
54/* ucc_init_guemr
55 * Init the Guemr register.
56 *
57 * regs - (In) pointer to registers base for the UCC.
58 */
59int ucc_init_guemr(struct ucc_common *regs);
60
61int ucc_set_qe_mux_mii_mng(int ucc_num);
62
63int ucc_set_qe_mux_rxtx(int ucc_num, enum qe_clock clock, enum comm_dir mode);
64
65int ucc_mux_set_grant_tsa_bkpt(int ucc_num, int set, u32 mask);
66
67/* QE MUX clock routing for UCC
68*/
69static inline int ucc_set_qe_mux_grant(int ucc_num, int set)
70{
71 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT);
72}
73
74static inline int ucc_set_qe_mux_tsa(int ucc_num, int set)
75{
76 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA);
77}
78
79static inline int ucc_set_qe_mux_bkpt(int ucc_num, int set)
80{
81 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT);
82}
83
84#endif /* __UCC_H__ */
diff --git a/include/asm-powerpc/ucc_fast.h b/include/asm-powerpc/ucc_fast.h
new file mode 100644
index 000000000000..39d1c90fd2ca
--- /dev/null
+++ b/include/asm-powerpc/ucc_fast.h
@@ -0,0 +1,243 @@
1/*
2 * include/asm-powerpc/ucc_fast.h
3 *
4 * Internal header file for UCC FAST unit routines.
5 *
6 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
7 *
8 * Authors: Shlomi Gridish <gridish@freescale.com>
9 * Li Yang <leoli@freescale.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16#ifndef __UCC_FAST_H__
17#define __UCC_FAST_H__
18
19#include <linux/kernel.h>
20
21#include <asm/immap_qe.h>
22#include <asm/qe.h>
23
24#include "ucc.h"
25
26/* Receive BD's status */
27#define R_E 0x80000000 /* buffer empty */
28#define R_W 0x20000000 /* wrap bit */
29#define R_I 0x10000000 /* interrupt on reception */
30#define R_L 0x08000000 /* last */
31#define R_F 0x04000000 /* first */
32
33/* transmit BD's status */
34#define T_R 0x80000000 /* ready bit */
35#define T_W 0x20000000 /* wrap bit */
36#define T_I 0x10000000 /* interrupt on completion */
37#define T_L 0x08000000 /* last */
38
39/* Rx Data buffer must be 4 bytes aligned in most cases */
40#define UCC_FAST_RX_ALIGN 4
41#define UCC_FAST_MRBLR_ALIGNMENT 4
42#define UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT 8
43
44/* Sizes */
45#define UCC_FAST_URFS_MIN_VAL 0x88
46#define UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR 8
47
48/* ucc_fast_channel_protocol_mode - UCC FAST mode */
49enum ucc_fast_channel_protocol_mode {
50 UCC_FAST_PROTOCOL_MODE_HDLC = 0x00000000,
51 UCC_FAST_PROTOCOL_MODE_RESERVED01 = 0x00000001,
52 UCC_FAST_PROTOCOL_MODE_RESERVED_QMC = 0x00000002,
53 UCC_FAST_PROTOCOL_MODE_RESERVED02 = 0x00000003,
54 UCC_FAST_PROTOCOL_MODE_RESERVED_UART = 0x00000004,
55 UCC_FAST_PROTOCOL_MODE_RESERVED03 = 0x00000005,
56 UCC_FAST_PROTOCOL_MODE_RESERVED_EX_MAC_1 = 0x00000006,
57 UCC_FAST_PROTOCOL_MODE_RESERVED_EX_MAC_2 = 0x00000007,
58 UCC_FAST_PROTOCOL_MODE_RESERVED_BISYNC = 0x00000008,
59 UCC_FAST_PROTOCOL_MODE_RESERVED04 = 0x00000009,
60 UCC_FAST_PROTOCOL_MODE_ATM = 0x0000000A,
61 UCC_FAST_PROTOCOL_MODE_RESERVED05 = 0x0000000B,
62 UCC_FAST_PROTOCOL_MODE_ETHERNET = 0x0000000C,
63 UCC_FAST_PROTOCOL_MODE_RESERVED06 = 0x0000000D,
64 UCC_FAST_PROTOCOL_MODE_POS = 0x0000000E,
65 UCC_FAST_PROTOCOL_MODE_RESERVED07 = 0x0000000F
66};
67
68/* ucc_fast_transparent_txrx - UCC Fast Transparent TX & RX */
69enum ucc_fast_transparent_txrx {
70 UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_NORMAL = 0x00000000,
71 UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_TRANSPARENT = 0x18000000
72};
73
74/* UCC fast diagnostic mode */
75enum ucc_fast_diag_mode {
76 UCC_FAST_DIAGNOSTIC_NORMAL = 0x0,
77 UCC_FAST_DIAGNOSTIC_LOCAL_LOOP_BACK = 0x40000000,
78 UCC_FAST_DIAGNOSTIC_AUTO_ECHO = 0x80000000,
79 UCC_FAST_DIAGNOSTIC_LOOP_BACK_AND_ECHO = 0xC0000000
80};
81
82/* UCC fast Sync length (transparent mode only) */
83enum ucc_fast_sync_len {
84 UCC_FAST_SYNC_LEN_NOT_USED = 0x0,
85 UCC_FAST_SYNC_LEN_AUTOMATIC = 0x00004000,
86 UCC_FAST_SYNC_LEN_8_BIT = 0x00008000,
87 UCC_FAST_SYNC_LEN_16_BIT = 0x0000C000
88};
89
90/* UCC fast RTS mode */
91enum ucc_fast_ready_to_send {
92 UCC_FAST_SEND_IDLES_BETWEEN_FRAMES = 0x00000000,
93 UCC_FAST_SEND_FLAGS_BETWEEN_FRAMES = 0x00002000
94};
95
96/* UCC fast receiver decoding mode */
97enum ucc_fast_rx_decoding_method {
98 UCC_FAST_RX_ENCODING_NRZ = 0x00000000,
99 UCC_FAST_RX_ENCODING_NRZI = 0x00000800,
100 UCC_FAST_RX_ENCODING_RESERVED0 = 0x00001000,
101 UCC_FAST_RX_ENCODING_RESERVED1 = 0x00001800
102};
103
104/* UCC fast transmitter encoding mode */
105enum ucc_fast_tx_encoding_method {
106 UCC_FAST_TX_ENCODING_NRZ = 0x00000000,
107 UCC_FAST_TX_ENCODING_NRZI = 0x00000100,
108 UCC_FAST_TX_ENCODING_RESERVED0 = 0x00000200,
109 UCC_FAST_TX_ENCODING_RESERVED1 = 0x00000300
110};
111
112/* UCC fast CRC length */
113enum ucc_fast_transparent_tcrc {
114 UCC_FAST_16_BIT_CRC = 0x00000000,
115 UCC_FAST_CRC_RESERVED0 = 0x00000040,
116 UCC_FAST_32_BIT_CRC = 0x00000080,
117 UCC_FAST_CRC_RESERVED1 = 0x000000C0
118};
119
120/* Fast UCC initialization structure */
121struct ucc_fast_info {
122 int ucc_num;
123 enum qe_clock rx_clock;
124 enum qe_clock tx_clock;
125 u32 regs;
126 int irq;
127 u32 uccm_mask;
128 int bd_mem_part;
129 int brkpt_support;
130 int grant_support;
131 int tsa;
132 int cdp;
133 int cds;
134 int ctsp;
135 int ctss;
136 int tci;
137 int txsy;
138 int rtsm;
139 int revd;
140 int rsyn;
141 u16 max_rx_buf_length;
142 u16 urfs;
143 u16 urfet;
144 u16 urfset;
145 u16 utfs;
146 u16 utfet;
147 u16 utftt;
148 u16 ufpt;
149 enum ucc_fast_channel_protocol_mode mode;
150 enum ucc_fast_transparent_txrx ttx_trx;
151 enum ucc_fast_tx_encoding_method tenc;
152 enum ucc_fast_rx_decoding_method renc;
153 enum ucc_fast_transparent_tcrc tcrc;
154 enum ucc_fast_sync_len synl;
155};
156
157struct ucc_fast_private {
158 struct ucc_fast_info *uf_info;
159 struct ucc_fast *uf_regs; /* a pointer to memory map of UCC regs. */
160 u32 *p_ucce; /* a pointer to the event register in memory. */
161 u32 *p_uccm; /* a pointer to the mask register in memory. */
162 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
163 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */
164 int stopped_tx; /* Whether channel has been stopped for Tx
165 (STOP_TX, etc.) */
166 int stopped_rx; /* Whether channel has been stopped for Rx */
167 u32 ucc_fast_tx_virtual_fifo_base_offset;/* pointer to base of Tx
168 virtual fifo */
169 u32 ucc_fast_rx_virtual_fifo_base_offset;/* pointer to base of Rx
170 virtual fifo */
171#ifdef STATISTICS
172 u32 tx_frames; /* Transmitted frames counter. */
173 u32 rx_frames; /* Received frames counter (only frames
174 passed to application). */
175 u32 tx_discarded; /* Discarded tx frames counter (frames that
176 were discarded by the driver due to errors).
177 */
178 u32 rx_discarded; /* Discarded rx frames counter (frames that
179 were discarded by the driver due to errors).
180 */
181#endif /* STATISTICS */
182 u16 mrblr; /* maximum receive buffer length */
183};
184
185/* ucc_fast_init
186 * Initializes Fast UCC according to user provided parameters.
187 *
188 * uf_info - (In) pointer to the fast UCC info structure.
189 * uccf_ret - (Out) pointer to the fast UCC structure.
190 */
191int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** uccf_ret);
192
193/* ucc_fast_free
194 * Frees all resources for fast UCC.
195 *
196 * uccf - (In) pointer to the fast UCC structure.
197 */
198void ucc_fast_free(struct ucc_fast_private * uccf);
199
200/* ucc_fast_enable
201 * Enables a fast UCC port.
202 * This routine enables Tx and/or Rx through the General UCC Mode Register.
203 *
204 * uccf - (In) pointer to the fast UCC structure.
205 * mode - (In) TX, RX, or both.
206 */
207void ucc_fast_enable(struct ucc_fast_private * uccf, enum comm_dir mode);
208
209/* ucc_fast_disable
210 * Disables a fast UCC port.
211 * This routine disables Tx and/or Rx through the General UCC Mode Register.
212 *
213 * uccf - (In) pointer to the fast UCC structure.
214 * mode - (In) TX, RX, or both.
215 */
216void ucc_fast_disable(struct ucc_fast_private * uccf, enum comm_dir mode);
217
218/* ucc_fast_irq
219 * Handles interrupts on fast UCC.
220 * Called from the general interrupt routine to handle interrupts on fast UCC.
221 *
222 * uccf - (In) pointer to the fast UCC structure.
223 */
224void ucc_fast_irq(struct ucc_fast_private * uccf);
225
226/* ucc_fast_transmit_on_demand
227 * Immediately forces a poll of the transmitter for data to be sent.
228 * Typically, the hardware performs a periodic poll for data that the
229 * transmit routine has set up to be transmitted. In cases where
230 * this polling cycle is not soon enough, this optional routine can
231 * be invoked to force a poll right away, instead. Proper use for
232 * each transmission for which this functionality is desired is to
233 * call the transmit routine and then this routine right after.
234 *
235 * uccf - (In) pointer to the fast UCC structure.
236 */
237void ucc_fast_transmit_on_demand(struct ucc_fast_private * uccf);
238
239u32 ucc_fast_get_qe_cr_subblock(int uccf_num);
240
241void ucc_fast_dump_regs(struct ucc_fast_private * uccf);
242
243#endif /* __UCC_FAST_H__ */
diff --git a/include/asm-powerpc/ucc_slow.h b/include/asm-powerpc/ucc_slow.h
new file mode 100644
index 000000000000..ca93bc99237e
--- /dev/null
+++ b/include/asm-powerpc/ucc_slow.h
@@ -0,0 +1,289 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * Internal header file for UCC SLOW unit routines.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15#ifndef __UCC_SLOW_H__
16#define __UCC_SLOW_H__
17
18#include <linux/kernel.h>
19
20#include <asm/immap_qe.h>
21#include <asm/qe.h>
22
23#include "ucc.h"
24
25/* transmit BD's status */
26#define T_R 0x80000000 /* ready bit */
27#define T_PAD 0x40000000 /* add pads to short frames */
28#define T_W 0x20000000 /* wrap bit */
29#define T_I 0x10000000 /* interrupt on completion */
30#define T_L 0x08000000 /* last */
31
32#define T_A 0x04000000 /* Address - the data transmitted as address
33 chars */
34#define T_TC 0x04000000 /* transmit CRC */
35#define T_CM 0x02000000 /* continuous mode */
36#define T_DEF 0x02000000 /* collision on previous attempt to transmit */
37#define T_P 0x01000000 /* Preamble - send Preamble sequence before
38 data */
39#define T_HB 0x01000000 /* heartbeat */
40#define T_NS 0x00800000 /* No Stop */
41#define T_LC 0x00800000 /* late collision */
42#define T_RL 0x00400000 /* retransmission limit */
43#define T_UN 0x00020000 /* underrun */
44#define T_CT 0x00010000 /* CTS lost */
45#define T_CSL 0x00010000 /* carrier sense lost */
46#define T_RC 0x003c0000 /* retry count */
47
48/* Receive BD's status */
49#define R_E 0x80000000 /* buffer empty */
50#define R_W 0x20000000 /* wrap bit */
51#define R_I 0x10000000 /* interrupt on reception */
52#define R_L 0x08000000 /* last */
53#define R_C 0x08000000 /* the last byte in this buffer is a cntl
54 char */
55#define R_F 0x04000000 /* first */
56#define R_A 0x04000000 /* the first byte in this buffer is address
57 byte */
58#define R_CM 0x02000000 /* continuous mode */
59#define R_ID 0x01000000 /* buffer close on reception of idles */
60#define R_M 0x01000000 /* Frame received because of promiscuous
61 mode */
62#define R_AM 0x00800000 /* Address match */
63#define R_DE 0x00800000 /* Address match */
64#define R_LG 0x00200000 /* Break received */
65#define R_BR 0x00200000 /* Frame length violation */
66#define R_NO 0x00100000 /* Rx Non Octet Aligned Packet */
67#define R_FR 0x00100000 /* Framing Error (no stop bit) character
68 received */
69#define R_PR 0x00080000 /* Parity Error character received */
70#define R_AB 0x00080000 /* Frame Aborted */
71#define R_SH 0x00080000 /* frame is too short */
72#define R_CR 0x00040000 /* CRC Error */
73#define R_OV 0x00020000 /* Overrun */
74#define R_CD 0x00010000 /* CD lost */
75#define R_CL 0x00010000 /* this frame is closed because of a
76 collision */
77
78/* Rx Data buffer must be 4 bytes aligned in most cases.*/
79#define UCC_SLOW_RX_ALIGN 4
80#define UCC_SLOW_MRBLR_ALIGNMENT 4
81#define UCC_SLOW_PRAM_SIZE 0x100
82#define ALIGNMENT_OF_UCC_SLOW_PRAM 64
83
84/* UCC Slow Channel Protocol Mode */
85enum ucc_slow_channel_protocol_mode {
86 UCC_SLOW_CHANNEL_PROTOCOL_MODE_QMC = 0x00000002,
87 UCC_SLOW_CHANNEL_PROTOCOL_MODE_UART = 0x00000004,
88 UCC_SLOW_CHANNEL_PROTOCOL_MODE_BISYNC = 0x00000008,
89};
90
91/* UCC Slow Transparent Transmit CRC (TCRC) */
92enum ucc_slow_transparent_tcrc {
93 /* 16-bit CCITT CRC (HDLC). (X16 + X12 + X5 + 1) */
94 UCC_SLOW_TRANSPARENT_TCRC_CCITT_CRC16 = 0x00000000,
95 /* CRC16 (BISYNC). (X16 + X15 + X2 + 1) */
96 UCC_SLOW_TRANSPARENT_TCRC_CRC16 = 0x00004000,
97 /* 32-bit CCITT CRC (Ethernet and HDLC) */
98 UCC_SLOW_TRANSPARENT_TCRC_CCITT_CRC32 = 0x00008000,
99};
100
101/* UCC Slow oversampling rate for transmitter (TDCR) */
102enum ucc_slow_tx_oversampling_rate {
103 /* 1x clock mode */
104 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_1 = 0x00000000,
105 /* 8x clock mode */
106 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_8 = 0x00010000,
107 /* 16x clock mode */
108 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_16 = 0x00020000,
109 /* 32x clock mode */
110 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_32 = 0x00030000,
111};
112
113/* UCC Slow Oversampling rate for receiver (RDCR)
114*/
115enum ucc_slow_rx_oversampling_rate {
116 /* 1x clock mode */
117 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_1 = 0x00000000,
118 /* 8x clock mode */
119 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_8 = 0x00004000,
120 /* 16x clock mode */
121 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_16 = 0x00008000,
122 /* 32x clock mode */
123 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_32 = 0x0000c000,
124};
125
126/* UCC Slow Transmitter encoding method (TENC)
127*/
128enum ucc_slow_tx_encoding_method {
129 UCC_SLOW_TRANSMITTER_ENCODING_METHOD_TENC_NRZ = 0x00000000,
130 UCC_SLOW_TRANSMITTER_ENCODING_METHOD_TENC_NRZI = 0x00000100
131};
132
133/* UCC Slow Receiver decoding method (RENC)
134*/
135enum ucc_slow_rx_decoding_method {
136 UCC_SLOW_RECEIVER_DECODING_METHOD_RENC_NRZ = 0x00000000,
137 UCC_SLOW_RECEIVER_DECODING_METHOD_RENC_NRZI = 0x00000800
138};
139
140/* UCC Slow Diagnostic mode (DIAG)
141*/
142enum ucc_slow_diag_mode {
143 UCC_SLOW_DIAG_MODE_NORMAL = 0x00000000,
144 UCC_SLOW_DIAG_MODE_LOOPBACK = 0x00000040,
145 UCC_SLOW_DIAG_MODE_ECHO = 0x00000080,
146 UCC_SLOW_DIAG_MODE_LOOPBACK_ECHO = 0x000000c0
147};
148
149struct ucc_slow_info {
150 int ucc_num;
151 enum qe_clock rx_clock;
152 enum qe_clock tx_clock;
153 struct ucc_slow *us_regs;
154 int irq;
155 u16 uccm_mask;
156 int data_mem_part;
157 int init_tx;
158 int init_rx;
159 u32 tx_bd_ring_len;
160 u32 rx_bd_ring_len;
161 int rx_interrupts;
162 int brkpt_support;
163 int grant_support;
164 int tsa;
165 int cdp;
166 int cds;
167 int ctsp;
168 int ctss;
169 int rinv;
170 int tinv;
171 int rtsm;
172 int rfw;
173 int tci;
174 int tend;
175 int tfl;
176 int txsy;
177 u16 max_rx_buf_length;
178 enum ucc_slow_transparent_tcrc tcrc;
179 enum ucc_slow_channel_protocol_mode mode;
180 enum ucc_slow_diag_mode diag;
181 enum ucc_slow_tx_oversampling_rate tdcr;
182 enum ucc_slow_rx_oversampling_rate rdcr;
183 enum ucc_slow_tx_encoding_method tenc;
184 enum ucc_slow_rx_decoding_method renc;
185};
186
187struct ucc_slow_private {
188 struct ucc_slow_info *us_info;
189 struct ucc_slow *us_regs; /* a pointer to memory map of UCC regs */
190 struct ucc_slow_pram *us_pram; /* a pointer to the parameter RAM */
191 u32 us_pram_offset;
192 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
193 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */
194 int stopped_tx; /* Whether channel has been stopped for Tx
195 (STOP_TX, etc.) */
196 int stopped_rx; /* Whether channel has been stopped for Rx */
197 struct list_head confQ; /* frames passed to chip waiting for tx */
198 u32 first_tx_bd_mask; /* mask is used in Tx routine to save status
199 and length for first BD in a frame */
200 u32 tx_base_offset; /* first BD in Tx BD table offset (In MURAM) */
201 u32 rx_base_offset; /* first BD in Rx BD table offset (In MURAM) */
202 u8 *confBd; /* next BD for confirm after Tx */
203 u8 *tx_bd; /* next BD for new Tx request */
204 u8 *rx_bd; /* next BD to collect after Rx */
205 void *p_rx_frame; /* accumulating receive frame */
206 u16 *p_ucce; /* a pointer to the event register in memory.
207 */
208 u16 *p_uccm; /* a pointer to the mask register in memory */
209 u16 saved_uccm; /* a saved mask for the RX Interrupt bits */
210#ifdef STATISTICS
211 u32 tx_frames; /* Transmitted frames counters */
212 u32 rx_frames; /* Received frames counters (only frames
213 passed to application) */
214 u32 rx_discarded; /* Discarded frames counters (frames that
215 were discarded by the driver due to
216 errors) */
217#endif /* STATISTICS */
218};
219
220/* ucc_slow_init
221 * Initializes Slow UCC according to provided parameters.
222 *
223 * us_info - (In) pointer to the slow UCC info structure.
224 * uccs_ret - (Out) pointer to the slow UCC structure.
225 */
226int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccs_ret);
227
228/* ucc_slow_free
229 * Frees all resources for slow UCC.
230 *
231 * uccs - (In) pointer to the slow UCC structure.
232 */
233void ucc_slow_free(struct ucc_slow_private * uccs);
234
235/* ucc_slow_enable
236 * Enables a fast UCC port.
237 * This routine enables Tx and/or Rx through the General UCC Mode Register.
238 *
239 * uccs - (In) pointer to the slow UCC structure.
240 * mode - (In) TX, RX, or both.
241 */
242void ucc_slow_enable(struct ucc_slow_private * uccs, enum comm_dir mode);
243
244/* ucc_slow_disable
245 * Disables a fast UCC port.
246 * This routine disables Tx and/or Rx through the General UCC Mode Register.
247 *
248 * uccs - (In) pointer to the slow UCC structure.
249 * mode - (In) TX, RX, or both.
250 */
251void ucc_slow_disable(struct ucc_slow_private * uccs, enum comm_dir mode);
252
253/* ucc_slow_poll_transmitter_now
254 * Immediately forces a poll of the transmitter for data to be sent.
255 * Typically, the hardware performs a periodic poll for data that the
256 * transmit routine has set up to be transmitted. In cases where
257 * this polling cycle is not soon enough, this optional routine can
258 * be invoked to force a poll right away, instead. Proper use for
259 * each transmission for which this functionality is desired is to
260 * call the transmit routine and then this routine right after.
261 *
262 * uccs - (In) pointer to the slow UCC structure.
263 */
264void ucc_slow_poll_transmitter_now(struct ucc_slow_private * uccs);
265
266/* ucc_slow_graceful_stop_tx
267 * Smoothly stops transmission on a specified slow UCC.
268 *
269 * uccs - (In) pointer to the slow UCC structure.
270 */
271void ucc_slow_graceful_stop_tx(struct ucc_slow_private * uccs);
272
273/* ucc_slow_stop_tx
274 * Stops transmission on a specified slow UCC.
275 *
276 * uccs - (In) pointer to the slow UCC structure.
277 */
278void ucc_slow_stop_tx(struct ucc_slow_private * uccs);
279
280/* ucc_slow_restart_x
281 * Restarts transmitting on a specified slow UCC.
282 *
283 * uccs - (In) pointer to the slow UCC structure.
284 */
285void ucc_slow_restart_x(struct ucc_slow_private * uccs);
286
287u32 ucc_slow_get_qe_cr_subblock(int uccs_num);
288
289#endif /* __UCC_SLOW_H__ */
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index eb66eae6616f..464a48cce7f5 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -479,13 +479,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
479#endif 479#endif
480 480
481/* 481/*
482 * System call prototypes.
483 */
484#ifdef __KERNEL_SYSCALLS__
485extern int execve(const char *file, char **argv, char **envp);
486#endif /* __KERNEL_SYSCALLS__ */
487
488/*
489 * "Conditional" syscalls 482 * "Conditional" syscalls
490 * 483 *
491 * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 484 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h
index 43f7129984c7..f1d337ed68d5 100644
--- a/include/asm-powerpc/xmon.h
+++ b/include/asm-powerpc/xmon.h
@@ -1,12 +1,22 @@
1#ifndef __PPC_XMON_H 1#ifndef __ASM_POWERPC_XMON_H
2#define __PPC_XMON_H 2#define __ASM_POWERPC_XMON_H
3#ifdef __KERNEL__
4 3
5struct pt_regs; 4/*
5 * Copyrignt (C) 2006 IBM Corp
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 */
6 12
7extern int xmon(struct pt_regs *excp); 13#ifdef __KERNEL__
8extern void xmon_printf(const char *fmt, ...);
9extern void xmon_init(int);
10 14
15#ifdef CONFIG_XMON
16extern void xmon_setup(void);
17#else
18static inline void xmon_setup(void) { };
11#endif 19#endif
12#endif 20
21#endif /* __KERNEL __ */
22#endif /* __ASM_POWERPC_XMON_H */
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
index f6a7ff04ffe5..220cc2debe08 100644
--- a/include/asm-ppc/cpm2.h
+++ b/include/asm-ppc/cpm2.h
@@ -42,6 +42,8 @@
42#define CPM_CR_IDMA4_SBLOCK (0x17) 42#define CPM_CR_IDMA4_SBLOCK (0x17)
43#define CPM_CR_MCC1_SBLOCK (0x1c) 43#define CPM_CR_MCC1_SBLOCK (0x1c)
44 44
45#define CPM_CR_FCC_SBLOCK(x) (x + 0x10)
46
45#define CPM_CR_SCC1_PAGE (0x00) 47#define CPM_CR_SCC1_PAGE (0x00)
46#define CPM_CR_SCC2_PAGE (0x01) 48#define CPM_CR_SCC2_PAGE (0x01)
47#define CPM_CR_SCC3_PAGE (0x02) 49#define CPM_CR_SCC3_PAGE (0x02)
@@ -62,6 +64,8 @@
62#define CPM_CR_MCC1_PAGE (0x07) 64#define CPM_CR_MCC1_PAGE (0x07)
63#define CPM_CR_MCC2_PAGE (0x08) 65#define CPM_CR_MCC2_PAGE (0x08)
64 66
67#define CPM_CR_FCC_PAGE(x) (x + 0x04)
68
65/* Some opcodes (there are more...later) 69/* Some opcodes (there are more...later)
66*/ 70*/
67#define CPM_CR_INIT_TRX ((ushort)0x0000) 71#define CPM_CR_INIT_TRX ((ushort)0x0000)
@@ -173,6 +177,10 @@ typedef struct cpm_buf_desc {
173#define PROFF_I2C_BASE ((uint)0x8afc) 177#define PROFF_I2C_BASE ((uint)0x8afc)
174#define PROFF_IDMA4_BASE ((uint)0x8afe) 178#define PROFF_IDMA4_BASE ((uint)0x8afe)
175 179
180#define PROFF_SCC_SIZE ((uint)0x100)
181#define PROFF_FCC_SIZE ((uint)0x100)
182#define PROFF_SMC_SIZE ((uint)64)
183
176/* The SMCs are relocated to any of the first eight DPRAM pages. 184/* The SMCs are relocated to any of the first eight DPRAM pages.
177 * We will fix these at the first locations of DPRAM, until we 185 * We will fix these at the first locations of DPRAM, until we
178 * get some microcode patches :-). 186 * get some microcode patches :-).
@@ -1186,7 +1194,60 @@ typedef struct im_idma {
1186#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128)) 1194#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
1187#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0) 1195#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
1188#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1) 1196#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
1189#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(2) 1197#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
1198
1199/* Clocks and GRG's */
1200
1201enum cpm_clk_dir {
1202 CPM_CLK_RX,
1203 CPM_CLK_TX,
1204 CPM_CLK_RTX
1205};
1206
1207enum cpm_clk_target {
1208 CPM_CLK_SCC1,
1209 CPM_CLK_SCC2,
1210 CPM_CLK_SCC3,
1211 CPM_CLK_SCC4,
1212 CPM_CLK_FCC1,
1213 CPM_CLK_FCC2,
1214 CPM_CLK_FCC3
1215};
1216
1217enum cpm_clk {
1218 CPM_CLK_NONE = 0,
1219 CPM_BRG1, /* Baud Rate Generator 1 */
1220 CPM_BRG2, /* Baud Rate Generator 2 */
1221 CPM_BRG3, /* Baud Rate Generator 3 */
1222 CPM_BRG4, /* Baud Rate Generator 4 */
1223 CPM_BRG5, /* Baud Rate Generator 5 */
1224 CPM_BRG6, /* Baud Rate Generator 6 */
1225 CPM_BRG7, /* Baud Rate Generator 7 */
1226 CPM_BRG8, /* Baud Rate Generator 8 */
1227 CPM_CLK1, /* Clock 1 */
1228 CPM_CLK2, /* Clock 2 */
1229 CPM_CLK3, /* Clock 3 */
1230 CPM_CLK4, /* Clock 4 */
1231 CPM_CLK5, /* Clock 5 */
1232 CPM_CLK6, /* Clock 6 */
1233 CPM_CLK7, /* Clock 7 */
1234 CPM_CLK8, /* Clock 8 */
1235 CPM_CLK9, /* Clock 9 */
1236 CPM_CLK10, /* Clock 10 */
1237 CPM_CLK11, /* Clock 11 */
1238 CPM_CLK12, /* Clock 12 */
1239 CPM_CLK13, /* Clock 13 */
1240 CPM_CLK14, /* Clock 14 */
1241 CPM_CLK15, /* Clock 15 */
1242 CPM_CLK16, /* Clock 16 */
1243 CPM_CLK17, /* Clock 17 */
1244 CPM_CLK18, /* Clock 18 */
1245 CPM_CLK19, /* Clock 19 */
1246 CPM_CLK20, /* Clock 20 */
1247 CPM_CLK_DUMMY
1248};
1249
1250extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
1190 1251
1191#endif /* __CPM2__ */ 1252#endif /* __CPM2__ */
1192#endif /* __KERNEL__ */ 1253#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/fs_pd.h b/include/asm-ppc/fs_pd.h
new file mode 100644
index 000000000000..8691327653af
--- /dev/null
+++ b/include/asm-ppc/fs_pd.h
@@ -0,0 +1,36 @@
1/*
2 * Platform information definitions.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_PD_H
13#define FS_PD_H
14
15static inline int uart_baudrate(void)
16{
17 int baud;
18 bd_t *bd = (bd_t *) __res;
19
20 if (bd->bi_baudrate)
21 baud = bd->bi_baudrate;
22 else
23 baud = -1;
24 return baud;
25}
26
27static inline int uart_clock(void)
28{
29 return (((bd_t *) __res)->bi_intfreq);
30}
31
32#define cpm2_map(member) (&cpm2_immr->member)
33#define cpm2_map_size(member, size) (&cpm2_immr->member)
34#define cpm2_unmap(addr) do {} while(0)
35
36#endif
diff --git a/include/asm-ppc/mv64x60_defs.h b/include/asm-ppc/mv64x60_defs.h
index f8f7f16b9b53..5b0704a3e6ea 100644
--- a/include/asm-ppc/mv64x60_defs.h
+++ b/include/asm-ppc/mv64x60_defs.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-ppc/gt64260_defs.h 2 * include/asm-ppc/mv64x60_defs.h
3 * 3 *
4 * Register definitions for the Marvell/Galileo GT64260, MV64360, etc. 4 * Register definitions for the Marvell/Galileo GT64260, MV64360, etc.
5 * host bridges. 5 * host bridges.
diff --git a/include/asm-ppc/rheap.h b/include/asm-ppc/rheap.h
index e6ca1f67cedc..39a10d862244 100644
--- a/include/asm-ppc/rheap.h
+++ b/include/asm-ppc/rheap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-ppc/rheap.c 2 * include/asm-ppc/rheap.h
3 * 3 *
4 * Header file for the implementation of a remote heap. 4 * Header file for the implementation of a remote heap.
5 * 5 *
@@ -62,6 +62,10 @@ extern int rh_attach_region(rh_info_t * info, void *start, int size);
62/* Detach a free region */ 62/* Detach a free region */
63extern void *rh_detach_region(rh_info_t * info, void *start, int size); 63extern void *rh_detach_region(rh_info_t * info, void *start, int size);
64 64
65/* Allocate the given size from the remote heap (with alignment) */
66extern void *rh_alloc_align(rh_info_t * info, int size, int alignment,
67 const char *owner);
68
65/* Allocate the given size from the remote heap */ 69/* Allocate the given size from the remote heap */
66extern void *rh_alloc(rh_info_t * info, int size, const char *owner); 70extern void *rh_alloc(rh_info_t * info, int size, const char *owner);
67 71
diff --git a/include/asm-ppc/rtc.h b/include/asm-ppc/rtc.h
index 05fbf912ab4d..6025b46d0a2a 100644
--- a/include/asm-ppc/rtc.h
+++ b/include/asm-ppc/rtc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * inclue/asm-ppc/rtc.h 2 * include/asm-ppc/rtc.h
3 * 3 *
4 * Author: Tom Rini <trini@mvista.com> 4 * Author: Tom Rini <trini@mvista.com>
5 * 5 *
diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h
index 5c64b75f0295..fccaf5531e57 100644
--- a/include/asm-ppc/spinlock.h
+++ b/include/asm-ppc/spinlock.h
@@ -161,4 +161,8 @@ static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
161 rw->lock = 0; 161 rw->lock = 0;
162} 162}
163 163
164#define _raw_spin_relax(lock) cpu_relax()
165#define _raw_read_relax(lock) cpu_relax()
166#define _raw_write_relax(lock) cpu_relax()
167
164#endif /* __ASM_SPINLOCK_H */ 168#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-s390/appldata.h b/include/asm-s390/appldata.h
index b1770703b706..79283dac8281 100644
--- a/include/asm-s390/appldata.h
+++ b/include/asm-s390/appldata.h
@@ -80,7 +80,7 @@ static inline int appldata_asm(struct appldata_product_id *id,
80 parm_list.product_id_addr = (unsigned long) id; 80 parm_list.product_id_addr = (unsigned long) id;
81 parm_list.buffer_addr = virt_to_phys(buffer); 81 parm_list.buffer_addr = virt_to_phys(buffer);
82 asm volatile( 82 asm volatile(
83 "diag %1,%0,0xdc" 83 " diag %1,%0,0xdc"
84 : "=d" (ry) 84 : "=d" (ry)
85 : "d" (&parm_list), "m" (parm_list), "m" (*id) 85 : "d" (&parm_list), "m" (parm_list), "m" (*id)
86 : "cc"); 86 : "cc");
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index 399bf02894dd..af20c7462485 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -30,20 +30,43 @@ typedef struct {
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32 32
33#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
34
33#define __CS_LOOP(ptr, op_val, op_string) ({ \ 35#define __CS_LOOP(ptr, op_val, op_string) ({ \
34 typeof(ptr->counter) old_val, new_val; \ 36 typeof(ptr->counter) old_val, new_val; \
35 __asm__ __volatile__(" l %0,0(%3)\n" \ 37 asm volatile( \
36 "0: lr %1,%0\n" \ 38 " l %0,%2\n" \
37 op_string " %1,%4\n" \ 39 "0: lr %1,%0\n" \
38 " cs %0,%1,0(%3)\n" \ 40 op_string " %1,%3\n" \
39 " jl 0b" \ 41 " cs %0,%1,%2\n" \
40 : "=&d" (old_val), "=&d" (new_val), \ 42 " jl 0b" \
41 "=m" (((atomic_t *)(ptr))->counter) \ 43 : "=&d" (old_val), "=&d" (new_val), \
42 : "a" (ptr), "d" (op_val), \ 44 "=Q" (((atomic_t *)(ptr))->counter) \
43 "m" (((atomic_t *)(ptr))->counter) \ 45 : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \
44 : "cc", "memory" ); \ 46 : "cc", "memory"); \
45 new_val; \ 47 new_val; \
46}) 48})
49
50#else /* __GNUC__ */
51
52#define __CS_LOOP(ptr, op_val, op_string) ({ \
53 typeof(ptr->counter) old_val, new_val; \
54 asm volatile( \
55 " l %0,0(%3)\n" \
56 "0: lr %1,%0\n" \
57 op_string " %1,%4\n" \
58 " cs %0,%1,0(%3)\n" \
59 " jl 0b" \
60 : "=&d" (old_val), "=&d" (new_val), \
61 "=m" (((atomic_t *)(ptr))->counter) \
62 : "a" (ptr), "d" (op_val), \
63 "m" (((atomic_t *)(ptr))->counter) \
64 : "cc", "memory"); \
65 new_val; \
66})
67
68#endif /* __GNUC__ */
69
47#define atomic_read(v) ((v)->counter) 70#define atomic_read(v) ((v)->counter)
48#define atomic_set(v,i) (((v)->counter) = (i)) 71#define atomic_set(v,i) (((v)->counter) = (i))
49 72
@@ -81,10 +104,19 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v)
81 104
82static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new) 105static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
83{ 106{
84 __asm__ __volatile__(" cs %0,%3,0(%2)\n" 107#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
85 : "+d" (old), "=m" (v->counter) 108 asm volatile(
86 : "a" (v), "d" (new), "m" (v->counter) 109 " cs %0,%2,%1"
87 : "cc", "memory" ); 110 : "+d" (old), "=Q" (v->counter)
111 : "d" (new), "Q" (v->counter)
112 : "cc", "memory");
113#else /* __GNUC__ */
114 asm volatile(
115 " cs %0,%3,0(%2)"
116 : "+d" (old), "=m" (v->counter)
117 : "a" (v), "d" (new), "m" (v->counter)
118 : "cc", "memory");
119#endif /* __GNUC__ */
88 return old; 120 return old;
89} 121}
90 122
@@ -113,20 +145,43 @@ typedef struct {
113} __attribute__ ((aligned (8))) atomic64_t; 145} __attribute__ ((aligned (8))) atomic64_t;
114#define ATOMIC64_INIT(i) { (i) } 146#define ATOMIC64_INIT(i) { (i) }
115 147
148#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
149
116#define __CSG_LOOP(ptr, op_val, op_string) ({ \ 150#define __CSG_LOOP(ptr, op_val, op_string) ({ \
117 typeof(ptr->counter) old_val, new_val; \ 151 typeof(ptr->counter) old_val, new_val; \
118 __asm__ __volatile__(" lg %0,0(%3)\n" \ 152 asm volatile( \
119 "0: lgr %1,%0\n" \ 153 " lg %0,%2\n" \
120 op_string " %1,%4\n" \ 154 "0: lgr %1,%0\n" \
121 " csg %0,%1,0(%3)\n" \ 155 op_string " %1,%3\n" \
122 " jl 0b" \ 156 " csg %0,%1,%2\n" \
123 : "=&d" (old_val), "=&d" (new_val), \ 157 " jl 0b" \
124 "=m" (((atomic_t *)(ptr))->counter) \ 158 : "=&d" (old_val), "=&d" (new_val), \
125 : "a" (ptr), "d" (op_val), \ 159 "=Q" (((atomic_t *)(ptr))->counter) \
126 "m" (((atomic_t *)(ptr))->counter) \ 160 : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \
127 : "cc", "memory" ); \ 161 : "cc", "memory" ); \
128 new_val; \ 162 new_val; \
129}) 163})
164
165#else /* __GNUC__ */
166
167#define __CSG_LOOP(ptr, op_val, op_string) ({ \
168 typeof(ptr->counter) old_val, new_val; \
169 asm volatile( \
170 " lg %0,0(%3)\n" \
171 "0: lgr %1,%0\n" \
172 op_string " %1,%4\n" \
173 " csg %0,%1,0(%3)\n" \
174 " jl 0b" \
175 : "=&d" (old_val), "=&d" (new_val), \
176 "=m" (((atomic_t *)(ptr))->counter) \
177 : "a" (ptr), "d" (op_val), \
178 "m" (((atomic_t *)(ptr))->counter) \
179 : "cc", "memory" ); \
180 new_val; \
181})
182
183#endif /* __GNUC__ */
184
130#define atomic64_read(v) ((v)->counter) 185#define atomic64_read(v) ((v)->counter)
131#define atomic64_set(v,i) (((v)->counter) = (i)) 186#define atomic64_set(v,i) (((v)->counter) = (i))
132 187
@@ -163,10 +218,19 @@ static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v)
163static __inline__ long long atomic64_cmpxchg(atomic64_t *v, 218static __inline__ long long atomic64_cmpxchg(atomic64_t *v,
164 long long old, long long new) 219 long long old, long long new)
165{ 220{
166 __asm__ __volatile__(" csg %0,%3,0(%2)\n" 221#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
167 : "+d" (old), "=m" (v->counter) 222 asm volatile(
168 : "a" (v), "d" (new), "m" (v->counter) 223 " csg %0,%2,%1"
169 : "cc", "memory" ); 224 : "+d" (old), "=Q" (v->counter)
225 : "d" (new), "Q" (v->counter)
226 : "cc", "memory");
227#else /* __GNUC__ */
228 asm volatile(
229 " csg %0,%3,0(%2)"
230 : "+d" (old), "=m" (v->counter)
231 : "a" (v), "d" (new), "m" (v->counter)
232 : "cc", "memory");
233#endif /* __GNUC__ */
170 return old; 234 return old;
171} 235}
172 236
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 0ddcdba79e4a..f79c9b792af1 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -67,16 +67,35 @@ extern const char _sb_findmap[];
67#define __BITOPS_AND "nr" 67#define __BITOPS_AND "nr"
68#define __BITOPS_XOR "xr" 68#define __BITOPS_XOR "xr"
69 69
70#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 70#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
71 __asm__ __volatile__(" l %0,0(%4)\n" \ 71
72 "0: lr %1,%0\n" \ 72#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
73 __op_string " %1,%3\n" \ 73 asm volatile( \
74 " cs %0,%1,0(%4)\n" \ 74 " l %0,%2\n" \
75 " jl 0b" \ 75 "0: lr %1,%0\n" \
76 : "=&d" (__old), "=&d" (__new), \ 76 __op_string " %1,%3\n" \
77 "=m" (*(unsigned long *) __addr) \ 77 " cs %0,%1,%2\n" \
78 : "d" (__val), "a" (__addr), \ 78 " jl 0b" \
79 "m" (*(unsigned long *) __addr) : "cc" ); 79 : "=&d" (__old), "=&d" (__new), \
80 "=Q" (*(unsigned long *) __addr) \
81 : "d" (__val), "Q" (*(unsigned long *) __addr) \
82 : "cc");
83
84#else /* __GNUC__ */
85
86#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
87 asm volatile( \
88 " l %0,0(%4)\n" \
89 "0: lr %1,%0\n" \
90 __op_string " %1,%3\n" \
91 " cs %0,%1,0(%4)\n" \
92 " jl 0b" \
93 : "=&d" (__old), "=&d" (__new), \
94 "=m" (*(unsigned long *) __addr) \
95 : "d" (__val), "a" (__addr), \
96 "m" (*(unsigned long *) __addr) : "cc");
97
98#endif /* __GNUC__ */
80 99
81#else /* __s390x__ */ 100#else /* __s390x__ */
82 101
@@ -86,21 +105,41 @@ extern const char _sb_findmap[];
86#define __BITOPS_AND "ngr" 105#define __BITOPS_AND "ngr"
87#define __BITOPS_XOR "xgr" 106#define __BITOPS_XOR "xgr"
88 107
89#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 108#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
90 __asm__ __volatile__(" lg %0,0(%4)\n" \ 109
91 "0: lgr %1,%0\n" \ 110#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
92 __op_string " %1,%3\n" \ 111 asm volatile( \
93 " csg %0,%1,0(%4)\n" \ 112 " lg %0,%2\n" \
94 " jl 0b" \ 113 "0: lgr %1,%0\n" \
95 : "=&d" (__old), "=&d" (__new), \ 114 __op_string " %1,%3\n" \
96 "=m" (*(unsigned long *) __addr) \ 115 " csg %0,%1,%2\n" \
97 : "d" (__val), "a" (__addr), \ 116 " jl 0b" \
98 "m" (*(unsigned long *) __addr) : "cc" ); 117 : "=&d" (__old), "=&d" (__new), \
118 "=Q" (*(unsigned long *) __addr) \
119 : "d" (__val), "Q" (*(unsigned long *) __addr) \
120 : "cc");
121
122#else /* __GNUC__ */
123
124#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
125 asm volatile( \
126 " lg %0,0(%4)\n" \
127 "0: lgr %1,%0\n" \
128 __op_string " %1,%3\n" \
129 " csg %0,%1,0(%4)\n" \
130 " jl 0b" \
131 : "=&d" (__old), "=&d" (__new), \
132 "=m" (*(unsigned long *) __addr) \
133 : "d" (__val), "a" (__addr), \
134 "m" (*(unsigned long *) __addr) : "cc");
135
136
137#endif /* __GNUC__ */
99 138
100#endif /* __s390x__ */ 139#endif /* __s390x__ */
101 140
102#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE) 141#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
103#define __BITOPS_BARRIER() __asm__ __volatile__ ( "" : : : "memory" ) 142#define __BITOPS_BARRIER() asm volatile("" : : : "memory")
104 143
105#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
106/* 145/*
@@ -217,10 +256,10 @@ static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
217 unsigned long addr; 256 unsigned long addr;
218 257
219 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 258 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
220 asm volatile("oc 0(1,%1),0(%2)" 259 asm volatile(
221 : "=m" (*(char *) addr) 260 " oc 0(1,%1),0(%2)"
222 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 261 : "=m" (*(char *) addr) : "a" (addr),
223 "m" (*(char *) addr) : "cc" ); 262 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
224} 263}
225 264
226static inline void 265static inline void
@@ -229,40 +268,7 @@ __constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
229 unsigned long addr; 268 unsigned long addr;
230 269
231 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 270 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
232 switch (nr&7) { 271 *(unsigned char *) addr |= 1 << (nr & 7);
233 case 0:
234 asm volatile ("oi 0(%1),0x01" : "=m" (*(char *) addr)
235 : "a" (addr), "m" (*(char *) addr) : "cc" );
236 break;
237 case 1:
238 asm volatile ("oi 0(%1),0x02" : "=m" (*(char *) addr)
239 : "a" (addr), "m" (*(char *) addr) : "cc" );
240 break;
241 case 2:
242 asm volatile ("oi 0(%1),0x04" : "=m" (*(char *) addr)
243 : "a" (addr), "m" (*(char *) addr) : "cc" );
244 break;
245 case 3:
246 asm volatile ("oi 0(%1),0x08" : "=m" (*(char *) addr)
247 : "a" (addr), "m" (*(char *) addr) : "cc" );
248 break;
249 case 4:
250 asm volatile ("oi 0(%1),0x10" : "=m" (*(char *) addr)
251 : "a" (addr), "m" (*(char *) addr) : "cc" );
252 break;
253 case 5:
254 asm volatile ("oi 0(%1),0x20" : "=m" (*(char *) addr)
255 : "a" (addr), "m" (*(char *) addr) : "cc" );
256 break;
257 case 6:
258 asm volatile ("oi 0(%1),0x40" : "=m" (*(char *) addr)
259 : "a" (addr), "m" (*(char *) addr) : "cc" );
260 break;
261 case 7:
262 asm volatile ("oi 0(%1),0x80" : "=m" (*(char *) addr)
263 : "a" (addr), "m" (*(char *) addr) : "cc" );
264 break;
265 }
266} 272}
267 273
268#define set_bit_simple(nr,addr) \ 274#define set_bit_simple(nr,addr) \
@@ -279,10 +285,10 @@ __clear_bit(unsigned long nr, volatile unsigned long *ptr)
279 unsigned long addr; 285 unsigned long addr;
280 286
281 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 287 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
282 asm volatile("nc 0(1,%1),0(%2)" 288 asm volatile(
283 : "=m" (*(char *) addr) 289 " nc 0(1,%1),0(%2)"
284 : "a" (addr), "a" (_ni_bitmap + (nr & 7)), 290 : "=m" (*(char *) addr) : "a" (addr),
285 "m" (*(char *) addr) : "cc" ); 291 "a" (_ni_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc");
286} 292}
287 293
288static inline void 294static inline void
@@ -291,40 +297,7 @@ __constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
291 unsigned long addr; 297 unsigned long addr;
292 298
293 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 299 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
294 switch (nr&7) { 300 *(unsigned char *) addr &= ~(1 << (nr & 7));
295 case 0:
296 asm volatile ("ni 0(%1),0xFE" : "=m" (*(char *) addr)
297 : "a" (addr), "m" (*(char *) addr) : "cc" );
298 break;
299 case 1:
300 asm volatile ("ni 0(%1),0xFD": "=m" (*(char *) addr)
301 : "a" (addr), "m" (*(char *) addr) : "cc" );
302 break;
303 case 2:
304 asm volatile ("ni 0(%1),0xFB" : "=m" (*(char *) addr)
305 : "a" (addr), "m" (*(char *) addr) : "cc" );
306 break;
307 case 3:
308 asm volatile ("ni 0(%1),0xF7" : "=m" (*(char *) addr)
309 : "a" (addr), "m" (*(char *) addr) : "cc" );
310 break;
311 case 4:
312 asm volatile ("ni 0(%1),0xEF" : "=m" (*(char *) addr)
313 : "a" (addr), "m" (*(char *) addr) : "cc" );
314 break;
315 case 5:
316 asm volatile ("ni 0(%1),0xDF" : "=m" (*(char *) addr)
317 : "a" (addr), "m" (*(char *) addr) : "cc" );
318 break;
319 case 6:
320 asm volatile ("ni 0(%1),0xBF" : "=m" (*(char *) addr)
321 : "a" (addr), "m" (*(char *) addr) : "cc" );
322 break;
323 case 7:
324 asm volatile ("ni 0(%1),0x7F" : "=m" (*(char *) addr)
325 : "a" (addr), "m" (*(char *) addr) : "cc" );
326 break;
327 }
328} 301}
329 302
330#define clear_bit_simple(nr,addr) \ 303#define clear_bit_simple(nr,addr) \
@@ -340,10 +313,10 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
340 unsigned long addr; 313 unsigned long addr;
341 314
342 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 315 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
343 asm volatile("xc 0(1,%1),0(%2)" 316 asm volatile(
344 : "=m" (*(char *) addr) 317 " xc 0(1,%1),0(%2)"
345 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 318 : "=m" (*(char *) addr) : "a" (addr),
346 "m" (*(char *) addr) : "cc" ); 319 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
347} 320}
348 321
349static inline void 322static inline void
@@ -352,40 +325,7 @@ __constant_change_bit(const unsigned long nr, volatile unsigned long *ptr)
352 unsigned long addr; 325 unsigned long addr;
353 326
354 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 327 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
355 switch (nr&7) { 328 *(unsigned char *) addr ^= 1 << (nr & 7);
356 case 0:
357 asm volatile ("xi 0(%1),0x01" : "=m" (*(char *) addr)
358 : "a" (addr), "m" (*(char *) addr) : "cc" );
359 break;
360 case 1:
361 asm volatile ("xi 0(%1),0x02" : "=m" (*(char *) addr)
362 : "a" (addr), "m" (*(char *) addr) : "cc" );
363 break;
364 case 2:
365 asm volatile ("xi 0(%1),0x04" : "=m" (*(char *) addr)
366 : "a" (addr), "m" (*(char *) addr) : "cc" );
367 break;
368 case 3:
369 asm volatile ("xi 0(%1),0x08" : "=m" (*(char *) addr)
370 : "a" (addr), "m" (*(char *) addr) : "cc" );
371 break;
372 case 4:
373 asm volatile ("xi 0(%1),0x10" : "=m" (*(char *) addr)
374 : "a" (addr), "m" (*(char *) addr) : "cc" );
375 break;
376 case 5:
377 asm volatile ("xi 0(%1),0x20" : "=m" (*(char *) addr)
378 : "a" (addr), "m" (*(char *) addr) : "cc" );
379 break;
380 case 6:
381 asm volatile ("xi 0(%1),0x40" : "=m" (*(char *) addr)
382 : "a" (addr), "m" (*(char *) addr) : "cc" );
383 break;
384 case 7:
385 asm volatile ("xi 0(%1),0x80" : "=m" (*(char *) addr)
386 : "a" (addr), "m" (*(char *) addr) : "cc" );
387 break;
388 }
389} 329}
390 330
391#define change_bit_simple(nr,addr) \ 331#define change_bit_simple(nr,addr) \
@@ -404,10 +344,11 @@ test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
404 344
405 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 345 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
406 ch = *(unsigned char *) addr; 346 ch = *(unsigned char *) addr;
407 asm volatile("oc 0(1,%1),0(%2)" 347 asm volatile(
408 : "=m" (*(char *) addr) 348 " oc 0(1,%1),0(%2)"
409 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 349 : "=m" (*(char *) addr)
410 "m" (*(char *) addr) : "cc", "memory" ); 350 : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
351 "m" (*(char *) addr) : "cc", "memory");
411 return (ch >> (nr & 7)) & 1; 352 return (ch >> (nr & 7)) & 1;
412} 353}
413#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y) 354#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y)
@@ -423,10 +364,11 @@ test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
423 364
424 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 365 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
425 ch = *(unsigned char *) addr; 366 ch = *(unsigned char *) addr;
426 asm volatile("nc 0(1,%1),0(%2)" 367 asm volatile(
427 : "=m" (*(char *) addr) 368 " nc 0(1,%1),0(%2)"
428 : "a" (addr), "a" (_ni_bitmap + (nr & 7)), 369 : "=m" (*(char *) addr)
429 "m" (*(char *) addr) : "cc", "memory" ); 370 : "a" (addr), "a" (_ni_bitmap + (nr & 7)),
371 "m" (*(char *) addr) : "cc", "memory");
430 return (ch >> (nr & 7)) & 1; 372 return (ch >> (nr & 7)) & 1;
431} 373}
432#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y) 374#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y)
@@ -442,10 +384,11 @@ test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
442 384
443 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 385 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
444 ch = *(unsigned char *) addr; 386 ch = *(unsigned char *) addr;
445 asm volatile("xc 0(1,%1),0(%2)" 387 asm volatile(
446 : "=m" (*(char *) addr) 388 " xc 0(1,%1),0(%2)"
447 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 389 : "=m" (*(char *) addr)
448 "m" (*(char *) addr) : "cc", "memory" ); 390 : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
391 "m" (*(char *) addr) : "cc", "memory");
449 return (ch >> (nr & 7)) & 1; 392 return (ch >> (nr & 7)) & 1;
450} 393}
451#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y) 394#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y)
@@ -557,35 +500,36 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size)
557 500
558 if (!size) 501 if (!size)
559 return 0; 502 return 0;
560 __asm__(" lhi %1,-1\n" 503 asm volatile(
561 " lr %2,%3\n" 504 " lhi %1,-1\n"
562 " slr %0,%0\n" 505 " lr %2,%3\n"
563 " ahi %2,31\n" 506 " slr %0,%0\n"
564 " srl %2,5\n" 507 " ahi %2,31\n"
565 "0: c %1,0(%0,%4)\n" 508 " srl %2,5\n"
566 " jne 1f\n" 509 "0: c %1,0(%0,%4)\n"
567 " la %0,4(%0)\n" 510 " jne 1f\n"
568 " brct %2,0b\n" 511 " la %0,4(%0)\n"
569 " lr %0,%3\n" 512 " brct %2,0b\n"
570 " j 4f\n" 513 " lr %0,%3\n"
571 "1: l %2,0(%0,%4)\n" 514 " j 4f\n"
572 " sll %0,3\n" 515 "1: l %2,0(%0,%4)\n"
573 " lhi %1,0xff\n" 516 " sll %0,3\n"
574 " tml %2,0xffff\n" 517 " lhi %1,0xff\n"
575 " jno 2f\n" 518 " tml %2,0xffff\n"
576 " ahi %0,16\n" 519 " jno 2f\n"
577 " srl %2,16\n" 520 " ahi %0,16\n"
578 "2: tml %2,0x00ff\n" 521 " srl %2,16\n"
579 " jno 3f\n" 522 "2: tml %2,0x00ff\n"
580 " ahi %0,8\n" 523 " jno 3f\n"
581 " srl %2,8\n" 524 " ahi %0,8\n"
582 "3: nr %2,%1\n" 525 " srl %2,8\n"
583 " ic %2,0(%2,%5)\n" 526 "3: nr %2,%1\n"
584 " alr %0,%2\n" 527 " ic %2,0(%2,%5)\n"
585 "4:" 528 " alr %0,%2\n"
586 : "=&a" (res), "=&d" (cmp), "=&a" (count) 529 "4:"
587 : "a" (size), "a" (addr), "a" (&_zb_findmap), 530 : "=&a" (res), "=&d" (cmp), "=&a" (count)
588 "m" (*(addrtype *) addr) : "cc" ); 531 : "a" (size), "a" (addr), "a" (&_zb_findmap),
532 "m" (*(addrtype *) addr) : "cc");
589 return (res < size) ? res : size; 533 return (res < size) ? res : size;
590} 534}
591 535
@@ -598,35 +542,36 @@ find_first_bit(const unsigned long * addr, unsigned long size)
598 542
599 if (!size) 543 if (!size)
600 return 0; 544 return 0;
601 __asm__(" slr %1,%1\n" 545 asm volatile(
602 " lr %2,%3\n" 546 " slr %1,%1\n"
603 " slr %0,%0\n" 547 " lr %2,%3\n"
604 " ahi %2,31\n" 548 " slr %0,%0\n"
605 " srl %2,5\n" 549 " ahi %2,31\n"
606 "0: c %1,0(%0,%4)\n" 550 " srl %2,5\n"
607 " jne 1f\n" 551 "0: c %1,0(%0,%4)\n"
608 " la %0,4(%0)\n" 552 " jne 1f\n"
609 " brct %2,0b\n" 553 " la %0,4(%0)\n"
610 " lr %0,%3\n" 554 " brct %2,0b\n"
611 " j 4f\n" 555 " lr %0,%3\n"
612 "1: l %2,0(%0,%4)\n" 556 " j 4f\n"
613 " sll %0,3\n" 557 "1: l %2,0(%0,%4)\n"
614 " lhi %1,0xff\n" 558 " sll %0,3\n"
615 " tml %2,0xffff\n" 559 " lhi %1,0xff\n"
616 " jnz 2f\n" 560 " tml %2,0xffff\n"
617 " ahi %0,16\n" 561 " jnz 2f\n"
618 " srl %2,16\n" 562 " ahi %0,16\n"
619 "2: tml %2,0x00ff\n" 563 " srl %2,16\n"
620 " jnz 3f\n" 564 "2: tml %2,0x00ff\n"
621 " ahi %0,8\n" 565 " jnz 3f\n"
622 " srl %2,8\n" 566 " ahi %0,8\n"
623 "3: nr %2,%1\n" 567 " srl %2,8\n"
624 " ic %2,0(%2,%5)\n" 568 "3: nr %2,%1\n"
625 " alr %0,%2\n" 569 " ic %2,0(%2,%5)\n"
626 "4:" 570 " alr %0,%2\n"
627 : "=&a" (res), "=&d" (cmp), "=&a" (count) 571 "4:"
628 : "a" (size), "a" (addr), "a" (&_sb_findmap), 572 : "=&a" (res), "=&d" (cmp), "=&a" (count)
629 "m" (*(addrtype *) addr) : "cc" ); 573 : "a" (size), "a" (addr), "a" (&_sb_findmap),
574 "m" (*(addrtype *) addr) : "cc");
630 return (res < size) ? res : size; 575 return (res < size) ? res : size;
631} 576}
632 577
@@ -640,39 +585,40 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size)
640 585
641 if (!size) 586 if (!size)
642 return 0; 587 return 0;
643 __asm__(" lghi %1,-1\n" 588 asm volatile(
644 " lgr %2,%3\n" 589 " lghi %1,-1\n"
645 " slgr %0,%0\n" 590 " lgr %2,%3\n"
646 " aghi %2,63\n" 591 " slgr %0,%0\n"
647 " srlg %2,%2,6\n" 592 " aghi %2,63\n"
648 "0: cg %1,0(%0,%4)\n" 593 " srlg %2,%2,6\n"
649 " jne 1f\n" 594 "0: cg %1,0(%0,%4)\n"
650 " la %0,8(%0)\n" 595 " jne 1f\n"
651 " brct %2,0b\n" 596 " la %0,8(%0)\n"
652 " lgr %0,%3\n" 597 " brct %2,0b\n"
653 " j 5f\n" 598 " lgr %0,%3\n"
654 "1: lg %2,0(%0,%4)\n" 599 " j 5f\n"
655 " sllg %0,%0,3\n" 600 "1: lg %2,0(%0,%4)\n"
656 " clr %2,%1\n" 601 " sllg %0,%0,3\n"
657 " jne 2f\n" 602 " clr %2,%1\n"
658 " aghi %0,32\n" 603 " jne 2f\n"
659 " srlg %2,%2,32\n" 604 " aghi %0,32\n"
660 "2: lghi %1,0xff\n" 605 " srlg %2,%2,32\n"
661 " tmll %2,0xffff\n" 606 "2: lghi %1,0xff\n"
662 " jno 3f\n" 607 " tmll %2,0xffff\n"
663 " aghi %0,16\n" 608 " jno 3f\n"
664 " srl %2,16\n" 609 " aghi %0,16\n"
665 "3: tmll %2,0x00ff\n" 610 " srl %2,16\n"
666 " jno 4f\n" 611 "3: tmll %2,0x00ff\n"
667 " aghi %0,8\n" 612 " jno 4f\n"
668 " srl %2,8\n" 613 " aghi %0,8\n"
669 "4: ngr %2,%1\n" 614 " srl %2,8\n"
670 " ic %2,0(%2,%5)\n" 615 "4: ngr %2,%1\n"
671 " algr %0,%2\n" 616 " ic %2,0(%2,%5)\n"
672 "5:" 617 " algr %0,%2\n"
673 : "=&a" (res), "=&d" (cmp), "=&a" (count) 618 "5:"
619 : "=&a" (res), "=&d" (cmp), "=&a" (count)
674 : "a" (size), "a" (addr), "a" (&_zb_findmap), 620 : "a" (size), "a" (addr), "a" (&_zb_findmap),
675 "m" (*(addrtype *) addr) : "cc" ); 621 "m" (*(addrtype *) addr) : "cc");
676 return (res < size) ? res : size; 622 return (res < size) ? res : size;
677} 623}
678 624
@@ -684,39 +630,40 @@ find_first_bit(const unsigned long * addr, unsigned long size)
684 630
685 if (!size) 631 if (!size)
686 return 0; 632 return 0;
687 __asm__(" slgr %1,%1\n" 633 asm volatile(
688 " lgr %2,%3\n" 634 " slgr %1,%1\n"
689 " slgr %0,%0\n" 635 " lgr %2,%3\n"
690 " aghi %2,63\n" 636 " slgr %0,%0\n"
691 " srlg %2,%2,6\n" 637 " aghi %2,63\n"
692 "0: cg %1,0(%0,%4)\n" 638 " srlg %2,%2,6\n"
693 " jne 1f\n" 639 "0: cg %1,0(%0,%4)\n"
694 " aghi %0,8\n" 640 " jne 1f\n"
695 " brct %2,0b\n" 641 " aghi %0,8\n"
696 " lgr %0,%3\n" 642 " brct %2,0b\n"
697 " j 5f\n" 643 " lgr %0,%3\n"
698 "1: lg %2,0(%0,%4)\n" 644 " j 5f\n"
699 " sllg %0,%0,3\n" 645 "1: lg %2,0(%0,%4)\n"
700 " clr %2,%1\n" 646 " sllg %0,%0,3\n"
701 " jne 2f\n" 647 " clr %2,%1\n"
702 " aghi %0,32\n" 648 " jne 2f\n"
703 " srlg %2,%2,32\n" 649 " aghi %0,32\n"
704 "2: lghi %1,0xff\n" 650 " srlg %2,%2,32\n"
705 " tmll %2,0xffff\n" 651 "2: lghi %1,0xff\n"
706 " jnz 3f\n" 652 " tmll %2,0xffff\n"
707 " aghi %0,16\n" 653 " jnz 3f\n"
708 " srl %2,16\n" 654 " aghi %0,16\n"
709 "3: tmll %2,0x00ff\n" 655 " srl %2,16\n"
710 " jnz 4f\n" 656 "3: tmll %2,0x00ff\n"
711 " aghi %0,8\n" 657 " jnz 4f\n"
712 " srl %2,8\n" 658 " aghi %0,8\n"
713 "4: ngr %2,%1\n" 659 " srl %2,8\n"
714 " ic %2,0(%2,%5)\n" 660 "4: ngr %2,%1\n"
715 " algr %0,%2\n" 661 " ic %2,0(%2,%5)\n"
716 "5:" 662 " algr %0,%2\n"
717 : "=&a" (res), "=&d" (cmp), "=&a" (count) 663 "5:"
664 : "=&a" (res), "=&d" (cmp), "=&a" (count)
718 : "a" (size), "a" (addr), "a" (&_sb_findmap), 665 : "a" (size), "a" (addr), "a" (&_sb_findmap),
719 "m" (*(addrtype *) addr) : "cc" ); 666 "m" (*(addrtype *) addr) : "cc");
720 return (res < size) ? res : size; 667 return (res < size) ? res : size;
721} 668}
722 669
@@ -832,36 +779,37 @@ ext2_find_first_zero_bit(void *vaddr, unsigned int size)
832 779
833 if (!size) 780 if (!size)
834 return 0; 781 return 0;
835 __asm__(" lhi %1,-1\n" 782 asm volatile(
836 " lr %2,%3\n" 783 " lhi %1,-1\n"
837 " ahi %2,31\n" 784 " lr %2,%3\n"
838 " srl %2,5\n" 785 " ahi %2,31\n"
839 " slr %0,%0\n" 786 " srl %2,5\n"
840 "0: cl %1,0(%0,%4)\n" 787 " slr %0,%0\n"
841 " jne 1f\n" 788 "0: cl %1,0(%0,%4)\n"
842 " ahi %0,4\n" 789 " jne 1f\n"
843 " brct %2,0b\n" 790 " ahi %0,4\n"
844 " lr %0,%3\n" 791 " brct %2,0b\n"
845 " j 4f\n" 792 " lr %0,%3\n"
846 "1: l %2,0(%0,%4)\n" 793 " j 4f\n"
847 " sll %0,3\n" 794 "1: l %2,0(%0,%4)\n"
848 " ahi %0,24\n" 795 " sll %0,3\n"
849 " lhi %1,0xff\n" 796 " ahi %0,24\n"
850 " tmh %2,0xffff\n" 797 " lhi %1,0xff\n"
851 " jo 2f\n" 798 " tmh %2,0xffff\n"
852 " ahi %0,-16\n" 799 " jo 2f\n"
853 " srl %2,16\n" 800 " ahi %0,-16\n"
854 "2: tml %2,0xff00\n" 801 " srl %2,16\n"
855 " jo 3f\n" 802 "2: tml %2,0xff00\n"
856 " ahi %0,-8\n" 803 " jo 3f\n"
857 " srl %2,8\n" 804 " ahi %0,-8\n"
858 "3: nr %2,%1\n" 805 " srl %2,8\n"
859 " ic %2,0(%2,%5)\n" 806 "3: nr %2,%1\n"
860 " alr %0,%2\n" 807 " ic %2,0(%2,%5)\n"
861 "4:" 808 " alr %0,%2\n"
862 : "=&a" (res), "=&d" (cmp), "=&a" (count) 809 "4:"
863 : "a" (size), "a" (vaddr), "a" (&_zb_findmap), 810 : "=&a" (res), "=&d" (cmp), "=&a" (count)
864 "m" (*(addrtype *) vaddr) : "cc" ); 811 : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
812 "m" (*(addrtype *) vaddr) : "cc");
865 return (res < size) ? res : size; 813 return (res < size) ? res : size;
866} 814}
867 815
@@ -875,39 +823,40 @@ ext2_find_first_zero_bit(void *vaddr, unsigned long size)
875 823
876 if (!size) 824 if (!size)
877 return 0; 825 return 0;
878 __asm__(" lghi %1,-1\n" 826 asm volatile(
879 " lgr %2,%3\n" 827 " lghi %1,-1\n"
880 " aghi %2,63\n" 828 " lgr %2,%3\n"
881 " srlg %2,%2,6\n" 829 " aghi %2,63\n"
882 " slgr %0,%0\n" 830 " srlg %2,%2,6\n"
883 "0: clg %1,0(%0,%4)\n" 831 " slgr %0,%0\n"
884 " jne 1f\n" 832 "0: clg %1,0(%0,%4)\n"
885 " aghi %0,8\n" 833 " jne 1f\n"
886 " brct %2,0b\n" 834 " aghi %0,8\n"
887 " lgr %0,%3\n" 835 " brct %2,0b\n"
888 " j 5f\n" 836 " lgr %0,%3\n"
889 "1: cl %1,0(%0,%4)\n" 837 " j 5f\n"
890 " jne 2f\n" 838 "1: cl %1,0(%0,%4)\n"
891 " aghi %0,4\n" 839 " jne 2f\n"
892 "2: l %2,0(%0,%4)\n" 840 " aghi %0,4\n"
893 " sllg %0,%0,3\n" 841 "2: l %2,0(%0,%4)\n"
894 " aghi %0,24\n" 842 " sllg %0,%0,3\n"
895 " lghi %1,0xff\n" 843 " aghi %0,24\n"
896 " tmlh %2,0xffff\n" 844 " lghi %1,0xff\n"
897 " jo 3f\n" 845 " tmlh %2,0xffff\n"
898 " aghi %0,-16\n" 846 " jo 3f\n"
899 " srl %2,16\n" 847 " aghi %0,-16\n"
900 "3: tmll %2,0xff00\n" 848 " srl %2,16\n"
901 " jo 4f\n" 849 "3: tmll %2,0xff00\n"
902 " aghi %0,-8\n" 850 " jo 4f\n"
903 " srl %2,8\n" 851 " aghi %0,-8\n"
904 "4: ngr %2,%1\n" 852 " srl %2,8\n"
905 " ic %2,0(%2,%5)\n" 853 "4: ngr %2,%1\n"
906 " algr %0,%2\n" 854 " ic %2,0(%2,%5)\n"
907 "5:" 855 " algr %0,%2\n"
908 : "=&a" (res), "=&d" (cmp), "=&a" (count) 856 "5:"
857 : "=&a" (res), "=&d" (cmp), "=&a" (count)
909 : "a" (size), "a" (vaddr), "a" (&_zb_findmap), 858 : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
910 "m" (*(addrtype *) vaddr) : "cc" ); 859 "m" (*(addrtype *) vaddr) : "cc");
911 return (res < size) ? res : size; 860 return (res < size) ? res : size;
912} 861}
913 862
@@ -927,13 +876,16 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
927 p = addr + offset / __BITOPS_WORDSIZE; 876 p = addr + offset / __BITOPS_WORDSIZE;
928 if (bit) { 877 if (bit) {
929#ifndef __s390x__ 878#ifndef __s390x__
930 asm(" ic %0,0(%1)\n" 879 asm volatile(
931 " icm %0,2,1(%1)\n" 880 " ic %0,0(%1)\n"
932 " icm %0,4,2(%1)\n" 881 " icm %0,2,1(%1)\n"
933 " icm %0,8,3(%1)" 882 " icm %0,4,2(%1)\n"
934 : "=&a" (word) : "a" (p), "m" (*p) : "cc" ); 883 " icm %0,8,3(%1)"
884 : "=&a" (word) : "a" (p), "m" (*p) : "cc");
935#else 885#else
936 asm(" lrvg %0,%1" : "=a" (word) : "m" (*p) ); 886 asm volatile(
887 " lrvg %0,%1"
888 : "=a" (word) : "m" (*p) );
937#endif 889#endif
938 /* 890 /*
939 * s390 version of ffz returns __BITOPS_WORDSIZE 891 * s390 version of ffz returns __BITOPS_WORDSIZE
diff --git a/include/asm-s390/byteorder.h b/include/asm-s390/byteorder.h
index 2cc35a0e188e..1fe2492baa8d 100644
--- a/include/asm-s390/byteorder.h
+++ b/include/asm-s390/byteorder.h
@@ -14,60 +14,54 @@
14#ifdef __GNUC__ 14#ifdef __GNUC__
15 15
16#ifdef __s390x__ 16#ifdef __s390x__
17static __inline__ __u64 ___arch__swab64p(const __u64 *x) 17static inline __u64 ___arch__swab64p(const __u64 *x)
18{ 18{
19 __u64 result; 19 __u64 result;
20 20
21 __asm__ __volatile__ ( 21 asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
22 " lrvg %0,%1"
23 : "=d" (result) : "m" (*x) );
24 return result; 22 return result;
25} 23}
26 24
27static __inline__ __u64 ___arch__swab64(__u64 x) 25static inline __u64 ___arch__swab64(__u64 x)
28{ 26{
29 __u64 result; 27 __u64 result;
30 28
31 __asm__ __volatile__ ( 29 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
32 " lrvgr %0,%1"
33 : "=d" (result) : "d" (x) );
34 return result; 30 return result;
35} 31}
36 32
37static __inline__ void ___arch__swab64s(__u64 *x) 33static inline void ___arch__swab64s(__u64 *x)
38{ 34{
39 *x = ___arch__swab64p(x); 35 *x = ___arch__swab64p(x);
40} 36}
41#endif /* __s390x__ */ 37#endif /* __s390x__ */
42 38
43static __inline__ __u32 ___arch__swab32p(const __u32 *x) 39static inline __u32 ___arch__swab32p(const __u32 *x)
44{ 40{
45 __u32 result; 41 __u32 result;
46 42
47 __asm__ __volatile__ ( 43 asm volatile(
48#ifndef __s390x__ 44#ifndef __s390x__
49 " icm %0,8,3(%1)\n" 45 " icm %0,8,3(%1)\n"
50 " icm %0,4,2(%1)\n" 46 " icm %0,4,2(%1)\n"
51 " icm %0,2,1(%1)\n" 47 " icm %0,2,1(%1)\n"
52 " ic %0,0(%1)" 48 " ic %0,0(%1)"
53 : "=&d" (result) : "a" (x), "m" (*x) : "cc" ); 49 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
54#else /* __s390x__ */ 50#else /* __s390x__ */
55 " lrv %0,%1" 51 " lrv %0,%1"
56 : "=d" (result) : "m" (*x) ); 52 : "=d" (result) : "m" (*x));
57#endif /* __s390x__ */ 53#endif /* __s390x__ */
58 return result; 54 return result;
59} 55}
60 56
61static __inline__ __u32 ___arch__swab32(__u32 x) 57static inline __u32 ___arch__swab32(__u32 x)
62{ 58{
63#ifndef __s390x__ 59#ifndef __s390x__
64 return ___arch__swab32p(&x); 60 return ___arch__swab32p(&x);
65#else /* __s390x__ */ 61#else /* __s390x__ */
66 __u32 result; 62 __u32 result;
67 63
68 __asm__ __volatile__ ( 64 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x));
69 " lrvr %0,%1"
70 : "=d" (result) : "d" (x) );
71 return result; 65 return result;
72#endif /* __s390x__ */ 66#endif /* __s390x__ */
73} 67}
@@ -81,14 +75,14 @@ static __inline__ __u16 ___arch__swab16p(const __u16 *x)
81{ 75{
82 __u16 result; 76 __u16 result;
83 77
84 __asm__ __volatile__ ( 78 asm volatile(
85#ifndef __s390x__ 79#ifndef __s390x__
86 " icm %0,2,1(%1)\n" 80 " icm %0,2,1(%1)\n"
87 " ic %0,0(%1)\n" 81 " ic %0,0(%1)\n"
88 : "=&d" (result) : "a" (x), "m" (*x) : "cc" ); 82 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
89#else /* __s390x__ */ 83#else /* __s390x__ */
90 " lrvh %0,%1" 84 " lrvh %0,%1"
91 : "=d" (result) : "m" (*x) ); 85 : "=d" (result) : "m" (*x));
92#endif /* __s390x__ */ 86#endif /* __s390x__ */
93 return result; 87 return result;
94} 88}
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 471f2af2b16a..37c362d89fad 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -30,57 +30,13 @@
30static inline unsigned int 30static inline unsigned int
31csum_partial(const unsigned char * buff, int len, unsigned int sum) 31csum_partial(const unsigned char * buff, int len, unsigned int sum)
32{ 32{
33 /* 33 register unsigned long reg2 asm("2") = (unsigned long) buff;
34 * Experiments with ethernet and slip connections show that buf 34 register unsigned long reg3 asm("3") = (unsigned long) len;
35 * is aligned on either a 2-byte or 4-byte boundary.
36 */
37#ifndef __s390x__
38 register_pair rp;
39
40 rp.subreg.even = (unsigned long) buff;
41 rp.subreg.odd = (unsigned long) len;
42 __asm__ __volatile__ (
43 "0: cksm %0,%1\n" /* do checksum on longs */
44 " jo 0b\n"
45 : "+&d" (sum), "+&a" (rp) : : "cc", "memory" );
46#else /* __s390x__ */
47 __asm__ __volatile__ (
48 " lgr 2,%1\n" /* address in gpr 2 */
49 " lgfr 3,%2\n" /* length in gpr 3 */
50 "0: cksm %0,2\n" /* do checksum on longs */
51 " jo 0b\n"
52 : "+&d" (sum)
53 : "d" (buff), "d" (len)
54 : "cc", "memory", "2", "3" );
55#endif /* __s390x__ */
56 return sum;
57}
58
59/*
60 * csum_partial as an inline function
61 */
62static inline unsigned int
63csum_partial_inline(const unsigned char * buff, int len, unsigned int sum)
64{
65#ifndef __s390x__
66 register_pair rp;
67 35
68 rp.subreg.even = (unsigned long) buff; 36 asm volatile(
69 rp.subreg.odd = (unsigned long) len; 37 "0: cksm %0,%1\n" /* do checksum on longs */
70 __asm__ __volatile__ ( 38 " jo 0b\n"
71 "0: cksm %0,%1\n" /* do checksum on longs */ 39 : "+d" (sum), "+d" (reg2), "+d" (reg3) : : "cc", "memory");
72 " jo 0b\n"
73 : "+&d" (sum), "+&a" (rp) : : "cc", "memory" );
74#else /* __s390x__ */
75 __asm__ __volatile__ (
76 " lgr 2,%1\n" /* address in gpr 2 */
77 " lgfr 3,%2\n" /* length in gpr 3 */
78 "0: cksm %0,2\n" /* do checksum on longs */
79 " jo 0b\n"
80 : "+&d" (sum)
81 : "d" (buff), "d" (len)
82 : "cc", "memory", "2", "3" );
83#endif /* __s390x__ */
84 return sum; 40 return sum;
85} 41}
86 42
@@ -114,7 +70,7 @@ static inline unsigned int
114csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) 70csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum)
115{ 71{
116 memcpy(dst,src,len); 72 memcpy(dst,src,len);
117 return csum_partial_inline(dst, len, sum); 73 return csum_partial(dst, len, sum);
118} 74}
119 75
120/* 76/*
@@ -126,22 +82,22 @@ csum_fold(unsigned int sum)
126#ifndef __s390x__ 82#ifndef __s390x__
127 register_pair rp; 83 register_pair rp;
128 84
129 __asm__ __volatile__ ( 85 asm volatile(
130 " slr %N1,%N1\n" /* %0 = H L */ 86 " slr %N1,%N1\n" /* %0 = H L */
131 " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */ 87 " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */
132 " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */ 88 " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */
133 " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */ 89 " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */
134 " alr %0,%1\n" /* %0 = H+L+C L+H */ 90 " alr %0,%1\n" /* %0 = H+L+C L+H */
135 " srl %0,16\n" /* %0 = H+L+C */ 91 " srl %0,16\n" /* %0 = H+L+C */
136 : "+&d" (sum), "=d" (rp) : : "cc" ); 92 : "+&d" (sum), "=d" (rp) : : "cc");
137#else /* __s390x__ */ 93#else /* __s390x__ */
138 __asm__ __volatile__ ( 94 asm volatile(
139 " sr 3,3\n" /* %0 = H*65536 + L */ 95 " sr 3,3\n" /* %0 = H*65536 + L */
140 " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */ 96 " lr 2,%0\n" /* %0 = H L, 2/3 = H L / 0 0 */
141 " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */ 97 " srdl 2,16\n" /* %0 = H L, 2/3 = 0 H / L 0 */
142 " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */ 98 " alr 2,3\n" /* %0 = H L, 2/3 = L H / L 0 */
143 " alr %0,2\n" /* %0 = H+L+C L+H */ 99 " alr %0,2\n" /* %0 = H+L+C L+H */
144 " srl %0,16\n" /* %0 = H+L+C */ 100 " srl %0,16\n" /* %0 = H+L+C */
145 : "+&d" (sum) : : "cc", "2", "3"); 101 : "+&d" (sum) : : "cc", "2", "3");
146#endif /* __s390x__ */ 102#endif /* __s390x__ */
147 return ((unsigned short) ~sum); 103 return ((unsigned short) ~sum);
@@ -155,29 +111,7 @@ csum_fold(unsigned int sum)
155static inline unsigned short 111static inline unsigned short
156ip_fast_csum(unsigned char *iph, unsigned int ihl) 112ip_fast_csum(unsigned char *iph, unsigned int ihl)
157{ 113{
158 unsigned long sum; 114 return csum_fold(csum_partial(iph, ihl*4, 0));
159#ifndef __s390x__
160 register_pair rp;
161
162 rp.subreg.even = (unsigned long) iph;
163 rp.subreg.odd = (unsigned long) ihl*4;
164 __asm__ __volatile__ (
165 " sr %0,%0\n" /* set sum to zero */
166 "0: cksm %0,%1\n" /* do checksum on longs */
167 " jo 0b\n"
168 : "=&d" (sum), "+&a" (rp) : : "cc", "memory" );
169#else /* __s390x__ */
170 __asm__ __volatile__ (
171 " slgr %0,%0\n" /* set sum to zero */
172 " lgr 2,%1\n" /* address in gpr 2 */
173 " lgfr 3,%2\n" /* length in gpr 3 */
174 "0: cksm %0,2\n" /* do checksum on ints */
175 " jo 0b\n"
176 : "=&d" (sum)
177 : "d" (iph), "d" (ihl*4)
178 : "cc", "memory", "2", "3" );
179#endif /* __s390x__ */
180 return csum_fold(sum);
181} 115}
182 116
183/* 117/*
@@ -190,47 +124,47 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
190 unsigned int sum) 124 unsigned int sum)
191{ 125{
192#ifndef __s390x__ 126#ifndef __s390x__
193 __asm__ __volatile__ ( 127 asm volatile(
194 " alr %0,%1\n" /* sum += saddr */ 128 " alr %0,%1\n" /* sum += saddr */
195 " brc 12,0f\n" 129 " brc 12,0f\n"
196 " ahi %0,1\n" /* add carry */ 130 " ahi %0,1\n" /* add carry */
197 "0:" 131 "0:"
198 : "+&d" (sum) : "d" (saddr) : "cc" ); 132 : "+&d" (sum) : "d" (saddr) : "cc");
199 __asm__ __volatile__ ( 133 asm volatile(
200 " alr %0,%1\n" /* sum += daddr */ 134 " alr %0,%1\n" /* sum += daddr */
201 " brc 12,1f\n" 135 " brc 12,1f\n"
202 " ahi %0,1\n" /* add carry */ 136 " ahi %0,1\n" /* add carry */
203 "1:" 137 "1:"
204 : "+&d" (sum) : "d" (daddr) : "cc" ); 138 : "+&d" (sum) : "d" (daddr) : "cc");
205 __asm__ __volatile__ ( 139 asm volatile(
206 " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */ 140 " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */
207 " brc 12,2f\n" 141 " brc 12,2f\n"
208 " ahi %0,1\n" /* add carry */ 142 " ahi %0,1\n" /* add carry */
209 "2:" 143 "2:"
210 : "+&d" (sum) 144 : "+&d" (sum)
211 : "d" (((unsigned int) len<<16) + (unsigned int) proto) 145 : "d" (((unsigned int) len<<16) + (unsigned int) proto)
212 : "cc" ); 146 : "cc");
213#else /* __s390x__ */ 147#else /* __s390x__ */
214 __asm__ __volatile__ ( 148 asm volatile(
215 " lgfr %0,%0\n" 149 " lgfr %0,%0\n"
216 " algr %0,%1\n" /* sum += saddr */ 150 " algr %0,%1\n" /* sum += saddr */
217 " brc 12,0f\n" 151 " brc 12,0f\n"
218 " aghi %0,1\n" /* add carry */ 152 " aghi %0,1\n" /* add carry */
219 "0: algr %0,%2\n" /* sum += daddr */ 153 "0: algr %0,%2\n" /* sum += daddr */
220 " brc 12,1f\n" 154 " brc 12,1f\n"
221 " aghi %0,1\n" /* add carry */ 155 " aghi %0,1\n" /* add carry */
222 "1: algfr %0,%3\n" /* sum += (len<<16) + proto */ 156 "1: algfr %0,%3\n" /* sum += (len<<16) + proto */
223 " brc 12,2f\n" 157 " brc 12,2f\n"
224 " aghi %0,1\n" /* add carry */ 158 " aghi %0,1\n" /* add carry */
225 "2: srlg 0,%0,32\n" 159 "2: srlg 0,%0,32\n"
226 " alr %0,0\n" /* fold to 32 bits */ 160 " alr %0,0\n" /* fold to 32 bits */
227 " brc 12,3f\n" 161 " brc 12,3f\n"
228 " ahi %0,1\n" /* add carry */ 162 " ahi %0,1\n" /* add carry */
229 "3: llgfr %0,%0" 163 "3: llgfr %0,%0"
230 : "+&d" (sum) 164 : "+&d" (sum)
231 : "d" (saddr), "d" (daddr), 165 : "d" (saddr), "d" (daddr),
232 "d" (((unsigned int) len<<16) + (unsigned int) proto) 166 "d" (((unsigned int) len<<16) + (unsigned int) proto)
233 : "cc", "0" ); 167 : "cc", "0");
234#endif /* __s390x__ */ 168#endif /* __s390x__ */
235 return sum; 169 return sum;
236} 170}
diff --git a/include/asm-s390/div64.h b/include/asm-s390/div64.h
index af098dc3cf59..6cd978cefb28 100644
--- a/include/asm-s390/div64.h
+++ b/include/asm-s390/div64.h
@@ -1,49 +1 @@
1#ifndef __S390_DIV64
2#define __S390_DIV64
3
4#ifndef __s390x__
5
6/* for do_div "base" needs to be smaller than 2^31-1 */
7#define do_div(n, base) ({ \
8 unsigned long long __n = (n); \
9 unsigned long __r; \
10 \
11 asm (" slr 0,0\n" \
12 " l 1,%1\n" \
13 " srdl 0,1\n" \
14 " dr 0,%2\n" \
15 " alr 1,1\n" \
16 " alr 0,0\n" \
17 " lhi 2,1\n" \
18 " n 2,%1\n" \
19 " alr 0,2\n" \
20 " clr 0,%2\n" \
21 " jl 0f\n" \
22 " slr 0,%2\n" \
23 " ahi 1,1\n" \
24 "0: st 1,%1\n" \
25 " l 1,4+%1\n" \
26 " srdl 0,1\n" \
27 " dr 0,%2\n" \
28 " alr 1,1\n" \
29 " alr 0,0\n" \
30 " lhi 2,1\n" \
31 " n 2,4+%1\n" \
32 " alr 0,2\n" \
33 " clr 0,%2\n" \
34 " jl 1f\n" \
35 " slr 0,%2\n" \
36 " ahi 1,1\n" \
37 "1: st 1,4+%1\n" \
38 " lr %0,0" \
39 : "=d" (__r), "=m" (__n) \
40 : "d" (base), "m" (__n) : "0", "1", "2", "cc" ); \
41 (n) = (__n); \
42 __r; \
43})
44
45#else /* __s390x__ */
46#include <asm-generic/div64.h> #include <asm-generic/div64.h>
47#endif /* __s390x__ */
48
49#endif
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h
index 15fd2eda6c90..7f6f641d32f4 100644
--- a/include/asm-s390/ebcdic.h
+++ b/include/asm-s390/ebcdic.h
@@ -26,16 +26,16 @@ codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
26{ 26{
27 if (nr-- <= 0) 27 if (nr-- <= 0)
28 return; 28 return;
29 __asm__ __volatile__( 29 asm volatile(
30 " bras 1,1f\n" 30 " bras 1,1f\n"
31 " tr 0(1,%0),0(%2)\n" 31 " tr 0(1,%0),0(%2)\n"
32 "0: tr 0(256,%0),0(%2)\n" 32 "0: tr 0(256,%0),0(%2)\n"
33 " la %0,256(%0)\n" 33 " la %0,256(%0)\n"
34 "1: ahi %1,-256\n" 34 "1: ahi %1,-256\n"
35 " jnm 0b\n" 35 " jnm 0b\n"
36 " ex %1,0(1)" 36 " ex %1,0(1)"
37 : "+&a" (addr), "+&a" (nr) 37 : "+&a" (addr), "+&a" (nr)
38 : "a" (codepage) : "cc", "memory", "1" ); 38 : "a" (codepage) : "cc", "memory", "1");
39} 39}
40 40
41#define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr) 41#define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr)
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index a6cc27e77007..efb7de9c1c6b 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -27,18 +27,16 @@
27static inline unsigned long virt_to_phys(volatile void * address) 27static inline unsigned long virt_to_phys(volatile void * address)
28{ 28{
29 unsigned long real_address; 29 unsigned long real_address;
30 __asm__ ( 30 asm volatile(
31#ifndef __s390x__ 31#ifndef __s390x__
32 " lra %0,0(%1)\n" 32 " lra %0,0(%1)\n"
33 " jz 0f\n"
34 " sr %0,%0\n"
35#else /* __s390x__ */ 33#else /* __s390x__ */
36 " lrag %0,0(%1)\n" 34 " lrag %0,0(%1)\n"
37 " jz 0f\n"
38 " slgr %0,%0\n"
39#endif /* __s390x__ */ 35#endif /* __s390x__ */
36 " jz 0f\n"
37 " la %0,0\n"
40 "0:" 38 "0:"
41 : "=a" (real_address) : "a" (address) : "cc" ); 39 : "=a" (real_address) : "a" (address) : "cc");
42 return real_address; 40 return real_address;
43} 41}
44 42
@@ -47,11 +45,6 @@ static inline void * phys_to_virt(unsigned long address)
47 return __io_virt(address); 45 return __io_virt(address);
48} 46}
49 47
50/*
51 * Change "struct page" to physical address.
52 */
53#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
54
55extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); 48extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
56 49
57static inline void * ioremap (unsigned long offset, unsigned long size) 50static inline void * ioremap (unsigned long offset, unsigned long size)
diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h
index bd1a721f7aa2..7da991a858f8 100644
--- a/include/asm-s390/irq.h
+++ b/include/asm-s390/irq.h
@@ -19,8 +19,5 @@ enum interruption_class {
19 NR_IRQS, 19 NR_IRQS,
20}; 20};
21 21
22#define touch_nmi_watchdog() do { } while(0)
23
24#endif /* __KERNEL__ */ 22#endif /* __KERNEL__ */
25#endif 23#endif
26
diff --git a/include/asm-s390/irqflags.h b/include/asm-s390/irqflags.h
index 3b566a5b3cc7..3f26131120b7 100644
--- a/include/asm-s390/irqflags.h
+++ b/include/asm-s390/irqflags.h
@@ -10,43 +10,93 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
14
15/* store then or system mask. */
16#define __raw_local_irq_stosm(__or) \
17({ \
18 unsigned long __mask; \
19 asm volatile( \
20 " stosm %0,%1" \
21 : "=Q" (__mask) : "i" (__or) : "memory"); \
22 __mask; \
23})
24
25/* store then and system mask. */
26#define __raw_local_irq_stnsm(__and) \
27({ \
28 unsigned long __mask; \
29 asm volatile( \
30 " stnsm %0,%1" \
31 : "=Q" (__mask) : "i" (__and) : "memory"); \
32 __mask; \
33})
34
35/* set system mask. */
36#define __raw_local_irq_ssm(__mask) \
37({ \
38 asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \
39})
40
41#else /* __GNUC__ */
42
43/* store then or system mask. */
44#define __raw_local_irq_stosm(__or) \
45({ \
46 unsigned long __mask; \
47 asm volatile( \
48 " stosm 0(%1),%2" \
49 : "=m" (__mask) \
50 : "a" (&__mask), "i" (__or) : "memory"); \
51 __mask; \
52})
53
54/* store then and system mask. */
55#define __raw_local_irq_stnsm(__and) \
56({ \
57 unsigned long __mask; \
58 asm volatile( \
59 " stnsm 0(%1),%2" \
60 : "=m" (__mask) \
61 : "a" (&__mask), "i" (__and) : "memory"); \
62 __mask; \
63})
64
65/* set system mask. */
66#define __raw_local_irq_ssm(__mask) \
67({ \
68 asm volatile( \
69 " ssm 0(%0)" \
70 : : "a" (&__mask), "m" (__mask) : "memory"); \
71})
72
73#endif /* __GNUC__ */
74
13/* interrupt control.. */ 75/* interrupt control.. */
14#define raw_local_irq_enable() ({ \ 76static inline unsigned long raw_local_irq_enable(void)
15 unsigned long __dummy; \ 77{
16 __asm__ __volatile__ ( \ 78 return __raw_local_irq_stosm(0x03);
17 "stosm 0(%1),0x03" \ 79}
18 : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \
19 })
20
21#define raw_local_irq_disable() ({ \
22 unsigned long __flags; \
23 __asm__ __volatile__ ( \
24 "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
25 __flags; \
26 })
27
28#define raw_local_save_flags(x) \
29do { \
30 typecheck(unsigned long, x); \
31 __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) ); \
32} while (0)
33 80
34#define raw_local_irq_restore(x) \ 81static inline unsigned long raw_local_irq_disable(void)
35do { \ 82{
36 typecheck(unsigned long, x); \ 83 return __raw_local_irq_stnsm(0xfc);
37 __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory"); \ 84}
85
86#define raw_local_save_flags(x) \
87do { \
88 typecheck(unsigned long, x); \
89 (x) = __raw_local_irq_stosm(0x00); \
38} while (0) 90} while (0)
39 91
40#define raw_irqs_disabled() \ 92static inline void raw_local_irq_restore(unsigned long flags)
41({ \ 93{
42 unsigned long flags; \ 94 __raw_local_irq_ssm(flags);
43 raw_local_save_flags(flags); \ 95}
44 !((flags >> __FLAG_SHIFT) & 3); \
45})
46 96
47static inline int raw_irqs_disabled_flags(unsigned long flags) 97static inline int raw_irqs_disabled_flags(unsigned long flags)
48{ 98{
49 return !((flags >> __FLAG_SHIFT) & 3); 99 return !(flags & (3UL << (BITS_PER_LONG - 8)));
50} 100}
51 101
52/* For spinlocks etc */ 102/* For spinlocks etc */
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 18695d10dedf..06583ed0bde7 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -359,7 +359,7 @@ extern struct _lowcore *lowcore_ptr[];
359 359
360static inline void set_prefix(__u32 address) 360static inline void set_prefix(__u32 address)
361{ 361{
362 __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); 362 asm volatile("spx %0" : : "m" (address) : "memory");
363} 363}
364 364
365#define __PANIC_MAGIC 0xDEADC0DE 365#define __PANIC_MAGIC 0xDEADC0DE
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index b2628dc5c490..363ea761d5ee 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -22,89 +22,45 @@
22#include <asm/setup.h> 22#include <asm/setup.h>
23#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
24 24
25#ifndef __s390x__
26
27static inline void clear_page(void *page)
28{
29 register_pair rp;
30
31 rp.subreg.even = (unsigned long) page;
32 rp.subreg.odd = (unsigned long) 4096;
33 asm volatile (" slr 1,1\n"
34 " mvcl %0,0"
35 : "+&a" (rp) : : "memory", "cc", "1" );
36}
37
38static inline void copy_page(void *to, void *from)
39{
40 if (MACHINE_HAS_MVPG)
41 asm volatile (" sr 0,0\n"
42 " mvpg %0,%1"
43 : : "a" ((void *)(to)), "a" ((void *)(from))
44 : "memory", "cc", "0" );
45 else
46 asm volatile (" mvc 0(256,%0),0(%1)\n"
47 " mvc 256(256,%0),256(%1)\n"
48 " mvc 512(256,%0),512(%1)\n"
49 " mvc 768(256,%0),768(%1)\n"
50 " mvc 1024(256,%0),1024(%1)\n"
51 " mvc 1280(256,%0),1280(%1)\n"
52 " mvc 1536(256,%0),1536(%1)\n"
53 " mvc 1792(256,%0),1792(%1)\n"
54 " mvc 2048(256,%0),2048(%1)\n"
55 " mvc 2304(256,%0),2304(%1)\n"
56 " mvc 2560(256,%0),2560(%1)\n"
57 " mvc 2816(256,%0),2816(%1)\n"
58 " mvc 3072(256,%0),3072(%1)\n"
59 " mvc 3328(256,%0),3328(%1)\n"
60 " mvc 3584(256,%0),3584(%1)\n"
61 " mvc 3840(256,%0),3840(%1)\n"
62 : : "a"((void *)(to)),"a"((void *)(from))
63 : "memory" );
64}
65
66#else /* __s390x__ */
67
68static inline void clear_page(void *page) 25static inline void clear_page(void *page)
69{ 26{
70 asm volatile (" lgr 2,%0\n" 27 register unsigned long reg1 asm ("1") = 0;
71 " lghi 3,4096\n" 28 register void *reg2 asm ("2") = page;
72 " slgr 1,1\n" 29 register unsigned long reg3 asm ("3") = 4096;
73 " mvcl 2,0" 30 asm volatile(
74 : : "a" ((void *) (page)) 31 " mvcl 2,0"
75 : "memory", "cc", "1", "2", "3" ); 32 : "+d" (reg2), "+d" (reg3) : "d" (reg1) : "memory", "cc");
76} 33}
77 34
78static inline void copy_page(void *to, void *from) 35static inline void copy_page(void *to, void *from)
79{ 36{
80 if (MACHINE_HAS_MVPG) 37 if (MACHINE_HAS_MVPG) {
81 asm volatile (" sgr 0,0\n" 38 register unsigned long reg0 asm ("0") = 0;
82 " mvpg %0,%1" 39 asm volatile(
83 : : "a" ((void *)(to)), "a" ((void *)(from)) 40 " mvpg %0,%1"
84 : "memory", "cc", "0" ); 41 : : "a" (to), "a" (from), "d" (reg0)
85 else 42 : "memory", "cc");
86 asm volatile (" mvc 0(256,%0),0(%1)\n" 43 } else
87 " mvc 256(256,%0),256(%1)\n" 44 asm volatile(
88 " mvc 512(256,%0),512(%1)\n" 45 " mvc 0(256,%0),0(%1)\n"
89 " mvc 768(256,%0),768(%1)\n" 46 " mvc 256(256,%0),256(%1)\n"
90 " mvc 1024(256,%0),1024(%1)\n" 47 " mvc 512(256,%0),512(%1)\n"
91 " mvc 1280(256,%0),1280(%1)\n" 48 " mvc 768(256,%0),768(%1)\n"
92 " mvc 1536(256,%0),1536(%1)\n" 49 " mvc 1024(256,%0),1024(%1)\n"
93 " mvc 1792(256,%0),1792(%1)\n" 50 " mvc 1280(256,%0),1280(%1)\n"
94 " mvc 2048(256,%0),2048(%1)\n" 51 " mvc 1536(256,%0),1536(%1)\n"
95 " mvc 2304(256,%0),2304(%1)\n" 52 " mvc 1792(256,%0),1792(%1)\n"
96 " mvc 2560(256,%0),2560(%1)\n" 53 " mvc 2048(256,%0),2048(%1)\n"
97 " mvc 2816(256,%0),2816(%1)\n" 54 " mvc 2304(256,%0),2304(%1)\n"
98 " mvc 3072(256,%0),3072(%1)\n" 55 " mvc 2560(256,%0),2560(%1)\n"
99 " mvc 3328(256,%0),3328(%1)\n" 56 " mvc 2816(256,%0),2816(%1)\n"
100 " mvc 3584(256,%0),3584(%1)\n" 57 " mvc 3072(256,%0),3072(%1)\n"
101 " mvc 3840(256,%0),3840(%1)\n" 58 " mvc 3328(256,%0),3328(%1)\n"
102 : : "a"((void *)(to)),"a"((void *)(from)) 59 " mvc 3584(256,%0),3584(%1)\n"
103 : "memory" ); 60 " mvc 3840(256,%0),3840(%1)\n"
61 : : "a" (to), "a" (from) : "memory");
104} 62}
105 63
106#endif /* __s390x__ */
107
108#define clear_user_page(page, vaddr, pg) clear_page(page) 64#define clear_user_page(page, vaddr, pg) clear_page(page)
109#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)
110 66
@@ -159,7 +115,7 @@ extern unsigned int default_storage_key;
159static inline void 115static inline void
160page_set_storage_key(unsigned long addr, unsigned int skey) 116page_set_storage_key(unsigned long addr, unsigned int skey)
161{ 117{
162 asm volatile ( "sske %0,%1" : : "d" (skey), "a" (addr) ); 118 asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
163} 119}
164 120
165static inline unsigned int 121static inline unsigned int
@@ -167,8 +123,7 @@ page_get_storage_key(unsigned long addr)
167{ 123{
168 unsigned int skey; 124 unsigned int skey;
169 125
170 asm volatile ( "iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0) ); 126 asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0));
171
172 return skey; 127 return skey;
173} 128}
174 129
@@ -182,6 +137,7 @@ page_get_storage_key(unsigned long addr)
182#define __pa(x) (unsigned long)(x) 137#define __pa(x) (unsigned long)(x)
183#define __va(x) (void *)(unsigned long)(x) 138#define __va(x) (void *)(unsigned long)(x)
184#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 139#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
140#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
185 141
186#define pfn_valid(pfn) ((pfn) < max_mapnr) 142#define pfn_valid(pfn) ((pfn) < max_mapnr)
187#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 143#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 803bc7064418..28619de5ecae 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -116,7 +116,7 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
116static inline void 116static inline void
117pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) 117pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
118{ 118{
119 pmd_populate_kernel(mm, pmd, (pte_t *)((page-mem_map) << PAGE_SHIFT)); 119 pmd_populate_kernel(mm, pmd, (pte_t *)page_to_phys(page));
120} 120}
121 121
122/* 122/*
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index e965309fedac..519f0a5ff181 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -31,9 +31,9 @@
31 * the S390 page table tree. 31 * the S390 page table tree.
32 */ 32 */
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34#include <linux/mm_types.h>
34#include <asm/bug.h> 35#include <asm/bug.h>
35#include <asm/processor.h> 36#include <asm/processor.h>
36#include <linux/threads.h>
37 37
38struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ 38struct vm_area_struct; /* forward declaration (include/linux/mm.h) */
39struct mm_struct; 39struct mm_struct;
@@ -554,9 +554,10 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
554 /* ipte in zarch mode can do the math */ 554 /* ipte in zarch mode can do the math */
555 pte_t *pto = ptep; 555 pte_t *pto = ptep;
556#endif 556#endif
557 asm volatile ("ipte %2,%3" 557 asm volatile(
558 : "=m" (*ptep) : "m" (*ptep), 558 " ipte %2,%3"
559 "a" (pto), "a" (address) ); 559 : "=m" (*ptep) : "m" (*ptep),
560 "a" (pto), "a" (address));
560 } 561 }
561 pte_val(*ptep) = _PAGE_TYPE_EMPTY; 562 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
562} 563}
@@ -596,30 +597,31 @@ ptep_establish(struct vm_area_struct *vma,
596 * should therefore only be called if it is not mapped in any 597 * should therefore only be called if it is not mapped in any
597 * address space. 598 * address space.
598 */ 599 */
599#define page_test_and_clear_dirty(_page) \ 600static inline int page_test_and_clear_dirty(struct page *page)
600({ \ 601{
601 struct page *__page = (_page); \ 602 unsigned long physpage = page_to_phys(page);
602 unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ 603 int skey = page_get_storage_key(physpage);
603 int __skey = page_get_storage_key(__physpage); \ 604
604 if (__skey & _PAGE_CHANGED) \ 605 if (skey & _PAGE_CHANGED)
605 page_set_storage_key(__physpage, __skey & ~_PAGE_CHANGED);\ 606 page_set_storage_key(physpage, skey & ~_PAGE_CHANGED);
606 (__skey & _PAGE_CHANGED); \ 607 return skey & _PAGE_CHANGED;
607}) 608}
608 609
609/* 610/*
610 * Test and clear referenced bit in storage key. 611 * Test and clear referenced bit in storage key.
611 */ 612 */
612#define page_test_and_clear_young(page) \ 613static inline int page_test_and_clear_young(struct page *page)
613({ \ 614{
614 struct page *__page = (page); \ 615 unsigned long physpage = page_to_phys(page);
615 unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ 616 int ccode;
616 int __ccode; \ 617
617 asm volatile ("rrbe 0,%1\n\t" \ 618 asm volatile(
618 "ipm %0\n\t" \ 619 " rrbe 0,%1\n"
619 "srl %0,28\n\t" \ 620 " ipm %0\n"
620 : "=d" (__ccode) : "a" (__physpage) : "cc" ); \ 621 " srl %0,28\n"
621 (__ccode & 2); \ 622 : "=d" (ccode) : "a" (physpage) : "cc" );
622}) 623 return ccode & 2;
624}
623 625
624/* 626/*
625 * Conversion functions: convert a page and protection to a page entry, 627 * Conversion functions: convert a page and protection to a page entry,
@@ -632,32 +634,28 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
632 return __pte; 634 return __pte;
633} 635}
634 636
635#define mk_pte(pg, pgprot) \ 637static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
636({ \ 638{
637 struct page *__page = (pg); \ 639 unsigned long physpage = page_to_phys(page);
638 pgprot_t __pgprot = (pgprot); \
639 unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
640 pte_t __pte = mk_pte_phys(__physpage, __pgprot); \
641 __pte; \
642})
643 640
644#define pfn_pte(pfn, pgprot) \ 641 return mk_pte_phys(physpage, pgprot);
645({ \ 642}
646 pgprot_t __pgprot = (pgprot); \ 643
647 unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \ 644static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
648 pte_t __pte = mk_pte_phys(__physpage, __pgprot); \ 645{
649 __pte; \ 646 unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
650}) 647
648 return mk_pte_phys(physpage, pgprot);
649}
651 650
652#ifdef __s390x__ 651#ifdef __s390x__
653 652
654#define pfn_pmd(pfn, pgprot) \ 653static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
655({ \ 654{
656 pgprot_t __pgprot = (pgprot); \ 655 unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
657 unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \ 656
658 pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot)); \ 657 return __pmd(physpage + pgprot_val(pgprot));
659 __pmd; \ 658}
660})
661 659
662#endif /* __s390x__ */ 660#endif /* __s390x__ */
663 661
@@ -666,11 +664,11 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
666 664
667#define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK) 665#define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK)
668 666
669#define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) 667#define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
670 668
671#define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK) 669#define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK)
672 670
673#define pgd_page(pgd) (mem_map+(pgd_val(pgd) >> PAGE_SHIFT)) 671#define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)
674 672
675/* to find an entry in a page-table-directory */ 673/* to find an entry in a page-table-directory */
676#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 674#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 578c2209fa76..cbbedc63ba25 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -13,7 +13,6 @@
13#ifndef __ASM_S390_PROCESSOR_H 13#ifndef __ASM_S390_PROCESSOR_H
14#define __ASM_S390_PROCESSOR_H 14#define __ASM_S390_PROCESSOR_H
15 15
16#include <asm/page.h>
17#include <asm/ptrace.h> 16#include <asm/ptrace.h>
18 17
19#ifdef __KERNEL__ 18#ifdef __KERNEL__
@@ -21,7 +20,7 @@
21 * Default implementation of macro that returns current 20 * Default implementation of macro that returns current
22 * instruction pointer ("program counter"). 21 * instruction pointer ("program counter").
23 */ 22 */
24#define current_text_addr() ({ void *pc; __asm__("basr %0,0":"=a"(pc)); pc; }) 23#define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; })
25 24
26/* 25/*
27 * CPU type and hardware bug flags. Kept separately for each CPU. 26 * CPU type and hardware bug flags. Kept separately for each CPU.
@@ -202,7 +201,7 @@ unsigned long get_wchan(struct task_struct *p);
202static inline void cpu_relax(void) 201static inline void cpu_relax(void)
203{ 202{
204 if (MACHINE_HAS_DIAG44) 203 if (MACHINE_HAS_DIAG44)
205 asm volatile ("diag 0,0,68" : : : "memory"); 204 asm volatile("diag 0,0,68" : : : "memory");
206 else 205 else
207 barrier(); 206 barrier();
208} 207}
@@ -213,9 +212,9 @@ static inline void cpu_relax(void)
213static inline void __load_psw(psw_t psw) 212static inline void __load_psw(psw_t psw)
214{ 213{
215#ifndef __s390x__ 214#ifndef __s390x__
216 asm volatile ("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); 215 asm volatile("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
217#else 216#else
218 asm volatile ("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); 217 asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
219#endif 218#endif
220} 219}
221 220
@@ -232,20 +231,20 @@ static inline void __load_psw_mask (unsigned long mask)
232 psw.mask = mask; 231 psw.mask = mask;
233 232
234#ifndef __s390x__ 233#ifndef __s390x__
235 asm volatile ( 234 asm volatile(
236 " basr %0,0\n" 235 " basr %0,0\n"
237 "0: ahi %0,1f-0b\n" 236 "0: ahi %0,1f-0b\n"
238 " st %0,4(%1)\n" 237 " st %0,4(%1)\n"
239 " lpsw 0(%1)\n" 238 " lpsw 0(%1)\n"
240 "1:" 239 "1:"
241 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); 240 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
242#else /* __s390x__ */ 241#else /* __s390x__ */
243 asm volatile ( 242 asm volatile(
244 " larl %0,1f\n" 243 " larl %0,1f\n"
245 " stg %0,8(%1)\n" 244 " stg %0,8(%1)\n"
246 " lpswe 0(%1)\n" 245 " lpswe 0(%1)\n"
247 "1:" 246 "1:"
248 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); 247 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
249#endif /* __s390x__ */ 248#endif /* __s390x__ */
250} 249}
251 250
@@ -274,56 +273,57 @@ static inline void disabled_wait(unsigned long code)
274 * the processor is dead afterwards 273 * the processor is dead afterwards
275 */ 274 */
276#ifndef __s390x__ 275#ifndef __s390x__
277 asm volatile (" stctl 0,0,0(%2)\n" 276 asm volatile(
278 " ni 0(%2),0xef\n" /* switch off protection */ 277 " stctl 0,0,0(%2)\n"
279 " lctl 0,0,0(%2)\n" 278 " ni 0(%2),0xef\n" /* switch off protection */
280 " stpt 0xd8\n" /* store timer */ 279 " lctl 0,0,0(%2)\n"
281 " stckc 0xe0\n" /* store clock comparator */ 280 " stpt 0xd8\n" /* store timer */
282 " stpx 0x108\n" /* store prefix register */ 281 " stckc 0xe0\n" /* store clock comparator */
283 " stam 0,15,0x120\n" /* store access registers */ 282 " stpx 0x108\n" /* store prefix register */
284 " std 0,0x160\n" /* store f0 */ 283 " stam 0,15,0x120\n" /* store access registers */
285 " std 2,0x168\n" /* store f2 */ 284 " std 0,0x160\n" /* store f0 */
286 " std 4,0x170\n" /* store f4 */ 285 " std 2,0x168\n" /* store f2 */
287 " std 6,0x178\n" /* store f6 */ 286 " std 4,0x170\n" /* store f4 */
288 " stm 0,15,0x180\n" /* store general registers */ 287 " std 6,0x178\n" /* store f6 */
289 " stctl 0,15,0x1c0\n" /* store control registers */ 288 " stm 0,15,0x180\n" /* store general registers */
290 " oi 0x1c0,0x10\n" /* fake protection bit */ 289 " stctl 0,15,0x1c0\n" /* store control registers */
291 " lpsw 0(%1)" 290 " oi 0x1c0,0x10\n" /* fake protection bit */
292 : "=m" (ctl_buf) 291 " lpsw 0(%1)"
293 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc" ); 292 : "=m" (ctl_buf)
293 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc");
294#else /* __s390x__ */ 294#else /* __s390x__ */
295 asm volatile (" stctg 0,0,0(%2)\n" 295 asm volatile(
296 " ni 4(%2),0xef\n" /* switch off protection */ 296 " stctg 0,0,0(%2)\n"
297 " lctlg 0,0,0(%2)\n" 297 " ni 4(%2),0xef\n" /* switch off protection */
298 " lghi 1,0x1000\n" 298 " lctlg 0,0,0(%2)\n"
299 " stpt 0x328(1)\n" /* store timer */ 299 " lghi 1,0x1000\n"
300 " stckc 0x330(1)\n" /* store clock comparator */ 300 " stpt 0x328(1)\n" /* store timer */
301 " stpx 0x318(1)\n" /* store prefix register */ 301 " stckc 0x330(1)\n" /* store clock comparator */
302 " stam 0,15,0x340(1)\n" /* store access registers */ 302 " stpx 0x318(1)\n" /* store prefix register */
303 " stfpc 0x31c(1)\n" /* store fpu control */ 303 " stam 0,15,0x340(1)\n"/* store access registers */
304 " std 0,0x200(1)\n" /* store f0 */ 304 " stfpc 0x31c(1)\n" /* store fpu control */
305 " std 1,0x208(1)\n" /* store f1 */ 305 " std 0,0x200(1)\n" /* store f0 */
306 " std 2,0x210(1)\n" /* store f2 */ 306 " std 1,0x208(1)\n" /* store f1 */
307 " std 3,0x218(1)\n" /* store f3 */ 307 " std 2,0x210(1)\n" /* store f2 */
308 " std 4,0x220(1)\n" /* store f4 */ 308 " std 3,0x218(1)\n" /* store f3 */
309 " std 5,0x228(1)\n" /* store f5 */ 309 " std 4,0x220(1)\n" /* store f4 */
310 " std 6,0x230(1)\n" /* store f6 */ 310 " std 5,0x228(1)\n" /* store f5 */
311 " std 7,0x238(1)\n" /* store f7 */ 311 " std 6,0x230(1)\n" /* store f6 */
312 " std 8,0x240(1)\n" /* store f8 */ 312 " std 7,0x238(1)\n" /* store f7 */
313 " std 9,0x248(1)\n" /* store f9 */ 313 " std 8,0x240(1)\n" /* store f8 */
314 " std 10,0x250(1)\n" /* store f10 */ 314 " std 9,0x248(1)\n" /* store f9 */
315 " std 11,0x258(1)\n" /* store f11 */ 315 " std 10,0x250(1)\n" /* store f10 */
316 " std 12,0x260(1)\n" /* store f12 */ 316 " std 11,0x258(1)\n" /* store f11 */
317 " std 13,0x268(1)\n" /* store f13 */ 317 " std 12,0x260(1)\n" /* store f12 */
318 " std 14,0x270(1)\n" /* store f14 */ 318 " std 13,0x268(1)\n" /* store f13 */
319 " std 15,0x278(1)\n" /* store f15 */ 319 " std 14,0x270(1)\n" /* store f14 */
320 " stmg 0,15,0x280(1)\n" /* store general registers */ 320 " std 15,0x278(1)\n" /* store f15 */
321 " stctg 0,15,0x380(1)\n" /* store control registers */ 321 " stmg 0,15,0x280(1)\n"/* store general registers */
322 " oi 0x384(1),0x10\n" /* fake protection bit */ 322 " stctg 0,15,0x380(1)\n"/* store control registers */
323 " lpswe 0(%1)" 323 " oi 0x384(1),0x10\n"/* fake protection bit */
324 : "=m" (ctl_buf) 324 " lpswe 0(%1)"
325 : "a" (&dw_psw), "a" (&ctl_buf), 325 : "=m" (ctl_buf)
326 "m" (dw_psw) : "cc", "0", "1"); 326 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0");
327#endif /* __s390x__ */ 327#endif /* __s390x__ */
328} 328}
329 329
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index 4d75d77b0f99..7b768c5c68a8 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -472,6 +472,7 @@ struct user_regs_struct
472 472
473#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) 473#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
474#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) 474#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
475#define regs_return_value(regs)((regs)->gprs[2])
475#define profile_pc(regs) instruction_pointer(regs) 476#define profile_pc(regs) instruction_pointer(regs)
476extern void show_regs(struct pt_regs * regs); 477extern void show_regs(struct pt_regs * regs);
477#endif 478#endif
@@ -479,7 +480,7 @@ extern void show_regs(struct pt_regs * regs);
479static inline void 480static inline void
480psw_set_key(unsigned int key) 481psw_set_key(unsigned int key)
481{ 482{
482 asm volatile ( "spka 0(%0)" : : "d" (key) ); 483 asm volatile("spka 0(%0)" : : "d" (key));
483} 484}
484 485
485#endif /* __ASSEMBLY__ */ 486#endif /* __ASSEMBLY__ */
diff --git a/include/asm-s390/qdio.h b/include/asm-s390/qdio.h
index a2f37a9353d3..7189c79bc673 100644
--- a/include/asm-s390/qdio.h
+++ b/include/asm-s390/qdio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm/qdio.h 2 * linux/include/asm-s390/qdio.h
3 * 3 *
4 * Linux for S/390 QDIO base support, Hipersocket base support 4 * Linux for S/390 QDIO base support, Hipersocket base support
5 * version 2 5 * version 2
diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h
index 13ec16965150..90f4eccaa290 100644
--- a/include/asm-s390/rwsem.h
+++ b/include/asm-s390/rwsem.h
@@ -122,23 +122,23 @@ static inline void __down_read(struct rw_semaphore *sem)
122{ 122{
123 signed long old, new; 123 signed long old, new;
124 124
125 __asm__ __volatile__( 125 asm volatile(
126#ifndef __s390x__ 126#ifndef __s390x__
127 " l %0,0(%3)\n" 127 " l %0,0(%3)\n"
128 "0: lr %1,%0\n" 128 "0: lr %1,%0\n"
129 " ahi %1,%5\n" 129 " ahi %1,%5\n"
130 " cs %0,%1,0(%3)\n" 130 " cs %0,%1,0(%3)\n"
131 " jl 0b" 131 " jl 0b"
132#else /* __s390x__ */ 132#else /* __s390x__ */
133 " lg %0,0(%3)\n" 133 " lg %0,0(%3)\n"
134 "0: lgr %1,%0\n" 134 "0: lgr %1,%0\n"
135 " aghi %1,%5\n" 135 " aghi %1,%5\n"
136 " csg %0,%1,0(%3)\n" 136 " csg %0,%1,0(%3)\n"
137 " jl 0b" 137 " jl 0b"
138#endif /* __s390x__ */ 138#endif /* __s390x__ */
139 : "=&d" (old), "=&d" (new), "=m" (sem->count) 139 : "=&d" (old), "=&d" (new), "=m" (sem->count)
140 : "a" (&sem->count), "m" (sem->count), 140 : "a" (&sem->count), "m" (sem->count),
141 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory" ); 141 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
142 if (old < 0) 142 if (old < 0)
143 rwsem_down_read_failed(sem); 143 rwsem_down_read_failed(sem);
144} 144}
@@ -150,27 +150,27 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
150{ 150{
151 signed long old, new; 151 signed long old, new;
152 152
153 __asm__ __volatile__( 153 asm volatile(
154#ifndef __s390x__ 154#ifndef __s390x__
155 " l %0,0(%3)\n" 155 " l %0,0(%3)\n"
156 "0: ltr %1,%0\n" 156 "0: ltr %1,%0\n"
157 " jm 1f\n" 157 " jm 1f\n"
158 " ahi %1,%5\n" 158 " ahi %1,%5\n"
159 " cs %0,%1,0(%3)\n" 159 " cs %0,%1,0(%3)\n"
160 " jl 0b\n" 160 " jl 0b\n"
161 "1:" 161 "1:"
162#else /* __s390x__ */ 162#else /* __s390x__ */
163 " lg %0,0(%3)\n" 163 " lg %0,0(%3)\n"
164 "0: ltgr %1,%0\n" 164 "0: ltgr %1,%0\n"
165 " jm 1f\n" 165 " jm 1f\n"
166 " aghi %1,%5\n" 166 " aghi %1,%5\n"
167 " csg %0,%1,0(%3)\n" 167 " csg %0,%1,0(%3)\n"
168 " jl 0b\n" 168 " jl 0b\n"
169 "1:" 169 "1:"
170#endif /* __s390x__ */ 170#endif /* __s390x__ */
171 : "=&d" (old), "=&d" (new), "=m" (sem->count) 171 : "=&d" (old), "=&d" (new), "=m" (sem->count)
172 : "a" (&sem->count), "m" (sem->count), 172 : "a" (&sem->count), "m" (sem->count),
173 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory" ); 173 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
174 return old >= 0 ? 1 : 0; 174 return old >= 0 ? 1 : 0;
175} 175}
176 176
@@ -182,23 +182,23 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
182 signed long old, new, tmp; 182 signed long old, new, tmp;
183 183
184 tmp = RWSEM_ACTIVE_WRITE_BIAS; 184 tmp = RWSEM_ACTIVE_WRITE_BIAS;
185 __asm__ __volatile__( 185 asm volatile(
186#ifndef __s390x__ 186#ifndef __s390x__
187 " l %0,0(%3)\n" 187 " l %0,0(%3)\n"
188 "0: lr %1,%0\n" 188 "0: lr %1,%0\n"
189 " a %1,%5\n" 189 " a %1,%5\n"
190 " cs %0,%1,0(%3)\n" 190 " cs %0,%1,0(%3)\n"
191 " jl 0b" 191 " jl 0b"
192#else /* __s390x__ */ 192#else /* __s390x__ */
193 " lg %0,0(%3)\n" 193 " lg %0,0(%3)\n"
194 "0: lgr %1,%0\n" 194 "0: lgr %1,%0\n"
195 " ag %1,%5\n" 195 " ag %1,%5\n"
196 " csg %0,%1,0(%3)\n" 196 " csg %0,%1,0(%3)\n"
197 " jl 0b" 197 " jl 0b"
198#endif /* __s390x__ */ 198#endif /* __s390x__ */
199 : "=&d" (old), "=&d" (new), "=m" (sem->count) 199 : "=&d" (old), "=&d" (new), "=m" (sem->count)
200 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 200 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
201 : "cc", "memory" ); 201 : "cc", "memory");
202 if (old != 0) 202 if (old != 0)
203 rwsem_down_write_failed(sem); 203 rwsem_down_write_failed(sem);
204} 204}
@@ -215,24 +215,24 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
215{ 215{
216 signed long old; 216 signed long old;
217 217
218 __asm__ __volatile__( 218 asm volatile(
219#ifndef __s390x__ 219#ifndef __s390x__
220 " l %0,0(%2)\n" 220 " l %0,0(%2)\n"
221 "0: ltr %0,%0\n" 221 "0: ltr %0,%0\n"
222 " jnz 1f\n" 222 " jnz 1f\n"
223 " cs %0,%4,0(%2)\n" 223 " cs %0,%4,0(%2)\n"
224 " jl 0b\n" 224 " jl 0b\n"
225#else /* __s390x__ */ 225#else /* __s390x__ */
226 " lg %0,0(%2)\n" 226 " lg %0,0(%2)\n"
227 "0: ltgr %0,%0\n" 227 "0: ltgr %0,%0\n"
228 " jnz 1f\n" 228 " jnz 1f\n"
229 " csg %0,%4,0(%2)\n" 229 " csg %0,%4,0(%2)\n"
230 " jl 0b\n" 230 " jl 0b\n"
231#endif /* __s390x__ */ 231#endif /* __s390x__ */
232 "1:" 232 "1:"
233 : "=&d" (old), "=m" (sem->count) 233 : "=&d" (old), "=m" (sem->count)
234 : "a" (&sem->count), "m" (sem->count), 234 : "a" (&sem->count), "m" (sem->count),
235 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory" ); 235 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory");
236 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; 236 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0;
237} 237}
238 238
@@ -243,24 +243,24 @@ static inline void __up_read(struct rw_semaphore *sem)
243{ 243{
244 signed long old, new; 244 signed long old, new;
245 245
246 __asm__ __volatile__( 246 asm volatile(
247#ifndef __s390x__ 247#ifndef __s390x__
248 " l %0,0(%3)\n" 248 " l %0,0(%3)\n"
249 "0: lr %1,%0\n" 249 "0: lr %1,%0\n"
250 " ahi %1,%5\n" 250 " ahi %1,%5\n"
251 " cs %0,%1,0(%3)\n" 251 " cs %0,%1,0(%3)\n"
252 " jl 0b" 252 " jl 0b"
253#else /* __s390x__ */ 253#else /* __s390x__ */
254 " lg %0,0(%3)\n" 254 " lg %0,0(%3)\n"
255 "0: lgr %1,%0\n" 255 "0: lgr %1,%0\n"
256 " aghi %1,%5\n" 256 " aghi %1,%5\n"
257 " csg %0,%1,0(%3)\n" 257 " csg %0,%1,0(%3)\n"
258 " jl 0b" 258 " jl 0b"
259#endif /* __s390x__ */ 259#endif /* __s390x__ */
260 : "=&d" (old), "=&d" (new), "=m" (sem->count) 260 : "=&d" (old), "=&d" (new), "=m" (sem->count)
261 : "a" (&sem->count), "m" (sem->count), 261 : "a" (&sem->count), "m" (sem->count),
262 "i" (-RWSEM_ACTIVE_READ_BIAS) 262 "i" (-RWSEM_ACTIVE_READ_BIAS)
263 : "cc", "memory" ); 263 : "cc", "memory");
264 if (new < 0) 264 if (new < 0)
265 if ((new & RWSEM_ACTIVE_MASK) == 0) 265 if ((new & RWSEM_ACTIVE_MASK) == 0)
266 rwsem_wake(sem); 266 rwsem_wake(sem);
@@ -274,23 +274,23 @@ static inline void __up_write(struct rw_semaphore *sem)
274 signed long old, new, tmp; 274 signed long old, new, tmp;
275 275
276 tmp = -RWSEM_ACTIVE_WRITE_BIAS; 276 tmp = -RWSEM_ACTIVE_WRITE_BIAS;
277 __asm__ __volatile__( 277 asm volatile(
278#ifndef __s390x__ 278#ifndef __s390x__
279 " l %0,0(%3)\n" 279 " l %0,0(%3)\n"
280 "0: lr %1,%0\n" 280 "0: lr %1,%0\n"
281 " a %1,%5\n" 281 " a %1,%5\n"
282 " cs %0,%1,0(%3)\n" 282 " cs %0,%1,0(%3)\n"
283 " jl 0b" 283 " jl 0b"
284#else /* __s390x__ */ 284#else /* __s390x__ */
285 " lg %0,0(%3)\n" 285 " lg %0,0(%3)\n"
286 "0: lgr %1,%0\n" 286 "0: lgr %1,%0\n"
287 " ag %1,%5\n" 287 " ag %1,%5\n"
288 " csg %0,%1,0(%3)\n" 288 " csg %0,%1,0(%3)\n"
289 " jl 0b" 289 " jl 0b"
290#endif /* __s390x__ */ 290#endif /* __s390x__ */
291 : "=&d" (old), "=&d" (new), "=m" (sem->count) 291 : "=&d" (old), "=&d" (new), "=m" (sem->count)
292 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 292 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
293 : "cc", "memory" ); 293 : "cc", "memory");
294 if (new < 0) 294 if (new < 0)
295 if ((new & RWSEM_ACTIVE_MASK) == 0) 295 if ((new & RWSEM_ACTIVE_MASK) == 0)
296 rwsem_wake(sem); 296 rwsem_wake(sem);
@@ -304,23 +304,23 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
304 signed long old, new, tmp; 304 signed long old, new, tmp;
305 305
306 tmp = -RWSEM_WAITING_BIAS; 306 tmp = -RWSEM_WAITING_BIAS;
307 __asm__ __volatile__( 307 asm volatile(
308#ifndef __s390x__ 308#ifndef __s390x__
309 " l %0,0(%3)\n" 309 " l %0,0(%3)\n"
310 "0: lr %1,%0\n" 310 "0: lr %1,%0\n"
311 " a %1,%5\n" 311 " a %1,%5\n"
312 " cs %0,%1,0(%3)\n" 312 " cs %0,%1,0(%3)\n"
313 " jl 0b" 313 " jl 0b"
314#else /* __s390x__ */ 314#else /* __s390x__ */
315 " lg %0,0(%3)\n" 315 " lg %0,0(%3)\n"
316 "0: lgr %1,%0\n" 316 "0: lgr %1,%0\n"
317 " ag %1,%5\n" 317 " ag %1,%5\n"
318 " csg %0,%1,0(%3)\n" 318 " csg %0,%1,0(%3)\n"
319 " jl 0b" 319 " jl 0b"
320#endif /* __s390x__ */ 320#endif /* __s390x__ */
321 : "=&d" (old), "=&d" (new), "=m" (sem->count) 321 : "=&d" (old), "=&d" (new), "=m" (sem->count)
322 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 322 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
323 : "cc", "memory" ); 323 : "cc", "memory");
324 if (new > 1) 324 if (new > 1)
325 rwsem_downgrade_wake(sem); 325 rwsem_downgrade_wake(sem);
326} 326}
@@ -332,23 +332,23 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
332{ 332{
333 signed long old, new; 333 signed long old, new;
334 334
335 __asm__ __volatile__( 335 asm volatile(
336#ifndef __s390x__ 336#ifndef __s390x__
337 " l %0,0(%3)\n" 337 " l %0,0(%3)\n"
338 "0: lr %1,%0\n" 338 "0: lr %1,%0\n"
339 " ar %1,%5\n" 339 " ar %1,%5\n"
340 " cs %0,%1,0(%3)\n" 340 " cs %0,%1,0(%3)\n"
341 " jl 0b" 341 " jl 0b"
342#else /* __s390x__ */ 342#else /* __s390x__ */
343 " lg %0,0(%3)\n" 343 " lg %0,0(%3)\n"
344 "0: lgr %1,%0\n" 344 "0: lgr %1,%0\n"
345 " agr %1,%5\n" 345 " agr %1,%5\n"
346 " csg %0,%1,0(%3)\n" 346 " csg %0,%1,0(%3)\n"
347 " jl 0b" 347 " jl 0b"
348#endif /* __s390x__ */ 348#endif /* __s390x__ */
349 : "=&d" (old), "=&d" (new), "=m" (sem->count) 349 : "=&d" (old), "=&d" (new), "=m" (sem->count)
350 : "a" (&sem->count), "m" (sem->count), "d" (delta) 350 : "a" (&sem->count), "m" (sem->count), "d" (delta)
351 : "cc", "memory" ); 351 : "cc", "memory");
352} 352}
353 353
354/* 354/*
@@ -358,23 +358,23 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
358{ 358{
359 signed long old, new; 359 signed long old, new;
360 360
361 __asm__ __volatile__( 361 asm volatile(
362#ifndef __s390x__ 362#ifndef __s390x__
363 " l %0,0(%3)\n" 363 " l %0,0(%3)\n"
364 "0: lr %1,%0\n" 364 "0: lr %1,%0\n"
365 " ar %1,%5\n" 365 " ar %1,%5\n"
366 " cs %0,%1,0(%3)\n" 366 " cs %0,%1,0(%3)\n"
367 " jl 0b" 367 " jl 0b"
368#else /* __s390x__ */ 368#else /* __s390x__ */
369 " lg %0,0(%3)\n" 369 " lg %0,0(%3)\n"
370 "0: lgr %1,%0\n" 370 "0: lgr %1,%0\n"
371 " agr %1,%5\n" 371 " agr %1,%5\n"
372 " csg %0,%1,0(%3)\n" 372 " csg %0,%1,0(%3)\n"
373 " jl 0b" 373 " jl 0b"
374#endif /* __s390x__ */ 374#endif /* __s390x__ */
375 : "=&d" (old), "=&d" (new), "=m" (sem->count) 375 : "=&d" (old), "=&d" (new), "=m" (sem->count)
376 : "a" (&sem->count), "m" (sem->count), "d" (delta) 376 : "a" (&sem->count), "m" (sem->count), "d" (delta)
377 : "cc", "memory" ); 377 : "cc", "memory");
378 return new; 378 return new;
379} 379}
380 380
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h
index 32cdc69f39f4..dbce058aefa9 100644
--- a/include/asm-s390/semaphore.h
+++ b/include/asm-s390/semaphore.h
@@ -85,17 +85,17 @@ static inline int down_trylock(struct semaphore * sem)
85 * sem->count.counter = --new_val; 85 * sem->count.counter = --new_val;
86 * In the ppc code this is called atomic_dec_if_positive. 86 * In the ppc code this is called atomic_dec_if_positive.
87 */ 87 */
88 __asm__ __volatile__ ( 88 asm volatile(
89 " l %0,0(%3)\n" 89 " l %0,0(%3)\n"
90 "0: ltr %1,%0\n" 90 "0: ltr %1,%0\n"
91 " jle 1f\n" 91 " jle 1f\n"
92 " ahi %1,-1\n" 92 " ahi %1,-1\n"
93 " cs %0,%1,0(%3)\n" 93 " cs %0,%1,0(%3)\n"
94 " jl 0b\n" 94 " jl 0b\n"
95 "1:" 95 "1:"
96 : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter) 96 : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter)
97 : "a" (&sem->count.counter), "m" (sem->count.counter) 97 : "a" (&sem->count.counter), "m" (sem->count.counter)
98 : "cc", "memory" ); 98 : "cc", "memory");
99 return old_val <= 0; 99 return old_val <= 0;
100} 100}
101 101
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index f1959732b6fd..5d72eda8a11b 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -39,6 +39,7 @@ extern unsigned long machine_flags;
39#define MACHINE_IS_P390 (machine_flags & 4) 39#define MACHINE_IS_P390 (machine_flags & 4)
40#define MACHINE_HAS_MVPG (machine_flags & 16) 40#define MACHINE_HAS_MVPG (machine_flags & 16)
41#define MACHINE_HAS_IDTE (machine_flags & 128) 41#define MACHINE_HAS_IDTE (machine_flags & 128)
42#define MACHINE_HAS_DIAG9C (machine_flags & 256)
42 43
43#ifndef __s390x__ 44#ifndef __s390x__
44#define MACHINE_HAS_IEEE (machine_flags & 2) 45#define MACHINE_HAS_IEEE (machine_flags & 2)
diff --git a/include/asm-s390/sfp-machine.h b/include/asm-s390/sfp-machine.h
index de69dfa46fbb..8ca8c77b2d04 100644
--- a/include/asm-s390/sfp-machine.h
+++ b/include/asm-s390/sfp-machine.h
@@ -76,21 +76,23 @@
76 unsigned int __r2 = (x2) + (y2); \ 76 unsigned int __r2 = (x2) + (y2); \
77 unsigned int __r1 = (x1); \ 77 unsigned int __r1 = (x1); \
78 unsigned int __r0 = (x0); \ 78 unsigned int __r0 = (x0); \
79 __asm__ (" alr %2,%3\n" \ 79 asm volatile( \
80 " brc 12,0f\n" \ 80 " alr %2,%3\n" \
81 " lhi 0,1\n" \ 81 " brc 12,0f\n" \
82 " alr %1,0\n" \ 82 " lhi 0,1\n" \
83 " brc 12,0f\n" \ 83 " alr %1,0\n" \
84 " alr %0,0\n" \ 84 " brc 12,0f\n" \
85 "0:" \ 85 " alr %0,0\n" \
86 : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \ 86 "0:" \
87 : "d" (y0), "i" (1) : "cc", "0" ); \ 87 : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \
88 __asm__ (" alr %1,%2\n" \ 88 : "d" (y0), "i" (1) : "cc", "0" ); \
89 " brc 12,0f\n" \ 89 asm volatile( \
90 " ahi %0,1\n" \ 90 " alr %1,%2\n" \
91 "0:" \ 91 " brc 12,0f\n" \
92 : "+&d" (__r2), "+&d" (__r1) \ 92 " ahi %0,1\n" \
93 : "d" (y1) : "cc" ); \ 93 "0:" \
94 : "+&d" (__r2), "+&d" (__r1) \
95 : "d" (y1) : "cc"); \
94 (r2) = __r2; \ 96 (r2) = __r2; \
95 (r1) = __r1; \ 97 (r1) = __r1; \
96 (r0) = __r0; \ 98 (r0) = __r0; \
@@ -100,21 +102,23 @@
100 unsigned int __r2 = (x2) - (y2); \ 102 unsigned int __r2 = (x2) - (y2); \
101 unsigned int __r1 = (x1); \ 103 unsigned int __r1 = (x1); \
102 unsigned int __r0 = (x0); \ 104 unsigned int __r0 = (x0); \
103 __asm__ (" slr %2,%3\n" \ 105 asm volatile( \
104 " brc 3,0f\n" \ 106 " slr %2,%3\n" \
105 " lhi 0,1\n" \ 107 " brc 3,0f\n" \
106 " slr %1,0\n" \ 108 " lhi 0,1\n" \
107 " brc 3,0f\n" \ 109 " slr %1,0\n" \
108 " slr %0,0\n" \ 110 " brc 3,0f\n" \
109 "0:" \ 111 " slr %0,0\n" \
110 : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \ 112 "0:" \
111 : "d" (y0) : "cc", "0" ); \ 113 : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \
112 __asm__ (" slr %1,%2\n" \ 114 : "d" (y0) : "cc", "0"); \
113 " brc 3,0f\n" \ 115 asm volatile( \
114 " ahi %0,-1\n" \ 116 " slr %1,%2\n" \
115 "0:" \ 117 " brc 3,0f\n" \
116 : "+&d" (__r2), "+&d" (__r1) \ 118 " ahi %0,-1\n" \
117 : "d" (y1) : "cc" ); \ 119 "0:" \
120 : "+&d" (__r2), "+&d" (__r1) \
121 : "d" (y1) : "cc"); \
118 (r2) = __r2; \ 122 (r2) = __r2; \
119 (r1) = __r1; \ 123 (r1) = __r1; \
120 (r0) = __r0; \ 124 (r0) = __r0; \
diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h
index fc56458aff66..e16d56f8dfe1 100644
--- a/include/asm-s390/sigp.h
+++ b/include/asm-s390/sigp.h
@@ -70,16 +70,16 @@ typedef enum
70static inline sigp_ccode 70static inline sigp_ccode
71signal_processor(__u16 cpu_addr, sigp_order_code order_code) 71signal_processor(__u16 cpu_addr, sigp_order_code order_code)
72{ 72{
73 register unsigned long reg1 asm ("1") = 0;
73 sigp_ccode ccode; 74 sigp_ccode ccode;
74 75
75 __asm__ __volatile__( 76 asm volatile(
76 " sr 1,1\n" /* parameter=0 in gpr 1 */ 77 " sigp %1,%2,0(%3)\n"
77 " sigp 1,%1,0(%2)\n" 78 " ipm %0\n"
78 " ipm %0\n" 79 " srl %0,28\n"
79 " srl %0,28\n" 80 : "=d" (ccode)
80 : "=d" (ccode) 81 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
81 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) 82 "a" (order_code) : "cc" , "memory");
82 : "cc" , "memory", "1" );
83 return ccode; 83 return ccode;
84} 84}
85 85
@@ -87,20 +87,18 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code)
87 * Signal processor with parameter 87 * Signal processor with parameter
88 */ 88 */
89static inline sigp_ccode 89static inline sigp_ccode
90signal_processor_p(__u32 parameter, __u16 cpu_addr, 90signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
91 sigp_order_code order_code)
92{ 91{
92 register unsigned int reg1 asm ("1") = parameter;
93 sigp_ccode ccode; 93 sigp_ccode ccode;
94 94
95 __asm__ __volatile__( 95 asm volatile(
96 " lr 1,%1\n" /* parameter in gpr 1 */ 96 " sigp %1,%2,0(%3)\n"
97 " sigp 1,%2,0(%3)\n" 97 " ipm %0\n"
98 " ipm %0\n" 98 " srl %0,28\n"
99 " srl %0,28\n"
100 : "=d" (ccode) 99 : "=d" (ccode)
101 : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]), 100 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
102 "a" (order_code) 101 "a" (order_code) : "cc" , "memory");
103 : "cc" , "memory", "1" );
104 return ccode; 102 return ccode;
105} 103}
106 104
@@ -108,24 +106,21 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr,
108 * Signal processor with parameter and return status 106 * Signal processor with parameter and return status
109 */ 107 */
110static inline sigp_ccode 108static inline sigp_ccode
111signal_processor_ps(__u32 *statusptr, __u32 parameter, 109signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
112 __u16 cpu_addr, sigp_order_code order_code) 110 sigp_order_code order_code)
113{ 111{
112 register unsigned int reg1 asm ("1") = parameter;
114 sigp_ccode ccode; 113 sigp_ccode ccode;
115 114
116 __asm__ __volatile__( 115 asm volatile(
117 " sr 2,2\n" /* clear status */ 116 " sigp %1,%2,0(%3)\n"
118 " lr 3,%2\n" /* parameter in gpr 3 */ 117 " ipm %0\n"
119 " sigp 2,%3,0(%4)\n" 118 " srl %0,28\n"
120 " st 2,%1\n" 119 : "=d" (ccode), "+d" (reg1)
121 " ipm %0\n" 120 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
122 " srl %0,28\n" 121 : "cc" , "memory");
123 : "=d" (ccode), "=m" (*statusptr) 122 *statusptr = reg1;
124 : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]), 123 return ccode;
125 "a" (order_code)
126 : "cc" , "memory", "2" , "3"
127 );
128 return ccode;
129} 124}
130 125
131#endif /* __SIGP__ */ 126#endif /* __SIGP__ */
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index 9fb02e9779c9..c3cf030ada4d 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -56,7 +56,7 @@ static inline __u16 hard_smp_processor_id(void)
56{ 56{
57 __u16 cpu_address; 57 __u16 cpu_address;
58 58
59 __asm__ ("stap %0\n" : "=m" (cpu_address)); 59 asm volatile("stap %0" : "=m" (cpu_address));
60 return cpu_address; 60 return cpu_address;
61} 61}
62 62
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 273dbecf8ace..3fd43826fd0b 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -11,17 +11,38 @@
11#ifndef __ASM_SPINLOCK_H 11#ifndef __ASM_SPINLOCK_H
12#define __ASM_SPINLOCK_H 12#define __ASM_SPINLOCK_H
13 13
14#include <linux/smp.h>
15
16#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
17
14static inline int 18static inline int
15_raw_compare_and_swap(volatile unsigned int *lock, 19_raw_compare_and_swap(volatile unsigned int *lock,
16 unsigned int old, unsigned int new) 20 unsigned int old, unsigned int new)
17{ 21{
18 asm volatile ("cs %0,%3,0(%4)" 22 asm volatile(
19 : "=d" (old), "=m" (*lock) 23 " cs %0,%3,%1"
20 : "0" (old), "d" (new), "a" (lock), "m" (*lock) 24 : "=d" (old), "=Q" (*lock)
21 : "cc", "memory" ); 25 : "0" (old), "d" (new), "Q" (*lock)
26 : "cc", "memory" );
22 return old; 27 return old;
23} 28}
24 29
30#else /* __GNUC__ */
31
32static inline int
33_raw_compare_and_swap(volatile unsigned int *lock,
34 unsigned int old, unsigned int new)
35{
36 asm volatile(
37 " cs %0,%3,0(%4)"
38 : "=d" (old), "=m" (*lock)
39 : "0" (old), "d" (new), "a" (lock), "m" (*lock)
40 : "cc", "memory" );
41 return old;
42}
43
44#endif /* __GNUC__ */
45
25/* 46/*
26 * Simple spin lock operations. There are two variants, one clears IRQ's 47 * Simple spin lock operations. There are two variants, one clears IRQ's
27 * on the local processor, one does not. 48 * on the local processor, one does not.
@@ -31,34 +52,46 @@ _raw_compare_and_swap(volatile unsigned int *lock,
31 * (the type definitions are in asm/spinlock_types.h) 52 * (the type definitions are in asm/spinlock_types.h)
32 */ 53 */
33 54
34#define __raw_spin_is_locked(x) ((x)->lock != 0) 55#define __raw_spin_is_locked(x) ((x)->owner_cpu != 0)
35#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 56#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
36#define __raw_spin_unlock_wait(lock) \ 57#define __raw_spin_unlock_wait(lock) \
37 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 58 do { while (__raw_spin_is_locked(lock)) \
59 _raw_spin_relax(lock); } while (0)
38 60
39extern void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc); 61extern void _raw_spin_lock_wait(raw_spinlock_t *, unsigned int pc);
40extern int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc); 62extern int _raw_spin_trylock_retry(raw_spinlock_t *, unsigned int pc);
63extern void _raw_spin_relax(raw_spinlock_t *lock);
41 64
42static inline void __raw_spin_lock(raw_spinlock_t *lp) 65static inline void __raw_spin_lock(raw_spinlock_t *lp)
43{ 66{
44 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); 67 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
45 68 int old;
46 if (unlikely(_raw_compare_and_swap(&lp->lock, 0, pc) != 0)) 69
47 _raw_spin_lock_wait(lp, pc); 70 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
71 if (likely(old == 0)) {
72 lp->owner_pc = pc;
73 return;
74 }
75 _raw_spin_lock_wait(lp, pc);
48} 76}
49 77
50static inline int __raw_spin_trylock(raw_spinlock_t *lp) 78static inline int __raw_spin_trylock(raw_spinlock_t *lp)
51{ 79{
52 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); 80 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
81 int old;
53 82
54 if (likely(_raw_compare_and_swap(&lp->lock, 0, pc) == 0)) 83 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
84 if (likely(old == 0)) {
85 lp->owner_pc = pc;
55 return 1; 86 return 1;
87 }
56 return _raw_spin_trylock_retry(lp, pc); 88 return _raw_spin_trylock_retry(lp, pc);
57} 89}
58 90
59static inline void __raw_spin_unlock(raw_spinlock_t *lp) 91static inline void __raw_spin_unlock(raw_spinlock_t *lp)
60{ 92{
61 _raw_compare_and_swap(&lp->lock, lp->lock, 0); 93 lp->owner_pc = 0;
94 _raw_compare_and_swap(&lp->owner_cpu, lp->owner_cpu, 0);
62} 95}
63 96
64/* 97/*
@@ -135,4 +168,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
135 return _raw_write_trylock_retry(rw); 168 return _raw_write_trylock_retry(rw);
136} 169}
137 170
171#define _raw_read_relax(lock) cpu_relax()
172#define _raw_write_relax(lock) cpu_relax()
173
138#endif /* __ASM_SPINLOCK_H */ 174#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-s390/spinlock_types.h b/include/asm-s390/spinlock_types.h
index f79a2216204f..b7ac13f7aa37 100644
--- a/include/asm-s390/spinlock_types.h
+++ b/include/asm-s390/spinlock_types.h
@@ -6,16 +6,16 @@
6#endif 6#endif
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned int lock; 9 volatile unsigned int owner_cpu;
10 volatile unsigned int owner_pc;
10} __attribute__ ((aligned (4))) raw_spinlock_t; 11} __attribute__ ((aligned (4))) raw_spinlock_t;
11 12
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 } 13#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13 14
14typedef struct { 15typedef struct {
15 volatile unsigned int lock; 16 volatile unsigned int lock;
16 volatile unsigned int owner_pc;
17} raw_rwlock_t; 17} raw_rwlock_t;
18 18
19#define __RAW_RW_LOCK_UNLOCKED { 0, 0 } 19#define __RAW_RW_LOCK_UNLOCKED { 0 }
20 20
21#endif 21#endif
diff --git a/include/asm-s390/string.h b/include/asm-s390/string.h
index 23a4c390489f..d074673a6d9b 100644
--- a/include/asm-s390/string.h
+++ b/include/asm-s390/string.h
@@ -60,12 +60,13 @@ static inline void *memchr(const void * s, int c, size_t n)
60 register int r0 asm("0") = (char) c; 60 register int r0 asm("0") = (char) c;
61 const void *ret = s + n; 61 const void *ret = s + n;
62 62
63 asm volatile ("0: srst %0,%1\n" 63 asm volatile(
64 " jo 0b\n" 64 "0: srst %0,%1\n"
65 " jl 1f\n" 65 " jo 0b\n"
66 " la %0,0\n" 66 " jl 1f\n"
67 "1:" 67 " la %0,0\n"
68 : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" ); 68 "1:"
69 : "+a" (ret), "+&a" (s) : "d" (r0) : "cc");
69 return (void *) ret; 70 return (void *) ret;
70} 71}
71 72
@@ -74,9 +75,10 @@ static inline void *memscan(void *s, int c, size_t n)
74 register int r0 asm("0") = (char) c; 75 register int r0 asm("0") = (char) c;
75 const void *ret = s + n; 76 const void *ret = s + n;
76 77
77 asm volatile ("0: srst %0,%1\n" 78 asm volatile(
78 " jo 0b\n" 79 "0: srst %0,%1\n"
79 : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" ); 80 " jo 0b\n"
81 : "+a" (ret), "+&a" (s) : "d" (r0) : "cc");
80 return (void *) ret; 82 return (void *) ret;
81} 83}
82 84
@@ -86,12 +88,13 @@ static inline char *strcat(char *dst, const char *src)
86 unsigned long dummy; 88 unsigned long dummy;
87 char *ret = dst; 89 char *ret = dst;
88 90
89 asm volatile ("0: srst %0,%1\n" 91 asm volatile(
90 " jo 0b\n" 92 "0: srst %0,%1\n"
91 "1: mvst %0,%2\n" 93 " jo 0b\n"
92 " jo 1b" 94 "1: mvst %0,%2\n"
93 : "=&a" (dummy), "+a" (dst), "+a" (src) 95 " jo 1b"
94 : "d" (r0), "0" (0) : "cc", "memory" ); 96 : "=&a" (dummy), "+a" (dst), "+a" (src)
97 : "d" (r0), "0" (0) : "cc", "memory" );
95 return ret; 98 return ret;
96} 99}
97 100
@@ -100,10 +103,11 @@ static inline char *strcpy(char *dst, const char *src)
100 register int r0 asm("0") = 0; 103 register int r0 asm("0") = 0;
101 char *ret = dst; 104 char *ret = dst;
102 105
103 asm volatile ("0: mvst %0,%1\n" 106 asm volatile(
104 " jo 0b" 107 "0: mvst %0,%1\n"
105 : "+&a" (dst), "+&a" (src) : "d" (r0) 108 " jo 0b"
106 : "cc", "memory" ); 109 : "+&a" (dst), "+&a" (src) : "d" (r0)
110 : "cc", "memory");
107 return ret; 111 return ret;
108} 112}
109 113
@@ -112,9 +116,10 @@ static inline size_t strlen(const char *s)
112 register unsigned long r0 asm("0") = 0; 116 register unsigned long r0 asm("0") = 0;
113 const char *tmp = s; 117 const char *tmp = s;
114 118
115 asm volatile ("0: srst %0,%1\n" 119 asm volatile(
116 " jo 0b" 120 "0: srst %0,%1\n"
117 : "+d" (r0), "+a" (tmp) : : "cc" ); 121 " jo 0b"
122 : "+d" (r0), "+a" (tmp) : : "cc");
118 return r0 - (unsigned long) s; 123 return r0 - (unsigned long) s;
119} 124}
120 125
@@ -124,9 +129,10 @@ static inline size_t strnlen(const char * s, size_t n)
124 const char *tmp = s; 129 const char *tmp = s;
125 const char *end = s + n; 130 const char *end = s + n;
126 131
127 asm volatile ("0: srst %0,%1\n" 132 asm volatile(
128 " jo 0b" 133 "0: srst %0,%1\n"
129 : "+a" (end), "+a" (tmp) : "d" (r0) : "cc" ); 134 " jo 0b"
135 : "+a" (end), "+a" (tmp) : "d" (r0) : "cc");
130 return end - s; 136 return end - s;
131} 137}
132 138
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 16040048cd1b..ccbafe4bf2cb 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -23,74 +23,68 @@ struct task_struct;
23 23
24extern struct task_struct *__switch_to(void *, void *); 24extern struct task_struct *__switch_to(void *, void *);
25 25
26#ifdef __s390x__
27#define __FLAG_SHIFT 56
28#else /* ! __s390x__ */
29#define __FLAG_SHIFT 24
30#endif /* ! __s390x__ */
31
32static inline void save_fp_regs(s390_fp_regs *fpregs) 26static inline void save_fp_regs(s390_fp_regs *fpregs)
33{ 27{
34 asm volatile ( 28 asm volatile(
35 " std 0,8(%1)\n" 29 " std 0,8(%1)\n"
36 " std 2,24(%1)\n" 30 " std 2,24(%1)\n"
37 " std 4,40(%1)\n" 31 " std 4,40(%1)\n"
38 " std 6,56(%1)" 32 " std 6,56(%1)"
39 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory" ); 33 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory");
40 if (!MACHINE_HAS_IEEE) 34 if (!MACHINE_HAS_IEEE)
41 return; 35 return;
42 asm volatile( 36 asm volatile(
43 " stfpc 0(%1)\n" 37 " stfpc 0(%1)\n"
44 " std 1,16(%1)\n" 38 " std 1,16(%1)\n"
45 " std 3,32(%1)\n" 39 " std 3,32(%1)\n"
46 " std 5,48(%1)\n" 40 " std 5,48(%1)\n"
47 " std 7,64(%1)\n" 41 " std 7,64(%1)\n"
48 " std 8,72(%1)\n" 42 " std 8,72(%1)\n"
49 " std 9,80(%1)\n" 43 " std 9,80(%1)\n"
50 " std 10,88(%1)\n" 44 " std 10,88(%1)\n"
51 " std 11,96(%1)\n" 45 " std 11,96(%1)\n"
52 " std 12,104(%1)\n" 46 " std 12,104(%1)\n"
53 " std 13,112(%1)\n" 47 " std 13,112(%1)\n"
54 " std 14,120(%1)\n" 48 " std 14,120(%1)\n"
55 " std 15,128(%1)\n" 49 " std 15,128(%1)\n"
56 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory" ); 50 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory");
57} 51}
58 52
59static inline void restore_fp_regs(s390_fp_regs *fpregs) 53static inline void restore_fp_regs(s390_fp_regs *fpregs)
60{ 54{
61 asm volatile ( 55 asm volatile(
62 " ld 0,8(%0)\n" 56 " ld 0,8(%0)\n"
63 " ld 2,24(%0)\n" 57 " ld 2,24(%0)\n"
64 " ld 4,40(%0)\n" 58 " ld 4,40(%0)\n"
65 " ld 6,56(%0)" 59 " ld 6,56(%0)"
66 : : "a" (fpregs), "m" (*fpregs) ); 60 : : "a" (fpregs), "m" (*fpregs));
67 if (!MACHINE_HAS_IEEE) 61 if (!MACHINE_HAS_IEEE)
68 return; 62 return;
69 asm volatile( 63 asm volatile(
70 " lfpc 0(%0)\n" 64 " lfpc 0(%0)\n"
71 " ld 1,16(%0)\n" 65 " ld 1,16(%0)\n"
72 " ld 3,32(%0)\n" 66 " ld 3,32(%0)\n"
73 " ld 5,48(%0)\n" 67 " ld 5,48(%0)\n"
74 " ld 7,64(%0)\n" 68 " ld 7,64(%0)\n"
75 " ld 8,72(%0)\n" 69 " ld 8,72(%0)\n"
76 " ld 9,80(%0)\n" 70 " ld 9,80(%0)\n"
77 " ld 10,88(%0)\n" 71 " ld 10,88(%0)\n"
78 " ld 11,96(%0)\n" 72 " ld 11,96(%0)\n"
79 " ld 12,104(%0)\n" 73 " ld 12,104(%0)\n"
80 " ld 13,112(%0)\n" 74 " ld 13,112(%0)\n"
81 " ld 14,120(%0)\n" 75 " ld 14,120(%0)\n"
82 " ld 15,128(%0)\n" 76 " ld 15,128(%0)\n"
83 : : "a" (fpregs), "m" (*fpregs) ); 77 : : "a" (fpregs), "m" (*fpregs));
84} 78}
85 79
86static inline void save_access_regs(unsigned int *acrs) 80static inline void save_access_regs(unsigned int *acrs)
87{ 81{
88 asm volatile ("stam 0,15,0(%0)" : : "a" (acrs) : "memory" ); 82 asm volatile("stam 0,15,0(%0)" : : "a" (acrs) : "memory");
89} 83}
90 84
91static inline void restore_access_regs(unsigned int *acrs) 85static inline void restore_access_regs(unsigned int *acrs)
92{ 86{
93 asm volatile ("lam 0,15,0(%0)" : : "a" (acrs) ); 87 asm volatile("lam 0,15,0(%0)" : : "a" (acrs));
94} 88}
95 89
96#define switch_to(prev,next,last) do { \ 90#define switch_to(prev,next,last) do { \
@@ -126,7 +120,7 @@ extern void account_system_vtime(struct task_struct *);
126 account_vtime(prev); \ 120 account_vtime(prev); \
127} while (0) 121} while (0)
128 122
129#define nop() __asm__ __volatile__ ("nop") 123#define nop() asm volatile("nop")
130 124
131#define xchg(ptr,x) \ 125#define xchg(ptr,x) \
132({ \ 126({ \
@@ -147,15 +141,15 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
147 shift = (3 ^ (addr & 3)) << 3; 141 shift = (3 ^ (addr & 3)) << 3;
148 addr ^= addr & 3; 142 addr ^= addr & 3;
149 asm volatile( 143 asm volatile(
150 " l %0,0(%4)\n" 144 " l %0,0(%4)\n"
151 "0: lr 0,%0\n" 145 "0: lr 0,%0\n"
152 " nr 0,%3\n" 146 " nr 0,%3\n"
153 " or 0,%2\n" 147 " or 0,%2\n"
154 " cs %0,0,0(%4)\n" 148 " cs %0,0,0(%4)\n"
155 " jl 0b\n" 149 " jl 0b\n"
156 : "=&d" (old), "=m" (*(int *) addr) 150 : "=&d" (old), "=m" (*(int *) addr)
157 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr), 151 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr),
158 "m" (*(int *) addr) : "memory", "cc", "0" ); 152 "m" (*(int *) addr) : "memory", "cc", "0");
159 x = old >> shift; 153 x = old >> shift;
160 break; 154 break;
161 case 2: 155 case 2:
@@ -163,36 +157,36 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
163 shift = (2 ^ (addr & 2)) << 3; 157 shift = (2 ^ (addr & 2)) << 3;
164 addr ^= addr & 2; 158 addr ^= addr & 2;
165 asm volatile( 159 asm volatile(
166 " l %0,0(%4)\n" 160 " l %0,0(%4)\n"
167 "0: lr 0,%0\n" 161 "0: lr 0,%0\n"
168 " nr 0,%3\n" 162 " nr 0,%3\n"
169 " or 0,%2\n" 163 " or 0,%2\n"
170 " cs %0,0,0(%4)\n" 164 " cs %0,0,0(%4)\n"
171 " jl 0b\n" 165 " jl 0b\n"
172 : "=&d" (old), "=m" (*(int *) addr) 166 : "=&d" (old), "=m" (*(int *) addr)
173 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr), 167 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr),
174 "m" (*(int *) addr) : "memory", "cc", "0" ); 168 "m" (*(int *) addr) : "memory", "cc", "0");
175 x = old >> shift; 169 x = old >> shift;
176 break; 170 break;
177 case 4: 171 case 4:
178 asm volatile ( 172 asm volatile(
179 " l %0,0(%3)\n" 173 " l %0,0(%3)\n"
180 "0: cs %0,%2,0(%3)\n" 174 "0: cs %0,%2,0(%3)\n"
181 " jl 0b\n" 175 " jl 0b\n"
182 : "=&d" (old), "=m" (*(int *) ptr) 176 : "=&d" (old), "=m" (*(int *) ptr)
183 : "d" (x), "a" (ptr), "m" (*(int *) ptr) 177 : "d" (x), "a" (ptr), "m" (*(int *) ptr)
184 : "memory", "cc" ); 178 : "memory", "cc");
185 x = old; 179 x = old;
186 break; 180 break;
187#ifdef __s390x__ 181#ifdef __s390x__
188 case 8: 182 case 8:
189 asm volatile ( 183 asm volatile(
190 " lg %0,0(%3)\n" 184 " lg %0,0(%3)\n"
191 "0: csg %0,%2,0(%3)\n" 185 "0: csg %0,%2,0(%3)\n"
192 " jl 0b\n" 186 " jl 0b\n"
193 : "=&d" (old), "=m" (*(long *) ptr) 187 : "=&d" (old), "=m" (*(long *) ptr)
194 : "d" (x), "a" (ptr), "m" (*(long *) ptr) 188 : "d" (x), "a" (ptr), "m" (*(long *) ptr)
195 : "memory", "cc" ); 189 : "memory", "cc");
196 x = old; 190 x = old;
197 break; 191 break;
198#endif /* __s390x__ */ 192#endif /* __s390x__ */
@@ -224,55 +218,55 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
224 shift = (3 ^ (addr & 3)) << 3; 218 shift = (3 ^ (addr & 3)) << 3;
225 addr ^= addr & 3; 219 addr ^= addr & 3;
226 asm volatile( 220 asm volatile(
227 " l %0,0(%4)\n" 221 " l %0,0(%4)\n"
228 "0: nr %0,%5\n" 222 "0: nr %0,%5\n"
229 " lr %1,%0\n" 223 " lr %1,%0\n"
230 " or %0,%2\n" 224 " or %0,%2\n"
231 " or %1,%3\n" 225 " or %1,%3\n"
232 " cs %0,%1,0(%4)\n" 226 " cs %0,%1,0(%4)\n"
233 " jnl 1f\n" 227 " jnl 1f\n"
234 " xr %1,%0\n" 228 " xr %1,%0\n"
235 " nr %1,%5\n" 229 " nr %1,%5\n"
236 " jnz 0b\n" 230 " jnz 0b\n"
237 "1:" 231 "1:"
238 : "=&d" (prev), "=&d" (tmp) 232 : "=&d" (prev), "=&d" (tmp)
239 : "d" (old << shift), "d" (new << shift), "a" (ptr), 233 : "d" (old << shift), "d" (new << shift), "a" (ptr),
240 "d" (~(255 << shift)) 234 "d" (~(255 << shift))
241 : "memory", "cc" ); 235 : "memory", "cc");
242 return prev >> shift; 236 return prev >> shift;
243 case 2: 237 case 2:
244 addr = (unsigned long) ptr; 238 addr = (unsigned long) ptr;
245 shift = (2 ^ (addr & 2)) << 3; 239 shift = (2 ^ (addr & 2)) << 3;
246 addr ^= addr & 2; 240 addr ^= addr & 2;
247 asm volatile( 241 asm volatile(
248 " l %0,0(%4)\n" 242 " l %0,0(%4)\n"
249 "0: nr %0,%5\n" 243 "0: nr %0,%5\n"
250 " lr %1,%0\n" 244 " lr %1,%0\n"
251 " or %0,%2\n" 245 " or %0,%2\n"
252 " or %1,%3\n" 246 " or %1,%3\n"
253 " cs %0,%1,0(%4)\n" 247 " cs %0,%1,0(%4)\n"
254 " jnl 1f\n" 248 " jnl 1f\n"
255 " xr %1,%0\n" 249 " xr %1,%0\n"
256 " nr %1,%5\n" 250 " nr %1,%5\n"
257 " jnz 0b\n" 251 " jnz 0b\n"
258 "1:" 252 "1:"
259 : "=&d" (prev), "=&d" (tmp) 253 : "=&d" (prev), "=&d" (tmp)
260 : "d" (old << shift), "d" (new << shift), "a" (ptr), 254 : "d" (old << shift), "d" (new << shift), "a" (ptr),
261 "d" (~(65535 << shift)) 255 "d" (~(65535 << shift))
262 : "memory", "cc" ); 256 : "memory", "cc");
263 return prev >> shift; 257 return prev >> shift;
264 case 4: 258 case 4:
265 asm volatile ( 259 asm volatile(
266 " cs %0,%2,0(%3)\n" 260 " cs %0,%2,0(%3)\n"
267 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) 261 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
268 : "memory", "cc" ); 262 : "memory", "cc");
269 return prev; 263 return prev;
270#ifdef __s390x__ 264#ifdef __s390x__
271 case 8: 265 case 8:
272 asm volatile ( 266 asm volatile(
273 " csg %0,%2,0(%3)\n" 267 " csg %0,%2,0(%3)\n"
274 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) 268 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
275 : "memory", "cc" ); 269 : "memory", "cc");
276 return prev; 270 return prev;
277#endif /* __s390x__ */ 271#endif /* __s390x__ */
278 } 272 }
@@ -289,8 +283,8 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
289 * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ). 283 * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ).
290 */ 284 */
291 285
292#define eieio() __asm__ __volatile__ ( "bcr 15,0" : : : "memory" ) 286#define eieio() asm volatile("bcr 15,0" : : : "memory")
293# define SYNC_OTHER_CORES(x) eieio() 287#define SYNC_OTHER_CORES(x) eieio()
294#define mb() eieio() 288#define mb() eieio()
295#define rmb() eieio() 289#define rmb() eieio()
296#define wmb() eieio() 290#define wmb() eieio()
@@ -307,117 +301,56 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
307 301
308#ifdef __s390x__ 302#ifdef __s390x__
309 303
310#define __ctl_load(array, low, high) ({ \ 304#define __ctl_load(array, low, high) ({ \
311 typedef struct { char _[sizeof(array)]; } addrtype; \ 305 typedef struct { char _[sizeof(array)]; } addrtype; \
312 __asm__ __volatile__ ( \ 306 asm volatile( \
313 " bras 1,0f\n" \ 307 " lctlg %1,%2,0(%0)\n" \
314 " lctlg 0,0,0(%0)\n" \ 308 : : "a" (&array), "i" (low), "i" (high), \
315 "0: ex %1,0(1)" \ 309 "m" (*(addrtype *)(array))); \
316 : : "a" (&array), "a" (((low)<<4)+(high)), \
317 "m" (*(addrtype *)(array)) : "1" ); \
318 }) 310 })
319 311
320#define __ctl_store(array, low, high) ({ \ 312#define __ctl_store(array, low, high) ({ \
321 typedef struct { char _[sizeof(array)]; } addrtype; \ 313 typedef struct { char _[sizeof(array)]; } addrtype; \
322 __asm__ __volatile__ ( \ 314 asm volatile( \
323 " bras 1,0f\n" \ 315 " stctg %2,%3,0(%1)\n" \
324 " stctg 0,0,0(%1)\n" \ 316 : "=m" (*(addrtype *)(array)) \
325 "0: ex %2,0(1)" \ 317 : "a" (&array), "i" (low), "i" (high)); \
326 : "=m" (*(addrtype *)(array)) \
327 : "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \
328 }) 318 })
329 319
330#define __ctl_set_bit(cr, bit) ({ \
331 __u8 __dummy[24]; \
332 __asm__ __volatile__ ( \
333 " bras 1,0f\n" /* skip indirect insns */ \
334 " stctg 0,0,0(%1)\n" \
335 " lctlg 0,0,0(%1)\n" \
336 "0: ex %2,0(1)\n" /* execute stctl */ \
337 " lg 0,0(%1)\n" \
338 " ogr 0,%3\n" /* set the bit */ \
339 " stg 0,0(%1)\n" \
340 "1: ex %2,6(1)" /* execute lctl */ \
341 : "=m" (__dummy) \
342 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
343 "a" (cr*17), "a" (1L<<(bit)) \
344 : "cc", "0", "1" ); \
345 })
346
347#define __ctl_clear_bit(cr, bit) ({ \
348 __u8 __dummy[16]; \
349 __asm__ __volatile__ ( \
350 " bras 1,0f\n" /* skip indirect insns */ \
351 " stctg 0,0,0(%1)\n" \
352 " lctlg 0,0,0(%1)\n" \
353 "0: ex %2,0(1)\n" /* execute stctl */ \
354 " lg 0,0(%1)\n" \
355 " ngr 0,%3\n" /* set the bit */ \
356 " stg 0,0(%1)\n" \
357 "1: ex %2,6(1)" /* execute lctl */ \
358 : "=m" (__dummy) \
359 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
360 "a" (cr*17), "a" (~(1L<<(bit))) \
361 : "cc", "0", "1" ); \
362 })
363
364#else /* __s390x__ */ 320#else /* __s390x__ */
365 321
366#define __ctl_load(array, low, high) ({ \ 322#define __ctl_load(array, low, high) ({ \
367 typedef struct { char _[sizeof(array)]; } addrtype; \ 323 typedef struct { char _[sizeof(array)]; } addrtype; \
368 __asm__ __volatile__ ( \ 324 asm volatile( \
369 " bras 1,0f\n" \ 325 " lctl %1,%2,0(%0)\n" \
370 " lctl 0,0,0(%0)\n" \ 326 : : "a" (&array), "i" (low), "i" (high), \
371 "0: ex %1,0(1)" \ 327 "m" (*(addrtype *)(array))); \
372 : : "a" (&array), "a" (((low)<<4)+(high)), \ 328})
373 "m" (*(addrtype *)(array)) : "1" ); \
374 })
375 329
376#define __ctl_store(array, low, high) ({ \ 330#define __ctl_store(array, low, high) ({ \
377 typedef struct { char _[sizeof(array)]; } addrtype; \ 331 typedef struct { char _[sizeof(array)]; } addrtype; \
378 __asm__ __volatile__ ( \ 332 asm volatile( \
379 " bras 1,0f\n" \ 333 " stctl %2,%3,0(%1)\n" \
380 " stctl 0,0,0(%1)\n" \ 334 : "=m" (*(addrtype *)(array)) \
381 "0: ex %2,0(1)" \ 335 : "a" (&array), "i" (low), "i" (high)); \
382 : "=m" (*(addrtype *)(array)) \
383 : "a" (&array), "a" (((low)<<4)+(high)): "1" ); \
384 }) 336 })
385 337
386#define __ctl_set_bit(cr, bit) ({ \
387 __u8 __dummy[16]; \
388 __asm__ __volatile__ ( \
389 " bras 1,0f\n" /* skip indirect insns */ \
390 " stctl 0,0,0(%1)\n" \
391 " lctl 0,0,0(%1)\n" \
392 "0: ex %2,0(1)\n" /* execute stctl */ \
393 " l 0,0(%1)\n" \
394 " or 0,%3\n" /* set the bit */ \
395 " st 0,0(%1)\n" \
396 "1: ex %2,4(1)" /* execute lctl */ \
397 : "=m" (__dummy) \
398 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
399 "a" (cr*17), "a" (1<<(bit)) \
400 : "cc", "0", "1" ); \
401 })
402
403#define __ctl_clear_bit(cr, bit) ({ \
404 __u8 __dummy[16]; \
405 __asm__ __volatile__ ( \
406 " bras 1,0f\n" /* skip indirect insns */ \
407 " stctl 0,0,0(%1)\n" \
408 " lctl 0,0,0(%1)\n" \
409 "0: ex %2,0(1)\n" /* execute stctl */ \
410 " l 0,0(%1)\n" \
411 " nr 0,%3\n" /* set the bit */ \
412 " st 0,0(%1)\n" \
413 "1: ex %2,4(1)" /* execute lctl */ \
414 : "=m" (__dummy) \
415 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
416 "a" (cr*17), "a" (~(1<<(bit))) \
417 : "cc", "0", "1" ); \
418 })
419#endif /* __s390x__ */ 338#endif /* __s390x__ */
420 339
340#define __ctl_set_bit(cr, bit) ({ \
341 unsigned long __dummy; \
342 __ctl_store(__dummy, cr, cr); \
343 __dummy |= 1UL << (bit); \
344 __ctl_load(__dummy, cr, cr); \
345})
346
347#define __ctl_clear_bit(cr, bit) ({ \
348 unsigned long __dummy; \
349 __ctl_store(__dummy, cr, cr); \
350 __dummy &= ~(1UL << (bit)); \
351 __ctl_load(__dummy, cr, cr); \
352})
353
421#include <linux/irqflags.h> 354#include <linux/irqflags.h>
422 355
423/* 356/*
@@ -427,8 +360,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
427static inline void 360static inline void
428__set_psw_mask(unsigned long mask) 361__set_psw_mask(unsigned long mask)
429{ 362{
430 local_save_flags(mask); 363 __load_psw_mask(mask | (__raw_local_irq_stosm(0x00) & ~(-1UL >> 8)));
431 __load_psw_mask(mask);
432} 364}
433 365
434#define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS) 366#define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS)
diff --git a/include/asm-s390/timex.h b/include/asm-s390/timex.h
index 5d0332a4c2bd..4df4a41029a3 100644
--- a/include/asm-s390/timex.h
+++ b/include/asm-s390/timex.h
@@ -15,20 +15,21 @@
15 15
16typedef unsigned long long cycles_t; 16typedef unsigned long long cycles_t;
17 17
18static inline cycles_t get_cycles(void)
19{
20 cycles_t cycles;
21
22 __asm__ __volatile__ ("stck 0(%1)" : "=m" (cycles) : "a" (&cycles) : "cc");
23 return cycles >> 2;
24}
25
26static inline unsigned long long get_clock (void) 18static inline unsigned long long get_clock (void)
27{ 19{
28 unsigned long long clk; 20 unsigned long long clk;
29 21
30 __asm__ __volatile__ ("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc"); 22#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
23 asm volatile("stck %0" : "=Q" (clk) : : "cc");
24#else /* __GNUC__ */
25 asm volatile("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc");
26#endif /* __GNUC__ */
31 return clk; 27 return clk;
32} 28}
33 29
30static inline cycles_t get_cycles(void)
31{
32 return (cycles_t) get_clock() >> 2;
33}
34
34#endif 35#endif
diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h
index 73cd85bebfb2..fa4dc916a9bf 100644
--- a/include/asm-s390/tlbflush.h
+++ b/include/asm-s390/tlbflush.h
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#define local_flush_tlb() \ 27#define local_flush_tlb() \
28do { __asm__ __volatile__("ptlb": : :"memory"); } while (0) 28do { asm volatile("ptlb": : :"memory"); } while (0)
29 29
30#ifndef CONFIG_SMP 30#ifndef CONFIG_SMP
31 31
@@ -68,24 +68,24 @@ extern void smp_ptlb_all(void);
68 68
69static inline void global_flush_tlb(void) 69static inline void global_flush_tlb(void)
70{ 70{
71 register unsigned long reg2 asm("2");
72 register unsigned long reg3 asm("3");
73 register unsigned long reg4 asm("4");
74 long dummy;
75
71#ifndef __s390x__ 76#ifndef __s390x__
72 if (!MACHINE_HAS_CSP) { 77 if (!MACHINE_HAS_CSP) {
73 smp_ptlb_all(); 78 smp_ptlb_all();
74 return; 79 return;
75 } 80 }
76#endif /* __s390x__ */ 81#endif /* __s390x__ */
77 { 82
78 register unsigned long addr asm("4"); 83 dummy = 0;
79 long dummy; 84 reg2 = reg3 = 0;
80 85 reg4 = ((unsigned long) &dummy) + 1;
81 dummy = 0; 86 asm volatile(
82 addr = ((unsigned long) &dummy) + 1; 87 " csp %0,%2"
83 __asm__ __volatile__ ( 88 : : "d" (reg2), "d" (reg3), "d" (reg4), "m" (dummy) : "cc" );
84 " slr 2,2\n"
85 " slr 3,3\n"
86 " csp 2,%0"
87 : : "a" (addr), "m" (dummy) : "cc", "2", "3" );
88 }
89} 89}
90 90
91/* 91/*
@@ -102,9 +102,9 @@ static inline void __flush_tlb_mm(struct mm_struct * mm)
102 if (unlikely(cpus_empty(mm->cpu_vm_mask))) 102 if (unlikely(cpus_empty(mm->cpu_vm_mask)))
103 return; 103 return;
104 if (MACHINE_HAS_IDTE) { 104 if (MACHINE_HAS_IDTE) {
105 asm volatile (".insn rrf,0xb98e0000,0,%0,%1,0" 105 asm volatile(
106 : : "a" (2048), 106 " .insn rrf,0xb98e0000,0,%0,%1,0"
107 "a" (__pa(mm->pgd)&PAGE_MASK) : "cc" ); 107 : : "a" (2048), "a" (__pa(mm->pgd)&PAGE_MASK) : "cc");
108 return; 108 return;
109 } 109 }
110 preempt_disable(); 110 preempt_disable();
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index e2047b0c9092..72ae4efddb49 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -38,25 +38,14 @@
38#define get_ds() (KERNEL_DS) 38#define get_ds() (KERNEL_DS)
39#define get_fs() (current->thread.mm_segment) 39#define get_fs() (current->thread.mm_segment)
40 40
41#ifdef __s390x__
42#define set_fs(x) \ 41#define set_fs(x) \
43({ \ 42({ \
44 unsigned long __pto; \ 43 unsigned long __pto; \
45 current->thread.mm_segment = (x); \ 44 current->thread.mm_segment = (x); \
46 __pto = current->thread.mm_segment.ar4 ? \ 45 __pto = current->thread.mm_segment.ar4 ? \
47 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ 46 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \
48 asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ 47 __ctl_load(__pto, 7, 7); \
49}) 48})
50#else /* __s390x__ */
51#define set_fs(x) \
52({ \
53 unsigned long __pto; \
54 current->thread.mm_segment = (x); \
55 __pto = current->thread.mm_segment.ar4 ? \
56 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \
57 asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \
58})
59#endif /* __s390x__ */
60 49
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 50#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 51
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 02b942d85c37..a19238cbcffa 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -247,8 +247,10 @@
247#define __NR_sync_file_range 307 247#define __NR_sync_file_range 307
248#define __NR_tee 308 248#define __NR_tee 308
249#define __NR_vmsplice 309 249#define __NR_vmsplice 309
250/* Number 310 is reserved for new sys_move_pages */
251#define __NR_getcpu 311
250 252
251#define NR_syscalls 310 253#define NR_syscalls 312
252 254
253/* 255/*
254 * There are some system calls that are not present on 64 bit, some 256 * There are some system calls that are not present on 64 bit, some
@@ -342,9 +344,11 @@
342 344
343#ifdef __KERNEL__ 345#ifdef __KERNEL__
344 346
347#include <linux/err.h>
348
345#define __syscall_return(type, res) \ 349#define __syscall_return(type, res) \
346do { \ 350do { \
347 if ((unsigned long)(res) >= (unsigned long)(-4095)) {\ 351 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
348 errno = -(res); \ 352 errno = -(res); \
349 res = -1; \ 353 res = -1; \
350 } \ 354 } \
@@ -353,145 +357,145 @@ do { \
353 357
354#define _svc_clobber "1", "cc", "memory" 358#define _svc_clobber "1", "cc", "memory"
355 359
356#define _syscall0(type,name) \ 360#define _syscall0(type,name) \
357type name(void) { \ 361type name(void) { \
358 register long __svcres asm("2"); \ 362 register long __svcres asm("2"); \
359 long __res; \ 363 long __res; \
360 __asm__ __volatile__ ( \ 364 asm volatile( \
361 " .if %1 < 256\n" \ 365 " .if %1 < 256\n" \
362 " svc %b1\n" \ 366 " svc %b1\n" \
363 " .else\n" \ 367 " .else\n" \
364 " la %%r1,%1\n" \ 368 " la %%r1,%1\n" \
365 " svc 0\n" \ 369 " svc 0\n" \
366 " .endif" \ 370 " .endif" \
367 : "=d" (__svcres) \ 371 : "=d" (__svcres) \
368 : "i" (__NR_##name) \ 372 : "i" (__NR_##name) \
369 : _svc_clobber ); \ 373 : _svc_clobber); \
370 __res = __svcres; \ 374 __res = __svcres; \
371 __syscall_return(type,__res); \ 375 __syscall_return(type,__res); \
372} 376}
373 377
374#define _syscall1(type,name,type1,arg1) \ 378#define _syscall1(type,name,type1,arg1) \
375type name(type1 arg1) { \ 379type name(type1 arg1) { \
376 register type1 __arg1 asm("2") = arg1; \ 380 register type1 __arg1 asm("2") = arg1; \
377 register long __svcres asm("2"); \ 381 register long __svcres asm("2"); \
378 long __res; \ 382 long __res; \
379 __asm__ __volatile__ ( \ 383 asm volatile( \
380 " .if %1 < 256\n" \ 384 " .if %1 < 256\n" \
381 " svc %b1\n" \ 385 " svc %b1\n" \
382 " .else\n" \ 386 " .else\n" \
383 " la %%r1,%1\n" \ 387 " la %%r1,%1\n" \
384 " svc 0\n" \ 388 " svc 0\n" \
385 " .endif" \ 389 " .endif" \
386 : "=d" (__svcres) \ 390 : "=d" (__svcres) \
387 : "i" (__NR_##name), \ 391 : "i" (__NR_##name), \
388 "0" (__arg1) \ 392 "0" (__arg1) \
389 : _svc_clobber ); \ 393 : _svc_clobber); \
390 __res = __svcres; \ 394 __res = __svcres; \
391 __syscall_return(type,__res); \ 395 __syscall_return(type,__res); \
392} 396}
393 397
394#define _syscall2(type,name,type1,arg1,type2,arg2) \ 398#define _syscall2(type,name,type1,arg1,type2,arg2) \
395type name(type1 arg1, type2 arg2) { \ 399type name(type1 arg1, type2 arg2) { \
396 register type1 __arg1 asm("2") = arg1; \ 400 register type1 __arg1 asm("2") = arg1; \
397 register type2 __arg2 asm("3") = arg2; \ 401 register type2 __arg2 asm("3") = arg2; \
398 register long __svcres asm("2"); \ 402 register long __svcres asm("2"); \
399 long __res; \ 403 long __res; \
400 __asm__ __volatile__ ( \ 404 asm volatile( \
401 " .if %1 < 256\n" \ 405 " .if %1 < 256\n" \
402 " svc %b1\n" \ 406 " svc %b1\n" \
403 " .else\n" \ 407 " .else\n" \
404 " la %%r1,%1\n" \ 408 " la %%r1,%1\n" \
405 " svc 0\n" \ 409 " svc 0\n" \
406 " .endif" \ 410 " .endif" \
407 : "=d" (__svcres) \ 411 : "=d" (__svcres) \
408 : "i" (__NR_##name), \ 412 : "i" (__NR_##name), \
409 "0" (__arg1), \ 413 "0" (__arg1), \
410 "d" (__arg2) \ 414 "d" (__arg2) \
411 : _svc_clobber ); \ 415 : _svc_clobber ); \
412 __res = __svcres; \ 416 __res = __svcres; \
413 __syscall_return(type,__res); \ 417 __syscall_return(type,__res); \
414} 418}
415 419
416#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\ 420#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
417type name(type1 arg1, type2 arg2, type3 arg3) { \ 421type name(type1 arg1, type2 arg2, type3 arg3) { \
418 register type1 __arg1 asm("2") = arg1; \ 422 register type1 __arg1 asm("2") = arg1; \
419 register type2 __arg2 asm("3") = arg2; \ 423 register type2 __arg2 asm("3") = arg2; \
420 register type3 __arg3 asm("4") = arg3; \ 424 register type3 __arg3 asm("4") = arg3; \
421 register long __svcres asm("2"); \ 425 register long __svcres asm("2"); \
422 long __res; \ 426 long __res; \
423 __asm__ __volatile__ ( \ 427 asm volatile( \
424 " .if %1 < 256\n" \ 428 " .if %1 < 256\n" \
425 " svc %b1\n" \ 429 " svc %b1\n" \
426 " .else\n" \ 430 " .else\n" \
427 " la %%r1,%1\n" \ 431 " la %%r1,%1\n" \
428 " svc 0\n" \ 432 " svc 0\n" \
429 " .endif" \ 433 " .endif" \
430 : "=d" (__svcres) \ 434 : "=d" (__svcres) \
431 : "i" (__NR_##name), \ 435 : "i" (__NR_##name), \
432 "0" (__arg1), \ 436 "0" (__arg1), \
433 "d" (__arg2), \ 437 "d" (__arg2), \
434 "d" (__arg3) \ 438 "d" (__arg3) \
435 : _svc_clobber ); \ 439 : _svc_clobber); \
436 __res = __svcres; \ 440 __res = __svcres; \
437 __syscall_return(type,__res); \ 441 __syscall_return(type,__res); \
438} 442}
439 443
440#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\ 444#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
441 type4,name4) \ 445 type4,name4) \
442type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ 446type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
443 register type1 __arg1 asm("2") = arg1; \ 447 register type1 __arg1 asm("2") = arg1; \
444 register type2 __arg2 asm("3") = arg2; \ 448 register type2 __arg2 asm("3") = arg2; \
445 register type3 __arg3 asm("4") = arg3; \ 449 register type3 __arg3 asm("4") = arg3; \
446 register type4 __arg4 asm("5") = arg4; \ 450 register type4 __arg4 asm("5") = arg4; \
447 register long __svcres asm("2"); \ 451 register long __svcres asm("2"); \
448 long __res; \ 452 long __res; \
449 __asm__ __volatile__ ( \ 453 asm volatile( \
450 " .if %1 < 256\n" \ 454 " .if %1 < 256\n" \
451 " svc %b1\n" \ 455 " svc %b1\n" \
452 " .else\n" \ 456 " .else\n" \
453 " la %%r1,%1\n" \ 457 " la %%r1,%1\n" \
454 " svc 0\n" \ 458 " svc 0\n" \
455 " .endif" \ 459 " .endif" \
456 : "=d" (__svcres) \ 460 : "=d" (__svcres) \
457 : "i" (__NR_##name), \ 461 : "i" (__NR_##name), \
458 "0" (__arg1), \ 462 "0" (__arg1), \
459 "d" (__arg2), \ 463 "d" (__arg2), \
460 "d" (__arg3), \ 464 "d" (__arg3), \
461 "d" (__arg4) \ 465 "d" (__arg4) \
462 : _svc_clobber ); \ 466 : _svc_clobber); \
463 __res = __svcres; \ 467 __res = __svcres; \
464 __syscall_return(type,__res); \ 468 __syscall_return(type,__res); \
465} 469}
466 470
467#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\ 471#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
468 type4,name4,type5,name5) \ 472 type4,name4,type5,name5) \
469type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 473type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
470 type5 arg5) { \ 474 type5 arg5) { \
471 register type1 __arg1 asm("2") = arg1; \ 475 register type1 __arg1 asm("2") = arg1; \
472 register type2 __arg2 asm("3") = arg2; \ 476 register type2 __arg2 asm("3") = arg2; \
473 register type3 __arg3 asm("4") = arg3; \ 477 register type3 __arg3 asm("4") = arg3; \
474 register type4 __arg4 asm("5") = arg4; \ 478 register type4 __arg4 asm("5") = arg4; \
475 register type5 __arg5 asm("6") = arg5; \ 479 register type5 __arg5 asm("6") = arg5; \
476 register long __svcres asm("2"); \ 480 register long __svcres asm("2"); \
477 long __res; \ 481 long __res; \
478 __asm__ __volatile__ ( \ 482 asm volatile( \
479 " .if %1 < 256\n" \ 483 " .if %1 < 256\n" \
480 " svc %b1\n" \ 484 " svc %b1\n" \
481 " .else\n" \ 485 " .else\n" \
482 " la %%r1,%1\n" \ 486 " la %%r1,%1\n" \
483 " svc 0\n" \ 487 " svc 0\n" \
484 " .endif" \ 488 " .endif" \
485 : "=d" (__svcres) \ 489 : "=d" (__svcres) \
486 : "i" (__NR_##name), \ 490 : "i" (__NR_##name), \
487 "0" (__arg1), \ 491 "0" (__arg1), \
488 "d" (__arg2), \ 492 "d" (__arg2), \
489 "d" (__arg3), \ 493 "d" (__arg3), \
490 "d" (__arg4), \ 494 "d" (__arg4), \
491 "d" (__arg5) \ 495 "d" (__arg5) \
492 : _svc_clobber ); \ 496 : _svc_clobber); \
493 __res = __svcres; \ 497 __res = __svcres; \
494 __syscall_return(type,__res); \ 498 __syscall_return(type,__res); \
495} 499}
496 500
497#define __ARCH_WANT_IPC_PARSE_VERSION 501#define __ARCH_WANT_IPC_PARSE_VERSION
@@ -521,57 +525,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
521# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 525# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
522# endif 526# endif
523 527
524#ifdef __KERNEL_SYSCALLS__
525
526#include <linux/compiler.h>
527#include <linux/types.h>
528#include <asm/ptrace.h>
529#include <asm/stat.h>
530#include <linux/syscalls.h>
531
532/*
533 * we need this inline - forking from kernel space will result
534 * in NO COPY ON WRITE (!!!), until an execve is executed. This
535 * is no problem, but for the stack. This is handled by not letting
536 * main() use the stack at all after fork(). Thus, no function
537 * calls - which means inline code for fork too, as otherwise we
538 * would use the stack upon exit from 'fork()'.
539 *
540 * Actually only pause and fork are needed inline, so that there
541 * won't be any messing with the stack from main(), but we define
542 * some others too.
543 */
544#define __NR__exit __NR_exit
545static inline _syscall0(pid_t,setsid)
546static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
547static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
548static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
549static inline _syscall1(int,dup,int,fd)
550static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
551static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
552static inline _syscall1(int,close,int,fd)
553static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf)
554
555static inline pid_t waitpid(int pid, int *wait_stat, int flags)
556{
557 return sys_wait4(pid, wait_stat, flags, NULL);
558}
559struct mmap_arg_struct;
560asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg);
561
562asmlinkage long sys_execve(struct pt_regs regs);
563asmlinkage long sys_clone(struct pt_regs regs);
564asmlinkage long sys_fork(struct pt_regs regs);
565asmlinkage long sys_vfork(struct pt_regs regs);
566asmlinkage long sys_pipe(unsigned long __user *fildes);
567struct sigaction;
568asmlinkage long sys_rt_sigaction(int sig,
569 const struct sigaction __user *act,
570 struct sigaction __user *oact,
571 size_t sigsetsize);
572
573#endif /* __KERNEL_SYSCALLS__ */
574
575/* 528/*
576 * "Conditional" syscalls 529 * "Conditional" syscalls
577 * 530 *
diff --git a/include/asm-sh/.gitignore b/include/asm-sh/.gitignore
new file mode 100644
index 000000000000..9218ef82b698
--- /dev/null
+++ b/include/asm-sh/.gitignore
@@ -0,0 +1,3 @@
1cpu
2mach
3machtypes.h
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
index 720afc11c2ca..b860218e402e 100644
--- a/include/asm-sh/addrspace.h
+++ b/include/asm-sh/addrspace.h
@@ -14,11 +14,19 @@
14#include <asm/cpu/addrspace.h> 14#include <asm/cpu/addrspace.h>
15 15
16/* Memory segments (32bit Privileged mode addresses) */ 16/* Memory segments (32bit Privileged mode addresses) */
17#ifndef CONFIG_CPU_SH2A
17#define P0SEG 0x00000000 18#define P0SEG 0x00000000
18#define P1SEG 0x80000000 19#define P1SEG 0x80000000
19#define P2SEG 0xa0000000 20#define P2SEG 0xa0000000
20#define P3SEG 0xc0000000 21#define P3SEG 0xc0000000
21#define P4SEG 0xe0000000 22#define P4SEG 0xe0000000
23#else
24#define P0SEG 0x00000000
25#define P1SEG 0x00000000
26#define P2SEG 0x20000000
27#define P3SEG 0x00000000
28#define P4SEG 0x80000000
29#endif
22 30
23/* Returns the privileged segment base of a given address */ 31/* Returns the privileged segment base of a given address */
24#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000) 32#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
diff --git a/include/asm-sh/adx/io.h b/include/asm-sh/adx/io.h
deleted file mode 100644
index ab1225f1d557..000000000000
--- a/include/asm-sh/adx/io.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * include/asm-sh/io_adx.h
3 *
4 * Copyright (C) 2001 A&D Co., Ltd.
5 *
6 * This file may be copied or modified under the terms of the GNU
7 * General Public License. See linux/COPYING for more information.
8 *
9 * IO functions for an A&D ADX Board
10 */
11
12#ifndef _ASM_SH_IO_ADX_H
13#define _ASM_SH_IO_ADX_H
14
15#include <asm/io_generic.h>
16
17extern unsigned char adx_inb(unsigned long port);
18extern unsigned short adx_inw(unsigned long port);
19extern unsigned int adx_inl(unsigned long port);
20
21extern void adx_outb(unsigned char value, unsigned long port);
22extern void adx_outw(unsigned short value, unsigned long port);
23extern void adx_outl(unsigned int value, unsigned long port);
24
25extern unsigned char adx_inb_p(unsigned long port);
26extern void adx_outb_p(unsigned char value, unsigned long port);
27
28extern void adx_insb(unsigned long port, void *addr, unsigned long count);
29extern void adx_insw(unsigned long port, void *addr, unsigned long count);
30extern void adx_insl(unsigned long port, void *addr, unsigned long count);
31extern void adx_outsb(unsigned long port, const void *addr, unsigned long count);
32extern void adx_outsw(unsigned long port, const void *addr, unsigned long count);
33extern void adx_outsl(unsigned long port, const void *addr, unsigned long count);
34
35extern unsigned char adx_readb(unsigned long addr);
36extern unsigned short adx_readw(unsigned long addr);
37extern unsigned int adx_readl(unsigned long addr);
38extern void adx_writeb(unsigned char b, unsigned long addr);
39extern void adx_writew(unsigned short b, unsigned long addr);
40extern void adx_writel(unsigned int b, unsigned long addr);
41
42extern void * adx_ioremap(unsigned long offset, unsigned long size);
43extern void adx_iounmap(void *addr);
44
45extern unsigned long adx_isa_port2addr(unsigned long offset);
46
47extern void setup_adx(void);
48extern void init_adx_IRQ(void);
49
50#ifdef __WANT_IO_DEF
51
52#define __inb adx_inb
53#define __inw adx_inw
54#define __inl adx_inl
55#define __outb adx_outb
56#define __outw adx_outw
57#define __outl adx_outl
58
59#define __inb_p adx_inb_p
60#define __inw_p adx_inw
61#define __inl_p adx_inl
62#define __outb_p adx_outb_p
63#define __outw_p adx_outw
64#define __outl_p adx_outl
65
66#define __insb adx_insb
67#define __insw adx_insw
68#define __insl adx_insl
69#define __outsb adx_outsb
70#define __outsw adx_outsw
71#define __outsl adx_outsl
72
73#define __readb adx_readb
74#define __readw adx_readw
75#define __readl adx_readl
76#define __writeb adx_writeb
77#define __writew adx_writew
78#define __writel adx_writel
79
80#define __isa_port2addr adx_isa_port2addr
81#define __ioremap adx_ioremap
82#define __iounmap adx_iounmap
83
84#endif
85
86#endif /* _ASM_SH_IO_AANDD_H */
diff --git a/include/asm-sh/apm.h b/include/asm-sh/apm.h
new file mode 100644
index 000000000000..8b091e93651f
--- /dev/null
+++ b/include/asm-sh/apm.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com>
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 */
9
10#ifndef __ASM_SH_APM_H
11#define __ASM_SH_APM_H
12
13#define APM_AC_OFFLINE 0
14#define APM_AC_ONLINE 1
15#define APM_AC_BACKUP 2
16#define APM_AC_UNKNOWN 0xff
17
18#define APM_BATTERY_STATUS_HIGH 0
19#define APM_BATTERY_STATUS_LOW 1
20#define APM_BATTERY_STATUS_CRITICAL 2
21#define APM_BATTERY_STATUS_CHARGING 3
22#define APM_BATTERY_STATUS_NOT_PRESENT 4
23#define APM_BATTERY_STATUS_UNKNOWN 0xff
24
25#define APM_BATTERY_LIFE_UNKNOWN 0xFFFF
26#define APM_BATTERY_LIFE_MINUTES 0x8000
27#define APM_BATTERY_LIFE_VALUE_MASK 0x7FFF
28
29#define APM_BATTERY_FLAG_HIGH (1 << 0)
30#define APM_BATTERY_FLAG_LOW (1 << 1)
31#define APM_BATTERY_FLAG_CRITICAL (1 << 2)
32#define APM_BATTERY_FLAG_CHARGING (1 << 3)
33#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
34#define APM_BATTERY_FLAG_UNKNOWN 0xff
35
36#define APM_UNITS_MINS 0
37#define APM_UNITS_SECS 1
38#define APM_UNITS_UNKNOWN -1
39
40
41extern int (*apm_get_info)(char *buf, char **start, off_t fpos, int length);
42extern int apm_suspended;
43
44void apm_queue_event(apm_event_t event);
45
46#endif
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h
index fb627de217f2..8bdc1ba56f73 100644
--- a/include/asm-sh/atomic.h
+++ b/include/asm-sh/atomic.h
@@ -14,6 +14,7 @@ typedef struct { volatile int counter; } atomic_t;
14#define atomic_read(v) ((v)->counter) 14#define atomic_read(v) ((v)->counter)
15#define atomic_set(v,i) ((v)->counter = (i)) 15#define atomic_set(v,i) ((v)->counter = (i))
16 16
17#include <linux/compiler.h>
17#include <asm/system.h> 18#include <asm/system.h>
18 19
19/* 20/*
@@ -21,49 +22,110 @@ typedef struct { volatile int counter; } atomic_t;
21 * forward to code at the end of this object's .text section, then 22 * forward to code at the end of this object's .text section, then
22 * branch back to restart the operation. 23 * branch back to restart the operation.
23 */ 24 */
24 25static inline void atomic_add(int i, atomic_t *v)
25static __inline__ void atomic_add(int i, atomic_t * v)
26{ 26{
27#ifdef CONFIG_CPU_SH4A
28 unsigned long tmp;
29
30 __asm__ __volatile__ (
31"1: movli.l @%3, %0 ! atomic_add \n"
32" add %2, %0 \n"
33" movco.l %0, @%3 \n"
34" bf 1b \n"
35 : "=&z" (tmp), "=r" (&v->counter)
36 : "r" (i), "r" (&v->counter)
37 : "t");
38#else
27 unsigned long flags; 39 unsigned long flags;
28 40
29 local_irq_save(flags); 41 local_irq_save(flags);
30 *(long *)v += i; 42 *(long *)v += i;
31 local_irq_restore(flags); 43 local_irq_restore(flags);
44#endif
32} 45}
33 46
34static __inline__ void atomic_sub(int i, atomic_t *v) 47static inline void atomic_sub(int i, atomic_t *v)
35{ 48{
49#ifdef CONFIG_CPU_SH4A
50 unsigned long tmp;
51
52 __asm__ __volatile__ (
53"1: movli.l @%3, %0 ! atomic_sub \n"
54" sub %2, %0 \n"
55" movco.l %0, @%3 \n"
56" bf 1b \n"
57 : "=&z" (tmp), "=r" (&v->counter)
58 : "r" (i), "r" (&v->counter)
59 : "t");
60#else
36 unsigned long flags; 61 unsigned long flags;
37 62
38 local_irq_save(flags); 63 local_irq_save(flags);
39 *(long *)v -= i; 64 *(long *)v -= i;
40 local_irq_restore(flags); 65 local_irq_restore(flags);
66#endif
41} 67}
42 68
43static __inline__ int atomic_add_return(int i, atomic_t * v) 69/*
70 * SH-4A note:
71 *
72 * We basically get atomic_xxx_return() for free compared with
73 * atomic_xxx(). movli.l/movco.l require r0 due to the instruction
74 * encoding, so the retval is automatically set without having to
75 * do any special work.
76 */
77static inline int atomic_add_return(int i, atomic_t *v)
44{ 78{
45 unsigned long temp, flags; 79 unsigned long temp;
80
81#ifdef CONFIG_CPU_SH4A
82 __asm__ __volatile__ (
83"1: movli.l @%3, %0 ! atomic_add_return \n"
84" add %2, %0 \n"
85" movco.l %0, @%3 \n"
86" bf 1b \n"
87" synco \n"
88 : "=&z" (temp), "=r" (&v->counter)
89 : "r" (i), "r" (&v->counter)
90 : "t");
91#else
92 unsigned long flags;
46 93
47 local_irq_save(flags); 94 local_irq_save(flags);
48 temp = *(long *)v; 95 temp = *(long *)v;
49 temp += i; 96 temp += i;
50 *(long *)v = temp; 97 *(long *)v = temp;
51 local_irq_restore(flags); 98 local_irq_restore(flags);
99#endif
52 100
53 return temp; 101 return temp;
54} 102}
55 103
56#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) 104#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
57 105
58static __inline__ int atomic_sub_return(int i, atomic_t * v) 106static inline int atomic_sub_return(int i, atomic_t *v)
59{ 107{
60 unsigned long temp, flags; 108 unsigned long temp;
109
110#ifdef CONFIG_CPU_SH4A
111 __asm__ __volatile__ (
112"1: movli.l @%3, %0 ! atomic_sub_return \n"
113" sub %2, %0 \n"
114" movco.l %0, @%3 \n"
115" bf 1b \n"
116" synco \n"
117 : "=&z" (temp), "=r" (&v->counter)
118 : "r" (i), "r" (&v->counter)
119 : "t");
120#else
121 unsigned long flags;
61 122
62 local_irq_save(flags); 123 local_irq_save(flags);
63 temp = *(long *)v; 124 temp = *(long *)v;
64 temp -= i; 125 temp -= i;
65 *(long *)v = temp; 126 *(long *)v = temp;
66 local_irq_restore(flags); 127 local_irq_restore(flags);
128#endif
67 129
68 return temp; 130 return temp;
69} 131}
@@ -118,22 +180,48 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
118} 180}
119#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 181#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
120 182
121static __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) 183static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
122{ 184{
185#ifdef CONFIG_CPU_SH4A
186 unsigned long tmp;
187
188 __asm__ __volatile__ (
189"1: movli.l @%3, %0 ! atomic_clear_mask \n"
190" and %2, %0 \n"
191" movco.l %0, @%3 \n"
192" bf 1b \n"
193 : "=&z" (tmp), "=r" (&v->counter)
194 : "r" (~mask), "r" (&v->counter)
195 : "t");
196#else
123 unsigned long flags; 197 unsigned long flags;
124 198
125 local_irq_save(flags); 199 local_irq_save(flags);
126 *(long *)v &= ~mask; 200 *(long *)v &= ~mask;
127 local_irq_restore(flags); 201 local_irq_restore(flags);
202#endif
128} 203}
129 204
130static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) 205static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
131{ 206{
207#ifdef CONFIG_CPU_SH4A
208 unsigned long tmp;
209
210 __asm__ __volatile__ (
211"1: movli.l @%3, %0 ! atomic_set_mask \n"
212" or %2, %0 \n"
213" movco.l %0, @%3 \n"
214" bf 1b \n"
215 : "=&z" (tmp), "=r" (&v->counter)
216 : "r" (mask), "r" (&v->counter)
217 : "t");
218#else
132 unsigned long flags; 219 unsigned long flags;
133 220
134 local_irq_save(flags); 221 local_irq_save(flags);
135 *(long *)v |= mask; 222 *(long *)v |= mask;
136 local_irq_restore(flags); 223 local_irq_restore(flags);
224#endif
137} 225}
138 226
139/* Atomic operations are already serializing on SH */ 227/* Atomic operations are already serializing on SH */
diff --git a/include/asm-sh/auxvec.h b/include/asm-sh/auxvec.h
index fc21e4db5881..1b6916e63e90 100644
--- a/include/asm-sh/auxvec.h
+++ b/include/asm-sh/auxvec.h
@@ -1,4 +1,18 @@
1#ifndef __ASM_SH_AUXVEC_H 1#ifndef __ASM_SH_AUXVEC_H
2#define __ASM_SH_AUXVEC_H 2#define __ASM_SH_AUXVEC_H
3 3
4/*
5 * Architecture-neutral AT_ values in 0-17, leave some room
6 * for more of them.
7 */
8
9#ifdef CONFIG_VSYSCALL
10/*
11 * Only define this in the vsyscall case, the entry point to
12 * the vsyscall page gets placed here. The kernel will attempt
13 * to build a gate VMA we don't care about otherwise..
14 */
15#define AT_SYSINFO_EHDR 33
16#endif
17
4#endif /* __ASM_SH_AUXVEC_H */ 18#endif /* __ASM_SH_AUXVEC_H */
diff --git a/include/asm-sh/bigsur/io.h b/include/asm-sh/bigsur/io.h
index 939735ee8dc5..1470ac8d4a39 100644
--- a/include/asm-sh/bigsur/io.h
+++ b/include/asm-sh/bigsur/io.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-sh/io_bigsur.h 2 * include/asm-sh/bigsur/io.h
3 * 3 *
4 * By Dustin McIntire (dustin@sensoria.com) (c)2001 4 * By Dustin McIntire (dustin@sensoria.com) (c)2001
5 * Derived from io_hd64465.h, which bore the message: 5 * Derived from io_hd64465.h, which bore the message:
diff --git a/include/asm-sh/bigsur/serial.h b/include/asm-sh/bigsur/serial.h
index 7233af42f755..a08fa82fe45a 100644
--- a/include/asm-sh/bigsur/serial.h
+++ b/include/asm-sh/bigsur/serial.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-sh/serial-bigsur.h 2 * include/asm-sh/bigsur/serial.h
3 * 3 *
4 * Configuration details for Big Sur 16550 based serial ports 4 * Configuration details for Big Sur 16550 based serial ports
5 * i.e. HD64465, PCMCIA, etc. 5 * i.e. HD64465, PCMCIA, etc.
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index e34f82508568..1c16792cee1d 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -6,7 +6,7 @@
6/* For __swab32 */ 6/* For __swab32 */
7#include <asm/byteorder.h> 7#include <asm/byteorder.h>
8 8
9static __inline__ void set_bit(int nr, volatile void * addr) 9static inline void set_bit(int nr, volatile void * addr)
10{ 10{
11 int mask; 11 int mask;
12 volatile unsigned int *a = addr; 12 volatile unsigned int *a = addr;
@@ -24,7 +24,7 @@ static __inline__ void set_bit(int nr, volatile void * addr)
24 */ 24 */
25#define smp_mb__before_clear_bit() barrier() 25#define smp_mb__before_clear_bit() barrier()
26#define smp_mb__after_clear_bit() barrier() 26#define smp_mb__after_clear_bit() barrier()
27static __inline__ void clear_bit(int nr, volatile void * addr) 27static inline void clear_bit(int nr, volatile void * addr)
28{ 28{
29 int mask; 29 int mask;
30 volatile unsigned int *a = addr; 30 volatile unsigned int *a = addr;
@@ -37,7 +37,7 @@ static __inline__ void clear_bit(int nr, volatile void * addr)
37 local_irq_restore(flags); 37 local_irq_restore(flags);
38} 38}
39 39
40static __inline__ void change_bit(int nr, volatile void * addr) 40static inline void change_bit(int nr, volatile void * addr)
41{ 41{
42 int mask; 42 int mask;
43 volatile unsigned int *a = addr; 43 volatile unsigned int *a = addr;
@@ -50,7 +50,7 @@ static __inline__ void change_bit(int nr, volatile void * addr)
50 local_irq_restore(flags); 50 local_irq_restore(flags);
51} 51}
52 52
53static __inline__ int test_and_set_bit(int nr, volatile void * addr) 53static inline int test_and_set_bit(int nr, volatile void * addr)
54{ 54{
55 int mask, retval; 55 int mask, retval;
56 volatile unsigned int *a = addr; 56 volatile unsigned int *a = addr;
@@ -66,7 +66,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
66 return retval; 66 return retval;
67} 67}
68 68
69static __inline__ int test_and_clear_bit(int nr, volatile void * addr) 69static inline int test_and_clear_bit(int nr, volatile void * addr)
70{ 70{
71 int mask, retval; 71 int mask, retval;
72 volatile unsigned int *a = addr; 72 volatile unsigned int *a = addr;
@@ -82,7 +82,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
82 return retval; 82 return retval;
83} 83}
84 84
85static __inline__ int test_and_change_bit(int nr, volatile void * addr) 85static inline int test_and_change_bit(int nr, volatile void * addr)
86{ 86{
87 int mask, retval; 87 int mask, retval;
88 volatile unsigned int *a = addr; 88 volatile unsigned int *a = addr;
@@ -100,7 +100,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
100 100
101#include <asm-generic/bitops/non-atomic.h> 101#include <asm-generic/bitops/non-atomic.h>
102 102
103static __inline__ unsigned long ffz(unsigned long word) 103static inline unsigned long ffz(unsigned long word)
104{ 104{
105 unsigned long result; 105 unsigned long result;
106 106
@@ -120,7 +120,7 @@ static __inline__ unsigned long ffz(unsigned long word)
120 * 120 *
121 * Undefined if no bit exists, so code should check against 0 first. 121 * Undefined if no bit exists, so code should check against 0 first.
122 */ 122 */
123static __inline__ unsigned long __ffs(unsigned long word) 123static inline unsigned long __ffs(unsigned long word)
124{ 124{
125 unsigned long result; 125 unsigned long result;
126 126
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h
index a6de3d06a3d9..beeea40f549e 100644
--- a/include/asm-sh/bugs.h
+++ b/include/asm-sh/bugs.h
@@ -18,7 +18,7 @@ static void __init check_bugs(void)
18{ 18{
19 extern char *get_cpu_subtype(void); 19 extern char *get_cpu_subtype(void);
20 extern unsigned long loops_per_jiffy; 20 extern unsigned long loops_per_jiffy;
21 char *p= &system_utsname.machine[2]; /* "sh" */ 21 char *p= &init_utsname()->machine[2]; /* "sh" */
22 22
23 cpu_data->loops_per_jiffy = loops_per_jiffy; 23 cpu_data->loops_per_jiffy = loops_per_jiffy;
24 24
@@ -32,6 +32,10 @@ static void __init check_bugs(void)
32 case CPU_SH7750 ... CPU_SH4_501: 32 case CPU_SH7750 ... CPU_SH4_501:
33 *p++ = '4'; 33 *p++ = '4';
34 break; 34 break;
35 case CPU_SH7770 ... CPU_SH7781:
36 *p++ = '4';
37 *p++ = 'a';
38 break;
35 default: 39 default:
36 *p++ = '?'; 40 *p++ = '?';
37 *p++ = '!'; 41 *p++ = '!';
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index 656fdfe9e8b4..e3a180cf5062 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -10,7 +10,6 @@
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <asm/cpu/cache.h> 12#include <asm/cpu/cache.h>
13#include <asm/cpu/cacheflush.h>
14 13
15#define SH_CACHE_VALID 1 14#define SH_CACHE_VALID 1
16#define SH_CACHE_UPDATED 2 15#define SH_CACHE_UPDATED 2
@@ -23,24 +22,31 @@
23#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 22#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
24 23
25struct cache_info { 24struct cache_info {
26 unsigned int ways; 25 unsigned int ways; /* Number of cache ways */
27 unsigned int sets; 26 unsigned int sets; /* Number of cache sets */
28 unsigned int linesz; 27 unsigned int linesz; /* Cache line size (bytes) */
29 28
30 unsigned int way_incr; 29 unsigned int way_size; /* sets * line size */
31 30
31 /*
32 * way_incr is the address offset for accessing the next way
33 * in memory mapped cache array ops.
34 */
35 unsigned int way_incr;
32 unsigned int entry_shift; 36 unsigned int entry_shift;
33 unsigned int entry_mask; 37 unsigned int entry_mask;
34 38
39 /*
40 * Compute a mask which selects the address bits which overlap between
41 * 1. those used to select the cache set during indexing
42 * 2. those in the physical page number.
43 */
44 unsigned int alias_mask;
45
46 unsigned int n_aliases; /* Number of aliases */
47
35 unsigned long flags; 48 unsigned long flags;
36}; 49};
37 50
38/* Flush (write-back only) a region (smaller than a page) */
39extern void __flush_wback_region(void *start, int size);
40/* Flush (write-back & invalidate) a region (smaller than a page) */
41extern void __flush_purge_region(void *start, int size);
42/* Flush (invalidate only) a region (smaller than a page) */
43extern void __flush_invalidate_region(void *start, int size);
44
45#endif /* __KERNEL__ */ 51#endif /* __KERNEL__ */
46#endif /* __ASM_SH_CACHE_H */ 52#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index 9dfb33edb008..07f62ec9ff0c 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -2,6 +2,7 @@
2#define __ASM_SH_CACHEFLUSH_H 2#define __ASM_SH_CACHEFLUSH_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/mm.h>
5#include <asm/cpu/cacheflush.h> 6#include <asm/cpu/cacheflush.h>
6 7
7/* Flush (write-back only) a region (smaller than a page) */ 8/* Flush (write-back only) a region (smaller than a page) */
@@ -27,5 +28,7 @@ extern void __flush_invalidate_region(void *start, int size);
27 memcpy(dst, src, len); \ 28 memcpy(dst, src, len); \
28 } while (0) 29 } while (0)
29 30
31#define HAVE_ARCH_UNMAPPED_AREA
32
30#endif /* __KERNEL__ */ 33#endif /* __KERNEL__ */
31#endif /* __ASM_SH_CACHEFLUSH_H */ 34#endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/include/asm-sh/cat68701/io.h b/include/asm-sh/cat68701/io.h
deleted file mode 100644
index 753b8466ad11..000000000000
--- a/include/asm-sh/cat68701/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * include/asm-sh/io_cat68701.h
3 *
4 * Copyright 2000 Stuart Menefy (stuart.menefy@st.com)
5 * 2001 Yutarou Ebihar (ebihara@si-linux.com)
6 *
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
9 *
10 * IO functions for an AONE Corp. CAT-68701 SH7708 Borad
11 */
12
13#ifndef _ASM_SH_IO_CAT68701_H
14#define _ASM_SH_IO_CAT68701_H
15
16extern unsigned long cat68701_isa_port2addr(unsigned long offset);
17extern int cat68701_irq_demux(int irq);
18
19extern void init_cat68701_IRQ(void);
20extern void heartbeat_cat68701(void);
21
22#endif /* _ASM_SH_IO_CAT68701_H */
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h
index fa03b30c4269..08168afe6746 100644
--- a/include/asm-sh/checksum.h
+++ b/include/asm-sh/checksum.h
@@ -159,6 +159,7 @@ static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len)
159} 159}
160 160
161#define _HAVE_ARCH_IPV6_CSUM 161#define _HAVE_ARCH_IPV6_CSUM
162#ifdef CONFIG_IPV6
162static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 163static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
163 struct in6_addr *daddr, 164 struct in6_addr *daddr,
164 __u32 len, 165 __u32 len,
@@ -194,6 +195,7 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
194 195
195 return csum_fold(sum); 196 return csum_fold(sum);
196} 197}
198#endif
197 199
198/* 200/*
199 * Copy and checksum to user 201 * Copy and checksum to user
diff --git a/include/asm-sh/cpu-features.h b/include/asm-sh/cpu-features.h
new file mode 100644
index 000000000000..4bccd7c032f9
--- /dev/null
+++ b/include/asm-sh/cpu-features.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_SH_CPU_FEATURES_H
2#define __ASM_SH_CPU_FEATURES_H
3
4/*
5 * Processor flags
6 *
7 * Note: When adding a new flag, keep cpu_flags[] in
8 * arch/sh/kernel/setup.c in sync so symbolic name
9 * mapping of the processor flags has a chance of being
10 * reasonably accurate.
11 *
12 * These flags are also available through the ELF
13 * auxiliary vector as AT_HWCAP.
14 */
15#define CPU_HAS_FPU 0x0001 /* Hardware FPU support */
16#define CPU_HAS_P2_FLUSH_BUG 0x0002 /* Need to flush the cache in P2 area */
17#define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */
18#define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */
19#define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */
20#define CPU_HAS_PTEA 0x0020 /* PTEA register */
21#define CPU_HAS_LLSC 0x0040 /* movli.l/movco.l */
22#define CPU_HAS_L2_CACHE 0x0080 /* Secondary cache / URAM */
23
24#endif /* __ASM_SH_CPU_FEATURES_H */
diff --git a/include/asm-sh/cpu-sh2/shmparam.h b/include/asm-sh/cpu-sh2/shmparam.h
deleted file mode 100644
index 817c1821ee4b..000000000000
--- a/include/asm-sh/cpu-sh2/shmparam.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh2/shmparam.h
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2_SHMPARAM_H
11#define __ASM_CPU_SH2_SHMPARAM_H
12
13#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
14
15#endif /* __ASM_CPU_SH2_SHMPARAM_H */
16
diff --git a/include/asm-sh/cpu-sh3/cache.h b/include/asm-sh/cpu-sh3/cache.h
index 406aa8d9b947..ffe08d2813f9 100644
--- a/include/asm-sh/cpu-sh3/cache.h
+++ b/include/asm-sh/cpu-sh3/cache.h
@@ -26,12 +26,10 @@
26#define CCR_CACHE_ENABLE CCR_CACHE_CE 26#define CCR_CACHE_ENABLE CCR_CACHE_CE
27#define CCR_CACHE_INVALIDATE CCR_CACHE_CF 27#define CCR_CACHE_INVALIDATE CCR_CACHE_CF
28 28
29#if defined(CONFIG_CPU_SUBTYPE_SH7705) 29#if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7710)
30#define CCR3 0xa40000b4 30#define CCR3 0xa40000b4
31#define CCR_CACHE_16KB 0x00010000 31#define CCR_CACHE_16KB 0x00010000
32#define CCR_CACHE_32KB 0x00020000 32#define CCR_CACHE_32KB 0x00020000
33#endif 33#endif
34 34
35
36#endif /* __ASM_CPU_SH3_CACHE_H */ 35#endif /* __ASM_CPU_SH3_CACHE_H */
37
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
index f51aed00c68f..03fde97a7fd0 100644
--- a/include/asm-sh/cpu-sh3/cacheflush.h
+++ b/include/asm-sh/cpu-sh3/cacheflush.h
@@ -10,7 +10,7 @@
10#ifndef __ASM_CPU_SH3_CACHEFLUSH_H 10#ifndef __ASM_CPU_SH3_CACHEFLUSH_H
11#define __ASM_CPU_SH3_CACHEFLUSH_H 11#define __ASM_CPU_SH3_CACHEFLUSH_H
12 12
13/* 13/*
14 * Cache flushing: 14 * Cache flushing:
15 * 15 *
16 * - flush_cache_all() flushes entire cache 16 * - flush_cache_all() flushes entire cache
@@ -35,53 +35,33 @@
35 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */ 35 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
36#define CACHE_ALIAS 0x00001000 36#define CACHE_ALIAS 0x00001000
37 37
38struct page;
39struct mm_struct;
40struct vm_area_struct;
41
42extern void flush_cache_all(void);
43extern void flush_cache_mm(struct mm_struct *mm);
44extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
45 unsigned long end);
46extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
47extern void flush_dcache_page(struct page *pg);
48extern void flush_icache_range(unsigned long start, unsigned long end);
49extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
50
51#define flush_dcache_mmap_lock(mapping) do { } while (0)
52#define flush_dcache_mmap_unlock(mapping) do { } while (0)
53
54/* SH3 has unified cache so no special action needed here */
55#define flush_cache_sigtramp(vaddr) do { } while (0)
56#define flush_page_to_ram(page) do { } while (0)
57#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
58
59#define p3_cache_init() do { } while (0)
60
61#define PG_mapped PG_arch_1 38#define PG_mapped PG_arch_1
62 39
63/* We provide our own get_unmapped_area to avoid cache alias issue */ 40void flush_cache_all(void);
64#define HAVE_ARCH_UNMAPPED_AREA 41void flush_cache_mm(struct mm_struct *mm);
65 42void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
43 unsigned long end);
44void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
45void flush_dcache_page(struct page *pg);
46void flush_icache_range(unsigned long start, unsigned long end);
47void flush_icache_page(struct vm_area_struct *vma, struct page *page);
66#else 48#else
67
68#define flush_cache_all() do { } while (0) 49#define flush_cache_all() do { } while (0)
69#define flush_cache_mm(mm) do { } while (0) 50#define flush_cache_mm(mm) do { } while (0)
70#define flush_cache_range(vma, start, end) do { } while (0) 51#define flush_cache_range(vma, start, end) do { } while (0)
71#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 52#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
72#define flush_dcache_page(page) do { } while (0) 53#define flush_dcache_page(page) do { } while (0)
73#define flush_dcache_mmap_lock(mapping) do { } while (0)
74#define flush_dcache_mmap_unlock(mapping) do { } while (0)
75#define flush_icache_range(start, end) do { } while (0) 54#define flush_icache_range(start, end) do { } while (0)
76#define flush_icache_page(vma,pg) do { } while (0) 55#define flush_icache_page(vma,pg) do { } while (0)
77#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) 56#endif
78#define flush_cache_sigtramp(vaddr) do { } while (0)
79 57
80#define p3_cache_init() do { } while (0) 58#define flush_dcache_mmap_lock(mapping) do { } while (0)
59#define flush_dcache_mmap_unlock(mapping) do { } while (0)
81 60
82#define HAVE_ARCH_UNMAPPED_AREA 61/* SH3 has unified cache so no special action needed here */
62#define flush_cache_sigtramp(vaddr) do { } while (0)
63#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
83 64
84#endif 65#define p3_cache_init() do { } while (0)
85 66
86#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */ 67#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
87
diff --git a/include/asm-sh/cpu-sh3/freq.h b/include/asm-sh/cpu-sh3/freq.h
index b61b6e331df0..273f3229785c 100644
--- a/include/asm-sh/cpu-sh3/freq.h
+++ b/include/asm-sh/cpu-sh3/freq.h
@@ -18,5 +18,9 @@
18#define MIN_DIVISOR_NR 0 18#define MIN_DIVISOR_NR 0
19#define MAX_DIVISOR_NR 4 19#define MAX_DIVISOR_NR 4
20 20
21#define FRQCR_CKOEN 0x0100
22#define FRQCR_PLLEN 0x0080
23#define FRQCR_PSTBY 0x0040
24
21#endif /* __ASM_CPU_SH3_FREQ_H */ 25#endif /* __ASM_CPU_SH3_FREQ_H */
22 26
diff --git a/include/asm-sh/cpu-sh3/mmu_context.h b/include/asm-sh/cpu-sh3/mmu_context.h
index a844ea0965b6..bccb7ddb438b 100644
--- a/include/asm-sh/cpu-sh3/mmu_context.h
+++ b/include/asm-sh/cpu-sh3/mmu_context.h
@@ -27,8 +27,12 @@
27#define TRA 0xffffffd0 27#define TRA 0xffffffd0
28#define EXPEVT 0xffffffd4 28#define EXPEVT 0xffffffd4
29 29
30#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \ 30#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
31 defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705) 31 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
33 defined(CONFIG_CPU_SUBTYPE_SH7300) || \
34 defined(CONFIG_CPU_SUBTYPE_SH7705) || \
35 defined(CONFIG_CPU_SUBTYPE_SH7710)
32#define INTEVT 0xa4000000 /* INTEVTE2(0xa4000000) */ 36#define INTEVT 0xa4000000 /* INTEVTE2(0xa4000000) */
33#else 37#else
34#define INTEVT 0xffffffd8 38#define INTEVT 0xffffffd8
diff --git a/include/asm-sh/cpu-sh3/rtc.h b/include/asm-sh/cpu-sh3/rtc.h
deleted file mode 100644
index 2d926671115a..000000000000
--- a/include/asm-sh/cpu-sh3/rtc.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_CPU_SH3_RTC_H
2#define __ASM_CPU_SH3_RTC_H
3
4/* SH-3 RTC */
5#define R64CNT 0xfffffec0
6#define RSECCNT 0xfffffec2
7#define RMINCNT 0xfffffec4
8#define RHRCNT 0xfffffec6
9#define RWKCNT 0xfffffec8
10#define RDAYCNT 0xfffffeca
11#define RMONCNT 0xfffffecc
12#define RYRCNT 0xfffffece
13#define RSECAR 0xfffffed0
14#define RMINAR 0xfffffed2
15#define RHRAR 0xfffffed4
16#define RWKAR 0xfffffed6
17#define RDAYAR 0xfffffed8
18#define RMONAR 0xfffffeda
19#define RCR1 0xfffffedc
20#define RCR2 0xfffffede
21
22#define RTC_BIT_INVERTED 0 /* No bug on SH7708, SH7709A */
23
24#endif /* __ASM_CPU_SH3_RTC_H */
25
diff --git a/include/asm-sh/cpu-sh3/shmparam.h b/include/asm-sh/cpu-sh3/shmparam.h
deleted file mode 100644
index da5b5eec81ee..000000000000
--- a/include/asm-sh/cpu-sh3/shmparam.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh3/shmparam.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH3_SHMPARAM_H
11#define __ASM_CPU_SH3_SHMPARAM_H
12
13#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
14
15#endif /* __ASM_CPU_SH3_SHMPARAM_H */
16
diff --git a/include/asm-sh/cpu-sh3/timer.h b/include/asm-sh/cpu-sh3/timer.h
index 3d8e95e8d10c..b2394cf76f49 100644
--- a/include/asm-sh/cpu-sh3/timer.h
+++ b/include/asm-sh/cpu-sh3/timer.h
@@ -20,9 +20,14 @@
20 * SH7710 20 * SH7710
21 * SH7720 21 * SH7720
22 * SH7300 22 * SH7300
23 * SH7710
23 * --------------------------------------------------------------------------- 24 * ---------------------------------------------------------------------------
24 */ 25 */
25 26
27#if !defined(CONFIG_CPU_SUBTYPE_SH7727)
28#define TMU_TOCR 0xfffffe90 /* Byte access */
29#endif
30
26#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710) 31#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710)
27#define TMU_TSTR 0xa412fe92 /* Byte access */ 32#define TMU_TSTR 0xa412fe92 /* Byte access */
28 33
@@ -39,9 +44,6 @@
39#define TMU2_TCR 0xa412feb4 /* Word access */ 44#define TMU2_TCR 0xa412feb4 /* Word access */
40 45
41#else 46#else
42#if !defined(CONFIG_CPU_SUBTYPE_SH7727)
43#define TMU_TOCR 0xfffffe90 /* Byte access */
44#endif
45#define TMU_TSTR 0xfffffe92 /* Byte access */ 47#define TMU_TSTR 0xfffffe92 /* Byte access */
46 48
47#define TMU0_TCOR 0xfffffe94 /* Long access */ 49#define TMU0_TCOR 0xfffffe94 /* Long access */
diff --git a/include/asm-sh/cpu-sh3/ubc.h b/include/asm-sh/cpu-sh3/ubc.h
index 0f809dec4e17..9d308cbe9b29 100644
--- a/include/asm-sh/cpu-sh3/ubc.h
+++ b/include/asm-sh/cpu-sh3/ubc.h
@@ -11,6 +11,19 @@
11#ifndef __ASM_CPU_SH3_UBC_H 11#ifndef __ASM_CPU_SH3_UBC_H
12#define __ASM_CPU_SH3_UBC_H 12#define __ASM_CPU_SH3_UBC_H
13 13
14#if defined(CONFIG_CPU_SUBTYPE_SH7710)
15#define UBC_BARA 0xa4ffffb0
16#define UBC_BAMRA 0xa4ffffb4
17#define UBC_BBRA 0xa4ffffb8
18#define UBC_BASRA 0xffffffe4
19#define UBC_BARB 0xa4ffffa0
20#define UBC_BAMRB 0xa4ffffa4
21#define UBC_BBRB 0xa4ffffa8
22#define UBC_BASRB 0xffffffe8
23#define UBC_BDRB 0xa4ffff90
24#define UBC_BDMRB 0xa4ffff94
25#define UBC_BRCR 0xa4ffff98
26#else
14#define UBC_BARA 0xffffffb0 27#define UBC_BARA 0xffffffb0
15#define UBC_BAMRA 0xffffffb4 28#define UBC_BAMRA 0xffffffb4
16#define UBC_BBRA 0xffffffb8 29#define UBC_BBRA 0xffffffb8
@@ -22,6 +35,6 @@
22#define UBC_BDRB 0xffffff90 35#define UBC_BDRB 0xffffff90
23#define UBC_BDMRB 0xffffff94 36#define UBC_BDMRB 0xffffff94
24#define UBC_BRCR 0xffffff98 37#define UBC_BRCR 0xffffff98
38#endif
25 39
26#endif /* __ASM_CPU_SH3_UBC_H */ 40#endif /* __ASM_CPU_SH3_UBC_H */
27
diff --git a/include/asm-sh/cpu-sh4/addrspace.h b/include/asm-sh/cpu-sh4/addrspace.h
index 727634d886ce..bb2e1b03060c 100644
--- a/include/asm-sh/cpu-sh4/addrspace.h
+++ b/include/asm-sh/cpu-sh4/addrspace.h
@@ -22,5 +22,8 @@
22#define P4SEG_TLB_DATA 0xf7000000 22#define P4SEG_TLB_DATA 0xf7000000
23#define P4SEG_REG_BASE 0xff000000 23#define P4SEG_REG_BASE 0xff000000
24 24
25#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
26#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
27
25#endif /* __ASM_CPU_SH4_ADDRSPACE_H */ 28#endif /* __ASM_CPU_SH4_ADDRSPACE_H */
26 29
diff --git a/include/asm-sh/cpu-sh4/cache.h b/include/asm-sh/cpu-sh4/cache.h
index 1fe20359312c..6e9c7e6ee8e4 100644
--- a/include/asm-sh/cpu-sh4/cache.h
+++ b/include/asm-sh/cpu-sh4/cache.h
@@ -22,7 +22,9 @@
22#define CCR_CACHE_ICE 0x0100 /* Instruction Cache Enable */ 22#define CCR_CACHE_ICE 0x0100 /* Instruction Cache Enable */
23#define CCR_CACHE_ICI 0x0800 /* IC Invalidate */ 23#define CCR_CACHE_ICI 0x0800 /* IC Invalidate */
24#define CCR_CACHE_IIX 0x8000 /* IC Index Enable */ 24#define CCR_CACHE_IIX 0x8000 /* IC Index Enable */
25#ifndef CONFIG_CPU_SUBTYPE_SH7780
25#define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */ 26#define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */
27#endif
26 28
27/* Default CCR setup: 8k+16k-byte cache,P1-wb,enable */ 29/* Default CCR setup: 8k+16k-byte cache,P1-wb,enable */
28#define CCR_CACHE_ENABLE (CCR_CACHE_OCE|CCR_CACHE_ICE) 30#define CCR_CACHE_ENABLE (CCR_CACHE_OCE|CCR_CACHE_ICE)
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
index f323567e085f..515fd574267c 100644
--- a/include/asm-sh/cpu-sh4/cacheflush.h
+++ b/include/asm-sh/cpu-sh4/cacheflush.h
@@ -16,40 +16,29 @@
16 * caching; in which case they're only semi-broken), 16 * caching; in which case they're only semi-broken),
17 * so we need them. 17 * so we need them.
18 */ 18 */
19 19void flush_cache_all(void);
20/* Page is 4K, OC size is 16K, there are four lines. */ 20void flush_cache_mm(struct mm_struct *mm);
21#define CACHE_ALIAS 0x00003000 21void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
22 22 unsigned long end);
23struct page; 23void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
24struct mm_struct; 24 unsigned long pfn);
25struct vm_area_struct; 25void flush_dcache_page(struct page *pg);
26
27extern void flush_cache_all(void);
28extern void flush_cache_mm(struct mm_struct *mm);
29extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
30 unsigned long end);
31extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
32extern void flush_dcache_page(struct page *pg);
33 26
34#define flush_dcache_mmap_lock(mapping) do { } while (0) 27#define flush_dcache_mmap_lock(mapping) do { } while (0)
35#define flush_dcache_mmap_unlock(mapping) do { } while (0) 28#define flush_dcache_mmap_unlock(mapping) do { } while (0)
36 29
37extern void flush_icache_range(unsigned long start, unsigned long end); 30void flush_icache_range(unsigned long start, unsigned long end);
38extern void flush_cache_sigtramp(unsigned long addr); 31void flush_cache_sigtramp(unsigned long addr);
39extern void flush_icache_user_range(struct vm_area_struct *vma, 32void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
40 struct page *page, unsigned long addr, 33 unsigned long addr, int len);
41 int len);
42 34
43#define flush_icache_page(vma,pg) do { } while (0) 35#define flush_icache_page(vma,pg) do { } while (0)
44 36
45/* Initialization of P3 area for copy_user_page */ 37/* Initialization of P3 area for copy_user_page */
46extern void p3_cache_init(void); 38void p3_cache_init(void);
47 39
48#define PG_mapped PG_arch_1 40#define PG_mapped PG_arch_1
49 41
50/* We provide our own get_unmapped_area to avoid cache alias issue */
51#define HAVE_ARCH_UNMAPPED_AREA
52
53#ifdef CONFIG_MMU 42#ifdef CONFIG_MMU
54extern int remap_area_pages(unsigned long addr, unsigned long phys_addr, 43extern int remap_area_pages(unsigned long addr, unsigned long phys_addr,
55 unsigned long size, unsigned long flags); 44 unsigned long size, unsigned long flags);
@@ -61,4 +50,3 @@ static inline int remap_area_pages(unsigned long addr, unsigned long phys_addr,
61} 50}
62#endif /* CONFIG_MMU */ 51#endif /* CONFIG_MMU */
63#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */ 52#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
64
diff --git a/include/asm-sh/cpu-sh4/dma-sh7780.h b/include/asm-sh/cpu-sh4/dma-sh7780.h
new file mode 100644
index 000000000000..6c90d28331b2
--- /dev/null
+++ b/include/asm-sh/cpu-sh4/dma-sh7780.h
@@ -0,0 +1,39 @@
1#ifndef __ASM_SH_CPU_SH4_DMA_SH7780_H
2#define __ASM_SH_CPU_SH4_DMA_SH7780_H
3
4#define REQ_HE 0x000000C0
5#define REQ_H 0x00000080
6#define REQ_LE 0x00000040
7#define TM_BURST 0x0000020
8#define TS_8 0x00000000
9#define TS_16 0x00000008
10#define TS_32 0x00000010
11#define TS_16BLK 0x00000018
12#define TS_32BLK 0x00100000
13
14/*
15 * The SuperH DMAC supports a number of transmit sizes, we list them here,
16 * with their respective values as they appear in the CHCR registers.
17 *
18 * Defaults to a 64-bit transfer size.
19 */
20enum {
21 XMIT_SZ_8BIT,
22 XMIT_SZ_16BIT,
23 XMIT_SZ_32BIT,
24 XMIT_SZ_128BIT,
25 XMIT_SZ_256BIT,
26};
27
28/*
29 * The DMA count is defined as the number of bytes to transfer.
30 */
31static unsigned int __attribute__ ((used)) ts_shift[] = {
32 [XMIT_SZ_8BIT] = 0,
33 [XMIT_SZ_16BIT] = 1,
34 [XMIT_SZ_32BIT] = 2,
35 [XMIT_SZ_128BIT] = 4,
36 [XMIT_SZ_256BIT] = 5,
37};
38
39#endif /* __ASM_SH_CPU_SH4_DMA_SH7780_H */
diff --git a/include/asm-sh/cpu-sh4/dma.h b/include/asm-sh/cpu-sh4/dma.h
index 0dfe61f14802..3e4b3e6d80c0 100644
--- a/include/asm-sh/cpu-sh4/dma.h
+++ b/include/asm-sh/cpu-sh4/dma.h
@@ -1,11 +1,17 @@
1#ifndef __ASM_CPU_SH4_DMA_H 1#ifndef __ASM_CPU_SH4_DMA_H
2#define __ASM_CPU_SH4_DMA_H 2#define __ASM_CPU_SH4_DMA_H
3 3
4#define DMAOR_INIT ( 0x8000 | DMAOR_DME )
5
4#ifdef CONFIG_CPU_SH4A 6#ifdef CONFIG_CPU_SH4A
5#define SH_DMAC_BASE 0xfc808020 7#define SH_DMAC_BASE 0xfc808020
8
9#define CHCR_TS_MASK 0x18
10#define CHCR_TS_SHIFT 3
11
12#include <asm/cpu/dma-sh7780.h>
6#else 13#else
7#define SH_DMAC_BASE 0xffa00000 14#define SH_DMAC_BASE 0xffa00000
8#endif
9 15
10/* Definitions for the SuperH DMAC */ 16/* Definitions for the SuperH DMAC */
11#define TM_BURST 0x0000080 17#define TM_BURST 0x0000080
@@ -19,8 +25,6 @@
19 25
20#define DMAOR_COD 0x00000008 26#define DMAOR_COD 0x00000008
21 27
22#define DMAOR_INIT ( 0x8000 | DMAOR_DME )
23
24/* 28/*
25 * The SuperH DMAC supports a number of transmit sizes, we list them here, 29 * The SuperH DMAC supports a number of transmit sizes, we list them here,
26 * with their respective values as they appear in the CHCR registers. 30 * with their respective values as they appear in the CHCR registers.
@@ -45,5 +49,6 @@ static unsigned int ts_shift[] __attribute__ ((used)) = {
45 [XMIT_SZ_32BIT] = 2, 49 [XMIT_SZ_32BIT] = 2,
46 [XMIT_SZ_256BIT] = 5, 50 [XMIT_SZ_256BIT] = 5,
47}; 51};
52#endif
48 53
49#endif /* __ASM_CPU_SH4_DMA_H */ 54#endif /* __ASM_CPU_SH4_DMA_H */
diff --git a/include/asm-sh/cpu-sh4/rtc.h b/include/asm-sh/cpu-sh4/rtc.h
deleted file mode 100644
index e091e32a67b7..000000000000
--- a/include/asm-sh/cpu-sh4/rtc.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_CPU_SH4_RTC_H
2#define __ASM_CPU_SH4_RTC_H
3
4/* SH-4 RTC */
5#define R64CNT 0xffc80000
6#define RSECCNT 0xffc80004
7#define RMINCNT 0xffc80008
8#define RHRCNT 0xffc8000c
9#define RWKCNT 0xffc80010
10#define RDAYCNT 0xffc80014
11#define RMONCNT 0xffc80018
12#define RYRCNT 0xffc8001c /* 16bit */
13#define RSECAR 0xffc80020
14#define RMINAR 0xffc80024
15#define RHRAR 0xffc80028
16#define RWKAR 0xffc8002c
17#define RDAYAR 0xffc80030
18#define RMONAR 0xffc80034
19#define RCR1 0xffc80038
20#define RCR2 0xffc8003c
21
22#define RTC_BIT_INVERTED 0x40 /* bug on SH7750, SH7750S */
23
24#endif /* __ASM_CPU_SH4_RTC_H */
25
diff --git a/include/asm-sh/cpu-sh4/shmparam.h b/include/asm-sh/cpu-sh4/shmparam.h
deleted file mode 100644
index a5a0aa9425fe..000000000000
--- a/include/asm-sh/cpu-sh4/shmparam.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh4/shmparam.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH4_SHMPARAM_H
11#define __ASM_CPU_SH4_SHMPARAM_H
12
13/*
14 * SH-4 has D-cache alias issue
15 */
16#define SHMLBA (PAGE_SIZE*4) /* attach addr a multiple of this */
17
18#endif /* __ASM_CPU_SH4_SHMPARAM_H */
19
diff --git a/include/asm-sh/cpu-sh4/sq.h b/include/asm-sh/cpu-sh4/sq.h
index 366b09166d3b..586d6491816a 100644
--- a/include/asm-sh/cpu-sh4/sq.h
+++ b/include/asm-sh/cpu-sh4/sq.h
@@ -17,7 +17,7 @@
17 * Store queues range from e0000000-e3fffffc, allowing approx. 64MB to be 17 * Store queues range from e0000000-e3fffffc, allowing approx. 64MB to be
18 * mapped to any physical address space. Since data is written (and aligned) 18 * mapped to any physical address space. Since data is written (and aligned)
19 * to 32-byte boundaries, we need to be sure that all allocations are aligned. 19 * to 32-byte boundaries, we need to be sure that all allocations are aligned.
20 */ 20 */
21#define SQ_SIZE 32 21#define SQ_SIZE 32
22#define SQ_ALIGN_MASK (~(SQ_SIZE - 1)) 22#define SQ_ALIGN_MASK (~(SQ_SIZE - 1))
23#define SQ_ALIGN(addr) (((addr)+SQ_SIZE-1) & SQ_ALIGN_MASK) 23#define SQ_ALIGN(addr) (((addr)+SQ_SIZE-1) & SQ_ALIGN_MASK)
@@ -26,23 +26,10 @@
26#define SQ_QACR1 (P4SEG_REG_BASE + 0x3c) 26#define SQ_QACR1 (P4SEG_REG_BASE + 0x3c)
27#define SQ_ADDRMAX (P4SEG_STORE_QUE + 0x04000000) 27#define SQ_ADDRMAX (P4SEG_STORE_QUE + 0x04000000)
28 28
29struct sq_mapping {
30 const char *name;
31
32 unsigned long sq_addr;
33 unsigned long addr;
34 unsigned int size;
35
36 struct list_head list;
37};
38
39/* arch/sh/kernel/cpu/sh4/sq.c */ 29/* arch/sh/kernel/cpu/sh4/sq.c */
40extern struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *name); 30unsigned long sq_remap(unsigned long phys, unsigned int size,
41extern void sq_unmap(struct sq_mapping *map); 31 const char *name, unsigned long flags);
42 32void sq_unmap(unsigned long vaddr);
43extern void sq_clear(unsigned long addr, unsigned int len); 33void sq_flush_range(unsigned long start, unsigned int len);
44extern void sq_flush(void *addr);
45extern void sq_flush_range(unsigned long start, unsigned int len);
46 34
47#endif /* __ASM_CPU_SH4_SQ_H */ 35#endif /* __ASM_CPU_SH4_SQ_H */
48
diff --git a/include/asm-sh/cqreek/cqreek.h b/include/asm-sh/cqreek/cqreek.h
deleted file mode 100644
index 09aecc06693e..000000000000
--- a/include/asm-sh/cqreek/cqreek.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef __ASM_SH_CQREEK_CQREEK_H
2#define __ASM_SH_CQREEK_CQREEK_H
3
4#define BRIDGE_FEATURE 0x0002
5
6#define BRIDGE_IDE_CTRL 0x0018
7#define BRIDGE_IDE_INTR_LVL 0x001A
8#define BRIDGE_IDE_INTR_MASK 0x001C
9#define BRIDGE_IDE_INTR_STAT 0x001E
10
11#define BRIDGE_ISA_CTRL 0x0028
12#define BRIDGE_ISA_INTR_LVL 0x002A
13#define BRIDGE_ISA_INTR_MASK 0x002C
14#define BRIDGE_ISA_INTR_STAT 0x002E
15
16/* arch/sh/boards/cqreek/setup.c */
17extern void setup_cqreek(void);
18
19/* arch/sh/boards/cqreek/irq.c */
20extern int cqreek_has_ide, cqreek_has_isa;
21extern void init_cqreek_IRQ(void);
22
23/* arch/sh/boards/cqreek/io.c */
24extern unsigned long cqreek_port2addr(unsigned long port);
25
26#endif /* __ASM_SH_CQREEK_CQREEK_H */
27
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 124968f9866e..56cd4b977232 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -141,25 +141,35 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
141 } 141 }
142} 142}
143 143
144static void dma_sync_single_for_cpu(struct device *dev, 144static inline void dma_sync_single_for_cpu(struct device *dev,
145 dma_addr_t dma_handle, size_t size, 145 dma_addr_t dma_handle, size_t size,
146 enum dma_data_direction dir) 146 enum dma_data_direction dir)
147 __attribute__ ((alias("dma_sync_single"))); 147{
148 dma_sync_single(dev, dma_handle, size, dir);
149}
150
151static inline void dma_sync_single_for_device(struct device *dev,
152 dma_addr_t dma_handle,
153 size_t size,
154 enum dma_data_direction dir)
155{
156 dma_sync_single(dev, dma_handle, size, dir);
157}
148 158
149static void dma_sync_single_for_device(struct device *dev, 159static inline void dma_sync_sg_for_cpu(struct device *dev,
150 dma_addr_t dma_handle, size_t size, 160 struct scatterlist *sg, int nelems,
151 enum dma_data_direction dir) 161 enum dma_data_direction dir)
152 __attribute__ ((alias("dma_sync_single"))); 162{
163 dma_sync_sg(dev, sg, nelems, dir);
164}
153 165
154static void dma_sync_sg_for_cpu(struct device *dev, 166static inline void dma_sync_sg_for_device(struct device *dev,
155 struct scatterlist *sg, int nelems, 167 struct scatterlist *sg, int nelems,
156 enum dma_data_direction dir) 168 enum dma_data_direction dir)
157 __attribute__ ((alias("dma_sync_sg"))); 169{
170 dma_sync_sg(dev, sg, nelems, dir);
171}
158 172
159static void dma_sync_sg_for_device(struct device *dev,
160 struct scatterlist *sg, int nelems,
161 enum dma_data_direction dir)
162 __attribute__ ((alias("dma_sync_sg")));
163 173
164static inline int dma_get_cache_alignment(void) 174static inline int dma_get_cache_alignment(void)
165{ 175{
@@ -174,6 +184,4 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
174{ 184{
175 return dma_addr == 0; 185 return dma_addr == 0;
176} 186}
177
178#endif /* __ASM_SH_DMA_MAPPING_H */ 187#endif /* __ASM_SH_DMA_MAPPING_H */
179
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index e62a6d0ed932..d9daa028689f 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -89,6 +89,7 @@ struct dma_channel {
89 wait_queue_head_t wait_queue; 89 wait_queue_head_t wait_queue;
90 90
91 struct sys_device dev; 91 struct sys_device dev;
92 char *name;
92}; 93};
93 94
94struct dma_info { 95struct dma_info {
diff --git a/include/asm-sh/dmida/io.h b/include/asm-sh/dmida/io.h
deleted file mode 100644
index 21bd416c01c3..000000000000
--- a/include/asm-sh/dmida/io.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __ASM_SH_DMIDA_IO_H
2#define __ASM_SH_DMIDA_IO_H
3
4/*
5 * Nothing special here.. just use the generic cchip io routines.
6 */
7#include <asm/hd64465/io.h>
8
9#endif /* __ASM_SH_DMIDA_IO_H */
10
diff --git a/include/asm-sh/dreamcast/sysasic.h b/include/asm-sh/dreamcast/sysasic.h
index c8858537803c..7874e3dac736 100644
--- a/include/asm-sh/dreamcast/sysasic.h
+++ b/include/asm-sh/dreamcast/sysasic.h
@@ -1,4 +1,4 @@
1/* include/asm-sh/dc_sysasic.h 1/* include/asm-sh/dreamcast/sysasic.h
2 * 2 *
3 * Definitions for the Dreamcast System ASIC and related peripherals. 3 * Definitions for the Dreamcast System ASIC and related peripherals.
4 * 4 *
diff --git a/include/asm-sh/ec3104/keyboard.h b/include/asm-sh/ec3104/keyboard.h
index 0dee7b05b49d..c1253a683197 100644
--- a/include/asm-sh/ec3104/keyboard.h
+++ b/include/asm-sh/ec3104/keyboard.h
@@ -6,8 +6,6 @@ extern char ec3104_kbd_unexpected_up(unsigned char);
6extern void ec3104_kbd_leds(unsigned char); 6extern void ec3104_kbd_leds(unsigned char);
7extern void ec3104_kbd_init_hw(void); 7extern void ec3104_kbd_init_hw(void);
8 8
9#define SYSRQ_KEY 0x54
10
11#define kbd_sysrq_xlate ec3104_kbd_sysrq_xlate 9#define kbd_sysrq_xlate ec3104_kbd_sysrq_xlate
12#define kbd_setkeycode ec3104_kbd_setkeycode 10#define kbd_setkeycode ec3104_kbd_setkeycode
13#define kbd_getkeycode ec3104_kbd_getkeycode 11#define kbd_getkeycode ec3104_kbd_getkeycode
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
index 1b63dfeea4f2..fc050fd7645e 100644
--- a/include/asm-sh/elf.h
+++ b/include/asm-sh/elf.h
@@ -1,6 +1,10 @@
1#ifndef __ASM_SH_ELF_H 1#ifndef __ASM_SH_ELF_H
2#define __ASM_SH_ELF_H 2#define __ASM_SH_ELF_H
3 3
4#include <asm/auxvec.h>
5#include <asm/ptrace.h>
6#include <asm/user.h>
7
4/* SH relocation types */ 8/* SH relocation types */
5#define R_SH_NONE 0 9#define R_SH_NONE 0
6#define R_SH_DIR32 1 10#define R_SH_DIR32 1
@@ -46,9 +50,6 @@
46 * ELF register definitions.. 50 * ELF register definitions..
47 */ 51 */
48 52
49#include <asm/ptrace.h>
50#include <asm/user.h>
51
52typedef unsigned long elf_greg_t; 53typedef unsigned long elf_greg_t;
53 54
54#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 55#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
@@ -91,7 +92,7 @@ typedef struct user_fpu_struct elf_fpregset_t;
91 instruction set this CPU supports. This could be done in user space, 92 instruction set this CPU supports. This could be done in user space,
92 but it's not easy, and we've already done it here. */ 93 but it's not easy, and we've already done it here. */
93 94
94#define ELF_HWCAP (0) 95#define ELF_HWCAP (boot_cpu_data.flags)
95 96
96/* This yields a string that ld.so will use to load implementation 97/* This yields a string that ld.so will use to load implementation
97 specific libraries for optimization. This is more specific in 98 specific libraries for optimization. This is more specific in
@@ -119,4 +120,24 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
119#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 120#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
120#endif 121#endif
121 122
123#ifdef CONFIG_VSYSCALL
124/* vDSO has arch_setup_additional_pages */
125#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
126struct linux_binprm;
127extern int arch_setup_additional_pages(struct linux_binprm *bprm,
128 int executable_stack);
129
130extern unsigned int vdso_enabled;
131extern void __kernel_vsyscall;
132
133#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
134#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
135
136#define ARCH_DLINFO \
137do { \
138 if (vdso_enabled) \
139 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
140} while (0)
141#endif /* CONFIG_VSYSCALL */
142
122#endif /* __ASM_SH_ELF_H */ 143#endif /* __ASM_SH_ELF_H */
diff --git a/include/asm-sh/fixmap.h b/include/asm-sh/fixmap.h
index 412bccaa07e6..458e9fa59545 100644
--- a/include/asm-sh/fixmap.h
+++ b/include/asm-sh/fixmap.h
@@ -25,7 +25,7 @@
25 * addresses. The point is to have a constant address at 25 * addresses. The point is to have a constant address at
26 * compile time, but to set the physical address only 26 * compile time, but to set the physical address only
27 * in the boot process. We allocate these special addresses 27 * in the boot process. We allocate these special addresses
28 * from the end of virtual memory (0xfffff000) backwards. 28 * from the end of P3 backwards.
29 * Also this lets us do fail-safe vmalloc(), we 29 * Also this lets us do fail-safe vmalloc(), we
30 * can guarantee that these special addresses and 30 * can guarantee that these special addresses and
31 * vmalloc()-ed addresses never overlap. 31 * vmalloc()-ed addresses never overlap.
diff --git a/include/asm-sh/flat.h b/include/asm-sh/flat.h
index f29072e1c87e..0d5cc04ab005 100644
--- a/include/asm-sh/flat.h
+++ b/include/asm-sh/flat.h
@@ -13,7 +13,7 @@
13#define __ASM_SH_FLAT_H 13#define __ASM_SH_FLAT_H
14 14
15#define flat_stack_align(sp) /* nothing needed */ 15#define flat_stack_align(sp) /* nothing needed */
16#define flat_argvp_envp_on_stack() 1 16#define flat_argvp_envp_on_stack() 0
17#define flat_old_ram_flag(flags) (flags) 17#define flat_old_ram_flag(flags) (flags)
18#define flat_reloc_valid(reloc, size) ((reloc) <= (size)) 18#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
19#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) 19#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp)
diff --git a/include/asm-sh/harp/harp.h b/include/asm-sh/harp/harp.h
deleted file mode 100644
index b2fbcfae9940..000000000000
--- a/include/asm-sh/harp/harp.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 * Defintions applicable to the STMicroelectronics ST40STB1 HARP and
8 * compatible boards.
9 */
10
11#if defined(CONFIG_SH_STB1_HARP)
12
13#define EPLD_BASE 0xa0800000
14
15#define EPLD_LED (EPLD_BASE+0x000c0000)
16#define EPLD_INTSTAT0 (EPLD_BASE+0x00200000)
17#define EPLD_INTSTAT1 (EPLD_BASE+0x00240000)
18#define EPLD_INTMASK0 (EPLD_BASE+0x00280000)
19#define EPLD_INTMASK1 (EPLD_BASE+0x002c0000)
20#define EPLD_PAGEADDR (EPLD_BASE+0x00300000)
21#define EPLD_REVID1 (EPLD_BASE+0x00380000)
22#define EPLD_REVID2 (EPLD_BASE+0x003c0000)
23
24#define EPLD_LED_ON 1
25#define EPLD_LED_OFF 0
26
27#elif defined(CONFIG_SH_STB1_OVERDRIVE)
28
29#define EPLD_BASE 0xa7000000
30
31#define EPLD_REVID (EPLD_BASE+0x00000000)
32#define EPLD_LED (EPLD_BASE+0x00040000)
33#define EPLD_INTMASK0 (EPLD_BASE+0x001c0000)
34#define EPLD_INTMASK1 (EPLD_BASE+0x00200000)
35#define EPLD_INTSTAT0 (EPLD_BASE+0x00240000)
36#define EPLD_INTSTAT1 (EPLD_BASE+0x00280000)
37
38#define EPLD_LED_ON 0
39#define EPLD_LED_OFF 1
40
41#else
42#error Unknown board
43#endif
diff --git a/include/asm-sh/harp/io.h b/include/asm-sh/harp/io.h
deleted file mode 100644
index 68f39e0b39de..000000000000
--- a/include/asm-sh/harp/io.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __ASM_SH_HARP_IO_H
2#define __ASM_SH_HARP_IO_H
3
4/*
5 * Nothing special here.. just use the generic cchip io routines.
6 */
7#include <asm/hd64465/io.h>
8
9#endif /* __ASM_SH_HARP_IO_H */
10
diff --git a/include/asm-sh/hd64461/hd64461.h b/include/asm-sh/hd64461.h
index 87f13d24c630..27e5c34e2659 100644
--- a/include/asm-sh/hd64461/hd64461.h
+++ b/include/asm-sh/hd64461.h
@@ -40,7 +40,12 @@
40#define HD64461_LCDCBAR 0x11000 40#define HD64461_LCDCBAR 0x11000
41#define HD64461_LCDCLOR 0x11002 41#define HD64461_LCDCLOR 0x11002
42#define HD64461_LCDCCR 0x11004 42#define HD64461_LCDCCR 0x11004
43#define HD64461_LCDCCR_MOFF 0x80 43#define HD64461_LCDCCR_STBACK 0x0400
44#define HD64461_LCDCCR_STREQ 0x0100
45#define HD64461_LCDCCR_MOFF 0x0080
46#define HD64461_LCDCCR_REFSEL 0x0040
47#define HD64461_LCDCCR_EPON 0x0020
48#define HD64461_LCDCCR_SPON 0x0010
44 49
45#define HD64461_LDR1 0x11010 50#define HD64461_LDR1 0x11010
46#define HD64461_LDR1_DON 0x01 51#define HD64461_LDR1_DON 0x01
@@ -54,9 +59,9 @@
54#define HD64461_LDVSPR 0x1101c 59#define HD64461_LDVSPR 0x1101c
55#define HD64461_LDR3 0x1101e 60#define HD64461_LDR3 0x1101e
56 61
57#define HD64461_CPTWAR 0x11030 62#define HD64461_CPTWAR 0x11030
58#define HD64461_CPTWDR 0x11032 63#define HD64461_CPTWDR 0x11032
59#define HD64461_CPTRAR 0x11034 64#define HD64461_CPTRAR 0x11034
60#define HD64461_CPTRDR 0x11036 65#define HD64461_CPTRDR 0x11036
61 66
62#define HD64461_GRDOR 0x11040 67#define HD64461_GRDOR 0x11040
@@ -111,7 +116,7 @@
111#define HD64461_PCCISR_BVD1 0x01 /* battery 1 */ 116#define HD64461_PCCISR_BVD1 0x01 /* battery 1 */
112 117
113#define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */ 118#define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */
114#define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */ 119#define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */
115#define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */ 120#define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */
116#define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */ 121#define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */
117#define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */ 122#define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */
@@ -139,11 +144,11 @@
139 144
140/* PCC Card Status Change Interrupt Enable Register */ 145/* PCC Card Status Change Interrupt Enable Register */
141#define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */ 146#define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */
142#define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */ 147#define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */
143#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */ 148#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */
144#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */ 149#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */
145#define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */ 150#define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */
146#define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */ 151#define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */
147 152
148#define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */ 153#define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */
149#define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */ 154#define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */
@@ -155,7 +160,6 @@
155#define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */ 160#define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */
156#define HD64461_PCCSCR_SWP 0x01 /* write protect */ 161#define HD64461_PCCSCR_SWP 0x01 /* write protect */
157 162
158
159#define HD64461_P0OCR 0x1202a 163#define HD64461_P0OCR 0x1202a
160#define HD64461_P1OCR 0x1202c 164#define HD64461_P1OCR 0x1202c
161#define HD64461_PGCR 0x1202e 165#define HD64461_PGCR 0x1202e
@@ -180,23 +184,25 @@
180#define HD64461_NIRR 0x15000 184#define HD64461_NIRR 0x15000
181#define HD64461_NIMR 0x15002 185#define HD64461_NIMR 0x15002
182 186
183#ifndef CONFIG_HD64461_IOBASE
184#define CONFIG_HD64461_IOBASE 0xb0000000
185#endif
186#ifndef CONFIG_HD64461_IRQ
187#define CONFIG_HD64461_IRQ 36
188#endif
189
190#define HD64461_IRQBASE OFFCHIP_IRQ_BASE 187#define HD64461_IRQBASE OFFCHIP_IRQ_BASE
191#define HD64461_IRQ_NUM 16 188#define HD64461_IRQ_NUM 16
192 189
193#define HD64461_IRQ_UART (HD64461_IRQBASE+5) 190#define HD64461_IRQ_UART (HD64461_IRQBASE+5)
194#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6) 191#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6)
195#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9) 192#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9)
196#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10) 193#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10)
197#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11) 194#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11)
198#define HD64461_IRQ_AFE (HD64461_IRQBASE+12) 195#define HD64461_IRQ_AFE (HD64461_IRQBASE+12)
199#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13) 196#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13)
200#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14) 197#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14)
198
199#define __IO_PREFIX hd64461
200#include <asm/io_generic.h>
201
202/* arch/sh/cchips/hd6446x/hd64461/setup.c */
203int hd64461_irq_demux(int irq);
204void hd64461_register_irq_demux(int irq,
205 int (*demux) (int irq, void *dev), void *dev);
206void hd64461_unregister_irq_demux(int irq);
201 207
202#endif 208#endif
diff --git a/include/asm-sh/hd64461/io.h b/include/asm-sh/hd64461/io.h
deleted file mode 100644
index 67f2489088d9..000000000000
--- a/include/asm-sh/hd64461/io.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * include/asm-sh/io_hd64461.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 * IO functions for an HD64461
10 */
11
12#ifndef _ASM_SH_IO_HD64461_H
13#define _ASM_SH_IO_HD64461_H
14
15extern unsigned char hd64461_inb(unsigned long port);
16extern unsigned short hd64461_inw(unsigned long port);
17extern unsigned int hd64461_inl(unsigned long port);
18
19extern void hd64461_outb(unsigned char value, unsigned long port);
20extern void hd64461_outw(unsigned short value, unsigned long port);
21extern void hd64461_outl(unsigned int value, unsigned long port);
22
23extern unsigned char hd64461_inb_p(unsigned long port);
24extern void hd64461_outb_p(unsigned char value, unsigned long port);
25
26extern void hd64461_insb(unsigned long port, void *addr, unsigned long count);
27extern void hd64461_insw(unsigned long port, void *addr, unsigned long count);
28extern void hd64461_insl(unsigned long port, void *addr, unsigned long count);
29
30extern void hd64461_outsb(unsigned long port, const void *buffer, unsigned long count);
31extern void hd64461_outsw(unsigned long port, const void *buffer, unsigned long count);
32extern void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count);
33
34extern unsigned short hd64461_readw(unsigned long addr);
35extern void hd64461_writew(unsigned short b, unsigned long addr);
36
37
38extern int hd64461_irq_demux(int irq);
39extern void hd64461_register_irq_demux(int irq,
40 int (*demux)(int irq, void *dev), void *dev);
41extern void hd64461_unregister_irq_demux(int irq);
42
43#endif /* _ASM_SH_IO_HD64461_H */
diff --git a/include/asm-sh/hd64465/io.h b/include/asm-sh/hd64465/io.h
index 1100bcf4968e..139f1472e5bb 100644
--- a/include/asm-sh/hd64465/io.h
+++ b/include/asm-sh/hd64465/io.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-sh/io_hd64465.h 2 * include/asm-sh/hd64465/io.h
3 * 3 *
4 * By Greg Banks <gbanks@pocketpenguins.com> 4 * By Greg Banks <gbanks@pocketpenguins.com>
5 * (c) 2000 PocketPenguins Inc. 5 * (c) 2000 PocketPenguins Inc.
diff --git a/include/asm-sh/hp6xx/hp6xx.h b/include/asm-sh/hp6xx/hp6xx.h
index a26247fd3d87..f35134c159dd 100644
--- a/include/asm-sh/hp6xx/hp6xx.h
+++ b/include/asm-sh/hp6xx/hp6xx.h
@@ -2,16 +2,33 @@
2#define __ASM_SH_HP6XX_H 2#define __ASM_SH_HP6XX_H
3 3
4/* 4/*
5 * Copyright (C) 2003 Andriy Skulysh 5 * Copyright (C) 2003, 2004, 2005 Andriy Skulysh
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
6 */ 11 */
7 12
8#define HP680_TS_IRQ IRQ3_IRQ 13#define HP680_BTN_IRQ IRQ0_IRQ
14#define HP680_TS_IRQ IRQ3_IRQ
15#define HP680_HD64461_IRQ IRQ4_IRQ
9 16
10#define DAC_LCD_BRIGHTNESS 0 17#define DAC_LCD_BRIGHTNESS 0
11#define DAC_SPEAKER_VOLUME 1 18#define DAC_SPEAKER_VOLUME 1
12 19
20#define PGDR_OPENED 0x01
21#define PGDR_MAIN_BATTERY_OUT 0x04
22#define PGDR_PLAY_BUTTON 0x08
23#define PGDR_REWIND_BUTTON 0x10
24#define PGDR_RECORD_BUTTON 0x20
25
13#define PHDR_TS_PEN_DOWN 0x08 26#define PHDR_TS_PEN_DOWN 0x08
14 27
28#define PJDR_LED_BLINK 0x02
29
30#define PKDR_LED_GREEN 0x10
31
15#define SCPDR_TS_SCAN_ENABLE 0x20 32#define SCPDR_TS_SCAN_ENABLE 0x20
16#define SCPDR_TS_SCAN_Y 0x02 33#define SCPDR_TS_SCAN_Y 0x02
17#define SCPDR_TS_SCAN_X 0x01 34#define SCPDR_TS_SCAN_X 0x01
@@ -21,11 +38,43 @@
21 38
22#define ADC_CHANNEL_TS_Y 1 39#define ADC_CHANNEL_TS_Y 1
23#define ADC_CHANNEL_TS_X 2 40#define ADC_CHANNEL_TS_X 2
41#define ADC_CHANNEL_BATTERY 3
42#define ADC_CHANNEL_BACKUP 4
43#define ADC_CHANNEL_CHARGE 5
24 44
25#define HD64461_GPADR_SPEAKER 0x01 45#define HD64461_GPADR_SPEAKER 0x01
26#define HD64461_GPADR_PCMCIA0 (0x02|0x08) 46#define HD64461_GPADR_PCMCIA0 (0x02|0x08)
47
27#define HD64461_GPBDR_LCDOFF 0x01 48#define HD64461_GPBDR_LCDOFF 0x01
49#define HD64461_GPBDR_LCD_CONTRAST_MASK 0x78
28#define HD64461_GPBDR_LED_RED 0x80 50#define HD64461_GPBDR_LED_RED 0x80
29 51
52#include <asm/hd64461.h>
53#include <asm/io.h>
54
55#define PJDR 0xa4000130
56#define PKDR 0xa4000132
57
58static inline void hp6xx_led_red(int on)
59{
60 u16 v16;
61 v16 = ctrl_inw(CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000);
62 if (on)
63 ctrl_outw(v16 & (~HD64461_GPBDR_LED_RED), CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000);
64 else
65 ctrl_outw(v16 | HD64461_GPBDR_LED_RED, CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000);
66}
67
68static inline void hp6xx_led_green(int on)
69{
70 u8 v8;
71
72 v8 = ctrl_inb(PKDR);
73 if (on)
74 ctrl_outb(v8 & (~PKDR_LED_GREEN), PKDR);
75 else
76 ctrl_outb(v8 | PKDR_LED_GREEN, PKDR);
77}
78
30 79
31#endif /* __ASM_SH_HP6XX_H */ 80#endif /* __ASM_SH_HP6XX_H */
diff --git a/include/asm-sh/hp6xx/io.h b/include/asm-sh/hp6xx/io.h
index 731798003550..2044476ab199 100644
--- a/include/asm-sh/hp6xx/io.h
+++ b/include/asm-sh/hp6xx/io.h
@@ -4,7 +4,7 @@
4/* 4/*
5 * Nothing special here.. just use the generic cchip io routines. 5 * Nothing special here.. just use the generic cchip io routines.
6 */ 6 */
7#include <asm/hd64461/io.h> 7#include <asm/hd64461.h>
8 8
9#endif /* __ASM_SH_HP6XX_IO_H */ 9#endif /* __ASM_SH_HP6XX_IO_H */
10 10
diff --git a/include/asm-sh/hs7751rvoip/hs7751rvoip.h b/include/asm-sh/hs7751rvoip/hs7751rvoip.h
index 5f995f937a44..c4cff9d33927 100644
--- a/include/asm-sh/hs7751rvoip/hs7751rvoip.h
+++ b/include/asm-sh/hs7751rvoip/hs7751rvoip.h
@@ -19,8 +19,6 @@
19#define PA_OUTPORTR 0xa400000e /* Output Port Reguster */ 19#define PA_OUTPORTR 0xa400000e /* Output Port Reguster */
20#define PA_VERREG 0xa4000014 /* FPGA Version Register */ 20#define PA_VERREG 0xa4000014 /* FPGA Version Register */
21 21
22#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
23#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
24#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ 22#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */
25 23
26#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ 24#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
@@ -44,4 +42,13 @@
44#define IRQ_RINGING 4 /* Ringing IRQ */ 42#define IRQ_RINGING 4 /* Ringing IRQ */
45#define IRQ_CODEC 5 /* CODEC IRQ */ 43#define IRQ_CODEC 5 /* CODEC IRQ */
46 44
45#define __IO_PREFIX hs7751rvoip
46#include <asm/io_generic.h>
47
48/* arch/sh/boards/renesas/hs7751rvoip/irq.c */
49void init_hs7751rvoip_IRQ(void);
50
51/* arch/sh/boards/renesas/hs7751rvoip/io.c */
52void *hs7751rvoip_ioremap(unsigned long, unsigned long);
53
47#endif /* __ASM_SH_RENESAS_HS7751RVOIP */ 54#endif /* __ASM_SH_RENESAS_HS7751RVOIP */
diff --git a/include/asm-sh/hs7751rvoip/io.h b/include/asm-sh/hs7751rvoip/io.h
deleted file mode 100644
index 513c8514001b..000000000000
--- a/include/asm-sh/hs7751rvoip/io.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * include/asm-sh/hs7751rvoip/hs7751rvoip.h
3 *
4 * Modified version of io_se.h for the hs7751rvoip-specific functions.
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 * IO functions for an Renesas Technology sales HS7751RVOIP
10 */
11
12#ifndef _ASM_SH_IO_HS7751RVOIP_H
13#define _ASM_SH_IO_HS7751RVOIP_H
14
15#include <asm/io_generic.h>
16
17extern unsigned char hs7751rvoip_inb(unsigned long port);
18extern unsigned short hs7751rvoip_inw(unsigned long port);
19extern unsigned int hs7751rvoip_inl(unsigned long port);
20
21extern void hs7751rvoip_outb(unsigned char value, unsigned long port);
22extern void hs7751rvoip_outw(unsigned short value, unsigned long port);
23extern void hs7751rvoip_outl(unsigned int value, unsigned long port);
24
25extern unsigned char hs7751rvoip_inb_p(unsigned long port);
26extern void hs7751rvoip_outb_p(unsigned char value, unsigned long port);
27
28extern void hs7751rvoip_insb(unsigned long port, void *addr, unsigned long count);
29extern void hs7751rvoip_insw(unsigned long port, void *addr, unsigned long count);
30extern void hs7751rvoip_insl(unsigned long port, void *addr, unsigned long count);
31extern void hs7751rvoip_outsb(unsigned long port, const void *addr, unsigned long count);
32extern void hs7751rvoip_outsw(unsigned long port, const void *addr, unsigned long count);
33extern void hs7751rvoip_outsl(unsigned long port, const void *addr, unsigned long count);
34
35extern void *hs7751rvoip_ioremap(unsigned long offset, unsigned long size);
36
37extern unsigned long hs7751rvoip_isa_port2addr(unsigned long offset);
38
39#endif /* _ASM_SH_IO_HS7751RVOIP_H */
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index 894e64b2d5f0..ed12d38e8c00 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -107,6 +107,9 @@
107#define __raw_writew(v, a) __writew(v, (void __iomem *)(a)) 107#define __raw_writew(v, a) __writew(v, (void __iomem *)(a))
108#define __raw_writel(v, a) __writel(v, (void __iomem *)(a)) 108#define __raw_writel(v, a) __writel(v, (void __iomem *)(a))
109 109
110void __raw_writesl(unsigned long addr, const void *data, int longlen);
111void __raw_readsl(unsigned long addr, void *data, int longlen);
112
110/* 113/*
111 * The platform header files may define some of these macros to use 114 * The platform header files may define some of these macros to use
112 * the inlined versions where appropriate. These macros may also be 115 * the inlined versions where appropriate. These macros may also be
@@ -132,6 +135,9 @@
132# define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) 135# define writel(v,a) ({ __raw_writel((v),(a)); mb(); })
133#endif 136#endif
134 137
138#define writesl __raw_writesl
139#define readsl __raw_readsl
140
135#define readb_relaxed(a) readb(a) 141#define readb_relaxed(a) readb(a)
136#define readw_relaxed(a) readw(a) 142#define readw_relaxed(a) readw(a)
137#define readl_relaxed(a) readl(a) 143#define readl_relaxed(a) readl(a)
@@ -209,8 +215,14 @@ static inline void ctrl_outl(unsigned int b, unsigned long addr)
209 *(volatile unsigned long*)addr = b; 215 *(volatile unsigned long*)addr = b;
210} 216}
211 217
218static inline void ctrl_delay(void)
219{
220 ctrl_inw(P2SEG);
221}
222
212#define IO_SPACE_LIMIT 0xffffffff 223#define IO_SPACE_LIMIT 0xffffffff
213 224
225#ifdef CONFIG_MMU
214/* 226/*
215 * Change virtual addresses to physical addresses and vv. 227 * Change virtual addresses to physical addresses and vv.
216 * These are trivial on the 1:1 Linux/SuperH mapping 228 * These are trivial on the 1:1 Linux/SuperH mapping
@@ -224,6 +236,10 @@ static inline void *phys_to_virt(unsigned long address)
224{ 236{
225 return (void *)P1SEGADDR(address); 237 return (void *)P1SEGADDR(address);
226} 238}
239#else
240#define phys_to_virt(address) ((void *)(address))
241#define virt_to_phys(address) ((unsigned long)(address))
242#endif
227 243
228#define virt_to_bus virt_to_phys 244#define virt_to_bus virt_to_phys
229#define bus_to_virt phys_to_virt 245#define bus_to_virt phys_to_virt
diff --git a/include/asm-sh/irq-sh73180.h b/include/asm-sh/irq-sh73180.h
index d705252be260..b28af9a69d72 100644
--- a/include/asm-sh/irq-sh73180.h
+++ b/include/asm-sh/irq-sh73180.h
@@ -311,6 +311,4 @@
311#define IRQ6_PRIORITY 1 311#define IRQ6_PRIORITY 1
312#define IRQ7_PRIORITY 1 312#define IRQ7_PRIORITY 1
313 313
314int shmse_irq_demux(int irq);
315
316#endif /* __ASM_SH_IRQ_SH73180_H */ 314#endif /* __ASM_SH_IRQ_SH73180_H */
diff --git a/include/asm-sh/irq-sh7343.h b/include/asm-sh/irq-sh7343.h
new file mode 100644
index 000000000000..5d15419b53b0
--- /dev/null
+++ b/include/asm-sh/irq-sh7343.h
@@ -0,0 +1,317 @@
1#ifndef __ASM_SH_IRQ_SH7343_H
2#define __ASM_SH_IRQ_SH7343_H
3
4/*
5 * linux/include/asm-sh/irq-sh7343.h
6 *
7 * Copyright (C) 2006 Kenati Technologies Inc.
8 * Andre Mccurdy <andre@kenati.com>
9 * Ranjit Deshpande <ranjit@kenati.com>
10 */
11
12#undef INTC_IPRA
13#undef INTC_IPRB
14#undef INTC_IPRC
15#undef INTC_IPRD
16
17#undef DMTE0_IRQ
18#undef DMTE1_IRQ
19#undef DMTE2_IRQ
20#undef DMTE3_IRQ
21#undef DMTE4_IRQ
22#undef DMTE5_IRQ
23#undef DMTE6_IRQ
24#undef DMTE7_IRQ
25#undef DMAE_IRQ
26#undef DMA_IPR_ADDR
27#undef DMA_IPR_POS
28#undef DMA_PRIORITY
29
30#undef INTC_IMCR0
31#undef INTC_IMCR1
32#undef INTC_IMCR2
33#undef INTC_IMCR3
34#undef INTC_IMCR4
35#undef INTC_IMCR5
36#undef INTC_IMCR6
37#undef INTC_IMCR7
38#undef INTC_IMCR8
39#undef INTC_IMCR9
40#undef INTC_IMCR10
41
42
43#define INTC_IPRA 0xA4080000UL
44#define INTC_IPRB 0xA4080004UL
45#define INTC_IPRC 0xA4080008UL
46#define INTC_IPRD 0xA408000CUL
47#define INTC_IPRE 0xA4080010UL
48#define INTC_IPRF 0xA4080014UL
49#define INTC_IPRG 0xA4080018UL
50#define INTC_IPRH 0xA408001CUL
51#define INTC_IPRI 0xA4080020UL
52#define INTC_IPRJ 0xA4080024UL
53#define INTC_IPRK 0xA4080028UL
54#define INTC_IPRL 0xA408002CUL
55
56#define INTC_IMR0 0xA4080080UL
57#define INTC_IMR1 0xA4080084UL
58#define INTC_IMR2 0xA4080088UL
59#define INTC_IMR3 0xA408008CUL
60#define INTC_IMR4 0xA4080090UL
61#define INTC_IMR5 0xA4080094UL
62#define INTC_IMR6 0xA4080098UL
63#define INTC_IMR7 0xA408009CUL
64#define INTC_IMR8 0xA40800A0UL
65#define INTC_IMR9 0xA40800A4UL
66#define INTC_IMR10 0xA40800A8UL
67#define INTC_IMR11 0xA40800ACUL
68
69#define INTC_IMCR0 0xA40800C0UL
70#define INTC_IMCR1 0xA40800C4UL
71#define INTC_IMCR2 0xA40800C8UL
72#define INTC_IMCR3 0xA40800CCUL
73#define INTC_IMCR4 0xA40800D0UL
74#define INTC_IMCR5 0xA40800D4UL
75#define INTC_IMCR6 0xA40800D8UL
76#define INTC_IMCR7 0xA40800DCUL
77#define INTC_IMCR8 0xA40800E0UL
78#define INTC_IMCR9 0xA40800E4UL
79#define INTC_IMCR10 0xA40800E8UL
80#define INTC_IMCR11 0xA40800ECUL
81
82#define INTC_ICR0 0xA4140000UL
83#define INTC_ICR1 0xA414001CUL
84
85#define INTMSK0 0xa4140044
86#define INTMSKCLR0 0xa4140064
87#define INTC_INTPRI0 0xa4140010
88
89/*
90 NOTE:
91
92 *_IRQ = (INTEVT2 - 0x200)/0x20
93*/
94
95/* TMU0 */
96#define TMU0_IRQ 16
97#define TMU0_IPR_ADDR INTC_IPRA
98#define TMU0_IPR_POS 3
99#define TMU0_PRIORITY 2
100
101#define TIMER_IRQ 16
102#define TIMER_IPR_ADDR INTC_IPRA
103#define TIMER_IPR_POS 3
104#define TIMER_PRIORITY 2
105
106/* TMU1 */
107#define TMU1_IRQ 17
108#define TMU1_IPR_ADDR INTC_IPRA
109#define TMU1_IPR_POS 2
110#define TMU1_PRIORITY 2
111
112/* TMU2 */
113#define TMU2_IRQ 18
114#define TMU2_IPR_ADDR INTC_IPRA
115#define TMU2_IPR_POS 1
116#define TMU2_PRIORITY 2
117
118/* LCDC */
119#define LCDC_IRQ 28
120#define LCDC_IPR_ADDR INTC_IPRB
121#define LCDC_IPR_POS 2
122#define LCDC_PRIORITY 2
123
124/* VIO (Video I/O) */
125#define CEU_IRQ 52
126#define BEU_IRQ 53
127#define VEU_IRQ 54
128#define VOU_IRQ 55
129#define VIO_IPR_ADDR INTC_IPRE
130#define VIO_IPR_POS 2
131#define VIO_PRIORITY 2
132
133/* MFI (Multi Functional Interface) */
134#define MFI_IRQ 56
135#define MFI_IPR_ADDR INTC_IPRE
136#define MFI_IPR_POS 1
137#define MFI_PRIORITY 2
138
139/* VPU (Video Processing Unit) */
140#define VPU_IRQ 60
141#define VPU_IPR_ADDR INTC_IPRE
142#define VPU_IPR_POS 0
143#define VPU_PRIORITY 2
144
145/* 3DG */
146#define TDG_IRQ 63
147#define TDG_IPR_ADDR INTC_IPRJ
148#define TDG_IPR_POS 2
149#define TDG_PRIORITY 2
150
151/* DMAC(1) */
152#define DMTE0_IRQ 48
153#define DMTE1_IRQ 49
154#define DMTE2_IRQ 50
155#define DMTE3_IRQ 51
156#define DMA1_IPR_ADDR INTC_IPRE
157#define DMA1_IPR_POS 3
158#define DMA1_PRIORITY 7
159
160/* DMAC(2) */
161#define DMTE4_IRQ 76
162#define DMTE5_IRQ 77
163#define DMA2_IPR_ADDR INTC_IPRF
164#define DMA2_IPR_POS 2
165#define DMA2_PRIORITY 7
166
167/* SCIF0 */
168#define SCIF_ERI_IRQ 80
169#define SCIF_RXI_IRQ 81
170#define SCIF_BRI_IRQ 82
171#define SCIF_TXI_IRQ 83
172#define SCIF_IPR_ADDR INTC_IPRG
173#define SCIF_IPR_POS 3
174#define SCIF_PRIORITY 3
175
176/* SIOF0 */
177#define SIOF0_IRQ 84
178#define SIOF0_IPR_ADDR INTC_IPRH
179#define SIOF0_IPR_POS 3
180#define SIOF0_PRIORITY 3
181
182/* FLCTL (Flash Memory Controller) */
183#define FLSTE_IRQ 92
184#define FLTEND_IRQ 93
185#define FLTRQ0_IRQ 94
186#define FLTRQ1_IRQ 95
187#define FLCTL_IPR_ADDR INTC_IPRH
188#define FLCTL_IPR_POS 1
189#define FLCTL_PRIORITY 3
190
191/* IIC(0) (IIC Bus Interface) */
192#define IIC0_ALI_IRQ 96
193#define IIC0_TACKI_IRQ 97
194#define IIC0_WAITI_IRQ 98
195#define IIC0_DTEI_IRQ 99
196#define IIC0_IPR_ADDR INTC_IPRH
197#define IIC0_IPR_POS 0
198#define IIC0_PRIORITY 3
199
200/* IIC(1) (IIC Bus Interface) */
201#define IIC1_ALI_IRQ 44
202#define IIC1_TACKI_IRQ 45
203#define IIC1_WAITI_IRQ 46
204#define IIC1_DTEI_IRQ 47
205#define IIC1_IPR_ADDR INTC_IPRI
206#define IIC1_IPR_POS 0
207#define IIC1_PRIORITY 3
208
209/* SIO0 */
210#define SIO0_IRQ 88
211#define SIO0_IPR_ADDR INTC_IPRI
212#define SIO0_IPR_POS 3
213#define SIO0_PRIORITY 3
214
215/* SDHI */
216#define SDHI_SDHII0_IRQ 100
217#define SDHI_SDHII1_IRQ 101
218#define SDHI_SDHII2_IRQ 102
219#define SDHI_SDHII3_IRQ 103
220#define SDHI_IPR_ADDR INTC_IPRK
221#define SDHI_IPR_POS 0
222#define SDHI_PRIORITY 3
223
224/* SIU (Sound Interface Unit) */
225#define SIU_IRQ 108
226#define SIU_IPR_ADDR INTC_IPRJ
227#define SIU_IPR_POS 1
228#define SIU_PRIORITY 3
229
230#define PORT_PACR 0xA4050100UL
231#define PORT_PBCR 0xA4050102UL
232#define PORT_PCCR 0xA4050104UL
233#define PORT_PDCR 0xA4050106UL
234#define PORT_PECR 0xA4050108UL
235#define PORT_PFCR 0xA405010AUL
236#define PORT_PGCR 0xA405010CUL
237#define PORT_PHCR 0xA405010EUL
238#define PORT_PJCR 0xA4050110UL
239#define PORT_PKCR 0xA4050112UL
240#define PORT_PLCR 0xA4050114UL
241#define PORT_SCPCR 0xA4050116UL
242#define PORT_PMCR 0xA4050118UL
243#define PORT_PNCR 0xA405011AUL
244#define PORT_PQCR 0xA405011CUL
245#define PORT_PRCR 0xA405011EUL
246#define PORT_PTCR 0xA405014CUL
247#define PORT_PUCR 0xA405014EUL
248#define PORT_PVCR 0xA4050150UL
249
250#define PORT_PSELA 0xA4050140UL
251#define PORT_PSELB 0xA4050142UL
252#define PORT_PSELC 0xA4050144UL
253#define PORT_PSELE 0xA4050158UL
254
255#define PORT_HIZCRA 0xA4050146UL
256#define PORT_HIZCRB 0xA4050148UL
257#define PORT_DRVCR 0xA405014AUL
258
259#define PORT_PADR 0xA4050120UL
260#define PORT_PBDR 0xA4050122UL
261#define PORT_PCDR 0xA4050124UL
262#define PORT_PDDR 0xA4050126UL
263#define PORT_PEDR 0xA4050128UL
264#define PORT_PFDR 0xA405012AUL
265#define PORT_PGDR 0xA405012CUL
266#define PORT_PHDR 0xA405012EUL
267#define PORT_PJDR 0xA4050130UL
268#define PORT_PKDR 0xA4050132UL
269#define PORT_PLDR 0xA4050134UL
270#define PORT_SCPDR 0xA4050136UL
271#define PORT_PMDR 0xA4050138UL
272#define PORT_PNDR 0xA405013AUL
273#define PORT_PQDR 0xA405013CUL
274#define PORT_PRDR 0xA405013EUL
275#define PORT_PTDR 0xA405016CUL
276#define PORT_PUDR 0xA405016EUL
277#define PORT_PVDR 0xA4050170UL
278
279#define IRQ0_IRQ 32
280#define IRQ1_IRQ 33
281#define IRQ2_IRQ 34
282#define IRQ3_IRQ 35
283#define IRQ4_IRQ 36
284#define IRQ5_IRQ 37
285#define IRQ6_IRQ 38
286#define IRQ7_IRQ 39
287
288#define INTPRI00 0xA4140010UL
289
290#define IRQ0_IPR_ADDR INTPRI00
291#define IRQ1_IPR_ADDR INTPRI00
292#define IRQ2_IPR_ADDR INTPRI00
293#define IRQ3_IPR_ADDR INTPRI00
294#define IRQ4_IPR_ADDR INTPRI00
295#define IRQ5_IPR_ADDR INTPRI00
296#define IRQ6_IPR_ADDR INTPRI00
297#define IRQ7_IPR_ADDR INTPRI00
298
299#define IRQ0_IPR_POS 7
300#define IRQ1_IPR_POS 6
301#define IRQ2_IPR_POS 5
302#define IRQ3_IPR_POS 4
303#define IRQ4_IPR_POS 3
304#define IRQ5_IPR_POS 2
305#define IRQ6_IPR_POS 1
306#define IRQ7_IPR_POS 0
307
308#define IRQ0_PRIORITY 1
309#define IRQ1_PRIORITY 1
310#define IRQ2_PRIORITY 1
311#define IRQ3_PRIORITY 1
312#define IRQ4_PRIORITY 1
313#define IRQ5_PRIORITY 1
314#define IRQ6_PRIORITY 1
315#define IRQ7_PRIORITY 1
316
317#endif /* __ASM_SH_IRQ_SH7343_H */
diff --git a/include/asm-sh/irq-sh7780.h b/include/asm-sh/irq-sh7780.h
index 7f90315cd830..895c5780e454 100644
--- a/include/asm-sh/irq-sh7780.h
+++ b/include/asm-sh/irq-sh7780.h
@@ -145,11 +145,6 @@
145#define TMU_CH5_IPR_POS 1 145#define TMU_CH5_IPR_POS 1
146#define TMU_CH5_PRIORITY 2 146#define TMU_CH5_PRIORITY 2
147 147
148#define RTC_IRQ 22
149#define RTC_IPR_ADDR INTC_INT2PRI1
150#define RTC_IPR_POS 0
151#define RTC_PRIORITY TIMER_PRIORITY
152
153/* SCIF0 */ 148/* SCIF0 */
154#define SCIF0_ERI_IRQ 40 149#define SCIF0_ERI_IRQ 40
155#define SCIF0_RXI_IRQ 41 150#define SCIF0_RXI_IRQ 41
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 611e67cd0627..0e5f365aff70 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -192,7 +192,7 @@
192 192
193#if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \ 193#if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \
194 defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \ 194 defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \
195 defined (CONFIG_CPU_SUBTYPE_SH7751) 195 defined (CONFIG_CPU_SUBTYPE_SH7751) || defined (CONFIG_CPU_SUBTYPE_SH7706)
196#define SCI_ERI_IRQ 23 196#define SCI_ERI_IRQ 23
197#define SCI_RXI_IRQ 24 197#define SCI_RXI_IRQ 24
198#define SCI_TXI_IRQ 25 198#define SCI_TXI_IRQ 25
@@ -207,6 +207,7 @@
207#define SCIF0_IPR_POS 3 207#define SCIF0_IPR_POS 3
208#define SCIF0_PRIORITY 3 208#define SCIF0_PRIORITY 3
209#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 209#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
210 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
210 defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 211 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
211 defined(CONFIG_CPU_SUBTYPE_SH7709) 212 defined(CONFIG_CPU_SUBTYPE_SH7709)
212#define SCIF_ERI_IRQ 56 213#define SCIF_ERI_IRQ 56
@@ -261,9 +262,12 @@
261#elif defined(CONFIG_CPU_SUBTYPE_SH7708) 262#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
262# define ONCHIP_NR_IRQS 32 263# define ONCHIP_NR_IRQS 32
263#elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \ 264#elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
265 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
264 defined(CONFIG_CPU_SUBTYPE_SH7705) 266 defined(CONFIG_CPU_SUBTYPE_SH7705)
265# define ONCHIP_NR_IRQS 64 // Actually 61 267# define ONCHIP_NR_IRQS 64 // Actually 61
266# define PINT_NR_IRQS 16 268# define PINT_NR_IRQS 16
269#elif defined(CONFIG_CPU_SUBTYPE_SH7710)
270# define ONCHIP_NR_IRQS 104
267#elif defined(CONFIG_CPU_SUBTYPE_SH7750) 271#elif defined(CONFIG_CPU_SUBTYPE_SH7750)
268# define ONCHIP_NR_IRQS 48 // Actually 44 272# define ONCHIP_NR_IRQS 48 // Actually 44
269#elif defined(CONFIG_CPU_SUBTYPE_SH7751) 273#elif defined(CONFIG_CPU_SUBTYPE_SH7751)
@@ -275,7 +279,8 @@
275#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) 279#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
276# define ONCHIP_NR_IRQS 144 280# define ONCHIP_NR_IRQS 144
277#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \ 281#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
278 defined(CONFIG_CPU_SUBTYPE_SH73180) 282 defined(CONFIG_CPU_SUBTYPE_SH73180) || \
283 defined(CONFIG_CPU_SUBTYPE_SH7343)
279# define ONCHIP_NR_IRQS 109 284# define ONCHIP_NR_IRQS 109
280#elif defined(CONFIG_CPU_SUBTYPE_SH7780) 285#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
281# define ONCHIP_NR_IRQS 111 286# define ONCHIP_NR_IRQS 111
@@ -311,6 +316,8 @@
311# define OFFCHIP_NR_IRQS 4 316# define OFFCHIP_NR_IRQS 4
312#elif defined(CONFIG_SH_R7780RP) 317#elif defined(CONFIG_SH_R7780RP)
313# define OFFCHIP_NR_IRQS 16 318# define OFFCHIP_NR_IRQS 16
319#elif defined(CONFIG_SH_7343_SOLUTION_ENGINE)
320# define OFFCHIP_NR_IRQS 12
314#elif defined(CONFIG_SH_UNKNOWN) 321#elif defined(CONFIG_SH_UNKNOWN)
315# define OFFCHIP_NR_IRQS 16 /* Must also be last */ 322# define OFFCHIP_NR_IRQS 16 /* Must also be last */
316#else 323#else
@@ -335,6 +342,11 @@ extern void make_maskreg_irq(unsigned int irq);
335extern unsigned short *irq_mask_register; 342extern unsigned short *irq_mask_register;
336 343
337/* 344/*
345 * PINT IRQs
346 */
347void init_IRQ_pint(void);
348
349/*
338 * Function for "on chip support modules". 350 * Function for "on chip support modules".
339 */ 351 */
340extern void make_ipr_irq(unsigned int irq, unsigned int addr, 352extern void make_ipr_irq(unsigned int irq, unsigned int addr,
@@ -471,8 +483,10 @@ extern int ipr_irq_demux(int irq);
471 483
472#define INTC_ICR 0xfffffee0UL 484#define INTC_ICR 0xfffffee0UL
473#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 485#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
486 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
474 defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 487 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
475 defined(CONFIG_CPU_SUBTYPE_SH7709) 488 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
489 defined(CONFIG_CPU_SUBTYPE_SH7710)
476#define INTC_IRR0 0xa4000004UL 490#define INTC_IRR0 0xa4000004UL
477#define INTC_IRR1 0xa4000006UL 491#define INTC_IRR1 0xa4000006UL
478#define INTC_IRR2 0xa4000008UL 492#define INTC_IRR2 0xa4000008UL
@@ -491,8 +505,105 @@ extern int ipr_irq_demux(int irq);
491#define INTC_IPRF 0xa4080000UL 505#define INTC_IPRF 0xa4080000UL
492#define INTC_IPRG 0xa4080002UL 506#define INTC_IPRG 0xa4080002UL
493#define INTC_IPRH 0xa4080004UL 507#define INTC_IPRH 0xa4080004UL
494#endif 508#elif defined(CONFIG_CPU_SUBTYPE_SH7710)
509/* Interrupt Controller Registers */
510#undef INTC_IPRA
511#undef INTC_IPRB
512#define INTC_IPRA 0xA414FEE2UL
513#define INTC_IPRB 0xA414FEE4UL
514#define INTC_IPRF 0xA4080000UL
515#define INTC_IPRG 0xA4080002UL
516#define INTC_IPRH 0xA4080004UL
517#define INTC_IPRI 0xA4080006UL
518
519#undef INTC_ICR0
520#undef INTC_ICR1
521#define INTC_ICR0 0xA414FEE0UL
522#define INTC_ICR1 0xA4140010UL
523
524#define INTC_IRR0 0xa4000004UL
525#define INTC_IRR1 0xa4000006UL
526#define INTC_IRR2 0xa4000008UL
527#define INTC_IRR3 0xa400000AUL
528#define INTC_IRR4 0xa400000CUL
529#define INTC_IRR5 0xa4080020UL
530#define INTC_IRR7 0xa4080024UL
531#define INTC_IRR8 0xa4080026UL
532
533/* Interrupt numbers */
534#define TIMER2_IRQ 18
535#define TIMER2_IPR_ADDR INTC_IPRA
536#define TIMER2_IPR_POS 1
537#define TIMER2_PRIORITY 2
538
539/* WDT */
540#define WDT_IRQ 27
541#define WDT_IPR_ADDR INTC_IPRB
542#define WDT_IPR_POS 3
543#define WDT_PRIORITY 2
544
545#define SCIF0_ERI_IRQ 52
546#define SCIF0_RXI_IRQ 53
547#define SCIF0_BRI_IRQ 54
548#define SCIF0_TXI_IRQ 55
549#define SCIF0_IPR_ADDR INTC_IPRE
550#define SCIF0_IPR_POS 2
551#define SCIF0_PRIORITY 3
552
553#define DMTE4_IRQ 76
554#define DMTE5_IRQ 77
555#define DMA2_IPR_ADDR INTC_IPRF
556#define DMA2_IPR_POS 2
557#define DMA2_PRIORITY 7
495 558
559#define IPSEC_IRQ 79
560#define IPSEC_IPR_ADDR INTC_IPRF
561#define IPSEC_IPR_POS 3
562#define IPSEC_PRIORITY 3
563
564/* EDMAC */
565#define EDMAC0_IRQ 80
566#define EDMAC0_IPR_ADDR INTC_IPRG
567#define EDMAC0_IPR_POS 3
568#define EDMAC0_PRIORITY 3
569
570#define EDMAC1_IRQ 81
571#define EDMAC1_IPR_ADDR INTC_IPRG
572#define EDMAC1_IPR_POS 2
573#define EDMAC1_PRIORITY 3
574
575#define EDMAC2_IRQ 82
576#define EDMAC2_IPR_ADDR INTC_IPRG
577#define EDMAC2_IPR_POS 1
578#define EDMAC2_PRIORITY 3
579
580/* SIOF */
581#define SIOF0_ERI_IRQ 96
582#define SIOF0_TXI_IRQ 97
583#define SIOF0_RXI_IRQ 98
584#define SIOF0_CCI_IRQ 99
585#define SIOF0_IPR_ADDR INTC_IPRH
586#define SIOF0_IPR_POS 0
587#define SIOF0_PRIORITY 7
588
589#define SIOF1_ERI_IRQ 100
590#define SIOF1_TXI_IRQ 101
591#define SIOF1_RXI_IRQ 102
592#define SIOF1_CCI_IRQ 103
593#define SIOF1_IPR_ADDR INTC_IPRI
594#define SIOF1_IPR_POS 1
595#define SIOF1_PRIORITY 7
596#endif /* CONFIG_CPU_SUBTYPE_SH7710 */
597
598#if defined(CONFIG_CPU_SUBTYPE_SH7710)
599#define PORT_PACR 0xa4050100UL
600#define PORT_PBCR 0xa4050102UL
601#define PORT_PCCR 0xa4050104UL
602#define PORT_PETCR 0xa4050106UL
603#define PORT_PADR 0xa4050120UL
604#define PORT_PBDR 0xa4050122UL
605#define PORT_PCDR 0xa4050124UL
606#else
496#define PORT_PACR 0xa4000100UL 607#define PORT_PACR 0xa4000100UL
497#define PORT_PBCR 0xa4000102UL 608#define PORT_PBCR 0xa4000102UL
498#define PORT_PCCR 0xa4000104UL 609#define PORT_PCCR 0xa4000104UL
@@ -501,6 +612,7 @@ extern int ipr_irq_demux(int irq);
501#define PORT_PBDR 0xa4000122UL 612#define PORT_PBDR 0xa4000122UL
502#define PORT_PCDR 0xa4000124UL 613#define PORT_PCDR 0xa4000124UL
503#define PORT_PFDR 0xa400012aUL 614#define PORT_PFDR 0xa400012aUL
615#endif
504 616
505#define IRQ0_IRQ 32 617#define IRQ0_IRQ 32
506#define IRQ1_IRQ 33 618#define IRQ1_IRQ 33
@@ -577,7 +689,7 @@ extern int ipr_irq_demux(int irq);
577#define NR_INTC2_IRQS 64 689#define NR_INTC2_IRQS 64
578#elif defined(CONFIG_CPU_SUBTYPE_SH7780) 690#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
579#define INTC2_BASE 0xffd40000 691#define INTC2_BASE 0xffd40000
580#define INTC2_FIRST_IRQ 22 692#define INTC2_FIRST_IRQ 21
581#define INTC2_INTMSK_OFFSET (0x38) 693#define INTC2_INTMSK_OFFSET (0x38)
582#define INTC2_INTMSKCLR_OFFSET (0x3c) 694#define INTC2_INTMSKCLR_OFFSET (0x3c)
583#define NR_INTC2_IRQS 60 695#define NR_INTC2_IRQS 60
@@ -594,6 +706,8 @@ void intc2_add_clear_irq(int irq, int (*fn)(int));
594 706
595#endif 707#endif
596 708
709extern int shmse_irq_demux(int irq);
710
597static inline int generic_irq_demux(int irq) 711static inline int generic_irq_demux(int irq)
598{ 712{
599 return irq; 713 return irq;
@@ -605,8 +719,21 @@ static inline int generic_irq_demux(int irq)
605#define irq_canonicalize(irq) (irq) 719#define irq_canonicalize(irq) (irq)
606#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) 720#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq))
607 721
722#ifdef CONFIG_4KSTACKS
723extern void irq_ctx_init(int cpu);
724extern void irq_ctx_exit(int cpu);
725# define __ARCH_HAS_DO_SOFTIRQ
726#else
727# define irq_ctx_init(cpu) do { } while (0)
728# define irq_ctx_exit(cpu) do { } while (0)
729#endif
730
608#if defined(CONFIG_CPU_SUBTYPE_SH73180) 731#if defined(CONFIG_CPU_SUBTYPE_SH73180)
609#include <asm/irq-sh73180.h> 732#include <asm/irq-sh73180.h>
610#endif 733#endif
611 734
735#if defined(CONFIG_CPU_SUBTYPE_SH7343)
736#include <asm/irq-sh7343.h>
737#endif
738
612#endif /* __ASM_SH_IRQ_H */ 739#endif /* __ASM_SH_IRQ_H */
diff --git a/include/asm-sh/kexec.h b/include/asm-sh/kexec.h
index 9dfe59f6fcb5..9d235af20cdd 100644
--- a/include/asm-sh/kexec.h
+++ b/include/asm-sh/kexec.h
@@ -23,11 +23,10 @@
23/* The native architecture */ 23/* The native architecture */
24#define KEXEC_ARCH KEXEC_ARCH_SH 24#define KEXEC_ARCH KEXEC_ARCH_SH
25 25
26#ifndef __ASSEMBLY__ 26#define MAX_NOTE_BYTES 1024
27 27
28extern void machine_shutdown(void); 28/* Provide a dummy definition to avoid build failures. */
29extern void *crash_notes; 29static inline void crash_setup_regs(struct pt_regs *newregs,
30 30 struct pt_regs *oldregs) { }
31#endif /* __ASSEMBLY__ */
32 31
33#endif /* _SH_KEXEC_H */ 32#endif /* _SH_KEXEC_H */
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 1653ffb75fbe..7b26f53fe343 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -128,4 +128,19 @@ extern int setjmp(jmp_buf __jmpb);
128#define KGDB_ASSERT(condition, message) 128#define KGDB_ASSERT(condition, message)
129#endif 129#endif
130 130
131/* Taken from sh-stub.c of GDB 4.18 */
132static const char hexchars[] = "0123456789abcdef";
133
134/* Get high hex bits */
135static inline char highhex(const int x)
136{
137 return hexchars[(x >> 4) & 0xf];
138}
139
140/* Get low hex bits */
141static inline char lowhex(const int x)
142{
143 return hexchars[x & 0xf];
144}
145
131#endif 146#endif
diff --git a/include/asm-sh/landisk/gio.h b/include/asm-sh/landisk/gio.h
new file mode 100644
index 000000000000..3fce4c451a46
--- /dev/null
+++ b/include/asm-sh/landisk/gio.h
@@ -0,0 +1,45 @@
1#ifndef __ASM_SH_LANDISK_GIO_H
2#define __ASM_SH_LANDISK_GIO_H
3
4#include <linux/ioctl.h>
5
6/* version */
7#define VERSION_STR "1.00"
8
9/* Driver name */
10#define GIO_DRIVER_NAME "/dev/giodrv"
11
12/* Use 'k' as magic number */
13#define GIODRV_IOC_MAGIC 'k'
14
15#define GIODRV_IOCRESET _IO(GIODRV_IOC_MAGIC, 0)
16/*
17 * S means "Set" through a ptr,
18 * T means "Tell" directly
19 * G means "Get" (to a pointed var)
20 * Q means "Query", response is on the return value
21 * X means "eXchange": G and S atomically
22 * H means "sHift": T and Q atomically
23 */
24#define GIODRV_IOCSGIODATA1 _IOW(GIODRV_IOC_MAGIC, 1, unsigned char *)
25#define GIODRV_IOCGGIODATA1 _IOR(GIODRV_IOC_MAGIC, 2, unsigned char *)
26#define GIODRV_IOCSGIODATA2 _IOW(GIODRV_IOC_MAGIC, 3, unsigned short *)
27#define GIODRV_IOCGGIODATA2 _IOR(GIODRV_IOC_MAGIC, 4, unsigned short *)
28#define GIODRV_IOCSGIODATA4 _IOW(GIODRV_IOC_MAGIC, 5, unsigned long *)
29#define GIODRV_IOCGGIODATA4 _IOR(GIODRV_IOC_MAGIC, 6, unsigned long *)
30#define GIODRV_IOCSGIOSETADDR _IOW(GIODRV_IOC_MAGIC, 7, unsigned long *)
31#define GIODRV_IOCHARDRESET _IO(GIODRV_IOC_MAGIC, 8) /* debugging tool */
32
33#define GIODRV_IOCSGIO_LED _IOW(GIODRV_IOC_MAGIC, 9, unsigned long *)
34#define GIODRV_IOCGGIO_LED _IOR(GIODRV_IOC_MAGIC, 10, unsigned long *)
35#define GIODRV_IOCSGIO_BUZZER _IOW(GIODRV_IOC_MAGIC, 11, unsigned long *)
36#define GIODRV_IOCGGIO_LANDISK _IOR(GIODRV_IOC_MAGIC, 14, unsigned long *)
37#define GIODRV_IOCGGIO_BTN _IOR(GIODRV_IOC_MAGIC, 22, unsigned long *)
38#define GIODRV_IOCSGIO_BTNPID _IOW(GIODRV_IOC_MAGIC, 23, unsigned long *)
39#define GIODRV_IOCGGIO_BTNPID _IOR(GIODRV_IOC_MAGIC, 24, unsigned long *)
40
41#define GIODRV_IOC_MAXNR 8
42#define GIO_READ 0x00000000
43#define GIO_WRITE 0x00000001
44
45#endif /* __ASM_SH_LANDISK_GIO_H */
diff --git a/include/asm-sh/landisk/ide.h b/include/asm-sh/landisk/ide.h
new file mode 100644
index 000000000000..6490e28415ed
--- /dev/null
+++ b/include/asm-sh/landisk/ide.h
@@ -0,0 +1,14 @@
1/*
2 * modifed by kogiidena
3 * 2005.03.03
4 */
5
6#ifndef __ASM_SH_LANDISK_IDE_H
7#define __ASM_SH_LANDISK_IDE_H
8
9/* Nothing to see here.. */
10#include <asm/landisk/iodata_landisk.h>
11#define IRQ_CFCARD IRQ_FATA /* CF Card IRQ */
12#define IRQ_PCMCIA IRQ_ATA /* PCMCIA IRQ */
13
14#endif /* __ASM_SH_LANDISK_IDE_H */
diff --git a/include/asm-sh/landisk/iodata_landisk.h b/include/asm-sh/landisk/iodata_landisk.h
new file mode 100644
index 000000000000..c74d3c73f377
--- /dev/null
+++ b/include/asm-sh/landisk/iodata_landisk.h
@@ -0,0 +1,79 @@
1#ifndef __ASM_SH_IODATA_LANDISK_H
2#define __ASM_SH_IODATA_LANDISK_H
3
4/*
5 * linux/include/asm-sh/landisk/iodata_landisk.h
6 *
7 * Copyright (C) 2000 Atom Create Engineering Co., Ltd.
8 *
9 * IO-DATA LANDISK support
10 */
11
12/* Box specific addresses. */
13
14#define PA_USB 0xa4000000 /* USB Controller M66590 */
15
16#define PA_ATARST 0xb0000000 /* ATA/FATA Access Control Register */
17#define PA_LED 0xb0000001 /* LED Control Register */
18#define PA_STATUS 0xb0000002 /* Switch Status Register */
19#define PA_SHUTDOWN 0xb0000003 /* Shutdown Control Register */
20#define PA_PCIPME 0xb0000004 /* PCI PME Status Register */
21#define PA_IMASK 0xb0000005 /* Interrupt Mask Register */
22/* 2003.10.31 I-O DATA NSD NWG add. for shutdown port clear */
23#define PA_PWRINT_CLR 0xb0000006 /* Shutdown Interrupt clear Register */
24
25#define PA_LCD_CLRDSP 0x00 /* LCD Clear Display Offset */
26#define PA_LCD_RTNHOME 0x00 /* LCD Return Home Offset */
27#define PA_LCD_ENTMODE 0x00 /* LCD Entry Mode Offset */
28#define PA_LCD_DSPCTL 0x00 /* LCD Display ON/OFF Control Offset */
29#define PA_LCD_FUNC 0x00 /* LCD Function Set Offset */
30#define PA_LCD_CGRAM 0x00 /* LCD Set CGRAM Address Offset */
31#define PA_LCD_DDRAM 0x00 /* LCD Set DDRAM Address Offset */
32#define PA_LCD_RDFLAG 0x01 /* LCD Read Busy Flag Offset */
33#define PA_LCD_WTDATA 0x02 /* LCD Write Datat to RAM Offset */
34#define PA_LCD_RDDATA 0x03 /* LCD Read Data from RAM Offset */
35#define PA_PIDE_OFFSET 0x40 /* CF IDE Offset */
36#define PA_SIDE_OFFSET 0x40 /* HDD IDE Offset */
37
38#define IRQ_PCIINTA 5 /* PCI INTA IRQ */
39#define IRQ_PCIINTB 6 /* PCI INTB IRQ */
40#define IRQ_PCIINDC 7 /* PCI INTC IRQ */
41#define IRQ_PCIINTD 8 /* PCI INTD IRQ */
42#define IRQ_ATA 9 /* ATA IRQ */
43#define IRQ_FATA 10 /* FATA IRQ */
44#define IRQ_POWER 11 /* Power Switch IRQ */
45#define IRQ_BUTTON 12 /* USL-5P Button IRQ */
46#define IRQ_FAULT 13 /* USL-5P Fault IRQ */
47
48#define SHUTDOWN_BTN_MAJOR 99 /* Shutdown button device major no. */
49
50#define SHUTDOWN_LOOP_CNT 5 /* Shutdown button Detection loop */
51#define SHUTDOWN_DELAY 200 /* Shutdown button delay value(ms) */
52
53
54/* added by kogiidena */
55/*
56 * landisk_ledparam
57 *
58 * led ------10 -6543210 -6543210 -6543210
59 * |000000..|0.......|0.......|U.......|
60 * | HARD |fastblik| blink | on |
61 *
62 * led0: power U:update flag
63 * led1: error
64 * led2: usb1
65 * led3: usb2
66 * led4: usb3
67 * led5: usb4
68 * led6: usb5
69 *
70 */
71extern int landisk_ledparam; /* from setup.c */
72extern int landisk_buzzerparam; /* from setup.c */
73extern int landisk_arch; /* from setup.c */
74
75#define __IO_PREFIX landisk
76#include <asm/io_generic.h>
77
78#endif /* __ASM_SH_IODATA_LANDISK_H */
79
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h
index 550501fa4fed..70389b72ffef 100644
--- a/include/asm-sh/machvec.h
+++ b/include/asm-sh/machvec.h
@@ -8,17 +8,18 @@
8 */ 8 */
9 9
10#ifndef _ASM_SH_MACHVEC_H 10#ifndef _ASM_SH_MACHVEC_H
11#define _ASM_SH_MACHVEC_H 1 11#define _ASM_SH_MACHVEC_H
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/time.h> 14#include <linux/time.h>
15
16#include <asm/machtypes.h> 15#include <asm/machtypes.h>
17#include <asm/machvec_init.h> 16#include <asm/machvec_init.h>
18 17
19struct device; 18struct device;
20 19
21struct sh_machine_vector { 20struct sh_machine_vector {
21 void (*mv_setup)(char **cmdline_p);
22 const char *mv_name;
22 int mv_nr_irqs; 23 int mv_nr_irqs;
23 24
24 u8 (*mv_inb)(unsigned long); 25 u8 (*mv_inb)(unsigned long);
@@ -65,4 +66,6 @@ struct sh_machine_vector {
65 66
66extern struct sh_machine_vector sh_mv; 67extern struct sh_machine_vector sh_mv;
67 68
69#define get_system_type() sh_mv.mv_name
70
68#endif /* _ASM_SH_MACHVEC_H */ 71#endif /* _ASM_SH_MACHVEC_H */
diff --git a/include/asm-sh/mc146818rtc.h b/include/asm-sh/mc146818rtc.h
index 1707cfb2915d..0aee96a97330 100644
--- a/include/asm-sh/mc146818rtc.h
+++ b/include/asm-sh/mc146818rtc.h
@@ -4,173 +4,4 @@
4#ifndef _ASM_MC146818RTC_H 4#ifndef _ASM_MC146818RTC_H
5#define _ASM_MC146818RTC_H 5#define _ASM_MC146818RTC_H
6 6
7#ifdef CONFIG_SH_MPC1211
8#undef _ASM_MC146818RTC_H
9#undef RTC_IRQ
10#include <asm/mpc1211/mc146818rtc.h>
11#else
12
13#include <asm/rtc.h>
14
15#define RTC_ALWAYS_BCD 1
16
17/* FIXME:RTC Interrupt feature is not implemented yet. */
18#undef RTC_IRQ
19#define RTC_IRQ 0
20
21#if defined(CONFIG_CPU_SH3)
22#define RTC_PORT(n) (R64CNT+(n)*2)
23#define CMOS_READ(addr) __CMOS_READ(addr,b)
24#define CMOS_WRITE(val,addr) __CMOS_WRITE(val,addr,b)
25
26#elif defined(CONFIG_SH_SECUREEDGE5410)
27#include <asm/snapgear/io.h>
28
29#define RTC_PORT(n) SECUREEDGE_IOPORT_ADDR
30#define CMOS_READ(addr) secureedge5410_cmos_read(addr)
31#define CMOS_WRITE(val,addr) secureedge5410_cmos_write(val,addr)
32extern unsigned char secureedge5410_cmos_read(int addr);
33extern void secureedge5410_cmos_write(unsigned char val, int addr);
34
35#elif defined(CONFIG_CPU_SH4)
36#define RTC_PORT(n) (R64CNT+(n)*4)
37#define CMOS_READ(addr) __CMOS_READ(addr,w)
38#define CMOS_WRITE(val,addr) __CMOS_WRITE(val,addr,w)
39#endif
40
41#define __CMOS_READ(addr, s) ({ \
42 unsigned char val=0, rcr1, rcr2, r64cnt, retry; \
43 switch(addr) { \
44 case RTC_SECONDS: \
45 val = ctrl_inb(RSECCNT); \
46 break; \
47 case RTC_SECONDS_ALARM: \
48 val = ctrl_inb(RSECAR); \
49 break; \
50 case RTC_MINUTES: \
51 val = ctrl_inb(RMINCNT); \
52 break; \
53 case RTC_MINUTES_ALARM: \
54 val = ctrl_inb(RMINAR); \
55 break; \
56 case RTC_HOURS: \
57 val = ctrl_inb(RHRCNT); \
58 break; \
59 case RTC_HOURS_ALARM: \
60 val = ctrl_inb(RHRAR); \
61 break; \
62 case RTC_DAY_OF_WEEK: \
63 val = ctrl_inb(RWKCNT); \
64 break; \
65 case RTC_DAY_OF_MONTH: \
66 val = ctrl_inb(RDAYCNT); \
67 break; \
68 case RTC_MONTH: \
69 val = ctrl_inb(RMONCNT); \
70 break; \
71 case RTC_YEAR: \
72 val = ctrl_in##s(RYRCNT); \
73 break; \
74 case RTC_REG_A: /* RTC_FREQ_SELECT */ \
75 rcr2 = ctrl_inb(RCR2); \
76 val = (rcr2 & RCR2_PESMASK) >> 4; \
77 rcr1 = ctrl_inb(RCR1); \
78 rcr1 = (rcr1 & (RCR1_CIE | RCR1_AIE)) | RCR1_AF;\
79 retry = 0; \
80 do { \
81 ctrl_outb(rcr1, RCR1); /* clear CF */ \
82 r64cnt = ctrl_inb(R64CNT); \
83 } while((ctrl_inb(RCR1) & RCR1_CF) && retry++ < 1000);\
84 r64cnt ^= RTC_BIT_INVERTED; \
85 if(r64cnt == 0x7f || r64cnt == 0) \
86 val |= RTC_UIP; \
87 break; \
88 case RTC_REG_B: /* RTC_CONTROL */ \
89 rcr1 = ctrl_inb(RCR1); \
90 rcr2 = ctrl_inb(RCR2); \
91 if(rcr1 & RCR1_CIE) val |= RTC_UIE; \
92 if(rcr1 & RCR1_AIE) val |= RTC_AIE; \
93 if(rcr2 & RCR2_PESMASK) val |= RTC_PIE; \
94 if(!(rcr2 & RCR2_START))val |= RTC_SET; \
95 val |= RTC_24H; \
96 break; \
97 case RTC_REG_C: /* RTC_INTR_FLAGS */ \
98 rcr1 = ctrl_inb(RCR1); \
99 rcr1 &= ~(RCR1_CF | RCR1_AF); \
100 ctrl_outb(rcr1, RCR1); \
101 rcr2 = ctrl_inb(RCR2); \
102 rcr2 &= ~RCR2_PEF; \
103 ctrl_outb(rcr2, RCR2); \
104 break; \
105 case RTC_REG_D: /* RTC_VALID */ \
106 /* Always valid ... */ \
107 val = RTC_VRT; \
108 break; \
109 default: \
110 break; \
111 } \
112 val; \
113})
114
115#define __CMOS_WRITE(val, addr, s) ({ \
116 unsigned char rcr1,rcr2; \
117 switch(addr) { \
118 case RTC_SECONDS: \
119 ctrl_outb(val, RSECCNT); \
120 break; \
121 case RTC_SECONDS_ALARM: \
122 ctrl_outb(val, RSECAR); \
123 break; \
124 case RTC_MINUTES: \
125 ctrl_outb(val, RMINCNT); \
126 break; \
127 case RTC_MINUTES_ALARM: \
128 ctrl_outb(val, RMINAR); \
129 break; \
130 case RTC_HOURS: \
131 ctrl_outb(val, RHRCNT); \
132 break; \
133 case RTC_HOURS_ALARM: \
134 ctrl_outb(val, RHRAR); \
135 break; \
136 case RTC_DAY_OF_WEEK: \
137 ctrl_outb(val, RWKCNT); \
138 break; \
139 case RTC_DAY_OF_MONTH: \
140 ctrl_outb(val, RDAYCNT); \
141 break; \
142 case RTC_MONTH: \
143 ctrl_outb(val, RMONCNT); \
144 break; \
145 case RTC_YEAR: \
146 ctrl_out##s((ctrl_in##s(RYRCNT) & 0xff00) | (val & 0xff), RYRCNT);\
147 break; \
148 case RTC_REG_A: /* RTC_FREQ_SELECT */ \
149 rcr2 = ctrl_inb(RCR2); \
150 if((val & RTC_DIV_CTL) == RTC_DIV_RESET2) \
151 rcr2 |= RCR2_RESET; \
152 ctrl_outb(rcr2, RCR2); \
153 break; \
154 case RTC_REG_B: /* RTC_CONTROL */ \
155 rcr1 = (ctrl_inb(RCR1) & 0x99) | RCR1_AF; \
156 if(val & RTC_AIE) rcr1 |= RCR1_AIE; \
157 else rcr1 &= ~RCR1_AIE; \
158 if(val & RTC_UIE) rcr1 |= RCR1_CIE; \
159 else rcr1 &= ~RCR1_CIE; \
160 ctrl_outb(rcr1, RCR1); \
161 rcr2 = ctrl_inb(RCR2); \
162 if(val & RTC_SET) rcr2 &= ~RCR2_START; \
163 else rcr2 |= RCR2_START; \
164 ctrl_outb(rcr2, RCR2); \
165 break; \
166 case RTC_REG_C: /* RTC_INTR_FLAGS */ \
167 break; \
168 case RTC_REG_D: /* RTC_VALID */ \
169 break; \
170 default: \
171 break; \
172 } \
173})
174
175#endif /* CONFIG_SH_MPC1211 */
176#endif /* _ASM_MC146818RTC_H */ 7#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h
index 72f07be6117f..cf47df79bb94 100644
--- a/include/asm-sh/mmu.h
+++ b/include/asm-sh/mmu.h
@@ -3,27 +3,76 @@
3 3
4#if !defined(CONFIG_MMU) 4#if !defined(CONFIG_MMU)
5 5
6struct mm_rblock_struct {
7 int size;
8 int refcount;
9 void *kblock;
10};
11
12struct mm_tblock_struct {
13 struct mm_rblock_struct *rblock;
14 struct mm_tblock_struct *next;
15};
16
17typedef struct { 6typedef struct {
18 struct mm_tblock_struct tblock; 7 struct vm_list_struct *vmlist;
19 unsigned long end_brk; 8 unsigned long end_brk;
20} mm_context_t; 9} mm_context_t;
21 10
22#else 11#else
23 12
24/* Default "unsigned long" context */ 13/* Default "unsigned long" context */
25typedef unsigned long mm_context_t; 14typedef unsigned long mm_context_id_t;
15
16typedef struct {
17 mm_context_id_t id;
18 void *vdso;
19} mm_context_t;
26 20
27#endif /* CONFIG_MMU */ 21#endif /* CONFIG_MMU */
28#endif /* __MMH_H */ 22
23/*
24 * Privileged Space Mapping Buffer (PMB) definitions
25 */
26#define PMB_PASCR 0xff000070
27#define PMB_IRMCR 0xff000078
28
29#define PMB_ADDR 0xf6100000
30#define PMB_DATA 0xf7100000
31#define PMB_ENTRY_MAX 16
32#define PMB_E_MASK 0x0000000f
33#define PMB_E_SHIFT 8
34
35#define PMB_SZ_16M 0x00000000
36#define PMB_SZ_64M 0x00000010
37#define PMB_SZ_128M 0x00000080
38#define PMB_SZ_512M 0x00000090
39#define PMB_SZ_MASK PMB_SZ_512M
40#define PMB_C 0x00000008
41#define PMB_WT 0x00000001
42#define PMB_UB 0x00000200
43#define PMB_V 0x00000100
44
45#define PMB_NO_ENTRY (-1)
46
47struct pmb_entry;
48
49struct pmb_entry {
50 unsigned long vpn;
51 unsigned long ppn;
52 unsigned long flags;
53
54 /*
55 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
56 * PMB_NO_ENTRY to search for a free one
57 */
58 int entry;
59
60 struct pmb_entry *next;
61 /* Adjacent entry link for contiguous multi-entry mappings */
62 struct pmb_entry *link;
63};
64
65/* arch/sh/mm/pmb.c */
66int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
67 unsigned long flags, int *entry);
68int set_pmb_entry(struct pmb_entry *pmbe);
69void clear_pmb_entry(struct pmb_entry *pmbe);
70struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
71 unsigned long flags);
72void pmb_free(struct pmb_entry *pmbe);
73long pmb_remap(unsigned long virt, unsigned long phys,
74 unsigned long size, unsigned long flags);
75void pmb_unmap(unsigned long addr);
76
77#endif /* __MMU_H */
29 78
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index 6760d064bd02..c7088efe579a 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -49,7 +49,7 @@ get_mmu_context(struct mm_struct *mm)
49 unsigned long mc = mmu_context_cache; 49 unsigned long mc = mmu_context_cache;
50 50
51 /* Check if we have old version of context. */ 51 /* Check if we have old version of context. */
52 if (((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0) 52 if (((mm->context.id ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0)
53 /* It's up to date, do nothing */ 53 /* It's up to date, do nothing */
54 return; 54 return;
55 55
@@ -68,7 +68,7 @@ get_mmu_context(struct mm_struct *mm)
68 if (!mc) 68 if (!mc)
69 mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; 69 mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
70 } 70 }
71 mm->context = mc; 71 mm->context.id = mc;
72} 72}
73 73
74/* 74/*
@@ -78,7 +78,7 @@ get_mmu_context(struct mm_struct *mm)
78static __inline__ int init_new_context(struct task_struct *tsk, 78static __inline__ int init_new_context(struct task_struct *tsk,
79 struct mm_struct *mm) 79 struct mm_struct *mm)
80{ 80{
81 mm->context = NO_CONTEXT; 81 mm->context.id = NO_CONTEXT;
82 82
83 return 0; 83 return 0;
84} 84}
@@ -123,7 +123,7 @@ static __inline__ unsigned long get_asid(void)
123static __inline__ void activate_context(struct mm_struct *mm) 123static __inline__ void activate_context(struct mm_struct *mm)
124{ 124{
125 get_mmu_context(mm); 125 get_mmu_context(mm);
126 set_asid(mm->context & MMU_CONTEXT_ASID_MASK); 126 set_asid(mm->context.id & MMU_CONTEXT_ASID_MASK);
127} 127}
128 128
129/* MMU_TTB can be used for optimizing the fault handling. 129/* MMU_TTB can be used for optimizing the fault handling.
@@ -174,9 +174,7 @@ static inline void enable_mmu(void)
174{ 174{
175 /* Enable MMU */ 175 /* Enable MMU */
176 ctrl_outl(MMU_CONTROL_INIT, MMUCR); 176 ctrl_outl(MMU_CONTROL_INIT, MMUCR);
177 177 ctrl_barrier();
178 /* The manual suggests doing some nops after turning on the MMU */
179 __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop\n\t");
180 178
181 if (mmu_context_cache == NO_CONTEXT) 179 if (mmu_context_cache == NO_CONTEXT)
182 mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; 180 mmu_context_cache = MMU_CONTEXT_FIRST_VERSION;
@@ -191,7 +189,8 @@ static inline void disable_mmu(void)
191 cr = ctrl_inl(MMUCR); 189 cr = ctrl_inl(MMUCR);
192 cr &= ~MMU_CONTROL_INIT; 190 cr &= ~MMU_CONTROL_INIT;
193 ctrl_outl(cr, MMUCR); 191 ctrl_outl(cr, MMUCR);
194 __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop\n\t"); 192
193 ctrl_barrier();
195} 194}
196#else 195#else
197/* 196/*
diff --git a/include/asm-sh/mpc1211/io.h b/include/asm-sh/mpc1211/io.h
index eba8a0b5fd7b..6298370bec2d 100644
--- a/include/asm-sh/mpc1211/io.h
+++ b/include/asm-sh/mpc1211/io.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-sh/io_mpc1211.h 2 * include/asm-sh/mpc1211/io.h
3 * 3 *
4 * Copyright 2001 Saito.K & Jeanne 4 * Copyright 2001 Saito.K & Jeanne
5 * 5 *
diff --git a/include/asm-sh/mpc1211/keyboard.h b/include/asm-sh/mpc1211/keyboard.h
index 71ef4cf4242d..9020feee7b4c 100644
--- a/include/asm-sh/mpc1211/keyboard.h
+++ b/include/asm-sh/mpc1211/keyboard.h
@@ -24,7 +24,6 @@ extern void pckbd_leds(unsigned char leds);
24extern void pckbd_init_hw(void); 24extern void pckbd_init_hw(void);
25extern int pckbd_pm_resume(struct pm_dev *, pm_request_t, void *); 25extern int pckbd_pm_resume(struct pm_dev *, pm_request_t, void *);
26extern pm_callback pm_kbd_request_override; 26extern pm_callback pm_kbd_request_override;
27extern unsigned char pckbd_sysrq_xlate[128];
28 27
29#define kbd_setkeycode pckbd_setkeycode 28#define kbd_setkeycode pckbd_setkeycode
30#define kbd_getkeycode pckbd_getkeycode 29#define kbd_getkeycode pckbd_getkeycode
@@ -32,9 +31,6 @@ extern unsigned char pckbd_sysrq_xlate[128];
32#define kbd_unexpected_up pckbd_unexpected_up 31#define kbd_unexpected_up pckbd_unexpected_up
33#define kbd_leds pckbd_leds 32#define kbd_leds pckbd_leds
34#define kbd_init_hw pckbd_init_hw 33#define kbd_init_hw pckbd_init_hw
35#define kbd_sysrq_xlate pckbd_sysrq_xlate
36
37#define SYSRQ_KEY 0x54
38 34
39/* resource allocation */ 35/* resource allocation */
40#define kbd_request_region() 36#define kbd_request_region()
diff --git a/include/asm-sh/overdrive/fpga.h b/include/asm-sh/overdrive/fpga.h
deleted file mode 100644
index 1cd87992c124..000000000000
--- a/include/asm-sh/overdrive/fpga.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Copyright (C) 2000 David J. Mckay (david.mckay@st.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 */
8
9#ifndef __FPGA_OD_H__
10#define __FPGA_OD_H__
11
12/* This routine will program up the fpga which interfaces to the galileo */
13int init_overdrive_fpga(void);
14
15#endif
diff --git a/include/asm-sh/overdrive/gt64111.h b/include/asm-sh/overdrive/gt64111.h
deleted file mode 100644
index 01d58bc13a44..000000000000
--- a/include/asm-sh/overdrive/gt64111.h
+++ /dev/null
@@ -1,109 +0,0 @@
1#ifndef _GT64111_H_
2#define _GT64111_H_
3
4#define MASTER_INTERFACE 0x0
5#define RAS10_LO_DEC_ADR 0x8
6#define RAS10_HI_DEC_ADR 0x10
7#define RAS32_LO_DEC_ADR 0x18
8#define RAS32_HI_DEC_ADR 0x20
9#define CS20_LO_DEC_ADR 0x28
10#define CS20_HI_DEC_ADR 0x30
11#define CS3_LO_DEC_ADR 0x38
12#define CS3_HI_DEC_ADR 0x40
13#define PCI_IO_LO_DEC_ADR 0x48
14#define PCI_IO_HI_DEC_ADR 0x50
15#define PCI_MEM0_LO_DEC_ADR 0x58
16#define PCI_MEM0_HI_DEC_ADR 0x60
17#define INTERNAL_SPACE_DEC 0x68
18#define BUS_ERR_ADR_LO_CPU 0x70
19#define READONLY0 0x78
20#define PCI_MEM1_LO_DEC_ADR 0x80
21#define PCI_MEM1_HI_DEC_ADR 0x88
22#define RAS0_LO_DEC_ADR 0x400
23#define RAS0_HI_DEC_ADR 0x404
24#define RAS1_LO_DEC_ADR 0x408
25#define RAS1_HI_DEC_ADR 0x40c
26#define RAS2_LO_DEC_ADR 0x410
27#define RAS2_HI_DEC_ADR 0x414
28#define RAS3_LO_DEC_ADR 0x418
29#define RAS3_HI_DEC_ADR 0x41c
30#define DEV_CS0_LO_DEC_ADR 0x420
31#define DEV_CS0_HI_DEC_ADR 0x424
32#define DEV_CS1_LO_DEC_ADR 0x428
33#define DEV_CS1_HI_DEC_ADR 0x42c
34#define DEV_CS2_LO_DEC_ADR 0x430
35#define DEV_CS2_HI_DEC_ADR 0x434
36#define DEV_CS3_LO_DEC_ADR 0x438
37#define DEV_CS3_HI_DEC_ADR 0x43c
38#define DEV_BOOTCS_LO_DEC_ADR 0x440
39#define DEV_BOOTCS_HI_DEC_ADR 0x444
40#define DEV_ADR_DEC_ERR 0x470
41#define DRAM_CFG 0x448
42#define DRAM_BANK0_PARMS 0x44c
43#define DRAM_BANK1_PARMS 0x450
44#define DRAM_BANK2_PARMS 0x454
45#define DRAM_BANK3_PARMS 0x458
46#define DEV_BANK0_PARMS 0x45c
47#define DEV_BANK1_PARMS 0x460
48#define DEV_BANK2_PARMS 0x464
49#define DEV_BANK3_PARMS 0x468
50#define DEV_BOOT_BANK_PARMS 0x46c
51#define CH0_DMA_BYTECOUNT 0x800
52#define CH1_DMA_BYTECOUNT 0x804
53#define CH2_DMA_BYTECOUNT 0x808
54#define CH3_DMA_BYTECOUNT 0x80c
55#define CH0_DMA_SRC_ADR 0x810
56#define CH1_DMA_SRC_ADR 0x814
57#define CH2_DMA_SRC_ADR 0x818
58#define CH3_DMA_SRC_ADR 0x81c
59#define CH0_DMA_DST_ADR 0x820
60#define CH1_DMA_DST_ADR 0x824
61#define CH2_DMA_DST_ADR 0x828
62#define CH3_DMA_DST_ADR 0x82c
63#define CH0_NEXT_REC_PTR 0x830
64#define CH1_NEXT_REC_PTR 0x834
65#define CH2_NEXT_REC_PTR 0x838
66#define CH3_NEXT_REC_PTR 0x83c
67#define CH0_CTRL 0x840
68#define CH1_CTRL 0x844
69#define CH2_CTRL 0x848
70#define CH3_CTRL 0x84c
71#define DMA_ARBITER 0x860
72#define TIMER0 0x850
73#define TIMER1 0x854
74#define TIMER2 0x858
75#define TIMER3 0x85c
76#define TIMER_CTRL 0x864
77#define PCI_CMD 0xc00
78#define PCI_TIMEOUT 0xc04
79#define PCI_RAS10_BANK_SIZE 0xc08
80#define PCI_RAS32_BANK_SIZE 0xc0c
81#define PCI_CS20_BANK_SIZE 0xc10
82#define PCI_CS3_BANK_SIZE 0xc14
83#define PCI_SERRMASK 0xc28
84#define PCI_INTACK 0xc34
85#define PCI_BAR_EN 0xc3c
86#define PCI_CFG_ADR 0xcf8
87#define PCI_CFG_DATA 0xcfc
88#define PCI_INTCAUSE 0xc18
89#define PCI_MAST_MASK 0xc1c
90#define PCI_PCIMASK 0xc24
91#define BAR_ENABLE_ADR 0xc3c
92
93/* These are config registers, accessible via PCI space */
94#define PCI_CONFIG_RAS10_BASE_ADR 0x010
95#define PCI_CONFIG_RAS32_BASE_ADR 0x014
96#define PCI_CONFIG_CS20_BASE_ADR 0x018
97#define PCI_CONFIG_CS3_BASE_ADR 0x01c
98#define PCI_CONFIG_INT_REG_MM_ADR 0x020
99#define PCI_CONFIG_INT_REG_IO_ADR 0x024
100#define PCI_CONFIG_BOARD_VENDOR 0x02c
101#define PCI_CONFIG_ROM_ADR 0x030
102#define PCI_CONFIG_INT_PIN_LINE 0x03c
103
104
105
106
107
108#endif
109
diff --git a/include/asm-sh/overdrive/io.h b/include/asm-sh/overdrive/io.h
deleted file mode 100644
index 0dba700e9643..000000000000
--- a/include/asm-sh/overdrive/io.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * include/asm-sh/io_od.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 * IO functions for an STMicroelectronics Overdrive
10 */
11
12#ifndef _ASM_SH_IO_OD_H
13#define _ASM_SH_IO_OD_H
14
15extern unsigned char od_inb(unsigned long port);
16extern unsigned short od_inw(unsigned long port);
17extern unsigned int od_inl(unsigned long port);
18
19extern void od_outb(unsigned char value, unsigned long port);
20extern void od_outw(unsigned short value, unsigned long port);
21extern void od_outl(unsigned int value, unsigned long port);
22
23extern unsigned char od_inb_p(unsigned long port);
24extern unsigned short od_inw_p(unsigned long port);
25extern unsigned int od_inl_p(unsigned long port);
26extern void od_outb_p(unsigned char value, unsigned long port);
27extern void od_outw_p(unsigned short value, unsigned long port);
28extern void od_outl_p(unsigned int value, unsigned long port);
29
30extern void od_insb(unsigned long port, void *addr, unsigned long count);
31extern void od_insw(unsigned long port, void *addr, unsigned long count);
32extern void od_insl(unsigned long port, void *addr, unsigned long count);
33extern void od_outsb(unsigned long port, const void *addr, unsigned long count);
34extern void od_outsw(unsigned long port, const void *addr, unsigned long count);
35extern void od_outsl(unsigned long port, const void *addr, unsigned long count);
36
37extern unsigned long od_isa_port2addr(unsigned long offset);
38
39#endif /* _ASM_SH_IO_OD_H */
diff --git a/include/asm-sh/overdrive/overdrive.h b/include/asm-sh/overdrive/overdrive.h
deleted file mode 100644
index fc746c244f83..000000000000
--- a/include/asm-sh/overdrive/overdrive.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (C) 2000 David J. Mckay (david.mckay@st.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 */
8
9
10#ifndef __OVERDRIVE_H__
11#define __OVERDRIVE_H__
12
13#define OVERDRIVE_INT_CT 0xa3a00000
14#define OVERDRIVE_INT_DT 0xa3b00000
15
16#define OVERDRIVE_CTRL 0xa3000000
17
18/* Shoving all these bits into the same register is not a good idea.
19 * As soon as I get a spare moment, I'll change the FPGA and put each
20 * bit in a separate register
21 */
22
23#define VALID_CTRL_BITS 0x1f
24
25#define ENABLE_RS232_MASK 0x1e
26#define DISABLE_RS232_BIT 0x01
27
28#define ENABLE_NMI_MASK 0x1d
29#define DISABLE_NMI_BIT 0x02
30
31#define RESET_PCI_MASK 0x1b
32#define ENABLE_PCI_BIT 0x04
33
34#define ENABLE_LED_MASK 0x17
35#define DISABLE_LED_BIT 0x08
36
37#define RESET_FPGA_MASK 0x0f
38#define ENABLE_FPGA_BIT 0x10
39
40
41#define FPGA_DCLK_ADDRESS 0xA3C00000
42
43#define FPGA_DATA 0x01 /* W */
44#define FPGA_CONFDONE 0x02 /* R */
45#define FPGA_NOT_STATUS 0x04 /* R */
46#define FPGA_INITDONE 0x08 /* R */
47
48#define FPGA_TIMEOUT 100000
49
50
51/* Interrupts for the overdrive. Note that these numbers have
52 * nothing to do with the actual IRQ numbers they appear on,
53 * this is all programmable. This is simply the position in the
54 * INT_CT register.
55 */
56
57#define OVERDRIVE_PCI_INTA 0
58#define OVERDRIVE_PCI_INTB 1
59#define OVERDRIVE_PCI_INTC 2
60#define OVERDRIVE_PCI_INTD 3
61#define OVERDRIVE_GALILEO_INT 4
62#define OVERDRIVE_GALILEO_LOCAL_INT 5
63#define OVERDRIVE_AUDIO_INT 6
64#define OVERDRIVE_KEYBOARD_INT 7
65
66/* Which Linux IRQ should we assign to each interrupt source? */
67#define OVERDRIVE_PCI_IRQ1 2
68#ifdef CONFIG_HACKED_NE2K
69#define OVERDRIVE_PCI_IRQ2 7
70#else
71#define OVERDRIVE_PCI_IRQ2 2
72#undef OVERDRIVE_PCI_INTB
73#define OVERDRIVE_PCI_INTB OVERDRIVE_PCI_INTA
74
75#endif
76
77/* Put the ESS solo audio chip on IRQ 4 */
78#define OVERDRIVE_ESS_IRQ 4
79
80/* Where the memory behind the PCI bus appears */
81#define PCI_DRAM_BASE 0xb7000000
82#define PCI_DRAM_SIZE (16*1024*1024)
83#define PCI_DRAM_FINISH (PCI_DRAM_BASE+PCI_DRAM_SIZE-1)
84
85/* Where the IO region appears in the memory */
86#define PCI_GTIO_BASE 0xb8000000
87
88#endif
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 6f7eb8a3aba5..ca8b26d90475 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -16,7 +16,13 @@
16 16
17/* PAGE_SHIFT determines the page size */ 17/* PAGE_SHIFT determines the page size */
18#define PAGE_SHIFT 12 18#define PAGE_SHIFT 12
19
20#ifdef __ASSEMBLY__
21#define PAGE_SIZE (1 << PAGE_SHIFT)
22#else
19#define PAGE_SIZE (1UL << PAGE_SHIFT) 23#define PAGE_SIZE (1UL << PAGE_SHIFT)
24#endif
25
20#define PAGE_MASK (~(PAGE_SIZE-1)) 26#define PAGE_MASK (~(PAGE_SIZE-1))
21#define PTE_MASK PAGE_MASK 27#define PTE_MASK PAGE_MASK
22 28
@@ -30,7 +36,6 @@
30#define HPAGE_SIZE (1UL << HPAGE_SHIFT) 36#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
31#define HPAGE_MASK (~(HPAGE_SIZE-1)) 37#define HPAGE_MASK (~(HPAGE_SIZE-1))
32#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) 38#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
33#define ARCH_HAS_SETCLEAR_HUGE_PTE
34#endif 39#endif
35 40
36#ifdef __KERNEL__ 41#ifdef __KERNEL__
@@ -39,10 +44,18 @@
39extern void (*clear_page)(void *to); 44extern void (*clear_page)(void *to);
40extern void (*copy_page)(void *to, void *from); 45extern void (*copy_page)(void *to, void *from);
41 46
47extern unsigned long shm_align_mask;
48
49#ifdef CONFIG_MMU
42extern void clear_page_slow(void *to); 50extern void clear_page_slow(void *to);
43extern void copy_page_slow(void *to, void *from); 51extern void copy_page_slow(void *to, void *from);
52#else
53extern void clear_page_nommu(void *to);
54extern void copy_page_nommu(void *to, void *from);
55#endif
44 56
45#if defined(CONFIG_SH7705_CACHE_32KB) && defined(CONFIG_MMU) 57#if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \
58 defined(CONFIG_SH7705_CACHE_32KB))
46struct page; 59struct page;
47extern void clear_user_page(void *to, unsigned long address, struct page *pg); 60extern void clear_user_page(void *to, unsigned long address, struct page *pg);
48extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg); 61extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg);
@@ -51,29 +64,20 @@ extern void __copy_user_page(void *to, void *from, void *orig_to);
51#elif defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH3) || !defined(CONFIG_MMU) 64#elif defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH3) || !defined(CONFIG_MMU)
52#define clear_user_page(page, vaddr, pg) clear_page(page) 65#define clear_user_page(page, vaddr, pg) clear_page(page)
53#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 66#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
54#elif defined(CONFIG_CPU_SH4)
55struct page;
56extern void clear_user_page(void *to, unsigned long address, struct page *pg);
57extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg);
58extern void __clear_user_page(void *to, void *orig_to);
59extern void __copy_user_page(void *to, void *from, void *orig_to);
60#endif 67#endif
61 68
62/* 69/*
63 * These are used to make use of C type-checking.. 70 * These are used to make use of C type-checking..
64 */ 71 */
65typedef struct { unsigned long pte; } pte_t; 72typedef struct { unsigned long pte; } pte_t;
66typedef struct { unsigned long pmd; } pmd_t;
67typedef struct { unsigned long pgd; } pgd_t; 73typedef struct { unsigned long pgd; } pgd_t;
68typedef struct { unsigned long pgprot; } pgprot_t; 74typedef struct { unsigned long pgprot; } pgprot_t;
69 75
70#define pte_val(x) ((x).pte) 76#define pte_val(x) ((x).pte)
71#define pmd_val(x) ((x).pmd)
72#define pgd_val(x) ((x).pgd) 77#define pgd_val(x) ((x).pgd)
73#define pgprot_val(x) ((x).pgprot) 78#define pgprot_val(x) ((x).pgprot)
74 79
75#define __pte(x) ((pte_t) { (x) } ) 80#define __pte(x) ((pte_t) { (x) } )
76#define __pmd(x) ((pmd_t) { (x) } )
77#define __pgd(x) ((pgd_t) { (x) } ) 81#define __pgd(x) ((pgd_t) { (x) } )
78#define __pgprot(x) ((pgprot_t) { (x) } ) 82#define __pgprot(x) ((pgprot_t) { (x) } )
79 83
@@ -93,7 +97,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
93#define __MEMORY_START CONFIG_MEMORY_START 97#define __MEMORY_START CONFIG_MEMORY_START
94#define __MEMORY_SIZE CONFIG_MEMORY_SIZE 98#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
95 99
96#define PAGE_OFFSET (0x80000000UL) 100#define PAGE_OFFSET CONFIG_PAGE_OFFSET
97#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 101#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
98#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 102#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
99 103
@@ -115,5 +119,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
115#include <asm-generic/memory_model.h> 119#include <asm-generic/memory_model.h>
116#include <asm-generic/page.h> 120#include <asm-generic/page.h>
117 121
122/* vDSO support */
123#ifdef CONFIG_VSYSCALL
124#define __HAVE_ARCH_GATE_AREA
125#endif
126
118#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
119#endif /* __ASM_SH_PAGE_H */ 128#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h
index 0a523c85b11c..6ccc948fe216 100644
--- a/include/asm-sh/pci.h
+++ b/include/asm-sh/pci.h
@@ -32,6 +32,34 @@ extern struct pci_channel board_pci_channels[];
32#define PCIBIOS_MIN_IO board_pci_channels->io_resource->start 32#define PCIBIOS_MIN_IO board_pci_channels->io_resource->start
33#define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start 33#define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start
34 34
35/*
36 * I/O routine helpers
37 */
38#ifdef CONFIG_CPU_SUBTYPE_SH7780
39#define PCI_IO_AREA 0xFE400000
40#define PCI_IO_SIZE 0x00400000
41#else
42#define PCI_IO_AREA 0xFE240000
43#define PCI_IO_SIZE 0X00040000
44#endif
45
46#define PCI_MEM_SIZE 0x01000000
47
48#define SH4_PCIIOBR_MASK 0xFFFC0000
49#define pci_ioaddr(addr) (PCI_IO_AREA + (addr & ~SH4_PCIIOBR_MASK))
50
51#if defined(CONFIG_PCI)
52#define is_pci_ioaddr(port) \
53 (((port) >= PCIBIOS_MIN_IO) && \
54 ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE)))
55#define is_pci_memaddr(port) \
56 (((port) >= PCIBIOS_MIN_MEM) && \
57 ((port) < (PCIBIOS_MIN_MEM + PCI_MEM_SIZE)))
58#else
59#define is_pci_ioaddr(port) (0)
60#define is_pci_memaddr(port) (0)
61#endif
62
35struct pci_dev; 63struct pci_dev;
36 64
37extern void pcibios_set_master(struct pci_dev *dev); 65extern void pcibios_set_master(struct pci_dev *dev);
@@ -87,15 +115,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
87 */ 115 */
88#define pci_dac_dma_supported(pci_dev, mask) (0) 116#define pci_dac_dma_supported(pci_dev, mask) (0)
89 117
90/* These macros should be used after a pci_map_sg call has been done
91 * to get bus addresses of each of the SG entries and their lengths.
92 * You should only work with the number of sg entries pci_map_sg
93 * returns, or alternatively stop on the first sg_dma_len(sg) which
94 * is 0.
95 */
96#define sg_dma_address(sg) (virt_to_bus((sg)->dma_address))
97#define sg_dma_len(sg) ((sg)->length)
98
99#ifdef CONFIG_PCI 118#ifdef CONFIG_PCI
100static inline void pci_dma_burst_advice(struct pci_dev *pdev, 119static inline void pci_dma_burst_advice(struct pci_dev *pdev,
101 enum pci_dma_burst_strategy *strat, 120 enum pci_dma_burst_strategy *strat,
@@ -107,11 +126,12 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
107#endif 126#endif
108 127
109/* Board-specific fixup routines. */ 128/* Board-specific fixup routines. */
110extern void pcibios_fixup(void); 129void pcibios_fixup(void);
111extern void pcibios_fixup_irqs(void); 130int pcibios_init_platform(void);
131int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
112 132
113#ifdef CONFIG_PCI_AUTO 133#ifdef CONFIG_PCI_AUTO
114extern int pciauto_assign_resources(int busno, struct pci_channel *hose); 134int pciauto_assign_resources(int busno, struct pci_channel *hose);
115#endif 135#endif
116 136
117static inline void pcibios_add_platform_entries(struct pci_dev *dev) 137static inline void pcibios_add_platform_entries(struct pci_dev *dev)
diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h
index f4f233f7a4f5..e841465ab4d2 100644
--- a/include/asm-sh/pgalloc.h
+++ b/include/asm-sh/pgalloc.h
@@ -1,15 +1,6 @@
1#ifndef __ASM_SH_PGALLOC_H 1#ifndef __ASM_SH_PGALLOC_H
2#define __ASM_SH_PGALLOC_H 2#define __ASM_SH_PGALLOC_H
3 3
4#include <linux/threads.h>
5#include <linux/slab.h>
6#include <linux/mm.h>
7
8#define pgd_quicklist ((unsigned long *)0)
9#define pmd_quicklist ((unsigned long *)0)
10#define pte_quicklist ((unsigned long *)0)
11#define pgtable_cache_size 0L
12
13#define pmd_populate_kernel(mm, pmd, pte) \ 4#define pmd_populate_kernel(mm, pmd, pte) \
14 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) 5 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
15 6
@@ -24,38 +15,24 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
24 */ 15 */
25static inline pgd_t *pgd_alloc(struct mm_struct *mm) 16static inline pgd_t *pgd_alloc(struct mm_struct *mm)
26{ 17{
27 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 18 return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
28 pgd_t *pgd = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL);
29
30 if (pgd)
31 memset(pgd, 0, pgd_size);
32
33 return pgd;
34} 19}
35 20
36static inline void pgd_free(pgd_t *pgd) 21static inline void pgd_free(pgd_t *pgd)
37{ 22{
38 kfree(pgd); 23 free_page((unsigned long)pgd);
39} 24}
40 25
41static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 26static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
42 unsigned long address) 27 unsigned long address)
43{ 28{
44 pte_t *pte; 29 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
45
46 pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
47
48 return pte;
49} 30}
50 31
51static inline struct page *pte_alloc_one(struct mm_struct *mm, 32static inline struct page *pte_alloc_one(struct mm_struct *mm,
52 unsigned long address) 33 unsigned long address)
53{ 34{
54 struct page *pte; 35 return alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
55
56 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
57
58 return pte;
59} 36}
60 37
61static inline void pte_free_kernel(pte_t *pte) 38static inline void pte_free_kernel(pte_t *pte)
@@ -75,14 +52,8 @@ static inline void pte_free(struct page *pte)
75 * inside the pgd, so has no extra memory associated with it. 52 * inside the pgd, so has no extra memory associated with it.
76 */ 53 */
77 54
78#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
79#define pmd_free(x) do { } while (0) 55#define pmd_free(x) do { } while (0)
80#define __pmd_free_tlb(tlb,x) do { } while (0) 56#define __pmd_free_tlb(tlb,x) do { } while (0)
81#define pgd_populate(mm, pmd, pte) BUG()
82#define check_pgt_cache() do { } while (0) 57#define check_pgt_cache() do { } while (0)
83 58
84#ifdef CONFIG_CPU_SH4
85#define PG_mapped PG_arch_1
86#endif
87
88#endif /* __ASM_SH_PGALLOC_H */ 59#endif /* __ASM_SH_PGALLOC_H */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 40d41a78041e..2c8682ad1012 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -1,42 +1,42 @@
1#ifndef __ASM_SH_PGTABLE_H
2#define __ASM_SH_PGTABLE_H
3
4#include <asm-generic/4level-fixup.h>
5
6/* 1/*
2 * This file contains the functions and defines necessary to modify and
3 * use the SuperH page table tree.
4 *
7 * Copyright (C) 1999 Niibe Yutaka 5 * Copyright (C) 1999 Niibe Yutaka
8 * Copyright (C) 2002, 2003, 2004 Paul Mundt 6 * Copyright (C) 2002 - 2005 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file "COPYING" in the main directory of this
10 * archive for more details.
9 */ 11 */
12#ifndef __ASM_SH_PGTABLE_H
13#define __ASM_SH_PGTABLE_H
10 14
11#include <asm/pgtable-2level.h> 15#include <asm-generic/pgtable-nopmd.h>
16#include <asm/page.h>
17
18#define PTRS_PER_PGD 1024
12 19
13/*
14 * This file contains the functions and defines necessary to modify and use
15 * the SuperH page table tree.
16 */
17#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
18#include <asm/processor.h>
19#include <asm/addrspace.h> 21#include <asm/addrspace.h>
20#include <asm/fixmap.h> 22#include <asm/fixmap.h>
21#include <linux/threads.h>
22 23
23extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 24extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
24extern void paging_init(void); 25extern void paging_init(void);
25 26
26/* 27/*
27 * Basically we have the same two-level (which is the logical three level
28 * Linux page table layout folded) page tables as the i386.
29 */
30
31/*
32 * ZERO_PAGE is a global shared page that is always zero: used 28 * ZERO_PAGE is a global shared page that is always zero: used
33 * for zero-mapped memory areas etc.. 29 * for zero-mapped memory areas etc..
34 */ 30 */
35extern unsigned long empty_zero_page[1024]; 31extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
36#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 32#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
37 33
38#endif /* !__ASSEMBLY__ */ 34#endif /* !__ASSEMBLY__ */
39 35
36/* traditional two-level paging structure */
37#define PGDIR_SHIFT 22
38#define PTRS_PER_PMD 1
39#define PTRS_PER_PTE 1024
40#define PMD_SIZE (1UL << PMD_SHIFT) 40#define PMD_SIZE (1UL << PMD_SHIFT)
41#define PMD_MASK (~(PMD_SIZE-1)) 41#define PMD_MASK (~(PMD_SIZE-1))
42#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 42#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
@@ -47,7 +47,6 @@ extern unsigned long empty_zero_page[1024];
47 47
48#define PTE_PHYS_MASK 0x1ffff000 48#define PTE_PHYS_MASK 0x1ffff000
49 49
50#ifndef __ASSEMBLY__
51/* 50/*
52 * First 1MB map is used by fixed purpose. 51 * First 1MB map is used by fixed purpose.
53 * Currently only 4-enty (16kB) is used (see arch/sh/mm/cache.c) 52 * Currently only 4-enty (16kB) is used (see arch/sh/mm/cache.c)
@@ -55,20 +54,41 @@ extern unsigned long empty_zero_page[1024];
55#define VMALLOC_START (P3SEG+0x00100000) 54#define VMALLOC_START (P3SEG+0x00100000)
56#define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) 55#define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
57 56
58#define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */ 57/*
59#define _PAGE_HW_SHARED 0x002 /* SH-bit : page is shared among processes */ 58 * Linux PTEL encoding.
60#define _PAGE_DIRTY 0x004 /* D-bit : page changed */ 59 *
61#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ 60 * Hardware and software bit definitions for the PTEL value:
62#define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ 61 *
63#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ 62 * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4).
64#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ 63 *
65#define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */ 64 * - Bit 1 is the SH-bit, but is unused on SH-3 due to an MMU bug (the
66#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ 65 * hardware PTEL value can't have the SH-bit set when MMUCR.IX is set,
67#define _PAGE_PROTNONE 0x200 /* software: if not present */ 66 * which is the default in cpu-sh3/mmu_context.h:MMU_CONTROL_INIT).
68#define _PAGE_ACCESSED 0x400 /* software: page referenced */ 67 *
69#define _PAGE_U0_SHARED 0x800 /* software: page is shared in user space */ 68 * In order to keep this relatively clean, do not use these for defining
70 69 * SH-3 specific flags until all of the other unused bits have been
71#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ 70 * exhausted.
71 *
72 * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE.
73 *
74 * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages.
75 * Bit 10 is used for _PAGE_ACCESSED, bit 11 remains unused.
76 *
77 * - Bits 31, 30, and 29 remain unused by everyone and can be used for future
78 * software flags, although care must be taken to update _PAGE_CLEAR_FLAGS.
79 */
80#define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */
81#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */
82#define _PAGE_DIRTY 0x004 /* D-bit : page changed */
83#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */
84#define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */
85#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */
86#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */
87#define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
88#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
89#define _PAGE_PROTNONE 0x200 /* software: if not present */
90#define _PAGE_ACCESSED 0x400 /* software: page referenced */
91#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
72 92
73/* software: moves to PTEA.TC (Timing Control) */ 93/* software: moves to PTEA.TC (Timing Control) */
74#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ 94#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */
@@ -83,23 +103,17 @@ extern unsigned long empty_zero_page[1024];
83#define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ 103#define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */
84#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ 104#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */
85 105
86 106/* Mask which drops unused bits from the PTEL value */
87/* Mask which drop software flags 107#ifdef CONFIG_CPU_SH3
88 * We also drop WT bit since it is used for _PAGE_FILE 108#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
89 * bit in this implementation. 109 _PAGE_FILE | _PAGE_SZ1 | \
90 */ 110 _PAGE_HW_SHARED)
91#define _PAGE_CLEAR_FLAGS (_PAGE_WT | _PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_U0_SHARED)
92
93#if defined(CONFIG_CPU_SH3)
94/*
95 * MMU on SH-3 has bug on SH-bit: We can't use it if MMUCR.IX=1.
96 * Work around: Just drop SH-bit.
97 */
98#define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS | _PAGE_HW_SHARED))
99#else 111#else
100#define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS)) 112#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
101#endif 113#endif
102 114
115#define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS))
116
103/* Hardware flags: SZ0=1 (4k-byte) */ 117/* Hardware flags: SZ0=1 (4k-byte) */
104#define _PAGE_FLAGS_HARD _PAGE_SZ0 118#define _PAGE_FLAGS_HARD _PAGE_SZ0
105 119
@@ -109,15 +123,15 @@ extern unsigned long empty_zero_page[1024];
109#define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1) 123#define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1)
110#endif 124#endif
111 125
112#define _PAGE_SHARED _PAGE_U0_SHARED
113
114#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) 126#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
115#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 127#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
116#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_SHARED) 128#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
129
130#ifndef __ASSEMBLY__
117 131
118#ifdef CONFIG_MMU 132#ifdef CONFIG_MMU
119#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) 133#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD)
120#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_SHARED | _PAGE_FLAGS_HARD) 134#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD)
121#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) 135#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
122#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) 136#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
123#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) 137#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
@@ -137,12 +151,13 @@ extern unsigned long empty_zero_page[1024];
137#define PAGE_KERNEL_PCC __pgprot(0) 151#define PAGE_KERNEL_PCC __pgprot(0)
138#endif 152#endif
139 153
154#endif /* __ASSEMBLY__ */
155
140/* 156/*
141 * As i386 and MIPS, SuperH can't do page protection for execute, and 157 * As i386 and MIPS, SuperH can't do page protection for execute, and
142 * considers that the same as a read. Also, write permissions imply 158 * considers that the same as a read. Also, write permissions imply
143 * read permissions. This is the closest we can get.. 159 * read permissions. This is the closest we can get..
144 */ 160 */
145
146#define __P000 PAGE_NONE 161#define __P000 PAGE_NONE
147#define __P001 PAGE_READONLY 162#define __P001 PAGE_READONLY
148#define __P010 PAGE_COPY 163#define __P010 PAGE_COPY
@@ -161,6 +176,26 @@ extern unsigned long empty_zero_page[1024];
161#define __S110 PAGE_SHARED 176#define __S110 PAGE_SHARED
162#define __S111 PAGE_SHARED 177#define __S111 PAGE_SHARED
163 178
179#ifndef __ASSEMBLY__
180
181/*
182 * Certain architectures need to do special things when PTEs
183 * within a page table are directly modified. Thus, the following
184 * hook is made available.
185 */
186#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
187#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
188
189/*
190 * (pmds are folded into pgds so this doesn't get actually called,
191 * but the define is needed for a generic inline function.)
192 */
193#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
194
195#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
196#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
197#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
198
164#define pte_none(x) (!pte_val(x)) 199#define pte_none(x) (!pte_val(x))
165#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) 200#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
166#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 201#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
@@ -171,7 +206,7 @@ extern unsigned long empty_zero_page[1024];
171#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) 206#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
172 207
173#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 208#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
174#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) 209#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK)
175 210
176/* 211/*
177 * The following only work if pte_present() is true. 212 * The following only work if pte_present() is true.
@@ -248,6 +283,11 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
248#define pte_unmap(pte) do { } while (0) 283#define pte_unmap(pte) do { } while (0)
249#define pte_unmap_nested(pte) do { } while (0) 284#define pte_unmap_nested(pte) do { } while (0)
250 285
286#define pte_ERROR(e) \
287 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
288#define pgd_ERROR(e) \
289 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
290
251struct vm_area_struct; 291struct vm_area_struct;
252extern void update_mmu_cache(struct vm_area_struct * vma, 292extern void update_mmu_cache(struct vm_area_struct * vma,
253 unsigned long address, pte_t pte); 293 unsigned long address, pte_t pte);
@@ -272,8 +312,6 @@ extern void update_mmu_cache(struct vm_area_struct * vma,
272 312
273typedef pte_t *pte_addr_t; 313typedef pte_t *pte_addr_t;
274 314
275#endif /* !__ASSEMBLY__ */
276
277#define kern_addr_valid(addr) (1) 315#define kern_addr_valid(addr) (1)
278 316
279#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ 317#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
@@ -301,5 +339,5 @@ extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t
301 339
302#include <asm-generic/pgtable.h> 340#include <asm-generic/pgtable.h>
303 341
342#endif /* !__ASSEMBLY__ */
304#endif /* __ASM_SH_PAGE_H */ 343#endif /* __ASM_SH_PAGE_H */
305
diff --git a/include/asm-sh/pm.h b/include/asm-sh/pm.h
new file mode 100644
index 000000000000..56fdbd6b1c94
--- /dev/null
+++ b/include/asm-sh/pm.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com>
7 *
8 */
9#ifndef __ASM_SH_PM_H
10#define __ASM_SH_PM_H
11
12extern u8 wakeup_start;
13extern u8 wakeup_end;
14
15void pm_enter(void);
16
17#endif
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index eeb0f48bb99e..474773853cd1 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -14,6 +14,7 @@
14#include <asm/types.h> 14#include <asm/types.h>
15#include <asm/cache.h> 15#include <asm/cache.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/cpu-features.h>
17 18
18/* 19/*
19 * Default implementation of macro that returns current 20 * Default implementation of macro that returns current
@@ -38,27 +39,30 @@ enum cpu_type {
38 CPU_SH7604, 39 CPU_SH7604,
39 40
40 /* SH-3 types */ 41 /* SH-3 types */
41 CPU_SH7705, CPU_SH7707, CPU_SH7708, CPU_SH7708S, CPU_SH7708R, 42 CPU_SH7705, CPU_SH7706, CPU_SH7707,
42 CPU_SH7709, CPU_SH7709A, CPU_SH7729, CPU_SH7300, 43 CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
44 CPU_SH7709, CPU_SH7709A, CPU_SH7710,
45 CPU_SH7729, CPU_SH7300,
43 46
44 /* SH-4 types */ 47 /* SH-4 types */
45 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, 48 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
46 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, 49 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501,
47 CPU_SH73180, CPU_SH7770, CPU_SH7780, CPU_SH7781, 50 CPU_SH73180, CPU_SH7343, CPU_SH7770, CPU_SH7780, CPU_SH7781,
48 51
49 /* Unknown subtype */ 52 /* Unknown subtype */
50 CPU_SH_NONE 53 CPU_SH_NONE
51}; 54};
52 55
53struct sh_cpuinfo { 56struct sh_cpuinfo {
54 enum cpu_type type; 57 unsigned int type;
55 unsigned long loops_per_jiffy; 58 unsigned long loops_per_jiffy;
56 59
57 struct cache_info icache; 60 struct cache_info icache; /* Primary I-cache */
58 struct cache_info dcache; 61 struct cache_info dcache; /* Primary D-cache */
62 struct cache_info scache; /* Secondary cache */
59 63
60 unsigned long flags; 64 unsigned long flags;
61}; 65} __attribute__ ((aligned(SMP_CACHE_BYTES)));
62 66
63extern struct sh_cpuinfo boot_cpu_data; 67extern struct sh_cpuinfo boot_cpu_data;
64 68
@@ -125,17 +129,6 @@ union sh_fpu_union {
125 struct sh_fpu_soft_struct soft; 129 struct sh_fpu_soft_struct soft;
126}; 130};
127 131
128/*
129 * Processor flags
130 */
131
132#define CPU_HAS_FPU 0x0001 /* Hardware FPU support */
133#define CPU_HAS_P2_FLUSH_BUG 0x0002 /* Need to flush the cache in P2 area */
134#define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */
135#define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */
136#define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */
137#define CPU_HAS_PTEA 0x0020 /* PTEA register */
138
139struct thread_struct { 132struct thread_struct {
140 unsigned long sp; 133 unsigned long sp;
141 unsigned long pc; 134 unsigned long pc;
@@ -149,6 +142,10 @@ struct thread_struct {
149 union sh_fpu_union fpu; 142 union sh_fpu_union fpu;
150}; 143};
151 144
145typedef struct {
146 unsigned long seg;
147} mm_segment_t;
148
152/* Count of active tasks with UBC settings */ 149/* Count of active tasks with UBC settings */
153extern int ubc_usercnt; 150extern int ubc_usercnt;
154 151
@@ -266,5 +263,24 @@ extern unsigned long get_wchan(struct task_struct *p);
266#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") 263#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
267#define cpu_relax() barrier() 264#define cpu_relax() barrier()
268 265
266#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH3) || \
267 defined(CONFIG_CPU_SH4)
268#define PREFETCH_STRIDE L1_CACHE_BYTES
269#define ARCH_HAS_PREFETCH
270#define ARCH_HAS_PREFETCHW
271static inline void prefetch(void *x)
272{
273 __asm__ __volatile__ ("pref @%0\n\t" : : "r" (x) : "memory");
274}
275
276#define prefetchw(x) prefetch(x)
277#endif
278
279#ifdef CONFIG_VSYSCALL
280extern int vsyscall_init(void);
281#else
282#define vsyscall_init() do { } while (0)
283#endif
284
269#endif /* __KERNEL__ */ 285#endif /* __KERNEL__ */
270#endif /* __ASM_SH_PROCESSOR_H */ 286#endif /* __ASM_SH_PROCESSOR_H */
diff --git a/include/asm-sh/r7780rp/ide.h b/include/asm-sh/r7780rp/ide.h
new file mode 100644
index 000000000000..a1ed78e0f617
--- /dev/null
+++ b/include/asm-sh/r7780rp/ide.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_SH_R7780RP_IDE_H
2#define __ASM_SH_R7780RP_IDE_H
3
4/* Nothing to see here.. */
5#include <asm/mach/r7780rp.h>
6
7#endif /* __ASM_SH_R7780RP_IDE_H */
8
diff --git a/include/asm-sh/r7780rp/r7780rp.h b/include/asm-sh/r7780rp/r7780rp.h
new file mode 100644
index 000000000000..f95d9dba31a2
--- /dev/null
+++ b/include/asm-sh/r7780rp/r7780rp.h
@@ -0,0 +1,177 @@
1#ifndef __ASM_SH_RENESAS_R7780RP_H
2#define __ASM_SH_RENESAS_R7780RP_H
3
4/*
5 * linux/include/asm-sh/r7780rp.h
6 *
7 * Copyright (C) 2000 Atom Create Engineering Co., Ltd.
8 *
9 * Renesas Solutions Highlander R7780RP support
10 */
11
12/* Box specific addresses. */
13#if defined(CONFIG_SH_R7780MP)
14#define PA_BCR 0xa4000000 /* FPGA */
15#define PA_IRLMSK (PA_BCR+0x0000) /* Interrupt Mask control */
16#define PA_IRLMON (PA_BCR+0x0002) /* Interrupt Status control */
17#define PA_IRLPRI1 (PA_BCR+0x0004) /* Interrupt Priorty 1 */
18#define PA_IRLPRI2 (PA_BCR+0x0006) /* Interrupt Priorty 2 */
19#define PA_IRLPRI3 (PA_BCR+0x0008) /* Interrupt Priorty 3 */
20#define PA_IRLPRI4 (PA_BCR+0x000a) /* Interrupt Priorty 4 */
21#define PA_RSTCTL (PA_BCR+0x000c) /* Reset Control */
22#define PA_PCIBD (PA_BCR+0x000e) /* PCI Board detect control */
23#define PA_PCICD (PA_BCR+0x0010) /* PCI Conector detect control */
24#define PA_EXTGIO (PA_BCR+0x0016) /* Extension GPIO Control */
25#define PA_IVDRMON (PA_BCR+0x0018) /* iVDR Moniter control */
26#define PA_IVDRCTL (PA_BCR+0x001a) /* iVDR control */
27#define PA_OBLED (PA_BCR+0x001c) /* On Board LED control */
28#define PA_OBSW (PA_BCR+0x001e) /* On Board Switch control */
29#define PA_AUDIOSEL (PA_BCR+0x0020) /* Sound Interface Select control */
30#define PA_EXTPLR (PA_BCR+0x001e) /* Extention Pin Polarity control */
31#define PA_TPCTL (PA_BCR+0x0100) /* Touch Panel Access control */
32#define PA_TPDCKCTL (PA_BCR+0x0102) /* Touch Panel Access data control */
33#define PA_TPCTLCLR (PA_BCR+0x0104) /* Touch Panel Access control */
34#define PA_TPXPOS (PA_BCR+0x0106) /* Touch Panel X position control */
35#define PA_TPYPOS (PA_BCR+0x0108) /* Touch Panel Y position control */
36#define PA_DBSW (PA_BCR+0x0200) /* Debug Board Switch control */
37#define PA_CFCTL (PA_BCR+0x0300) /* CF Timing control */
38#define PA_CFPOW (PA_BCR+0x0302) /* CF Power control */
39#define PA_CFCDINTCLR (PA_BCR+0x0304) /* CF Insert Interrupt clear */
40#define PA_SCSMR0 (PA_BCR+0x0400) /* SCIF0 Serial mode control */
41#define PA_SCBRR0 (PA_BCR+0x0404) /* SCIF0 Bit rate control */
42#define PA_SCSCR0 (PA_BCR+0x0408) /* SCIF0 Serial control */
43#define PA_SCFTDR0 (PA_BCR+0x040c) /* SCIF0 Send FIFO control */
44#define PA_SCFSR0 (PA_BCR+0x0410) /* SCIF0 Serial status control */
45#define PA_SCFRDR0 (PA_BCR+0x0414) /* SCIF0 Receive FIFO control */
46#define PA_SCFCR0 (PA_BCR+0x0418) /* SCIF0 FIFO control */
47#define PA_SCTFDR0 (PA_BCR+0x041c) /* SCIF0 Send FIFO data control */
48#define PA_SCRFDR0 (PA_BCR+0x0420) /* SCIF0 Receive FIFO data control */
49#define PA_SCSPTR0 (PA_BCR+0x0424) /* SCIF0 Serial Port control */
50#define PA_SCLSR0 (PA_BCR+0x0428) /* SCIF0 Line Status control */
51#define PA_SCRER0 (PA_BCR+0x042c) /* SCIF0 Serial Error control */
52#define PA_SCSMR1 (PA_BCR+0x0500) /* SCIF1 Serial mode control */
53#define PA_SCBRR1 (PA_BCR+0x0504) /* SCIF1 Bit rate control */
54#define PA_SCSCR1 (PA_BCR+0x0508) /* SCIF1 Serial control */
55#define PA_SCFTDR1 (PA_BCR+0x050c) /* SCIF1 Send FIFO control */
56#define PA_SCFSR1 (PA_BCR+0x0510) /* SCIF1 Serial status control */
57#define PA_SCFRDR1 (PA_BCR+0x0514) /* SCIF1 Receive FIFO control */
58#define PA_SCFCR1 (PA_BCR+0x0518) /* SCIF1 FIFO control */
59#define PA_SCTFDR1 (PA_BCR+0x051c) /* SCIF1 Send FIFO data control */
60#define PA_SCRFDR1 (PA_BCR+0x0520) /* SCIF1 Receive FIFO data control */
61#define PA_SCSPTR1 (PA_BCR+0x0524) /* SCIF1 Serial Port control */
62#define PA_SCLSR1 (PA_BCR+0x0528) /* SCIF1 Line Status control */
63#define PA_SCRER1 (PA_BCR+0x052c) /* SCIF1 Serial Error control */
64#define PA_ICCR (PA_BCR+0x0600) /* Serial control */
65#define PA_SAR (PA_BCR+0x0602) /* Serial Slave control */
66#define PA_MDR (PA_BCR+0x0604) /* Serial Mode control */
67#define PA_ADR1 (PA_BCR+0x0606) /* Serial Address1 control */
68#define PA_DAR1 (PA_BCR+0x0646) /* Serial Data1 control */
69#define PA_VERREG (PA_BCR+0x0700) /* FPGA Version Register */
70#define PA_POFF (PA_BCR+0x0800) /* System Power Off control */
71#define PA_PMR (PA_BCR+0x0900) /* */
72
73#define PA_AX88796L 0xa4100400 /* AX88796L Area */
74#define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */
75#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
76#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
77#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */
78#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */
79
80#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
81
82#define IRQ_PCISLOT1 65 /* PCI Slot #1 IRQ */
83#define IRQ_PCISLOT2 66 /* PCI Slot #2 IRQ */
84#define IRQ_PCISLOT3 67 /* PCI Slot #3 IRQ */
85#define IRQ_PCISLOT4 68 /* PCI Slot #4 IRQ */
86#define IRQ_CFCARD 1 /* CF Card IRQ */
87// #define IRQ_CFINST 0 /* CF Card Insert IRQ */
88#define IRQ_TP 2 /* Touch Panel IRQ */
89#define IRQ_SCI1 3 /* SCI1 IRQ */
90#define IRQ_SCI0 4 /* SCI0 IRQ */
91#define IRQ_2SERIAL 5 /* Serial IRQ */
92#define IRQ_RTC 6 /* RTC A / B IRQ */
93#define IRQ_EXTENTION6 7 /* EXT6n IRQ */
94#define IRQ_EXTENTION5 8 /* EXT5n IRQ */
95#define IRQ_EXTENTION4 9 /* EXT4n IRQ */
96#define IRQ_EXTENTION2 10 /* EXT2n IRQ */
97#define IRQ_EXTENTION1 11 /* EXT1n IRQ */
98#define IRQ_ONETH 13 /* On board Ethernet IRQ */
99#define IRQ_PSW 14 /* Push Switch IRQ */
100
101#else /* R7780RP */
102
103#define PA_BCR 0xa5000000 /* FPGA */
104#define PA_IRLMSK (PA_BCR+0x0000) /* Interrupt Mask control */
105#define PA_IRLMON (PA_BCR+0x0002) /* Interrupt Status control */
106#define PA_SDPOW (PA_BCR+0x0004) /* SD Power control */
107#define PA_RSTCTL (PA_BCR+0x0006) /* Device Reset control */
108#define PA_PCIBD (PA_BCR+0x0008) /* PCI Board detect control */
109#define PA_PCICD (PA_BCR+0x000a) /* PCI Conector detect control */
110#define PA_ZIGIO1 (PA_BCR+0x000c) /* Zigbee IO control 1 */
111#define PA_ZIGIO2 (PA_BCR+0x000e) /* Zigbee IO control 2 */
112#define PA_ZIGIO3 (PA_BCR+0x0010) /* Zigbee IO control 3 */
113#define PA_ZIGIO4 (PA_BCR+0x0012) /* Zigbee IO control 4 */
114#define PA_IVDRMON (PA_BCR+0x0014) /* iVDR Moniter control */
115#define PA_IVDRCTL (PA_BCR+0x0016) /* iVDR control */
116#define PA_OBLED (PA_BCR+0x0018) /* On Board LED control */
117#define PA_OBSW (PA_BCR+0x001a) /* On Board Switch control */
118#define PA_AUDIOSEL (PA_BCR+0x001c) /* Sound Interface Select control */
119#define PA_EXTPLR (PA_BCR+0x001e) /* Extention Pin Polarity control */
120#define PA_TPCTL (PA_BCR+0x0100) /* Touch Panel Access control */
121#define PA_TPDCKCTL (PA_BCR+0x0102) /* Touch Panel Access data control */
122#define PA_TPCTLCLR (PA_BCR+0x0104) /* Touch Panel Access control */
123#define PA_TPXPOS (PA_BCR+0x0106) /* Touch Panel X position control */
124#define PA_TPYPOS (PA_BCR+0x0108) /* Touch Panel Y position control */
125#define PA_DBDET (PA_BCR+0x0200) /* Debug Board detect control */
126#define PA_DBDISPCTL (PA_BCR+0x0202) /* Debug Board Dot timing control */
127#define PA_DBSW (PA_BCR+0x0204) /* Debug Board Switch control */
128#define PA_CFCTL (PA_BCR+0x0300) /* CF Timing control */
129#define PA_CFPOW (PA_BCR+0x0302) /* CF Power control */
130#define PA_CFCDINTCLR (PA_BCR+0x0304) /* CF Insert Interrupt clear */
131#define PA_SCSMR (PA_BCR+0x0400) /* SCIF Serial mode control */
132#define PA_SCBRR (PA_BCR+0x0402) /* SCIF Bit rate control */
133#define PA_SCSCR (PA_BCR+0x0404) /* SCIF Serial control */
134#define PA_SCFDTR (PA_BCR+0x0406) /* SCIF Send FIFO control */
135#define PA_SCFSR (PA_BCR+0x0408) /* SCIF Serial status control */
136#define PA_SCFRDR (PA_BCR+0x040a) /* SCIF Receive FIFO control */
137#define PA_SCFCR (PA_BCR+0x040c) /* SCIF FIFO control */
138#define PA_SCFDR (PA_BCR+0x040e) /* SCIF FIFO data control */
139#define PA_SCLSR (PA_BCR+0x0412) /* SCIF Line Status control */
140#define PA_ICCR (PA_BCR+0x0500) /* Serial control */
141#define PA_SAR (PA_BCR+0x0502) /* Serial Slave control */
142#define PA_MDR (PA_BCR+0x0504) /* Serial Mode control */
143#define PA_ADR1 (PA_BCR+0x0506) /* Serial Address1 control */
144#define PA_DAR1 (PA_BCR+0x0546) /* Serial Data1 control */
145#define PA_VERREG (PA_BCR+0x0600) /* FPGA Version Register */
146
147#define PA_AX88796L 0xa5800400 /* AX88796L Area */
148#define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */
149#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
150#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
151#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */
152#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */
153
154#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
155
156#define IRQ_PCISLOT1 0 /* PCI Slot #1 IRQ */
157#define IRQ_PCISLOT2 1 /* PCI Slot #2 IRQ */
158#define IRQ_PCISLOT3 2 /* PCI Slot #3 IRQ */
159#define IRQ_PCISLOT4 3 /* PCI Slot #4 IRQ */
160#define IRQ_CFCARD 4 /* CF Card IRQ */
161#define IRQ_CFINST 5 /* CF Card Insert IRQ */
162#define IRQ_M66596 6 /* M66596 IRQ */
163#define IRQ_SDCARD 7 /* SD Card IRQ */
164#define IRQ_TUCHPANEL 8 /* Touch Panel IRQ */
165#define IRQ_SCI 9 /* SCI IRQ */
166#define IRQ_2SERIAL 10 /* Serial IRQ */
167#define IRQ_EXTENTION 11 /* EXTn IRQ */
168#define IRQ_ONETH 12 /* On board Ethernet IRQ */
169#define IRQ_PSW 13 /* Push Switch IRQ */
170#define IRQ_ZIGBEE 14 /* Ziggbee IO IRQ */
171
172#endif /* CONFIG_SH_R7780MP */
173
174#define __IO_PREFIX r7780rp
175#include <asm/io_generic.h>
176
177#endif /* __ASM_SH_RENESAS_R7780RP */
diff --git a/include/asm-sh/rtc.h b/include/asm-sh/rtc.h
index cea9cdf9b925..91aacc96151b 100644
--- a/include/asm-sh/rtc.h
+++ b/include/asm-sh/rtc.h
@@ -1,29 +1,8 @@
1#ifndef _ASM_RTC_H 1#ifndef _ASM_RTC_H
2#define _ASM_RTC_H 2#define _ASM_RTC_H
3#ifdef __KERNEL__
4 3
5#include <asm/machvec.h>
6#include <asm/cpu/rtc.h>
7
8extern void sh_rtc_gettimeofday(struct timespec *ts);
9extern int sh_rtc_settimeofday(const time_t secs);
10extern void (*board_time_init)(void); 4extern void (*board_time_init)(void);
11extern void (*rtc_get_time)(struct timespec *); 5extern void (*rtc_sh_get_time)(struct timespec *);
12extern int (*rtc_set_time)(const time_t); 6extern int (*rtc_sh_set_time)(const time_t);
13
14/* RCR1 Bits */
15#define RCR1_CF 0x80 /* Carry Flag */
16#define RCR1_CIE 0x10 /* Carry Interrupt Enable */
17#define RCR1_AIE 0x08 /* Alarm Interrupt Enable */
18#define RCR1_AF 0x01 /* Alarm Flag */
19
20/* RCR2 Bits */
21#define RCR2_PEF 0x80 /* PEriodic interrupt Flag */
22#define RCR2_PESMASK 0x70 /* Periodic interrupt Set */
23#define RCR2_RTCEN 0x08 /* ENable RTC */
24#define RCR2_ADJ 0x04 /* ADJustment (30-second) */
25#define RCR2_RESET 0x02 /* Reset bit */
26#define RCR2_START 0x01 /* Start bit */
27 7
28#endif /* __KERNEL__ */
29#endif /* _ASM_RTC_H */ 8#endif /* _ASM_RTC_H */
diff --git a/include/asm-sh/rts7751r2d/io.h b/include/asm-sh/rts7751r2d/io.h
deleted file mode 100644
index 241094020567..000000000000
--- a/include/asm-sh/rts7751r2d/io.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * include/asm-sh/io_rts7751r2d.h
3 *
4 * Modified version of io_se.h for the rts7751r2d-specific functions.
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 * IO functions for an Renesas Technology sales RTS7751R2D
10 */
11
12#ifndef _ASM_SH_IO_RTS7751R2D_H
13#define _ASM_SH_IO_RTS7751R2D_H
14
15extern unsigned char rts7751r2d_inb(unsigned long port);
16extern unsigned short rts7751r2d_inw(unsigned long port);
17extern unsigned int rts7751r2d_inl(unsigned long port);
18
19extern void rts7751r2d_outb(unsigned char value, unsigned long port);
20extern void rts7751r2d_outw(unsigned short value, unsigned long port);
21extern void rts7751r2d_outl(unsigned int value, unsigned long port);
22
23extern unsigned char rts7751r2d_inb_p(unsigned long port);
24extern void rts7751r2d_outb_p(unsigned char value, unsigned long port);
25
26extern void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count);
27extern void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count);
28extern void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count);
29extern void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count);
30extern void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count);
31extern void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count);
32
33extern void *rts7751r2d_ioremap(unsigned long offset, unsigned long size);
34
35extern unsigned long rts7751r2d_isa_port2addr(unsigned long offset);
36
37#endif /* _ASM_SH_IO_RTS7751R2D_H */
diff --git a/include/asm-sh/rts7751r2d/rts7751r2d.h b/include/asm-sh/rts7751r2d/rts7751r2d.h
index 4e09ba597e9a..796b8fcb81a8 100644
--- a/include/asm-sh/rts7751r2d/rts7751r2d.h
+++ b/include/asm-sh/rts7751r2d/rts7751r2d.h
@@ -41,8 +41,6 @@
41 41
42#define PA_AX88796L 0xaa000400 /* AX88796L Area */ 42#define PA_AX88796L 0xaa000400 /* AX88796L Area */
43#define PA_VOYAGER 0xab000000 /* VOYAGER GX Area */ 43#define PA_VOYAGER 0xab000000 /* VOYAGER GX Area */
44#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
45#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
46#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ 44#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */
47#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ 45#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */
48 46
@@ -70,4 +68,7 @@
70#define IRQ_PCISLOT2 10 /* PCI Slot #2 IRQ */ 68#define IRQ_PCISLOT2 10 /* PCI Slot #2 IRQ */
71#define IRQ_EXTENTION 11 /* EXTn IRQ */ 69#define IRQ_EXTENTION 11 /* EXTn IRQ */
72 70
71#define __IO_PREFIX rts7751r2d
72#include <asm/io_generic.h>
73
73#endif /* __ASM_SH_RENESAS_RTS7751R2D */ 74#endif /* __ASM_SH_RENESAS_RTS7751R2D */
diff --git a/include/asm-sh/scatterlist.h b/include/asm-sh/scatterlist.h
index 7b91df140022..d19e7cd3b023 100644
--- a/include/asm-sh/scatterlist.h
+++ b/include/asm-sh/scatterlist.h
@@ -10,4 +10,13 @@ struct scatterlist {
10 10
11#define ISA_DMA_THRESHOLD (0x1fffffff) 11#define ISA_DMA_THRESHOLD (0x1fffffff)
12 12
13/* These macros should be used after a pci_map_sg call has been done
14 * to get bus addresses of each of the SG entries and their lengths.
15 * You should only work with the number of sg entries pci_map_sg
16 * returns, or alternatively stop on the first sg_dma_len(sg) which
17 * is 0.
18 */
19#define sg_dma_address(sg) ((sg)->dma_address)
20#define sg_dma_len(sg) ((sg)->length)
21
13#endif /* !(__ASM_SH_SCATTERLIST_H) */ 22#endif /* !(__ASM_SH_SCATTERLIST_H) */
diff --git a/include/asm-sh/sci.h b/include/asm-sh/sci.h
new file mode 100644
index 000000000000..52e73660c129
--- /dev/null
+++ b/include/asm-sh/sci.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_SH_SCI_H
2#define __ASM_SH_SCI_H
3
4#include <linux/serial_core.h>
5
6/*
7 * Generic header for SuperH SCI(F)
8 *
9 * Do not place SH-specific parts in here, sh64 and h8300 depend on this too.
10 */
11
12/* Offsets into the sci_port->irqs array */
13enum {
14 SCIx_ERI_IRQ,
15 SCIx_RXI_IRQ,
16 SCIx_TXI_IRQ,
17 SCIx_BRI_IRQ,
18 SCIx_NR_IRQS,
19};
20
21/*
22 * Platform device specific platform_data struct
23 */
24struct plat_sci_port {
25 void __iomem *membase; /* io cookie */
26 unsigned long mapbase; /* resource base */
27 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
28 unsigned int type; /* SCI / SCIF / IRDA */
29 upf_t flags; /* UPF_* flags */
30};
31
32int early_sci_setup(struct uart_port *port);
33
34#endif /* __ASM_SH_SCI_H */
diff --git a/include/asm-sh/se/se.h b/include/asm-sh/se.h
index 791c5da0388a..a1832154a3aa 100644
--- a/include/asm-sh/se/se.h
+++ b/include/asm-sh/se.h
@@ -74,4 +74,7 @@
74#define IRQ_STNIC 10 74#define IRQ_STNIC 10
75#endif 75#endif
76 76
77#define __IO_PREFIX se
78#include <asm/io_generic.h>
79
77#endif /* __ASM_SH_HITACHI_SE_H */ 80#endif /* __ASM_SH_HITACHI_SE_H */
diff --git a/include/asm-sh/se/io.h b/include/asm-sh/se/io.h
deleted file mode 100644
index 9eeb86cd6cef..000000000000
--- a/include/asm-sh/se/io.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * include/asm-sh/io_se.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 * IO functions for an Hitachi SolutionEngine
10 */
11
12#ifndef _ASM_SH_IO_SE_H
13#define _ASM_SH_IO_SE_H
14
15extern unsigned char se_inb(unsigned long port);
16extern unsigned short se_inw(unsigned long port);
17extern unsigned int se_inl(unsigned long port);
18
19extern void se_outb(unsigned char value, unsigned long port);
20extern void se_outw(unsigned short value, unsigned long port);
21extern void se_outl(unsigned int value, unsigned long port);
22
23extern unsigned char se_inb_p(unsigned long port);
24extern void se_outb_p(unsigned char value, unsigned long port);
25
26extern void se_insb(unsigned long port, void *addr, unsigned long count);
27extern void se_insw(unsigned long port, void *addr, unsigned long count);
28extern void se_insl(unsigned long port, void *addr, unsigned long count);
29extern void se_outsb(unsigned long port, const void *addr, unsigned long count);
30extern void se_outsw(unsigned long port, const void *addr, unsigned long count);
31extern void se_outsl(unsigned long port, const void *addr, unsigned long count);
32
33extern unsigned long se_isa_port2addr(unsigned long offset);
34
35#endif /* _ASM_SH_IO_SE_H */
diff --git a/include/asm-sh/se7300/se7300.h b/include/asm-sh/se7300.h
index 3ec1ded86c97..4e24edccb30d 100644
--- a/include/asm-sh/se7300/se7300.h
+++ b/include/asm-sh/se7300.h
@@ -58,4 +58,7 @@
58#define PA_LCD1 0xb8000000 58#define PA_LCD1 0xb8000000
59#define PA_LCD2 0xb8800000 59#define PA_LCD2 0xb8800000
60 60
61#define __IO_PREFIX sh7300se
62#include <asm/io_generic.h>
63
61#endif /* __ASM_SH_HITACHI_SE7300_H */ 64#endif /* __ASM_SH_HITACHI_SE7300_H */
diff --git a/include/asm-sh/se7300/io.h b/include/asm-sh/se7300/io.h
deleted file mode 100644
index c6af85529714..000000000000
--- a/include/asm-sh/se7300/io.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * include/asm-sh/se7300/io.h
3 *
4 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
5 * IO functions for SH-Mobile(SH7300) SolutionEngine
6 */
7
8#ifndef _ASM_SH_IO_7300SE_H
9#define _ASM_SH_IO_7300SE_H
10
11extern unsigned char sh7300se_inb(unsigned long port);
12extern unsigned short sh7300se_inw(unsigned long port);
13extern unsigned int sh7300se_inl(unsigned long port);
14
15extern void sh7300se_outb(unsigned char value, unsigned long port);
16extern void sh7300se_outw(unsigned short value, unsigned long port);
17extern void sh7300se_outl(unsigned int value, unsigned long port);
18
19extern unsigned char sh7300se_inb_p(unsigned long port);
20extern void sh7300se_outb_p(unsigned char value, unsigned long port);
21
22extern void sh7300se_insb(unsigned long port, void *addr, unsigned long count);
23extern void sh7300se_insw(unsigned long port, void *addr, unsigned long count);
24extern void sh7300se_insl(unsigned long port, void *addr, unsigned long count);
25extern void sh7300se_outsb(unsigned long port, const void *addr, unsigned long count);
26extern void sh7300se_outsw(unsigned long port, const void *addr, unsigned long count);
27extern void sh7300se_outsl(unsigned long port, const void *addr, unsigned long count);
28
29#endif /* _ASM_SH_IO_7300SE_H */
diff --git a/include/asm-sh/se73180/se73180.h b/include/asm-sh/se73180.h
index f5b93e39e768..3a4acb3e38a1 100644
--- a/include/asm-sh/se73180/se73180.h
+++ b/include/asm-sh/se73180.h
@@ -59,4 +59,7 @@
59#define PA_LCD1 0xb8000000 59#define PA_LCD1 0xb8000000
60#define PA_LCD2 0xb8800000 60#define PA_LCD2 0xb8800000
61 61
62#define __IO_PREFIX sh73180se
63#include <asm/io_generic.h>
64
62#endif /* __ASM_SH_HITACHI_SE73180_H */ 65#endif /* __ASM_SH_HITACHI_SE73180_H */
diff --git a/include/asm-sh/se73180/io.h b/include/asm-sh/se73180/io.h
deleted file mode 100644
index c9cb1b9412c6..000000000000
--- a/include/asm-sh/se73180/io.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * include/asm-sh/se73180/io.h
3 *
4 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
5 * Based on include/asm-sh/se7300/io.h
6 *
7 * IO functions for SH-Mobile3(SH73180) SolutionEngine
8 *
9 */
10
11#ifndef _ASM_SH_IO_73180SE_H
12#define _ASM_SH_IO_73180SE_H
13
14extern unsigned char sh73180se_inb(unsigned long port);
15extern unsigned short sh73180se_inw(unsigned long port);
16extern unsigned int sh73180se_inl(unsigned long port);
17
18extern void sh73180se_outb(unsigned char value, unsigned long port);
19extern void sh73180se_outw(unsigned short value, unsigned long port);
20extern void sh73180se_outl(unsigned int value, unsigned long port);
21
22extern unsigned char sh73180se_inb_p(unsigned long port);
23extern void sh73180se_outb_p(unsigned char value, unsigned long port);
24
25extern void sh73180se_insb(unsigned long port, void *addr, unsigned long count);
26extern void sh73180se_insw(unsigned long port, void *addr, unsigned long count);
27extern void sh73180se_insl(unsigned long port, void *addr, unsigned long count);
28extern void sh73180se_outsb(unsigned long port, const void *addr, unsigned long count);
29extern void sh73180se_outsw(unsigned long port, const void *addr, unsigned long count);
30extern void sh73180se_outsl(unsigned long port, const void *addr, unsigned long count);
31
32#endif /* _ASM_SH_IO_73180SE_H */
diff --git a/include/asm-sh/se7343.h b/include/asm-sh/se7343.h
new file mode 100644
index 000000000000..e7914a54aa96
--- /dev/null
+++ b/include/asm-sh/se7343.h
@@ -0,0 +1,82 @@
1#ifndef __ASM_SH_HITACHI_SE7343_H
2#define __ASM_SH_HITACHI_SE7343_H
3
4/*
5 * include/asm-sh/se/se7343.h
6 *
7 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
8 *
9 * SH-Mobile SolutionEngine 7343 support
10 */
11
12/* Box specific addresses. */
13
14/* Area 0 */
15#define PA_ROM 0x00000000 /* EPROM */
16#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte(Actually 2MB) */
17#define PA_FROM 0x00400000 /* Flash ROM */
18#define PA_FROM_SIZE 0x00400000 /* Flash size 4M byte */
19#define PA_SRAM 0x00800000 /* SRAM */
20#define PA_FROM_SIZE 0x00400000 /* SRAM size 4M byte */
21/* Area 1 */
22#define PA_EXT1 0x04000000
23#define PA_EXT1_SIZE 0x04000000
24/* Area 2 */
25#define PA_EXT2 0x08000000
26#define PA_EXT2_SIZE 0x04000000
27/* Area 3 */
28#define PA_SDRAM 0x0c000000
29#define PA_SDRAM_SIZE 0x04000000
30/* Area 4 */
31#define PA_PCIC 0x10000000 /* MR-SHPC-01 PCMCIA */
32#define PA_MRSHPC 0xb03fffe0 /* MR-SHPC-01 PCMCIA controller */
33#define PA_MRSHPC_MW1 0xb0400000 /* MR-SHPC-01 memory window base */
34#define PA_MRSHPC_MW2 0xb0500000 /* MR-SHPC-01 attribute window base */
35#define PA_MRSHPC_IO 0xb0600000 /* MR-SHPC-01 I/O window base */
36#define MRSHPC_OPTION (PA_MRSHPC + 6)
37#define MRSHPC_CSR (PA_MRSHPC + 8)
38#define MRSHPC_ISR (PA_MRSHPC + 10)
39#define MRSHPC_ICR (PA_MRSHPC + 12)
40#define MRSHPC_CPWCR (PA_MRSHPC + 14)
41#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
42#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
43#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
44#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
45#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
46#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
47#define MRSHPC_CDCR (PA_MRSHPC + 28)
48#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
49#define PA_LED 0xb0C00000 /* LED */
50#define LED_SHIFT 0
51#define PA_DIPSW 0xb0900000 /* Dip switch 31 */
52#define PA_CPLD_MODESET 0xb1400004 /* CPLD Mode set register */
53#define PA_CPLD_ST 0xb1400008 /* CPLD Interrupt status register */
54#define PA_CPLD_IMSK 0xb140000a /* CPLD Interrupt mask register */
55/* Area 5 */
56#define PA_EXT5 0x14000000
57#define PA_EXT5_SIZE 0x04000000
58/* Area 6 */
59#define PA_LCD1 0xb8000000
60#define PA_LCD2 0xb8800000
61
62#define __IO_PREFIX sh7343se
63#include <asm/io_generic.h>
64
65/* External Multiplexed interrupts */
66#define PC_IRQ0 OFFCHIP_IRQ_BASE
67#define PC_IRQ1 (PC_IRQ0 + 1)
68#define PC_IRQ2 (PC_IRQ1 + 1)
69#define PC_IRQ3 (PC_IRQ2 + 1)
70
71#define EXT_IRQ0 (PC_IRQ3 + 1)
72#define EXT_IRQ1 (EXT_IRQ0 + 1)
73#define EXT_IRQ2 (EXT_IRQ1 + 1)
74#define EXT_IRQ3 (EXT_IRQ2 + 1)
75
76#define USB_IRQ0 (EXT_IRQ3 + 1)
77#define USB_IRQ1 (USB_IRQ0 + 1)
78
79#define UART_IRQ0 (USB_IRQ1 + 1)
80#define UART_IRQ1 (UART_IRQ0 + 1)
81
82#endif /* __ASM_SH_HITACHI_SE7343_H */
diff --git a/include/asm-sh/se7751/se7751.h b/include/asm-sh/se7751.h
index 738e22bebdfb..88cd379d9084 100644
--- a/include/asm-sh/se7751/se7751.h
+++ b/include/asm-sh/se7751.h
@@ -65,4 +65,7 @@
65 65
66#define IRQ_79C973 13 66#define IRQ_79C973 13
67 67
68#define __IO_PREFIX sh7751se
69#include <asm/io_generic.h>
70
68#endif /* __ASM_SH_HITACHI_7751SE_H */ 71#endif /* __ASM_SH_HITACHI_7751SE_H */
diff --git a/include/asm-sh/se7751/io.h b/include/asm-sh/se7751/io.h
deleted file mode 100644
index 78d8f5744bc5..000000000000
--- a/include/asm-sh/se7751/io.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * include/asm-sh/io_7751se.h
3 *
4 * Modified version of io_se.h for the 7751se-specific functions.
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 * IO functions for an Hitachi SolutionEngine
10 */
11
12#ifndef _ASM_SH_IO_7751SE_H
13#define _ASM_SH_IO_7751SE_H
14
15extern unsigned char sh7751se_inb(unsigned long port);
16extern unsigned short sh7751se_inw(unsigned long port);
17extern unsigned int sh7751se_inl(unsigned long port);
18
19extern void sh7751se_outb(unsigned char value, unsigned long port);
20extern void sh7751se_outw(unsigned short value, unsigned long port);
21extern void sh7751se_outl(unsigned int value, unsigned long port);
22
23extern unsigned char sh7751se_inb_p(unsigned long port);
24extern void sh7751se_outb_p(unsigned char value, unsigned long port);
25
26extern void sh7751se_insb(unsigned long port, void *addr, unsigned long count);
27extern void sh7751se_insw(unsigned long port, void *addr, unsigned long count);
28extern void sh7751se_insl(unsigned long port, void *addr, unsigned long count);
29extern void sh7751se_outsb(unsigned long port, const void *addr, unsigned long count);
30extern void sh7751se_outsw(unsigned long port, const void *addr, unsigned long count);
31extern void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count);
32
33extern unsigned char sh7751se_readb(unsigned long addr);
34extern unsigned short sh7751se_readw(unsigned long addr);
35extern unsigned int sh7751se_readl(unsigned long addr);
36extern void sh7751se_writeb(unsigned char b, unsigned long addr);
37extern void sh7751se_writew(unsigned short b, unsigned long addr);
38extern void sh7751se_writel(unsigned int b, unsigned long addr);
39
40extern unsigned long sh7751se_isa_port2addr(unsigned long offset);
41
42#endif /* _ASM_SH_IO_7751SE_H */
diff --git a/include/asm-sh/setup.h b/include/asm-sh/setup.h
index d19de7c8df4e..34ca8a7f06ba 100644
--- a/include/asm-sh/setup.h
+++ b/include/asm-sh/setup.h
@@ -4,5 +4,7 @@
4 4
5#define COMMAND_LINE_SIZE 256 5#define COMMAND_LINE_SIZE 256
6 6
7int setup_early_printk(char *);
8
7#endif /* _SH_SETUP_H */ 9#endif /* _SH_SETUP_H */
8#endif /* __KERNEL__ */ 10#endif /* __KERNEL__ */
diff --git a/include/asm-sh/sfp-machine.h b/include/asm-sh/sfp-machine.h
new file mode 100644
index 000000000000..d3c548443f2a
--- /dev/null
+++ b/include/asm-sh/sfp-machine.h
@@ -0,0 +1,84 @@
1/* Machine-dependent software floating-point definitions.
2 SuperH kernel version.
3 Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Richard Henderson (rth@cygnus.com),
6 Jakub Jelinek (jj@ultra.linux.cz),
7 David S. Miller (davem@redhat.com) and
8 Peter Maydell (pmaydell@chiark.greenend.org.uk).
9
10 The GNU C Library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version.
14
15 The GNU C Library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public
21 License along with the GNU C Library; see the file COPYING.LIB. If
22 not, write to the Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24
25#ifndef _SFP_MACHINE_H
26#define _SFP_MACHINE_H
27
28#define _FP_W_TYPE_SIZE 32
29#define _FP_W_TYPE unsigned long
30#define _FP_WS_TYPE signed long
31#define _FP_I_TYPE long
32
33#define _FP_MUL_MEAT_S(R,X,Y) \
34 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
35#define _FP_MUL_MEAT_D(R,X,Y) \
36 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
37#define _FP_MUL_MEAT_Q(R,X,Y) \
38 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
39
40#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
41#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
42#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
43
44#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
45#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
46#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
47#define _FP_NANSIGN_S 0
48#define _FP_NANSIGN_D 0
49#define _FP_NANSIGN_Q 0
50
51#define _FP_KEEPNANFRACP 1
52
53/*
54 * If one NaN is signaling and the other is not,
55 * we choose that one, otherwise we choose X.
56 */
57#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
58 do { \
59 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
60 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
61 { \
62 R##_s = Y##_s; \
63 _FP_FRAC_COPY_##wc(R,Y); \
64 } \
65 else \
66 { \
67 R##_s = X##_s; \
68 _FP_FRAC_COPY_##wc(R,X); \
69 } \
70 R##_c = FP_CLS_NAN; \
71 } while (0)
72
73//#define FP_ROUNDMODE FPSCR_RM
74#define FP_DENORM_ZERO 1/*FPSCR_DN*/
75
76/* Exception flags. */
77#define FP_EX_INVALID (1<<4)
78#define FP_EX_DIVZERO (1<<3)
79#define FP_EX_OVERFLOW (1<<2)
80#define FP_EX_UNDERFLOW (1<<1)
81#define FP_EX_INEXACT (1<<0)
82
83#endif
84
diff --git a/include/asm-sh/sh03/io.h b/include/asm-sh/sh03/io.h
index 25792e9831ea..df3b187ef883 100644
--- a/include/asm-sh/sh03/io.h
+++ b/include/asm-sh/sh03/io.h
@@ -33,14 +33,6 @@
33#define IRL3_IPR_POS 0 33#define IRL3_IPR_POS 0
34#define IRL3_PRIORITY 4 34#define IRL3_PRIORITY 4
35 35
36 36void heartbeat_sh03(void);
37extern unsigned long sh03_isa_port2addr(unsigned long offset);
38
39extern void setup_sh03(void);
40extern void init_sh03_IRQ(void);
41extern void heartbeat_sh03(void);
42
43extern void sh03_rtc_gettimeofday(struct timeval *tv);
44extern int sh03_rtc_settimeofday(const struct timeval *tv);
45 37
46#endif /* _ASM_SH_IO_SH03_H */ 38#endif /* _ASM_SH_IO_SH03_H */
diff --git a/include/asm-sh/sh2000/sh2000.h b/include/asm-sh/sh2000/sh2000.h
deleted file mode 100644
index 8d547324d59a..000000000000
--- a/include/asm-sh/sh2000/sh2000.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_SH_SH2000_SH2000_H
2#define __ASM_SH_SH2000_SH2000_H
3
4/* arch/sh/boards/sh2000/setup.c */
5extern int setup_sh2000(void);
6
7#endif /* __ASM_SH_SH2000_SH2000_H */
8
diff --git a/include/asm-sh/shmin/shmin.h b/include/asm-sh/shmin/shmin.h
new file mode 100644
index 000000000000..36ba138a81fb
--- /dev/null
+++ b/include/asm-sh/shmin/shmin.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_SH_SHMIN_H
2#define __ASM_SH_SHMIN_H
3
4#define SHMIN_IO_BASE 0xb0000000UL
5
6#define SHMIN_NE_IRQ IRQ2_IRQ
7#define SHMIN_NE_BASE 0x300
8
9#endif
diff --git a/include/asm-sh/shmparam.h b/include/asm-sh/shmparam.h
index 0a95604b9b66..ba1758d90106 100644
--- a/include/asm-sh/shmparam.h
+++ b/include/asm-sh/shmparam.h
@@ -1,8 +1,22 @@
1/*
2 * include/asm-sh/shmparam.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2006 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
1#ifndef __ASM_SH_SHMPARAM_H 11#ifndef __ASM_SH_SHMPARAM_H
2#define __ASM_SH_SHMPARAM_H 12#define __ASM_SH_SHMPARAM_H
3#ifdef __KERNEL__
4 13
5#include <asm/cpu/shmparam.h> 14/*
15 * SH-4 and SH-3 7705 have an aliasing dcache. Bump this up to a sensible value
16 * for everyone, and work out the specifics from the probed cache descriptor.
17 */
18#define SHMLBA 0x4000 /* attach addr a multiple of this */
19
20#define __ARCH_FORCE_SHMLBA
6 21
7#endif /* __KERNEL__ */
8#endif /* __ASM_SH_SHMPARAM_H */ 22#endif /* __ASM_SH_SHMPARAM_H */
diff --git a/include/asm-sh/se/smc37c93x.h b/include/asm-sh/smc37c93x.h
index 585da2a8fc45..585da2a8fc45 100644
--- a/include/asm-sh/se/smc37c93x.h
+++ b/include/asm-sh/smc37c93x.h
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h
index f57c4fe9692a..71ecddf70db3 100644
--- a/include/asm-sh/smp.h
+++ b/include/asm-sh/smp.h
@@ -19,11 +19,6 @@
19#include <asm/atomic.h> 19#include <asm/atomic.h>
20#include <asm/current.h> 20#include <asm/current.h>
21 21
22extern cpumask_t cpu_online_map;
23extern cpumask_t cpu_possible_map;
24
25#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
26
27#define raw_smp_processor_id() (current_thread_info()->cpu) 22#define raw_smp_processor_id() (current_thread_info()->cpu)
28 23
29/* I've no idea what the real meaning of this is */ 24/* I've no idea what the real meaning of this is */
diff --git a/include/asm-sh/snapgear/io.h b/include/asm-sh/snapgear.h
index bfa97ac06280..6b5e4ddc073a 100644
--- a/include/asm-sh/snapgear/io.h
+++ b/include/asm-sh/snapgear.h
@@ -40,21 +40,8 @@
40#define IRL3_PRIORITY 4 40#define IRL3_PRIORITY 4
41#endif 41#endif
42 42
43extern unsigned char snapgear_inb(unsigned long port); 43#define __IO_PREFIX snapgear
44extern unsigned short snapgear_inw(unsigned long port); 44#include <asm/io_generic.h>
45extern unsigned int snapgear_inl(unsigned long port);
46
47extern void snapgear_outb(unsigned char value, unsigned long port);
48extern void snapgear_outw(unsigned short value, unsigned long port);
49extern void snapgear_outl(unsigned int value, unsigned long port);
50
51extern unsigned char snapgear_inb_p(unsigned long port);
52extern void snapgear_outb_p(unsigned char value, unsigned long port);
53
54extern void snapgear_insl(unsigned long port, void *addr, unsigned long count);
55extern void snapgear_outsl(unsigned long port, const void *addr, unsigned long count);
56
57extern unsigned long snapgear_isa_port2addr(unsigned long offset);
58 45
59#ifdef CONFIG_SH_SECUREEDGE5410 46#ifdef CONFIG_SH_SECUREEDGE5410
60/* 47/*
@@ -79,14 +66,14 @@ extern unsigned long snapgear_isa_port2addr(unsigned long offset);
79 * D12 - RTS RESET 66 * D12 - RTS RESET
80 */ 67 */
81 68
82 #define SECUREEDGE_IOPORT_ADDR ((volatile short *) 0xb0000000) 69#define SECUREEDGE_IOPORT_ADDR ((volatile short *) 0xb0000000)
83 extern unsigned short secureedge5410_ioport; 70extern unsigned short secureedge5410_ioport;
84 71
85 #define SECUREEDGE_WRITE_IOPORT(val, mask) (*SECUREEDGE_IOPORT_ADDR = \ 72#define SECUREEDGE_WRITE_IOPORT(val, mask) (*SECUREEDGE_IOPORT_ADDR = \
86 (secureedge5410_ioport = \ 73 (secureedge5410_ioport = \
87 ((secureedge5410_ioport & ~(mask)) | ((val) & (mask))))) 74 ((secureedge5410_ioport & ~(mask)) | ((val) & (mask)))))
88 #define SECUREEDGE_READ_IOPORT() \ 75#define SECUREEDGE_READ_IOPORT() \
89 ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817)) 76 ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817))
90#endif 77#endif
91 78
92#endif /* _ASM_SH_IO_SNAPGEAR_H */ 79#endif /* _ASM_SH_IO_SNAPGEAR_H */
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index 846322d4c35d..2586eef07d57 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -88,7 +88,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
88 __raw_spin_unlock(&rw->lock); 88 __raw_spin_unlock(&rw->lock);
89} 89}
90 90
91#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 91static inline int __raw_read_trylock(raw_rwlock_t *lock)
92{
93 atomic_t *count = (atomic_t*)lock;
94 if (atomic_dec_return(count) >= 0)
95 return 1;
96 atomic_inc(count);
97 return 0;
98}
92 99
93static inline int __raw_write_trylock(raw_rwlock_t *rw) 100static inline int __raw_write_trylock(raw_rwlock_t *rw)
94{ 101{
@@ -100,4 +107,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
100 return 0; 107 return 0;
101} 108}
102 109
110#define _raw_spin_relax(lock) cpu_relax()
111#define _raw_read_relax(lock) cpu_relax()
112#define _raw_write_relax(lock) cpu_relax()
113
103#endif /* __ASM_SH_SPINLOCK_H */ 114#endif /* __ASM_SH_SPINLOCK_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
index 3e0cff04caec..95bc7db006b0 100644
--- a/include/asm-sh/string.h
+++ b/include/asm-sh/string.h
@@ -1,13 +1,15 @@
1#ifndef __ASM_SH_STRING_H 1#ifndef __ASM_SH_STRING_H
2#define __ASM_SH_STRING_H 2#define __ASM_SH_STRING_H
3 3
4#ifdef __KERNEL__
5
4/* 6/*
5 * Copyright (C) 1999 Niibe Yutaka 7 * Copyright (C) 1999 Niibe Yutaka
6 * But consider these trivial functions to be public domain. 8 * But consider these trivial functions to be public domain.
7 */ 9 */
8 10
9#define __HAVE_ARCH_STRCPY 11#define __HAVE_ARCH_STRCPY
10static __inline__ char *strcpy(char *__dest, const char *__src) 12static inline char *strcpy(char *__dest, const char *__src)
11{ 13{
12 register char *__xdest = __dest; 14 register char *__xdest = __dest;
13 unsigned long __dummy; 15 unsigned long __dummy;
@@ -26,7 +28,7 @@ static __inline__ char *strcpy(char *__dest, const char *__src)
26} 28}
27 29
28#define __HAVE_ARCH_STRNCPY 30#define __HAVE_ARCH_STRNCPY
29static __inline__ char *strncpy(char *__dest, const char *__src, size_t __n) 31static inline char *strncpy(char *__dest, const char *__src, size_t __n)
30{ 32{
31 register char *__xdest = __dest; 33 register char *__xdest = __dest;
32 unsigned long __dummy; 34 unsigned long __dummy;
@@ -52,7 +54,7 @@ static __inline__ char *strncpy(char *__dest, const char *__src, size_t __n)
52} 54}
53 55
54#define __HAVE_ARCH_STRCMP 56#define __HAVE_ARCH_STRCMP
55static __inline__ int strcmp(const char *__cs, const char *__ct) 57static inline int strcmp(const char *__cs, const char *__ct)
56{ 58{
57 register int __res; 59 register int __res;
58 unsigned long __dummy; 60 unsigned long __dummy;
@@ -78,7 +80,7 @@ static __inline__ int strcmp(const char *__cs, const char *__ct)
78} 80}
79 81
80#define __HAVE_ARCH_STRNCMP 82#define __HAVE_ARCH_STRNCMP
81static __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) 83static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
82{ 84{
83 register int __res; 85 register int __res;
84 unsigned long __dummy; 86 unsigned long __dummy;
@@ -124,4 +126,9 @@ extern void *memchr(const void *__s, int __c, size_t __n);
124#define __HAVE_ARCH_STRLEN 126#define __HAVE_ARCH_STRLEN
125extern size_t strlen(const char *); 127extern size_t strlen(const char *);
126 128
129/* arch/sh/lib/strcasecmp.c */
130extern int strcasecmp(const char *, const char *);
131
132#endif /* __KERNEL__ */
133
127#endif /* __ASM_SH_STRING_H */ 134#endif /* __ASM_SH_STRING_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index ad35ad4958f4..6c1f8fde5ac4 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -6,6 +6,7 @@
6 * Copyright (C) 2002 Paul Mundt 6 * Copyright (C) 2002 Paul Mundt
7 */ 7 */
8 8
9#include <asm/types.h>
9 10
10/* 11/*
11 * switch_to() should switch tasks to task nr n, first 12 * switch_to() should switch tasks to task nr n, first
@@ -66,13 +67,20 @@ static inline void sched_cacheflush(void)
66{ 67{
67} 68}
68 69
69#define nop() __asm__ __volatile__ ("nop") 70#ifdef CONFIG_CPU_SH4A
70 71#define __icbi() \
71 72{ \
72#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 73 unsigned long __addr; \
74 __addr = 0xa8000000; \
75 __asm__ __volatile__( \
76 "icbi %0\n\t" \
77 : /* no output */ \
78 : "m" (__m(__addr))); \
79}
80#endif
73 81
74static __inline__ unsigned long tas(volatile int *m) 82static inline unsigned long tas(volatile int *m)
75{ /* #define tas(ptr) (xchg((ptr),1)) */ 83{
76 unsigned long retval; 84 unsigned long retval;
77 85
78 __asm__ __volatile__ ("tas.b @%1\n\t" 86 __asm__ __volatile__ ("tas.b @%1\n\t"
@@ -81,12 +89,33 @@ static __inline__ unsigned long tas(volatile int *m)
81 return retval; 89 return retval;
82} 90}
83 91
84extern void __xchg_called_with_bad_pointer(void); 92/*
85 93 * A brief note on ctrl_barrier(), the control register write barrier.
86#define mb() __asm__ __volatile__ ("": : :"memory") 94 *
87#define rmb() mb() 95 * Legacy SH cores typically require a sequence of 8 nops after
88#define wmb() __asm__ __volatile__ ("": : :"memory") 96 * modification of a control register in order for the changes to take
97 * effect. On newer cores (like the sh4a and sh5) this is accomplished
98 * with icbi.
99 *
100 * Also note that on sh4a in the icbi case we can forego a synco for the
101 * write barrier, as it's not necessary for control registers.
102 *
103 * Historically we have only done this type of barrier for the MMUCR, but
104 * it's also necessary for the CCR, so we make it generic here instead.
105 */
106#ifdef CONFIG_CPU_SH4A
107#define mb() __asm__ __volatile__ ("synco": : :"memory")
108#define rmb() mb()
109#define wmb() __asm__ __volatile__ ("synco": : :"memory")
110#define ctrl_barrier() __icbi()
111#define read_barrier_depends() do { } while(0)
112#else
113#define mb() __asm__ __volatile__ ("": : :"memory")
114#define rmb() mb()
115#define wmb() __asm__ __volatile__ ("": : :"memory")
116#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
89#define read_barrier_depends() do { } while(0) 117#define read_barrier_depends() do { } while(0)
118#endif
90 119
91#ifdef CONFIG_SMP 120#ifdef CONFIG_SMP
92#define smp_mb() mb() 121#define smp_mb() mb()
@@ -103,7 +132,8 @@ extern void __xchg_called_with_bad_pointer(void);
103#define set_mb(var, value) do { xchg(&var, value); } while (0) 132#define set_mb(var, value) do { xchg(&var, value); } while (0)
104 133
105/* Interrupt Control */ 134/* Interrupt Control */
106static __inline__ void local_irq_enable(void) 135#ifdef CONFIG_CPU_HAS_SR_RB
136static inline void local_irq_enable(void)
107{ 137{
108 unsigned long __dummy0, __dummy1; 138 unsigned long __dummy0, __dummy1;
109 139
@@ -116,8 +146,22 @@ static __inline__ void local_irq_enable(void)
116 : "1" (~0x000000f0) 146 : "1" (~0x000000f0)
117 : "memory"); 147 : "memory");
118} 148}
149#else
150static inline void local_irq_enable(void)
151{
152 unsigned long __dummy0, __dummy1;
153
154 __asm__ __volatile__ (
155 "stc sr, %0\n\t"
156 "and %1, %0\n\t"
157 "ldc %0, sr\n\t"
158 : "=&r" (__dummy0), "=r" (__dummy1)
159 : "1" (~0x000000f0)
160 : "memory");
161}
162#endif
119 163
120static __inline__ void local_irq_disable(void) 164static inline void local_irq_disable(void)
121{ 165{
122 unsigned long __dummy; 166 unsigned long __dummy;
123 __asm__ __volatile__("stc sr, %0\n\t" 167 __asm__ __volatile__("stc sr, %0\n\t"
@@ -128,6 +172,31 @@ static __inline__ void local_irq_disable(void)
128 : "memory"); 172 : "memory");
129} 173}
130 174
175static inline void set_bl_bit(void)
176{
177 unsigned long __dummy0, __dummy1;
178
179 __asm__ __volatile__ ("stc sr, %0\n\t"
180 "or %2, %0\n\t"
181 "and %3, %0\n\t"
182 "ldc %0, sr"
183 : "=&r" (__dummy0), "=r" (__dummy1)
184 : "r" (0x10000000), "r" (0xffffff0f)
185 : "memory");
186}
187
188static inline void clear_bl_bit(void)
189{
190 unsigned long __dummy0, __dummy1;
191
192 __asm__ __volatile__ ("stc sr, %0\n\t"
193 "and %2, %0\n\t"
194 "ldc %0, sr"
195 : "=&r" (__dummy0), "=r" (__dummy1)
196 : "1" (~0x10000000)
197 : "memory");
198}
199
131#define local_save_flags(x) \ 200#define local_save_flags(x) \
132 __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" ) 201 __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" )
133 202
@@ -138,7 +207,7 @@ static __inline__ void local_irq_disable(void)
138 (flags != 0); \ 207 (flags != 0); \
139}) 208})
140 209
141static __inline__ unsigned long local_irq_save(void) 210static inline unsigned long local_irq_save(void)
142{ 211{
143 unsigned long flags, __dummy; 212 unsigned long flags, __dummy;
144 213
@@ -154,35 +223,9 @@ static __inline__ unsigned long local_irq_save(void)
154 return flags; 223 return flags;
155} 224}
156 225
157#ifdef DEBUG_CLI_STI 226#define local_irq_restore(x) do { \
158static __inline__ void local_irq_restore(unsigned long x)
159{
160 if ((x & 0x000000f0) != 0x000000f0)
161 local_irq_enable();
162 else {
163 unsigned long flags;
164 local_save_flags(flags);
165
166 if (flags == 0) {
167 extern void dump_stack(void);
168 printk(KERN_ERR "BUG!\n");
169 dump_stack();
170 local_irq_disable();
171 }
172 }
173}
174#else
175#define local_irq_restore(x) do { \
176 if ((x & 0x000000f0) != 0x000000f0) \
177 local_irq_enable(); \
178} while (0)
179#endif
180
181#define really_restore_flags(x) do { \
182 if ((x & 0x000000f0) != 0x000000f0) \ 227 if ((x & 0x000000f0) != 0x000000f0) \
183 local_irq_enable(); \ 228 local_irq_enable(); \
184 else \
185 local_irq_disable(); \
186} while (0) 229} while (0)
187 230
188/* 231/*
@@ -210,8 +253,8 @@ do { \
210#define back_to_P1() \ 253#define back_to_P1() \
211do { \ 254do { \
212 unsigned long __dummy; \ 255 unsigned long __dummy; \
256 ctrl_barrier(); \
213 __asm__ __volatile__( \ 257 __asm__ __volatile__( \
214 "nop;nop;nop;nop;nop;nop;nop\n\t" \
215 "mov.l 1f, %0\n\t" \ 258 "mov.l 1f, %0\n\t" \
216 "jmp @%0\n\t" \ 259 "jmp @%0\n\t" \
217 " nop\n\t" \ 260 " nop\n\t" \
@@ -224,7 +267,7 @@ do { \
224/* For spinlocks etc */ 267/* For spinlocks etc */
225#define local_irq_save(x) x = local_irq_save() 268#define local_irq_save(x) x = local_irq_save()
226 269
227static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) 270static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
228{ 271{
229 unsigned long flags, retval; 272 unsigned long flags, retval;
230 273
@@ -235,7 +278,7 @@ static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val)
235 return retval; 278 return retval;
236} 279}
237 280
238static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) 281static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
239{ 282{
240 unsigned long flags, retval; 283 unsigned long flags, retval;
241 284
@@ -246,20 +289,70 @@ static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned lon
246 return retval; 289 return retval;
247} 290}
248 291
249static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, int size) 292extern void __xchg_called_with_bad_pointer(void);
293
294#define __xchg(ptr, x, size) \
295({ \
296 unsigned long __xchg__res; \
297 volatile void *__xchg_ptr = (ptr); \
298 switch (size) { \
299 case 4: \
300 __xchg__res = xchg_u32(__xchg_ptr, x); \
301 break; \
302 case 1: \
303 __xchg__res = xchg_u8(__xchg_ptr, x); \
304 break; \
305 default: \
306 __xchg_called_with_bad_pointer(); \
307 __xchg__res = x; \
308 break; \
309 } \
310 \
311 __xchg__res; \
312})
313
314#define xchg(ptr,x) \
315 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
316
317static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
318 unsigned long new)
319{
320 __u32 retval;
321 unsigned long flags;
322
323 local_irq_save(flags);
324 retval = *m;
325 if (retval == old)
326 *m = new;
327 local_irq_restore(flags); /* implies memory barrier */
328 return retval;
329}
330
331/* This function doesn't exist, so you'll get a linker error
332 * if something tries to do an invalid cmpxchg(). */
333extern void __cmpxchg_called_with_bad_pointer(void);
334
335#define __HAVE_ARCH_CMPXCHG 1
336
337static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
338 unsigned long new, int size)
250{ 339{
251 switch (size) { 340 switch (size) {
252 case 4: 341 case 4:
253 return xchg_u32(ptr, x); 342 return __cmpxchg_u32(ptr, old, new);
254 break;
255 case 1:
256 return xchg_u8(ptr, x);
257 break;
258 } 343 }
259 __xchg_called_with_bad_pointer(); 344 __cmpxchg_called_with_bad_pointer();
260 return x; 345 return old;
261} 346}
262 347
348#define cmpxchg(ptr,o,n) \
349 ({ \
350 __typeof__(*(ptr)) _o_ = (o); \
351 __typeof__(*(ptr)) _n_ = (n); \
352 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
353 (unsigned long)_n_, sizeof(*(ptr))); \
354 })
355
263/* XXX 356/* XXX
264 * disable hlt during certain critical i/o operations 357 * disable hlt during certain critical i/o operations
265 */ 358 */
diff --git a/include/asm-sh/systemh/io.h b/include/asm-sh/systemh/io.h
deleted file mode 100644
index 327849b49db8..000000000000
--- a/include/asm-sh/systemh/io.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * include/asm-sh/systemh/io.h
3 *
4 * Stupid I/O definitions for SystemH, cloned from SE7751.
5 *
6 * Copyright (C) 2003 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#ifndef __ASM_SH_SYSTEMH_IO_H
13#define __ASM_SH_SYSTEMH_IO_H
14
15extern unsigned char sh7751systemh_inb(unsigned long port);
16extern unsigned short sh7751systemh_inw(unsigned long port);
17extern unsigned int sh7751systemh_inl(unsigned long port);
18
19extern void sh7751systemh_outb(unsigned char value, unsigned long port);
20extern void sh7751systemh_outw(unsigned short value, unsigned long port);
21extern void sh7751systemh_outl(unsigned int value, unsigned long port);
22
23extern unsigned char sh7751systemh_inb_p(unsigned long port);
24extern void sh7751systemh_outb_p(unsigned char value, unsigned long port);
25
26extern void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count);
27extern void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count);
28extern void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count);
29extern void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count);
30extern void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long count);
31extern void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count);
32
33extern unsigned char sh7751systemh_readb(unsigned long addr);
34extern unsigned short sh7751systemh_readw(unsigned long addr);
35extern unsigned int sh7751systemh_readl(unsigned long addr);
36extern void sh7751systemh_writeb(unsigned char b, unsigned long addr);
37extern void sh7751systemh_writew(unsigned short b, unsigned long addr);
38extern void sh7751systemh_writel(unsigned int b, unsigned long addr);
39
40extern unsigned long sh7751systemh_isa_port2addr(unsigned long offset);
41
42#endif /* __ASM_SH_SYSTEMH_IO_H */
43
diff --git a/include/asm-sh/systemh/7751systemh.h b/include/asm-sh/systemh7751.h
index 4170531bdbd9..b143bb2a2ca7 100644
--- a/include/asm-sh/systemh/7751systemh.h
+++ b/include/asm-sh/systemh7751.h
@@ -65,4 +65,7 @@
65 65
66#define IRQ_79C973 13 66#define IRQ_79C973 13
67 67
68#define __IO_PREFIX sh7751systemh
69#include <asm/io_generic.h>
70
68#endif /* __ASM_SH_SYSTEMH_7751SYSTEMH_H */ 71#endif /* __ASM_SH_SYSTEMH_7751SYSTEMH_H */
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 7345350d98c0..3ebc3f9039eb 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -9,8 +9,8 @@
9 * Copyright (C) 2002 David Howells (dhowells@redhat.com) 9 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
10 * - Incorporating suggestions made by Linus Torvalds and Dave Miller 10 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
11 */ 11 */
12
13#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <asm/page.h>
14 14
15#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
16#include <asm/processor.h> 16#include <asm/processor.h>
@@ -21,7 +21,10 @@ struct thread_info {
21 unsigned long flags; /* low level flags */ 21 unsigned long flags; /* low level flags */
22 __u32 cpu; 22 __u32 cpu;
23 int preempt_count; /* 0 => preemptable, <0 => BUG */ 23 int preempt_count; /* 0 => preemptable, <0 => BUG */
24 mm_segment_t addr_limit; /* thread address space */
24 struct restart_block restart_block; 25 struct restart_block restart_block;
26 unsigned long previous_sp; /* sp of previous stack in case
27 of nested IRQ stacks */
25 __u8 supervisor_stack[0]; 28 __u8 supervisor_stack[0];
26}; 29};
27 30
@@ -29,6 +32,13 @@ struct thread_info {
29 32
30#define PREEMPT_ACTIVE 0x10000000 33#define PREEMPT_ACTIVE 0x10000000
31 34
35#ifdef CONFIG_4KSTACKS
36#define THREAD_SIZE (PAGE_SIZE)
37#else
38#define THREAD_SIZE (PAGE_SIZE * 2)
39#endif
40#define STACK_WARN (THREAD_SIZE / 8)
41
32/* 42/*
33 * macros/functions for gaining access to the thread information structure 43 * macros/functions for gaining access to the thread information structure
34 */ 44 */
@@ -40,6 +50,7 @@ struct thread_info {
40 .flags = 0, \ 50 .flags = 0, \
41 .cpu = 0, \ 51 .cpu = 0, \
42 .preempt_count = 1, \ 52 .preempt_count = 1, \
53 .addr_limit = KERNEL_DS, \
43 .restart_block = { \ 54 .restart_block = { \
44 .fn = do_no_restart_syscall, \ 55 .fn = do_no_restart_syscall, \
45 }, \ 56 }, \
@@ -48,24 +59,42 @@ struct thread_info {
48#define init_thread_info (init_thread_union.thread_info) 59#define init_thread_info (init_thread_union.thread_info)
49#define init_stack (init_thread_union.stack) 60#define init_stack (init_thread_union.stack)
50 61
62/* how to get the current stack pointer from C */
63register unsigned long current_stack_pointer asm("r15") __attribute_used__;
64
51/* how to get the thread information struct from C */ 65/* how to get the thread information struct from C */
52static inline struct thread_info *current_thread_info(void) 66static inline struct thread_info *current_thread_info(void)
53{ 67{
54 struct thread_info *ti; 68 struct thread_info *ti;
69#ifdef CONFIG_CPU_HAS_SR_RB
55 __asm__("stc r7_bank, %0" : "=r" (ti)); 70 __asm__("stc r7_bank, %0" : "=r" (ti));
71#else
72 unsigned long __dummy;
73
74 __asm__ __volatile__ (
75 "mov r15, %0\n\t"
76 "and %1, %0\n\t"
77 : "=&r" (ti), "=r" (__dummy)
78 : "1" (~(THREAD_SIZE - 1))
79 : "memory");
80#endif
81
56 return ti; 82 return ti;
57} 83}
58 84
59/* thread information allocation */ 85/* thread information allocation */
60#define THREAD_SIZE (2*PAGE_SIZE) 86#ifdef CONFIG_DEBUG_STACK_USAGE
61#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 87#define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL)
62#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 88#else
89#define alloc_thread_info(ti) kmalloc(THREAD_SIZE, GFP_KERNEL)
90#endif
91#define free_thread_info(ti) kfree(ti)
63 92
64#else /* !__ASSEMBLY__ */ 93#else /* !__ASSEMBLY__ */
65 94
66/* how to get the thread information struct from ASM */ 95/* how to get the thread information struct from ASM */
67#define GET_THREAD_INFO(reg) \ 96#define GET_THREAD_INFO(reg) \
68 stc r7_bank, reg 97 stc r7_bank, reg
69 98
70#endif 99#endif
71 100
@@ -79,18 +108,18 @@ static inline struct thread_info *current_thread_info(void)
79#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ 108#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
80#define TIF_SIGPENDING 2 /* signal pending */ 109#define TIF_SIGPENDING 2 /* signal pending */
81#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 110#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
111#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
82#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 112#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
83#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 113#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
84#define TIF_MEMDIE 18 114#define TIF_MEMDIE 18
85#define TIF_USERSPACE 31 /* true if FS sets userspace */
86 115
87#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 116#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
88#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 117#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
89#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 118#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
90#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 119#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
120#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
91#define _TIF_USEDFPU (1<<TIF_USEDFPU) 121#define _TIF_USEDFPU (1<<TIF_USEDFPU)
92#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 122#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
93#define _TIF_USERSPACE (1<<TIF_USERSPACE)
94 123
95#define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */ 124#define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */
96#define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */ 125#define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */
diff --git a/include/asm-sh/timer.h b/include/asm-sh/timer.h
index dd6579c0b04c..c7ab28095ba0 100644
--- a/include/asm-sh/timer.h
+++ b/include/asm-sh/timer.h
@@ -6,6 +6,8 @@
6 6
7struct sys_timer_ops { 7struct sys_timer_ops {
8 int (*init)(void); 8 int (*init)(void);
9 int (*start)(void);
10 int (*stop)(void);
9 unsigned long (*get_offset)(void); 11 unsigned long (*get_offset)(void);
10 unsigned long (*get_frequency)(void); 12 unsigned long (*get_frequency)(void);
11}; 13};
diff --git a/include/asm-sh/titan.h b/include/asm-sh/titan.h
new file mode 100644
index 000000000000..270a4f4bc8a9
--- /dev/null
+++ b/include/asm-sh/titan.h
@@ -0,0 +1,43 @@
1/*
2 * Platform defintions for Titan
3 */
4
5#ifndef _ASM_SH_TITAN_TITAN_H
6#define _ASM_SH_TITAN_TITAN_H
7
8#define __IO_PREFIX titan
9#include <asm/io_generic.h>
10
11/* IRQ assignments */
12#define TITAN_IRQ_WAN 2 /* eth0 (WAN) */
13#define TITAN_IRQ_LAN 5 /* eth1 (LAN) */
14#define TITAN_IRQ_MPCIA 8 /* mPCI A */
15#define TITAN_IRQ_MPCIB 11 /* mPCI B */
16#define TITAN_IRQ_USB 11 /* USB */
17
18/*
19 * The external interrupt lines, these take up ints 0 - 15 inclusive
20 * depending on the priority for the interrupt. In fact the priority
21 * is the interrupt :-)
22 */
23#define IRL0_IRQ 0
24#define IRL0_IPR_ADDR INTC_IPRD
25#define IRL0_IPR_POS 3
26#define IRL0_PRIORITY 8
27
28#define IRL1_IRQ 1
29#define IRL1_IPR_ADDR INTC_IPRD
30#define IRL1_IPR_POS 2
31#define IRL1_PRIORITY 8
32
33#define IRL2_IRQ 2
34#define IRL2_IPR_ADDR INTC_IPRD
35#define IRL2_IPR_POS 1
36#define IRL2_PRIORITY 8
37
38#define IRL3_IRQ 3
39#define IRL3_IPR_ADDR INTC_IPRD
40#define IRL3_IPR_POS 0
41#define IRL3_PRIORITY 8
42
43#endif
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index 2cb01861e7c5..5c49ed6715f2 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -16,21 +16,9 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18 18
19/*
20 * NOTE: Macro/functions in this file depends on threads_info.h implementation.
21 * Assumes:
22 * TI_FLAGS == 8
23 * TIF_USERSPACE == 31
24 * USER_ADDR_LIMIT == 0x80000000
25 */
26
27#define VERIFY_READ 0 19#define VERIFY_READ 0
28#define VERIFY_WRITE 1 20#define VERIFY_WRITE 1
29 21
30typedef struct {
31 unsigned int is_user_space;
32} mm_segment_t;
33
34/* 22/*
35 * The fs value determines whether argument validity checking should be 23 * The fs value determines whether argument validity checking should be
36 * performed or not. If get_fs() == USER_DS, checking is performed, with 24 * performed or not. If get_fs() == USER_DS, checking is performed, with
@@ -40,16 +28,18 @@ typedef struct {
40 */ 28 */
41 29
42#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) 30#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
43#define segment_eq(a,b) ((a).is_user_space == (b).is_user_space)
44 31
45#define USER_ADDR_LIMIT 0x80000000 32#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL)
33#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
46 34
47#define KERNEL_DS MAKE_MM_SEG(0) 35#define segment_eq(a,b) ((a).seg == (b).seg)
48#define USER_DS MAKE_MM_SEG(1)
49 36
50#define get_ds() (KERNEL_DS) 37#define get_ds() (KERNEL_DS)
51 38
52#if !defined(CONFIG_MMU) 39#if !defined(CONFIG_MMU)
40/* NOMMU is always true */
41#define __addr_ok(addr) (1)
42
53static inline mm_segment_t get_fs(void) 43static inline mm_segment_t get_fs(void)
54{ 44{
55 return USER_DS; 45 return USER_DS;
@@ -76,31 +66,11 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
76 return ((addr >= memory_start) && ((addr + size) < memory_end)); 66 return ((addr >= memory_start) && ((addr + size) < memory_end));
77} 67}
78#else /* CONFIG_MMU */ 68#else /* CONFIG_MMU */
79static inline mm_segment_t get_fs(void) 69#define __addr_ok(addr) \
80{ 70 ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
81 return MAKE_MM_SEG(test_thread_flag(TIF_USERSPACE));
82}
83 71
84static inline void set_fs(mm_segment_t s) 72#define get_fs() (current_thread_info()->addr_limit)
85{ 73#define set_fs(x) (current_thread_info()->addr_limit = (x))
86 unsigned long ti, flag;
87 __asm__ __volatile__(
88 "stc r7_bank, %0\n\t"
89 "mov.l @(8,%0), %1\n\t"
90 "shal %1\n\t"
91 "cmp/pl %2\n\t"
92 "rotcr %1\n\t"
93 "mov.l %1, @(8,%0)"
94 : "=&r" (ti), "=&r" (flag)
95 : "r" (s.is_user_space)
96 : "t");
97/****
98 if (s.is_user_space)
99 set_thread_flag(TIF_USERSPACE);
100 else
101 clear_thread_flag(TIF_USERSPACE);
102****/
103}
104 74
105/* 75/*
106 * __access_ok: Check if address with size is OK or not. 76 * __access_ok: Check if address with size is OK or not.
@@ -108,7 +78,7 @@ static inline void set_fs(mm_segment_t s)
108 * We do three checks: 78 * We do three checks:
109 * (1) is it user space? 79 * (1) is it user space?
110 * (2) addr + size --> carry? 80 * (2) addr + size --> carry?
111 * (3) addr + size >= 0x80000000 (USER_ADDR_LIMIT) 81 * (3) addr + size >= 0x80000000 (PAGE_OFFSET)
112 * 82 *
113 * (1) (2) (3) | RESULT 83 * (1) (2) (3) | RESULT
114 * 0 0 0 | ok 84 * 0 0 0 | ok
@@ -201,6 +171,7 @@ do { \
201 __gu_err; \ 171 __gu_err; \
202}) 172})
203 173
174#ifdef CONFIG_MMU
204#define __get_user_check(x,ptr,size) \ 175#define __get_user_check(x,ptr,size) \
205({ \ 176({ \
206 long __gu_err, __gu_val; \ 177 long __gu_err, __gu_val; \
@@ -290,6 +261,18 @@ __asm__("stc r7_bank, %1\n\t" \
290 : "r" (addr) \ 261 : "r" (addr) \
291 : "t"); \ 262 : "t"); \
292}) 263})
264#else /* CONFIG_MMU */
265#define __get_user_check(x,ptr,size) \
266({ \
267 long __gu_err, __gu_val; \
268 if (__access_ok((unsigned long)(ptr), (size))) { \
269 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
270 (x) = (__typeof__(*(ptr)))__gu_val; \
271 } else \
272 __gu_err = -EFAULT; \
273 __gu_err; \
274})
275#endif
293 276
294#define __get_user_asm(x, addr, err, insn) \ 277#define __get_user_asm(x, addr, err, insn) \
295({ \ 278({ \
@@ -541,7 +524,7 @@ static __inline__ long __strnlen_user(const char __user *__s, long __n)
541 "3:\n\t" 524 "3:\n\t"
542 "mov.l 4f, %1\n\t" 525 "mov.l 4f, %1\n\t"
543 "jmp @%1\n\t" 526 "jmp @%1\n\t"
544 " mov %5, %0\n" 527 " mov #0, %0\n"
545 ".balign 4\n" 528 ".balign 4\n"
546 "4: .long 2b\n" 529 "4: .long 2b\n"
547 ".previous\n" 530 ".previous\n"
@@ -550,26 +533,20 @@ static __inline__ long __strnlen_user(const char __user *__s, long __n)
550 " .long 1b,3b\n" 533 " .long 1b,3b\n"
551 ".previous" 534 ".previous"
552 : "=z" (res), "=&r" (__dummy) 535 : "=z" (res), "=&r" (__dummy)
553 : "0" (0), "r" (__s), "r" (__n), "i" (-EFAULT) 536 : "0" (0), "r" (__s), "r" (__n)
554 : "t"); 537 : "t");
555 return res; 538 return res;
556} 539}
557 540
558static __inline__ long strnlen_user(const char __user *s, long n) 541static __inline__ long strnlen_user(const char __user *s, long n)
559{ 542{
560 if (!access_ok(VERIFY_READ, s, n)) 543 if (!__addr_ok(s))
561 return 0; 544 return 0;
562 else 545 else
563 return __strnlen_user(s, n); 546 return __strnlen_user(s, n);
564} 547}
565 548
566static __inline__ long strlen_user(const char __user *s) 549#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
567{
568 if (!access_ok(VERIFY_READ, s, 0))
569 return 0;
570 else
571 return __strnlen_user(s, ~0UL >> 1);
572}
573 550
574/* 551/*
575 * The exception table consists of pairs of addresses: the first is the 552 * The exception table consists of pairs of addresses: the first is the
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 76b5430cb458..f1a0cbc966be 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -292,25 +292,51 @@
292#define __NR_mq_getsetattr (__NR_mq_open+5) 292#define __NR_mq_getsetattr (__NR_mq_open+5)
293#define __NR_kexec_load 283 293#define __NR_kexec_load 283
294#define __NR_waitid 284 294#define __NR_waitid 284
295#define __NR_add_key 285 295/* #define __NR_sys_setaltroot 285 */
296#define __NR_request_key 286 296#define __NR_add_key 286
297#define __NR_keyctl 287 297#define __NR_request_key 287
298#define __NR_ioprio_set 288 298#define __NR_keyctl 288
299#define __NR_ioprio_get 289 299#define __NR_ioprio_set 289
300#define __NR_inotify_init 290 300#define __NR_ioprio_get 290
301#define __NR_inotify_add_watch 291 301#define __NR_inotify_init 291
302#define __NR_inotify_rm_watch 292 302#define __NR_inotify_add_watch 292
303#define __NR_inotify_rm_watch 293
304#define __NR_migrate_pages 294
305#define __NR_openat 295
306#define __NR_mkdirat 296
307#define __NR_mknodat 297
308#define __NR_fchownat 298
309#define __NR_futimesat 299
310#define __NR_newfstatat 300
311#define __NR_unlinkat 301
312#define __NR_renameat 302
313#define __NR_linkat 303
314#define __NR_symlinkat 304
315#define __NR_readlinkat 305
316#define __NR_fchmodat 306
317#define __NR_faccessat 307
318#define __NR_pselect6 308
319#define __NR_ppoll 309
320#define __NR_unshare 310
321#define __NR_set_robust_list 311
322#define __NR_get_robust_list 312
323#define __NR_splice 313
324#define __NR_sync_file_range 314
325#define __NR_tee 315
326#define __NR_vmsplice 316
303 327
304 328#define NR_syscalls 317
305#define NR_syscalls 293
306 329
307#ifdef __KERNEL__ 330#ifdef __KERNEL__
308 331
309/* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */ 332#include <linux/err.h>
333
334/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
335 * see <asm-sh/errno.h> */
310 336
311#define __syscall_return(type, res) \ 337#define __syscall_return(type, res) \
312do { \ 338do { \
313 if ((unsigned long)(res) >= (unsigned long)(-124)) { \ 339 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
314 /* Avoid using "res" which is declared to be in register r0; \ 340 /* Avoid using "res" which is declared to be in register r0; \
315 errno might expand to a function call and clobber it. */ \ 341 errno might expand to a function call and clobber it. */ \
316 int __err = -(res); \ 342 int __err = -(res); \
@@ -444,76 +470,7 @@ __syscall_return(type,__sc0); \
444#define __ARCH_WANT_SYS_SIGPENDING 470#define __ARCH_WANT_SYS_SIGPENDING
445#define __ARCH_WANT_SYS_SIGPROCMASK 471#define __ARCH_WANT_SYS_SIGPROCMASK
446#define __ARCH_WANT_SYS_RT_SIGACTION 472#define __ARCH_WANT_SYS_RT_SIGACTION
447 473#define __ARCH_WANT_SYS_RT_SIGSUSPEND
448#ifdef __KERNEL_SYSCALLS__
449
450#include <linux/compiler.h>
451#include <linux/types.h>
452#include <linux/linkage.h>
453#include <asm/ptrace.h>
454
455/*
456 * we need this inline - forking from kernel space will result
457 * in NO COPY ON WRITE (!!!), until an execve is executed. This
458 * is no problem, but for the stack. This is handled by not letting
459 * main() use the stack at all after fork(). Thus, no function
460 * calls - which means inline code for fork too, as otherwise we
461 * would use the stack upon exit from 'fork()'.
462 *
463 * Actually only pause and fork are needed inline, so that there
464 * won't be any messing with the stack from main(), but we define
465 * some others too.
466 */
467#define __NR__exit __NR_exit
468static __inline__ _syscall0(int,pause)
469static __inline__ _syscall0(int,sync)
470static __inline__ _syscall0(pid_t,setsid)
471static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count)
472static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count)
473static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
474static __inline__ _syscall1(int,dup,int,fd)
475static __inline__ _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
476static __inline__ _syscall3(int,open,const char *,file,int,flag,int,mode)
477static __inline__ _syscall1(int,close,int,fd)
478static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
479static __inline__ _syscall1(int,delete_module,const char *,name)
480
481static __inline__ pid_t wait(int * wait_stat)
482{
483 return waitpid(-1,wait_stat,0);
484}
485
486asmlinkage long sys_mmap2(
487 unsigned long addr, unsigned long len,
488 unsigned long prot, unsigned long flags,
489 unsigned long fd, unsigned long pgoff);
490asmlinkage int sys_execve(char *ufilename, char **uargv,
491 char **uenvp, unsigned long r7,
492 struct pt_regs regs);
493asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
494 unsigned long parent_tidptr,
495 unsigned long child_tidptr,
496 struct pt_regs regs);
497asmlinkage int sys_fork(unsigned long r4, unsigned long r5,
498 unsigned long r6, unsigned long r7,
499 struct pt_regs regs);
500asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
501 unsigned long r6, unsigned long r7,
502 struct pt_regs regs);
503asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
504 unsigned long r6, unsigned long r7,
505 struct pt_regs regs);
506asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char *buf,
507 size_t count, long dummy, loff_t pos);
508asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char *buf,
509 size_t count, long dummy, loff_t pos);
510struct sigaction;
511asmlinkage long sys_rt_sigaction(int sig,
512 const struct sigaction __user *act,
513 struct sigaction __user *oact,
514 size_t sigsetsize);
515
516#endif /* __KERNEL_SYSCALLS__ */
517 474
518/* 475/*
519 * "Conditional" syscalls 476 * "Conditional" syscalls
diff --git a/include/asm-sh/rts7751r2d/voyagergx_reg.h b/include/asm-sh/voyagergx.h
index f031b5d6cf54..99b0807d1c9f 100644
--- a/include/asm-sh/rts7751r2d/voyagergx_reg.h
+++ b/include/asm-sh/voyagergx.h
@@ -1,5 +1,5 @@
1/* -------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------- */
2/* voyagergx_reg.h */ 2/* voyagergx.h */
3/* -------------------------------------------------------------------- */ 3/* -------------------------------------------------------------------- */
4/* This program is free software; you can redistribute it and/or modify 4/* This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
diff --git a/include/asm-sh/watchdog.h b/include/asm-sh/watchdog.h
index 09ca41972a11..d19ea62ef8c6 100644
--- a/include/asm-sh/watchdog.h
+++ b/include/asm-sh/watchdog.h
@@ -62,7 +62,6 @@
62 62
63/** 63/**
64 * sh_wdt_read_cnt - Read from Counter 64 * sh_wdt_read_cnt - Read from Counter
65 *
66 * Reads back the WTCNT value. 65 * Reads back the WTCNT value.
67 */ 66 */
68static inline __u8 sh_wdt_read_cnt(void) 67static inline __u8 sh_wdt_read_cnt(void)
@@ -72,7 +71,6 @@ static inline __u8 sh_wdt_read_cnt(void)
72 71
73/** 72/**
74 * sh_wdt_write_cnt - Write to Counter 73 * sh_wdt_write_cnt - Write to Counter
75 *
76 * @val: Value to write 74 * @val: Value to write
77 * 75 *
78 * Writes the given value @val to the lower byte of the timer counter. 76 * Writes the given value @val to the lower byte of the timer counter.
@@ -95,7 +93,6 @@ static inline __u8 sh_wdt_read_csr(void)
95 93
96/** 94/**
97 * sh_wdt_write_csr - Write to Control/Status Register 95 * sh_wdt_write_csr - Write to Control/Status Register
98 *
99 * @val: Value to write 96 * @val: Value to write
100 * 97 *
101 * Writes the given value @val to the lower byte of the control/status 98 * Writes the given value @val to the lower byte of the control/status
diff --git a/include/asm-sh64/keyboard.h b/include/asm-sh64/keyboard.h
index 1fab96d792bf..0b01c3beb2f8 100644
--- a/include/asm-sh64/keyboard.h
+++ b/include/asm-sh64/keyboard.h
@@ -30,7 +30,6 @@ extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
30extern char pckbd_unexpected_up(unsigned char keycode); 30extern char pckbd_unexpected_up(unsigned char keycode);
31extern void pckbd_leds(unsigned char leds); 31extern void pckbd_leds(unsigned char leds);
32extern void pckbd_init_hw(void); 32extern void pckbd_init_hw(void);
33extern unsigned char pckbd_sysrq_xlate[128];
34 33
35#define kbd_setkeycode pckbd_setkeycode 34#define kbd_setkeycode pckbd_setkeycode
36#define kbd_getkeycode pckbd_getkeycode 35#define kbd_getkeycode pckbd_getkeycode
@@ -38,9 +37,6 @@ extern unsigned char pckbd_sysrq_xlate[128];
38#define kbd_unexpected_up pckbd_unexpected_up 37#define kbd_unexpected_up pckbd_unexpected_up
39#define kbd_leds pckbd_leds 38#define kbd_leds pckbd_leds
40#define kbd_init_hw pckbd_init_hw 39#define kbd_init_hw pckbd_init_hw
41#define kbd_sysrq_xlate pckbd_sysrq_xlate
42
43#define SYSRQ_KEY 0x54
44 40
45/* resource allocation */ 41/* resource allocation */
46#define kbd_request_region() 42#define kbd_request_region()
diff --git a/include/asm-sh64/serial.h b/include/asm-sh64/serial.h
index 29c9be15112b..e8d7b3f2da57 100644
--- a/include/asm-sh64/serial.h
+++ b/include/asm-sh64/serial.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-sh/serial.h 2 * include/asm-sh64/serial.h
3 * 3 *
4 * Configuration details for 8250, 16450, 16550, etc. serial ports 4 * Configuration details for 8250, 16450, 16550, etc. serial ports
5 */ 5 */
diff --git a/include/asm-sh64/timex.h b/include/asm-sh64/timex.h
index af0b79269661..163e2b62fe27 100644
--- a/include/asm-sh64/timex.h
+++ b/include/asm-sh64/timex.h
@@ -17,9 +17,6 @@
17 17
18#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ 18#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
19#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ 19#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
20#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
21 (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
22 << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
23 20
24typedef unsigned long cycles_t; 21typedef unsigned long cycles_t;
25 22
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index 9a1590fffc15..ee7828b27ad1 100644
--- a/include/asm-sh64/unistd.h
+++ b/include/asm-sh64/unistd.h
@@ -347,8 +347,10 @@
347#ifdef __KERNEL__ 347#ifdef __KERNEL__
348 348
349#define NR_syscalls 321 349#define NR_syscalls 321
350#include <linux/err.h>
350 351
351/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */ 352/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
353 * see <asm-sh64/errno.h> */
352 354
353#define __syscall_return(type, res) \ 355#define __syscall_return(type, res) \
354do { \ 356do { \
@@ -358,7 +360,7 @@ do { \
358 ** life easier in the system call epilogue (see entry.S) \ 360 ** life easier in the system call epilogue (see entry.S) \
359 */ \ 361 */ \
360 register unsigned long __sr2 __asm__ ("r2") = res; \ 362 register unsigned long __sr2 __asm__ ("r2") = res; \
361 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 363 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
362 errno = -(res); \ 364 errno = -(res); \
363 __sr2 = -1; \ 365 __sr2 = -1; \
364 } \ 366 } \
@@ -511,47 +513,6 @@ __syscall_return(type,__sc0); \
511#define __ARCH_WANT_SYS_SIGPROCMASK 513#define __ARCH_WANT_SYS_SIGPROCMASK
512#define __ARCH_WANT_SYS_RT_SIGACTION 514#define __ARCH_WANT_SYS_RT_SIGACTION
513 515
514#ifdef __KERNEL_SYSCALLS__
515
516/* Copy from sh */
517#include <linux/compiler.h>
518#include <linux/types.h>
519#include <asm/ptrace.h>
520
521/*
522 * we need this inline - forking from kernel space will result
523 * in NO COPY ON WRITE (!!!), until an execve is executed. This
524 * is no problem, but for the stack. This is handled by not letting
525 * main() use the stack at all after fork(). Thus, no function
526 * calls - which means inline code for fork too, as otherwise we
527 * would use the stack upon exit from 'fork()'.
528 *
529 * Actually only pause and fork are needed inline, so that there
530 * won't be any messing with the stack from main(), but we define
531 * some others too.
532 */
533#define __NR__exit __NR_exit
534static inline _syscall0(int,pause)
535static inline _syscall1(int,setup,int,magic)
536static inline _syscall0(int,sync)
537static inline _syscall0(pid_t,setsid)
538static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
539static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
540static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
541static inline _syscall1(int,dup,int,fd)
542static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
543static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
544static inline _syscall1(int,close,int,fd)
545static inline _syscall1(int,_exit,int,exitcode)
546static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
547static inline _syscall1(int,delete_module,const char *,name)
548
549static inline pid_t wait(int * wait_stat)
550{
551 return waitpid(-1,wait_stat,0);
552}
553#endif /* __KERNEL_SYSCALLS__ */
554
555/* 516/*
556 * "Conditional" syscalls 517 * "Conditional" syscalls
557 * 518 *
diff --git a/include/asm-sparc/reg.h b/include/asm-sparc/reg.h
index ed60ebec5930..ea0a7e590bb3 100644
--- a/include/asm-sparc/reg.h
+++ b/include/asm-sparc/reg.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/asm-sparc/reg.h 2 * linux/include/asm-sparc/reg.h
3 * Layout of the registers as expected by gdb on the Sparc 3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in 4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other 5 * this file, we don't even use the other
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 1c75474ba1df..557d08959d2f 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -154,6 +154,10 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
156 156
157#define _raw_spin_relax(lock) cpu_relax()
158#define _raw_read_relax(lock) cpu_relax()
159#define _raw_write_relax(lock) cpu_relax()
160
157#define __raw_read_can_lock(rw) (!((rw)->lock & 0xff)) 161#define __raw_read_can_lock(rw) (!((rw)->lock & 0xff))
158#define __raw_write_can_lock(rw) (!(rw)->lock) 162#define __raw_write_can_lock(rw) (!(rw)->lock)
159 163
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 2553762465ca..c7a495afc82e 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -478,53 +478,6 @@ return -1; \
478#define __ARCH_WANT_SYS_SIGPROCMASK 478#define __ARCH_WANT_SYS_SIGPROCMASK
479#define __ARCH_WANT_SYS_RT_SIGSUSPEND 479#define __ARCH_WANT_SYS_RT_SIGSUSPEND
480 480
481#ifdef __KERNEL_SYSCALLS__
482
483#include <linux/compiler.h>
484#include <linux/types.h>
485
486/*
487 * we need this inline - forking from kernel space will result
488 * in NO COPY ON WRITE (!!!), until an execve is executed. This
489 * is no problem, but for the stack. This is handled by not letting
490 * main() use the stack at all after fork(). Thus, no function
491 * calls - which means inline code for fork too, as otherwise we
492 * would use the stack upon exit from 'fork()'.
493 *
494 * Actually only pause and fork are needed inline, so that there
495 * won't be any messing with the stack from main(), but we define
496 * some others too.
497 */
498#define __NR__exit __NR_exit
499static __inline__ _syscall0(pid_t,setsid)
500static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count)
501static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count)
502static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
503static __inline__ _syscall1(int,dup,int,fd)
504static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp)
505static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode)
506static __inline__ _syscall1(int,close,int,fd)
507static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
508
509#include <linux/linkage.h>
510
511asmlinkage unsigned long sys_mmap(
512 unsigned long addr, unsigned long len,
513 unsigned long prot, unsigned long flags,
514 unsigned long fd, unsigned long off);
515asmlinkage unsigned long sys_mmap2(
516 unsigned long addr, unsigned long len,
517 unsigned long prot, unsigned long flags,
518 unsigned long fd, unsigned long pgoff);
519struct sigaction;
520asmlinkage long sys_rt_sigaction(int sig,
521 const struct sigaction __user *act,
522 struct sigaction __user *oact,
523 void __user *restorer,
524 size_t sigsetsize);
525
526#endif /* __KERNEL_SYSCALLS__ */
527
528/* 481/*
529 * "Conditional" syscalls 482 * "Conditional" syscalls
530 * 483 *
diff --git a/include/asm-sparc64/compat_signal.h b/include/asm-sparc64/compat_signal.h
new file mode 100644
index 000000000000..b759eab9b51c
--- /dev/null
+++ b/include/asm-sparc64/compat_signal.h
@@ -0,0 +1,29 @@
1#ifndef _COMPAT_SIGNAL_H
2#define _COMPAT_SIGNAL_H
3
4#include <linux/compat.h>
5#include <asm/signal.h>
6
7#ifdef CONFIG_COMPAT
8struct __new_sigaction32 {
9 unsigned sa_handler;
10 unsigned int sa_flags;
11 unsigned sa_restorer; /* not used by Linux/SPARC yet */
12 compat_sigset_t sa_mask;
13};
14
15struct __old_sigaction32 {
16 unsigned sa_handler;
17 compat_old_sigset_t sa_mask;
18 unsigned int sa_flags;
19 unsigned sa_restorer; /* not used by Linux/SPARC yet */
20};
21
22typedef struct sigaltstack32 {
23 u32 ss_sp;
24 int ss_flags;
25 compat_size_t ss_size;
26} stack_t32;
27#endif
28
29#endif /* !(_COMPAT_SIGNAL_H) */
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
index 9968871103bc..fa6f467389db 100644
--- a/include/asm-sparc64/signal.h
+++ b/include/asm-sparc64/signal.h
@@ -8,7 +8,6 @@
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9#include <linux/personality.h> 9#include <linux/personality.h>
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/compat.h>
12#endif 11#endif
13#endif 12#endif
14 13
@@ -167,23 +166,6 @@ struct __new_sigaction {
167 __new_sigset_t sa_mask; 166 __new_sigset_t sa_mask;
168}; 167};
169 168
170#ifdef __KERNEL__
171
172#ifdef CONFIG_COMPAT
173struct __new_sigaction32 {
174 unsigned sa_handler;
175 unsigned int sa_flags;
176 unsigned sa_restorer; /* not used by Linux/SPARC yet */
177 compat_sigset_t sa_mask;
178};
179#endif
180
181struct k_sigaction {
182 struct __new_sigaction sa;
183 void __user *ka_restorer;
184};
185#endif
186
187struct __old_sigaction { 169struct __old_sigaction {
188 __sighandler_t sa_handler; 170 __sighandler_t sa_handler;
189 __old_sigset_t sa_mask; 171 __old_sigset_t sa_mask;
@@ -191,19 +173,6 @@ struct __old_sigaction {
191 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */ 173 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
192}; 174};
193 175
194#ifdef __KERNEL__
195
196#ifdef CONFIG_COMPAT
197struct __old_sigaction32 {
198 unsigned sa_handler;
199 compat_old_sigset_t sa_mask;
200 unsigned int sa_flags;
201 unsigned sa_restorer; /* not used by Linux/SPARC yet */
202};
203#endif
204
205#endif
206
207typedef struct sigaltstack { 176typedef struct sigaltstack {
208 void __user *ss_sp; 177 void __user *ss_sp;
209 int ss_flags; 178 int ss_flags;
@@ -212,13 +181,10 @@ typedef struct sigaltstack {
212 181
213#ifdef __KERNEL__ 182#ifdef __KERNEL__
214 183
215#ifdef CONFIG_COMPAT 184struct k_sigaction {
216typedef struct sigaltstack32 { 185 struct __new_sigaction sa;
217 u32 ss_sp; 186 void __user *ka_restorer;
218 int ss_flags; 187};
219 compat_size_t ss_size;
220} stack_t32;
221#endif
222 188
223struct signal_deliver_cookie { 189struct signal_deliver_cookie {
224 int restart_syscall; 190 int restart_syscall;
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index bd5ffc76bc7e..0006fe9f8c7a 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -241,6 +241,10 @@ static int inline __write_trylock(raw_rwlock_t *lock)
241#define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) 241#define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
242#define __raw_write_can_lock(rw) (!(rw)->lock) 242#define __raw_write_can_lock(rw) (!(rw)->lock)
243 243
244#define _raw_spin_relax(lock) cpu_relax()
245#define _raw_read_relax(lock) cpu_relax()
246#define _raw_write_relax(lock) cpu_relax()
247
244#endif /* !(__ASSEMBLY__) */ 248#endif /* !(__ASSEMBLY__) */
245 249
246#endif /* !(__SPARC64_SPINLOCK_H) */ 250#endif /* !(__SPARC64_SPINLOCK_H) */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index badc73fdcb97..124cf076717f 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -445,48 +445,6 @@ if (__res>=0) \
445errno = -__res; \ 445errno = -__res; \
446return -1; \ 446return -1; \
447} 447}
448#ifdef __KERNEL_SYSCALLS__
449
450#include <linux/compiler.h>
451#include <linux/types.h>
452
453/*
454 * we need this inline - forking from kernel space will result
455 * in NO COPY ON WRITE (!!!), until an execve is executed. This
456 * is no problem, but for the stack. This is handled by not letting
457 * main() use the stack at all after fork(). Thus, no function
458 * calls - which means inline code for fork too, as otherwise we
459 * would use the stack upon exit from 'fork()'.
460 *
461 * Actually only pause and fork are needed inline, so that there
462 * won't be any messing with the stack from main(), but we define
463 * some others too.
464 */
465#define __NR__exit __NR_exit
466static __inline__ _syscall0(pid_t,setsid)
467static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count)
468static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count)
469static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
470static __inline__ _syscall1(int,dup,int,fd)
471static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp)
472static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode)
473static __inline__ _syscall1(int,close,int,fd)
474static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
475
476#include <linux/linkage.h>
477
478asmlinkage unsigned long sys_mmap(
479 unsigned long addr, unsigned long len,
480 unsigned long prot, unsigned long flags,
481 unsigned long fd, unsigned long off);
482struct sigaction;
483asmlinkage long sys_rt_sigaction(int sig,
484 const struct sigaction __user *act,
485 struct sigaction __user *oact,
486 void __user *restorer,
487 size_t sigsetsize);
488
489#endif /* __KERNEL_SYSCALLS__ */
490 448
491/* sysconf options, for SunOS compatibility */ 449/* sysconf options, for SunOS compatibility */
492#define _SC_ARG_MAX 1 450#define _SC_ARG_MAX 1
diff --git a/include/asm-um/alternative-asm.i b/include/asm-um/alternative-asm.i
new file mode 100644
index 000000000000..cae9faca132f
--- /dev/null
+++ b/include/asm-um/alternative-asm.i
@@ -0,0 +1,6 @@
1#ifndef __UM_ALTERNATIVE_ASM_I
2#define __UM_ALTERNATIVE_ASM_I
3
4#include "asm/arch/alternative-asm.i"
5
6#endif
diff --git a/include/asm-um/frame.i b/include/asm-um/frame.i
new file mode 100644
index 000000000000..09d5dca5d928
--- /dev/null
+++ b/include/asm-um/frame.i
@@ -0,0 +1,6 @@
1#ifndef __UM_FRAME_I
2#define __UM_FRAME_I
3
4#include "asm/arch/frame.i"
5
6#endif
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index 4862daf8b906..188f72621776 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -274,12 +274,6 @@ static inline pte_t pte_mkread(pte_t pte)
274 return(pte_mknewprot(pte)); 274 return(pte_mknewprot(pte));
275} 275}
276 276
277static inline pte_t pte_mkexec(pte_t pte)
278{
279 pte_set_bits(pte, _PAGE_USER);
280 return(pte_mknewprot(pte));
281}
282
283static inline pte_t pte_mkdirty(pte_t pte) 277static inline pte_t pte_mkdirty(pte_t pte)
284{ 278{
285 pte_set_bits(pte, _PAGE_DIRTY); 279 pte_set_bits(pte, _PAGE_DIRTY);
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index afa4fe1ca9f1..d99bbddffdb9 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -13,6 +13,7 @@ struct task_struct;
13#include "asm/ptrace.h" 13#include "asm/ptrace.h"
14#include "choose-mode.h" 14#include "choose-mode.h"
15#include "registers.h" 15#include "registers.h"
16#include "sysdep/archsetjmp.h"
16 17
17struct mm_struct; 18struct mm_struct;
18 19
@@ -43,8 +44,7 @@ struct thread_struct {
43#endif 44#endif
44#ifdef CONFIG_MODE_SKAS 45#ifdef CONFIG_MODE_SKAS
45 struct { 46 struct {
46 void *switch_buf; 47 jmp_buf switch_buf;
47 void *fork_buf;
48 int mm_count; 48 int mm_count;
49 } skas; 49 } skas;
50#endif 50#endif
@@ -138,7 +138,7 @@ extern struct cpuinfo_um cpu_data[];
138 138
139#ifdef CONFIG_MODE_SKAS 139#ifdef CONFIG_MODE_SKAS
140#define KSTK_REG(tsk, reg) \ 140#define KSTK_REG(tsk, reg) \
141 get_thread_reg(reg, tsk->thread.mode.skas.switch_buf) 141 get_thread_reg(reg, &tsk->thread.mode.skas.switch_buf)
142#else 142#else
143#define KSTK_REG(tsk, reg) (0xbadbabe) 143#define KSTK_REG(tsk, reg) (0xbadbabe)
144#endif 144#endif
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h
index 2074483e6ca4..03b4af4ac09a 100644
--- a/include/asm-um/ptrace-x86_64.h
+++ b/include/asm-um/ptrace-x86_64.h
@@ -16,12 +16,15 @@
16 16
17#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 17#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
18 18
19/* Also defined in sysdep/ptrace.h, so may already be defined. */
20#ifndef FS_BASE
19#define FS_BASE (21 * sizeof(unsigned long)) 21#define FS_BASE (21 * sizeof(unsigned long))
20#define GS_BASE (22 * sizeof(unsigned long)) 22#define GS_BASE (22 * sizeof(unsigned long))
21#define DS (23 * sizeof(unsigned long)) 23#define DS (23 * sizeof(unsigned long))
22#define ES (24 * sizeof(unsigned long)) 24#define ES (24 * sizeof(unsigned long))
23#define FS (25 * sizeof(unsigned long)) 25#define FS (25 * sizeof(unsigned long))
24#define GS (26 * sizeof(unsigned long)) 26#define GS (26 * sizeof(unsigned long))
27#endif
25 28
26#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs) 29#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs)
27#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs) 30#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs)
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h
index afccfcaa9ea9..732c83f04c3d 100644
--- a/include/asm-um/unistd.h
+++ b/include/asm-um/unistd.h
@@ -37,34 +37,6 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]);
37#define __ARCH_WANT_SYS_RT_SIGSUSPEND 37#define __ARCH_WANT_SYS_RT_SIGSUSPEND
38#endif 38#endif
39 39
40#ifdef __KERNEL_SYSCALLS__
41
42#include <linux/compiler.h>
43#include <linux/types.h>
44
45static inline int execve(const char *filename, char *const argv[],
46 char *const envp[])
47{
48 mm_segment_t fs;
49 int ret;
50
51 fs = get_fs();
52 set_fs(KERNEL_DS);
53 ret = um_execve(filename, argv, envp);
54 set_fs(fs);
55
56 if (ret >= 0)
57 return ret;
58
59 errno = -(long)ret;
60 return -1;
61}
62
63int sys_execve(char *file, char **argv, char **env);
64
65#endif /* __KERNEL_SYSCALLS__ */
66
67#undef __KERNEL_SYSCALLS__
68#include "asm/arch/unistd.h" 40#include "asm/arch/unistd.h"
69 41
70#endif /* _UM_UNISTD_H_*/ 42#endif /* _UM_UNISTD_H_*/
diff --git a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h
index bcb44bfe577a..737401e7d3ad 100644
--- a/include/asm-v850/unistd.h
+++ b/include/asm-v850/unistd.h
@@ -238,12 +238,13 @@
238#ifdef __KERNEL__ 238#ifdef __KERNEL__
239 239
240#include <asm/clinkage.h> 240#include <asm/clinkage.h>
241#include <linux/err.h>
241 242
242#define __syscall_return(type, res) \ 243#define __syscall_return(type, res) \
243 do { \ 244 do { \
244 /* user-visible error numbers are in the range -1 - -124: \ 245 /* user-visible error numbers are in the range -1 - -MAX_ERRNO: \
245 see <asm-v850/errno.h> */ \ 246 see <asm-v850/errno.h> */ \
246 if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-125), 0)) { \ 247 if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO), 0)) { \
247 errno = -(res); \ 248 errno = -(res); \
248 res = -1; \ 249 res = -1; \
249 } \ 250 } \
@@ -386,57 +387,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
386#define __ARCH_WANT_SYS_SIGPROCMASK 387#define __ARCH_WANT_SYS_SIGPROCMASK
387#define __ARCH_WANT_SYS_RT_SIGACTION 388#define __ARCH_WANT_SYS_RT_SIGACTION
388 389
389#ifdef __KERNEL_SYSCALLS__
390
391#include <linux/compiler.h>
392#include <linux/types.h>
393
394/*
395 * we need this inline - forking from kernel space will result
396 * in NO COPY ON WRITE (!!!), until an execve is executed. This
397 * is no problem, but for the stack. This is handled by not letting
398 * main() use the stack at all after fork(). Thus, no function
399 * calls - which means inline code for fork too, as otherwise we
400 * would use the stack upon exit from 'fork()'.
401 *
402 * Actually only pause and fork are needed inline, so that there
403 * won't be any messing with the stack from main(), but we define
404 * some others too.
405 */
406#define __NR__exit __NR_exit
407extern inline _syscall0(pid_t,setsid)
408extern inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
409extern inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
410extern inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
411extern inline _syscall1(int,dup,int,fd)
412extern inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
413extern inline _syscall3(int,open,const char *,file,int,flag,int,mode)
414extern inline _syscall1(int,close,int,fd)
415extern inline _syscall1(int,_exit,int,exitcode)
416extern inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
417
418extern inline pid_t wait(int * wait_stat)
419{
420 return waitpid (-1, wait_stat, 0);
421}
422
423unsigned long sys_mmap(unsigned long addr, size_t len,
424 unsigned long prot, unsigned long flags,
425 unsigned long fd, off_t offset);
426unsigned long sys_mmap2(unsigned long addr, size_t len,
427 unsigned long prot, unsigned long flags,
428 unsigned long fd, unsigned long pgoff);
429struct pt_regs;
430int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs);
431int sys_pipe (int *fildes);
432struct sigaction;
433asmlinkage long sys_rt_sigaction(int sig,
434 const struct sigaction __user *act,
435 struct sigaction __user *oact,
436 size_t sigsetsize);
437
438#endif /* __KERNEL_SYSCALLS__ */
439
440/* 390/*
441 * "Conditional" syscalls 391 * "Conditional" syscalls
442 */ 392 */
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index 2c95a319c056..ed59aa4c6ff9 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -155,8 +155,6 @@ extern void acpi_reserve_bootmem(void);
155 155
156#endif /*CONFIG_ACPI_SLEEP*/ 156#endif /*CONFIG_ACPI_SLEEP*/
157 157
158#define boot_cpu_physical_apicid boot_cpu_id
159
160extern int acpi_disabled; 158extern int acpi_disabled;
161extern int acpi_pci_disabled; 159extern int acpi_pci_disabled;
162 160
diff --git a/include/asm-x86_64/alternative-asm.i b/include/asm-x86_64/alternative-asm.i
new file mode 100644
index 000000000000..0b3f1a2bb2cb
--- /dev/null
+++ b/include/asm-x86_64/alternative-asm.i
@@ -0,0 +1,12 @@
1#ifdef CONFIG_SMP
2 .macro LOCK_PREFIX
31: lock
4 .section .smp_locks,"a"
5 .align 8
6 .quad 1b
7 .previous
8 .endm
9#else
10 .macro LOCK_PREFIX
11 .endm
12#endif
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index 9c96a0a8d1bd..9e66d32330c9 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -17,6 +17,8 @@
17 17
18extern int apic_verbosity; 18extern int apic_verbosity;
19extern int apic_runs_main_timer; 19extern int apic_runs_main_timer;
20extern int ioapic_force;
21extern int apic_mapped;
20 22
21/* 23/*
22 * Define the default level of output to be very little 24 * Define the default level of output to be very little
@@ -29,8 +31,6 @@ extern int apic_runs_main_timer;
29 printk(s, ##a); \ 31 printk(s, ##a); \
30 } while (0) 32 } while (0)
31 33
32#ifdef CONFIG_X86_LOCAL_APIC
33
34struct pt_regs; 34struct pt_regs;
35 35
36/* 36/*
@@ -95,17 +95,12 @@ extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
95#define K8_APIC_EXT_INT_MSG_EXT 0x7 95#define K8_APIC_EXT_INT_MSG_EXT 0x7
96#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 96#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0
97 97
98extern int disable_timer_pin_1;
99
100
101void smp_send_timer_broadcast_ipi(void); 98void smp_send_timer_broadcast_ipi(void);
102void switch_APIC_timer_to_ipi(void *cpumask); 99void switch_APIC_timer_to_ipi(void *cpumask);
103void switch_ipi_to_APIC_timer(void *cpumask); 100void switch_ipi_to_APIC_timer(void *cpumask);
104 101
105#define ARCH_APICTIMER_STOPS_ON_C3 1 102#define ARCH_APICTIMER_STOPS_ON_C3 1
106 103
107#endif /* CONFIG_X86_LOCAL_APIC */
108
109extern unsigned boot_cpu_id; 104extern unsigned boot_cpu_id;
110 105
111#endif /* __ASM_APIC_H */ 106#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index f7ba57b1cc08..5b535eaf5309 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -399,6 +399,8 @@ static __inline__ int fls(int x)
399 return r+1; 399 return r+1;
400} 400}
401 401
402#define ARCH_HAS_FAST_MULTIPLIER 1
403
402#include <asm-generic/bitops/hweight.h> 404#include <asm-generic/bitops/hweight.h>
403 405
404#endif /* __KERNEL__ */ 406#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h
index ed8a9d25272d..052df758ae61 100644
--- a/include/asm-x86_64/cache.h
+++ b/include/asm-x86_64/cache.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-x8664/cache.h 2 * include/asm-x86_64/cache.h
3 */ 3 */
4#ifndef __ARCH_X8664_CACHE_H 4#ifndef __ARCH_X8664_CACHE_H
5#define __ARCH_X8664_CACHE_H 5#define __ARCH_X8664_CACHE_H
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h
index 4e3919524240..6b93f5a3a5c8 100644
--- a/include/asm-x86_64/calgary.h
+++ b/include/asm-x86_64/calgary.h
@@ -24,7 +24,6 @@
24#ifndef _ASM_X86_64_CALGARY_H 24#ifndef _ASM_X86_64_CALGARY_H
25#define _ASM_X86_64_CALGARY_H 25#define _ASM_X86_64_CALGARY_H
26 26
27#include <linux/config.h>
28#include <linux/spinlock.h> 27#include <linux/spinlock.h>
29#include <linux/device.h> 28#include <linux/device.h>
30#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
@@ -34,12 +33,12 @@ struct iommu_table {
34 unsigned long it_base; /* mapped address of tce table */ 33 unsigned long it_base; /* mapped address of tce table */
35 unsigned long it_hint; /* Hint for next alloc */ 34 unsigned long it_hint; /* Hint for next alloc */
36 unsigned long *it_map; /* A simple allocation bitmap for now */ 35 unsigned long *it_map; /* A simple allocation bitmap for now */
36 void __iomem *bbar; /* Bridge BAR */
37 u64 tar_val; /* Table Address Register */
38 struct timer_list watchdog_timer;
37 spinlock_t it_lock; /* Protects it_map */ 39 spinlock_t it_lock; /* Protects it_map */
38 unsigned int it_size; /* Size of iommu table in entries */ 40 unsigned int it_size; /* Size of iommu table in entries */
39 unsigned char it_busno; /* Bus number this table belongs to */ 41 unsigned char it_busno; /* Bus number this table belongs to */
40 void __iomem *bbar;
41 u64 tar_val;
42 struct timer_list watchdog_timer;
43}; 42};
44 43
45#define TCE_TABLE_SIZE_UNSPECIFIED ~0 44#define TCE_TABLE_SIZE_UNSPECIFIED ~0
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index b6da83dcc7a6..10174b110a5c 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -55,13 +55,6 @@ extern dma_addr_t bad_dma_address;
55extern struct dma_mapping_ops* dma_ops; 55extern struct dma_mapping_ops* dma_ops;
56extern int iommu_merge; 56extern int iommu_merge;
57 57
58static inline int valid_dma_direction(int dma_direction)
59{
60 return ((dma_direction == DMA_BIDIRECTIONAL) ||
61 (dma_direction == DMA_TO_DEVICE) ||
62 (dma_direction == DMA_FROM_DEVICE));
63}
64
65static inline int dma_mapping_error(dma_addr_t dma_addr) 58static inline int dma_mapping_error(dma_addr_t dma_addr)
66{ 59{
67 if (dma_ops->mapping_error) 60 if (dma_ops->mapping_error)
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h
index 0744db777676..eedc08526b0b 100644
--- a/include/asm-x86_64/dwarf2.h
+++ b/include/asm-x86_64/dwarf2.h
@@ -13,7 +13,7 @@
13 away for older version. 13 away for older version.
14 */ 14 */
15 15
16#ifdef CONFIG_UNWIND_INFO 16#ifdef CONFIG_AS_CFI
17 17
18#define CFI_STARTPROC .cfi_startproc 18#define CFI_STARTPROC .cfi_startproc
19#define CFI_ENDPROC .cfi_endproc 19#define CFI_ENDPROC .cfi_endproc
@@ -28,6 +28,11 @@
28#define CFI_REMEMBER_STATE .cfi_remember_state 28#define CFI_REMEMBER_STATE .cfi_remember_state
29#define CFI_RESTORE_STATE .cfi_restore_state 29#define CFI_RESTORE_STATE .cfi_restore_state
30#define CFI_UNDEFINED .cfi_undefined 30#define CFI_UNDEFINED .cfi_undefined
31#ifdef CONFIG_AS_CFI_SIGNAL_FRAME
32#define CFI_SIGNAL_FRAME .cfi_signal_frame
33#else
34#define CFI_SIGNAL_FRAME
35#endif
31 36
32#else 37#else
33 38
@@ -45,6 +50,7 @@
45#define CFI_REMEMBER_STATE # 50#define CFI_REMEMBER_STATE #
46#define CFI_RESTORE_STATE # 51#define CFI_RESTORE_STATE #
47#define CFI_UNDEFINED # 52#define CFI_UNDEFINED #
53#define CFI_SIGNAL_FRAME #
48 54
49#endif 55#endif
50 56
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index f65674832318..fa2086774105 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -19,13 +19,9 @@
19 19
20#define E820_RAM 1 20#define E820_RAM 1
21#define E820_RESERVED 2 21#define E820_RESERVED 2
22#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ 22#define E820_ACPI 3
23#define E820_NVS 4 23#define E820_NVS 4
24 24
25#define HIGH_MEMORY (1024*1024)
26
27#define LOWMEMSIZE() (0x9f000)
28
29#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
30struct e820entry { 26struct e820entry {
31 u64 addr; /* start of memory segment */ 27 u64 addr; /* start of memory segment */
@@ -51,13 +47,11 @@ extern void e820_print_map(char *who);
51extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); 47extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
52extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); 48extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
53 49
54extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
55extern void e820_setup_gap(void); 50extern void e820_setup_gap(void);
56extern unsigned long e820_hole_size(unsigned long start_pfn, 51extern void e820_register_active_regions(int nid,
57 unsigned long end_pfn); 52 unsigned long start_pfn, unsigned long end_pfn);
58 53
59extern void __init parse_memopt(char *p, char **end); 54extern void finish_e820_parsing(void);
60extern void __init parse_memmapopt(char *p, char **end);
61 55
62extern struct e820map e820; 56extern struct e820map e820;
63 57
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
index 0b4ffbd1a125..1b620db5b9e3 100644
--- a/include/asm-x86_64/fixmap.h
+++ b/include/asm-x86_64/fixmap.h
@@ -37,13 +37,9 @@ enum fixed_addresses {
37 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, 37 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
38 VSYSCALL_HPET, 38 VSYSCALL_HPET,
39 FIX_HPET_BASE, 39 FIX_HPET_BASE,
40#ifdef CONFIG_X86_LOCAL_APIC
41 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ 40 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
42#endif
43#ifdef CONFIG_X86_IO_APIC
44 FIX_IO_APIC_BASE_0, 41 FIX_IO_APIC_BASE_0,
45 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, 42 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
46#endif
47 __end_of_fixed_addresses 43 __end_of_fixed_addresses
48}; 44};
49 45
diff --git a/include/asm-x86_64/genapic.h b/include/asm-x86_64/genapic.h
index 50b38e7c58e4..81e714665344 100644
--- a/include/asm-x86_64/genapic.h
+++ b/include/asm-x86_64/genapic.h
@@ -16,7 +16,6 @@ struct genapic {
16 char *name; 16 char *name;
17 u32 int_delivery_mode; 17 u32 int_delivery_mode;
18 u32 int_dest_mode; 18 u32 int_dest_mode;
19 u32 int_delivery_dest; /* for quick IPIs */
20 int (*apic_id_registered)(void); 19 int (*apic_id_registered)(void);
21 cpumask_t (*target_cpus)(void); 20 cpumask_t (*target_cpus)(void);
22 void (*init_apic_ldr)(void); 21 void (*init_apic_ldr)(void);
diff --git a/include/asm-x86_64/hardirq.h b/include/asm-x86_64/hardirq.h
index 64a65ce2f41f..95d5e090ed89 100644
--- a/include/asm-x86_64/hardirq.h
+++ b/include/asm-x86_64/hardirq.h
@@ -6,6 +6,9 @@
6#include <asm/pda.h> 6#include <asm/pda.h>
7#include <asm/apic.h> 7#include <asm/apic.h>
8 8
9/* We can have at most NR_VECTORS irqs routed to a cpu at a time */
10#define MAX_HARDIRQS_PER_CPU NR_VECTORS
11
9#define __ARCH_IRQ_STAT 1 12#define __ARCH_IRQ_STAT 1
10 13
11#define local_softirq_pending() read_pda(__softirq_pending) 14#define local_softirq_pending() read_pda(__softirq_pending)
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 48a4a5364e85..53d0d9fd10d6 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -19,8 +19,7 @@
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <linux/profile.h> 20#include <linux/profile.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22 22#include <linux/percpu.h>
23struct hw_interrupt_type;
24#endif 23#endif
25 24
26#define NMI_VECTOR 0x02 25#define NMI_VECTOR 0x02
@@ -75,9 +74,10 @@ struct hw_interrupt_type;
75 74
76 75
77#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
78extern u8 irq_vector[NR_IRQ_VECTORS]; 77extern unsigned int irq_vector[NR_IRQ_VECTORS];
78typedef int vector_irq_t[NR_VECTORS];
79DECLARE_PER_CPU(vector_irq_t, vector_irq);
79#define IO_APIC_VECTOR(irq) (irq_vector[irq]) 80#define IO_APIC_VECTOR(irq) (irq_vector[irq])
80#define AUTO_ASSIGN -1
81 81
82/* 82/*
83 * Various low-level irq details needed by irq.c, process.c, 83 * Various low-level irq details needed by irq.c, process.c,
diff --git a/include/asm-x86_64/hypertransport.h b/include/asm-x86_64/hypertransport.h
new file mode 100644
index 000000000000..c16c6ff4bdd7
--- /dev/null
+++ b/include/asm-x86_64/hypertransport.h
@@ -0,0 +1,42 @@
1#ifndef ASM_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/i387.h b/include/asm-x86_64/i387.h
index cba8a3b0cded..0217b74cc9fc 100644
--- a/include/asm-x86_64/i387.h
+++ b/include/asm-x86_64/i387.h
@@ -24,6 +24,7 @@ extern unsigned int mxcsr_feature_mask;
24extern void mxcsr_feature_mask_init(void); 24extern void mxcsr_feature_mask_init(void);
25extern void init_fpu(struct task_struct *child); 25extern void init_fpu(struct task_struct *child);
26extern int save_i387(struct _fpstate __user *buf); 26extern int save_i387(struct _fpstate __user *buf);
27extern asmlinkage void math_state_restore(void);
27 28
28/* 29/*
29 * FPU lazy state save handling... 30 * FPU lazy state save handling...
@@ -31,7 +32,9 @@ extern int save_i387(struct _fpstate __user *buf);
31 32
32#define unlazy_fpu(tsk) do { \ 33#define unlazy_fpu(tsk) do { \
33 if (task_thread_info(tsk)->status & TS_USEDFPU) \ 34 if (task_thread_info(tsk)->status & TS_USEDFPU) \
34 save_init_fpu(tsk); \ 35 save_init_fpu(tsk); \
36 else \
37 tsk->fpu_counter = 0; \
35} while (0) 38} while (0)
36 39
37/* Ignore delayed exceptions from user space */ 40/* Ignore delayed exceptions from user space */
@@ -134,8 +137,8 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
134#else 137#else
135 : [fx] "cdaSDb" (fx), "0" (0)); 138 : [fx] "cdaSDb" (fx), "0" (0));
136#endif 139#endif
137 if (unlikely(err)) 140 if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct)))
138 __clear_user(fx, sizeof(struct i387_fxsave_struct)); 141 err = -EFAULT;
139 /* No need to clear here because the caller clears USED_MATH */ 142 /* No need to clear here because the caller clears USED_MATH */
140 return err; 143 return err;
141} 144}
diff --git a/include/asm-x86_64/intel_arch_perfmon.h b/include/asm-x86_64/intel_arch_perfmon.h
index 59c396431569..8633331420ec 100644
--- a/include/asm-x86_64/intel_arch_perfmon.h
+++ b/include/asm-x86_64/intel_arch_perfmon.h
@@ -14,6 +14,18 @@
14 14
15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) 15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c)
16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) 16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
17#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) 17#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0)
18#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
19 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
20
21union cpuid10_eax {
22 struct {
23 unsigned int version_id:8;
24 unsigned int num_counters:8;
25 unsigned int bit_width:8;
26 unsigned int mask_length:8;
27 } split;
28 unsigned int full;
29};
18 30
19#endif /* X86_64_INTEL_ARCH_PERFMON_H */ 31#endif /* X86_64_INTEL_ARCH_PERFMON_H */
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index fb7a0909a174..171ec2dc8c04 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -10,48 +10,6 @@
10 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar 10 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
11 */ 11 */
12 12
13#ifdef CONFIG_X86_IO_APIC
14
15#ifdef CONFIG_PCI_MSI
16static inline int use_pci_vector(void) {return 1;}
17static inline void disable_edge_ioapic_vector(unsigned int vector) { }
18static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { }
19static inline void end_edge_ioapic_vector (unsigned int vector) { }
20#define startup_level_ioapic startup_level_ioapic_vector
21#define shutdown_level_ioapic mask_IO_APIC_vector
22#define enable_level_ioapic unmask_IO_APIC_vector
23#define disable_level_ioapic mask_IO_APIC_vector
24#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_vector
25#define end_level_ioapic end_level_ioapic_vector
26#define set_ioapic_affinity set_ioapic_affinity_vector
27
28#define startup_edge_ioapic startup_edge_ioapic_vector
29#define shutdown_edge_ioapic disable_edge_ioapic_vector
30#define enable_edge_ioapic unmask_IO_APIC_vector
31#define disable_edge_ioapic disable_edge_ioapic_vector
32#define ack_edge_ioapic ack_edge_ioapic_vector
33#define end_edge_ioapic end_edge_ioapic_vector
34#else
35static inline int use_pci_vector(void) {return 0;}
36static inline void disable_edge_ioapic_irq(unsigned int irq) { }
37static inline void mask_and_ack_level_ioapic_irq(unsigned int irq) { }
38static inline void end_edge_ioapic_irq (unsigned int irq) { }
39#define startup_level_ioapic startup_level_ioapic_irq
40#define shutdown_level_ioapic mask_IO_APIC_irq
41#define enable_level_ioapic unmask_IO_APIC_irq
42#define disable_level_ioapic mask_IO_APIC_irq
43#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_irq
44#define end_level_ioapic end_level_ioapic_irq
45#define set_ioapic_affinity set_ioapic_affinity_irq
46
47#define startup_edge_ioapic startup_edge_ioapic_irq
48#define shutdown_edge_ioapic disable_edge_ioapic_irq
49#define enable_edge_ioapic unmask_IO_APIC_irq
50#define disable_edge_ioapic disable_edge_ioapic_irq
51#define ack_edge_ioapic ack_edge_ioapic_irq
52#define end_edge_ioapic end_edge_ioapic_irq
53#endif
54
55#define APIC_MISMATCH_DEBUG 13#define APIC_MISMATCH_DEBUG
56 14
57#define IO_APIC_BASE(idx) \ 15#define IO_APIC_BASE(idx) \
@@ -204,17 +162,10 @@ extern int skip_ioapic_setup;
204extern int io_apic_get_version (int ioapic); 162extern int io_apic_get_version (int ioapic);
205extern int io_apic_get_redir_entries (int ioapic); 163extern int io_apic_get_redir_entries (int ioapic);
206extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int); 164extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
207extern int timer_uses_ioapic_pin_0;
208#endif 165#endif
209 166
210extern int sis_apic_bug; /* dummy */ 167extern int sis_apic_bug; /* dummy */
211 168
212#else /* !CONFIG_X86_IO_APIC */
213#define io_apic_assign_pci_irqs 0
214#endif
215
216extern int assign_irq_vector(int irq);
217
218void enable_NMI_through_LVT0 (void * dummy); 169void enable_NMI_through_LVT0 (void * dummy);
219 170
220extern spinlock_t i8259A_lock; 171extern spinlock_t i8259A_lock;
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h
index 9db5a1b4f7b1..5006c6e75656 100644
--- a/include/asm-x86_64/irq.h
+++ b/include/asm-x86_64/irq.h
@@ -31,22 +31,15 @@
31 31
32#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in hw_irq.h */ 32#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in hw_irq.h */
33 33
34#ifdef CONFIG_PCI_MSI 34#define NR_IRQS (NR_VECTORS + (32 *NR_CPUS))
35#define NR_IRQS FIRST_SYSTEM_VECTOR
36#define NR_IRQ_VECTORS NR_IRQS 35#define NR_IRQ_VECTORS NR_IRQS
37#else
38#define NR_IRQS 224
39#define NR_IRQ_VECTORS (32 * NR_CPUS)
40#endif
41 36
42static __inline__ int irq_canonicalize(int irq) 37static __inline__ int irq_canonicalize(int irq)
43{ 38{
44 return ((irq == 2) ? 9 : irq); 39 return ((irq == 2) ? 9 : irq);
45} 40}
46 41
47#ifdef CONFIG_X86_LOCAL_APIC
48#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ 42#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
49#endif
50 43
51#ifdef CONFIG_HOTPLUG_CPU 44#ifdef CONFIG_HOTPLUG_CPU
52#include <linux/cpumask.h> 45#include <linux/cpumask.h>
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h
index c564bae03433..5fab957e1091 100644
--- a/include/asm-x86_64/kexec.h
+++ b/include/asm-x86_64/kexec.h
@@ -1,6 +1,27 @@
1#ifndef _X86_64_KEXEC_H 1#ifndef _X86_64_KEXEC_H
2#define _X86_64_KEXEC_H 2#define _X86_64_KEXEC_H
3 3
4#define PA_CONTROL_PAGE 0
5#define VA_CONTROL_PAGE 1
6#define PA_PGD 2
7#define VA_PGD 3
8#define PA_PUD_0 4
9#define VA_PUD_0 5
10#define PA_PMD_0 6
11#define VA_PMD_0 7
12#define PA_PTE_0 8
13#define VA_PTE_0 9
14#define PA_PUD_1 10
15#define VA_PUD_1 11
16#define PA_PMD_1 12
17#define VA_PMD_1 13
18#define PA_PTE_1 14
19#define VA_PTE_1 15
20#define PA_TABLE_PAGE 16
21#define PAGES_NR 17
22
23#ifndef __ASSEMBLY__
24
4#include <linux/string.h> 25#include <linux/string.h>
5 26
6#include <asm/page.h> 27#include <asm/page.h>
@@ -64,4 +85,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
64 newregs->rip = (unsigned long)current_text_addr(); 85 newregs->rip = (unsigned long)current_text_addr();
65 } 86 }
66} 87}
88
89NORET_TYPE void
90relocate_kernel(unsigned long indirection_page,
91 unsigned long page_list,
92 unsigned long start_address) ATTRIB_NORET;
93
94#endif /* __ASSEMBLY__ */
95
67#endif /* _X86_64_KEXEC_H */ 96#endif /* _X86_64_KEXEC_H */
diff --git a/include/asm-x86_64/linkage.h b/include/asm-x86_64/linkage.h
index 291c2d01c44f..b5f39d0189ce 100644
--- a/include/asm-x86_64/linkage.h
+++ b/include/asm-x86_64/linkage.h
@@ -1,6 +1,6 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#define __ALIGN .p2align 4,,15
5 5
6#endif 6#endif
diff --git a/include/asm-x86_64/mach_apic.h b/include/asm-x86_64/mach_apic.h
index 0acea44c9377..d33422450c00 100644
--- a/include/asm-x86_64/mach_apic.h
+++ b/include/asm-x86_64/mach_apic.h
@@ -16,7 +16,6 @@
16 16
17#define INT_DELIVERY_MODE (genapic->int_delivery_mode) 17#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
18#define INT_DEST_MODE (genapic->int_dest_mode) 18#define INT_DEST_MODE (genapic->int_dest_mode)
19#define INT_DELIVERY_DEST (genapic->int_delivery_dest)
20#define TARGET_CPUS (genapic->target_cpus()) 19#define TARGET_CPUS (genapic->target_cpus())
21#define apic_id_registered (genapic->apic_id_registered) 20#define apic_id_registered (genapic->apic_id_registered)
22#define init_apic_ldr (genapic->init_apic_ldr) 21#define init_apic_ldr (genapic->init_apic_ldr)
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index d13687dfd691..5a11146d6d9c 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -99,6 +99,8 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c)
99} 99}
100#endif 100#endif
101 101
102void mce_log_therm_throt_event(unsigned int cpu, __u64 status);
103
102extern atomic_t mce_entry; 104extern atomic_t mce_entry;
103 105
104#endif 106#endif
diff --git a/include/asm-x86_64/mmx.h b/include/asm-x86_64/mmx.h
deleted file mode 100644
index 46b71da99869..000000000000
--- a/include/asm-x86_64/mmx.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_MMX_H
2#define _ASM_MMX_H
3
4/*
5 * MMX 3Dnow! helper operations
6 */
7
8#include <linux/types.h>
9
10extern void *_mmx_memcpy(void *to, const void *from, size_t size);
11extern void mmx_clear_page(void *page);
12extern void mmx_copy_page(void *to, void *from);
13
14#endif
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h
index 14fc3ddd9031..017fddb61dc5 100644
--- a/include/asm-x86_64/mpspec.h
+++ b/include/asm-x86_64/mpspec.h
@@ -159,13 +159,7 @@ struct mpc_config_lintsrc
159#define MAX_MP_BUSSES 256 159#define MAX_MP_BUSSES 256
160/* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ 160/* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
161#define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) 161#define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
162enum mp_bustype { 162extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
163 MP_BUS_ISA = 1,
164 MP_BUS_EISA,
165 MP_BUS_PCI,
166 MP_BUS_MCA
167};
168extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES];
169extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; 163extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
170 164
171extern unsigned int boot_cpu_physical_apicid; 165extern unsigned int boot_cpu_physical_apicid;
@@ -178,18 +172,15 @@ extern int mp_irq_entries;
178extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; 172extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
179extern int mpc_default_type; 173extern int mpc_default_type;
180extern unsigned long mp_lapic_addr; 174extern unsigned long mp_lapic_addr;
181extern int pic_mode;
182 175
183#ifdef CONFIG_ACPI 176#ifdef CONFIG_ACPI
184extern void mp_register_lapic (u8 id, u8 enabled); 177extern void mp_register_lapic (u8 id, u8 enabled);
185extern void mp_register_lapic_address (u64 address); 178extern void mp_register_lapic_address (u64 address);
186 179
187#ifdef CONFIG_X86_IO_APIC
188extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); 180extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
189extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); 181extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
190extern void mp_config_acpi_legacy_irqs (void); 182extern void mp_config_acpi_legacy_irqs (void);
191extern int mp_register_gsi (u32 gsi, int triggering, int polarity); 183extern int mp_register_gsi (u32 gsi, int triggering, int polarity);
192#endif /*CONFIG_X86_IO_APIC*/
193#endif 184#endif
194 185
195extern int using_apic_timer; 186extern int using_apic_timer;
diff --git a/include/asm-x86_64/msi.h b/include/asm-x86_64/msi.h
deleted file mode 100644
index 3ad2346624b2..000000000000
--- a/include/asm-x86_64/msi.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2003-2004 Intel
3 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
4 */
5
6#ifndef ASM_MSI_H
7#define ASM_MSI_H
8
9#include <asm/desc.h>
10#include <asm/mach_apic.h>
11#include <asm/smp.h>
12
13#define LAST_DEVICE_VECTOR (FIRST_SYSTEM_VECTOR - 1)
14#define MSI_TARGET_CPU_SHIFT 12
15
16extern struct msi_ops msi_apic_ops;
17
18static inline int msi_arch_init(void)
19{
20 msi_register(&msi_apic_ops);
21 return 0;
22}
23
24#endif /* ASM_MSI_H */
diff --git a/include/asm-x86_64/msidef.h b/include/asm-x86_64/msidef.h
new file mode 100644
index 000000000000..5b8acddb70fb
--- /dev/null
+++ b/include/asm-x86_64/msidef.h
@@ -0,0 +1,47 @@
1#ifndef ASM_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/msr.h b/include/asm-x86_64/msr.h
index 10f8b51cec8b..37e194169fac 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -66,14 +66,25 @@
66#define rdtscl(low) \ 66#define rdtscl(low) \
67 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") 67 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
68 68
69#define rdtscp(low,high,aux) \
70 asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
71
69#define rdtscll(val) do { \ 72#define rdtscll(val) do { \
70 unsigned int __a,__d; \ 73 unsigned int __a,__d; \
71 asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ 74 asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \
72 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ 75 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \
73} while(0) 76} while(0)
74 77
78#define rdtscpll(val, aux) do { \
79 unsigned long __a, __d; \
80 asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
81 (val) = (__d << 32) | __a; \
82} while (0)
83
75#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 84#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
76 85
86#define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0)
87
77#define rdpmc(counter,low,high) \ 88#define rdpmc(counter,low,high) \
78 __asm__ __volatile__("rdpmc" \ 89 __asm__ __volatile__("rdpmc" \
79 : "=a" (low), "=d" (high) \ 90 : "=a" (low), "=d" (high) \
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h
index 06fab6de2a88..16396b1de3e4 100644
--- a/include/asm-x86_64/mutex.h
+++ b/include/asm-x86_64/mutex.h
@@ -25,13 +25,9 @@ do { \
25 \ 25 \
26 __asm__ __volatile__( \ 26 __asm__ __volatile__( \
27 LOCK_PREFIX " decl (%%rdi) \n" \ 27 LOCK_PREFIX " decl (%%rdi) \n" \
28 " js 2f \n" \ 28 " jns 1f \n" \
29 "1: \n" \ 29 " call "#fail_fn" \n" \
30 \ 30 "1:" \
31 LOCK_SECTION_START("") \
32 "2: call "#fail_fn" \n" \
33 " jmp 1b \n" \
34 LOCK_SECTION_END \
35 \ 31 \
36 :"=D" (dummy) \ 32 :"=D" (dummy) \
37 : "D" (v) \ 33 : "D" (v) \
@@ -75,13 +71,9 @@ do { \
75 \ 71 \
76 __asm__ __volatile__( \ 72 __asm__ __volatile__( \
77 LOCK_PREFIX " incl (%%rdi) \n" \ 73 LOCK_PREFIX " incl (%%rdi) \n" \
78 " jle 2f \n" \ 74 " jg 1f \n" \
79 "1: \n" \ 75 " call "#fail_fn" \n" \
80 \ 76 "1: " \
81 LOCK_SECTION_START("") \
82 "2: call "#fail_fn" \n" \
83 " jmp 1b \n" \
84 LOCK_SECTION_END \
85 \ 77 \
86 :"=D" (dummy) \ 78 :"=D" (dummy) \
87 : "D" (v) \ 79 : "D" (v) \
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
index efb45c894d76..f367d4014b42 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -7,24 +7,13 @@
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <asm/io.h> 8#include <asm/io.h>
9 9
10struct pt_regs;
11
12typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu);
13
14/**
15 * set_nmi_callback
16 *
17 * Set a handler for an NMI. Only one handler may be
18 * set. Return 1 if the NMI was handled.
19 */
20void set_nmi_callback(nmi_callback_t callback);
21
22/** 10/**
23 * unset_nmi_callback 11 * do_nmi_callback
24 * 12 *
25 * Remove the handler previously set. 13 * Check to see if a callback exists and execute it. Return 1
14 * if the handler exists and was handled successfully.
26 */ 15 */
27void unset_nmi_callback(void); 16int do_nmi_callback(struct pt_regs *regs, int cpu);
28 17
29#ifdef CONFIG_PM 18#ifdef CONFIG_PM
30 19
@@ -48,25 +37,32 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev)
48#endif /* CONFIG_PM */ 37#endif /* CONFIG_PM */
49 38
50extern void default_do_nmi(struct pt_regs *); 39extern void default_do_nmi(struct pt_regs *);
51extern void die_nmi(char *str, struct pt_regs *regs); 40extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
52 41
53#define get_nmi_reason() inb(0x61) 42#define get_nmi_reason() inb(0x61)
54 43
55extern int panic_on_timeout; 44extern int panic_on_timeout;
56extern int unknown_nmi_panic; 45extern int unknown_nmi_panic;
46extern int nmi_watchdog_enabled;
57 47
58extern int check_nmi_watchdog(void); 48extern int check_nmi_watchdog(void);
59 49extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
60extern void setup_apic_nmi_watchdog (void); 50extern int avail_to_resrv_perfctr_nmi(unsigned int);
61extern int reserve_lapic_nmi(void); 51extern int reserve_perfctr_nmi(unsigned int);
62extern void release_lapic_nmi(void); 52extern void release_perfctr_nmi(unsigned int);
53extern int reserve_evntsel_nmi(unsigned int);
54extern void release_evntsel_nmi(unsigned int);
55
56extern void setup_apic_nmi_watchdog (void *);
57extern void stop_apic_nmi_watchdog (void *);
63extern void disable_timer_nmi_watchdog(void); 58extern void disable_timer_nmi_watchdog(void);
64extern void enable_timer_nmi_watchdog(void); 59extern void enable_timer_nmi_watchdog(void);
65extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); 60extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
66 61
67extern void nmi_watchdog_default(void); 62extern void nmi_watchdog_default(void);
68extern int setup_nmi_watchdog(char *); 63extern int setup_nmi_watchdog(char *);
69 64
65extern atomic_t nmi_active;
70extern unsigned int nmi_watchdog; 66extern unsigned int nmi_watchdog;
71#define NMI_DEFAULT -1 67#define NMI_DEFAULT -1
72#define NMI_NONE 0 68#define NMI_NONE 0
@@ -74,4 +70,11 @@ extern unsigned int nmi_watchdog;
74#define NMI_LOCAL_APIC 2 70#define NMI_LOCAL_APIC 2
75#define NMI_INVALID 3 71#define NMI_INVALID 3
76 72
73struct ctl_table;
74struct file;
75extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
76 void __user *, size_t *, loff_t *);
77
78extern int unknown_nmi_panic;
79
77#endif /* ASM_NMI_H */ 80#endif /* ASM_NMI_H */
diff --git a/include/asm-x86_64/pci-direct.h b/include/asm-x86_64/pci-direct.h
index 036b6ca5b53b..eba9cb471df3 100644
--- a/include/asm-x86_64/pci-direct.h
+++ b/include/asm-x86_64/pci-direct.h
@@ -2,47 +2,15 @@
2#define ASM_PCI_DIRECT_H 1 2#define ASM_PCI_DIRECT_H 1
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <asm/io.h>
6 5
7/* Direct PCI access. This is used for PCI accesses in early boot before 6/* Direct PCI access. This is used for PCI accesses in early boot before
8 the PCI subsystem works. */ 7 the PCI subsystem works. */
9 8
10#define PDprintk(x...) 9extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset);
10extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset);
11extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset);
12extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val);
11 13
12static inline u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset) 14extern int early_pci_allowed(void);
13{
14 u32 v;
15 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
16 v = inl(0xcfc);
17 if (v != 0xffffffff)
18 PDprintk("%x reading 4 from %x: %x\n", slot, offset, v);
19 return v;
20}
21
22static inline u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset)
23{
24 u8 v;
25 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
26 v = inb(0xcfc + (offset&3));
27 PDprintk("%x reading 1 from %x: %x\n", slot, offset, v);
28 return v;
29}
30
31static inline u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset)
32{
33 u16 v;
34 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
35 v = inw(0xcfc + (offset&2));
36 PDprintk("%x reading 2 from %x: %x\n", slot, offset, v);
37 return v;
38}
39
40static inline void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset,
41 u32 val)
42{
43 PDprintk("%x writing to %x: %x\n", slot, offset, val);
44 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
45 outl(val, 0xcfc);
46}
47 15
48#endif 16#endif
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index b47c3df9ed1d..14996d962bac 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -9,20 +9,24 @@
9 9
10/* Per processor datastructure. %gs points to it while the kernel runs */ 10/* Per processor datastructure. %gs points to it while the kernel runs */
11struct x8664_pda { 11struct x8664_pda {
12 struct task_struct *pcurrent; /* Current process */ 12 struct task_struct *pcurrent; /* 0 Current process */
13 unsigned long data_offset; /* Per cpu data offset from linker address */ 13 unsigned long data_offset; /* 8 Per cpu data offset from linker
14 unsigned long kernelstack; /* top of kernel stack for current */ 14 address */
15 unsigned long oldrsp; /* user rsp for system call */ 15 unsigned long kernelstack; /* 16 top of kernel stack for current */
16#if DEBUG_STKSZ > EXCEPTION_STKSZ 16 unsigned long oldrsp; /* 24 user rsp for system call */
17 unsigned long debugstack; /* #DB/#BP stack. */ 17 int irqcount; /* 32 Irq nesting counter. Starts with -1 */
18 int cpunumber; /* 36 Logical CPU number */
19#ifdef CONFIG_CC_STACKPROTECTOR
20 unsigned long stack_canary; /* 40 stack canary value */
21 /* gcc-ABI: this canary MUST be at
22 offset 40!!! */
18#endif 23#endif
19 int irqcount; /* Irq nesting counter. Starts with -1 */ 24 char *irqstackptr;
20 int cpunumber; /* Logical CPU number */
21 char *irqstackptr; /* top of irqstack */
22 int nodenumber; /* number of current node */ 25 int nodenumber; /* number of current node */
23 unsigned int __softirq_pending; 26 unsigned int __softirq_pending;
24 unsigned int __nmi_count; /* number of NMI on this CPUs */ 27 unsigned int __nmi_count; /* number of NMI on this CPUs */
25 int mmu_state; 28 short mmu_state;
29 short isidle;
26 struct mm_struct *active_mm; 30 struct mm_struct *active_mm;
27 unsigned apic_timer_irqs; 31 unsigned apic_timer_irqs;
28} ____cacheline_aligned_in_smp; 32} ____cacheline_aligned_in_smp;
@@ -36,44 +40,69 @@ extern struct x8664_pda boot_cpu_pda[];
36 * There is no fast way to get the base address of the PDA, all the accesses 40 * There is no fast way to get the base address of the PDA, all the accesses
37 * have to mention %fs/%gs. So it needs to be done this Torvaldian way. 41 * have to mention %fs/%gs. So it needs to be done this Torvaldian way.
38 */ 42 */
39#define sizeof_field(type,field) (sizeof(((type *)0)->field)) 43extern void __bad_pda_field(void) __attribute__((noreturn));
40#define typeof_field(type,field) typeof(((type *)0)->field)
41 44
42extern void __bad_pda_field(void); 45/*
46 * proxy_pda doesn't actually exist, but tell gcc it is accessed for
47 * all PDA accesses so it gets read/write dependencies right.
48 */
49extern struct x8664_pda _proxy_pda;
43 50
44#define pda_offset(field) offsetof(struct x8664_pda, field) 51#define pda_offset(field) offsetof(struct x8664_pda, field)
45 52
46#define pda_to_op(op,field,val) do { \ 53#define pda_to_op(op,field,val) do { \
47 typedef typeof_field(struct x8664_pda, field) T__; \ 54 typedef typeof(_proxy_pda.field) T__; \
48 switch (sizeof_field(struct x8664_pda, field)) { \ 55 if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \
49case 2: \ 56 switch (sizeof(_proxy_pda.field)) { \
50asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ 57 case 2: \
51case 4: \ 58 asm(op "w %1,%%gs:%c2" : \
52asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ 59 "+m" (_proxy_pda.field) : \
53case 8: \ 60 "ri" ((T__)val), \
54asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ 61 "i"(pda_offset(field))); \
55 default: __bad_pda_field(); \ 62 break; \
56 } \ 63 case 4: \
64 asm(op "l %1,%%gs:%c2" : \
65 "+m" (_proxy_pda.field) : \
66 "ri" ((T__)val), \
67 "i" (pda_offset(field))); \
68 break; \
69 case 8: \
70 asm(op "q %1,%%gs:%c2": \
71 "+m" (_proxy_pda.field) : \
72 "ri" ((T__)val), \
73 "i"(pda_offset(field))); \
74 break; \
75 default: \
76 __bad_pda_field(); \
77 } \
57 } while (0) 78 } while (0)
58 79
59/* 80#define pda_from_op(op,field) ({ \
60 * AK: PDA read accesses should be neither volatile nor have an memory clobber. 81 typeof(_proxy_pda.field) ret__; \
61 * Unfortunately removing them causes all hell to break lose currently. 82 switch (sizeof(_proxy_pda.field)) { \
62 */ 83 case 2: \
63#define pda_from_op(op,field) ({ \ 84 asm(op "w %%gs:%c1,%0" : \
64 typeof_field(struct x8664_pda, field) ret__; \ 85 "=r" (ret__) : \
65 switch (sizeof_field(struct x8664_pda, field)) { \ 86 "i" (pda_offset(field)), \
66case 2: \ 87 "m" (_proxy_pda.field)); \
67asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 88 break; \
68case 4: \ 89 case 4: \
69asm volatile(op "l %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 90 asm(op "l %%gs:%c1,%0": \
70case 8: \ 91 "=r" (ret__): \
71asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 92 "i" (pda_offset(field)), \
72 default: __bad_pda_field(); \ 93 "m" (_proxy_pda.field)); \
73 } \ 94 break; \
95 case 8: \
96 asm(op "q %%gs:%c1,%0": \
97 "=r" (ret__) : \
98 "i" (pda_offset(field)), \
99 "m" (_proxy_pda.field)); \
100 break; \
101 default: \
102 __bad_pda_field(); \
103 } \
74 ret__; }) 104 ret__; })
75 105
76
77#define read_pda(field) pda_from_op("mov",field) 106#define read_pda(field) pda_from_op("mov",field)
78#define write_pda(field,val) pda_to_op("mov",field,val) 107#define write_pda(field,val) pda_to_op("mov",field,val)
79#define add_pda(field,val) pda_to_op("add",field,val) 108#define add_pda(field,val) pda_to_op("add",field,val)
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index bffb2f886a51..285756010c51 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,6 +11,16 @@
11 11
12#include <asm/pda.h> 12#include <asm/pda.h>
13 13
14#ifdef CONFIG_MODULES
15# define PERCPU_MODULE_RESERVE 8192
16#else
17# define PERCPU_MODULE_RESERVE 0
18#endif
19
20#define PERCPU_ENOUGH_ROOM \
21 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
22 PERCPU_MODULE_RESERVE)
23
14#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) 24#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
15#define __my_cpu_offset() read_pda(data_offset) 25#define __my_cpu_offset() read_pda(data_offset)
16 26
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 51eba2395171..6899e770b173 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -21,12 +21,9 @@ extern unsigned long __supported_pte_mask;
21 21
22#define swapper_pg_dir init_level4_pgt 22#define swapper_pg_dir init_level4_pgt
23 23
24extern int nonx_setup(char *str);
25extern void paging_init(void); 24extern void paging_init(void);
26extern void clear_kernel_mapping(unsigned long addr, unsigned long size); 25extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
27 26
28extern unsigned long pgkern_mask;
29
30/* 27/*
31 * ZERO_PAGE is a global shared page that is always zero: used 28 * ZERO_PAGE is a global shared page that is always zero: used
32 * for zero-mapped memory areas etc.. 29 * for zero-mapped memory areas etc..
@@ -265,7 +262,7 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
265#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) 262#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
266static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 263static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
267static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 264static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
268static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 265static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); }
269static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 266static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
270static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 267static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
271static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 268static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
@@ -278,11 +275,12 @@ static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) &
278static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 275static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
279static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } 276static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
280static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } 277static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
281static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } 278static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; }
282static 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; }
283static 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; }
284static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 281static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
285static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; } 282static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; }
283static inline pte_t pte_clrhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_PSE)); return pte; }
286 284
287struct vm_area_struct; 285struct vm_area_struct;
288 286
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 038fe1f47e6f..c28fc2db2171 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -24,8 +24,6 @@ extern void mtrr_bp_init(void);
24#define mtrr_bp_init() do {} while (0) 24#define mtrr_bp_init() do {} while (0)
25#endif 25#endif
26extern void init_memory_mapping(unsigned long start, unsigned long end); 26extern void init_memory_mapping(unsigned long start, unsigned long end);
27extern void size_zones(unsigned long *z, unsigned long *h,
28 unsigned long start_pfn, unsigned long end_pfn);
29 27
30extern void system_call(void); 28extern void system_call(void);
31extern int kernel_syscall(void); 29extern int kernel_syscall(void);
@@ -51,10 +49,8 @@ extern unsigned long long monotonic_base;
51extern int sysctl_vsyscall; 49extern int sysctl_vsyscall;
52extern int nohpet; 50extern int nohpet;
53extern unsigned long vxtime_hz; 51extern unsigned long vxtime_hz;
52extern void time_init_gtod(void);
54 53
55extern int numa_setup(char *opt);
56
57extern int setup_early_printk(char *);
58extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); 54extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
59 55
60extern void early_identify_cpu(struct cpuinfo_x86 *c); 56extern void early_identify_cpu(struct cpuinfo_x86 *c);
@@ -91,7 +87,7 @@ extern void syscall32_cpu_init(void);
91 87
92extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); 88extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end);
93 89
94extern void check_ioapic(void); 90extern void early_quirks(void);
95extern void check_efer(void); 91extern void check_efer(void);
96 92
97extern int unhandled_signal(struct task_struct *tsk, int sig); 93extern int unhandled_signal(struct task_struct *tsk, int sig);
@@ -103,13 +99,7 @@ extern void select_idle_routine(const struct cpuinfo_x86 *c);
103extern unsigned long table_start, table_end; 99extern unsigned long table_start, table_end;
104 100
105extern int exception_trace; 101extern int exception_trace;
106extern int using_apic_timer;
107extern int disable_apic;
108extern unsigned cpu_khz; 102extern unsigned cpu_khz;
109extern int ioapic_force;
110extern int skip_ioapic_setup;
111extern int acpi_ht;
112extern int acpi_disabled;
113 103
114extern void no_iommu_init(void); 104extern void no_iommu_init(void);
115extern int force_iommu, no_iommu; 105extern int force_iommu, no_iommu;
@@ -131,7 +121,8 @@ extern int fix_aperture;
131 121
132extern int reboot_force; 122extern int reboot_force;
133extern int notsc_setup(char *); 123extern int notsc_setup(char *);
134extern int setup_additional_cpus(char *); 124
125extern int gsi_irq_sharing(int gsi);
135 126
136extern void smp_local_timer_interrupt(struct pt_regs * regs); 127extern void smp_local_timer_interrupt(struct pt_regs * regs);
137 128
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h
index ab827dc381d7..5ea84dbb1e9c 100644
--- a/include/asm-x86_64/ptrace.h
+++ b/include/asm-x86_64/ptrace.h
@@ -39,6 +39,8 @@ struct pt_regs {
39#define user_mode(regs) (!!((regs)->cs & 3)) 39#define user_mode(regs) (!!((regs)->cs & 3))
40#define user_mode_vm(regs) user_mode(regs) 40#define user_mode_vm(regs) user_mode(regs)
41#define instruction_pointer(regs) ((regs)->rip) 41#define instruction_pointer(regs) ((regs)->rip)
42#define regs_return_value(regs) ((regs)->rax)
43
42extern unsigned long profile_pc(struct pt_regs *regs); 44extern unsigned long profile_pc(struct pt_regs *regs);
43void signal_fault(struct pt_regs *regs, void __user *frame, char *where); 45void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
44 46
diff --git a/include/asm-x86_64/rwlock.h b/include/asm-x86_64/rwlock.h
index dea0e9459264..72aeebed920b 100644
--- a/include/asm-x86_64/rwlock.h
+++ b/include/asm-x86_64/rwlock.h
@@ -18,69 +18,9 @@
18#ifndef _ASM_X86_64_RWLOCK_H 18#ifndef _ASM_X86_64_RWLOCK_H
19#define _ASM_X86_64_RWLOCK_H 19#define _ASM_X86_64_RWLOCK_H
20 20
21#include <linux/stringify.h>
22
23#define RW_LOCK_BIAS 0x01000000 21#define RW_LOCK_BIAS 0x01000000
24#define RW_LOCK_BIAS_STR "0x01000000" 22#define RW_LOCK_BIAS_STR "0x01000000"
25
26#define __build_read_lock_ptr(rw, helper) \
27 asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" \
28 "js 2f\n" \
29 "1:\n" \
30 LOCK_SECTION_START("") \
31 "2:\tcall " helper "\n\t" \
32 "jmp 1b\n" \
33 LOCK_SECTION_END \
34 ::"a" (rw) : "memory")
35
36#define __build_read_lock_const(rw, helper) \
37 asm volatile(LOCK_PREFIX "subl $1,%0\n\t" \
38 "js 2f\n" \
39 "1:\n" \
40 LOCK_SECTION_START("") \
41 "2:\tpushq %%rax\n\t" \
42 "leaq %0,%%rax\n\t" \
43 "call " helper "\n\t" \
44 "popq %%rax\n\t" \
45 "jmp 1b\n" \
46 LOCK_SECTION_END \
47 :"=m" (*((volatile int *)rw))::"memory")
48
49#define __build_read_lock(rw, helper) do { \
50 if (__builtin_constant_p(rw)) \
51 __build_read_lock_const(rw, helper); \
52 else \
53 __build_read_lock_ptr(rw, helper); \
54 } while (0)
55
56#define __build_write_lock_ptr(rw, helper) \
57 asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
58 "jnz 2f\n" \
59 "1:\n" \
60 LOCK_SECTION_START("") \
61 "2:\tcall " helper "\n\t" \
62 "jmp 1b\n" \
63 LOCK_SECTION_END \
64 ::"a" (rw) : "memory")
65
66#define __build_write_lock_const(rw, helper) \
67 asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \
68 "jnz 2f\n" \
69 "1:\n" \
70 LOCK_SECTION_START("") \
71 "2:\tpushq %%rax\n\t" \
72 "leaq %0,%%rax\n\t" \
73 "call " helper "\n\t" \
74 "popq %%rax\n\t" \
75 "jmp 1b\n" \
76 LOCK_SECTION_END \
77 :"=m" (*((volatile long *)rw))::"memory")
78 23
79#define __build_write_lock(rw, helper) do { \ 24/* Actual code is in asm/spinlock.h or in arch/x86_64/lib/rwlock.S */
80 if (__builtin_constant_p(rw)) \
81 __build_write_lock_const(rw, helper); \
82 else \
83 __build_write_lock_ptr(rw, helper); \
84 } while (0)
85 25
86#endif 26#endif
diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h
index d4bed33fb32c..334ddcdd8f92 100644
--- a/include/asm-x86_64/segment.h
+++ b/include/asm-x86_64/segment.h
@@ -20,15 +20,16 @@
20#define __USER_CS 0x33 /* 6*8+3 */ 20#define __USER_CS 0x33 /* 6*8+3 */
21#define __USER32_DS __USER_DS 21#define __USER32_DS __USER_DS
22 22
23#define GDT_ENTRY_TLS 1
24#define GDT_ENTRY_TSS 8 /* needs two entries */ 23#define GDT_ENTRY_TSS 8 /* needs two entries */
25#define GDT_ENTRY_LDT 10 /* needs two entries */ 24#define GDT_ENTRY_LDT 10 /* needs two entries */
26#define GDT_ENTRY_TLS_MIN 12 25#define GDT_ENTRY_TLS_MIN 12
27#define GDT_ENTRY_TLS_MAX 14 26#define GDT_ENTRY_TLS_MAX 14
28/* 15 free */
29 27
30#define GDT_ENTRY_TLS_ENTRIES 3 28#define GDT_ENTRY_TLS_ENTRIES 3
31 29
30#define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */
31#define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3)
32
32/* TLS indexes for 64bit - hardcoded in arch_prctl */ 33/* TLS indexes for 64bit - hardcoded in arch_prctl */
33#define FS_TLS 0 34#define FS_TLS 0
34#define GS_TLS 1 35#define GS_TLS 1
diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h
index 064df08b9a0f..1194888536b9 100644
--- a/include/asm-x86_64/semaphore.h
+++ b/include/asm-x86_64/semaphore.h
@@ -107,12 +107,9 @@ static inline void down(struct semaphore * sem)
107 __asm__ __volatile__( 107 __asm__ __volatile__(
108 "# atomic down operation\n\t" 108 "# atomic down operation\n\t"
109 LOCK_PREFIX "decl %0\n\t" /* --sem->count */ 109 LOCK_PREFIX "decl %0\n\t" /* --sem->count */
110 "js 2f\n" 110 "jns 1f\n\t"
111 "1:\n" 111 "call __down_failed\n"
112 LOCK_SECTION_START("") 112 "1:"
113 "2:\tcall __down_failed\n\t"
114 "jmp 1b\n"
115 LOCK_SECTION_END
116 :"=m" (sem->count) 113 :"=m" (sem->count)
117 :"D" (sem) 114 :"D" (sem)
118 :"memory"); 115 :"memory");
@@ -130,15 +127,12 @@ static inline int down_interruptible(struct semaphore * sem)
130 127
131 __asm__ __volatile__( 128 __asm__ __volatile__(
132 "# atomic interruptible down operation\n\t" 129 "# atomic interruptible down operation\n\t"
130 "xorl %0,%0\n\t"
133 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 131 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
134 "js 2f\n\t" 132 "jns 2f\n\t"
135 "xorl %0,%0\n" 133 "call __down_failed_interruptible\n"
136 "1:\n" 134 "2:\n"
137 LOCK_SECTION_START("") 135 :"=&a" (result), "=m" (sem->count)
138 "2:\tcall __down_failed_interruptible\n\t"
139 "jmp 1b\n"
140 LOCK_SECTION_END
141 :"=a" (result), "=m" (sem->count)
142 :"D" (sem) 136 :"D" (sem)
143 :"memory"); 137 :"memory");
144 return result; 138 return result;
@@ -154,15 +148,12 @@ static inline int down_trylock(struct semaphore * sem)
154 148
155 __asm__ __volatile__( 149 __asm__ __volatile__(
156 "# atomic interruptible down operation\n\t" 150 "# atomic interruptible down operation\n\t"
151 "xorl %0,%0\n\t"
157 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 152 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
158 "js 2f\n\t" 153 "jns 2f\n\t"
159 "xorl %0,%0\n" 154 "call __down_failed_trylock\n\t"
160 "1:\n" 155 "2:\n"
161 LOCK_SECTION_START("") 156 :"=&a" (result), "=m" (sem->count)
162 "2:\tcall __down_failed_trylock\n\t"
163 "jmp 1b\n"
164 LOCK_SECTION_END
165 :"=a" (result), "=m" (sem->count)
166 :"D" (sem) 157 :"D" (sem)
167 :"memory","cc"); 158 :"memory","cc");
168 return result; 159 return result;
@@ -179,12 +170,9 @@ static inline void up(struct semaphore * sem)
179 __asm__ __volatile__( 170 __asm__ __volatile__(
180 "# atomic up operation\n\t" 171 "# atomic up operation\n\t"
181 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ 172 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
182 "jle 2f\n" 173 "jg 1f\n\t"
183 "1:\n" 174 "call __up_wakeup\n"
184 LOCK_SECTION_START("") 175 "1:"
185 "2:\tcall __up_wakeup\n\t"
186 "jmp 1b\n"
187 LOCK_SECTION_END
188 :"=m" (sem->count) 176 :"=m" (sem->count)
189 :"D" (sem) 177 :"D" (sem)
190 :"memory"); 178 :"memory");
diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h
index 3ede2a61973a..4581f978b299 100644
--- a/include/asm-x86_64/signal.h
+++ b/include/asm-x86_64/signal.h
@@ -24,10 +24,6 @@ typedef struct {
24} sigset_t; 24} sigset_t;
25 25
26 26
27struct pt_regs;
28asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
29
30
31#else 27#else
32/* Here we must cater to libcs that poke about in kernel headers. */ 28/* Here we must cater to libcs that poke about in kernel headers. */
33 29
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index ce97f65e1d10..d6b7c057edba 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -4,27 +4,18 @@
4/* 4/*
5 * We need the APIC definitions automatically as part of 'smp.h' 5 * We need the APIC definitions automatically as part of 'smp.h'
6 */ 6 */
7#ifndef __ASSEMBLY__
8#include <linux/threads.h> 7#include <linux/threads.h>
9#include <linux/cpumask.h> 8#include <linux/cpumask.h>
10#include <linux/bitops.h> 9#include <linux/bitops.h>
11extern int disable_apic; 10extern int disable_apic;
12#endif
13 11
14#ifdef CONFIG_X86_LOCAL_APIC
15#ifndef __ASSEMBLY__
16#include <asm/fixmap.h> 12#include <asm/fixmap.h>
17#include <asm/mpspec.h> 13#include <asm/mpspec.h>
18#ifdef CONFIG_X86_IO_APIC
19#include <asm/io_apic.h> 14#include <asm/io_apic.h>
20#endif
21#include <asm/apic.h> 15#include <asm/apic.h>
22#include <asm/thread_info.h> 16#include <asm/thread_info.h>
23#endif
24#endif
25 17
26#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
27#ifndef ASSEMBLY
28 19
29#include <asm/pda.h> 20#include <asm/pda.h>
30 21
@@ -42,7 +33,6 @@ extern cpumask_t cpu_initialized;
42 33
43extern void smp_alloc_memory(void); 34extern void smp_alloc_memory(void);
44extern volatile unsigned long smp_invalidate_needed; 35extern volatile unsigned long smp_invalidate_needed;
45extern int pic_mode;
46extern void lock_ipi_call_lock(void); 36extern void lock_ipi_call_lock(void);
47extern void unlock_ipi_call_lock(void); 37extern void unlock_ipi_call_lock(void);
48extern int smp_num_siblings; 38extern int smp_num_siblings;
@@ -74,20 +64,16 @@ static inline int hard_smp_processor_id(void)
74 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); 64 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
75} 65}
76 66
77extern int safe_smp_processor_id(void);
78extern int __cpu_disable(void); 67extern int __cpu_disable(void);
79extern void __cpu_die(unsigned int cpu); 68extern void __cpu_die(unsigned int cpu);
80extern void prefill_possible_map(void); 69extern void prefill_possible_map(void);
81extern unsigned num_processors; 70extern unsigned num_processors;
82extern unsigned disabled_cpus; 71extern unsigned disabled_cpus;
83 72
84#endif /* !ASSEMBLY */
85
86#define NO_PROC_ID 0xFF /* No processor magic marker */ 73#define NO_PROC_ID 0xFF /* No processor magic marker */
87 74
88#endif 75#endif
89 76
90#ifndef ASSEMBLY
91/* 77/*
92 * Some lowlevel functions might want to know about 78 * Some lowlevel functions might want to know about
93 * the real APIC ID <-> CPU # mapping. 79 * the real APIC ID <-> CPU # mapping.
@@ -109,11 +95,8 @@ static inline int cpu_present_to_apicid(int mps_cpu)
109 return BAD_APICID; 95 return BAD_APICID;
110} 96}
111 97
112#endif /* !ASSEMBLY */
113
114#ifndef CONFIG_SMP 98#ifndef CONFIG_SMP
115#define stack_smp_processor_id() 0 99#define stack_smp_processor_id() 0
116#define safe_smp_processor_id() 0
117#define cpu_logical_map(x) (x) 100#define cpu_logical_map(x) (x)
118#else 101#else
119#include <asm/thread_info.h> 102#include <asm/thread_info.h>
@@ -125,19 +108,23 @@ static inline int cpu_present_to_apicid(int mps_cpu)
125}) 108})
126#endif 109#endif
127 110
128#ifndef __ASSEMBLY__
129static __inline int logical_smp_processor_id(void) 111static __inline int logical_smp_processor_id(void)
130{ 112{
131 /* we don't want to mark this access volatile - bad code generation */ 113 /* we don't want to mark this access volatile - bad code generation */
132 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); 114 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
133} 115}
134#endif
135 116
136#ifdef CONFIG_SMP 117#ifdef CONFIG_SMP
137#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 118#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
138#else 119#else
139#define cpu_physical_id(cpu) boot_cpu_id 120#define cpu_physical_id(cpu) boot_cpu_id
140#endif 121static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
141 122 void *info, int retry, int wait)
123{
124 /* Disable interrupts here? */
125 func(info);
126 return 0;
127}
128#endif /* !CONFIG_SMP */
142#endif 129#endif
143 130
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h
index 248a79f0eaff..05ef097ba55b 100644
--- a/include/asm-x86_64/spinlock.h
+++ b/include/asm-x86_64/spinlock.h
@@ -4,6 +4,7 @@
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5#include <asm/rwlock.h> 5#include <asm/rwlock.h>
6#include <asm/page.h> 6#include <asm/page.h>
7#include <asm/processor.h>
7 8
8/* 9/*
9 * Your basic SMP spinlocks, allowing only a single CPU anywhere 10 * Your basic SMP spinlocks, allowing only a single CPU anywhere
@@ -16,31 +17,23 @@
16 * (the type definitions are in asm/spinlock_types.h) 17 * (the type definitions are in asm/spinlock_types.h)
17 */ 18 */
18 19
19#define __raw_spin_is_locked(x) \ 20static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
20 (*(volatile signed int *)(&(x)->slock) <= 0) 21{
21 22 return *(volatile signed int *)(&(lock)->slock) <= 0;
22#define __raw_spin_lock_string \ 23}
23 "\n1:\t" \
24 LOCK_PREFIX " ; decl %0\n\t" \
25 "js 2f\n" \
26 LOCK_SECTION_START("") \
27 "2:\t" \
28 "rep;nop\n\t" \
29 "cmpl $0,%0\n\t" \
30 "jle 2b\n\t" \
31 "jmp 1b\n" \
32 LOCK_SECTION_END
33
34#define __raw_spin_lock_string_up \
35 "\n\tdecl %0"
36
37#define __raw_spin_unlock_string \
38 "movl $1,%0" \
39 :"=m" (lock->slock) : : "memory"
40 24
41static inline void __raw_spin_lock(raw_spinlock_t *lock) 25static inline void __raw_spin_lock(raw_spinlock_t *lock)
42{ 26{
43 asm volatile(__raw_spin_lock_string : "=m" (lock->slock) : : "memory"); 27 asm volatile(
28 "\n1:\t"
29 LOCK_PREFIX " ; decl %0\n\t"
30 "jns 2f\n"
31 "3:\n"
32 "rep;nop\n\t"
33 "cmpl $0,%0\n\t"
34 "jle 3b\n\t"
35 "jmp 1b\n"
36 "2:\t" : "=m" (lock->slock) : : "memory");
44} 37}
45 38
46#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 39#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
@@ -49,7 +42,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
49{ 42{
50 int oldval; 43 int oldval;
51 44
52 __asm__ __volatile__( 45 asm volatile(
53 "xchgl %0,%1" 46 "xchgl %0,%1"
54 :"=q" (oldval), "=m" (lock->slock) 47 :"=q" (oldval), "=m" (lock->slock)
55 :"0" (0) : "memory"); 48 :"0" (0) : "memory");
@@ -59,13 +52,14 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
59 52
60static inline void __raw_spin_unlock(raw_spinlock_t *lock) 53static inline void __raw_spin_unlock(raw_spinlock_t *lock)
61{ 54{
62 __asm__ __volatile__( 55 asm volatile("movl $1,%0" :"=m" (lock->slock) :: "memory");
63 __raw_spin_unlock_string
64 );
65} 56}
66 57
67#define __raw_spin_unlock_wait(lock) \ 58static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
68 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 59{
60 while (__raw_spin_is_locked(lock))
61 cpu_relax();
62}
69 63
70/* 64/*
71 * Read-write spinlocks, allowing multiple readers 65 * Read-write spinlocks, allowing multiple readers
@@ -79,26 +73,34 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
79 * 73 *
80 * On x86, we implement read-write locks as a 32-bit counter 74 * On x86, we implement read-write locks as a 32-bit counter
81 * with the high bit (sign) being the "contended" bit. 75 * with the high bit (sign) being the "contended" bit.
82 *
83 * The inline assembly is non-obvious. Think about it.
84 *
85 * Changed to use the same technique as rw semaphores. See
86 * semaphore.h for details. -ben
87 *
88 * the helpers are in arch/i386/kernel/semaphore.c
89 */ 76 */
90 77
91#define __raw_read_can_lock(x) ((int)(x)->lock > 0) 78static inline int __raw_read_can_lock(raw_rwlock_t *lock)
92#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) 79{
80 return (int)(lock)->lock > 0;
81}
82
83static inline int __raw_write_can_lock(raw_rwlock_t *lock)
84{
85 return (lock)->lock == RW_LOCK_BIAS;
86}
93 87
94static inline void __raw_read_lock(raw_rwlock_t *rw) 88static inline void __raw_read_lock(raw_rwlock_t *rw)
95{ 89{
96 __build_read_lock(rw, "__read_lock_failed"); 90 asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t"
91 "jns 1f\n"
92 "call __read_lock_failed\n"
93 "1:\n"
94 ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory");
97} 95}
98 96
99static inline void __raw_write_lock(raw_rwlock_t *rw) 97static inline void __raw_write_lock(raw_rwlock_t *rw)
100{ 98{
101 __build_write_lock(rw, "__write_lock_failed"); 99 asm volatile(LOCK_PREFIX "subl %1,(%0)\n\t"
100 "jz 1f\n"
101 "\tcall __write_lock_failed\n\t"
102 "1:\n"
103 ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory");
102} 104}
103 105
104static inline int __raw_read_trylock(raw_rwlock_t *lock) 106static inline int __raw_read_trylock(raw_rwlock_t *lock)
@@ -131,4 +133,8 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
131 : "=m" (rw->lock) : : "memory"); 133 : "=m" (rw->lock) : : "memory");
132} 134}
133 135
136#define _raw_spin_relax(lock) cpu_relax()
137#define _raw_read_relax(lock) cpu_relax()
138#define _raw_write_relax(lock) cpu_relax()
139
134#endif /* __ASM_SPINLOCK_H */ 140#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-x86_64/stacktrace.h b/include/asm-x86_64/stacktrace.h
new file mode 100644
index 000000000000..5eb9799bef76
--- /dev/null
+++ b/include/asm-x86_64/stacktrace.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_STACKTRACE_H
2#define _ASM_STACKTRACE_H 1
3
4/* Generic stack tracer with callbacks */
5
6struct stacktrace_ops {
7 void (*warning)(void *data, char *msg);
8 /* msg must contain %s for the symbol */
9 void (*warning_symbol)(void *data, char *msg, unsigned long symbol);
10 void (*address)(void *data, unsigned long address);
11 /* On negative return stop dumping */
12 int (*stack)(void *data, char *name);
13};
14
15void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack,
16 struct stacktrace_ops *ops, void *data);
17
18#endif
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index 6bf170bceae1..bd376bc8c4ab 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -14,12 +14,13 @@
14#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" 14#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
15 15
16/* frame pointer must be last for get_wchan */ 16/* frame pointer must be last for get_wchan */
17#define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" 17#define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"
18#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" 18#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t"
19 19
20#define __EXTRA_CLOBBER \ 20#define __EXTRA_CLOBBER \
21 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" 21 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15"
22 22
23/* Save restore flags to clear handle leaking NT */
23#define switch_to(prev,next,last) \ 24#define switch_to(prev,next,last) \
24 asm volatile(SAVE_CONTEXT \ 25 asm volatile(SAVE_CONTEXT \
25 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ 26 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
diff --git a/include/asm-x86_64/tce.h b/include/asm-x86_64/tce.h
index 53e9a68b3336..dbb047febc5e 100644
--- a/include/asm-x86_64/tce.h
+++ b/include/asm-x86_64/tce.h
@@ -24,7 +24,6 @@
24#ifndef _ASM_X86_64_TCE_H 24#ifndef _ASM_X86_64_TCE_H
25#define _ASM_X86_64_TCE_H 25#define _ASM_X86_64_TCE_H
26 26
27extern void* tce_table_kva[];
28extern unsigned int specified_table_size; 27extern unsigned int specified_table_size;
29struct iommu_table; 28struct iommu_table;
30 29
diff --git a/include/asm-x86_64/therm_throt.h b/include/asm-x86_64/therm_throt.h
new file mode 100644
index 000000000000..5aac059007ba
--- /dev/null
+++ b/include/asm-x86_64/therm_throt.h
@@ -0,0 +1 @@
#include <asm-i386/therm_throt.h>
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h
index 2029b00351f3..787a08114b48 100644
--- a/include/asm-x86_64/thread_info.h
+++ b/include/asm-x86_64/thread_info.h
@@ -114,11 +114,14 @@ static inline struct thread_info *stack_thread_info(void)
114#define TIF_IRET 5 /* force IRET */ 114#define TIF_IRET 5 /* force IRET */
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/* 16 free */ 118/* 16 free */
118#define TIF_IA32 17 /* 32bit process */ 119#define TIF_IA32 17 /* 32bit process */
119#define TIF_FORK 18 /* ret_from_fork */ 120#define TIF_FORK 18 /* ret_from_fork */
120#define TIF_ABI_PENDING 19 121#define TIF_ABI_PENDING 19
121#define TIF_MEMDIE 20 122#define TIF_MEMDIE 20
123#define TIF_DEBUG 21 /* uses debug registers */
124#define TIF_IO_BITMAP 22 /* uses I/O bitmap */
122 125
123#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 126#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
124#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 127#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -128,9 +131,12 @@ static inline struct thread_info *stack_thread_info(void)
128#define _TIF_IRET (1<<TIF_IRET) 131#define _TIF_IRET (1<<TIF_IRET)
129#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 132#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
130#define _TIF_SECCOMP (1<<TIF_SECCOMP) 133#define _TIF_SECCOMP (1<<TIF_SECCOMP)
134#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
131#define _TIF_IA32 (1<<TIF_IA32) 135#define _TIF_IA32 (1<<TIF_IA32)
132#define _TIF_FORK (1<<TIF_FORK) 136#define _TIF_FORK (1<<TIF_FORK)
133#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 137#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
138#define _TIF_DEBUG (1<<TIF_DEBUG)
139#define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP)
134 140
135/* work to do on interrupt/exception return */ 141/* work to do on interrupt/exception return */
136#define _TIF_WORK_MASK \ 142#define _TIF_WORK_MASK \
@@ -138,6 +144,9 @@ static inline struct thread_info *stack_thread_info(void)
138/* work to do on any return to user space */ 144/* work to do on any return to user space */
139#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 145#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
140 146
147/* flags to check in __switch_to() */
148#define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP)
149
141#define PREEMPT_ACTIVE 0x10000000 150#define PREEMPT_ACTIVE 0x10000000
142 151
143/* 152/*
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
index d16d5b60f419..983bd296c81a 100644
--- a/include/asm-x86_64/tlbflush.h
+++ b/include/asm-x86_64/tlbflush.h
@@ -4,44 +4,44 @@
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/processor.h> 5#include <asm/processor.h>
6 6
7#define __flush_tlb() \ 7static inline unsigned long get_cr3(void)
8 do { \ 8{
9 unsigned long tmpreg; \ 9 unsigned long cr3;
10 \ 10 asm volatile("mov %%cr3,%0" : "=r" (cr3));
11 __asm__ __volatile__( \ 11 return cr3;
12 "movq %%cr3, %0; # flush TLB \n" \ 12}
13 "movq %0, %%cr3; \n" \
14 : "=r" (tmpreg) \
15 :: "memory"); \
16 } while (0)
17 13
18/* 14static inline void set_cr3(unsigned long cr3)
19 * Global pages have to be flushed a bit differently. Not a real 15{
20 * performance problem because this does not happen often. 16 asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory");
21 */ 17}
22#define __flush_tlb_global() \ 18
23 do { \ 19static inline void __flush_tlb(void)
24 unsigned long tmpreg, cr4, cr4_orig; \ 20{
25 \ 21 set_cr3(get_cr3());
26 __asm__ __volatile__( \ 22}
27 "movq %%cr4, %2; # turn off PGE \n" \ 23
28 "movq %2, %1; \n" \ 24static inline unsigned long get_cr4(void)
29 "andq %3, %1; \n" \ 25{
30 "movq %1, %%cr4; \n" \ 26 unsigned long cr4;
31 "movq %%cr3, %0; # flush TLB \n" \ 27 asm volatile("mov %%cr4,%0" : "=r" (cr4));
32 "movq %0, %%cr3; \n" \ 28 return cr4;
33 "movq %2, %%cr4; # turn PGE back on \n" \ 29}
34 : "=&r" (tmpreg), "=&r" (cr4), "=&r" (cr4_orig) \ 30
35 : "i" (~X86_CR4_PGE) \ 31static inline void set_cr4(unsigned long cr4)
36 : "memory"); \ 32{
37 } while (0) 33 asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory");
38 34}
39extern unsigned long pgkern_mask; 35
40 36static inline void __flush_tlb_all(void)
41#define __flush_tlb_all() __flush_tlb_global() 37{
38 unsigned long cr4 = get_cr4();
39 set_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */
40 set_cr4(cr4); /* write old PGE again and flush TLBs */
41}
42 42
43#define __flush_tlb_one(addr) \ 43#define __flush_tlb_one(addr) \
44 __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) 44 __asm__ __volatile__("invlpg (%0)" :: "r" (addr) : "memory")
45 45
46 46
47/* 47/*
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index 6e7a2e976b04..5c8f49280dbc 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -31,6 +31,7 @@ extern int __node_distance(int, int);
31#define SD_NODE_INIT (struct sched_domain) { \ 31#define SD_NODE_INIT (struct sched_domain) { \
32 .span = CPU_MASK_NONE, \ 32 .span = CPU_MASK_NONE, \
33 .parent = NULL, \ 33 .parent = NULL, \
34 .child = NULL, \
34 .groups = NULL, \ 35 .groups = NULL, \
35 .min_interval = 8, \ 36 .min_interval = 8, \
36 .max_interval = 32, \ 37 .max_interval = 32, \
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 1e1fa003daa3..19f99178fe83 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -84,7 +84,7 @@ struct exception_table_entry
84 */ 84 */
85 85
86#define __get_user_x(size,ret,x,ptr) \ 86#define __get_user_x(size,ret,x,ptr) \
87 __asm__ __volatile__("call __get_user_" #size \ 87 asm volatile("call __get_user_" #size \
88 :"=a" (ret),"=d" (x) \ 88 :"=a" (ret),"=d" (x) \
89 :"c" (ptr) \ 89 :"c" (ptr) \
90 :"r8") 90 :"r8")
@@ -101,7 +101,7 @@ struct exception_table_entry
101 case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ 101 case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \
102 default: __get_user_bad(); break; \ 102 default: __get_user_bad(); break; \
103 } \ 103 } \
104 (x) = (__typeof__(*(ptr)))__val_gu; \ 104 (x) = (typeof(*(ptr)))__val_gu; \
105 __ret_gu; \ 105 __ret_gu; \
106}) 106})
107 107
@@ -112,7 +112,7 @@ extern void __put_user_8(void);
112extern void __put_user_bad(void); 112extern void __put_user_bad(void);
113 113
114#define __put_user_x(size,ret,x,ptr) \ 114#define __put_user_x(size,ret,x,ptr) \
115 __asm__ __volatile__("call __put_user_" #size \ 115 asm volatile("call __put_user_" #size \
116 :"=a" (ret) \ 116 :"=a" (ret) \
117 :"c" (ptr),"d" (x) \ 117 :"c" (ptr),"d" (x) \
118 :"r8") 118 :"r8")
@@ -139,7 +139,7 @@ extern void __put_user_bad(void);
139#define __put_user_check(x,ptr,size) \ 139#define __put_user_check(x,ptr,size) \
140({ \ 140({ \
141 int __pu_err; \ 141 int __pu_err; \
142 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ 142 typeof(*(ptr)) __user *__pu_addr = (ptr); \
143 switch (size) { \ 143 switch (size) { \
144 case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \ 144 case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \
145 case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \ 145 case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \
@@ -173,7 +173,7 @@ struct __large_struct { unsigned long buf[100]; };
173 * aliasing issues. 173 * aliasing issues.
174 */ 174 */
175#define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ 175#define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \
176 __asm__ __volatile__( \ 176 asm volatile( \
177 "1: mov"itype" %"rtype"1,%2\n" \ 177 "1: mov"itype" %"rtype"1,%2\n" \
178 "2:\n" \ 178 "2:\n" \
179 ".section .fixup,\"ax\"\n" \ 179 ".section .fixup,\"ax\"\n" \
@@ -193,7 +193,7 @@ struct __large_struct { unsigned long buf[100]; };
193 int __gu_err; \ 193 int __gu_err; \
194 unsigned long __gu_val; \ 194 unsigned long __gu_val; \
195 __get_user_size(__gu_val,(ptr),(size),__gu_err); \ 195 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
196 (x) = (__typeof__(*(ptr)))__gu_val; \ 196 (x) = (typeof(*(ptr)))__gu_val; \
197 __gu_err; \ 197 __gu_err; \
198}) 198})
199 199
@@ -217,7 +217,7 @@ do { \
217} while (0) 217} while (0)
218 218
219#define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \ 219#define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \
220 __asm__ __volatile__( \ 220 asm volatile( \
221 "1: mov"itype" %2,%"rtype"1\n" \ 221 "1: mov"itype" %2,%"rtype"1\n" \
222 "2:\n" \ 222 "2:\n" \
223 ".section .fixup,\"ax\"\n" \ 223 ".section .fixup,\"ax\"\n" \
@@ -237,15 +237,20 @@ do { \
237 */ 237 */
238 238
239/* Handles exceptions in both to and from, but doesn't do access_ok */ 239/* Handles exceptions in both to and from, but doesn't do access_ok */
240extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 240__must_check unsigned long
241 241copy_user_generic(void *to, const void *from, unsigned len);
242extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 242
243extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 243__must_check unsigned long
244extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 244copy_to_user(void __user *to, const void *from, unsigned len);
245 245__must_check unsigned long
246static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 246copy_from_user(void *to, const void __user *from, unsigned len);
247__must_check unsigned long
248copy_in_user(void __user *to, const void __user *from, unsigned len);
249
250static __always_inline __must_check
251int __copy_from_user(void *dst, const void __user *src, unsigned size)
247{ 252{
248 int ret = 0; 253 int ret = 0;
249 if (!__builtin_constant_p(size)) 254 if (!__builtin_constant_p(size))
250 return copy_user_generic(dst,(__force void *)src,size); 255 return copy_user_generic(dst,(__force void *)src,size);
251 switch (size) { 256 switch (size) {
@@ -272,9 +277,10 @@ static __always_inline int __copy_from_user(void *dst, const void __user *src, u
272 } 277 }
273} 278}
274 279
275static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 280static __always_inline __must_check
281int __copy_to_user(void __user *dst, const void *src, unsigned size)
276{ 282{
277 int ret = 0; 283 int ret = 0;
278 if (!__builtin_constant_p(size)) 284 if (!__builtin_constant_p(size))
279 return copy_user_generic((__force void *)dst,src,size); 285 return copy_user_generic((__force void *)dst,src,size);
280 switch (size) { 286 switch (size) {
@@ -303,10 +309,10 @@ static __always_inline int __copy_to_user(void __user *dst, const void *src, uns
303 } 309 }
304} 310}
305 311
306 312static __always_inline __must_check
307static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 313int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
308{ 314{
309 int ret = 0; 315 int ret = 0;
310 if (!__builtin_constant_p(size)) 316 if (!__builtin_constant_p(size))
311 return copy_user_generic((__force void *)dst,(__force void *)src,size); 317 return copy_user_generic((__force void *)dst,(__force void *)src,size);
312 switch (size) { 318 switch (size) {
@@ -344,15 +350,22 @@ static __always_inline int __copy_in_user(void __user *dst, const void __user *s
344 } 350 }
345} 351}
346 352
347long strncpy_from_user(char *dst, const char __user *src, long count); 353__must_check long
348long __strncpy_from_user(char *dst, const char __user *src, long count); 354strncpy_from_user(char *dst, const char __user *src, long count);
349long strnlen_user(const char __user *str, long n); 355__must_check long
350long __strnlen_user(const char __user *str, long n); 356__strncpy_from_user(char *dst, const char __user *src, long count);
351long strlen_user(const char __user *str); 357__must_check long strnlen_user(const char __user *str, long n);
352unsigned long clear_user(void __user *mem, unsigned long len); 358__must_check long __strnlen_user(const char __user *str, long n);
353unsigned long __clear_user(void __user *mem, unsigned long len); 359__must_check long strlen_user(const char __user *str);
360__must_check unsigned long clear_user(void __user *mem, unsigned long len);
361__must_check unsigned long __clear_user(void __user *mem, unsigned long len);
354 362
355#define __copy_to_user_inatomic __copy_to_user 363__must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size);
356#define __copy_from_user_inatomic __copy_from_user 364
365static __must_check __always_inline int
366__copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
367{
368 return copy_user_generic((__force void *)dst, src, size);
369}
357 370
358#endif /* __X86_64_UACCESS_H */ 371#endif /* __X86_64_UACCESS_H */
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 80fd48e84bbb..777288eb7e75 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -600,9 +600,9 @@ __SYSCALL(__NR_fchmodat, sys_fchmodat)
600#define __NR_faccessat 269 600#define __NR_faccessat 269
601__SYSCALL(__NR_faccessat, sys_faccessat) 601__SYSCALL(__NR_faccessat, sys_faccessat)
602#define __NR_pselect6 270 602#define __NR_pselect6 270
603__SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */ 603__SYSCALL(__NR_pselect6, sys_pselect6)
604#define __NR_ppoll 271 604#define __NR_ppoll 271
605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ 605__SYSCALL(__NR_ppoll, sys_ppoll)
606#define __NR_unshare 272 606#define __NR_unshare 272
607__SYSCALL(__NR_unshare, sys_unshare) 607__SYSCALL(__NR_unshare, sys_unshare)
608#define __NR_set_robust_list 273 608#define __NR_set_robust_list 273
@@ -620,19 +620,21 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice)
620#define __NR_move_pages 279 620#define __NR_move_pages 279
621__SYSCALL(__NR_move_pages, sys_move_pages) 621__SYSCALL(__NR_move_pages, sys_move_pages)
622 622
623#ifdef __KERNEL__
624
625#define __NR_syscall_max __NR_move_pages 623#define __NR_syscall_max __NR_move_pages
626 624
625#ifdef __KERNEL__
626#include <linux/err.h>
627#endif
628
627#ifndef __NO_STUBS 629#ifndef __NO_STUBS
628 630
629/* user-visible error numbers are in the range -1 - -4095 */ 631/* user-visible error numbers are in the range -1 - -MAX_ERRNO */
630 632
631#define __syscall_clobber "r11","rcx","memory" 633#define __syscall_clobber "r11","rcx","memory"
632 634
633#define __syscall_return(type, res) \ 635#define __syscall_return(type, res) \
634do { \ 636do { \
635 if ((unsigned long)(res) >= (unsigned long)(-127)) { \ 637 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
636 errno = -(res); \ 638 errno = -(res); \
637 res = -1; \ 639 res = -1; \
638 } \ 640 } \
@@ -658,11 +660,10 @@ do { \
658#define __ARCH_WANT_SYS_SIGPENDING 660#define __ARCH_WANT_SYS_SIGPENDING
659#define __ARCH_WANT_SYS_SIGPROCMASK 661#define __ARCH_WANT_SYS_SIGPROCMASK
660#define __ARCH_WANT_SYS_RT_SIGACTION 662#define __ARCH_WANT_SYS_RT_SIGACTION
663#define __ARCH_WANT_SYS_RT_SIGSUSPEND
661#define __ARCH_WANT_SYS_TIME 664#define __ARCH_WANT_SYS_TIME
662#define __ARCH_WANT_COMPAT_SYS_TIME 665#define __ARCH_WANT_COMPAT_SYS_TIME
663 666
664#ifndef __KERNEL_SYSCALLS__
665
666#define __syscall "syscall" 667#define __syscall "syscall"
667 668
668#define _syscall0(type,name) \ 669#define _syscall0(type,name) \
@@ -744,83 +745,7 @@ __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; " __syscall \
744__syscall_return(type,__res); \ 745__syscall_return(type,__res); \
745} 746}
746 747
747#else /* __KERNEL_SYSCALLS__ */ 748#ifdef __KERNEL__
748
749#include <linux/syscalls.h>
750#include <asm/ptrace.h>
751
752/*
753 * we need this inline - forking from kernel space will result
754 * in NO COPY ON WRITE (!!!), until an execve is executed. This
755 * is no problem, but for the stack. This is handled by not letting
756 * main() use the stack at all after fork(). Thus, no function
757 * calls - which means inline code for fork too, as otherwise we
758 * would use the stack upon exit from 'fork()'.
759 *
760 * Actually only pause and fork are needed inline, so that there
761 * won't be any messing with the stack from main(), but we define
762 * some others too.
763 */
764#define __NR__exit __NR_exit
765
766static inline pid_t setsid(void)
767{
768 return sys_setsid();
769}
770
771static inline ssize_t write(unsigned int fd, char * buf, size_t count)
772{
773 return sys_write(fd, buf, count);
774}
775
776static inline ssize_t read(unsigned int fd, char * buf, size_t count)
777{
778 return sys_read(fd, buf, count);
779}
780
781static inline off_t lseek(unsigned int fd, off_t offset, unsigned int origin)
782{
783 return sys_lseek(fd, offset, origin);
784}
785
786static inline long dup(unsigned int fd)
787{
788 return sys_dup(fd);
789}
790
791/* implemented in asm in arch/x86_64/kernel/entry.S */
792extern int execve(const char *, char * const *, char * const *);
793
794static inline long open(const char * filename, int flags, int mode)
795{
796 return sys_open(filename, flags, mode);
797}
798
799static inline long close(unsigned int fd)
800{
801 return sys_close(fd);
802}
803
804static inline pid_t waitpid(int pid, int * wait_stat, int flags)
805{
806 return sys_wait4(pid, wait_stat, flags, NULL);
807}
808
809extern long sys_mmap(unsigned long addr, unsigned long len,
810 unsigned long prot, unsigned long flags,
811 unsigned long fd, unsigned long off);
812
813extern int sys_modify_ldt(int func, void *ptr, unsigned long bytecount);
814
815asmlinkage long sys_execve(char *name, char **argv, char **envp,
816 struct pt_regs regs);
817asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
818 void *parent_tid, void *child_tid,
819 struct pt_regs regs);
820asmlinkage long sys_fork(struct pt_regs regs);
821asmlinkage long sys_vfork(struct pt_regs regs);
822asmlinkage long sys_pipe(int *fildes);
823
824#ifndef __ASSEMBLY__ 749#ifndef __ASSEMBLY__
825 750
826#include <linux/linkage.h> 751#include <linux/linkage.h>
@@ -837,8 +762,8 @@ asmlinkage long sys_rt_sigaction(int sig,
837 size_t sigsetsize); 762 size_t sigsetsize);
838 763
839#endif /* __ASSEMBLY__ */ 764#endif /* __ASSEMBLY__ */
840 765#endif /* __KERNEL__ */
841#endif /* __KERNEL_SYSCALLS__ */ 766#endif /* __NO_STUBS */
842 767
843/* 768/*
844 * "Conditional" syscalls 769 * "Conditional" syscalls
@@ -848,8 +773,4 @@ asmlinkage long sys_rt_sigaction(int sig,
848 */ 773 */
849#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 774#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
850 775
851#endif /* __NO_STUBS */
852
853#endif /* __KERNEL__ */
854
855#endif /* _ASM_X86_64_UNISTD_H_ */ 776#endif /* _ASM_X86_64_UNISTD_H_ */
diff --git a/include/asm-x86_64/unwind.h b/include/asm-x86_64/unwind.h
index 1f6e9bfb569e..2e7ff10fd775 100644
--- a/include/asm-x86_64/unwind.h
+++ b/include/asm-x86_64/unwind.h
@@ -18,6 +18,7 @@ struct unwind_frame_info
18{ 18{
19 struct pt_regs regs; 19 struct pt_regs regs;
20 struct task_struct *task; 20 struct task_struct *task;
21 unsigned call_frame:1;
21}; 22};
22 23
23#define UNW_PC(frame) (frame)->regs.rip 24#define UNW_PC(frame) (frame)->regs.rip
@@ -57,6 +58,10 @@ struct unwind_frame_info
57 PTREGS_INFO(r15), \ 58 PTREGS_INFO(r15), \
58 PTREGS_INFO(rip) 59 PTREGS_INFO(rip)
59 60
61#define UNW_DEFAULT_RA(raItem, dataAlign) \
62 ((raItem).where == Memory && \
63 !((raItem).value * (dataAlign) + 8))
64
60static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, 65static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
61 /*const*/ struct pt_regs *regs) 66 /*const*/ struct pt_regs *regs)
62{ 67{
@@ -94,8 +99,8 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
94 99
95#else 100#else
96 101
97#define UNW_PC(frame) ((void)(frame), 0) 102#define UNW_PC(frame) ((void)(frame), 0UL)
98#define UNW_SP(frame) ((void)(frame), 0) 103#define UNW_SP(frame) ((void)(frame), 0UL)
99 104
100static inline int arch_unw_user_mode(const void *info) 105static inline int arch_unw_user_mode(const void *info)
101{ 106{
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 146b24402a5f..fd452fc2c037 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -4,6 +4,7 @@
4enum vsyscall_num { 4enum vsyscall_num {
5 __NR_vgettimeofday, 5 __NR_vgettimeofday,
6 __NR_vtime, 6 __NR_vtime,
7 __NR_vgetcpu,
7}; 8};
8 9
9#define VSYSCALL_START (-10UL << 20) 10#define VSYSCALL_START (-10UL << 20)
@@ -15,7 +16,7 @@ enum vsyscall_num {
15#include <linux/seqlock.h> 16#include <linux/seqlock.h>
16 17
17#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) 18#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
18#define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) 19#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))
19#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) 20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
20#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) 21#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
21#define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16))) 22#define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16)))
@@ -26,6 +27,9 @@ enum vsyscall_num {
26#define VXTIME_HPET 2 27#define VXTIME_HPET 2
27#define VXTIME_PMTMR 3 28#define VXTIME_PMTMR 3
28 29
30#define VGETCPU_RDTSCP 1
31#define VGETCPU_LSL 2
32
29struct vxtime_data { 33struct vxtime_data {
30 long hpet_address; /* HPET base address */ 34 long hpet_address; /* HPET base address */
31 int last; 35 int last;
@@ -40,21 +44,23 @@ struct vxtime_data {
40 44
41/* vsyscall space (readonly) */ 45/* vsyscall space (readonly) */
42extern struct vxtime_data __vxtime; 46extern struct vxtime_data __vxtime;
47extern int __vgetcpu_mode;
43extern struct timespec __xtime; 48extern struct timespec __xtime;
44extern volatile unsigned long __jiffies; 49extern volatile unsigned long __jiffies;
45extern unsigned long __wall_jiffies;
46extern struct timezone __sys_tz; 50extern struct timezone __sys_tz;
47extern seqlock_t __xtime_lock; 51extern seqlock_t __xtime_lock;
48 52
49/* kernel space (writeable) */ 53/* kernel space (writeable) */
50extern struct vxtime_data vxtime; 54extern struct vxtime_data vxtime;
51extern unsigned long wall_jiffies; 55extern int vgetcpu_mode;
52extern struct timezone sys_tz; 56extern struct timezone sys_tz;
53extern int sysctl_vsyscall; 57extern int sysctl_vsyscall;
54extern seqlock_t xtime_lock; 58extern seqlock_t xtime_lock;
55 59
56extern int sysctl_vsyscall; 60extern int sysctl_vsyscall;
57 61
62extern void vsyscall_set_cpu(int cpu);
63
58#define ARCH_HAVE_XTIME_LOCK 1 64#define ARCH_HAVE_XTIME_LOCK 1
59 65
60#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h
index 3be701dfe098..ffc4dcfd6ac1 100644
--- a/include/asm-xtensa/a.out.h
+++ b/include/asm-xtensa/a.out.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/addrspace.h 2 * include/asm-xtensa/a.out.h
3 * 3 *
4 * Dummy a.out file. Xtensa does not support the a.out format, but the kernel 4 * Dummy a.out file. Xtensa does not support the a.out format, but the kernel
5 * seems to depend on it. 5 * seems to depend on it.
diff --git a/include/asm-xtensa/cache.h b/include/asm-xtensa/cache.h
index 5aae3f12407c..1e79c0e27460 100644
--- a/include/asm-xtensa/cache.h
+++ b/include/asm-xtensa/cache.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/cacheflush.h 2 * include/asm-xtensa/cache.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
diff --git a/include/asm-xtensa/coprocessor.h b/include/asm-xtensa/coprocessor.h
index a91b96dc0efe..5093034723be 100644
--- a/include/asm-xtensa/coprocessor.h
+++ b/include/asm-xtensa/coprocessor.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/cpextra.h 2 * include/asm-xtensa/coprocessor.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h
index c425f10d086a..c39c91dfcc69 100644
--- a/include/asm-xtensa/dma-mapping.h
+++ b/include/asm-xtensa/dma-mapping.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/dma_mapping.h 2 * include/asm-xtensa/dma-mapping.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
diff --git a/include/asm-xtensa/ioctls.h b/include/asm-xtensa/ioctls.h
index 3b89a772d0a0..39e6f23921bb 100644
--- a/include/asm-xtensa/ioctls.h
+++ b/include/asm-xtensa/ioctls.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/ioctl.h 2 * include/asm-xtensa/ioctls.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index a47cc734c20c..b4318934b10d 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-xtensa/page.h 2 * linux/include/asm-xtensa/pgtable.h
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version2 as 5 * it under the terms of the GNU General Public License version2 as
diff --git a/include/asm-xtensa/siginfo.h b/include/asm-xtensa/siginfo.h
index 44f0ae77b539..6916248295df 100644
--- a/include/asm-xtensa/siginfo.h
+++ b/include/asm-xtensa/siginfo.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/processor.h 2 * include/asm-xtensa/siginfo.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
diff --git a/include/asm-xtensa/timex.h b/include/asm-xtensa/timex.h
index d14a3755a12b..c7b705e66655 100644
--- a/include/asm-xtensa/timex.h
+++ b/include/asm-xtensa/timex.h
@@ -31,9 +31,6 @@
31 31
32#define CLOCK_TICK_RATE 1193180 /* (everyone is using this value) */ 32#define CLOCK_TICK_RATE 1193180 /* (everyone is using this value) */
33#define CLOCK_TICK_FACTOR 20 /* Factor of both 10^6 and CLOCK_TICK_RATE */ 33#define CLOCK_TICK_FACTOR 20 /* Factor of both 10^6 and CLOCK_TICK_RATE */
34#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
35 (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
36 << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
37 34
38#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 35#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
39extern unsigned long ccount_per_jiffy; 36extern unsigned long ccount_per_jiffy;
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h
index 5e1b99dc4ab3..411f810a55c6 100644
--- a/include/asm-xtensa/unistd.h
+++ b/include/asm-xtensa/unistd.h
@@ -402,11 +402,6 @@ __asm__ __volatile__ ( \
402__syscall_return(type,__res); \ 402__syscall_return(type,__res); \
403} 403}
404 404
405
406#ifdef __KERNEL_SYSCALLS__
407static __inline__ _syscall3(int,execve,const char*,file,char**,argv,char**,envp)
408#endif
409
410/* 405/*
411 * "Conditional" syscalls 406 * "Conditional" syscalls
412 * 407 *
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 1df2ac30a4d2..5114ff18101d 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -46,6 +46,7 @@ header-y += coff.h
46header-y += comstats.h 46header-y += comstats.h
47header-y += consolemap.h 47header-y += consolemap.h
48header-y += cycx_cfm.h 48header-y += cycx_cfm.h
49header-y += dlm_device.h
49header-y += dm-ioctl.h 50header-y += dm-ioctl.h
50header-y += dn.h 51header-y += dn.h
51header-y += dqblk_v1.h 52header-y += dqblk_v1.h
@@ -58,6 +59,7 @@ header-y += elf-em.h
58header-y += fadvise.h 59header-y += fadvise.h
59header-y += fd.h 60header-y += fd.h
60header-y += fdreg.h 61header-y += fdreg.h
62header-y += fib_rules.h
61header-y += ftape-header-segment.h 63header-y += ftape-header-segment.h
62header-y += ftape-vendors.h 64header-y += ftape-vendors.h
63header-y += fuse.h 65header-y += fuse.h
@@ -70,6 +72,7 @@ header-y += hysdn_if.h
70header-y += i2c-dev.h 72header-y += i2c-dev.h
71header-y += i8k.h 73header-y += i8k.h
72header-y += icmp.h 74header-y += icmp.h
75header-y += if_addr.h
73header-y += if_arcnet.h 76header-y += if_arcnet.h
74header-y += if_arp.h 77header-y += if_arp.h
75header-y += if_bonding.h 78header-y += if_bonding.h
@@ -79,6 +82,7 @@ header-y += if_fddi.h
79header-y += if.h 82header-y += if.h
80header-y += if_hippi.h 83header-y += if_hippi.h
81header-y += if_infiniband.h 84header-y += if_infiniband.h
85header-y += if_link.h
82header-y += if_packet.h 86header-y += if_packet.h
83header-y += if_plip.h 87header-y += if_plip.h
84header-y += if_ppp.h 88header-y += if_ppp.h
@@ -96,11 +100,11 @@ header-y += ipx.h
96header-y += irda.h 100header-y += irda.h
97header-y += isdn_divertif.h 101header-y += isdn_divertif.h
98header-y += iso_fs.h 102header-y += iso_fs.h
99header-y += ite_gpio.h
100header-y += ixjuser.h 103header-y += ixjuser.h
101header-y += jffs2.h 104header-y += jffs2.h
102header-y += keyctl.h 105header-y += keyctl.h
103header-y += limits.h 106header-y += limits.h
107header-y += lock_dlm_plock.h
104header-y += magic.h 108header-y += magic.h
105header-y += major.h 109header-y += major.h
106header-y += matroxfb.h 110header-y += matroxfb.h
@@ -110,6 +114,7 @@ header-y += mmtimer.h
110header-y += mqueue.h 114header-y += mqueue.h
111header-y += mtio.h 115header-y += mtio.h
112header-y += ncp_no.h 116header-y += ncp_no.h
117header-y += neighbour.h
113header-y += netfilter_arp.h 118header-y += netfilter_arp.h
114header-y += netrom.h 119header-y += netrom.h
115header-y += nfs2.h 120header-y += nfs2.h
@@ -152,12 +157,10 @@ header-y += toshiba.h
152header-y += ultrasound.h 157header-y += ultrasound.h
153header-y += un.h 158header-y += un.h
154header-y += utime.h 159header-y += utime.h
155header-y += utsname.h
156header-y += video_decoder.h 160header-y += video_decoder.h
157header-y += video_encoder.h 161header-y += video_encoder.h
158header-y += videotext.h 162header-y += videotext.h
159header-y += vt.h 163header-y += vt.h
160header-y += wavefront.h
161header-y += wireless.h 164header-y += wireless.h
162header-y += xattr.h 165header-y += xattr.h
163header-y += x25.h 166header-y += x25.h
@@ -190,6 +193,7 @@ unifdef-y += cyclades.h
190unifdef-y += dccp.h 193unifdef-y += dccp.h
191unifdef-y += dirent.h 194unifdef-y += dirent.h
192unifdef-y += divert.h 195unifdef-y += divert.h
196unifdef-y += dlm.h
193unifdef-y += elfcore.h 197unifdef-y += elfcore.h
194unifdef-y += errno.h 198unifdef-y += errno.h
195unifdef-y += errqueue.h 199unifdef-y += errqueue.h
@@ -206,6 +210,7 @@ unifdef-y += ftape.h
206unifdef-y += gameport.h 210unifdef-y += gameport.h
207unifdef-y += generic_serial.h 211unifdef-y += generic_serial.h
208unifdef-y += genhd.h 212unifdef-y += genhd.h
213unifdef-y += gfs2_ondisk.h
209unifdef-y += hayesesp.h 214unifdef-y += hayesesp.h
210unifdef-y += hdlcdrv.h 215unifdef-y += hdlcdrv.h
211unifdef-y += hdlc.h 216unifdef-y += hdlc.h
@@ -329,6 +334,7 @@ unifdef-y += unistd.h
329unifdef-y += usb_ch9.h 334unifdef-y += usb_ch9.h
330unifdef-y += usbdevice_fs.h 335unifdef-y += usbdevice_fs.h
331unifdef-y += user.h 336unifdef-y += user.h
337unifdef-y += utsname.h
332unifdef-y += videodev2.h 338unifdef-y += videodev2.h
333unifdef-y += videodev.h 339unifdef-y += videodev.h
334unifdef-y += wait.h 340unifdef-y += wait.h
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
index 2ed2fd855133..22eb9367235a 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -331,8 +331,6 @@ extern int ac97_read_proc (char *page_out, char **start, off_t off,
331extern int ac97_probe_codec(struct ac97_codec *); 331extern int ac97_probe_codec(struct ac97_codec *);
332extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate); 332extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);
333extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate); 333extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
334extern int ac97_save_state(struct ac97_codec *codec);
335extern int ac97_restore_state(struct ac97_codec *codec);
336 334
337extern struct ac97_codec *ac97_alloc_codec(void); 335extern struct ac97_codec *ac97_alloc_codec(void);
338extern void ac97_release_codec(struct ac97_codec *codec); 336extern void ac97_release_codec(struct ac97_codec *codec);
@@ -346,9 +344,6 @@ struct ac97_driver {
346 void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver); 344 void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver);
347}; 345};
348 346
349extern int ac97_register_driver(struct ac97_driver *driver);
350extern void ac97_unregister_driver(struct ac97_driver *driver);
351
352/* quirk types */ 347/* quirk types */
353enum { 348enum {
354 AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */ 349 AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */
diff --git a/include/linux/acct.h b/include/linux/acct.h
index e86bae7324d2..0496d1f09952 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -124,16 +124,12 @@ extern void acct_auto_close(struct super_block *sb);
124extern void acct_init_pacct(struct pacct_struct *pacct); 124extern void acct_init_pacct(struct pacct_struct *pacct);
125extern void acct_collect(long exitcode, int group_dead); 125extern void acct_collect(long exitcode, int group_dead);
126extern void acct_process(void); 126extern void acct_process(void);
127extern void acct_update_integrals(struct task_struct *tsk);
128extern void acct_clear_integrals(struct task_struct *tsk);
129#else 127#else
130#define acct_auto_close_mnt(x) do { } while (0) 128#define acct_auto_close_mnt(x) do { } while (0)
131#define acct_auto_close(x) do { } while (0) 129#define acct_auto_close(x) do { } while (0)
132#define acct_init_pacct(x) do { } while (0) 130#define acct_init_pacct(x) do { } while (0)
133#define acct_collect(x,y) do { } while (0) 131#define acct_collect(x,y) do { } while (0)
134#define acct_process() do { } while (0) 132#define acct_process() do { } while (0)
135#define acct_update_integrals(x) do { } while (0)
136#define acct_clear_integrals(task) do { } while (0)
137#endif 133#endif
138 134
139/* 135/*
diff --git a/include/linux/aer.h b/include/linux/aer.h
new file mode 100644
index 000000000000..402e178b38eb
--- /dev/null
+++ b/include/linux/aer.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2006 Intel Corp.
3 * Tom Long Nguyen (tom.l.nguyen@intel.com)
4 * Zhang Yanmin (yanmin.zhang@intel.com)
5 */
6
7#ifndef _AER_H_
8#define _AER_H_
9
10#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
13extern int pci_find_aer_capability(struct pci_dev *dev);
14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16#else
17#define pci_enable_pcie_error_reporting(dev) do { } while (0)
18#define pci_find_aer_capability(dev) do { } while (0)
19#define pci_disable_pcie_error_reporting(dev) do { } while (0)
20#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0)
21#endif
22
23#endif //_AER_H_
24
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 00c8efa95cc3..0d71c0041f13 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -4,8 +4,10 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/workqueue.h> 5#include <linux/workqueue.h>
6#include <linux/aio_abi.h> 6#include <linux/aio_abi.h>
7#include <linux/uio.h>
7 8
8#include <asm/atomic.h> 9#include <asm/atomic.h>
10#include <linux/uio.h>
9 11
10#define AIO_MAXSEGS 4 12#define AIO_MAXSEGS 4
11#define AIO_KIOGRP_NR_ATOMIC 8 13#define AIO_KIOGRP_NR_ATOMIC 8
@@ -110,8 +112,10 @@ struct kiocb {
110 char __user *ki_buf; /* remaining iocb->aio_buf */ 112 char __user *ki_buf; /* remaining iocb->aio_buf */
111 size_t ki_left; /* remaining bytes */ 113 size_t ki_left; /* remaining bytes */
112 long ki_retried; /* just for testing */ 114 long ki_retried; /* just for testing */
113 long ki_kicked; /* just for testing */ 115 struct iovec ki_inline_vec; /* inline vector */
114 long ki_queued; /* just for testing */ 116 struct iovec *ki_iovec;
117 unsigned long ki_nr_segs;
118 unsigned long ki_cur_seg;
115 119
116 struct list_head ki_list; /* the aio core uses this 120 struct list_head ki_list; /* the aio core uses this
117 * for cancellation */ 121 * for cancellation */
@@ -213,11 +217,11 @@ int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
213 struct iocb *iocb)); 217 struct iocb *iocb));
214 218
215#define get_ioctx(kioctx) do { \ 219#define get_ioctx(kioctx) do { \
216 BUG_ON(unlikely(atomic_read(&(kioctx)->users) <= 0)); \ 220 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
217 atomic_inc(&(kioctx)->users); \ 221 atomic_inc(&(kioctx)->users); \
218} while (0) 222} while (0)
219#define put_ioctx(kioctx) do { \ 223#define put_ioctx(kioctx) do { \
220 BUG_ON(unlikely(atomic_read(&(kioctx)->users) <= 0)); \ 224 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
221 if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ 225 if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \
222 __put_ioctx(kioctx); \ 226 __put_ioctx(kioctx); \
223} while (0) 227} while (0)
diff --git a/include/linux/aio_abi.h b/include/linux/aio_abi.h
index 30fdcc89d142..e3ca0a485cc6 100644
--- a/include/linux/aio_abi.h
+++ b/include/linux/aio_abi.h
@@ -1,4 +1,4 @@
1/* linux/aio_abi.h 1/* include/linux/aio_abi.h
2 * 2 *
3 * Copyright 2000,2001,2002 Red Hat. 3 * Copyright 2000,2001,2002 Red Hat.
4 * 4 *
@@ -41,6 +41,8 @@ enum {
41 * IOCB_CMD_POLL = 5, 41 * IOCB_CMD_POLL = 5,
42 */ 42 */
43 IOCB_CMD_NOOP = 6, 43 IOCB_CMD_NOOP = 6,
44 IOCB_CMD_PREADV = 7,
45 IOCB_CMD_PWRITEV = 8,
44}; 46};
45 47
46/* read() from /dev/aio returns these structures. */ 48/* read() from /dev/aio returns these structures. */
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 6ba3aa8a81f4..75b8baca08f3 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -88,15 +88,7 @@ static inline struct atalk_sock *at_sk(struct sock *sk)
88#include <asm/byteorder.h> 88#include <asm/byteorder.h>
89 89
90struct ddpehdr { 90struct ddpehdr {
91#ifdef __LITTLE_ENDIAN_BITFIELD 91 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
92 __u16 deh_len:10,
93 deh_hops:4,
94 deh_pad:2;
95#else
96 __u16 deh_pad:2,
97 deh_hops:4,
98 deh_len:10;
99#endif
100 __be16 deh_sum; 92 __be16 deh_sum;
101 __be16 deh_dnet; 93 __be16 deh_dnet;
102 __be16 deh_snet; 94 __be16 deh_snet;
@@ -112,36 +104,6 @@ static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
112 return (struct ddpehdr *)skb->h.raw; 104 return (struct ddpehdr *)skb->h.raw;
113} 105}
114 106
115/*
116 * Don't drop the struct into the struct above. You'll get some
117 * surprise padding.
118 */
119struct ddpebits {
120#ifdef __LITTLE_ENDIAN_BITFIELD
121 __u16 deh_len:10,
122 deh_hops:4,
123 deh_pad:2;
124#else
125 __u16 deh_pad:2,
126 deh_hops:4,
127 deh_len:10;
128#endif
129};
130
131/* Short form header */
132struct ddpshdr {
133#ifdef __LITTLE_ENDIAN_BITFIELD
134 __u16 dsh_len:10,
135 dsh_pad:6;
136#else
137 __u16 dsh_pad:6,
138 dsh_len:10;
139#endif
140 __u8 dsh_dport;
141 __u8 dsh_sport;
142 /* And netatalk apps expect to stick the type in themselves */
143};
144
145/* AppleTalk AARP headers */ 107/* AppleTalk AARP headers */
146struct elapaarp { 108struct elapaarp {
147 __be16 hw_type; 109 __be16 hw_type;
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index f267f2442766..6f5a1bab8f50 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -1,9 +1,7 @@
1/* 1/*
2 * 2 * ATM Lan Emulation Daemon driver interface
3 * ATM Lan Emulation Daemon vs. driver interface
4 *
5 * mkiiskila@yahoo.com
6 * 3 *
4 * Marko Kiiskila <mkiiskila@yahoo.com>
7 */ 5 */
8 6
9#ifndef _ATMLEC_H_ 7#ifndef _ATMLEC_H_
@@ -13,76 +11,87 @@
13#include <linux/atmioc.h> 11#include <linux/atmioc.h>
14#include <linux/atm.h> 12#include <linux/atm.h>
15#include <linux/if_ether.h> 13#include <linux/if_ether.h>
14
16/* ATM lec daemon control socket */ 15/* ATM lec daemon control socket */
17#define ATMLEC_CTRL _IO('a',ATMIOC_LANE) 16#define ATMLEC_CTRL _IO('a', ATMIOC_LANE)
18#define ATMLEC_DATA _IO('a',ATMIOC_LANE+1) 17#define ATMLEC_DATA _IO('a', ATMIOC_LANE+1)
19#define ATMLEC_MCAST _IO('a',ATMIOC_LANE+2) 18#define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2)
20 19
21/* Maximum number of LEC interfaces (tweakable) */ 20/* Maximum number of LEC interfaces (tweakable) */
22#define MAX_LEC_ITF 48 21#define MAX_LEC_ITF 48
23 22
24/* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring. 23/*
24 * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
25 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for 25 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
26 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS. 26 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
27 */ 27 */
28#define NUM_TR_DEVS 8 28#define NUM_TR_DEVS 8
29 29
30typedef enum { 30typedef enum {
31 l_set_mac_addr, l_del_mac_addr, 31 l_set_mac_addr,
32 l_svc_setup, 32 l_del_mac_addr,
33 l_addr_delete, l_topology_change, 33 l_svc_setup,
34 l_flush_complete, l_arp_update, 34 l_addr_delete,
35 l_narp_req, /* LANE2 mandates the use of this */ 35 l_topology_change,
36 l_config, l_flush_tran_id, 36 l_flush_complete,
37 l_set_lecid, l_arp_xmt, 37 l_arp_update,
38 l_rdesc_arp_xmt, 38 l_narp_req, /* LANE2 mandates the use of this */
39 l_associate_req, 39 l_config,
40 l_should_bridge /* should we bridge this MAC? */ 40 l_flush_tran_id,
41 l_set_lecid,
42 l_arp_xmt,
43 l_rdesc_arp_xmt,
44 l_associate_req,
45 l_should_bridge /* should we bridge this MAC? */
41} atmlec_msg_type; 46} atmlec_msg_type;
42 47
43#define ATMLEC_MSG_TYPE_MAX l_should_bridge 48#define ATMLEC_MSG_TYPE_MAX l_should_bridge
44 49
45struct atmlec_config_msg { 50struct atmlec_config_msg {
46 unsigned int maximum_unknown_frame_count; 51 unsigned int maximum_unknown_frame_count;
47 unsigned int max_unknown_frame_time; 52 unsigned int max_unknown_frame_time;
48 unsigned short max_retry_count; 53 unsigned short max_retry_count;
49 unsigned int aging_time; 54 unsigned int aging_time;
50 unsigned int forward_delay_time; 55 unsigned int forward_delay_time;
51 unsigned int arp_response_time; 56 unsigned int arp_response_time;
52 unsigned int flush_timeout; 57 unsigned int flush_timeout;
53 unsigned int path_switching_delay; 58 unsigned int path_switching_delay;
54 unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ 59 unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
55 int mtu; 60 int mtu;
56 int is_proxy; 61 int is_proxy;
57}; 62};
58 63
59struct atmlec_msg { 64struct atmlec_msg {
60 atmlec_msg_type type; 65 atmlec_msg_type type;
61 int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ 66 int sizeoftlvs; /* LANE2: if != 0, tlvs follow */
62 union { 67 union {
63 struct { 68 struct {
64 unsigned char mac_addr[ETH_ALEN]; 69 unsigned char mac_addr[ETH_ALEN];
65 unsigned char atm_addr[ATM_ESA_LEN]; 70 unsigned char atm_addr[ATM_ESA_LEN];
66 unsigned int flag;/* Topology_change flag, 71 unsigned int flag; /*
67 remoteflag, permanent flag, 72 * Topology_change flag,
68 lecid, transaction id */ 73 * remoteflag, permanent flag,
69 unsigned int targetless_le_arp; /* LANE2 */ 74 * lecid, transaction id
70 unsigned int no_source_le_narp; /* LANE2 */ 75 */
71 } normal; 76 unsigned int targetless_le_arp; /* LANE2 */
72 struct atmlec_config_msg config; 77 unsigned int no_source_le_narp; /* LANE2 */
73 struct { 78 } normal;
74 uint16_t lec_id; /* requestor lec_id */ 79 struct atmlec_config_msg config;
75 uint32_t tran_id; /* transaction id */ 80 struct {
76 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ 81 uint16_t lec_id; /* requestor lec_id */
77 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ 82 uint32_t tran_id; /* transaction id */
78 } proxy; 83 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
79 /* For mapping LE_ARP requests to responses. Filled by */ 84 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
80 } content; /* zeppelin, returned by kernel. Used only when proxying */ 85 } proxy; /*
86 * For mapping LE_ARP requests to responses. Filled by
87 * zeppelin, returned by kernel. Used only when proxying
88 */
89 } content;
81} __ATM_API_ALIGN; 90} __ATM_API_ALIGN;
82 91
83struct atmlec_ioc { 92struct atmlec_ioc {
84 int dev_num; 93 int dev_num;
85 unsigned char atm_addr[ATM_ESA_LEN]; 94 unsigned char atm_addr[ATM_ESA_LEN];
86 unsigned char receive; /* 1= receive vcc, 0 = send vcc */ 95 unsigned char receive; /* 1= receive vcc, 0 = send vcc */
87}; 96};
88#endif /* _ATMLEC_H_ */ 97#endif /* _ATMLEC_H_ */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 40a6c26294ae..b2ca666d9997 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -75,7 +75,7 @@
75#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ 75#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */
76 76
77#define AUDIT_SYSCALL 1300 /* Syscall event */ 77#define AUDIT_SYSCALL 1300 /* Syscall event */
78#define AUDIT_FS_WATCH 1301 /* Filesystem watch event */ 78/* #define AUDIT_FS_WATCH 1301 * Deprecated */
79#define AUDIT_PATH 1302 /* Filename path information */ 79#define AUDIT_PATH 1302 /* Filename path information */
80#define AUDIT_IPC 1303 /* IPC record */ 80#define AUDIT_IPC 1303 /* IPC record */
81#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ 81#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */
@@ -88,6 +88,7 @@
88#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */ 88#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */
89#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ 89#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
90#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ 90#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
91#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
91 92
92#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 93#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
93#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 94#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -95,6 +96,11 @@
95#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ 96#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
96#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ 97#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
97#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ 98#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
99#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
100#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
101#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
102#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
103#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
98 104
99#define AUDIT_FIRST_KERN_ANOM_MSG 1700 105#define AUDIT_FIRST_KERN_ANOM_MSG 1700
100#define AUDIT_LAST_KERN_ANOM_MSG 1799 106#define AUDIT_LAST_KERN_ANOM_MSG 1799
diff --git a/include/linux/awe_voice.h b/include/linux/awe_voice.h
index 4bf9f33048e2..bf33f17bea99 100644
--- a/include/linux/awe_voice.h
+++ b/include/linux/awe_voice.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * sound/awe_voice.h 2 * include/linux/awe_voice.h
3 * 3 *
4 * Voice information definitions for the low level driver for the 4 * Voice information definitions for the low level driver for the
5 * AWE32/SB32/AWE64 wave table synth. 5 * AWE32/SB32/AWE64 wave table synth.
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 76bdaeab6f62..092dbd0e7658 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -70,7 +70,8 @@ typedef void (bio_destructor_t) (struct bio *);
70 * stacking drivers) 70 * stacking drivers)
71 */ 71 */
72struct bio { 72struct bio {
73 sector_t bi_sector; 73 sector_t bi_sector; /* device address in 512 byte
74 sectors */
74 struct bio *bi_next; /* request queue link */ 75 struct bio *bi_next; /* request queue link */
75 struct block_device *bi_bdev; 76 struct block_device *bi_bdev;
76 unsigned long bi_flags; /* status, command, etc */ 77 unsigned long bi_flags; /* status, command, etc */
@@ -148,6 +149,7 @@ struct bio {
148#define BIO_RW_BARRIER 2 149#define BIO_RW_BARRIER 2
149#define BIO_RW_FAILFAST 3 150#define BIO_RW_FAILFAST 3
150#define BIO_RW_SYNC 4 151#define BIO_RW_SYNC 4
152#define BIO_RW_META 5
151 153
152/* 154/*
153 * upper 16 bits of bi_rw define the io priority of this bio 155 * upper 16 bits of bi_rw define the io priority of this bio
@@ -178,6 +180,7 @@ struct bio {
178#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) 180#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
179#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) 181#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
180#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) 182#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
183#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
181 184
182/* 185/*
183 * will die 186 * will die
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c773ee545ebd..26f7856ff812 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_BLKDEV_H 1#ifndef _LINUX_BLKDEV_H
2#define _LINUX_BLKDEV_H 2#define _LINUX_BLKDEV_H
3 3
4#include <linux/sched.h>
4#include <linux/major.h> 5#include <linux/major.h>
5#include <linux/genhd.h> 6#include <linux/genhd.h>
6#include <linux/list.h> 7#include <linux/list.h>
@@ -16,6 +17,22 @@
16 17
17#include <asm/scatterlist.h> 18#include <asm/scatterlist.h>
18 19
20#ifdef CONFIG_LBD
21# include <asm/div64.h>
22# define sector_div(a, b) do_div(a, b)
23#else
24# define sector_div(n, b)( \
25{ \
26 int _res; \
27 _res = (n) % (b); \
28 (n) /= (b); \
29 _res; \
30} \
31)
32#endif
33
34#ifdef CONFIG_BLOCK
35
19struct scsi_ioctl_command; 36struct scsi_ioctl_command;
20 37
21struct request_queue; 38struct request_queue;
@@ -90,7 +107,7 @@ struct io_context {
90 atomic_t refcount; 107 atomic_t refcount;
91 struct task_struct *task; 108 struct task_struct *task;
92 109
93 int (*set_ioprio)(struct io_context *, unsigned int); 110 unsigned int ioprio_changed;
94 111
95 /* 112 /*
96 * For request batching 113 * For request batching
@@ -104,8 +121,7 @@ struct io_context {
104 121
105void put_io_context(struct io_context *ioc); 122void put_io_context(struct io_context *ioc);
106void exit_io_context(void); 123void exit_io_context(void);
107struct io_context *current_io_context(gfp_t gfp_flags); 124struct io_context *get_io_context(gfp_t gfp_flags, int node);
108struct io_context *get_io_context(gfp_t gfp_flags);
109void copy_io_context(struct io_context **pdst, struct io_context **psrc); 125void copy_io_context(struct io_context **pdst, struct io_context **psrc);
110void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); 126void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
111 127
@@ -120,6 +136,90 @@ struct request_list {
120 wait_queue_head_t wait[2]; 136 wait_queue_head_t wait[2];
121}; 137};
122 138
139/*
140 * request command types
141 */
142enum rq_cmd_type_bits {
143 REQ_TYPE_FS = 1, /* fs request */
144 REQ_TYPE_BLOCK_PC, /* scsi command */
145 REQ_TYPE_SENSE, /* sense request */
146 REQ_TYPE_PM_SUSPEND, /* suspend request */
147 REQ_TYPE_PM_RESUME, /* resume request */
148 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
149 REQ_TYPE_FLUSH, /* flush request */
150 REQ_TYPE_SPECIAL, /* driver defined type */
151 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
152 /*
153 * for ATA/ATAPI devices. this really doesn't belong here, ide should
154 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
155 * private REQ_LB opcodes to differentiate what type of request this is
156 */
157 REQ_TYPE_ATA_CMD,
158 REQ_TYPE_ATA_TASK,
159 REQ_TYPE_ATA_TASKFILE,
160};
161
162/*
163 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
164 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
165 * SCSI cdb.
166 *
167 * 0x00 -> 0x3f are driver private, to be used for whatever purpose they need,
168 * typically to differentiate REQ_TYPE_SPECIAL requests.
169 *
170 */
171enum {
172 /*
173 * just examples for now
174 */
175 REQ_LB_OP_EJECT = 0x40, /* eject request */
176 REQ_LB_OP_FLUSH = 0x41, /* flush device */
177};
178
179/*
180 * request type modified bits. first three bits match BIO_RW* bits, important
181 */
182enum rq_flag_bits {
183 __REQ_RW, /* not set, read. set, write */
184 __REQ_FAILFAST, /* no low level driver retries */
185 __REQ_SORTED, /* elevator knows about this request */
186 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
187 __REQ_HARDBARRIER, /* may not be passed by drive either */
188 __REQ_FUA, /* forced unit access */
189 __REQ_NOMERGE, /* don't touch this for merging */
190 __REQ_STARTED, /* drive already may have started this one */
191 __REQ_DONTPREP, /* don't call prep for this one */
192 __REQ_QUEUED, /* uses queueing */
193 __REQ_ELVPRIV, /* elevator private data attached */
194 __REQ_FAILED, /* set if the request failed */
195 __REQ_QUIET, /* don't worry about errors */
196 __REQ_PREEMPT, /* set for "ide_preempt" requests */
197 __REQ_ORDERED_COLOR, /* is before or after barrier */
198 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
199 __REQ_ALLOCED, /* request came from our alloc pool */
200 __REQ_RW_META, /* metadata io request */
201 __REQ_NR_BITS, /* stops here */
202};
203
204#define REQ_RW (1 << __REQ_RW)
205#define REQ_FAILFAST (1 << __REQ_FAILFAST)
206#define REQ_SORTED (1 << __REQ_SORTED)
207#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
208#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
209#define REQ_FUA (1 << __REQ_FUA)
210#define REQ_NOMERGE (1 << __REQ_NOMERGE)
211#define REQ_STARTED (1 << __REQ_STARTED)
212#define REQ_DONTPREP (1 << __REQ_DONTPREP)
213#define REQ_QUEUED (1 << __REQ_QUEUED)
214#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
215#define REQ_FAILED (1 << __REQ_FAILED)
216#define REQ_QUIET (1 << __REQ_QUIET)
217#define REQ_PREEMPT (1 << __REQ_PREEMPT)
218#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
219#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
220#define REQ_ALLOCED (1 << __REQ_ALLOCED)
221#define REQ_RW_META (1 << __REQ_RW_META)
222
123#define BLK_MAX_CDB 16 223#define BLK_MAX_CDB 16
124 224
125/* 225/*
@@ -129,30 +229,46 @@ struct request {
129 struct list_head queuelist; 229 struct list_head queuelist;
130 struct list_head donelist; 230 struct list_head donelist;
131 231
132 unsigned long flags; /* see REQ_ bits below */ 232 request_queue_t *q;
233
234 unsigned int cmd_flags;
235 enum rq_cmd_type_bits cmd_type;
133 236
134 /* Maintain bio traversal state for part by part I/O submission. 237 /* Maintain bio traversal state for part by part I/O submission.
135 * hard_* are block layer internals, no driver should touch them! 238 * hard_* are block layer internals, no driver should touch them!
136 */ 239 */
137 240
138 sector_t sector; /* next sector to submit */ 241 sector_t sector; /* next sector to submit */
242 sector_t hard_sector; /* next sector to complete */
139 unsigned long nr_sectors; /* no. of sectors left to submit */ 243 unsigned long nr_sectors; /* no. of sectors left to submit */
244 unsigned long hard_nr_sectors; /* no. of sectors left to complete */
140 /* no. of sectors left to submit in the current segment */ 245 /* no. of sectors left to submit in the current segment */
141 unsigned int current_nr_sectors; 246 unsigned int current_nr_sectors;
142 247
143 sector_t hard_sector; /* next sector to complete */
144 unsigned long hard_nr_sectors; /* no. of sectors left to complete */
145 /* no. of sectors left to complete in the current segment */ 248 /* no. of sectors left to complete in the current segment */
146 unsigned int hard_cur_sectors; 249 unsigned int hard_cur_sectors;
147 250
148 struct bio *bio; 251 struct bio *bio;
149 struct bio *biotail; 252 struct bio *biotail;
150 253
254 struct hlist_node hash; /* merge hash */
255 /*
256 * The rb_node is only used inside the io scheduler, requests
257 * are pruned when moved to the dispatch queue. So let the
258 * completion_data share space with the rb_node.
259 */
260 union {
261 struct rb_node rb_node; /* sort/lookup */
262 void *completion_data;
263 };
264
265 /*
266 * two pointers are available for the IO schedulers, if they need
267 * more they have to dynamically allocate it.
268 */
151 void *elevator_private; 269 void *elevator_private;
152 void *completion_data; 270 void *elevator_private2;
153 271
154 int rq_status; /* should split this into a few status bits */
155 int errors;
156 struct gendisk *rq_disk; 272 struct gendisk *rq_disk;
157 unsigned long start_time; 273 unsigned long start_time;
158 274
@@ -170,15 +286,13 @@ struct request {
170 286
171 unsigned short ioprio; 287 unsigned short ioprio;
172 288
289 void *special;
290 char *buffer;
291
173 int tag; 292 int tag;
293 int errors;
174 294
175 int ref_count; 295 int ref_count;
176 request_queue_t *q;
177 struct request_list *rl;
178
179 struct completion *waiting;
180 void *special;
181 char *buffer;
182 296
183 /* 297 /*
184 * when request is used as a packet command carrier 298 * when request is used as a packet command carrier
@@ -195,80 +309,14 @@ struct request {
195 int retries; 309 int retries;
196 310
197 /* 311 /*
198 * completion callback. end_io_data should be folded in with waiting 312 * completion callback.
199 */ 313 */
200 rq_end_io_fn *end_io; 314 rq_end_io_fn *end_io;
201 void *end_io_data; 315 void *end_io_data;
202}; 316};
203 317
204/* 318/*
205 * first three bits match BIO_RW* bits, important 319 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME
206 */
207enum rq_flag_bits {
208 __REQ_RW, /* not set, read. set, write */
209 __REQ_FAILFAST, /* no low level driver retries */
210 __REQ_SORTED, /* elevator knows about this request */
211 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
212 __REQ_HARDBARRIER, /* may not be passed by drive either */
213 __REQ_FUA, /* forced unit access */
214 __REQ_CMD, /* is a regular fs rw request */
215 __REQ_NOMERGE, /* don't touch this for merging */
216 __REQ_STARTED, /* drive already may have started this one */
217 __REQ_DONTPREP, /* don't call prep for this one */
218 __REQ_QUEUED, /* uses queueing */
219 __REQ_ELVPRIV, /* elevator private data attached */
220 /*
221 * for ATA/ATAPI devices
222 */
223 __REQ_PC, /* packet command (special) */
224 __REQ_BLOCK_PC, /* queued down pc from block layer */
225 __REQ_SENSE, /* sense retrival */
226
227 __REQ_FAILED, /* set if the request failed */
228 __REQ_QUIET, /* don't worry about errors */
229 __REQ_SPECIAL, /* driver suplied command */
230 __REQ_DRIVE_CMD,
231 __REQ_DRIVE_TASK,
232 __REQ_DRIVE_TASKFILE,
233 __REQ_PREEMPT, /* set for "ide_preempt" requests */
234 __REQ_PM_SUSPEND, /* suspend request */
235 __REQ_PM_RESUME, /* resume request */
236 __REQ_PM_SHUTDOWN, /* shutdown request */
237 __REQ_ORDERED_COLOR, /* is before or after barrier */
238 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
239 __REQ_NR_BITS, /* stops here */
240};
241
242#define REQ_RW (1 << __REQ_RW)
243#define REQ_FAILFAST (1 << __REQ_FAILFAST)
244#define REQ_SORTED (1 << __REQ_SORTED)
245#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
246#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
247#define REQ_FUA (1 << __REQ_FUA)
248#define REQ_CMD (1 << __REQ_CMD)
249#define REQ_NOMERGE (1 << __REQ_NOMERGE)
250#define REQ_STARTED (1 << __REQ_STARTED)
251#define REQ_DONTPREP (1 << __REQ_DONTPREP)
252#define REQ_QUEUED (1 << __REQ_QUEUED)
253#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
254#define REQ_PC (1 << __REQ_PC)
255#define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC)
256#define REQ_SENSE (1 << __REQ_SENSE)
257#define REQ_FAILED (1 << __REQ_FAILED)
258#define REQ_QUIET (1 << __REQ_QUIET)
259#define REQ_SPECIAL (1 << __REQ_SPECIAL)
260#define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD)
261#define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK)
262#define REQ_DRIVE_TASKFILE (1 << __REQ_DRIVE_TASKFILE)
263#define REQ_PREEMPT (1 << __REQ_PREEMPT)
264#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND)
265#define REQ_PM_RESUME (1 << __REQ_PM_RESUME)
266#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN)
267#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
268#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
269
270/*
271 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME
272 * requests. Some step values could eventually be made generic. 320 * requests. Some step values could eventually be made generic.
273 */ 321 */
274struct request_pm_state 322struct request_pm_state
@@ -417,9 +465,9 @@ struct request_queue
417 unsigned int sg_timeout; 465 unsigned int sg_timeout;
418 unsigned int sg_reserved_size; 466 unsigned int sg_reserved_size;
419 int node; 467 int node;
420 468#ifdef CONFIG_BLK_DEV_IO_TRACE
421 struct blk_trace *blk_trace; 469 struct blk_trace *blk_trace;
422 470#endif
423 /* 471 /*
424 * reserved for flush operations 472 * reserved for flush operations
425 */ 473 */
@@ -432,9 +480,6 @@ struct request_queue
432 struct mutex sysfs_lock; 480 struct mutex sysfs_lock;
433}; 481};
434 482
435#define RQ_INACTIVE (-1)
436#define RQ_ACTIVE 1
437
438#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 483#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
439#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 484#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
440#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 485#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
@@ -490,25 +535,34 @@ enum {
490#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 535#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
491#define blk_queue_flushing(q) ((q)->ordseq) 536#define blk_queue_flushing(q) ((q)->ordseq)
492 537
493#define blk_fs_request(rq) ((rq)->flags & REQ_CMD) 538#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
494#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) 539#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
495#define blk_noretry_request(rq) ((rq)->flags & REQ_FAILFAST) 540#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL)
496#define blk_rq_started(rq) ((rq)->flags & REQ_STARTED) 541#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE)
542
543#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST)
544#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
497 545
498#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) 546#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq))
499 547
500#define blk_pm_suspend_request(rq) ((rq)->flags & REQ_PM_SUSPEND) 548#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
501#define blk_pm_resume_request(rq) ((rq)->flags & REQ_PM_RESUME) 549#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
502#define blk_pm_request(rq) \ 550#define blk_pm_request(rq) \
503 ((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME)) 551 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq))
504 552
505#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED) 553#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
506#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) 554#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
507#define blk_fua_rq(rq) ((rq)->flags & REQ_FUA) 555#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
508 556
509#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 557#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
510 558
511#define rq_data_dir(rq) ((rq)->flags & 1) 559#define rq_data_dir(rq) ((rq)->cmd_flags & 1)
560
561/*
562 * We regard a request as sync, if it's a READ or a SYNC write.
563 */
564#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC)
565#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
512 566
513static inline int blk_queue_full(struct request_queue *q, int rw) 567static inline int blk_queue_full(struct request_queue *q, int rw)
514{ 568{
@@ -541,13 +595,7 @@ static inline void blk_clear_queue_full(struct request_queue *q, int rw)
541#define RQ_NOMERGE_FLAGS \ 595#define RQ_NOMERGE_FLAGS \
542 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 596 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
543#define rq_mergeable(rq) \ 597#define rq_mergeable(rq) \
544 (!((rq)->flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq))) 598 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq)))
545
546/*
547 * noop, requests are automagically marked as active/inactive by I/O
548 * scheduler -- see elv_next_request
549 */
550#define blk_queue_headactive(q, head_active)
551 599
552/* 600/*
553 * q->prep_rq_fn return values 601 * q->prep_rq_fn return values
@@ -586,11 +634,6 @@ static inline void blk_queue_bounce(request_queue_t *q, struct bio **bio)
586 if ((rq->bio)) \ 634 if ((rq->bio)) \
587 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) 635 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
588 636
589struct sec_size {
590 unsigned block_size;
591 unsigned block_size_bits;
592};
593
594extern int blk_register_queue(struct gendisk *disk); 637extern int blk_register_queue(struct gendisk *disk);
595extern void blk_unregister_queue(struct gendisk *disk); 638extern void blk_unregister_queue(struct gendisk *disk);
596extern void register_disk(struct gendisk *dev); 639extern void register_disk(struct gendisk *dev);
@@ -612,6 +655,7 @@ extern void blk_stop_queue(request_queue_t *q);
612extern void blk_sync_queue(struct request_queue *q); 655extern void blk_sync_queue(struct request_queue *q);
613extern void __blk_stop_queue(request_queue_t *q); 656extern void __blk_stop_queue(request_queue_t *q);
614extern void blk_run_queue(request_queue_t *); 657extern void blk_run_queue(request_queue_t *);
658extern void blk_start_queueing(request_queue_t *);
615extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); 659extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
616extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int); 660extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int);
617extern int blk_rq_unmap_user(struct bio *, unsigned int); 661extern int blk_rq_unmap_user(struct bio *, unsigned int);
@@ -655,16 +699,6 @@ extern void end_that_request_last(struct request *, int);
655extern void end_request(struct request *req, int uptodate); 699extern void end_request(struct request *req, int uptodate);
656extern void blk_complete_request(struct request *); 700extern void blk_complete_request(struct request *);
657 701
658static inline int rq_all_done(struct request *rq, unsigned int nr_bytes)
659{
660 if (blk_fs_request(rq))
661 return (nr_bytes >= (rq->hard_nr_sectors << 9));
662 else if (blk_pc_request(rq))
663 return nr_bytes >= rq->data_len;
664
665 return 0;
666}
667
668/* 702/*
669 * end_that_request_first/chunk() takes an uptodate argument. we account 703 * end_that_request_first/chunk() takes an uptodate argument. we account
670 * any value <= as an io error. 0 means -EIO for compatability reasons, 704 * any value <= as an io error. 0 means -EIO for compatability reasons,
@@ -679,21 +713,6 @@ static inline void blkdev_dequeue_request(struct request *req)
679} 713}
680 714
681/* 715/*
682 * This should be in elevator.h, but that requires pulling in rq and q
683 */
684static inline void elv_dispatch_add_tail(struct request_queue *q,
685 struct request *rq)
686{
687 if (q->last_merge == rq)
688 q->last_merge = NULL;
689 q->nr_sorted--;
690
691 q->end_sector = rq_end_sector(rq);
692 q->boundary_rq = rq;
693 list_add_tail(&rq->queuelist, &q->queue_head);
694}
695
696/*
697 * Access functions for manipulating queue properties 716 * Access functions for manipulating queue properties
698 */ 717 */
699extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn, 718extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn,
@@ -737,7 +756,7 @@ extern void blk_put_queue(request_queue_t *);
737 */ 756 */
738#define blk_queue_tag_depth(q) ((q)->queue_tags->busy) 757#define blk_queue_tag_depth(q) ((q)->queue_tags->busy)
739#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth) 758#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth)
740#define blk_rq_tagged(rq) ((rq)->flags & REQ_QUEUED) 759#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
741extern int blk_queue_start_tag(request_queue_t *, struct request *); 760extern int blk_queue_start_tag(request_queue_t *, struct request *);
742extern struct request *blk_queue_find_tag(request_queue_t *, int); 761extern struct request *blk_queue_find_tag(request_queue_t *, int);
743extern void blk_queue_end_tag(request_queue_t *, struct request *); 762extern void blk_queue_end_tag(request_queue_t *, struct request *);
@@ -750,6 +769,14 @@ extern struct blk_queue_tag *blk_init_tags(int);
750extern void blk_free_tags(struct blk_queue_tag *); 769extern void blk_free_tags(struct blk_queue_tag *);
751extern void blk_congestion_end(int rw); 770extern void blk_congestion_end(int rw);
752 771
772static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
773 int tag)
774{
775 if (unlikely(bqt == NULL || tag >= bqt->real_max_depth))
776 return NULL;
777 return bqt->tag_index[tag];
778}
779
753extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *); 780extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
754extern int blkdev_issue_flush(struct block_device *, sector_t *); 781extern int blkdev_issue_flush(struct block_device *, sector_t *);
755 782
@@ -787,14 +814,6 @@ static inline int queue_dma_alignment(request_queue_t *q)
787 return retval; 814 return retval;
788} 815}
789 816
790static inline int bdev_dma_aligment(struct block_device *bdev)
791{
792 return queue_dma_alignment(bdev_get_queue(bdev));
793}
794
795#define blk_finished_io(nsects) do { } while (0)
796#define blk_started_io(nsects) do { } while (0)
797
798/* assumes size > 256 */ 817/* assumes size > 256 */
799static inline unsigned int blksize_bits(unsigned int size) 818static inline unsigned int blksize_bits(unsigned int size)
800{ 819{
@@ -824,24 +843,32 @@ struct work_struct;
824int kblockd_schedule_work(struct work_struct *work); 843int kblockd_schedule_work(struct work_struct *work);
825void kblockd_flush(void); 844void kblockd_flush(void);
826 845
827#ifdef CONFIG_LBD
828# include <asm/div64.h>
829# define sector_div(a, b) do_div(a, b)
830#else
831# define sector_div(n, b)( \
832{ \
833 int _res; \
834 _res = (n) % (b); \
835 (n) /= (b); \
836 _res; \
837} \
838)
839#endif
840
841#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 846#define MODULE_ALIAS_BLOCKDEV(major,minor) \
842 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 847 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
843#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 848#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
844 MODULE_ALIAS("block-major-" __stringify(major) "-*") 849 MODULE_ALIAS("block-major-" __stringify(major) "-*")
845 850
846 851
852#else /* CONFIG_BLOCK */
853/*
854 * stubs for when the block layer is configured out
855 */
856#define buffer_heads_over_limit 0
857
858static inline long blk_congestion_wait(int rw, long timeout)
859{
860 return io_schedule_timeout(timeout);
861}
862
863static inline long nr_blockdev_pages(void)
864{
865 return 0;
866}
867
868static inline void exit_io_context(void)
869{
870}
871
872#endif /* CONFIG_BLOCK */
873
847#endif 874#endif
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7520cc1ff9e2..b99a714fcac6 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -20,6 +20,7 @@ enum blktrace_cat {
20 BLK_TC_PC = 1 << 9, /* pc requests */ 20 BLK_TC_PC = 1 << 9, /* pc requests */
21 BLK_TC_NOTIFY = 1 << 10, /* special message */ 21 BLK_TC_NOTIFY = 1 << 10, /* special message */
22 BLK_TC_AHEAD = 1 << 11, /* readahead */ 22 BLK_TC_AHEAD = 1 << 11, /* readahead */
23 BLK_TC_META = 1 << 12, /* metadata */
23 24
24 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 25 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
25}; 26};
@@ -148,7 +149,7 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
148 u32 what) 149 u32 what)
149{ 150{
150 struct blk_trace *bt = q->blk_trace; 151 struct blk_trace *bt = q->blk_trace;
151 int rw = rq->flags & 0x03; 152 int rw = rq->cmd_flags & 0x03;
152 153
153 if (likely(!bt)) 154 if (likely(!bt))
154 return; 155 return;
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 737e407d0cd1..131ffd37e716 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -14,6 +14,8 @@
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <asm/atomic.h> 15#include <asm/atomic.h>
16 16
17#ifdef CONFIG_BLOCK
18
17enum bh_state_bits { 19enum bh_state_bits {
18 BH_Uptodate, /* Contains valid data */ 20 BH_Uptodate, /* Contains valid data */
19 BH_Dirty, /* Is dirty */ 21 BH_Dirty, /* Is dirty */
@@ -190,9 +192,7 @@ extern int buffer_heads_over_limit;
190 * Generic address_space_operations implementations for buffer_head-backed 192 * Generic address_space_operations implementations for buffer_head-backed
191 * address_spaces. 193 * address_spaces.
192 */ 194 */
193int try_to_release_page(struct page * page, gfp_t gfp_mask);
194void block_invalidatepage(struct page *page, unsigned long offset); 195void block_invalidatepage(struct page *page, unsigned long offset);
195void do_invalidatepage(struct page *page, unsigned long offset);
196int block_write_full_page(struct page *page, get_block_t *get_block, 196int block_write_full_page(struct page *page, get_block_t *get_block,
197 struct writeback_control *wbc); 197 struct writeback_control *wbc);
198int block_read_full_page(struct page*, get_block_t*); 198int block_read_full_page(struct page*, get_block_t*);
@@ -302,4 +302,19 @@ static inline void lock_buffer(struct buffer_head *bh)
302 __lock_buffer(bh); 302 __lock_buffer(bh);
303} 303}
304 304
305extern int __set_page_dirty_buffers(struct page *page);
306
307#else /* CONFIG_BLOCK */
308
309static inline void buffer_init(void) {}
310static inline int try_to_free_buffers(struct page *page) { return 1; }
311static inline int sync_blockdev(struct block_device *bdev) { return 0; }
312static inline int inode_has_buffers(struct inode *inode) { return 0; }
313static inline void invalidate_inode_buffers(struct inode *inode) {}
314static inline int remove_inode_buffers(struct inode *inode) { return 1; }
315static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
316static inline void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) {}
317
318
319#endif /* CONFIG_BLOCK */
305#endif /* _LINUX_BUFFER_HEAD_H */ 320#endif /* _LINUX_BUFFER_HEAD_H */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 2216638962d2..ee5f53f2ca15 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -23,5 +23,7 @@ void cdev_del(struct cdev *);
23 23
24void cd_forget(struct inode *); 24void cd_forget(struct inode *);
25 25
26extern struct backing_dev_info directly_mappable_cdev_bdi;
27
26#endif 28#endif
27#endif 29#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 9760753e662b..ef5cd192784c 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -13,6 +13,7 @@
13 13
14#include <asm/compat.h> 14#include <asm/compat.h>
15#include <asm/siginfo.h> 15#include <asm/siginfo.h>
16#include <asm/signal.h>
16 17
17#define compat_jiffies_to_clock_t(x) \ 18#define compat_jiffies_to_clock_t(x) \
18 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
@@ -227,6 +228,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
227asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 228asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
228 229
229extern int compat_printk(const char *fmt, ...); 230extern int compat_printk(const char *fmt, ...);
231extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
230 232
231#endif /* CONFIG_COMPAT */ 233#endif /* CONFIG_COMPAT */
232#endif /* _LINUX_COMPAT_H */ 234#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index bea0255196c4..4e1663d7691e 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -90,6 +90,7 @@ COMPATIBLE_IOCTL(FDTWADDLE)
90COMPATIBLE_IOCTL(FDFMTTRK) 90COMPATIBLE_IOCTL(FDFMTTRK)
91COMPATIBLE_IOCTL(FDRAWCMD) 91COMPATIBLE_IOCTL(FDRAWCMD)
92/* 0x12 */ 92/* 0x12 */
93#ifdef CONFIG_BLOCK
93COMPATIBLE_IOCTL(BLKRASET) 94COMPATIBLE_IOCTL(BLKRASET)
94COMPATIBLE_IOCTL(BLKROSET) 95COMPATIBLE_IOCTL(BLKROSET)
95COMPATIBLE_IOCTL(BLKROGET) 96COMPATIBLE_IOCTL(BLKROGET)
@@ -103,6 +104,7 @@ COMPATIBLE_IOCTL(BLKTRACESETUP)
103COMPATIBLE_IOCTL(BLKTRACETEARDOWN) 104COMPATIBLE_IOCTL(BLKTRACETEARDOWN)
104ULONG_IOCTL(BLKRASET) 105ULONG_IOCTL(BLKRASET)
105ULONG_IOCTL(BLKFRASET) 106ULONG_IOCTL(BLKFRASET)
107#endif
106/* RAID */ 108/* RAID */
107COMPATIBLE_IOCTL(RAID_VERSION) 109COMPATIBLE_IOCTL(RAID_VERSION)
108COMPATIBLE_IOCTL(GET_ARRAY_INFO) 110COMPATIBLE_IOCTL(GET_ARRAY_INFO)
@@ -120,10 +122,10 @@ COMPATIBLE_IOCTL(PROTECT_ARRAY)
120ULONG_IOCTL(HOT_ADD_DISK) 122ULONG_IOCTL(HOT_ADD_DISK)
121ULONG_IOCTL(SET_DISK_FAULTY) 123ULONG_IOCTL(SET_DISK_FAULTY)
122COMPATIBLE_IOCTL(RUN_ARRAY) 124COMPATIBLE_IOCTL(RUN_ARRAY)
123ULONG_IOCTL(START_ARRAY)
124COMPATIBLE_IOCTL(STOP_ARRAY) 125COMPATIBLE_IOCTL(STOP_ARRAY)
125COMPATIBLE_IOCTL(STOP_ARRAY_RO) 126COMPATIBLE_IOCTL(STOP_ARRAY_RO)
126COMPATIBLE_IOCTL(RESTART_ARRAY_RW) 127COMPATIBLE_IOCTL(RESTART_ARRAY_RW)
128ULONG_IOCTL(SET_BITMAP_FILE)
127/* DM */ 129/* DM */
128COMPATIBLE_IOCTL(DM_VERSION_32) 130COMPATIBLE_IOCTL(DM_VERSION_32)
129COMPATIBLE_IOCTL(DM_REMOVE_ALL_32) 131COMPATIBLE_IOCTL(DM_REMOVE_ALL_32)
@@ -395,12 +397,6 @@ COMPATIBLE_IOCTL(DVD_WRITE_STRUCT)
395COMPATIBLE_IOCTL(DVD_AUTH) 397COMPATIBLE_IOCTL(DVD_AUTH)
396/* pktcdvd */ 398/* pktcdvd */
397COMPATIBLE_IOCTL(PACKET_CTRL_CMD) 399COMPATIBLE_IOCTL(PACKET_CTRL_CMD)
398/* Big L */
399ULONG_IOCTL(LOOP_SET_FD)
400ULONG_IOCTL(LOOP_CHANGE_FD)
401COMPATIBLE_IOCTL(LOOP_CLR_FD)
402COMPATIBLE_IOCTL(LOOP_GET_STATUS64)
403COMPATIBLE_IOCTL(LOOP_SET_STATUS64)
404/* Big A */ 400/* Big A */
405/* sparc only */ 401/* sparc only */
406/* Big Q for sound/OSS */ 402/* Big Q for sound/OSS */
@@ -573,18 +569,6 @@ COMPATIBLE_IOCTL(RAW_SETBIND)
573COMPATIBLE_IOCTL(RAW_GETBIND) 569COMPATIBLE_IOCTL(RAW_GETBIND)
574/* SMB ioctls which do not need any translations */ 570/* SMB ioctls which do not need any translations */
575COMPATIBLE_IOCTL(SMB_IOC_NEWCONN) 571COMPATIBLE_IOCTL(SMB_IOC_NEWCONN)
576/* NCP ioctls which do not need any translations */
577COMPATIBLE_IOCTL(NCP_IOC_CONN_LOGGED_IN)
578COMPATIBLE_IOCTL(NCP_IOC_SIGN_INIT)
579COMPATIBLE_IOCTL(NCP_IOC_SIGN_WANTED)
580COMPATIBLE_IOCTL(NCP_IOC_SET_SIGN_WANTED)
581COMPATIBLE_IOCTL(NCP_IOC_LOCKUNLOCK)
582COMPATIBLE_IOCTL(NCP_IOC_GETROOT)
583COMPATIBLE_IOCTL(NCP_IOC_SETROOT)
584COMPATIBLE_IOCTL(NCP_IOC_GETCHARSETS)
585COMPATIBLE_IOCTL(NCP_IOC_SETCHARSETS)
586COMPATIBLE_IOCTL(NCP_IOC_GETDENTRYTTL)
587COMPATIBLE_IOCTL(NCP_IOC_SETDENTRYTTL)
588/* Little a */ 572/* Little a */
589COMPATIBLE_IOCTL(ATMSIGD_CTRL) 573COMPATIBLE_IOCTL(ATMSIGD_CTRL)
590COMPATIBLE_IOCTL(ATMARPD_CTRL) 574COMPATIBLE_IOCTL(ATMARPD_CTRL)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 9b4f11094937..538423d4a865 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -10,11 +10,11 @@
10# define __force __attribute__((force)) 10# define __force __attribute__((force))
11# define __nocast __attribute__((nocast)) 11# define __nocast __attribute__((nocast))
12# define __iomem __attribute__((noderef, address_space(2))) 12# define __iomem __attribute__((noderef, address_space(2)))
13# define __acquires(x) __attribute__((context(0,1))) 13# define __acquires(x) __attribute__((context(x,0,1)))
14# define __releases(x) __attribute__((context(1,0))) 14# define __releases(x) __attribute__((context(x,1,0)))
15# define __acquire(x) __context__(1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x) ((x) ? ({ __context__(1); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18extern void __chk_user_ptr(void __user *); 18extern void __chk_user_ptr(void __user *);
19extern void __chk_io_ptr(void __iomem *); 19extern void __chk_io_ptr(void __iomem *);
20#else 20#else
@@ -31,7 +31,7 @@ extern void __chk_io_ptr(void __iomem *);
31# define __releases(x) 31# define __releases(x)
32# define __acquire(x) (void)0 32# define __acquire(x) (void)0
33# define __release(x) (void)0 33# define __release(x) (void)0
34# define __cond_lock(x) (x) 34# define __cond_lock(x,c) (c)
35#endif 35#endif
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
@@ -99,6 +99,11 @@ extern void __chk_io_ptr(void __iomem *);
99#define __must_check 99#define __must_check
100#endif 100#endif
101 101
102#ifndef CONFIG_ENABLE_MUST_CHECK
103#undef __must_check
104#define __must_check
105#endif
106
102/* 107/*
103 * Allow us to avoid 'defined but not used' warnings on functions and data, 108 * Allow us to avoid 'defined but not used' warnings on functions and data,
104 * as well as force them to be emitted to the assembly file. 109 * as well as force them to be emitted to the assembly file.
diff --git a/include/linux/config.h b/include/linux/config.h
index a91f5e55b525..479ffb0a22d8 100644
--- a/include/linux/config.h
+++ b/include/linux/config.h
@@ -3,6 +3,7 @@
3/* This file is no longer in use and kept only for backward compatibility. 3/* This file is no longer in use and kept only for backward compatibility.
4 * autoconf.h is now included via -imacros on the commandline 4 * autoconf.h is now included via -imacros on the commandline
5 */ 5 */
6#warning Including config.h is deprecated.
6#include <linux/autoconf.h> 7#include <linux/autoconf.h>
7 8
8#endif 9#endif
diff --git a/include/linux/console.h b/include/linux/console.h
index 76a1807726eb..7d0420274de0 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -129,6 +129,9 @@ static inline void suspend_console(void) {}
129static inline void resume_console(void) {} 129static inline void resume_console(void) {}
130#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */ 130#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
131 131
132int mda_console_init(void);
133void prom_con_init(void);
134
132/* Some debug stub to catch some of the obvious races in the VT code */ 135/* Some debug stub to catch some of the obvious races in the VT code */
133#if 1 136#if 1
134#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) 137#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress)
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 25423f79bf9f..ed6c0fee1ac7 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -54,7 +54,7 @@ struct vc_data {
54 struct tty_struct *vc_tty; /* TTY we are attached to */ 54 struct tty_struct *vc_tty; /* TTY we are attached to */
55 /* data for manual vt switching */ 55 /* data for manual vt switching */
56 struct vt_mode vt_mode; 56 struct vt_mode vt_mode;
57 int vt_pid; 57 struct pid *vt_pid;
58 int vt_newvt; 58 int vt_newvt;
59 wait_queue_head_t paste_wait; 59 wait_queue_head_t paste_wait;
60 /* mode flags */ 60 /* mode flags */
diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h
index 65842efc1b70..82c9a1f11020 100644
--- a/include/linux/consolemap.h
+++ b/include/linux/consolemap.h
@@ -13,3 +13,4 @@ struct vc_data;
13extern unsigned char inverse_translate(struct vc_data *conp, int glyph); 13extern unsigned char inverse_translate(struct vc_data *conp, int glyph);
14extern unsigned short *set_translate(int m, struct vc_data *vc); 14extern unsigned short *set_translate(int m, struct vc_data *vc);
15extern int conv_uni_to_pc(struct vc_data *conp, long ucs); 15extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
16void console_map_init(void);
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 9354722a9217..4d8adf663681 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -63,6 +63,8 @@ static inline int cpuset_do_slab_mem_spread(void)
63 return current->flags & PF_SPREAD_SLAB; 63 return current->flags & PF_SPREAD_SLAB;
64} 64}
65 65
66extern void cpuset_track_online_nodes(void);
67
66#else /* !CONFIG_CPUSETS */ 68#else /* !CONFIG_CPUSETS */
67 69
68static inline int cpuset_init_early(void) { return 0; } 70static inline int cpuset_init_early(void) { return 0; }
@@ -126,6 +128,8 @@ static inline int cpuset_do_slab_mem_spread(void)
126 return 0; 128 return 0;
127} 129}
128 130
131static inline void cpuset_track_online_nodes(void) {}
132
129#endif /* !CONFIG_CPUSETS */ 133#endif /* !CONFIG_CPUSETS */
130 134
131#endif /* _LINUX_CPUSET_H */ 135#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index a41f38428c37..1dba681e428d 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -87,6 +87,6 @@ struct cramfs_super {
87/* Uncompression interfaces to the underlying zlib */ 87/* Uncompression interfaces to the underlying zlib */
88int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); 88int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
89int cramfs_uncompress_init(void); 89int cramfs_uncompress_init(void);
90int cramfs_uncompress_exit(void); 90void cramfs_uncompress_exit(void);
91 91
92#endif 92#endif
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 88dafa246d87..952bee79a8f3 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -43,6 +43,8 @@ extern int debug_locks_off(void);
43# define locking_selftest() do { } while (0) 43# define locking_selftest() do { } while (0)
44#endif 44#endif
45 45
46struct task_struct;
47
46#ifdef CONFIG_LOCKDEP 48#ifdef CONFIG_LOCKDEP
47extern void debug_show_all_locks(void); 49extern void debug_show_all_locks(void);
48extern void debug_show_held_locks(struct task_struct *task); 50extern void debug_show_held_locks(struct task_struct *task);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index e3d1c33d1558..03ef41c1eaac 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -55,8 +55,10 @@ typedef int (*dm_endio_fn) (struct dm_target *ti,
55 struct bio *bio, int error, 55 struct bio *bio, int error,
56 union map_info *map_context); 56 union map_info *map_context);
57 57
58typedef void (*dm_flush_fn) (struct dm_target *ti);
58typedef void (*dm_presuspend_fn) (struct dm_target *ti); 59typedef void (*dm_presuspend_fn) (struct dm_target *ti);
59typedef void (*dm_postsuspend_fn) (struct dm_target *ti); 60typedef void (*dm_postsuspend_fn) (struct dm_target *ti);
61typedef int (*dm_preresume_fn) (struct dm_target *ti);
60typedef void (*dm_resume_fn) (struct dm_target *ti); 62typedef void (*dm_resume_fn) (struct dm_target *ti);
61 63
62typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, 64typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
@@ -64,9 +66,18 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
64 66
65typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); 67typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
66 68
69typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode,
70 struct file *filp, unsigned int cmd,
71 unsigned long arg);
72
67void dm_error(const char *message); 73void dm_error(const char *message);
68 74
69/* 75/*
76 * Combine device limits.
77 */
78void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
79
80/*
70 * Constructors should call these functions to ensure destination devices 81 * Constructors should call these functions to ensure destination devices
71 * are opened/closed correctly. 82 * are opened/closed correctly.
72 * FIXME: too many arguments. 83 * FIXME: too many arguments.
@@ -86,11 +97,14 @@ struct target_type {
86 dm_dtr_fn dtr; 97 dm_dtr_fn dtr;
87 dm_map_fn map; 98 dm_map_fn map;
88 dm_endio_fn end_io; 99 dm_endio_fn end_io;
100 dm_flush_fn flush;
89 dm_presuspend_fn presuspend; 101 dm_presuspend_fn presuspend;
90 dm_postsuspend_fn postsuspend; 102 dm_postsuspend_fn postsuspend;
103 dm_preresume_fn preresume;
91 dm_resume_fn resume; 104 dm_resume_fn resume;
92 dm_status_fn status; 105 dm_status_fn status;
93 dm_message_fn message; 106 dm_message_fn message;
107 dm_ioctl_fn ioctl;
94}; 108};
95 109
96struct io_restrictions { 110struct io_restrictions {
diff --git a/include/linux/device.h b/include/linux/device.h
index 1e5f30da98bc..662e6a10144e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -15,6 +15,7 @@
15#include <linux/kobject.h> 15#include <linux/kobject.h>
16#include <linux/klist.h> 16#include <linux/klist.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/compiler.h>
18#include <linux/types.h> 19#include <linux/types.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/pm.h> 21#include <linux/pm.h>
@@ -51,14 +52,17 @@ struct bus_type {
51 int (*probe)(struct device * dev); 52 int (*probe)(struct device * dev);
52 int (*remove)(struct device * dev); 53 int (*remove)(struct device * dev);
53 void (*shutdown)(struct device * dev); 54 void (*shutdown)(struct device * dev);
54 int (*suspend)(struct device * dev, pm_message_t state); 55
55 int (*resume)(struct device * dev); 56 int (*suspend)(struct device * dev, pm_message_t state);
57 int (*suspend_late)(struct device * dev, pm_message_t state);
58 int (*resume_early)(struct device * dev);
59 int (*resume)(struct device * dev);
56}; 60};
57 61
58extern int bus_register(struct bus_type * bus); 62extern int __must_check bus_register(struct bus_type * bus);
59extern void bus_unregister(struct bus_type * bus); 63extern void bus_unregister(struct bus_type * bus);
60 64
61extern void bus_rescan_devices(struct bus_type * bus); 65extern int __must_check bus_rescan_devices(struct bus_type * bus);
62 66
63/* iterator helpers for buses */ 67/* iterator helpers for buses */
64 68
@@ -67,9 +71,9 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
67struct device * bus_find_device(struct bus_type *bus, struct device *start, 71struct device * bus_find_device(struct bus_type *bus, struct device *start,
68 void *data, int (*match)(struct device *, void *)); 72 void *data, int (*match)(struct device *, void *));
69 73
70int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, 74int __must_check bus_for_each_drv(struct bus_type *bus,
71 void * data, int (*fn)(struct device_driver *, void *)); 75 struct device_driver *start, void *data,
72 76 int (*fn)(struct device_driver *, void *));
73 77
74/* driverfs interface for exporting bus attributes */ 78/* driverfs interface for exporting bus attributes */
75 79
@@ -82,7 +86,8 @@ struct bus_attribute {
82#define BUS_ATTR(_name,_mode,_show,_store) \ 86#define BUS_ATTR(_name,_mode,_show,_store) \
83struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) 87struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
84 88
85extern int bus_create_file(struct bus_type *, struct bus_attribute *); 89extern int __must_check bus_create_file(struct bus_type *,
90 struct bus_attribute *);
86extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 91extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
87 92
88struct device_driver { 93struct device_driver {
@@ -101,16 +106,18 @@ struct device_driver {
101 void (*shutdown) (struct device * dev); 106 void (*shutdown) (struct device * dev);
102 int (*suspend) (struct device * dev, pm_message_t state); 107 int (*suspend) (struct device * dev, pm_message_t state);
103 int (*resume) (struct device * dev); 108 int (*resume) (struct device * dev);
109
110 unsigned int multithread_probe:1;
104}; 111};
105 112
106 113
107extern int driver_register(struct device_driver * drv); 114extern int __must_check driver_register(struct device_driver * drv);
108extern void driver_unregister(struct device_driver * drv); 115extern void driver_unregister(struct device_driver * drv);
109 116
110extern struct device_driver * get_driver(struct device_driver * drv); 117extern struct device_driver * get_driver(struct device_driver * drv);
111extern void put_driver(struct device_driver * drv); 118extern void put_driver(struct device_driver * drv);
112extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 119extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
113 120extern int driver_probe_done(void);
114 121
115/* driverfs interface for exporting driver attributes */ 122/* driverfs interface for exporting driver attributes */
116 123
@@ -123,16 +130,17 @@ struct driver_attribute {
123#define DRIVER_ATTR(_name,_mode,_show,_store) \ 130#define DRIVER_ATTR(_name,_mode,_show,_store) \
124struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) 131struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
125 132
126extern int driver_create_file(struct device_driver *, struct driver_attribute *); 133extern int __must_check driver_create_file(struct device_driver *,
134 struct driver_attribute *);
127extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 135extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
128 136
129extern int driver_for_each_device(struct device_driver * drv, struct device * start, 137extern int __must_check driver_for_each_device(struct device_driver * drv,
130 void * data, int (*fn)(struct device *, void *)); 138 struct device *start, void *data,
139 int (*fn)(struct device *, void *));
131struct device * driver_find_device(struct device_driver *drv, 140struct device * driver_find_device(struct device_driver *drv,
132 struct device *start, void *data, 141 struct device *start, void *data,
133 int (*match)(struct device *, void *)); 142 int (*match)(struct device *, void *));
134 143
135
136/* 144/*
137 * device classes 145 * device classes
138 */ 146 */
@@ -146,17 +154,26 @@ struct class {
146 struct list_head interfaces; 154 struct list_head interfaces;
147 struct semaphore sem; /* locks both the children and interfaces lists */ 155 struct semaphore sem; /* locks both the children and interfaces lists */
148 156
157 struct kobject *virtual_dir;
158
149 struct class_attribute * class_attrs; 159 struct class_attribute * class_attrs;
150 struct class_device_attribute * class_dev_attrs; 160 struct class_device_attribute * class_dev_attrs;
161 struct device_attribute * dev_attrs;
151 162
152 int (*uevent)(struct class_device *dev, char **envp, 163 int (*uevent)(struct class_device *dev, char **envp,
153 int num_envp, char *buffer, int buffer_size); 164 int num_envp, char *buffer, int buffer_size);
165 int (*dev_uevent)(struct device *dev, char **envp, int num_envp,
166 char *buffer, int buffer_size);
154 167
155 void (*release)(struct class_device *dev); 168 void (*release)(struct class_device *dev);
156 void (*class_release)(struct class *class); 169 void (*class_release)(struct class *class);
170 void (*dev_release)(struct device *dev);
171
172 int (*suspend)(struct device *, pm_message_t state);
173 int (*resume)(struct device *);
157}; 174};
158 175
159extern int class_register(struct class *); 176extern int __must_check class_register(struct class *);
160extern void class_unregister(struct class *); 177extern void class_unregister(struct class *);
161 178
162 179
@@ -169,7 +186,8 @@ struct class_attribute {
169#define CLASS_ATTR(_name,_mode,_show,_store) \ 186#define CLASS_ATTR(_name,_mode,_show,_store) \
170struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) 187struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
171 188
172extern int class_create_file(struct class *, const struct class_attribute *); 189extern int __must_check class_create_file(struct class *,
190 const struct class_attribute *);
173extern void class_remove_file(struct class *, const struct class_attribute *); 191extern void class_remove_file(struct class *, const struct class_attribute *);
174 192
175struct class_device_attribute { 193struct class_device_attribute {
@@ -182,7 +200,7 @@ struct class_device_attribute {
182struct class_device_attribute class_device_attr_##_name = \ 200struct class_device_attribute class_device_attr_##_name = \
183 __ATTR(_name,_mode,_show,_store) 201 __ATTR(_name,_mode,_show,_store)
184 202
185extern int class_device_create_file(struct class_device *, 203extern int __must_check class_device_create_file(struct class_device *,
186 const struct class_device_attribute *); 204 const struct class_device_attribute *);
187 205
188/** 206/**
@@ -242,10 +260,10 @@ class_set_devdata (struct class_device *dev, void *data)
242} 260}
243 261
244 262
245extern int class_device_register(struct class_device *); 263extern int __must_check class_device_register(struct class_device *);
246extern void class_device_unregister(struct class_device *); 264extern void class_device_unregister(struct class_device *);
247extern void class_device_initialize(struct class_device *); 265extern void class_device_initialize(struct class_device *);
248extern int class_device_add(struct class_device *); 266extern int __must_check class_device_add(struct class_device *);
249extern void class_device_del(struct class_device *); 267extern void class_device_del(struct class_device *);
250 268
251extern int class_device_rename(struct class_device *, char *); 269extern int class_device_rename(struct class_device *, char *);
@@ -255,7 +273,7 @@ extern void class_device_put(struct class_device *);
255 273
256extern void class_device_remove_file(struct class_device *, 274extern void class_device_remove_file(struct class_device *,
257 const struct class_device_attribute *); 275 const struct class_device_attribute *);
258extern int class_device_create_bin_file(struct class_device *, 276extern int __must_check class_device_create_bin_file(struct class_device *,
259 struct bin_attribute *); 277 struct bin_attribute *);
260extern void class_device_remove_bin_file(struct class_device *, 278extern void class_device_remove_bin_file(struct class_device *,
261 struct bin_attribute *); 279 struct bin_attribute *);
@@ -266,22 +284,23 @@ struct class_interface {
266 284
267 int (*add) (struct class_device *, struct class_interface *); 285 int (*add) (struct class_device *, struct class_interface *);
268 void (*remove) (struct class_device *, struct class_interface *); 286 void (*remove) (struct class_device *, struct class_interface *);
287 int (*add_dev) (struct device *, struct class_interface *);
288 void (*remove_dev) (struct device *, struct class_interface *);
269}; 289};
270 290
271extern int class_interface_register(struct class_interface *); 291extern int __must_check class_interface_register(struct class_interface *);
272extern void class_interface_unregister(struct class_interface *); 292extern void class_interface_unregister(struct class_interface *);
273 293
274extern struct class *class_create(struct module *owner, char *name); 294extern struct class *class_create(struct module *owner, const char *name);
275extern void class_destroy(struct class *cls); 295extern void class_destroy(struct class *cls);
276extern struct class_device *class_device_create(struct class *cls, 296extern struct class_device *class_device_create(struct class *cls,
277 struct class_device *parent, 297 struct class_device *parent,
278 dev_t devt, 298 dev_t devt,
279 struct device *device, 299 struct device *device,
280 char *fmt, ...) 300 const char *fmt, ...)
281 __attribute__((format(printf,5,6))); 301 __attribute__((format(printf,5,6)));
282extern void class_device_destroy(struct class *cls, dev_t devt); 302extern void class_device_destroy(struct class *cls, dev_t devt);
283 303
284
285/* interface for exporting device attributes */ 304/* interface for exporting device attributes */
286struct device_attribute { 305struct device_attribute {
287 struct attribute attr; 306 struct attribute attr;
@@ -294,8 +313,13 @@ struct device_attribute {
294#define DEVICE_ATTR(_name,_mode,_show,_store) \ 313#define DEVICE_ATTR(_name,_mode,_show,_store) \
295struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) 314struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
296 315
297extern int device_create_file(struct device *device, struct device_attribute * entry); 316extern int __must_check device_create_file(struct device *device,
317 struct device_attribute * entry);
298extern void device_remove_file(struct device * dev, struct device_attribute * attr); 318extern void device_remove_file(struct device * dev, struct device_attribute * attr);
319extern int __must_check device_create_bin_file(struct device *dev,
320 struct bin_attribute *attr);
321extern void device_remove_bin_file(struct device *dev,
322 struct bin_attribute *attr);
299struct device { 323struct device {
300 struct klist klist_children; 324 struct klist klist_children;
301 struct klist_node knode_parent; /* node in sibling list */ 325 struct klist_node knode_parent; /* node in sibling list */
@@ -305,6 +329,7 @@ struct device {
305 329
306 struct kobject kobj; 330 struct kobject kobj;
307 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 331 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
332 unsigned is_registered:1;
308 struct device_attribute uevent_attr; 333 struct device_attribute uevent_attr;
309 struct device_attribute *devt_attr; 334 struct device_attribute *devt_attr;
310 335
@@ -338,6 +363,7 @@ struct device {
338 struct list_head node; 363 struct list_head node;
339 struct class *class; /* optional*/ 364 struct class *class; /* optional*/
340 dev_t devt; /* dev_t, creates the sysfs "dev" */ 365 dev_t devt; /* dev_t, creates the sysfs "dev" */
366 struct attribute_group **groups; /* optional groups */
341 367
342 void (*release)(struct device * dev); 368 void (*release)(struct device * dev);
343}; 369};
@@ -356,38 +382,41 @@ dev_set_drvdata (struct device *dev, void *data)
356 382
357static inline int device_is_registered(struct device *dev) 383static inline int device_is_registered(struct device *dev)
358{ 384{
359 return klist_node_attached(&dev->knode_bus); 385 return dev->is_registered;
360} 386}
361 387
362/* 388/*
363 * High level routines for use by the bus drivers 389 * High level routines for use by the bus drivers
364 */ 390 */
365extern int device_register(struct device * dev); 391extern int __must_check device_register(struct device * dev);
366extern void device_unregister(struct device * dev); 392extern void device_unregister(struct device * dev);
367extern void device_initialize(struct device * dev); 393extern void device_initialize(struct device * dev);
368extern int device_add(struct device * dev); 394extern int __must_check device_add(struct device * dev);
369extern void device_del(struct device * dev); 395extern void device_del(struct device * dev);
370extern int device_for_each_child(struct device *, void *, 396extern int __must_check device_for_each_child(struct device *, void *,
371 int (*fn)(struct device *, void *)); 397 int (*fn)(struct device *, void *));
398extern int device_rename(struct device *dev, char *new_name);
372 399
373/* 400/*
374 * Manual binding of a device to driver. See drivers/base/bus.c 401 * Manual binding of a device to driver. See drivers/base/bus.c
375 * for information on use. 402 * for information on use.
376 */ 403 */
377extern void device_bind_driver(struct device * dev); 404extern int __must_check device_bind_driver(struct device *dev);
378extern void device_release_driver(struct device * dev); 405extern void device_release_driver(struct device * dev);
379extern int device_attach(struct device * dev); 406extern int __must_check device_attach(struct device * dev);
380extern void driver_attach(struct device_driver * drv); 407extern int __must_check driver_attach(struct device_driver *drv);
381extern void device_reprobe(struct device *dev); 408extern int __must_check device_reprobe(struct device *dev);
382 409
383/* 410/*
384 * Easy functions for dynamically creating devices on the fly 411 * Easy functions for dynamically creating devices on the fly
385 */ 412 */
386extern struct device *device_create(struct class *cls, struct device *parent, 413extern struct device *device_create(struct class *cls, struct device *parent,
387 dev_t devt, char *fmt, ...) 414 dev_t devt, const char *fmt, ...)
388 __attribute__((format(printf,4,5))); 415 __attribute__((format(printf,4,5)));
389extern void device_destroy(struct class *cls, dev_t devt); 416extern void device_destroy(struct class *cls, dev_t devt);
390 417
418extern int virtual_device_parent(struct device *dev);
419
391/* 420/*
392 * Platform "fixup" functions - allow the platform to have their say 421 * Platform "fixup" functions - allow the platform to have their say
393 * about devices and actions that the general device layer doesn't 422 * about devices and actions that the general device layer doesn't
@@ -412,7 +441,7 @@ extern void device_shutdown(void);
412 441
413 442
414/* drivers/base/firmware.c */ 443/* drivers/base/firmware.c */
415extern int firmware_register(struct subsystem *); 444extern int __must_check firmware_register(struct subsystem *);
416extern void firmware_unregister(struct subsystem *); 445extern void firmware_unregister(struct subsystem *);
417 446
418/* debugging and troubleshooting/diagnostic helpers. */ 447/* debugging and troubleshooting/diagnostic helpers. */
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
new file mode 100644
index 000000000000..1b1dcb9a40bb
--- /dev/null
+++ b/include/linux/dlm.h
@@ -0,0 +1,302 @@
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
6**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
14#ifndef __DLM_DOT_H__
15#define __DLM_DOT_H__
16
17/*
18 * Interface to Distributed Lock Manager (DLM)
19 * routines and structures to use DLM lockspaces
20 */
21
22/*
23 * Lock Modes
24 */
25
26#define DLM_LOCK_IV -1 /* invalid */
27#define DLM_LOCK_NL 0 /* null */
28#define DLM_LOCK_CR 1 /* concurrent read */
29#define DLM_LOCK_CW 2 /* concurrent write */
30#define DLM_LOCK_PR 3 /* protected read */
31#define DLM_LOCK_PW 4 /* protected write */
32#define DLM_LOCK_EX 5 /* exclusive */
33
34/*
35 * Maximum size in bytes of a dlm_lock name
36 */
37
38#define DLM_RESNAME_MAXLEN 64
39
40/*
41 * Flags to dlm_lock
42 *
43 * DLM_LKF_NOQUEUE
44 *
45 * Do not queue the lock request on the wait queue if it cannot be granted
46 * immediately. If the lock cannot be granted because of this flag, DLM will
47 * either return -EAGAIN from the dlm_lock call or will return 0 from
48 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
49 *
50 * DLM_LKF_CANCEL
51 *
52 * Used to cancel a pending lock request or conversion. A converting lock is
53 * returned to its previously granted mode.
54 *
55 * DLM_LKF_CONVERT
56 *
57 * Indicates a lock conversion request. For conversions the name and namelen
58 * are ignored and the lock ID in the LKSB is used to identify the lock.
59 *
60 * DLM_LKF_VALBLK
61 *
62 * Requests DLM to return the current contents of the lock value block in the
63 * lock status block. When this flag is set in a lock conversion from PW or EX
64 * modes, DLM assigns the value specified in the lock status block to the lock
65 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
66 * containing application-specific information.
67 *
68 * DLM_LKF_QUECVT
69 *
70 * Force a conversion request to be queued, even if it is compatible with
71 * the granted modes of other locks on the same resource.
72 *
73 * DLM_LKF_IVVALBLK
74 *
75 * Invalidate the lock value block.
76 *
77 * DLM_LKF_CONVDEADLK
78 *
79 * Allows the dlm to resolve conversion deadlocks internally by demoting the
80 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
81 * returned for a conversion that's been effected by this.
82 *
83 * DLM_LKF_PERSISTENT
84 *
85 * Only relevant to locks originating in userspace. A persistent lock will not
86 * be removed if the process holding the lock exits.
87 *
88 * DLM_LKF_NODLKWT
89 * DLM_LKF_NODLCKBLK
90 *
91 * net yet implemented
92 *
93 * DLM_LKF_EXPEDITE
94 *
95 * Used only with new requests for NL mode locks. Tells the lock manager
96 * to grant the lock, ignoring other locks in convert and wait queues.
97 *
98 * DLM_LKF_NOQUEUEBAST
99 *
100 * Send blocking AST's before returning -EAGAIN to the caller. It is only
101 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
102 * NOQUEUE requests otherwise.
103 *
104 * DLM_LKF_HEADQUE
105 *
106 * Add a lock to the head of the convert or wait queue rather than the tail.
107 *
108 * DLM_LKF_NOORDER
109 *
110 * Disregard the standard grant order rules and grant a lock as soon as it
111 * is compatible with other granted locks.
112 *
113 * DLM_LKF_ORPHAN
114 *
115 * not yet implemented
116 *
117 * DLM_LKF_ALTPR
118 *
119 * If the requested mode cannot be granted immediately, try to grant the lock
120 * in PR mode instead. If this alternate mode is granted instead of the
121 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
122 *
123 * DLM_LKF_ALTCW
124 *
125 * The same as ALTPR, but the alternate mode is CW.
126 *
127 * DLM_LKF_FORCEUNLOCK
128 *
129 * Unlock the lock even if it is converting or waiting or has sublocks.
130 * Only really for use by the userland device.c code.
131 *
132 */
133
134#define DLM_LKF_NOQUEUE 0x00000001
135#define DLM_LKF_CANCEL 0x00000002
136#define DLM_LKF_CONVERT 0x00000004
137#define DLM_LKF_VALBLK 0x00000008
138#define DLM_LKF_QUECVT 0x00000010
139#define DLM_LKF_IVVALBLK 0x00000020
140#define DLM_LKF_CONVDEADLK 0x00000040
141#define DLM_LKF_PERSISTENT 0x00000080
142#define DLM_LKF_NODLCKWT 0x00000100
143#define DLM_LKF_NODLCKBLK 0x00000200
144#define DLM_LKF_EXPEDITE 0x00000400
145#define DLM_LKF_NOQUEUEBAST 0x00000800
146#define DLM_LKF_HEADQUE 0x00001000
147#define DLM_LKF_NOORDER 0x00002000
148#define DLM_LKF_ORPHAN 0x00004000
149#define DLM_LKF_ALTPR 0x00008000
150#define DLM_LKF_ALTCW 0x00010000
151#define DLM_LKF_FORCEUNLOCK 0x00020000
152
153/*
154 * Some return codes that are not in errno.h
155 */
156
157#define DLM_ECANCEL 0x10001
158#define DLM_EUNLOCK 0x10002
159
160typedef void dlm_lockspace_t;
161
162/*
163 * Lock status block
164 *
165 * Use this structure to specify the contents of the lock value block. For a
166 * conversion request, this structure is used to specify the lock ID of the
167 * lock. DLM writes the status of the lock request and the lock ID assigned
168 * to the request in the lock status block.
169 *
170 * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests.
171 * It is available when dlm_lock returns.
172 *
173 * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules
174 * shown for the DLM_LKF_VALBLK flag.
175 *
176 * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock,
177 * it was first demoted to NL to avoid conversion deadlock.
178 * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid.
179 *
180 * sb_status: the returned status of the lock request set prior to AST
181 * execution. Possible return values:
182 *
183 * 0 if lock request was successful
184 * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
185 * -ENOMEM if there is no memory to process request
186 * -EINVAL if there are invalid parameters
187 * -DLM_EUNLOCK if unlock request was successful
188 * -DLM_ECANCEL if a cancel completed successfully
189 */
190
191#define DLM_SBF_DEMOTED 0x01
192#define DLM_SBF_VALNOTVALID 0x02
193#define DLM_SBF_ALTMODE 0x04
194
195struct dlm_lksb {
196 int sb_status;
197 uint32_t sb_lkid;
198 char sb_flags;
199 char * sb_lvbptr;
200};
201
202
203#ifdef __KERNEL__
204
205#define DLM_LSFL_NODIR 0x00000001
206
207/*
208 * dlm_new_lockspace
209 *
210 * Starts a lockspace with the given name. If the named lockspace exists in
211 * the cluster, the calling node joins it.
212 */
213
214int dlm_new_lockspace(char *name, int namelen, dlm_lockspace_t **lockspace,
215 uint32_t flags, int lvblen);
216
217/*
218 * dlm_release_lockspace
219 *
220 * Stop a lockspace.
221 */
222
223int dlm_release_lockspace(dlm_lockspace_t *lockspace, int force);
224
225/*
226 * dlm_lock
227 *
228 * Make an asyncronous request to acquire or convert a lock on a named
229 * resource.
230 *
231 * lockspace: context for the request
232 * mode: the requested mode of the lock (DLM_LOCK_)
233 * lksb: lock status block for input and async return values
234 * flags: input flags (DLM_LKF_)
235 * name: name of the resource to lock, can be binary
236 * namelen: the length in bytes of the resource name (MAX_RESNAME_LEN)
237 * parent: the lock ID of a parent lock or 0 if none
238 * lockast: function DLM executes when it completes processing the request
239 * astarg: argument passed to lockast and bast functions
240 * bast: function DLM executes when this lock later blocks another request
241 *
242 * Returns:
243 * 0 if request is successfully queued for processing
244 * -EINVAL if any input parameters are invalid
245 * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
246 * -ENOMEM if there is no memory to process request
247 * -ENOTCONN if there is a communication error
248 *
249 * If the call to dlm_lock returns an error then the operation has failed and
250 * the AST routine will not be called. If dlm_lock returns 0 it is still
251 * possible that the lock operation will fail. The AST routine will be called
252 * when the locking is complete and the status is returned in the lksb.
253 *
254 * If the AST routines or parameter are passed to a conversion operation then
255 * they will overwrite those values that were passed to a previous dlm_lock
256 * call.
257 *
258 * AST routines should not block (at least not for long), but may make
259 * any locking calls they please.
260 */
261
262int dlm_lock(dlm_lockspace_t *lockspace,
263 int mode,
264 struct dlm_lksb *lksb,
265 uint32_t flags,
266 void *name,
267 unsigned int namelen,
268 uint32_t parent_lkid,
269 void (*lockast) (void *astarg),
270 void *astarg,
271 void (*bast) (void *astarg, int mode));
272
273/*
274 * dlm_unlock
275 *
276 * Asynchronously release a lock on a resource. The AST routine is called
277 * when the resource is successfully unlocked.
278 *
279 * lockspace: context for the request
280 * lkid: the lock ID as returned in the lksb
281 * flags: input flags (DLM_LKF_)
282 * lksb: if NULL the lksb parameter passed to last lock request is used
283 * astarg: the arg used with the completion ast for the unlock
284 *
285 * Returns:
286 * 0 if request is successfully queued for processing
287 * -EINVAL if any input parameters are invalid
288 * -ENOTEMPTY if the lock still has sublocks
289 * -EBUSY if the lock is waiting for a remote lock operation
290 * -ENOTCONN if there is a communication error
291 */
292
293int dlm_unlock(dlm_lockspace_t *lockspace,
294 uint32_t lkid,
295 uint32_t flags,
296 struct dlm_lksb *lksb,
297 void *astarg);
298
299#endif /* __KERNEL__ */
300
301#endif /* __DLM_DOT_H__ */
302
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h
new file mode 100644
index 000000000000..2a2dd189b9fd
--- /dev/null
+++ b/include/linux/dlm_device.h
@@ -0,0 +1,86 @@
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
6**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
14/* This is the device interface for dlm, most users will use a library
15 * interface.
16 */
17
18#define DLM_USER_LVB_LEN 32
19
20/* Version of the device interface */
21#define DLM_DEVICE_VERSION_MAJOR 5
22#define DLM_DEVICE_VERSION_MINOR 0
23#define DLM_DEVICE_VERSION_PATCH 0
24
25/* struct passed to the lock write */
26struct dlm_lock_params {
27 __u8 mode;
28 __u8 namelen;
29 __u16 flags;
30 __u32 lkid;
31 __u32 parent;
32 void __user *castparam;
33 void __user *castaddr;
34 void __user *bastparam;
35 void __user *bastaddr;
36 struct dlm_lksb __user *lksb;
37 char lvb[DLM_USER_LVB_LEN];
38 char name[0];
39};
40
41struct dlm_lspace_params {
42 __u32 flags;
43 __u32 minor;
44 char name[0];
45};
46
47struct dlm_write_request {
48 __u32 version[3];
49 __u8 cmd;
50 __u8 is64bit;
51 __u8 unused[2];
52
53 union {
54 struct dlm_lock_params lock;
55 struct dlm_lspace_params lspace;
56 } i;
57};
58
59/* struct read from the "device" fd,
60 consists mainly of userspace pointers for the library to use */
61struct dlm_lock_result {
62 __u32 length;
63 void __user * user_astaddr;
64 void __user * user_astparam;
65 struct dlm_lksb __user * user_lksb;
66 struct dlm_lksb lksb;
67 __u8 bast_mode;
68 __u8 unused[3];
69 /* Offsets may be zero if no data is present */
70 __u32 lvb_offset;
71};
72
73/* Commands passed to the device */
74#define DLM_USER_LOCK 1
75#define DLM_USER_UNLOCK 2
76#define DLM_USER_QUERY 3
77#define DLM_USER_CREATE_LOCKSPACE 4
78#define DLM_USER_REMOVE_LOCKSPACE 5
79
80/* Arbitrary length restriction */
81#define MAX_LS_NAME_LEN 64
82
83/* Lockspace flags */
84#define DLM_USER_LSFLG_AUTOFREE 1
85#define DLM_USER_LSFLG_FORCEFREE 2
86
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 9623bb625090..8853fc4d1c5e 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -285,9 +285,9 @@ typedef char ioctl_struct[308];
285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
286 286
287#define DM_VERSION_MAJOR 4 287#define DM_VERSION_MAJOR 4
288#define DM_VERSION_MINOR 7 288#define DM_VERSION_MINOR 10
289#define DM_VERSION_PATCHLEVEL 0 289#define DM_VERSION_PATCHLEVEL 0
290#define DM_VERSION_EXTRA "-ioctl (2006-06-24)" 290#define DM_VERSION_EXTRA "-ioctl (2006-09-14)"
291 291
292/* Status bits */ 292/* Status bits */
293#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 293#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 635690cf3e3d..ff203c465fed 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -24,6 +24,13 @@ enum dma_data_direction {
24#define DMA_28BIT_MASK 0x000000000fffffffULL 24#define DMA_28BIT_MASK 0x000000000fffffffULL
25#define DMA_24BIT_MASK 0x0000000000ffffffULL 25#define DMA_24BIT_MASK 0x0000000000ffffffULL
26 26
27static inline int valid_dma_direction(int dma_direction)
28{
29 return ((dma_direction == DMA_BIDIRECTIONAL) ||
30 (dma_direction == DMA_TO_DEVICE) ||
31 (dma_direction == DMA_FROM_DEVICE));
32}
33
27#include <asm/dma-mapping.h> 34#include <asm/dma-mapping.h>
28 35
29/* Backwards compat, remove in 2.7.x */ 36/* Backwards compat, remove in 2.7.x */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b2cd2071d432..38dc403be70b 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -27,7 +27,8 @@ enum dmi_device_type {
27 DMI_DEV_TYPE_ETHERNET, 27 DMI_DEV_TYPE_ETHERNET,
28 DMI_DEV_TYPE_TOKENRING, 28 DMI_DEV_TYPE_TOKENRING,
29 DMI_DEV_TYPE_SOUND, 29 DMI_DEV_TYPE_SOUND,
30 DMI_DEV_TYPE_IPMI = -1 30 DMI_DEV_TYPE_IPMI = -1,
31 DMI_DEV_TYPE_OEM_STRING = -2
31}; 32};
32 33
33struct dmi_header { 34struct dmi_header {
diff --git a/include/linux/edd.h b/include/linux/edd.h
index 162512b886f7..b2b3e68aa512 100644
--- a/include/linux/edd.h
+++ b/include/linux/edd.h
@@ -52,6 +52,7 @@
52#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */ 52#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */
53#define EDD_CL_OFF 0x666f /* "of" for off */ 53#define EDD_CL_OFF 0x666f /* "of" for off */
54#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */ 54#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */
55#define EDD_CL_ON 0x6e6f /* "on" for on */
55 56
56#ifndef __ASSEMBLY__ 57#ifndef __ASSEMBLY__
57 58
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index 4079242dced8..1ff7c1392525 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -3,8 +3,8 @@
3 3
4#include <linux/ioport.h> 4#include <linux/ioport.h>
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
6 7
7#define EISA_SIG_LEN 8
8#define EISA_MAX_SLOTS 8 8#define EISA_MAX_SLOTS 8
9 9
10#define EISA_MAX_RESOURCES 4 10#define EISA_MAX_RESOURCES 4
@@ -27,12 +27,6 @@
27#define EISA_CONFIG_ENABLED 1 27#define EISA_CONFIG_ENABLED 1
28#define EISA_CONFIG_FORCED 2 28#define EISA_CONFIG_FORCED 2
29 29
30/* The EISA signature, in ASCII form, null terminated */
31struct eisa_device_id {
32 char sig[EISA_SIG_LEN];
33 unsigned long driver_data;
34};
35
36/* There is not much we can say about an EISA device, apart from 30/* There is not much we can say about an EISA device, apart from
37 * signature, slot number, and base address. dma_mask is set by 31 * signature, slot number, and base address. dma_mask is set by
38 * default to parent device mask..*/ 32 * default to parent device mask..*/
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 1713ace808bf..b3370ef5164d 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -1,12 +1,16 @@
1#ifndef _LINUX_ELEVATOR_H 1#ifndef _LINUX_ELEVATOR_H
2#define _LINUX_ELEVATOR_H 2#define _LINUX_ELEVATOR_H
3 3
4#include <linux/percpu.h>
5
6#ifdef CONFIG_BLOCK
7
4typedef int (elevator_merge_fn) (request_queue_t *, struct request **, 8typedef int (elevator_merge_fn) (request_queue_t *, struct request **,
5 struct bio *); 9 struct bio *);
6 10
7typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *); 11typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *);
8 12
9typedef void (elevator_merged_fn) (request_queue_t *, struct request *); 13typedef void (elevator_merged_fn) (request_queue_t *, struct request *, int);
10 14
11typedef int (elevator_dispatch_fn) (request_queue_t *, int); 15typedef int (elevator_dispatch_fn) (request_queue_t *, int);
12 16
@@ -14,9 +18,9 @@ typedef void (elevator_add_req_fn) (request_queue_t *, struct request *);
14typedef int (elevator_queue_empty_fn) (request_queue_t *); 18typedef int (elevator_queue_empty_fn) (request_queue_t *);
15typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *); 19typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *);
16typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); 20typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
17typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *); 21typedef int (elevator_may_queue_fn) (request_queue_t *, int);
18 22
19typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, gfp_t); 23typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, gfp_t);
20typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); 24typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
21typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); 25typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
22typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 26typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
@@ -82,19 +86,21 @@ struct elevator_queue
82 struct kobject kobj; 86 struct kobject kobj;
83 struct elevator_type *elevator_type; 87 struct elevator_type *elevator_type;
84 struct mutex sysfs_lock; 88 struct mutex sysfs_lock;
89 struct hlist_head *hash;
85}; 90};
86 91
87/* 92/*
88 * block elevator interface 93 * block elevator interface
89 */ 94 */
90extern void elv_dispatch_sort(request_queue_t *, struct request *); 95extern void elv_dispatch_sort(request_queue_t *, struct request *);
96extern void elv_dispatch_add_tail(request_queue_t *, struct request *);
91extern void elv_add_request(request_queue_t *, struct request *, int, int); 97extern void elv_add_request(request_queue_t *, struct request *, int, int);
92extern void __elv_add_request(request_queue_t *, struct request *, int, int); 98extern void __elv_add_request(request_queue_t *, struct request *, int, int);
93extern void elv_insert(request_queue_t *, struct request *, int); 99extern void elv_insert(request_queue_t *, struct request *, int);
94extern int elv_merge(request_queue_t *, struct request **, struct bio *); 100extern int elv_merge(request_queue_t *, struct request **, struct bio *);
95extern void elv_merge_requests(request_queue_t *, struct request *, 101extern void elv_merge_requests(request_queue_t *, struct request *,
96 struct request *); 102 struct request *);
97extern void elv_merged_request(request_queue_t *, struct request *); 103extern void elv_merged_request(request_queue_t *, struct request *, int);
98extern void elv_dequeue_request(request_queue_t *, struct request *); 104extern void elv_dequeue_request(request_queue_t *, struct request *);
99extern void elv_requeue_request(request_queue_t *, struct request *); 105extern void elv_requeue_request(request_queue_t *, struct request *);
100extern int elv_queue_empty(request_queue_t *); 106extern int elv_queue_empty(request_queue_t *);
@@ -103,9 +109,9 @@ extern struct request *elv_former_request(request_queue_t *, struct request *);
103extern struct request *elv_latter_request(request_queue_t *, struct request *); 109extern struct request *elv_latter_request(request_queue_t *, struct request *);
104extern int elv_register_queue(request_queue_t *q); 110extern int elv_register_queue(request_queue_t *q);
105extern void elv_unregister_queue(request_queue_t *q); 111extern void elv_unregister_queue(request_queue_t *q);
106extern int elv_may_queue(request_queue_t *, int, struct bio *); 112extern int elv_may_queue(request_queue_t *, int);
107extern void elv_completed_request(request_queue_t *, struct request *); 113extern void elv_completed_request(request_queue_t *, struct request *);
108extern int elv_set_request(request_queue_t *, struct request *, struct bio *, gfp_t); 114extern int elv_set_request(request_queue_t *, struct request *, gfp_t);
109extern void elv_put_request(request_queue_t *, struct request *); 115extern void elv_put_request(request_queue_t *, struct request *);
110 116
111/* 117/*
@@ -125,6 +131,19 @@ extern void elevator_exit(elevator_t *);
125extern int elv_rq_merge_ok(struct request *, struct bio *); 131extern int elv_rq_merge_ok(struct request *, struct bio *);
126 132
127/* 133/*
134 * Helper functions.
135 */
136extern struct request *elv_rb_former_request(request_queue_t *, struct request *);
137extern struct request *elv_rb_latter_request(request_queue_t *, struct request *);
138
139/*
140 * rb support functions.
141 */
142extern struct request *elv_rb_add(struct rb_root *, struct request *);
143extern void elv_rb_del(struct rb_root *, struct request *);
144extern struct request *elv_rb_find(struct rb_root *, sector_t);
145
146/*
128 * Return values from elevator merger 147 * Return values from elevator merger
129 */ 148 */
130#define ELEVATOR_NO_MERGE 0 149#define ELEVATOR_NO_MERGE 0
@@ -149,5 +168,42 @@ enum {
149}; 168};
150 169
151#define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors) 170#define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors)
171#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
172
173/*
174 * Hack to reuse the donelist list_head as the fifo time holder while
175 * the request is in the io scheduler. Saves an unsigned long in rq.
176 */
177#define rq_fifo_time(rq) ((unsigned long) (rq)->donelist.next)
178#define rq_set_fifo_time(rq,exp) ((rq)->donelist.next = (void *) (exp))
179#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
180#define rq_fifo_clear(rq) do { \
181 list_del_init(&(rq)->queuelist); \
182 INIT_LIST_HEAD(&(rq)->donelist); \
183 } while (0)
152 184
185/*
186 * io context count accounting
187 */
188#define elv_ioc_count_mod(name, __val) \
189 do { \
190 preempt_disable(); \
191 __get_cpu_var(name) += (__val); \
192 preempt_enable(); \
193 } while (0)
194
195#define elv_ioc_count_inc(name) elv_ioc_count_mod(name, 1)
196#define elv_ioc_count_dec(name) elv_ioc_count_mod(name, -1)
197
198#define elv_ioc_count_read(name) \
199({ \
200 unsigned long __val = 0; \
201 int __cpu; \
202 smp_wmb(); \
203 for_each_possible_cpu(__cpu) \
204 __val += per_cpu(name, __cpu); \
205 __val; \
206})
207
208#endif /* CONFIG_BLOCK */
153#endif 209#endif
diff --git a/include/linux/err.h b/include/linux/err.h
index cd3b367f7445..1ab1d44f8d3b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -15,6 +15,8 @@
15 */ 15 */
16#define MAX_ERRNO 4095 16#define MAX_ERRNO 4095
17 17
18#ifndef __ASSEMBLY__
19
18#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) 20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
19 21
20static inline void *ERR_PTR(long error) 22static inline void *ERR_PTR(long error)
@@ -32,4 +34,6 @@ static inline long IS_ERR(const void *ptr)
32 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
33} 35}
34 36
37#endif
38
35#endif /* _LINUX_ERR_H */ 39#endif /* _LINUX_ERR_H */
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 408118a07763..92f8d4fab32b 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -38,7 +38,7 @@ struct sock_exterr_skb
38 } header; 38 } header;
39 struct sock_extended_err ee; 39 struct sock_extended_err ee;
40 u16 addr_offset; 40 u16 addr_offset;
41 u16 port; 41 __be16 port;
42}; 42};
43 43
44#endif 44#endif
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 33a1aa107329..153d755376a4 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -165,41 +165,49 @@ struct ext2_group_desc
165#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) 165#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
166 166
167/* 167/*
168 * Inode flags 168 * Inode flags (GETFLAGS/SETFLAGS)
169 */ 169 */
170#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */ 170#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */
171#define EXT2_UNRM_FL 0x00000002 /* Undelete */ 171#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */
172#define EXT2_COMPR_FL 0x00000004 /* Compress file */ 172#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */
173#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */ 173#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
174#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ 174#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
175#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ 175#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
176#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ 176#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
177#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */ 177#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
178/* Reserved for compression usage... */ 178/* Reserved for compression usage... */
179#define EXT2_DIRTY_FL 0x00000100 179#define EXT2_DIRTY_FL FS_DIRTY_FL
180#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ 180#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */
181#define EXT2_NOCOMP_FL 0x00000400 /* Don't compress */ 181#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */
182#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */ 182#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */
183/* End compression flags --- maybe not all used */ 183/* End compression flags --- maybe not all used */
184#define EXT2_BTREE_FL 0x00001000 /* btree format dir */ 184#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */
185#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */ 185#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */
186#define EXT2_IMAGIC_FL 0x00002000 /* AFS directory */ 186#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */
187#define EXT2_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ 187#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */
188#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 188#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
189#define EXT2_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 189#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
190#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 190#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
191#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 191#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
192 192
193#define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 193#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
194#define EXT2_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 194#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
195 195
196/* 196/*
197 * ioctl commands 197 * ioctl commands
198 */ 198 */
199#define EXT2_IOC_GETFLAGS _IOR('f', 1, long) 199#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS
200#define EXT2_IOC_SETFLAGS _IOW('f', 2, long) 200#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS
201#define EXT2_IOC_GETVERSION _IOR('v', 1, long) 201#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION
202#define EXT2_IOC_SETVERSION _IOW('v', 2, long) 202#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION
203
204/*
205 * ioctl commands in 32 bit emulation
206 */
207#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS
208#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS
209#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION
210#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION
203 211
204/* 212/*
205 * Structure of an inode on the disk 213 * Structure of an inode on the disk
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 0eed918b3816..11cca1bdc0c7 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -216,14 +216,14 @@ struct ext3_new_group_data {
216/* 216/*
217 * ioctl commands 217 * ioctl commands
218 */ 218 */
219#define EXT3_IOC_GETFLAGS _IOR('f', 1, long) 219#define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS
220#define EXT3_IOC_SETFLAGS _IOW('f', 2, long) 220#define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS
221#define EXT3_IOC_GETVERSION _IOR('f', 3, long) 221#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
222#define EXT3_IOC_SETVERSION _IOW('f', 4, long) 222#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
223#define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) 223#define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
224#define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input) 224#define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input)
225#define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long) 225#define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
226#define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long) 226#define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
227#ifdef CONFIG_JBD_DEBUG 227#ifdef CONFIG_JBD_DEBUG
228#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) 228#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
229#endif 229#endif
@@ -231,6 +231,23 @@ struct ext3_new_group_data {
231#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) 231#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
232 232
233/* 233/*
234 * ioctl commands in 32 bit emulation
235 */
236#define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS
237#define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS
238#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
239#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
240#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
241#define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
242#define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
243#ifdef CONFIG_JBD_DEBUG
244#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
245#endif
246#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
247#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
248
249
250/*
234 * Mount options 251 * Mount options
235 */ 252 */
236struct ext3_mount_options { 253struct ext3_mount_options {
@@ -460,7 +477,7 @@ struct ext3_super_block {
460 */ 477 */
461 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 478 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
462 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 479 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
463 __u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ 480 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
464 /* 481 /*
465 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. 482 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
466 */ 483 */
@@ -473,7 +490,7 @@ struct ext3_super_block {
473 __u8 s_reserved_char_pad; 490 __u8 s_reserved_char_pad;
474 __u16 s_reserved_word_pad; 491 __u16 s_reserved_word_pad;
475 __le32 s_default_mount_opts; 492 __le32 s_default_mount_opts;
476 __le32 s_first_meta_bg; /* First metablock block group */ 493 __le32 s_first_meta_bg; /* First metablock block group */
477 __u32 s_reserved[190]; /* Padding to the end of the block */ 494 __u32 s_reserved[190]; /* Padding to the end of the block */
478}; 495};
479 496
@@ -812,6 +829,7 @@ extern void ext3_set_aops(struct inode *inode);
812/* ioctl.c */ 829/* ioctl.c */
813extern int ext3_ioctl (struct inode *, struct file *, unsigned int, 830extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
814 unsigned long); 831 unsigned long);
832extern long ext3_compat_ioctl (struct file *, unsigned int, unsigned long);
815 833
816/* namei.c */ 834/* namei.c */
817extern int ext3_orphan_add(handle_t *, struct inode *); 835extern int ext3_orphan_add(handle_t *, struct inode *);
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 2f18b9511f21..4395e5206746 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -35,7 +35,7 @@ struct ext3_reserve_window {
35}; 35};
36 36
37struct ext3_reserve_window_node { 37struct ext3_reserve_window_node {
38 struct rb_node rsv_node; 38 struct rb_node rsv_node;
39 __u32 rsv_goal_size; 39 __u32 rsv_goal_size;
40 __u32 rsv_alloc_hit; 40 __u32 rsv_alloc_hit;
41 struct ext3_reserve_window rsv_window; 41 struct ext3_reserve_window rsv_window;
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index c8307c02dd07..ce0e6109aff0 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -23,7 +23,7 @@
23 23
24/* Define the number of blocks we need to account to a transaction to 24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data. 25 * modify one block of data.
26 * 26 *
27 * We may have to touch one inode, one bitmap buffer, up to three 27 * We may have to touch one inode, one bitmap buffer, up to three
28 * indirection blocks, the group and superblock summaries, and the data 28 * indirection blocks, the group and superblock summaries, and the data
29 * block to complete the transaction. */ 29 * block to complete the transaction. */
@@ -88,16 +88,16 @@
88#endif 88#endif
89 89
90int 90int
91ext3_mark_iloc_dirty(handle_t *handle, 91ext3_mark_iloc_dirty(handle_t *handle,
92 struct inode *inode, 92 struct inode *inode,
93 struct ext3_iloc *iloc); 93 struct ext3_iloc *iloc);
94 94
95/* 95/*
96 * On success, We end up with an outstanding reference count against 96 * On success, We end up with an outstanding reference count against
97 * iloc->bh. This _must_ be cleaned up later. 97 * iloc->bh. This _must_ be cleaned up later.
98 */ 98 */
99 99
100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, 100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode,
101 struct ext3_iloc *iloc); 101 struct ext3_iloc *iloc);
102 102
103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); 103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2f335e966011..3e69241e6a81 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -2,6 +2,7 @@
2#define _LINUX_FB_H 2#define _LINUX_FB_H
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/i2c.h>
5 6
6/* Definitions of frame buffers */ 7/* Definitions of frame buffers */
7 8
@@ -775,6 +776,7 @@ struct fb_info {
775 struct fb_ops *fbops; 776 struct fb_ops *fbops;
776 struct device *device; 777 struct device *device;
777 struct class_device *class_device; /* sysfs per device attrs */ 778 struct class_device *class_device; /* sysfs per device attrs */
779 int class_flag; /* private sysfs flags */
778#ifdef CONFIG_FB_TILEBLITTING 780#ifdef CONFIG_FB_TILEBLITTING
779 struct fb_tile_ops *tileops; /* Tile Blitting */ 781 struct fb_tile_ops *tileops; /* Tile Blitting */
780#endif 782#endif
@@ -940,6 +942,7 @@ extern void fb_edid_to_monspecs(unsigned char *edid,
940 struct fb_monspecs *specs); 942 struct fb_monspecs *specs);
941extern void fb_destroy_modedb(struct fb_videomode *modedb); 943extern void fb_destroy_modedb(struct fb_videomode *modedb);
942extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); 944extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
945extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
943 946
944/* drivers/video/modedb.c */ 947/* drivers/video/modedb.c */
945#define VESA_MODEDB_SIZE 34 948#define VESA_MODEDB_SIZE 34
diff --git a/include/linux/file.h b/include/linux/file.h
index 9f7c2513866f..74183e6f7f45 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -112,5 +112,6 @@ struct task_struct;
112 112
113struct files_struct *get_files_struct(struct task_struct *); 113struct files_struct *get_files_struct(struct task_struct *);
114void FASTCALL(put_files_struct(struct files_struct *fs)); 114void FASTCALL(put_files_struct(struct files_struct *fs));
115void reset_files_struct(struct task_struct *, struct files_struct *);
115 116
116#endif /* __LINUX_FILE_H */ 117#endif /* __LINUX_FILE_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1d3e601ece73..34406ed467c3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -79,8 +79,8 @@ extern int dir_notify_enable;
79#define WRITE 1 79#define WRITE 1
80#define READA 2 /* read-ahead - don't block if no resources */ 80#define READA 2 /* read-ahead - don't block if no resources */
81#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 81#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
82#define SPECIAL 4 /* For non-blockdevice requests in request queue */
83#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 82#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
83#define READ_META (READ | (1 << BIO_RW_META))
84#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 84#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
85#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 85#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
86 86
@@ -217,6 +217,47 @@ extern int dir_notify_enable;
217#define FIBMAP _IO(0x00,1) /* bmap access */ 217#define FIBMAP _IO(0x00,1) /* bmap access */
218#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ 218#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
219 219
220#define FS_IOC_GETFLAGS _IOR('f', 1, long)
221#define FS_IOC_SETFLAGS _IOW('f', 2, long)
222#define FS_IOC_GETVERSION _IOR('v', 1, long)
223#define FS_IOC_SETVERSION _IOW('v', 2, long)
224#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
225#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
226#define FS_IOC32_GETVERSION _IOR('v', 1, int)
227#define FS_IOC32_SETVERSION _IOW('v', 2, int)
228
229/*
230 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
231 */
232#define FS_SECRM_FL 0x00000001 /* Secure deletion */
233#define FS_UNRM_FL 0x00000002 /* Undelete */
234#define FS_COMPR_FL 0x00000004 /* Compress file */
235#define FS_SYNC_FL 0x00000008 /* Synchronous updates */
236#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
237#define FS_APPEND_FL 0x00000020 /* writes to file may only append */
238#define FS_NODUMP_FL 0x00000040 /* do not dump file */
239#define FS_NOATIME_FL 0x00000080 /* do not update atime */
240/* Reserved for compression usage... */
241#define FS_DIRTY_FL 0x00000100
242#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
243#define FS_NOCOMP_FL 0x00000400 /* Don't compress */
244#define FS_ECOMPR_FL 0x00000800 /* Compression error */
245/* End compression flags --- maybe not all used */
246#define FS_BTREE_FL 0x00001000 /* btree format dir */
247#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */
248#define FS_IMAGIC_FL 0x00002000 /* AFS directory */
249#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */
250#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
251#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
252#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
253#define FS_EXTENT_FL 0x00080000 /* Extents */
254#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
255#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
256
257#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
258#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
259
260
220#define SYNC_FILE_RANGE_WAIT_BEFORE 1 261#define SYNC_FILE_RANGE_WAIT_BEFORE 1
221#define SYNC_FILE_RANGE_WRITE 2 262#define SYNC_FILE_RANGE_WRITE 2
222#define SYNC_FILE_RANGE_WAIT_AFTER 4 263#define SYNC_FILE_RANGE_WAIT_AFTER 4
@@ -512,7 +553,6 @@ struct inode {
512 struct timespec i_mtime; 553 struct timespec i_mtime;
513 struct timespec i_ctime; 554 struct timespec i_ctime;
514 unsigned int i_blkbits; 555 unsigned int i_blkbits;
515 unsigned long i_blksize;
516 unsigned long i_version; 556 unsigned long i_version;
517 blkcnt_t i_blocks; 557 blkcnt_t i_blocks;
518 unsigned short i_bytes; 558 unsigned short i_bytes;
@@ -528,11 +568,12 @@ struct inode {
528#ifdef CONFIG_QUOTA 568#ifdef CONFIG_QUOTA
529 struct dquot *i_dquot[MAXQUOTAS]; 569 struct dquot *i_dquot[MAXQUOTAS];
530#endif 570#endif
531 /* These three should probably be a union */
532 struct list_head i_devices; 571 struct list_head i_devices;
533 struct pipe_inode_info *i_pipe; 572 union {
534 struct block_device *i_bdev; 573 struct pipe_inode_info *i_pipe;
535 struct cdev *i_cdev; 574 struct block_device *i_bdev;
575 struct cdev *i_cdev;
576 };
536 int i_cindex; 577 int i_cindex;
537 578
538 __u32 i_generation; 579 __u32 i_generation;
@@ -553,10 +594,10 @@ struct inode {
553 unsigned int i_flags; 594 unsigned int i_flags;
554 595
555 atomic_t i_writecount; 596 atomic_t i_writecount;
597#ifdef CONFIG_SECURITY
556 void *i_security; 598 void *i_security;
557 union { 599#endif
558 void *generic_ip; 600 void *i_private; /* fs or device private pointer */
559 } u;
560#ifdef __NEED_I_SIZE_ORDERED 601#ifdef __NEED_I_SIZE_ORDERED
561 seqcount_t i_size_seqcount; 602 seqcount_t i_size_seqcount;
562#endif 603#endif
@@ -645,9 +686,9 @@ extern struct block_device *I_BDEV(struct inode *inode);
645 686
646struct fown_struct { 687struct fown_struct {
647 rwlock_t lock; /* protects pid, uid, euid fields */ 688 rwlock_t lock; /* protects pid, uid, euid fields */
648 int pid; /* pid or -pgrp where SIGIO should be sent */ 689 struct pid *pid; /* pid or -pgrp where SIGIO should be sent */
690 enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */
649 uid_t uid, euid; /* uid/euid of process setting the owner */ 691 uid_t uid, euid; /* uid/euid of process setting the owner */
650 void *security;
651 int signum; /* posix.1b rt signal to be delivered on IO */ 692 int signum; /* posix.1b rt signal to be delivered on IO */
652}; 693};
653 694
@@ -690,8 +731,9 @@ struct file {
690 struct file_ra_state f_ra; 731 struct file_ra_state f_ra;
691 732
692 unsigned long f_version; 733 unsigned long f_version;
734#ifdef CONFIG_SECURITY
693 void *f_security; 735 void *f_security;
694 736#endif
695 /* needed for tty driver, and maybe others */ 737 /* needed for tty driver, and maybe others */
696 void *private_data; 738 void *private_data;
697 739
@@ -841,8 +883,10 @@ extern void kill_fasync(struct fasync_struct **, int, int);
841/* only for net: no internal synchronization */ 883/* only for net: no internal synchronization */
842extern void __kill_fasync(struct fasync_struct *, int, int); 884extern void __kill_fasync(struct fasync_struct *, int, int);
843 885
886extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
844extern int f_setown(struct file *filp, unsigned long arg, int force); 887extern int f_setown(struct file *filp, unsigned long arg, int force);
845extern void f_delown(struct file *filp); 888extern void f_delown(struct file *filp);
889extern pid_t f_getown(struct file *filp);
846extern int send_sigurg(struct fown_struct *fown); 890extern int send_sigurg(struct fown_struct *fown);
847 891
848/* 892/*
@@ -879,7 +923,9 @@ struct super_block {
879 int s_syncing; 923 int s_syncing;
880 int s_need_sync_fs; 924 int s_need_sync_fs;
881 atomic_t s_active; 925 atomic_t s_active;
926#ifdef CONFIG_SECURITY
882 void *s_security; 927 void *s_security;
928#endif
883 struct xattr_handler **s_xattr; 929 struct xattr_handler **s_xattr;
884 930
885 struct list_head s_inodes; /* all inodes */ 931 struct list_head s_inodes; /* all inodes */
@@ -1005,7 +1051,7 @@ int generic_osync_inode(struct inode *, struct address_space *, int);
1005 * This allows the kernel to read directories into kernel space or 1051 * This allows the kernel to read directories into kernel space or
1006 * to have different dirent layouts depending on the binary type. 1052 * to have different dirent layouts depending on the binary type.
1007 */ 1053 */
1008typedef int (*filldir_t)(void *, const char *, int, loff_t, ino_t, unsigned); 1054typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1009 1055
1010struct block_device_operations { 1056struct block_device_operations {
1011 int (*open) (struct inode *, struct file *); 1057 int (*open) (struct inode *, struct file *);
@@ -1056,9 +1102,9 @@ struct file_operations {
1056 struct module *owner; 1102 struct module *owner;
1057 loff_t (*llseek) (struct file *, loff_t, int); 1103 loff_t (*llseek) (struct file *, loff_t, int);
1058 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 1104 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
1059 ssize_t (*aio_read) (struct kiocb *, char __user *, size_t, loff_t);
1060 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1105 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1061 ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, loff_t); 1106 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1107 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1062 int (*readdir) (struct file *, void *, filldir_t); 1108 int (*readdir) (struct file *, void *, filldir_t);
1063 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1109 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1064 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); 1110 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
@@ -1072,8 +1118,6 @@ struct file_operations {
1072 int (*aio_fsync) (struct kiocb *, int datasync); 1118 int (*aio_fsync) (struct kiocb *, int datasync);
1073 int (*fasync) (int, struct file *, int); 1119 int (*fasync) (int, struct file *, int);
1074 int (*lock) (struct file *, int, struct file_lock *); 1120 int (*lock) (struct file *, int, struct file_lock *);
1075 ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
1076 ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
1077 ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *); 1121 ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
1078 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); 1122 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
1079 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1123 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
@@ -1111,6 +1155,11 @@ struct inode_operations {
1111 1155
1112struct seq_file; 1156struct seq_file;
1113 1157
1158ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1159 unsigned long nr_segs, unsigned long fast_segs,
1160 struct iovec *fast_pointer,
1161 struct iovec **ret_pointer);
1162
1114extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); 1163extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1115extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); 1164extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
1116extern ssize_t vfs_readv(struct file *, const struct iovec __user *, 1165extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
@@ -1145,9 +1194,10 @@ struct super_operations {
1145 1194
1146 int (*show_options)(struct seq_file *, struct vfsmount *); 1195 int (*show_options)(struct seq_file *, struct vfsmount *);
1147 int (*show_stats)(struct seq_file *, struct vfsmount *); 1196 int (*show_stats)(struct seq_file *, struct vfsmount *);
1148 1197#ifdef CONFIG_QUOTA
1149 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1198 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1150 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1199 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1200#endif
1151}; 1201};
1152 1202
1153/* Inode state bits. Protected by inode_lock. */ 1203/* Inode state bits. Protected by inode_lock. */
@@ -1174,15 +1224,30 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1174 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1224 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1175} 1225}
1176 1226
1177static inline void inode_inc_link_count(struct inode *inode) 1227static inline void inc_nlink(struct inode *inode)
1178{ 1228{
1179 inode->i_nlink++; 1229 inode->i_nlink++;
1230}
1231
1232static inline void inode_inc_link_count(struct inode *inode)
1233{
1234 inc_nlink(inode);
1180 mark_inode_dirty(inode); 1235 mark_inode_dirty(inode);
1181} 1236}
1182 1237
1183static inline void inode_dec_link_count(struct inode *inode) 1238static inline void drop_nlink(struct inode *inode)
1184{ 1239{
1185 inode->i_nlink--; 1240 inode->i_nlink--;
1241}
1242
1243static inline void clear_nlink(struct inode *inode)
1244{
1245 inode->i_nlink = 0;
1246}
1247
1248static inline void inode_dec_link_count(struct inode *inode)
1249{
1250 drop_nlink(inode);
1186 mark_inode_dirty(inode); 1251 mark_inode_dirty(inode);
1187} 1252}
1188 1253
@@ -1440,6 +1505,7 @@ extern void __init vfs_caches_init(unsigned long);
1440extern void putname(const char *name); 1505extern void putname(const char *name);
1441#endif 1506#endif
1442 1507
1508#ifdef CONFIG_BLOCK
1443extern int register_blkdev(unsigned int, const char *); 1509extern int register_blkdev(unsigned int, const char *);
1444extern int unregister_blkdev(unsigned int, const char *); 1510extern int unregister_blkdev(unsigned int, const char *);
1445extern struct block_device *bdget(dev_t); 1511extern struct block_device *bdget(dev_t);
@@ -1448,13 +1514,20 @@ extern void bd_forget(struct inode *inode);
1448extern void bdput(struct block_device *); 1514extern void bdput(struct block_device *);
1449extern struct block_device *open_by_devnum(dev_t, unsigned); 1515extern struct block_device *open_by_devnum(dev_t, unsigned);
1450extern struct block_device *open_partition_by_devnum(dev_t, unsigned); 1516extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
1451extern const struct file_operations def_blk_fops;
1452extern const struct address_space_operations def_blk_aops; 1517extern const struct address_space_operations def_blk_aops;
1518#else
1519static inline void bd_forget(struct inode *inode) {}
1520#endif
1521extern const struct file_operations def_blk_fops;
1453extern const struct file_operations def_chr_fops; 1522extern const struct file_operations def_chr_fops;
1454extern const struct file_operations bad_sock_fops; 1523extern const struct file_operations bad_sock_fops;
1455extern const struct file_operations def_fifo_fops; 1524extern const struct file_operations def_fifo_fops;
1525#ifdef CONFIG_BLOCK
1456extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1526extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1457extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1527extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1528extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
1529 struct gendisk *disk, unsigned cmd,
1530 unsigned long arg);
1458extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1531extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1459extern int blkdev_get(struct block_device *, mode_t, unsigned); 1532extern int blkdev_get(struct block_device *, mode_t, unsigned);
1460extern int blkdev_put(struct block_device *); 1533extern int blkdev_put(struct block_device *);
@@ -1468,6 +1541,7 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1468#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder) 1541#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder)
1469#define bd_release_from_disk(bdev, disk) bd_release(bdev) 1542#define bd_release_from_disk(bdev, disk) bd_release(bdev)
1470#endif 1543#endif
1544#endif
1471 1545
1472/* fs/char_dev.c */ 1546/* fs/char_dev.c */
1473#define CHRDEV_MAJOR_HASH_SIZE 255 1547#define CHRDEV_MAJOR_HASH_SIZE 255
@@ -1481,14 +1555,19 @@ extern int chrdev_open(struct inode *, struct file *);
1481extern void chrdev_show(struct seq_file *,off_t); 1555extern void chrdev_show(struct seq_file *,off_t);
1482 1556
1483/* fs/block_dev.c */ 1557/* fs/block_dev.c */
1484#define BLKDEV_MAJOR_HASH_SIZE 255
1485#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1558#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1559
1560#ifdef CONFIG_BLOCK
1561#define BLKDEV_MAJOR_HASH_SIZE 255
1486extern const char *__bdevname(dev_t, char *buffer); 1562extern const char *__bdevname(dev_t, char *buffer);
1487extern const char *bdevname(struct block_device *bdev, char *buffer); 1563extern const char *bdevname(struct block_device *bdev, char *buffer);
1488extern struct block_device *lookup_bdev(const char *); 1564extern struct block_device *lookup_bdev(const char *);
1489extern struct block_device *open_bdev_excl(const char *, int, void *); 1565extern struct block_device *open_bdev_excl(const char *, int, void *);
1490extern void close_bdev_excl(struct block_device *); 1566extern void close_bdev_excl(struct block_device *);
1491extern void blkdev_show(struct seq_file *,off_t); 1567extern void blkdev_show(struct seq_file *,off_t);
1568#else
1569#define BLKDEV_MAJOR_HASH_SIZE 0
1570#endif
1492 1571
1493extern void init_special_inode(struct inode *, umode_t, dev_t); 1572extern void init_special_inode(struct inode *, umode_t, dev_t);
1494 1573
@@ -1502,6 +1581,7 @@ extern const struct file_operations rdwr_fifo_fops;
1502 1581
1503extern int fs_may_remount_ro(struct super_block *); 1582extern int fs_may_remount_ro(struct super_block *);
1504 1583
1584#ifdef CONFIG_BLOCK
1505/* 1585/*
1506 * return READ, READA, or WRITE 1586 * return READ, READA, or WRITE
1507 */ 1587 */
@@ -1513,9 +1593,10 @@ extern int fs_may_remount_ro(struct super_block *);
1513#define bio_data_dir(bio) ((bio)->bi_rw & 1) 1593#define bio_data_dir(bio) ((bio)->bi_rw & 1)
1514 1594
1515extern int check_disk_change(struct block_device *); 1595extern int check_disk_change(struct block_device *);
1516extern int invalidate_inodes(struct super_block *);
1517extern int __invalidate_device(struct block_device *); 1596extern int __invalidate_device(struct block_device *);
1518extern int invalidate_partition(struct gendisk *, int); 1597extern int invalidate_partition(struct gendisk *, int);
1598#endif
1599extern int invalidate_inodes(struct super_block *);
1519unsigned long invalidate_mapping_pages(struct address_space *mapping, 1600unsigned long invalidate_mapping_pages(struct address_space *mapping,
1520 pgoff_t start, pgoff_t end); 1601 pgoff_t start, pgoff_t end);
1521unsigned long invalidate_inode_pages(struct address_space *mapping); 1602unsigned long invalidate_inode_pages(struct address_space *mapping);
@@ -1543,11 +1624,14 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
1543extern long do_fsync(struct file *file, int datasync); 1624extern long do_fsync(struct file *file, int datasync);
1544extern void sync_supers(void); 1625extern void sync_supers(void);
1545extern void sync_filesystems(int wait); 1626extern void sync_filesystems(int wait);
1627extern void __fsync_super(struct super_block *sb);
1546extern void emergency_sync(void); 1628extern void emergency_sync(void);
1547extern void emergency_remount(void); 1629extern void emergency_remount(void);
1548extern int do_remount_sb(struct super_block *sb, int flags, 1630extern int do_remount_sb(struct super_block *sb, int flags,
1549 void *data, int force); 1631 void *data, int force);
1632#ifdef CONFIG_BLOCK
1550extern sector_t bmap(struct inode *, sector_t); 1633extern sector_t bmap(struct inode *, sector_t);
1634#endif
1551extern int notify_change(struct dentry *, struct iattr *); 1635extern int notify_change(struct dentry *, struct iattr *);
1552extern int permission(struct inode *, int, struct nameidata *); 1636extern int permission(struct inode *, int, struct nameidata *);
1553extern int generic_permission(struct inode *, int, 1637extern int generic_permission(struct inode *, int,
@@ -1565,6 +1649,9 @@ static inline void allow_write_access(struct file *file)
1565 atomic_inc(&file->f_dentry->d_inode->i_writecount); 1649 atomic_inc(&file->f_dentry->d_inode->i_writecount);
1566} 1650}
1567extern int do_pipe(int *); 1651extern int do_pipe(int *);
1652extern struct file *create_read_pipe(struct file *f);
1653extern struct file *create_write_pipe(void);
1654extern void free_write_pipe(struct file *);
1568 1655
1569extern int open_namei(int dfd, const char *, int, int, struct nameidata *); 1656extern int open_namei(int dfd, const char *, int, int, struct nameidata *);
1570extern int may_open(struct nameidata *, int, int); 1657extern int may_open(struct nameidata *, int, int);
@@ -1630,9 +1717,11 @@ static inline void insert_inode_hash(struct inode *inode) {
1630extern struct file * get_empty_filp(void); 1717extern struct file * get_empty_filp(void);
1631extern void file_move(struct file *f, struct list_head *list); 1718extern void file_move(struct file *f, struct list_head *list);
1632extern void file_kill(struct file *f); 1719extern void file_kill(struct file *f);
1720#ifdef CONFIG_BLOCK
1633struct bio; 1721struct bio;
1634extern void submit_bio(int, struct bio *); 1722extern void submit_bio(int, struct bio *);
1635extern int bdev_read_only(struct block_device *); 1723extern int bdev_read_only(struct block_device *);
1724#endif
1636extern int set_blocksize(struct block_device *, int); 1725extern int set_blocksize(struct block_device *, int);
1637extern int sb_set_blocksize(struct super_block *, int); 1726extern int sb_set_blocksize(struct super_block *, int);
1638extern int sb_min_blocksize(struct super_block *, int); 1727extern int sb_min_blocksize(struct super_block *, int);
@@ -1641,22 +1730,17 @@ extern int generic_file_mmap(struct file *, struct vm_area_struct *);
1641extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1730extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
1642extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1731extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1643extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1732extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1644extern ssize_t generic_file_read(struct file *, char __user *, size_t, loff_t *);
1645int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1733int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
1646extern ssize_t generic_file_write(struct file *, const char __user *, size_t, loff_t *); 1734extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
1647extern ssize_t generic_file_aio_read(struct kiocb *, char __user *, size_t, loff_t); 1735extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
1648extern ssize_t __generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t *);
1649extern ssize_t generic_file_aio_write(struct kiocb *, const char __user *, size_t, loff_t);
1650extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *, 1736extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *,
1651 unsigned long, loff_t *); 1737 unsigned long, loff_t);
1652extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 1738extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *,
1653 unsigned long *, loff_t, loff_t *, size_t, size_t); 1739 unsigned long *, loff_t, loff_t *, size_t, size_t);
1654extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, 1740extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
1655 unsigned long, loff_t, loff_t *, size_t, ssize_t); 1741 unsigned long, loff_t, loff_t *, size_t, ssize_t);
1656extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); 1742extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
1657extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 1743extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
1658ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
1659 unsigned long nr_segs, loff_t *ppos);
1660extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); 1744extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
1661extern void do_generic_mapping_read(struct address_space *mapping, 1745extern void do_generic_mapping_read(struct address_space *mapping,
1662 struct file_ra_state *, struct file *, 1746 struct file_ra_state *, struct file *,
@@ -1674,10 +1758,6 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
1674 1758
1675extern void 1759extern void
1676file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1760file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1677extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov,
1678 unsigned long nr_segs, loff_t *ppos);
1679ssize_t generic_file_writev(struct file *filp, const struct iovec *iov,
1680 unsigned long nr_segs, loff_t *ppos);
1681extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 1761extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
1682extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 1762extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
1683extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); 1763extern loff_t remote_llseek(struct file *file, loff_t offset, int origin);
@@ -1713,6 +1793,7 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1713 actor); 1793 actor);
1714} 1794}
1715 1795
1796#ifdef CONFIG_BLOCK
1716ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1797ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1717 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1798 struct block_device *bdev, const struct iovec *iov, loff_t offset,
1718 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 1799 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
@@ -1750,6 +1831,7 @@ static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
1750 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1831 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1751 nr_segs, get_block, end_io, DIO_OWN_LOCKING); 1832 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
1752} 1833}
1834#endif
1753 1835
1754extern const struct file_operations generic_ro_fops; 1836extern const struct file_operations generic_ro_fops;
1755 1837
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 74ed35a00a94..543cd3cd9e77 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -55,6 +55,30 @@ static inline int fs_get_scc_index(enum fs_id id)
55 return -1; 55 return -1;
56} 56}
57 57
58static inline int fs_fec_index2id(int index)
59{
60 int id = fsid_fec1 + index - 1;
61 if (id >= fsid_fec1 && id <= fsid_fec2)
62 return id;
63 return FS_MAX_INDEX;
64 }
65
66static inline int fs_fcc_index2id(int index)
67{
68 int id = fsid_fcc1 + index - 1;
69 if (id >= fsid_fcc1 && id <= fsid_fcc3)
70 return id;
71 return FS_MAX_INDEX;
72}
73
74static inline int fs_scc_index2id(int index)
75{
76 int id = fsid_scc1 + index - 1;
77 if (id >= fsid_scc1 && id <= fsid_scc4)
78 return id;
79 return FS_MAX_INDEX;
80}
81
58enum fs_mii_method { 82enum fs_mii_method {
59 fsmii_fixed, 83 fsmii_fixed,
60 fsmii_fec, 84 fsmii_fec,
@@ -87,18 +111,21 @@ struct fs_mii_bb_platform_info {
87}; 111};
88 112
89struct fs_platform_info { 113struct fs_platform_info {
90 114
91 void(*init_ioports)(void); 115 void(*init_ioports)(struct fs_platform_info *);
92 /* device specific information */ 116 /* device specific information */
93 int fs_no; /* controller index */ 117 int fs_no; /* controller index */
118 char fs_type[4]; /* controller type */
94 119
95 u32 cp_page; /* CPM page */ 120 u32 cp_page; /* CPM page */
96 u32 cp_block; /* CPM sblock */ 121 u32 cp_block; /* CPM sblock */
97 122
98 u32 clk_trx; /* some stuff for pins & mux configuration*/ 123 u32 clk_trx; /* some stuff for pins & mux configuration*/
124 u32 clk_rx;
125 u32 clk_tx;
99 u32 clk_route; 126 u32 clk_route;
100 u32 clk_mask; 127 u32 clk_mask;
101 128
102 u32 mem_offset; 129 u32 mem_offset;
103 u32 dpram_offset; 130 u32 dpram_offset;
104 u32 fcc_regs_c; 131 u32 fcc_regs_c;
@@ -124,4 +151,16 @@ struct fs_mii_fec_platform_info {
124 u32 irq[32]; 151 u32 irq[32];
125 u32 mii_speed; 152 u32 mii_speed;
126}; 153};
154
155static inline int fs_get_id(struct fs_platform_info *fpi)
156{
157 if(strstr(fpi->fs_type, "SCC"))
158 return fs_scc_index2id(fpi->fs_no);
159 if(strstr(fpi->fs_type, "FCC"))
160 return fs_fcc_index2id(fpi->fs_no);
161 if(strstr(fpi->fs_type, "FEC"))
162 return fs_fec_index2id(fpi->fs_no);
163 return fpi->fs_no;
164}
165
127#endif 166#endif
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h
index f5975126b712..809bb9ffc788 100644
--- a/include/linux/fs_uart_pd.h
+++ b/include/linux/fs_uart_pd.h
@@ -46,15 +46,27 @@ static inline int fs_uart_id_fsid2smc(int id)
46} 46}
47 47
48struct fs_uart_platform_info { 48struct fs_uart_platform_info {
49 void(*init_ioports)(void); 49 void(*init_ioports)(struct fs_uart_platform_info *);
50 /* device specific information */ 50 /* device specific information */
51 int fs_no; /* controller index */ 51 int fs_no; /* controller index */
52 char fs_type[4]; /* controller type */
52 u32 uart_clk; 53 u32 uart_clk;
53 u8 tx_num_fifo; 54 u8 tx_num_fifo;
54 u8 tx_buf_size; 55 u8 tx_buf_size;
55 u8 rx_num_fifo; 56 u8 rx_num_fifo;
56 u8 rx_buf_size; 57 u8 rx_buf_size;
57 u8 brg; 58 u8 brg;
59 u8 clk_rx;
60 u8 clk_tx;
58}; 61};
59 62
63static inline int fs_uart_get_id(struct fs_uart_platform_info *fpi)
64{
65 if(strstr(fpi->fs_type, "SMC"))
66 return fs_uart_id_smc2fsid(fpi->fs_no);
67 if(strstr(fpi->fs_type, "SCC"))
68 return fs_uart_id_scc2fsid(fpi->fs_no);
69 return fpi->fs_no;
70}
71
60#endif 72#endif
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 16fbe59edeb1..3da29e2d524a 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -46,18 +46,17 @@
46 46
47struct gianfar_platform_data { 47struct gianfar_platform_data {
48 /* device specific information */ 48 /* device specific information */
49 u32 device_flags; 49 u32 device_flags;
50
51 /* board specific information */ 50 /* board specific information */
52 u32 board_flags; 51 u32 board_flags;
53 u32 bus_id; 52 u32 bus_id;
54 u32 phy_id; 53 u32 phy_id;
55 u8 mac_addr[6]; 54 u8 mac_addr[6];
56}; 55};
57 56
58struct gianfar_mdio_data { 57struct gianfar_mdio_data {
59 /* board specific information */ 58 /* board specific information */
60 int irq[32]; 59 int irq[32];
61}; 60};
62 61
63/* Flags related to gianfar device features */ 62/* Flags related to gianfar device features */
@@ -76,14 +75,13 @@ struct gianfar_mdio_data {
76 75
77struct fsl_i2c_platform_data { 76struct fsl_i2c_platform_data {
78 /* device specific information */ 77 /* device specific information */
79 u32 device_flags; 78 u32 device_flags;
80}; 79};
81 80
82/* Flags related to I2C device features */ 81/* Flags related to I2C device features */
83#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001 82#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001
84#define FSL_I2C_DEV_CLOCK_5200 0x00000002 83#define FSL_I2C_DEV_CLOCK_5200 0x00000002
85 84
86
87enum fsl_usb2_operating_modes { 85enum fsl_usb2_operating_modes {
88 FSL_USB2_MPH_HOST, 86 FSL_USB2_MPH_HOST,
89 FSL_USB2_DR_HOST, 87 FSL_USB2_DR_HOST,
@@ -101,9 +99,9 @@ enum fsl_usb2_phy_modes {
101 99
102struct fsl_usb2_platform_data { 100struct fsl_usb2_platform_data {
103 /* board specific information */ 101 /* board specific information */
104 enum fsl_usb2_operating_modes operating_mode; 102 enum fsl_usb2_operating_modes operating_mode;
105 enum fsl_usb2_phy_modes phy_mode; 103 enum fsl_usb2_phy_modes phy_mode;
106 unsigned int port_enables; 104 unsigned int port_enables;
107}; 105};
108 106
109/* Flags in fsl_usb2_mph_platform_data */ 107/* Flags in fsl_usb2_mph_platform_data */
@@ -121,5 +119,44 @@ struct fsl_spi_platform_data {
121 u32 sysclk; 119 u32 sysclk;
122}; 120};
123 121
124#endif /* _FSL_DEVICE_H_ */ 122/* Ethernet interface (phy management and speed)
125#endif /* __KERNEL__ */ 123*/
124enum enet_interface {
125 ENET_10_MII, /* 10 Base T, MII interface */
126 ENET_10_RMII, /* 10 Base T, RMII interface */
127 ENET_10_RGMII, /* 10 Base T, RGMII interface */
128 ENET_100_MII, /* 100 Base T, MII interface */
129 ENET_100_RMII, /* 100 Base T, RMII interface */
130 ENET_100_RGMII, /* 100 Base T, RGMII interface */
131 ENET_1000_GMII, /* 1000 Base T, GMII interface */
132 ENET_1000_RGMII, /* 1000 Base T, RGMII interface */
133 ENET_1000_TBI, /* 1000 Base T, TBI interface */
134 ENET_1000_RTBI /* 1000 Base T, RTBI interface */
135};
136
137struct ucc_geth_platform_data {
138 /* device specific information */
139 u32 device_flags;
140 u32 phy_reg_addr;
141
142 /* board specific information */
143 u32 board_flags;
144 u8 rx_clock;
145 u8 tx_clock;
146 u32 phy_id;
147 enum enet_interface phy_interface;
148 u32 phy_interrupt;
149 u8 mac_addr[6];
150};
151
152/* Flags related to UCC Gigabit Ethernet device features */
153#define FSL_UGETH_DEV_HAS_GIGABIT 0x00000001
154#define FSL_UGETH_DEV_HAS_COALESCE 0x00000002
155#define FSL_UGETH_DEV_HAS_RMON 0x00000004
156
157/* Flags in ucc_geth_platform_data */
158#define FSL_UGETH_BRD_HAS_PHY_INTR 0x00000001
159 /* if not set use a timer */
160
161#endif /* _FSL_DEVICE_H_ */
162#endif /* __KERNEL__ */
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 690c42803d2e..9869ef3674ac 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -31,5 +31,6 @@ struct gen_pool_chunk {
31 31
32extern struct gen_pool *gen_pool_create(int, int); 32extern struct gen_pool *gen_pool_create(int, int);
33extern int gen_pool_add(struct gen_pool *, unsigned long, size_t, int); 33extern int gen_pool_add(struct gen_pool *, unsigned long, size_t, int);
34extern void gen_pool_destroy(struct gen_pool *);
34extern unsigned long gen_pool_alloc(struct gen_pool *, size_t); 35extern unsigned long gen_pool_alloc(struct gen_pool *, size_t);
35extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); 36extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
new file mode 100644
index 000000000000..80764f40be75
--- /dev/null
+++ b/include/linux/generic_acl.h
@@ -0,0 +1,36 @@
1/*
2 * fs/generic_acl.c
3 *
4 * (C) 2005 Andreas Gruenbacher <agruen@suse.de>
5 *
6 * This file is released under the GPL.
7 */
8
9#ifndef GENERIC_ACL_H
10#define GENERIC_ACL_H
11
12#include <linux/posix_acl.h>
13#include <linux/posix_acl_xattr.h>
14
15/**
16 * struct generic_acl_operations - filesystem operations
17 *
18 * Filesystems must make these operations available to the generic
19 * operations.
20 */
21struct generic_acl_operations {
22 struct posix_acl *(*getacl)(struct inode *, int);
23 void (*setacl)(struct inode *, int, struct posix_acl *);
24};
25
26size_t generic_acl_list(struct inode *, struct generic_acl_operations *, int,
27 char *, size_t);
28int generic_acl_get(struct inode *, struct generic_acl_operations *, int,
29 void *, size_t);
30int generic_acl_set(struct inode *, struct generic_acl_operations *, int,
31 const void *, size_t);
32int generic_acl_init(struct inode *, struct inode *,
33 struct generic_acl_operations *);
34int generic_acl_chmod(struct inode *, struct generic_acl_operations *);
35
36#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e4af57e87c17..41f276fdd185 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -11,6 +11,8 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13 13
14#ifdef CONFIG_BLOCK
15
14enum { 16enum {
15/* These three have identical behaviour; use the second one if DOS FDISK gets 17/* These three have identical behaviour; use the second one if DOS FDISK gets
16 confused about extended/logical partitions starting past cylinder 1023. */ 18 confused about extended/logical partitions starting past cylinder 1023. */
@@ -420,3 +422,5 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
420#endif 422#endif
421 423
422#endif 424#endif
425
426#endif
diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h
new file mode 100644
index 000000000000..c7372d7a97be
--- /dev/null
+++ b/include/linux/getcpu.h
@@ -0,0 +1,18 @@
1#ifndef _LINUX_GETCPU_H
2#define _LINUX_GETCPU_H 1
3
4/* Cache for getcpu() to speed it up. Results might be a short time
5 out of date, but will be faster.
6
7 User programs should not refer to the contents of this structure.
8 I repeat they should not refer to it. If they do they will break
9 in future kernels.
10
11 It is only a private cache for vgetcpu(). It will change in future kernels.
12 The user program must store this information per thread (__thread)
13 If you want 100% accurate information pass NULL instead. */
14struct getcpu_cache {
15 unsigned long blob[128 / sizeof(long)];
16};
17
18#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 8b34aabfe4c6..bf2b6bc3f6fd 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -67,7 +67,12 @@ struct vm_area_struct;
67#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ 67#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
68 __GFP_HIGHMEM) 68 __GFP_HIGHMEM)
69 69
70#ifdef CONFIG_NUMA
70#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 71#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
72#else
73#define GFP_THISNODE 0
74#endif
75
71 76
72/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some 77/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
73 platforms, used as appropriate on others */ 78 platforms, used as appropriate on others */
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
new file mode 100644
index 000000000000..a7ae7c177cac
--- /dev/null
+++ b/include/linux/gfs2_ondisk.h
@@ -0,0 +1,443 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License v.2.
8 */
9
10#ifndef __GFS2_ONDISK_DOT_H__
11#define __GFS2_ONDISK_DOT_H__
12
13#define GFS2_MAGIC 0x01161970
14#define GFS2_BASIC_BLOCK 512
15#define GFS2_BASIC_BLOCK_SHIFT 9
16
17/* Lock numbers of the LM_TYPE_NONDISK type */
18
19#define GFS2_MOUNT_LOCK 0
20#define GFS2_LIVE_LOCK 1
21#define GFS2_TRANS_LOCK 2
22#define GFS2_RENAME_LOCK 3
23
24/* Format numbers for various metadata types */
25
26#define GFS2_FORMAT_NONE 0
27#define GFS2_FORMAT_SB 100
28#define GFS2_FORMAT_RG 200
29#define GFS2_FORMAT_RB 300
30#define GFS2_FORMAT_DI 400
31#define GFS2_FORMAT_IN 500
32#define GFS2_FORMAT_LF 600
33#define GFS2_FORMAT_JD 700
34#define GFS2_FORMAT_LH 800
35#define GFS2_FORMAT_LD 900
36#define GFS2_FORMAT_LB 1000
37#define GFS2_FORMAT_EA 1600
38#define GFS2_FORMAT_ED 1700
39#define GFS2_FORMAT_QC 1400
40/* These are format numbers for entities contained in files */
41#define GFS2_FORMAT_RI 1100
42#define GFS2_FORMAT_DE 1200
43#define GFS2_FORMAT_QU 1500
44/* These are part of the superblock */
45#define GFS2_FORMAT_FS 1801
46#define GFS2_FORMAT_MULTI 1900
47
48/*
49 * An on-disk inode number
50 */
51
52struct gfs2_inum {
53 __be64 no_formal_ino;
54 __be64 no_addr;
55};
56
57static inline int gfs2_inum_equal(const struct gfs2_inum *ino1,
58 const struct gfs2_inum *ino2)
59{
60 return ino1->no_formal_ino == ino2->no_formal_ino &&
61 ino1->no_addr == ino2->no_addr;
62}
63
64/*
65 * Generic metadata head structure
66 * Every inplace buffer logged in the journal must start with this.
67 */
68
69#define GFS2_METATYPE_NONE 0
70#define GFS2_METATYPE_SB 1
71#define GFS2_METATYPE_RG 2
72#define GFS2_METATYPE_RB 3
73#define GFS2_METATYPE_DI 4
74#define GFS2_METATYPE_IN 5
75#define GFS2_METATYPE_LF 6
76#define GFS2_METATYPE_JD 7
77#define GFS2_METATYPE_LH 8
78#define GFS2_METATYPE_LD 9
79#define GFS2_METATYPE_LB 12
80#define GFS2_METATYPE_EA 10
81#define GFS2_METATYPE_ED 11
82#define GFS2_METATYPE_QC 14
83
84struct gfs2_meta_header {
85 __be32 mh_magic;
86 __be32 mh_type;
87 __be64 __pad0; /* Was generation number in gfs1 */
88 __be32 mh_format;
89 __be32 __pad1; /* Was incarnation number in gfs1 */
90};
91
92/*
93 * super-block structure
94 *
95 * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes)
96 *
97 * Order is important, need to be able to read old superblocks to do on-disk
98 * version upgrades.
99 */
100
101/* Address of superblock in GFS2 basic blocks */
102#define GFS2_SB_ADDR 128
103
104/* The lock number for the superblock (must be zero) */
105#define GFS2_SB_LOCK 0
106
107/* Requirement: GFS2_LOCKNAME_LEN % 8 == 0
108 Includes: the fencing zero at the end */
109#define GFS2_LOCKNAME_LEN 64
110
111struct gfs2_sb {
112 struct gfs2_meta_header sb_header;
113
114 __be32 sb_fs_format;
115 __be32 sb_multihost_format;
116 __u32 __pad0; /* Was superblock flags in gfs1 */
117
118 __be32 sb_bsize;
119 __be32 sb_bsize_shift;
120 __u32 __pad1; /* Was journal segment size in gfs1 */
121
122 struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
123 struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
124 struct gfs2_inum sb_root_dir;
125
126 char sb_lockproto[GFS2_LOCKNAME_LEN];
127 char sb_locktable[GFS2_LOCKNAME_LEN];
128 /* In gfs1, quota and license dinodes followed */
129};
130
131/*
132 * resource index structure
133 */
134
135struct gfs2_rindex {
136 __be64 ri_addr; /* grp block disk address */
137 __be32 ri_length; /* length of rgrp header in fs blocks */
138 __u32 __pad;
139
140 __be64 ri_data0; /* first data location */
141 __be32 ri_data; /* num of data blocks in rgrp */
142
143 __be32 ri_bitbytes; /* number of bytes in data bitmaps */
144
145 __u8 ri_reserved[64];
146};
147
148/*
149 * resource group header structure
150 */
151
152/* Number of blocks per byte in rgrp */
153#define GFS2_NBBY 4
154#define GFS2_BIT_SIZE 2
155#define GFS2_BIT_MASK 0x00000003
156
157#define GFS2_BLKST_FREE 0
158#define GFS2_BLKST_USED 1
159#define GFS2_BLKST_UNLINKED 2
160#define GFS2_BLKST_DINODE 3
161
162#define GFS2_RGF_JOURNAL 0x00000001
163#define GFS2_RGF_METAONLY 0x00000002
164#define GFS2_RGF_DATAONLY 0x00000004
165#define GFS2_RGF_NOALLOC 0x00000008
166
167struct gfs2_rgrp {
168 struct gfs2_meta_header rg_header;
169
170 __be32 rg_flags;
171 __be32 rg_free;
172 __be32 rg_dinodes;
173 __be32 __pad;
174 __be64 rg_igeneration;
175
176 __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */
177};
178
179/*
180 * quota structure
181 */
182
183struct gfs2_quota {
184 __be64 qu_limit;
185 __be64 qu_warn;
186 __be64 qu_value;
187 __u8 qu_reserved[64];
188};
189
190/*
191 * dinode structure
192 */
193
194#define GFS2_MAX_META_HEIGHT 10
195#define GFS2_DIR_MAX_DEPTH 17
196
197#define DT2IF(dt) (((dt) << 12) & S_IFMT)
198#define IF2DT(sif) (((sif) & S_IFMT) >> 12)
199
200enum {
201 gfs2fl_Jdata = 0,
202 gfs2fl_ExHash = 1,
203 gfs2fl_Unused = 2,
204 gfs2fl_EaIndirect = 3,
205 gfs2fl_Directio = 4,
206 gfs2fl_Immutable = 5,
207 gfs2fl_AppendOnly = 6,
208 gfs2fl_NoAtime = 7,
209 gfs2fl_Sync = 8,
210 gfs2fl_System = 9,
211 gfs2fl_TruncInProg = 29,
212 gfs2fl_InheritDirectio = 30,
213 gfs2fl_InheritJdata = 31,
214};
215
216/* Dinode flags */
217#define GFS2_DIF_JDATA 0x00000001
218#define GFS2_DIF_EXHASH 0x00000002
219#define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */
220#define GFS2_DIF_EA_INDIRECT 0x00000008
221#define GFS2_DIF_DIRECTIO 0x00000010
222#define GFS2_DIF_IMMUTABLE 0x00000020
223#define GFS2_DIF_APPENDONLY 0x00000040
224#define GFS2_DIF_NOATIME 0x00000080
225#define GFS2_DIF_SYNC 0x00000100
226#define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
227#define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
228#define GFS2_DIF_INHERIT_DIRECTIO 0x40000000
229#define GFS2_DIF_INHERIT_JDATA 0x80000000
230
231struct gfs2_dinode {
232 struct gfs2_meta_header di_header;
233
234 struct gfs2_inum di_num;
235
236 __be32 di_mode; /* mode of file */
237 __be32 di_uid; /* owner's user id */
238 __be32 di_gid; /* owner's group id */
239 __be32 di_nlink; /* number of links to this file */
240 __be64 di_size; /* number of bytes in file */
241 __be64 di_blocks; /* number of blocks in file */
242 __be64 di_atime; /* time last accessed */
243 __be64 di_mtime; /* time last modified */
244 __be64 di_ctime; /* time last changed */
245 __be32 di_major; /* device major number */
246 __be32 di_minor; /* device minor number */
247
248 /* This section varies from gfs1. Padding added to align with
249 * remainder of dinode
250 */
251 __be64 di_goal_meta; /* rgrp to alloc from next */
252 __be64 di_goal_data; /* data block goal */
253 __be64 di_generation; /* generation number for NFS */
254
255 __be32 di_flags; /* GFS2_DIF_... */
256 __be32 di_payload_format; /* GFS2_FORMAT_... */
257 __u16 __pad1; /* Was ditype in gfs1 */
258 __be16 di_height; /* height of metadata */
259 __u32 __pad2; /* Unused incarnation number from gfs1 */
260
261 /* These only apply to directories */
262 __u16 __pad3; /* Padding */
263 __be16 di_depth; /* Number of bits in the table */
264 __be32 di_entries; /* The number of entries in the directory */
265
266 struct gfs2_inum __pad4; /* Unused even in current gfs1 */
267
268 __be64 di_eattr; /* extended attribute block number */
269
270 __u8 di_reserved[56];
271};
272
273/*
274 * directory structure - many of these per directory file
275 */
276
277#define GFS2_FNAMESIZE 255
278#define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7)
279
280struct gfs2_dirent {
281 struct gfs2_inum de_inum;
282 __be32 de_hash;
283 __be16 de_rec_len;
284 __be16 de_name_len;
285 __be16 de_type;
286 __u8 __pad[14];
287};
288
289/*
290 * Header of leaf directory nodes
291 */
292
293struct gfs2_leaf {
294 struct gfs2_meta_header lf_header;
295
296 __be16 lf_depth; /* Depth of leaf */
297 __be16 lf_entries; /* Number of dirents in leaf */
298 __be32 lf_dirent_format; /* Format of the dirents */
299 __be64 lf_next; /* Next leaf, if overflow */
300
301 __u8 lf_reserved[64];
302};
303
304/*
305 * Extended attribute header format
306 */
307
308#define GFS2_EA_MAX_NAME_LEN 255
309#define GFS2_EA_MAX_DATA_LEN 65536
310
311#define GFS2_EATYPE_UNUSED 0
312#define GFS2_EATYPE_USR 1
313#define GFS2_EATYPE_SYS 2
314#define GFS2_EATYPE_SECURITY 3
315
316#define GFS2_EATYPE_LAST 3
317#define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST)
318
319#define GFS2_EAFLAG_LAST 0x01 /* last ea in block */
320
321struct gfs2_ea_header {
322 __be32 ea_rec_len;
323 __be32 ea_data_len;
324 __u8 ea_name_len; /* no NULL pointer after the string */
325 __u8 ea_type; /* GFS2_EATYPE_... */
326 __u8 ea_flags; /* GFS2_EAFLAG_... */
327 __u8 ea_num_ptrs;
328 __u32 __pad;
329};
330
331/*
332 * Log header structure
333 */
334
335#define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */
336
337struct gfs2_log_header {
338 struct gfs2_meta_header lh_header;
339
340 __be64 lh_sequence; /* Sequence number of this transaction */
341 __be32 lh_flags; /* GFS2_LOG_HEAD_... */
342 __be32 lh_tail; /* Block number of log tail */
343 __be32 lh_blkno;
344 __be32 lh_hash;
345};
346
347/*
348 * Log type descriptor
349 */
350
351#define GFS2_LOG_DESC_METADATA 300
352/* ld_data1 is the number of metadata blocks in the descriptor.
353 ld_data2 is unused. */
354
355#define GFS2_LOG_DESC_REVOKE 301
356/* ld_data1 is the number of revoke blocks in the descriptor.
357 ld_data2 is unused. */
358
359#define GFS2_LOG_DESC_JDATA 302
360/* ld_data1 is the number of data blocks in the descriptor.
361 ld_data2 is unused. */
362
363struct gfs2_log_descriptor {
364 struct gfs2_meta_header ld_header;
365
366 __be32 ld_type; /* GFS2_LOG_DESC_... */
367 __be32 ld_length; /* Number of buffers in this chunk */
368 __be32 ld_data1; /* descriptor-specific field */
369 __be32 ld_data2; /* descriptor-specific field */
370
371 __u8 ld_reserved[32];
372};
373
374/*
375 * Inum Range
376 * Describe a range of formal inode numbers allocated to
377 * one machine to assign to inodes.
378 */
379
380#define GFS2_INUM_QUANTUM 1048576
381
382struct gfs2_inum_range {
383 __be64 ir_start;
384 __be64 ir_length;
385};
386
387/*
388 * Statfs change
389 * Describes an change to the pool of free and allocated
390 * blocks.
391 */
392
393struct gfs2_statfs_change {
394 __be64 sc_total;
395 __be64 sc_free;
396 __be64 sc_dinodes;
397};
398
399/*
400 * Quota change
401 * Describes an allocation change for a particular
402 * user or group.
403 */
404
405#define GFS2_QCF_USER 0x00000001
406
407struct gfs2_quota_change {
408 __be64 qc_change;
409 __be32 qc_flags; /* GFS2_QCF_... */
410 __be32 qc_id;
411};
412
413#ifdef __KERNEL__
414/* Translation functions */
415
416extern void gfs2_inum_in(struct gfs2_inum *no, const void *buf);
417extern void gfs2_inum_out(const struct gfs2_inum *no, void *buf);
418extern void gfs2_sb_in(struct gfs2_sb *sb, const void *buf);
419extern void gfs2_rindex_in(struct gfs2_rindex *ri, const void *buf);
420extern void gfs2_rindex_out(const struct gfs2_rindex *ri, void *buf);
421extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, const void *buf);
422extern void gfs2_rgrp_out(const struct gfs2_rgrp *rg, void *buf);
423extern void gfs2_quota_in(struct gfs2_quota *qu, const void *buf);
424extern void gfs2_quota_out(const struct gfs2_quota *qu, void *buf);
425extern void gfs2_dinode_in(struct gfs2_dinode *di, const void *buf);
426extern void gfs2_dinode_out(const struct gfs2_dinode *di, void *buf);
427extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf);
428extern void gfs2_ea_header_out(const struct gfs2_ea_header *ea, void *buf);
429extern void gfs2_log_header_in(struct gfs2_log_header *lh, const void *buf);
430extern void gfs2_inum_range_in(struct gfs2_inum_range *ir, const void *buf);
431extern void gfs2_inum_range_out(const struct gfs2_inum_range *ir, void *buf);
432extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, const void *buf);
433extern void gfs2_statfs_change_out(const struct gfs2_statfs_change *sc, void *buf);
434extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, const void *buf);
435
436/* Printing functions */
437
438extern void gfs2_rindex_print(const struct gfs2_rindex *ri);
439extern void gfs2_dinode_print(const struct gfs2_dinode *di);
440
441#endif /* __KERNEL__ */
442
443#endif /* __GFS2_ONDISK_DOT_H__ */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 50d8b5744cf6..612472aaa79c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -28,11 +28,16 @@
28 28
29#ifndef HARDIRQ_BITS 29#ifndef HARDIRQ_BITS
30#define HARDIRQ_BITS 12 30#define HARDIRQ_BITS 12
31
32#ifndef MAX_HARDIRQS_PER_CPU
33#define MAX_HARDIRQS_PER_CPU NR_IRQS
34#endif
35
31/* 36/*
32 * The hardirq mask has to be large enough to have space for potentially 37 * The hardirq mask has to be large enough to have space for potentially
33 * all IRQ sources in the system nesting on a single CPU. 38 * all IRQ sources in the system nesting on a single CPU.
34 */ 39 */
35#if (1 << HARDIRQ_BITS) < NR_IRQS 40#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PER_CPU
36# error HARDIRQ_BITS is too low! 41# error HARDIRQ_BITS is too low!
37#endif 42#endif
38#endif 43#endif
diff --git a/include/linux/harrier_defs.h b/include/linux/harrier_defs.h
index 685b252e16cc..efef11db790f 100644
--- a/include/linux/harrier_defs.h
+++ b/include/linux/harrier_defs.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * asm-ppc/harrier_defs.h 2 * include/linux/harrier_defs.h
3 * 3 *
4 * Definitions for Motorola MCG Harrier North Bridge & Memory controller 4 * Definitions for Motorola MCG Harrier North Bridge & Memory controller
5 * 5 *
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index d5ebbb29aeae..d4b333938f73 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -11,95 +11,46 @@
11#ifndef __HDLC_H 11#ifndef __HDLC_H
12#define __HDLC_H 12#define __HDLC_H
13 13
14#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
15
16#define CLOCK_DEFAULT 0 /* Default setting */
17#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
18#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
19#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
20#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
21
22
23#define ENCODING_DEFAULT 0 /* Default setting */
24#define ENCODING_NRZ 1
25#define ENCODING_NRZI 2
26#define ENCODING_FM_MARK 3
27#define ENCODING_FM_SPACE 4
28#define ENCODING_MANCHESTER 5
29
30
31#define PARITY_DEFAULT 0 /* Default setting */
32#define PARITY_NONE 1 /* No parity */
33#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
34#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
35#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
36#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
37#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
38#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
39
40#define LMI_DEFAULT 0 /* Default setting */
41#define LMI_NONE 1 /* No LMI, all PVCs are static */
42#define LMI_ANSI 2 /* ANSI Annex D */
43#define LMI_CCITT 3 /* ITU-T Annex A */
44#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
45 14
46#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ 15#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
16#if 0
47#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ 17#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
18#else
19#define HDLC_MAX_MRU 1600 /* as required for FR network */
20#endif
48 21
49 22
50#ifdef __KERNEL__ 23#ifdef __KERNEL__
51 24
52#include <linux/skbuff.h> 25#include <linux/skbuff.h>
53#include <linux/netdevice.h> 26#include <linux/netdevice.h>
54#include <net/syncppp.h>
55#include <linux/hdlc/ioctl.h> 27#include <linux/hdlc/ioctl.h>
56 28
57 29
58typedef struct { /* Used in Cisco and PPP mode */ 30/* Used by all network devices here, pointed to by netdev_priv(dev) */
59 u8 address; 31struct hdlc_device_desc {
60 u8 control; 32 int (*netif_rx)(struct sk_buff *skb);
61 u16 protocol;
62}__attribute__ ((packed)) hdlc_header;
63
64
65
66typedef struct {
67 u32 type; /* code */
68 u32 par1;
69 u32 par2;
70 u16 rel; /* reliability */
71 u32 time;
72}__attribute__ ((packed)) cisco_packet;
73#define CISCO_PACKET_LEN 18
74#define CISCO_BIG_PACKET_LEN 20
75
76
77
78typedef struct pvc_device_struct {
79 struct net_device *master;
80 struct net_device *main;
81 struct net_device *ether; /* bridged Ethernet interface */
82 struct pvc_device_struct *next; /* Sorted in ascending DLCI order */
83 int dlci;
84 int open_count;
85
86 struct {
87 unsigned int new: 1;
88 unsigned int active: 1;
89 unsigned int exist: 1;
90 unsigned int deleted: 1;
91 unsigned int fecn: 1;
92 unsigned int becn: 1;
93 unsigned int bandwidth; /* Cisco LMI reporting only */
94 }state;
95}pvc_device;
96
97
98
99typedef struct hdlc_device_struct {
100 /* To be initialized by hardware driver */
101 struct net_device_stats stats; 33 struct net_device_stats stats;
102 34};
35
36/* This structure is a private property of HDLC protocols.
37 Hardware drivers have no interest here */
38
39struct hdlc_proto {
40 int (*open)(struct net_device *dev);
41 void (*close)(struct net_device *dev);
42 void (*start)(struct net_device *dev); /* if open & DCD */
43 void (*stop)(struct net_device *dev); /* if open & !DCD */
44 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 unsigned short (*type_trans)(struct sk_buff *skb,
47 struct net_device *dev);
48 struct module *module;
49 struct hdlc_proto *next; /* next protocol in the list */
50};
51
52
53typedef struct hdlc_device {
103 /* used by HDLC layer to take control over HDLC device from hw driver*/ 54 /* used by HDLC layer to take control over HDLC device from hw driver*/
104 int (*attach)(struct net_device *dev, 55 int (*attach)(struct net_device *dev,
105 unsigned short encoding, unsigned short parity); 56 unsigned short encoding, unsigned short parity);
@@ -107,82 +58,18 @@ typedef struct hdlc_device_struct {
107 /* hardware driver must handle this instead of dev->hard_start_xmit */ 58 /* hardware driver must handle this instead of dev->hard_start_xmit */
108 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 59 int (*xmit)(struct sk_buff *skb, struct net_device *dev);
109 60
110
111 /* Things below are for HDLC layer internal use only */ 61 /* Things below are for HDLC layer internal use only */
112 struct { 62 const struct hdlc_proto *proto;
113 int (*open)(struct net_device *dev);
114 void (*close)(struct net_device *dev);
115
116 /* if open & DCD */
117 void (*start)(struct net_device *dev);
118 /* if open & !DCD */
119 void (*stop)(struct net_device *dev);
120
121 void (*detach)(struct hdlc_device_struct *hdlc);
122 int (*netif_rx)(struct sk_buff *skb);
123 unsigned short (*type_trans)(struct sk_buff *skb,
124 struct net_device *dev);
125 int id; /* IF_PROTO_HDLC/CISCO/FR/etc. */
126 }proto;
127
128 int carrier; 63 int carrier;
129 int open; 64 int open;
130 spinlock_t state_lock; 65 spinlock_t state_lock;
131 66 void *state;
132 union {
133 struct {
134 fr_proto settings;
135 pvc_device *first_pvc;
136 int dce_pvc_count;
137
138 struct timer_list timer;
139 unsigned long last_poll;
140 int reliable;
141 int dce_changed;
142 int request;
143 int fullrep_sent;
144 u32 last_errors; /* last errors bit list */
145 u8 n391cnt;
146 u8 txseq; /* TX sequence number */
147 u8 rxseq; /* RX sequence number */
148 }fr;
149
150 struct {
151 cisco_proto settings;
152
153 struct timer_list timer;
154 unsigned long last_poll;
155 int up;
156 int request_sent;
157 u32 txseq; /* TX sequence number */
158 u32 rxseq; /* RX sequence number */
159 }cisco;
160
161 struct {
162 raw_hdlc_proto settings;
163 }raw_hdlc;
164
165 struct {
166 struct ppp_device pppdev;
167 struct ppp_device *syncppp_ptr;
168 int (*old_change_mtu)(struct net_device *dev,
169 int new_mtu);
170 }ppp;
171 }state;
172 void *priv; 67 void *priv;
173}hdlc_device; 68}hdlc_device;
174 69
175 70
176 71
177int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr); 72/* Exported from hdlc module */
178int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr);
179int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr);
180int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr);
181int hdlc_fr_ioctl(struct net_device *dev, struct ifreq *ifr);
182int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr);
183
184
185/* Exported from hdlc.o */
186 73
187/* Called by hardware driver when a user requests HDLC service */ 74/* Called by hardware driver when a user requests HDLC service */
188int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 75int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
@@ -191,17 +78,21 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
191#define register_hdlc_device(dev) register_netdev(dev) 78#define register_hdlc_device(dev) register_netdev(dev)
192void unregister_hdlc_device(struct net_device *dev); 79void unregister_hdlc_device(struct net_device *dev);
193 80
81
82void register_hdlc_protocol(struct hdlc_proto *proto);
83void unregister_hdlc_protocol(struct hdlc_proto *proto);
84
194struct net_device *alloc_hdlcdev(void *priv); 85struct net_device *alloc_hdlcdev(void *priv);
195 86
196static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) 87
88static __inline__ struct hdlc_device_desc* dev_to_desc(struct net_device *dev)
197{ 89{
198 return netdev_priv(dev); 90 return netdev_priv(dev);
199} 91}
200 92
201 93static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev)
202static __inline__ pvc_device* dev_to_pvc(struct net_device *dev)
203{ 94{
204 return (pvc_device*)dev->priv; 95 return netdev_priv(dev) + sizeof(struct hdlc_device_desc);
205} 96}
206 97
207 98
@@ -225,18 +116,14 @@ int hdlc_open(struct net_device *dev);
225/* Must be called by hardware driver when HDLC device is being closed */ 116/* Must be called by hardware driver when HDLC device is being closed */
226void hdlc_close(struct net_device *dev); 117void hdlc_close(struct net_device *dev);
227 118
119int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
120 int (*rx)(struct sk_buff *skb), size_t size);
228/* May be used by hardware driver to gain control over HDLC device */ 121/* May be used by hardware driver to gain control over HDLC device */
229static __inline__ void hdlc_proto_detach(hdlc_device *hdlc) 122void detach_hdlc_protocol(struct net_device *dev);
230{
231 if (hdlc->proto.detach)
232 hdlc->proto.detach(hdlc);
233 hdlc->proto.detach = NULL;
234}
235
236 123
237static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) 124static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
238{ 125{
239 return &dev_to_hdlc(dev)->stats; 126 return &dev_to_desc(dev)->stats;
240} 127}
241 128
242 129
@@ -248,8 +135,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
248 skb->mac.raw = skb->data; 135 skb->mac.raw = skb->data;
249 skb->dev = dev; 136 skb->dev = dev;
250 137
251 if (hdlc->proto.type_trans) 138 if (hdlc->proto->type_trans)
252 return hdlc->proto.type_trans(skb, dev); 139 return hdlc->proto->type_trans(skb, dev);
253 else 140 else
254 return htons(ETH_P_HDLC); 141 return htons(ETH_P_HDLC);
255} 142}
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h
index 78430ba3ea69..583972364357 100644
--- a/include/linux/hdlc/ioctl.h
+++ b/include/linux/hdlc/ioctl.h
@@ -1,6 +1,39 @@
1#ifndef __HDLC_IOCTL_H__ 1#ifndef __HDLC_IOCTL_H__
2#define __HDLC_IOCTL_H__ 2#define __HDLC_IOCTL_H__
3 3
4
5#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
6
7#define CLOCK_DEFAULT 0 /* Default setting */
8#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
9#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
10#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
11#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
12
13
14#define ENCODING_DEFAULT 0 /* Default setting */
15#define ENCODING_NRZ 1
16#define ENCODING_NRZI 2
17#define ENCODING_FM_MARK 3
18#define ENCODING_FM_SPACE 4
19#define ENCODING_MANCHESTER 5
20
21
22#define PARITY_DEFAULT 0 /* Default setting */
23#define PARITY_NONE 1 /* No parity */
24#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
25#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
26#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
27#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
28#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
29#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
30
31#define LMI_DEFAULT 0 /* Default setting */
32#define LMI_NONE 1 /* No LMI, all PVCs are static */
33#define LMI_ANSI 2 /* ANSI Annex D */
34#define LMI_CCITT 3 /* ITU-T Annex A */
35#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
36
4typedef struct { 37typedef struct {
5 unsigned int clock_rate; /* bits per second */ 38 unsigned int clock_rate; /* bits per second */
6 unsigned int clock_type; /* internal, external, TX-internal etc. */ 39 unsigned int clock_type; /* internal, external, TX-internal etc. */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 4fc379de6c2f..fca93025ab51 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -138,6 +138,7 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
138 struct timespec __user *rmtp, 138 struct timespec __user *rmtp,
139 const enum hrtimer_mode mode, 139 const enum hrtimer_mode mode,
140 const clockid_t clockid); 140 const clockid_t clockid);
141extern long hrtimer_nanosleep_restart(struct restart_block *restart_block);
141 142
142extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, 143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
143 struct task_struct *tsk); 144 struct task_struct *tsk);
diff --git a/include/linux/htirq.h b/include/linux/htirq.h
new file mode 100644
index 000000000000..1f15ce279a23
--- /dev/null
+++ b/include/linux/htirq.h
@@ -0,0 +1,15 @@
1#ifndef LINUX_HTIRQ_H
2#define LINUX_HTIRQ_H
3
4/* Helper functions.. */
5void write_ht_irq_low(unsigned int irq, u32 data);
6void write_ht_irq_high(unsigned int irq, u32 data);
7u32 read_ht_irq_low(unsigned int irq);
8u32 read_ht_irq_high(unsigned int irq);
9void mask_ht_irq(unsigned int irq);
10void unmask_ht_irq(unsigned int irq);
11
12/* The arch hook for getting things started */
13int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);
14
15#endif /* LINUX_HTIRQ_H */
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index c0e7fab28ce3..c8f8df25c7e0 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -40,7 +40,6 @@ struct i2c_algo_bit_data {
40 /* local settings */ 40 /* local settings */
41 int udelay; /* half-clock-cycle time in microsecs */ 41 int udelay; /* half-clock-cycle time in microsecs */
42 /* i.e. clock is (500 / udelay) KHz */ 42 /* i.e. clock is (500 / udelay) KHz */
43 int mdelay; /* in millisecs, unused */
44 int timeout; /* in jiffies */ 43 int timeout; /* in jiffies */
45}; 44};
46 45
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 18b0adf57a3d..9908f3fc4839 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -35,7 +35,6 @@ struct i2c_algo_pcf_data {
35 35
36 /* local settings */ 36 /* local settings */
37 int udelay; 37 int udelay;
38 int mdelay;
39 int timeout; 38 int timeout;
40}; 39};
41 40
diff --git a/include/linux/i2c-algo-sibyte.h b/include/linux/i2c-algo-sibyte.h
deleted file mode 100644
index 03914ded8614..000000000000
--- a/include/linux/i2c-algo-sibyte.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef I2C_ALGO_SIBYTE_H
20#define I2C_ALGO_SIBYTE_H 1
21
22#include <linux/i2c.h>
23
24struct i2c_algo_sibyte_data {
25 void *data; /* private data */
26 int bus; /* which bus */
27 void *reg_base; /* CSR base */
28};
29
30int i2c_sibyte_add_bus(struct i2c_adapter *, int speed);
31int i2c_sibyte_del_bus(struct i2c_adapter *);
32
33#endif /* I2C_ALGO_SIBYTE_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 9418519a55d1..0a8f750cbede 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -193,6 +193,7 @@
193#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ 193#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */
194#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ 194#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
195#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 195#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
196#define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */
196 197
197/* --- PCF 8584 based algorithms */ 198/* --- PCF 8584 based algorithms */
198#define I2C_HW_P_LP 0x020000 /* Parallel port interface */ 199#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index eb0628a7ecc6..9b5d04768c2c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -64,14 +64,6 @@ extern int i2c_master_recv(struct i2c_client *,char* ,int);
64 */ 64 */
65extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); 65extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
66 66
67/*
68 * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
69 * This is not tested/implemented yet and will change in the future.
70 */
71extern int i2c_slave_send(struct i2c_client *,char*,int);
72extern int i2c_slave_recv(struct i2c_client *,char*,int);
73
74
75 67
76/* This is the very generalized SMBus access routine. You probably do not 68/* This is the very generalized SMBus access routine. You probably do not
77 want to use this, though; one of the functions below may be much easier, 69 want to use this, though; one of the functions below may be much easier,
@@ -201,10 +193,6 @@ struct i2c_algorithm {
201 unsigned short flags, char read_write, 193 unsigned short flags, char read_write,
202 u8 command, int size, union i2c_smbus_data * data); 194 u8 command, int size, union i2c_smbus_data * data);
203 195
204 /* --- these optional/future use for some adapter types.*/
205 int (*slave_send)(struct i2c_adapter *,char*,int);
206 int (*slave_recv)(struct i2c_adapter *,char*,int);
207
208 /* --- ioctl like call to set div. parameters. */ 196 /* --- ioctl like call to set div. parameters. */
209 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); 197 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
210 198
@@ -220,7 +208,7 @@ struct i2c_adapter {
220 struct module *owner; 208 struct module *owner;
221 unsigned int id; 209 unsigned int id;
222 unsigned int class; 210 unsigned int class;
223 struct i2c_algorithm *algo;/* the algorithm to access the bus */ 211 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
224 void *algo_data; 212 void *algo_data;
225 213
226 /* --- administration stuff. */ 214 /* --- administration stuff. */
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index f0b571f1060b..878cfe4e587f 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -68,16 +68,16 @@
68struct icmphdr { 68struct icmphdr {
69 __u8 type; 69 __u8 type;
70 __u8 code; 70 __u8 code;
71 __u16 checksum; 71 __be16 checksum;
72 union { 72 union {
73 struct { 73 struct {
74 __u16 id; 74 __be16 id;
75 __u16 sequence; 75 __be16 sequence;
76 } echo; 76 } echo;
77 __u32 gateway; 77 __be32 gateway;
78 struct { 78 struct {
79 __u16 __unused; 79 __be16 __unused;
80 __u16 mtu; 80 __be16 mtu;
81 } frag; 81 } frag;
82 } un; 82 } un;
83}; 83};
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 99620451d958..07d8d725541f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -251,7 +251,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
251 251
252#include <asm/ide.h> 252#include <asm/ide.h>
253 253
254#ifndef MAX_HWIFS 254#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
255#undef MAX_HWIFS
255#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS 256#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
256#endif 257#endif
257 258
@@ -773,12 +774,13 @@ typedef struct hwif_s {
773 unsigned long dma_status; /* dma status register */ 774 unsigned long dma_status; /* dma status register */
774 unsigned long dma_vendor3; /* dma vendor 3 register */ 775 unsigned long dma_vendor3; /* dma vendor 3 register */
775 unsigned long dma_prdtable; /* actual prd table address */ 776 unsigned long dma_prdtable; /* actual prd table address */
776 unsigned long dma_base2; /* extended base addr for dma ports */
777 777
778 unsigned dma_extra; /* extra addr for dma ports */
779 unsigned long config_data; /* for use by chipset-specific code */ 778 unsigned long config_data; /* for use by chipset-specific code */
780 unsigned long select_data; /* for use by chipset-specific code */ 779 unsigned long select_data; /* for use by chipset-specific code */
781 780
781 unsigned long extra_base; /* extra addr for dma ports */
782 unsigned extra_ports; /* number of extra dma ports */
783
782 unsigned noprobe : 1; /* don't probe for this interface */ 784 unsigned noprobe : 1; /* don't probe for this interface */
783 unsigned present : 1; /* this interface exists */ 785 unsigned present : 1; /* this interface exists */
784 unsigned hold : 1; /* this interface is always present */ 786 unsigned hold : 1; /* this interface is always present */
@@ -823,6 +825,9 @@ typedef struct hwgroup_s {
823 unsigned int sleeping : 1; 825 unsigned int sleeping : 1;
824 /* BOOL: polling active & poll_timeout field valid */ 826 /* BOOL: polling active & poll_timeout field valid */
825 unsigned int polling : 1; 827 unsigned int polling : 1;
828 /* BOOL: in a polling reset situation. Must not trigger another reset yet */
829 unsigned int resetting : 1;
830
826 /* current drive */ 831 /* current drive */
827 ide_drive_t *drive; 832 ide_drive_t *drive;
828 /* ptr to current hwif in linked-list */ 833 /* ptr to current hwif in linked-list */
@@ -1190,7 +1195,6 @@ extern int ideprobe_init(void);
1190extern void ide_scan_pcibus(int scan_direction) __init; 1195extern void ide_scan_pcibus(int scan_direction) __init;
1191extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); 1196extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner);
1192#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) 1197#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE)
1193extern void ide_pci_unregister_driver(struct pci_driver *driver);
1194void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1198void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
1195extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1199extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
1196 1200
diff --git a/include/linux/if.h b/include/linux/if.h
index cd080d765324..32bf419351f1 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -59,6 +59,8 @@
59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ 59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ 60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
62#define IFF_BONDING 0x20 /* bonding master or slave */
63#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
62 64
63#define IF_GET_IFACE 0x0001 /* for querying only */ 65#define IF_GET_IFACE 0x0001 /* for querying only */
64#define IF_GET_PROTO 0x0002 66#define IF_GET_PROTO 0x0002
@@ -212,134 +214,4 @@ struct ifconf
212#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 214#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
213#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ 215#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
214 216
215/* The struct should be in sync with struct net_device_stats */
216struct rtnl_link_stats
217{
218 __u32 rx_packets; /* total packets received */
219 __u32 tx_packets; /* total packets transmitted */
220 __u32 rx_bytes; /* total bytes received */
221 __u32 tx_bytes; /* total bytes transmitted */
222 __u32 rx_errors; /* bad packets received */
223 __u32 tx_errors; /* packet transmit problems */
224 __u32 rx_dropped; /* no space in linux buffers */
225 __u32 tx_dropped; /* no space available in linux */
226 __u32 multicast; /* multicast packets received */
227 __u32 collisions;
228
229 /* detailed rx_errors: */
230 __u32 rx_length_errors;
231 __u32 rx_over_errors; /* receiver ring buff overflow */
232 __u32 rx_crc_errors; /* recved pkt with crc error */
233 __u32 rx_frame_errors; /* recv'd frame alignment error */
234 __u32 rx_fifo_errors; /* recv'r fifo overrun */
235 __u32 rx_missed_errors; /* receiver missed packet */
236
237 /* detailed tx_errors */
238 __u32 tx_aborted_errors;
239 __u32 tx_carrier_errors;
240 __u32 tx_fifo_errors;
241 __u32 tx_heartbeat_errors;
242 __u32 tx_window_errors;
243
244 /* for cslip etc */
245 __u32 rx_compressed;
246 __u32 tx_compressed;
247};
248
249/* The struct should be in sync with struct ifmap */
250struct rtnl_link_ifmap
251{
252 __u64 mem_start;
253 __u64 mem_end;
254 __u64 base_addr;
255 __u16 irq;
256 __u8 dma;
257 __u8 port;
258};
259
260enum
261{
262 IFLA_UNSPEC,
263 IFLA_ADDRESS,
264 IFLA_BROADCAST,
265 IFLA_IFNAME,
266 IFLA_MTU,
267 IFLA_LINK,
268 IFLA_QDISC,
269 IFLA_STATS,
270 IFLA_COST,
271#define IFLA_COST IFLA_COST
272 IFLA_PRIORITY,
273#define IFLA_PRIORITY IFLA_PRIORITY
274 IFLA_MASTER,
275#define IFLA_MASTER IFLA_MASTER
276 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
277#define IFLA_WIRELESS IFLA_WIRELESS
278 IFLA_PROTINFO, /* Protocol specific information for a link */
279#define IFLA_PROTINFO IFLA_PROTINFO
280 IFLA_TXQLEN,
281#define IFLA_TXQLEN IFLA_TXQLEN
282 IFLA_MAP,
283#define IFLA_MAP IFLA_MAP
284 IFLA_WEIGHT,
285#define IFLA_WEIGHT IFLA_WEIGHT
286 IFLA_OPERSTATE,
287 IFLA_LINKMODE,
288 __IFLA_MAX
289};
290
291
292#define IFLA_MAX (__IFLA_MAX - 1)
293
294/* ifi_flags.
295
296 IFF_* flags.
297
298 The only change is:
299 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
300 more not changeable by user. They describe link media
301 characteristics and set by device driver.
302
303 Comments:
304 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
305 - If neither of these three flags are set;
306 the interface is NBMA.
307
308 - IFF_MULTICAST does not mean anything special:
309 multicasts can be used on all not-NBMA links.
310 IFF_MULTICAST means that this media uses special encapsulation
311 for multicast frames. Apparently, all IFF_POINTOPOINT and
312 IFF_BROADCAST devices are able to use multicasts too.
313 */
314
315/* IFLA_LINK.
316 For usual devices it is equal ifi_index.
317 If it is a "virtual interface" (f.e. tunnel), ifi_link
318 can point to real physical interface (f.e. for bandwidth calculations),
319 or maybe 0, what means, that real media is unknown (usual
320 for IPIP tunnels, when route to endpoint is allowed to change)
321 */
322
323/* Subtype attributes for IFLA_PROTINFO */
324enum
325{
326 IFLA_INET6_UNSPEC,
327 IFLA_INET6_FLAGS, /* link flags */
328 IFLA_INET6_CONF, /* sysctl parameters */
329 IFLA_INET6_STATS, /* statistics */
330 IFLA_INET6_MCAST, /* MC things. What of them? */
331 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
332 __IFLA_INET6_MAX
333};
334
335#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
336
337struct ifla_cacheinfo
338{
339 __u32 max_reasm_len;
340 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
341 __u32 reachable_time;
342 __u32 retrans_time;
343};
344
345#endif /* _LINUX_IF_H */ 217#endif /* _LINUX_IF_H */
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index a8b1a2071838..7f5714214ee3 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -130,11 +130,11 @@ struct arpreq_old {
130 130
131struct arphdr 131struct arphdr
132{ 132{
133 unsigned short ar_hrd; /* format of hardware address */ 133 __be16 ar_hrd; /* format of hardware address */
134 unsigned short ar_pro; /* format of protocol address */ 134 __be16 ar_pro; /* format of protocol address */
135 unsigned char ar_hln; /* length of hardware address */ 135 unsigned char ar_hln; /* length of hardware address */
136 unsigned char ar_pln; /* length of protocol address */ 136 unsigned char ar_pln; /* length of protocol address */
137 unsigned short ar_op; /* ARP opcode (command) */ 137 __be16 ar_op; /* ARP opcode (command) */
138 138
139#if 0 139#if 0
140 /* 140 /*
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
new file mode 100644
index 000000000000..e963a077e6f5
--- /dev/null
+++ b/include/linux/if_link.h
@@ -0,0 +1,136 @@
1#ifndef _LINUX_IF_LINK_H
2#define _LINUX_IF_LINK_H
3
4#include <linux/netlink.h>
5
6/* The struct should be in sync with struct net_device_stats */
7struct rtnl_link_stats
8{
9 __u32 rx_packets; /* total packets received */
10 __u32 tx_packets; /* total packets transmitted */
11 __u32 rx_bytes; /* total bytes received */
12 __u32 tx_bytes; /* total bytes transmitted */
13 __u32 rx_errors; /* bad packets received */
14 __u32 tx_errors; /* packet transmit problems */
15 __u32 rx_dropped; /* no space in linux buffers */
16 __u32 tx_dropped; /* no space available in linux */
17 __u32 multicast; /* multicast packets received */
18 __u32 collisions;
19
20 /* detailed rx_errors: */
21 __u32 rx_length_errors;
22 __u32 rx_over_errors; /* receiver ring buff overflow */
23 __u32 rx_crc_errors; /* recved pkt with crc error */
24 __u32 rx_frame_errors; /* recv'd frame alignment error */
25 __u32 rx_fifo_errors; /* recv'r fifo overrun */
26 __u32 rx_missed_errors; /* receiver missed packet */
27
28 /* detailed tx_errors */
29 __u32 tx_aborted_errors;
30 __u32 tx_carrier_errors;
31 __u32 tx_fifo_errors;
32 __u32 tx_heartbeat_errors;
33 __u32 tx_window_errors;
34
35 /* for cslip etc */
36 __u32 rx_compressed;
37 __u32 tx_compressed;
38};
39
40/* The struct should be in sync with struct ifmap */
41struct rtnl_link_ifmap
42{
43 __u64 mem_start;
44 __u64 mem_end;
45 __u64 base_addr;
46 __u16 irq;
47 __u8 dma;
48 __u8 port;
49};
50
51enum
52{
53 IFLA_UNSPEC,
54 IFLA_ADDRESS,
55 IFLA_BROADCAST,
56 IFLA_IFNAME,
57 IFLA_MTU,
58 IFLA_LINK,
59 IFLA_QDISC,
60 IFLA_STATS,
61 IFLA_COST,
62#define IFLA_COST IFLA_COST
63 IFLA_PRIORITY,
64#define IFLA_PRIORITY IFLA_PRIORITY
65 IFLA_MASTER,
66#define IFLA_MASTER IFLA_MASTER
67 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
68#define IFLA_WIRELESS IFLA_WIRELESS
69 IFLA_PROTINFO, /* Protocol specific information for a link */
70#define IFLA_PROTINFO IFLA_PROTINFO
71 IFLA_TXQLEN,
72#define IFLA_TXQLEN IFLA_TXQLEN
73 IFLA_MAP,
74#define IFLA_MAP IFLA_MAP
75 IFLA_WEIGHT,
76#define IFLA_WEIGHT IFLA_WEIGHT
77 IFLA_OPERSTATE,
78 IFLA_LINKMODE,
79 __IFLA_MAX
80};
81
82
83#define IFLA_MAX (__IFLA_MAX - 1)
84
85/* ifi_flags.
86
87 IFF_* flags.
88
89 The only change is:
90 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
91 more not changeable by user. They describe link media
92 characteristics and set by device driver.
93
94 Comments:
95 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
96 - If neither of these three flags are set;
97 the interface is NBMA.
98
99 - IFF_MULTICAST does not mean anything special:
100 multicasts can be used on all not-NBMA links.
101 IFF_MULTICAST means that this media uses special encapsulation
102 for multicast frames. Apparently, all IFF_POINTOPOINT and
103 IFF_BROADCAST devices are able to use multicasts too.
104 */
105
106/* IFLA_LINK.
107 For usual devices it is equal ifi_index.
108 If it is a "virtual interface" (f.e. tunnel), ifi_link
109 can point to real physical interface (f.e. for bandwidth calculations),
110 or maybe 0, what means, that real media is unknown (usual
111 for IPIP tunnels, when route to endpoint is allowed to change)
112 */
113
114/* Subtype attributes for IFLA_PROTINFO */
115enum
116{
117 IFLA_INET6_UNSPEC,
118 IFLA_INET6_FLAGS, /* link flags */
119 IFLA_INET6_CONF, /* sysctl parameters */
120 IFLA_INET6_STATS, /* statistics */
121 IFLA_INET6_MCAST, /* MC things. What of them? */
122 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
123 __IFLA_INET6_MAX
124};
125
126#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
127
128struct ifla_cacheinfo
129{
130 __u32 max_reasm_len;
131 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
132 __u32 reachable_time;
133 __u32 retrans_time;
134};
135
136#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 899c3d4776f3..03f43e2893a4 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -30,8 +30,8 @@ struct igmphdr
30{ 30{
31 __u8 type; 31 __u8 type;
32 __u8 code; /* For newer IGMP */ 32 __u8 code; /* For newer IGMP */
33 __u16 csum; 33 __be16 csum;
34 __u32 group; 34 __be32 group;
35}; 35};
36 36
37/* V3 group record types [grec_type] */ 37/* V3 group record types [grec_type] */
@@ -45,25 +45,25 @@ struct igmphdr
45struct igmpv3_grec { 45struct igmpv3_grec {
46 __u8 grec_type; 46 __u8 grec_type;
47 __u8 grec_auxwords; 47 __u8 grec_auxwords;
48 __u16 grec_nsrcs; 48 __be16 grec_nsrcs;
49 __u32 grec_mca; 49 __be32 grec_mca;
50 __u32 grec_src[0]; 50 __be32 grec_src[0];
51}; 51};
52 52
53struct igmpv3_report { 53struct igmpv3_report {
54 __u8 type; 54 __u8 type;
55 __u8 resv1; 55 __u8 resv1;
56 __u16 csum; 56 __be16 csum;
57 __u16 resv2; 57 __be16 resv2;
58 __u16 ngrec; 58 __be16 ngrec;
59 struct igmpv3_grec grec[0]; 59 struct igmpv3_grec grec[0];
60}; 60};
61 61
62struct igmpv3_query { 62struct igmpv3_query {
63 __u8 type; 63 __u8 type;
64 __u8 code; 64 __u8 code;
65 __u16 csum; 65 __be16 csum;
66 __u32 group; 66 __be32 group;
67#if defined(__LITTLE_ENDIAN_BITFIELD) 67#if defined(__LITTLE_ENDIAN_BITFIELD)
68 __u8 qrv:3, 68 __u8 qrv:3,
69 suppress:1, 69 suppress:1,
@@ -76,8 +76,8 @@ struct igmpv3_query {
76#error "Please fix <asm/byteorder.h>" 76#error "Please fix <asm/byteorder.h>"
77#endif 77#endif
78 __u8 qqic; 78 __u8 qqic;
79 __u16 nsrcs; 79 __be16 nsrcs;
80 __u32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
@@ -136,11 +136,11 @@ struct ip_sf_socklist
136{ 136{
137 unsigned int sl_max; 137 unsigned int sl_max;
138 unsigned int sl_count; 138 unsigned int sl_count;
139 __u32 sl_addr[0]; 139 __be32 sl_addr[0];
140}; 140};
141 141
142#define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ 142#define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \
143 (count) * sizeof(__u32)) 143 (count) * sizeof(__be32))
144 144
145#define IP_SFBLOCK 10 /* allocate this many at once */ 145#define IP_SFBLOCK 10 /* allocate this many at once */
146 146
@@ -159,7 +159,7 @@ struct ip_mc_socklist
159struct ip_sf_list 159struct ip_sf_list
160{ 160{
161 struct ip_sf_list *sf_next; 161 struct ip_sf_list *sf_next;
162 __u32 sf_inaddr; 162 __be32 sf_inaddr;
163 unsigned long sf_count[2]; /* include/exclude counts */ 163 unsigned long sf_count[2]; /* include/exclude counts */
164 unsigned char sf_gsresp; /* include in g & s response? */ 164 unsigned char sf_gsresp; /* include in g & s response? */
165 unsigned char sf_oldin; /* change state */ 165 unsigned char sf_oldin; /* change state */
@@ -197,7 +197,7 @@ struct ip_mc_list
197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
198#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) 198#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
199 199
200extern int ip_check_mc(struct in_device *dev, u32 mc_addr, u32 src_addr, u16 proto); 200extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
201extern int igmp_rcv(struct sk_buff *); 201extern int igmp_rcv(struct sk_buff *);
202extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); 202extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
203extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); 203extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
@@ -209,13 +209,13 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
209 struct ip_msfilter __user *optval, int __user *optlen); 209 struct ip_msfilter __user *optval, int __user *optlen);
210extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, 210extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
211 struct group_filter __user *optval, int __user *optlen); 211 struct group_filter __user *optval, int __user *optlen);
212extern int ip_mc_sf_allow(struct sock *sk, u32 local, u32 rmt, int dif); 212extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
213extern void ip_mr_init(void); 213extern void ip_mr_init(void);
214extern void ip_mc_init_dev(struct in_device *); 214extern void ip_mc_init_dev(struct in_device *);
215extern void ip_mc_destroy_dev(struct in_device *); 215extern void ip_mc_destroy_dev(struct in_device *);
216extern void ip_mc_up(struct in_device *); 216extern void ip_mc_up(struct in_device *);
217extern void ip_mc_down(struct in_device *); 217extern void ip_mc_down(struct in_device *);
218extern void ip_mc_dec_group(struct in_device *in_dev, u32 addr); 218extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
219extern void ip_mc_inc_group(struct in_device *in_dev, u32 addr); 219extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
220#endif 220#endif
221#endif 221#endif
diff --git a/include/linux/in.h b/include/linux/in.h
index bcaca8399aed..2619859f6e1b 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -40,6 +40,7 @@ enum {
40 40
41 IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ 41 IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
42 IPPROTO_AH = 51, /* Authentication Header protocol */ 42 IPPROTO_AH = 51, /* Authentication Header protocol */
43 IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
43 IPPROTO_PIM = 103, /* Protocol Independent Multicast */ 44 IPPROTO_PIM = 103, /* Protocol Independent Multicast */
44 45
45 IPPROTO_COMP = 108, /* Compression Header protocol */ 46 IPPROTO_COMP = 108, /* Compression Header protocol */
@@ -123,17 +124,17 @@ struct ip_mreqn
123}; 124};
124 125
125struct ip_mreq_source { 126struct ip_mreq_source {
126 __u32 imr_multiaddr; 127 __be32 imr_multiaddr;
127 __u32 imr_interface; 128 __be32 imr_interface;
128 __u32 imr_sourceaddr; 129 __be32 imr_sourceaddr;
129}; 130};
130 131
131struct ip_msfilter { 132struct ip_msfilter {
132 __u32 imsf_multiaddr; 133 __be32 imsf_multiaddr;
133 __u32 imsf_interface; 134 __be32 imsf_interface;
134 __u32 imsf_fmode; 135 __u32 imsf_fmode;
135 __u32 imsf_numsrc; 136 __u32 imsf_numsrc;
136 __u32 imsf_slist[1]; 137 __be32 imsf_slist[1];
137}; 138};
138 139
139#define IP_MSFILTER_SIZE(numsrc) \ 140#define IP_MSFILTER_SIZE(numsrc) \
diff --git a/include/linux/in6.h b/include/linux/in6.h
index d776829b443f..9be6a4756f0b 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -32,8 +32,8 @@ struct in6_addr
32 union 32 union
33 { 33 {
34 __u8 u6_addr8[16]; 34 __u8 u6_addr8[16];
35 __u16 u6_addr16[8]; 35 __be16 u6_addr16[8];
36 __u32 u6_addr32[4]; 36 __be32 u6_addr32[4];
37 } in6_u; 37 } in6_u;
38#define s6_addr in6_u.u6_addr8 38#define s6_addr in6_u.u6_addr8
39#define s6_addr16 in6_u.u6_addr16 39#define s6_addr16 in6_u.u6_addr16
@@ -53,7 +53,7 @@ extern const struct in6_addr in6addr_loopback;
53 53
54struct sockaddr_in6 { 54struct sockaddr_in6 {
55 unsigned short int sin6_family; /* AF_INET6 */ 55 unsigned short int sin6_family; /* AF_INET6 */
56 __u16 sin6_port; /* Transport layer port # */ 56 __be16 sin6_port; /* Transport layer port # */
57 __u32 sin6_flowinfo; /* IPv6 flow information */ 57 __u32 sin6_flowinfo; /* IPv6 flow information */
58 struct in6_addr sin6_addr; /* IPv6 address */ 58 struct in6_addr sin6_addr; /* IPv6 address */
59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */ 59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index a4606e5810e5..6e8bc548635a 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -9,10 +9,10 @@
9 9
10/* Socket identity */ 10/* Socket identity */
11struct inet_diag_sockid { 11struct inet_diag_sockid {
12 __u16 idiag_sport; 12 __be16 idiag_sport;
13 __u16 idiag_dport; 13 __be16 idiag_dport;
14 __u32 idiag_src[4]; 14 __be32 idiag_src[4];
15 __u32 idiag_dst[4]; 15 __be32 idiag_dst[4];
16 __u32 idiag_if; 16 __u32 idiag_if;
17 __u32 idiag_cookie[2]; 17 __u32 idiag_cookie[2];
18#define INET_DIAG_NOCOOKIE (~0U) 18#define INET_DIAG_NOCOOKIE (~0U)
@@ -67,7 +67,7 @@ struct inet_diag_hostcond {
67 __u8 family; 67 __u8 family;
68 __u8 prefix_len; 68 __u8 prefix_len;
69 int port; 69 int port;
70 __u32 addr[0]; 70 __be32 addr[0];
71}; 71};
72 72
73/* Base info structure. It contains socket identity (addrs/ports/cookie) 73/* Base info structure. It contains socket identity (addrs/ports/cookie)
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 92297ff24e85..5a0ab04627bc 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -90,11 +90,11 @@ struct in_ifaddr
90 struct in_ifaddr *ifa_next; 90 struct in_ifaddr *ifa_next;
91 struct in_device *ifa_dev; 91 struct in_device *ifa_dev;
92 struct rcu_head rcu_head; 92 struct rcu_head rcu_head;
93 u32 ifa_local; 93 __be32 ifa_local;
94 u32 ifa_address; 94 __be32 ifa_address;
95 u32 ifa_mask; 95 __be32 ifa_mask;
96 u32 ifa_broadcast; 96 __be32 ifa_broadcast;
97 u32 ifa_anycast; 97 __be32 ifa_anycast;
98 unsigned char ifa_scope; 98 unsigned char ifa_scope;
99 unsigned char ifa_flags; 99 unsigned char ifa_flags;
100 unsigned char ifa_prefixlen; 100 unsigned char ifa_prefixlen;
@@ -104,18 +104,18 @@ struct in_ifaddr
104extern int register_inetaddr_notifier(struct notifier_block *nb); 104extern int register_inetaddr_notifier(struct notifier_block *nb);
105extern int unregister_inetaddr_notifier(struct notifier_block *nb); 105extern int unregister_inetaddr_notifier(struct notifier_block *nb);
106 106
107extern struct net_device *ip_dev_find(u32 addr); 107extern struct net_device *ip_dev_find(__be32 addr);
108extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b); 108extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
109extern int devinet_ioctl(unsigned int cmd, void __user *); 109extern int devinet_ioctl(unsigned int cmd, void __user *);
110extern void devinet_init(void); 110extern void devinet_init(void);
111extern struct in_device *inetdev_init(struct net_device *dev); 111extern struct in_device *inetdev_init(struct net_device *dev);
112extern struct in_device *inetdev_by_index(int); 112extern struct in_device *inetdev_by_index(int);
113extern u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope); 113extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
114extern u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope); 114extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
115extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask); 115extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
116extern void inet_forward_change(void); 116extern void inet_forward_change(void);
117 117
118static __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa) 118static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
119{ 119{
120 return !((addr^ifa->ifa_address)&ifa->ifa_mask); 120 return !((addr^ifa->ifa_address)&ifa->ifa_mask);
121} 121}
@@ -183,7 +183,7 @@ static inline void in_dev_put(struct in_device *idev)
183 183
184#endif /* __KERNEL__ */ 184#endif /* __KERNEL__ */
185 185
186static __inline__ __u32 inet_make_mask(int logmask) 186static __inline__ __be32 inet_make_mask(int logmask)
187{ 187{
188 if (logmask) 188 if (logmask)
189 return htonl(~((1<<(32-logmask))-1)); 189 return htonl(~((1<<(32-logmask))-1));
diff --git a/include/linux/init.h b/include/linux/init.h
index 6667785dd1ff..e92b1455d7af 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -68,6 +68,7 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[];
68 68
69/* Defined in init/main.c */ 69/* Defined in init/main.c */
70extern char saved_command_line[]; 70extern char saved_command_line[];
71extern unsigned int reset_devices;
71 72
72/* used by init/main.c */ 73/* used by init/main.c */
73extern void setup_arch(char **); 74extern void setup_arch(char **);
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 60aac2cea0cf..33c5daacc743 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -4,7 +4,9 @@
4#include <linux/file.h> 4#include <linux/file.h>
5#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
6#include <linux/irqflags.h> 6#include <linux/irqflags.h>
7#include <linux/utsname.h>
7#include <linux/lockdep.h> 8#include <linux/lockdep.h>
9#include <linux/ipc.h>
8 10
9#define INIT_FDTABLE \ 11#define INIT_FDTABLE \
10{ \ 12{ \
@@ -68,6 +70,15 @@
68 .session = 1, \ 70 .session = 1, \
69} 71}
70 72
73extern struct nsproxy init_nsproxy;
74#define INIT_NSPROXY(nsproxy) { \
75 .count = ATOMIC_INIT(1), \
76 .nslock = SPIN_LOCK_UNLOCKED, \
77 .uts_ns = &init_uts_ns, \
78 .namespace = NULL, \
79 INIT_IPC_NS(ipc_ns) \
80}
81
71#define INIT_SIGHAND(sighand) { \ 82#define INIT_SIGHAND(sighand) { \
72 .count = ATOMIC_INIT(1), \ 83 .count = ATOMIC_INIT(1), \
73 .action = { { { .sa_handler = NULL, } }, }, \ 84 .action = { { { .sa_handler = NULL, } }, }, \
@@ -117,6 +128,7 @@ extern struct group_info init_groups;
117 .files = &init_files, \ 128 .files = &init_files, \
118 .signal = &init_signals, \ 129 .signal = &init_signals, \
119 .sighand = &init_sighand, \ 130 .sighand = &init_sighand, \
131 .nsproxy = &init_nsproxy, \
120 .pending = { \ 132 .pending = { \
121 .list = LIST_HEAD_INIT(tsk.pending.list), \ 133 .list = LIST_HEAD_INIT(tsk.pending.list), \
122 .signal = {{0}}}, \ 134 .signal = {{0}}}, \
diff --git a/include/linux/input.h b/include/linux/input.h
index b3253ab72ff7..5770105471dd 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -349,6 +349,9 @@ struct input_absinfo {
349 349
350#define KEY_BATTERY 236 350#define KEY_BATTERY 236
351 351
352#define KEY_BLUETOOTH 237
353#define KEY_WLAN 238
354
352#define KEY_UNKNOWN 240 355#define KEY_UNKNOWN 240
353 356
354#define BTN_MISC 0x100 357#define BTN_MISC 0x100
@@ -645,6 +648,7 @@ struct input_absinfo {
645#define BUS_USB 0x03 648#define BUS_USB 0x03
646#define BUS_HIL 0x04 649#define BUS_HIL 0x04
647#define BUS_BLUETOOTH 0x05 650#define BUS_BLUETOOTH 0x05
651#define BUS_VIRTUAL 0x06
648 652
649#define BUS_ISA 0x10 653#define BUS_ISA 0x10
650#define BUS_I8042 0x11 654#define BUS_I8042 0x11
@@ -667,98 +671,167 @@ struct input_absinfo {
667 671
668/* 672/*
669 * Structures used in ioctls to upload effects to a device 673 * Structures used in ioctls to upload effects to a device
670 * The first structures are not passed directly by using ioctls. 674 * They are pieces of a bigger structure (called ff_effect)
671 * They are sub-structures of the actually sent structure (called ff_effect) 675 */
676
677/*
678 * All duration values are expressed in ms. Values above 32767 ms (0x7fff)
679 * should not be used and have unspecified results.
672 */ 680 */
673 681
682/**
683 * struct ff_replay - defines scheduling of the effect
684 * @length: duration of the effect
685 * @delay: delay before effect should start playing
686 */
674struct ff_replay { 687struct ff_replay {
675 __u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */ 688 __u16 length;
676 __u16 delay; /* Time to wait before to start playing an effect */ 689 __u16 delay;
677}; 690};
678 691
692/**
693 * struct ff_trigger - defines what triggers the effect
694 * @button: number of the button triggering the effect
695 * @interval: controls how soon the effect can be re-triggered
696 */
679struct ff_trigger { 697struct ff_trigger {
680 __u16 button; /* Number of button triggering an effect */ 698 __u16 button;
681 __u16 interval; /* Time to wait before an effect can be re-triggered (ms) */ 699 __u16 interval;
682}; 700};
683 701
702/**
703 * struct ff_envelope - generic effect envelope
704 * @attack_length: duration of the attack (ms)
705 * @attack_level: level at the beginning of the attack
706 * @fade_length: duration of fade (ms)
707 * @fade_level: level at the end of fade
708 *
709 * The @attack_level and @fade_level are absolute values; when applying
710 * envelope force-feedback core will convert to positive/negative
711 * value based on polarity of the default level of the effect.
712 * Valid range for the attack and fade levels is 0x0000 - 0x7fff
713 */
684struct ff_envelope { 714struct ff_envelope {
685 __u16 attack_length; /* Duration of attack (ms) */ 715 __u16 attack_length;
686 __u16 attack_level; /* Level at beginning of attack */ 716 __u16 attack_level;
687 __u16 fade_length; /* Duration of fade (ms) */ 717 __u16 fade_length;
688 __u16 fade_level; /* Level at end of fade */ 718 __u16 fade_level;
689}; 719};
690 720
691/* FF_CONSTANT */ 721/**
722 * struct ff_constant_effect - defines parameters of a constant effect
723 * @level: strength of the effect; may be negative
724 * @envelope: envelope data
725 */
692struct ff_constant_effect { 726struct ff_constant_effect {
693 __s16 level; /* Strength of effect. Negative values are OK */ 727 __s16 level;
694 struct ff_envelope envelope; 728 struct ff_envelope envelope;
695}; 729};
696 730
697/* FF_RAMP */ 731/**
732 * struct ff_ramp_effect - defines parameters of a ramp effect
733 * @start_level: beginning strength of the effect; may be negative
734 * @end_level: final strength of the effect; may be negative
735 * @envelope: envelope data
736 */
698struct ff_ramp_effect { 737struct ff_ramp_effect {
699 __s16 start_level; 738 __s16 start_level;
700 __s16 end_level; 739 __s16 end_level;
701 struct ff_envelope envelope; 740 struct ff_envelope envelope;
702}; 741};
703 742
704/* FF_SPRING of FF_FRICTION */ 743/**
744 * struct ff_condition_effect - defines a spring or friction effect
745 * @right_saturation: maximum level when joystick moved all way to the right
746 * @left_saturation: same for the left side
747 * @right_coeff: controls how fast the force grows when the joystick moves
748 * to the right
749 * @left_coeff: same for the left side
750 * @deadband: size of the dead zone, where no force is produced
751 * @center: position of the dead zone
752 */
705struct ff_condition_effect { 753struct ff_condition_effect {
706 __u16 right_saturation; /* Max level when joystick is on the right */ 754 __u16 right_saturation;
707 __u16 left_saturation; /* Max level when joystick in on the left */ 755 __u16 left_saturation;
708
709 __s16 right_coeff; /* Indicates how fast the force grows when the
710 joystick moves to the right */
711 __s16 left_coeff; /* Same for left side */
712 756
713 __u16 deadband; /* Size of area where no force is produced */ 757 __s16 right_coeff;
714 __s16 center; /* Position of dead zone */ 758 __s16 left_coeff;
715 759
760 __u16 deadband;
761 __s16 center;
716}; 762};
717 763
718/* FF_PERIODIC */ 764/**
765 * struct ff_periodic_effect - defines parameters of a periodic effect
766 * @waveform: kind of the effect (wave)
767 * @period: period of the wave (ms)
768 * @magnitude: peak value
769 * @offset: mean value of the wave (roughly)
770 * @phase: 'horizontal' shift
771 * @envelope: envelope data
772 * @custom_len: number of samples (FF_CUSTOM only)
773 * @custom_data: buffer of samples (FF_CUSTOM only)
774 *
775 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
776 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
777 * for the time being as no driver supports it yet.
778 *
779 * Note: the data pointed by custom_data is copied by the driver.
780 * You can therefore dispose of the memory after the upload/update.
781 */
719struct ff_periodic_effect { 782struct ff_periodic_effect {
720 __u16 waveform; /* Kind of wave (sine, square...) */ 783 __u16 waveform;
721 __u16 period; /* in ms */ 784 __u16 period;
722 __s16 magnitude; /* Peak value */ 785 __s16 magnitude;
723 __s16 offset; /* Mean value of wave (roughly) */ 786 __s16 offset;
724 __u16 phase; /* 'Horizontal' shift */ 787 __u16 phase;
725 788
726 struct ff_envelope envelope; 789 struct ff_envelope envelope;
727 790
728/* Only used if waveform == FF_CUSTOM */ 791 __u32 custom_len;
729 __u32 custom_len; /* Number of samples */ 792 __s16 *custom_data;
730 __s16 *custom_data; /* Buffer of samples */
731/* Note: the data pointed by custom_data is copied by the driver. You can
732 * therefore dispose of the memory after the upload/update */
733}; 793};
734 794
735/* FF_RUMBLE */ 795/**
736/* Some rumble pads have two motors of different weight. 796 * struct ff_rumble_effect - defines parameters of a periodic effect
737 strong_magnitude represents the magnitude of the vibration generated 797 * @strong_magnitude: magnitude of the heavy motor
738 by the heavy motor. 798 * @weak_magnitude: magnitude of the light one
739*/ 799 *
800 * Some rumble pads have two motors of different weight. Strong_magnitude
801 * represents the magnitude of the vibration generated by the heavy one.
802 */
740struct ff_rumble_effect { 803struct ff_rumble_effect {
741 __u16 strong_magnitude; /* Magnitude of the heavy motor */ 804 __u16 strong_magnitude;
742 __u16 weak_magnitude; /* Magnitude of the light one */ 805 __u16 weak_magnitude;
743}; 806};
744 807
745/* 808/**
746 * Structure sent through ioctl from the application to the driver 809 * struct ff_effect - defines force feedback effect
810 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
811 * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
812 * @id: an unique id assigned to an effect
813 * @direction: direction of the effect
814 * @trigger: trigger conditions (struct ff_trigger)
815 * @replay: scheduling of the effect (struct ff_replay)
816 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
817 * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
818 * defining effect parameters
819 *
820 * This structure is sent through ioctl from the application to the driver.
821 * To create a new effect aplication should set its @id to -1; the kernel
822 * will return assigned @id which can later be used to update or delete
823 * this effect.
824 *
825 * Direction of the effect is encoded as follows:
826 * 0 deg -> 0x0000 (down)
827 * 90 deg -> 0x4000 (left)
828 * 180 deg -> 0x8000 (up)
829 * 270 deg -> 0xC000 (right)
747 */ 830 */
748struct ff_effect { 831struct ff_effect {
749 __u16 type; 832 __u16 type;
750/* Following field denotes the unique id assigned to an effect.
751 * If user sets if to -1, a new effect is created, and its id is returned in the same field
752 * Else, the user sets it to the effect id it wants to update.
753 */
754 __s16 id; 833 __s16 id;
755 834 __u16 direction;
756 __u16 direction; /* Direction. 0 deg -> 0x0000 (down)
757 90 deg -> 0x4000 (left)
758 180 deg -> 0x8000 (up)
759 270 deg -> 0xC000 (right)
760 */
761
762 struct ff_trigger trigger; 835 struct ff_trigger trigger;
763 struct ff_replay replay; 836 struct ff_replay replay;
764 837
@@ -784,6 +857,9 @@ struct ff_effect {
784#define FF_INERTIA 0x56 857#define FF_INERTIA 0x56
785#define FF_RAMP 0x57 858#define FF_RAMP 0x57
786 859
860#define FF_EFFECT_MIN FF_RUMBLE
861#define FF_EFFECT_MAX FF_RAMP
862
787/* 863/*
788 * Force feedback periodic effect types 864 * Force feedback periodic effect types
789 */ 865 */
@@ -795,6 +871,9 @@ struct ff_effect {
795#define FF_SAW_DOWN 0x5c 871#define FF_SAW_DOWN 0x5c
796#define FF_CUSTOM 0x5d 872#define FF_CUSTOM 0x5d
797 873
874#define FF_WAVEFORM_MIN FF_SQUARE
875#define FF_WAVEFORM_MAX FF_CUSTOM
876
798/* 877/*
799 * Set ff device properties 878 * Set ff device properties
800 */ 879 */
@@ -864,12 +943,13 @@ struct input_dev {
864 unsigned long sndbit[NBITS(SND_MAX)]; 943 unsigned long sndbit[NBITS(SND_MAX)];
865 unsigned long ffbit[NBITS(FF_MAX)]; 944 unsigned long ffbit[NBITS(FF_MAX)];
866 unsigned long swbit[NBITS(SW_MAX)]; 945 unsigned long swbit[NBITS(SW_MAX)];
867 int ff_effects_max;
868 946
869 unsigned int keycodemax; 947 unsigned int keycodemax;
870 unsigned int keycodesize; 948 unsigned int keycodesize;
871 void *keycode; 949 void *keycode;
872 950
951 struct ff_device *ff;
952
873 unsigned int repeat_key; 953 unsigned int repeat_key;
874 struct timer_list timer; 954 struct timer_list timer;
875 955
@@ -895,8 +975,6 @@ struct input_dev {
895 void (*close)(struct input_dev *dev); 975 void (*close)(struct input_dev *dev);
896 int (*flush)(struct input_dev *dev, struct file *file); 976 int (*flush)(struct input_dev *dev, struct file *file);
897 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); 977 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
898 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
899 int (*erase_effect)(struct input_dev *dev, int effect_id);
900 978
901 struct input_handle *grab; 979 struct input_handle *grab;
902 980
@@ -904,9 +982,6 @@ struct input_dev {
904 unsigned int users; 982 unsigned int users;
905 983
906 struct class_device cdev; 984 struct class_device cdev;
907 struct device *dev; /* will be removed soon */
908
909 int dynalloc; /* temporarily */
910 985
911 struct list_head h_list; 986 struct list_head h_list;
912 struct list_head node; 987 struct list_head node;
@@ -985,16 +1060,16 @@ struct input_handler {
985 void *private; 1060 void *private;
986 1061
987 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1062 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
988 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 1063 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
989 void (*disconnect)(struct input_handle *handle); 1064 void (*disconnect)(struct input_handle *handle);
990 void (*start)(struct input_handle *handle); 1065 void (*start)(struct input_handle *handle);
991 1066
992 const struct file_operations *fops; 1067 const struct file_operations *fops;
993 int minor; 1068 int minor;
994 char *name; 1069 const char *name;
995 1070
996 struct input_device_id *id_table; 1071 const struct input_device_id *id_table;
997 struct input_device_id *blacklist; 1072 const struct input_device_id *blacklist;
998 1073
999 struct list_head h_list; 1074 struct list_head h_list;
1000 struct list_head node; 1075 struct list_head node;
@@ -1005,7 +1080,7 @@ struct input_handle {
1005 void *private; 1080 void *private;
1006 1081
1007 int open; 1082 int open;
1008 char *name; 1083 const char *name;
1009 1084
1010 struct input_dev *dev; 1085 struct input_dev *dev;
1011 struct input_handler *handler; 1086 struct input_handler *handler;
@@ -1019,12 +1094,6 @@ struct input_handle {
1019#define to_handle(n) container_of(n,struct input_handle,d_node) 1094#define to_handle(n) container_of(n,struct input_handle,d_node)
1020#define to_handle_h(n) container_of(n,struct input_handle,h_node) 1095#define to_handle_h(n) container_of(n,struct input_handle,h_node)
1021 1096
1022static inline void init_input_dev(struct input_dev *dev)
1023{
1024 INIT_LIST_HEAD(&dev->h_list);
1025 INIT_LIST_HEAD(&dev->node);
1026}
1027
1028struct input_dev *input_allocate_device(void); 1097struct input_dev *input_allocate_device(void);
1029void input_free_device(struct input_dev *dev); 1098void input_free_device(struct input_dev *dev);
1030 1099
@@ -1041,7 +1110,7 @@ static inline void input_put_device(struct input_dev *dev)
1041int input_register_device(struct input_dev *); 1110int input_register_device(struct input_dev *);
1042void input_unregister_device(struct input_dev *); 1111void input_unregister_device(struct input_dev *);
1043 1112
1044void input_register_handler(struct input_handler *); 1113int input_register_handler(struct input_handler *);
1045void input_unregister_handler(struct input_handler *); 1114void input_unregister_handler(struct input_handler *);
1046 1115
1047int input_grab_device(struct input_handle *); 1116int input_grab_device(struct input_handle *);
@@ -1070,11 +1139,6 @@ static inline void input_report_abs(struct input_dev *dev, unsigned int code, in
1070 input_event(dev, EV_ABS, code, value); 1139 input_event(dev, EV_ABS, code, value);
1071} 1140}
1072 1141
1073static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value)
1074{
1075 input_event(dev, EV_FF, code, value);
1076}
1077
1078static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value) 1142static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
1079{ 1143{
1080 input_event(dev, EV_FF_STATUS, code, value); 1144 input_event(dev, EV_FF_STATUS, code, value);
@@ -1108,5 +1172,61 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1108 1172
1109extern struct class input_class; 1173extern struct class input_class;
1110 1174
1175/**
1176 * struct ff_device - force-feedback part of an input device
1177 * @upload: Called to upload an new effect into device
1178 * @erase: Called to erase an effect from device
1179 * @playback: Called to request device to start playing specified effect
1180 * @set_gain: Called to set specified gain
1181 * @set_autocenter: Called to auto-center device
1182 * @destroy: called by input core when parent input device is being
1183 * destroyed
1184 * @private: driver-specific data, will be freed automatically
1185 * @ffbit: bitmap of force feedback capabilities truly supported by
1186 * device (not emulated like ones in input_dev->ffbit)
1187 * @mutex: mutex for serializing access to the device
1188 * @max_effects: maximum number of effects supported by device
1189 * @effects: pointer to an array of effects currently loaded into device
1190 * @effect_owners: array of effect owners; when file handle owning
1191 * an effect gets closed the effcet is automatically erased
1192 *
1193 * Every force-feedback device must implement upload() and playback()
1194 * methods; erase() is optional. set_gain() and set_autocenter() need
1195 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
1196 * bits.
1197 */
1198struct ff_device {
1199 int (*upload)(struct input_dev *dev, struct ff_effect *effect,
1200 struct ff_effect *old);
1201 int (*erase)(struct input_dev *dev, int effect_id);
1202
1203 int (*playback)(struct input_dev *dev, int effect_id, int value);
1204 void (*set_gain)(struct input_dev *dev, u16 gain);
1205 void (*set_autocenter)(struct input_dev *dev, u16 magnitude);
1206
1207 void (*destroy)(struct ff_device *);
1208
1209 void *private;
1210
1211 unsigned long ffbit[NBITS(FF_MAX)];
1212
1213 struct mutex mutex;
1214
1215 int max_effects;
1216 struct ff_effect *effects;
1217 struct file *effect_owners[];
1218};
1219
1220int input_ff_create(struct input_dev *dev, int max_effects);
1221void input_ff_destroy(struct input_dev *dev);
1222
1223int input_ff_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1224
1225int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, struct file *file);
1226int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1227
1228int input_ff_create_memless(struct input_dev *dev, void *data,
1229 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1230
1111#endif 1231#endif
1112#endif 1232#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index d5afee95fd43..1f97e3d92639 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -123,6 +123,14 @@ static inline void disable_irq_nosync_lockdep(unsigned int irq)
123#endif 123#endif
124} 124}
125 125
126static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
127{
128 disable_irq_nosync(irq);
129#ifdef CONFIG_LOCKDEP
130 local_irq_save(*flags);
131#endif
132}
133
126static inline void disable_irq_lockdep(unsigned int irq) 134static inline void disable_irq_lockdep(unsigned int irq)
127{ 135{
128 disable_irq(irq); 136 disable_irq(irq);
@@ -139,6 +147,14 @@ static inline void enable_irq_lockdep(unsigned int irq)
139 enable_irq(irq); 147 enable_irq(irq);
140} 148}
141 149
150static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
151{
152#ifdef CONFIG_LOCKDEP
153 local_irq_restore(*flags);
154#endif
155 enable_irq(irq);
156}
157
142/* IRQ wakeup (PM) control: */ 158/* IRQ wakeup (PM) control: */
143extern int set_irq_wake(unsigned int irq, unsigned int on); 159extern int set_irq_wake(unsigned int irq, unsigned int on);
144 160
diff --git a/include/linux/io.h b/include/linux/io.h
index 420e2fdf26f6..aa3f5af670b5 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -19,8 +19,12 @@
19#define _LINUX_IO_H 19#define _LINUX_IO_H
20 20
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/page.h>
22 23
23void __iowrite32_copy(void __iomem *to, const void *from, size_t count); 24void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
24void __iowrite64_copy(void __iomem *to, const void *from, size_t count); 25void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
25 26
27int ioremap_page_range(unsigned long addr, unsigned long end,
28 unsigned long phys_addr, pgprot_t prot);
29
26#endif /* _LINUX_IO_H */ 30#endif /* _LINUX_IO_H */
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 2f4600146f83..ecee9bb27d0e 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -80,6 +80,8 @@
80#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 80#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
81#define IPOPT_TS_PRESPEC 3 /* specified modules only */ 81#define IPOPT_TS_PRESPEC 3 /* specified modules only */
82 82
83#define IPV4_BEET_PHMAXLEN 8
84
83struct iphdr { 85struct iphdr {
84#if defined(__LITTLE_ENDIAN_BITFIELD) 86#if defined(__LITTLE_ENDIAN_BITFIELD)
85 __u8 ihl:4, 87 __u8 ihl:4,
@@ -96,7 +98,7 @@ struct iphdr {
96 __be16 frag_off; 98 __be16 frag_off;
97 __u8 ttl; 99 __u8 ttl;
98 __u8 protocol; 100 __u8 protocol;
99 __u16 check; 101 __be16 check;
100 __be32 saddr; 102 __be32 saddr;
101 __be32 daddr; 103 __be32 daddr;
102 /*The options start here. */ 104 /*The options start here. */
@@ -105,22 +107,29 @@ struct iphdr {
105struct ip_auth_hdr { 107struct ip_auth_hdr {
106 __u8 nexthdr; 108 __u8 nexthdr;
107 __u8 hdrlen; /* This one is measured in 32 bit units! */ 109 __u8 hdrlen; /* This one is measured in 32 bit units! */
108 __u16 reserved; 110 __be16 reserved;
109 __u32 spi; 111 __be32 spi;
110 __u32 seq_no; /* Sequence number */ 112 __be32 seq_no; /* Sequence number */
111 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ 113 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
112}; 114};
113 115
114struct ip_esp_hdr { 116struct ip_esp_hdr {
115 __u32 spi; 117 __be32 spi;
116 __u32 seq_no; /* Sequence number */ 118 __be32 seq_no; /* Sequence number */
117 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ 119 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */
118}; 120};
119 121
120struct ip_comp_hdr { 122struct ip_comp_hdr {
121 __u8 nexthdr; 123 __u8 nexthdr;
122 __u8 flags; 124 __u8 flags;
123 __u16 cpi; 125 __be16 cpi;
126};
127
128struct ip_beet_phdr {
129 __u8 nexthdr;
130 __u8 hdrlen;
131 __u8 padlen;
132 __u8 reserved;
124}; 133};
125 134
126#endif /* _LINUX_IP_H */ 135#endif /* _LINUX_IP_H */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index b291189737e7..636094c29b16 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -51,6 +51,8 @@ struct ipc_perm
51 51
52#ifdef __KERNEL__ 52#ifdef __KERNEL__
53 53
54#include <linux/kref.h>
55
54#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 56#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
55 57
56/* used by in-kernel data structures */ 58/* used by in-kernel data structures */
@@ -68,6 +70,59 @@ struct kern_ipc_perm
68 void *security; 70 void *security;
69}; 71};
70 72
73struct ipc_ids;
74struct ipc_namespace {
75 struct kref kref;
76 struct ipc_ids *ids[3];
77
78 int sem_ctls[4];
79 int used_sems;
80
81 int msg_ctlmax;
82 int msg_ctlmnb;
83 int msg_ctlmni;
84
85 size_t shm_ctlmax;
86 size_t shm_ctlall;
87 int shm_ctlmni;
88 int shm_tot;
89};
90
91extern struct ipc_namespace init_ipc_ns;
92
93#ifdef CONFIG_SYSVIPC
94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
95#else
96#define INIT_IPC_NS(ns)
97#endif
98
99#ifdef CONFIG_IPC_NS
100extern void free_ipc_ns(struct kref *kref);
101extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
102extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
103#else
104static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
105{
106 return 0;
107}
108#endif
109
110static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
111{
112#ifdef CONFIG_IPC_NS
113 if (ns)
114 kref_get(&ns->kref);
115#endif
116 return ns;
117}
118
119static inline void put_ipc_ns(struct ipc_namespace *ns)
120{
121#ifdef CONFIG_IPC_NS
122 kref_put(&ns->kref, free_ipc_ns);
123#endif
124}
125
71#endif /* __KERNEL__ */ 126#endif /* __KERNEL__ */
72 127
73#endif /* _LINUX_IPC_H */ 128#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index d09fbeabf1dc..796ca009fd46 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -148,6 +148,13 @@ struct ipmi_lan_addr
148#define IPMI_BMC_CHANNEL 0xf 148#define IPMI_BMC_CHANNEL 0xf
149#define IPMI_NUM_CHANNELS 0x10 149#define IPMI_NUM_CHANNELS 0x10
150 150
151/*
152 * Used to signify an "all channel" bitmask. This is more than the
153 * actual number of channels because this is used in userland and
154 * will cover us if the number of channels is extended.
155 */
156#define IPMI_CHAN_ALL (~0)
157
151 158
152/* 159/*
153 * A raw IPMI message without any addressing. This covers both 160 * A raw IPMI message without any addressing. This covers both
@@ -350,18 +357,21 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
350 357
351/* 358/*
352 * When commands come in to the SMS, the user can register to receive 359 * When commands come in to the SMS, the user can register to receive
353 * them. Only one user can be listening on a specific netfn/cmd pair 360 * them. Only one user can be listening on a specific netfn/cmd/chan tuple
354 * at a time, you will get an EBUSY error if the command is already 361 * at a time, you will get an EBUSY error if the command is already
355 * registered. If a command is received that does not have a user 362 * registered. If a command is received that does not have a user
356 * registered, the driver will automatically return the proper 363 * registered, the driver will automatically return the proper
357 * error. 364 * error. Channels are specified as a bitfield, use IPMI_CHAN_ALL to
365 * mean all channels.
358 */ 366 */
359int ipmi_register_for_cmd(ipmi_user_t user, 367int ipmi_register_for_cmd(ipmi_user_t user,
360 unsigned char netfn, 368 unsigned char netfn,
361 unsigned char cmd); 369 unsigned char cmd,
370 unsigned int chans);
362int ipmi_unregister_for_cmd(ipmi_user_t user, 371int ipmi_unregister_for_cmd(ipmi_user_t user,
363 unsigned char netfn, 372 unsigned char netfn,
364 unsigned char cmd); 373 unsigned char cmd,
374 unsigned int chans);
365 375
366/* 376/*
367 * Allow run-to-completion mode to be set for the interface of 377 * Allow run-to-completion mode to be set for the interface of
@@ -571,6 +581,36 @@ struct ipmi_cmdspec
571#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \ 581#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \
572 struct ipmi_cmdspec) 582 struct ipmi_cmdspec)
573 583
584/*
585 * Register to get commands from other entities on specific channels.
586 * This way, you can only listen on specific channels, or have messages
587 * from some channels go to one place and other channels to someplace
588 * else. The chans field is a bitmask, (1 << channel) for each channel.
589 * It may be IPMI_CHAN_ALL for all channels.
590 */
591struct ipmi_cmdspec_chans
592{
593 unsigned int netfn;
594 unsigned int cmd;
595 unsigned int chans;
596};
597
598/*
599 * Register to receive a specific command on specific channels. error values:
600 * - EFAULT - an address supplied was invalid.
601 * - EBUSY - One of the netfn/cmd/chans supplied was already in use.
602 * - ENOMEM - could not allocate memory for the entry.
603 */
604#define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \
605 struct ipmi_cmdspec_chans)
606/*
607 * Unregister some netfn/cmd/chans. error values:
608 * - EFAULT - an address supplied was invalid.
609 * - ENOENT - None of the netfn/cmd/chans were found registered for this user.
610 */
611#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \
612 struct ipmi_cmdspec_chans)
613
574/* 614/*
575 * Set whether this interface receives events. Note that the first 615 * Set whether this interface receives events. Note that the first
576 * user registered for events will get all pending events for the 616 * user registered for events will get all pending events for the
diff --git a/include/linux/ipsec.h b/include/linux/ipsec.h
index d3c527616b5e..d17a6302a0e9 100644
--- a/include/linux/ipsec.h
+++ b/include/linux/ipsec.h
@@ -12,7 +12,8 @@
12enum { 12enum {
13 IPSEC_MODE_ANY = 0, /* We do not support this for SA */ 13 IPSEC_MODE_ANY = 0, /* We do not support this for SA */
14 IPSEC_MODE_TRANSPORT = 1, 14 IPSEC_MODE_TRANSPORT = 1,
15 IPSEC_MODE_TUNNEL = 2 15 IPSEC_MODE_TUNNEL = 2,
16 IPSEC_MODE_BEET = 3
16}; 17};
17 18
18enum { 19enum {
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index caca57df0d7d..4f435c59de06 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -99,22 +99,22 @@ struct ipv6_destopt_hao {
99struct ipv6_auth_hdr { 99struct ipv6_auth_hdr {
100 __u8 nexthdr; 100 __u8 nexthdr;
101 __u8 hdrlen; /* This one is measured in 32 bit units! */ 101 __u8 hdrlen; /* This one is measured in 32 bit units! */
102 __u16 reserved; 102 __be16 reserved;
103 __u32 spi; 103 __be32 spi;
104 __u32 seq_no; /* Sequence number */ 104 __be32 seq_no; /* Sequence number */
105 __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */ 105 __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */
106}; 106};
107 107
108struct ipv6_esp_hdr { 108struct ipv6_esp_hdr {
109 __u32 spi; 109 __be32 spi;
110 __u32 seq_no; /* Sequence number */ 110 __be32 seq_no; /* Sequence number */
111 __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ 111 __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */
112}; 112};
113 113
114struct ipv6_comp_hdr { 114struct ipv6_comp_hdr {
115 __u8 nexthdr; 115 __u8 nexthdr;
116 __u8 flags; 116 __u8 flags;
117 __u16 cpi; 117 __be16 cpi;
118}; 118};
119 119
120/* 120/*
@@ -136,7 +136,7 @@ struct ipv6hdr {
136#endif 136#endif
137 __u8 flow_lbl[3]; 137 __u8 flow_lbl[3];
138 138
139 __u16 payload_len; 139 __be16 payload_len;
140 __u8 nexthdr; 140 __u8 nexthdr;
141 __u8 hop_limit; 141 __u8 hop_limit;
142 142
@@ -461,7 +461,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
461 461
462#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 462#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\
463 (((__sk)->sk_hash == (__hash)) && \ 463 (((__sk)->sk_hash == (__hash)) && \
464 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 464 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
465 ((__sk)->sk_family == AF_INET6) && \ 465 ((__sk)->sk_family == AF_INET6) && \
466 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 466 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
467 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 467 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 48d3cb3b6a47..6f463606c318 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -59,6 +59,7 @@
59#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */ 59#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */
60#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */ 60#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */
61#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */ 61#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */
62#define IRQ_MOVE_PENDING 0x40000000 /* need to re-target IRQ destination */
62 63
63struct proc_dir_entry; 64struct proc_dir_entry;
64 65
@@ -132,7 +133,6 @@ struct irq_chip {
132 * @affinity: IRQ affinity on SMP 133 * @affinity: IRQ affinity on SMP
133 * @cpu: cpu index useful for balancing 134 * @cpu: cpu index useful for balancing
134 * @pending_mask: pending rebalanced interrupts 135 * @pending_mask: pending rebalanced interrupts
135 * @move_irq: need to re-target IRQ destination
136 * @dir: /proc/irq/ procfs entry 136 * @dir: /proc/irq/ procfs entry
137 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP 137 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
138 * 138 *
@@ -159,7 +159,6 @@ struct irq_desc {
159#endif 159#endif
160#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) 160#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
161 cpumask_t pending_mask; 161 cpumask_t pending_mask;
162 unsigned int move_irq; /* need to re-target IRQ dest */
163#endif 162#endif
164#ifdef CONFIG_PROC_FS 163#ifdef CONFIG_PROC_FS
165 struct proc_dir_entry *dir; 164 struct proc_dir_entry *dir;
@@ -206,36 +205,7 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
206 205
207void set_pending_irq(unsigned int irq, cpumask_t mask); 206void set_pending_irq(unsigned int irq, cpumask_t mask);
208void move_native_irq(int irq); 207void move_native_irq(int irq);
209 208void move_masked_irq(int irq);
210#ifdef CONFIG_PCI_MSI
211/*
212 * Wonder why these are dummies?
213 * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
214 * counter part after translating the vector to irq info. We need to perform
215 * this operation on the real irq, when we dont use vector, i.e when
216 * pci_use_vector() is false.
217 */
218static inline void move_irq(int irq)
219{
220}
221
222static inline void set_irq_info(int irq, cpumask_t mask)
223{
224}
225
226#else /* CONFIG_PCI_MSI */
227
228static inline void move_irq(int irq)
229{
230 move_native_irq(irq);
231}
232
233static inline void set_irq_info(int irq, cpumask_t mask)
234{
235 set_native_irq_info(irq, mask);
236}
237
238#endif /* CONFIG_PCI_MSI */
239 209
240#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ 210#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
241 211
@@ -247,21 +217,20 @@ static inline void move_native_irq(int irq)
247{ 217{
248} 218}
249 219
250static inline void set_pending_irq(unsigned int irq, cpumask_t mask) 220static inline void move_masked_irq(int irq)
251{ 221{
252} 222}
253 223
254static inline void set_irq_info(int irq, cpumask_t mask) 224static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
255{ 225{
256 set_native_irq_info(irq, mask);
257} 226}
258 227
259#endif /* CONFIG_GENERIC_PENDING_IRQ */ 228#endif /* CONFIG_GENERIC_PENDING_IRQ */
260 229
261#else /* CONFIG_SMP */ 230#else /* CONFIG_SMP */
262 231
263#define move_irq(x)
264#define move_native_irq(x) 232#define move_native_irq(x)
233#define move_masked_irq(x)
265 234
266#endif /* CONFIG_SMP */ 235#endif /* CONFIG_SMP */
267 236
@@ -399,8 +368,22 @@ set_irq_chained_handler(unsigned int irq,
399 __set_irq_handler(irq, handle, 1); 368 __set_irq_handler(irq, handle, 1);
400} 369}
401 370
402/* Set/get chip/data for an IRQ: */ 371/* Handle dynamic irq creation and destruction */
372extern int create_irq(void);
373extern void destroy_irq(unsigned int irq);
403 374
375/* Test to see if a driver has successfully requested an irq */
376static inline int irq_has_action(unsigned int irq)
377{
378 struct irq_desc *desc = irq_desc + irq;
379 return desc->action != NULL;
380}
381
382/* Dynamic irq helper functions */
383extern void dynamic_irq_init(unsigned int irq);
384extern void dynamic_irq_cleanup(unsigned int irq);
385
386/* Set/get chip/data for an IRQ: */
404extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); 387extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
405extern int set_irq_data(unsigned int irq, void *data); 388extern int set_irq_data(unsigned int irq, void *data);
406extern int set_irq_chip_data(unsigned int irq, void *data); 389extern int set_irq_chip_data(unsigned int irq, void *data);
diff --git a/include/linux/ite_gpio.h b/include/linux/ite_gpio.h
deleted file mode 100644
index b123a14292d3..000000000000
--- a/include/linux/ite_gpio.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * FILE NAME ite_gpio.h
3 *
4 * BRIEF MODULE DESCRIPTION
5 * Generic gpio.
6 *
7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Hai-Pao Fan <haipao@mvista.com>
9 *
10 * Copyright 2001 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#ifndef __ITE_GPIO_H
34#define __ITE_GPIO_H
35
36#include <linux/ioctl.h>
37
38struct ite_gpio_ioctl_data {
39 __u32 device;
40 __u32 mask;
41 __u32 data;
42};
43
44#define ITE_GPIO_IOCTL_BASE 'Z'
45
46#define ITE_GPIO_IN _IOWR(ITE_GPIO_IOCTL_BASE, 0, struct ite_gpio_ioctl_data)
47#define ITE_GPIO_OUT _IOW (ITE_GPIO_IOCTL_BASE, 1, struct ite_gpio_ioctl_data)
48#define ITE_GPIO_INT_CTRL _IOW (ITE_GPIO_IOCTL_BASE, 2, struct ite_gpio_ioctl_data)
49#define ITE_GPIO_IN_STATUS _IOW (ITE_GPIO_IOCTL_BASE, 3, struct ite_gpio_ioctl_data)
50#define ITE_GPIO_OUT_STATUS _IOW (ITE_GPIO_IOCTL_BASE, 4, struct ite_gpio_ioctl_data)
51#define ITE_GPIO_GEN_CTRL _IOW (ITE_GPIO_IOCTL_BASE, 5, struct ite_gpio_ioctl_data)
52#define ITE_GPIO_INT_WAIT _IOW (ITE_GPIO_IOCTL_BASE, 6, struct ite_gpio_ioctl_data)
53
54#define ITE_GPIO_PORTA 0x01
55#define ITE_GPIO_PORTB 0x02
56#define ITE_GPIO_PORTC 0x04
57
58extern int ite_gpio_in(__u32 device, __u32 mask, volatile __u32 *data);
59extern int ite_gpio_out(__u32 device, __u32 mask, __u32 data);
60extern int ite_gpio_int_ctrl(__u32 device, __u32 mask, __u32 data);
61extern int ite_gpio_in_status(__u32 device, __u32 mask, volatile __u32 *data);
62extern int ite_gpio_out_status(__u32 device, __u32 mask, __u32 data);
63extern int ite_gpio_gen_ctrl(__u32 device, __u32 mask, __u32 data);
64extern int ite_gpio_int_wait(__u32 device, __u32 mask, __u32 data);
65
66#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index a04c154c5207..fe89444b1c6f 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * linux/include/linux/jbd.h 2 * linux/include/linux/jbd.h
3 * 3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com> 4 * Written by Stephen C. Tweedie <sct@redhat.com>
5 * 5 *
6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved 6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
@@ -64,7 +64,7 @@ extern int journal_enable_debug;
64 if ((n) <= journal_enable_debug) { \ 64 if ((n) <= journal_enable_debug) { \
65 printk (KERN_DEBUG "(%s, %d): %s: ", \ 65 printk (KERN_DEBUG "(%s, %d): %s: ", \
66 __FILE__, __LINE__, __FUNCTION__); \ 66 __FILE__, __LINE__, __FUNCTION__); \
67 printk (f, ## a); \ 67 printk (f, ## a); \
68 } \ 68 } \
69 } while (0) 69 } while (0)
70#else 70#else
@@ -97,8 +97,8 @@ extern void jbd_slab_free(void *ptr, size_t size);
97 * number of outstanding buffers possible at any time. When the 97 * number of outstanding buffers possible at any time. When the
98 * operation completes, any buffer credits not used are credited back to 98 * operation completes, any buffer credits not used are credited back to
99 * the transaction, so that at all times we know how many buffers the 99 * the transaction, so that at all times we know how many buffers the
100 * outstanding updates on a transaction might possibly touch. 100 * outstanding updates on a transaction might possibly touch.
101 * 101 *
102 * This is an opaque datatype. 102 * This is an opaque datatype.
103 **/ 103 **/
104typedef struct handle_s handle_t; /* Atomic operation type */ 104typedef struct handle_s handle_t; /* Atomic operation type */
@@ -108,7 +108,7 @@ typedef struct handle_s handle_t; /* Atomic operation type */
108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem. 108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
109 * 109 *
110 * journal_t is linked to from the fs superblock structure. 110 * journal_t is linked to from the fs superblock structure.
111 * 111 *
112 * We use the journal_t to keep track of all outstanding transaction 112 * We use the journal_t to keep track of all outstanding transaction
113 * activity on the filesystem, and to manage the state of the log 113 * activity on the filesystem, and to manage the state of the log
114 * writing process. 114 * writing process.
@@ -128,7 +128,7 @@ typedef struct journal_s journal_t; /* Journal control structure */
128 * On-disk structures 128 * On-disk structures
129 */ 129 */
130 130
131/* 131/*
132 * Descriptor block types: 132 * Descriptor block types:
133 */ 133 */
134 134
@@ -149,8 +149,8 @@ typedef struct journal_header_s
149} journal_header_t; 149} journal_header_t;
150 150
151 151
152/* 152/*
153 * The block tag: used to describe a single buffer in the journal 153 * The block tag: used to describe a single buffer in the journal
154 */ 154 */
155typedef struct journal_block_tag_s 155typedef struct journal_block_tag_s
156{ 156{
@@ -158,9 +158,9 @@ typedef struct journal_block_tag_s
158 __be32 t_flags; /* See below */ 158 __be32 t_flags; /* See below */
159} journal_block_tag_t; 159} journal_block_tag_t;
160 160
161/* 161/*
162 * The revoke descriptor: used on disk to describe a series of blocks to 162 * The revoke descriptor: used on disk to describe a series of blocks to
163 * be revoked from the log 163 * be revoked from the log
164 */ 164 */
165typedef struct journal_revoke_header_s 165typedef struct journal_revoke_header_s
166{ 166{
@@ -201,9 +201,9 @@ typedef struct journal_superblock_s
201 201
202/* 0x0024 */ 202/* 0x0024 */
203 /* Remaining fields are only valid in a version-2 superblock */ 203 /* Remaining fields are only valid in a version-2 superblock */
204 __be32 s_feature_compat; /* compatible feature set */ 204 __be32 s_feature_compat; /* compatible feature set */
205 __be32 s_feature_incompat; /* incompatible feature set */ 205 __be32 s_feature_incompat; /* incompatible feature set */
206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */ 206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */
207/* 0x0030 */ 207/* 0x0030 */
208 __u8 s_uuid[16]; /* 128-bit uuid for journal */ 208 __u8 s_uuid[16]; /* 128-bit uuid for journal */
209 209
@@ -374,10 +374,10 @@ struct jbd_revoke_table_s;
374 **/ 374 **/
375 375
376/* Docbook can't yet cope with the bit fields, but will leave the documentation 376/* Docbook can't yet cope with the bit fields, but will leave the documentation
377 * in so it can be fixed later. 377 * in so it can be fixed later.
378 */ 378 */
379 379
380struct handle_s 380struct handle_s
381{ 381{
382 /* Which compound transaction is this update a part of? */ 382 /* Which compound transaction is this update a part of? */
383 transaction_t *h_transaction; 383 transaction_t *h_transaction;
@@ -435,7 +435,7 @@ struct handle_s
435 * 435 *
436 */ 436 */
437 437
438struct transaction_s 438struct transaction_s
439{ 439{
440 /* Pointer to the journal for this transaction. [no locking] */ 440 /* Pointer to the journal for this transaction. [no locking] */
441 journal_t *t_journal; 441 journal_t *t_journal;
@@ -455,7 +455,7 @@ struct transaction_s
455 T_RUNDOWN, 455 T_RUNDOWN,
456 T_FLUSH, 456 T_FLUSH,
457 T_COMMIT, 457 T_COMMIT,
458 T_FINISHED 458 T_FINISHED
459 } t_state; 459 } t_state;
460 460
461 /* 461 /*
@@ -569,7 +569,7 @@ struct transaction_s
569 * journal_t. 569 * journal_t.
570 * @j_flags: General journaling state flags 570 * @j_flags: General journaling state flags
571 * @j_errno: Is there an outstanding uncleared error on the journal (from a 571 * @j_errno: Is there an outstanding uncleared error on the journal (from a
572 * prior abort)? 572 * prior abort)?
573 * @j_sb_buffer: First part of superblock buffer 573 * @j_sb_buffer: First part of superblock buffer
574 * @j_superblock: Second part of superblock buffer 574 * @j_superblock: Second part of superblock buffer
575 * @j_format_version: Version of the superblock format 575 * @j_format_version: Version of the superblock format
@@ -583,7 +583,7 @@ struct transaction_s
583 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 583 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
584 * to start committing, or for a barrier lock to be released 584 * to start committing, or for a barrier lock to be released
585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete 585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
586 * @j_wait_done_commit: Wait queue for waiting for commit to complete 586 * @j_wait_done_commit: Wait queue for waiting for commit to complete
587 * @j_wait_checkpoint: Wait queue to trigger checkpointing 587 * @j_wait_checkpoint: Wait queue to trigger checkpointing
588 * @j_wait_commit: Wait queue to trigger commit 588 * @j_wait_commit: Wait queue to trigger commit
589 * @j_wait_updates: Wait queue to wait for updates to complete 589 * @j_wait_updates: Wait queue to wait for updates to complete
@@ -592,7 +592,7 @@ struct transaction_s
592 * @j_tail: Journal tail - identifies the oldest still-used block in the 592 * @j_tail: Journal tail - identifies the oldest still-used block in the
593 * journal. 593 * journal.
594 * @j_free: Journal free - how many free blocks are there in the journal? 594 * @j_free: Journal free - how many free blocks are there in the journal?
595 * @j_first: The block number of the first usable block 595 * @j_first: The block number of the first usable block
596 * @j_last: The block number one beyond the last usable block 596 * @j_last: The block number one beyond the last usable block
597 * @j_dev: Device where we store the journal 597 * @j_dev: Device where we store the journal
598 * @j_blocksize: blocksize for the location where we store the journal. 598 * @j_blocksize: blocksize for the location where we store the journal.
@@ -604,12 +604,12 @@ struct transaction_s
604 * @j_list_lock: Protects the buffer lists and internal buffer state. 604 * @j_list_lock: Protects the buffer lists and internal buffer state.
605 * @j_inode: Optional inode where we store the journal. If present, all journal 605 * @j_inode: Optional inode where we store the journal. If present, all journal
606 * block numbers are mapped into this inode via bmap(). 606 * block numbers are mapped into this inode via bmap().
607 * @j_tail_sequence: Sequence number of the oldest transaction in the log 607 * @j_tail_sequence: Sequence number of the oldest transaction in the log
608 * @j_transaction_sequence: Sequence number of the next transaction to grant 608 * @j_transaction_sequence: Sequence number of the next transaction to grant
609 * @j_commit_sequence: Sequence number of the most recently committed 609 * @j_commit_sequence: Sequence number of the most recently committed
610 * transaction 610 * transaction
611 * @j_commit_request: Sequence number of the most recent transaction wanting 611 * @j_commit_request: Sequence number of the most recent transaction wanting
612 * commit 612 * commit
613 * @j_uuid: Uuid of client object. 613 * @j_uuid: Uuid of client object.
614 * @j_task: Pointer to the current commit thread for this journal 614 * @j_task: Pointer to the current commit thread for this journal
615 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a 615 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
@@ -699,7 +699,7 @@ struct journal_s
699 wait_queue_head_t j_wait_updates; 699 wait_queue_head_t j_wait_updates;
700 700
701 /* Semaphore for locking against concurrent checkpoints */ 701 /* Semaphore for locking against concurrent checkpoints */
702 struct mutex j_checkpoint_mutex; 702 struct mutex j_checkpoint_mutex;
703 703
704 /* 704 /*
705 * Journal head: identifies the first unused block in the journal. 705 * Journal head: identifies the first unused block in the journal.
@@ -732,7 +732,7 @@ struct journal_s
732 */ 732 */
733 struct block_device *j_dev; 733 struct block_device *j_dev;
734 int j_blocksize; 734 int j_blocksize;
735 unsigned int j_blk_offset; 735 unsigned long j_blk_offset;
736 736
737 /* 737 /*
738 * Device which holds the client fs. For internal journal this will be 738 * Device which holds the client fs. For internal journal this will be
@@ -823,8 +823,8 @@ struct journal_s
823 void *j_private; 823 void *j_private;
824}; 824};
825 825
826/* 826/*
827 * Journal flag definitions 827 * Journal flag definitions
828 */ 828 */
829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ 829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ 830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
@@ -833,7 +833,7 @@ struct journal_s
833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
834#define JFS_BARRIER 0x020 /* Use IDE barriers */ 834#define JFS_BARRIER 0x020 /* Use IDE barriers */
835 835
836/* 836/*
837 * Function declarations for the journaling transaction and buffer 837 * Function declarations for the journaling transaction and buffer
838 * management 838 * management
839 */ 839 */
@@ -862,11 +862,11 @@ int __journal_remove_checkpoint(struct journal_head *);
862void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 862void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
863 863
864/* Buffer IO */ 864/* Buffer IO */
865extern int 865extern int
866journal_write_metadata_buffer(transaction_t *transaction, 866journal_write_metadata_buffer(transaction_t *transaction,
867 struct journal_head *jh_in, 867 struct journal_head *jh_in,
868 struct journal_head **jh_out, 868 struct journal_head **jh_out,
869 int blocknr); 869 unsigned long blocknr);
870 870
871/* Transaction locking */ 871/* Transaction locking */
872extern void __wait_on_journal (journal_t *); 872extern void __wait_on_journal (journal_t *);
@@ -890,7 +890,7 @@ static inline handle_t *journal_current_handle(void)
890/* The journaling code user interface: 890/* The journaling code user interface:
891 * 891 *
892 * Create and destroy handles 892 * Create and destroy handles
893 * Register buffer modifications against the current transaction. 893 * Register buffer modifications against the current transaction.
894 */ 894 */
895 895
896extern handle_t *journal_start(journal_t *, int nblocks); 896extern handle_t *journal_start(journal_t *, int nblocks);
@@ -917,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev,
917 int start, int len, int bsize); 917 int start, int len, int bsize);
918extern journal_t * journal_init_inode (struct inode *); 918extern journal_t * journal_init_inode (struct inode *);
919extern int journal_update_format (journal_t *); 919extern int journal_update_format (journal_t *);
920extern int journal_check_used_features 920extern int journal_check_used_features
921 (journal_t *, unsigned long, unsigned long, unsigned long); 921 (journal_t *, unsigned long, unsigned long, unsigned long);
922extern int journal_check_available_features 922extern int journal_check_available_features
923 (journal_t *, unsigned long, unsigned long, unsigned long); 923 (journal_t *, unsigned long, unsigned long, unsigned long);
924extern int journal_set_features 924extern int journal_set_features
925 (journal_t *, unsigned long, unsigned long, unsigned long); 925 (journal_t *, unsigned long, unsigned long, unsigned long);
926extern int journal_create (journal_t *); 926extern int journal_create (journal_t *);
927extern int journal_load (journal_t *journal); 927extern int journal_load (journal_t *journal);
@@ -977,7 +977,6 @@ extern void journal_write_revoke_records(journal_t *, transaction_t *);
977extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 977extern int journal_set_revoke(journal_t *, unsigned long, tid_t);
978extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 978extern int journal_test_revoke(journal_t *, unsigned long, tid_t);
979extern void journal_clear_revoke(journal_t *); 979extern void journal_clear_revoke(journal_t *);
980extern void journal_brelse_array(struct buffer_head *b[], int n);
981extern void journal_switch_revoke_table(journal_t *journal); 980extern void journal_switch_revoke_table(journal_t *journal);
982 981
983/* 982/*
@@ -1015,7 +1014,7 @@ do { \
1015 * bit, when set, indicates that we have had a fatal error somewhere, 1014 * bit, when set, indicates that we have had a fatal error somewhere,
1016 * either inside the journaling layer or indicated to us by the client 1015 * either inside the journaling layer or indicated to us by the client
1017 * (eg. ext3), and that we and should not commit any further 1016 * (eg. ext3), and that we and should not commit any further
1018 * transactions. 1017 * transactions.
1019 */ 1018 */
1020 1019
1021static inline int is_journal_aborted(journal_t *journal) 1020static inline int is_journal_aborted(journal_t *journal)
@@ -1082,7 +1081,7 @@ static inline int jbd_space_needed(journal_t *journal)
1082#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1081#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
1083#define BJ_Locked 8 /* Locked for I/O during commit */ 1082#define BJ_Locked 8 /* Locked for I/O during commit */
1084#define BJ_Types 9 1083#define BJ_Types 9
1085 1084
1086extern int jbd_blocks_per_page(struct inode *inode); 1085extern int jbd_blocks_per_page(struct inode *inode);
1087 1086
1088#ifdef __KERNEL__ 1087#ifdef __KERNEL__
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 329ebcffa106..c8d5f207c3d4 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -115,6 +115,21 @@ static inline u64 get_jiffies_64(void)
115 ((long)(a) - (long)(b) >= 0)) 115 ((long)(a) - (long)(b) >= 0))
116#define time_before_eq(a,b) time_after_eq(b,a) 116#define time_before_eq(a,b) time_after_eq(b,a)
117 117
118/* Same as above, but does so with platform independent 64bit types.
119 * These must be used when utilizing jiffies_64 (i.e. return value of
120 * get_jiffies_64() */
121#define time_after64(a,b) \
122 (typecheck(__u64, a) && \
123 typecheck(__u64, b) && \
124 ((__s64)(b) - (__s64)(a) < 0))
125#define time_before64(a,b) time_after64(b,a)
126
127#define time_after_eq64(a,b) \
128 (typecheck(__u64, a) && \
129 typecheck(__u64, b) && \
130 ((__s64)(a) - (__s64)(b) >= 0))
131#define time_before_eq64(a,b) time_after_eq64(b,a)
132
118/* 133/*
119 * Have the 32 bit jiffies value wrap 5 minutes after boot 134 * Have the 32 bit jiffies value wrap 5 minutes after boot
120 * so jiffies wrap bugs show up earlier. 135 * so jiffies wrap bugs show up earlier.
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 849043ce4ed6..1cebcbc28b47 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -12,6 +12,10 @@
12/* Lookup the address for a symbol. Returns 0 if not found. */ 12/* Lookup the address for a symbol. Returns 0 if not found. */
13unsigned long kallsyms_lookup_name(const char *name); 13unsigned long kallsyms_lookup_name(const char *name);
14 14
15extern int kallsyms_lookup_size_offset(unsigned long addr,
16 unsigned long *symbolsize,
17 unsigned long *offset);
18
15/* Lookup an address. modname is set to NULL if it's in the kernel. */ 19/* Lookup an address. modname is set to NULL if it's in the kernel. */
16const char *kallsyms_lookup(unsigned long addr, 20const char *kallsyms_lookup(unsigned long addr,
17 unsigned long *symbolsize, 21 unsigned long *symbolsize,
@@ -28,6 +32,13 @@ static inline unsigned long kallsyms_lookup_name(const char *name)
28 return 0; 32 return 0;
29} 33}
30 34
35static inline int kallsyms_lookup_size_offset(unsigned long addr,
36 unsigned long *symbolsize,
37 unsigned long *offset)
38{
39 return 0;
40}
41
31static inline const char *kallsyms_lookup(unsigned long addr, 42static inline const char *kallsyms_lookup(unsigned long addr,
32 unsigned long *symbolsize, 43 unsigned long *symbolsize,
33 unsigned long *offset, 44 unsigned long *offset,
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e44a37e2c71c..80f39cab470a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -187,6 +187,7 @@ extern void bust_spinlocks(int yes);
187extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 187extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
188extern int panic_timeout; 188extern int panic_timeout;
189extern int panic_on_oops; 189extern int panic_on_oops;
190extern int panic_on_unrecovered_nmi;
190extern int tainted; 191extern int tainted;
191extern const char *print_tainted(void); 192extern const char *print_tainted(void);
192extern void add_taint(unsigned); 193extern void add_taint(unsigned);
@@ -215,8 +216,10 @@ extern void dump_stack(void);
215#define pr_debug(fmt,arg...) \ 216#define pr_debug(fmt,arg...) \
216 printk(KERN_DEBUG fmt,##arg) 217 printk(KERN_DEBUG fmt,##arg)
217#else 218#else
218#define pr_debug(fmt,arg...) \ 219static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
219 do { } while (0) 220{
221 return 0;
222}
220#endif 223#endif
221 224
222#define pr_info(fmt,arg...) \ 225#define pr_info(fmt,arg...) \
@@ -349,4 +352,11 @@ struct sysinfo {
349/* Trap pasters of __FUNCTION__ at compile-time */ 352/* Trap pasters of __FUNCTION__ at compile-time */
350#define __FUNCTION__ (__func__) 353#define __FUNCTION__ (__func__)
351 354
355/* This helps us to avoid #ifdef CONFIG_NUMA */
356#ifdef CONFIG_NUMA
357#define NUMA_BUILD 1
358#else
359#define NUMA_BUILD 0
360#endif
361
352#endif 362#endif
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 0db22a1ab474..10f505c8431d 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -47,4 +47,8 @@ call_usermodehelper(char *path, char **argv, char **envp, int wait)
47 47
48extern void usermodehelper_init(void); 48extern void usermodehelper_init(void);
49 49
50struct file;
51extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[],
52 struct file **filp);
53
50#endif /* __LINUX_KMOD_H__ */ 54#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 2d229327959e..bcd9cd173c2c 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -20,6 +20,7 @@
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/sysfs.h> 22#include <linux/sysfs.h>
23#include <linux/compiler.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
24#include <linux/rwsem.h> 25#include <linux/rwsem.h>
25#include <linux/kref.h> 26#include <linux/kref.h>
@@ -71,12 +72,12 @@ static inline const char * kobject_name(const struct kobject * kobj)
71extern void kobject_init(struct kobject *); 72extern void kobject_init(struct kobject *);
72extern void kobject_cleanup(struct kobject *); 73extern void kobject_cleanup(struct kobject *);
73 74
74extern int kobject_add(struct kobject *); 75extern int __must_check kobject_add(struct kobject *);
75extern void kobject_del(struct kobject *); 76extern void kobject_del(struct kobject *);
76 77
77extern int kobject_rename(struct kobject *, const char *new_name); 78extern int __must_check kobject_rename(struct kobject *, const char *new_name);
78 79
79extern int kobject_register(struct kobject *); 80extern int __must_check kobject_register(struct kobject *);
80extern void kobject_unregister(struct kobject *); 81extern void kobject_unregister(struct kobject *);
81 82
82extern struct kobject * kobject_get(struct kobject *); 83extern struct kobject * kobject_get(struct kobject *);
@@ -128,8 +129,8 @@ struct kset {
128 129
129 130
130extern void kset_init(struct kset * k); 131extern void kset_init(struct kset * k);
131extern int kset_add(struct kset * k); 132extern int __must_check kset_add(struct kset * k);
132extern int kset_register(struct kset * k); 133extern int __must_check kset_register(struct kset * k);
133extern void kset_unregister(struct kset * k); 134extern void kset_unregister(struct kset * k);
134 135
135static inline struct kset * to_kset(struct kobject * kobj) 136static inline struct kset * to_kset(struct kobject * kobj)
@@ -239,7 +240,7 @@ extern struct subsystem hypervisor_subsys;
239 (obj)->subsys.kset.kobj.kset = &(_subsys).kset 240 (obj)->subsys.kset.kobj.kset = &(_subsys).kset
240 241
241extern void subsystem_init(struct subsystem *); 242extern void subsystem_init(struct subsystem *);
242extern int subsystem_register(struct subsystem *); 243extern int __must_check subsystem_register(struct subsystem *);
243extern void subsystem_unregister(struct subsystem *); 244extern void subsystem_unregister(struct subsystem *);
244 245
245static inline struct subsystem * subsys_get(struct subsystem * s) 246static inline struct subsystem * subsys_get(struct subsystem * s)
@@ -258,7 +259,8 @@ struct subsys_attribute {
258 ssize_t (*store)(struct subsystem *, const char *, size_t); 259 ssize_t (*store)(struct subsystem *, const char *, size_t);
259}; 260};
260 261
261extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 262extern int __must_check subsys_create_file(struct subsystem * ,
263 struct subsys_attribute *);
262 264
263#if defined(CONFIG_HOTPLUG) 265#if defined(CONFIG_HOTPLUG)
264void kobject_uevent(struct kobject *kobj, enum kobject_action action); 266void kobject_uevent(struct kobject *kobj, enum kobject_action action);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 8bf6702da2a0..ac4c0559f751 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -77,6 +77,12 @@ struct kprobe {
77 /* location of the probe point */ 77 /* location of the probe point */
78 kprobe_opcode_t *addr; 78 kprobe_opcode_t *addr;
79 79
80 /* Allow user to indicate symbol name of the probe point */
81 char *symbol_name;
82
83 /* Offset into the symbol */
84 unsigned int offset;
85
80 /* Called before addr is executed. */ 86 /* Called before addr is executed. */
81 kprobe_pre_handler_t pre_handler; 87 kprobe_pre_handler_t pre_handler;
82 88
@@ -196,7 +202,7 @@ void unregister_kretprobe(struct kretprobe *rp);
196struct kretprobe_instance *get_free_rp_inst(struct kretprobe *rp); 202struct kretprobe_instance *get_free_rp_inst(struct kretprobe *rp);
197void add_rp_inst(struct kretprobe_instance *ri); 203void add_rp_inst(struct kretprobe_instance *ri);
198void kprobe_flush_task(struct task_struct *tk); 204void kprobe_flush_task(struct task_struct *tk);
199void recycle_rp_inst(struct kretprobe_instance *ri); 205void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
200#else /* CONFIG_KPROBES */ 206#else /* CONFIG_KPROBES */
201 207
202#define __kprobes /**/ 208#define __kprobes /**/
diff --git a/include/linux/latency.h b/include/linux/latency.h
new file mode 100644
index 000000000000..c08b52bb55b0
--- /dev/null
+++ b/include/linux/latency.h
@@ -0,0 +1,25 @@
1/*
2 * latency.h: Explicit system-wide latency-expectation infrastructure
3 *
4 * (C) Copyright 2006 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 */
8
9#ifndef _INCLUDE_GUARD_LATENCY_H_
10#define _INCLUDE_GUARD_LATENCY_H_
11
12#include <linux/notifier.h>
13
14void set_acceptable_latency(char *identifier, int usecs);
15void modify_acceptable_latency(char *identifier, int usecs);
16void remove_acceptable_latency(char *identifier);
17void synchronize_acceptable_latency(void);
18int system_latency_constraint(void);
19
20int register_latency_notifier(struct notifier_block * nb);
21int unregister_latency_notifier(struct notifier_block * nb);
22
23#define INFINITE_LATENCY 1000000
24
25#endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index dc23c7c639f3..88afceffb7cb 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -12,6 +12,9 @@
12#ifndef __LINUX_LEDS_H_INCLUDED 12#ifndef __LINUX_LEDS_H_INCLUDED
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h>
16#include <linux/spinlock.h>
17
15struct device; 18struct device;
16struct class_device; 19struct class_device;
17/* 20/*
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d6a3d4b345fc..d1af1dbeaeb4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -109,6 +109,10 @@ static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
109#define ATA_TAG_POISON 0xfafbfcfdU 109#define ATA_TAG_POISON 0xfafbfcfdU
110 110
111/* move to PCI layer? */ 111/* move to PCI layer? */
112#define PCI_VDEVICE(vendor, device) \
113 PCI_VENDOR_ID_##vendor, (device), \
114 PCI_ANY_ID, PCI_ANY_ID, 0, 0
115
112static inline struct device *pci_dev_to_dev(struct pci_dev *pdev) 116static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
113{ 117{
114 return &pdev->dev; 118 return &pdev->dev;
@@ -138,8 +142,9 @@ enum {
138 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */ 142 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
139 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 143 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
140 144
141 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */ 145 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */
142 ATA_DFLAG_SUSPENDED = (1 << 9), /* device suspended */ 146 ATA_DFLAG_NCQ_OFF = (1 << 9), /* devied limited to non-NCQ mode */
147 ATA_DFLAG_SUSPENDED = (1 << 10), /* device suspended */
143 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 148 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
144 149
145 ATA_DFLAG_DETACH = (1 << 16), 150 ATA_DFLAG_DETACH = (1 << 16),
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index 08a450a9dbf7..f6f301e2b0f5 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -47,5 +47,6 @@ int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int comman
47int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 47int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
48int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); 48int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data);
49void ps2_cmd_aborted(struct ps2dev *ps2dev); 49void ps2_cmd_aborted(struct ps2dev *ps2dev);
50int ps2_is_keyboard_id(char id);
50 51
51#endif /* _LIBPS2_H */ 52#endif /* _LIBPS2_H */
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 932021f872d5..6c9873f88287 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -35,9 +35,13 @@
35#endif 35#endif
36 36
37#define KPROBE_ENTRY(name) \ 37#define KPROBE_ENTRY(name) \
38 .section .kprobes.text, "ax"; \ 38 .pushsection .kprobes.text, "ax"; \
39 ENTRY(name) 39 ENTRY(name)
40 40
41#define KPROBE_END(name) \
42 END(name); \
43 .popsection
44
41#ifndef END 45#ifndef END
42#define END(name) \ 46#define END(name) \
43 .size name, .-name 47 .size name, .-name
diff --git a/include/linux/list.h b/include/linux/list.h
index 65a5b5ceda49..a9c90287c0ff 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -39,6 +39,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
39 * This is only for internal list manipulation where we know 39 * This is only for internal list manipulation where we know
40 * the prev/next entries already! 40 * the prev/next entries already!
41 */ 41 */
42#ifndef CONFIG_DEBUG_LIST
42static inline void __list_add(struct list_head *new, 43static inline void __list_add(struct list_head *new,
43 struct list_head *prev, 44 struct list_head *prev,
44 struct list_head *next) 45 struct list_head *next)
@@ -48,6 +49,11 @@ static inline void __list_add(struct list_head *new,
48 new->prev = prev; 49 new->prev = prev;
49 prev->next = new; 50 prev->next = new;
50} 51}
52#else
53extern void __list_add(struct list_head *new,
54 struct list_head *prev,
55 struct list_head *next);
56#endif
51 57
52/** 58/**
53 * list_add - add a new entry 59 * list_add - add a new entry
@@ -57,10 +63,15 @@ static inline void __list_add(struct list_head *new,
57 * Insert a new entry after the specified head. 63 * Insert a new entry after the specified head.
58 * This is good for implementing stacks. 64 * This is good for implementing stacks.
59 */ 65 */
66#ifndef CONFIG_DEBUG_LIST
60static inline void list_add(struct list_head *new, struct list_head *head) 67static inline void list_add(struct list_head *new, struct list_head *head)
61{ 68{
62 __list_add(new, head, head->next); 69 __list_add(new, head, head->next);
63} 70}
71#else
72extern void list_add(struct list_head *new, struct list_head *head);
73#endif
74
64 75
65/** 76/**
66 * list_add_tail - add a new entry 77 * list_add_tail - add a new entry
@@ -153,12 +164,16 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
153 * Note: list_empty on entry does not return true after this, the entry is 164 * Note: list_empty on entry does not return true after this, the entry is
154 * in an undefined state. 165 * in an undefined state.
155 */ 166 */
167#ifndef CONFIG_DEBUG_LIST
156static inline void list_del(struct list_head *entry) 168static inline void list_del(struct list_head *entry)
157{ 169{
158 __list_del(entry->prev, entry->next); 170 __list_del(entry->prev, entry->next);
159 entry->next = LIST_POISON1; 171 entry->next = LIST_POISON1;
160 entry->prev = LIST_POISON2; 172 entry->prev = LIST_POISON2;
161} 173}
174#else
175extern void list_del(struct list_head *entry);
176#endif
162 177
163/** 178/**
164 * list_del_rcu - deletes entry from list without re-initialization 179 * list_del_rcu - deletes entry from list without re-initialization
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
new file mode 100644
index 000000000000..1418fdc9ac02
--- /dev/null
+++ b/include/linux/lm_interface.h
@@ -0,0 +1,273 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __LM_INTERFACE_DOT_H__
11#define __LM_INTERFACE_DOT_H__
12
13
14typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
15
16/*
17 * lm_mount() flags
18 *
19 * LM_MFLAG_SPECTATOR
20 * GFS is asking to join the filesystem's lockspace, but it doesn't want to
21 * modify the filesystem. The lock module shouldn't assign a journal to the FS
22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node
23 * dies or withdraws, all locks can be wiped immediately.
24 */
25
26#define LM_MFLAG_SPECTATOR 0x00000001
27
28/*
29 * lm_lockstruct flags
30 *
31 * LM_LSFLAG_LOCAL
32 * The lock_nolock module returns LM_LSFLAG_LOCAL to GFS, indicating that GFS
33 * can make single-node optimizations.
34 */
35
36#define LM_LSFLAG_LOCAL 0x00000001
37
38/*
39 * lm_lockname types
40 */
41
42#define LM_TYPE_RESERVED 0x00
43#define LM_TYPE_NONDISK 0x01
44#define LM_TYPE_INODE 0x02
45#define LM_TYPE_RGRP 0x03
46#define LM_TYPE_META 0x04
47#define LM_TYPE_IOPEN 0x05
48#define LM_TYPE_FLOCK 0x06
49#define LM_TYPE_PLOCK 0x07
50#define LM_TYPE_QUOTA 0x08
51#define LM_TYPE_JOURNAL 0x09
52
53/*
54 * lm_lock() states
55 *
56 * SHARED is compatible with SHARED, not with DEFERRED or EX.
57 * DEFERRED is compatible with DEFERRED, not with SHARED or EX.
58 */
59
60#define LM_ST_UNLOCKED 0
61#define LM_ST_EXCLUSIVE 1
62#define LM_ST_DEFERRED 2
63#define LM_ST_SHARED 3
64
65/*
66 * lm_lock() flags
67 *
68 * LM_FLAG_TRY
69 * Don't wait to acquire the lock if it can't be granted immediately.
70 *
71 * LM_FLAG_TRY_1CB
72 * Send one blocking callback if TRY is set and the lock is not granted.
73 *
74 * LM_FLAG_NOEXP
75 * GFS sets this flag on lock requests it makes while doing journal recovery.
76 * These special requests should not be blocked due to the recovery like
77 * ordinary locks would be.
78 *
79 * LM_FLAG_ANY
80 * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
81 * also be granted in SHARED. The preferred state is whichever is compatible
82 * with other granted locks, or the specified state if no other locks exist.
83 *
84 * LM_FLAG_PRIORITY
85 * Override fairness considerations. Suppose a lock is held in a shared state
86 * and there is a pending request for the deferred state. A shared lock
87 * request with the priority flag would be allowed to bypass the deferred
88 * request and directly join the other shared lock. A shared lock request
89 * without the priority flag might be forced to wait until the deferred
90 * requested had acquired and released the lock.
91 */
92
93#define LM_FLAG_TRY 0x00000001
94#define LM_FLAG_TRY_1CB 0x00000002
95#define LM_FLAG_NOEXP 0x00000004
96#define LM_FLAG_ANY 0x00000008
97#define LM_FLAG_PRIORITY 0x00000010
98
99/*
100 * lm_lock() and lm_async_cb return flags
101 *
102 * LM_OUT_ST_MASK
103 * Masks the lower two bits of lock state in the returned value.
104 *
105 * LM_OUT_CACHEABLE
106 * The lock hasn't been released so GFS can continue to cache data for it.
107 *
108 * LM_OUT_CANCELED
109 * The lock request was canceled.
110 *
111 * LM_OUT_ASYNC
112 * The result of the request will be returned in an LM_CB_ASYNC callback.
113 */
114
115#define LM_OUT_ST_MASK 0x00000003
116#define LM_OUT_CACHEABLE 0x00000004
117#define LM_OUT_CANCELED 0x00000008
118#define LM_OUT_ASYNC 0x00000080
119#define LM_OUT_ERROR 0x00000100
120
121/*
122 * lm_callback_t types
123 *
124 * LM_CB_NEED_E LM_CB_NEED_D LM_CB_NEED_S
125 * Blocking callback, a remote node is requesting the given lock in
126 * EXCLUSIVE, DEFERRED, or SHARED.
127 *
128 * LM_CB_NEED_RECOVERY
129 * The given journal needs to be recovered.
130 *
131 * LM_CB_DROPLOCKS
132 * Reduce the number of cached locks.
133 *
134 * LM_CB_ASYNC
135 * The given lock has been granted.
136 */
137
138#define LM_CB_NEED_E 257
139#define LM_CB_NEED_D 258
140#define LM_CB_NEED_S 259
141#define LM_CB_NEED_RECOVERY 260
142#define LM_CB_DROPLOCKS 261
143#define LM_CB_ASYNC 262
144
145/*
146 * lm_recovery_done() messages
147 */
148
149#define LM_RD_GAVEUP 308
150#define LM_RD_SUCCESS 309
151
152
153struct lm_lockname {
154 u64 ln_number;
155 unsigned int ln_type;
156};
157
158#define lm_name_equal(name1, name2) \
159 (((name1)->ln_number == (name2)->ln_number) && \
160 ((name1)->ln_type == (name2)->ln_type)) \
161
162struct lm_async_cb {
163 struct lm_lockname lc_name;
164 int lc_ret;
165};
166
167struct lm_lockstruct;
168
169struct lm_lockops {
170 const char *lm_proto_name;
171
172 /*
173 * Mount/Unmount
174 */
175
176 int (*lm_mount) (char *table_name, char *host_data,
177 lm_callback_t cb, void *cb_data,
178 unsigned int min_lvb_size, int flags,
179 struct lm_lockstruct *lockstruct,
180 struct kobject *fskobj);
181
182 void (*lm_others_may_mount) (void *lockspace);
183
184 void (*lm_unmount) (void *lockspace);
185
186 void (*lm_withdraw) (void *lockspace);
187
188 /*
189 * Lock oriented operations
190 */
191
192 int (*lm_get_lock) (void *lockspace, struct lm_lockname *name, void **lockp);
193
194 void (*lm_put_lock) (void *lock);
195
196 unsigned int (*lm_lock) (void *lock, unsigned int cur_state,
197 unsigned int req_state, unsigned int flags);
198
199 unsigned int (*lm_unlock) (void *lock, unsigned int cur_state);
200
201 void (*lm_cancel) (void *lock);
202
203 int (*lm_hold_lvb) (void *lock, char **lvbp);
204 void (*lm_unhold_lvb) (void *lock, char *lvb);
205
206 /*
207 * Posix Lock oriented operations
208 */
209
210 int (*lm_plock_get) (void *lockspace, struct lm_lockname *name,
211 struct file *file, struct file_lock *fl);
212
213 int (*lm_plock) (void *lockspace, struct lm_lockname *name,
214 struct file *file, int cmd, struct file_lock *fl);
215
216 int (*lm_punlock) (void *lockspace, struct lm_lockname *name,
217 struct file *file, struct file_lock *fl);
218
219 /*
220 * Client oriented operations
221 */
222
223 void (*lm_recovery_done) (void *lockspace, unsigned int jid,
224 unsigned int message);
225
226 struct module *lm_owner;
227};
228
229/*
230 * lm_mount() return values
231 *
232 * ls_jid - the journal ID this node should use
233 * ls_first - this node is the first to mount the file system
234 * ls_lvb_size - size in bytes of lock value blocks
235 * ls_lockspace - lock module's context for this file system
236 * ls_ops - lock module's functions
237 * ls_flags - lock module features
238 */
239
240struct lm_lockstruct {
241 unsigned int ls_jid;
242 unsigned int ls_first;
243 unsigned int ls_lvb_size;
244 void *ls_lockspace;
245 const struct lm_lockops *ls_ops;
246 int ls_flags;
247};
248
249/*
250 * Lock module bottom interface. A lock module makes itself available to GFS
251 * with these functions.
252 */
253
254int gfs2_register_lockproto(const struct lm_lockops *proto);
255void gfs2_unregister_lockproto(const struct lm_lockops *proto);
256
257/*
258 * Lock module top interface. GFS calls these functions when mounting or
259 * unmounting a file system.
260 */
261
262int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
263 lm_callback_t cb, void *cb_data,
264 unsigned int min_lvb_size, int flags,
265 struct lm_lockstruct *lockstruct,
266 struct kobject *fskobj);
267
268void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct);
269
270void gfs2_withdraw_lockproto(struct lm_lockstruct *lockstruct);
271
272#endif /* __LM_INTERFACE_DOT_H__ */
273
diff --git a/include/linux/lock_dlm_plock.h b/include/linux/lock_dlm_plock.h
new file mode 100644
index 000000000000..fc3415113973
--- /dev/null
+++ b/include/linux/lock_dlm_plock.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2005 Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use,
5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2.
7 */
8
9#ifndef __LOCK_DLM_PLOCK_DOT_H__
10#define __LOCK_DLM_PLOCK_DOT_H__
11
12#define GDLM_PLOCK_MISC_NAME "lock_dlm_plock"
13
14#define GDLM_PLOCK_VERSION_MAJOR 1
15#define GDLM_PLOCK_VERSION_MINOR 1
16#define GDLM_PLOCK_VERSION_PATCH 0
17
18enum {
19 GDLM_PLOCK_OP_LOCK = 1,
20 GDLM_PLOCK_OP_UNLOCK,
21 GDLM_PLOCK_OP_GET,
22};
23
24struct gdlm_plock_info {
25 __u32 version[3];
26 __u8 optype;
27 __u8 ex;
28 __u8 wait;
29 __u8 pad;
30 __u32 pid;
31 __s32 nodeid;
32 __s32 rv;
33 __u32 fsid;
34 __u64 number;
35 __u64 start;
36 __u64 end;
37 __u64 owner;
38};
39
40#endif
41
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index b054debef2e0..81e3a185f951 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -30,7 +30,7 @@ extern struct nlmsvc_binding * nlmsvc_ops;
30 * Functions exported by the lockd module 30 * Functions exported by the lockd module
31 */ 31 */
32extern int nlmclnt_proc(struct inode *, int, struct file_lock *); 32extern int nlmclnt_proc(struct inode *, int, struct file_lock *);
33extern int lockd_up(void); 33extern int lockd_up(int proto);
34extern void lockd_down(void); 34extern void lockd_down(void);
35 35
36#endif /* LINUX_LOCKD_BIND_H */ 36#endif /* LINUX_LOCKD_BIND_H */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 0d92c468d55a..2909619c0295 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -37,17 +37,15 @@
37 * Lockd host handle (used both by the client and server personality). 37 * Lockd host handle (used both by the client and server personality).
38 */ 38 */
39struct nlm_host { 39struct nlm_host {
40 struct nlm_host * h_next; /* linked list (hash table) */ 40 struct hlist_node h_hash; /* doubly linked list */
41 struct sockaddr_in h_addr; /* peer address */ 41 struct sockaddr_in h_addr; /* peer address */
42 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 42 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */
43 char h_name[20]; /* remote hostname */ 43 char * h_name; /* remote hostname */
44 u32 h_version; /* interface version */ 44 u32 h_version; /* interface version */
45 unsigned short h_proto; /* transport proto */ 45 unsigned short h_proto; /* transport proto */
46 unsigned short h_reclaiming : 1, 46 unsigned short h_reclaiming : 1,
47 h_server : 1, /* server side, not client side */ 47 h_server : 1, /* server side, not client side */
48 h_inuse : 1, 48 h_inuse : 1;
49 h_killed : 1,
50 h_monitored : 1;
51 wait_queue_head_t h_gracewait; /* wait while reclaiming */ 49 wait_queue_head_t h_gracewait; /* wait while reclaiming */
52 struct rw_semaphore h_rwsem; /* Reboot recovery lock */ 50 struct rw_semaphore h_rwsem; /* Reboot recovery lock */
53 u32 h_state; /* pseudo-state counter */ 51 u32 h_state; /* pseudo-state counter */
@@ -61,6 +59,16 @@ struct nlm_host {
61 spinlock_t h_lock; 59 spinlock_t h_lock;
62 struct list_head h_granted; /* Locks in GRANTED state */ 60 struct list_head h_granted; /* Locks in GRANTED state */
63 struct list_head h_reclaim; /* Locks in RECLAIM state */ 61 struct list_head h_reclaim; /* Locks in RECLAIM state */
62 struct nsm_handle * h_nsmhandle; /* NSM status handle */
63};
64
65struct nsm_handle {
66 struct list_head sm_link;
67 atomic_t sm_count;
68 char * sm_name;
69 struct sockaddr_in sm_addr;
70 unsigned int sm_monitored : 1,
71 sm_sticky : 1; /* don't unmonitor */
64}; 72};
65 73
66/* 74/*
@@ -80,7 +88,7 @@ struct nlm_wait;
80/* 88/*
81 * Memory chunk for NLM client RPC request. 89 * Memory chunk for NLM client RPC request.
82 */ 90 */
83#define NLMCLNT_OHSIZE (sizeof(system_utsname.nodename)+10) 91#define NLMCLNT_OHSIZE (sizeof(utsname()->nodename)+10)
84struct nlm_rqst { 92struct nlm_rqst {
85 unsigned int a_flags; /* initial RPC task flags */ 93 unsigned int a_flags; /* initial RPC task flags */
86 struct nlm_host * a_host; /* host handle */ 94 struct nlm_host * a_host; /* host handle */
@@ -96,15 +104,14 @@ struct nlm_rqst {
96 * an NFS client. 104 * an NFS client.
97 */ 105 */
98struct nlm_file { 106struct nlm_file {
99 struct nlm_file * f_next; /* linked list */ 107 struct hlist_node f_list; /* linked list */
100 struct nfs_fh f_handle; /* NFS file handle */ 108 struct nfs_fh f_handle; /* NFS file handle */
101 struct file * f_file; /* VFS file pointer */ 109 struct file * f_file; /* VFS file pointer */
102 struct nlm_share * f_shares; /* DOS shares */ 110 struct nlm_share * f_shares; /* DOS shares */
103 struct nlm_block * f_blocks; /* blocked locks */ 111 struct list_head f_blocks; /* blocked locks */
104 unsigned int f_locks; /* guesstimate # of locks */ 112 unsigned int f_locks; /* guesstimate # of locks */
105 unsigned int f_count; /* reference count */ 113 unsigned int f_count; /* reference count */
106 struct semaphore f_sema; /* avoid concurrent access */ 114 struct mutex f_mutex; /* avoid concurrent access */
107 int f_hash; /* hash of f_handle */
108}; 115};
109 116
110/* 117/*
@@ -114,26 +121,18 @@ struct nlm_file {
114#define NLM_NEVER (~(unsigned long) 0) 121#define NLM_NEVER (~(unsigned long) 0)
115struct nlm_block { 122struct nlm_block {
116 struct kref b_count; /* Reference count */ 123 struct kref b_count; /* Reference count */
117 struct nlm_block * b_next; /* linked list (all blocks) */ 124 struct list_head b_list; /* linked list of all blocks */
118 struct nlm_block * b_fnext; /* linked list (per file) */ 125 struct list_head b_flist; /* linked list (per file) */
119 struct nlm_rqst * b_call; /* RPC args & callback info */ 126 struct nlm_rqst * b_call; /* RPC args & callback info */
120 struct svc_serv * b_daemon; /* NLM service */ 127 struct svc_serv * b_daemon; /* NLM service */
121 struct nlm_host * b_host; /* host handle for RPC clnt */ 128 struct nlm_host * b_host; /* host handle for RPC clnt */
122 unsigned long b_when; /* next re-xmit */ 129 unsigned long b_when; /* next re-xmit */
123 unsigned int b_id; /* block id */ 130 unsigned int b_id; /* block id */
124 unsigned char b_queued; /* re-queued */
125 unsigned char b_granted; /* VFS granted lock */ 131 unsigned char b_granted; /* VFS granted lock */
126 struct nlm_file * b_file; /* file in question */ 132 struct nlm_file * b_file; /* file in question */
127}; 133};
128 134
129/* 135/*
130 * Valid actions for nlmsvc_traverse_files
131 */
132#define NLM_ACT_CHECK 0 /* check for locks */
133#define NLM_ACT_MARK 1 /* mark & sweep */
134#define NLM_ACT_UNLOCK 2 /* release all locks */
135
136/*
137 * Global variables 136 * Global variables
138 */ 137 */
139extern struct rpc_program nlm_program; 138extern struct rpc_program nlm_program;
@@ -143,6 +142,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
143#endif 142#endif
144extern int nlmsvc_grace_period; 143extern int nlmsvc_grace_period;
145extern unsigned long nlmsvc_timeout; 144extern unsigned long nlmsvc_timeout;
145extern int nsm_use_hostnames;
146 146
147/* 147/*
148 * Lockd client functions 148 * Lockd client functions
@@ -155,22 +155,31 @@ struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock
155void nlmclnt_finish_block(struct nlm_wait *block); 155void nlmclnt_finish_block(struct nlm_wait *block);
156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
157u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 157u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
158void nlmclnt_recovery(struct nlm_host *, u32); 158void nlmclnt_recovery(struct nlm_host *);
159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
160void nlmclnt_next_cookie(struct nlm_cookie *);
160 161
161/* 162/*
162 * Host cache 163 * Host cache
163 */ 164 */
164struct nlm_host * nlmclnt_lookup_host(struct sockaddr_in *, int, int); 165struct nlm_host * nlmclnt_lookup_host(const struct sockaddr_in *, int, int, const char *, int);
165struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *); 166struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *, const char *, int);
166struct nlm_host * nlm_lookup_host(int server, struct sockaddr_in *, int, int); 167struct nlm_host * nlm_lookup_host(int server, const struct sockaddr_in *, int, int, const char *, int);
167struct rpc_clnt * nlm_bind_host(struct nlm_host *); 168struct rpc_clnt * nlm_bind_host(struct nlm_host *);
168void nlm_rebind_host(struct nlm_host *); 169void nlm_rebind_host(struct nlm_host *);
169struct nlm_host * nlm_get_host(struct nlm_host *); 170struct nlm_host * nlm_get_host(struct nlm_host *);
170void nlm_release_host(struct nlm_host *); 171void nlm_release_host(struct nlm_host *);
171void nlm_shutdown_hosts(void); 172void nlm_shutdown_hosts(void);
172extern struct nlm_host *nlm_find_client(void); 173extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, int, u32);
174struct nsm_handle *nsm_find(const struct sockaddr_in *, const char *, int);
175void nsm_release(struct nsm_handle *);
176
173 177
178/*
179 * This is used in garbage collection and resource reclaim
180 * A return value != 0 means destroy the lock/block/share
181 */
182typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref);
174 183
175/* 184/*
176 * Server-side lock handling 185 * Server-side lock handling
@@ -183,8 +192,8 @@ u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
183u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 192u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
184unsigned long nlmsvc_retry_blocked(void); 193unsigned long nlmsvc_retry_blocked(void);
185void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
186 int action); 195 nlm_host_match_fn_t match);
187void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32); 196void nlmsvc_grant_reply(struct nlm_cookie *, u32);
188 197
189/* 198/*
190 * File handling for the server personality 199 * File handling for the server personality
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index c75a424ebe4c..cd7816e74c05 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -25,6 +25,7 @@ u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int); 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *,
29 nlm_host_match_fn_t);
29 30
30#endif /* LINUX_LOCKD_SHARE_H */ 31#endif /* LINUX_LOCKD_SHARE_H */
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
index 1080bb6ae315..fc61d40964da 100644
--- a/include/linux/lockd/sm_inter.h
+++ b/include/linux/lockd/sm_inter.h
@@ -28,7 +28,8 @@ struct nsm_args {
28 u32 prog; /* RPC callback info */ 28 u32 prog; /* RPC callback info */
29 u32 vers; 29 u32 vers;
30 u32 proc; 30 u32 proc;
31 u32 proto; /* protocol (udp/tcp) plus server/client flag */ 31
32 char * mon_name;
32}; 33};
33 34
34/* 35/*
@@ -41,6 +42,6 @@ struct nsm_res {
41 42
42int nsm_monitor(struct nlm_host *); 43int nsm_monitor(struct nlm_host *);
43int nsm_unmonitor(struct nlm_host *); 44int nsm_unmonitor(struct nlm_host *);
44extern u32 nsm_local_state; 45extern int nsm_local_state;
45 46
46#endif /* LINUX_LOCKD_SM_INTER_H */ 47#endif /* LINUX_LOCKD_SM_INTER_H */
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index cee36e7c0548..3cc1ae25009b 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/linux/lockd/xdr.h 2 * linux/include/linux/lockd/xdr4.h
3 * 3 *
4 * XDR types for the NLM protocol 4 * XDR types for the NLM protocol
5 * 5 *
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index c040a8c969aa..1314ca0f29be 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -8,13 +8,13 @@
8#ifndef __LINUX_LOCKDEP_H 8#ifndef __LINUX_LOCKDEP_H
9#define __LINUX_LOCKDEP_H 9#define __LINUX_LOCKDEP_H
10 10
11#ifdef CONFIG_LOCKDEP
12
11#include <linux/linkage.h> 13#include <linux/linkage.h>
12#include <linux/list.h> 14#include <linux/list.h>
13#include <linux/debug_locks.h> 15#include <linux/debug_locks.h>
14#include <linux/stacktrace.h> 16#include <linux/stacktrace.h>
15 17
16#ifdef CONFIG_LOCKDEP
17
18/* 18/*
19 * Lock-class usage-state bits: 19 * Lock-class usage-state bits:
20 */ 20 */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index e76c7611d6cc..191a595055f0 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -59,10 +59,9 @@ struct loop_device {
59 struct bio *lo_bio; 59 struct bio *lo_bio;
60 struct bio *lo_biotail; 60 struct bio *lo_biotail;
61 int lo_state; 61 int lo_state;
62 struct completion lo_done;
63 struct completion lo_bh_done;
64 struct mutex lo_ctl_mutex; 62 struct mutex lo_ctl_mutex;
65 int lo_pending; 63 struct task_struct *lo_thread;
64 wait_queue_head_t lo_event;
66 65
67 request_queue_t *lo_queue; 66 request_queue_t *lo_queue;
68}; 67};
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 8f04143ca363..654ef5544878 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -57,7 +57,7 @@ struct memory_block {
57struct notifier_block; 57struct notifier_block;
58struct mem_section; 58struct mem_section;
59 59
60#ifndef CONFIG_MEMORY_HOTPLUG 60#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE
61static inline int memory_dev_init(void) 61static inline int memory_dev_init(void)
62{ 62{
63 return 0; 63 return 0;
@@ -78,7 +78,7 @@ extern int remove_memory_block(unsigned long, struct mem_section *, int);
78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
79 79
80 80
81#endif /* CONFIG_MEMORY_HOTPLUG */ 81#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
82 82
83#define hotplug_memory_notifier(fn, pri) { \ 83#define hotplug_memory_notifier(fn, pri) { \
84 static struct notifier_block fn##_mem_nb = \ 84 static struct notifier_block fn##_mem_nb = \
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 218501cfaeb9..7b54666cea8e 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -172,5 +172,7 @@ static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
172extern int add_memory(int nid, u64 start, u64 size); 172extern int add_memory(int nid, u64 start, u64 size);
173extern int arch_add_memory(int nid, u64 start, u64 size); 173extern int arch_add_memory(int nid, u64 start, u64 size);
174extern int remove_memory(u64 start, u64 size); 174extern int remove_memory(u64 start, u64 size);
175extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
176 int nr_pages);
175 177
176#endif /* __LINUX_MEMORY_HOTPLUG_H */ 178#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 856f0ee7e84a..b7966ab8cb6a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/debug_locks.h> 17#include <linux/debug_locks.h>
18#include <linux/backing-dev.h> 18#include <linux/backing-dev.h>
19#include <linux/mm_types.h>
19 20
20struct mempolicy; 21struct mempolicy;
21struct anon_vma; 22struct anon_vma;
@@ -198,6 +199,7 @@ struct vm_operations_struct {
198 void (*open)(struct vm_area_struct * area); 199 void (*open)(struct vm_area_struct * area);
199 void (*close)(struct vm_area_struct * area); 200 void (*close)(struct vm_area_struct * area);
200 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 201 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type);
202 unsigned long (*nopfn)(struct vm_area_struct * area, unsigned long address);
201 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); 203 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
202 204
203 /* notification that a previously read-only page is about to become 205 /* notification that a previously read-only page is about to become
@@ -215,62 +217,6 @@ struct vm_operations_struct {
215struct mmu_gather; 217struct mmu_gather;
216struct inode; 218struct inode;
217 219
218/*
219 * Each physical page in the system has a struct page associated with
220 * it to keep track of whatever it is we are using the page for at the
221 * moment. Note that we have no way to track which tasks are using
222 * a page, though if it is a pagecache page, rmap structures can tell us
223 * who is mapping it.
224 */
225struct page {
226 unsigned long flags; /* Atomic flags, some possibly
227 * updated asynchronously */
228 atomic_t _count; /* Usage count, see below. */
229 atomic_t _mapcount; /* Count of ptes mapped in mms,
230 * to show when page is mapped
231 * & limit reverse map searches.
232 */
233 union {
234 struct {
235 unsigned long private; /* Mapping-private opaque data:
236 * usually used for buffer_heads
237 * if PagePrivate set; used for
238 * swp_entry_t if PageSwapCache;
239 * indicates order in the buddy
240 * system if PG_buddy is set.
241 */
242 struct address_space *mapping; /* If low bit clear, points to
243 * inode address_space, or NULL.
244 * If page mapped as anonymous
245 * memory, low bit is set, and
246 * it points to anon_vma object:
247 * see PAGE_MAPPING_ANON below.
248 */
249 };
250#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
251 spinlock_t ptl;
252#endif
253 };
254 pgoff_t index; /* Our offset within mapping. */
255 struct list_head lru; /* Pageout list, eg. active_list
256 * protected by zone->lru_lock !
257 */
258 /*
259 * On machines where all RAM is mapped into kernel address space,
260 * we can simply calculate the virtual address. On machines with
261 * highmem some memory is mapped into kernel virtual memory
262 * dynamically, so we need a place to store that address.
263 * Note that this field could be 16 bits on x86 ... ;)
264 *
265 * Architectures with slow multiplication can define
266 * WANT_PAGE_VIRTUAL in asm/page.h
267 */
268#if defined(WANT_PAGE_VIRTUAL)
269 void *virtual; /* Kernel virtual address (NULL if
270 not kmapped, ie. highmem) */
271#endif /* WANT_PAGE_VIRTUAL */
272};
273
274#define page_private(page) ((page)->private) 220#define page_private(page) ((page)->private)
275#define set_page_private(page, v) ((page)->private = (v)) 221#define set_page_private(page, v) ((page)->private = (v))
276 222
@@ -501,7 +447,11 @@ static inline struct zone *page_zone(struct page *page)
501 447
502static inline unsigned long zone_to_nid(struct zone *zone) 448static inline unsigned long zone_to_nid(struct zone *zone)
503{ 449{
504 return zone->zone_pgdat->node_id; 450#ifdef CONFIG_NUMA
451 return zone->node;
452#else
453 return 0;
454#endif
505} 455}
506 456
507static inline unsigned long page_to_nid(struct page *page) 457static inline unsigned long page_to_nid(struct page *page)
@@ -546,11 +496,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
546 */ 496 */
547#include <linux/vmstat.h> 497#include <linux/vmstat.h>
548 498
549#ifndef CONFIG_DISCONTIGMEM
550/* The array of struct pages - for discontigmem use pgdat->lmem_map */
551extern struct page *mem_map;
552#endif
553
554static __always_inline void *lowmem_page_address(struct page *page) 499static __always_inline void *lowmem_page_address(struct page *page)
555{ 500{
556 return __va(page_to_pfn(page) << PAGE_SHIFT); 501 return __va(page_to_pfn(page) << PAGE_SHIFT);
@@ -650,6 +595,12 @@ static inline int page_mapped(struct page *page)
650#define NOPAGE_OOM ((struct page *) (-1)) 595#define NOPAGE_OOM ((struct page *) (-1))
651 596
652/* 597/*
598 * Error return values for the *_nopfn functions
599 */
600#define NOPFN_SIGBUS ((unsigned long) -1)
601#define NOPFN_OOM ((unsigned long) -2)
602
603/*
653 * Different kinds of faults, as returned by handle_mm_fault(). 604 * Different kinds of faults, as returned by handle_mm_fault().
654 * Used to decide whether a process gets delivered SIGBUS or 605 * Used to decide whether a process gets delivered SIGBUS or
655 * just gets major/minor fault counters bumped up. 606 * just gets major/minor fault counters bumped up.
@@ -792,7 +743,9 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long
792 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 743 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
793void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long); 744void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long);
794 745
795int __set_page_dirty_buffers(struct page *page); 746extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
747extern void do_invalidatepage(struct page *page, unsigned long offset);
748
796int __set_page_dirty_nobuffers(struct page *page); 749int __set_page_dirty_nobuffers(struct page *page);
797int redirty_page_for_writepage(struct writeback_control *wbc, 750int redirty_page_for_writepage(struct writeback_control *wbc,
798 struct page *page); 751 struct page *page);
@@ -937,12 +890,64 @@ extern void free_area_init(unsigned long * zones_size);
937extern void free_area_init_node(int nid, pg_data_t *pgdat, 890extern void free_area_init_node(int nid, pg_data_t *pgdat,
938 unsigned long * zones_size, unsigned long zone_start_pfn, 891 unsigned long * zones_size, unsigned long zone_start_pfn,
939 unsigned long *zholes_size); 892 unsigned long *zholes_size);
893#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
894/*
895 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
896 * zones, allocate the backing mem_map and account for memory holes in a more
897 * architecture independent manner. This is a substitute for creating the
898 * zone_sizes[] and zholes_size[] arrays and passing them to
899 * free_area_init_node()
900 *
901 * An architecture is expected to register range of page frames backed by
902 * physical memory with add_active_range() before calling
903 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
904 * usage, an architecture is expected to do something like
905 *
906 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
907 * max_highmem_pfn};
908 * for_each_valid_physical_page_range()
909 * add_active_range(node_id, start_pfn, end_pfn)
910 * free_area_init_nodes(max_zone_pfns);
911 *
912 * If the architecture guarantees that there are no holes in the ranges
913 * registered with add_active_range(), free_bootmem_active_regions()
914 * will call free_bootmem_node() for each registered physical page range.
915 * Similarly sparse_memory_present_with_active_regions() calls
916 * memory_present() for each range when SPARSEMEM is enabled.
917 *
918 * See mm/page_alloc.c for more information on each function exposed by
919 * CONFIG_ARCH_POPULATES_NODE_MAP
920 */
921extern void free_area_init_nodes(unsigned long *max_zone_pfn);
922extern void add_active_range(unsigned int nid, unsigned long start_pfn,
923 unsigned long end_pfn);
924extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
925 unsigned long new_end_pfn);
926extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
927 unsigned long end_pfn);
928extern void remove_all_active_ranges(void);
929extern unsigned long absent_pages_in_range(unsigned long start_pfn,
930 unsigned long end_pfn);
931extern void get_pfn_range_for_nid(unsigned int nid,
932 unsigned long *start_pfn, unsigned long *end_pfn);
933extern unsigned long find_min_pfn_with_active_regions(void);
934extern unsigned long find_max_pfn_with_active_regions(void);
935extern void free_bootmem_with_active_regions(int nid,
936 unsigned long max_low_pfn);
937extern void sparse_memory_present_with_active_regions(int nid);
938#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
939extern int early_pfn_to_nid(unsigned long pfn);
940#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
941#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
942extern void set_dma_reserve(unsigned long new_dma_reserve);
940extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); 943extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
941extern void setup_per_zone_pages_min(void); 944extern void setup_per_zone_pages_min(void);
942extern void mem_init(void); 945extern void mem_init(void);
943extern void show_mem(void); 946extern void show_mem(void);
944extern void si_meminfo(struct sysinfo * val); 947extern void si_meminfo(struct sysinfo * val);
945extern void si_meminfo_node(struct sysinfo *val, int nid); 948extern void si_meminfo_node(struct sysinfo *val, int nid);
949extern void zonetable_add(struct zone *zone, int nid, enum zone_type zid,
950 unsigned long pfn, unsigned long size);
946 951
947#ifdef CONFIG_NUMA 952#ifdef CONFIG_NUMA
948extern void setup_per_cpu_pageset(void); 953extern void setup_per_cpu_pageset(void);
@@ -1130,7 +1135,7 @@ void drop_slab(void);
1130extern int randomize_va_space; 1135extern int randomize_va_space;
1131#endif 1136#endif
1132 1137
1133const char *arch_vma_name(struct vm_area_struct *vma); 1138__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma);
1134 1139
1135#endif /* __KERNEL__ */ 1140#endif /* __KERNEL__ */
1136#endif /* _LINUX_MM_H */ 1141#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
new file mode 100644
index 000000000000..c3852fd4a1cc
--- /dev/null
+++ b/include/linux/mm_types.h
@@ -0,0 +1,67 @@
1#ifndef _LINUX_MM_TYPES_H
2#define _LINUX_MM_TYPES_H
3
4#include <linux/types.h>
5#include <linux/threads.h>
6#include <linux/list.h>
7#include <linux/spinlock.h>
8
9struct address_space;
10
11/*
12 * Each physical page in the system has a struct page associated with
13 * it to keep track of whatever it is we are using the page for at the
14 * moment. Note that we have no way to track which tasks are using
15 * a page, though if it is a pagecache page, rmap structures can tell us
16 * who is mapping it.
17 */
18struct page {
19 unsigned long flags; /* Atomic flags, some possibly
20 * updated asynchronously */
21 atomic_t _count; /* Usage count, see below. */
22 atomic_t _mapcount; /* Count of ptes mapped in mms,
23 * to show when page is mapped
24 * & limit reverse map searches.
25 */
26 union {
27 struct {
28 unsigned long private; /* Mapping-private opaque data:
29 * usually used for buffer_heads
30 * if PagePrivate set; used for
31 * swp_entry_t if PageSwapCache;
32 * indicates order in the buddy
33 * system if PG_buddy is set.
34 */
35 struct address_space *mapping; /* If low bit clear, points to
36 * inode address_space, or NULL.
37 * If page mapped as anonymous
38 * memory, low bit is set, and
39 * it points to anon_vma object:
40 * see PAGE_MAPPING_ANON below.
41 */
42 };
43#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
44 spinlock_t ptl;
45#endif
46 };
47 pgoff_t index; /* Our offset within mapping. */
48 struct list_head lru; /* Pageout list, eg. active_list
49 * protected by zone->lru_lock !
50 */
51 /*
52 * On machines where all RAM is mapped into kernel address space,
53 * we can simply calculate the virtual address. On machines with
54 * highmem some memory is mapped into kernel virtual memory
55 * dynamically, so we need a place to store that address.
56 * Note that this field could be 16 bits on x86 ... ;)
57 *
58 * Architectures with slow multiplication can define
59 * WANT_PAGE_VIRTUAL in asm/page.h
60 */
61#if defined(WANT_PAGE_VIRTUAL)
62 void *virtual; /* Kernel virtual address (NULL if
63 not kmapped, ie. highmem) */
64#endif /* WANT_PAGE_VIRTUAL */
65};
66
67#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ba095aebedff..587264a58d56 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -85,6 +85,8 @@ struct mmc_host {
85 unsigned long caps; /* Host capabilities */ 85 unsigned long caps; /* Host capabilities */
86 86
87#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 87#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
88#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */
89#define MMC_CAP_BYTEBLOCK (1 << 2) /* Can do non-log2 block sizes */
88 90
89 /* host specific block data */ 91 /* host specific block data */
90 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 92 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 627e2c08ce41..a3594dfd6963 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -68,7 +68,6 @@ struct mmc_command {
68struct mmc_data { 68struct mmc_data {
69 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */ 69 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */
70 unsigned int timeout_clks; /* data timeout (in clocks) */ 70 unsigned int timeout_clks; /* data timeout (in clocks) */
71 unsigned int blksz_bits; /* data block size */
72 unsigned int blksz; /* data block size */ 71 unsigned int blksz; /* data block size */
73 unsigned int blocks; /* number of blocks */ 72 unsigned int blocks; /* number of blocks */
74 unsigned int error; /* data error */ 73 unsigned int error; /* data error */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 3693f1a52788..59855b8718a0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -58,6 +58,7 @@ enum zone_stat_item {
58 NR_WRITEBACK, 58 NR_WRITEBACK,
59 NR_UNSTABLE_NFS, /* NFS unstable pages */ 59 NR_UNSTABLE_NFS, /* NFS unstable pages */
60 NR_BOUNCE, 60 NR_BOUNCE,
61 NR_VMSCAN_WRITE,
61#ifdef CONFIG_NUMA 62#ifdef CONFIG_NUMA
62 NUMA_HIT, /* allocated in intended node */ 63 NUMA_HIT, /* allocated in intended node */
63 NUMA_MISS, /* allocated in non intended node */ 64 NUMA_MISS, /* allocated in non intended node */
@@ -167,6 +168,7 @@ struct zone {
167 unsigned long lowmem_reserve[MAX_NR_ZONES]; 168 unsigned long lowmem_reserve[MAX_NR_ZONES];
168 169
169#ifdef CONFIG_NUMA 170#ifdef CONFIG_NUMA
171 int node;
170 /* 172 /*
171 * zone reclaim becomes active if more unmapped pages exist. 173 * zone reclaim becomes active if more unmapped pages exist.
172 */ 174 */
@@ -305,6 +307,18 @@ struct zonelist {
305 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited 307 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
306}; 308};
307 309
310#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
311struct node_active_region {
312 unsigned long start_pfn;
313 unsigned long end_pfn;
314 int nid;
315};
316#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
317
318#ifndef CONFIG_DISCONTIGMEM
319/* The array of struct pages - for discontigmem use pgdat->lmem_map */
320extern struct page *mem_map;
321#endif
308 322
309/* 323/*
310 * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM 324 * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
@@ -518,7 +532,8 @@ extern struct zone *next_zone(struct zone *zone);
518 532
519#endif 533#endif
520 534
521#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 535#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
536 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
522#define early_pfn_to_nid(nid) (0UL) 537#define early_pfn_to_nid(nid) (0UL)
523#endif 538#endif
524 539
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f7ca0b09075d..e0c393cc7240 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -308,4 +308,16 @@ struct input_device_id {
308 kernel_ulong_t driver_info; 308 kernel_ulong_t driver_info;
309}; 309};
310 310
311/* EISA */
312
313#define EISA_SIG_LEN 8
314
315/* The EISA signature, in ASCII form, null terminated */
316struct eisa_device_id {
317 char sig[EISA_SIG_LEN];
318 kernel_ulong_t driver_data;
319};
320
321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
322
311#endif /* LINUX_MOD_DEVICETABLE_H */ 323#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index d4486cc2e7fe..4b2d8091a410 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -232,17 +232,17 @@ enum module_state
232}; 232};
233 233
234/* Similar stuff for section attributes. */ 234/* Similar stuff for section attributes. */
235#define MODULE_SECT_NAME_LEN 32
236struct module_sect_attr 235struct module_sect_attr
237{ 236{
238 struct module_attribute mattr; 237 struct module_attribute mattr;
239 char name[MODULE_SECT_NAME_LEN]; 238 char *name;
240 unsigned long address; 239 unsigned long address;
241}; 240};
242 241
243struct module_sect_attrs 242struct module_sect_attrs
244{ 243{
245 struct attribute_group grp; 244 struct attribute_group grp;
245 int nsections;
246 struct module_sect_attr attrs[0]; 246 struct module_sect_attr attrs[0];
247}; 247};
248 248
@@ -320,6 +320,8 @@ struct module
320 /* Am I GPL-compatible */ 320 /* Am I GPL-compatible */
321 int license_gplok; 321 int license_gplok;
322 322
323 unsigned int taints; /* same bits as kernel:tainted */
324
323#ifdef CONFIG_MODULE_UNLOAD 325#ifdef CONFIG_MODULE_UNLOAD
324 /* Reference counts */ 326 /* Reference counts */
325 struct module_ref ref[NR_CPUS]; 327 struct module_ref ref[NR_CPUS];
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 3ca880463c47..cc5fb75af78a 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -9,6 +9,7 @@
9 * (And no, it doesn't do the #ifdef __MPAGE_H thing, and it doesn't do 9 * (And no, it doesn't do the #ifdef __MPAGE_H thing, and it doesn't do
10 * nested includes. Get it right in the .c file). 10 * nested includes. Get it right in the .c file).
11 */ 11 */
12#ifdef CONFIG_BLOCK
12 13
13struct writeback_control; 14struct writeback_control;
14typedef int (writepage_t)(struct page *page, struct writeback_control *wbc); 15typedef int (writepage_t)(struct page *page, struct writeback_control *wbc);
@@ -21,8 +22,4 @@ int mpage_writepages(struct address_space *mapping,
21int mpage_writepage(struct page *page, get_block_t *get_block, 22int mpage_writepage(struct page *page, get_block_t *get_block,
22 struct writeback_control *wbc); 23 struct writeback_control *wbc);
23 24
24static inline int 25#endif
25generic_writepages(struct address_space *mapping, struct writeback_control *wbc)
26{
27 return mpage_writepages(mapping, wbc, NULL);
28}
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index e05d54a90743..7da2cee8e132 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -142,7 +142,7 @@ struct vif_device
142 unsigned long rate_limit; /* Traffic shaping (NI) */ 142 unsigned long rate_limit; /* Traffic shaping (NI) */
143 unsigned char threshold; /* TTL threshold */ 143 unsigned char threshold; /* TTL threshold */
144 unsigned short flags; /* Control flags */ 144 unsigned short flags; /* Control flags */
145 __u32 local,remote; /* Addresses(remote for tunnels)*/ 145 __be32 local,remote; /* Addresses(remote for tunnels)*/
146 int link; /* Physical interface index */ 146 int link; /* Physical interface index */
147}; 147};
148 148
@@ -151,8 +151,8 @@ struct vif_device
151struct mfc_cache 151struct mfc_cache
152{ 152{
153 struct mfc_cache *next; /* Next entry on cache line */ 153 struct mfc_cache *next; /* Next entry on cache line */
154 __u32 mfc_mcastgrp; /* Group the entry belongs to */ 154 __be32 mfc_mcastgrp; /* Group the entry belongs to */
155 __u32 mfc_origin; /* Source of packet */ 155 __be32 mfc_origin; /* Source of packet */
156 vifi_t mfc_parent; /* Source interface */ 156 vifi_t mfc_parent; /* Source interface */
157 int mfc_flags; /* Flags on line */ 157 int mfc_flags; /* Flags on line */
158 158
@@ -179,9 +179,9 @@ struct mfc_cache
179#define MFC_LINES 64 179#define MFC_LINES 64
180 180
181#ifdef __BIG_ENDIAN 181#ifdef __BIG_ENDIAN
182#define MFC_HASH(a,b) ((((a)>>24)^((b)>>26))&(MFC_LINES-1)) 182#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
183#else 183#else
184#define MFC_HASH(a,b) (((a)^((b)>>2))&(MFC_LINES-1)) 184#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
185#endif 185#endif
186 186
187#endif 187#endif
@@ -213,8 +213,8 @@ struct pimreghdr
213{ 213{
214 __u8 type; 214 __u8 type;
215 __u8 reserved; 215 __u8 reserved;
216 __u16 csum; 216 __be16 csum;
217 __u32 flags; 217 __be32 flags;
218}; 218};
219 219
220extern int pim_rcv_v1(struct sk_buff *); 220extern int pim_rcv_v1(struct sk_buff *);
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index bae62d62dc3e..ce6c85815cbd 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -204,6 +204,7 @@ struct fat_mount_options {
204 unicode_xlate:1, /* create escape sequences for unhandled Unicode */ 204 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
205 numtail:1, /* Does first alias have a numeric '~1' type tail? */ 205 numtail:1, /* Does first alias have a numeric '~1' type tail? */
206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ 206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
207 flush:1, /* write things quickly */
207 nocase:1; /* Does this need case conversion? 0=need case conversion*/ 208 nocase:1; /* Does this need case conversion? 0=need case conversion*/
208}; 209};
209 210
@@ -412,6 +413,8 @@ extern int fat_sync_inode(struct inode *inode);
412extern int fat_fill_super(struct super_block *sb, void *data, int silent, 413extern int fat_fill_super(struct super_block *sb, void *data, int silent,
413 struct inode_operations *fs_dir_inode_ops, int isvfat); 414 struct inode_operations *fs_dir_inode_ops, int isvfat);
414 415
416extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
417 struct inode *i2);
415/* fat/misc.c */ 418/* fat/misc.c */
416extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); 419extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
417extern void fat_clusters_flush(struct super_block *sb); 420extern void fat_clusters_flush(struct super_block *sb);
diff --git a/include/linux/msi.h b/include/linux/msi.h
new file mode 100644
index 000000000000..c7ef94343673
--- /dev/null
+++ b/include/linux/msi.h
@@ -0,0 +1,49 @@
1#ifndef LINUX_MSI_H
2#define LINUX_MSI_H
3
4struct msi_msg {
5 u32 address_lo; /* low 32 bits of msi message address */
6 u32 address_hi; /* high 32 bits of msi message address */
7 u32 data; /* 16 bits of msi message data */
8};
9
10/* Heper functions */
11extern void mask_msi_irq(unsigned int irq);
12extern void unmask_msi_irq(unsigned int irq);
13extern void read_msi_msg(unsigned int irq, struct msi_msg *msg);
14
15extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
16
17struct msi_desc {
18 struct {
19 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */
20 __u8 maskbit : 1; /* mask-pending bit supported ? */
21 __u8 unused : 1;
22 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
23 __u8 pos; /* Location of the msi capability */
24 __u16 entry_nr; /* specific enabled entry */
25 unsigned default_irq; /* default pre-assigned irq */
26 }msi_attrib;
27
28 struct {
29 __u16 head;
30 __u16 tail;
31 }link;
32
33 void __iomem *mask_base;
34 struct pci_dev *dev;
35
36#ifdef CONFIG_PM
37 /* PM save area for MSIX address/data */
38 struct msi_msg msg_save;
39#endif
40};
41
42/*
43 * The arch hook for setup up msi irqs
44 */
45int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev);
46void arch_teardown_msi_irq(unsigned int irq);
47
48
49#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 0b4cd2fa64aa..70420bbae82b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -27,9 +27,17 @@
27struct mtd_info; 27struct mtd_info;
28/* Scan and identify a NAND device */ 28/* Scan and identify a NAND device */
29extern int nand_scan (struct mtd_info *mtd, int max_chips); 29extern int nand_scan (struct mtd_info *mtd, int max_chips);
30/* Separate phases of nand_scan(), allowing board driver to intervene
31 * and override command or ECC setup according to flash type */
32extern int nand_scan_ident(struct mtd_info *mtd, int max_chips);
33extern int nand_scan_tail(struct mtd_info *mtd);
34
30/* Free resources held by the NAND device */ 35/* Free resources held by the NAND device */
31extern void nand_release (struct mtd_info *mtd); 36extern void nand_release (struct mtd_info *mtd);
32 37
38/* Internal helper for board drivers which need to override command function */
39extern void nand_wait_ready(struct mtd_info *mtd);
40
33/* The maximum number of NAND chips in an array */ 41/* The maximum number of NAND chips in an array */
34#define NAND_MAX_CHIPS 8 42#define NAND_MAX_CHIPS 8
35 43
@@ -178,7 +186,9 @@ typedef enum {
178#define NAND_USE_FLASH_BBT 0x00010000 186#define NAND_USE_FLASH_BBT 0x00010000
179/* This option skips the bbt scan during initialization. */ 187/* This option skips the bbt scan during initialization. */
180#define NAND_SKIP_BBTSCAN 0x00020000 188#define NAND_SKIP_BBTSCAN 0x00020000
181 189/* This option is defined if the board driver allocates its own buffers
190 (e.g. because it needs them DMA-coherent */
191#define NAND_OWN_BUFFERS 0x00040000
182/* Options set by nand scan */ 192/* Options set by nand scan */
183/* Nand scan has allocated controller struct */ 193/* Nand scan has allocated controller struct */
184#define NAND_CONTROLLER_ALLOC 0x80000000 194#define NAND_CONTROLLER_ALLOC 0x80000000
@@ -228,6 +238,8 @@ struct nand_hw_control {
228 * be provided if an hardware ECC is available 238 * be provided if an hardware ECC is available
229 * @calculate: function for ecc calculation or readback from ecc hardware 239 * @calculate: function for ecc calculation or readback from ecc hardware
230 * @correct: function for ecc correction, matching to ecc generator (sw/hw) 240 * @correct: function for ecc correction, matching to ecc generator (sw/hw)
241 * @read_page_raw: function to read a raw page without ECC
242 * @write_page_raw: function to write a raw page without ECC
231 * @read_page: function to read a page according to the ecc generator requirements 243 * @read_page: function to read a page according to the ecc generator requirements
232 * @write_page: function to write a page according to the ecc generator requirements 244 * @write_page: function to write a page according to the ecc generator requirements
233 * @read_oob: function to read chip OOB data 245 * @read_oob: function to read chip OOB data
@@ -249,6 +261,12 @@ struct nand_ecc_ctrl {
249 int (*correct)(struct mtd_info *mtd, uint8_t *dat, 261 int (*correct)(struct mtd_info *mtd, uint8_t *dat,
250 uint8_t *read_ecc, 262 uint8_t *read_ecc,
251 uint8_t *calc_ecc); 263 uint8_t *calc_ecc);
264 int (*read_page_raw)(struct mtd_info *mtd,
265 struct nand_chip *chip,
266 uint8_t *buf);
267 void (*write_page_raw)(struct mtd_info *mtd,
268 struct nand_chip *chip,
269 const uint8_t *buf);
252 int (*read_page)(struct mtd_info *mtd, 270 int (*read_page)(struct mtd_info *mtd,
253 struct nand_chip *chip, 271 struct nand_chip *chip,
254 uint8_t *buf); 272 uint8_t *buf);
@@ -337,6 +355,7 @@ struct nand_buffers {
337 * @priv: [OPTIONAL] pointer to private chip date 355 * @priv: [OPTIONAL] pointer to private chip date
338 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks 356 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
339 * (determine if errors are correctable) 357 * (determine if errors are correctable)
358 * @write_page [REPLACEABLE] High-level page write function
340 */ 359 */
341 360
342struct nand_chip { 361struct nand_chip {
@@ -359,6 +378,8 @@ struct nand_chip {
359 void (*erase_cmd)(struct mtd_info *mtd, int page); 378 void (*erase_cmd)(struct mtd_info *mtd, int page);
360 int (*scan_bbt)(struct mtd_info *mtd); 379 int (*scan_bbt)(struct mtd_info *mtd);
361 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); 380 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
381 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
382 const uint8_t *buf, int page, int cached, int raw);
362 383
363 int chip_delay; 384 int chip_delay;
364 unsigned int options; 385 unsigned int options;
@@ -380,7 +401,7 @@ struct nand_chip {
380 struct nand_ecclayout *ecclayout; 401 struct nand_ecclayout *ecclayout;
381 402
382 struct nand_ecc_ctrl ecc; 403 struct nand_ecc_ctrl ecc;
383 struct nand_buffers buffers; 404 struct nand_buffers *buffers;
384 struct nand_hw_control hwcontrol; 405 struct nand_hw_control hwcontrol;
385 406
386 struct mtd_oob_ops ops; 407 struct mtd_oob_ops ops;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 1f4972155249..6f045b586e76 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/linux/mtd/onenand.h 2 * linux/include/linux/mtd/onenand.h
3 * 3 *
4 * Copyright (C) 2005 Samsung Electronics 4 * Copyright (C) 2005-2006 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -96,6 +96,7 @@ struct onenand_chip {
96 void __iomem *base; 96 void __iomem *base;
97 unsigned int chipsize; 97 unsigned int chipsize;
98 unsigned int device_id; 98 unsigned int device_id;
99 unsigned int version_id;
99 unsigned int density_mask; 100 unsigned int density_mask;
100 unsigned int options; 101 unsigned int options;
101 102
@@ -149,7 +150,8 @@ struct onenand_chip {
149/* 150/*
150 * Options bits 151 * Options bits
151 */ 152 */
152#define ONENAND_CONT_LOCK (0x0001) 153#define ONENAND_HAS_CONT_LOCK (0x0001)
154#define ONENAND_HAS_UNLOCK_ALL (0x0002)
153#define ONENAND_PAGEBUF_ALLOC (0x1000) 155#define ONENAND_PAGEBUF_ALLOC (0x1000)
154 156
155/* 157/*
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index 4a72818d2545..9e409fe6ded6 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * OneNAND Register header file 4 * OneNAND Register header file
5 * 5 *
6 * Copyright (C) 2005 Samsung Electronics 6 * Copyright (C) 2005-2006 Samsung Electronics
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -72,6 +72,7 @@
72#define ONENAND_DEVICE_VCC_MASK (0x3) 72#define ONENAND_DEVICE_VCC_MASK (0x3)
73 73
74#define ONENAND_DEVICE_DENSITY_512Mb (0x002) 74#define ONENAND_DEVICE_DENSITY_512Mb (0x002)
75#define ONENAND_DEVICE_DENSITY_1Gb (0x003)
75 76
76/* 77/*
77 * Version ID Register F002h (R) 78 * Version ID Register F002h (R)
@@ -110,6 +111,7 @@
110#define ONENAND_CMD_UNLOCK (0x23) 111#define ONENAND_CMD_UNLOCK (0x23)
111#define ONENAND_CMD_LOCK (0x2A) 112#define ONENAND_CMD_LOCK (0x2A)
112#define ONENAND_CMD_LOCK_TIGHT (0x2C) 113#define ONENAND_CMD_LOCK_TIGHT (0x2C)
114#define ONENAND_CMD_UNLOCK_ALL (0x27)
113#define ONENAND_CMD_ERASE (0x94) 115#define ONENAND_CMD_ERASE (0x94)
114#define ONENAND_CMD_RESET (0xF0) 116#define ONENAND_CMD_RESET (0xF0)
115#define ONENAND_CMD_OTP_ACCESS (0x65) 117#define ONENAND_CMD_OTP_ACCESS (0x65)
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index 2332eda07e0e..9667863bd7e3 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -1,4 +1,4 @@
1/* linux/include/mtd/plat-ram.h 1/* linux/include/linux/mtd/plat-ram.h
2 * 2 *
3 * (c) 2004 Simtec Electronics 3 * (c) 2004 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 45511a5918d3..f5f19606effb 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_NAMEI_H 1#ifndef _LINUX_NAMEI_H
2#define _LINUX_NAMEI_H 2#define _LINUX_NAMEI_H
3 3
4#include <linux/dcache.h>
4#include <linux/linkage.h> 5#include <linux/linkage.h>
5 6
6struct vfsmount; 7struct vfsmount;
@@ -54,6 +55,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
54#define LOOKUP_OPEN (0x0100) 55#define LOOKUP_OPEN (0x0100)
55#define LOOKUP_CREATE (0x0200) 56#define LOOKUP_CREATE (0x0200)
56#define LOOKUP_ACCESS (0x0400) 57#define LOOKUP_ACCESS (0x0400)
58#define LOOKUP_CHDIR (0x0800)
57 59
58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *)); 60extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
59extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *)); 61extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 3abc8e3b4879..d137009f0b2b 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/mount.h> 5#include <linux/mount.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/nsproxy.h>
7 8
8struct namespace { 9struct namespace {
9 atomic_t count; 10 atomic_t count;
@@ -26,11 +27,8 @@ static inline void put_namespace(struct namespace *namespace)
26 27
27static inline void exit_namespace(struct task_struct *p) 28static inline void exit_namespace(struct task_struct *p)
28{ 29{
29 struct namespace *namespace = p->namespace; 30 struct namespace *namespace = p->nsproxy->namespace;
30 if (namespace) { 31 if (namespace) {
31 task_lock(p);
32 p->namespace = NULL;
33 task_unlock(p);
34 put_namespace(namespace); 32 put_namespace(namespace);
35 } 33 }
36} 34}
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 02e352be717e..0ea7f89e613c 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -212,6 +212,7 @@ void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
212 212
213/* linux/fs/ncpfs/ioctl.c */ 213/* linux/fs/ncpfs/ioctl.c */
214int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 214int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
215long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
215 216
216/* linux/fs/ncpfs/sock.c */ 217/* linux/fs/ncpfs/sock.c */
217int ncp_request2(struct ncp_server *server, int function, 218int ncp_request2(struct ncp_server *server, int function,
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 43289127b458..9264139bd8df 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -187,7 +187,7 @@ struct hh_cache
187{ 187{
188 struct hh_cache *hh_next; /* Next entry */ 188 struct hh_cache *hh_next; /* Next entry */
189 atomic_t hh_refcnt; /* number of users */ 189 atomic_t hh_refcnt; /* number of users */
190 unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP 190 __be16 hh_type; /* protocol identifier, f.e ETH_P_IP
191 * NOTE: For VLANs, this will be the 191 * NOTE: For VLANs, this will be the
192 * encapuslated type. --BLG 192 * encapuslated type. --BLG
193 */ 193 */
@@ -334,7 +334,6 @@ struct net_device
334 334
335 335
336 struct net_device_stats* (*get_stats)(struct net_device *dev); 336 struct net_device_stats* (*get_stats)(struct net_device *dev);
337 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
338 337
339 /* List of functions to handle Wireless Extensions (instead of ioctl). 338 /* List of functions to handle Wireless Extensions (instead of ioctl).
340 * See <net/iw_handler.h> for details. Jean II */ 339 * See <net/iw_handler.h> for details. Jean II */
@@ -1016,7 +1015,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1016} 1015}
1017 1016
1018/* On bonding slaves other than the currently active slave, suppress 1017/* On bonding slaves other than the currently active slave, suppress
1019 * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast. 1018 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1019 * ARP on active-backup slaves with arp_validate enabled.
1020 */ 1020 */
1021static inline int skb_bond_should_drop(struct sk_buff *skb) 1021static inline int skb_bond_should_drop(struct sk_buff *skb)
1022{ 1022{
@@ -1025,6 +1025,10 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1025 1025
1026 if (master && 1026 if (master &&
1027 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1027 (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
1028 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1029 skb->protocol == __constant_htons(ETH_P_ARP))
1030 return 0;
1031
1028 if (master->priv_flags & IFF_MASTER_ALB) { 1032 if (master->priv_flags & IFF_MASTER_ALB) {
1029 if (skb->pkt_type != PACKET_BROADCAST && 1033 if (skb->pkt_type != PACKET_BROADCAST &&
1030 skb->pkt_type != PACKET_MULTICAST) 1034 skb->pkt_type != PACKET_MULTICAST)
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 149e87c9ab13..44e39b61d9e7 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -46,11 +46,11 @@ struct arpt_arp {
46 struct arpt_devaddr_info tgt_devaddr; 46 struct arpt_devaddr_info tgt_devaddr;
47 47
48 /* ARP operation code. */ 48 /* ARP operation code. */
49 u_int16_t arpop, arpop_mask; 49 __be16 arpop, arpop_mask;
50 50
51 /* ARP hardware address and protocol address format. */ 51 /* ARP hardware address and protocol address format. */
52 u_int16_t arhrd, arhrd_mask; 52 __be16 arhrd, arhrd_mask;
53 u_int16_t arpro, arpro_mask; 53 __be16 arpro, arpro_mask;
54 54
55 /* The protocol address length is only accepted if it is 4 55 /* The protocol address length is only accepted if it is 4
56 * so there is no use in offering a way to do filtering on it. 56 * so there is no use in offering a way to do filtering on it.
diff --git a/include/linux/netfilter_bridge/ebt_mark_t.h b/include/linux/netfilter_bridge/ebt_mark_t.h
index 110fec6a40a2..6270f6f33693 100644
--- a/include/linux/netfilter_bridge/ebt_mark_t.h
+++ b/include/linux/netfilter_bridge/ebt_mark_t.h
@@ -1,6 +1,18 @@
1#ifndef __LINUX_BRIDGE_EBT_MARK_T_H 1#ifndef __LINUX_BRIDGE_EBT_MARK_T_H
2#define __LINUX_BRIDGE_EBT_MARK_T_H 2#define __LINUX_BRIDGE_EBT_MARK_T_H
3 3
4/* The target member is reused for adding new actions, the
5 * value of the real target is -1 to -NUM_STANDARD_TARGETS.
6 * For backward compatibility, the 4 lsb (2 would be enough,
7 * but let's play it safe) are kept to designate this target.
8 * The remaining bits designate the action. By making the set
9 * action 0xfffffff0, the result will look ok for older
10 * versions. [September 2006] */
11#define MARK_SET_VALUE (0xfffffff0)
12#define MARK_OR_VALUE (0xffffffe0)
13#define MARK_AND_VALUE (0xffffffd0)
14#define MARK_XOR_VALUE (0xffffffc0)
15
4struct ebt_mark_t_info 16struct ebt_mark_t_info
5{ 17{
6 unsigned long mark; 18 unsigned long mark;
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index ce02c984f3ba..5b63a231a76b 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -77,7 +77,7 @@ enum nf_ip_hook_priorities {
77#define SO_ORIGINAL_DST 80 77#define SO_ORIGINAL_DST 80
78 78
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80extern int ip_route_me_harder(struct sk_buff **pskb); 80extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type);
81extern int ip_xfrm_me_harder(struct sk_buff **pskb); 81extern int ip_xfrm_me_harder(struct sk_buff **pskb);
82extern unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 82extern unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
83 unsigned int dataoff, u_int8_t protocol); 83 unsigned int dataoff, u_int8_t protocol);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 51dbec1892c8..64e868034c4a 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -157,7 +157,7 @@ struct ip_conntrack_expect
157 unsigned int flags; 157 unsigned int flags;
158 158
159#ifdef CONFIG_IP_NF_NAT_NEEDED 159#ifdef CONFIG_IP_NF_NAT_NEEDED
160 u_int32_t saved_ip; 160 __be32 saved_ip;
161 /* This is the original per-proto part, used to map the 161 /* This is the original per-proto part, used to map the
162 * expected connection the way the recipient expects. */ 162 * expected connection the way the recipient expects. */
163 union ip_conntrack_manip_proto saved_proto; 163 union ip_conntrack_manip_proto saved_proto;
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
index 3cbff7379002..943cc6a4871d 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -30,7 +30,7 @@ struct ip_ct_h323_master {
30struct ip_conntrack_expect; 30struct ip_conntrack_expect;
31 31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr, 32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 u_int32_t * ip, u_int16_t * port); 33 __be32 * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new, 34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this); 35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new, 36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
@@ -38,11 +38,11 @@ extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb, 38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff, 39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr, 40 H245_TransportAddress * addr,
41 u_int32_t ip, u_int16_t port); 41 __be32 ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb, 42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff, 43 unsigned char **data, int dataoff,
44 TransportAddress * addr, 44 TransportAddress * addr,
45 u_int32_t ip, u_int16_t port); 45 __be32 ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb, 46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct, 47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo, 48 enum ip_conntrack_info ctinfo,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
index 2fdabdb4c0ef..c228bde74c33 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -23,13 +23,13 @@ union ip_conntrack_manip_proto
23 __be16 port; 23 __be16 port;
24 } tcp; 24 } tcp;
25 struct { 25 struct {
26 u_int16_t port; 26 __be16 port;
27 } udp; 27 } udp;
28 struct { 28 struct {
29 u_int16_t id; 29 __be16 id;
30 } icmp; 30 } icmp;
31 struct { 31 struct {
32 u_int16_t port; 32 __be16 port;
33 } sctp; 33 } sctp;
34 struct { 34 struct {
35 __be16 key; /* key is 32bit, pptp only uses 16 */ 35 __be16 key; /* key is 32bit, pptp only uses 16 */
@@ -39,7 +39,7 @@ union ip_conntrack_manip_proto
39/* The manipulable part of the tuple. */ 39/* The manipulable part of the tuple. */
40struct ip_conntrack_manip 40struct ip_conntrack_manip
41{ 41{
42 u_int32_t ip; 42 __be32 ip;
43 union ip_conntrack_manip_proto u; 43 union ip_conntrack_manip_proto u;
44}; 44};
45 45
@@ -50,22 +50,22 @@ struct ip_conntrack_tuple
50 50
51 /* These are the parts of the tuple which are fixed. */ 51 /* These are the parts of the tuple which are fixed. */
52 struct { 52 struct {
53 u_int32_t ip; 53 __be32 ip;
54 union { 54 union {
55 /* Add other protocols here. */ 55 /* Add other protocols here. */
56 u_int16_t all; 56 u_int16_t all;
57 57
58 struct { 58 struct {
59 u_int16_t port; 59 __be16 port;
60 } tcp; 60 } tcp;
61 struct { 61 struct {
62 u_int16_t port; 62 __be16 port;
63 } udp; 63 } udp;
64 struct { 64 struct {
65 u_int8_t type, code; 65 u_int8_t type, code;
66 } icmp; 66 } icmp;
67 struct { 67 struct {
68 u_int16_t port; 68 __be16 port;
69 } sctp; 69 } sctp;
70 struct { 70 struct {
71 __be16 key; /* key is 32bit, 71 __be16 key; /* key is 32bit,
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index 98f8407e4cb5..bdf553620ca1 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -33,7 +33,7 @@ struct ip_nat_range
33 unsigned int flags; 33 unsigned int flags;
34 34
35 /* Inclusive: network order. */ 35 /* Inclusive: network order. */
36 u_int32_t min_ip, max_ip; 36 __be32 min_ip, max_ip;
37 37
38 /* Inclusive: network order */ 38 /* Inclusive: network order */
39 union ip_conntrack_manip_proto min, max; 39 union ip_conntrack_manip_proto min, max;
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
index aa08d68c4841..a03507f465f8 100644
--- a/include/linux/netfilter_ipv4/ip_queue.h
+++ b/include/linux/netfilter_ipv4/ip_queue.h
@@ -26,7 +26,7 @@ typedef struct ipq_packet_msg {
26 unsigned int hook; /* Netfilter hook we rode in on */ 26 unsigned int hook; /* Netfilter hook we rode in on */
27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */ 27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */
28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ 28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
29 unsigned short hw_protocol; /* Hardware protocol (network order) */ 29 __be16 hw_protocol; /* Hardware protocol (network order) */
30 unsigned short hw_type; /* Hardware type */ 30 unsigned short hw_type; /* Hardware type */
31 unsigned char hw_addrlen; /* Hardware address length */ 31 unsigned char hw_addrlen; /* Hardware address length */
32 unsigned char hw_addr[8]; /* Hardware address */ 32 unsigned char hw_addr[8]; /* Hardware address */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index 3ecb3bd63676..34ab0fb736e2 100644
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ b/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -8,7 +8,7 @@
8 8
9struct ipt_iprange { 9struct ipt_iprange {
10 /* Inclusive: network order. */ 10 /* Inclusive: network order. */
11 u_int32_t min_ip, max_ip; 11 __be32 min_ip, max_ip;
12}; 12};
13 13
14struct ipt_iprange_info 14struct ipt_iprange_info
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 36f5bcf513b0..76ff54846ada 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -315,10 +315,6 @@ extern void nfs_end_data_update(struct inode *);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 316extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 317extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
318extern struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
319 const struct dentry *dentry,
320 struct nfs_fh *fh,
321 struct nfs_fattr *fattr);
322 318
323/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 319/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
324extern u32 root_nfs_parse_addr(char *name); /*__init*/ 320extern u32 root_nfs_parse_addr(char *name); /*__init*/
@@ -371,10 +367,12 @@ extern int nfs3_removexattr (struct dentry *, const char *name);
371 */ 367 */
372extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 368extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
373 unsigned long); 369 unsigned long);
374extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, 370extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
375 size_t count, loff_t pos); 371 const struct iovec *iov, unsigned long nr_segs,
376extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, 372 loff_t pos);
377 size_t count, loff_t pos); 373extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
374 const struct iovec *iov, unsigned long nr_segs,
375 loff_t pos);
378 376
379/* 377/*
380 * linux/fs/nfs/dir.c 378 * linux/fs/nfs/dir.c
diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h
index b75bb1b38d09..f0cc77790527 100644
--- a/include/linux/nfsd/const.h
+++ b/include/linux/nfsd/const.h
@@ -20,17 +20,31 @@
20#define NFSSVC_MAXVERS 3 20#define NFSSVC_MAXVERS 3
21 21
22/* 22/*
23 * Maximum blocksize supported by daemon currently at 32K 23 * Maximum blocksizes supported by daemon under various circumstances.
24 */ 24 */
25#define NFSSVC_MAXBLKSIZE (32*1024) 25#define NFSSVC_MAXBLKSIZE RPCSVC_MAXPAYLOAD
26/* NFSv2 is limited by the protocol specification, see RFC 1094 */
27#define NFSSVC_MAXBLKSIZE_V2 (8*1024)
26 28
27#ifdef __KERNEL__ 29#ifdef __KERNEL__
28 30
31#include <linux/sunrpc/msg_prot.h>
32
29#ifndef NFS_SUPER_MAGIC 33#ifndef NFS_SUPER_MAGIC
30# define NFS_SUPER_MAGIC 0x6969 34# define NFS_SUPER_MAGIC 0x6969
31#endif 35#endif
32 36
33#define NFSD_BUFSIZE (1024 + NFSSVC_MAXBLKSIZE) 37/*
38 * Largest number of bytes we need to allocate for an NFS
39 * call or reply. Used to control buffer sizes. We use
40 * the length of v3 WRITE, READDIR and READDIR replies
41 * which are an RPC header, up to 26 XDR units of reply
42 * data, and some page data.
43 *
44 * Note that accuracy here doesn't matter too much as the
45 * size is rounded up to a page size when allocating space.
46 */
47#define NFSD_BUFSIZE ((RPC_MAX_HEADER_WITH_AUTH+26)*XDR_UNIT + NFSSVC_MAXBLKSIZE)
34 48
35#ifdef CONFIG_NFSD_V4 49#ifdef CONFIG_NFSD_V4
36# define NFSSVC_XDRSIZE NFS4_SVC_XDRSIZE 50# define NFSSVC_XDRSIZE NFS4_SVC_XDRSIZE
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index d2a8abb5011a..6e78ea969f49 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -45,15 +45,36 @@
45 45
46#ifdef __KERNEL__ 46#ifdef __KERNEL__
47 47
48/*
49 * FS Locations
50 */
51
52#define MAX_FS_LOCATIONS 128
53
54struct nfsd4_fs_location {
55 char *hosts; /* colon separated list of hosts */
56 char *path; /* slash separated list of path components */
57};
58
59struct nfsd4_fs_locations {
60 uint32_t locations_count;
61 struct nfsd4_fs_location *locations;
62/* If we're not actually serving this data ourselves (only providing a
63 * list of replicas that do serve it) then we set "migrated": */
64 int migrated;
65};
66
48struct svc_export { 67struct svc_export {
49 struct cache_head h; 68 struct cache_head h;
50 struct auth_domain * ex_client; 69 struct auth_domain * ex_client;
51 int ex_flags; 70 int ex_flags;
52 struct vfsmount * ex_mnt; 71 struct vfsmount * ex_mnt;
53 struct dentry * ex_dentry; 72 struct dentry * ex_dentry;
73 char * ex_path;
54 uid_t ex_anon_uid; 74 uid_t ex_anon_uid;
55 gid_t ex_anon_gid; 75 gid_t ex_anon_gid;
56 int ex_fsid; 76 int ex_fsid;
77 struct nfsd4_fs_locations ex_fslocs;
57}; 78};
58 79
59/* an "export key" (expkey) maps a filehandlefragement to an 80/* an "export key" (expkey) maps a filehandlefragement to an
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 2dcad295fece..d0d4aae7085f 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -140,6 +140,12 @@ struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int);
140int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); 140int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *);
141#endif 141#endif
142 142
143enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };
144int nfsd_vers(int vers, enum vers_op change);
145void nfsd_reset_versions(void);
146int nfsd_create_serv(void);
147
148extern int nfsd_max_blksize;
143 149
144/* 150/*
145 * NFSv4 State 151 * NFSv4 State
@@ -210,6 +216,7 @@ void nfsd_lockd_shutdown(void);
210#define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE) 216#define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE)
211#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID) 217#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID)
212#define nfserr_resource __constant_htonl(NFSERR_RESOURCE) 218#define nfserr_resource __constant_htonl(NFSERR_RESOURCE)
219#define nfserr_moved __constant_htonl(NFSERR_MOVED)
213#define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE) 220#define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE)
214#define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH) 221#define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH)
215#define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED) 222#define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED)
@@ -286,7 +293,6 @@ static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh)
286/* 293/*
287 * The following attributes are currently not supported by the NFSv4 server: 294 * The following attributes are currently not supported by the NFSv4 server:
288 * ARCHIVE (deprecated anyway) 295 * ARCHIVE (deprecated anyway)
289 * FS_LOCATIONS (will be supported eventually)
290 * HIDDEN (unlikely to be supported any time soon) 296 * HIDDEN (unlikely to be supported any time soon)
291 * MIMETYPE (unlikely to be supported any time soon) 297 * MIMETYPE (unlikely to be supported any time soon)
292 * QUOTA_* (will be supported in a forthcoming patch) 298 * QUOTA_* (will be supported in a forthcoming patch)
@@ -302,7 +308,7 @@ static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh)
302 | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \ 308 | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \
303 | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \ 309 | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \
304 | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \ 310 | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \
305 | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_HOMOGENEOUS \ 311 | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_HOMOGENEOUS \
306 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ 312 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \
307 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) 313 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL)
308 314
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index f9edcd2ff3c8..069257ea99a0 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -269,14 +269,8 @@ fill_post_wcc(struct svc_fh *fhp)
269 fhp->fh_post_uid = inode->i_uid; 269 fhp->fh_post_uid = inode->i_uid;
270 fhp->fh_post_gid = inode->i_gid; 270 fhp->fh_post_gid = inode->i_gid;
271 fhp->fh_post_size = inode->i_size; 271 fhp->fh_post_size = inode->i_size;
272 if (inode->i_blksize) { 272 fhp->fh_post_blksize = BLOCK_SIZE;
273 fhp->fh_post_blksize = inode->i_blksize; 273 fhp->fh_post_blocks = inode->i_blocks;
274 fhp->fh_post_blocks = inode->i_blocks;
275 } else {
276 fhp->fh_post_blksize = BLOCK_SIZE;
277 /* how much do we care for accuracy with MinixFS? */
278 fhp->fh_post_blocks = (inode->i_size+511) >> 9;
279 }
280 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode)); 274 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
281 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode)); 275 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
282 fhp->fh_post_atime = inode->i_atime; 276 fhp->fh_post_atime = inode->i_atime;
@@ -296,8 +290,9 @@ fill_post_wcc(struct svc_fh *fhp)
296 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once 290 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once
297 * so, any changes here should be reflected there. 291 * so, any changes here should be reflected there.
298 */ 292 */
293
299static inline void 294static inline void
300fh_lock(struct svc_fh *fhp) 295fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
301{ 296{
302 struct dentry *dentry = fhp->fh_dentry; 297 struct dentry *dentry = fhp->fh_dentry;
303 struct inode *inode; 298 struct inode *inode;
@@ -316,11 +311,17 @@ fh_lock(struct svc_fh *fhp)
316 } 311 }
317 312
318 inode = dentry->d_inode; 313 inode = dentry->d_inode;
319 mutex_lock(&inode->i_mutex); 314 mutex_lock_nested(&inode->i_mutex, subclass);
320 fill_pre_wcc(fhp); 315 fill_pre_wcc(fhp);
321 fhp->fh_locked = 1; 316 fhp->fh_locked = 1;
322} 317}
323 318
319static inline void
320fh_lock(struct svc_fh *fhp)
321{
322 fh_lock_nested(fhp, I_MUTEX_NORMAL);
323}
324
324/* 325/*
325 * Unlock a file handle/inode 326 * Unlock a file handle/inode
326 */ 327 */
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
index 28a82fdd922f..7678cfbe9960 100644
--- a/include/linux/nfsd/stats.h
+++ b/include/linux/nfsd/stats.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/nfsd/stats.h 2 * linux/include/linux/nfsd/stats.h
3 * 3 *
4 * Statistics for NFS server. 4 * Statistics for NFS server.
5 * 5 *
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
index dae0faea2807..8bcddccb6c42 100644
--- a/include/linux/nfsd/syscall.h
+++ b/include/linux/nfsd/syscall.h
@@ -38,21 +38,6 @@
38#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ 38#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
39#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ 39#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
40 40
41/*
42 * Macros used to set version
43 */
44#define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << (_v)))
45#define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v)))
46#define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v)))
47
48#if defined(CONFIG_NFSD_V4)
49#define NFSCTL_VERALL (0x1c /* 0b011100 */)
50#elif defined(CONFIG_NFSD_V3)
51#define NFSCTL_VERALL (0x0c /* 0b001100 */)
52#else
53#define NFSCTL_VERALL (0x04 /* 0b000100 */)
54#endif
55
56/* SVC */ 41/* SVC */
57struct nfsctl_svc { 42struct nfsctl_svc {
58 unsigned short svc_port; 43 unsigned short svc_port;
@@ -134,8 +119,6 @@ extern int exp_delclient(struct nfsctl_client *ncp);
134extern int exp_export(struct nfsctl_export *nxp); 119extern int exp_export(struct nfsctl_export *nxp);
135extern int exp_unexport(struct nfsctl_export *nxp); 120extern int exp_unexport(struct nfsctl_export *nxp);
136 121
137extern unsigned int nfsd_versbits;
138
139#endif /* __KERNEL__ */ 122#endif /* __KERNEL__ */
140 123
141#endif /* NFSD_SYSCALL_H */ 124#endif /* NFSD_SYSCALL_H */
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 3f4f7142bbe3..0e53de87d886 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/inxlude/linux/nfsd/xdr.h 2 * linux/include/linux/nfsd/xdr.h
3 * 3 *
4 * XDR types for nfsd. This is mainly a typing exercise. 4 * XDR types for nfsd. This is mainly a typing exercise.
5 */ 5 */
@@ -30,7 +30,6 @@ struct nfsd_readargs {
30 struct svc_fh fh; 30 struct svc_fh fh;
31 __u32 offset; 31 __u32 offset;
32 __u32 count; 32 __u32 count;
33 struct kvec vec[RPCSVC_MAXPAGES];
34 int vlen; 33 int vlen;
35}; 34};
36 35
@@ -38,7 +37,6 @@ struct nfsd_writeargs {
38 svc_fh fh; 37 svc_fh fh;
39 __u32 offset; 38 __u32 offset;
40 int len; 39 int len;
41 struct kvec vec[RPCSVC_MAXPAGES];
42 int vlen; 40 int vlen;
43}; 41};
44 42
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index a4322741f8b9..474d882dc2f3 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -33,7 +33,6 @@ struct nfsd3_readargs {
33 struct svc_fh fh; 33 struct svc_fh fh;
34 __u64 offset; 34 __u64 offset;
35 __u32 count; 35 __u32 count;
36 struct kvec vec[RPCSVC_MAXPAGES];
37 int vlen; 36 int vlen;
38}; 37};
39 38
@@ -43,7 +42,6 @@ struct nfsd3_writeargs {
43 __u32 count; 42 __u32 count;
44 int stable; 43 int stable;
45 __u32 len; 44 __u32 len;
46 struct kvec vec[RPCSVC_MAXPAGES];
47 int vlen; 45 int vlen;
48}; 46};
49 47
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 77adba7d2281..66e642762a07 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -241,7 +241,6 @@ struct nfsd4_read {
241 stateid_t rd_stateid; /* request */ 241 stateid_t rd_stateid; /* request */
242 u64 rd_offset; /* request */ 242 u64 rd_offset; /* request */
243 u32 rd_length; /* request */ 243 u32 rd_length; /* request */
244 struct kvec rd_iov[RPCSVC_MAXPAGES];
245 int rd_vlen; 244 int rd_vlen;
246 struct file *rd_filp; 245 struct file *rd_filp;
247 246
@@ -326,7 +325,6 @@ struct nfsd4_write {
326 u64 wr_offset; /* request */ 325 u64 wr_offset; /* request */
327 u32 wr_stable_how; /* request */ 326 u32 wr_stable_how; /* request */
328 u32 wr_buflen; /* request */ 327 u32 wr_buflen; /* request */
329 struct kvec wr_vec[RPCSVC_MAXPAGES]; /* request */
330 int wr_vlen; 328 int wr_vlen;
331 329
332 u32 wr_bytes_written; /* response */ 330 u32 wr_bytes_written; /* response */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index c8f4d2f627d7..e16904e28c3a 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -4,6 +4,7 @@
4#ifndef LINUX_NMI_H 4#ifndef LINUX_NMI_H
5#define LINUX_NMI_H 5#define LINUX_NMI_H
6 6
7#include <linux/sched.h>
7#include <asm/irq.h> 8#include <asm/irq.h>
8 9
9/** 10/**
@@ -16,7 +17,7 @@
16#ifdef ARCH_HAS_NMI_WATCHDOG 17#ifdef ARCH_HAS_NMI_WATCHDOG
17extern void touch_nmi_watchdog(void); 18extern void touch_nmi_watchdog(void);
18#else 19#else
19# define touch_nmi_watchdog() do { } while(0) 20# define touch_nmi_watchdog() touch_softlockup_watchdog()
20#endif 21#endif
21 22
22#endif 23#endif
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 1a9ef3e627d1..5dce5c21822c 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -352,6 +352,7 @@ extern nodemask_t node_possible_map;
352#define node_possible(node) node_isset((node), node_possible_map) 352#define node_possible(node) node_isset((node), node_possible_map)
353#define first_online_node first_node(node_online_map) 353#define first_online_node first_node(node_online_map)
354#define next_online_node(nid) next_node((nid), node_online_map) 354#define next_online_node(nid) next_node((nid), node_online_map)
355int highest_possible_node_id(void);
355#else 356#else
356#define num_online_nodes() 1 357#define num_online_nodes() 1
357#define num_possible_nodes() 1 358#define num_possible_nodes() 1
@@ -359,6 +360,7 @@ extern nodemask_t node_possible_map;
359#define node_possible(node) ((node) == 0) 360#define node_possible(node) ((node) == 0)
360#define first_online_node 0 361#define first_online_node 0
361#define next_online_node(nid) (MAX_NUMNODES) 362#define next_online_node(nid) (MAX_NUMNODES)
363#define highest_possible_node_id() 0
362#endif 364#endif
363 365
364#define any_online_node(mask) \ 366#define any_online_node(mask) \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 7ff386a6ae87..10a43ed0527e 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -12,9 +12,10 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/rwsem.h> 14#include <linux/rwsem.h>
15#include <linux/srcu.h>
15 16
16/* 17/*
17 * Notifier chains are of three types: 18 * Notifier chains are of four types:
18 * 19 *
19 * Atomic notifier chains: Chain callbacks run in interrupt/atomic 20 * Atomic notifier chains: Chain callbacks run in interrupt/atomic
20 * context. Callouts are not allowed to block. 21 * context. Callouts are not allowed to block.
@@ -23,13 +24,27 @@
23 * Raw notifier chains: There are no restrictions on callbacks, 24 * Raw notifier chains: There are no restrictions on callbacks,
24 * registration, or unregistration. All locking and protection 25 * registration, or unregistration. All locking and protection
25 * must be provided by the caller. 26 * must be provided by the caller.
27 * SRCU notifier chains: A variant of blocking notifier chains, with
28 * the same restrictions.
26 * 29 *
27 * atomic_notifier_chain_register() may be called from an atomic context, 30 * atomic_notifier_chain_register() may be called from an atomic context,
28 * but blocking_notifier_chain_register() must be called from a process 31 * but blocking_notifier_chain_register() and srcu_notifier_chain_register()
29 * context. Ditto for the corresponding _unregister() routines. 32 * must be called from a process context. Ditto for the corresponding
33 * _unregister() routines.
30 * 34 *
31 * atomic_notifier_chain_unregister() and blocking_notifier_chain_unregister() 35 * atomic_notifier_chain_unregister(), blocking_notifier_chain_unregister(),
32 * _must not_ be called from within the call chain. 36 * and srcu_notifier_chain_unregister() _must not_ be called from within
37 * the call chain.
38 *
39 * SRCU notifier chains are an alternative form of blocking notifier chains.
40 * They use SRCU (Sleepable Read-Copy Update) instead of rw-semaphores for
41 * protection of the chain links. This means there is _very_ low overhead
42 * in srcu_notifier_call_chain(): no cache bounces and no memory barriers.
43 * As compensation, srcu_notifier_chain_unregister() is rather expensive.
44 * SRCU notifier chains should be used when the chain will be called very
45 * often but notifier_blocks will seldom be removed. Also, SRCU notifier
46 * chains are slightly more difficult to use because they require special
47 * runtime initialization.
33 */ 48 */
34 49
35struct notifier_block { 50struct notifier_block {
@@ -52,6 +67,12 @@ struct raw_notifier_head {
52 struct notifier_block *head; 67 struct notifier_block *head;
53}; 68};
54 69
70struct srcu_notifier_head {
71 struct mutex mutex;
72 struct srcu_struct srcu;
73 struct notifier_block *head;
74};
75
55#define ATOMIC_INIT_NOTIFIER_HEAD(name) do { \ 76#define ATOMIC_INIT_NOTIFIER_HEAD(name) do { \
56 spin_lock_init(&(name)->lock); \ 77 spin_lock_init(&(name)->lock); \
57 (name)->head = NULL; \ 78 (name)->head = NULL; \
@@ -64,6 +85,11 @@ struct raw_notifier_head {
64 (name)->head = NULL; \ 85 (name)->head = NULL; \
65 } while (0) 86 } while (0)
66 87
88/* srcu_notifier_heads must be initialized and cleaned up dynamically */
89extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
90#define srcu_cleanup_notifier_head(name) \
91 cleanup_srcu_struct(&(name)->srcu);
92
67#define ATOMIC_NOTIFIER_INIT(name) { \ 93#define ATOMIC_NOTIFIER_INIT(name) { \
68 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ 94 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
69 .head = NULL } 95 .head = NULL }
@@ -72,6 +98,7 @@ struct raw_notifier_head {
72 .head = NULL } 98 .head = NULL }
73#define RAW_NOTIFIER_INIT(name) { \ 99#define RAW_NOTIFIER_INIT(name) { \
74 .head = NULL } 100 .head = NULL }
101/* srcu_notifier_heads cannot be initialized statically */
75 102
76#define ATOMIC_NOTIFIER_HEAD(name) \ 103#define ATOMIC_NOTIFIER_HEAD(name) \
77 struct atomic_notifier_head name = \ 104 struct atomic_notifier_head name = \
@@ -91,6 +118,8 @@ extern int blocking_notifier_chain_register(struct blocking_notifier_head *,
91 struct notifier_block *); 118 struct notifier_block *);
92extern int raw_notifier_chain_register(struct raw_notifier_head *, 119extern int raw_notifier_chain_register(struct raw_notifier_head *,
93 struct notifier_block *); 120 struct notifier_block *);
121extern int srcu_notifier_chain_register(struct srcu_notifier_head *,
122 struct notifier_block *);
94 123
95extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *, 124extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *,
96 struct notifier_block *); 125 struct notifier_block *);
@@ -98,6 +127,8 @@ extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *,
98 struct notifier_block *); 127 struct notifier_block *);
99extern int raw_notifier_chain_unregister(struct raw_notifier_head *, 128extern int raw_notifier_chain_unregister(struct raw_notifier_head *,
100 struct notifier_block *); 129 struct notifier_block *);
130extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *,
131 struct notifier_block *);
101 132
102extern int atomic_notifier_call_chain(struct atomic_notifier_head *, 133extern int atomic_notifier_call_chain(struct atomic_notifier_head *,
103 unsigned long val, void *v); 134 unsigned long val, void *v);
@@ -105,6 +136,8 @@ extern int blocking_notifier_call_chain(struct blocking_notifier_head *,
105 unsigned long val, void *v); 136 unsigned long val, void *v);
106extern int raw_notifier_call_chain(struct raw_notifier_head *, 137extern int raw_notifier_call_chain(struct raw_notifier_head *,
107 unsigned long val, void *v); 138 unsigned long val, void *v);
139extern int srcu_notifier_call_chain(struct srcu_notifier_head *,
140 unsigned long val, void *v);
108 141
109#define NOTIFY_DONE 0x0000 /* Don't care */ 142#define NOTIFY_DONE 0x0000 /* Don't care */
110#define NOTIFY_OK 0x0001 /* Suits me */ 143#define NOTIFY_OK 0x0001 /* Suits me */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
new file mode 100644
index 000000000000..f6baecdeecd6
--- /dev/null
+++ b/include/linux/nsproxy.h
@@ -0,0 +1,52 @@
1#ifndef _LINUX_NSPROXY_H
2#define _LINUX_NSPROXY_H
3
4#include <linux/spinlock.h>
5#include <linux/sched.h>
6
7struct namespace;
8struct uts_namespace;
9struct ipc_namespace;
10
11/*
12 * A structure to contain pointers to all per-process
13 * namespaces - fs (mount), uts, network, sysvipc, etc.
14 *
15 * 'count' is the number of tasks holding a reference.
16 * The count for each namespace, then, will be the number
17 * of nsproxies pointing to it, not the number of tasks.
18 *
19 * The nsproxy is shared by tasks which share all namespaces.
20 * As soon as a single namespace is cloned or unshared, the
21 * nsproxy is copied.
22 */
23struct nsproxy {
24 atomic_t count;
25 spinlock_t nslock;
26 struct uts_namespace *uts_ns;
27 struct ipc_namespace *ipc_ns;
28 struct namespace *namespace;
29};
30extern struct nsproxy init_nsproxy;
31
32struct nsproxy *dup_namespaces(struct nsproxy *orig);
33int copy_namespaces(int flags, struct task_struct *tsk);
34void get_task_namespaces(struct task_struct *tsk);
35void free_nsproxy(struct nsproxy *ns);
36
37static inline void put_nsproxy(struct nsproxy *ns)
38{
39 if (atomic_dec_and_test(&ns->count)) {
40 free_nsproxy(ns);
41 }
42}
43
44static inline void exit_task_namespaces(struct task_struct *p)
45{
46 struct nsproxy *ns = p->nsproxy;
47 if (ns) {
48 put_nsproxy(ns);
49 p->nsproxy = NULL;
50 }
51}
52#endif
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9d7921dd50f0..4830a3bedfb2 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -128,12 +128,11 @@
128 128
129#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) 129#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags)
130#ifdef CONFIG_S390 130#ifdef CONFIG_S390
131#define SetPageUptodate(_page) \ 131static inline void SetPageUptodate(struct page *page)
132 do { \ 132{
133 struct page *__page = (_page); \ 133 if (!test_and_set_bit(PG_uptodate, &page->flags))
134 if (!test_and_set_bit(PG_uptodate, &__page->flags)) \ 134 page_test_and_clear_dirty(page);
135 page_test_and_clear_dirty(_page); \ 135}
136 } while (0)
137#else 136#else
138#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 137#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
139#endif 138#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8565b81d7fbc..5c604f5fad67 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -49,6 +49,7 @@
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/ioport.h> 50#include <linux/ioport.h>
51#include <linux/list.h> 51#include <linux/list.h>
52#include <linux/compiler.h>
52#include <linux/errno.h> 53#include <linux/errno.h>
53#include <linux/device.h> 54#include <linux/device.h>
54 55
@@ -346,6 +347,8 @@ struct pci_driver {
346 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ 347 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
347 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 348 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
348 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ 349 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
350 int (*suspend_late) (struct pci_dev *dev, pm_message_t state);
351 int (*resume_early) (struct pci_dev *dev);
349 int (*resume) (struct pci_dev *dev); /* Device woken up */ 352 int (*resume) (struct pci_dev *dev); /* Device woken up */
350 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ 353 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
351 void (*shutdown) (struct pci_dev *dev); 354 void (*shutdown) (struct pci_dev *dev);
@@ -353,6 +356,8 @@ struct pci_driver {
353 struct pci_error_handlers *err_handler; 356 struct pci_error_handlers *err_handler;
354 struct device_driver driver; 357 struct device_driver driver;
355 struct pci_dynids dynids; 358 struct pci_dynids dynids;
359
360 int multithread_probe;
356}; 361};
357 362
358#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 363#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver)
@@ -401,7 +406,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
401extern struct list_head pci_devices; /* list of all devices */ 406extern struct list_head pci_devices; /* list of all devices */
402 407
403void pcibios_fixup_bus(struct pci_bus *); 408void pcibios_fixup_bus(struct pci_bus *);
404int pcibios_enable_device(struct pci_dev *, int mask); 409int __must_check pcibios_enable_device(struct pci_dev *, int mask);
405char *pcibios_setup (char *str); 410char *pcibios_setup (char *str);
406 411
407/* Used only when drivers/pci/setup.c is used */ 412/* Used only when drivers/pci/setup.c is used */
@@ -428,7 +433,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
428struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 433struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
429void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 434void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
430unsigned int pci_scan_child_bus(struct pci_bus *bus); 435unsigned int pci_scan_child_bus(struct pci_bus *bus);
431void pci_bus_add_device(struct pci_dev *dev); 436int __must_check pci_bus_add_device(struct pci_dev *dev);
432void pci_read_bridge_bases(struct pci_bus *child); 437void pci_read_bridge_bases(struct pci_bus *child);
433struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 438struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res);
434int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 439int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
@@ -436,6 +441,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
436extern void pci_dev_put(struct pci_dev *dev); 441extern void pci_dev_put(struct pci_dev *dev);
437extern void pci_remove_bus(struct pci_bus *b); 442extern void pci_remove_bus(struct pci_bus *b);
438extern void pci_remove_bus_device(struct pci_dev *dev); 443extern void pci_remove_bus_device(struct pci_dev *dev);
444extern void pci_stop_bus_device(struct pci_dev *dev);
439void pci_setup_cardbus(struct pci_bus *bus); 445void pci_setup_cardbus(struct pci_bus *bus);
440 446
441/* Generic PCI functions exported to card drivers */ 447/* Generic PCI functions exported to card drivers */
@@ -488,19 +494,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
488 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 494 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val);
489} 495}
490 496
491int pci_enable_device(struct pci_dev *dev); 497int __must_check pci_enable_device(struct pci_dev *dev);
492int pci_enable_device_bars(struct pci_dev *dev, int mask); 498int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
493void pci_disable_device(struct pci_dev *dev); 499void pci_disable_device(struct pci_dev *dev);
494void pci_set_master(struct pci_dev *dev); 500void pci_set_master(struct pci_dev *dev);
495#define HAVE_PCI_SET_MWI 501#define HAVE_PCI_SET_MWI
496int pci_set_mwi(struct pci_dev *dev); 502int __must_check pci_set_mwi(struct pci_dev *dev);
497void pci_clear_mwi(struct pci_dev *dev); 503void pci_clear_mwi(struct pci_dev *dev);
498void pci_intx(struct pci_dev *dev, int enable); 504void pci_intx(struct pci_dev *dev, int enable);
499int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 505int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
500int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 506int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
501void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 507void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
502int pci_assign_resource(struct pci_dev *dev, int i); 508int __must_check pci_assign_resource(struct pci_dev *dev, int i);
503int pci_assign_resource_fixed(struct pci_dev *dev, int i); 509int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
504void pci_restore_bars(struct pci_dev *dev); 510void pci_restore_bars(struct pci_dev *dev);
505 511
506/* ROM control related routines */ 512/* ROM control related routines */
@@ -526,23 +532,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *);
526void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 532void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
527 int (*)(struct pci_dev *, u8, u8)); 533 int (*)(struct pci_dev *, u8, u8));
528#define HAVE_PCI_REQ_REGIONS 2 534#define HAVE_PCI_REQ_REGIONS 2
529int pci_request_regions(struct pci_dev *, const char *); 535int __must_check pci_request_regions(struct pci_dev *, const char *);
530void pci_release_regions(struct pci_dev *); 536void pci_release_regions(struct pci_dev *);
531int pci_request_region(struct pci_dev *, int, const char *); 537int __must_check pci_request_region(struct pci_dev *, int, const char *);
532void pci_release_region(struct pci_dev *, int); 538void pci_release_region(struct pci_dev *, int);
533 539
534/* drivers/pci/bus.c */ 540/* drivers/pci/bus.c */
535int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 541int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
536 resource_size_t size, resource_size_t align, 542 struct resource *res, resource_size_t size,
537 resource_size_t min, unsigned int type_mask, 543 resource_size_t align, resource_size_t min,
538 void (*alignf)(void *, struct resource *, 544 unsigned int type_mask,
539 resource_size_t, resource_size_t), 545 void (*alignf)(void *, struct resource *,
540 void *alignf_data); 546 resource_size_t, resource_size_t),
547 void *alignf_data);
541void pci_enable_bridges(struct pci_bus *bus); 548void pci_enable_bridges(struct pci_bus *bus);
542 549
543/* Proper probing supporting hot-pluggable devices */ 550/* Proper probing supporting hot-pluggable devices */
544int __pci_register_driver(struct pci_driver *, struct module *); 551int __must_check __pci_register_driver(struct pci_driver *, struct module *);
545static inline int pci_register_driver(struct pci_driver *driver) 552static inline int __must_check pci_register_driver(struct pci_driver *driver)
546{ 553{
547 return __pci_register_driver(driver, THIS_MODULE); 554 return __pci_register_driver(driver, THIS_MODULE);
548} 555}
@@ -588,6 +595,7 @@ struct msix_entry {
588 u16 entry; /* driver uses to specify entry, OS writes */ 595 u16 entry; /* driver uses to specify entry, OS writes */
589}; 596};
590 597
598
591#ifndef CONFIG_PCI_MSI 599#ifndef CONFIG_PCI_MSI
592static inline void pci_scan_msi_device(struct pci_dev *dev) {} 600static inline void pci_scan_msi_device(struct pci_dev *dev) {}
593static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} 601static inline int pci_enable_msi(struct pci_dev *dev) {return -1;}
@@ -606,6 +614,12 @@ extern void pci_disable_msix(struct pci_dev *dev);
606extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 614extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
607#endif 615#endif
608 616
617#ifdef CONFIG_HT_IRQ
618/* The functions a driver should call */
619int ht_create_irq(struct pci_dev *dev, int idx);
620void ht_destroy_irq(unsigned int irq);
621#endif /* CONFIG_HT_IRQ */
622
609extern void pci_block_user_cfg_access(struct pci_dev *dev); 623extern void pci_block_user_cfg_access(struct pci_dev *dev);
610extern void pci_unblock_user_cfg_access(struct pci_dev *dev); 624extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
611 625
@@ -780,12 +794,13 @@ enum pci_fixup_pass {
780void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 794void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
781 795
782extern int pci_pci_problems; 796extern int pci_pci_problems;
783#define PCIPCI_FAIL 1 797#define PCIPCI_FAIL 1 /* No PCI PCI DMA */
784#define PCIPCI_TRITON 2 798#define PCIPCI_TRITON 2
785#define PCIPCI_NATOMA 4 799#define PCIPCI_NATOMA 4
786#define PCIPCI_VIAETBF 8 800#define PCIPCI_VIAETBF 8
787#define PCIPCI_VSFX 16 801#define PCIPCI_VSFX 16
788#define PCIPCI_ALIMAGIK 32 802#define PCIPCI_ALIMAGIK 32 /* Need low latency setting */
803#define PCIAGP_FAIL 64 /* No PCI to AGP DMA */
789 804
790#endif /* __KERNEL__ */ 805#endif /* __KERNEL__ */
791#endif /* LINUX_PCI_H */ 806#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6a1e09834559..f069df245469 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -479,6 +479,7 @@
479 479
480#define PCI_VENDOR_ID_AMD 0x1022 480#define PCI_VENDOR_ID_AMD 0x1022
481#define PCI_DEVICE_ID_AMD_K8_NB 0x1100 481#define PCI_DEVICE_ID_AMD_K8_NB 0x1100
482#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103
482#define PCI_DEVICE_ID_AMD_LANCE 0x2000 483#define PCI_DEVICE_ID_AMD_LANCE 0x2000
483#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 484#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
484#define PCI_DEVICE_ID_AMD_SCSI 0x2020 485#define PCI_DEVICE_ID_AMD_SCSI 0x2020
@@ -506,6 +507,7 @@
506#define PCI_DEVICE_ID_AMD_8151_0 0x7454 507#define PCI_DEVICE_ID_AMD_8151_0 0x7454
507#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 508#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
508#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 509#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
510#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
509#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 511#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
510#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 512#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
511#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 513#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
@@ -1411,6 +1413,7 @@
1411#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1413#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1412#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1414#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1413#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1415#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1416#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1414#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1417#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1415#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1418#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
1416#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 1419#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
@@ -1482,9 +1485,6 @@
1482#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1485#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1483#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1486#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1484#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1487#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1485#define PCI_DEVICE_ID_MARVELL_GT96100 0x9652
1486#define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653
1487
1488 1488
1489#define PCI_VENDOR_ID_V3 0x11b0 1489#define PCI_VENDOR_ID_V3 0x11b0
1490#define PCI_DEVICE_ID_V3_V960 0x0001 1490#define PCI_DEVICE_ID_V3_V960 0x0001
@@ -1615,8 +1615,6 @@
1615#define PCI_VENDOR_ID_ROCKWELL 0x127A 1615#define PCI_VENDOR_ID_ROCKWELL 0x127A
1616 1616
1617#define PCI_VENDOR_ID_ITE 0x1283 1617#define PCI_VENDOR_ID_ITE 0x1283
1618#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
1619#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
1620#define PCI_DEVICE_ID_ITE_8211 0x8211 1618#define PCI_DEVICE_ID_ITE_8211 0x8211
1621#define PCI_DEVICE_ID_ITE_8212 0x8212 1619#define PCI_DEVICE_ID_ITE_8212 0x8212
1622#define PCI_DEVICE_ID_ITE_8872 0x8872 1620#define PCI_DEVICE_ID_ITE_8872 0x8872
@@ -1883,6 +1881,8 @@
1883#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 1881#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
1884#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 1882#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402
1885 1883
1884#define PCI_VENDOR_ID_SIPACKETS 0x14d9
1885#define PCI_DEVICE_ID_SP1011 0x0010
1886 1886
1887#define PCI_VENDOR_ID_AFAVLAB 0x14db 1887#define PCI_VENDOR_ID_AFAVLAB 0x14db
1888#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 1888#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180
@@ -1905,6 +1905,7 @@
1905#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1905#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
1906#define PCI_DEVICE_ID_TIGON3_5720 0x1658 1906#define PCI_DEVICE_ID_TIGON3_5720 0x1658
1907#define PCI_DEVICE_ID_TIGON3_5721 0x1659 1907#define PCI_DEVICE_ID_TIGON3_5721 0x1659
1908#define PCI_DEVICE_ID_TIGON3_5722 0x165a
1908#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 1909#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
1909#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 1910#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
1910#define PCI_DEVICE_ID_TIGON3_5714 0x1668 1911#define PCI_DEVICE_ID_TIGON3_5714 0x1668
@@ -1914,6 +1915,7 @@
1914#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 1915#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
1915#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 1916#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
1916#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 1917#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
1918#define PCI_DEVICE_ID_TIGON3_5756 0x1674
1917#define PCI_DEVICE_ID_TIGON3_5750 0x1676 1919#define PCI_DEVICE_ID_TIGON3_5750 0x1676
1918#define PCI_DEVICE_ID_TIGON3_5751 0x1677 1920#define PCI_DEVICE_ID_TIGON3_5751 0x1677
1919#define PCI_DEVICE_ID_TIGON3_5715 0x1678 1921#define PCI_DEVICE_ID_TIGON3_5715 0x1678
@@ -1943,6 +1945,8 @@
1943#define PCI_DEVICE_ID_TIGON3_5901 0x170d 1945#define PCI_DEVICE_ID_TIGON3_5901 0x170d
1944#define PCI_DEVICE_ID_BCM4401B1 0x170c 1946#define PCI_DEVICE_ID_BCM4401B1 0x170c
1945#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e 1947#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
1948#define PCI_DEVICE_ID_TIGON3_5906 0x1712
1949#define PCI_DEVICE_ID_TIGON3_5906M 0x1713
1946#define PCI_DEVICE_ID_BCM4401 0x4401 1950#define PCI_DEVICE_ID_BCM4401 0x4401
1947#define PCI_DEVICE_ID_BCM4401B0 0x4402 1951#define PCI_DEVICE_ID_BCM4401B0 0x4402
1948 1952
@@ -1993,6 +1997,7 @@
1993#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612 1997#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612
1994 1998
1995#define PCI_VENDOR_ID_SIBYTE 0x166d 1999#define PCI_VENDOR_ID_SIBYTE 0x166d
2000#define PCI_DEVICE_ID_BCM1250_PCI 0x0001
1996#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2001#define PCI_DEVICE_ID_BCM1250_HT 0x0002
1997 2002
1998#define PCI_VENDOR_ID_NETCELL 0x169c 2003#define PCI_VENDOR_ID_NETCELL 0x169c
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 96930cb5927c..c312a12ad2d6 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -12,6 +12,11 @@
12 * PCI Local Bus Specification 12 * PCI Local Bus Specification
13 * PCI to PCI Bridge Specification 13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide 14 * PCI System Design Guide
15 *
16 * For hypertransport information, please consult the following manuals
17 * from http://www.hypertransport.org
18 *
19 * The Hypertransport I/O Link Specification
15 */ 20 */
16 21
17#ifndef LINUX_PCI_REGS_H 22#ifndef LINUX_PCI_REGS_H
@@ -196,7 +201,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 201#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 202#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 203#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ 204#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ 205#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */
201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 206#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 207#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
@@ -463,4 +468,20 @@
463#define PCI_PWR_CAP 12 /* Capability */ 468#define PCI_PWR_CAP 12 /* Capability */
464#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ 469#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
465 470
471/* Hypertransport sub capability types */
472#define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */
473#define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */
474#define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */
475#define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */
476#define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */
477#define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */
478#define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */
479#define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */
480#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */
481#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */
482#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */
483#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */
484#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */
485
486
466#endif /* LINUX_PCI_REGS_H */ 487#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index b44e01a70914..6cd91e3f9820 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -62,6 +62,12 @@ struct pcie_port_service_driver {
62 int (*suspend) (struct pcie_device *dev, pm_message_t state); 62 int (*suspend) (struct pcie_device *dev, pm_message_t state);
63 int (*resume) (struct pcie_device *dev); 63 int (*resume) (struct pcie_device *dev);
64 64
65 /* Service Error Recovery Handler */
66 struct pci_error_handlers *err_handler;
67
68 /* Link Reset Capability - AER service driver specific */
69 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
70
65 const struct pcie_port_service_id *id_table; 71 const struct pcie_port_service_id *id_table;
66 struct device_driver driver; 72 struct device_driver driver;
67}; 73};
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 3835a9642f13..46ec72fa2c84 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -74,7 +74,7 @@ static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
74 return 0; 74 return 0;
75} 75}
76 76
77static inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 77static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
78{ 78{
79 return kzalloc(size, gfp); 79 return kzalloc(size, gfp);
80} 80}
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 29960b03bef7..2c0007d17218 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -68,6 +68,8 @@ extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type));
68extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid, 68extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid,
69 enum pid_type)); 69 enum pid_type));
70 70
71extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
72
71/* 73/*
72 * attach_pid() and detach_pid() must be called with the tasklist_lock 74 * attach_pid() and detach_pid() must be called with the tasklist_lock
73 * write-held. 75 * write-held.
@@ -76,6 +78,8 @@ extern int FASTCALL(attach_pid(struct task_struct *task,
76 enum pid_type type, int nr)); 78 enum pid_type type, int nr));
77 79
78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 80extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
81extern void FASTCALL(transfer_pid(struct task_struct *old,
82 struct task_struct *new, enum pid_type));
79 83
80/* 84/*
81 * look up a PID in the hash table. Must be called with the tasklist_lock 85 * look up a PID in the hash table. Must be called with the tasklist_lock
@@ -87,33 +91,42 @@ extern struct pid *FASTCALL(find_pid(int nr));
87 * Lookup a PID in the hash table, and return with it's count elevated. 91 * Lookup a PID in the hash table, and return with it's count elevated.
88 */ 92 */
89extern struct pid *find_get_pid(int nr); 93extern struct pid *find_get_pid(int nr);
94extern struct pid *find_ge_pid(int nr);
90 95
91extern struct pid *alloc_pid(void); 96extern struct pid *alloc_pid(void);
92extern void FASTCALL(free_pid(struct pid *pid)); 97extern void FASTCALL(free_pid(struct pid *pid));
93 98
94#define pid_next(task, type) \ 99static inline pid_t pid_nr(struct pid *pid)
95 ((task)->pids[(type)].node.next) 100{
96 101 pid_t nr = 0;
97#define pid_next_task(task, type) \ 102 if (pid)
98 hlist_entry(pid_next(task, type), struct task_struct, \ 103 nr = pid->nr;
99 pids[(type)].node) 104 return nr;
105}
100 106
101 107
102/* We could use hlist_for_each_entry_rcu here but it takes more arguments
103 * than the do_each_task_pid/while_each_task_pid. So we roll our own
104 * to preserve the existing interface.
105 */
106#define do_each_task_pid(who, type, task) \ 108#define do_each_task_pid(who, type, task) \
107 if ((task = find_task_by_pid_type(type, who))) { \ 109 do { \
108 prefetch(pid_next(task, type)); \ 110 struct hlist_node *pos___; \
109 do { 111 struct pid *pid___ = find_pid(who); \
112 if (pid___ != NULL) \
113 hlist_for_each_entry_rcu((task), pos___, \
114 &pid___->tasks[type], pids[type].node) {
110 115
111#define while_each_task_pid(who, type, task) \ 116#define while_each_task_pid(who, type, task) \
112 } while (pid_next(task, type) && ({ \ 117 } \
113 task = pid_next_task(task, type); \ 118 } while (0)
114 rcu_dereference(task); \ 119
115 prefetch(pid_next(task, type)); \ 120
116 1; }) ); \ 121#define do_each_pid_task(pid, type, task) \
117 } 122 do { \
123 struct hlist_node *pos___; \
124 if (pid != NULL) \
125 hlist_for_each_entry_rcu((task), pos___, \
126 &pid->tasks[type], pids[type].node) {
127
128#define while_each_pid_task(pid, type, task) \
129 } \
130 } while (0)
118 131
119#endif /* _LINUX_PID_H */ 132#endif /* _LINUX_PID_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 782090c68932..29cd6dee13db 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -49,6 +49,8 @@ struct platform_driver {
49 int (*remove)(struct platform_device *); 49 int (*remove)(struct platform_device *);
50 void (*shutdown)(struct platform_device *); 50 void (*shutdown)(struct platform_device *);
51 int (*suspend)(struct platform_device *, pm_message_t state); 51 int (*suspend)(struct platform_device *, pm_message_t state);
52 int (*suspend_late)(struct platform_device *, pm_message_t state);
53 int (*resume_early)(struct platform_device *);
52 int (*resume)(struct platform_device *); 54 int (*resume)(struct platform_device *);
53 struct device_driver driver; 55 struct device_driver driver;
54}; 56};
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 658c1b93d5bb..6b27e07aef19 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -142,29 +142,61 @@ typedef struct pm_message {
142} pm_message_t; 142} pm_message_t;
143 143
144/* 144/*
145 * There are 4 important states driver can be in: 145 * Several driver power state transitions are externally visible, affecting
146 * ON -- driver is working 146 * the state of pending I/O queues and (for drivers that touch hardware)
147 * FREEZE -- stop operations and apply whatever policy is applicable to a 147 * interrupts, wakeups, DMA, and other hardware state. There may also be
148 * suspended driver of that class, freeze queues for block like IDE 148 * internal transitions to various low power modes, which are transparent
149 * does, drop packets for ethernet, etc... stop DMA engine too etc... 149 * to the rest of the driver stack (such as a driver that's ON gating off
150 * so a consistent image can be saved; but do not power any hardware 150 * clocks which are not in active use).
151 * down.
152 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as
153 * possible. Roughly pci D3.
154 * 151 *
155 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 152 * One transition is triggered by resume(), after a suspend() call; the
156 * (SUSPEND). We'll need to fix the drivers. So yes, putting 3 to all different 153 * message is implicit:
157 * defines is intentional, and will go away as soon as drivers are fixed. Also 154 *
158 * note that typedef is neccessary, we'll probably want to switch to 155 * ON Driver starts working again, responding to hardware events
159 * typedef struct pm_message_t { int event; int flags; } pm_message_t 156 * and software requests. The hardware may have gone through
160 * or something similar soon. 157 * a power-off reset, or it may have maintained state from the
158 * previous suspend() which the driver will rely on while
159 * resuming. On most platforms, there are no restrictions on
160 * availability of resources like clocks during resume().
161 *
162 * Other transitions are triggered by messages sent using suspend(). All
163 * these transitions quiesce the driver, so that I/O queues are inactive.
164 * That commonly entails turning off IRQs and DMA; there may be rules
165 * about how to quiesce that are specific to the bus or the device's type.
166 * (For example, network drivers mark the link state.) Other details may
167 * differ according to the message:
168 *
169 * SUSPEND Quiesce, enter a low power device state appropriate for
170 * the upcoming system state (such as PCI_D3hot), and enable
171 * wakeup events as appropriate.
172 *
173 * FREEZE Quiesce operations so that a consistent image can be saved;
174 * but do NOT otherwise enter a low power device state, and do
175 * NOT emit system wakeup events.
176 *
177 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring
178 * the system from a snapshot taken after an earlier FREEZE.
179 * Some drivers will need to reset their hardware state instead
180 * of preserving it, to ensure that it's never mistaken for the
181 * state which that earlier snapshot had set up.
182 *
183 * A minimally power-aware driver treats all messages as SUSPEND, fully
184 * reinitializes its device during resume() -- whether or not it was reset
185 * during the suspend/resume cycle -- and can't issue wakeup events.
186 *
187 * More power-aware drivers may also use low power states at runtime as
188 * well as during system sleep states like PM_SUSPEND_STANDBY. They may
189 * be able to use wakeup events to exit from runtime low-power states,
190 * or from system low-power states such as standby or suspend-to-RAM.
161 */ 191 */
162 192
163#define PM_EVENT_ON 0 193#define PM_EVENT_ON 0
164#define PM_EVENT_FREEZE 1 194#define PM_EVENT_FREEZE 1
165#define PM_EVENT_SUSPEND 2 195#define PM_EVENT_SUSPEND 2
196#define PM_EVENT_PRETHAW 3
166 197
167#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) 198#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
199#define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, })
168#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) 200#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
169#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) 201#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
170 202
@@ -190,6 +222,7 @@ extern void device_resume(void);
190extern suspend_disk_method_t pm_disk_mode; 222extern suspend_disk_method_t pm_disk_mode;
191 223
192extern int device_suspend(pm_message_t state); 224extern int device_suspend(pm_message_t state);
225extern int device_prepare_suspend(pm_message_t state);
193 226
194#define device_set_wakeup_enable(dev,val) \ 227#define device_set_wakeup_enable(dev,val) \
195 ((dev)->power.should_wakeup = !!(val)) 228 ((dev)->power.should_wakeup = !!(val))
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 95572c434bc9..a7dd38f30ade 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -72,6 +72,7 @@ struct k_clock {
72 int (*timer_create) (struct k_itimer *timer); 72 int (*timer_create) (struct k_itimer *timer);
73 int (*nsleep) (const clockid_t which_clock, int flags, 73 int (*nsleep) (const clockid_t which_clock, int flags,
74 struct timespec *, struct timespec __user *); 74 struct timespec *, struct timespec __user *);
75 long (*nsleep_restart) (struct restart_block *restart_block);
75 int (*timer_set) (struct k_itimer * timr, int flags, 76 int (*timer_set) (struct k_itimer * timr, int flags,
76 struct itimerspec * new_setting, 77 struct itimerspec * new_setting,
77 struct itimerspec * old_setting); 78 struct itimerspec * old_setting);
@@ -97,6 +98,7 @@ int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
97int posix_cpu_timer_create(struct k_itimer *timer); 98int posix_cpu_timer_create(struct k_itimer *timer);
98int posix_cpu_nsleep(const clockid_t which_clock, int flags, 99int posix_cpu_nsleep(const clockid_t which_clock, int flags,
99 struct timespec *rqtp, struct timespec __user *rmtp); 100 struct timespec *rqtp, struct timespec __user *rmtp);
101long posix_cpu_nsleep_restart(struct restart_block *restart_block);
100int posix_cpu_timer_set(struct k_itimer *timer, int flags, 102int posix_cpu_timer_set(struct k_itimer *timer, int flags,
101 struct itimerspec *new, struct itimerspec *old); 103 struct itimerspec *new, struct itimerspec *old);
102int posix_cpu_timer_del(struct k_itimer *timer); 104int posix_cpu_timer_del(struct k_itimer *timer);
@@ -111,4 +113,6 @@ void posix_cpu_timers_exit_group(struct task_struct *task);
111void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, 113void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
112 cputime_t *newval, cputime_t *oldval); 114 cputime_t *newval, cputime_t *oldval);
113 115
116long clock_nanosleep_restart(struct restart_block *restart_block);
117
114#endif 118#endif
diff --git a/include/linux/ppdev.h b/include/linux/ppdev.h
index f376a7598a78..dc18c5d23ebe 100644
--- a/include/linux/ppdev.h
+++ b/include/linux/ppdev.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/char/ppdev.h 2 * linux/include/linux/ppdev.h
3 * 3 *
4 * User-space parallel port device driver (header file). 4 * User-space parallel port device driver (header file).
5 * 5 *
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 3435ca38dd14..87dec8fe6de9 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -244,13 +244,15 @@ static inline void kclist_add(struct kcore_list *new, void *addr, size_t size)
244extern void kclist_add(struct kcore_list *, void *, size_t); 244extern void kclist_add(struct kcore_list *, void *, size_t);
245#endif 245#endif
246 246
247union proc_op {
248 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **);
249 int (*proc_read)(struct task_struct *task, char *page);
250};
251
247struct proc_inode { 252struct proc_inode {
248 struct pid *pid; 253 struct pid *pid;
249 int fd; 254 int fd;
250 union { 255 union proc_op op;
251 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **);
252 int (*proc_read)(struct task_struct *task, char *page);
253 } op;
254 struct proc_dir_entry *pde; 256 struct proc_dir_entry *pde;
255 struct inode vfs_inode; 257 struct inode vfs_inode;
256}; 258};
@@ -268,7 +270,9 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
268struct proc_maps_private { 270struct proc_maps_private {
269 struct pid *pid; 271 struct pid *pid;
270 struct task_struct *task; 272 struct task_struct *task;
273#ifdef CONFIG_MMU
271 struct vm_area_struct *tail_vma; 274 struct vm_area_struct *tail_vma;
275#endif
272}; 276};
273 277
274#endif /* _LINUX_PROC_FS_H */ 278#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/pspace.h b/include/linux/pspace.h
new file mode 100644
index 000000000000..91d48b8b2d99
--- /dev/null
+++ b/include/linux/pspace.h
@@ -0,0 +1,23 @@
1#ifndef _LINUX_PSPACE_H
2#define _LINUX_PSPACE_H
3
4#include <linux/sched.h>
5#include <linux/mm.h>
6#include <linux/threads.h>
7#include <linux/pid.h>
8
9struct pidmap {
10 atomic_t nr_free;
11 void *page;
12};
13
14#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
15
16struct pspace {
17 struct pidmap pidmap[PIDMAP_ENTRIES];
18 int last_pid;
19};
20
21extern struct pspace init_pspace;
22
23#endif /* _LINUX_PSPACE_H */
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 8b2749a259dc..eeb1976ef7bf 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -16,8 +16,8 @@
16#define PTRACE_KILL 8 16#define PTRACE_KILL 8
17#define PTRACE_SINGLESTEP 9 17#define PTRACE_SINGLESTEP 9
18 18
19#define PTRACE_ATTACH 0x10 19#define PTRACE_ATTACH 16
20#define PTRACE_DETACH 0x11 20#define PTRACE_DETACH 17
21 21
22#define PTRACE_SYSCALL 24 22#define PTRACE_SYSCALL 24
23 23
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 63df898fe2e9..84d887751855 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -265,6 +265,8 @@ int bitmap_update_sb(struct bitmap *bitmap);
265int bitmap_setallbits(struct bitmap *bitmap); 265int bitmap_setallbits(struct bitmap *bitmap);
266void bitmap_write_all(struct bitmap *bitmap); 266void bitmap_write_all(struct bitmap *bitmap);
267 267
268void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e);
269
268/* these are exported */ 270/* these are exported */
269int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, 271int bitmap_startwrite(struct bitmap *bitmap, sector_t offset,
270 unsigned long sectors, int behind); 272 unsigned long sectors, int behind);
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index eb3e547c8fee..866a1e2b0ce0 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -53,6 +53,8 @@
53#include <linux/raid/md_u.h> 53#include <linux/raid/md_u.h>
54#include <linux/raid/md_k.h> 54#include <linux/raid/md_k.h>
55 55
56#ifdef CONFIG_MD
57
56/* 58/*
57 * Different major versions are not compatible. 59 * Different major versions are not compatible.
58 * Different minor versions are only downward compatible. 60 * Different minor versions are only downward compatible.
@@ -93,7 +95,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
93extern void md_do_sync(mddev_t *mddev); 95extern void md_do_sync(mddev_t *mddev);
94extern void md_new_event(mddev_t *mddev); 96extern void md_new_event(mddev_t *mddev);
95 97
96extern void md_update_sb(mddev_t * mddev);
97 98
99#endif /* CONFIG_MD */
98#endif 100#endif
99 101
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index d28890295852..8245c282168b 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -18,6 +18,8 @@
18/* and dm-bio-list.h is not under include/linux because.... ??? */ 18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h" 19#include "../../../drivers/md/dm-bio-list.h"
20 20
21#ifdef CONFIG_BLOCK
22
21#define LEVEL_MULTIPATH (-4) 23#define LEVEL_MULTIPATH (-4)
22#define LEVEL_LINEAR (-1) 24#define LEVEL_LINEAR (-1)
23#define LEVEL_FAULTY (-5) 25#define LEVEL_FAULTY (-5)
@@ -29,18 +31,15 @@
29#define LEVEL_NONE (-1000000) 31#define LEVEL_NONE (-1000000)
30 32
31#define MaxSector (~(sector_t)0) 33#define MaxSector (~(sector_t)0)
32#define MD_THREAD_NAME_MAX 14
33 34
34typedef struct mddev_s mddev_t; 35typedef struct mddev_s mddev_t;
35typedef struct mdk_rdev_s mdk_rdev_t; 36typedef struct mdk_rdev_s mdk_rdev_t;
36 37
37#define MAX_MD_DEVS 256 /* Max number of md dev */
38
39/* 38/*
40 * options passed in raidrun: 39 * options passed in raidrun:
41 */ 40 */
42 41
43/* Currently this must fix in an 'int' */ 42/* Currently this must fit in an 'int' */
44#define MAX_CHUNK_SIZE (1<<30) 43#define MAX_CHUNK_SIZE (1<<30)
45 44
46/* 45/*
@@ -114,7 +113,11 @@ struct mddev_s
114 dev_t unit; 113 dev_t unit;
115 int md_minor; 114 int md_minor;
116 struct list_head disks; 115 struct list_head disks;
117 int sb_dirty; 116 unsigned long flags;
117#define MD_CHANGE_DEVS 0 /* Some device status has changed */
118#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
119#define MD_CHANGE_PENDING 2 /* superblock update in progress */
120
118 int ro; 121 int ro;
119 122
120 struct gendisk *gendisk; 123 struct gendisk *gendisk;
@@ -362,5 +365,6 @@ static inline void safe_put_page(struct page *p)
362 if (p) put_page(p); 365 if (p) put_page(p);
363} 366}
364 367
368#endif /* CONFIG_BLOCK */
365#endif 369#endif
366 370
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h
index 81da20ccec4d..7192035fc4b0 100644
--- a/include/linux/raid/md_u.h
+++ b/include/linux/raid/md_u.h
@@ -41,7 +41,7 @@
41 41
42/* usage */ 42/* usage */
43#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) 43#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
44#define START_ARRAY _IO (MD_MAJOR, 0x31) 44/* 0x31 was START_ARRAY */
45#define STOP_ARRAY _IO (MD_MAJOR, 0x32) 45#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
46#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) 46#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
47#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) 47#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 3009c813d83d..0a9ba7c3302e 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -30,7 +30,6 @@ struct r1_private_data_s {
30 mddev_t *mddev; 30 mddev_t *mddev;
31 mirror_info_t *mirrors; 31 mirror_info_t *mirrors;
32 int raid_disks; 32 int raid_disks;
33 int working_disks;
34 int last_used; 33 int last_used;
35 sector_t next_seq_sect; 34 sector_t next_seq_sect;
36 spinlock_t device_lock; 35 spinlock_t device_lock;
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
index c41e56a7c090..e9091cfeb286 100644
--- a/include/linux/raid/raid10.h
+++ b/include/linux/raid/raid10.h
@@ -16,7 +16,6 @@ struct r10_private_data_s {
16 mddev_t *mddev; 16 mddev_t *mddev;
17 mirror_info_t *mirrors; 17 mirror_info_t *mirrors;
18 int raid_disks; 18 int raid_disks;
19 int working_disks;
20 spinlock_t device_lock; 19 spinlock_t device_lock;
21 20
22 /* geometry */ 21 /* geometry */
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 20ed4c997636..f13299a15591 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -195,8 +195,9 @@ struct stripe_head {
195 * it to the count of prereading stripes. 195 * it to the count of prereading stripes.
196 * When write is initiated, or the stripe refcnt == 0 (just in case) we 196 * When write is initiated, or the stripe refcnt == 0 (just in case) we
197 * clear the PREREAD_ACTIVE flag and decrement the count 197 * clear the PREREAD_ACTIVE flag and decrement the count
198 * Whenever the delayed queue is empty and the device is not plugged, we 198 * Whenever the 'handle' queue is empty and the device is not plugged, we
199 * move any strips from delayed to handle and clear the DELAYED flag and set PREREAD_ACTIVE. 199 * move any strips from delayed to handle and clear the DELAYED flag and set
200 * PREREAD_ACTIVE.
200 * In stripe_handle, if we find pre-reading is necessary, we do it if 201 * In stripe_handle, if we find pre-reading is necessary, we do it if
201 * PREREAD_ACTIVE is set, else we set DELAYED which will send it to the delayed queue. 202 * PREREAD_ACTIVE is set, else we set DELAYED which will send it to the delayed queue.
202 * HANDLE gets cleared if stripe_handle leave nothing locked. 203 * HANDLE gets cleared if stripe_handle leave nothing locked.
@@ -213,7 +214,7 @@ struct raid5_private_data {
213 struct disk_info *spare; 214 struct disk_info *spare;
214 int chunk_size, level, algorithm; 215 int chunk_size, level, algorithm;
215 int max_degraded; 216 int max_degraded;
216 int raid_disks, working_disks, failed_disks; 217 int raid_disks;
217 int max_nr_stripes; 218 int max_nr_stripes;
218 219
219 /* used during an expand */ 220 /* used during an expand */
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 00b340ba6612..b160fb18e8d6 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -17,5 +17,6 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
17 17
18extern const struct file_operations ramfs_file_operations; 18extern const struct file_operations ramfs_file_operations;
19extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
20extern int __init init_rootfs(void);
20 21
21#endif 22#endif
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 8d5382e62c08..344bc3495ddb 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -133,7 +133,7 @@ static inline void rb_set_color(struct rb_node *rb, int color)
133#define rb_entry(ptr, type, member) container_of(ptr, type, member) 133#define rb_entry(ptr, type, member) container_of(ptr, type, member)
134 134
135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) 135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
136#define RB_EMPTY_NODE(node) (rb_parent(node) != node) 136#define RB_EMPTY_NODE(node) (rb_parent(node) == node)
137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) 137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
138 138
139extern void rb_insert_color(struct rb_node *, struct rb_root *); 139extern void rb_insert_color(struct rb_node *, struct rb_root *);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index b4ca73d65891..c6b7485eac7c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -19,7 +19,7 @@
19 * 19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com> 20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * 21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com> 22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers: 24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf 25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
@@ -66,6 +66,8 @@ struct rcu_ctrlblk {
66 long completed; /* Number of the last completed batch */ 66 long completed; /* Number of the last completed batch */
67 int next_pending; /* Is the next batch already waiting? */ 67 int next_pending; /* Is the next batch already waiting? */
68 68
69 int signaled;
70
69 spinlock_t lock ____cacheline_internodealigned_in_smp; 71 spinlock_t lock ____cacheline_internodealigned_in_smp;
70 cpumask_t cpumask; /* CPUs that need to switch in order */ 72 cpumask_t cpumask; /* CPUs that need to switch in order */
71 /* for current batch to proceed. */ 73 /* for current batch to proceed. */
@@ -106,9 +108,6 @@ struct rcu_data {
106 long blimit; /* Upper limit on a processed batch */ 108 long blimit; /* Upper limit on a processed batch */
107 int cpu; 109 int cpu;
108 struct rcu_head barrier; 110 struct rcu_head barrier;
109#ifdef CONFIG_SMP
110 long last_rs_qlen; /* qlen during the last resched */
111#endif
112}; 111};
113 112
114DECLARE_PER_CPU(struct rcu_data, rcu_data); 113DECLARE_PER_CPU(struct rcu_data, rcu_data);
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 806ec5b06707..fe00f781a622 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -56,6 +56,16 @@ extern int reiserfs_xattr_posix_acl_init(void) __init;
56extern int reiserfs_xattr_posix_acl_exit(void); 56extern int reiserfs_xattr_posix_acl_exit(void);
57extern struct reiserfs_xattr_handler posix_acl_default_handler; 57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler; 58extern struct reiserfs_xattr_handler posix_acl_access_handler;
59
60static inline void reiserfs_init_acl_access(struct inode *inode)
61{
62 REISERFS_I(inode)->i_acl_access = NULL;
63}
64
65static inline void reiserfs_init_acl_default(struct inode *inode)
66{
67 REISERFS_I(inode)->i_acl_default = NULL;
68}
59#else 69#else
60 70
61#define reiserfs_cache_default_acl(inode) 0 71#define reiserfs_cache_default_acl(inode) 0
@@ -87,4 +97,11 @@ reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
87 return 0; 97 return 0;
88} 98}
89 99
100static inline void reiserfs_init_acl_access(struct inode *inode)
101{
102}
103
104static inline void reiserfs_init_acl_default(struct inode *inode)
105{
106}
90#endif 107#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 28493ffaafe7..7bc6bfb86253 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -807,21 +807,19 @@ struct stat_data_v1 {
807#define set_sd_v1_first_direct_byte(sdp,v) \ 807#define set_sd_v1_first_direct_byte(sdp,v) \
808 ((sdp)->sd_first_direct_byte = cpu_to_le32(v)) 808 ((sdp)->sd_first_direct_byte = cpu_to_le32(v))
809 809
810#include <linux/ext2_fs.h>
811
812/* inode flags stored in sd_attrs (nee sd_reserved) */ 810/* inode flags stored in sd_attrs (nee sd_reserved) */
813 811
814/* we want common flags to have the same values as in ext2, 812/* we want common flags to have the same values as in ext2,
815 so chattr(1) will work without problems */ 813 so chattr(1) will work without problems */
816#define REISERFS_IMMUTABLE_FL EXT2_IMMUTABLE_FL 814#define REISERFS_IMMUTABLE_FL FS_IMMUTABLE_FL
817#define REISERFS_APPEND_FL EXT2_APPEND_FL 815#define REISERFS_APPEND_FL FS_APPEND_FL
818#define REISERFS_SYNC_FL EXT2_SYNC_FL 816#define REISERFS_SYNC_FL FS_SYNC_FL
819#define REISERFS_NOATIME_FL EXT2_NOATIME_FL 817#define REISERFS_NOATIME_FL FS_NOATIME_FL
820#define REISERFS_NODUMP_FL EXT2_NODUMP_FL 818#define REISERFS_NODUMP_FL FS_NODUMP_FL
821#define REISERFS_SECRM_FL EXT2_SECRM_FL 819#define REISERFS_SECRM_FL FS_SECRM_FL
822#define REISERFS_UNRM_FL EXT2_UNRM_FL 820#define REISERFS_UNRM_FL FS_UNRM_FL
823#define REISERFS_COMPR_FL EXT2_COMPR_FL 821#define REISERFS_COMPR_FL FS_COMPR_FL
824#define REISERFS_NOTAIL_FL EXT2_NOTAIL_FL 822#define REISERFS_NOTAIL_FL FS_NOTAIL_FL
825 823
826/* persistent flags that file inherits from the parent directory */ 824/* persistent flags that file inherits from the parent directory */
827#define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \ 825#define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
@@ -2075,6 +2073,10 @@ void reiserfs_init_alloc_options(struct super_block *s);
2075 */ 2073 */
2076__le32 reiserfs_choose_packing(struct inode *dir); 2074__le32 reiserfs_choose_packing(struct inode *dir);
2077 2075
2076int reiserfs_init_bitmap_cache(struct super_block *sb);
2077void reiserfs_free_bitmap_cache(struct super_block *sb);
2078void reiserfs_cache_bitmap_metadata(struct super_block *sb, struct buffer_head *bh, struct reiserfs_bitmap_info *info);
2079struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, unsigned int bitmap);
2078int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value); 2080int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value);
2079void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, 2081void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *,
2080 b_blocknr_t, int for_unformatted); 2082 b_blocknr_t, int for_unformatted);
@@ -2163,15 +2165,24 @@ __u32 r5_hash(const signed char *msg, int len);
2163/* prototypes from ioctl.c */ 2165/* prototypes from ioctl.c */
2164int reiserfs_ioctl(struct inode *inode, struct file *filp, 2166int reiserfs_ioctl(struct inode *inode, struct file *filp,
2165 unsigned int cmd, unsigned long arg); 2167 unsigned int cmd, unsigned long arg);
2168long reiserfs_compat_ioctl(struct file *filp,
2169 unsigned int cmd, unsigned long arg);
2166 2170
2167/* ioctl's command */ 2171/* ioctl's command */
2168#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) 2172#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
2169/* define following flags to be the same as in ext2, so that chattr(1), 2173/* define following flags to be the same as in ext2, so that chattr(1),
2170 lsattr(1) will work with us. */ 2174 lsattr(1) will work with us. */
2171#define REISERFS_IOC_GETFLAGS EXT2_IOC_GETFLAGS 2175#define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS
2172#define REISERFS_IOC_SETFLAGS EXT2_IOC_SETFLAGS 2176#define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS
2173#define REISERFS_IOC_GETVERSION EXT2_IOC_GETVERSION 2177#define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION
2174#define REISERFS_IOC_SETVERSION EXT2_IOC_SETVERSION 2178#define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION
2179
2180/* the 32 bit compat definitions with int argument */
2181#define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int)
2182#define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS
2183#define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS
2184#define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION
2185#define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION
2175 2186
2176/* Locking primitives */ 2187/* Locking primitives */
2177/* Right now we are still falling back to (un)lock_kernel, but eventually that 2188/* Right now we are still falling back to (un)lock_kernel, but eventually that
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 149be8d9a0c9..5b3b297aa2c5 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -52,10 +52,13 @@ struct reiserfs_inode_info {
52 ** flushed */ 52 ** flushed */
53 unsigned long i_trans_id; 53 unsigned long i_trans_id;
54 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
55 55#ifdef CONFIG_REISERFS_FS_POSIX_ACL
56 struct posix_acl *i_acl_access; 56 struct posix_acl *i_acl_access;
57 struct posix_acl *i_acl_default; 57 struct posix_acl *i_acl_default;
58#endif
59#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore xattr_sem; 60 struct rw_semaphore xattr_sem;
61#endif
59 struct inode vfs_inode; 62 struct inode vfs_inode;
60}; 63};
61 64
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 31b4c0bd4fa0..73e0becec086 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -267,7 +267,6 @@ struct reiserfs_bitmap_info {
267 // FIXME: Won't work with block sizes > 8K 267 // FIXME: Won't work with block sizes > 8K
268 __u16 first_zero_hint; 268 __u16 first_zero_hint;
269 __u16 free_count; 269 __u16 free_count;
270 struct buffer_head *bh; /* the actual bitmap */
271}; 270};
272 271
273struct proc_dir_entry; 272struct proc_dir_entry;
@@ -414,6 +413,7 @@ struct reiserfs_sb_info {
414/* Definitions of reiserfs on-disk properties: */ 413/* Definitions of reiserfs on-disk properties: */
415#define REISERFS_3_5 0 414#define REISERFS_3_5 0
416#define REISERFS_3_6 1 415#define REISERFS_3_6 1
416#define REISERFS_OLD_FORMAT 2
417 417
418enum reiserfs_mount_options { 418enum reiserfs_mount_options {
419/* Mount options */ 419/* Mount options */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 5e961035c725..966c35851b2e 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -97,6 +97,11 @@ static inline void reiserfs_mark_inode_private(struct inode *inode)
97 inode->i_flags |= S_PRIVATE; 97 inode->i_flags |= S_PRIVATE;
98} 98}
99 99
100static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
101{
102 init_rwsem(&REISERFS_I(inode)->xattr_sem);
103}
104
100#else 105#else
101 106
102#define is_reiserfs_priv_object(inode) 0 107#define is_reiserfs_priv_object(inode) 0
@@ -129,6 +134,9 @@ static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
129 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ 134 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
130 return 0; 135 return 0;
131}; 136};
137static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
138{
139}
132#endif 140#endif
133 141
134#endif /* __KERNEL__ */ 142#endif /* __KERNEL__ */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 5371e4e74595..b89f09357054 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -141,7 +141,7 @@ struct rtc_device
141 int id; 141 int id;
142 char name[RTC_DEVICE_NAME_SIZE]; 142 char name[RTC_DEVICE_NAME_SIZE];
143 143
144 struct rtc_class_ops *ops; 144 const struct rtc_class_ops *ops;
145 struct mutex ops_lock; 145 struct mutex ops_lock;
146 146
147 struct class_device *rtc_dev; 147 struct class_device *rtc_dev;
@@ -172,7 +172,7 @@ struct rtc_device
172 172
173extern struct rtc_device *rtc_device_register(const char *name, 173extern struct rtc_device *rtc_device_register(const char *name,
174 struct device *dev, 174 struct device *dev,
175 struct rtc_class_ops *ops, 175 const struct rtc_class_ops *ops,
176 struct module *owner); 176 struct module *owner);
177extern void rtc_device_unregister(struct rtc_device *rdev); 177extern void rtc_device_unregister(struct rtc_device *rdev);
178extern int rtc_interface_register(struct class_interface *intf); 178extern int rtc_interface_register(struct class_interface *intf);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 9c92dc8b9a08..3a18addaed4c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -2,7 +2,7 @@
2#define __LINUX_RTNETLINK_H 2#define __LINUX_RTNETLINK_H
3 3
4#include <linux/netlink.h> 4#include <linux/netlink.h>
5#include <linux/if.h> 5#include <linux/if_link.h>
6 6
7/**** 7/****
8 * Routing/neighbour discovery messages. 8 * Routing/neighbour discovery messages.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 34ed0d99b1bd..331f4502e92b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -24,6 +24,8 @@
24#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ 24#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
25#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ 25#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
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? */
28#define CLONE_NEWIPC 0x08000000 /* New ipcs */
27 29
28/* 30/*
29 * Scheduling policies 31 * Scheduling policies
@@ -118,7 +120,6 @@ extern unsigned long avenrun[]; /* Load averages */
118 120
119extern unsigned long total_forks; 121extern unsigned long total_forks;
120extern int nr_threads; 122extern int nr_threads;
121extern int last_pid;
122DECLARE_PER_CPU(unsigned long, process_counts); 123DECLARE_PER_CPU(unsigned long, process_counts);
123extern int nr_processes(void); 124extern int nr_processes(void);
124extern unsigned long nr_running(void); 125extern unsigned long nr_running(void);
@@ -148,6 +149,7 @@ extern unsigned long weighted_cpuload(const int cpu);
148#define EXIT_DEAD 32 149#define EXIT_DEAD 32
149/* in tsk->state again */ 150/* in tsk->state again */
150#define TASK_NONINTERACTIVE 64 151#define TASK_NONINTERACTIVE 64
152#define TASK_DEAD 128
151 153
152#define __set_task_state(tsk, state_value) \ 154#define __set_task_state(tsk, state_value) \
153 do { (tsk)->state = (state_value); } while (0) 155 do { (tsk)->state = (state_value); } while (0)
@@ -238,7 +240,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout);
238extern signed long schedule_timeout_uninterruptible(signed long timeout); 240extern signed long schedule_timeout_uninterruptible(signed long timeout);
239asmlinkage void schedule(void); 241asmlinkage void schedule(void);
240 242
241struct namespace; 243struct nsproxy;
242 244
243/* Maximum number of active map areas.. This is a random (large) number */ 245/* Maximum number of active map areas.. This is a random (large) number */
244#define DEFAULT_MAX_MAP_COUNT 65536 246#define DEFAULT_MAX_MAP_COUNT 65536
@@ -504,8 +506,8 @@ struct signal_struct {
504#define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO) 506#define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO)
505#define rt_task(p) rt_prio((p)->prio) 507#define rt_task(p) rt_prio((p)->prio)
506#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) 508#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
507#define has_rt_policy(p) \ 509#define is_rt_policy(p) ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
508 unlikely((p)->policy != SCHED_NORMAL && (p)->policy != SCHED_BATCH) 510#define has_rt_policy(p) unlikely(is_rt_policy((p)->policy))
509 511
510/* 512/*
511 * Some day this will be a full-fledged user tracking system.. 513 * Some day this will be a full-fledged user tracking system..
@@ -623,9 +625,17 @@ enum idle_type
623#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ 625#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */
624#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 626#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
625#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ 627#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */
628#define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */
626 629
627#define BALANCE_FOR_POWER ((sched_mc_power_savings || sched_smt_power_savings) \ 630#define BALANCE_FOR_MC_POWER \
628 ? SD_POWERSAVINGS_BALANCE : 0) 631 (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
632
633#define BALANCE_FOR_PKG_POWER \
634 ((sched_mc_power_savings || sched_smt_power_savings) ? \
635 SD_POWERSAVINGS_BALANCE : 0)
636
637#define test_sd_parent(sd, flag) ((sd->parent && \
638 (sd->parent->flags & flag)) ? 1 : 0)
629 639
630 640
631struct sched_group { 641struct sched_group {
@@ -642,6 +652,7 @@ struct sched_group {
642struct sched_domain { 652struct sched_domain {
643 /* These fields must be setup */ 653 /* These fields must be setup */
644 struct sched_domain *parent; /* top domain must be null terminated */ 654 struct sched_domain *parent; /* top domain must be null terminated */
655 struct sched_domain *child; /* bottom domain must be null terminated */
645 struct sched_group *groups; /* the balancing groups of the domain */ 656 struct sched_group *groups; /* the balancing groups of the domain */
646 cpumask_t span; /* span of all CPUs in this domain */ 657 cpumask_t span; /* span of all CPUs in this domain */
647 unsigned long min_interval; /* Minimum balance interval ms */ 658 unsigned long min_interval; /* Minimum balance interval ms */
@@ -709,7 +720,6 @@ extern unsigned int max_cache_size;
709 720
710 721
711struct io_context; /* See blkdev.h */ 722struct io_context; /* See blkdev.h */
712void exit_io_context(void);
713struct cpuset; 723struct cpuset;
714 724
715#define NGROUPS_SMALL 32 725#define NGROUPS_SMALL 32
@@ -754,6 +764,7 @@ static inline void prefetch_stack(struct task_struct *t) { }
754struct audit_context; /* See audit.c */ 764struct audit_context; /* See audit.c */
755struct mempolicy; 765struct mempolicy;
756struct pipe_inode_info; 766struct pipe_inode_info;
767struct uts_namespace;
757 768
758enum sleep_type { 769enum sleep_type {
759 SLEEP_NORMAL, 770 SLEEP_NORMAL,
@@ -784,8 +795,9 @@ struct task_struct {
784 struct prio_array *array; 795 struct prio_array *array;
785 796
786 unsigned short ioprio; 797 unsigned short ioprio;
798#ifdef CONFIG_BLK_DEV_IO_TRACE
787 unsigned int btrace_seq; 799 unsigned int btrace_seq;
788 800#endif
789 unsigned long sleep_avg; 801 unsigned long sleep_avg;
790 unsigned long long timestamp, last_ran; 802 unsigned long long timestamp, last_ran;
791 unsigned long long sched_time; /* sched_clock time spent running */ 803 unsigned long long sched_time; /* sched_clock time spent running */
@@ -819,6 +831,11 @@ struct task_struct {
819 unsigned did_exec:1; 831 unsigned did_exec:1;
820 pid_t pid; 832 pid_t pid;
821 pid_t tgid; 833 pid_t tgid;
834
835#ifdef CONFIG_CC_STACKPROTECTOR
836 /* Canary value for the -fstack-protector gcc feature */
837 unsigned long stack_canary;
838#endif
822 /* 839 /*
823 * pointers to (original) parent process, youngest child, younger sibling, 840 * pointers to (original) parent process, youngest child, younger sibling,
824 * older sibling, respectively. (p->father can be replaced with 841 * older sibling, respectively. (p->father can be replaced with
@@ -865,6 +882,15 @@ struct task_struct {
865 struct key *thread_keyring; /* keyring private to this thread */ 882 struct key *thread_keyring; /* keyring private to this thread */
866 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 883 unsigned char jit_keyring; /* default keyring to attach requested keys to */
867#endif 884#endif
885 /*
886 * fpu_counter contains the number of consecutive context switches
887 * that the FPU is used. If this is over a threshold, the lazy fpu
888 * saving becomes unlazy to save the trap. This is an unsigned char
889 * so that after 256 times the counter wraps and the behavior turns
890 * lazy again; this to deal with bursty apps that only use FPU for
891 * a short time
892 */
893 unsigned char fpu_counter;
868 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 894 int oomkilladj; /* OOM kill score adjustment (bit shift). */
869 char comm[TASK_COMM_LEN]; /* executable name excluding path 895 char comm[TASK_COMM_LEN]; /* executable name excluding path
870 - access with [gs]et_task_comm (which lock 896 - access with [gs]et_task_comm (which lock
@@ -872,16 +898,18 @@ struct task_struct {
872 - initialized normally by flush_old_exec */ 898 - initialized normally by flush_old_exec */
873/* file system info */ 899/* file system info */
874 int link_count, total_link_count; 900 int link_count, total_link_count;
901#ifdef CONFIG_SYSVIPC
875/* ipc stuff */ 902/* ipc stuff */
876 struct sysv_sem sysvsem; 903 struct sysv_sem sysvsem;
904#endif
877/* CPU-specific state of this task */ 905/* CPU-specific state of this task */
878 struct thread_struct thread; 906 struct thread_struct thread;
879/* filesystem information */ 907/* filesystem information */
880 struct fs_struct *fs; 908 struct fs_struct *fs;
881/* open file information */ 909/* open file information */
882 struct files_struct *files; 910 struct files_struct *files;
883/* namespace */ 911/* namespaces */
884 struct namespace *namespace; 912 struct nsproxy *nsproxy;
885/* signal handlers */ 913/* signal handlers */
886 struct signal_struct *signal; 914 struct signal_struct *signal;
887 struct sighand_struct *sighand; 915 struct sighand_struct *sighand;
@@ -964,10 +992,10 @@ struct task_struct {
964 wait_queue_t *io_wait; 992 wait_queue_t *io_wait;
965/* i/o counters(bytes read/written, #syscalls */ 993/* i/o counters(bytes read/written, #syscalls */
966 u64 rchar, wchar, syscr, syscw; 994 u64 rchar, wchar, syscr, syscw;
967#if defined(CONFIG_BSD_PROCESS_ACCT) 995#if defined(CONFIG_TASK_XACCT)
968 u64 acct_rss_mem1; /* accumulated rss usage */ 996 u64 acct_rss_mem1; /* accumulated rss usage */
969 u64 acct_vm_mem1; /* accumulated virtual memory usage */ 997 u64 acct_vm_mem1; /* accumulated virtual memory usage */
970 clock_t acct_stimexpd; /* clock_t-converted stime since last update */ 998 cputime_t acct_stimexpd;/* stime since last update */
971#endif 999#endif
972#ifdef CONFIG_NUMA 1000#ifdef CONFIG_NUMA
973 struct mempolicy *mempolicy; 1001 struct mempolicy *mempolicy;
@@ -1003,6 +1031,26 @@ static inline pid_t process_group(struct task_struct *tsk)
1003 return tsk->signal->pgrp; 1031 return tsk->signal->pgrp;
1004} 1032}
1005 1033
1034static inline struct pid *task_pid(struct task_struct *task)
1035{
1036 return task->pids[PIDTYPE_PID].pid;
1037}
1038
1039static inline struct pid *task_tgid(struct task_struct *task)
1040{
1041 return task->group_leader->pids[PIDTYPE_PID].pid;
1042}
1043
1044static inline struct pid *task_pgrp(struct task_struct *task)
1045{
1046 return task->group_leader->pids[PIDTYPE_PGID].pid;
1047}
1048
1049static inline struct pid *task_session(struct task_struct *task)
1050{
1051 return task->group_leader->pids[PIDTYPE_SID].pid;
1052}
1053
1006/** 1054/**
1007 * pid_alive - check that a task structure is not stale 1055 * pid_alive - check that a task structure is not stale
1008 * @p: Task structure to be checked. 1056 * @p: Task structure to be checked.
@@ -1016,6 +1064,18 @@ static inline int pid_alive(struct task_struct *p)
1016 return p->pids[PIDTYPE_PID].pid != NULL; 1064 return p->pids[PIDTYPE_PID].pid != NULL;
1017} 1065}
1018 1066
1067/**
1068 * is_init - check if a task structure is the first user space
1069 * task the kernel created.
1070 * @p: Task structure to be checked.
1071 */
1072static inline int is_init(struct task_struct *tsk)
1073{
1074 return tsk->pid == 1;
1075}
1076
1077extern struct pid *cad_pid;
1078
1019extern void free_task(struct task_struct *tsk); 1079extern void free_task(struct task_struct *tsk);
1020#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 1080#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
1021 1081
@@ -1034,7 +1094,6 @@ static inline void put_task_struct(struct task_struct *t)
1034 /* Not implemented yet, only for 486*/ 1094 /* Not implemented yet, only for 486*/
1035#define PF_STARTING 0x00000002 /* being created */ 1095#define PF_STARTING 0x00000002 /* being created */
1036#define PF_EXITING 0x00000004 /* getting shut down */ 1096#define PF_EXITING 0x00000004 /* getting shut down */
1037#define PF_DEAD 0x00000008 /* Dead */
1038#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1097#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1039#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1098#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1040#define PF_DUMPCORE 0x00000200 /* dumped core */ 1099#define PF_DUMPCORE 0x00000200 /* dumped core */
@@ -1179,7 +1238,7 @@ extern void switch_uid(struct user_struct *);
1179 1238
1180#include <asm/current.h> 1239#include <asm/current.h>
1181 1240
1182extern void do_timer(struct pt_regs *); 1241extern void do_timer(unsigned long ticks);
1183 1242
1184extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state)); 1243extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
1185extern int FASTCALL(wake_up_process(struct task_struct * tsk)); 1244extern int FASTCALL(wake_up_process(struct task_struct * tsk));
@@ -1221,10 +1280,15 @@ extern int send_sig_info(int, struct siginfo *, struct task_struct *);
1221extern int send_group_sig_info(int, struct siginfo *, struct task_struct *); 1280extern int send_group_sig_info(int, struct siginfo *, struct task_struct *);
1222extern int force_sigsegv(int, struct task_struct *); 1281extern int force_sigsegv(int, struct task_struct *);
1223extern int force_sig_info(int, struct siginfo *, struct task_struct *); 1282extern int force_sig_info(int, struct siginfo *, struct task_struct *);
1283extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
1284extern int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
1285extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
1286extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32);
1287extern int kill_pgrp(struct pid *pid, int sig, int priv);
1288extern int kill_pid(struct pid *pid, int sig, int priv);
1224extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1289extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp);
1225extern int kill_pg_info(int, struct siginfo *, pid_t); 1290extern int kill_pg_info(int, struct siginfo *, pid_t);
1226extern int kill_proc_info(int, struct siginfo *, pid_t); 1291extern int kill_proc_info(int, struct siginfo *, pid_t);
1227extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t, u32);
1228extern void do_notify_parent(struct task_struct *, int); 1292extern void do_notify_parent(struct task_struct *, int);
1229extern void force_sig(int, struct task_struct *); 1293extern void force_sig(int, struct task_struct *);
1230extern void force_sig_specific(int, struct task_struct *); 1294extern void force_sig_specific(int, struct task_struct *);
@@ -1239,6 +1303,11 @@ extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
1239extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 1303extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
1240extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 1304extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
1241 1305
1306static inline int kill_cad_pid(int sig, int priv)
1307{
1308 return kill_pid(cad_pid, sig, priv);
1309}
1310
1242/* These can be the second arg to send_sig_info/send_group_sig_info. */ 1311/* These can be the second arg to send_sig_info/send_group_sig_info. */
1243#define SEND_SIG_NOINFO ((struct siginfo *) 0) 1312#define SEND_SIG_NOINFO ((struct siginfo *) 0)
1244#define SEND_SIG_PRIV ((struct siginfo *) 1) 1313#define SEND_SIG_PRIV ((struct siginfo *) 1)
@@ -1332,6 +1401,17 @@ extern void wait_task_inactive(struct task_struct * p);
1332/* de_thread depends on thread_group_leader not being a pid based check */ 1401/* de_thread depends on thread_group_leader not being a pid based check */
1333#define thread_group_leader(p) (p == p->group_leader) 1402#define thread_group_leader(p) (p == p->group_leader)
1334 1403
1404/* Do to the insanities of de_thread it is possible for a process
1405 * to have the pid of the thread group leader without actually being
1406 * the thread group leader. For iteration through the pids in proc
1407 * all we care about is that we have a task with the appropriate
1408 * pid, we don't actually care if we have the right task.
1409 */
1410static inline int has_group_leader_pid(struct task_struct *p)
1411{
1412 return p->pid == p->tgid;
1413}
1414
1335static inline struct task_struct *next_thread(const struct task_struct *p) 1415static inline struct task_struct *next_thread(const struct task_struct *p)
1336{ 1416{
1337 return list_entry(rcu_dereference(p->thread_group.next), 1417 return list_entry(rcu_dereference(p->thread_group.next),
diff --git a/include/linux/scx200.h b/include/linux/scx200.h
index 693c0557e70b..de466e11e271 100644
--- a/include/linux/scx200.h
+++ b/include/linux/scx200.h
@@ -32,7 +32,7 @@ extern unsigned scx200_cb_base;
32 32
33/* High Resolution Timer */ 33/* High Resolution Timer */
34#define SCx200_TIMER_OFFSET 0x08 34#define SCx200_TIMER_OFFSET 0x08
35#define SCx200_TIMER_SIZE 0x05 35#define SCx200_TIMER_SIZE 0x06
36 36
37/* Clock Generators */ 37/* Clock Generators */
38#define SCx200_CLOCKGEN_OFFSET 0x10 38#define SCx200_CLOCKGEN_OFFSET 0x10
diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h
index 90dd069cc145..1a82d30c4b17 100644
--- a/include/linux/scx200_gpio.h
+++ b/include/linux/scx200_gpio.h
@@ -4,6 +4,7 @@ u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear);
4 4
5extern unsigned scx200_gpio_base; 5extern unsigned scx200_gpio_base;
6extern long scx200_gpio_shadow[2]; 6extern long scx200_gpio_shadow[2];
7extern struct nsc_gpio_ops scx200_gpio_ops;
7 8
8#define scx200_gpio_present() (scx200_gpio_base!=0) 9#define scx200_gpio_present() (scx200_gpio_base!=0)
9 10
diff --git a/include/linux/security.h b/include/linux/security.h
index 9f56fb8a4a6c..9b5fea81f55e 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1595,6 +1595,7 @@ static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
1595 1595
1596static inline int security_inode_alloc (struct inode *inode) 1596static inline int security_inode_alloc (struct inode *inode)
1597{ 1597{
1598 inode->i_security = NULL;
1598 return security_ops->inode_alloc_security (inode); 1599 return security_ops->inode_alloc_security (inode);
1599} 1600}
1600 1601
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 86501a3de2ac..b661c19f3f72 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -67,8 +67,8 @@
67/* Parisc type numbers. */ 67/* Parisc type numbers. */
68#define PORT_MUX 48 68#define PORT_MUX 48
69 69
70/* Atmel AT91xxx SoC */ 70/* Atmel AT91 / AT32 SoC */
71#define PORT_AT91 49 71#define PORT_ATMEL 49
72 72
73/* Macintosh Zilog type numbers */ 73/* Macintosh Zilog type numbers */
74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ 74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
@@ -319,6 +319,7 @@ struct uart_info {
319#define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) 319#define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
320#define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29)) 320#define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29))
321#define UIF_INITIALIZED ((__force uif_t) (1 << 31)) 321#define UIF_INITIALIZED ((__force uif_t) (1 << 31))
322#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
322 323
323 int blocked_open; 324 int blocked_open;
324 325
@@ -414,7 +415,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
414#ifdef SUPPORT_SYSRQ 415#ifdef SUPPORT_SYSRQ
415 if (port->sysrq) { 416 if (port->sysrq) {
416 if (ch && time_before(jiffies, port->sysrq)) { 417 if (ch && time_before(jiffies, port->sysrq)) {
417 handle_sysrq(ch, regs, NULL); 418 handle_sysrq(ch, regs, port->info->tty);
418 port->sysrq = 0; 419 port->sysrq = 0;
419 return 1; 420 return 1;
420 } 421 }
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 6348e8330897..c9069310b6ac 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -217,5 +217,8 @@ static inline void serio_unpin_driver(struct serio *serio)
217#define SERIO_LKKBD 0x28 217#define SERIO_LKKBD 0x28
218#define SERIO_ELO 0x29 218#define SERIO_ELO 0x29
219#define SERIO_MICROTOUCH 0x30 219#define SERIO_MICROTOUCH 0x30
220#define SERIO_PENMOUNT 0x31
221#define SERIO_TOUCHRIGHT 0x32
222#define SERIO_TOUCHWIN 0x33
220 223
221#endif 224#endif
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c057f0b32318..f3c51899117f 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -19,6 +19,10 @@ struct shmem_inode_info {
19 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ 19 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
20 struct list_head swaplist; /* chain of maybes on swap */ 20 struct list_head swaplist; /* chain of maybes on swap */
21 struct inode vfs_inode; 21 struct inode vfs_inode;
22#ifdef CONFIG_TMPFS_POSIX_ACL
23 struct posix_acl *i_acl;
24 struct posix_acl *i_default_acl;
25#endif
22}; 26};
23 27
24struct shmem_sb_info { 28struct shmem_sb_info {
@@ -36,4 +40,24 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
36 return container_of(inode, struct shmem_inode_info, vfs_inode); 40 return container_of(inode, struct shmem_inode_info, vfs_inode);
37} 41}
38 42
43#ifdef CONFIG_TMPFS_POSIX_ACL
44int shmem_permission(struct inode *, int, struct nameidata *);
45int shmem_acl_init(struct inode *, struct inode *);
46void shmem_acl_destroy_inode(struct inode *);
47
48extern struct xattr_handler shmem_xattr_acl_access_handler;
49extern struct xattr_handler shmem_xattr_acl_default_handler;
50
51extern struct generic_acl_operations shmem_acl_ops;
52
53#else
54static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
55{
56 return 0;
57}
58static inline void shmem_acl_destroy_inode(struct inode *inode)
59{
60}
61#endif /* CONFIG_TMPFS_POSIX_ACL */
62
39#endif 63#endif
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 66d6eb78d1c6..c4947b8a2c03 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/mm/slab.h 2 * linux/include/linux/slab.h
3 * Written by Mark Hemment, 1996. 3 * Written by Mark Hemment, 1996.
4 * (markhe@nextd.demon.co.uk) 4 * (markhe@nextd.demon.co.uk)
5 */ 5 */
@@ -60,7 +60,7 @@ extern void __init kmem_cache_init(void);
60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, 60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long,
61 void (*)(void *, kmem_cache_t *, unsigned long), 61 void (*)(void *, kmem_cache_t *, unsigned long),
62 void (*)(void *, kmem_cache_t *, unsigned long)); 62 void (*)(void *, kmem_cache_t *, unsigned long));
63extern int kmem_cache_destroy(kmem_cache_t *); 63extern void kmem_cache_destroy(kmem_cache_t *);
64extern int kmem_cache_shrink(kmem_cache_t *); 64extern int kmem_cache_shrink(kmem_cache_t *);
65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); 65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
@@ -77,13 +77,6 @@ struct cache_sizes {
77extern struct cache_sizes malloc_sizes[]; 77extern struct cache_sizes malloc_sizes[];
78 78
79extern void *__kmalloc(size_t, gfp_t); 79extern void *__kmalloc(size_t, gfp_t);
80#ifndef CONFIG_DEBUG_SLAB
81#define ____kmalloc(size, flags) __kmalloc(size, flags)
82#else
83extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
84#define ____kmalloc(size, flags) \
85 __kmalloc_track_caller(size, flags, __builtin_return_address(0))
86#endif
87 80
88/** 81/**
89 * kmalloc - allocate memory 82 * kmalloc - allocate memory
@@ -153,6 +146,23 @@ found:
153 return __kmalloc(size, flags); 146 return __kmalloc(size, flags);
154} 147}
155 148
149/*
150 * kmalloc_track_caller is a special version of kmalloc that records the
151 * calling function of the routine calling it for slab leak tracking instead
152 * of just the calling function (confusing, eh?).
153 * It's useful when the call to kmalloc comes from a widely-used standard
154 * allocator where we care about the real place the memory allocation
155 * request comes from.
156 */
157#ifndef CONFIG_DEBUG_SLAB
158#define kmalloc_track_caller(size, flags) \
159 __kmalloc(size, flags)
160#else
161extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
162#define kmalloc_track_caller(size, flags) \
163 __kmalloc_track_caller(size, flags, __builtin_return_address(0))
164#endif
165
156extern void *__kzalloc(size_t, gfp_t); 166extern void *__kzalloc(size_t, gfp_t);
157 167
158/** 168/**
@@ -249,7 +259,7 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
249 unsigned long, 259 unsigned long,
250 void (*)(void *, struct kmem_cache *, unsigned long), 260 void (*)(void *, struct kmem_cache *, unsigned long),
251 void (*)(void *, struct kmem_cache *, unsigned long)); 261 void (*)(void *, struct kmem_cache *, unsigned long));
252int kmem_cache_destroy(struct kmem_cache *c); 262void kmem_cache_destroy(struct kmem_cache *c);
253void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); 263void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
254void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 264void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
255void kmem_cache_free(struct kmem_cache *c, void *b); 265void kmem_cache_free(struct kmem_cache *c, void *b);
@@ -271,7 +281,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
271#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) 281#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
272#define kmalloc_node(s, f, n) kmalloc(s, f) 282#define kmalloc_node(s, f, n) kmalloc(s, f)
273#define kzalloc(s, f) __kzalloc(s, f) 283#define kzalloc(s, f) __kzalloc(s, f)
274#define ____kmalloc kmalloc 284#define kmalloc_track_caller kmalloc
275 285
276#endif /* CONFIG_SLOB */ 286#endif /* CONFIG_SLOB */
277 287
diff --git a/include/linux/smb.h b/include/linux/smb.h
index 6df3b1501559..f098dff93f6b 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -89,7 +89,6 @@ struct smb_fattr {
89 struct timespec f_atime; 89 struct timespec f_atime;
90 struct timespec f_mtime; 90 struct timespec f_mtime;
91 struct timespec f_ctime; 91 struct timespec f_ctime;
92 unsigned long f_blksize;
93 unsigned long f_blocks; 92 unsigned long f_blocks;
94 int f_unix; 93 int f_unix;
95}; 94};
diff --git a/include/linux/sound.h b/include/linux/sound.h
index f63d8342ffa3..9e2a94feed6b 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -35,10 +35,8 @@ extern int register_sound_special_device(const struct file_operations *fops, int
35extern int register_sound_mixer(const struct file_operations *fops, int dev); 35extern int register_sound_mixer(const struct file_operations *fops, int dev);
36extern int register_sound_midi(const struct file_operations *fops, int dev); 36extern int register_sound_midi(const struct file_operations *fops, int dev);
37extern int register_sound_dsp(const struct file_operations *fops, int dev); 37extern int register_sound_dsp(const struct file_operations *fops, int dev);
38extern int register_sound_synth(const struct file_operations *fops, int dev);
39 38
40extern void unregister_sound_special(int unit); 39extern void unregister_sound_special(int unit);
41extern void unregister_sound_mixer(int unit); 40extern void unregister_sound_mixer(int unit);
42extern void unregister_sound_midi(int unit); 41extern void unregister_sound_midi(int unit);
43extern void unregister_sound_dsp(int unit); 42extern void unregister_sound_dsp(int unit);
44extern void unregister_sound_synth(int unit);
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 31473db92d3b..b800d2d68b32 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -167,9 +167,9 @@ do { \
167 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various 167 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
168 * methods are defined as nops in the case they are not required. 168 * methods are defined as nops in the case they are not required.
169 */ 169 */
170#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) 170#define spin_trylock(lock) __cond_lock(lock, _spin_trylock(lock))
171#define read_trylock(lock) __cond_lock(_read_trylock(lock)) 171#define read_trylock(lock) __cond_lock(lock, _read_trylock(lock))
172#define write_trylock(lock) __cond_lock(_write_trylock(lock)) 172#define write_trylock(lock) __cond_lock(lock, _write_trylock(lock))
173 173
174#define spin_lock(lock) _spin_lock(lock) 174#define spin_lock(lock) _spin_lock(lock)
175 175
@@ -236,19 +236,19 @@ do { \
236 _write_unlock_irqrestore(lock, flags) 236 _write_unlock_irqrestore(lock, flags)
237#define write_unlock_bh(lock) _write_unlock_bh(lock) 237#define write_unlock_bh(lock) _write_unlock_bh(lock)
238 238
239#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) 239#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock))
240 240
241#define spin_trylock_irq(lock) \ 241#define spin_trylock_irq(lock) \
242({ \ 242({ \
243 local_irq_disable(); \ 243 local_irq_disable(); \
244 _spin_trylock(lock) ? \ 244 spin_trylock(lock) ? \
245 1 : ({ local_irq_enable(); 0; }); \ 245 1 : ({ local_irq_enable(); 0; }); \
246}) 246})
247 247
248#define spin_trylock_irqsave(lock, flags) \ 248#define spin_trylock_irqsave(lock, flags) \
249({ \ 249({ \
250 local_irq_save(flags); \ 250 local_irq_save(flags); \
251 _spin_trylock(lock) ? \ 251 spin_trylock(lock) ? \
252 1 : ({ local_irq_restore(flags); 0; }); \ 252 1 : ({ local_irq_restore(flags); 0; }); \
253}) 253})
254 254
@@ -264,7 +264,7 @@ do { \
264 */ 264 */
265extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); 265extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
266#define atomic_dec_and_lock(atomic, lock) \ 266#define atomic_dec_and_lock(atomic, lock) \
267 __cond_lock(_atomic_dec_and_lock(atomic, lock)) 267 __cond_lock(lock, _atomic_dec_and_lock(atomic, lock))
268 268
269/** 269/**
270 * spin_can_lock - would spin_trylock() succeed? 270 * spin_can_lock - would spin_trylock() succeed?
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index b2c4f8299464..8828b8155e9c 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -19,41 +19,41 @@ int in_lock_functions(unsigned long addr);
19 19
20#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) 20#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x))
21 21
22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); 22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock);
23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) 23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
24 __acquires(spinlock_t); 24 __acquires(lock);
25void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); 25void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock);
26void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); 26void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock);
27void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); 27void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock);
28void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); 28void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(lock);
29void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); 29void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(lock);
30void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); 30void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(lock);
31void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); 31void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock);
32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); 32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock);
33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
34 __acquires(spinlock_t); 34 __acquires(lock);
35unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 35unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
36 __acquires(rwlock_t); 36 __acquires(lock);
37unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 37unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
38 __acquires(rwlock_t); 38 __acquires(lock);
39int __lockfunc _spin_trylock(spinlock_t *lock); 39int __lockfunc _spin_trylock(spinlock_t *lock);
40int __lockfunc _read_trylock(rwlock_t *lock); 40int __lockfunc _read_trylock(rwlock_t *lock);
41int __lockfunc _write_trylock(rwlock_t *lock); 41int __lockfunc _write_trylock(rwlock_t *lock);
42int __lockfunc _spin_trylock_bh(spinlock_t *lock); 42int __lockfunc _spin_trylock_bh(spinlock_t *lock);
43void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); 43void __lockfunc _spin_unlock(spinlock_t *lock) __releases(lock);
44void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); 44void __lockfunc _read_unlock(rwlock_t *lock) __releases(lock);
45void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); 45void __lockfunc _write_unlock(rwlock_t *lock) __releases(lock);
46void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); 46void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(lock);
47void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); 47void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(lock);
48void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); 48void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(lock);
49void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); 49void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(lock);
50void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); 50void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(lock);
51void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); 51void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(lock);
52void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) 52void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
53 __releases(spinlock_t); 53 __releases(lock);
54void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 54void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
55 __releases(rwlock_t); 55 __releases(lock);
56void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 56void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
57 __releases(rwlock_t); 57 __releases(lock);
58 58
59#endif /* __LINUX_SPINLOCK_API_SMP_H */ 59#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
new file mode 100644
index 000000000000..aca0eee53930
--- /dev/null
+++ b/include/linux/srcu.h
@@ -0,0 +1,53 @@
1/*
2 * Sleepable Read-Copy Update mechanism for mutual exclusion
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * For detailed explanation of Read-Copy Update mechanism see -
23 * Documentation/RCU/ *.txt
24 *
25 */
26
27#ifndef _LINUX_SRCU_H
28#define _LINUX_SRCU_H
29
30struct srcu_struct_array {
31 int c[2];
32};
33
34struct srcu_struct {
35 int completed;
36 struct srcu_struct_array *per_cpu_ref;
37 struct mutex mutex;
38};
39
40#ifndef CONFIG_PREEMPT
41#define srcu_barrier() barrier()
42#else /* #ifndef CONFIG_PREEMPT */
43#define srcu_barrier()
44#endif /* #else #ifndef CONFIG_PREEMPT */
45
46int init_srcu_struct(struct srcu_struct *sp);
47void cleanup_srcu_struct(struct srcu_struct *sp);
48int srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
49void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
50void synchronize_srcu(struct srcu_struct *sp);
51long srcu_batches_completed(struct srcu_struct *sp);
52
53#endif
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 9cc81e572224..50e2b01e517c 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -5,15 +5,16 @@
5struct stack_trace { 5struct stack_trace {
6 unsigned int nr_entries, max_entries; 6 unsigned int nr_entries, max_entries;
7 unsigned long *entries; 7 unsigned long *entries;
8 int skip; /* input argument: How many entries to skip */
9 int all_contexts; /* input argument: if true do than one stack */
8}; 10};
9 11
10extern void save_stack_trace(struct stack_trace *trace, 12extern void save_stack_trace(struct stack_trace *trace,
11 struct task_struct *task, int all_contexts, 13 struct task_struct *task);
12 unsigned int skip);
13 14
14extern void print_stack_trace(struct stack_trace *trace, int spaces); 15extern void print_stack_trace(struct stack_trace *trace, int spaces);
15#else 16#else
16# define save_stack_trace(trace, task, all, skip) do { } while (0) 17# define save_stack_trace(trace, task) do { } while (0)
17# define print_stack_trace(trace) do { } while (0) 18# define print_stack_trace(trace) do { } while (0)
18#endif 19#endif
19 20
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 8669291352db..679ef0d70b6b 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -57,7 +57,7 @@
57#include <linux/time.h> 57#include <linux/time.h>
58 58
59struct kstat { 59struct kstat {
60 unsigned long ino; 60 u64 ino;
61 dev_t dev; 61 dev_t dev;
62 umode_t mode; 62 umode_t mode;
63 unsigned int nlink; 63 unsigned int nlink;
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index ea65dfb60cd8..6a40c76bdcf1 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -11,6 +11,12 @@
11#endif 11#endif
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14
15enum {
16 false = 0,
17 true = 1
18};
19
14#undef offsetof 20#undef offsetof
15#ifdef __compiler_offsetof 21#ifdef __compiler_offsetof
16#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) 22#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
diff --git a/include/linux/string.h b/include/linux/string.h
index e4c755860316..4f69ef9e6eb5 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -99,6 +99,7 @@ extern void * memchr(const void *,int,__kernel_size_t);
99#endif 99#endif
100 100
101extern char *kstrdup(const char *s, gfp_t gfp); 101extern char *kstrdup(const char *s, gfp_t gfp);
102extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
102 103
103#ifdef __cplusplus 104#ifdef __cplusplus
104} 105}
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index a6de332e57d4..534cdc7be58d 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -20,9 +20,6 @@
20/* size of the nodename buffer */ 20/* size of the nodename buffer */
21#define UNX_MAXNODENAME 32 21#define UNX_MAXNODENAME 32
22 22
23/* Maximum size (in bytes) of an rpc credential or verifier */
24#define RPC_MAX_AUTH_SIZE (400)
25
26/* Work around the lack of a VFS credential */ 23/* Work around the lack of a VFS credential */
27struct auth_cred { 24struct auth_cred {
28 uid_t uid; 25 uid_t uid;
@@ -109,13 +106,13 @@ struct rpc_credops {
109 void (*crdestroy)(struct rpc_cred *); 106 void (*crdestroy)(struct rpc_cred *);
110 107
111 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 108 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
112 u32 * (*crmarshal)(struct rpc_task *, u32 *); 109 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
113 int (*crrefresh)(struct rpc_task *); 110 int (*crrefresh)(struct rpc_task *);
114 u32 * (*crvalidate)(struct rpc_task *, u32 *); 111 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
115 int (*crwrap_req)(struct rpc_task *, kxdrproc_t, 112 int (*crwrap_req)(struct rpc_task *, kxdrproc_t,
116 void *, u32 *, void *); 113 void *, __be32 *, void *);
117 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, 114 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t,
118 void *, u32 *, void *); 115 void *, __be32 *, void *);
119}; 116};
120 117
121extern struct rpc_authops authunix_ops; 118extern struct rpc_authops authunix_ops;
@@ -134,10 +131,10 @@ struct rpc_cred * rpcauth_bindcred(struct rpc_task *);
134void rpcauth_holdcred(struct rpc_task *); 131void rpcauth_holdcred(struct rpc_task *);
135void put_rpccred(struct rpc_cred *); 132void put_rpccred(struct rpc_cred *);
136void rpcauth_unbindcred(struct rpc_task *); 133void rpcauth_unbindcred(struct rpc_task *);
137u32 * rpcauth_marshcred(struct rpc_task *, u32 *); 134__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
138u32 * rpcauth_checkverf(struct rpc_task *, u32 *); 135__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
139int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, u32 *data, void *obj); 136int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj);
140int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, u32 *data, void *obj); 137int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj);
141int rpcauth_refreshcred(struct rpc_task *); 138int rpcauth_refreshcred(struct rpc_task *);
142void rpcauth_invalcred(struct rpc_task *); 139void rpcauth_invalcred(struct rpc_task *);
143int rpcauth_uptodatecred(struct rpc_task *); 140int rpcauth_uptodatecred(struct rpc_task *);
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 03084dc4bb6a..97b62e97dd8d 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/linux/auth_gss.h 2 * linux/include/linux/sunrpc/auth_gss.h
3 * 3 *
4 * Declarations for RPCSEC_GSS 4 * Declarations for RPCSEC_GSS
5 * 5 *
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index b5612c958cce..3699dff7db8f 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -163,6 +163,17 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
163 kref_put(&h->ref, cd->cache_put); 163 kref_put(&h->ref, cd->cache_put);
164} 164}
165 165
166static inline int cache_valid(struct cache_head *h)
167{
168 /* If an item has been unhashed pending removal when
169 * the refcount drops to 0, the expiry_time will be
170 * set to 0. We don't want to consider such items
171 * valid in this context even though CACHE_VALID is
172 * set.
173 */
174 return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
175}
176
166extern int cache_check(struct cache_detail *detail, 177extern int cache_check(struct cache_detail *detail,
167 struct cache_head *h, struct cache_req *rqstp); 178 struct cache_head *h, struct cache_req *rqstp);
168extern void cache_flush(void); 179extern void cache_flush(void);
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 6e112cc5cdda..5eca9e442051 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/linux/gss_api.h 2 * linux/include/linux/sunrpc/gss_api.h
3 * 3 *
4 * Somewhat simplified version of the gss api. 4 * Somewhat simplified version of the gss api.
5 * 5 *
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index f43f237360ae..1e65f2dd80e5 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/net/sunrpc/msg_prot.h 2 * linux/include/linux/sunrpc/msg_prot.h
3 * 3 *
4 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
5 */ 5 */
@@ -11,6 +11,9 @@
11 11
12#define RPC_VERSION 2 12#define RPC_VERSION 2
13 13
14/* size of an XDR encoding unit in bytes, i.e. 32bit */
15#define XDR_UNIT (4)
16
14/* spec defines authentication flavor as an unsigned 32 bit integer */ 17/* spec defines authentication flavor as an unsigned 32 bit integer */
15typedef u32 rpc_authflavor_t; 18typedef u32 rpc_authflavor_t;
16 19
@@ -34,6 +37,9 @@ enum rpc_auth_flavors {
34 RPC_AUTH_GSS_SPKMP = 390011, 37 RPC_AUTH_GSS_SPKMP = 390011,
35}; 38};
36 39
40/* Maximum size (in bytes) of an rpc credential or verifier */
41#define RPC_MAX_AUTH_SIZE (400)
42
37enum rpc_msg_type { 43enum rpc_msg_type {
38 RPC_CALL = 0, 44 RPC_CALL = 0,
39 RPC_REPLY = 1 45 RPC_REPLY = 1
@@ -95,11 +101,45 @@ enum rpc_auth_stat {
95 * 2GB. 101 * 2GB.
96 */ 102 */
97 103
98typedef u32 rpc_fraghdr; 104typedef __be32 rpc_fraghdr;
99 105
100#define RPC_LAST_STREAM_FRAGMENT (1U << 31) 106#define RPC_LAST_STREAM_FRAGMENT (1U << 31)
101#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) 107#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT)
102#define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1) 108#define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1)
103 109
110/*
111 * RPC call and reply header size as number of 32bit words (verifier
112 * size computed separately, see below)
113 */
114#define RPC_CALLHDRSIZE (6)
115#define RPC_REPHDRSIZE (4)
116
117
118/*
119 * Maximum RPC header size, including authentication,
120 * as number of 32bit words (see RFCs 1831, 1832).
121 *
122 * xid 1 xdr unit = 4 bytes
123 * mtype 1
124 * rpc_version 1
125 * program 1
126 * prog_version 1
127 * procedure 1
128 * cred {
129 * flavor 1
130 * length 1
131 * body<RPC_MAX_AUTH_SIZE> 100 xdr units = 400 bytes
132 * }
133 * verf {
134 * flavor 1
135 * length 1
136 * body<RPC_MAX_AUTH_SIZE> 100 xdr units = 400 bytes
137 * }
138 * TOTAL 210 xdr units = 840 bytes
139 */
140#define RPC_MAX_HEADER_WITH_AUTH \
141 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4))
142
143
104#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
105#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 145#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 7b27c09b5604..d6288e89fd9d 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -13,11 +13,36 @@
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/sunrpc/types.h> 14#include <linux/sunrpc/types.h>
15#include <linux/sunrpc/xdr.h> 15#include <linux/sunrpc/xdr.h>
16#include <linux/sunrpc/auth.h>
16#include <linux/sunrpc/svcauth.h> 17#include <linux/sunrpc/svcauth.h>
17#include <linux/wait.h> 18#include <linux/wait.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19 20
20/* 21/*
22 * This is the RPC server thread function prototype
23 */
24typedef void (*svc_thread_fn)(struct svc_rqst *);
25
26/*
27 *
28 * RPC service thread pool.
29 *
30 * Pool of threads and temporary sockets. Generally there is only
31 * a single one of these per RPC service, but on NUMA machines those
32 * services that can benefit from it (i.e. nfs but not lockd) will
33 * have one pool per NUMA node. This optimisation reduces cross-
34 * node traffic on multi-node NUMA NFS servers.
35 */
36struct svc_pool {
37 unsigned int sp_id; /* pool id; also node id on NUMA */
38 spinlock_t sp_lock; /* protects all fields */
39 struct list_head sp_threads; /* idle server threads */
40 struct list_head sp_sockets; /* pending sockets */
41 unsigned int sp_nrthreads; /* # of threads in pool */
42 struct list_head sp_all_threads; /* all server threads */
43} ____cacheline_aligned_in_smp;
44
45/*
21 * RPC service. 46 * RPC service.
22 * 47 *
23 * An RPC service is a ``daemon,'' possibly multithreaded, which 48 * An RPC service is a ``daemon,'' possibly multithreaded, which
@@ -28,8 +53,6 @@
28 * We currently do not support more than one RPC program per daemon. 53 * We currently do not support more than one RPC program per daemon.
29 */ 54 */
30struct svc_serv { 55struct svc_serv {
31 struct list_head sv_threads; /* idle server threads */
32 struct list_head sv_sockets; /* pending sockets */
33 struct svc_program * sv_program; /* RPC program */ 56 struct svc_program * sv_program; /* RPC program */
34 struct svc_stat * sv_stats; /* RPC statistics */ 57 struct svc_stat * sv_stats; /* RPC statistics */
35 spinlock_t sv_lock; 58 spinlock_t sv_lock;
@@ -40,16 +63,61 @@ struct svc_serv {
40 struct list_head sv_permsocks; /* all permanent sockets */ 63 struct list_head sv_permsocks; /* all permanent sockets */
41 struct list_head sv_tempsocks; /* all temporary sockets */ 64 struct list_head sv_tempsocks; /* all temporary sockets */
42 int sv_tmpcnt; /* count of temporary sockets */ 65 int sv_tmpcnt; /* count of temporary sockets */
66 struct timer_list sv_temptimer; /* timer for aging temporary sockets */
43 67
44 char * sv_name; /* service name */ 68 char * sv_name; /* service name */
69
70 unsigned int sv_nrpools; /* number of thread pools */
71 struct svc_pool * sv_pools; /* array of thread pools */
72
73 void (*sv_shutdown)(struct svc_serv *serv);
74 /* Callback to use when last thread
75 * exits.
76 */
77
78 struct module * sv_module; /* optional module to count when
79 * adding threads */
80 svc_thread_fn sv_function; /* main function for threads */
81 int sv_kill_signal; /* signal to kill threads */
45}; 82};
46 83
47/* 84/*
85 * We use sv_nrthreads as a reference count. svc_destroy() drops
86 * this refcount, so we need to bump it up around operations that
87 * change the number of threads. Horrible, but there it is.
88 * Should be called with the BKL held.
89 */
90static inline void svc_get(struct svc_serv *serv)
91{
92 serv->sv_nrthreads++;
93}
94
95/*
48 * Maximum payload size supported by a kernel RPC server. 96 * Maximum payload size supported by a kernel RPC server.
49 * This is use to determine the max number of pages nfsd is 97 * This is use to determine the max number of pages nfsd is
50 * willing to return in a single READ operation. 98 * willing to return in a single READ operation.
99 *
100 * These happen to all be powers of 2, which is not strictly
101 * necessary but helps enforce the real limitation, which is
102 * that they should be multiples of PAGE_CACHE_SIZE.
103 *
104 * For UDP transports, a block plus NFS,RPC, and UDP headers
105 * has to fit into the IP datagram limit of 64K. The largest
106 * feasible number for all known page sizes is probably 48K,
107 * but we choose 32K here. This is the same as the historical
108 * Linux limit; someone who cares more about NFS/UDP performance
109 * can test a larger number.
110 *
111 * For TCP transports we have more freedom. A size of 1MB is
112 * chosen to match the client limit. Other OSes are known to
113 * have larger limits, but those numbers are probably beyond
114 * the point of diminishing returns.
51 */ 115 */
52#define RPCSVC_MAXPAYLOAD (64*1024u) 116#define RPCSVC_MAXPAYLOAD (1*1024*1024u)
117#define RPCSVC_MAXPAYLOAD_TCP RPCSVC_MAXPAYLOAD
118#define RPCSVC_MAXPAYLOAD_UDP (32*1024u)
119
120extern u32 svc_max_payload(const struct svc_rqst *rqstp);
53 121
54/* 122/*
55 * RPC Requsts and replies are stored in one or more pages. 123 * RPC Requsts and replies are stored in one or more pages.
@@ -78,43 +146,61 @@ struct svc_serv {
78 */ 146 */
79#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) 147#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2)
80 148
81static inline u32 svc_getu32(struct kvec *iov) 149static inline u32 svc_getnl(struct kvec *iov)
150{
151 __be32 val, *vp;
152 vp = iov->iov_base;
153 val = *vp++;
154 iov->iov_base = (void*)vp;
155 iov->iov_len -= sizeof(__be32);
156 return ntohl(val);
157}
158
159static inline void svc_putnl(struct kvec *iov, u32 val)
160{
161 __be32 *vp = iov->iov_base + iov->iov_len;
162 *vp = htonl(val);
163 iov->iov_len += sizeof(__be32);
164}
165
166static inline __be32 svc_getu32(struct kvec *iov)
82{ 167{
83 u32 val, *vp; 168 __be32 val, *vp;
84 vp = iov->iov_base; 169 vp = iov->iov_base;
85 val = *vp++; 170 val = *vp++;
86 iov->iov_base = (void*)vp; 171 iov->iov_base = (void*)vp;
87 iov->iov_len -= sizeof(u32); 172 iov->iov_len -= sizeof(__be32);
88 return val; 173 return val;
89} 174}
90 175
91static inline void svc_ungetu32(struct kvec *iov) 176static inline void svc_ungetu32(struct kvec *iov)
92{ 177{
93 u32 *vp = (u32 *)iov->iov_base; 178 __be32 *vp = (__be32 *)iov->iov_base;
94 iov->iov_base = (void *)(vp - 1); 179 iov->iov_base = (void *)(vp - 1);
95 iov->iov_len += sizeof(*vp); 180 iov->iov_len += sizeof(*vp);
96} 181}
97 182
98static inline void svc_putu32(struct kvec *iov, u32 val) 183static inline void svc_putu32(struct kvec *iov, __be32 val)
99{ 184{
100 u32 *vp = iov->iov_base + iov->iov_len; 185 __be32 *vp = iov->iov_base + iov->iov_len;
101 *vp = val; 186 *vp = val;
102 iov->iov_len += sizeof(u32); 187 iov->iov_len += sizeof(__be32);
103} 188}
104 189
105 190
106/* 191/*
107 * The context of a single thread, including the request currently being 192 * The context of a single thread, including the request currently being
108 * processed. 193 * processed.
109 * NOTE: First two items must be prev/next.
110 */ 194 */
111struct svc_rqst { 195struct svc_rqst {
112 struct list_head rq_list; /* idle list */ 196 struct list_head rq_list; /* idle list */
197 struct list_head rq_all; /* all threads list */
113 struct svc_sock * rq_sock; /* socket */ 198 struct svc_sock * rq_sock; /* socket */
114 struct sockaddr_in rq_addr; /* peer address */ 199 struct sockaddr_in rq_addr; /* peer address */
115 int rq_addrlen; 200 int rq_addrlen;
116 201
117 struct svc_serv * rq_server; /* RPC service definition */ 202 struct svc_serv * rq_server; /* RPC service definition */
203 struct svc_pool * rq_pool; /* thread pool */
118 struct svc_procedure * rq_procinfo; /* procedure info */ 204 struct svc_procedure * rq_procinfo; /* procedure info */
119 struct auth_ops * rq_authop; /* authentication flavour */ 205 struct auth_ops * rq_authop; /* authentication flavour */
120 struct svc_cred rq_cred; /* auth info */ 206 struct svc_cred rq_cred; /* auth info */
@@ -123,14 +209,13 @@ struct svc_rqst {
123 209
124 struct xdr_buf rq_arg; 210 struct xdr_buf rq_arg;
125 struct xdr_buf rq_res; 211 struct xdr_buf rq_res;
126 struct page * rq_argpages[RPCSVC_MAXPAGES]; 212 struct page * rq_pages[RPCSVC_MAXPAGES];
127 struct page * rq_respages[RPCSVC_MAXPAGES]; 213 struct page * *rq_respages; /* points into rq_pages */
128 int rq_restailpage; 214 int rq_resused; /* number of pages used for result */
129 short rq_argused; /* pages used for argument */ 215
130 short rq_arghi; /* pages available in argument page list */ 216 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
131 short rq_resused; /* pages used for result */ 217
132 218 __be32 rq_xid; /* transmission id */
133 u32 rq_xid; /* transmission id */
134 u32 rq_prog; /* program number */ 219 u32 rq_prog; /* program number */
135 u32 rq_vers; /* program version */ 220 u32 rq_vers; /* program version */
136 u32 rq_proc; /* procedure number */ 221 u32 rq_proc; /* procedure number */
@@ -139,7 +224,7 @@ struct svc_rqst {
139 rq_secure : 1; /* secure port */ 224 rq_secure : 1; /* secure port */
140 225
141 226
142 __u32 rq_daddr; /* dest addr of request - reply from here */ 227 __be32 rq_daddr; /* dest addr of request - reply from here */
143 228
144 void * rq_argp; /* decoded arguments */ 229 void * rq_argp; /* decoded arguments */
145 void * rq_resp; /* xdr'd results */ 230 void * rq_resp; /* xdr'd results */
@@ -163,13 +248,14 @@ struct svc_rqst {
163 * to prevent encrypting page 248 * to prevent encrypting page
164 * cache pages */ 249 * cache pages */
165 wait_queue_head_t rq_wait; /* synchronization */ 250 wait_queue_head_t rq_wait; /* synchronization */
251 struct task_struct *rq_task; /* service thread */
166}; 252};
167 253
168/* 254/*
169 * Check buffer bounds after decoding arguments 255 * Check buffer bounds after decoding arguments
170 */ 256 */
171static inline int 257static inline int
172xdr_argsize_check(struct svc_rqst *rqstp, u32 *p) 258xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
173{ 259{
174 char *cp = (char *)p; 260 char *cp = (char *)p;
175 struct kvec *vec = &rqstp->rq_arg.head[0]; 261 struct kvec *vec = &rqstp->rq_arg.head[0];
@@ -178,7 +264,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p)
178} 264}
179 265
180static inline int 266static inline int
181xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) 267xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
182{ 268{
183 struct kvec *vec = &rqstp->rq_res.head[0]; 269 struct kvec *vec = &rqstp->rq_res.head[0];
184 char *cp = (char*)p; 270 char *cp = (char*)p;
@@ -188,71 +274,26 @@ xdr_ressize_check(struct svc_rqst *rqstp, u32 *p)
188 return vec->iov_len <= PAGE_SIZE; 274 return vec->iov_len <= PAGE_SIZE;
189} 275}
190 276
191static inline struct page * 277static inline void svc_free_res_pages(struct svc_rqst *rqstp)
192svc_take_res_page(struct svc_rqst *rqstp)
193{
194 if (rqstp->rq_arghi <= rqstp->rq_argused)
195 return NULL;
196 rqstp->rq_arghi--;
197 rqstp->rq_respages[rqstp->rq_resused] =
198 rqstp->rq_argpages[rqstp->rq_arghi];
199 return rqstp->rq_respages[rqstp->rq_resused++];
200}
201
202static inline void svc_take_page(struct svc_rqst *rqstp)
203{
204 if (rqstp->rq_arghi <= rqstp->rq_argused) {
205 WARN_ON(1);
206 return;
207 }
208 rqstp->rq_arghi--;
209 rqstp->rq_respages[rqstp->rq_resused] =
210 rqstp->rq_argpages[rqstp->rq_arghi];
211 rqstp->rq_resused++;
212}
213
214static inline void svc_pushback_allpages(struct svc_rqst *rqstp)
215{
216 while (rqstp->rq_resused) {
217 if (rqstp->rq_respages[--rqstp->rq_resused] == NULL)
218 continue;
219 rqstp->rq_argpages[rqstp->rq_arghi++] =
220 rqstp->rq_respages[rqstp->rq_resused];
221 rqstp->rq_respages[rqstp->rq_resused] = NULL;
222 }
223}
224
225static inline void svc_pushback_unused_pages(struct svc_rqst *rqstp)
226{ 278{
227 while (rqstp->rq_resused && 279 while (rqstp->rq_resused) {
228 rqstp->rq_res.pages != &rqstp->rq_respages[rqstp->rq_resused]) { 280 struct page **pp = (rqstp->rq_respages +
229 281 --rqstp->rq_resused);
230 if (rqstp->rq_respages[--rqstp->rq_resused] != NULL) { 282 if (*pp) {
231 rqstp->rq_argpages[rqstp->rq_arghi++] = 283 put_page(*pp);
232 rqstp->rq_respages[rqstp->rq_resused]; 284 *pp = NULL;
233 rqstp->rq_respages[rqstp->rq_resused] = NULL;
234 } 285 }
235 } 286 }
236} 287}
237 288
238static inline void svc_free_allpages(struct svc_rqst *rqstp)
239{
240 while (rqstp->rq_resused) {
241 if (rqstp->rq_respages[--rqstp->rq_resused] == NULL)
242 continue;
243 put_page(rqstp->rq_respages[rqstp->rq_resused]);
244 rqstp->rq_respages[rqstp->rq_resused] = NULL;
245 }
246}
247
248struct svc_deferred_req { 289struct svc_deferred_req {
249 u32 prot; /* protocol (UDP or TCP) */ 290 u32 prot; /* protocol (UDP or TCP) */
250 struct sockaddr_in addr; 291 struct sockaddr_in addr;
251 struct svc_sock *svsk; /* where reply must go */ 292 struct svc_sock *svsk; /* where reply must go */
252 u32 daddr; /* where reply must come from */ 293 __be32 daddr; /* where reply must come from */
253 struct cache_deferred_req handle; 294 struct cache_deferred_req handle;
254 int argslen; 295 int argslen;
255 u32 args[0]; 296 __be32 args[0];
256}; 297};
257 298
258/* 299/*
@@ -280,11 +321,14 @@ struct svc_version {
280 struct svc_procedure * vs_proc; /* per-procedure info */ 321 struct svc_procedure * vs_proc; /* per-procedure info */
281 u32 vs_xdrsize; /* xdrsize needed for this version */ 322 u32 vs_xdrsize; /* xdrsize needed for this version */
282 323
324 unsigned int vs_hidden : 1; /* Don't register with portmapper.
325 * Only used for nfsacl so far. */
326
283 /* Override dispatch function (e.g. when caching replies). 327 /* Override dispatch function (e.g. when caching replies).
284 * A return value of 0 means drop the request. 328 * A return value of 0 means drop the request.
285 * vs_dispatch == NULL means use default dispatcher. 329 * vs_dispatch == NULL means use default dispatcher.
286 */ 330 */
287 int (*vs_dispatch)(struct svc_rqst *, u32 *); 331 int (*vs_dispatch)(struct svc_rqst *, __be32 *);
288}; 332};
289 333
290/* 334/*
@@ -304,20 +348,21 @@ struct svc_procedure {
304}; 348};
305 349
306/* 350/*
307 * This is the RPC server thread function prototype
308 */
309typedef void (*svc_thread_fn)(struct svc_rqst *);
310
311/*
312 * Function prototypes. 351 * Function prototypes.
313 */ 352 */
314struct svc_serv * svc_create(struct svc_program *, unsigned int); 353struct svc_serv * svc_create(struct svc_program *, unsigned int,
354 void (*shutdown)(struct svc_serv*));
315int svc_create_thread(svc_thread_fn, struct svc_serv *); 355int svc_create_thread(svc_thread_fn, struct svc_serv *);
316void svc_exit_thread(struct svc_rqst *); 356void svc_exit_thread(struct svc_rqst *);
357struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
358 void (*shutdown)(struct svc_serv*),
359 svc_thread_fn, int sig, struct module *);
360int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
317void svc_destroy(struct svc_serv *); 361void svc_destroy(struct svc_serv *);
318int svc_process(struct svc_serv *, struct svc_rqst *); 362int svc_process(struct svc_rqst *);
319int svc_register(struct svc_serv *, int, unsigned short); 363int svc_register(struct svc_serv *, int, unsigned short);
320void svc_wake_up(struct svc_serv *); 364void svc_wake_up(struct svc_serv *);
321void svc_reserve(struct svc_rqst *rqstp, int space); 365void svc_reserve(struct svc_rqst *rqstp, int space);
366struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
322 367
323#endif /* SUNRPC_SVC_H */ 368#endif /* SUNRPC_SVC_H */
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 2fe2087edd66..de92619b0826 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -95,7 +95,7 @@ struct auth_ops {
95 char * name; 95 char * name;
96 struct module *owner; 96 struct module *owner;
97 int flavour; 97 int flavour;
98 int (*accept)(struct svc_rqst *rq, u32 *authp); 98 int (*accept)(struct svc_rqst *rq, __be32 *authp);
99 int (*release)(struct svc_rqst *rq); 99 int (*release)(struct svc_rqst *rq);
100 void (*domain_release)(struct auth_domain *); 100 void (*domain_release)(struct auth_domain *);
101 int (*set_client)(struct svc_rqst *rq); 101 int (*set_client)(struct svc_rqst *rq);
@@ -112,7 +112,7 @@ struct auth_ops {
112#define SVC_COMPLETE 9 112#define SVC_COMPLETE 9
113 113
114 114
115extern int svc_authenticate(struct svc_rqst *rqstp, u32 *authp); 115extern int svc_authenticate(struct svc_rqst *rqstp, __be32 *authp);
116extern int svc_authorise(struct svc_rqst *rqstp); 116extern int svc_authorise(struct svc_rqst *rqstp);
117extern int svc_set_client(struct svc_rqst *rqstp); 117extern int svc_set_client(struct svc_rqst *rqstp);
118extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops); 118extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops);
@@ -126,6 +126,7 @@ extern struct auth_domain *auth_domain_find(char *name);
126extern struct auth_domain *auth_unix_lookup(struct in_addr addr); 126extern 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 *);
129 130
130static inline unsigned long hash_str(char *name, int bits) 131static inline unsigned long hash_str(char *name, int bits)
131{ 132{
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index 3a2206f61de0..5a5db16ab660 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/linux/svcauth_gss.h 2 * linux/include/linux/sunrpc/svcauth_gss.h
3 * 3 *
4 * Bruce Fields <bfields@umich.edu> 4 * Bruce Fields <bfields@umich.edu>
5 * Copyright (c) 2002 The Regents of the Unviersity of Michigan 5 * Copyright (c) 2002 The Regents of the Unviersity of Michigan
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index b4acb3d37c3f..98b21ad370fd 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -20,8 +20,9 @@ struct svc_sock {
20 struct socket * sk_sock; /* berkeley socket layer */ 20 struct socket * sk_sock; /* berkeley socket layer */
21 struct sock * sk_sk; /* INET layer */ 21 struct sock * sk_sk; /* INET layer */
22 22
23 struct svc_pool * sk_pool; /* current pool iff queued */
23 struct svc_serv * sk_server; /* service for this socket */ 24 struct svc_serv * sk_server; /* service for this socket */
24 unsigned int sk_inuse; /* use count */ 25 atomic_t sk_inuse; /* use count */
25 unsigned long sk_flags; 26 unsigned long sk_flags;
26#define SK_BUSY 0 /* enqueued/receiving */ 27#define SK_BUSY 0 /* enqueued/receiving */
27#define SK_CONN 1 /* conn pending */ 28#define SK_CONN 1 /* conn pending */
@@ -31,9 +32,12 @@ struct svc_sock {
31#define SK_DEAD 6 /* socket closed */ 32#define SK_DEAD 6 /* socket closed */
32#define SK_CHNGBUF 7 /* need to change snd/rcv buffer sizes */ 33#define SK_CHNGBUF 7 /* need to change snd/rcv buffer sizes */
33#define SK_DEFERRED 8 /* request on sk_deferred */ 34#define SK_DEFERRED 8 /* request on sk_deferred */
35#define SK_OLD 9 /* used for temp socket aging mark+sweep */
36#define SK_DETACHED 10 /* detached from tempsocks list */
34 37
35 int sk_reserved; /* space on outq that is reserved */ 38 atomic_t sk_reserved; /* space on outq that is reserved */
36 39
40 spinlock_t sk_defer_lock; /* protects sk_deferred */
37 struct list_head sk_deferred; /* deferred requests that need to 41 struct list_head sk_deferred; /* deferred requests that need to
38 * be revisted */ 42 * be revisted */
39 struct mutex sk_mutex; /* to serialize sending data */ 43 struct mutex sk_mutex; /* to serialize sending data */
@@ -50,6 +54,9 @@ struct svc_sock {
50 int sk_reclen; /* length of record */ 54 int sk_reclen; /* length of record */
51 int sk_tcplen; /* current read length */ 55 int sk_tcplen; /* current read length */
52 time_t sk_lastrecv; /* time of last received request */ 56 time_t sk_lastrecv; /* time of last received request */
57
58 /* cache of various info for TCP sockets */
59 void *sk_info_authunix;
53}; 60};
54 61
55/* 62/*
@@ -57,9 +64,14 @@ struct svc_sock {
57 */ 64 */
58int svc_makesock(struct svc_serv *, int, unsigned short); 65int svc_makesock(struct svc_serv *, int, unsigned short);
59void svc_delete_socket(struct svc_sock *); 66void svc_delete_socket(struct svc_sock *);
60int svc_recv(struct svc_serv *, struct svc_rqst *, long); 67int svc_recv(struct svc_rqst *, long);
61int svc_send(struct svc_rqst *); 68int svc_send(struct svc_rqst *);
62void svc_drop(struct svc_rqst *); 69void svc_drop(struct svc_rqst *);
63void svc_sock_update_bufs(struct svc_serv *serv); 70void svc_sock_update_bufs(struct svc_serv *serv);
71int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
72int svc_addsock(struct svc_serv *serv,
73 int fd,
74 char *name_return,
75 int *proto);
64 76
65#endif /* SUNRPC_SVCSOCK_H */ 77#endif /* SUNRPC_SVCSOCK_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index e6d3d349506c..953723b09bc6 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -32,7 +32,7 @@ struct xdr_netobj {
32 * side) or svc_rqst pointer (server side). 32 * side) or svc_rqst pointer (server side).
33 * Encode functions always assume there's enough room in the buffer. 33 * Encode functions always assume there's enough room in the buffer.
34 */ 34 */
35typedef int (*kxdrproc_t)(void *rqstp, u32 *data, void *obj); 35typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
36 36
37/* 37/*
38 * Basic structure for transmission/reception of a client XDR message. 38 * Basic structure for transmission/reception of a client XDR message.
@@ -88,19 +88,19 @@ struct xdr_buf {
88/* 88/*
89 * Miscellaneous XDR helper functions 89 * Miscellaneous XDR helper functions
90 */ 90 */
91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len); 91__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len); 92__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
93u32 * xdr_encode_string(u32 *p, const char *s); 93__be32 *xdr_encode_string(__be32 *p, const char *s);
94u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen); 94__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen);
95u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); 95__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
96u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); 96__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
97 97
98void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int, 98void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int,
99 unsigned int); 99 unsigned int);
100void xdr_inline_pages(struct xdr_buf *, unsigned int, 100void xdr_inline_pages(struct xdr_buf *, unsigned int,
101 struct page **, unsigned int, unsigned int); 101 struct page **, unsigned int, unsigned int);
102 102
103static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len) 103static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int len)
104{ 104{
105 return xdr_encode_opaque(p, s, len); 105 return xdr_encode_opaque(p, s, len);
106} 106}
@@ -108,16 +108,16 @@ static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len)
108/* 108/*
109 * Decode 64bit quantities (NFSv3 support) 109 * Decode 64bit quantities (NFSv3 support)
110 */ 110 */
111static inline u32 * 111static inline __be32 *
112xdr_encode_hyper(u32 *p, __u64 val) 112xdr_encode_hyper(__be32 *p, __u64 val)
113{ 113{
114 *p++ = htonl(val >> 32); 114 *p++ = htonl(val >> 32);
115 *p++ = htonl(val & 0xFFFFFFFF); 115 *p++ = htonl(val & 0xFFFFFFFF);
116 return p; 116 return p;
117} 117}
118 118
119static inline u32 * 119static inline __be32 *
120xdr_decode_hyper(u32 *p, __u64 *valp) 120xdr_decode_hyper(__be32 *p, __u64 *valp)
121{ 121{
122 *valp = ((__u64) ntohl(*p++)) << 32; 122 *valp = ((__u64) ntohl(*p++)) << 32;
123 *valp |= ntohl(*p++); 123 *valp |= ntohl(*p++);
@@ -128,7 +128,7 @@ xdr_decode_hyper(u32 *p, __u64 *valp)
128 * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) 128 * Adjust kvec to reflect end of xdr'ed data (RPC client XDR)
129 */ 129 */
130static inline int 130static inline int
131xdr_adjust_iovec(struct kvec *iov, u32 *p) 131xdr_adjust_iovec(struct kvec *iov, __be32 *p)
132{ 132{
133 return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); 133 return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base);
134} 134}
@@ -180,19 +180,19 @@ extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
180 * Provide some simple tools for XDR buffer overflow-checking etc. 180 * Provide some simple tools for XDR buffer overflow-checking etc.
181 */ 181 */
182struct xdr_stream { 182struct xdr_stream {
183 uint32_t *p; /* start of available buffer */ 183 __be32 *p; /* start of available buffer */
184 struct xdr_buf *buf; /* XDR buffer to read/write */ 184 struct xdr_buf *buf; /* XDR buffer to read/write */
185 185
186 uint32_t *end; /* end of available buffer space */ 186 __be32 *end; /* end of available buffer space */
187 struct kvec *iov; /* pointer to the current kvec */ 187 struct kvec *iov; /* pointer to the current kvec */
188}; 188};
189 189
190extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); 190extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
191extern uint32_t *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); 191extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
192extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, 192extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
193 unsigned int base, unsigned int len); 193 unsigned int base, unsigned int len);
194extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); 194extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
195extern uint32_t *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); 195extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
196extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); 196extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
197extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); 197extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
198 198
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index bdeba8538c71..60394fbc4c70 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -15,6 +15,7 @@
15#include <linux/kref.h> 15#include <linux/kref.h>
16#include <linux/sunrpc/sched.h> 16#include <linux/sunrpc/sched.h>
17#include <linux/sunrpc/xdr.h> 17#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/msg_prot.h>
18 19
19extern unsigned int xprt_udp_slot_table_entries; 20extern unsigned int xprt_udp_slot_table_entries;
20extern unsigned int xprt_tcp_slot_table_entries; 21extern unsigned int xprt_tcp_slot_table_entries;
@@ -24,13 +25,6 @@ extern unsigned int xprt_tcp_slot_table_entries;
24#define RPC_MAX_SLOT_TABLE (128U) 25#define RPC_MAX_SLOT_TABLE (128U)
25 26
26/* 27/*
27 * RPC call and reply header size as number of 32bit words (verifier
28 * size computed separately)
29 */
30#define RPC_CALLHDRSIZE 6
31#define RPC_REPHDRSIZE 4
32
33/*
34 * Parameters for choosing a free port 28 * Parameters for choosing a free port
35 */ 29 */
36extern unsigned int xprt_min_resvport; 30extern unsigned int xprt_min_resvport;
@@ -79,7 +73,7 @@ struct rpc_rqst {
79 * This is the private part 73 * This is the private part
80 */ 74 */
81 struct rpc_task * rq_task; /* RPC task data */ 75 struct rpc_task * rq_task; /* RPC task data */
82 __u32 rq_xid; /* request XID */ 76 __be32 rq_xid; /* request XID */
83 int rq_cong; /* has incremented xprt->cong */ 77 int rq_cong; /* has incremented xprt->cong */
84 int rq_received; /* receive completed */ 78 int rq_received; /* receive completed */
85 u32 rq_seqno; /* gss seq no. used on req. */ 79 u32 rq_seqno; /* gss seq no. used on req. */
@@ -171,9 +165,9 @@ struct rpc_xprt {
171 /* 165 /*
172 * State of TCP reply receive stuff 166 * State of TCP reply receive stuff
173 */ 167 */
174 u32 tcp_recm, /* Fragment header */ 168 __be32 tcp_recm, /* Fragment header */
175 tcp_xid, /* Current XID */ 169 tcp_xid; /* Current XID */
176 tcp_reclen, /* fragment length */ 170 u32 tcp_reclen, /* fragment length */
177 tcp_offset; /* fragment offset */ 171 tcp_offset; /* fragment offset */
178 unsigned long tcp_copied, /* copied to request */ 172 unsigned long tcp_copied, /* copied to request */
179 tcp_flags; 173 tcp_flags;
@@ -253,7 +247,7 @@ void xprt_release(struct rpc_task *task);
253struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); 247struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
254void xprt_put(struct rpc_xprt *xprt); 248void xprt_put(struct rpc_xprt *xprt);
255 249
256static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) 250static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
257{ 251{
258 return p + xprt->tsh_size; 252 return p + xprt->tsh_size;
259} 253}
@@ -268,7 +262,7 @@ void xprt_wait_for_buffer_space(struct rpc_task *task);
268void xprt_write_space(struct rpc_xprt *xprt); 262void xprt_write_space(struct rpc_xprt *xprt);
269void xprt_update_rtt(struct rpc_task *task); 263void xprt_update_rtt(struct rpc_task *task);
270void xprt_adjust_cwnd(struct rpc_task *task, int result); 264void xprt_adjust_cwnd(struct rpc_task *task, int result);
271struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid); 265struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
272void xprt_complete_rqst(struct rpc_task *task, int copied); 266void xprt_complete_rqst(struct rpc_task *task, int copied);
273void xprt_release_rqst_cong(struct rpc_task *task); 267void xprt_release_rqst_cong(struct rpc_task *task);
274void xprt_disconnect(struct rpc_xprt *xprt); 268void xprt_disconnect(struct rpc_xprt *xprt);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 0577f5284cbc..c8b042667af1 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.13 2006/05/23 18:25:06 paulkf Exp $ 4 * $Id: synclink.h,v 3.14 2006/07/17 20:15:43 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -124,6 +124,8 @@
124 124
125#define MGSL_MODE_ASYNC 1 125#define MGSL_MODE_ASYNC 1
126#define MGSL_MODE_HDLC 2 126#define MGSL_MODE_HDLC 2
127#define MGSL_MODE_MONOSYNC 3
128#define MGSL_MODE_BISYNC 4
127#define MGSL_MODE_RAW 6 129#define MGSL_MODE_RAW 6
128 130
129#define MGSL_BUS_TYPE_ISA 1 131#define MGSL_BUS_TYPE_ISA 1
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 008f04c56737..3efcfc7e9c6c 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -53,6 +53,7 @@ struct mq_attr;
53struct compat_stat; 53struct compat_stat;
54struct compat_timeval; 54struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache;
56 57
57#include <linux/types.h> 58#include <linux/types.h>
58#include <linux/aio_abi.h> 59#include <linux/aio_abi.h>
@@ -596,5 +597,8 @@ asmlinkage long sys_get_robust_list(int pid,
596 size_t __user *len_ptr); 597 size_t __user *len_ptr);
597asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, 598asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
598 size_t len); 599 size_t len);
600asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
601
602int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
599 603
600#endif 604#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index eca555781d05..1b24bd45e080 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -150,6 +150,8 @@ enum
150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ 150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
151 KERN_COMPAT_LOG=73, /* int: print compat layer messages */ 151 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
152 KERN_MAX_LOCK_DEPTH=74, 152 KERN_MAX_LOCK_DEPTH=74,
153 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
154 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
153}; 155};
154 156
155 157
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 1ea5d3cda6ae..6d5c43d31dec 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -10,6 +10,7 @@
10#ifndef _SYSFS_H_ 10#ifndef _SYSFS_H_
11#define _SYSFS_H_ 11#define _SYSFS_H_
12 12
13#include <linux/compiler.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14 15
15struct kobject; 16struct kobject;
@@ -86,40 +87,44 @@ struct sysfs_dirent {
86 87
87#ifdef CONFIG_SYSFS 88#ifdef CONFIG_SYSFS
88 89
89extern int 90extern int __must_check
90sysfs_create_dir(struct kobject *); 91sysfs_create_dir(struct kobject *);
91 92
92extern void 93extern void
93sysfs_remove_dir(struct kobject *); 94sysfs_remove_dir(struct kobject *);
94 95
95extern int 96extern int __must_check
96sysfs_rename_dir(struct kobject *, const char *new_name); 97sysfs_rename_dir(struct kobject *, const char *new_name);
97 98
98extern int 99extern int __must_check
99sysfs_create_file(struct kobject *, const struct attribute *); 100sysfs_create_file(struct kobject *, const struct attribute *);
100 101
101extern int 102extern int __must_check
102sysfs_update_file(struct kobject *, const struct attribute *); 103sysfs_update_file(struct kobject *, const struct attribute *);
103 104
104extern int 105extern int __must_check
105sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); 106sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode);
106 107
107extern void 108extern void
108sysfs_remove_file(struct kobject *, const struct attribute *); 109sysfs_remove_file(struct kobject *, const struct attribute *);
109 110
110extern int 111extern int __must_check
111sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); 112sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name);
112 113
113extern void 114extern void
114sysfs_remove_link(struct kobject *, const char * name); 115sysfs_remove_link(struct kobject *, const char * name);
115 116
116int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); 117int __must_check sysfs_create_bin_file(struct kobject *kobj,
117int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); 118 struct bin_attribute *attr);
119void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
118 120
119int sysfs_create_group(struct kobject *, const struct attribute_group *); 121int __must_check sysfs_create_group(struct kobject *,
122 const struct attribute_group *);
120void sysfs_remove_group(struct kobject *, const struct attribute_group *); 123void sysfs_remove_group(struct kobject *, const struct attribute_group *);
121void sysfs_notify(struct kobject * k, char *dir, char *attr); 124void sysfs_notify(struct kobject * k, char *dir, char *attr);
122 125
126extern int __must_check sysfs_init(void);
127
123#else /* CONFIG_SYSFS */ 128#else /* CONFIG_SYSFS */
124 129
125static inline int sysfs_create_dir(struct kobject * k) 130static inline int sysfs_create_dir(struct kobject * k)
@@ -191,6 +196,11 @@ static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
191{ 196{
192} 197}
193 198
199static inline int __must_check sysfs_init(void)
200{
201 return 0;
202}
203
194#endif /* CONFIG_SYSFS */ 204#endif /* CONFIG_SYSFS */
195 205
196#endif /* _SYSFS_H_ */ 206#endif /* _SYSFS_H_ */
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 4812ff60561c..e657e523b9bf 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -11,6 +11,8 @@
11 * based upon discusions in irc://irc.openprojects.net/#kernelnewbies 11 * based upon discusions in irc://irc.openprojects.net/#kernelnewbies
12 */ 12 */
13 13
14#ifndef _LINUX_SYSRQ_H
15#define _LINUX_SYSRQ_H
14 16
15struct pt_regs; 17struct pt_regs;
16struct tty_struct; 18struct tty_struct;
@@ -57,3 +59,5 @@ static inline int __reterr(void)
57#define unregister_sysrq_key(ig,nore) __reterr() 59#define unregister_sysrq_key(ig,nore) __reterr()
58 60
59#endif 61#endif
62
63#endif /* _LINUX_SYSRQ_H */
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index f1cb6cddd19d..45248806ae9c 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -2,6 +2,7 @@
2 * 2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006 3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006 4 * (C) Balbir Singh, IBM Corp. 2006
5 * (C) Jay Lan, SGI, 2006
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2.1 of the GNU Lesser General Public License 8 * under the terms of version 2.1 of the GNU Lesser General Public License
@@ -29,16 +30,25 @@
29 * c) add new fields after version comment; maintain 64-bit alignment 30 * c) add new fields after version comment; maintain 64-bit alignment
30 */ 31 */
31 32
32#define TASKSTATS_VERSION 1 33
34#define TASKSTATS_VERSION 2
35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
36 * in linux/sched.h */
33 37
34struct taskstats { 38struct taskstats {
35 39
36 /* Version 1 */ 40 /* The version number of this struct. This field is always set to
41 * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
42 * Each time the struct is changed, the value should be incremented.
43 */
37 __u16 version; 44 __u16 version;
38 __u16 padding[3]; /* Userspace should not interpret the padding 45 __u32 ac_exitcode; /* Exit status */
39 * field which can be replaced by useful 46
40 * fields if struct taskstats is extended. 47 /* The accounting flags of a task as defined in <linux/acct.h>
41 */ 48 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
49 */
50 __u8 ac_flag; /* Record flags */
51 __u8 ac_nice; /* task_nice */
42 52
43 /* Delay accounting fields start 53 /* Delay accounting fields start
44 * 54 *
@@ -88,6 +98,48 @@ struct taskstats {
88 __u64 cpu_run_virtual_total; 98 __u64 cpu_run_virtual_total;
89 /* Delay accounting fields end */ 99 /* Delay accounting fields end */
90 /* version 1 ends here */ 100 /* version 1 ends here */
101
102 /* Basic Accounting Fields start */
103 char ac_comm[TS_COMM_LEN]; /* Command name */
104 __u8 ac_sched; /* Scheduling discipline */
105 __u8 ac_pad[3];
106 __u32 ac_uid; /* User ID */
107 __u32 ac_gid; /* Group ID */
108 __u32 ac_pid; /* Process ID */
109 __u32 ac_ppid; /* Parent process ID */
110 __u32 ac_btime; /* Begin time [sec since 1970] */
111 __u64 ac_etime; /* Elapsed time [usec] */
112 __u64 ac_utime; /* User CPU time [usec] */
113 __u64 ac_stime; /* SYstem CPU time [usec] */
114 __u64 ac_minflt; /* Minor Page Fault Count */
115 __u64 ac_majflt; /* Major Page Fault Count */
116 /* Basic Accounting Fields end */
117
118 /* Extended accounting fields start */
119 /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
120 * The current rss usage is added to this counter every time
121 * a tick is charged to a task's system time. So, at the end we
122 * will have memory usage multiplied by system time. Thus an
123 * average usage per system time unit can be calculated.
124 */
125 __u64 coremem; /* accumulated RSS usage in MB-usec */
126 /* Accumulated virtual memory usage in duration of a task.
127 * Same as acct_rss_mem1 above except that we keep track of VM usage.
128 */
129 __u64 virtmem; /* accumulated VM usage in MB-usec */
130
131 /* High watermark of RSS and virtual memory usage in duration of
132 * a task, in KBytes.
133 */
134 __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */
135 __u64 hiwater_vm; /* High-water VM usage, in KB */
136
137 /* The following four fields are I/O statistics of a task. */
138 __u64 read_char; /* bytes read */
139 __u64 write_char; /* bytes written */
140 __u64 read_syscalls; /* read syscalls */
141 __u64 write_syscalls; /* write syscalls */
142 /* Extended accounting fields end */
91}; 143};
92 144
93 145
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8ebf497907f8..0e058a2d1c6d 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -21,10 +21,10 @@
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22 22
23struct tcphdr { 23struct tcphdr {
24 __u16 source; 24 __be16 source;
25 __u16 dest; 25 __be16 dest;
26 __u32 seq; 26 __be32 seq;
27 __u32 ack_seq; 27 __be32 ack_seq;
28#if defined(__LITTLE_ENDIAN_BITFIELD) 28#if defined(__LITTLE_ENDIAN_BITFIELD)
29 __u16 res1:4, 29 __u16 res1:4,
30 doff:4, 30 doff:4,
@@ -50,9 +50,9 @@ struct tcphdr {
50#else 50#else
51#error "Adjust your <asm/byteorder.h> defines" 51#error "Adjust your <asm/byteorder.h> defines"
52#endif 52#endif
53 __u16 window; 53 __be16 window;
54 __u16 check; 54 __be16 check;
55 __u16 urg_ptr; 55 __be16 urg_ptr;
56}; 56};
57 57
58/* 58/*
@@ -62,7 +62,7 @@ struct tcphdr {
62 */ 62 */
63union tcp_word_hdr { 63union tcp_word_hdr {
64 struct tcphdr hdr; 64 struct tcphdr hdr;
65 __u32 words[5]; 65 __be32 words[5];
66}; 66};
67 67
68#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) 68#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
@@ -166,6 +166,11 @@ struct tcp_info
166#include <net/inet_timewait_sock.h> 166#include <net/inet_timewait_sock.h>
167 167
168/* This defines a selective acknowledgement block. */ 168/* This defines a selective acknowledgement block. */
169struct tcp_sack_block_wire {
170 __be32 start_seq;
171 __be32 end_seq;
172};
173
169struct tcp_sack_block { 174struct tcp_sack_block {
170 __u32 start_seq; 175 __u32 start_seq;
171 __u32 end_seq; 176 __u32 end_seq;
@@ -211,7 +216,7 @@ struct tcp_sock {
211 * Header prediction flags 216 * Header prediction flags
212 * 0x5?10 << 16 + snd_wnd in net byte order 217 * 0x5?10 << 16 + snd_wnd in net byte order
213 */ 218 */
214 __u32 pred_flags; 219 __be32 pred_flags;
215 220
216/* 221/*
217 * RFC793 variables by their proper names. This means you can 222 * RFC793 variables by their proper names. This means you can
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
new file mode 100644
index 000000000000..203dd5e11ecb
--- /dev/null
+++ b/include/linux/tifm.h
@@ -0,0 +1,158 @@
1/*
2 * tifm.h - TI FlashMedia driver
3 *
4 * Copyright (C) 2006 Alex Dubov <oakad@yahoo.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef _TIFM_H
13#define _TIFM_H
14
15#include <linux/spinlock.h>
16#include <linux/interrupt.h>
17#include <linux/wait.h>
18#include <linux/delay.h>
19#include <linux/pci.h>
20
21/* Host registers (relative to pci base address): */
22enum {
23 FM_SET_INTERRUPT_ENABLE = 0x008,
24 FM_CLEAR_INTERRUPT_ENABLE = 0x00c,
25 FM_INTERRUPT_STATUS = 0x014 };
26
27/* Socket registers (relative to socket base address): */
28enum {
29 SOCK_CONTROL = 0x004,
30 SOCK_PRESENT_STATE = 0x008,
31 SOCK_DMA_ADDRESS = 0x00c,
32 SOCK_DMA_CONTROL = 0x010,
33 SOCK_DMA_FIFO_INT_ENABLE_SET = 0x014,
34 SOCK_DMA_FIFO_INT_ENABLE_CLEAR = 0x018,
35 SOCK_DMA_FIFO_STATUS = 0x020,
36 SOCK_FIFO_CONTROL = 0x024,
37 SOCK_FIFO_PAGE_SIZE = 0x028,
38 SOCK_MMCSD_COMMAND = 0x104,
39 SOCK_MMCSD_ARG_LOW = 0x108,
40 SOCK_MMCSD_ARG_HIGH = 0x10c,
41 SOCK_MMCSD_CONFIG = 0x110,
42 SOCK_MMCSD_STATUS = 0x114,
43 SOCK_MMCSD_INT_ENABLE = 0x118,
44 SOCK_MMCSD_COMMAND_TO = 0x11c,
45 SOCK_MMCSD_DATA_TO = 0x120,
46 SOCK_MMCSD_DATA = 0x124,
47 SOCK_MMCSD_BLOCK_LEN = 0x128,
48 SOCK_MMCSD_NUM_BLOCKS = 0x12c,
49 SOCK_MMCSD_BUFFER_CONFIG = 0x130,
50 SOCK_MMCSD_SPI_CONFIG = 0x134,
51 SOCK_MMCSD_SDIO_MODE_CONFIG = 0x138,
52 SOCK_MMCSD_RESPONSE = 0x144,
53 SOCK_MMCSD_SDIO_SR = 0x164,
54 SOCK_MMCSD_SYSTEM_CONTROL = 0x168,
55 SOCK_MMCSD_SYSTEM_STATUS = 0x16c,
56 SOCK_MS_COMMAND = 0x184,
57 SOCK_MS_DATA = 0x188,
58 SOCK_MS_STATUS = 0x18c,
59 SOCK_MS_SYSTEM = 0x190,
60 SOCK_FIFO_ACCESS = 0x200 };
61
62
63#define TIFM_IRQ_ENABLE 0x80000000
64#define TIFM_IRQ_SOCKMASK 0x00000001
65#define TIFM_IRQ_CARDMASK 0x00000100
66#define TIFM_IRQ_FIFOMASK 0x00010000
67#define TIFM_IRQ_SETALL 0xffffffff
68#define TIFM_IRQ_SETALLSOCK 0x0000000f
69
70#define TIFM_CTRL_LED 0x00000040
71#define TIFM_CTRL_FAST_CLK 0x00000100
72
73#define TIFM_SOCK_STATE_OCCUPIED 0x00000008
74#define TIFM_SOCK_STATE_POWERED 0x00000080
75
76#define TIFM_FIFO_ENABLE 0x00000001 /* Meaning of this constant is unverified */
77#define TIFM_FIFO_INT_SETALL 0x0000ffff
78#define TIFM_FIFO_INTMASK 0x00000005 /* Meaning of this constant is unverified */
79
80#define TIFM_DMA_RESET 0x00000002 /* Meaning of this constant is unverified */
81#define TIFM_DMA_TX 0x00008000 /* Meaning of this constant is unverified */
82#define TIFM_DMA_EN 0x00000001 /* Meaning of this constant is unverified */
83
84typedef enum {FM_NULL = 0, FM_XD = 0x01, FM_MS = 0x02, FM_SD = 0x03} tifm_media_id;
85
86struct tifm_driver;
87struct tifm_dev {
88 char __iomem *addr;
89 spinlock_t lock;
90 tifm_media_id media_id;
91 char wq_name[KOBJ_NAME_LEN];
92 struct workqueue_struct *wq;
93
94 unsigned int (*signal_irq)(struct tifm_dev *sock,
95 unsigned int sock_irq_status);
96
97 struct tifm_driver *drv;
98 struct device dev;
99};
100
101struct tifm_driver {
102 tifm_media_id *id_table;
103 int (*probe)(struct tifm_dev *dev);
104 void (*remove)(struct tifm_dev *dev);
105
106 struct device_driver driver;
107};
108
109struct tifm_adapter {
110 char __iomem *addr;
111 unsigned int irq_status;
112 unsigned int insert_mask;
113 unsigned int remove_mask;
114 spinlock_t lock;
115 unsigned int id;
116 unsigned int max_sockets;
117 char wq_name[KOBJ_NAME_LEN];
118 unsigned int inhibit_new_cards;
119 struct workqueue_struct *wq;
120 struct work_struct media_inserter;
121 struct work_struct media_remover;
122 struct tifm_dev **sockets;
123 struct class_device cdev;
124 struct device *dev;
125
126 void (*eject)(struct tifm_adapter *fm, struct tifm_dev *sock);
127};
128
129struct tifm_adapter *tifm_alloc_adapter(void);
130void tifm_free_device(struct device *dev);
131void tifm_free_adapter(struct tifm_adapter *fm);
132int tifm_add_adapter(struct tifm_adapter *fm);
133void tifm_remove_adapter(struct tifm_adapter *fm);
134struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id);
135int tifm_register_driver(struct tifm_driver *drv);
136void tifm_unregister_driver(struct tifm_driver *drv);
137void tifm_eject(struct tifm_dev *sock);
138int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
139 int direction);
140void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
141 int direction);
142
143
144static inline void *tifm_get_drvdata(struct tifm_dev *dev)
145{
146 return dev_get_drvdata(&dev->dev);
147}
148
149static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data)
150{
151 dev_set_drvdata(&dev->dev, data);
152}
153
154struct tifm_device_id {
155 tifm_media_id media_id;
156};
157
158#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index d543d3871e38..049dfe4a11f2 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -69,34 +69,28 @@
69 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, 69 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
70 * respectively. 70 * respectively.
71 */ 71 */
72#define SHIFT_KG 6 /* phase factor (shift) */ 72#define SHIFT_PLL 4 /* PLL frequency factor (shift) */
73#define SHIFT_KF 16 /* PLL frequency factor (shift) */ 73#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
74#define SHIFT_KH 2 /* FLL frequency factor (shift) */ 74#define MAXTC 10 /* maximum time constant (shift) */
75#define MAXTC 6 /* maximum time constant (shift) */
76 75
77/* 76/*
78 * The SHIFT_SCALE define establishes the decimal point of the time_phase 77 * The SHIFT_UPDATE define establishes the decimal point of the
79 * variable which serves as an extension to the low-order bits of the 78 * time_offset variable which represents the current offset with
80 * system clock variable. The SHIFT_UPDATE define establishes the decimal 79 * respect to standard time.
81 * point of the time_offset variable which represents the current offset
82 * with respect to standard time. The FINENSEC define represents 1 nsec in
83 * scaled units.
84 * 80 *
85 * SHIFT_USEC defines the scaling (shift) of the time_freq and 81 * SHIFT_USEC defines the scaling (shift) of the time_freq and
86 * time_tolerance variables, which represent the current frequency 82 * time_tolerance variables, which represent the current frequency
87 * offset and maximum frequency tolerance. 83 * offset and maximum frequency tolerance.
88 *
89 * FINENSEC is 1 ns in SHIFT_UPDATE units of the time_phase variable.
90 */ 84 */
91#define SHIFT_SCALE 22 /* phase scale (shift) */ 85#define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */
92#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */
93#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 86#define SHIFT_USEC 16 /* frequency offset scale (shift) */
94#define FINENSEC (1L << (SHIFT_SCALE - 10)) /* ~1 ns in phase units */ 87#define SHIFT_NSEC 12 /* kernel frequency offset scale */
95 88
96#define MAXPHASE 512000L /* max phase error (us) */ 89#define MAXPHASE 512000L /* max phase error (us) */
97#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ 90#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */
98#define MINSEC 16L /* min interval between updates (s) */ 91#define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */
99#define MAXSEC 1200L /* max interval between updates (s) */ 92#define MINSEC 256 /* min interval between updates (s) */
93#define MAXSEC 2048 /* max interval between updates (s) */
100#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ 94#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */
101 95
102/* 96/*
@@ -204,33 +198,15 @@ extern int tickadj; /* amount of adjustment per tick */
204/* 198/*
205 * phase-lock loop variables 199 * phase-lock loop variables
206 */ 200 */
207extern int time_state; /* clock status */
208extern int time_status; /* clock synchronization status bits */ 201extern int time_status; /* clock synchronization status bits */
209extern long time_offset; /* time adjustment (us) */
210extern long time_constant; /* pll time constant */
211extern long time_tolerance; /* frequency tolerance (ppm) */
212extern long time_precision; /* clock precision (us) */
213extern long time_maxerror; /* maximum error */ 202extern long time_maxerror; /* maximum error */
214extern long time_esterror; /* estimated error */ 203extern long time_esterror; /* estimated error */
215 204
216extern long time_freq; /* frequency offset (scaled ppm) */ 205extern long time_freq; /* frequency offset (scaled ppm) */
217extern long time_reftime; /* time at last adjustment (s) */
218 206
219extern long time_adjust; /* The amount of adjtime left */ 207extern long time_adjust; /* The amount of adjtime left */
220extern long time_next_adjust; /* Value for time_adjust at next tick */
221 208
222/** 209extern void ntp_clear(void);
223 * ntp_clear - Clears the NTP state variables
224 *
225 * Must be called while holding a write on the xtime_lock
226 */
227static inline void ntp_clear(void)
228{
229 time_adjust = 0; /* stop active adjtime() */
230 time_status |= STA_UNSYNC;
231 time_maxerror = NTP_PHASE_LIMIT;
232 time_esterror = NTP_PHASE_LIMIT;
233}
234 210
235/** 211/**
236 * ntp_synced - Returns 1 if the NTP status is not UNSYNC 212 * ntp_synced - Returns 1 if the NTP status is not UNSYNC
@@ -294,11 +270,15 @@ extern void register_time_interpolator(struct time_interpolator *);
294extern void unregister_time_interpolator(struct time_interpolator *); 270extern void unregister_time_interpolator(struct time_interpolator *);
295extern void time_interpolator_reset(void); 271extern void time_interpolator_reset(void);
296extern unsigned long time_interpolator_get_offset(void); 272extern unsigned long time_interpolator_get_offset(void);
273extern void time_interpolator_update(long delta_nsec);
297 274
298#else /* !CONFIG_TIME_INTERPOLATION */ 275#else /* !CONFIG_TIME_INTERPOLATION */
299 276
300static inline void 277static inline void time_interpolator_reset(void)
301time_interpolator_reset(void) 278{
279}
280
281static inline void time_interpolator_update(long delta_nsec)
302{ 282{
303} 283}
304 284
@@ -309,6 +289,8 @@ time_interpolator_reset(void)
309/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 289/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
310extern u64 current_tick_length(void); 290extern u64 current_tick_length(void);
311 291
292extern void second_overflow(void);
293extern void update_ntp_one_tick(void);
312extern int do_adjtimex(struct timex *); 294extern int do_adjtimex(struct timex *);
313 295
314#endif /* KERNEL */ 296#endif /* KERNEL */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index ec1eca85290a..da508d1998e4 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -89,6 +89,7 @@
89#define SD_SIBLING_INIT (struct sched_domain) { \ 89#define SD_SIBLING_INIT (struct sched_domain) { \
90 .span = CPU_MASK_NONE, \ 90 .span = CPU_MASK_NONE, \
91 .parent = NULL, \ 91 .parent = NULL, \
92 .child = NULL, \
92 .groups = NULL, \ 93 .groups = NULL, \
93 .min_interval = 1, \ 94 .min_interval = 1, \
94 .max_interval = 2, \ 95 .max_interval = 2, \
@@ -114,11 +115,44 @@
114#endif 115#endif
115#endif /* CONFIG_SCHED_SMT */ 116#endif /* CONFIG_SCHED_SMT */
116 117
118#ifdef CONFIG_SCHED_MC
119/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
120#ifndef SD_MC_INIT
121#define SD_MC_INIT (struct sched_domain) { \
122 .span = CPU_MASK_NONE, \
123 .parent = NULL, \
124 .child = NULL, \
125 .groups = NULL, \
126 .min_interval = 1, \
127 .max_interval = 4, \
128 .busy_factor = 64, \
129 .imbalance_pct = 125, \
130 .cache_nice_tries = 1, \
131 .per_cpu_gain = 100, \
132 .busy_idx = 2, \
133 .idle_idx = 1, \
134 .newidle_idx = 2, \
135 .wake_idx = 1, \
136 .forkexec_idx = 1, \
137 .flags = SD_LOAD_BALANCE \
138 | SD_BALANCE_NEWIDLE \
139 | SD_BALANCE_EXEC \
140 | SD_WAKE_AFFINE \
141 | SD_SHARE_PKG_RESOURCES\
142 | BALANCE_FOR_MC_POWER, \
143 .last_balance = jiffies, \
144 .balance_interval = 1, \
145 .nr_balance_failed = 0, \
146}
147#endif
148#endif /* CONFIG_SCHED_MC */
149
117/* Common values for CPUs */ 150/* Common values for CPUs */
118#ifndef SD_CPU_INIT 151#ifndef SD_CPU_INIT
119#define SD_CPU_INIT (struct sched_domain) { \ 152#define SD_CPU_INIT (struct sched_domain) { \
120 .span = CPU_MASK_NONE, \ 153 .span = CPU_MASK_NONE, \
121 .parent = NULL, \ 154 .parent = NULL, \
155 .child = NULL, \
122 .groups = NULL, \ 156 .groups = NULL, \
123 .min_interval = 1, \ 157 .min_interval = 1, \
124 .max_interval = 4, \ 158 .max_interval = 4, \
@@ -135,7 +169,7 @@
135 | SD_BALANCE_NEWIDLE \ 169 | SD_BALANCE_NEWIDLE \
136 | SD_BALANCE_EXEC \ 170 | SD_BALANCE_EXEC \
137 | SD_WAKE_AFFINE \ 171 | SD_WAKE_AFFINE \
138 | BALANCE_FOR_POWER, \ 172 | BALANCE_FOR_PKG_POWER,\
139 .last_balance = jiffies, \ 173 .last_balance = jiffies, \
140 .balance_interval = 1, \ 174 .balance_interval = 1, \
141 .nr_balance_failed = 0, \ 175 .nr_balance_failed = 0, \
@@ -146,6 +180,7 @@
146#define SD_ALLNODES_INIT (struct sched_domain) { \ 180#define SD_ALLNODES_INIT (struct sched_domain) { \
147 .span = CPU_MASK_NONE, \ 181 .span = CPU_MASK_NONE, \
148 .parent = NULL, \ 182 .parent = NULL, \
183 .child = NULL, \
149 .groups = NULL, \ 184 .groups = NULL, \
150 .min_interval = 64, \ 185 .min_interval = 64, \
151 .max_interval = 64*num_online_cpus(), \ 186 .max_interval = 64*num_online_cpus(), \
@@ -165,15 +200,6 @@
165 .nr_balance_failed = 0, \ 200 .nr_balance_failed = 0, \
166} 201}
167 202
168#ifdef CONFIG_SCHED_MC
169#ifndef SD_MC_INIT
170/* for now its same as SD_CPU_INIT.
171 * TBD: Tune Domain parameters!
172 */
173#define SD_MC_INIT SD_CPU_INIT
174#endif
175#endif
176
177#ifdef CONFIG_NUMA 203#ifdef CONFIG_NUMA
178#ifndef SD_NODE_INIT 204#ifndef SD_NODE_INIT
179#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 205#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
index 99e02ef54c47..bfc84a7aecc5 100644
--- a/include/linux/trdevice.h
+++ b/include/linux/trdevice.h
@@ -28,7 +28,7 @@
28#include <linux/if_tr.h> 28#include <linux/if_tr.h>
29 29
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev); 31extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev);
32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); 32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
33extern struct net_device *alloc_trdev(int sizeof_priv); 33extern struct net_device *alloc_trdev(int sizeof_priv);
34 34
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h
new file mode 100644
index 000000000000..7e50ac795b0b
--- /dev/null
+++ b/include/linux/tsacct_kern.h
@@ -0,0 +1,34 @@
1/*
2 * tsacct_kern.h - kernel header for system accounting over taskstats interface
3 *
4 * Copyright (C) Jay Lan SGI
5 */
6
7#ifndef _LINUX_TSACCT_KERN_H
8#define _LINUX_TSACCT_KERN_H
9
10#include <linux/taskstats.h>
11
12#ifdef CONFIG_TASKSTATS
13extern void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk);
14#else
15static inline void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
16{}
17#endif /* CONFIG_TASKSTATS */
18
19#ifdef CONFIG_TASK_XACCT
20extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p);
21extern void acct_update_integrals(struct task_struct *tsk);
22extern void acct_clear_integrals(struct task_struct *tsk);
23#else
24static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
25{}
26static inline void acct_update_integrals(struct task_struct *tsk)
27{}
28static inline void acct_clear_integrals(struct task_struct *tsk)
29{}
30#endif /* CONFIG_TASK_XACCT */
31
32#endif
33
34
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 04827ca65781..44091c0db0b4 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -174,7 +174,7 @@ struct tty_struct {
174 struct tty_driver *driver; 174 struct tty_driver *driver;
175 int index; 175 int index;
176 struct tty_ldisc ldisc; 176 struct tty_ldisc ldisc;
177 struct semaphore termios_sem; 177 struct mutex termios_mutex;
178 struct termios *termios, *termios_locked; 178 struct termios *termios, *termios_locked;
179 char name[64]; 179 char name[64];
180 int pgrp; 180 int pgrp;
@@ -190,7 +190,6 @@ struct tty_struct {
190 struct tty_struct *link; 190 struct tty_struct *link;
191 struct fasync_struct *fasync; 191 struct fasync_struct *fasync;
192 struct tty_bufhead buf; 192 struct tty_bufhead buf;
193 int max_flip_cnt;
194 int alt_speed; /* For magic substitution of 38400 bps */ 193 int alt_speed; /* For magic substitution of 38400 bps */
195 wait_queue_head_t write_wait; 194 wait_queue_head_t write_wait;
196 wait_queue_head_t read_wait; 195 wait_queue_head_t read_wait;
@@ -308,6 +307,9 @@ extern void tty_ldisc_put(int);
308extern void tty_wakeup(struct tty_struct *tty); 307extern void tty_wakeup(struct tty_struct *tty);
309extern void tty_ldisc_flush(struct tty_struct *tty); 308extern void tty_ldisc_flush(struct tty_struct *tty);
310 309
310extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
311 unsigned long arg);
312
311extern struct mutex tty_mutex; 313extern struct mutex tty_mutex;
312 314
313/* n_tty.c */ 315/* n_tty.c */
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 58c961c9e170..5c8473bb6882 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -219,7 +219,8 @@ extern struct list_head tty_drivers;
219 219
220struct tty_driver *alloc_tty_driver(int lines); 220struct tty_driver *alloc_tty_driver(int lines);
221void put_tty_driver(struct tty_driver *driver); 221void put_tty_driver(struct tty_driver *driver);
222void tty_set_operations(struct tty_driver *driver, struct tty_operations *op); 222void tty_set_operations(struct tty_driver *driver,
223 const struct tty_operations *op);
223 224
224/* tty driver magic number */ 225/* tty driver magic number */
225#define TTY_DRIVER_MAGIC 0x5402 226#define TTY_DRIVER_MAGIC 0x5402
diff --git a/include/linux/types.h b/include/linux/types.h
index 3f235660a3cd..750f085fa564 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -33,6 +33,8 @@ typedef __kernel_clockid_t clockid_t;
33typedef __kernel_mqd_t mqd_t; 33typedef __kernel_mqd_t mqd_t;
34 34
35#ifdef __KERNEL__ 35#ifdef __KERNEL__
36typedef _Bool bool;
37
36typedef __kernel_uid32_t uid_t; 38typedef __kernel_uid32_t uid_t;
37typedef __kernel_gid32_t gid_t; 39typedef __kernel_gid32_t gid_t;
38typedef __kernel_uid16_t uid16_t; 40typedef __kernel_uid16_t uid16_t;
@@ -127,8 +129,12 @@ typedef __s64 int64_t;
127/* this is a special 64bit data type that is 8-byte aligned */ 129/* this is a special 64bit data type that is 8-byte aligned */
128#define aligned_u64 unsigned long long __attribute__((aligned(8))) 130#define aligned_u64 unsigned long long __attribute__((aligned(8)))
129 131
130/* 132/**
131 * The type used for indexing onto a disc or disc partition. 133 * The type used for indexing onto a disc or disc partition.
134 *
135 * Linux always considers sectors to be 512 bytes long independently
136 * of the devices real block size.
137 *
132 * If required, asm/types.h can override it and define 138 * If required, asm/types.h can override it and define
133 * HAVE_SECTOR_T 139 * HAVE_SECTOR_T
134 */ 140 */
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 391e7ed1eb3f..a48d7f11c7be 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -19,4 +19,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,
19 19
20#endif /* ARCH_HAS_NOCACHE_UACCESS */ 20#endif /* ARCH_HAS_NOCACHE_UACCESS */
21 21
22/**
23 * probe_kernel_address(): safely attempt to read from a location
24 * @addr: address to read from - its type is type typeof(retval)*
25 * @retval: read into this variable
26 *
27 * Safely read from address @addr into variable @revtal. If a kernel fault
28 * happens, handle that and return -EFAULT.
29 * We ensure that the __get_user() is executed in atomic context so that
30 * do_page_fault() doesn't attempt to take mmap_sem. This makes
31 * probe_kernel_address() suitable for use within regions where the caller
32 * already holds mmap_sem, or other locks which nest inside mmap_sem.
33 */
34#define probe_kernel_address(addr, retval) \
35 ({ \
36 long ret; \
37 \
38 inc_preempt_count(); \
39 ret = __get_user(retval, addr); \
40 dec_preempt_count(); \
41 ret; \
42 })
43
22#endif /* __LINUX_UACCESS_H__ */ 44#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 90223f057d50..014b41d1e308 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -20,10 +20,10 @@
20#include <linux/types.h> 20#include <linux/types.h>
21 21
22struct udphdr { 22struct udphdr {
23 __u16 source; 23 __be16 source;
24 __u16 dest; 24 __be16 dest;
25 __u16 len; 25 __be16 len;
26 __u16 check; 26 __be16 check;
27}; 27};
28 28
29/* UDP socket options */ 29/* UDP socket options */
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 7168302f9844..1fd61eeed664 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -22,12 +22,18 @@
22 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> 22 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
23 * 23 *
24 * Changes/Revisions: 24 * Changes/Revisions:
25 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
26 * - update ff support for the changes in kernel interface
27 * - add UINPUT_VERSION
25 * 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>) 28 * 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>)
26 * - added force feedback support 29 * - added force feedback support
27 * - added UI_SET_PHYS 30 * - added UI_SET_PHYS
28 * 0.1 20/06/2002 31 * 0.1 20/06/2002
29 * - first public version 32 * - first public version
30 */ 33 */
34
35#define UINPUT_VERSION 3
36
31#ifdef __KERNEL__ 37#ifdef __KERNEL__
32#define UINPUT_MINOR 223 38#define UINPUT_MINOR 223
33#define UINPUT_NAME "uinput" 39#define UINPUT_NAME "uinput"
@@ -45,7 +51,10 @@ struct uinput_request {
45 51
46 union { 52 union {
47 int effect_id; 53 int effect_id;
48 struct ff_effect* effect; 54 struct {
55 struct ff_effect *effect;
56 struct ff_effect *old;
57 } upload;
49 } u; 58 } u;
50}; 59};
51 60
@@ -58,6 +67,7 @@ struct uinput_device {
58 unsigned char head; 67 unsigned char head;
59 unsigned char tail; 68 unsigned char tail;
60 struct input_event buff[UINPUT_BUFFER_SIZE]; 69 struct input_event buff[UINPUT_BUFFER_SIZE];
70 int ff_effects_max;
61 71
62 struct uinput_request *requests[UINPUT_NUM_REQUESTS]; 72 struct uinput_request *requests[UINPUT_NUM_REQUESTS];
63 wait_queue_head_t requests_waitq; 73 wait_queue_head_t requests_waitq;
@@ -69,6 +79,7 @@ struct uinput_ff_upload {
69 int request_id; 79 int request_id;
70 int retval; 80 int retval;
71 struct ff_effect effect; 81 struct ff_effect effect;
82 struct ff_effect old;
72}; 83};
73 84
74struct uinput_ff_erase { 85struct uinput_ff_erase {
@@ -98,33 +109,33 @@ struct uinput_ff_erase {
98#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) 109#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
99#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) 110#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
100 111
101/* To write a force-feedback-capable driver, the upload_effect 112/*
113 * To write a force-feedback-capable driver, the upload_effect
102 * and erase_effect callbacks in input_dev must be implemented. 114 * and erase_effect callbacks in input_dev must be implemented.
103 * The uinput driver will generate a fake input event when one of 115 * The uinput driver will generate a fake input event when one of
104 * these callbacks are invoked. The userspace code then uses 116 * these callbacks are invoked. The userspace code then uses
105 * ioctls to retrieve additional parameters and send the return code. 117 * ioctls to retrieve additional parameters and send the return code.
106 * The callback blocks until this return code is sent. 118 * The callback blocks until this return code is sent.
107 * 119 *
108 * The described callback mechanism is only used if EV_FF is set. 120 * The described callback mechanism is only used if ff_effects_max
109 * Otherwise, default implementations of upload_effect and erase_effect 121 * is set.
110 * are used.
111 * 122 *
112 * To implement upload_effect(): 123 * To implement upload_effect():
113 * 1. Wait for an event with type==EV_UINPUT and code==UI_FF_UPLOAD. 124 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD.
114 * A request ID will be given in 'value'. 125 * A request ID will be given in 'value'.
115 * 2. Allocate a uinput_ff_upload struct, fill in request_id with 126 * 2. Allocate a uinput_ff_upload struct, fill in request_id with
116 * the 'value' from the EV_UINPUT event. 127 * the 'value' from the EV_UINPUT event.
117 * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the 128 * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the
118 * uinput_ff_upload struct. It will be filled in with the 129 * uinput_ff_upload struct. It will be filled in with the
119 * ff_effect passed to upload_effect(). 130 * ff_effects passed to upload_effect().
120 * 4. Perform the effect upload, and place the modified ff_effect 131 * 4. Perform the effect upload, and place a return code back into
121 * and a return code back into the uinput_ff_upload struct. 132 the uinput_ff_upload struct.
122 * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the 133 * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the
123 * uinput_ff_upload_effect struct. This will complete execution 134 * uinput_ff_upload_effect struct. This will complete execution
124 * of our upload_effect() handler. 135 * of our upload_effect() handler.
125 * 136 *
126 * To implement erase_effect(): 137 * To implement erase_effect():
127 * 1. Wait for an event with type==EV_UINPUT and code==UI_FF_ERASE. 138 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE.
128 * A request ID will be given in 'value'. 139 * A request ID will be given in 'value'.
129 * 2. Allocate a uinput_ff_erase struct, fill in request_id with 140 * 2. Allocate a uinput_ff_erase struct, fill in request_id with
130 * the 'value' from the EV_UINPUT event. 141 * the 'value' from the EV_UINPUT event.
@@ -133,13 +144,13 @@ struct uinput_ff_erase {
133 * effect ID passed to erase_effect(). 144 * effect ID passed to erase_effect().
134 * 4. Perform the effect erasure, and place a return code back 145 * 4. Perform the effect erasure, and place a return code back
135 * into the uinput_ff_erase struct. 146 * into the uinput_ff_erase struct.
136 * and a return code back into the uinput_ff_erase struct.
137 * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the 147 * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the
138 * uinput_ff_erase_effect struct. This will complete execution 148 * uinput_ff_erase_effect struct. This will complete execution
139 * of our erase_effect() handler. 149 * of our erase_effect() handler.
140 */ 150 */
141 151
142/* This is the new event type, used only by uinput. 152/*
153 * This is the new event type, used only by uinput.
143 * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value' 154 * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value'
144 * is the unique request ID. This number was picked 155 * is the unique request ID. This number was picked
145 * arbitrarily, above EV_MAX (since the input system 156 * arbitrarily, above EV_MAX (since the input system
diff --git a/include/linux/unistd.h b/include/linux/unistd.h
index c18c60f3254e..aa8d5b5e2e3e 100644
--- a/include/linux/unistd.h
+++ b/include/linux/unistd.h
@@ -1,12 +1,8 @@
1#ifndef _LINUX_UNISTD_H_ 1#ifndef _LINUX_UNISTD_H_
2#define _LINUX_UNISTD_H_ 2#define _LINUX_UNISTD_H_
3 3
4#ifdef __KERNEL__
5extern int errno;
6#endif
7
8/* 4/*
9 * Include machine specific syscallX macros 5 * Include machine specific syscall numbers
10 */ 6 */
11#include <asm/unistd.h> 7#include <asm/unistd.h>
12 8
diff --git a/include/linux/unwind.h b/include/linux/unwind.h
index ce48e2cd37a2..73e1751d03dd 100644
--- a/include/linux/unwind.h
+++ b/include/linux/unwind.h
@@ -12,8 +12,6 @@
12 * is not much point in implementing the full Dwarf2 unwind API. 12 * is not much point in implementing the full Dwarf2 unwind API.
13 */ 13 */
14 14
15#include <linux/config.h>
16
17struct module; 15struct module;
18 16
19#ifdef CONFIG_STACK_UNWIND 17#ifdef CONFIG_STACK_UNWIND
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2bd0c8e0154..190cc1b78fe2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -19,6 +19,7 @@
19#include <linux/fs.h> /* for struct file_operations */ 19#include <linux/fs.h> /* for struct file_operations */
20#include <linux/completion.h> /* for struct completion */ 20#include <linux/completion.h> /* for struct completion */
21#include <linux/sched.h> /* for current && schedule_timeout */ 21#include <linux/sched.h> /* for current && schedule_timeout */
22#include <linux/mutex.h> /* for struct mutex */
22 23
23struct usb_device; 24struct usb_device;
24struct usb_driver; 25struct usb_driver;
@@ -102,8 +103,13 @@ enum usb_interface_condition {
102 * number from the USB core by calling usb_register_dev(). 103 * number from the USB core by calling usb_register_dev().
103 * @condition: binding state of the interface: not bound, binding 104 * @condition: binding state of the interface: not bound, binding
104 * (in probe()), bound to a driver, or unbinding (in disconnect()) 105 * (in probe()), bound to a driver, or unbinding (in disconnect())
106 * @is_active: flag set when the interface is bound and not suspended.
107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
108 * capability during autosuspend.
105 * @dev: driver model's view of this device 109 * @dev: driver model's view of this device
106 * @class_dev: driver model's class view of this device. 110 * @class_dev: driver model's class view of this device.
111 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
112 * allowed unless the counter is 0.
107 * 113 *
108 * USB device drivers attach to interfaces on a physical device. Each 114 * USB device drivers attach to interfaces on a physical device. Each
109 * interface encapsulates a single high level function, such as feeding 115 * interface encapsulates a single high level function, such as feeding
@@ -142,8 +148,12 @@ struct usb_interface {
142 int minor; /* minor number this interface is 148 int minor; /* minor number this interface is
143 * bound to */ 149 * bound to */
144 enum usb_interface_condition condition; /* state of binding */ 150 enum usb_interface_condition condition; /* state of binding */
151 unsigned is_active:1; /* the interface is not suspended */
152 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
153
145 struct device dev; /* interface specific device info */ 154 struct device dev; /* interface specific device info */
146 struct class_device *class_dev; 155 struct class_device *class_dev;
156 int pm_usage_cnt; /* usage counter for autosuspend */
147}; 157};
148#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 158#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
149#define interface_to_usbdev(intf) \ 159#define interface_to_usbdev(intf) \
@@ -254,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
254 264
255/* ----------------------------------------------------------------------- */ 265/* ----------------------------------------------------------------------- */
256 266
257struct usb_operations;
258
259/* USB device number allocation bitmap */ 267/* USB device number allocation bitmap */
260struct usb_devmap { 268struct usb_devmap {
261 unsigned long devicemap[128 / (8*sizeof(unsigned long))]; 269 unsigned long devicemap[128 / (8*sizeof(unsigned long))];
@@ -268,6 +276,7 @@ struct usb_bus {
268 struct device *controller; /* host/master side hardware */ 276 struct device *controller; /* host/master side hardware */
269 int busnum; /* Bus number (in order of reg) */ 277 int busnum; /* Bus number (in order of reg) */
270 char *bus_name; /* stable id (PCI slot_name etc) */ 278 char *bus_name; /* stable id (PCI slot_name etc) */
279 u8 uses_dma; /* Does the host controller use DMA? */
271 u8 otg_port; /* 0, or number of OTG/HNP port */ 280 u8 otg_port; /* 0, or number of OTG/HNP port */
272 unsigned is_b_host:1; /* true during some HNP roleswitches */ 281 unsigned is_b_host:1; /* true during some HNP roleswitches */
273 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 282 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
@@ -276,10 +285,8 @@ struct usb_bus {
276 * round-robin allocation */ 285 * round-robin allocation */
277 286
278 struct usb_devmap devmap; /* device address allocation map */ 287 struct usb_devmap devmap; /* device address allocation map */
279 struct usb_operations *op; /* Operations (specific to the HC) */
280 struct usb_device *root_hub; /* Root hub */ 288 struct usb_device *root_hub; /* Root hub */
281 struct list_head bus_list; /* list of busses */ 289 struct list_head bus_list; /* list of busses */
282 void *hcpriv; /* Host Controller private data */
283 290
284 int bandwidth_allocated; /* on this bus: how much of the time 291 int bandwidth_allocated; /* on this bus: how much of the time
285 * reserved for periodic (intr/iso) 292 * reserved for periodic (intr/iso)
@@ -294,8 +301,6 @@ struct usb_bus {
294 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 301 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
295 302
296 struct class_device *class_dev; /* class device for this bus */ 303 struct class_device *class_dev; /* class device for this bus */
297 struct kref kref; /* reference counting for this bus */
298 void (*release)(struct usb_bus *bus);
299 304
300#if defined(CONFIG_USB_MON) 305#if defined(CONFIG_USB_MON)
301 struct mon_bus *mon_bus; /* non-null when associated */ 306 struct mon_bus *mon_bus; /* non-null when associated */
@@ -350,6 +355,7 @@ struct usb_device {
350 355
351 unsigned short bus_mA; /* Current available from the bus */ 356 unsigned short bus_mA; /* Current available from the bus */
352 u8 portnum; /* Parent port number (origin 1) */ 357 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */
353 359
354 int have_langid; /* whether string_langid is valid */ 360 int have_langid; /* whether string_langid is valid */
355 int string_langid; /* language ID for strings */ 361 int string_langid; /* language ID for strings */
@@ -373,6 +379,15 @@ struct usb_device {
373 379
374 int maxchild; /* Number of ports if hub */ 380 int maxchild; /* Number of ports if hub */
375 struct usb_device *children[USB_MAXCHILDREN]; 381 struct usb_device *children[USB_MAXCHILDREN];
382
383 int pm_usage_cnt; /* usage counter for autosuspend */
384#ifdef CONFIG_PM
385 struct work_struct autosuspend; /* for delayed autosuspends */
386 struct mutex pm_mutex; /* protects PM operations */
387
388 unsigned auto_pm:1; /* autosuspend/resume in progress */
389 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
390#endif
376}; 391};
377#define to_usb_device(d) container_of(d, struct usb_device, dev) 392#define to_usb_device(d) container_of(d, struct usb_device, dev)
378 393
@@ -384,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev);
384#define usb_unlock_device(udev) up(&(udev)->dev.sem) 399#define usb_unlock_device(udev) up(&(udev)->dev.sem)
385#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) 400#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
386extern int usb_lock_device_for_reset(struct usb_device *udev, 401extern int usb_lock_device_for_reset(struct usb_device *udev,
387 struct usb_interface *iface); 402 const struct usb_interface *iface);
388 403
389/* USB port reset for device reinitialization */ 404/* USB port reset for device reinitialization */
390extern int usb_reset_device(struct usb_device *dev); 405extern int usb_reset_device(struct usb_device *dev);
@@ -393,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev,
393 408
394extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 409extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
395 410
411/* USB autosuspend and autoresume */
412#ifdef CONFIG_USB_SUSPEND
413extern int usb_autopm_get_interface(struct usb_interface *intf);
414extern void usb_autopm_put_interface(struct usb_interface *intf);
415
416#else
417#define usb_autopm_get_interface(intf) 0
418#define usb_autopm_put_interface(intf) do {} while (0)
419#endif
420
421
396/*-------------------------------------------------------------------------*/ 422/*-------------------------------------------------------------------------*/
397 423
398/* for drivers using iso endpoints */ 424/* for drivers using iso endpoints */
@@ -423,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
423 449
424extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 450extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
425 int minor); 451 int minor);
426extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, 452extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
427 unsigned ifnum); 453 unsigned ifnum);
428extern struct usb_host_interface *usb_altnum_to_altsetting( 454extern struct usb_host_interface *usb_altnum_to_altsetting(
429 struct usb_interface *intf, unsigned int altnum); 455 const struct usb_interface *intf, unsigned int altnum);
430 456
431 457
432/** 458/**
@@ -464,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
464 490
465/*-------------------------------------------------------------------------*/ 491/*-------------------------------------------------------------------------*/
466 492
493extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd);
494extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd);
495extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd);
496extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd);
497extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd);
498extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd);
499extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd);
500extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd);
501extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd);
502extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd);
503extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd);
504
505/*-------------------------------------------------------------------------*/
506
467#define USB_DEVICE_ID_MATCH_DEVICE \ 507#define USB_DEVICE_ID_MATCH_DEVICE \
468 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 508 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
469#define USB_DEVICE_ID_MATCH_DEV_RANGE \ 509#define USB_DEVICE_ID_MATCH_DEV_RANGE \
@@ -540,7 +580,17 @@ struct usb_dynids {
540}; 580};
541 581
542/** 582/**
543 * struct usb_driver - identifies USB driver to usbcore 583 * struct usbdrv_wrap - wrapper for driver-model structure
584 * @driver: The driver-model core driver structure.
585 * @for_devices: Non-zero for device drivers, 0 for interface drivers.
586 */
587struct usbdrv_wrap {
588 struct device_driver driver;
589 int for_devices;
590};
591
592/**
593 * struct usb_driver - identifies USB interface driver to usbcore
544 * @name: The driver name should be unique among USB drivers, 594 * @name: The driver name should be unique among USB drivers,
545 * and should normally be the same as the module name. 595 * and should normally be the same as the module name.
546 * @probe: Called to see if the driver is willing to manage a particular 596 * @probe: Called to see if the driver is willing to manage a particular
@@ -567,12 +617,14 @@ struct usb_dynids {
567 * or your driver's probe function will never get called. 617 * or your driver's probe function will never get called.
568 * @dynids: used internally to hold the list of dynamically added device 618 * @dynids: used internally to hold the list of dynamically added device
569 * ids for this driver. 619 * ids for this driver.
570 * @driver: the driver model core driver structure. 620 * @drvwrap: Driver-model core structure wrapper.
571 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be 621 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
572 * added to this driver by preventing the sysfs file from being created. 622 * added to this driver by preventing the sysfs file from being created.
623 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
624 * for interfaces bound to this driver.
573 * 625 *
574 * USB drivers must provide a name, probe() and disconnect() methods, 626 * USB interface drivers must provide a name, probe() and disconnect()
575 * and an id_table. Other driver fields are optional. 627 * methods, and an id_table. Other driver fields are optional.
576 * 628 *
577 * The id_table is used in hotplugging. It holds a set of descriptors, 629 * The id_table is used in hotplugging. It holds a set of descriptors,
578 * and specialized data may be associated with each entry. That table 630 * and specialized data may be associated with each entry. That table
@@ -606,10 +658,44 @@ struct usb_driver {
606 const struct usb_device_id *id_table; 658 const struct usb_device_id *id_table;
607 659
608 struct usb_dynids dynids; 660 struct usb_dynids dynids;
609 struct device_driver driver; 661 struct usbdrv_wrap drvwrap;
610 unsigned int no_dynamic_id:1; 662 unsigned int no_dynamic_id:1;
663 unsigned int supports_autosuspend:1;
611}; 664};
612#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 665#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
666
667/**
668 * struct usb_device_driver - identifies USB device driver to usbcore
669 * @name: The driver name should be unique among USB drivers,
670 * and should normally be the same as the module name.
671 * @probe: Called to see if the driver is willing to manage a particular
672 * device. If it is, probe returns zero and uses dev_set_drvdata()
673 * to associate driver-specific data with the device. If unwilling
674 * to manage the device, return a negative errno value.
675 * @disconnect: Called when the device is no longer accessible, usually
676 * because it has been (or is being) disconnected or the driver's
677 * module is being unloaded.
678 * @suspend: Called when the device is going to be suspended by the system.
679 * @resume: Called when the device is being resumed by the system.
680 * @drvwrap: Driver-model core structure wrapper.
681 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
682 * for devices bound to this driver.
683 *
684 * USB drivers must provide all the fields listed above except drvwrap.
685 */
686struct usb_device_driver {
687 const char *name;
688
689 int (*probe) (struct usb_device *udev);
690 void (*disconnect) (struct usb_device *udev);
691
692 int (*suspend) (struct usb_device *udev, pm_message_t message);
693 int (*resume) (struct usb_device *udev);
694 struct usbdrv_wrap drvwrap;
695 unsigned int supports_autosuspend:1;
696};
697#define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
698 drvwrap.driver)
613 699
614extern struct bus_type usb_bus_type; 700extern struct bus_type usb_bus_type;
615 701
@@ -633,13 +719,17 @@ struct usb_class_driver {
633 * use these in module_init()/module_exit() 719 * use these in module_init()/module_exit()
634 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 720 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
635 */ 721 */
636int usb_register_driver(struct usb_driver *, struct module *); 722extern int usb_register_driver(struct usb_driver *, struct module *);
637static inline int usb_register(struct usb_driver *driver) 723static inline int usb_register(struct usb_driver *driver)
638{ 724{
639 return usb_register_driver(driver, THIS_MODULE); 725 return usb_register_driver(driver, THIS_MODULE);
640} 726}
641extern void usb_deregister(struct usb_driver *); 727extern void usb_deregister(struct usb_driver *);
642 728
729extern int usb_register_device_driver(struct usb_device_driver *,
730 struct module *);
731extern void usb_deregister_device_driver(struct usb_device_driver *);
732
643extern int usb_register_dev(struct usb_interface *intf, 733extern int usb_register_dev(struct usb_interface *intf,
644 struct usb_class_driver *class_driver); 734 struct usb_class_driver *class_driver);
645extern void usb_deregister_dev(struct usb_interface *intf, 735extern void usb_deregister_dev(struct usb_interface *intf,
@@ -885,7 +975,7 @@ struct urb
885 * @setup_packet: pointer to the setup_packet buffer 975 * @setup_packet: pointer to the setup_packet buffer
886 * @transfer_buffer: pointer to the transfer buffer 976 * @transfer_buffer: pointer to the transfer buffer
887 * @buffer_length: length of the transfer buffer 977 * @buffer_length: length of the transfer buffer
888 * @complete: pointer to the usb_complete_t function 978 * @complete_fn: pointer to the usb_complete_t function
889 * @context: what to set the urb context to. 979 * @context: what to set the urb context to.
890 * 980 *
891 * Initializes a control urb with the proper information needed to submit 981 * Initializes a control urb with the proper information needed to submit
@@ -897,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
897 unsigned char *setup_packet, 987 unsigned char *setup_packet,
898 void *transfer_buffer, 988 void *transfer_buffer,
899 int buffer_length, 989 int buffer_length,
900 usb_complete_t complete, 990 usb_complete_t complete_fn,
901 void *context) 991 void *context)
902{ 992{
903 spin_lock_init(&urb->lock); 993 spin_lock_init(&urb->lock);
@@ -906,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
906 urb->setup_packet = setup_packet; 996 urb->setup_packet = setup_packet;
907 urb->transfer_buffer = transfer_buffer; 997 urb->transfer_buffer = transfer_buffer;
908 urb->transfer_buffer_length = buffer_length; 998 urb->transfer_buffer_length = buffer_length;
909 urb->complete = complete; 999 urb->complete = complete_fn;
910 urb->context = context; 1000 urb->context = context;
911} 1001}
912 1002
@@ -917,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
917 * @pipe: the endpoint pipe 1007 * @pipe: the endpoint pipe
918 * @transfer_buffer: pointer to the transfer buffer 1008 * @transfer_buffer: pointer to the transfer buffer
919 * @buffer_length: length of the transfer buffer 1009 * @buffer_length: length of the transfer buffer
920 * @complete: pointer to the usb_complete_t function 1010 * @complete_fn: pointer to the usb_complete_t function
921 * @context: what to set the urb context to. 1011 * @context: what to set the urb context to.
922 * 1012 *
923 * Initializes a bulk urb with the proper information needed to submit it 1013 * Initializes a bulk urb with the proper information needed to submit it
@@ -928,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
928 unsigned int pipe, 1018 unsigned int pipe,
929 void *transfer_buffer, 1019 void *transfer_buffer,
930 int buffer_length, 1020 int buffer_length,
931 usb_complete_t complete, 1021 usb_complete_t complete_fn,
932 void *context) 1022 void *context)
933{ 1023{
934 spin_lock_init(&urb->lock); 1024 spin_lock_init(&urb->lock);
@@ -936,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
936 urb->pipe = pipe; 1026 urb->pipe = pipe;
937 urb->transfer_buffer = transfer_buffer; 1027 urb->transfer_buffer = transfer_buffer;
938 urb->transfer_buffer_length = buffer_length; 1028 urb->transfer_buffer_length = buffer_length;
939 urb->complete = complete; 1029 urb->complete = complete_fn;
940 urb->context = context; 1030 urb->context = context;
941} 1031}
942 1032
@@ -947,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
947 * @pipe: the endpoint pipe 1037 * @pipe: the endpoint pipe
948 * @transfer_buffer: pointer to the transfer buffer 1038 * @transfer_buffer: pointer to the transfer buffer
949 * @buffer_length: length of the transfer buffer 1039 * @buffer_length: length of the transfer buffer
950 * @complete: pointer to the usb_complete_t function 1040 * @complete_fn: pointer to the usb_complete_t function
951 * @context: what to set the urb context to. 1041 * @context: what to set the urb context to.
952 * @interval: what to set the urb interval to, encoded like 1042 * @interval: what to set the urb interval to, encoded like
953 * the endpoint descriptor's bInterval value. 1043 * the endpoint descriptor's bInterval value.
@@ -963,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
963 unsigned int pipe, 1053 unsigned int pipe,
964 void *transfer_buffer, 1054 void *transfer_buffer,
965 int buffer_length, 1055 int buffer_length,
966 usb_complete_t complete, 1056 usb_complete_t complete_fn,
967 void *context, 1057 void *context,
968 int interval) 1058 int interval)
969{ 1059{
@@ -972,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
972 urb->pipe = pipe; 1062 urb->pipe = pipe;
973 urb->transfer_buffer = transfer_buffer; 1063 urb->transfer_buffer = transfer_buffer;
974 urb->transfer_buffer_length = buffer_length; 1064 urb->transfer_buffer_length = buffer_length;
975 urb->complete = complete; 1065 urb->complete = complete_fn;
976 urb->context = context; 1066 urb->context = context;
977 if (dev->speed == USB_SPEED_HIGH) 1067 if (dev->speed == USB_SPEED_HIGH)
978 urb->interval = 1 << (interval - 1); 1068 urb->interval = 1 << (interval - 1);
@@ -990,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
990extern int usb_unlink_urb(struct urb *urb); 1080extern int usb_unlink_urb(struct urb *urb);
991extern void usb_kill_urb(struct urb *urb); 1081extern void usb_kill_urb(struct urb *urb);
992 1082
993#define HAVE_USB_BUFFERS
994void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1083void *usb_buffer_alloc (struct usb_device *dev, size_t size,
995 gfp_t mem_flags, dma_addr_t *dma); 1084 gfp_t mem_flags, dma_addr_t *dma);
996void usb_buffer_free (struct usb_device *dev, size_t size, 1085void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1003,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb);
1003#endif 1092#endif
1004 1093
1005struct scatterlist; 1094struct scatterlist;
1006int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, 1095int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe,
1007 struct scatterlist *sg, int nents); 1096 struct scatterlist *sg, int nents);
1008#if 0 1097#if 0
1009void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, 1098void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe,
1010 struct scatterlist *sg, int n_hw_ents); 1099 struct scatterlist *sg, int n_hw_ents);
1011#endif 1100#endif
1012void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, 1101void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe,
1013 struct scatterlist *sg, int n_hw_ents); 1102 struct scatterlist *sg, int n_hw_ents);
1014 1103
1015/*-------------------------------------------------------------------* 1104/*-------------------------------------------------------------------*
1016 * SYNCHRONOUS CALL SUPPORT * 1105 * SYNCHRONOUS CALL SUPPORT *
@@ -1038,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe);
1038extern int usb_reset_configuration(struct usb_device *dev); 1127extern int usb_reset_configuration(struct usb_device *dev);
1039extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); 1128extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
1040 1129
1130/* this request isn't really synchronous, but it belongs with the others */
1131extern int usb_driver_set_configuration(struct usb_device *udev, int config);
1132
1041/* 1133/*
1042 * timeouts, in milliseconds, used for sending/receiving control messages 1134 * timeouts, in milliseconds, used for sending/receiving control messages
1043 * they typically complete within a few frames (msec) after they're issued 1135 * they typically complete within a few frames (msec) after they're issued
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
new file mode 100644
index 000000000000..6bd235994dc2
--- /dev/null
+++ b/include/linux/usb/audio.h
@@ -0,0 +1,53 @@
1/*
2 * <linux/usb/audio.h> -- USB Audio definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for Audio Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 */
17
18#ifndef __LINUX_USB_AUDIO_H
19#define __LINUX_USB_AUDIO_H
20
21#include <linux/types.h>
22
23/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03
27
28/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor {
30 __u8 bLength; // 8+n
31 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
32 __u8 bDescriptorSubtype; // USB_MS_HEADER
33 __le16 bcdADC; // 0x0100
34 __le16 wTotalLength; // includes Unit and Terminal desc.
35 __u8 bInCollection; // n
36 __u8 baInterfaceNr[]; // [n]
37} __attribute__ ((packed));
38
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
40
41/* As above, but more useful for defining your own descriptors: */
42#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
43struct usb_ac_header_descriptor_##n { \
44 __u8 bLength; \
45 __u8 bDescriptorType; \
46 __u8 bDescriptorSubtype; \
47 __le16 bcdADC; \
48 __le16 wTotalLength; \
49 __u8 bInCollection; \
50 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed))
52
53#endif
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
new file mode 100644
index 000000000000..11a97d5ffd34
--- /dev/null
+++ b/include/linux/usb/midi.h
@@ -0,0 +1,112 @@
1/*
2 * <linux/usb/midi.h> -- USB MIDI definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for MIDI Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/midi10.pdf
16 */
17
18#ifndef __LINUX_USB_MIDI_H
19#define __LINUX_USB_MIDI_H
20
21#include <linux/types.h>
22
23/* A.1 MS Class-Specific Interface Descriptor Subtypes */
24#define USB_MS_HEADER 0x01
25#define USB_MS_MIDI_IN_JACK 0x02
26#define USB_MS_MIDI_OUT_JACK 0x03
27#define USB_MS_ELEMENT 0x04
28
29/* A.2 MS Class-Specific Endpoint Descriptor Subtypes */
30#define USB_MS_GENERAL 0x01
31
32/* A.3 MS MIDI IN and OUT Jack Types */
33#define USB_MS_EMBEDDED 0x01
34#define USB_MS_EXTERNAL 0x02
35
36/* 6.1.2.1 Class-Specific MS Interface Header Descriptor */
37struct usb_ms_header_descriptor {
38 __u8 bLength;
39 __u8 bDescriptorType;
40 __u8 bDescriptorSubtype;
41 __le16 bcdMSC;
42 __le16 wTotalLength;
43} __attribute__ ((packed));
44
45#define USB_DT_MS_HEADER_SIZE 7
46
47/* 6.1.2.2 MIDI IN Jack Descriptor */
48struct usb_midi_in_jack_descriptor {
49 __u8 bLength;
50 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
51 __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK
52 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
53 __u8 bJackID;
54 __u8 iJack;
55} __attribute__ ((packed));
56
57#define USB_DT_MIDI_IN_SIZE 6
58
59struct usb_midi_source_pin {
60 __u8 baSourceID;
61 __u8 baSourcePin;
62} __attribute__ ((packed));
63
64/* 6.1.2.3 MIDI OUT Jack Descriptor */
65struct usb_midi_out_jack_descriptor {
66 __u8 bLength;
67 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
68 __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK
69 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
70 __u8 bJackID;
71 __u8 bNrInputPins; // p
72 struct usb_midi_source_pin pins[]; // [p]
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */
74} __attribute__ ((packed));
75
76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
77
78/* As above, but more useful for defining your own descriptors: */
79#define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \
80struct usb_midi_out_jack_descriptor_##p { \
81 __u8 bLength; \
82 __u8 bDescriptorType; \
83 __u8 bDescriptorSubtype; \
84 __u8 bJackType; \
85 __u8 bJackID; \
86 __u8 bNrInputPins; \
87 struct usb_midi_source_pin pins[p]; \
88 __u8 iJack; \
89} __attribute__ ((packed))
90
91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
92struct usb_ms_endpoint_descriptor {
93 __u8 bLength; // 4+n
94 __u8 bDescriptorType; // USB_DT_CS_ENDPOINT
95 __u8 bDescriptorSubtype; // USB_MS_GENERAL
96 __u8 bNumEmbMIDIJack; // n
97 __u8 baAssocJackID[]; // [n]
98} __attribute__ ((packed));
99
100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
101
102/* As above, but more useful for defining your own descriptors: */
103#define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \
104struct usb_ms_endpoint_descriptor_##n { \
105 __u8 bLength; \
106 __u8 bDescriptorType; \
107 __u8 bDescriptorSubtype; \
108 __u8 bNumEmbMIDIJack; \
109 __u8 baAssocJackID[n]; \
110} __attribute__ ((packed))
111
112#endif
diff --git a/include/linux/usb_otg.h b/include/linux/usb/otg.h
index f827f6e203c2..9897f7a818c5 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb/otg.h
@@ -1,4 +1,4 @@
1// include/linux/usb_otg.h 1// include/linux/usb/otg.h
2 2
3/* 3/*
4 * These APIs may be used between USB controllers. USB device drivers 4 * These APIs may be used between USB controllers. USB device drivers
@@ -52,7 +52,7 @@ struct otg_transceiver {
52 u16 port_change; 52 u16 port_change;
53 53
54 /* bind/unbind the host controller */ 54 /* bind/unbind the host controller */
55 int (*set_host)(struct otg_transceiver *otg, 55 int (*set_host)(struct otg_transceiver *otg,
56 struct usb_bus *host); 56 struct usb_bus *host);
57 57
58 /* bind/unbind the peripheral controller */ 58 /* bind/unbind the peripheral controller */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index e7fc5fed5b98..2ae76fe52ff7 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -108,6 +108,9 @@ enum { US_DO_ALL_FLAGS };
108#ifdef CONFIG_USB_STORAGE_ALAUDA 108#ifdef CONFIG_USB_STORAGE_ALAUDA
109#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ 109#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
110#endif 110#endif
111#ifdef CONFIG_USB_STORAGE_KARMA
112#define US_PR_KARMA 0xf5 /* Rio Karma */
113#endif
111 114
112#define US_PR_DEVICE 0xff /* Use device's value */ 115#define US_PR_DEVICE 0xff /* Use device's value */
113 116
diff --git a/include/linux/utime.h b/include/linux/utime.h
index c6bf27b7897e..640be6a1959e 100644
--- a/include/linux/utime.h
+++ b/include/linux/utime.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_UTIME_H 1#ifndef _LINUX_UTIME_H
2#define _LINUX_UTIME_H 2#define _LINUX_UTIME_H
3 3
4#include <linux/types.h>
5
4struct utimbuf { 6struct utimbuf {
5 time_t actime; 7 time_t actime;
6 time_t modtime; 8 time_t modtime;
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 13e1da0c538d..a4555fe3754c 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -30,7 +30,65 @@ struct new_utsname {
30 char domainname[65]; 30 char domainname[65];
31}; 31};
32 32
33extern struct new_utsname system_utsname; 33#ifdef __KERNEL__
34 34
35extern struct rw_semaphore uts_sem; 35#include <linux/sched.h>
36#include <linux/kref.h>
37#include <linux/nsproxy.h>
38#include <asm/atomic.h>
39
40struct uts_namespace {
41 struct kref kref;
42 struct new_utsname name;
43};
44extern struct uts_namespace init_uts_ns;
45
46static inline void get_uts_ns(struct uts_namespace *ns)
47{
48 kref_get(&ns->kref);
49}
50
51#ifdef CONFIG_UTS_NS
52extern int unshare_utsname(unsigned long unshare_flags,
53 struct uts_namespace **new_uts);
54extern int copy_utsname(int flags, struct task_struct *tsk);
55extern void free_uts_ns(struct kref *kref);
56
57static inline void put_uts_ns(struct uts_namespace *ns)
58{
59 kref_put(&ns->kref, free_uts_ns);
60}
61#else
62static inline int unshare_utsname(unsigned long unshare_flags,
63 struct uts_namespace **new_uts)
64{
65 if (unshare_flags & CLONE_NEWUTS)
66 return -EINVAL;
67
68 return 0;
69}
70
71static inline int copy_utsname(int flags, struct task_struct *tsk)
72{
73 return 0;
74}
75static inline void put_uts_ns(struct uts_namespace *ns)
76{
77}
36#endif 78#endif
79
80static inline struct new_utsname *utsname(void)
81{
82 return &current->nsproxy->uts_ns->name;
83}
84
85static inline struct new_utsname *init_utsname(void)
86{
87 return &init_uts_ns.name;
88}
89
90extern struct rw_semaphore uts_sem;
91
92#endif /* __KERNEL__ */
93
94#endif /* _LINUX_UTSNAME_H */
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index 46919f9f5eb3..4d0909e53595 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -24,5 +24,5 @@
24#define VERMAGIC_STRING \ 24#define VERMAGIC_STRING \
25 UTS_RELEASE " " \ 25 UTS_RELEASE " " \
26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC \ 27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC
28 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 28
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index e3715d774197..c5fdf6259548 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -276,6 +276,82 @@ struct v4l2_fmtdesc
276 276
277#define V4L2_FMT_FLAG_COMPRESSED 0x0001 277#define V4L2_FMT_FLAG_COMPRESSED 0x0001
278 278
279#if 1
280 /* Experimental Frame Size and frame rate enumeration */
281/*
282 * F R A M E S I Z E E N U M E R A T I O N
283 */
284enum v4l2_frmsizetypes
285{
286 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
287 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
288 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
289};
290
291struct v4l2_frmsize_discrete
292{
293 __u32 width; /* Frame width [pixel] */
294 __u32 height; /* Frame height [pixel] */
295};
296
297struct v4l2_frmsize_stepwise
298{
299 __u32 min_width; /* Minimum frame width [pixel] */
300 __u32 max_width; /* Maximum frame width [pixel] */
301 __u32 step_width; /* Frame width step size [pixel] */
302 __u32 min_height; /* Minimum frame height [pixel] */
303 __u32 max_height; /* Maximum frame height [pixel] */
304 __u32 step_height; /* Frame height step size [pixel] */
305};
306
307struct v4l2_frmsizeenum
308{
309 __u32 index; /* Frame size number */
310 __u32 pixel_format; /* Pixel format */
311 __u32 type; /* Frame size type the device supports. */
312
313 union { /* Frame size */
314 struct v4l2_frmsize_discrete discrete;
315 struct v4l2_frmsize_stepwise stepwise;
316 };
317
318 __u32 reserved[2]; /* Reserved space for future use */
319};
320
321/*
322 * F R A M E R A T E E N U M E R A T I O N
323 */
324enum v4l2_frmivaltypes
325{
326 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
327 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
328 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
329};
330
331struct v4l2_frmival_stepwise
332{
333 struct v4l2_fract min; /* Minimum frame interval [s] */
334 struct v4l2_fract max; /* Maximum frame interval [s] */
335 struct v4l2_fract step; /* Frame interval step size [s] */
336};
337
338struct v4l2_frmivalenum
339{
340 __u32 index; /* Frame format index */
341 __u32 pixel_format; /* Pixel format */
342 __u32 width; /* Frame width */
343 __u32 height; /* Frame height */
344 __u32 type; /* Frame interval type the device supports. */
345
346 union { /* Frame interval */
347 struct v4l2_fract discrete;
348 struct v4l2_frmival_stepwise stepwise;
349 };
350
351 __u32 reserved[2]; /* Reserved space for future use */
352};
353#endif
354
279/* 355/*
280 * T I M E C O D E 356 * T I M E C O D E
281 */ 357 */
@@ -1135,7 +1211,8 @@ struct v4l2_sliced_vbi_cap
1135 (equals frame lines 313-336 for 625 line video 1211 (equals frame lines 313-336 for 625 line video
1136 standards, 263-286 for 525 line standards) */ 1212 standards, 263-286 for 525 line standards) */
1137 __u16 service_lines[2][24]; 1213 __u16 service_lines[2][24];
1138 __u32 reserved[4]; /* must be 0 */ 1214 enum v4l2_buf_type type;
1215 __u32 reserved[3]; /* must be 0 */
1139}; 1216};
1140 1217
1141struct v4l2_sliced_vbi_data 1218struct v4l2_sliced_vbi_data
@@ -1242,12 +1319,16 @@ struct v4l2_streamparm
1242#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) 1319#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority)
1243#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) 1320#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority)
1244#if 1 1321#if 1
1245#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) 1322#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap)
1246#endif 1323#endif
1247#define VIDIOC_LOG_STATUS _IO ('V', 70) 1324#define VIDIOC_LOG_STATUS _IO ('V', 70)
1248#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 1325#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
1249#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1326#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls)
1250#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 1327#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls)
1328#if 1
1329#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum)
1330#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
1331#endif
1251 1332
1252#ifdef __OLD_VIDIOC_ 1333#ifdef __OLD_VIDIOC_
1253/* for compatibility, will go away some day */ 1334/* for compatibility, will go away some day */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index dee88c6b6fa7..ce5f1482e6be 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -62,7 +62,6 @@ extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
62extern struct vm_struct *get_vm_area_node(unsigned long size, 62extern struct vm_struct *get_vm_area_node(unsigned long size,
63 unsigned long flags, int node); 63 unsigned long flags, int node);
64extern struct vm_struct *remove_vm_area(void *addr); 64extern struct vm_struct *remove_vm_area(void *addr);
65extern struct vm_struct *__remove_vm_area(void *addr);
66extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 65extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
67 struct page ***pages); 66 struct page ***pages);
68extern void unmap_vm_area(struct vm_struct *area); 67extern void unmap_vm_area(struct vm_struct *area);
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 176c7f797339..c89df55f6e03 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <linux/config.h>
7#include <linux/mmzone.h> 6#include <linux/mmzone.h>
8#include <asm/atomic.h> 7#include <asm/atomic.h>
9 8
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 918a29763aea..37a1a41f5b65 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -33,7 +33,8 @@ extern int fg_console, last_console, want_console;
33int vc_allocate(unsigned int console); 33int vc_allocate(unsigned int console);
34int vc_cons_allocated(unsigned int console); 34int vc_cons_allocated(unsigned int console);
35int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); 35int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
36void vc_disallocate(unsigned int console); 36int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
37void vc_deallocate(unsigned int console);
37void reset_palette(struct vc_data *vc); 38void reset_palette(struct vc_data *vc);
38void do_blank_screen(int entering_gfx); 39void do_blank_screen(int entering_gfx);
39void do_unblank_screen(int leaving_gfx); 40void do_unblank_screen(int leaving_gfx);
@@ -83,4 +84,11 @@ void reset_vc(struct vc_data *vc);
83extern char con_buf[CON_BUF_SIZE]; 84extern char con_buf[CON_BUF_SIZE];
84extern struct semaphore con_buf_sem; 85extern struct semaphore con_buf_sem;
85 86
87struct vt_spawn_console {
88 spinlock_t lock;
89 struct pid *pid;
90 int sig;
91};
92extern struct vt_spawn_console vt_spawn_con;
93
86#endif /* _VT_KERN_H */ 94#endif /* _VT_KERN_H */
diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h
deleted file mode 100644
index 51ab3c933acd..000000000000
--- a/include/linux/wavefront.h
+++ /dev/null
@@ -1,675 +0,0 @@
1#ifndef __wavefront_h__
2#define __wavefront_h__
3
4/* WaveFront header file.
5 *
6 * Copyright (C) by Paul Barton-Davis 1998
7 *
8 * This program is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
9 * Version 2 (June 1991). See the "COPYING" file distributed with this software
10 * for more info.
11 */
12
13#if (!defined(__GNUC__) && !defined(__GNUG__))
14
15 You will not be able to compile this file correctly without gcc, because
16 it is necessary to pack the "wavefront_alias" structure to a size
17 of 22 bytes, corresponding to 16-bit alignment (as would have been
18 the case on the original platform, MS-DOS). If this is not done,
19 then WavePatch-format files cannot be read/written correctly.
20 The method used to do this here ("__attribute__((packed)") is
21 completely compiler dependent.
22
23 All other wavefront_* types end up aligned to 32 bit values and
24 still have the same (correct) size.
25
26#else
27
28 /* However, note that as of G++ 2.7.3.2, g++ was unable to
29 correctly parse *type* __attribute__ tags. It will do the
30 right thing if we use the "packed" attribute on each struct
31 member, which has the same semantics anyway.
32 */
33
34#endif /* __GNUC__ */
35
36/***************************** WARNING ********************************
37 PLEASE DO NOT MODIFY THIS FILE IN ANY WAY THAT AFFECTS ITS ABILITY TO
38 BE USED WITH EITHER C *OR* C++.
39 **********************************************************************/
40
41#ifndef NUM_MIDIKEYS
42#define NUM_MIDIKEYS 128
43#endif /* NUM_MIDIKEYS */
44
45#ifndef NUM_MIDICHANNELS
46#define NUM_MIDICHANNELS 16
47#endif /* NUM_MIDICHANNELS */
48
49/* These are very useful/important. the original wavefront interface
50 was developed on a 16 bit system, where sizeof(int) = 2
51 bytes. Defining things like this makes the code much more portable, and
52 easier to understand without having to toggle back and forth
53 between a 16-bit view of the world and a 32-bit one.
54 */
55
56typedef short INT16;
57typedef unsigned short UINT16;
58typedef int INT32;
59typedef unsigned int UINT32;
60typedef char CHAR8;
61typedef unsigned char UCHAR8;
62
63/* Pseudo-commands not part of the WaveFront command set.
64 These are used for various driver controls and direct
65 hardware control.
66 */
67
68#define WFC_DEBUG_DRIVER 0
69#define WFC_FX_IOCTL 1
70#define WFC_PATCH_STATUS 2
71#define WFC_PROGRAM_STATUS 3
72#define WFC_SAMPLE_STATUS 4
73#define WFC_DISABLE_INTERRUPTS 5
74#define WFC_ENABLE_INTERRUPTS 6
75#define WFC_INTERRUPT_STATUS 7
76#define WFC_ROMSAMPLES_RDONLY 8
77#define WFC_IDENTIFY_SLOT_TYPE 9
78
79/* Wavefront synth commands
80 */
81
82#define WFC_DOWNLOAD_SAMPLE 0x80
83#define WFC_DOWNLOAD_BLOCK 0x81
84#define WFC_DOWNLOAD_MULTISAMPLE 0x82
85#define WFC_DOWNLOAD_SAMPLE_ALIAS 0x83
86#define WFC_DELETE_SAMPLE 0x84
87#define WFC_REPORT_FREE_MEMORY 0x85
88#define WFC_DOWNLOAD_PATCH 0x86
89#define WFC_DOWNLOAD_PROGRAM 0x87
90#define WFC_SET_SYNTHVOL 0x89
91#define WFC_SET_NVOICES 0x8B
92#define WFC_DOWNLOAD_DRUM 0x90
93#define WFC_GET_SYNTHVOL 0x92
94#define WFC_GET_NVOICES 0x94
95#define WFC_DISABLE_CHANNEL 0x9A
96#define WFC_ENABLE_CHANNEL 0x9B
97#define WFC_MISYNTH_OFF 0x9D
98#define WFC_MISYNTH_ON 0x9E
99#define WFC_FIRMWARE_VERSION 0x9F
100#define WFC_GET_NSAMPLES 0xA0
101#define WFC_DISABLE_DRUM_PROGRAM 0xA2
102#define WFC_UPLOAD_PATCH 0xA3
103#define WFC_UPLOAD_PROGRAM 0xA4
104#define WFC_SET_TUNING 0xA6
105#define WFC_GET_TUNING 0xA7
106#define WFC_VMIDI_ON 0xA8
107#define WFC_VMIDI_OFF 0xA9
108#define WFC_MIDI_STATUS 0xAA
109#define WFC_GET_CHANNEL_STATUS 0xAB
110#define WFC_DOWNLOAD_SAMPLE_HEADER 0xAC
111#define WFC_UPLOAD_SAMPLE_HEADER 0xAD
112#define WFC_UPLOAD_MULTISAMPLE 0xAE
113#define WFC_UPLOAD_SAMPLE_ALIAS 0xAF
114#define WFC_IDENTIFY_SAMPLE_TYPE 0xB0
115#define WFC_DOWNLOAD_EDRUM_PROGRAM 0xB1
116#define WFC_UPLOAD_EDRUM_PROGRAM 0xB2
117#define WFC_SET_EDRUM_CHANNEL 0xB3
118#define WFC_INSTOUT_LEVELS 0xB4
119#define WFC_PEAKOUT_LEVELS 0xB5
120#define WFC_REPORT_CHANNEL_PROGRAMS 0xB6
121#define WFC_HARDWARE_VERSION 0xCF
122#define WFC_UPLOAD_SAMPLE_PARAMS 0xD7
123#define WFC_DOWNLOAD_OS 0xF1
124#define WFC_NOOP 0xFF
125
126#define WF_MAX_SAMPLE 512
127#define WF_MAX_PATCH 256
128#define WF_MAX_PROGRAM 128
129
130#define WF_SECTION_MAX 44 /* longest OS section length */
131
132/* # of bytes we send to the board when sending it various kinds of
133 substantive data, such as samples, patches and programs.
134*/
135
136#define WF_PROGRAM_BYTES 32
137#define WF_PATCH_BYTES 132
138#define WF_SAMPLE_BYTES 27
139#define WF_SAMPLE_HDR_BYTES 25
140#define WF_ALIAS_BYTES 25
141#define WF_DRUM_BYTES 9
142#define WF_MSAMPLE_BYTES 259 /* (MIDI_KEYS * 2) + 3 */
143
144#define WF_ACK 0x80
145#define WF_DMA_ACK 0x81
146
147/* OR-values for MIDI status bits */
148
149#define WF_MIDI_VIRTUAL_ENABLED 0x1
150#define WF_MIDI_VIRTUAL_IS_EXTERNAL 0x2
151#define WF_MIDI_IN_TO_SYNTH_DISABLED 0x4
152
153/* slot indexes for struct address_info: makes code a little more mnemonic */
154
155#define WF_SYNTH_SLOT 0
156#define WF_INTERNAL_MIDI_SLOT 1
157#define WF_EXTERNAL_MIDI_SLOT 2
158
159/* Magic MIDI bytes used to switch I/O streams on the ICS2115 MPU401
160 emulation. Note these NEVER show up in output from the device and
161 should NEVER be used in input unless Virtual MIDI mode has been
162 disabled. If they do show up as input, the results are unpredictable.
163*/
164
165#define WF_EXTERNAL_SWITCH 0xFD
166#define WF_INTERNAL_SWITCH 0xF9
167
168/* Debugging flags */
169
170#define WF_DEBUG_CMD 0x1
171#define WF_DEBUG_DATA 0x2
172#define WF_DEBUG_LOAD_PATCH 0x4
173#define WF_DEBUG_IO 0x8
174
175/* WavePatch file format stuff */
176
177#define WF_WAVEPATCH_VERSION 120; /* Current version number (1.2) */
178#define WF_MAX_COMMENT 64 /* Comment length */
179#define WF_NUM_LAYERS 4
180#define WF_NAME_LENGTH 32
181#define WF_SOURCE_LENGTH 260
182
183#define BankFileID "Bank"
184#define DrumkitFileID "DrumKit"
185#define ProgramFileID "Program"
186
187struct wf_envelope
188{
189 UCHAR8 attack_time:7;
190 UCHAR8 Unused1:1;
191
192 UCHAR8 decay1_time:7;
193 UCHAR8 Unused2:1;
194
195 UCHAR8 decay2_time:7;
196 UCHAR8 Unused3:1;
197
198 UCHAR8 sustain_time:7;
199 UCHAR8 Unused4:1;
200
201 UCHAR8 release_time:7;
202 UCHAR8 Unused5:1;
203
204 UCHAR8 release2_time:7;
205 UCHAR8 Unused6:1;
206
207 CHAR8 attack_level;
208 CHAR8 decay1_level;
209 CHAR8 decay2_level;
210 CHAR8 sustain_level;
211 CHAR8 release_level;
212
213 UCHAR8 attack_velocity:7;
214 UCHAR8 Unused7:1;
215
216 UCHAR8 volume_velocity:7;
217 UCHAR8 Unused8:1;
218
219 UCHAR8 keyboard_scaling:7;
220 UCHAR8 Unused9:1;
221};
222typedef struct wf_envelope wavefront_envelope;
223
224struct wf_lfo
225{
226 UCHAR8 sample_number;
227
228 UCHAR8 frequency:7;
229 UCHAR8 Unused1:1;
230
231 UCHAR8 am_src:4;
232 UCHAR8 fm_src:4;
233
234 CHAR8 fm_amount;
235 CHAR8 am_amount;
236 CHAR8 start_level;
237 CHAR8 end_level;
238
239 UCHAR8 ramp_delay:7;
240 UCHAR8 wave_restart:1; /* for LFO2 only */
241
242 UCHAR8 ramp_time:7;
243 UCHAR8 Unused2:1;
244};
245typedef struct wf_lfo wavefront_lfo;
246
247struct wf_patch
248{
249 INT16 frequency_bias; /* ** THIS IS IN MOTOROLA FORMAT!! ** */
250
251 UCHAR8 amplitude_bias:7;
252 UCHAR8 Unused1:1;
253
254 UCHAR8 portamento:7;
255 UCHAR8 Unused2:1;
256
257 UCHAR8 sample_number;
258
259 UCHAR8 pitch_bend:4;
260 UCHAR8 sample_msb:1;
261 UCHAR8 Unused3:3;
262
263 UCHAR8 mono:1;
264 UCHAR8 retrigger:1;
265 UCHAR8 nohold:1;
266 UCHAR8 restart:1;
267 UCHAR8 filterconfig:2; /* SDK says "not used" */
268 UCHAR8 reuse:1;
269 UCHAR8 reset_lfo:1;
270
271 UCHAR8 fm_src2:4;
272 UCHAR8 fm_src1:4;
273
274 CHAR8 fm_amount1;
275 CHAR8 fm_amount2;
276
277 UCHAR8 am_src:4;
278 UCHAR8 Unused4:4;
279
280 CHAR8 am_amount;
281
282 UCHAR8 fc1_mode:4;
283 UCHAR8 fc2_mode:4;
284
285 CHAR8 fc1_mod_amount;
286 CHAR8 fc1_keyboard_scaling;
287 CHAR8 fc1_bias;
288 CHAR8 fc2_mod_amount;
289 CHAR8 fc2_keyboard_scaling;
290 CHAR8 fc2_bias;
291
292 UCHAR8 randomizer:7;
293 UCHAR8 Unused5:1;
294
295 struct wf_envelope envelope1;
296 struct wf_envelope envelope2;
297 struct wf_lfo lfo1;
298 struct wf_lfo lfo2;
299};
300typedef struct wf_patch wavefront_patch;
301
302struct wf_layer
303{
304 UCHAR8 patch_number;
305
306 UCHAR8 mix_level:7;
307 UCHAR8 mute:1;
308
309 UCHAR8 split_point:7;
310 UCHAR8 play_below:1;
311
312 UCHAR8 pan_mod_src:2;
313 UCHAR8 pan_or_mod:1;
314 UCHAR8 pan:4;
315 UCHAR8 split_type:1;
316};
317typedef struct wf_layer wavefront_layer;
318
319struct wf_program
320{
321 struct wf_layer layer[WF_NUM_LAYERS];
322};
323typedef struct wf_program wavefront_program;
324
325struct wf_sample_offset
326{
327 INT32 Fraction:4;
328 INT32 Integer:20;
329 INT32 Unused:8;
330};
331typedef struct wf_sample_offset wavefront_sample_offset;
332
333/* Sample slot types */
334
335#define WF_ST_SAMPLE 0
336#define WF_ST_MULTISAMPLE 1
337#define WF_ST_ALIAS 2
338#define WF_ST_EMPTY 3
339
340/* pseudo's */
341
342#define WF_ST_DRUM 4
343#define WF_ST_PROGRAM 5
344#define WF_ST_PATCH 6
345#define WF_ST_SAMPLEHDR 7
346
347#define WF_ST_MASK 0xf
348
349/* Flags for slot status. These occupy the upper bits of the same byte
350 as a sample type.
351*/
352
353#define WF_SLOT_USED 0x80 /* XXX don't rely on this being accurate */
354#define WF_SLOT_FILLED 0x40
355#define WF_SLOT_ROM 0x20
356
357#define WF_SLOT_MASK 0xf0
358
359/* channel constants */
360
361#define WF_CH_MONO 0
362#define WF_CH_LEFT 1
363#define WF_CH_RIGHT 2
364
365/* Sample formats */
366
367#define LINEAR_16BIT 0
368#define WHITE_NOISE 1
369#define LINEAR_8BIT 2
370#define MULAW_8BIT 3
371
372#define WF_SAMPLE_IS_8BIT(smpl) ((smpl)->SampleResolution&2)
373
374
375/*
376
377 Because most/all of the sample data we pass in via pointers has
378 never been copied (just mmap-ed into user space straight from the
379 disk), it would be nice to allow handling of multi-channel sample
380 data without forcing user-level extraction of the relevant bytes.
381
382 So, we need a way of specifying which channel to use (the WaveFront
383 only handles mono samples in a given slot), and the only way to do
384 this without using some struct other than wavefront_sample as the
385 interface is the awful hack of using the unused bits in a
386 wavefront_sample:
387
388 Val Meaning
389 --- -------
390 0 no channel selection (use channel 1, sample is MONO)
391 1 use first channel, and skip one
392 2 use second channel, and skip one
393 3 use third channel, and skip two
394 4 use fourth channel, skip three
395 5 use fifth channel, skip four
396 6 use six channel, skip five
397
398
399 This can handle up to 4 channels, and anyone downloading >4 channels
400 of sample data just to select one of them needs to find some tools
401 like sox ...
402
403 NOTE: values 0, 1 and 2 correspond to WF_CH_* above. This is
404 important.
405
406*/
407
408#define WF_SET_CHANNEL(samp,chn) \
409 (samp)->Unused1 = chn & 0x1; \
410 (samp)->Unused2 = chn & 0x2; \
411 (samp)->Unused3 = chn & 0x4
412
413#define WF_GET_CHANNEL(samp) \
414 (((samp)->Unused3 << 2)|((samp)->Unused2<<1)|(samp)->Unused1)
415
416typedef struct wf_sample {
417 struct wf_sample_offset sampleStartOffset;
418 struct wf_sample_offset loopStartOffset;
419 struct wf_sample_offset loopEndOffset;
420 struct wf_sample_offset sampleEndOffset;
421 INT16 FrequencyBias;
422 UCHAR8 SampleResolution:2; /* sample_format */
423 UCHAR8 Unused1:1;
424 UCHAR8 Loop:1;
425 UCHAR8 Bidirectional:1;
426 UCHAR8 Unused2:1;
427 UCHAR8 Reverse:1;
428 UCHAR8 Unused3:1;
429} wavefront_sample;
430
431typedef struct wf_multisample {
432 INT16 NumberOfSamples; /* log2 of the number of samples */
433 INT16 SampleNumber[NUM_MIDIKEYS];
434} wavefront_multisample;
435
436typedef struct wf_alias {
437 INT16 OriginalSample;
438
439 struct wf_sample_offset sampleStartOffset;
440 struct wf_sample_offset loopStartOffset;
441 struct wf_sample_offset sampleEndOffset;
442 struct wf_sample_offset loopEndOffset;
443
444 INT16 FrequencyBias;
445
446 UCHAR8 SampleResolution:2;
447 UCHAR8 Unused1:1;
448 UCHAR8 Loop:1;
449 UCHAR8 Bidirectional:1;
450 UCHAR8 Unused2:1;
451 UCHAR8 Reverse:1;
452 UCHAR8 Unused3:1;
453
454 /* This structure is meant to be padded only to 16 bits on their
455 original. Of course, whoever wrote their documentation didn't
456 realize that sizeof(struct) can be >=
457 sum(sizeof(struct-fields)) and so thought that giving a C level
458 description of the structs used in WavePatch files was
459 sufficient. I suppose it was, as long as you remember the
460 standard 16->32 bit issues.
461 */
462
463 UCHAR8 sixteen_bit_padding;
464} __attribute__((packed)) wavefront_alias;
465
466typedef struct wf_drum {
467 UCHAR8 PatchNumber;
468 UCHAR8 MixLevel:7;
469 UCHAR8 Unmute:1;
470 UCHAR8 Group:4;
471 UCHAR8 Unused1:4;
472 UCHAR8 PanModSource:2;
473 UCHAR8 PanModulated:1;
474 UCHAR8 PanAmount:4;
475 UCHAR8 Unused2:1;
476} wavefront_drum;
477
478typedef struct wf_drumkit {
479 struct wf_drum drum[NUM_MIDIKEYS];
480} wavefront_drumkit;
481
482typedef struct wf_channel_programs {
483 UCHAR8 Program[NUM_MIDICHANNELS];
484} wavefront_channel_programs;
485
486/* How to get MIDI channel status from the data returned by
487 a WFC_GET_CHANNEL_STATUS command (a struct wf_channel_programs)
488*/
489
490#define WF_CHANNEL_STATUS(ch,wcp) (wcp)[(ch/7)] & (1<<((ch)%7))
491
492typedef union wf_any {
493 wavefront_sample s;
494 wavefront_multisample ms;
495 wavefront_alias a;
496 wavefront_program pr;
497 wavefront_patch p;
498 wavefront_drum d;
499} wavefront_any;
500
501/* Hannu Solvainen hoped that his "patch_info" struct in soundcard.h
502 might work for other wave-table based patch loading situations.
503 Alas, his fears were correct. The WaveFront doesn't even come with
504 just "patches", but several different kind of structures that
505 control the sound generation process.
506 */
507
508typedef struct wf_patch_info {
509
510 /* the first two fields are used by the OSS "patch loading" interface
511 only, and are unused by the current user-level library.
512 */
513
514 INT16 key; /* Use WAVEFRONT_PATCH here */
515 UINT16 devno; /* fill in when sending */
516 UCHAR8 subkey; /* WF_ST_{SAMPLE,ALIAS,etc.} */
517
518#define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999
519
520 UINT16 number; /* patch/sample/prog number */
521
522 UINT32 size; /* size of any data included in
523 one of the fields in `hdrptr', or
524 as `dataptr'.
525
526 NOTE: for actual samples, this is
527 the size of the *SELECTED CHANNEL*
528 even if more data is actually available.
529
530 So, a stereo sample (2 channels) of
531 6000 bytes total has `size' = 3000.
532
533 See the macros and comments for
534 WF_{GET,SET}_CHANNEL above.
535
536 */
537 wavefront_any __user *hdrptr; /* user-space ptr to hdr bytes */
538 UINT16 __user *dataptr; /* actual sample data */
539
540 wavefront_any hdr; /* kernel-space copy of hdr bytes */
541} wavefront_patch_info;
542
543/* The maximum number of bytes we will ever move to or from user space
544 in response to a WFC_* command. This obviously doesn't cover
545 actual sample data.
546*/
547
548#define WF_MAX_READ sizeof(wavefront_multisample)
549#define WF_MAX_WRITE sizeof(wavefront_multisample)
550
551/*
552 This allows us to execute any WF command except the download/upload
553 ones, which are handled differently due to copyin/copyout issues as
554 well as data-nybbling to/from the card.
555 */
556
557typedef struct wavefront_control {
558 int cmd; /* WFC_* */
559 char status; /* return status to user-space */
560 unsigned char rbuf[WF_MAX_READ]; /* bytes read from card */
561 unsigned char wbuf[WF_MAX_WRITE]; /* bytes written to card */
562} wavefront_control;
563
564#define WFCTL_WFCMD 0x1
565#define WFCTL_LOAD_SPP 0x2
566
567/* Modulator table */
568
569#define WF_MOD_LFO1 0
570#define WF_MOD_LFO2 1
571#define WF_MOD_ENV1 2
572#define WF_MOD_ENV2 3
573#define WF_MOD_KEYBOARD 4
574#define WF_MOD_LOGKEY 5
575#define WF_MOD_VELOCITY 6
576#define WF_MOD_LOGVEL 7
577#define WF_MOD_RANDOM 8
578#define WF_MOD_PRESSURE 9
579#define WF_MOD_MOD_WHEEL 10
580#define WF_MOD_1 WF_MOD_MOD_WHEEL
581#define WF_MOD_BREATH 11
582#define WF_MOD_2 WF_MOD_BREATH
583#define WF_MOD_FOOT 12
584#define WF_MOD_4 WF_MOD_FOOT
585#define WF_MOD_VOLUME 13
586#define WF_MOD_7 WF_MOD_VOLUME
587#define WF_MOD_PAN 14
588#define WF_MOD_10 WF_MOD_PAN
589#define WF_MOD_EXPR 15
590#define WF_MOD_11 WF_MOD_EXPR
591
592/* FX-related material */
593
594typedef struct wf_fx_info {
595 int request; /* see list below */
596 int data[4]; /* we don't need much */
597} wavefront_fx_info;
598
599/* support for each of these will be forthcoming once I or someone
600 else has figured out which of the addresses on page 6 and page 7 of
601 the YSS225 control each parameter. Incidentally, these come from
602 the Windows driver interface, but again, Turtle Beach didn't
603 document the API to use them.
604*/
605
606#define WFFX_SETOUTGAIN 0
607#define WFFX_SETSTEREOOUTGAIN 1
608#define WFFX_SETREVERBIN1GAIN 2
609#define WFFX_SETREVERBIN2GAIN 3
610#define WFFX_SETREVERBIN3GAIN 4
611#define WFFX_SETCHORUSINPORT 5
612#define WFFX_SETREVERBIN1PORT 6
613#define WFFX_SETREVERBIN2PORT 7
614#define WFFX_SETREVERBIN3PORT 8
615#define WFFX_SETEFFECTPORT 9
616#define WFFX_SETAUXPORT 10
617#define WFFX_SETREVERBTYPE 11
618#define WFFX_SETREVERBDELAY 12
619#define WFFX_SETCHORUSLFO 13
620#define WFFX_SETCHORUSPMD 14
621#define WFFX_SETCHORUSAMD 15
622#define WFFX_SETEFFECT 16
623#define WFFX_SETBASEALL 17
624#define WFFX_SETREVERBALL 18
625#define WFFX_SETCHORUSALL 20
626#define WFFX_SETREVERBDEF 22
627#define WFFX_SETCHORUSDEF 23
628#define WFFX_DELAYSETINGAIN 24
629#define WFFX_DELAYSETFBGAIN 25
630#define WFFX_DELAYSETFBLPF 26
631#define WFFX_DELAYSETGAIN 27
632#define WFFX_DELAYSETTIME 28
633#define WFFX_DELAYSETFBTIME 29
634#define WFFX_DELAYSETALL 30
635#define WFFX_DELAYSETDEF 32
636#define WFFX_SDELAYSETINGAIN 33
637#define WFFX_SDELAYSETFBGAIN 34
638#define WFFX_SDELAYSETFBLPF 35
639#define WFFX_SDELAYSETGAIN 36
640#define WFFX_SDELAYSETTIME 37
641#define WFFX_SDELAYSETFBTIME 38
642#define WFFX_SDELAYSETALL 39
643#define WFFX_SDELAYSETDEF 41
644#define WFFX_DEQSETINGAIN 42
645#define WFFX_DEQSETFILTER 43
646#define WFFX_DEQSETALL 44
647#define WFFX_DEQSETDEF 46
648#define WFFX_MUTE 47
649#define WFFX_FLANGESETBALANCE 48
650#define WFFX_FLANGESETDELAY 49
651#define WFFX_FLANGESETDWFFX_TH 50
652#define WFFX_FLANGESETFBGAIN 51
653#define WFFX_FLANGESETINGAIN 52
654#define WFFX_FLANGESETLFO 53
655#define WFFX_FLANGESETALL 54
656#define WFFX_FLANGESETDEF 56
657#define WFFX_PITCHSETSHIFT 57
658#define WFFX_PITCHSETBALANCE 58
659#define WFFX_PITCHSETALL 59
660#define WFFX_PITCHSETDEF 61
661#define WFFX_SRSSETINGAIN 62
662#define WFFX_SRSSETSPACE 63
663#define WFFX_SRSSETCENTER 64
664#define WFFX_SRSSETGAIN 65
665#define WFFX_SRSSETMODE 66
666#define WFFX_SRSSETDEF 68
667
668/* Allow direct user-space control over FX memory/coefficient data.
669 In theory this could be used to download the FX microprogram,
670 but it would be a little slower, and involve some weird code.
671 */
672
673#define WFFX_MEMSET 69
674
675#endif /* __wavefront_h__ */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 13588564b42b..a50a0130fd9e 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 20 17.2.06 4 * Version : 21 14.3.06
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
@@ -69,9 +69,14 @@
69 69
70/***************************** INCLUDES *****************************/ 70/***************************** INCLUDES *****************************/
71 71
72/* This header is used in user-space, therefore need to be sanitised
73 * for that purpose. Those includes are usually not compatible with glibc.
74 * To know which includes to use in user-space, check iwlib.h. */
75#ifdef __KERNEL__
72#include <linux/types.h> /* for "caddr_t" et al */ 76#include <linux/types.h> /* for "caddr_t" et al */
73#include <linux/socket.h> /* for "struct sockaddr" et al */ 77#include <linux/socket.h> /* for "struct sockaddr" et al */
74#include <linux/if.h> /* for IFNAMSIZ and co... */ 78#include <linux/if.h> /* for IFNAMSIZ and co... */
79#endif /* __KERNEL__ */
75 80
76/***************************** VERSION *****************************/ 81/***************************** VERSION *****************************/
77/* 82/*
@@ -80,7 +85,7 @@
80 * (there is some stuff that will be added in the future...) 85 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version. 86 * I just plan to increment with each new version.
82 */ 87 */
83#define WIRELESS_EXT 20 88#define WIRELESS_EXT 21
84 89
85/* 90/*
86 * Changes : 91 * Changes :
@@ -208,6 +213,14 @@
208 * V19 to V20 213 * V19 to V20
209 * ---------- 214 * ----------
210 * - RtNetlink requests support (SET/GET) 215 * - RtNetlink requests support (SET/GET)
216 *
217 * V20 to V21
218 * ----------
219 * - Remove (struct net_device *)->get_wireless_stats()
220 * - Change length in ESSID and NICK to strlen() instead of strlen()+1
221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
222 * - Power/Retry relative values no longer * 100000
223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
211 */ 224 */
212 225
213/**************************** CONSTANTS ****************************/ 226/**************************** CONSTANTS ****************************/
@@ -448,6 +461,7 @@
448#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ 461#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
449#define IW_QUAL_LEVEL_INVALID 0x20 462#define IW_QUAL_LEVEL_INVALID 0x20
450#define IW_QUAL_NOISE_INVALID 0x40 463#define IW_QUAL_NOISE_INVALID 0x40
464#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */
451#define IW_QUAL_ALL_INVALID 0x70 465#define IW_QUAL_ALL_INVALID 0x70
452 466
453/* Frequency flags */ 467/* Frequency flags */
@@ -500,10 +514,12 @@
500#define IW_RETRY_TYPE 0xF000 /* Type of parameter */ 514#define IW_RETRY_TYPE 0xF000 /* Type of parameter */
501#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ 515#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/
502#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ 516#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */
503#define IW_RETRY_MODIFIER 0x000F /* Modify a parameter */ 517#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */
504#define IW_RETRY_MIN 0x0001 /* Value is a minimum */ 518#define IW_RETRY_MIN 0x0001 /* Value is a minimum */
505#define IW_RETRY_MAX 0x0002 /* Value is a maximum */ 519#define IW_RETRY_MAX 0x0002 /* Value is a maximum */
506#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ 520#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
521#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */
522#define IW_RETRY_LONG 0x0020 /* Value is for long packets */
507 523
508/* Scanning request flags */ 524/* Scanning request flags */
509#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ 525#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */
@@ -1017,7 +1033,7 @@ struct iw_range
1017 /* Note : this frequency list doesn't need to fit channel numbers, 1033 /* Note : this frequency list doesn't need to fit channel numbers,
1018 * because each entry contain its channel index */ 1034 * because each entry contain its channel index */
1019 1035
1020 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ 1036 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */
1021}; 1037};
1022 1038
1023/* 1039/*
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 56a23a0e7f2e..a341c8032866 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/writeback.h. 2 * include/linux/writeback.h
3 */ 3 */
4#ifndef WRITEBACK_H 4#ifndef WRITEBACK_H
5#define WRITEBACK_H 5#define WRITEBACK_H
@@ -111,12 +111,15 @@ balance_dirty_pages_ratelimited(struct address_space *mapping)
111} 111}
112 112
113int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 113int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
114extern int generic_writepages(struct address_space *mapping,
115 struct writeback_control *wbc);
114int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 116int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
115int sync_page_range(struct inode *inode, struct address_space *mapping, 117int sync_page_range(struct inode *inode, struct address_space *mapping,
116 loff_t pos, loff_t count); 118 loff_t pos, loff_t count);
117int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, 119int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
118 loff_t pos, loff_t count); 120 loff_t pos, loff_t count);
119void set_page_dirty_balance(struct page *page); 121void set_page_dirty_balance(struct page *page);
122void writeback_set_ratelimit(void);
120 123
121/* pdflush.c */ 124/* pdflush.c */
122extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 125extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 14ecd19f4cdc..8ae7f744917b 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -12,8 +12,8 @@
12 */ 12 */
13typedef union 13typedef union
14{ 14{
15 __u32 a4; 15 __be32 a4;
16 __u32 a6[4]; 16 __be32 a6[4];
17} xfrm_address_t; 17} xfrm_address_t;
18 18
19/* Ident of a specific xfrm_state. It is used on input to lookup 19/* Ident of a specific xfrm_state. It is used on input to lookup
@@ -23,7 +23,7 @@ typedef union
23struct xfrm_id 23struct xfrm_id
24{ 24{
25 xfrm_address_t daddr; 25 xfrm_address_t daddr;
26 __u32 spi; 26 __be32 spi;
27 __u8 proto; 27 __u8 proto;
28}; 28};
29 29
@@ -49,10 +49,10 @@ struct xfrm_selector
49{ 49{
50 xfrm_address_t daddr; 50 xfrm_address_t daddr;
51 xfrm_address_t saddr; 51 xfrm_address_t saddr;
52 __u16 dport; 52 __be16 dport;
53 __u16 dport_mask; 53 __be16 dport_mask;
54 __u16 sport; 54 __be16 sport;
55 __u16 sport_mask; 55 __be16 sport_mask;
56 __u16 family; 56 __u16 family;
57 __u8 prefixlen_d; 57 __u8 prefixlen_d;
58 __u8 prefixlen_s; 58 __u8 prefixlen_s;
@@ -129,7 +129,8 @@ enum
129#define XFRM_MODE_TUNNEL 1 129#define XFRM_MODE_TUNNEL 1
130#define XFRM_MODE_ROUTEOPTIMIZATION 2 130#define XFRM_MODE_ROUTEOPTIMIZATION 2
131#define XFRM_MODE_IN_TRIGGER 3 131#define XFRM_MODE_IN_TRIGGER 3
132#define XFRM_MODE_MAX 4 132#define XFRM_MODE_BEET 4
133#define XFRM_MODE_MAX 5
133 134
134/* Netlink configuration messages. */ 135/* Netlink configuration messages. */
135enum { 136enum {
@@ -281,7 +282,7 @@ struct xfrm_usersa_info {
281 282
282struct xfrm_usersa_id { 283struct xfrm_usersa_id {
283 xfrm_address_t daddr; 284 xfrm_address_t daddr;
284 __u32 spi; 285 __be32 spi;
285 __u16 family; 286 __u16 family;
286 __u8 proto; 287 __u8 proto;
287}; 288};
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index 1fd4a2207574..db8823d45a7d 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -18,7 +18,9 @@ enum audiochip {
18 AUDIO_CHIP_TDA9874, 18 AUDIO_CHIP_TDA9874,
19 AUDIO_CHIP_PIC16C54, 19 AUDIO_CHIP_PIC16C54,
20 /* Provided by msp3400.c */ 20 /* Provided by msp3400.c */
21 AUDIO_CHIP_MSP34XX 21 AUDIO_CHIP_MSP34XX,
22 /* Provided by wm8775.c */
23 AUDIO_CHIP_WM8775
22}; 24};
23 25
24#endif /* AUDIOCHIP_H */ 26#endif /* AUDIOCHIP_H */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 7bab09b0ed45..8f58406533c6 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -90,6 +90,8 @@ extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
90extern IR_KEYTAB_TYPE ir_codes_pinnacle_color[IR_KEYTAB_SIZE]; 90extern IR_KEYTAB_TYPE ir_codes_pinnacle_color[IR_KEYTAB_SIZE];
91extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; 91extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE];
92extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE]; 92extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE];
93extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE];
94extern IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE];
93 95
94#endif 96#endif
95 97
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
index 3c43b95f4c0d..37dad07a8439 100644
--- a/include/media/tuner-types.h
+++ b/include/media/tuner-types.h
@@ -72,6 +72,9 @@ struct tuner_params {
72 unsigned int port2_invert_for_secam_lc:1; 72 unsigned int port2_invert_for_secam_lc:1;
73 /* Some cards require PORT1 to be 1 for mono Radio FM and 0 for stereo. */ 73 /* Some cards require PORT1 to be 1 for mono Radio FM and 0 for stereo. */
74 unsigned int port1_set_for_fm_mono:1; 74 unsigned int port1_set_for_fm_mono:1;
75 /* Select 18% (or according to datasheet 0%) L standard PLL gating,
76 vs the driver default of 36%. */
77 unsigned int default_pll_gating_18:1;
75 /* Default tda9887 TOP value in dB for the low band. Default is 0. 78 /* Default tda9887 TOP value in dB for the low band. Default is 0.
76 Range: -16:+15 */ 79 Range: -16:+15 */
77 signed int default_top_low:5; 80 signed int default_top_low:5;
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 2f7b00b08e88..3116e750132f 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -144,6 +144,7 @@ extern int tuner_debug;
144#define TDA9887_DEEMPHASIS_50 (2<<16) 144#define TDA9887_DEEMPHASIS_50 (2<<16)
145#define TDA9887_DEEMPHASIS_75 (3<<16) 145#define TDA9887_DEEMPHASIS_75 (3<<16)
146#define TDA9887_AUTOMUTE (1<<18) 146#define TDA9887_AUTOMUTE (1<<18)
147#define TDA9887_GATING_18 (1<<19)
147 148
148#ifdef __KERNEL__ 149#ifdef __KERNEL__
149 150
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 5564db13c0d5..aecc946980a3 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -121,10 +121,17 @@ enum v4l2_chip_ident {
121 /* general idents: reserved range 0-49 */ 121 /* general idents: reserved range 0-49 */
122 V4L2_IDENT_UNKNOWN = 0, 122 V4L2_IDENT_UNKNOWN = 0,
123 123
124 /* module saa7115: reserved range 100-149 */ 124 /* module saa7110: just ident= 100 */
125 V4L2_IDENT_SAA7110 = 100,
126
127 /* module saa7111: just ident= 101 */
128 V4L2_IDENT_SAA7111 = 101,
129
130 /* module saa7115: reserved range 102-149 */
125 V4L2_IDENT_SAA7113 = 103, 131 V4L2_IDENT_SAA7113 = 103,
126 V4L2_IDENT_SAA7114 = 104, 132 V4L2_IDENT_SAA7114 = 104,
127 V4L2_IDENT_SAA7115 = 105, 133 V4L2_IDENT_SAA7115 = 105,
134 V4L2_IDENT_SAA7118 = 108,
128 135
129 /* module saa7127: reserved range 150-199 */ 136 /* module saa7127: reserved range 150-199 */
130 V4L2_IDENT_SAA7127 = 157, 137 V4L2_IDENT_SAA7127 = 157,
@@ -166,11 +173,12 @@ enum v4l2_chip_ident {
166#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32) 173#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32)
167 174
168/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 175/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
169#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) 176#define VIDIOC_INT_S_REGISTER _IOW ('d', 100, struct v4l2_register)
170#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) 177#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register)
171 178
172/* Reset the I2C chip */ 179/* Generic reset command. The argument selects which subsystems to reset.
173#define VIDIOC_INT_RESET _IO ('d', 102) 180 Passing 0 will always reset the whole chip. */
181#define VIDIOC_INT_RESET _IOW ('d', 102, u32)
174 182
175/* Set the frequency (in Hz) of the audio clock output. 183/* Set the frequency (in Hz) of the audio clock output.
176 Used to slave an audio processor to the video decoder, ensuring that audio 184 Used to slave an audio processor to the video decoder, ensuring that audio
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 810462f8a374..6a11d772700f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -9,7 +9,8 @@
9#ifndef _V4L2_DEV_H 9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H 10#define _V4L2_DEV_H
11 11
12#define OBSOLETE_OWNER 1 /* to be removed soon */ 12#define OBSOLETE_OWNER 1 /* to be removed soon */
13#define OBSOLETE_DEVDATA 1 /* to be removed soon */
13 14
14#include <linux/poll.h> 15#include <linux/poll.h>
15#include <linux/fs.h> 16#include <linux/fs.h>
@@ -338,10 +339,8 @@ extern int video_usercopy(struct inode *inode, struct file *file,
338#ifdef CONFIG_VIDEO_V4L1_COMPAT 339#ifdef CONFIG_VIDEO_V4L1_COMPAT
339#include <linux/mm.h> 340#include <linux/mm.h>
340 341
341extern struct video_device* video_devdata(struct file*);
342
343#define to_video_device(cd) container_of(cd, struct video_device, class_dev) 342#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
344static inline int 343static inline int __must_check
345video_device_create_file(struct video_device *vfd, 344video_device_create_file(struct video_device *vfd,
346 struct class_device_attribute *attr) 345 struct class_device_attribute *attr)
347{ 346{
@@ -370,9 +369,14 @@ static inline void video_set_drvdata(struct video_device *dev, void *data)
370{ 369{
371 dev->priv = data; 370 dev->priv = data;
372} 371}
372
373#endif 373#endif
374 374
375#ifdef OBSOLETE_DEVDATA /* to be removed soon */
376/* Obsolete stuff - Still needed for radio devices and obsolete drivers */
377extern struct video_device* video_devdata(struct file*);
375extern int video_exclusive_open(struct inode *inode, struct file *file); 378extern int video_exclusive_open(struct inode *inode, struct file *file);
376extern int video_exclusive_release(struct inode *inode, struct file *file); 379extern int video_exclusive_release(struct inode *inode, struct file *file);
380#endif
377 381
378#endif /* _V4L2_DEV_H */ 382#endif /* _V4L2_DEV_H */
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index 13e7a3c6d794..e0fe92b03a4e 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -1,6 +1,5 @@
1header-y += inftl-user.h 1header-y += inftl-user.h
2header-y += jffs2-user.h 2header-y += jffs2-user.h
3header-y += mtd-abi.h
3header-y += mtd-user.h 4header-y += mtd-user.h
4header-y += nftl-user.h 5header-y += nftl-user.h
5
6unifdef-y += mtd-abi.h
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index b0a67b7ffdcd..f913c30d7b89 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -7,12 +7,6 @@
7#ifndef __MTD_ABI_H__ 7#ifndef __MTD_ABI_H__
8#define __MTD_ABI_H__ 8#define __MTD_ABI_H__
9 9
10#ifndef __KERNEL__
11/* Urgh. The whole point of splitting this out into
12 separate files was to avoid #ifdef __KERNEL__ */
13#define __user
14#endif
15
16struct erase_info_user { 10struct erase_info_user {
17 uint32_t start; 11 uint32_t start;
18 uint32_t length; 12 uint32_t length;
diff --git a/include/net/arp.h b/include/net/arp.h
index 643bded9f557..6a3d9a7d302b 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -12,15 +12,15 @@ extern struct neigh_table arp_tbl;
12extern void arp_init(void); 12extern void arp_init(void);
13extern int arp_find(unsigned char *haddr, struct sk_buff *skb); 13extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
14extern int arp_ioctl(unsigned int cmd, void __user *arg); 14extern int arp_ioctl(unsigned int cmd, void __user *arg);
15extern void arp_send(int type, int ptype, u32 dest_ip, 15extern void arp_send(int type, int ptype, __be32 dest_ip,
16 struct net_device *dev, u32 src_ip, 16 struct net_device *dev, __be32 src_ip,
17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); 17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
18extern int arp_bind_neighbour(struct dst_entry *dst); 18extern int arp_bind_neighbour(struct dst_entry *dst);
19extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); 19extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir);
20extern void arp_ifdown(struct net_device *dev); 20extern void arp_ifdown(struct net_device *dev);
21 21
22extern struct sk_buff *arp_create(int type, int ptype, u32 dest_ip, 22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
23 struct net_device *dev, u32 src_ip, 23 struct net_device *dev, __be32 src_ip,
24 unsigned char *dest_hw, unsigned char *src_hw, 24 unsigned char *dest_hw, unsigned char *src_hw,
25 unsigned char *target_hw); 25 unsigned char *target_hw);
26extern void arp_xmit(struct sk_buff *skb); 26extern void arp_xmit(struct sk_buff *skb);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index b2bdb1aa0429..10a3eec191fd 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -44,12 +44,13 @@
44#define HCI_NOTIFY_VOICE_SETTING 3 44#define HCI_NOTIFY_VOICE_SETTING 3
45 45
46/* HCI device types */ 46/* HCI device types */
47#define HCI_VHCI 0 47#define HCI_VIRTUAL 0
48#define HCI_USB 1 48#define HCI_USB 1
49#define HCI_PCCARD 2 49#define HCI_PCCARD 2
50#define HCI_UART 3 50#define HCI_UART 3
51#define HCI_RS232 4 51#define HCI_RS232 4
52#define HCI_PCI 5 52#define HCI_PCI 5
53#define HCI_SDIO 6
53 54
54/* HCI device quirks */ 55/* HCI device quirks */
55enum { 56enum {
@@ -296,6 +297,7 @@ struct hci_cp_host_buffer_size {
296 297
297/* Link Control */ 298/* Link Control */
298#define OGF_LINK_CTL 0x01 299#define OGF_LINK_CTL 0x01
300
299#define OCF_CREATE_CONN 0x0005 301#define OCF_CREATE_CONN 0x0005
300struct hci_cp_create_conn { 302struct hci_cp_create_conn {
301 bdaddr_t bdaddr; 303 bdaddr_t bdaddr;
@@ -306,6 +308,11 @@ struct hci_cp_create_conn {
306 __u8 role_switch; 308 __u8 role_switch;
307} __attribute__ ((packed)); 309} __attribute__ ((packed));
308 310
311#define OCF_CREATE_CONN_CANCEL 0x0008
312struct hci_cp_create_conn_cancel {
313 bdaddr_t bdaddr;
314} __attribute__ ((packed));
315
309#define OCF_ACCEPT_CONN_REQ 0x0009 316#define OCF_ACCEPT_CONN_REQ 0x0009
310struct hci_cp_accept_conn_req { 317struct hci_cp_accept_conn_req {
311 bdaddr_t bdaddr; 318 bdaddr_t bdaddr;
@@ -339,6 +346,8 @@ struct hci_cp_inquiry {
339 346
340#define OCF_INQUIRY_CANCEL 0x0002 347#define OCF_INQUIRY_CANCEL 0x0002
341 348
349#define OCF_EXIT_PERIODIC_INQ 0x0004
350
342#define OCF_LINK_KEY_REPLY 0x000B 351#define OCF_LINK_KEY_REPLY 0x000B
343struct hci_cp_link_key_reply { 352struct hci_cp_link_key_reply {
344 bdaddr_t bdaddr; 353 bdaddr_t bdaddr;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d84855fe7336..df22efcfcc0b 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -72,6 +72,9 @@ struct hci_dev {
72 __u8 type; 72 __u8 type;
73 bdaddr_t bdaddr; 73 bdaddr_t bdaddr;
74 __u8 features[8]; 74 __u8 features[8];
75 __u8 hci_ver;
76 __u16 hci_rev;
77 __u16 manufacturer;
75 __u16 voice_setting; 78 __u16 voice_setting;
76 79
77 __u16 pkt_type; 80 __u16 pkt_type;
@@ -165,6 +168,10 @@ struct hci_conn {
165 struct timer_list disc_timer; 168 struct timer_list disc_timer;
166 struct timer_list idle_timer; 169 struct timer_list idle_timer;
167 170
171 struct work_struct work;
172
173 struct device dev;
174
168 struct hci_dev *hdev; 175 struct hci_dev *hdev;
169 void *l2cap_data; 176 void *l2cap_data;
170 void *sco_data; 177 void *sco_data;
@@ -309,10 +316,13 @@ static inline void hci_conn_put(struct hci_conn *conn)
309 if (atomic_dec_and_test(&conn->refcnt)) { 316 if (atomic_dec_and_test(&conn->refcnt)) {
310 unsigned long timeo; 317 unsigned long timeo;
311 if (conn->type == ACL_LINK) { 318 if (conn->type == ACL_LINK) {
312 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
313 if (!conn->out)
314 timeo *= 2;
315 del_timer(&conn->idle_timer); 319 del_timer(&conn->idle_timer);
320 if (conn->state == BT_CONNECTED) {
321 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
322 if (!conn->out)
323 timeo *= 2;
324 } else
325 timeo = msecs_to_jiffies(10);
316 } else 326 } else
317 timeo = msecs_to_jiffies(10); 327 timeo = msecs_to_jiffies(10);
318 mod_timer(&conn->disc_timer, jiffies + timeo); 328 mod_timer(&conn->disc_timer, jiffies + timeo);
@@ -412,6 +422,8 @@ static inline int hci_recv_frame(struct sk_buff *skb)
412 422
413int hci_register_sysfs(struct hci_dev *hdev); 423int hci_register_sysfs(struct hci_dev *hdev);
414void hci_unregister_sysfs(struct hci_dev *hdev); 424void hci_unregister_sysfs(struct hci_dev *hdev);
425void hci_conn_add_sysfs(struct hci_conn *conn);
426void hci_conn_del_sysfs(struct hci_conn *conn);
415 427
416#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) 428#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev))
417 429
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 2d72496c2029..718b4d9c891f 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -128,7 +128,9 @@ extern int cipso_v4_rbm_strictvalid;
128 128
129#ifdef CONFIG_NETLABEL 129#ifdef CONFIG_NETLABEL
130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); 130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
131int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)); 131int cipso_v4_doi_remove(u32 doi,
132 struct netlbl_audit *audit_info,
133 void (*callback) (struct rcu_head * head));
132struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); 134struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
133int cipso_v4_doi_walk(u32 *skip_cnt, 135int cipso_v4_doi_walk(u32 *skip_cnt,
134 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), 136 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
@@ -143,6 +145,7 @@ static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
143} 145}
144 146
145static inline int cipso_v4_doi_remove(u32 doi, 147static inline int cipso_v4_doi_remove(u32 doi,
148 struct netlbl_audit *audit_info,
146 void (*callback) (struct rcu_head * head)) 149 void (*callback) (struct rcu_head * head))
147{ 150{
148 return 0; 151 return 0;
diff --git a/include/net/dst.h b/include/net/dst.h
index a8d825f90305..e156e38e4ac3 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -84,7 +84,7 @@ struct dst_entry
84struct dst_ops 84struct dst_ops
85{ 85{
86 unsigned short family; 86 unsigned short family;
87 unsigned short protocol; 87 __be16 protocol;
88 unsigned gc_thresh; 88 unsigned gc_thresh;
89 89
90 int (*gc)(void); 90 int (*gc)(void);
diff --git a/include/net/flow.h b/include/net/flow.h
index 3ca210ec1379..ddf5f3ca1720 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -16,8 +16,8 @@ struct flowi {
16 16
17 union { 17 union {
18 struct { 18 struct {
19 __u32 daddr; 19 __be32 daddr;
20 __u32 saddr; 20 __be32 saddr;
21 __u32 fwmark; 21 __u32 fwmark;
22 __u8 tos; 22 __u8 tos;
23 __u8 scope; 23 __u8 scope;
@@ -56,8 +56,8 @@ struct flowi {
56#define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 56#define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01
57 union { 57 union {
58 struct { 58 struct {
59 __u16 sport; 59 __be16 sport;
60 __u16 dport; 60 __be16 dport;
61 } ports; 61 } ports;
62 62
63 struct { 63 struct {
@@ -73,7 +73,7 @@ struct flowi {
73 __u8 objname[16]; /* Not zero terminated */ 73 __u8 objname[16]; /* Not zero terminated */
74 } dnports; 74 } dnports;
75 75
76 __u32 spi; 76 __be32 spi;
77 77
78#ifdef CONFIG_IPV6_MIP6 78#ifdef CONFIG_IPV6_MIP6
79 struct { 79 struct {
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 4a38d85e4e25..b619314218a6 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -169,4 +169,22 @@ static inline int genlmsg_len(const struct genlmsghdr *gnlh)
169 return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN); 169 return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN);
170} 170}
171 171
172/**
173 * genlmsg_msg_size - length of genetlink message not including padding
174 * @payload: length of message payload
175 */
176static inline int genlmsg_msg_size(int payload)
177{
178 return GENL_HDRLEN + payload;
179}
180
181/**
182 * genlmsg_total_size - length of genetlink message including padding
183 * @payload: length of message payload
184 */
185static inline int genlmsg_total_size(int payload)
186{
187 return NLMSG_ALIGN(genlmsg_msg_size(payload));
188}
189
172#endif /* __NET_GENERIC_NETLINK_H */ 190#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 05f8ff7d9316..dc09474efcf3 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -38,7 +38,7 @@ struct dst_entry;
38struct net_proto_family; 38struct net_proto_family;
39struct sk_buff; 39struct sk_buff;
40 40
41extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); 41extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
42extern int icmp_rcv(struct sk_buff *skb); 42extern int icmp_rcv(struct sk_buff *skb);
43extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); 43extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
44extern void icmp_init(struct net_proto_family *ops); 44extern void icmp_init(struct net_proto_family *ops);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index de4e83b6da4b..0bcf9f237e1f 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -238,9 +238,9 @@ extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
238 238
239extern struct request_sock *inet_csk_search_req(const struct sock *sk, 239extern struct request_sock *inet_csk_search_req(const struct sock *sk,
240 struct request_sock ***prevp, 240 struct request_sock ***prevp,
241 const __u16 rport, 241 const __be16 rport,
242 const __u32 raddr, 242 const __be32 raddr,
243 const __u32 laddr); 243 const __be32 laddr);
244extern int inet_csk_bind_conflict(const struct sock *sk, 244extern int inet_csk_bind_conflict(const struct sock *sk,
245 const struct inet_bind_bucket *tb); 245 const struct inet_bind_bucket *tb);
246extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, 246extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index b4491c9e2a5a..a9eb2eaf094e 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -272,42 +272,56 @@ static inline int inet_iif(const struct sk_buff *skb)
272} 272}
273 273
274extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, 274extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
275 const u32 daddr, 275 const __be32 daddr,
276 const unsigned short hnum, 276 const unsigned short hnum,
277 const int dif); 277 const int dif);
278 278
279static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, 279static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
280 u32 daddr, u16 dport, int dif) 280 __be32 daddr, __be16 dport, int dif)
281{ 281{
282 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); 282 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif);
283} 283}
284 284
285/* Socket demux engine toys. */ 285/* Socket demux engine toys. */
286/* What happens here is ugly; there's a pair of adjacent fields in
287 struct inet_sock; __be16 dport followed by __u16 num. We want to
288 search by pair, so we combine the keys into a single 32bit value
289 and compare with 32bit value read from &...->dport. Let's at least
290 make sure that it's not mixed with anything else...
291 On 64bit targets we combine comparisons with pair of adjacent __be32
292 fields in the same way.
293*/
294typedef __u32 __bitwise __portpair;
286#ifdef __BIG_ENDIAN 295#ifdef __BIG_ENDIAN
287#define INET_COMBINED_PORTS(__sport, __dport) \ 296#define INET_COMBINED_PORTS(__sport, __dport) \
288 (((__u32)(__sport) << 16) | (__u32)(__dport)) 297 ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
289#else /* __LITTLE_ENDIAN */ 298#else /* __LITTLE_ENDIAN */
290#define INET_COMBINED_PORTS(__sport, __dport) \ 299#define INET_COMBINED_PORTS(__sport, __dport) \
291 (((__u32)(__dport) << 16) | (__u32)(__sport)) 300 ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(__sport)))
292#endif 301#endif
293 302
294#if (BITS_PER_LONG == 64) 303#if (BITS_PER_LONG == 64)
304typedef __u64 __bitwise __addrpair;
295#ifdef __BIG_ENDIAN 305#ifdef __BIG_ENDIAN
296#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 306#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
297 const __u64 __name = (((__u64)(__saddr)) << 32) | ((__u64)(__daddr)); 307 const __addrpair __name = (__force __addrpair) ( \
308 (((__force __u64)(__be32)(__saddr)) << 32) | \
309 ((__force __u64)(__be32)(__daddr)));
298#else /* __LITTLE_ENDIAN */ 310#else /* __LITTLE_ENDIAN */
299#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 311#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
300 const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr)); 312 const __addrpair __name = (__force __addrpair) ( \
313 (((__force __u64)(__be32)(__daddr)) << 32) | \
314 ((__force __u64)(__be32)(__saddr)));
301#endif /* __BIG_ENDIAN */ 315#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 316#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
303 (((__sk)->sk_hash == (__hash)) && \ 317 (((__sk)->sk_hash == (__hash)) && \
304 ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 318 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
305 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 319 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 320 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
307#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 321#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
308 (((__sk)->sk_hash == (__hash)) && \ 322 (((__sk)->sk_hash == (__hash)) && \
309 ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 323 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
310 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 324 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
311 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
312#else /* 32-bit arch */ 326#else /* 32-bit arch */
313#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 327#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
@@ -315,13 +329,13 @@ static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
315 (((__sk)->sk_hash == (__hash)) && \ 329 (((__sk)->sk_hash == (__hash)) && \
316 (inet_sk(__sk)->daddr == (__saddr)) && \ 330 (inet_sk(__sk)->daddr == (__saddr)) && \
317 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 331 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
318 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 332 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 333 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
320#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 334#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
321 (((__sk)->sk_hash == (__hash)) && \ 335 (((__sk)->sk_hash == (__hash)) && \
322 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 336 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
323 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 337 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
324 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 338 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 339 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
326#endif /* 64-bit arch */ 340#endif /* 64-bit arch */
327 341
@@ -333,12 +347,12 @@ static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
333 */ 347 */
334static inline struct sock * 348static inline struct sock *
335 __inet_lookup_established(struct inet_hashinfo *hashinfo, 349 __inet_lookup_established(struct inet_hashinfo *hashinfo,
336 const u32 saddr, const u16 sport, 350 const __be32 saddr, const __be16 sport,
337 const u32 daddr, const u16 hnum, 351 const __be32 daddr, const u16 hnum,
338 const int dif) 352 const int dif)
339{ 353{
340 INET_ADDR_COOKIE(acookie, saddr, daddr) 354 INET_ADDR_COOKIE(acookie, saddr, daddr)
341 const __u32 ports = INET_COMBINED_PORTS(sport, hnum); 355 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
342 struct sock *sk; 356 struct sock *sk;
343 const struct hlist_node *node; 357 const struct hlist_node *node;
344 /* Optimize here for direct hit, only listening connections can 358 /* Optimize here for direct hit, only listening connections can
@@ -370,8 +384,8 @@ hit:
370 384
371static inline struct sock * 385static inline struct sock *
372 inet_lookup_established(struct inet_hashinfo *hashinfo, 386 inet_lookup_established(struct inet_hashinfo *hashinfo,
373 const u32 saddr, const u16 sport, 387 const __be32 saddr, const __be16 sport,
374 const u32 daddr, const u16 dport, 388 const __be32 daddr, const __be16 dport,
375 const int dif) 389 const int dif)
376{ 390{
377 return __inet_lookup_established(hashinfo, saddr, sport, daddr, 391 return __inet_lookup_established(hashinfo, saddr, sport, daddr,
@@ -379,8 +393,8 @@ static inline struct sock *
379} 393}
380 394
381static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, 395static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
382 const u32 saddr, const u16 sport, 396 const __be32 saddr, const __be16 sport,
383 const u32 daddr, const u16 dport, 397 const __be32 daddr, const __be16 dport,
384 const int dif) 398 const int dif)
385{ 399{
386 u16 hnum = ntohs(dport); 400 u16 hnum = ntohs(dport);
@@ -390,8 +404,8 @@ static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
390} 404}
391 405
392static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, 406static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
393 const u32 saddr, const u16 sport, 407 const __be32 saddr, const __be16 sport,
394 const u32 daddr, const u16 dport, 408 const __be32 daddr, const __be16 dport,
395 const int dif) 409 const int dif)
396{ 410{
397 struct sock *sk; 411 struct sock *sk;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index f6242710f2ff..ce6da97bc848 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -36,7 +36,7 @@
36 * @ts_needaddr - Need to record addr of outgoing dev 36 * @ts_needaddr - Need to record addr of outgoing dev
37 */ 37 */
38struct ip_options { 38struct ip_options {
39 __u32 faddr; 39 __be32 faddr;
40 unsigned char optlen; 40 unsigned char optlen;
41 unsigned char srr; 41 unsigned char srr;
42 unsigned char rr; 42 unsigned char rr;
@@ -62,9 +62,9 @@ struct inet_request_sock {
62 u16 inet6_rsk_offset; 62 u16 inet6_rsk_offset;
63 /* 2 bytes hole, try to pack */ 63 /* 2 bytes hole, try to pack */
64#endif 64#endif
65 u32 loc_addr; 65 __be32 loc_addr;
66 u32 rmt_addr; 66 __be32 rmt_addr;
67 u16 rmt_port; 67 __be16 rmt_port;
68 u16 snd_wscale : 4, 68 u16 snd_wscale : 4,
69 rcv_wscale : 4, 69 rcv_wscale : 4,
70 tstamp_ok : 1, 70 tstamp_ok : 1,
@@ -110,15 +110,15 @@ struct inet_sock {
110 struct ipv6_pinfo *pinet6; 110 struct ipv6_pinfo *pinet6;
111#endif 111#endif
112 /* Socket demultiplex comparisons on incoming packets. */ 112 /* Socket demultiplex comparisons on incoming packets. */
113 __u32 daddr; 113 __be32 daddr;
114 __u32 rcv_saddr; 114 __be32 rcv_saddr;
115 __u16 dport; 115 __be16 dport;
116 __u16 num; 116 __u16 num;
117 __u32 saddr; 117 __be32 saddr;
118 __s16 uc_ttl; 118 __s16 uc_ttl;
119 __u16 cmsg_flags; 119 __u16 cmsg_flags;
120 struct ip_options *opt; 120 struct ip_options *opt;
121 __u16 sport; 121 __be16 sport;
122 __u16 id; 122 __u16 id;
123 __u8 tos; 123 __u8 tos;
124 __u8 mc_ttl; 124 __u8 mc_ttl;
@@ -129,7 +129,7 @@ struct inet_sock {
129 hdrincl:1, 129 hdrincl:1,
130 mc_loop:1; 130 mc_loop:1;
131 int mc_index; 131 int mc_index;
132 __u32 mc_addr; 132 __be32 mc_addr;
133 struct ip_mc_socklist *mc_list; 133 struct ip_mc_socklist *mc_list;
134 struct { 134 struct {
135 unsigned int flags; 135 unsigned int flags;
@@ -137,7 +137,7 @@ struct inet_sock {
137 struct ip_options *opt; 137 struct ip_options *opt;
138 struct rtable *rt; 138 struct rtable *rt;
139 int length; /* Total length of all frames */ 139 int length; /* Total length of all frames */
140 u32 addr; 140 __be32 addr;
141 struct flowi fl; 141 struct flowi fl;
142 } cork; 142 } cork;
143}; 143};
@@ -167,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
167 167
168extern int inet_sk_rebuild_header(struct sock *sk); 168extern int inet_sk_rebuild_header(struct sock *sk);
169 169
170static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, 170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
171 const __u32 faddr, const __u16 fport) 171 const __be32 faddr, const __be16 fport)
172{ 172{
173 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); 173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport);
174 h ^= h >> 16; 174 h ^= h >> 16;
175 h ^= h >> 8; 175 h ^= h >> 8;
176 return h; 176 return h;
@@ -179,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
179static inline int inet_sk_ehashfn(const struct sock *sk) 179static inline int inet_sk_ehashfn(const struct sock *sk)
180{ 180{
181 const struct inet_sock *inet = inet_sk(sk); 181 const struct inet_sock *inet = inet_sk(sk);
182 const __u32 laddr = inet->rcv_saddr; 182 const __be32 laddr = inet->rcv_saddr;
183 const __u16 lport = inet->num; 183 const __u16 lport = inet->num;
184 const __u32 faddr = inet->daddr; 184 const __be32 faddr = inet->daddr;
185 const __u16 fport = inet->dport; 185 const __be16 fport = inet->dport;
186 186
187 return inet_ehashfn(laddr, lport, faddr, fport); 187 return inet_ehashfn(laddr, lport, faddr, fport);
188} 188}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 600cb543550d..6d14c22a00c5 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -120,10 +120,10 @@ struct inet_timewait_sock {
120 unsigned char tw_rcv_wscale; 120 unsigned char tw_rcv_wscale;
121 /* Socket demultiplex comparisons on incoming packets. */ 121 /* Socket demultiplex comparisons on incoming packets. */
122 /* these five are in inet_sock */ 122 /* these five are in inet_sock */
123 __u16 tw_sport; 123 __be16 tw_sport;
124 __u32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES))); 124 __be32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES)));
125 __u32 tw_rcv_saddr; 125 __be32 tw_rcv_saddr;
126 __u16 tw_dport; 126 __be16 tw_dport;
127 __u16 tw_num; 127 __u16 tw_num;
128 /* And these are ours. */ 128 /* And these are ours. */
129 __u8 tw_ipv6only:1; 129 __u8 tw_ipv6only:1;
@@ -186,7 +186,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
186 return (struct inet_timewait_sock *)sk; 186 return (struct inet_timewait_sock *)sk;
187} 187}
188 188
189static inline u32 inet_rcv_saddr(const struct sock *sk) 189static inline __be32 inet_rcv_saddr(const struct sock *sk)
190{ 190{
191 return likely(sk->sk_state != TCP_TIME_WAIT) ? 191 return likely(sk->sk_state != TCP_TIME_WAIT) ?
192 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; 192 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 0965515f40cf..925573fd2aed 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -22,7 +22,7 @@ struct inet_peer
22 unsigned long dtime; /* the time of last use of not 22 unsigned long dtime; /* the time of last use of not
23 * referenced entries */ 23 * referenced entries */
24 atomic_t refcnt; 24 atomic_t refcnt;
25 __u32 v4daddr; /* peer's address */ 25 __be32 v4daddr; /* peer's address */
26 __u16 avl_height; 26 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */ 27 __u16 ip_id_count; /* IP ID for the next packet */
28 atomic_t rid; /* Frag reception counter */ 28 atomic_t rid; /* Frag reception counter */
@@ -33,7 +33,7 @@ struct inet_peer
33void inet_initpeers(void) __init; 33void inet_initpeers(void) __init;
34 34
35/* can be called with or without local BH being disabled */ 35/* can be called with or without local BH being disabled */
36struct inet_peer *inet_getpeer(__u32 daddr, int create); 36struct inet_peer *inet_getpeer(__be32 daddr, int create);
37 37
38extern spinlock_t inet_peer_unused_lock; 38extern spinlock_t inet_peer_unused_lock;
39extern struct inet_peer **inet_peer_unused_tailp; 39extern struct inet_peer **inet_peer_unused_tailp;
diff --git a/include/net/ip.h b/include/net/ip.h
index 98f908400771..b6d95e553401 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -45,7 +45,7 @@ struct inet_skb_parm
45 45
46struct ipcm_cookie 46struct ipcm_cookie
47{ 47{
48 u32 addr; 48 __be32 addr;
49 int oif; 49 int oif;
50 struct ip_options *opt; 50 struct ip_options *opt;
51}; 51};
@@ -86,7 +86,7 @@ extern int igmp_mc_proc_init(void);
86 */ 86 */
87 87
88extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, 88extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
89 u32 saddr, u32 daddr, 89 __be32 saddr, __be32 daddr,
90 struct ip_options *opt); 90 struct ip_options *opt);
91extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, 91extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
92 struct packet_type *pt, struct net_device *orig_dev); 92 struct packet_type *pt, struct net_device *orig_dev);
@@ -335,7 +335,7 @@ extern int ip_net_unreachable(struct sk_buff *skb);
335 * Functions provided by ip_options.c 335 * Functions provided by ip_options.c
336 */ 336 */
337 337
338extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 daddr, struct rtable *rt, int is_frag); 338extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag);
339extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 339extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
340extern void ip_options_fragment(struct sk_buff *skb); 340extern void ip_options_fragment(struct sk_buff *skb);
341extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); 341extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb);
@@ -363,8 +363,8 @@ extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(s
363 363
364extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); 364extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
365extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 365extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
366 u16 port, u32 info, u8 *payload); 366 __be16 port, u32 info, u8 *payload);
367extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport, 367extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
368 u32 info); 368 u32 info);
369 369
370/* sysctl helpers - any sysctl which holds a value that ends up being 370/* sysctl helpers - any sysctl which holds a value that ends up being
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index fcc159a4ac17..82229146bac7 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -30,13 +30,13 @@ struct fib_config {
30 u8 fc_type; 30 u8 fc_type;
31 /* 1 byte unused */ 31 /* 1 byte unused */
32 u32 fc_table; 32 u32 fc_table;
33 u32 fc_dst; 33 __be32 fc_dst;
34 u32 fc_src; 34 __be32 fc_src;
35 u32 fc_gw; 35 __be32 fc_gw;
36 int fc_oif; 36 int fc_oif;
37 u32 fc_flags; 37 u32 fc_flags;
38 u32 fc_priority; 38 u32 fc_priority;
39 u32 fc_prefsrc; 39 __be32 fc_prefsrc;
40 struct nlattr *fc_mx; 40 struct nlattr *fc_mx;
41 struct rtnexthop *fc_mp; 41 struct rtnexthop *fc_mp;
42 int fc_mx_len; 42 int fc_mx_len;
@@ -63,7 +63,7 @@ struct fib_nh {
63 __u32 nh_tclassid; 63 __u32 nh_tclassid;
64#endif 64#endif
65 int nh_oif; 65 int nh_oif;
66 u32 nh_gw; 66 __be32 nh_gw;
67}; 67};
68 68
69/* 69/*
@@ -78,7 +78,7 @@ struct fib_info {
78 int fib_dead; 78 int fib_dead;
79 unsigned fib_flags; 79 unsigned fib_flags;
80 int fib_protocol; 80 int fib_protocol;
81 u32 fib_prefsrc; 81 __be32 fib_prefsrc;
82 u32 fib_priority; 82 u32 fib_priority;
83 u32 fib_metrics[RTAX_MAX]; 83 u32 fib_metrics[RTAX_MAX];
84#define fib_mtu fib_metrics[RTAX_MTU-1] 84#define fib_mtu fib_metrics[RTAX_MTU-1]
@@ -107,8 +107,8 @@ struct fib_result {
107 unsigned char type; 107 unsigned char type;
108 unsigned char scope; 108 unsigned char scope;
109#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 109#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
110 __u32 network; 110 __be32 network;
111 __u32 netmask; 111 __be32 netmask;
112#endif 112#endif
113 struct fib_info *fi; 113 struct fib_info *fi;
114#ifdef CONFIG_IP_MULTIPLE_TABLES 114#ifdef CONFIG_IP_MULTIPLE_TABLES
@@ -117,7 +117,7 @@ struct fib_result {
117}; 117};
118 118
119struct fib_result_nl { 119struct fib_result_nl {
120 u32 fl_addr; /* To be looked up*/ 120 __be32 fl_addr; /* To be looked up*/
121 u32 fl_fwmark; 121 u32 fl_fwmark;
122 unsigned char fl_tos; 122 unsigned char fl_tos;
123 unsigned char fl_scope; 123 unsigned char fl_scope;
@@ -222,17 +222,17 @@ extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
222extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); 222extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
223extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); 223extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
224extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); 224extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
225extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, 225extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
226 struct net_device *dev, u32 *spec_dst, u32 *itag); 226 struct net_device *dev, __be32 *spec_dst, u32 *itag);
227extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 227extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
228 228
229struct rtentry; 229struct rtentry;
230 230
231/* Exported by fib_semantics.c */ 231/* Exported by fib_semantics.c */
232extern int ip_fib_check_default(u32 gw, struct net_device *dev); 232extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
233extern int fib_sync_down(u32 local, struct net_device *dev, int force); 233extern int fib_sync_down(__be32 local, struct net_device *dev, int force);
234extern int fib_sync_up(struct net_device *dev); 234extern int fib_sync_up(struct net_device *dev);
235extern u32 __fib_res_prefsrc(struct fib_result *res); 235extern __be32 __fib_res_prefsrc(struct fib_result *res);
236 236
237/* Exported by fib_hash.c */ 237/* Exported by fib_hash.c */
238extern struct fib_table *fib_hash_init(u32 id); 238extern struct fib_table *fib_hash_init(u32 id);
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h
index ac747b64734c..beffdd66ad74 100644
--- a/include/net/ip_mp_alg.h
+++ b/include/net/ip_mp_alg.h
@@ -17,7 +17,7 @@ struct ip_mp_alg_ops {
17 void (*mp_alg_select_route)(const struct flowi *flp, 17 void (*mp_alg_select_route)(const struct flowi *flp,
18 struct rtable *rth, struct rtable **rp); 18 struct rtable *rth, struct rtable **rp);
19 void (*mp_alg_flush)(void); 19 void (*mp_alg_flush)(void);
20 void (*mp_alg_set_nhinfo)(__u32 network, __u32 netmask, 20 void (*mp_alg_set_nhinfo)(__be32 network, __be32 netmask,
21 unsigned char prefixlen, 21 unsigned char prefixlen,
22 const struct fib_nh *nh); 22 const struct fib_nh *nh);
23 void (*mp_alg_remove)(struct rtable *rth); 23 void (*mp_alg_remove)(struct rtable *rth);
@@ -59,7 +59,7 @@ static inline void multipath_flush(void)
59} 59}
60 60
61static inline void multipath_set_nhinfo(struct rtable *rth, 61static inline void multipath_set_nhinfo(struct rtable *rth,
62 __u32 network, __u32 netmask, 62 __be32 network, __be32 netmask,
63 unsigned char prefixlen, 63 unsigned char prefixlen,
64 const struct fib_nh *nh) 64 const struct fib_nh *nh)
65{ 65{
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 3b57b159b653..49c717e3b040 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -100,22 +100,22 @@
100struct ip_vs_service_user { 100struct ip_vs_service_user {
101 /* virtual service addresses */ 101 /* virtual service addresses */
102 u_int16_t protocol; 102 u_int16_t protocol;
103 u_int32_t addr; /* virtual ip address */ 103 __be32 addr; /* virtual ip address */
104 u_int16_t port; 104 __be16 port;
105 u_int32_t fwmark; /* firwall mark of service */ 105 u_int32_t fwmark; /* firwall mark of service */
106 106
107 /* virtual service options */ 107 /* virtual service options */
108 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 108 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
109 unsigned flags; /* virtual service flags */ 109 unsigned flags; /* virtual service flags */
110 unsigned timeout; /* persistent timeout in sec */ 110 unsigned timeout; /* persistent timeout in sec */
111 u_int32_t netmask; /* persistent netmask */ 111 __be32 netmask; /* persistent netmask */
112}; 112};
113 113
114 114
115struct ip_vs_dest_user { 115struct ip_vs_dest_user {
116 /* destination server address */ 116 /* destination server address */
117 u_int32_t addr; 117 __be32 addr;
118 u_int16_t port; 118 __be16 port;
119 119
120 /* real server options */ 120 /* real server options */
121 unsigned conn_flags; /* connection flags */ 121 unsigned conn_flags; /* connection flags */
@@ -163,15 +163,15 @@ struct ip_vs_getinfo {
163struct ip_vs_service_entry { 163struct ip_vs_service_entry {
164 /* which service: user fills in these */ 164 /* which service: user fills in these */
165 u_int16_t protocol; 165 u_int16_t protocol;
166 u_int32_t addr; /* virtual address */ 166 __be32 addr; /* virtual address */
167 u_int16_t port; 167 __be16 port;
168 u_int32_t fwmark; /* firwall mark of service */ 168 u_int32_t fwmark; /* firwall mark of service */
169 169
170 /* service options */ 170 /* service options */
171 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 171 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
172 unsigned flags; /* virtual service flags */ 172 unsigned flags; /* virtual service flags */
173 unsigned timeout; /* persistent timeout */ 173 unsigned timeout; /* persistent timeout */
174 u_int32_t netmask; /* persistent netmask */ 174 __be32 netmask; /* persistent netmask */
175 175
176 /* number of real servers */ 176 /* number of real servers */
177 unsigned int num_dests; 177 unsigned int num_dests;
@@ -182,8 +182,8 @@ struct ip_vs_service_entry {
182 182
183 183
184struct ip_vs_dest_entry { 184struct ip_vs_dest_entry {
185 u_int32_t addr; /* destination address */ 185 __be32 addr; /* destination address */
186 u_int16_t port; 186 __be16 port;
187 unsigned conn_flags; /* connection flags */ 187 unsigned conn_flags; /* connection flags */
188 int weight; /* destination weight */ 188 int weight; /* destination weight */
189 189
@@ -203,8 +203,8 @@ struct ip_vs_dest_entry {
203struct ip_vs_get_dests { 203struct ip_vs_get_dests {
204 /* which service: user fills in these */ 204 /* which service: user fills in these */
205 u_int16_t protocol; 205 u_int16_t protocol;
206 u_int32_t addr; /* virtual address */ 206 __be32 addr; /* virtual address */
207 u_int16_t port; 207 __be16 port;
208 u_int32_t fwmark; /* firwall mark of service */ 208 u_int32_t fwmark; /* firwall mark of service */
209 209
210 /* number of real servers */ 210 /* number of real servers */
@@ -502,12 +502,12 @@ struct ip_vs_conn {
502 struct list_head c_list; /* hashed list heads */ 502 struct list_head c_list; /* hashed list heads */
503 503
504 /* Protocol, addresses and port numbers */ 504 /* Protocol, addresses and port numbers */
505 __u32 caddr; /* client address */ 505 __be32 caddr; /* client address */
506 __u32 vaddr; /* virtual address */ 506 __be32 vaddr; /* virtual address */
507 __u32 daddr; /* destination address */ 507 __be32 daddr; /* destination address */
508 __u16 cport; 508 __be16 cport;
509 __u16 vport; 509 __be16 vport;
510 __u16 dport; 510 __be16 dport;
511 __u16 protocol; /* Which protocol (TCP/UDP) */ 511 __u16 protocol; /* Which protocol (TCP/UDP) */
512 512
513 /* counter and timer */ 513 /* counter and timer */
@@ -554,12 +554,12 @@ struct ip_vs_service {
554 atomic_t usecnt; /* use counter */ 554 atomic_t usecnt; /* use counter */
555 555
556 __u16 protocol; /* which protocol (TCP/UDP) */ 556 __u16 protocol; /* which protocol (TCP/UDP) */
557 __u32 addr; /* IP address for virtual service */ 557 __be32 addr; /* IP address for virtual service */
558 __u16 port; /* port number for the service */ 558 __be16 port; /* port number for the service */
559 __u32 fwmark; /* firewall mark of the service */ 559 __u32 fwmark; /* firewall mark of the service */
560 unsigned flags; /* service status flags */ 560 unsigned flags; /* service status flags */
561 unsigned timeout; /* persistent timeout in ticks */ 561 unsigned timeout; /* persistent timeout in ticks */
562 __u32 netmask; /* grouping granularity */ 562 __be32 netmask; /* grouping granularity */
563 563
564 struct list_head destinations; /* real server d-linked list */ 564 struct list_head destinations; /* real server d-linked list */
565 __u32 num_dests; /* number of servers */ 565 __u32 num_dests; /* number of servers */
@@ -581,8 +581,8 @@ struct ip_vs_dest {
581 struct list_head n_list; /* for the dests in the service */ 581 struct list_head n_list; /* for the dests in the service */
582 struct list_head d_list; /* for table with all the dests */ 582 struct list_head d_list; /* for table with all the dests */
583 583
584 __u32 addr; /* IP address of the server */ 584 __be32 addr; /* IP address of the server */
585 __u16 port; /* port number of the server */ 585 __be16 port; /* port number of the server */
586 volatile unsigned flags; /* dest status flags */ 586 volatile unsigned flags; /* dest status flags */
587 atomic_t conn_flags; /* flags to copy to conn */ 587 atomic_t conn_flags; /* flags to copy to conn */
588 atomic_t weight; /* server weight */ 588 atomic_t weight; /* server weight */
@@ -605,8 +605,8 @@ struct ip_vs_dest {
605 /* for virtual service */ 605 /* for virtual service */
606 struct ip_vs_service *svc; /* service it belongs to */ 606 struct ip_vs_service *svc; /* service it belongs to */
607 __u16 protocol; /* which protocol (TCP/UDP) */ 607 __u16 protocol; /* which protocol (TCP/UDP) */
608 __u32 vaddr; /* virtual IP address */ 608 __be32 vaddr; /* virtual IP address */
609 __u16 vport; /* virtual port number */ 609 __be16 vport; /* virtual port number */
610 __u32 vfwmark; /* firewall mark of service */ 610 __u32 vfwmark; /* firewall mark of service */
611}; 611};
612 612
@@ -648,7 +648,7 @@ struct ip_vs_app
648 /* members for application incarnations */ 648 /* members for application incarnations */
649 struct list_head p_list; /* member in proto app list */ 649 struct list_head p_list; /* member in proto app list */
650 struct ip_vs_app *app; /* its real application */ 650 struct ip_vs_app *app; /* its real application */
651 __u16 port; /* port number in net order */ 651 __be16 port; /* port number in net order */
652 atomic_t usecnt; /* usage counter */ 652 atomic_t usecnt; /* usage counter */
653 653
654 /* output hook: return false if can't linearize. diff set for TCP. */ 654 /* output hook: return false if can't linearize. diff set for TCP. */
@@ -740,11 +740,11 @@ enum {
740}; 740};
741 741
742extern struct ip_vs_conn *ip_vs_conn_in_get 742extern struct ip_vs_conn *ip_vs_conn_in_get
743(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); 743(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
744extern struct ip_vs_conn *ip_vs_ct_in_get 744extern struct ip_vs_conn *ip_vs_ct_in_get
745(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); 745(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
746extern struct ip_vs_conn *ip_vs_conn_out_get 746extern struct ip_vs_conn *ip_vs_conn_out_get
747(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); 747(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
748 748
749/* put back the conn without restarting its timer */ 749/* put back the conn without restarting its timer */
750static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 750static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
@@ -752,11 +752,11 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
752 atomic_dec(&cp->refcnt); 752 atomic_dec(&cp->refcnt);
753} 753}
754extern void ip_vs_conn_put(struct ip_vs_conn *cp); 754extern void ip_vs_conn_put(struct ip_vs_conn *cp);
755extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport); 755extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
756 756
757extern struct ip_vs_conn * 757extern struct ip_vs_conn *
758ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport, 758ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport,
759 __u32 daddr, __u16 dport, unsigned flags, 759 __be32 daddr, __be16 dport, unsigned flags,
760 struct ip_vs_dest *dest); 760 struct ip_vs_dest *dest);
761extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 761extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
762 762
@@ -887,7 +887,7 @@ extern int sysctl_ip_vs_nat_icmp_send;
887extern struct ip_vs_stats ip_vs_stats; 887extern struct ip_vs_stats ip_vs_stats;
888 888
889extern struct ip_vs_service * 889extern struct ip_vs_service *
890ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport); 890ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport);
891 891
892static inline void ip_vs_service_put(struct ip_vs_service *svc) 892static inline void ip_vs_service_put(struct ip_vs_service *svc)
893{ 893{
@@ -895,7 +895,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
895} 895}
896 896
897extern struct ip_vs_dest * 897extern struct ip_vs_dest *
898ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport); 898ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport);
899extern int ip_vs_use_count_inc(void); 899extern int ip_vs_use_count_inc(void);
900extern void ip_vs_use_count_dec(void); 900extern void ip_vs_use_count_dec(void);
901extern int ip_vs_control_init(void); 901extern int ip_vs_control_init(void);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 72bf47b2a4e0..8223c4410b4b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -318,8 +318,8 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
318 318
319#ifndef __HAVE_ARCH_ADDR_SET 319#ifndef __HAVE_ARCH_ADDR_SET
320static inline void ipv6_addr_set(struct in6_addr *addr, 320static inline void ipv6_addr_set(struct in6_addr *addr,
321 __u32 w1, __u32 w2, 321 __be32 w1, __be32 w2,
322 __u32 w3, __u32 w4) 322 __be32 w3, __be32 w4)
323{ 323{
324 addr->s6_addr32[0] = w1; 324 addr->s6_addr32[0] = w1;
325 addr->s6_addr32[1] = w2; 325 addr->s6_addr32[1] = w2;
@@ -337,7 +337,7 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1,
337 a1->s6_addr32[3] == a2->s6_addr32[3]); 337 a1->s6_addr32[3] == a2->s6_addr32[3]);
338} 338}
339 339
340static inline int __ipv6_prefix_equal(const u32 *a1, const u32 *a2, 340static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
341 unsigned int prefixlen) 341 unsigned int prefixlen)
342{ 342{
343 unsigned pdw, pbi; 343 unsigned pdw, pbi;
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
index 1c73bdbc3eb3..9592c374b41d 100644
--- a/include/net/irda/irlan_common.h
+++ b/include/net/irda/irlan_common.h
@@ -98,7 +98,15 @@
98#define IRLAN_SHORT 1 98#define IRLAN_SHORT 1
99#define IRLAN_ARRAY 2 99#define IRLAN_ARRAY 2
100 100
101#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER) 101/* IrLAN sits on top if IrTTP */
102#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER)
103/* 1 byte for the command code and 1 byte for the parameter count */
104#define IRLAN_CMD_HEADER 2
105
106#define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \
107 + strlen ((value)))
108#define IRLAN_BYTE_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 1)
109#define IRLAN_SHORT_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 2)
102 110
103/* 111/*
104 * IrLAN client 112 * IrLAN client
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 3452ae257c84..9dd54a5002b2 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -74,6 +74,19 @@ struct discovery_t;
74 74
75#define PF_BIT 0x10 /* Poll/final bit */ 75#define PF_BIT 0x10 /* Poll/final bit */
76 76
77/* Some IrLAP field lengths */
78/*
79 * Only baud rate triplet is 4 bytes (PV can be 2 bytes).
80 * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes.
81 */
82#define IRLAP_NEGOCIATION_PARAMS_LEN 25
83#define IRLAP_DISCOVERY_INFO_LEN 32
84
85struct disc_frame {
86 __u8 caddr; /* Connection address */
87 __u8 control;
88} IRDA_PACK;
89
77struct xid_frame { 90struct xid_frame {
78 __u8 caddr; /* Connection address */ 91 __u8 caddr; /* Connection address */
79 __u8 control; 92 __u8 control;
@@ -95,11 +108,25 @@ struct test_frame {
95struct ua_frame { 108struct ua_frame {
96 __u8 caddr; 109 __u8 caddr;
97 __u8 control; 110 __u8 control;
98
99 __u32 saddr; /* Source device address */ 111 __u32 saddr; /* Source device address */
100 __u32 daddr; /* Dest device address */ 112 __u32 daddr; /* Dest device address */
101} IRDA_PACK; 113} IRDA_PACK;
102 114
115struct dm_frame {
116 __u8 caddr; /* Connection address */
117 __u8 control;
118} IRDA_PACK;
119
120struct rd_frame {
121 __u8 caddr; /* Connection address */
122 __u8 control;
123} IRDA_PACK;
124
125struct rr_frame {
126 __u8 caddr; /* Connection address */
127 __u8 control;
128} IRDA_PACK;
129
103struct i_frame { 130struct i_frame {
104 __u8 caddr; 131 __u8 caddr;
105 __u8 control; 132 __u8 control;
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index 11ecfa58a648..e212b9bc2503 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -48,7 +48,7 @@
48#define DEV_ADDR_ANY 0xffffffff 48#define DEV_ADDR_ANY 0xffffffff
49 49
50#define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ 50#define LMP_HEADER 2 /* Dest LSAP + Source LSAP */
51#define LMP_CONTROL_HEADER 4 51#define LMP_CONTROL_HEADER 4 /* LMP_HEADER + opcode + parameter */
52#define LMP_PID_HEADER 1 /* Used by Ultra */ 52#define LMP_PID_HEADER 1 /* Used by Ultra */
53#define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER) 53#define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER)
54 54
diff --git a/include/net/netdma.h b/include/net/netdma.h
index 7f53cd1d8b1e..f28c6e064e8f 100644
--- a/include/net/netdma.h
+++ b/include/net/netdma.h
@@ -20,7 +20,6 @@
20 */ 20 */
21#ifndef NETDMA_H 21#ifndef NETDMA_H
22#define NETDMA_H 22#define NETDMA_H
23#include <linux/config.h>
24#ifdef CONFIG_NET_DMA 23#ifdef CONFIG_NET_DMA
25#include <linux/dmaengine.h> 24#include <linux/dmaengine.h>
26#include <linux/skbuff.h> 25#include <linux/skbuff.h>
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 6692430063fd..c63a58058e21 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -92,11 +92,17 @@
92 * 92 *
93 */ 93 */
94 94
95/* NetLabel audit information */
96struct netlbl_audit {
97 u32 secid;
98 uid_t loginuid;
99};
100
95/* Domain mapping definition struct */ 101/* Domain mapping definition struct */
96struct netlbl_dom_map; 102struct netlbl_dom_map;
97 103
98/* Domain mapping operations */ 104/* Domain mapping operations */
99int netlbl_domhsh_remove(const char *domain); 105int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);
100 106
101/* LSM security attributes */ 107/* LSM security attributes */
102struct netlbl_lsm_cache { 108struct netlbl_lsm_cache {
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 4ab68a7a636a..ce5cba19c393 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -831,6 +831,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
831#define NLA_PUT_U32(skb, attrtype, value) \ 831#define NLA_PUT_U32(skb, attrtype, value) \
832 NLA_PUT_TYPE(skb, u32, attrtype, value) 832 NLA_PUT_TYPE(skb, u32, attrtype, value)
833 833
834#define NLA_PUT_BE32(skb, attrtype, value) \
835 NLA_PUT_TYPE(skb, __be32, attrtype, value)
836
834#define NLA_PUT_U64(skb, attrtype, value) \ 837#define NLA_PUT_U64(skb, attrtype, value) \
835 NLA_PUT_TYPE(skb, u64, attrtype, value) 838 NLA_PUT_TYPE(skb, u64, attrtype, value)
836 839
@@ -853,6 +856,15 @@ static inline u32 nla_get_u32(struct nlattr *nla)
853} 856}
854 857
855/** 858/**
859 * nla_get_be32 - return payload of __be32 attribute
860 * @nla: __be32 netlink attribute
861 */
862static inline __be32 nla_get_be32(struct nlattr *nla)
863{
864 return *(__be32 *) nla_data(nla);
865}
866
867/**
856 * nla_get_u16 - return payload of u16 attribute 868 * nla_get_u16 - return payload of u16 attribute
857 * @nla: u16 netlink attribute 869 * @nla: u16 netlink attribute
858 */ 870 */
diff --git a/include/net/route.h b/include/net/route.h
index 7f93ac0e0899..486e37aff06c 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -62,18 +62,18 @@ struct rtable
62 __u16 rt_type; 62 __u16 rt_type;
63 __u16 rt_multipath_alg; 63 __u16 rt_multipath_alg;
64 64
65 __u32 rt_dst; /* Path destination */ 65 __be32 rt_dst; /* Path destination */
66 __u32 rt_src; /* Path source */ 66 __be32 rt_src; /* Path source */
67 int rt_iif; 67 int rt_iif;
68 68
69 /* Info on neighbour */ 69 /* Info on neighbour */
70 __u32 rt_gateway; 70 __be32 rt_gateway;
71 71
72 /* Cache lookup keys */ 72 /* Cache lookup keys */
73 struct flowi fl; 73 struct flowi fl;
74 74
75 /* Miscellaneous cached information */ 75 /* Miscellaneous cached information */
76 __u32 rt_spec_dst; /* RFC1122 specific destination */ 76 __be32 rt_spec_dst; /* RFC1122 specific destination */
77 struct inet_peer *peer; /* long-living peer info */ 77 struct inet_peer *peer; /* long-living peer info */
78}; 78};
79 79
@@ -109,18 +109,18 @@ extern struct ip_rt_acct *ip_rt_acct;
109 109
110struct in_device; 110struct in_device;
111extern int ip_rt_init(void); 111extern int ip_rt_init(void);
112extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, 112extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
113 u32 src, struct net_device *dev); 113 __be32 src, struct net_device *dev);
114extern void ip_rt_advice(struct rtable **rp, int advice); 114extern void ip_rt_advice(struct rtable **rp, int advice);
115extern void rt_cache_flush(int how); 115extern void rt_cache_flush(int how);
116extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); 116extern int __ip_route_output_key(struct rtable **, const struct flowi *flp);
117extern int ip_route_output_key(struct rtable **, struct flowi *flp); 117extern int ip_route_output_key(struct rtable **, struct flowi *flp);
118extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 118extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
119extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin); 119extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin);
120extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); 120extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
121extern void ip_rt_send_redirect(struct sk_buff *skb); 121extern void ip_rt_send_redirect(struct sk_buff *skb);
122 122
123extern unsigned inet_addr_type(u32 addr); 123extern unsigned inet_addr_type(__be32 addr);
124extern void ip_rt_multicast_event(struct in_device *); 124extern void ip_rt_multicast_event(struct in_device *);
125extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); 125extern int ip_rt_ioctl(unsigned int cmd, void __user *arg);
126extern void ip_rt_get_source(u8 *src, struct rtable *rt); 126extern void ip_rt_get_source(u8 *src, struct rtable *rt);
@@ -144,9 +144,9 @@ static inline char rt_tos2priority(u8 tos)
144 return ip_tos2prio[IPTOS_TOS(tos)>>1]; 144 return ip_tos2prio[IPTOS_TOS(tos)>>1];
145} 145}
146 146
147static inline int ip_route_connect(struct rtable **rp, u32 dst, 147static inline int ip_route_connect(struct rtable **rp, __be32 dst,
148 u32 src, u32 tos, int oif, u8 protocol, 148 __be32 src, u32 tos, int oif, u8 protocol,
149 u16 sport, u16 dport, struct sock *sk) 149 __be16 sport, __be16 dport, struct sock *sk)
150{ 150{
151 struct flowi fl = { .oif = oif, 151 struct flowi fl = { .oif = oif,
152 .nl_u = { .ip4_u = { .daddr = dst, 152 .nl_u = { .ip4_u = { .daddr = dst,
@@ -172,7 +172,7 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst,
172} 172}
173 173
174static inline int ip_route_newports(struct rtable **rp, u8 protocol, 174static inline int ip_route_newports(struct rtable **rp, u8 protocol,
175 u16 sport, u16 dport, struct sock *sk) 175 __be16 sport, __be16 dport, struct sock *sk)
176{ 176{
177 if (sport != (*rp)->fl.fl_ip_sport || 177 if (sport != (*rp)->fl.fl_ip_sport ||
178 dport != (*rp)->fl.fl_ip_dport) { 178 dport != (*rp)->fl.fl_ip_dport) {
diff --git a/include/net/sock.h b/include/net/sock.h
index edd4d73ce7f5..40bb90ebb2d1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -665,7 +665,6 @@ struct sock_iocb {
665 struct sock *sk; 665 struct sock *sk;
666 struct scm_cookie *scm; 666 struct scm_cookie *scm;
667 struct msghdr *msg, async_msg; 667 struct msghdr *msg, async_msg;
668 struct iovec async_iov;
669 struct kiocb *kiocb; 668 struct kiocb *kiocb;
670}; 669};
671 670
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 11e0b1d6bd47..1e2a4ddec96e 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -437,8 +437,8 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
437 437
438static __inline__ int addr_match(void *token1, void *token2, int prefixlen) 438static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
439{ 439{
440 __u32 *a1 = token1; 440 __be32 *a1 = token1;
441 __u32 *a2 = token2; 441 __be32 *a2 = token2;
442 int pdw; 442 int pdw;
443 int pbi; 443 int pbi;
444 444
@@ -450,7 +450,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
450 return 0; 450 return 0;
451 451
452 if (pbi) { 452 if (pbi) {
453 __u32 mask; 453 __be32 mask;
454 454
455 mask = htonl((0xffffffff) << (32 - pbi)); 455 mask = htonl((0xffffffff) << (32 - pbi));
456 456
@@ -462,9 +462,9 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
462} 462}
463 463
464static __inline__ 464static __inline__
465u16 xfrm_flowi_sport(struct flowi *fl) 465__be16 xfrm_flowi_sport(struct flowi *fl)
466{ 466{
467 u16 port; 467 __be16 port;
468 switch(fl->proto) { 468 switch(fl->proto) {
469 case IPPROTO_TCP: 469 case IPPROTO_TCP:
470 case IPPROTO_UDP: 470 case IPPROTO_UDP:
@@ -487,9 +487,9 @@ u16 xfrm_flowi_sport(struct flowi *fl)
487} 487}
488 488
489static __inline__ 489static __inline__
490u16 xfrm_flowi_dport(struct flowi *fl) 490__be16 xfrm_flowi_dport(struct flowi *fl)
491{ 491{
492 u16 port; 492 __be16 port;
493 switch(fl->proto) { 493 switch(fl->proto) {
494 case IPPROTO_TCP: 494 case IPPROTO_TCP:
495 case IPPROTO_UDP: 495 case IPPROTO_UDP:
@@ -912,7 +912,7 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
912extern void xfrm_state_insert(struct xfrm_state *x); 912extern void xfrm_state_insert(struct xfrm_state *x);
913extern int xfrm_state_add(struct xfrm_state *x); 913extern int xfrm_state_add(struct xfrm_state *x);
914extern int xfrm_state_update(struct xfrm_state *x); 914extern int xfrm_state_update(struct xfrm_state *x);
915extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); 915extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family);
916extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 916extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family);
917#ifdef CONFIG_XFRM_SUB_POLICY 917#ifdef CONFIG_XFRM_SUB_POLICY
918extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 918extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
@@ -935,8 +935,8 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
935extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 935extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
936extern int xfrm_state_delete(struct xfrm_state *x); 936extern int xfrm_state_delete(struct xfrm_state *x);
937extern void xfrm_state_flush(u8 proto); 937extern void xfrm_state_flush(u8 proto);
938extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); 938extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
939extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); 939extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
940extern void xfrm_replay_notify(struct xfrm_state *x, int event); 940extern void xfrm_replay_notify(struct xfrm_state *x, int event);
941extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); 941extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
942extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 942extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
@@ -945,7 +945,7 @@ extern int xfrm4_rcv(struct sk_buff *skb);
945extern int xfrm4_output(struct sk_buff *skb); 945extern int xfrm4_output(struct sk_buff *skb);
946extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 946extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
947extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 947extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
948extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); 948extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi);
949extern int xfrm6_rcv(struct sk_buff **pskb); 949extern int xfrm6_rcv(struct sk_buff **pskb);
950extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 950extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
951 xfrm_address_t *saddr, u8 proto); 951 xfrm_address_t *saddr, u8 proto);
@@ -989,7 +989,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
989struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); 989struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete);
990void xfrm_policy_flush(u8 type); 990void xfrm_policy_flush(u8 type);
991u32 xfrm_get_acqseq(void); 991u32 xfrm_get_acqseq(void);
992void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 992void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
993struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 993struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
994 xfrm_address_t *daddr, xfrm_address_t *saddr, 994 xfrm_address_t *daddr, xfrm_address_t *saddr,
995 int create, unsigned short family); 995 int create, unsigned short family);
@@ -1004,7 +1004,7 @@ extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pi
1004extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1004extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1005 1005
1006extern void xfrm_input_init(void); 1006extern void xfrm_input_init(void);
1007extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); 1007extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
1008 1008
1009extern void xfrm_probe_algs(void); 1009extern void xfrm_probe_algs(void);
1010extern int xfrm_count_auth_supported(void); 1010extern int xfrm_count_auth_supported(void);
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index d04d05adfa9b..cf4c219c0b5c 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -6,7 +6,6 @@
6#include <scsi/scsi_device.h> 6#include <scsi/scsi_device.h>
7#include <scsi/scsi_host.h> 7#include <scsi/scsi_host.h>
8 8
9
10#define MSG_SIMPLE_TAG 0x20 9#define MSG_SIMPLE_TAG 0x20
11#define MSG_HEAD_TAG 0x21 10#define MSG_HEAD_TAG 0x21
12#define MSG_ORDERED_TAG 0x22 11#define MSG_ORDERED_TAG 0x22
@@ -14,6 +13,7 @@
14#define SCSI_NO_TAG (-1) /* identify no tag in use */ 13#define SCSI_NO_TAG (-1) /* identify no tag in use */
15 14
16 15
16#ifdef CONFIG_BLOCK
17 17
18/** 18/**
19 * scsi_get_tag_type - get the type of tag the device supports 19 * scsi_get_tag_type - get the type of tag the device supports
@@ -100,7 +100,7 @@ static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg)
100 struct scsi_device *sdev = cmd->device; 100 struct scsi_device *sdev = cmd->device;
101 101
102 if (blk_rq_tagged(req)) { 102 if (blk_rq_tagged(req)) {
103 if (sdev->ordered_tags && req->flags & REQ_HARDBARRIER) 103 if (sdev->ordered_tags && req->cmd_flags & REQ_HARDBARRIER)
104 *msg++ = MSG_ORDERED_TAG; 104 *msg++ = MSG_ORDERED_TAG;
105 else 105 else
106 *msg++ = MSG_SIMPLE_TAG; 106 *msg++ = MSG_SIMPLE_TAG;
@@ -144,4 +144,25 @@ static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
144 return shost->bqt ? 0 : -ENOMEM; 144 return shost->bqt ? 0 : -ENOMEM;
145} 145}
146 146
147/**
148 * scsi_host_find_tag - find the tagged command by host
149 * @shost: pointer to scsi_host
150 * @tag: tag of the scsi_cmnd
151 *
152 * Notes:
153 * Only works with tags allocated by the generic blk layer.
154 **/
155static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
156 int tag)
157{
158 struct request *req;
159
160 if (tag != SCSI_NO_TAG) {
161 req = blk_map_queue_find_tag(shost->bqt, tag);
162 return req ? (struct scsi_cmnd *)req->special : NULL;
163 }
164 return NULL;
165}
166
167#endif /* CONFIG_BLOCK */
147#endif /* _SCSI_SCSI_TCQ_H */ 168#endif /* _SCSI_SCSI_TCQ_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 60d40b34efc0..afaf3e88e086 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -347,6 +347,7 @@ struct snd_pcm_substream {
347 int number; 347 int number;
348 char name[32]; /* substream name */ 348 char name[32]; /* substream name */
349 int stream; /* stream (direction) */ 349 int stream; /* stream (direction) */
350 char latency_id[20]; /* latency identifier */
350 size_t buffer_bytes_max; /* limit ring buffer size */ 351 size_t buffer_bytes_max; /* limit ring buffer size */
351 struct snd_dma_buffer dma_buffer; 352 struct snd_dma_buffer dma_buffer;
352 unsigned int dma_buf_id; 353 unsigned int dma_buf_id;
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index f06cc88607f5..c99d261df8f7 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -1,4 +1,4 @@
1/* drivers/video/s1d3xxxfb.h 1/* include/video/s1d13xxxfb.h
2 * 2 *
3 * (c) 2004 Simtec Electronics 3 * (c) 2004 Simtec Electronics
4 * (c) 2005 Thibaut VARENE <varenet@parisc-linux.org> 4 * (c) 2005 Thibaut VARENE <varenet@parisc-linux.org>
diff --git a/include/video/sstfb.h b/include/video/sstfb.h
index 3570f9c9b111..5dbf5e7e50a8 100644
--- a/include/video/sstfb.h
+++ b/include/video/sstfb.h
@@ -68,10 +68,6 @@
68# define print_var(X,Y...) 68# define print_var(X,Y...)
69#endif 69#endif
70 70
71#define eprintk(X...) printk(KERN_ERR "sstfb: " X)
72#define iprintk(X...) printk(KERN_INFO "sstfb: " X)
73#define wprintk(X...) printk(KERN_WARNING "sstfb: " X)
74
75#define BIT(x) (1ul<<(x)) 71#define BIT(x) (1ul<<(x))
76#define POW2(x) (1ul<<(x)) 72#define POW2(x) (1ul<<(x))
77 73