aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild9
-rw-r--r--include/acpi/acconfig.h2
-rw-r--r--include/acpi/acdispat.h2
-rw-r--r--include/acpi/acglobal.h26
-rw-r--r--include/acpi/acinterp.h15
-rw-r--r--include/acpi/aclocal.h40
-rw-r--r--include/acpi/acmacros.h10
-rw-r--r--include/acpi/acobject.h8
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/acpi_drivers.h17
-rw-r--r--include/acpi/acpiosxf.h42
-rw-r--r--include/acpi/acresrc.h8
-rw-r--r--include/acpi/actypes.h49
-rw-r--r--include/acpi/platform/aclinux.h29
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-alpha/Kbuild11
-rw-r--r--include/asm-alpha/barrier.h3
-rw-r--r--include/asm-alpha/compiler.h3
-rw-r--r--include/asm-alpha/core_t2.h2
-rw-r--r--include/asm-alpha/floppy.h5
-rw-r--r--include/asm-alpha/hw_irq.h2
-rw-r--r--include/asm-alpha/mmzone.h1
-rw-r--r--include/asm-alpha/page.h6
-rw-r--r--include/asm-alpha/pgtable.h9
-rw-r--r--include/asm-alpha/rwsem.h14
-rw-r--r--include/asm-alpha/signal.h2
-rw-r--r--include/asm-alpha/socket.h1
-rw-r--r--include/asm-arm/Kbuild1
-rw-r--r--include/asm-arm/arch-aaec2000/io.h1
-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/board.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/gpio.h18
-rw-r--r--include/asm-arm/arch-at91rm9200/hardware.h28
-rw-r--r--include/asm-arm/arch-at91rm9200/irqs.h10
-rw-r--r--include/asm-arm/arch-at91rm9200/memory.h2
-rw-r--r--include/asm-arm/arch-clps711x/io.h1
-rw-r--r--include/asm-arm/arch-clps711x/time.h2
-rw-r--r--include/asm-arm/arch-ebsa285/io.h8
-rw-r--r--include/asm-arm/arch-ep93xx/ep93xx-regs.h3
-rw-r--r--include/asm-arm/arch-ep93xx/platform.h7
-rw-r--r--include/asm-arm/arch-h720x/memory.h2
-rw-r--r--include/asm-arm/arch-imx/memory.h6
-rw-r--r--include/asm-arm/arch-integrator/io.h1
-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)12
-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.h136
-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-ixp23xx/ixp23xx.h11
-rw-r--r--include/asm-arm/arch-ixp23xx/platform.h10
-rw-r--r--include/asm-arm/arch-ixp23xx/uncompress.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h5
-rw-r--r--include/asm-arm/arch-l7200/io.h9
-rw-r--r--include/asm-arm/arch-l7200/time.h2
-rw-r--r--include/asm-arm/arch-lh7a40x/io.h1
-rw-r--r--include/asm-arm/arch-netx/io.h1
-rw-r--r--include/asm-arm/arch-omap/board-ams-delta.h11
-rw-r--r--include/asm-arm/arch-omap/board-fsample.h51
-rw-r--r--include/asm-arm/arch-omap/board.h7
-rw-r--r--include/asm-arm/arch-omap/clock.h3
-rw-r--r--include/asm-arm/arch-omap/dma.h31
-rw-r--r--include/asm-arm/arch-omap/dmtimer.h82
-rw-r--r--include/asm-arm/arch-omap/gpmc.h91
-rw-r--r--include/asm-arm/arch-omap/hardware.h4
-rw-r--r--include/asm-arm/arch-omap/io.h1
-rw-r--r--include/asm-arm/arch-omap/irqs.h16
-rw-r--r--include/asm-arm/arch-omap/keypad.h3
-rw-r--r--include/asm-arm/arch-omap/mux.h51
-rw-r--r--include/asm-arm/arch-omap/pm.h33
-rw-r--r--include/asm-arm/arch-pxa/io.h1
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h2
-rw-r--r--include/asm-arm/arch-pxa/ssp.h4
-rw-r--r--include/asm-arm/arch-pxa/trizeps4.h106
-rw-r--r--include/asm-arm/arch-pxa/udc.h8
-rw-r--r--include/asm-arm/arch-realview/io.h1
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-cpld.h3
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-irq.h4
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-map.h2
-rw-r--r--include/asm-arm/arch-s3c2410/audio.h4
-rw-r--r--include/asm-arm/arch-s3c2410/bast-cpld.h5
-rw-r--r--include/asm-arm/arch-s3c2410/bast-irq.h6
-rw-r--r--include/asm-arm/arch-s3c2410/bast-map.h4
-rw-r--r--include/asm-arm/arch-s3c2410/bast-pmu.h3
-rw-r--r--include/asm-arm/arch-s3c2410/debug-macro.S13
-rw-r--r--include/asm-arm/arch-s3c2410/dma.h213
-rw-r--r--include/asm-arm/arch-s3c2410/entry-macro.S30
-rw-r--r--include/asm-arm/arch-s3c2410/fb.h7
-rw-r--r--include/asm-arm/arch-s3c2410/hardware.h10
-rw-r--r--include/asm-arm/arch-s3c2410/idle.h4
-rw-r--r--include/asm-arm/arch-s3c2410/iic.h4
-rw-r--r--include/asm-arm/arch-s3c2410/io.h8
-rw-r--r--include/asm-arm/arch-s3c2410/irqs.h9
-rw-r--r--include/asm-arm/arch-s3c2410/map.h28
-rw-r--r--include/asm-arm/arch-s3c2410/memory.h14
-rw-r--r--include/asm-arm/arch-s3c2410/nand.h3
-rw-r--r--include/asm-arm/arch-s3c2410/osiris-map.h20
-rw-r--r--include/asm-arm/arch-s3c2410/regs-ac97.h23
-rw-r--r--include/asm-arm/arch-s3c2410/regs-adc.h3
-rw-r--r--include/asm-arm/arch-s3c2410/regs-clock.h75
-rw-r--r--include/asm-arm/arch-s3c2410/regs-dsc.h13
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h78
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpioj.h9
-rw-r--r--include/asm-arm/arch-s3c2410/regs-iic.h4
-rw-r--r--include/asm-arm/arch-s3c2410/regs-iis.h12
-rw-r--r--include/asm-arm/arch-s3c2410/regs-irq.h15
-rw-r--r--include/asm-arm/arch-s3c2410/regs-lcd.h38
-rw-r--r--include/asm-arm/arch-s3c2410/regs-mem.h6
-rw-r--r--include/asm-arm/arch-s3c2410/regs-nand.h52
-rw-r--r--include/asm-arm/arch-s3c2410/regs-power.h34
-rw-r--r--include/asm-arm/arch-s3c2410/regs-rtc.h7
-rw-r--r--include/asm-arm/arch-s3c2410/regs-sdi.h5
-rw-r--r--include/asm-arm/arch-s3c2410/regs-serial.h20
-rw-r--r--include/asm-arm/arch-s3c2410/regs-spi.h8
-rw-r--r--include/asm-arm/arch-s3c2410/regs-timer.h7
-rw-r--r--include/asm-arm/arch-s3c2410/regs-udc.h8
-rw-r--r--include/asm-arm/arch-s3c2410/regs-watchdog.h7
-rw-r--r--include/asm-arm/arch-s3c2410/system.h9
-rw-r--r--include/asm-arm/arch-s3c2410/timex.h6
-rw-r--r--include/asm-arm/arch-s3c2410/uncompress.h9
-rw-r--r--include/asm-arm/arch-s3c2410/usb-control.h5
-rw-r--r--include/asm-arm/arch-s3c2410/vmalloc.h6
-rw-r--r--include/asm-arm/arch-s3c2410/vr1000-cpld.h4
-rw-r--r--include/asm-arm/arch-s3c2410/vr1000-irq.h6
-rw-r--r--include/asm-arm/arch-s3c2410/vr1000-map.h6
-rw-r--r--include/asm-arm/arch-sa1100/io.h1
-rw-r--r--include/asm-arm/arch-versatile/io.h1
-rw-r--r--include/asm-arm/arch-versatile/platform.h2
-rw-r--r--include/asm-arm/assembler.h36
-rw-r--r--include/asm-arm/atomic.h16
-rw-r--r--include/asm-arm/bitops.h24
-rw-r--r--include/asm-arm/bug.h1
-rw-r--r--include/asm-arm/bugs.h4
-rw-r--r--include/asm-arm/cacheflush.h40
-rw-r--r--include/asm-arm/domain.h7
-rw-r--r--include/asm-arm/dyntick.h6
-rw-r--r--include/asm-arm/elf.h16
-rw-r--r--include/asm-arm/flat.h16
-rw-r--r--include/asm-arm/floppy.h2
-rw-r--r--include/asm-arm/fpstate.h8
-rw-r--r--include/asm-arm/hardware/iop3xx.h301
-rw-r--r--include/asm-arm/hardware/locomo.h38
-rw-r--r--include/asm-arm/hardware/sharpsl_pm.h1
-rw-r--r--include/asm-arm/hardware/ssp.h4
-rw-r--r--include/asm-arm/hw_irq.h20
-rw-r--r--include/asm-arm/io.h11
-rw-r--r--include/asm-arm/irq.h22
-rw-r--r--include/asm-arm/irqflags.h132
-rw-r--r--include/asm-arm/mach/irq.h135
-rw-r--r--include/asm-arm/mach/map.h9
-rw-r--r--include/asm-arm/mach/pci.h12
-rw-r--r--include/asm-arm/mach/time.h3
-rw-r--r--include/asm-arm/memory.h80
-rw-r--r--include/asm-arm/mmu.h17
-rw-r--r--include/asm-arm/mmu_context.h14
-rw-r--r--include/asm-arm/page-nommu.h51
-rw-r--r--include/asm-arm/page.h17
-rw-r--r--include/asm-arm/pgalloc.h8
-rw-r--r--include/asm-arm/pgtable-hwdef.h1
-rw-r--r--include/asm-arm/pgtable-nommu.h123
-rw-r--r--include/asm-arm/pgtable.h25
-rw-r--r--include/asm-arm/proc-fns.h44
-rw-r--r--include/asm-arm/procinfo.h4
-rw-r--r--include/asm-arm/ptrace.h5
-rw-r--r--include/asm-arm/setup.h12
-rw-r--r--include/asm-arm/signal.h6
-rw-r--r--include/asm-arm/socket.h1
-rw-r--r--include/asm-arm/spinlock.h16
-rw-r--r--include/asm-arm/system.h138
-rw-r--r--include/asm-arm/thread_info.h9
-rw-r--r--include/asm-arm/timeofday.h4
-rw-r--r--include/asm-arm/tlbflush.h76
-rw-r--r--include/asm-arm/uaccess.h184
-rw-r--r--include/asm-arm/ucontext.h93
-rw-r--r--include/asm-arm/unaligned.h62
-rw-r--r--include/asm-arm/unistd.h3
-rw-r--r--include/asm-arm26/floppy.h2
-rw-r--r--include/asm-arm26/pgtable.h8
-rw-r--r--include/asm-arm26/signal.h2
-rw-r--r--include/asm-arm26/socket.h1
-rw-r--r--include/asm-arm26/system.h1
-rw-r--r--include/asm-arm26/unistd.h3
-rw-r--r--include/asm-avr32/Kbuild3
-rw-r--r--include/asm-avr32/a.out.h26
-rw-r--r--include/asm-avr32/addrspace.h43
-rw-r--r--include/asm-avr32/arch-at32ap/at91rm9200_pdc.h36
-rw-r--r--include/asm-avr32/arch-at32ap/at91rm9200_usart.h123
-rw-r--r--include/asm-avr32/arch-at32ap/board.h35
-rw-r--r--include/asm-avr32/arch-at32ap/init.h21
-rw-r--r--include/asm-avr32/arch-at32ap/portmux.h16
-rw-r--r--include/asm-avr32/arch-at32ap/sm.h27
-rw-r--r--include/asm-avr32/arch-at32ap/smc.h60
-rw-r--r--include/asm-avr32/asm.h102
-rw-r--r--include/asm-avr32/atomic.h201
-rw-r--r--include/asm-avr32/auxvec.h4
-rw-r--r--include/asm-avr32/bitops.h296
-rw-r--r--include/asm-avr32/bug.h47
-rw-r--r--include/asm-avr32/bugs.h15
-rw-r--r--include/asm-avr32/byteorder.h25
-rw-r--r--include/asm-avr32/cache.h29
-rw-r--r--include/asm-avr32/cachectl.h11
-rw-r--r--include/asm-avr32/cacheflush.h129
-rw-r--r--include/asm-avr32/checksum.h156
-rw-r--r--include/asm-avr32/cputime.h6
-rw-r--r--include/asm-avr32/current.h15
-rw-r--r--include/asm-avr32/delay.h26
-rw-r--r--include/asm-avr32/div64.h6
-rw-r--r--include/asm-avr32/dma-mapping.h320
-rw-r--r--include/asm-avr32/dma.h8
-rw-r--r--include/asm-avr32/elf.h110
-rw-r--r--include/asm-avr32/emergency-restart.h6
-rw-r--r--include/asm-avr32/errno.h6
-rw-r--r--include/asm-avr32/fcntl.h6
-rw-r--r--include/asm-avr32/futex.h6
-rw-r--r--include/asm-avr32/hardirq.h34
-rw-r--r--include/asm-avr32/hw_irq.h9
-rw-r--r--include/asm-avr32/intc.h128
-rw-r--r--include/asm-avr32/io.h253
-rw-r--r--include/asm-avr32/ioctl.h6
-rw-r--r--include/asm-avr32/ioctls.h83
-rw-r--r--include/asm-avr32/ipcbuf.h29
-rw-r--r--include/asm-avr32/irq.h10
-rw-r--r--include/asm-avr32/irqflags.h68
-rw-r--r--include/asm-avr32/kdebug.h38
-rw-r--r--include/asm-avr32/kmap_types.h30
-rw-r--r--include/asm-avr32/kprobes.h34
-rw-r--r--include/asm-avr32/linkage.h7
-rw-r--r--include/asm-avr32/local.h6
-rw-r--r--include/asm-avr32/mach/serial_at91.h33
-rw-r--r--include/asm-avr32/mman.h17
-rw-r--r--include/asm-avr32/mmu.h10
-rw-r--r--include/asm-avr32/mmu_context.h148
-rw-r--r--include/asm-avr32/module.h28
-rw-r--r--include/asm-avr32/msgbuf.h31
-rw-r--r--include/asm-avr32/mutex.h9
-rw-r--r--include/asm-avr32/namei.h7
-rw-r--r--include/asm-avr32/numnodes.h7
-rw-r--r--include/asm-avr32/ocd.h78
-rw-r--r--include/asm-avr32/page.h112
-rw-r--r--include/asm-avr32/param.h23
-rw-r--r--include/asm-avr32/pci.h8
-rw-r--r--include/asm-avr32/percpu.h6
-rw-r--r--include/asm-avr32/pgalloc.h96
-rw-r--r--include/asm-avr32/pgtable-2level.h47
-rw-r--r--include/asm-avr32/pgtable.h408
-rw-r--r--include/asm-avr32/poll.h27
-rw-r--r--include/asm-avr32/posix_types.h129
-rw-r--r--include/asm-avr32/processor.h147
-rw-r--r--include/asm-avr32/ptrace.h154
-rw-r--r--include/asm-avr32/resource.h6
-rw-r--r--include/asm-avr32/scatterlist.h21
-rw-r--r--include/asm-avr32/sections.h6
-rw-r--r--include/asm-avr32/semaphore.h109
-rw-r--r--include/asm-avr32/sembuf.h25
-rw-r--r--include/asm-avr32/setup.h141
-rw-r--r--include/asm-avr32/shmbuf.h42
-rw-r--r--include/asm-avr32/shmparam.h6
-rw-r--r--include/asm-avr32/sigcontext.h34
-rw-r--r--include/asm-avr32/siginfo.h6
-rw-r--r--include/asm-avr32/signal.h168
-rw-r--r--include/asm-avr32/socket.h53
-rw-r--r--include/asm-avr32/sockios.h12
-rw-r--r--include/asm-avr32/stat.h79
-rw-r--r--include/asm-avr32/statfs.h6
-rw-r--r--include/asm-avr32/string.h17
-rw-r--r--include/asm-avr32/sysreg.h332
-rw-r--r--include/asm-avr32/system.h155
-rw-r--r--include/asm-avr32/termbits.h173
-rw-r--r--include/asm-avr32/termios.h80
-rw-r--r--include/asm-avr32/thread_info.h106
-rw-r--r--include/asm-avr32/timex.h40
-rw-r--r--include/asm-avr32/tlb.h32
-rw-r--r--include/asm-avr32/tlbflush.h40
-rw-r--r--include/asm-avr32/topology.h6
-rw-r--r--include/asm-avr32/traps.h23
-rw-r--r--include/asm-avr32/types.h70
-rw-r--r--include/asm-avr32/uaccess.h335
-rw-r--r--include/asm-avr32/ucontext.h12
-rw-r--r--include/asm-avr32/unaligned.h25
-rw-r--r--include/asm-avr32/unistd.h387
-rw-r--r--include/asm-avr32/user.h65
-rw-r--r--include/asm-cris/Kbuild5
-rw-r--r--include/asm-cris/arch-v10/Kbuild2
-rw-r--r--include/asm-cris/arch-v10/irq.h2
-rw-r--r--include/asm-cris/arch-v32/Kbuild2
-rw-r--r--include/asm-cris/arch-v32/arbiter.h4
-rw-r--r--include/asm-cris/arch-v32/irq.h2
-rw-r--r--include/asm-cris/byteorder.h3
-rw-r--r--include/asm-cris/elf.h8
-rw-r--r--include/asm-cris/hw_irq.h2
-rw-r--r--include/asm-cris/irq.h5
-rw-r--r--include/asm-cris/page.h8
-rw-r--r--include/asm-cris/pgtable.h4
-rw-r--r--include/asm-cris/posix_types.h9
-rw-r--r--include/asm-cris/signal.h2
-rw-r--r--include/asm-cris/socket.h1
-rw-r--r--include/asm-cris/system.h1
-rw-r--r--include/asm-cris/unistd.h4
-rw-r--r--include/asm-frv/Kbuild1
-rw-r--r--include/asm-frv/bitops.h96
-rw-r--r--include/asm-frv/cpu-irqs.h54
-rw-r--r--include/asm-frv/elf.h6
-rw-r--r--include/asm-frv/gdb-stub.h22
-rw-r--r--include/asm-frv/hardirq.h5
-rw-r--r--include/asm-frv/irq-routing.h70
-rw-r--r--include/asm-frv/irq.h26
-rw-r--r--include/asm-frv/mb93091-fpga-irqs.h6
-rw-r--r--include/asm-frv/mb93093-fpga-irqs.h6
-rw-r--r--include/asm-frv/mb93493-irqs.h6
-rw-r--r--include/asm-frv/mb93493-regs.h2
-rw-r--r--include/asm-frv/pgtable.h8
-rw-r--r--include/asm-frv/processor.h3
-rw-r--r--include/asm-frv/ptrace.h12
-rw-r--r--include/asm-frv/registers.h97
-rw-r--r--include/asm-frv/signal.h2
-rw-r--r--include/asm-frv/socket.h1
-rw-r--r--include/asm-frv/system.h1
-rw-r--r--include/asm-frv/thread_info.h24
-rw-r--r--include/asm-frv/unistd.h3
-rw-r--r--include/asm-generic/4level-fixup.h4
-rw-r--r--include/asm-generic/Kbuild12
-rw-r--r--include/asm-generic/Kbuild.asm34
-rw-r--r--include/asm-generic/audit_change_attr.h22
-rw-r--r--include/asm-generic/audit_dir_write.h18
-rw-r--r--include/asm-generic/audit_read.h8
-rw-r--r--include/asm-generic/audit_write.h11
-rw-r--r--include/asm-generic/bug.h33
-rw-r--r--include/asm-generic/cputime.h2
-rw-r--r--include/asm-generic/libata-portmap.h12
-rw-r--r--include/asm-generic/mutex-null.h15
-rw-r--r--include/asm-generic/percpu.h8
-rw-r--r--include/asm-generic/pgtable-nopmd.h2
-rw-r--r--include/asm-generic/pgtable-nopud.h2
-rw-r--r--include/asm-generic/pgtable.h3
-rw-r--r--include/asm-generic/rtc.h7
-rw-r--r--include/asm-generic/sections.h1
-rw-r--r--include/asm-generic/vmlinux.lds.h37
-rw-r--r--include/asm-h8300/Kbuild1
-rw-r--r--include/asm-h8300/page.h8
-rw-r--r--include/asm-h8300/processor.h3
-rw-r--r--include/asm-h8300/signal.h2
-rw-r--r--include/asm-h8300/socket.h1
-rw-r--r--include/asm-h8300/system.h1
-rw-r--r--include/asm-h8300/unistd.h6
-rw-r--r--include/asm-i386/Kbuild11
-rw-r--r--include/asm-i386/acpi.h14
-rw-r--r--include/asm-i386/alternative-asm.i14
-rw-r--r--include/asm-i386/alternative.h30
-rw-r--r--include/asm-i386/apic.h28
-rw-r--r--include/asm-i386/atomic.h30
-rw-r--r--include/asm-i386/cpu.h2
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/delay.h2
-rw-r--r--include/asm-i386/desc.h121
-rw-r--r--include/asm-i386/dma-mapping.h15
-rw-r--r--include/asm-i386/dwarf2.h61
-rw-r--r--include/asm-i386/e820.h2
-rw-r--r--include/asm-i386/elf.h61
-rw-r--r--include/asm-i386/fixmap.h17
-rw-r--r--include/asm-i386/floppy.h7
-rw-r--r--include/asm-i386/frame.i24
-rw-r--r--include/asm-i386/futex.h10
-rw-r--r--include/asm-i386/genapic.h69
-rw-r--r--include/asm-i386/hw_irq.h12
-rw-r--r--include/asm-i386/intel_arch_perfmon.h31
-rw-r--r--include/asm-i386/io_apic.h11
-rw-r--r--include/asm-i386/irqflags.h127
-rw-r--r--include/asm-i386/k8.h1
-rw-r--r--include/asm-i386/kdebug.h2
-rw-r--r--include/asm-i386/kexec.h27
-rw-r--r--include/asm-i386/kprobes.h2
-rw-r--r--include/asm-i386/local.h40
-rw-r--r--include/asm-i386/mach-default/do_timer.h2
-rw-r--r--include/asm-i386/mach-default/mach_ipi.h7
-rw-r--r--include/asm-i386/mach-default/mach_mpspec.h4
-rw-r--r--include/asm-i386/mach-default/mach_timer.h4
-rw-r--r--include/asm-i386/mach-default/setup_arch.h (renamed from include/asm-i386/mach-default/setup_arch_pre.h)0
-rw-r--r--include/asm-i386/mach-default/setup_arch_post.h40
-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-summit/mach_mpparse.h3
-rw-r--r--include/asm-i386/mach-visws/do_timer.h2
-rw-r--r--include/asm-i386/mach-visws/setup_arch.h (renamed from include/asm-i386/mach-visws/setup_arch_pre.h)3
-rw-r--r--include/asm-i386/mach-visws/setup_arch_post.h49
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h2
-rw-r--r--include/asm-i386/mach-voyager/setup_arch.h (renamed from include/asm-i386/mach-voyager/setup_arch_pre.h)2
-rw-r--r--include/asm-i386/mach-voyager/setup_arch_post.h73
-rw-r--r--include/asm-i386/mmu.h1
-rw-r--r--include/asm-i386/mmzone.h8
-rw-r--r--include/asm-i386/mutex.h16
-rw-r--r--include/asm-i386/nmi.h53
-rw-r--r--include/asm-i386/node.h29
-rw-r--r--include/asm-i386/page.h3
-rw-r--r--include/asm-i386/pgtable-2level.h3
-rw-r--r--include/asm-i386/pgtable-3level.h4
-rw-r--r--include/asm-i386/pgtable.h47
-rw-r--r--include/asm-i386/posix_types.h4
-rw-r--r--include/asm-i386/processor.h71
-rw-r--r--include/asm-i386/ptrace-abi.h39
-rw-r--r--include/asm-i386/ptrace.h44
-rw-r--r--include/asm-i386/rwlock.h52
-rw-r--r--include/asm-i386/rwsem.h139
-rw-r--r--include/asm-i386/segment.h17
-rw-r--r--include/asm-i386/semaphore.h57
-rw-r--r--include/asm-i386/setup.h17
-rw-r--r--include/asm-i386/signal.h6
-rw-r--r--include/asm-i386/smp.h22
-rw-r--r--include/asm-i386/socket.h1
-rw-r--r--include/asm-i386/spinlock.h151
-rw-r--r--include/asm-i386/stacktrace.h1
-rw-r--r--include/asm-i386/sync_bitops.h156
-rw-r--r--include/asm-i386/system.h89
-rw-r--r--include/asm-i386/therm_throt.h9
-rw-r--r--include/asm-i386/thread_info.h25
-rw-r--r--include/asm-i386/timer.h57
-rw-r--r--include/asm-i386/timex.h34
-rw-r--r--include/asm-i386/tlbflush.h4
-rw-r--r--include/asm-i386/topology.h11
-rw-r--r--include/asm-i386/tsc.h48
-rw-r--r--include/asm-i386/uaccess.h50
-rw-r--r--include/asm-i386/unistd.h8
-rw-r--r--include/asm-i386/unwind.h107
-rw-r--r--include/asm-ia64/Kbuild17
-rw-r--r--include/asm-ia64/esi.h30
-rw-r--r--include/asm-ia64/futex.h122
-rw-r--r--include/asm-ia64/hw_irq.h3
-rw-r--r--include/asm-ia64/io.h2
-rw-r--r--include/asm-ia64/irq.h5
-rw-r--r--include/asm-ia64/kdebug.h2
-rw-r--r--include/asm-ia64/kprobes.h9
-rw-r--r--include/asm-ia64/mca_asm.h2
-rw-r--r--include/asm-ia64/meminit.h8
-rw-r--r--include/asm-ia64/mman.h8
-rw-r--r--include/asm-ia64/module.h3
-rw-r--r--include/asm-ia64/nodedata.h12
-rw-r--r--include/asm-ia64/numa.h6
-rw-r--r--include/asm-ia64/page.h4
-rw-r--r--include/asm-ia64/pal.h23
-rw-r--r--include/asm-ia64/percpu.h3
-rw-r--r--include/asm-ia64/pgtable.h14
-rw-r--r--include/asm-ia64/processor.h13
-rw-r--r--include/asm-ia64/ptrace.h10
-rw-r--r--include/asm-ia64/rwsem.h18
-rw-r--r--include/asm-ia64/signal.h4
-rw-r--r--include/asm-ia64/smp.h3
-rw-r--r--include/asm-ia64/sn/sn_sal.h16
-rw-r--r--include/asm-ia64/sn/tioca_provider.h2
-rw-r--r--include/asm-ia64/sn/xp.h22
-rw-r--r--include/asm-ia64/sn/xpc.h8
-rw-r--r--include/asm-ia64/socket.h1
-rw-r--r--include/asm-ia64/system.h5
-rw-r--r--include/asm-ia64/thread_info.h7
-rw-r--r--include/asm-ia64/topology.h1
-rw-r--r--include/asm-ia64/ustack.h7
-rw-r--r--include/asm-m32r/Kbuild1
-rw-r--r--include/asm-m32r/hw_irq.h5
-rw-r--r--include/asm-m32r/page.h3
-rw-r--r--include/asm-m32r/pgtable-2level.h6
-rw-r--r--include/asm-m32r/pgtable.h4
-rw-r--r--include/asm-m32r/ptrace.h4
-rw-r--r--include/asm-m32r/signal.h3
-rw-r--r--include/asm-m32r/socket.h1
-rw-r--r--include/asm-m32r/spinlock.h9
-rw-r--r--include/asm-m32r/system.h9
-rw-r--r--include/asm-m32r/unistd.h9
-rw-r--r--include/asm-m32r/user.h1
-rw-r--r--include/asm-m68k/Kbuild1
-rw-r--r--include/asm-m68k/amigaints.h96
-rw-r--r--include/asm-m68k/apollohw.h4
-rw-r--r--include/asm-m68k/atari_stdma.h2
-rw-r--r--include/asm-m68k/atariints.h11
-rw-r--r--include/asm-m68k/bvme6000hw.h30
-rw-r--r--include/asm-m68k/cacheflush.h40
-rw-r--r--include/asm-m68k/dma-mapping.h90
-rw-r--r--include/asm-m68k/floppy.h4
-rw-r--r--include/asm-m68k/irq.h110
-rw-r--r--include/asm-m68k/mac_oss.h10
-rw-r--r--include/asm-m68k/machdep.h6
-rw-r--r--include/asm-m68k/macintosh.h10
-rw-r--r--include/asm-m68k/macints.h14
-rw-r--r--include/asm-m68k/motorola_pgtable.h1
-rw-r--r--include/asm-m68k/mvme147hw.h44
-rw-r--r--include/asm-m68k/mvme16xhw.h40
-rw-r--r--include/asm-m68k/oplib.h5
-rw-r--r--include/asm-m68k/page.h8
-rw-r--r--include/asm-m68k/scatterlist.h9
-rw-r--r--include/asm-m68k/signal.h21
-rw-r--r--include/asm-m68k/socket.h1
-rw-r--r--include/asm-m68k/sun3ints.h22
-rw-r--r--include/asm-m68k/sun3xflop.h3
-rw-r--r--include/asm-m68k/system.h1
-rw-r--r--include/asm-m68k/traps.h7
-rw-r--r--include/asm-m68k/uaccess.h234
-rw-r--r--include/asm-m68k/unistd.h5
-rw-r--r--include/asm-m68knommu/Kbuild1
-rw-r--r--include/asm-m68knommu/bootstd.h12
-rw-r--r--include/asm-m68knommu/cacheflush.h13
-rw-r--r--include/asm-m68knommu/coldfire.h76
-rw-r--r--include/asm-m68knommu/irq.h6
-rw-r--r--include/asm-m68knommu/m5249sim.h2
-rw-r--r--include/asm-m68knommu/m532xsim.h2238
-rw-r--r--include/asm-m68knommu/mcfcache.h15
-rw-r--r--include/asm-m68knommu/mcfpit.h8
-rw-r--r--include/asm-m68knommu/mcfsim.h3
-rw-r--r--include/asm-m68knommu/mcftimer.h30
-rw-r--r--include/asm-m68knommu/mcfuart.h4
-rw-r--r--include/asm-m68knommu/page.h7
-rw-r--r--include/asm-m68knommu/page_offset.h43
-rw-r--r--include/asm-m68knommu/processor.h31
-rw-r--r--include/asm-m68knommu/ptrace.h2
-rw-r--r--include/asm-m68knommu/signal.h2
-rw-r--r--include/asm-m68knommu/system.h1
-rw-r--r--include/asm-m68knommu/uaccess.h12
-rw-r--r--include/asm-m68knommu/unistd.h5
-rw-r--r--include/asm-mips/Kbuild3
-rw-r--r--include/asm-mips/apm.h1
-rw-r--r--include/asm-mips/asmmacro.h4
-rw-r--r--include/asm-mips/atomic.h2
-rw-r--r--include/asm-mips/bitops.h2
-rw-r--r--include/asm-mips/bootinfo.h3
-rw-r--r--include/asm-mips/cacheflush.h12
-rw-r--r--include/asm-mips/compat.h3
-rw-r--r--include/asm-mips/cpu-features.h30
-rw-r--r--include/asm-mips/cpu.h2
-rw-r--r--include/asm-mips/fcntl.h2
-rw-r--r--include/asm-mips/fixmap.h4
-rw-r--r--include/asm-mips/galileo-boards/gt96100.h427
-rw-r--r--include/asm-mips/hazards.h360
-rw-r--r--include/asm-mips/hw_irq.h8
-rw-r--r--include/asm-mips/inst.h2
-rw-r--r--include/asm-mips/irqflags.h (renamed from include/asm-mips/interrupt.h)70
-rw-r--r--include/asm-mips/mach-atlas/mc146818rtc.h4
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_dbdma.h6
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h2
-rw-r--r--include/asm-mips/mach-cobalt/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-dec/mc146818rtc.h2
-rw-r--r--include/asm-mips/mach-ev96100/mach-gt64120.h46
-rw-r--r--include/asm-mips/mach-excite/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-excite/excite.h3
-rw-r--r--include/asm-mips/mach-excite/excite_fpga.h80
-rw-r--r--include/asm-mips/mach-generic/floppy.h2
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-ja/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-jazz/floppy.h2
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-mips/irq.h6
-rw-r--r--include/asm-mips/mach-ocelot3/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-qemu/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-sibyte/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-sim/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-yosemite/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mips-boards/atlasint.h124
-rw-r--r--include/asm-mips/mipsregs.h7
-rw-r--r--include/asm-mips/mmu_context.h8
-rw-r--r--include/asm-mips/page.h31
-rw-r--r--include/asm-mips/pgtable-32.h4
-rw-r--r--include/asm-mips/pgtable-64.h16
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/ptrace.h3
-rw-r--r--include/asm-mips/serial.h4
-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.h22
-rw-r--r--include/asm-mips/sn/ioc3.h2
-rw-r--r--include/asm-mips/sn/klconfig.h10
-rw-r--r--include/asm-mips/socket.h1
-rw-r--r--include/asm-mips/spinlock.h47
-rw-r--r--include/asm-mips/stackframe.h16
-rw-r--r--include/asm-mips/system.h5
-rw-r--r--include/asm-mips/time.h4
-rw-r--r--include/asm-mips/timex.h4
-rw-r--r--include/asm-mips/unistd.h33
-rw-r--r--include/asm-mips/user.h4
-rw-r--r--include/asm-mips/vr41xx/capcella.h2
-rw-r--r--include/asm-mips/vr41xx/cmbvr4133.h6
-rw-r--r--include/asm-mips/vr41xx/e55.h43
-rw-r--r--include/asm-mips/vr41xx/irq.h101
-rw-r--r--include/asm-mips/vr41xx/mpc30x.h2
-rw-r--r--include/asm-mips/vr41xx/tb0219.h2
-rw-r--r--include/asm-mips/vr41xx/tb0226.h2
-rw-r--r--include/asm-mips/vr41xx/tb0287.h2
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h53
-rw-r--r--include/asm-mips/vr41xx/vrc4173.h221
-rw-r--r--include/asm-mips/vr41xx/workpad.h43
-rw-r--r--include/asm-parisc/Kbuild1
-rw-r--r--include/asm-parisc/assembly.h2
-rw-r--r--include/asm-parisc/compat.h11
-rw-r--r--include/asm-parisc/floppy.h8
-rw-r--r--include/asm-parisc/hw_irq.h9
-rw-r--r--include/asm-parisc/irq.h5
-rw-r--r--include/asm-parisc/page.h18
-rw-r--r--include/asm-parisc/pdc.h21
-rw-r--r--include/asm-parisc/pgtable.h17
-rw-r--r--include/asm-parisc/processor.h14
-rw-r--r--include/asm-parisc/signal.h2
-rw-r--r--include/asm-parisc/socket.h1
-rw-r--r--include/asm-parisc/system.h28
-rw-r--r--include/asm-parisc/uaccess.h9
-rw-r--r--include/asm-parisc/unistd.h5
-rw-r--r--include/asm-powerpc/Kbuild41
-rw-r--r--include/asm-powerpc/atomic.h32
-rw-r--r--include/asm-powerpc/backlight.h40
-rw-r--r--include/asm-powerpc/bitops.h16
-rw-r--r--include/asm-powerpc/bug.h12
-rw-r--r--include/asm-powerpc/cputable.h75
-rw-r--r--include/asm-powerpc/cputime.h18
-rw-r--r--include/asm-powerpc/eeh.h3
-rw-r--r--include/asm-powerpc/floppy.h3
-rw-r--r--include/asm-powerpc/futex.h28
-rw-r--r--include/asm-powerpc/hvcall.h121
-rw-r--r--include/asm-powerpc/hw_irq.h18
-rw-r--r--include/asm-powerpc/i8259.h8
-rw-r--r--include/asm-powerpc/ibmebus.h2
-rw-r--r--include/asm-powerpc/ide.h12
-rw-r--r--include/asm-powerpc/io.h221
-rw-r--r--include/asm-powerpc/ipic.h12
-rw-r--r--include/asm-powerpc/irq.h351
-rw-r--r--include/asm-powerpc/irqflags.h31
-rw-r--r--include/asm-powerpc/iseries/hv_call_xm.h17
-rw-r--r--include/asm-powerpc/iseries/hv_lp_config.h13
-rw-r--r--include/asm-powerpc/iseries/iseries_io.h60
-rw-r--r--include/asm-powerpc/iseries/it_exp_vpd_panel.h51
-rw-r--r--include/asm-powerpc/iseries/it_lp_naca.h80
-rw-r--r--include/asm-powerpc/iseries/it_lp_queue.h42
-rw-r--r--include/asm-powerpc/iseries/vio.h28
-rw-r--r--include/asm-powerpc/kdebug.h2
-rw-r--r--include/asm-powerpc/kdump.h4
-rw-r--r--include/asm-powerpc/kexec.h12
-rw-r--r--include/asm-powerpc/kprobes.h3
-rw-r--r--include/asm-powerpc/lppaca.h23
-rw-r--r--include/asm-powerpc/machdep.h4
-rw-r--r--include/asm-powerpc/mmu.h1
-rw-r--r--include/asm-powerpc/mmu_context.h7
-rw-r--r--include/asm-powerpc/mpc86xx.h8
-rw-r--r--include/asm-powerpc/mpic.h190
-rw-r--r--include/asm-powerpc/of_device.h2
-rw-r--r--include/asm-powerpc/paca.h4
-rw-r--r--include/asm-powerpc/page.h6
-rw-r--r--include/asm-powerpc/pci.h2
-rw-r--r--include/asm-powerpc/percpu.h3
-rw-r--r--include/asm-powerpc/pgalloc.h2
-rw-r--r--include/asm-powerpc/pgtable-4k.h5
-rw-r--r--include/asm-powerpc/pgtable.h11
-rw-r--r--include/asm-powerpc/pmac_pfunc.h2
-rw-r--r--include/asm-powerpc/ppc-pci.h11
-rw-r--r--include/asm-powerpc/processor.h1
-rw-r--r--include/asm-powerpc/prom.h122
-rw-r--r--include/asm-powerpc/ptrace.h4
-rw-r--r--include/asm-powerpc/reg.h1
-rw-r--r--include/asm-powerpc/rtas.h20
-rw-r--r--include/asm-powerpc/rwsem.h18
-rw-r--r--include/asm-powerpc/signal.h2
-rw-r--r--include/asm-powerpc/smu.h2
-rw-r--r--include/asm-powerpc/socket.h1
-rw-r--r--include/asm-powerpc/spinlock.h17
-rw-r--r--include/asm-powerpc/spu.h3
-rw-r--r--include/asm-powerpc/system.h31
-rw-r--r--include/asm-powerpc/time.h10
-rw-r--r--include/asm-powerpc/todc.h487
-rw-r--r--include/asm-powerpc/topology.h5
-rw-r--r--include/asm-powerpc/tsi108.h111
-rw-r--r--include/asm-powerpc/tsi108_irq.h124
-rw-r--r--include/asm-powerpc/udbg.h3
-rw-r--r--include/asm-powerpc/vio.h4
-rw-r--r--include/asm-ppc/cpm2.h95
-rw-r--r--include/asm-ppc/floppy.h8
-rw-r--r--include/asm-ppc/ibm4xx.h2
-rw-r--r--include/asm-ppc/io.h46
-rw-r--r--include/asm-ppc/mpc8260.h1
-rw-r--r--include/asm-ppc/mpc8260_pci9.h4
-rw-r--r--include/asm-ppc/mpc8xx.h1
-rw-r--r--include/asm-ppc/ocp.h1
-rw-r--r--include/asm-ppc/page.h2
-rw-r--r--include/asm-ppc/pci.h2
-rw-r--r--include/asm-ppc/pgtable.h8
-rw-r--r--include/asm-ppc/reg_booke.h16
-rw-r--r--include/asm-ppc/system.h1
-rw-r--r--include/asm-s390/Kbuild12
-rw-r--r--include/asm-s390/appldata.h90
-rw-r--r--include/asm-s390/atomic.h120
-rw-r--r--include/asm-s390/bitops.h668
-rw-r--r--include/asm-s390/bug.h11
-rw-r--r--include/asm-s390/byteorder.h50
-rw-r--r--include/asm-s390/ccwdev.h2
-rw-r--r--include/asm-s390/checksum.h176
-rw-r--r--include/asm-s390/cio.h11
-rw-r--r--include/asm-s390/cmb.h4
-rw-r--r--include/asm-s390/dasd.h8
-rw-r--r--include/asm-s390/debug.h2
-rw-r--r--include/asm-s390/div64.h48
-rw-r--r--include/asm-s390/dma.h2
-rw-r--r--include/asm-s390/ebcdic.h20
-rw-r--r--include/asm-s390/elf.h28
-rw-r--r--include/asm-s390/futex.h86
-rw-r--r--include/asm-s390/io.h16
-rw-r--r--include/asm-s390/irq.h3
-rw-r--r--include/asm-s390/irqflags.h106
-rw-r--r--include/asm-s390/kdebug.h59
-rw-r--r--include/asm-s390/kprobes.h114
-rw-r--r--include/asm-s390/lowcore.h16
-rw-r--r--include/asm-s390/monwriter.h33
-rw-r--r--include/asm-s390/page.h111
-rw-r--r--include/asm-s390/percpu.h23
-rw-r--r--include/asm-s390/pgalloc.h69
-rw-r--r--include/asm-s390/pgtable.h227
-rw-r--r--include/asm-s390/processor.h163
-rw-r--r--include/asm-s390/ptrace.h2
-rw-r--r--include/asm-s390/rwsem.h269
-rw-r--r--include/asm-s390/semaphore.h19
-rw-r--r--include/asm-s390/setup.h69
-rw-r--r--include/asm-s390/sfp-machine.h64
-rw-r--r--include/asm-s390/signal.h2
-rw-r--r--include/asm-s390/sigp.h65
-rw-r--r--include/asm-s390/smp.h4
-rw-r--r--include/asm-s390/socket.h1
-rw-r--r--include/asm-s390/spinlock.h27
-rw-r--r--include/asm-s390/string.h56
-rw-r--r--include/asm-s390/system.h384
-rw-r--r--include/asm-s390/thread_info.h1
-rw-r--r--include/asm-s390/timex.h19
-rw-r--r--include/asm-s390/tlbflush.h32
-rw-r--r--include/asm-s390/uaccess.h181
-rw-r--r--include/asm-s390/unistd.h432
-rw-r--r--include/asm-s390/z90crypt.h212
-rw-r--r--include/asm-s390/zcrypt.h285
-rw-r--r--include/asm-sh/Kbuild1
-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/bitops.h16
-rw-r--r--include/asm-sh/bugs.h4
-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/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/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/elf.h30
-rw-r--r--include/asm-sh/fixmap.h2
-rw-r--r--include/asm-sh/flat.h2
-rw-r--r--include/asm-sh/floppy.h8
-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/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/hw_irq.h5
-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/keyboard.h2
-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.h38
-rw-r--r--include/asm-sh/pci.h44
-rw-r--r--include/asm-sh/pgalloc.h37
-rw-r--r--include/asm-sh/pgtable-2level.h5
-rw-r--r--include/asm-sh/pgtable.h158
-rw-r--r--include/asm-sh/pm.h17
-rw-r--r--include/asm-sh/processor.h55
-rw-r--r--include/asm-sh/ptrace.h2
-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/rts7751r2d.h2
-rw-r--r--include/asm-sh/rwsem.h18
-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.h86
-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/signal.h2
-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/socket.h1
-rw-r--r--include/asm-sh/system.h202
-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.h51
-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/Kbuild1
-rw-r--r--include/asm-sh64/bug.h16
-rw-r--r--include/asm-sh64/byteorder.h4
-rw-r--r--include/asm-sh64/dma-mapping.h16
-rw-r--r--include/asm-sh64/hw_irq.h1
-rw-r--r--include/asm-sh64/io.h7
-rw-r--r--include/asm-sh64/keyboard.h2
-rw-r--r--include/asm-sh64/page.h3
-rw-r--r--include/asm-sh64/pgtable.h6
-rw-r--r--include/asm-sh64/processor.h3
-rw-r--r--include/asm-sh64/ptrace.h2
-rw-r--r--include/asm-sh64/shmparam.h16
-rw-r--r--include/asm-sh64/signal.h3
-rw-r--r--include/asm-sh64/system.h3
-rw-r--r--include/asm-sh64/uaccess.h19
-rw-r--r--include/asm-sh64/unistd.h6
-rw-r--r--include/asm-sh64/user.h1
-rw-r--r--include/asm-sparc/Kbuild15
-rw-r--r--include/asm-sparc/ebus.h17
-rw-r--r--include/asm-sparc/floppy.h3
-rw-r--r--include/asm-sparc/io.h16
-rw-r--r--include/asm-sparc/mman.h8
-rw-r--r--include/asm-sparc/of_device.h79
-rw-r--r--include/asm-sparc/oplib.h5
-rw-r--r--include/asm-sparc/page.h8
-rw-r--r--include/asm-sparc/pbm.h3
-rw-r--r--include/asm-sparc/pgtable.h4
-rw-r--r--include/asm-sparc/prom.h104
-rw-r--r--include/asm-sparc/sbus.h28
-rw-r--r--include/asm-sparc/signal.h5
-rw-r--r--include/asm-sparc/socket.h1
-rw-r--r--include/asm-sparc/system.h1
-rw-r--r--include/asm-sparc64/Kbuild26
-rw-r--r--include/asm-sparc64/dma-mapping.h57
-rw-r--r--include/asm-sparc64/ebus.h20
-rw-r--r--include/asm-sparc64/fhc.h7
-rw-r--r--include/asm-sparc64/floppy.h79
-rw-r--r--include/asm-sparc64/isa.h21
-rw-r--r--include/asm-sparc64/kdebug.h2
-rw-r--r--include/asm-sparc64/kprobes.h2
-rw-r--r--include/asm-sparc64/mman.h8
-rw-r--r--include/asm-sparc64/of_device.h80
-rw-r--r--include/asm-sparc64/openprom.h2
-rw-r--r--include/asm-sparc64/oplib.h10
-rw-r--r--include/asm-sparc64/page.h9
-rw-r--r--include/asm-sparc64/parport.h25
-rw-r--r--include/asm-sparc64/pbm.h20
-rw-r--r--include/asm-sparc64/percpu.h3
-rw-r--r--include/asm-sparc64/pgtable.h11
-rw-r--r--include/asm-sparc64/prom.h112
-rw-r--r--include/asm-sparc64/sbus.h30
-rw-r--r--include/asm-sparc64/sfp-machine.h2
-rw-r--r--include/asm-sparc64/shmparam.h2
-rw-r--r--include/asm-sparc64/signal.h3
-rw-r--r--include/asm-sparc64/socket.h1
-rw-r--r--include/asm-sparc64/starfire.h2
-rw-r--r--include/asm-sparc64/system.h2
-rw-r--r--include/asm-sparc64/topology.h3
-rw-r--r--include/asm-sparc64/vdev.h16
-rw-r--r--include/asm-um/alternative-asm.i6
-rw-r--r--include/asm-um/frame.i6
-rw-r--r--include/asm-um/hw_irq.h3
-rw-r--r--include/asm-um/io.h5
-rw-r--r--include/asm-um/kmap_types.h20
-rw-r--r--include/asm-um/pgtable-2level.h2
-rw-r--r--include/asm-um/pgtable-3level.h5
-rw-r--r--include/asm-um/pgtable.h10
-rw-r--r--include/asm-um/processor-generic.h8
-rw-r--r--include/asm-um/ptrace-generic.h14
-rw-r--r--include/asm-um/ptrace-x86_64.h7
-rw-r--r--include/asm-v850/Kbuild1
-rw-r--r--include/asm-v850/hw_irq.h4
-rw-r--r--include/asm-v850/page.h7
-rw-r--r--include/asm-v850/param.h4
-rw-r--r--include/asm-v850/processor.h3
-rw-r--r--include/asm-v850/signal.h2
-rw-r--r--include/asm-v850/socket.h1
-rw-r--r--include/asm-v850/system.h1
-rw-r--r--include/asm-v850/unistd.h5
-rw-r--r--include/asm-x86_64/Kbuild22
-rw-r--r--include/asm-x86_64/acpi.h2
-rw-r--r--include/asm-x86_64/alternative-asm.i14
-rw-r--r--include/asm-x86_64/alternative.h136
-rw-r--r--include/asm-x86_64/apic.h35
-rw-r--r--include/asm-x86_64/atomic.h42
-rw-r--r--include/asm-x86_64/bitops.h9
-rw-r--r--include/asm-x86_64/calgary.h62
-rw-r--r--include/asm-x86_64/cpufeature.h3
-rw-r--r--include/asm-x86_64/dma-mapping.h10
-rw-r--r--include/asm-x86_64/dma.h2
-rw-r--r--include/asm-x86_64/dwarf2.h8
-rw-r--r--include/asm-x86_64/e820.h15
-rw-r--r--include/asm-x86_64/elf.h20
-rw-r--r--include/asm-x86_64/fixmap.h4
-rw-r--r--include/asm-x86_64/floppy.h8
-rw-r--r--include/asm-x86_64/gart-mapping.h16
-rw-r--r--include/asm-x86_64/genapic.h1
-rw-r--r--include/asm-x86_64/hpet.h2
-rw-r--r--include/asm-x86_64/hw_irq.h13
-rw-r--r--include/asm-x86_64/i387.h9
-rw-r--r--include/asm-x86_64/ia32_unistd.h308
-rw-r--r--include/asm-x86_64/intel_arch_perfmon.h31
-rw-r--r--include/asm-x86_64/io_apic.h6
-rw-r--r--include/asm-x86_64/irq.h2
-rw-r--r--include/asm-x86_64/irqflags.h141
-rw-r--r--include/asm-x86_64/k8.h14
-rw-r--r--include/asm-x86_64/kdebug.h4
-rw-r--r--include/asm-x86_64/kexec.h29
-rw-r--r--include/asm-x86_64/kprobes.h2
-rw-r--r--include/asm-x86_64/linkage.h2
-rw-r--r--include/asm-x86_64/local.h26
-rw-r--r--include/asm-x86_64/mach_apic.h1
-rw-r--r--include/asm-x86_64/mce.h15
-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/msr.h11
-rw-r--r--include/asm-x86_64/mutex.h24
-rw-r--r--include/asm-x86_64/nmi.h59
-rw-r--r--include/asm-x86_64/page.h2
-rw-r--r--include/asm-x86_64/pci-direct.h42
-rw-r--r--include/asm-x86_64/pci.h4
-rw-r--r--include/asm-x86_64/pda.h109
-rw-r--r--include/asm-x86_64/percpu.h24
-rw-r--r--include/asm-x86_64/pgtable.h30
-rw-r--r--include/asm-x86_64/processor.h11
-rw-r--r--include/asm-x86_64/proto.h32
-rw-r--r--include/asm-x86_64/ptrace-abi.h51
-rw-r--r--include/asm-x86_64/ptrace.h59
-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.h52
-rw-r--r--include/asm-x86_64/signal.h8
-rw-r--r--include/asm-x86_64/smp.h33
-rw-r--r--include/asm-x86_64/socket.h1
-rw-r--r--include/asm-x86_64/spinlock.h83
-rw-r--r--include/asm-x86_64/stacktrace.h18
-rw-r--r--include/asm-x86_64/string.h3
-rw-r--r--include/asm-x86_64/swiotlb.h2
-rw-r--r--include/asm-x86_64/system.h130
-rw-r--r--include/asm-x86_64/tce.h48
-rw-r--r--include/asm-x86_64/therm_throt.h1
-rw-r--r--include/asm-x86_64/thread_info.h28
-rw-r--r--include/asm-x86_64/tlbflush.h70
-rw-r--r--include/asm-x86_64/topology.h10
-rw-r--r--include/asm-x86_64/uaccess.h71
-rw-r--r--include/asm-x86_64/unistd.h21
-rw-r--r--include/asm-x86_64/unwind.h112
-rw-r--r--include/asm-x86_64/vsyscall.h12
-rw-r--r--include/asm-xtensa/Kbuild1
-rw-r--r--include/asm-xtensa/hw_irq.h4
-rw-r--r--include/asm-xtensa/pgtable.h4
-rw-r--r--include/asm-xtensa/processor.h3
-rw-r--r--include/asm-xtensa/rwsem.h18
-rw-r--r--include/asm-xtensa/signal.h15
-rw-r--r--include/asm-xtensa/socket.h1
-rw-r--r--include/asm-xtensa/system.h1
-rw-r--r--include/crypto/algapi.h156
-rw-r--r--include/crypto/twofish.h22
-rw-r--r--include/keys/user-type.h1
-rw-r--r--include/linux/Kbuild344
-rw-r--r--include/linux/ac97_codec.h2
-rw-r--r--include/linux/acct.h8
-rw-r--r--include/linux/acpi.h6
-rw-r--r--include/linux/adfs_fs.h2
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/affs_fs.h7
-rw-r--r--include/linux/ata.h26
-rw-r--r--include/linux/atalk.h40
-rw-r--r--include/linux/atmdev.h4
-rw-r--r--include/linux/atmlec.h119
-rw-r--r--include/linux/audit.h84
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitmap.h5
-rw-r--r--include/linux/blkdev.h7
-rw-r--r--include/linux/blktrace_api.h5
-rw-r--r--include/linux/bootmem.h104
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/byteorder/Kbuild7
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/clocksource.h185
-rw-r--r--include/linux/cn_proc.h3
-rw-r--r--include/linux/coda_linux.h4
-rw-r--r--include/linux/coda_psdev.h4
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/compat_ioctl.h11
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/completion.h15
-rw-r--r--include/linux/console.h10
-rw-r--r--include/linux/console_struct.h1
-rw-r--r--include/linux/cpu.h30
-rw-r--r--include/linux/cpufreq.h9
-rw-r--r--include/linux/cpumask.h4
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/cramfs_fs.h2
-rw-r--r--include/linux/crypto.h723
-rw-r--r--include/linux/dcache.h13
-rw-r--r--include/linux/dccp.h16
-rw-r--r--include/linux/debug_locks.h71
-rw-r--r--include/linux/delayacct.h121
-rw-r--r--include/linux/devfs_fs.h41
-rw-r--r--include/linux/devfs_fs_kernel.h57
-rw-r--r--include/linux/device-mapper.h111
-rw-r--r--include/linux/device.h99
-rw-r--r--include/linux/dm-ioctl.h6
-rw-r--r--include/linux/dma-mapping.h7
-rw-r--r--include/linux/dmaengine.h45
-rw-r--r--include/linux/dmi.h3
-rw-r--r--include/linux/dqblk_xfs.h4
-rw-r--r--include/linux/dvb/Kbuild9
-rw-r--r--include/linux/dvb/dmx.h26
-rw-r--r--include/linux/edd.h1
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/efs_fs_sb.h3
-rw-r--r--include/linux/eisa.h8
-rw-r--r--include/linux/elf-em.h6
-rw-r--r--include/linux/elfcore.h10
-rw-r--r--include/linux/elfnote.h90
-rw-r--r--include/linux/err.h8
-rw-r--r--include/linux/errqueue.h2
-rw-r--r--include/linux/eventpoll.h2
-rw-r--r--include/linux/ext2_fs.h6
-rw-r--r--include/linux/ext3_fs.h50
-rw-r--r--include/linux/ext3_fs_i.h18
-rw-r--r--include/linux/ext3_jbd.h10
-rw-r--r--include/linux/fb.h48
-rw-r--r--include/linux/fcntl.h1
-rw-r--r--include/linux/fib_rules.h65
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/filter.h13
-rw-r--r--include/linux/fs.h84
-rw-r--r--include/linux/fs_enet_pd.h50
-rw-r--r--include/linux/fsnotify.h6
-rw-r--r--include/linux/fuse.h36
-rw-r--r--include/linux/futex.h15
-rw-r--r--include/linux/generic_acl.h36
-rw-r--r--include/linux/genetlink.h18
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/getcpu.h18
-rw-r--r--include/linux/gfp.h41
-rw-r--r--include/linux/hardirq.h27
-rw-r--r--include/linux/hdlc.h203
-rw-r--r--include/linux/hdlc/Kbuild1
-rw-r--r--include/linux/hdlc/ioctl.h33
-rw-r--r--include/linux/highmem.h5
-rw-r--r--include/linux/hpfs_fs.h8
-rw-r--r--include/linux/hrtimer.h6
-rw-r--r--include/linux/hw_random.h50
-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.h4
-rw-r--r--include/linux/i2c.h16
-rw-r--r--include/linux/icmp.h12
-rw-r--r--include/linux/ide.h8
-rw-r--r--include/linux/idr.h3
-rw-r--r--include/linux/if.h3
-rw-r--r--include/linux/if_addr.h55
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_link.h136
-rw-r--r--include/linux/if_vlan.h10
-rw-r--r--include/linux/igmp.h38
-rw-r--r--include/linux/in.h16
-rw-r--r--include/linux/in6.h8
-rw-r--r--include/linux/inet.h2
-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.h17
-rw-r--r--include/linux/input.h34
-rw-r--r--include/linux/interrupt.h154
-rw-r--r--include/linux/ioport.h33
-rw-r--r--include/linux/ioprio.h23
-rw-r--r--include/linux/ip.h15
-rw-r--r--include/linux/ipmi.h4
-rw-r--r--include/linux/ipv6.h47
-rw-r--r--include/linux/irq.h377
-rw-r--r--include/linux/irqflags.h96
-rw-r--r--include/linux/isdn/Kbuild1
-rw-r--r--include/linux/isdn/tpam.h55
-rw-r--r--include/linux/iso_fs.h6
-rw-r--r--include/linux/jbd.h74
-rw-r--r--include/linux/jffs2.h5
-rw-r--r--include/linux/jiffies.h19
-rw-r--r--include/linux/kallsyms.h23
-rw-r--r--include/linux/kbd_kern.h4
-rw-r--r--include/linux/kernel.h22
-rw-r--r--include/linux/key.h21
-rw-r--r--include/linux/kobject.h16
-rw-r--r--include/linux/kthread.h66
-rw-r--r--include/linux/ktime.h15
-rw-r--r--include/linux/leds.h3
-rw-r--r--include/linux/libata.h192
-rw-r--r--include/linux/license.h14
-rw-r--r--include/linux/linkage.h6
-rw-r--r--include/linux/list.h169
-rw-r--r--include/linux/lockd/lockd.h5
-rw-r--r--include/linux/lockdep.h353
-rw-r--r--include/linux/loop.h5
-rw-r--r--include/linux/magic.h37
-rw-r--r--include/linux/mc146818rtc.h7
-rw-r--r--include/linux/memory_hotplug.h73
-rw-r--r--include/linux/mempolicy.h4
-rw-r--r--include/linux/migrate.h11
-rw-r--r--include/linux/minix_fs.h6
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mm.h263
-rw-r--r--include/linux/mm_types.h67
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmzone.h178
-rw-r--r--include/linux/mod_devicetable.h23
-rw-r--r--include/linux/module.h48
-rw-r--r--include/linux/mount.h8
-rw-r--r--include/linux/mroute.h14
-rw-r--r--include/linux/msdos_fs.h7
-rw-r--r--include/linux/mtd/bbm.h35
-rw-r--r--include/linux/mtd/cfi.h13
-rw-r--r--include/linux/mtd/mtd.h4
-rw-r--r--include/linux/mtd/nand.h16
-rw-r--r--include/linux/mtd/onenand.h77
-rw-r--r--include/linux/mutex-debug.h18
-rw-r--r--include/linux/mutex.h37
-rw-r--r--include/linux/namei.h3
-rw-r--r--include/linux/nbd.h12
-rw-r--r--include/linux/ncp_fs.h5
-rw-r--r--include/linux/neighbour.h159
-rw-r--r--include/linux/net.h29
-rw-r--r--include/linux/netdevice.h75
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/Kbuild40
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h1
-rw-r--r--include/linux/netfilter/nfnetlink.h4
-rw-r--r--include/linux/netfilter/nfnetlink_log.h6
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h8
-rw-r--r--include/linux/netfilter/x_tables.h52
-rw-r--r--include/linux/netfilter/xt_DSCP.h20
-rw-r--r--include/linux/netfilter/xt_dscp.h23
-rw-r--r--include/linux/netfilter_arp/Kbuild3
-rw-r--r--include/linux/netfilter_arp/arp_tables.h9
-rw-r--r--include/linux/netfilter_bridge.h35
-rw-r--r--include/linux/netfilter_bridge/Kbuild17
-rw-r--r--include/linux/netfilter_ipv4/Kbuild63
-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_helper.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h45
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h22
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h16
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h8
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h4
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_DSCP.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_dscp.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h2
-rw-r--r--include/linux/netfilter_ipv4/listhelp.h123
-rw-r--r--include/linux/netfilter_ipv6.h1
-rw-r--r--include/linux/netfilter_ipv6/Kbuild21
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/linux/netfilter_logging.h33
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/netpoll.h1
-rw-r--r--include/linux/nfs4.h7
-rw-r--r--include/linux/nfs_fs.h67
-rw-r--r--include/linux/nfs_fs_sb.h90
-rw-r--r--include/linux/nfs_idmap.h14
-rw-r--r--include/linux/nfs_page.h5
-rw-r--r--include/linux/nfs_xdr.h94
-rw-r--r--include/linux/nfsd/Kbuild7
-rw-r--r--include/linux/nfsd/nfsfh.h10
-rw-r--r--include/linux/nfsd/stats.h6
-rw-r--r--include/linux/nmi.h3
-rw-r--r--include/linux/node.h25
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/nsc_gpio.h40
-rw-r--r--include/linux/openprom_fs.h10
-rw-r--r--include/linux/page-flags.h183
-rw-r--r--include/linux/pagemap.h60
-rw-r--r--include/linux/parport.h5
-rw-r--r--include/linux/pci.h49
-rw-r--r--include/linux/pci_ids.h46
-rw-r--r--include/linux/pci_regs.h18
-rw-r--r--include/linux/pcieport_if.h6
-rw-r--r--include/linux/percpu.h89
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/pid.h2
-rw-r--r--include/linux/pkt_cls.h1
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/plist.h248
-rw-r--r--include/linux/pm.h63
-rw-r--r--include/linux/pm_legacy.h7
-rw-r--r--include/linux/pmu.h3
-rw-r--r--include/linux/pnp.h7
-rw-r--r--include/linux/poison.h63
-rw-r--r--include/linux/posix-timers.h4
-rw-r--r--include/linux/proc_fs.h21
-rw-r--r--include/linux/ptrace.h5
-rw-r--r--include/linux/qnx4_fs.h2
-rw-r--r--include/linux/raid/Kbuild2
-rw-r--r--include/linux/raid/bitmap.h11
-rw-r--r--include/linux/raid/linear.h2
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h13
-rw-r--r--include/linux/raid/md_p.h5
-rw-r--r--include/linux/raid/raid10.h7
-rw-r--r--include/linux/raid/raid5.h1
-rw-r--r--include/linux/rcupdate.h25
-rw-r--r--include/linux/reboot.h4
-rw-r--r--include/linux/reiserfs_acl.h17
-rw-r--r--include/linux/reiserfs_fs.h12
-rw-r--r--include/linux/reiserfs_fs_i.h5
-rw-r--r--include/linux/reiserfs_xattr.h8
-rw-r--r--include/linux/resource.h4
-rw-r--r--include/linux/resume-trace.h34
-rw-r--r--include/linux/rmap.h14
-rw-r--r--include/linux/root_dev.h2
-rw-r--r--include/linux/rtc-v3020.h35
-rw-r--r--include/linux/rtc.h16
-rw-r--r--include/linux/rtmutex.h107
-rw-r--r--include/linux/rtnetlink.h376
-rw-r--r--include/linux/rwsem-spinlock.h27
-rw-r--r--include/linux/rwsem.h96
-rw-r--r--include/linux/scatterlist.h4
-rw-r--r--include/linux/sched.h241
-rw-r--r--include/linux/scx200.h7
-rw-r--r--include/linux/scx200_gpio.h22
-rw-r--r--include/linux/security.h342
-rw-r--r--include/linux/selinux.h29
-rw-r--r--include/linux/seqlock.h12
-rw-r--r--include/linux/serial_core.h8
-rw-r--r--include/linux/shmem_fs.h24
-rw-r--r--include/linux/signal.h26
-rw-r--r--include/linux/skbuff.h92
-rw-r--r--include/linux/slab.h33
-rw-r--r--include/linux/smb.h4
-rw-r--r--include/linux/smp.h5
-rw-r--r--include/linux/snmp.h35
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/spinlock.h77
-rw-r--r--include/linux/spinlock_api_smp.h50
-rw-r--r--include/linux/spinlock_api_up.h1
-rw-r--r--include/linux/spinlock_types.h47
-rw-r--r--include/linux/spinlock_types_up.h9
-rw-r--r--include/linux/spinlock_up.h1
-rw-r--r--include/linux/stacktrace.h21
-rw-r--r--include/linux/stddef.h2
-rw-r--r--include/linux/sunrpc/Kbuild1
-rw-r--r--include/linux/sunrpc/auth.h16
-rw-r--r--include/linux/sunrpc/clnt.h57
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/gss_krb5.h19
-rw-r--r--include/linux/sunrpc/gss_spkm3.h4
-rw-r--r--include/linux/sunrpc/msg_prot.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h6
-rw-r--r--include/linux/sunrpc/sched.h5
-rw-r--r--include/linux/sunrpc/svc.h49
-rw-r--r--include/linux/sunrpc/svcauth.h4
-rw-r--r--include/linux/sunrpc/xdr.h39
-rw-r--r--include/linux/sunrpc/xprt.h68
-rw-r--r--include/linux/suspend.h33
-rw-r--r--include/linux/swap.h16
-rw-r--r--include/linux/synclink.h5
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/sysctl.h18
-rw-r--r--include/linux/sysfs.h28
-rw-r--r--include/linux/taskstats.h137
-rw-r--r--include/linux/taskstats_kern.h89
-rw-r--r--include/linux/tc_act/Kbuild4
-rw-r--r--include/linux/tc_ematch/Kbuild4
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/time.h40
-rw-r--r--include/linux/timex.h5
-rw-r--r--include/linux/topology.h3
-rw-r--r--include/linux/trdevice.h2
-rw-r--r--include/linux/tty.h18
-rw-r--r--include/linux/tty_driver.h14
-rw-r--r--include/linux/tty_flip.h2
-rw-r--r--include/linux/types.h7
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/udp.h10
-rw-r--r--include/linux/ufs_fs.h108
-rw-r--r--include/linux/ufs_fs_i.h1
-rw-r--r--include/linux/unwind.h127
-rw-r--r--include/linux/usb.h165
-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/serial.h300
-rw-r--r--include/linux/usb_ch9.h7
-rw-r--r--include/linux/usb_gadget.h4
-rw-r--r--include/linux/usb_usual.h7
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--include/linux/vermagic.h6
-rw-r--r--include/linux/videodev.h55
-rw-r--r--include/linux/videodev2.h400
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/vmstat.h229
-rw-r--r--include/linux/vt.h11
-rw-r--r--include/linux/vt_kern.h4
-rw-r--r--include/linux/wait.h8
-rw-r--r--include/linux/watchdog.h10
-rw-r--r--include/linux/wireless.h24
-rw-r--r--include/linux/workqueue.h2
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xfrm.h52
-rw-r--r--include/media/cx2341x.h195
-rw-r--r--include/media/ir-common.h5
-rw-r--r--include/media/ir-kbd-i2c.h3
-rw-r--r--include/media/ovcamchip.h1
-rw-r--r--include/media/pwc-ioctl.h325
-rw-r--r--include/media/saa7115.h11
-rw-r--r--include/media/saa7146_vv.h2
-rw-r--r--include/media/tuner-types.h55
-rw-r--r--include/media/tuner.h13
-rw-r--r--include/media/tvp5150.h34
-rw-r--r--include/media/v4l2-common.h32
-rw-r--r--include/media/v4l2-dev.h378
-rw-r--r--include/media/video-buf-dvb.h3
-rw-r--r--include/media/video-buf.h1
-rw-r--r--include/mtd/Kbuild6
-rw-r--r--include/mtd/mtd-abi.h3
-rw-r--r--include/net/act_api.h136
-rw-r--r--include/net/act_generic.h142
-rw-r--r--include/net/addrconf.h13
-rw-r--r--include/net/af_unix.h7
-rw-r--r--include/net/ah.h30
-rw-r--r--include/net/arp.h8
-rw-r--r--include/net/ax25.h24
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--include/net/bluetooth/hci.h84
-rw-r--r--include/net/bluetooth/hci_core.h71
-rw-r--r--include/net/cipso_ipv4.h254
-rw-r--r--include/net/dn_fib.h18
-rw-r--r--include/net/dst.h3
-rw-r--r--include/net/esp.h36
-rw-r--r--include/net/fib_rules.h97
-rw-r--r--include/net/flow.h26
-rw-r--r--include/net/genetlink.h27
-rw-r--r--include/net/icmp.h2
-rw-r--r--include/net/ieee80211.h9
-rw-r--r--include/net/ieee80211softmac.h61
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet_connection_sock.h9
-rw-r--r--include/net/inet_hashtables.h96
-rw-r--r--include/net/inet_sock.h40
-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/ip6_fib.h113
-rw-r--r--include/net/ip6_route.h51
-rw-r--r--include/net/ip_fib.h124
-rw-r--r--include/net/ip_mp_alg.h4
-rw-r--r--include/net/ip_vs.h68
-rw-r--r--include/net/ipcomp.h5
-rw-r--r--include/net/ipv6.h14
-rw-r--r--include/net/irda/irda_device.h2
-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/mip6.h61
-rw-r--r--include/net/neighbour.h42
-rw-r--r--include/net/netdma.h4
-rw-r--r--include/net/netevent.h33
-rw-r--r--include/net/netlabel.h261
-rw-r--r--include/net/netlink.h154
-rw-r--r--include/net/nexthop.h33
-rw-r--r--include/net/pkt_act.h273
-rw-r--r--include/net/pkt_sched.h4
-rw-r--r--include/net/protocol.h11
-rw-r--r--include/net/red.h2
-rw-r--r--include/net/request_sock.h1
-rw-r--r--include/net/route.h27
-rw-r--r--include/net/scm.h38
-rw-r--r--include/net/sctp/constants.h17
-rw-r--r--include/net/sctp/sctp.h81
-rw-r--r--include/net/sctp/sm.h3
-rw-r--r--include/net/sctp/structs.h26
-rw-r--r--include/net/sctp/user.h9
-rw-r--r--include/net/snmp.h6
-rw-r--r--include/net/sock.h83
-rw-r--r--include/net/tc_act/tc_defact.h13
-rw-r--r--include/net/tc_act/tc_gact.h18
-rw-r--r--include/net/tc_act/tc_ipt.h15
-rw-r--r--include/net/tc_act/tc_mirred.h17
-rw-r--r--include/net/tc_act/tc_pedit.h15
-rw-r--r--include/net/tcp.h8
-rw-r--r--include/net/tcp_ecn.h4
-rw-r--r--include/net/tipc/tipc_bearer.h12
-rw-r--r--include/net/udp.h18
-rw-r--r--include/net/xfrm.h238
-rw-r--r--include/rdma/Kbuild1
-rw-r--r--include/rdma/ib_addr.h27
-rw-r--r--include/rdma/ib_fmr_pool.h2
-rw-r--r--include/rdma/ib_mad.h7
-rw-r--r--include/rdma/ib_sa.h45
-rw-r--r--include/rdma/ib_user_verbs.h2
-rw-r--r--include/rdma/ib_verbs.h31
-rw-r--r--include/rdma/iw_cm.h258
-rw-r--r--include/rdma/rdma_cm.h12
-rw-r--r--include/scsi/Kbuild4
-rw-r--r--include/scsi/iscsi_if.h24
-rw-r--r--include/scsi/libiscsi.h40
-rw-r--r--include/scsi/libsas.h627
-rw-r--r--include/scsi/sas.h631
-rw-r--r--include/scsi/scsi.h16
-rw-r--r--include/scsi/scsi_cmnd.h25
-rw-r--r--include/scsi/scsi_host.h13
-rw-r--r--include/scsi/scsi_netlink.h87
-rw-r--r--include/scsi/scsi_netlink_fc.h71
-rw-r--r--include/scsi/scsi_tcq.h15
-rw-r--r--include/scsi/scsi_transport_fc.h80
-rw-r--r--include/scsi/scsi_transport_iscsi.h52
-rw-r--r--include/scsi/scsi_transport_sas.h79
-rw-r--r--include/scsi/scsi_transport_spi.h3
-rw-r--r--include/sound/Kbuild10
-rw-r--r--include/sound/ac97_codec.h33
-rw-r--r--include/sound/ad1848.h22
-rw-r--r--include/sound/ak4xxx-adda.h50
-rw-r--r--include/sound/asound.h19
-rw-r--r--include/sound/control.h13
-rw-r--r--include/sound/core.h12
-rw-r--r--include/sound/cs46xx.h1
-rw-r--r--include/sound/emu10k1.h4
-rw-r--r--include/sound/info.h7
-rw-r--r--include/sound/initval.h3
-rw-r--r--include/sound/pcm.h4
-rw-r--r--include/sound/tea575x-tuner.h3
-rw-r--r--include/sound/timer.h1
-rw-r--r--include/sound/tlv.h60
-rw-r--r--include/sound/vx_core.h1
-rw-r--r--include/video/Kbuild1
-rw-r--r--include/video/mbxfb.h28
1507 files changed, 39375 insertions, 16520 deletions
diff --git a/include/Kbuild b/include/Kbuild
new file mode 100644
index 0000000000..2d03f99586
--- /dev/null
+++ b/include/Kbuild
@@ -0,0 +1,9 @@
1header-y += asm-generic/
2header-y += linux/
3header-y += scsi/
4header-y += sound/
5header-y += mtd/
6header-y += rdma/
7header-y += video/
8
9header-y += asm-$(ARCH)/
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index b9beceb331..9e6c23c360 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -63,7 +63,7 @@
63 63
64/* Current ACPICA subsystem version in YYYYMMDD format */ 64/* Current ACPICA subsystem version in YYYYMMDD format */
65 65
66#define ACPI_CA_VERSION 0x20060608 66#define ACPI_CA_VERSION 0x20060707
67 67
68/* 68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete, 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 288f84903a..a22fe9cf84 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -201,7 +201,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
201acpi_status 201acpi_status
202acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, 202acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
203 union acpi_operand_object *obj_desc, 203 union acpi_operand_object *obj_desc,
204 struct acpi_namespace_node *calling_method_node); 204 struct acpi_walk_state *walk_state);
205 205
206acpi_status 206acpi_status
207acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); 207acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state);
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 14531d48f6..06972e6637 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -181,6 +181,12 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
181extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; 181extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
182extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1]; 182extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
183 183
184/*****************************************************************************
185 *
186 * Mutual exlusion within ACPICA subsystem
187 *
188 ****************************************************************************/
189
184/* 190/*
185 * Predefined mutex objects. This array contains the 191 * Predefined mutex objects. This array contains the
186 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 192 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
@@ -188,6 +194,20 @@ extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
188 */ 194 */
189ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; 195ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
190 196
197/*
198 * Global lock semaphore works in conjunction with the actual HW global lock
199 */
200ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;
201
202/*
203 * Spinlocks are used for interfaces that can be possibly called at
204 * interrupt level
205 */
206ACPI_EXTERN spinlock_t _acpi_gbl_gpe_lock; /* For GPE data structs and registers */
207ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */
208#define acpi_gbl_gpe_lock &_acpi_gbl_gpe_lock
209#define acpi_gbl_hardware_lock &_acpi_gbl_hardware_lock
210
191/***************************************************************************** 211/*****************************************************************************
192 * 212 *
193 * Miscellaneous globals 213 * Miscellaneous globals
@@ -217,7 +237,6 @@ ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
217ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; 237ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
218ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; 238ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
219ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; 239ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
220ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
221 240
222/* Misc */ 241/* Misc */
223 242
@@ -315,11 +334,6 @@ ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
315ACPI_EXTERN struct acpi_gpe_block_info 334ACPI_EXTERN struct acpi_gpe_block_info
316 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; 335 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
317 336
318/* Spinlocks */
319
320ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
321ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock;
322
323/***************************************************************************** 337/*****************************************************************************
324 * 338 *
325 * Debugger globals 339 * Debugger globals
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index 9f22cfcb62..91586d0d5b 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -53,10 +53,14 @@
53#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info)) 53#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info))
54 54
55/* 55/*
56 * If possible, pack the following structure to byte alignment, since we 56 * If possible, pack the following structures to byte alignment, since we
57 * don't care about performance for debug output 57 * don't care about performance for debug output. Two cases where we cannot
58 * pack the structures:
59 *
60 * 1) Hardware does not support misaligned memory transfers
61 * 2) Compiler does not support pointers within packed structures
58 */ 62 */
59#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 63#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
60#pragma pack(1) 64#pragma pack(1)
61#endif 65#endif
62 66
@@ -287,7 +291,10 @@ acpi_ex_system_wait_event(union acpi_operand_object *time,
287 291
288acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc); 292acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
289 293
290acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout); 294acpi_status
295acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout);
296
297acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout);
291 298
292/* 299/*
293 * exoparg1 - ACPI AML execution, 1 operand 300 * exoparg1 - ACPI AML execution, 1 operand
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 1eeca7adca..a4d0e73d5a 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -47,10 +47,11 @@
47/* acpisrc:struct_defs -- for acpisrc conversion */ 47/* acpisrc:struct_defs -- for acpisrc conversion */
48 48
49#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ 49#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
50#define ACPI_INFINITE_CONCURRENCY 0xFF 50#define ACPI_DO_NOT_WAIT 0
51#define ACPI_SERIALIZED 0xFF
51 52
52typedef void *acpi_mutex;
53typedef u32 acpi_mutex_handle; 53typedef u32 acpi_mutex_handle;
54#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
54 55
55/* Total number of aml opcodes defined */ 56/* Total number of aml opcodes defined */
56 57
@@ -79,16 +80,15 @@ union acpi_parse_object;
79 * table below also! 80 * table below also!
80 */ 81 */
81#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ 82#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
82#define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */ 83#define ACPI_MTX_TABLES 1 /* Data for ACPI tables */
83#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ 84#define ACPI_MTX_NAMESPACE 2 /* ACPI Namespace */
84#define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */ 85#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
85#define ACPI_MTX_EVENTS 4 /* Data for ACPI events */ 86#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
86#define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */ 87#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
87#define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */ 88#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
88#define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */ 89#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
89#define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */ 90
90 91#define ACPI_MAX_MUTEX 7
91#define ACPI_MAX_MUTEX 8
92#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 92#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
93 93
94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
@@ -98,14 +98,13 @@ union acpi_parse_object;
98 98
99static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { 99static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
100 "ACPI_MTX_Interpreter", 100 "ACPI_MTX_Interpreter",
101 "ACPI_MTX_Method",
102 "ACPI_MTX_Tables", 101 "ACPI_MTX_Tables",
103 "ACPI_MTX_Namespace", 102 "ACPI_MTX_Namespace",
104 "ACPI_MTX_Events", 103 "ACPI_MTX_Events",
105 "ACPI_MTX_Caches", 104 "ACPI_MTX_Caches",
106 "ACPI_MTX_Memory", 105 "ACPI_MTX_Memory",
107 "ACPI_MTX_DebugCmdComplete", 106 "ACPI_MTX_CommandComplete",
108 "ACPI_MTX_DebugCmdReady" 107 "ACPI_MTX_CommandReady"
109}; 108};
110 109
111#endif 110#endif
@@ -128,7 +127,7 @@ typedef u8 acpi_owner_id;
128 127
129/* This Thread ID means that the mutex is not in use (unlocked) */ 128/* This Thread ID means that the mutex is not in use (unlocked) */
130 129
131#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1 130#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
132 131
133/* Table for the global mutexes */ 132/* Table for the global mutexes */
134 133
@@ -205,7 +204,7 @@ struct acpi_namespace_node {
205/* Namespace Node flags */ 204/* Namespace Node flags */
206 205
207#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ 206#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
208#define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */ 207#define ANOBJ_RESERVED 0x02 /* Available for future use */
209#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 208#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
210#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 209#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
211#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ 210#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
@@ -705,6 +704,13 @@ struct acpi_bit_register_info {
705}; 704};
706 705
707/* 706/*
707 * Some ACPI registers have bits that must be ignored -- meaning that they
708 * must be preserved.
709 */
710#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
711#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0201 /* Bit 9, Bit 0 (SCI_EN) */
712
713/*
708 * Register IDs 714 * Register IDs
709 * These are the full ACPI registers 715 * These are the full ACPI registers
710 */ 716 */
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 38f9aa4bef..192fa095a5 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -394,6 +394,8 @@
394#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) 394#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
395#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) 395#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
396 396
397#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask))
398
397/* Generate a UUID */ 399/* Generate a UUID */
398 400
399#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ 401#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
@@ -722,9 +724,15 @@
722 724
723/* Memory allocation */ 725/* Memory allocation */
724 726
727#ifndef ACPI_ALLOCATE
725#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 728#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
729#endif
730#ifndef ACPI_ALLOCATE_ZEROED
726#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 731#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
727#define ACPI_FREE(a) acpi_os_free(a) 732#endif
733#ifndef ACPI_FREE
734#define ACPI_FREE(a) acpio_os_free(a)
735#endif
728#define ACPI_MEM_TRACKING(a) 736#define ACPI_MEM_TRACKING(a)
729 737
730#else 738#else
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index 1747d94084..8fdee31119 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -140,14 +140,14 @@ struct acpi_object_package {
140 *****************************************************************************/ 140 *****************************************************************************/
141 141
142struct acpi_object_event { 142struct acpi_object_event {
143 ACPI_OBJECT_COMMON_HEADER void *semaphore; 143 ACPI_OBJECT_COMMON_HEADER acpi_semaphore os_semaphore; /* Actual OS synchronization object */
144}; 144};
145 145
146struct acpi_object_mutex { 146struct acpi_object_mutex {
147 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ 147 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
148 u16 acquisition_depth; /* Allow multiple Acquires, same thread */ 148 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
149 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ 149 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */
150 void *semaphore; /* Actual OS synchronization object */ 150 acpi_mutex os_mutex; /* Actual OS synchronization object */
151 union acpi_operand_object *prev; /* Link for list of acquired mutexes */ 151 union acpi_operand_object *prev; /* Link for list of acquired mutexes */
152 union acpi_operand_object *next; /* Link for list of acquired mutexes */ 152 union acpi_operand_object *next; /* Link for list of acquired mutexes */
153 struct acpi_namespace_node *node; /* Containing namespace node */ 153 struct acpi_namespace_node *node; /* Containing namespace node */
@@ -166,8 +166,8 @@ struct acpi_object_region {
166struct acpi_object_method { 166struct acpi_object_method {
167 ACPI_OBJECT_COMMON_HEADER u8 method_flags; 167 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
168 u8 param_count; 168 u8 param_count;
169 u8 concurrency; 169 u8 sync_level;
170 void *semaphore; 170 union acpi_operand_object *mutex;
171 u8 *aml_start; 171 u8 *aml_start;
172 ACPI_INTERNAL_METHOD implementation; 172 ACPI_INTERNAL_METHOD implementation;
173 u32 aml_length; 173 u32 aml_length;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a2b3e390a5..f338e40bd5 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -334,7 +334,7 @@ int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
334 acpi_handle handle, int type); 334 acpi_handle handle, int type);
335int acpi_bus_trim(struct acpi_device *start, int rmdevice); 335int acpi_bus_trim(struct acpi_device *start, int rmdevice);
336int acpi_bus_start(struct acpi_device *device); 336int acpi_bus_start(struct acpi_device *device);
337 337acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd);
338int acpi_match_ids(struct acpi_device *device, char *ids); 338int acpi_match_ids(struct acpi_device *device, char *ids);
339int acpi_create_dir(struct acpi_device *); 339int acpi_create_dir(struct acpi_device *);
340void acpi_remove_dir(struct acpi_device *); 340void acpi_remove_dir(struct acpi_device *);
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index b425f9bb6d..6a5bdcefec 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -110,4 +110,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
110 110
111extern int acpi_specific_hotkey_enabled; 111extern int acpi_specific_hotkey_enabled;
112 112
113/*--------------------------------------------------------------------------
114 Dock Station
115 -------------------------------------------------------------------------- */
116#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
117extern int is_dock_device(acpi_handle handle);
118extern int register_dock_notifier(struct notifier_block *nb);
119extern void unregister_dock_notifier(struct notifier_block *nb);
120extern int register_hotplug_dock_device(acpi_handle handle,
121 acpi_notify_handler handler, void *context);
122extern void unregister_hotplug_dock_device(acpi_handle handle);
123#else
124#define is_dock_device(h) (0)
125#define register_dock_notifier(nb) (-ENODEV)
126#define unregister_dock_notifier(nb) do { } while(0)
127#define register_hotplug_dock_device(h1, h2, c) (-ENODEV)
128#define unregister_hotplug_dock_device(h) do { } while(0)
129#endif
113#endif /*__ACPI_DRIVERS_H__*/ 130#endif /*__ACPI_DRIVERS_H__*/
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 8f473c83b7..0cd63bce0a 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -96,33 +96,53 @@ acpi_os_table_override(struct acpi_table_header *existing_table,
96 struct acpi_table_header **new_table); 96 struct acpi_table_header **new_table);
97 97
98/* 98/*
99 * Synchronization primitives 99 * Spinlock primitives
100 */
101acpi_status acpi_os_create_lock(acpi_spinlock * out_handle);
102
103void acpi_os_delete_lock(acpi_spinlock handle);
104
105acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);
106
107void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags);
108
109/*
110 * Semaphore primitives
100 */ 111 */
101acpi_status 112acpi_status
102acpi_os_create_semaphore(u32 max_units, 113acpi_os_create_semaphore(u32 max_units,
103 u32 initial_units, acpi_handle * out_handle); 114 u32 initial_units, acpi_semaphore * out_handle);
104 115
105acpi_status acpi_os_delete_semaphore(acpi_handle handle); 116acpi_status acpi_os_delete_semaphore(acpi_semaphore handle);
106 117
107acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout); 118acpi_status
119acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
120
121acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
122
123/*
124 * Mutex primitives
125 */
126acpi_status acpi_os_create_mutex(acpi_mutex * out_handle);
108 127
109acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units); 128void acpi_os_delete_mutex(acpi_mutex handle);
110 129
111acpi_status acpi_os_create_lock(acpi_handle * out_handle); 130acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
112 131
113void acpi_os_delete_lock(acpi_handle handle); 132void acpi_os_release_mutex(acpi_mutex handle);
114 133
115acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle); 134/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
116 135
117void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags); 136#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle)
137#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle)
138#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time)
139#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1)
118 140
119/* 141/*
120 * Memory allocation and mapping 142 * Memory allocation and mapping
121 */ 143 */
122void *acpi_os_allocate(acpi_size size); 144void *acpi_os_allocate(acpi_size size);
123 145
124void acpi_os_free(void *memory);
125
126acpi_status 146acpi_status
127acpi_os_map_memory(acpi_physical_address physical_address, 147acpi_os_map_memory(acpi_physical_address physical_address,
128 acpi_size size, void __iomem ** logical_address); 148 acpi_size size, void __iomem ** logical_address);
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index ad11fc13fb..80a3b33571 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -50,9 +50,13 @@
50 50
51/* 51/*
52 * If possible, pack the following structures to byte alignment, since we 52 * If possible, pack the following structures to byte alignment, since we
53 * don't care about performance for debug output 53 * don't care about performance for debug output. Two cases where we cannot
54 * pack the structures:
55 *
56 * 1) Hardware does not support misaligned memory transfers
57 * 2) Compiler does not support pointers within packed structures
54 */ 58 */
55#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 59#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
56#pragma pack(1) 60#pragma pack(1)
57#endif 61#endif
58 62
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 77cf1236b0..64b603cfe9 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -241,7 +241,7 @@ typedef acpi_native_uint acpi_size;
241 241
242/******************************************************************************* 242/*******************************************************************************
243 * 243 *
244 * OS- or compiler-dependent types 244 * OS-dependent and compiler-dependent types
245 * 245 *
246 * If the defaults below are not appropriate for the host system, they can 246 * If the defaults below are not appropriate for the host system, they can
247 * be defined in the compiler-specific or OS-specific header, and this will 247 * be defined in the compiler-specific or OS-specific header, and this will
@@ -249,29 +249,36 @@ typedef acpi_native_uint acpi_size;
249 * 249 *
250 ******************************************************************************/ 250 ******************************************************************************/
251 251
252/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 252/* Value returned by acpi_os_get_thread_id */
253 253
254#ifndef acpi_uintptr_t 254#ifndef acpi_thread_id
255#define acpi_uintptr_t void * 255#define acpi_thread_id acpi_native_uint
256#endif 256#endif
257 257
258/* 258/* Object returned from acpi_os_create_lock */
259 * If acpi_cache_t was not defined in the OS-dependent header, 259
260 * define it now. This is typically the case where the local cache 260#ifndef acpi_spinlock
261 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) 261#define acpi_spinlock void *
262 */
263#ifndef acpi_cache_t
264#define acpi_cache_t struct acpi_memory_list
265#endif 262#endif
266 263
267/* 264/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */
268 * Allow the CPU flags word to be defined per-OS to simplify the use of the 265
269 * lock and unlock OSL interfaces.
270 */
271#ifndef acpi_cpu_flags 266#ifndef acpi_cpu_flags
272#define acpi_cpu_flags acpi_native_uint 267#define acpi_cpu_flags acpi_native_uint
273#endif 268#endif
274 269
270/* Object returned from acpi_os_create_cache */
271
272#ifndef acpi_cache_t
273#define acpi_cache_t struct acpi_memory_list
274#endif
275
276/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
277
278#ifndef acpi_uintptr_t
279#define acpi_uintptr_t void *
280#endif
281
275/* 282/*
276 * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because 283 * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
277 * some compilers can catch printf format string problems 284 * some compilers can catch printf format string problems
@@ -298,13 +305,6 @@ typedef acpi_native_uint acpi_size;
298#define ACPI_EXPORT_SYMBOL(symbol) 305#define ACPI_EXPORT_SYMBOL(symbol)
299#endif 306#endif
300 307
301/*
302 * thread_id is returned by acpi_os_get_thread_id.
303 */
304#ifndef acpi_thread_id
305#define acpi_thread_id acpi_native_uint
306#endif
307
308/******************************************************************************* 308/*******************************************************************************
309 * 309 *
310 * Independent types 310 * Independent types
@@ -380,6 +380,11 @@ struct uint32_struct {
380 u32 hi; 380 u32 hi;
381}; 381};
382 382
383/* Synchronization objects */
384
385#define acpi_mutex void *
386#define acpi_semaphore void *
387
383/* 388/*
384 * Acpi integer width. In ACPI version 1, integers are 389 * Acpi integer width. In ACPI version 1, integers are
385 * 32 bits. In ACPI version 2, integers are 64 bits. 390 * 32 bits. In ACPI version 2, integers are 64 bits.
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 277d35bced..47faf27913 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -58,11 +58,14 @@
58#include <asm/div64.h> 58#include <asm/div64.h>
59#include <asm/acpi.h> 59#include <asm/acpi.h>
60#include <linux/slab.h> 60#include <linux/slab.h>
61#include <linux/spinlock_types.h>
62#include <asm/current.h>
61 63
62/* Host-dependent types and defines */ 64/* Host-dependent types and defines */
63 65
64#define ACPI_MACHINE_WIDTH BITS_PER_LONG 66#define ACPI_MACHINE_WIDTH BITS_PER_LONG
65#define acpi_cache_t kmem_cache_t 67#define acpi_cache_t kmem_cache_t
68#define acpi_spinlock spinlock_t *
66#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 69#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
67#define strtoul simple_strtoul 70#define strtoul simple_strtoul
68 71
@@ -98,8 +101,30 @@
98 101
99#define acpi_cpu_flags unsigned long 102#define acpi_cpu_flags unsigned long
100 103
101#define acpi_thread_id u32 104#define acpi_thread_id struct task_struct *
102 105
103static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; } 106static inline acpi_thread_id acpi_os_get_thread_id(void) { return current; }
107
108/*
109 * The irqs_disabled() check is for resume from RAM.
110 * Interrupts are off during resume, just like they are for boot.
111 * However, boot has (system_state != SYSTEM_RUNNING)
112 * to quiet __might_sleep() in kmalloc() and resume does not.
113 */
114#include <acpi/actypes.h>
115static inline void *acpi_os_allocate(acpi_size size) {
116 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
117}
118static inline void *acpi_os_allocate_zeroed(acpi_size size) {
119 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
120}
121
122static inline void *acpi_os_acquire_object(acpi_cache_t * cache) {
123 return kmem_cache_zalloc(cache, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
124}
125
126#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
127#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
128#define ACPI_FREE(a) kfree(a)
104 129
105#endif /* __ACLINUX_H__ */ 130#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 77371b3cdc..9dd5b75961 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -62,6 +62,7 @@ struct acpi_processor_cx {
62 u32 latency_ticks; 62 u32 latency_ticks;
63 u32 power; 63 u32 power;
64 u32 usage; 64 u32 usage;
65 u64 time;
65 struct acpi_processor_cx_policy promotion; 66 struct acpi_processor_cx_policy promotion;
66 struct acpi_processor_cx_policy demotion; 67 struct acpi_processor_cx_policy demotion;
67}; 68};
diff --git a/include/asm-alpha/Kbuild b/include/asm-alpha/Kbuild
new file mode 100644
index 0000000000..b7c8f188b3
--- /dev/null
+++ b/include/asm-alpha/Kbuild
@@ -0,0 +1,11 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += gentrap.h
4header-y += regdef.h
5header-y += pal.h
6header-y += reg.h
7
8unifdef-y += console.h
9unifdef-y += fpu.h
10unifdef-y += sysinfo.h
11unifdef-y += compiler.h
diff --git a/include/asm-alpha/barrier.h b/include/asm-alpha/barrier.h
index 681ff581af..384dc08d6f 100644
--- a/include/asm-alpha/barrier.h
+++ b/include/asm-alpha/barrier.h
@@ -30,7 +30,4 @@ __asm__ __volatile__("mb": : :"memory")
30#define set_mb(var, value) \ 30#define set_mb(var, value) \
31do { var = value; mb(); } while (0) 31do { var = value; mb(); } while (0)
32 32
33#define set_wmb(var, value) \
34do { var = value; wmb(); } while (0)
35
36#endif /* __BARRIER_H */ 33#endif /* __BARRIER_H */
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
index 00c6f57ad9..d2768cc3d7 100644
--- a/include/asm-alpha/compiler.h
+++ b/include/asm-alpha/compiler.h
@@ -90,6 +90,7 @@
90 __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) 90 __asm__("stw %1,%0" : "=m"(mem) : "r"(val))
91#endif 91#endif
92 92
93#ifdef __KERNEL__
93/* Some idiots over in <linux/compiler.h> thought inline should imply 94/* Some idiots over in <linux/compiler.h> thought inline should imply
94 always_inline. This breaks stuff. We'll include this file whenever 95 always_inline. This breaks stuff. We'll include this file whenever
95 we run into such problems. */ 96 we run into such problems. */
@@ -101,4 +102,6 @@
101#undef __always_inline 102#undef __always_inline
102#define __always_inline inline __attribute__((always_inline)) 103#define __always_inline inline __attribute__((always_inline))
103 104
105#endif /* __KERNEL__ */
106
104#endif /* __ALPHA_COMPILER_H */ 107#endif /* __ALPHA_COMPILER_H */
diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h
index dba70c62a1..457c34b6eb 100644
--- a/include/asm-alpha/core_t2.h
+++ b/include/asm-alpha/core_t2.h
@@ -435,7 +435,7 @@ static inline void t2_outl(u32 b, unsigned long addr)
435 set_hae(msb); \ 435 set_hae(msb); \
436} 436}
437 437
438static spinlock_t t2_hae_lock = SPIN_LOCK_UNLOCKED; 438static DEFINE_SPINLOCK(t2_hae_lock);
439 439
440__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) 440__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
441{ 441{
diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h
index e177d4180f..6a9f02af95 100644
--- a/include/asm-alpha/floppy.h
+++ b/include/asm-alpha/floppy.h
@@ -25,9 +25,8 @@
25#define fd_enable_irq() enable_irq(FLOPPY_IRQ) 25#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
26#define fd_disable_irq() disable_irq(FLOPPY_IRQ) 26#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
27#define fd_cacheflush(addr,size) /* nothing */ 27#define fd_cacheflush(addr,size) /* nothing */
28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ 28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\
29 SA_INTERRUPT|SA_SAMPLE_RANDOM, \ 29 IRQF_DISABLED, "floppy", NULL)
30 "floppy", NULL)
31#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 30#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
32 31
33#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
diff --git a/include/asm-alpha/hw_irq.h b/include/asm-alpha/hw_irq.h
index ca9d43b635..a37db0f950 100644
--- a/include/asm-alpha/hw_irq.h
+++ b/include/asm-alpha/hw_irq.h
@@ -2,8 +2,6 @@
2#define _ALPHA_HW_IRQ_H 2#define _ALPHA_HW_IRQ_H
3 3
4 4
5static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
6
7extern volatile unsigned long irq_err_count; 5extern volatile unsigned long irq_err_count;
8 6
9#ifdef CONFIG_ALPHA_GENERIC 7#ifdef CONFIG_ALPHA_GENERIC
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h
index 64d0ab98fc..8af56ce346 100644
--- a/include/asm-alpha/mmzone.h
+++ b/include/asm-alpha/mmzone.h
@@ -75,6 +75,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
75#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) 75#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr)
76 76
77#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) 77#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32))
78#define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32))
78#define pte_pfn(pte) (pte_val(pte) >> 32) 79#define pte_pfn(pte) (pte_val(pte) >> 32)
79 80
80#define mk_pte(page, pgprot) \ 81#define mk_pte(page, pgprot) \
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index 8c7cd50d4e..d2bed3cb33 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -1,6 +1,8 @@
1#ifndef _ALPHA_PAGE_H 1#ifndef _ALPHA_PAGE_H
2#define _ALPHA_PAGE_H 2#define _ALPHA_PAGE_H
3 3
4#ifdef __KERNEL__
5
4#include <asm/pal.h> 6#include <asm/pal.h>
5 7
6/* PAGE_SHIFT determines the page size */ 8/* PAGE_SHIFT determines the page size */
@@ -8,8 +10,6 @@
8#define PAGE_SIZE (1UL << PAGE_SHIFT) 10#define PAGE_SIZE (1UL << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1)) 11#define PAGE_MASK (~(PAGE_SIZE-1))
10 12
11#ifdef __KERNEL__
12
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14 14
15#define STRICT_MM_TYPECHECKS 15#define STRICT_MM_TYPECHECKS
@@ -92,9 +92,9 @@ typedef unsigned long pgprot_t;
92 92
93#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 93#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
94 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 94 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
95#endif /* __KERNEL__ */
96 95
97#include <asm-generic/memory_model.h> 96#include <asm-generic/memory_model.h>
98#include <asm-generic/page.h> 97#include <asm-generic/page.h>
99 98
99#endif /* __KERNEL__ */
100#endif /* _ALPHA_PAGE_H */ 100#endif /* _ALPHA_PAGE_H */
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index 93eaa58b79..49ac9bee7c 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -230,16 +230,17 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
230 230
231 231
232extern inline unsigned long 232extern inline unsigned long
233pmd_page_kernel(pmd_t pmd) 233pmd_page_vaddr(pmd_t pmd)
234{ 234{
235 return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; 235 return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET;
236} 236}
237 237
238#ifndef CONFIG_DISCONTIGMEM 238#ifndef CONFIG_DISCONTIGMEM
239#define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) 239#define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32))
240#define pgd_page(pgd) (mem_map + ((pgd_val(pgd) & _PFN_MASK) >> 32))
240#endif 241#endif
241 242
242extern inline unsigned long pgd_page(pgd_t pgd) 243extern inline unsigned long pgd_page_vaddr(pgd_t pgd)
243{ return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } 244{ return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); }
244 245
245extern inline int pte_none(pte_t pte) { return !pte_val(pte); } 246extern inline int pte_none(pte_t pte) { return !pte_val(pte); }
@@ -293,13 +294,13 @@ extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; retu
293/* Find an entry in the second-level page table.. */ 294/* Find an entry in the second-level page table.. */
294extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) 295extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
295{ 296{
296 return (pmd_t *) pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); 297 return (pmd_t *) pgd_page_vaddr(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
297} 298}
298 299
299/* Find an entry in the third-level page table.. */ 300/* Find an entry in the third-level page table.. */
300extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) 301extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address)
301{ 302{
302 return (pte_t *) pmd_page_kernel(*dir) 303 return (pte_t *) pmd_page_vaddr(*dir)
303 + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); 304 + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1));
304} 305}
305 306
diff --git a/include/asm-alpha/rwsem.h b/include/asm-alpha/rwsem.h
index fafdd4f701..1570c0b543 100644
--- a/include/asm-alpha/rwsem.h
+++ b/include/asm-alpha/rwsem.h
@@ -36,20 +36,11 @@ struct rw_semaphore {
36#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 36#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
37 spinlock_t wait_lock; 37 spinlock_t wait_lock;
38 struct list_head wait_list; 38 struct list_head wait_list;
39#if RWSEM_DEBUG
40 int debug;
41#endif
42}; 39};
43 40
44#if RWSEM_DEBUG
45#define __RWSEM_DEBUG_INIT , 0
46#else
47#define __RWSEM_DEBUG_INIT /* */
48#endif
49
50#define __RWSEM_INITIALIZER(name) \ 41#define __RWSEM_INITIALIZER(name) \
51 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 42 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
52 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEBUG_INIT } 43 LIST_HEAD_INIT((name).wait_list) }
53 44
54#define DECLARE_RWSEM(name) \ 45#define DECLARE_RWSEM(name) \
55 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 46 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -59,9 +50,6 @@ static inline void init_rwsem(struct rw_semaphore *sem)
59 sem->count = RWSEM_UNLOCKED_VALUE; 50 sem->count = RWSEM_UNLOCKED_VALUE;
60 spin_lock_init(&sem->wait_lock); 51 spin_lock_init(&sem->wait_lock);
61 INIT_LIST_HEAD(&sem->wait_list); 52 INIT_LIST_HEAD(&sem->wait_list);
62#if RWSEM_DEBUG
63 sem->debug = 0;
64#endif
65} 53}
66 54
67static inline void __down_read(struct rw_semaphore *sem) 55static inline void __down_read(struct rw_semaphore *sem)
diff --git a/include/asm-alpha/signal.h b/include/asm-alpha/signal.h
index 1a2c52a056..13c2305d35 100644
--- a/include/asm-alpha/signal.h
+++ b/include/asm-alpha/signal.h
@@ -77,7 +77,6 @@ typedef unsigned long sigset_t;
77 * SA_FLAGS values: 77 * SA_FLAGS values:
78 * 78 *
79 * SA_ONSTACK indicates that a registered stack_t will be used. 79 * SA_ONSTACK indicates that a registered stack_t will be used.
80 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
81 * SA_RESTART flag to get restarting signals (which were the default long ago) 80 * SA_RESTART flag to get restarting signals (which were the default long ago)
82 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 81 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
83 * SA_RESETHAND clears the handler when the signal is delivered. 82 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -98,7 +97,6 @@ typedef unsigned long sigset_t;
98 97
99#define SA_ONESHOT SA_RESETHAND 98#define SA_ONESHOT SA_RESETHAND
100#define SA_NOMASK SA_NODEFER 99#define SA_NOMASK SA_NODEFER
101#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
102 100
103/* 101/*
104 * sigaltstack controls 102 * sigaltstack controls
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index b519322913..d22ab97ea7 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -51,6 +51,7 @@
51#define SCM_TIMESTAMP SO_TIMESTAMP 51#define SCM_TIMESTAMP SO_TIMESTAMP
52 52
53#define SO_PEERSEC 30 53#define SO_PEERSEC 30
54#define SO_PASSSEC 34
54 55
55/* Security levels - as per NRL IPv6 - don't actually do anything */ 56/* Security levels - as per NRL IPv6 - don't actually do anything */
56#define SO_SECURITY_AUTHENTICATION 19 57#define SO_SECURITY_AUTHENTICATION 19
diff --git a/include/asm-arm/Kbuild b/include/asm-arm/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-arm/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-arm/arch-aaec2000/io.h b/include/asm-arm/arch-aaec2000/io.h
index 8d67907fd4..d710204ac7 100644
--- a/include/asm-arm/arch-aaec2000/io.h
+++ b/include/asm-arm/arch-aaec2000/io.h
@@ -16,6 +16,5 @@
16 */ 16 */
17#define __io(a) ((void __iomem *)(a)) 17#define __io(a) ((void __iomem *)(a))
18#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
19#define __mem_isa(a) (a)
20 19
21#endif 20#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200.h b/include/asm-arm/arch-at91rm9200/at91rm9200.h
index 58f40931a5..a5a86b1ff8 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 0f4c12d5f0..73693fea76 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 0000000000..93547d7482
--- /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/board.h b/include/asm-arm/arch-at91rm9200/board.h
index 1fdd70b238..c1ca9a4658 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -20,7 +20,7 @@
20 20
21/* 21/*
22 * These are data structures found in platform_device.dev.platform_data, 22 * These are data structures found in platform_device.dev.platform_data,
23 * and describing board-specfic data needed by drivers. For example, 23 * and describing board-specific data needed by drivers. For example,
24 * which pin is used for a given GPIO role. 24 * which pin is used for a given GPIO role.
25 * 25 *
26 * In 2.6, drivers should strongly avoid board-specific knowledge so 26 * In 2.6, drivers should strongly avoid board-specific knowledge so
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91rm9200/gpio.h
index dbde1baaf2..a011d27876 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 235d39d911..6551b4d1ff 100644
--- a/include/asm-arm/arch-at91rm9200/hardware.h
+++ b/include/asm-arm/arch-at91rm9200/hardware.h
@@ -34,27 +34,14 @@
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 AT91_NR_UART 5 /* 4 USART3's and one DBGU port */
@@ -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 2dc93b174a..763cb96c41 100644
--- a/include/asm-arm/arch-at91rm9200/irqs.h
+++ b/include/asm-arm/arch-at91rm9200/irqs.h
@@ -32,19 +32,11 @@
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.
39 */ 39 */
40#define NR_IRQS (NR_AIC_IRQS + (4 * 32)) 40#define NR_IRQS (NR_AIC_IRQS + (4 * 32))
41 41
42
43#ifndef __ASSEMBLY__
44/*
45 * Initialize the IRQ controller.
46 */
47extern void at91rm9200_init_irq(unsigned int priority[]);
48#endif
49
50#endif 42#endif
diff --git a/include/asm-arm/arch-at91rm9200/memory.h b/include/asm-arm/arch-at91rm9200/memory.h
index 3c327c4043..f985069e6d 100644
--- a/include/asm-arm/arch-at91rm9200/memory.h
+++ b/include/asm-arm/arch-at91rm9200/memory.h
@@ -33,9 +33,7 @@
33 * bus_to_virt: Used to convert an address for DMA operations 33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use. 34 * to an address that the kernel can use.
35 */ 35 */
36#define __virt_to_bus__is_a_macro
37#define __virt_to_bus(x) __virt_to_phys(x) 36#define __virt_to_bus(x) __virt_to_phys(x)
38#define __bus_to_virt__is_a_macro
39#define __bus_to_virt(x) __phys_to_virt(x) 37#define __bus_to_virt(x) __phys_to_virt(x)
40 38
41#endif 39#endif
diff --git a/include/asm-arm/arch-clps711x/io.h b/include/asm-arm/arch-clps711x/io.h
index 62613b0e2d..53d790202c 100644
--- a/include/asm-arm/arch-clps711x/io.h
+++ b/include/asm-arm/arch-clps711x/io.h
@@ -26,7 +26,6 @@
26 26
27#define __io(a) ((void __iomem *)(a)) 27#define __io(a) ((void __iomem *)(a))
28#define __mem_pci(a) (a) 28#define __mem_pci(a) (a)
29#define __mem_isa(a) (a)
30 29
31/* 30/*
32 * We don't support ins[lb]/outs[lb]. Make them fault. 31 * We don't support ins[lb]/outs[lb]. Make them fault.
diff --git a/include/asm-arm/arch-clps711x/time.h b/include/asm-arm/arch-clps711x/time.h
index 9cb27cd4e6..0e4a3901d3 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/io.h b/include/asm-arm/arch-ebsa285/io.h
index 776f9d3770..f9c7291418 100644
--- a/include/asm-arm/arch-ebsa285/io.h
+++ b/include/asm-arm/arch-ebsa285/io.h
@@ -24,7 +24,6 @@
24#define __io(a) ((void __iomem *)(PCIO_BASE + (a))) 24#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
25#if 1 25#if 1
26#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
27#define __mem_isa(a) ((a) + PCIMEM_BASE)
28#else 27#else
29 28
30static inline void __iomem *___mem_pci(void __iomem *p) 29static inline void __iomem *___mem_pci(void __iomem *p)
@@ -34,14 +33,7 @@ static inline void __iomem *___mem_pci(void __iomem *p)
34 return p; 33 return p;
35} 34}
36 35
37static inline void __iomem *___mem_isa(void __iomem *p)
38{
39 unsigned long a = (unsigned long)p;
40 BUG_ON(a >= 16*1048576);
41 return p + PCIMEM_BASE;
42}
43#define __mem_pci(a) ___mem_pci(a) 36#define __mem_pci(a) ___mem_pci(a)
44#define __mem_isa(a) ___mem_isa(a)
45#endif 37#endif
46 38
47#endif 39#endif
diff --git a/include/asm-arm/arch-ep93xx/ep93xx-regs.h b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
index 71cea0b584..593f562f85 100644
--- a/include/asm-arm/arch-ep93xx/ep93xx-regs.h
+++ b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
@@ -27,6 +27,7 @@
27#define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000) 27#define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000)
28 28
29#define EP93XX_ETHERNET_BASE (EP93XX_AHB_VIRT_BASE + 0x00010000) 29#define EP93XX_ETHERNET_BASE (EP93XX_AHB_VIRT_BASE + 0x00010000)
30#define EP93XX_ETHERNET_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00010000)
30 31
31#define EP93XX_USB_BASE (EP93XX_AHB_VIRT_BASE + 0x00020000) 32#define EP93XX_USB_BASE (EP93XX_AHB_VIRT_BASE + 0x00020000)
32#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) 33#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000)
@@ -115,6 +116,8 @@
115#define EP93XX_SYSCON_CLOCK_USH_EN 0x10000000 116#define EP93XX_SYSCON_CLOCK_USH_EN 0x10000000
116#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08) 117#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08)
117#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c) 118#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c)
119#define EP93XX_SYSCON_CLOCK_SET1 EP93XX_SYSCON_REG(0x20)
120#define EP93XX_SYSCON_CLOCK_SET2 EP93XX_SYSCON_REG(0x24)
118#define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80) 121#define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80)
119#define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000 122#define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000
120#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) 123#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
diff --git a/include/asm-arm/arch-ep93xx/platform.h b/include/asm-arm/arch-ep93xx/platform.h
index df9cbb6ef6..b4a8deb8bd 100644
--- a/include/asm-arm/arch-ep93xx/platform.h
+++ b/include/asm-arm/arch-ep93xx/platform.h
@@ -8,7 +8,14 @@ void ep93xx_map_io(void);
8void ep93xx_init_irq(void); 8void ep93xx_init_irq(void);
9void ep93xx_init_time(unsigned long); 9void ep93xx_init_time(unsigned long);
10void ep93xx_init_devices(void); 10void ep93xx_init_devices(void);
11void ep93xx_clock_init(void);
11extern struct sys_timer ep93xx_timer; 12extern struct sys_timer ep93xx_timer;
12 13
14struct ep93xx_eth_data
15{
16 unsigned char dev_addr[6];
17 unsigned char phy_id;
18};
19
13 20
14#endif 21#endif
diff --git a/include/asm-arm/arch-h720x/memory.h b/include/asm-arm/arch-h720x/memory.h
index 4a1bfd78a0..53e923dba7 100644
--- a/include/asm-arm/arch-h720x/memory.h
+++ b/include/asm-arm/arch-h720x/memory.h
@@ -23,9 +23,7 @@
23 * There is something to do here later !, Mar 2000, Jungjun Kim 23 * There is something to do here later !, Mar 2000, Jungjun Kim
24 */ 24 */
25 25
26#define __virt_to_bus__is_a_macro
27#define __virt_to_bus(x) __virt_to_phys(x) 26#define __virt_to_bus(x) __virt_to_phys(x)
28#define __bus_to_virt__is_a_macro
29#define __bus_to_virt(x) __phys_to_virt(x) 27#define __bus_to_virt(x) __phys_to_virt(x)
30 28
31#endif 29#endif
diff --git a/include/asm-arm/arch-imx/memory.h b/include/asm-arm/arch-imx/memory.h
index d09ae32cd2..5ad9012791 100644
--- a/include/asm-arm/arch-imx/memory.h
+++ b/include/asm-arm/arch-imx/memory.h
@@ -30,9 +30,7 @@
30 * bus_to_virt: Used to convert an address for DMA operations 30 * bus_to_virt: Used to convert an address for DMA operations
31 * to an address that the kernel can use. 31 * to an address that the kernel can use.
32 */ 32 */
33#define __virt_to_bus__is_a_macro 33#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)
34#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET) 34#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)
35#define __bus_to_virt__is_a_macro
36#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)
37 35
38#endif 36#endif
diff --git a/include/asm-arm/arch-integrator/io.h b/include/asm-arm/arch-integrator/io.h
index 31f2deab51..c8f2175948 100644
--- a/include/asm-arm/arch-integrator/io.h
+++ b/include/asm-arm/arch-integrator/io.h
@@ -32,6 +32,5 @@
32 32
33#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a))) 33#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a)))
34#define __mem_pci(a) (a) 34#define __mem_pci(a) (a)
35#define __mem_isa(a) ((a) + PCI_MEMORY_VADDR)
36 35
37#endif 36#endif
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 0000000000..9022b6849e
--- /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 1e808db8af..e977a9ef31 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 0000000000..1500cbbd22
--- /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 0000000000..3b065618dd
--- /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 0000000000..6556ed5eee
--- /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 f39046a6ab..12d9ee02cd 100644
--- a/include/asm-arm/arch-iop3xx/io.h
+++ b/include/asm-arm/arch-iop32x/io.h
@@ -1,22 +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#define __mem_isa(a) (a) 20
21 21
22#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 0000000000..4bbd85f3ed
--- /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 4177cfa810..fff4eafa1f 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 cb8725979f..eb69db9b9a 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 0000000000..bbaef873af
--- /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 0000000000..764cd3f0d4
--- /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 0000000000..fed31a6484
--- /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 0000000000..17b7eb7e9c
--- /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 0000000000..9934b08731
--- /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 0000000000..e64f52bf2b
--- /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 0000000000..0a70baa195
--- /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 0000000000..9e7132ebe6
--- /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 0000000000..b7775fdc5a
--- /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 0000000000..92b791702e
--- /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 0000000000..0659cf94d0
--- /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 0000000000..c017402bab
--- /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 0000000000..7ac6e93db5
--- /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 0668e78d48..79b9302017 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 e5fff1775d..0531656294 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 0000000000..d045f84033
--- /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 0000000000..0d39139b24
--- /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 0000000000..00dd07ece2
--- /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 0000000000..fe3e1e369f
--- /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 0000000000..e17fbc0587
--- /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 0000000000..66f545a7f4
--- /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 ce007e5319..0000000000
--- 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 926668c098..0000000000
--- 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 3b138171d0..0000000000
--- 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 2fcc1654cb..0000000000
--- 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 f8df778a35..0000000000
--- 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 8ff73d4872..0000000000
--- a/include/asm-arm/arch-iop3xx/iop331-irqs.h
+++ /dev/null
@@ -1,136 +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#if defined(CONFIG_ARCH_IQ80331)
95/*
96 * Interrupts available on the IQ80331 board
97 */
98
99/*
100 * On board devices
101 */
102#define IRQ_IQ80331_I82544 IRQ_IOP331_XINT0
103#define IRQ_IQ80331_UART0 IRQ_IOP331_UART0
104#define IRQ_IQ80331_UART1 IRQ_IOP331_UART1
105
106/*
107 * PCI interrupts
108 */
109#define IRQ_IQ80331_INTA IRQ_IOP331_XINT0
110#define IRQ_IQ80331_INTB IRQ_IOP331_XINT1
111#define IRQ_IQ80331_INTC IRQ_IOP331_XINT2
112#define IRQ_IQ80331_INTD IRQ_IOP331_XINT3
113
114#elif defined(CONFIG_MACH_IQ80332)
115/*
116 * Interrupts available on the IQ80332 board
117 */
118
119/*
120 * On board devices
121 */
122#define IRQ_IQ80332_I82544 IRQ_IOP331_XINT0
123#define IRQ_IQ80332_UART0 IRQ_IOP331_UART0
124#define IRQ_IQ80332_UART1 IRQ_IOP331_UART1
125
126/*
127 * PCI interrupts
128 */
129#define IRQ_IQ80332_INTA IRQ_IOP331_XINT0
130#define IRQ_IQ80332_INTB IRQ_IOP331_XINT1
131#define IRQ_IQ80332_INTC IRQ_IOP331_XINT2
132#define IRQ_IQ80332_INTD IRQ_IOP331_XINT3
133
134#endif
135
136#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 fbf0cc11bd..0000000000
--- 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 b2c03f4c26..0000000000
--- 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 e43ebd9847..0000000000
--- 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 af6ae8cd36..0000000000
--- 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 14ca8d0f7b..0000000000
--- 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 fbdd5af644..0000000000
--- 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 0f2f6847f9..0000000000
--- 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-ixp23xx/ixp23xx.h b/include/asm-arm/arch-ixp23xx/ixp23xx.h
index d0a72201ee..3927b1d61b 100644
--- a/include/asm-arm/arch-ixp23xx/ixp23xx.h
+++ b/include/asm-arm/arch-ixp23xx/ixp23xx.h
@@ -295,15 +295,4 @@
295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160) 295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160)
296 296
297 297
298#ifndef __ASSEMBLY__
299/*
300 * Is system memory on the XSI or CPP bus?
301 */
302static inline unsigned ixp23xx_cpp_boot(void)
303{
304 return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);
305}
306#endif
307
308
309#endif 298#endif
diff --git a/include/asm-arm/arch-ixp23xx/platform.h b/include/asm-arm/arch-ixp23xx/platform.h
index 19a73b39c8..56e16d6664 100644
--- a/include/asm-arm/arch-ixp23xx/platform.h
+++ b/include/asm-arm/arch-ixp23xx/platform.h
@@ -43,5 +43,15 @@ extern struct sys_timer ixp23xx_timer;
43 43
44#define IXP23XX_UART_XTAL 14745600 44#define IXP23XX_UART_XTAL 14745600
45 45
46#ifndef __ASSEMBLY__
47/*
48 * Is system memory on the XSI or CPP bus?
49 */
50static inline unsigned ixp23xx_cpp_boot(void)
51{
52 return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);
53}
54#endif
55
46 56
47#endif 57#endif
diff --git a/include/asm-arm/arch-ixp23xx/uncompress.h b/include/asm-arm/arch-ixp23xx/uncompress.h
index 013575e6a9..16c1110f23 100644
--- a/include/asm-arm/arch-ixp23xx/uncompress.h
+++ b/include/asm-arm/arch-ixp23xx/uncompress.h
@@ -11,7 +11,7 @@
11#ifndef __ASM_ARCH_UNCOMPRESS_H 11#ifndef __ASM_ARCH_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H 12#define __ASM_ARCH_UNCOMPRESS_H
13 13
14#include <asm/hardware.h> 14#include <asm/arch/ixp23xx.h>
15#include <linux/serial_reg.h> 15#include <linux/serial_reg.h>
16 16
17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS) 17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS)
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index b59520e56f..0d517267fb 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -38,7 +38,7 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
38 * 2) If > 64MB of memory space is required, the IXP4xx can be configured 38 * 2) If > 64MB of memory space is required, the IXP4xx can be configured
39 * to use indirect registers to access PCI (as we do below for I/O 39 * to use indirect registers to access PCI (as we do below for I/O
40 * transactions). This allows for up to 128MB (0x48000000 to 0x4fffffff) 40 * transactions). This allows for up to 128MB (0x48000000 to 0x4fffffff)
41 * of memory on the bus. The disadvantadge of this is that every 41 * of memory on the bus. The disadvantage of this is that every
42 * PCI access requires three local register accesses plus a spinlock, 42 * PCI access requires three local register accesses plus a spinlock,
43 * but in some cases the performance hit is acceptable. In addition, 43 * but in some cases the performance hit is acceptable. In addition,
44 * you cannot mmap() PCI devices in this case. 44 * you cannot mmap() PCI devices in this case.
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 13aee17b04..8d10a91876 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-l7200/io.h b/include/asm-arm/arch-l7200/io.h
index cab8ad0adf..d744d97c18 100644
--- a/include/asm-arm/arch-l7200/io.h
+++ b/include/asm-arm/arch-l7200/io.h
@@ -19,7 +19,6 @@
19 */ 19 */
20#define __io_pci(a) ((void __iomem *)(PCIO_BASE + (a))) 20#define __io_pci(a) ((void __iomem *)(PCIO_BASE + (a)))
21#define __mem_pci(a) (a) 21#define __mem_pci(a) (a)
22#define __mem_isa(a) (a)
23 22
24#define __ioaddr(p) __io_pci(p) 23#define __ioaddr(p) __io_pci(p)
25 24
@@ -32,9 +31,9 @@
32static inline unsigned int __arch_getw(unsigned long a) 31static inline unsigned int __arch_getw(unsigned long a)
33{ 32{
34 unsigned int value; 33 unsigned int value;
35 __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw" 34 __asm__ __volatile__("ldrh %0, [%1, #0] @ getw"
36 : "=&r" (value) 35 : "=&r" (value)
37 : "r" (a)); 36 : "r" (a) : "cc");
38 return value; 37 return value;
39} 38}
40 39
@@ -43,8 +42,8 @@ static inline unsigned int __arch_getw(unsigned long a)
43 42
44static inline void __arch_putw(unsigned int value, unsigned long a) 43static inline void __arch_putw(unsigned int value, unsigned long a)
45{ 44{
46 __asm__ __volatile__("str%?h %0, [%1, #0] @ putw" 45 __asm__ __volatile__("strh %0, [%1, #0] @ putw"
47 : : "r" (value), "r" (a)); 46 : : "r" (value), "r" (a) : "cc");
48} 47}
49 48
50/* 49/*
diff --git a/include/asm-arm/arch-l7200/time.h b/include/asm-arm/arch-l7200/time.h
index 7b98b533e6..c69cb50873 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/io.h b/include/asm-arm/arch-lh7a40x/io.h
index bbcd4335f4..17bc940974 100644
--- a/include/asm-arm/arch-lh7a40x/io.h
+++ b/include/asm-arm/arch-lh7a40x/io.h
@@ -18,6 +18,5 @@
18/* No ISA or PCI bus on this machine. */ 18/* No ISA or PCI bus on this machine. */
19#define __io(a) ((void __iomem *)(a)) 19#define __io(a) ((void __iomem *)(a))
20#define __mem_pci(a) (a) 20#define __mem_pci(a) (a)
21#define __mem_isa(a) (a)
22 21
23#endif /* __ASM_ARCH_IO_H */ 22#endif /* __ASM_ARCH_IO_H */
diff --git a/include/asm-arm/arch-netx/io.h b/include/asm-arm/arch-netx/io.h
index 81b7bc4774..a7a53f8016 100644
--- a/include/asm-arm/arch-netx/io.h
+++ b/include/asm-arm/arch-netx/io.h
@@ -24,6 +24,5 @@
24 24
25#define __io(a) ((void __iomem *)(a)) 25#define __io(a) ((void __iomem *)(a))
26#define __mem_pci(a) (a) 26#define __mem_pci(a) (a)
27#define __mem_isa(a) (a)
28 27
29#endif 28#endif
diff --git a/include/asm-arm/arch-omap/board-ams-delta.h b/include/asm-arm/arch-omap/board-ams-delta.h
index 0070f6d3b7..9aee15d971 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/board-fsample.h b/include/asm-arm/arch-omap/board-fsample.h
new file mode 100644
index 0000000000..89a1e529fb
--- /dev/null
+++ b/include/asm-arm/arch-omap/board-fsample.h
@@ -0,0 +1,51 @@
1/*
2 * linux/include/asm-arm/arch-omap/board-fsample.h
3 *
4 * Board-specific goodies for TI F-Sample.
5 *
6 * Copyright (C) 2006 Google, Inc.
7 * Author: Brian Swetland <swetland@google.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_OMAP_FSAMPLE_H
15#define __ASM_ARCH_OMAP_FSAMPLE_H
16
17/* fsample is pretty close to p2-sample */
18#include <asm/arch/board-perseus2.h>
19
20#define fsample_cpld_read(reg) __raw_readb(reg)
21#define fsample_cpld_write(val, reg) __raw_writeb(val, reg)
22
23#define FSAMPLE_CPLD_BASE 0xE8100000
24#define FSAMPLE_CPLD_SIZE SZ_4K
25#define FSAMPLE_CPLD_START 0x05080000
26
27#define FSAMPLE_CPLD_REG_A (FSAMPLE_CPLD_BASE + 0x00)
28#define FSAMPLE_CPLD_SWITCH (FSAMPLE_CPLD_BASE + 0x02)
29#define FSAMPLE_CPLD_UART (FSAMPLE_CPLD_BASE + 0x02)
30#define FSAMPLE_CPLD_REG_B (FSAMPLE_CPLD_BASE + 0x04)
31#define FSAMPLE_CPLD_VERSION (FSAMPLE_CPLD_BASE + 0x06)
32#define FSAMPLE_CPLD_SET_CLR (FSAMPLE_CPLD_BASE + 0x06)
33
34#define FSAMPLE_CPLD_BIT_BT_RESET 0
35#define FSAMPLE_CPLD_BIT_LCD_RESET 1
36#define FSAMPLE_CPLD_BIT_CAM_PWDN 2
37#define FSAMPLE_CPLD_BIT_CHARGER_ENABLE 3
38#define FSAMPLE_CPLD_BIT_SD_MMC_EN 4
39#define FSAMPLE_CPLD_BIT_aGPS_PWREN 5
40#define FSAMPLE_CPLD_BIT_BACKLIGHT 6
41#define FSAMPLE_CPLD_BIT_aGPS_EN_RESET 7
42#define FSAMPLE_CPLD_BIT_aGPS_SLEEPx_N 8
43#define FSAMPLE_CPLD_BIT_OTG_RESET 9
44
45#define fsample_cpld_set(bit) \
46 fsample_cpld_write((((bit) & 15) << 4) | 0x0f, FSAMPLE_CPLD_SET_CLR)
47
48#define fsample_cpld_clear(bit) \
49 fsample_cpld_write(0xf0 | ((bit) & 15), FSAMPLE_CPLD_SET_CLR)
50
51#endif
diff --git a/include/asm-arm/arch-omap/board.h b/include/asm-arm/arch-omap/board.h
index dfdbf06fd6..edf1dc6ad9 100644
--- a/include/asm-arm/arch-omap/board.h
+++ b/include/asm-arm/arch-omap/board.h
@@ -22,6 +22,7 @@
22#define OMAP_TAG_UART 0x4f07 22#define OMAP_TAG_UART 0x4f07
23#define OMAP_TAG_FBMEM 0x4f08 23#define OMAP_TAG_FBMEM 0x4f08
24#define OMAP_TAG_STI_CONSOLE 0x4f09 24#define OMAP_TAG_STI_CONSOLE 0x4f09
25#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
25 26
26#define OMAP_TAG_BOOT_REASON 0x4f80 27#define OMAP_TAG_BOOT_REASON 0x4f80
27#define OMAP_TAG_FLASH_PART 0x4f81 28#define OMAP_TAG_FLASH_PART 0x4f81
@@ -61,6 +62,12 @@ struct omap_sti_console_config {
61 u8 channel; 62 u8 channel;
62}; 63};
63 64
65struct omap_camera_sensor_config {
66 u16 reset_gpio;
67 int (*power_on)(void * data);
68 int (*power_off)(void * data);
69};
70
64struct omap_usb_config { 71struct omap_usb_config {
65 /* Configure drivers according to the connectors on your board: 72 /* Configure drivers according to the connectors on your board:
66 * - "A" connector (rectagular) 73 * - "A" connector (rectagular)
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
index 3c4eb9fbe4..fa68810499 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -45,11 +45,10 @@ 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;
51extern struct list_head clocks;
52extern spinlock_t clockfw_lock;
53 52
54extern int clk_init(struct clk_functions * custom_clocks); 53extern int clk_init(struct clk_functions * custom_clocks);
55extern int clk_register(struct clk *clk); 54extern int clk_register(struct clk *clk);
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index ca1202312a..d591d0585b 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -185,8 +185,8 @@
185/* DMA channels for 24xx */ 185/* DMA channels for 24xx */
186#define OMAP24XX_DMA_NO_DEVICE 0 186#define OMAP24XX_DMA_NO_DEVICE 0
187#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */ 187#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
188#define OMAP24XX_DMA_EXT_NDMA_REQ0 2 /* S_DMA_1 */ 188#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
189#define OMAP24XX_DMA_EXT_NDMA_REQ1 3 /* S_DMA_2 */ 189#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
190#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */ 190#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
191#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */ 191#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
192#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */ 192#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
@@ -197,7 +197,9 @@
197#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */ 197#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
198#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */ 198#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
199#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */ 199#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
200 200#define OMAP24XX_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
201#define OMAP24XX_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
202#define OMAP24XX_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
201#define OMAP24XX_DMA_EAC_AC_RD 17 /* S_DMA_16 */ 203#define OMAP24XX_DMA_EAC_AC_RD 17 /* S_DMA_16 */
202#define OMAP24XX_DMA_EAC_AC_WR 18 /* S_DMA_17 */ 204#define OMAP24XX_DMA_EAC_AC_WR 18 /* S_DMA_17 */
203#define OMAP24XX_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */ 205#define OMAP24XX_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
@@ -244,6 +246,7 @@
244#define OMAP24XX_DMA_MMC1_TX 61 /* SDMA_60 */ 246#define OMAP24XX_DMA_MMC1_TX 61 /* SDMA_60 */
245#define OMAP24XX_DMA_MMC1_RX 62 /* SDMA_61 */ 247#define OMAP24XX_DMA_MMC1_RX 62 /* SDMA_61 */
246#define OMAP24XX_DMA_MS 63 /* SDMA_62 */ 248#define OMAP24XX_DMA_MS 63 /* SDMA_62 */
249#define OMAP24XX_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
247 250
248/*----------------------------------------------------------------------------*/ 251/*----------------------------------------------------------------------------*/
249 252
@@ -274,7 +277,7 @@
274#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea) 277#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
275#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4) 278#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
276 279
277#define OMAP_DMA_TOUT_IRQ (1 << 0) /* Only on omap1 */ 280#define OMAP1_DMA_TOUT_IRQ (1 << 0)
278#define OMAP_DMA_DROP_IRQ (1 << 1) 281#define OMAP_DMA_DROP_IRQ (1 << 1)
279#define OMAP_DMA_HALF_IRQ (1 << 2) 282#define OMAP_DMA_HALF_IRQ (1 << 2)
280#define OMAP_DMA_FRAME_IRQ (1 << 3) 283#define OMAP_DMA_FRAME_IRQ (1 << 3)
@@ -315,11 +318,11 @@ enum {
315 OMAP_LCD_DMA_B2_BOTTOM 318 OMAP_LCD_DMA_B2_BOTTOM
316}; 319};
317 320
318/* REVISIT: Check if BURST_4 is really 1 (or 2) */
319enum omap_dma_burst_mode { 321enum omap_dma_burst_mode {
320 OMAP_DMA_DATA_BURST_DIS = 0, 322 OMAP_DMA_DATA_BURST_DIS = 0,
321 OMAP_DMA_DATA_BURST_4, 323 OMAP_DMA_DATA_BURST_4,
322 OMAP_DMA_DATA_BURST_8 324 OMAP_DMA_DATA_BURST_8,
325 OMAP_DMA_DATA_BURST_16,
323}; 326};
324 327
325enum omap_dma_color_mode { 328enum omap_dma_color_mode {
@@ -328,6 +331,12 @@ enum omap_dma_color_mode {
328 OMAP_DMA_TRANSPARENT_COPY 331 OMAP_DMA_TRANSPARENT_COPY
329}; 332};
330 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
331struct omap_dma_channel_params { 340struct omap_dma_channel_params {
332 int data_type; /* data type 8,16,32 */ 341 int data_type; /* data type 8,16,32 */
333 int elem_count; /* number of elements in a frame */ 342 int elem_count; /* number of elements in a frame */
@@ -335,13 +344,13 @@ struct omap_dma_channel_params {
335 344
336 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */ 345 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
337 int src_amode; /* constant , post increment, indexed , double indexed */ 346 int src_amode; /* constant , post increment, indexed , double indexed */
338 int src_start; /* source address : physical */ 347 unsigned long src_start; /* source address : physical */
339 int src_ei; /* source element index */ 348 int src_ei; /* source element index */
340 int src_fi; /* source frame index */ 349 int src_fi; /* source frame index */
341 350
342 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */ 351 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
343 int dst_amode; /* constant , post increment, indexed , double indexed */ 352 int dst_amode; /* constant , post increment, indexed , double indexed */
344 int dst_start; /* source address : physical */ 353 unsigned long dst_start; /* source address : physical */
345 int dst_ei; /* source element index */ 354 int dst_ei; /* source element index */
346 int dst_fi; /* source frame index */ 355 int dst_fi; /* source frame index */
347 356
@@ -353,7 +362,7 @@ struct omap_dma_channel_params {
353}; 362};
354 363
355 364
356extern void omap_set_dma_priority(int dst_port, int priority); 365extern void omap_set_dma_priority(int lch, int dst_port, int priority);
357extern int omap_request_dma(int dev_id, const char *dev_name, 366extern int omap_request_dma(int dev_id, const char *dev_name,
358 void (* callback)(int lch, u16 ch_status, void *data), 367 void (* callback)(int lch, u16 ch_status, void *data),
359 void *data, int *dma_ch); 368 void *data, int *dma_ch);
@@ -368,6 +377,7 @@ extern void omap_set_dma_transfer_params(int lch, int data_type,
368 int dma_trigger, int src_or_dst_synch); 377 int dma_trigger, int src_or_dst_synch);
369extern 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,
370 u32 color); 379 u32 color);
380extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
371 381
372extern 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,
373 unsigned long src_start, 383 unsigned long src_start,
@@ -391,6 +401,9 @@ extern void omap_set_dma_params(int lch,
391extern void omap_dma_link_lch (int lch_head, int lch_queue); 401extern void omap_dma_link_lch (int lch_head, int lch_queue);
392extern void omap_dma_unlink_lch (int lch_head, int lch_queue); 402extern void omap_dma_unlink_lch (int lch_head, int lch_queue);
393 403
404extern int omap_set_dma_callback(int lch,
405 void (* callback)(int lch, u16 ch_status, void *data),
406 void *data);
394extern dma_addr_t omap_get_dma_src_pos(int lch); 407extern dma_addr_t omap_get_dma_src_pos(int lch);
395extern dma_addr_t omap_get_dma_dst_pos(int lch); 408extern dma_addr_t omap_get_dma_dst_pos(int lch);
396extern 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 e6522e6a38..b5f3a71b89 100644
--- a/include/asm-arm/arch-omap/dmtimer.h
+++ b/include/asm-arm/arch-omap/dmtimer.h
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 2005 Nokia Corporation 6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com> 7 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com>
8 * PWM and clock framwork support by Timo Teras.
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 11 * under the terms of the GNU General Public License as published by the
@@ -25,69 +26,58 @@
25 * 675 Mass Ave, Cambridge, MA 02139, USA. 26 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 27 */
27 28
28#ifndef __ASM_ARCH_TIMER_H 29#ifndef __ASM_ARCH_DMTIMER_H
29#define __ASM_ARCH_TIMER_H 30#define __ASM_ARCH_DMTIMER_H
30
31#include <linux/list.h>
32
33#define OMAP_TIMER_SRC_ARMXOR 0x00
34#define OMAP_TIMER_SRC_32_KHZ 0x01
35#define OMAP_TIMER_SRC_EXT_CLK 0x02
36
37/* timer control reg bits */
38#define OMAP_TIMER_CTRL_CAPTMODE (1 << 13)
39#define OMAP_TIMER_CTRL_PT (1 << 12)
40#define OMAP_TIMER_CTRL_TRG_OVERFLOW (0x1 << 10)
41#define OMAP_TIMER_CTRL_TRG_OFANDMATCH (0x2 << 10)
42#define OMAP_TIMER_CTRL_TCM_LOWTOHIGH (0x1 << 8)
43#define OMAP_TIMER_CTRL_TCM_HIGHTOLOW (0x2 << 8)
44#define OMAP_TIMER_CTRL_TCM_BOTHEDGES (0x3 << 8)
45#define OMAP_TIMER_CTRL_SCPWM (1 << 7)
46#define OMAP_TIMER_CTRL_CE (1 << 6) /* compare enable */
47#define OMAP_TIMER_CTRL_PRE (1 << 5) /* prescaler enable */
48#define OMAP_TIMER_CTRL_PTV_SHIFT 2 /* how much to shift the prescaler value */
49#define OMAP_TIMER_CTRL_AR (1 << 1) /* auto-reload enable */
50#define OMAP_TIMER_CTRL_ST (1 << 0) /* start timer */
51 31
52/* timer interrupt enable bits */ 32/* clock sources */
53#define OMAP_TIMER_INT_CAPTURE (1 << 2) 33#define OMAP_TIMER_SRC_SYS_CLK 0x00
54#define OMAP_TIMER_INT_OVERFLOW (1 << 1) 34#define OMAP_TIMER_SRC_32_KHZ 0x01
55#define OMAP_TIMER_INT_MATCH (1 << 0) 35#define OMAP_TIMER_SRC_EXT_CLK 0x02
56 36
37/* timer interrupt enable bits */
38#define OMAP_TIMER_INT_CAPTURE (1 << 2)
39#define OMAP_TIMER_INT_OVERFLOW (1 << 1)
40#define OMAP_TIMER_INT_MATCH (1 << 0)
57 41
58struct omap_dm_timer { 42/* trigger types */
59 struct list_head timer_list; 43#define OMAP_TIMER_TRIGGER_NONE 0x00
44#define OMAP_TIMER_TRIGGER_OVERFLOW 0x01
45#define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02
60 46
61 u32 base; 47struct omap_dm_timer;
62 unsigned int irq; 48struct clk;
63};
64 49
65u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, int reg); 50int omap_dm_timer_init(void);
66void omap_dm_timer_write_reg(struct omap_dm_timer *timer, int reg, u32 value);
67 51
68struct 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);
69void omap_dm_timer_free(struct omap_dm_timer *timer); 54void omap_dm_timer_free(struct omap_dm_timer *timer);
70void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); 55void omap_dm_timer_enable(struct omap_dm_timer *timer);
56void omap_dm_timer_disable(struct omap_dm_timer *timer);
71 57
72void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); 58int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
73void omap_dm_timer_set_trigger(struct omap_dm_timer *timer, unsigned int value); 59
74void omap_dm_timer_enable_compare(struct omap_dm_timer *timer); 60u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
75void omap_dm_timer_enable_autoreload(struct omap_dm_timer *timer); 61struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer);
76 62
77void omap_dm_timer_trigger(struct omap_dm_timer *timer); 63void omap_dm_timer_trigger(struct omap_dm_timer *timer);
78void omap_dm_timer_start(struct omap_dm_timer *timer); 64void omap_dm_timer_start(struct omap_dm_timer *timer);
79void omap_dm_timer_stop(struct omap_dm_timer *timer); 65void omap_dm_timer_stop(struct omap_dm_timer *timer);
80 66
81void omap_dm_timer_set_load(struct omap_dm_timer *timer, unsigned int load); 67void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
82void omap_dm_timer_set_match(struct omap_dm_timer *timer, unsigned int match); 68void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
69void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
70void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
71void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
72
73void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
83 74
84unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); 75unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
85void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); 76void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
86
87unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer); 77unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer);
88void omap_dm_timer_reset_counter(struct omap_dm_timer *timer); 78void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value);
89 79
90int omap_dm_timers_active(void); 80int omap_dm_timers_active(void);
91u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
92 81
93#endif /* __ASM_ARCH_TIMER_H */ 82
83#endif /* __ASM_ARCH_DMTIMER_H */
diff --git a/include/asm-arm/arch-omap/gpmc.h b/include/asm-arm/arch-omap/gpmc.h
new file mode 100644
index 0000000000..7c03ef6c14
--- /dev/null
+++ b/include/asm-arm/arch-omap/gpmc.h
@@ -0,0 +1,91 @@
1/*
2 * General-Purpose Memory Controller for OMAP2
3 *
4 * Copyright (C) 2005-2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __OMAP2_GPMC_H
12#define __OMAP2_GPMC_H
13
14#define GPMC_CS_CONFIG1 0x00
15#define GPMC_CS_CONFIG2 0x04
16#define GPMC_CS_CONFIG3 0x08
17#define GPMC_CS_CONFIG4 0x0c
18#define GPMC_CS_CONFIG5 0x10
19#define GPMC_CS_CONFIG6 0x14
20#define GPMC_CS_CONFIG7 0x18
21#define GPMC_CS_NAND_COMMAND 0x1c
22#define GPMC_CS_NAND_ADDRESS 0x20
23#define GPMC_CS_NAND_DATA 0x24
24
25#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
26#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 20)
27#define GPMC_CONFIG1_READTYPE_ASYNC (0 << 29)
28#define GPMC_CONFIG1_READTYPE_SYNC (1 << 29)
29#define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27)
30#define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27)
31#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25)
32#define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23)
33#define GPMC_CONFIG1_WAIT_READ_MON (1 << 22)
34#define GPMC_CONFIG1_WAIT_WRITE_MON (1 << 21)
35#define GPMC_CONFIG1_WAIT_MON_IIME(val) ((val & 3) << 18)
36#define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16)
37#define GPMC_CONFIG1_DEVICESIZE(val) ((val & 3) << 12)
38#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
39#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
40#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
41#define GPMC_CONFIG1_DEVICETYPE_NAND GPMC_CONFIG1_DEVICETYPE(1)
42#define GPMC_CONFIG1_MUXADDDATA (1 << 9)
43#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
44#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
45#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
46#define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2))
47#define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3))
48
49/*
50 * Note that all values in this struct are in nanoseconds, while
51 * the register values are in gpmc_fck cycles.
52 */
53struct gpmc_timings {
54 /* Minimum clock period for synchronous mode */
55 u16 sync_clk;
56
57 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
58 u16 cs_on; /* Assertion time */
59 u16 cs_rd_off; /* Read deassertion time */
60 u16 cs_wr_off; /* Write deassertion time */
61
62 /* ADV signal timings corresponding to GPMC_CONFIG3 */
63 u16 adv_on; /* Assertion time */
64 u16 adv_rd_off; /* Read deassertion time */
65 u16 adv_wr_off; /* Write deassertion time */
66
67 /* WE signals timings corresponding to GPMC_CONFIG4 */
68 u16 we_on; /* WE assertion time */
69 u16 we_off; /* WE deassertion time */
70
71 /* OE signals timings corresponding to GPMC_CONFIG4 */
72 u16 oe_on; /* OE assertion time */
73 u16 oe_off; /* OE deassertion time */
74
75 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
76 u16 page_burst_access; /* Multiple access word delay */
77 u16 access; /* Start-cycle to first data valid delay */
78 u16 rd_cycle; /* Total read cycle time */
79 u16 wr_cycle; /* Total write cycle time */
80};
81
82extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
83
84extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
85extern u32 gpmc_cs_read_reg(int cs, int idx);
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);
88extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
89extern void gpmc_cs_free(int cs);
90
91#endif
diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
index c7d9e85779..481048d652 100644
--- a/include/asm-arm/arch-omap/hardware.h
+++ b/include/asm-arm/arch-omap/hardware.h
@@ -297,6 +297,10 @@
297#include "board-perseus2.h" 297#include "board-perseus2.h"
298#endif 298#endif
299 299
300#ifdef CONFIG_MACH_OMAP_FSAMPLE
301#include "board-fsample.h"
302#endif
303
300#ifdef CONFIG_MACH_OMAP_H3 304#ifdef CONFIG_MACH_OMAP_H3
301#include "board-h3.h" 305#include "board-h3.h"
302#endif 306#endif
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
index b726acfcab..78f68e6a4f 100644
--- a/include/asm-arm/arch-omap/io.h
+++ b/include/asm-arm/arch-omap/io.h
@@ -44,7 +44,6 @@
44 */ 44 */
45#define __io(a) ((void __iomem *)(PCIO_BASE + (a))) 45#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
46#define __mem_pci(a) (a) 46#define __mem_pci(a) (a)
47#define __mem_isa(a) (a)
48 47
49/* 48/*
50 * ---------------------------------------------------------------------------- 49 * ----------------------------------------------------------------------------
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h
index 42098d99f3..c5bb05a69b 100644
--- a/include/asm-arm/arch-omap/irqs.h
+++ b/include/asm-arm/arch-omap/irqs.h
@@ -237,16 +237,32 @@
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
243#define INT_24XX_GPIO_BANK3 31 244#define INT_24XX_GPIO_BANK3 31
244#define INT_24XX_GPIO_BANK4 32 245#define INT_24XX_GPIO_BANK4 32
246#define INT_24XX_GPTIMER1 37
247#define INT_24XX_GPTIMER2 38
248#define INT_24XX_GPTIMER3 39
249#define INT_24XX_GPTIMER4 40
250#define INT_24XX_GPTIMER5 41
251#define INT_24XX_GPTIMER6 42
252#define INT_24XX_GPTIMER7 43
253#define INT_24XX_GPTIMER8 44
254#define INT_24XX_GPTIMER9 45
255#define INT_24XX_GPTIMER10 46
256#define INT_24XX_GPTIMER11 47
257#define INT_24XX_GPTIMER12 48
245#define INT_24XX_MCBSP1_IRQ_TX 59 258#define INT_24XX_MCBSP1_IRQ_TX 59
246#define INT_24XX_MCBSP1_IRQ_RX 60 259#define INT_24XX_MCBSP1_IRQ_RX 60
247#define INT_24XX_MCBSP2_IRQ_TX 62 260#define INT_24XX_MCBSP2_IRQ_TX 62
248#define INT_24XX_MCBSP2_IRQ_RX 63 261#define INT_24XX_MCBSP2_IRQ_RX 63
262#define INT_24XX_UART1_IRQ 72
263#define INT_24XX_UART2_IRQ 73
249#define INT_24XX_UART3_IRQ 74 264#define INT_24XX_UART3_IRQ 74
265#define INT_24XX_MMC_IRQ 83
250 266
251/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and 267/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
252 * 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 8a023a984a..b7f8307543 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/mux.h b/include/asm-arm/arch-omap/mux.h
index 0dc24d4ba5..828cc5c114 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,
@@ -410,6 +421,12 @@ enum omap24xx_index {
410 /* 24xx clock */ 421 /* 24xx clock */
411 W14_24XX_SYS_CLKOUT, 422 W14_24XX_SYS_CLKOUT,
412 423
424 /* 24xx GPMC wait pin monitoring */
425 L3_GPMC_WAIT0,
426 N7_GPMC_WAIT1,
427 M1_GPMC_WAIT2,
428 P1_GPMC_WAIT3,
429
413 /* 242X McBSP */ 430 /* 242X McBSP */
414 Y15_24XX_MCBSP2_CLKX, 431 Y15_24XX_MCBSP2_CLKX,
415 R14_24XX_MCBSP2_FSX, 432 R14_24XX_MCBSP2_FSX,
@@ -429,12 +446,46 @@ enum omap24xx_index {
429 M15_24XX_GPIO92, 446 M15_24XX_GPIO92,
430 V14_24XX_GPIO117, 447 V14_24XX_GPIO117,
431 448
449 /* 242x DBG GPIO */
450 V4_242X_GPIO49,
451 W2_242X_GPIO50,
452 U4_242X_GPIO51,
453 V3_242X_GPIO52,
454 V2_242X_GPIO53,
455 V6_242X_GPIO53,
456 T4_242X_GPIO54,
457 Y4_242X_GPIO54,
458 T3_242X_GPIO55,
459 U2_242X_GPIO56,
460
461 /* 24xx external DMA requests */
462 AA10_242X_DMAREQ0,
463 AA6_242X_DMAREQ1,
464 E4_242X_DMAREQ2,
465 G4_242X_DMAREQ3,
466 D3_242X_DMAREQ4,
467 E3_242X_DMAREQ5,
468
432 P20_24XX_TSC_IRQ, 469 P20_24XX_TSC_IRQ,
433 470
434 /* UART3 */ 471 /* UART3 */
435 K15_24XX_UART3_TX, 472 K15_24XX_UART3_TX,
436 K14_24XX_UART3_RX, 473 K14_24XX_UART3_RX,
437 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
438 /* Keypad GPIO*/ 489 /* Keypad GPIO*/
439 T19_24XX_KBR0, 490 T19_24XX_KBR0,
440 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 05b003f3a9..e46623c61a 100644
--- a/include/asm-arm/arch-omap/pm.h
+++ b/include/asm-arm/arch-omap/pm.h
@@ -299,10 +299,43 @@ enum omap24xx_save_state {
299 OMAP24XX_SLEEP_SAVE_INTC_MIR0, 299 OMAP24XX_SLEEP_SAVE_INTC_MIR0,
300 OMAP24XX_SLEEP_SAVE_INTC_MIR1, 300 OMAP24XX_SLEEP_SAVE_INTC_MIR1,
301 OMAP24XX_SLEEP_SAVE_INTC_MIR2, 301 OMAP24XX_SLEEP_SAVE_INTC_MIR2,
302
303 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_MPU,
304 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_CORE,
305 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_GFX,
306 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_DSP,
307 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_MDM,
308
309 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_MPU,
310 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_CORE,
311 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_GFX,
312 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_DSP,
313 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_MDM,
314
315 OMAP24XX_SLEEP_SAVE_CM_IDLEST1_CORE,
316 OMAP24XX_SLEEP_SAVE_CM_IDLEST2_CORE,
317 OMAP24XX_SLEEP_SAVE_CM_IDLEST3_CORE,
318 OMAP24XX_SLEEP_SAVE_CM_IDLEST4_CORE,
319 OMAP24XX_SLEEP_SAVE_CM_IDLEST_GFX,
320 OMAP24XX_SLEEP_SAVE_CM_IDLEST_WKUP,
321 OMAP24XX_SLEEP_SAVE_CM_IDLEST_CKGEN,
322 OMAP24XX_SLEEP_SAVE_CM_IDLEST_DSP,
323 OMAP24XX_SLEEP_SAVE_CM_IDLEST_MDM,
324
325 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE1_CORE,
326 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE2_CORE,
327 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE3_CORE,
328 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE4_CORE,
329 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_WKUP,
330 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_PLL,
331 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_DSP,
332 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_MDM,
333
302 OMAP24XX_SLEEP_SAVE_CM_FCLKEN1_CORE, 334 OMAP24XX_SLEEP_SAVE_CM_FCLKEN1_CORE,
303 OMAP24XX_SLEEP_SAVE_CM_FCLKEN2_CORE, 335 OMAP24XX_SLEEP_SAVE_CM_FCLKEN2_CORE,
304 OMAP24XX_SLEEP_SAVE_CM_ICLKEN1_CORE, 336 OMAP24XX_SLEEP_SAVE_CM_ICLKEN1_CORE,
305 OMAP24XX_SLEEP_SAVE_CM_ICLKEN2_CORE, 337 OMAP24XX_SLEEP_SAVE_CM_ICLKEN2_CORE,
338 OMAP24XX_SLEEP_SAVE_CM_ICLKEN3_CORE,
306 OMAP24XX_SLEEP_SAVE_CM_ICLKEN4_CORE, 339 OMAP24XX_SLEEP_SAVE_CM_ICLKEN4_CORE,
307 OMAP24XX_SLEEP_SAVE_GPIO1_IRQENABLE1, 340 OMAP24XX_SLEEP_SAVE_GPIO1_IRQENABLE1,
308 OMAP24XX_SLEEP_SAVE_GPIO2_IRQENABLE1, 341 OMAP24XX_SLEEP_SAVE_GPIO2_IRQENABLE1,
diff --git a/include/asm-arm/arch-pxa/io.h b/include/asm-arm/arch-pxa/io.h
index eb2dd58d39..7f8d817b44 100644
--- a/include/asm-arm/arch-pxa/io.h
+++ b/include/asm-arm/arch-pxa/io.h
@@ -16,6 +16,5 @@
16 */ 16 */
17#define __io(a) ((void __iomem *)(a)) 17#define __io(a) ((void __iomem *)(a))
18#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
19#define __mem_isa(a) (a)
20 19
21#endif 20#endif
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 9f83f4adfb..f5cc65dd7d 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1329,6 +1329,7 @@
1329#define GPIO84_NSRXD 84 /* NSSP receive */ 1329#define GPIO84_NSRXD 84 /* NSSP receive */
1330#define GPIO85_nPCE_1 85 /* Card Enable for Card Space (PXA27x) */ 1330#define GPIO85_nPCE_1 85 /* Card Enable for Card Space (PXA27x) */
1331#define GPIO92_MMCDAT0 92 /* MMC DAT0 (PXA27x) */ 1331#define GPIO92_MMCDAT0 92 /* MMC DAT0 (PXA27x) */
1332#define GPIO102_nPCE_1 102 /* PCMCIA (PXA27x) */
1332#define GPIO109_MMCDAT1 109 /* MMC DAT1 (PXA27x) */ 1333#define GPIO109_MMCDAT1 109 /* MMC DAT1 (PXA27x) */
1333#define GPIO110_MMCDAT2 110 /* MMC DAT2 (PXA27x) */ 1334#define GPIO110_MMCDAT2 110 /* MMC DAT2 (PXA27x) */
1334#define GPIO110_MMCCS0 110 /* MMC Chip Select 0 (PXA27x) */ 1335#define GPIO110_MMCCS0 110 /* MMC Chip Select 0 (PXA27x) */
@@ -1471,6 +1472,7 @@
1471#define GPIO84_NSSP_RX (84 | GPIO_ALT_FN_2_IN) 1472#define GPIO84_NSSP_RX (84 | GPIO_ALT_FN_2_IN)
1472#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT) 1473#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT)
1473#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT) 1474#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT)
1475#define GPIO102_nPCE_1_MD (102 | GPIO_ALT_FN_1_OUT)
1474#define GPIO104_pSKTSEL_MD (104 | GPIO_ALT_FN_1_OUT) 1476#define GPIO104_pSKTSEL_MD (104 | GPIO_ALT_FN_1_OUT)
1475#define GPIO109_MMCDAT1_MD (109 | GPIO_ALT_FN_1_OUT) 1477#define GPIO109_MMCDAT1_MD (109 | GPIO_ALT_FN_1_OUT)
1476#define GPIO110_MMCDAT2_MD (110 | GPIO_ALT_FN_1_OUT) 1478#define GPIO110_MMCDAT2_MD (110 | GPIO_ALT_FN_1_OUT)
diff --git a/include/asm-arm/arch-pxa/ssp.h b/include/asm-arm/arch-pxa/ssp.h
index 949878c0d9..ea200551a7 100644
--- a/include/asm-arm/arch-pxa/ssp.h
+++ b/include/asm-arm/arch-pxa/ssp.h
@@ -40,8 +40,8 @@ struct ssp_dev {
40}; 40};
41 41
42int ssp_write_word(struct ssp_dev *dev, u32 data); 42int ssp_write_word(struct ssp_dev *dev, u32 data);
43int ssp_read_word(struct ssp_dev *dev); 43int ssp_read_word(struct ssp_dev *dev, u32 *data);
44void ssp_flush(struct ssp_dev *dev); 44int ssp_flush(struct ssp_dev *dev);
45void ssp_enable(struct ssp_dev *dev); 45void ssp_enable(struct ssp_dev *dev);
46void ssp_disable(struct ssp_dev *dev); 46void ssp_disable(struct ssp_dev *dev);
47void ssp_save_state(struct ssp_dev *dev, struct ssp_state *ssp); 47void ssp_save_state(struct ssp_dev *dev, struct ssp_state *ssp);
diff --git a/include/asm-arm/arch-pxa/trizeps4.h b/include/asm-arm/arch-pxa/trizeps4.h
new file mode 100644
index 0000000000..641d0ec110
--- /dev/null
+++ b/include/asm-arm/arch-pxa/trizeps4.h
@@ -0,0 +1,106 @@
1/************************************************************************
2 * Include file for TRIZEPS4 SoM and ConXS eval-board
3 * Copyright (c) Jürgen Schindele
4 * 2006
5 ************************************************************************/
6
7/*
8 * Includes/Defines
9 */
10#ifndef _TRIPEPS4_H_
11#define _TRIPEPS4_H_
12
13/* physical memory regions */
14#define TRIZEPS4_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */
15#define TRIZEPS4_DISK_PHYS (PXA_CS1_PHYS) /* Disk On Chip region */
16#define TRIZEPS4_ETH_PHYS (PXA_CS2_PHYS) /* Ethernet DM9000 region */
17#define TRIZEPS4_PIC_PHYS (PXA_CS3_PHYS) /* Logic chip on ConXS-Board */
18#define TRIZEPS4_SDRAM_BASE 0xa0000000 /* SDRAM region */
19
20#define TRIZEPS4_CFSR_PHYS (PXA_CS3_PHYS) /* Logic chip on ConXS-Board CSFR register */
21#define TRIZEPS4_BOCR_PHYS (PXA_CS3_PHYS+0x02000000) /* Logic chip on ConXS-Board BOCR register */
22#define TRIZEPS4_IRCR_PHYS (PXA_CS3_PHYS+0x02400000) /* Logic chip on ConXS-Board IRCR register*/
23#define TRIZEPS4_UPSR_PHYS (PXA_CS3_PHYS+0x02800000) /* Logic chip on ConXS-Board UPSR register*/
24#define TRIZEPS4_DICR_PHYS (PXA_CS3_PHYS+0x03800000) /* Logic chip on ConXS-Board DICR register*/
25
26/* virtual memory regions */
27#define TRIZEPS4_DISK_VIRT 0xF0000000 /* Disk On Chip region */
28
29#define TRIZEPS4_PIC_VIRT 0xF0100000 /* not used */
30#define TRIZEPS4_CFSR_VIRT 0xF0100000
31#define TRIZEPS4_BOCR_VIRT 0xF0200000
32#define TRIZEPS4_DICR_VIRT 0xF0300000
33#define TRIZEPS4_IRCR_VIRT 0xF0400000
34#define TRIZEPS4_UPSR_VIRT 0xF0500000
35
36/* size of flash */
37#define TRIZEPS4_FLASH_SIZE 0x02000000 /* Flash size 32 MB */
38
39/* Ethernet Controller Davicom DM9000 */
40#define GPIO_DM9000 101
41#define TRIZEPS4_ETH_IRQ IRQ_GPIO(GPIO_DM9000)
42
43/* UCB1400 audio / TS-controller */
44#define GPIO_UCB1400 1
45#define TRIZEPS4_UCB1400_IRQ IRQ_GPIO(GPIO_UCB1400)
46
47/* PCMCIA socket Compact Flash */
48#define GPIO_PCD 11 /* PCMCIA Card Detect */
49#define TRIZEPS4_CD_IRQ IRQ_GPIO(GPIO_PCD)
50#define GPIO_PRDY 13 /* READY / nINT */
51#define TRIZEPS4_READY_NINT IRQ_GPIO(GPIO_PRDY)
52
53/* MMC socket */
54#define GPIO_MMC_DET 12
55#define TRIZEPS4_MMC_IRQ IRQ_GPIO(GPIO_MMC_DET)
56
57/* LEDS using tx2 / rx2 */
58#define GPIO_SYS_BUSY_LED 46
59#define GPIO_HEARTBEAT_LED 47
60
61/* Off-module PIC on ConXS board */
62#define GPIO_PIC 0
63#define TRIZEPS4_PIC_IRQ IRQ_GPIO(GPIO_PIC)
64
65#define CFSR_P2V(x) ((x) - TRIZEPS4_CFSR_PHYS + TRIZEPS4_CFSR_VIRT)
66#define CFSR_V2P(x) ((x) - TRIZEPS4_CFSR_VIRT + TRIZEPS4_CFSR_PHYS)
67
68#define BCR_P2V(x) ((x) - TRIZEPS4_BOCR_PHYS + TRIZEPS4_BOCR_VIRT)
69#define BCR_V2P(x) ((x) - TRIZEPS4_BOCR_VIRT + TRIZEPS4_BOCR_PHYS)
70
71#define DCR_P2V(x) ((x) - TRIZEPS4_DICR_PHYS + TRIZEPS4_DICR_VIRT)
72#define DCR_V2P(x) ((x) - TRIZEPS4_DICR_VIRT + TRIZEPS4_DICR_PHYS)
73
74#ifndef __ASSEMBLY__
75#define ConXS_CFSR (*((volatile unsigned short *)CFSR_P2V(0x0C000000)))
76#define ConXS_BCR (*((volatile unsigned short *)BCR_P2V(0x0E000000)))
77#define ConXS_DCR (*((volatile unsigned short *)DCR_P2V(0x0F800000)))
78#else
79#define ConXS_CFSR CFSR_P2V(0x0C000000)
80#define ConXS_BCR BCR_P2V(0x0E000000)
81#define ConXS_DCR DCR_P2V(0x0F800000)
82#endif
83
84#define ConXS_CFSR_BVD_MASK 0x0003
85#define ConXS_CFSR_BVD1 (1 << 0)
86#define ConXS_CFSR_BVD2 (1 << 1)
87#define ConXS_CFSR_VS_MASK 0x000C
88#define ConXS_CFSR_VS1 (1 << 2)
89#define ConXS_CFSR_VS2 (1 << 3)
90#define ConXS_CFSR_VS_5V (0x3 << 2)
91#define ConXS_CFSR_VS_3V3 0x0
92
93#define ConXS_BCR_S0_POW_EN0 (1 << 0)
94#define ConXS_BCR_S0_POW_EN1 (1 << 1)
95#define ConXS_BCR_L_DISP (1 << 4)
96#define ConXS_BCR_CF_BUF_EN (1 << 5)
97#define ConXS_BCR_CF_RESET (1 << 7)
98#define ConXS_BCR_S0_VCC_3V3 0x1
99#define ConXS_BCR_S0_VCC_5V0 0x2
100#define ConXS_BCR_S0_VPP_12V 0x4
101#define ConXS_BCR_S0_VPP_3V3 0x8
102
103#define ConXS_IRCR_MODE (1 << 0)
104#define ConXS_IRCR_SD (1 << 1)
105
106#endif /* _TRIPEPS4_H_ */
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h
index 30548a30c7..121cd24111 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-realview/io.h b/include/asm-arm/arch-realview/io.h
index d444a68ac3..c70f1dfbe1 100644
--- a/include/asm-arm/arch-realview/io.h
+++ b/include/asm-arm/arch-realview/io.h
@@ -29,6 +29,5 @@ static inline void __iomem *__io(unsigned long addr)
29 29
30#define __io(a) __io(a) 30#define __io(a) __io(a)
31#define __mem_pci(a) (a) 31#define __mem_pci(a) (a)
32#define __mem_isa(a) (a)
33 32
34#endif 33#endif
diff --git a/include/asm-arm/arch-s3c2410/anubis-cpld.h b/include/asm-arm/arch-s3c2410/anubis-cpld.h
index 5675b1796b..40e8e270d3 100644
--- a/include/asm-arm/arch-s3c2410/anubis-cpld.h
+++ b/include/asm-arm/arch-s3c2410/anubis-cpld.h
@@ -9,9 +9,6 @@
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14 *
15*/ 12*/
16 13
17#ifndef __ASM_ARCH_ANUBISCPLD_H 14#ifndef __ASM_ARCH_ANUBISCPLD_H
diff --git a/include/asm-arm/arch-s3c2410/anubis-irq.h b/include/asm-arm/arch-s3c2410/anubis-irq.h
index 82f15dbd97..4b5f423779 100644
--- a/include/asm-arm/arch-s3c2410/anubis-irq.h
+++ b/include/asm-arm/arch-s3c2410/anubis-irq.h
@@ -9,9 +9,7 @@
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 * 12*/
13 * Changelog:
14 */
15 13
16#ifndef __ASM_ARCH_ANUBISIRQ_H 14#ifndef __ASM_ARCH_ANUBISIRQ_H
17#define __ASM_ARCH_ANUBISIRQ_H 15#define __ASM_ARCH_ANUBISIRQ_H
diff --git a/include/asm-arm/arch-s3c2410/anubis-map.h b/include/asm-arm/arch-s3c2410/anubis-map.h
index d529ffda85..058a2104b0 100644
--- a/include/asm-arm/arch-s3c2410/anubis-map.h
+++ b/include/asm-arm/arch-s3c2410/anubis-map.h
@@ -9,8 +9,6 @@
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14*/ 12*/
15 13
16/* needs arch/map.h including with this */ 14/* needs arch/map.h including with this */
diff --git a/include/asm-arm/arch-s3c2410/audio.h b/include/asm-arm/arch-s3c2410/audio.h
index 0d276e67f2..7e0222276c 100644
--- a/include/asm-arm/arch-s3c2410/audio.h
+++ b/include/asm-arm/arch-s3c2410/audio.h
@@ -9,10 +9,6 @@
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14 * 20-Nov-2004 BJD Created file
15 * 07-Mar-2005 BJD Added suspend/resume calls
16*/ 12*/
17 13
18#ifndef __ASM_ARCH_AUDIO_H 14#ifndef __ASM_ARCH_AUDIO_H
diff --git a/include/asm-arm/arch-s3c2410/bast-cpld.h b/include/asm-arm/arch-s3c2410/bast-cpld.h
index e28ca51a49..8969cffe83 100644
--- a/include/asm-arm/arch-s3c2410/bast-cpld.h
+++ b/include/asm-arm/arch-s3c2410/bast-cpld.h
@@ -8,11 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 25-May-2003 BJD Created file, added CTRL1 registers
14 * 30-Aug-2004 BJD Updated definitions from 2.4.26 port
15 * 30-Aug-2004 BJD Added CTRL3 and CTRL4 definitions
16*/ 11*/
17 12
18#ifndef __ASM_ARCH_BASTCPLD_H 13#ifndef __ASM_ARCH_BASTCPLD_H
diff --git a/include/asm-arm/arch-s3c2410/bast-irq.h b/include/asm-arm/arch-s3c2410/bast-irq.h
index b79b47f0d1..15ffa66f50 100644
--- a/include/asm-arm/arch-s3c2410/bast-irq.h
+++ b/include/asm-arm/arch-s3c2410/bast-irq.h
@@ -8,11 +8,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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11*/
12 * Changelog:
13 * 14-Sep-2004 BJD Fixed IRQ_USBOC definition
14 * 06-Jan-2003 BJD Linux 2.6.0 version
15 */
16 12
17#ifndef __ASM_ARCH_BASTIRQ_H 13#ifndef __ASM_ARCH_BASTIRQ_H
18#define __ASM_ARCH_BASTIRQ_H 14#define __ASM_ARCH_BASTIRQ_H
diff --git a/include/asm-arm/arch-s3c2410/bast-map.h b/include/asm-arm/arch-s3c2410/bast-map.h
index 29c07e302b..727cef84c7 100644
--- a/include/asm-arm/arch-s3c2410/bast-map.h
+++ b/include/asm-arm/arch-s3c2410/bast-map.h
@@ -8,10 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 06-Jan-2003 BJD Linux 2.6.0 version, moved bast specifics from arch/map.h
14 * 12-Mar-2004 BJD Fixed header include protection
15*/ 11*/
16 12
17/* needs arch/map.h including with this */ 13/* needs arch/map.h including with this */
diff --git a/include/asm-arm/arch-s3c2410/bast-pmu.h b/include/asm-arm/arch-s3c2410/bast-pmu.h
index 758c5c59d4..82836027f0 100644
--- a/include/asm-arm/arch-s3c2410/bast-pmu.h
+++ b/include/asm-arm/arch-s3c2410/bast-pmu.h
@@ -9,9 +9,6 @@
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14 * 08-Oct-2003 BJD Initial creation
15*/ 12*/
16 13
17#ifndef __ASM_ARCH_BASTPMU_H 14#ifndef __ASM_ARCH_BASTPMU_H
diff --git a/include/asm-arm/arch-s3c2410/debug-macro.S b/include/asm-arm/arch-s3c2410/debug-macro.S
index 5f8223e700..93064860e0 100644
--- a/include/asm-arm/arch-s3c2410/debug-macro.S
+++ b/include/asm-arm/arch-s3c2410/debug-macro.S
@@ -10,9 +10,6 @@
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 *
14 * Modifications:
15 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
16*/ 13*/
17 14
18#include <asm/arch/map.h> 15#include <asm/arch/map.h>
@@ -33,7 +30,7 @@
33 .endm 30 .endm
34 31
35 .macro senduart,rd,rx 32 .macro senduart,rd,rx
36 str \rd, [\rx, # S3C2410_UTXH ] 33 strb \rd, [\rx, # S3C2410_UTXH ]
37 .endm 34 .endm
38 35
39 .macro busyuart, rd, rx 36 .macro busyuart, rd, rx
@@ -42,6 +39,12 @@
42 beq 1001f @ 39 beq 1001f @
43 @ FIFO enabled... 40 @ FIFO enabled...
441003: 411003:
42 @ check for arm920 vs arm926. currently assume all arm926
43 @ devices have an 64 byte FIFO identical to the s3c2440
44 mrc p15, 0, \rd, c0, c0
45 and \rd, \rd, #0xff0
46 teq \rd, #0x260
47 beq 1004f
45 mrc p15, 0, \rd, c1, c0 48 mrc p15, 0, \rd, c1, c0
46 tst \rd, #1 49 tst \rd, #1
47 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) 50 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
@@ -50,7 +53,7 @@
50 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] 53 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
51 and \rd, \rd, #0x00ff0000 54 and \rd, \rd, #0x00ff0000
52 teq \rd, #0x00440000 @ is it 2440? 55 teq \rd, #0x00440000 @ is it 2440?
53 561004:
54 ldr \rd, [ \rx, # S3C2410_UFSTAT ] 57 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
55 moveq \rd, \rd, lsr #SHIFT_2440TXF 58 moveq \rd, \rd, lsr #SHIFT_2440TXF
56 tst \rd, #S3C2410_UFSTAT_TXFULL 59 tst \rd, #S3C2410_UFSTAT_TXFULL
diff --git a/include/asm-arm/arch-s3c2410/dma.h b/include/asm-arm/arch-s3c2410/dma.h
index 72964f9b84..7ac2248369 100644
--- a/include/asm-arm/arch-s3c2410/dma.h
+++ b/include/asm-arm/arch-s3c2410/dma.h
@@ -1,18 +1,13 @@
1/* linux/include/asm-arm/arch-bast/dma.h 1/* linux/include/asm-arm/arch-s3c2410/dma.h
2 * 2 *
3 * Copyright (C) 2003,2004 Simtec Electronics 3 * Copyright (C) 2003,2004,2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Samsung S3C2410X DMA support 6 * Samsung S3C241XX DMA support
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * ??-May-2003 BJD Created file
14 * ??-Jun-2003 BJD Added more dma functionality to go with arch
15 * 10-Nov-2004 BJD Added sys_device support
16*/ 11*/
17 12
18#ifndef __ASM_ARCH_DMA_H 13#ifndef __ASM_ARCH_DMA_H
@@ -21,28 +16,59 @@
21#include <linux/sysdev.h> 16#include <linux/sysdev.h>
22#include "hardware.h" 17#include "hardware.h"
23 18
24
25/* 19/*
26 * This is the maximum DMA address(physical address) that can be DMAd to. 20 * This is the maximum DMA address(physical address) that can be DMAd to.
27 * 21 *
28 */ 22 */
29#define MAX_DMA_ADDRESS 0x20000000 23#define MAX_DMA_ADDRESS 0x40000000
30#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 24#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
31 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 */
32 58
33/* we have 4 dma channels */ 59/* we have 4 dma channels */
34#define S3C2410_DMA_CHANNELS (4) 60#define S3C2410_DMA_CHANNELS (4)
35 61
36/* types */ 62/* types */
37 63
38typedef enum { 64enum s3c2410_dma_state {
39 S3C2410_DMA_IDLE, 65 S3C2410_DMA_IDLE,
40 S3C2410_DMA_RUNNING, 66 S3C2410_DMA_RUNNING,
41 S3C2410_DMA_PAUSED 67 S3C2410_DMA_PAUSED
42} s3c2410_dma_state_t; 68};
43 69
44 70
45/* s3c2410_dma_loadst_t 71/* enum s3c2410_dma_loadst
46 * 72 *
47 * This represents the state of the DMA engine, wrt to the loaded / running 73 * This represents the state of the DMA engine, wrt to the loaded / running
48 * transfers. Since we don't have any way of knowing exactly the state of 74 * transfers. Since we don't have any way of knowing exactly the state of
@@ -70,44 +96,40 @@ typedef enum {
70 * currently running. 96 * currently running.
71*/ 97*/
72 98
73typedef enum { 99enum s3c2410_dma_loadst {
74 S3C2410_DMALOAD_NONE, 100 S3C2410_DMALOAD_NONE,
75 S3C2410_DMALOAD_1LOADED, 101 S3C2410_DMALOAD_1LOADED,
76 S3C2410_DMALOAD_1RUNNING, 102 S3C2410_DMALOAD_1RUNNING,
77 S3C2410_DMALOAD_1LOADED_1RUNNING, 103 S3C2410_DMALOAD_1LOADED_1RUNNING,
78} s3c2410_dma_loadst_t; 104};
79 105
80typedef enum { 106enum s3c2410_dma_buffresult {
81 S3C2410_RES_OK, 107 S3C2410_RES_OK,
82 S3C2410_RES_ERR, 108 S3C2410_RES_ERR,
83 S3C2410_RES_ABORT 109 S3C2410_RES_ABORT
84} s3c2410_dma_buffresult_t; 110};
85
86
87typedef enum s3c2410_dmasrc_e s3c2410_dmasrc_t;
88 111
89enum s3c2410_dmasrc_e { 112enum s3c2410_dmasrc {
90 S3C2410_DMASRC_HW, /* source is memory */ 113 S3C2410_DMASRC_HW, /* source is memory */
91 S3C2410_DMASRC_MEM /* source is hardware */ 114 S3C2410_DMASRC_MEM /* source is hardware */
92}; 115};
93 116
94/* enum s3c2410_chan_op_e 117/* enum s3c2410_chan_op
95 * 118 *
96 * operation codes passed to the DMA code by the user, and also used 119 * operation codes passed to the DMA code by the user, and also used
97 * to inform the current channel owner of any changes to the system state 120 * to inform the current channel owner of any changes to the system state
98*/ 121*/
99 122
100enum s3c2410_chan_op_e { 123enum s3c2410_chan_op {
101 S3C2410_DMAOP_START, 124 S3C2410_DMAOP_START,
102 S3C2410_DMAOP_STOP, 125 S3C2410_DMAOP_STOP,
103 S3C2410_DMAOP_PAUSE, 126 S3C2410_DMAOP_PAUSE,
104 S3C2410_DMAOP_RESUME, 127 S3C2410_DMAOP_RESUME,
105 S3C2410_DMAOP_FLUSH, 128 S3C2410_DMAOP_FLUSH,
106 S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */ 129 S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
130 S3C2410_DMAOP_STARTED, /* indicate channel started */
107}; 131};
108 132
109typedef enum s3c2410_chan_op_e s3c2410_chan_op_t;
110
111/* flags */ 133/* flags */
112 134
113#define S3C2410_DMAF_SLOW (1<<0) /* slow, so don't worry about 135#define S3C2410_DMAF_SLOW (1<<0) /* slow, so don't worry about
@@ -116,104 +138,104 @@ typedef enum s3c2410_chan_op_e s3c2410_chan_op_t;
116 138
117/* dma buffer */ 139/* dma buffer */
118 140
119typedef struct s3c2410_dma_buf_s s3c2410_dma_buf_t;
120
121struct s3c2410_dma_client { 141struct s3c2410_dma_client {
122 char *name; 142 char *name;
123}; 143};
124 144
125typedef struct s3c2410_dma_client s3c2410_dma_client_t;
126
127/* s3c2410_dma_buf_s 145/* s3c2410_dma_buf_s
128 * 146 *
129 * internally used buffer structure to describe a queued or running 147 * internally used buffer structure to describe a queued or running
130 * buffer. 148 * buffer.
131*/ 149*/
132 150
133struct s3c2410_dma_buf_s { 151struct s3c2410_dma_buf;
134 s3c2410_dma_buf_t *next; 152struct s3c2410_dma_buf {
135 int magic; /* magic */ 153 struct s3c2410_dma_buf *next;
136 int size; /* buffer size in bytes */ 154 int magic; /* magic */
137 dma_addr_t data; /* start of DMA data */ 155 int size; /* buffer size in bytes */
138 dma_addr_t ptr; /* where the DMA got to [1] */ 156 dma_addr_t data; /* start of DMA data */
139 void *id; /* client's id */ 157 dma_addr_t ptr; /* where the DMA got to [1] */
158 void *id; /* client's id */
140}; 159};
141 160
142/* [1] is this updated for both recv/send modes? */ 161/* [1] is this updated for both recv/send modes? */
143 162
144typedef struct s3c2410_dma_chan_s s3c2410_dma_chan_t; 163struct s3c2410_dma_chan;
145 164
146/* s3c2410_dma_cbfn_t 165/* s3c2410_dma_cbfn_t
147 * 166 *
148 * buffer callback routine type 167 * buffer callback routine type
149*/ 168*/
150 169
151typedef void (*s3c2410_dma_cbfn_t)(s3c2410_dma_chan_t *, void *buf, int size, 170typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
152 s3c2410_dma_buffresult_t result); 171 void *buf, int size,
172 enum s3c2410_dma_buffresult result);
153 173
154typedef int (*s3c2410_dma_opfn_t)(s3c2410_dma_chan_t *, 174typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
155 s3c2410_chan_op_t ); 175 enum s3c2410_chan_op );
156 176
157struct s3c2410_dma_stats_s { 177struct s3c2410_dma_stats {
158 unsigned long loads; 178 unsigned long loads;
159 unsigned long timeout_longest; 179 unsigned long timeout_longest;
160 unsigned long timeout_shortest; 180 unsigned long timeout_shortest;
161 unsigned long timeout_avg; 181 unsigned long timeout_avg;
162 unsigned long timeout_failed; 182 unsigned long timeout_failed;
163}; 183};
164 184
165typedef struct s3c2410_dma_stats_s s3c2410_dma_stats_t; 185struct s3c2410_dma_map;
166 186
167/* struct s3c2410_dma_chan_s 187/* struct s3c2410_dma_chan
168 * 188 *
169 * full state information for each DMA channel 189 * full state information for each DMA channel
170*/ 190*/
171 191
172struct s3c2410_dma_chan_s { 192struct s3c2410_dma_chan {
173 /* channel state flags and information */ 193 /* channel state flags and information */
174 unsigned char number; /* number of this dma channel */ 194 unsigned char number; /* number of this dma channel */
175 unsigned char in_use; /* channel allocated */ 195 unsigned char in_use; /* channel allocated */
176 unsigned char irq_claimed; /* irq claimed for channel */ 196 unsigned char irq_claimed; /* irq claimed for channel */
177 unsigned char irq_enabled; /* irq enabled for channel */ 197 unsigned char irq_enabled; /* irq enabled for channel */
178 unsigned char xfer_unit; /* size of an transfer */ 198 unsigned char xfer_unit; /* size of an transfer */
179 199
180 /* channel state */ 200 /* channel state */
181 201
182 s3c2410_dma_state_t state; 202 enum s3c2410_dma_state state;
183 s3c2410_dma_loadst_t load_state; 203 enum s3c2410_dma_loadst load_state;
184 s3c2410_dma_client_t *client; 204 struct s3c2410_dma_client *client;
185 205
186 /* channel configuration */ 206 /* channel configuration */
187 s3c2410_dmasrc_t source; 207 enum s3c2410_dmasrc source;
188 unsigned long dev_addr; 208 unsigned long dev_addr;
189 unsigned long load_timeout; 209 unsigned long load_timeout;
190 unsigned int flags; /* channel flags */ 210 unsigned int flags; /* channel flags */
211
212 struct s3c24xx_dma_map *map; /* channel hw maps */
191 213
192 /* channel's hardware position and configuration */ 214 /* channel's hardware position and configuration */
193 void __iomem *regs; /* channels registers */ 215 void __iomem *regs; /* channels registers */
194 void __iomem *addr_reg; /* data address register */ 216 void __iomem *addr_reg; /* data address register */
195 unsigned int irq; /* channel irq */ 217 unsigned int irq; /* channel irq */
196 unsigned long dcon; /* default value of DCON */ 218 unsigned long dcon; /* default value of DCON */
197 219
198 /* driver handles */ 220 /* driver handles */
199 s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */ 221 s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */
200 s3c2410_dma_opfn_t op_fn; /* channel operation callback */ 222 s3c2410_dma_opfn_t op_fn; /* channel op callback */
201 223
202 /* stats gathering */ 224 /* stats gathering */
203 s3c2410_dma_stats_t *stats; 225 struct s3c2410_dma_stats *stats;
204 s3c2410_dma_stats_t stats_store; 226 struct s3c2410_dma_stats stats_store;
205 227
206 /* buffer list and information */ 228 /* buffer list and information */
207 s3c2410_dma_buf_t *curr; /* current dma buffer */ 229 struct s3c2410_dma_buf *curr; /* current dma buffer */
208 s3c2410_dma_buf_t *next; /* next buffer to load */ 230 struct s3c2410_dma_buf *next; /* next buffer to load */
209 s3c2410_dma_buf_t *end; /* end of queue */ 231 struct s3c2410_dma_buf *end; /* end of queue */
210 232
211 /* system device */ 233 /* system device */
212 struct sys_device dev; 234 struct sys_device dev;
213}; 235};
214 236
215/* the currently allocated channel information */ 237/* the currently allocated channel information */
216extern s3c2410_dma_chan_t s3c2410_chans[]; 238extern struct s3c2410_dma_chan s3c2410_chans[];
217 239
218/* note, we don't really use dma_device_t at the moment */ 240/* note, we don't really use dma_device_t at the moment */
219typedef unsigned long dma_device_t; 241typedef unsigned long dma_device_t;
@@ -226,7 +248,7 @@ typedef unsigned long dma_device_t;
226*/ 248*/
227 249
228extern int s3c2410_dma_request(dmach_t channel, 250extern int s3c2410_dma_request(dmach_t channel,
229 s3c2410_dma_client_t *, void *dev); 251 struct s3c2410_dma_client *, void *dev);
230 252
231 253
232/* s3c2410_dma_ctrl 254/* s3c2410_dma_ctrl
@@ -234,7 +256,7 @@ extern int s3c2410_dma_request(dmach_t channel,
234 * change the state of the dma channel 256 * change the state of the dma channel
235*/ 257*/
236 258
237extern int s3c2410_dma_ctrl(dmach_t channel, s3c2410_chan_op_t op); 259extern int s3c2410_dma_ctrl(dmach_t channel, enum s3c2410_chan_op op);
238 260
239/* s3c2410_dma_setflags 261/* s3c2410_dma_setflags
240 * 262 *
@@ -249,7 +271,7 @@ extern int s3c2410_dma_setflags(dmach_t channel,
249 * free the dma channel (will also abort any outstanding operations) 271 * free the dma channel (will also abort any outstanding operations)
250*/ 272*/
251 273
252extern int s3c2410_dma_free(dmach_t channel, s3c2410_dma_client_t *); 274extern int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *);
253 275
254/* s3c2410_dma_enqueue 276/* s3c2410_dma_enqueue
255 * 277 *
@@ -273,7 +295,7 @@ extern int s3c2410_dma_config(dmach_t channel, int xferunit, int dcon);
273 * configure the device we're talking to 295 * configure the device we're talking to
274*/ 296*/
275 297
276extern int s3c2410_dma_devconfig(int channel, s3c2410_dmasrc_t source, 298extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source,
277 int hwcfg, unsigned long devaddr); 299 int hwcfg, unsigned long devaddr);
278 300
279/* s3c2410_dma_getposition 301/* s3c2410_dma_getposition
@@ -298,6 +320,7 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
298#define S3C2410_DMA_DCSRC (0x18) 320#define S3C2410_DMA_DCSRC (0x18)
299#define S3C2410_DMA_DCDST (0x1C) 321#define S3C2410_DMA_DCDST (0x1C)
300#define S3C2410_DMA_DMASKTRIG (0x20) 322#define S3C2410_DMA_DMASKTRIG (0x20)
323#define S3C2412_DMA_DMAREQSEL (0x24)
301 324
302#define S3C2410_DISRCC_INC (1<<0) 325#define S3C2410_DISRCC_INC (1<<0)
303#define S3C2410_DISRCC_APB (1<<1) 326#define S3C2410_DISRCC_APB (1<<1)
@@ -364,4 +387,32 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
364#define S3C2440_DCON_CH3_PCMOUT (6<<24) 387#define S3C2440_DCON_CH3_PCMOUT (6<<24)
365#endif 388#endif
366 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
367#endif /* __ASM_ARCH_DMA_H */ 418#endif /* __ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-s3c2410/entry-macro.S b/include/asm-arm/arch-s3c2410/entry-macro.S
index 894c35cf3b..e09a6b8ec1 100644
--- a/include/asm-arm/arch-s3c2410/entry-macro.S
+++ b/include/asm-arm/arch-s3c2410/entry-macro.S
@@ -18,8 +18,6 @@
18 18
19#define INTPND (0x10) 19#define INTPND (0x10)
20#define INTOFFSET (0x14) 20#define INTOFFSET (0x14)
21#define EXTINTPEND (0xa8)
22#define EXTINTMASK (0xa4)
23 21
24#include <asm/hardware.h> 22#include <asm/hardware.h>
25#include <asm/arch/irqs.h> 23#include <asm/arch/irqs.h>
@@ -28,37 +26,23 @@
28 26
29 mov \base, #S3C24XX_VA_IRQ 27 mov \base, #S3C24XX_VA_IRQ
30 28
31 ldr \irqstat, [ \base, #INTPND]
32 bics \irqnr, \irqstat, #3<<4 @@ only an GPIO IRQ
33 beq 2000f
34
35 @@ try the interrupt offset register, since it is there 29 @@ try the interrupt offset register, since it is there
36 30
31 ldr \irqstat, [ \base, #INTPND ]
32 teq \irqstat, #0
33 beq 1002f
37 ldr \irqnr, [ \base, #INTOFFSET ] 34 ldr \irqnr, [ \base, #INTOFFSET ]
38 mov \tmp, #1 35 mov \tmp, #1
39 tst \irqstat, \tmp, lsl \irqnr 36 tst \irqstat, \tmp, lsl \irqnr
40 addne \irqnr, \irqnr, #IRQ_EINT0
41 bne 1001f 37 bne 1001f
42 38
43 @@ the number specified is not a valid irq, so try 39 @@ the number specified is not a valid irq, so try
44 @@ and work it out for ourselves 40 @@ and work it out for ourselves
45 41
46 mov \irqnr, #IRQ_EINT0 @@ start here 42 mov \irqnr, #0 @@ start here
47 b 3000f
48
492000:
50 @@ load the GPIO interrupt register, and check it
51
52 add \tmp, \base, #S3C24XX_VA_GPIO - S3C24XX_VA_IRQ
53 ldr \irqstat, [ \tmp, # EXTINTPEND ]
54 ldr \irqnr, [ \tmp, # EXTINTMASK ]
55 bics \irqstat, \irqstat, \irqnr
56 beq 1001f
57
58 mov \irqnr, #(IRQ_EINT4 - 4)
59 43
60 @@ work out which irq (if any) we got 44 @@ work out which irq (if any) we got
613000: 45
62 movs \tmp, \irqstat, lsl#16 46 movs \tmp, \irqstat, lsl#16
63 addeq \irqnr, \irqnr, #16 47 addeq \irqnr, \irqnr, #16
64 moveq \irqstat, \irqstat, lsr#16 48 moveq \irqstat, \irqstat, lsr#16
@@ -75,9 +59,9 @@
75 addeq \irqnr, \irqnr, #1 59 addeq \irqnr, \irqnr, #1
76 60
77 @@ we have the value 61 @@ we have the value
78 movs \irqnr, \irqnr
79
801001: 621001:
63 adds \irqnr, \irqnr, #IRQ_EINT0
641002:
81 @@ exit here, Z flag unset if IRQ 65 @@ exit here, Z flag unset if IRQ
82 66
83 .endm 67 .endm
diff --git a/include/asm-arm/arch-s3c2410/fb.h b/include/asm-arm/arch-s3c2410/fb.h
index 4790491ba9..71161797bc 100644
--- a/include/asm-arm/arch-s3c2410/fb.h
+++ b/include/asm-arm/arch-s3c2410/fb.h
@@ -7,13 +7,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
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 *
11 *
12 * Changelog:
13 * 07-Sep-2004 RTP Created file
14 * 03-Nov-2004 BJD Updated and minor cleanups
15 * 03-Aug-2005 RTP Renamed to fb.h
16 * 26-Oct-2005 BJD Changed name of platdata init
17*/ 10*/
18 11
19#ifndef __ASM_ARM_FB_H 12#ifndef __ASM_ARM_FB_H
diff --git a/include/asm-arm/arch-s3c2410/hardware.h b/include/asm-arm/arch-s3c2410/hardware.h
index a2330bf836..871f8af09b 100644
--- a/include/asm-arm/arch-s3c2410/hardware.h
+++ b/include/asm-arm/arch-s3c2410/hardware.h
@@ -8,16 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 21-May-2003 BJD Created file
14 * 06-Jun-2003 BJD Added CPU frequency settings
15 * 03-Sep-2003 BJD Linux v2.6 support
16 * 12-Mar-2004 BJD Fixed include protection, fixed type of clock vars
17 * 14-Sep-2004 BJD Added misccr and getpin to gpio
18 * 01-Oct-2004 BJD Added the new gpio functions
19 * 16-Oct-2004 BJD Removed the clock variables
20 * 15-Jan-2006 LCVR Added s3c2400_gpio_getirq()
21*/ 11*/
22 12
23#ifndef __ASM_ARCH_HARDWARE_H 13#ifndef __ASM_ARCH_HARDWARE_H
diff --git a/include/asm-arm/arch-s3c2410/idle.h b/include/asm-arm/arch-s3c2410/idle.h
index 749227c095..eed450608f 100644
--- a/include/asm-arm/arch-s3c2410/idle.h
+++ b/include/asm-arm/arch-s3c2410/idle.h
@@ -8,10 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 CPU Idle controls 10 * S3C2410 CPU Idle controls
11 *
12 * Changelog:
13 * 28-Oct-2004 BJD Initial version
14 *
15*/ 11*/
16 12
17#ifndef __ASM_ARCH_IDLE_H 13#ifndef __ASM_ARCH_IDLE_H
diff --git a/include/asm-arm/arch-s3c2410/iic.h b/include/asm-arm/arch-s3c2410/iic.h
index 518547f6d7..ed3d6c7bf6 100644
--- a/include/asm-arm/arch-s3c2410/iic.h
+++ b/include/asm-arm/arch-s3c2410/iic.h
@@ -8,10 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 05-Oct-2004 BJD Created file
14 * 19-Oct-2004 BJD Updated for s3c2440
15*/ 11*/
16 12
17#ifndef __ASM_ARCH_IIC_H 13#ifndef __ASM_ARCH_IIC_H
diff --git a/include/asm-arm/arch-s3c2410/io.h b/include/asm-arm/arch-s3c2410/io.h
index 16fbc8afff..6b35a4f263 100644
--- a/include/asm-arm/arch-s3c2410/io.h
+++ b/include/asm-arm/arch-s3c2410/io.h
@@ -4,13 +4,7 @@
4 * 4 *
5 * Copyright (C) 1997 Russell King 5 * Copyright (C) 1997 Russell King
6 * (C) 2003 Simtec Electronics 6 * (C) 2003 Simtec Electronics
7 * 7*/
8 * Modifications:
9 * 06-Dec-1997 RMK Created.
10 * 02-Sep-2003 BJD Modified for S3C2410
11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
12 * 13-Oct-2005 BJD Fixed problems with LDRH/STRH offset range
13 */
14 8
15#ifndef __ASM_ARM_ARCH_IO_H 9#ifndef __ASM_ARM_ARCH_IO_H
16#define __ASM_ARM_ARCH_IO_H 10#define __ASM_ARM_ARCH_IO_H
diff --git a/include/asm-arm/arch-s3c2410/irqs.h b/include/asm-arm/arch-s3c2410/irqs.h
index d9773d6972..39a69829d1 100644
--- a/include/asm-arm/arch-s3c2410/irqs.h
+++ b/include/asm-arm/arch-s3c2410/irqs.h
@@ -6,14 +6,7 @@
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 * Changelog:
11 * 12-May-2003 BJD Created file
12 * 08-Jan-2003 BJD Linux 2.6.0 version, moved BAST bits out
13 * 12-Mar-2004 BJD Fixed bug in header protection
14 * 10-Feb-2005 BJD Added camera IRQ from guillaume.gourat@nexvision.tv
15 * 28-Feb-2005 BJD Updated s3c2440 IRQs
16 */
17 10
18 11
19#ifndef __ASM_ARCH_IRQS_H 12#ifndef __ASM_ARCH_IRQS_H
diff --git a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h
index 5e4c8c37bc..7895042d17 100644
--- a/include/asm-arm/arch-s3c2410/map.h
+++ b/include/asm-arm/arch-s3c2410/map.h
@@ -8,13 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 12-May-2003 BJD Created file
14 * 06-Jan-2003 BJD Linux 2.6.0 version, moved bast specifics out
15 * 10-Feb-2005 BJD Added CAMIF definition from guillaume.gourat@nexvision.tv
16 * 10-Mar-2005 LCVR Added support to S3C2400, changed {VA,SZ} names
17 * 15-Jan-2006 LCVR Added S3C24XX_PA macros for common S3C24XX resources
18*/ 11*/
19 12
20#ifndef __ASM_ARCH_MAP_H 13#ifndef __ASM_ARCH_MAP_H
@@ -167,6 +160,11 @@
167#define S3C2440_PA_CAMIF (0x4F000000) 160#define S3C2440_PA_CAMIF (0x4F000000)
168#define S3C2440_SZ_CAMIF SZ_1M 161#define S3C2440_SZ_CAMIF SZ_1M
169 162
163/* AC97 */
164
165#define S3C2440_PA_AC97 (0x5B000000)
166#define S3C2440_SZ_AC97 SZ_1M
167
170/* 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
171 * implements it. We reserve two 16M regions for ISA. 169 * implements it. We reserve two 16M regions for ISA.
172 */ 170 */
@@ -236,4 +234,20 @@
236#define S3C24XX_PA_SPI S3C2410_PA_SPI 234#define S3C24XX_PA_SPI S3C2410_PA_SPI
237#endif 235#endif
238 236
237/* deal with the registers that move under the 2412/2413 */
238
239#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
240#ifndef __ASSEMBLY__
241extern void __iomem *s3c24xx_va_gpio2;
242#endif
243#ifdef CONFIG_CPU_S3C2412_ONLY
244#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
245#else
246#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
247#endif
248#else
249#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
250#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
251#endif
252
239#endif /* __ASM_ARCH_MAP_H */ 253#endif /* __ASM_ARCH_MAP_H */
diff --git a/include/asm-arm/arch-s3c2410/memory.h b/include/asm-arm/arch-s3c2410/memory.h
index 6ab834a14c..4be6a74c43 100644
--- a/include/asm-arm/arch-s3c2410/memory.h
+++ b/include/asm-arm/arch-s3c2410/memory.h
@@ -1,6 +1,4 @@
1/* 1/* linux/include/asm-arm/arch-s3c2410/memory.h
2 * linux/include/asm-arm/arch-s3c2410/memory.h
3 *
4 * from linux/include/asm-arm/arch-rpc/memory.h 2 * from linux/include/asm-arm/arch-rpc/memory.h
5 * 3 *
6 * Copyright (C) 1996,1997,1998 Russell King. 4 * Copyright (C) 1996,1997,1998 Russell King.
@@ -8,16 +6,6 @@
8 * 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
9 * 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
10 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 20-Oct-1996 RMK Created
14 * 31-Dec-1997 RMK Fixed definitions to reduce warnings
15 * 11-Jan-1998 RMK Uninlined to reduce hits on cache
16 * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt
17 * 21-Mar-1999 RMK Renamed to memory.h
18 * RMK Added TASK_SIZE and PAGE_OFFSET
19 * 05-Apr-2004 BJD Copied and altered for arch-s3c2410
20 * 17-Mar-2005 LCVR Modified for S3C2400
21*/ 9*/
22 10
23#ifndef __ASM_ARCH_MEMORY_H 11#ifndef __ASM_ARCH_MEMORY_H
diff --git a/include/asm-arm/arch-s3c2410/nand.h b/include/asm-arm/arch-s3c2410/nand.h
index 9148ac045b..e350ae2acf 100644
--- a/include/asm-arm/arch-s3c2410/nand.h
+++ b/include/asm-arm/arch-s3c2410/nand.h
@@ -8,9 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 23-Sep-2004 BJD Created file
14*/ 11*/
15 12
16/* struct s3c2410_nand_set 13/* struct s3c2410_nand_set
diff --git a/include/asm-arm/arch-s3c2410/osiris-map.h b/include/asm-arm/arch-s3c2410/osiris-map.h
index 7c4b0cd2d1..a14164dfa5 100644
--- a/include/asm-arm/arch-s3c2410/osiris-map.h
+++ b/include/asm-arm/arch-s3c2410/osiris-map.h
@@ -9,8 +9,6 @@
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14*/ 12*/
15 13
16/* needs arch/map.h including with this */ 14/* needs arch/map.h including with this */
@@ -20,22 +18,22 @@
20 18
21/* start peripherals off after the S3C2410 */ 19/* start peripherals off after the S3C2410 */
22 20
23#define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x05000000)) 21#define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x04000000))
24 22
25#define OSIRIS_PA_CPLD (S3C2410_CS1 | (3<<25)) 23#define OSIRIS_PA_CPLD (S3C2410_CS1 | (1<<26))
26 24
27/* 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 */
28 26
29#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00000000) /* 0x01300000 */ 27#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00000000)
30#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD) 28#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD)
31 29
32#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00100000) /* 0x01400000 */ 30#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00100000)
33#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (1<<24)) 31#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (1<<23))
34 32
35#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00200000) /* 0x01500000 */ 33#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00200000)
36#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<24)) 34#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<23))
37 35
38#define OSIRIS_VA_CTRL4 OSIRIS_IOADDR(0x00300000) /* 0x01600000 */ 36#define OSIRIS_VA_CTRL4 OSIRIS_IOADDR(0x00300000)
39#define OSIRIS_PA_CTRL4 (OSIRIS_PA_CPLD + (3<<24)) 37#define OSIRIS_PA_CTRL4 (OSIRIS_PA_CPLD + (3<<23))
40 38
41#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 0000000000..bdd6a4f93d
--- /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 15bfc2f575..c7b90b3ecc 100644
--- a/include/asm-arm/arch-s3c2410/regs-adc.h
+++ b/include/asm-arm/arch-s3c2410/regs-adc.h
@@ -7,9 +7,6 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * S3C2410 ADC registers 9 * S3C2410 ADC registers
10 *
11 * Changelog:
12 * 27-09-2004 SAH Created file
13*/ 10*/
14 11
15#ifndef __ASM_ARCH_REGS_ADC_H 12#ifndef __ASM_ARCH_REGS_ADC_H
diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h
index 6c92faffe9..b2f4690c07 100644
--- a/include/asm-arm/arch-s3c2410/regs-clock.h
+++ b/include/asm-arm/arch-s3c2410/regs-clock.h
@@ -1,6 +1,6 @@
1/* linux/include/asm/arch-s3c2410/regs-clock.h 1/* linux/include/asm/arch-s3c2410/regs-clock.h
2 * 2 *
3 * Copyright (c) 2003,2004,2005 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/
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
@@ -8,18 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 clock register definitions 10 * S3C2410 clock register definitions
11 *
12 * Changelog:
13 * 18-Aug-2004 Ben Dooks Added 2440 definitions
14 * 08-Aug-2004 Herbert Pötzl Added CLKCON definitions
15 * 19-06-2003 Ben Dooks Created file
16 * 12-03-2004 Ben Dooks Updated include protection
17 * 29-Sep-2004 Ben Dooks Fixed usage for assembly inclusion
18 * 10-Feb-2005 Ben Dooks Fixed CAMDIVN address (Guillaume Gourat)
19 * 10-Mar-2005 Lucas Villa Real Changed S3C2410_VA to S3C24XX_VA
20 * 27-Aug-2005 Ben Dooks Add clock-slow info
21 * 20-Oct-2005 Ben Dooks Fixed overflow in PLL (Guillaume Gourat)
22 * 20-Oct-2005 Ben Dooks Add masks for DCLK (Guillaume Gourat)
23*/ 11*/
24 12
25#ifndef __ASM_ARM_REGS_CLOCK 13#ifndef __ASM_ARM_REGS_CLOCK
@@ -140,5 +128,66 @@ s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
140 128
141#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */ 129#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */
142 130
131#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
132
133#define S3C2412_OSCSET S3C2410_CLKREG(0x18)
134#define S3C2412_CLKSRC S3C2410_CLKREG(0x1C)
135
136#define S3C2412_PLLCON_OFF (1<<20)
137
138#define S3C2412_CLKDIVN_PDIVN (1<<2)
139#define S3C2412_CLKDIVN_HDIVN_MASK (3<<0)
140#define S3C2421_CLKDIVN_ARMDIVN (1<<3)
141#define S3C2412_CLKDIVN_USB48DIV (1<<6)
142#define S3C2412_CLKDIVN_UARTDIV_MASK (15<<8)
143#define S3C2412_CLKDIVN_UARTDIV_SHIFT (8)
144#define S3C2412_CLKDIVN_I2SDIV_MASK (15<<12)
145#define S3C2412_CLKDIVN_I2SDIV_SHIFT (12)
146#define S3C2412_CLKDIVN_CAMDIV_MASK (15<<16)
147#define S3C2412_CLKDIVN_CAMDIV_SHIFT (16)
148
149#define S3C2412_CLKCON_WDT (1<<28)
150#define S3C2412_CLKCON_SPI (1<<27)
151#define S3C2412_CLKCON_IIS (1<<26)
152#define S3C2412_CLKCON_IIC (1<<25)
153#define S3C2412_CLKCON_ADC (1<<24)
154#define S3C2412_CLKCON_RTC (1<<23)
155#define S3C2412_CLKCON_GPIO (1<<22)
156#define S3C2412_CLKCON_UART2 (1<<21)
157#define S3C2412_CLKCON_UART1 (1<<20)
158#define S3C2412_CLKCON_UART0 (1<<19)
159#define S3C2412_CLKCON_SDI (1<<18)
160#define S3C2412_CLKCON_PWMT (1<<17)
161#define S3C2412_CLKCON_USBD (1<<16)
162#define S3C2412_CLKCON_CAMCLK (1<<15)
163#define S3C2412_CLKCON_UARTCLK (1<<14)
164/* missing 13 */
165#define S3C2412_CLKCON_USB_HOST48 (1<<12)
166#define S3C2412_CLKCON_USB_DEV48 (1<<11)
167#define S3C2412_CLKCON_HCLKdiv2 (1<<10)
168#define S3C2412_CLKCON_HCLKx2 (1<<9)
169#define S3C2412_CLKCON_SDRAM (1<<8)
170/* missing 7 */
171#define S3C2412_CLKCON_USBH S3C2410_CLKCON_USBH
172#define S3C2412_CLKCON_LCDC S3C2410_CLKCON_LCDC
173#define S3C2412_CLKCON_NAND S3C2410_CLKCON_NAND
174#define S3C2412_CLKCON_DMA3 (1<<3)
175#define S3C2412_CLKCON_DMA2 (1<<2)
176#define S3C2412_CLKCON_DMA1 (1<<1)
177#define S3C2412_CLKCON_DMA0 (1<<0)
178
179/* clock sourec controls */
180
181#define S3C2412_CLKSRC_EXTCLKDIV_MASK (7 << 0)
182#define S3C2412_CLKSRC_EXTCLKDIV_SHIFT (0)
183#define S3C2412_CLKSRC_MDIVCLK_EXTCLKDIV (1<<3)
184#define S3C2412_CLKSRC_MSYSCLK_MPLL (1<<4)
185#define S3C2412_CLKSRC_USYSCLK_UPLL (1<<5)
186#define S3C2412_CLKSRC_UARTCLK_MPLL (1<<8)
187#define S3C2412_CLKSRC_I2SCLK_MPLL (1<<9)
188#define S3C2412_CLKSRC_USBCLK_HCLK (1<<10)
189#define S3C2412_CLKSRC_CAMCLK_HCLK (1<<11)
190
191#endif /* CONFIG_CPU_S3C2412 | CONFIG_CPU_S3C2413 */
143 192
144#endif /* __ASM_ARM_REGS_CLOCK */ 193#endif /* __ASM_ARM_REGS_CLOCK */
diff --git a/include/asm-arm/arch-s3c2410/regs-dsc.h b/include/asm-arm/arch-s3c2410/regs-dsc.h
index ba13a2c9e5..a0a1248751 100644
--- a/include/asm-arm/arch-s3c2410/regs-dsc.h
+++ b/include/asm-arm/arch-s3c2410/regs-dsc.h
@@ -7,18 +7,19 @@
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 * S3C2440 Signal Drive Strength Control 10 * S3C2440/S3C2412 Signal Drive Strength Control
11 *
12 * Changelog:
13 * 11-Aug-2004 BJD Created file
14 * 25-Aug-2004 BJD Added the _SELECT_* defs for using with functions
15*/ 11*/
16 12
17 13
18#ifndef __ASM_ARCH_REGS_DSC_H 14#ifndef __ASM_ARCH_REGS_DSC_H
19#define __ASM_ARCH_REGS_DSC_H "2440-dsc" 15#define __ASM_ARCH_REGS_DSC_H "2440-dsc"
20 16
21#ifdef CONFIG_CPU_S3C2440 17#if defined(CONFIG_CPU_S3C2412)
18#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)
19#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)
20#endif
21
22#if defined(CONFIG_CPU_S3C2440)
22 23
23#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4) 24#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4)
24#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8) 25#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8)
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index 5f10334f06..93c49432db 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -8,21 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 GPIO register definitions 10 * S3C2410 GPIO register definitions
11 *
12 * Changelog:
13 * 19-06-2003 BJD Created file
14 * 23-06-2003 BJD Updated GSTATUS registers
15 * 12-03-2004 BJD Updated include protection
16 * 20-07-2004 BJD Added GPIO pin numbers, added Port A definitions
17 * 04-10-2004 BJD Fixed number of bugs, added EXT IRQ filter defs
18 * 17-10-2004 BJD Added GSTATUS1 register definitions
19 * 18-11-2004 BJD Fixed definitions of GPE3, GPE4, GPE5 and GPE6
20 * 18-11-2004 BJD Added S3C2440 AC97 controls
21 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
22 * 28-Mar-2005 LCVR Fixed definition of GPB10
23 * 26-Oct-2005 BJD Added generic configuration types
24 * 27-Nov-2005 LCVR Added definitions to S3C2400 registers
25 * 15-Jan-2006 LCVR Written S3C24XX_GPIO_BASE() macro
26*/ 11*/
27 12
28 13
@@ -45,7 +30,7 @@
45#define S3C24XX_MISCCR S3C2400_MISCCR 30#define S3C24XX_MISCCR S3C2400_MISCCR
46#else 31#else
47#define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x) 32#define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x)
48#define S3C24XX_MISCCR S3C2410_MISCCR 33#define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80)
49#endif /* CONFIG_CPU_S3C2400 */ 34#endif /* CONFIG_CPU_S3C2400 */
50 35
51 36
@@ -73,9 +58,15 @@
73#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */ 58#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */
74#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */ 59#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */
75 60
76/* configure GPIO ports A..G */ 61/* register address for the GPIO registers.
62 * S3C24XX_GPIOREG2 is for the second set of registers in the
63 * GPIO which move between s3c2410 and s3c2412 type systems */
77 64
78#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO) 65#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
66#define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2)
67
68
69/* configure GPIO ports A..G */
79 70
80/* port A - S3C2410: 22bits, zero in bit X makes pin X output 71/* port A - S3C2410: 22bits, zero in bit X makes pin X output
81 * S3C2400: 18bits, zero in bit X makes pin X output 72 * S3C2400: 18bits, zero in bit X makes pin X output
@@ -953,11 +944,18 @@
953#define S3C2410_GPH10_OUTP (0x01 << 20) 944#define S3C2410_GPH10_OUTP (0x01 << 20)
954#define S3C2410_GPH10_CLKOUT1 (0x02 << 20) 945#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
955 946
947/* The S3C2412 and S3C2413 move the GPJ register set to after
948 * GPH, which means all registers after 0x80 are now offset by 0x10
949 * for the 2412/2413 from the 2410/2440/2442
950*/
951
956/* miscellaneous control */ 952/* miscellaneous control */
957#define S3C2400_MISCCR S3C2410_GPIOREG(0x54) 953#define S3C2400_MISCCR S3C2410_GPIOREG(0x54)
958#define S3C2410_MISCCR S3C2410_GPIOREG(0x80) 954#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
959#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84) 955#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
960 956
957#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
958
961/* see clock.h for dclk definitions */ 959/* see clock.h for dclk definitions */
962 960
963/* pullup control on databus */ 961/* pullup control on databus */
@@ -985,6 +983,8 @@
985#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4) 983#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4)
986#define S3C2410_MISCCR_CLK0_MASK (7<<4) 984#define S3C2410_MISCCR_CLK0_MASK (7<<4)
987 985
986#define S3C2412_MISCCR_CLK0_RTC (2<<4)
987
988#define S3C2410_MISCCR_CLK1_MPLL (0<<8) 988#define S3C2410_MISCCR_CLK1_MPLL (0<<8)
989#define S3C2410_MISCCR_CLK1_UPLL (1<<8) 989#define S3C2410_MISCCR_CLK1_UPLL (1<<8)
990#define S3C2410_MISCCR_CLK1_FCLK (2<<8) 990#define S3C2410_MISCCR_CLK1_FCLK (2<<8)
@@ -993,6 +993,8 @@
993#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8) 993#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8)
994#define S3C2410_MISCCR_CLK1_MASK (7<<8) 994#define S3C2410_MISCCR_CLK1_MASK (7<<8)
995 995
996#define S3C2412_MISCCR_CLK1_CLKsrc (0<<8)
997
996#define S3C2410_MISCCR_USBSUSPND0 (1<<12) 998#define S3C2410_MISCCR_USBSUSPND0 (1<<12)
997#define S3C2410_MISCCR_USBSUSPND1 (1<<13) 999#define S3C2410_MISCCR_USBSUSPND1 (1<<13)
998 1000
@@ -1000,7 +1002,7 @@
1000 1002
1001#define S3C2410_MISCCR_nEN_SCLK0 (1<<17) 1003#define S3C2410_MISCCR_nEN_SCLK0 (1<<17)
1002#define S3C2410_MISCCR_nEN_SCLK1 (1<<18) 1004#define S3C2410_MISCCR_nEN_SCLK1 (1<<18)
1003#define S3C2410_MISCCR_nEN_SCLKE (1<<19) 1005#define S3C2410_MISCCR_nEN_SCLKE (1<<19) /* not 2412 */
1004#define S3C2410_MISCCR_SDSLEEP (7<<17) 1006#define S3C2410_MISCCR_SDSLEEP (7<<17)
1005 1007
1006/* external interrupt control... */ 1008/* external interrupt control... */
@@ -1017,6 +1019,10 @@
1017#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C) 1019#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C)
1018#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90) 1020#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90)
1019 1021
1022#define S3C24XX_EXTINT0 S3C24XX_GPIOREG2(0x88)
1023#define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C)
1024#define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90)
1025
1020/* values for S3C2410_EXTINT0/1/2 */ 1026/* values for S3C2410_EXTINT0/1/2 */
1021#define S3C2410_EXTINT_LOWLEV (0x00) 1027#define S3C2410_EXTINT_LOWLEV (0x00)
1022#define S3C2410_EXTINT_HILEV (0x01) 1028#define S3C2410_EXTINT_HILEV (0x01)
@@ -1030,6 +1036,11 @@
1030#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C) 1036#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C)
1031#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0) 1037#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0)
1032 1038
1039#define S3C24XX_EINFLT0 S3C24XX_GPIOREG2(0x94)
1040#define S3C24XX_EINFLT1 S3C24XX_GPIOREG2(0x98)
1041#define S3C24XX_EINFLT2 S3C24XX_GPIOREG2(0x9C)
1042#define S3C24XX_EINFLT3 S3C24XX_GPIOREG2(0xA0)
1043
1033/* values for interrupt filtering */ 1044/* values for interrupt filtering */
1034#define S3C2410_EINTFLT_PCLK (0x00) 1045#define S3C2410_EINTFLT_PCLK (0x00)
1035#define S3C2410_EINTFLT_EXTCLK (1<<7) 1046#define S3C2410_EINTFLT_EXTCLK (1<<7)
@@ -1039,6 +1050,7 @@
1039 1050
1040/* GSTATUS have miscellaneous information in them 1051/* GSTATUS have miscellaneous information in them
1041 * 1052 *
1053 * These move between s3c2410 and s3c2412 style systems.
1042 */ 1054 */
1043 1055
1044#define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC) 1056#define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC)
@@ -1047,6 +1059,18 @@
1047#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8) 1059#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8)
1048#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC) 1060#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC)
1049 1061
1062#define S3C2412_GSTATUS0 S3C2410_GPIOREG(0x0BC)
1063#define S3C2412_GSTATUS1 S3C2410_GPIOREG(0x0C0)
1064#define S3C2412_GSTATUS2 S3C2410_GPIOREG(0x0C4)
1065#define S3C2412_GSTATUS3 S3C2410_GPIOREG(0x0C8)
1066#define S3C2412_GSTATUS4 S3C2410_GPIOREG(0x0CC)
1067
1068#define S3C24XX_GSTATUS0 S3C24XX_GPIOREG2(0x0AC)
1069#define S3C24XX_GSTATUS1 S3C24XX_GPIOREG2(0x0B0)
1070#define S3C24XX_GSTATUS2 S3C24XX_GPIOREG2(0x0B4)
1071#define S3C24XX_GSTATUS3 S3C24XX_GPIOREG2(0x0B8)
1072#define S3C24XX_GSTATUS4 S3C24XX_GPIOREG2(0x0BC)
1073
1050#define S3C2410_GSTATUS0_nWAIT (1<<3) 1074#define S3C2410_GSTATUS0_nWAIT (1<<3)
1051#define S3C2410_GSTATUS0_NCON (1<<2) 1075#define S3C2410_GSTATUS0_NCON (1<<2)
1052#define S3C2410_GSTATUS0_RnB (1<<1) 1076#define S3C2410_GSTATUS0_RnB (1<<1)
@@ -1054,6 +1078,7 @@
1054 1078
1055#define S3C2410_GSTATUS1_IDMASK (0xffff0000) 1079#define S3C2410_GSTATUS1_IDMASK (0xffff0000)
1056#define S3C2410_GSTATUS1_2410 (0x32410000) 1080#define S3C2410_GSTATUS1_2410 (0x32410000)
1081#define S3C2410_GSTATUS1_2412 (0x32412001)
1057#define S3C2410_GSTATUS1_2440 (0x32440000) 1082#define S3C2410_GSTATUS1_2440 (0x32440000)
1058#define S3C2410_GSTATUS1_2442 (0x32440aaa) 1083#define S3C2410_GSTATUS1_2442 (0x32440aaa)
1059 1084
@@ -1077,5 +1102,22 @@
1077#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5) 1102#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5)
1078#define S3C2400_OPENCR_OPC_MOSIEN (1<<5) 1103#define S3C2400_OPENCR_OPC_MOSIEN (1<<5)
1079 1104
1105/* 2412/2413 sleep configuration registers */
1106
1107#define S3C2412_GPBSLPCON S3C2410_GPIOREG(0x1C)
1108#define S3C2412_GPCSLPCON S3C2410_GPIOREG(0x2C)
1109#define S3C2412_GPDSLPCON S3C2410_GPIOREG(0x3C)
1110#define S3C2412_GPESLPCON S3C2410_GPIOREG(0x4C)
1111#define S3C2412_GPFSLPCON S3C2410_GPIOREG(0x5C)
1112#define S3C2412_GPGSLPCON S3C2410_GPIOREG(0x6C)
1113#define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C)
1114
1115/* definitions for each pin bit */
1116#define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2))
1117#define S3C2412_SLPCON_HI(x) ( 0x01 << ((x) * 2))
1118#define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2))
1119#define S3C2412_SLPCON_PDWN(x) ( 0x03 << ((x) * 2))
1120#define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2))
1121
1080#endif /* __ASM_ARCH_REGS_GPIO_H */ 1122#endif /* __ASM_ARCH_REGS_GPIO_H */
1081 1123
diff --git a/include/asm-arm/arch-s3c2410/regs-gpioj.h b/include/asm-arm/arch-s3c2410/regs-gpioj.h
index 3ad2324acc..91cefa2604 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpioj.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpioj.h
@@ -8,10 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2440 GPIO J register definitions 10 * S3C2440 GPIO J register definitions
11 *
12 * Changelog:
13 * 11-Aug-2004 BJD Created file
14 * 10-Feb-2005 BJD Fix GPJ12 definition (Guillaume Gourat)
15*/ 11*/
16 12
17 13
@@ -32,6 +28,11 @@
32#define S3C2440_GPJDAT S3C2410_GPIOREG(0xd4) 28#define S3C2440_GPJDAT S3C2410_GPIOREG(0xd4)
33#define S3C2440_GPJUP S3C2410_GPIOREG(0xd8) 29#define S3C2440_GPJUP S3C2410_GPIOREG(0xd8)
34 30
31#define S3C2413_GPJCON S3C2410_GPIOREG(0x80)
32#define S3C2413_GPJDAT S3C2410_GPIOREG(0x84)
33#define S3C2413_GPJUP S3C2410_GPIOREG(0x88)
34#define S3C2413_GPJSLPCON S3C2410_GPIOREG(0x8C)
35
35#define S3C2440_GPJ0 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 0) 36#define S3C2440_GPJ0 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 0)
36#define S3C2440_GPJ0_INP (0x00 << 0) 37#define S3C2440_GPJ0_INP (0x00 << 0)
37#define S3C2440_GPJ0_OUTP (0x01 << 0) 38#define S3C2440_GPJ0_OUTP (0x01 << 0)
diff --git a/include/asm-arm/arch-s3c2410/regs-iic.h b/include/asm-arm/arch-s3c2410/regs-iic.h
index fed3288e20..2ae29522f2 100644
--- a/include/asm-arm/arch-s3c2410/regs-iic.h
+++ b/include/asm-arm/arch-s3c2410/regs-iic.h
@@ -8,10 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 I2C Controller 10 * S3C2410 I2C Controller
11 *
12 * Changelog:
13 * 03-Oct-2004 BJD Initial include for Linux
14 * 08-Nov-2004 BJD Added S3C2440 filter register
15*/ 11*/
16 12
17#ifndef __ASM_ARCH_REGS_IIC_H 13#ifndef __ASM_ARCH_REGS_IIC_H
diff --git a/include/asm-arm/arch-s3c2410/regs-iis.h b/include/asm-arm/arch-s3c2410/regs-iis.h
index 7fdde9b91c..72cd250982 100644
--- a/include/asm-arm/arch-s3c2410/regs-iis.h
+++ b/include/asm-arm/arch-s3c2410/regs-iis.h
@@ -8,17 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 IIS register definition 10 * S3C2410 IIS register definition
11 * 11*/
12 * Changelog:
13 * 19-06-2003 BJD Created file
14 * 26-06-2003 BJD Finished off definitions for register addresses
15 * 12-03-2004 BJD Updated include protection
16 * 07-03-2005 BJD Added FIFO size flags and S3C2440 MPLL
17 * 05-04-2005 LCVR Added IISFCON definitions for the S3C2400
18 * 18-07-2005 DA Change IISCON_MPLL to IISMOD_MPLL
19 * Correct IISMOD_256FS and IISMOD_384FS
20 * Add IISCON_PSCEN
21 */
22 12
23#ifndef __ASM_ARCH_REGS_IIS_H 13#ifndef __ASM_ARCH_REGS_IIS_H
24#define __ASM_ARCH_REGS_IIS_H 14#define __ASM_ARCH_REGS_IIS_H
diff --git a/include/asm-arm/arch-s3c2410/regs-irq.h b/include/asm-arm/arch-s3c2410/regs-irq.h
index 24b7292df7..29fb8ef670 100644
--- a/include/asm-arm/arch-s3c2410/regs-irq.h
+++ b/include/asm-arm/arch-s3c2410/regs-irq.h
@@ -6,14 +6,7 @@
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 *
11 *
12 * Changelog:
13 * 19-06-2003 BJD Created file
14 * 12-03-2004 BJD Updated include protection
15 * 10-03-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
16 */
17 10
18 11
19#ifndef ___ASM_ARCH_REGS_IRQ_H 12#ifndef ___ASM_ARCH_REGS_IRQ_H
@@ -23,6 +16,7 @@
23 16
24#define S3C2410_IRQREG(x) ((x) + S3C24XX_VA_IRQ) 17#define S3C2410_IRQREG(x) ((x) + S3C24XX_VA_IRQ)
25#define S3C2410_EINTREG(x) ((x) + S3C24XX_VA_GPIO) 18#define S3C2410_EINTREG(x) ((x) + S3C24XX_VA_GPIO)
19#define S3C24XX_EINTREG(x) ((x) + S3C24XX_VA_GPIO2)
26 20
27#define S3C2410_SRCPND S3C2410_IRQREG(0x000) 21#define S3C2410_SRCPND S3C2410_IRQREG(0x000)
28#define S3C2410_INTMOD S3C2410_IRQREG(0x004) 22#define S3C2410_INTMOD S3C2410_IRQREG(0x004)
@@ -40,5 +34,10 @@
40 34
41#define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4) 35#define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4)
42#define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8) 36#define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8)
37#define S3C2412_EINTMASK S3C2410_EINTREG(0x0B4)
38#define S3C2412_EINTPEND S3C2410_EINTREG(0X0B8)
39
40#define S3C24XX_EINTMASK S3C24XX_EINTREG(0x0A4)
41#define S3C24XX_EINTPEND S3C24XX_EINTREG(0X0A8)
43 42
44#endif /* ___ASM_ARCH_REGS_IRQ_H */ 43#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-lcd.h b/include/asm-arm/arch-s3c2410/regs-lcd.h
index b6b1b4e8bb..6d7881c8cf 100644
--- a/include/asm-arm/arch-s3c2410/regs-lcd.h
+++ b/include/asm-arm/arch-s3c2410/regs-lcd.h
@@ -6,14 +6,6 @@
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 *
10 *
11 *
12 * Changelog:
13 * 12-06-2003 BJD Created file
14 * 26-06-2003 BJD Updated LCDCON register definitions
15 * 12-03-2004 BJD Updated include protection
16 * 10-03-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
17*/ 9*/
18 10
19 11
@@ -71,6 +63,8 @@
71#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F) 63#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
72#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF) 64#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF)
73 65
66/* LDCCON4 changes for STN mode on the S3C2412 */
67
74#define S3C2410_LCDCON4_MVAL(x) ((x) << 8) 68#define S3C2410_LCDCON4_MVAL(x) ((x) << 8)
75#define S3C2410_LCDCON4_HSPW(x) ((x) << 0) 69#define S3C2410_LCDCON4_HSPW(x) ((x) << 0)
76#define S3C2410_LCDCON4_WLH(x) ((x) << 0) 70#define S3C2410_LCDCON4_WLH(x) ((x) << 0)
@@ -121,10 +115,38 @@
121#define S3C2410_LCDINT_FRSYNC (1<<1) 115#define S3C2410_LCDINT_FRSYNC (1<<1)
122#define S3C2410_LCDINT_FICNT (1<<0) 116#define S3C2410_LCDINT_FICNT (1<<0)
123 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
124#define S3C2410_LPCSEL S3C2410_LCDREG(0x60) 125#define S3C2410_LPCSEL S3C2410_LCDREG(0x60)
125 126
126#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) 127#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4))
127 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
128#endif /* ___ASM_ARCH_REGS_LCD_H */ 150#endif /* ___ASM_ARCH_REGS_LCD_H */
129 151
130 152
diff --git a/include/asm-arm/arch-s3c2410/regs-mem.h b/include/asm-arm/arch-s3c2410/regs-mem.h
index a2d7d0cec0..375dca5036 100644
--- a/include/asm-arm/arch-s3c2410/regs-mem.h
+++ b/include/asm-arm/arch-s3c2410/regs-mem.h
@@ -8,12 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 Memory Control register definitions 10 * S3C2410 Memory Control register definitions
11 *
12 * Changelog:
13 * 29-Sep-2004 BJD Initial include for Linux
14 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
15 * 04-Apr-2005 LCVR Added S3C2400 DRAM/BANKSIZE_MASK definitions
16 *
17*/ 11*/
18 12
19#ifndef __ASM_ARM_MEMREGS_H 13#ifndef __ASM_ARM_MEMREGS_H
diff --git a/include/asm-arm/arch-s3c2410/regs-nand.h b/include/asm-arm/arch-s3c2410/regs-nand.h
index 7cff235e66..b824d371ae 100644
--- a/include/asm-arm/arch-s3c2410/regs-nand.h
+++ b/include/asm-arm/arch-s3c2410/regs-nand.h
@@ -8,10 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 NAND register definitions 10 * S3C2410 NAND register definitions
11 *
12 * Changelog:
13 * 18-Aug-2004 BJD Copied file from 2.4 and updated
14 * 01-May-2005 BJD Added definitions for s3c2440 controller
15*/ 11*/
16 12
17#ifndef __ASM_ARM_REGS_NAND 13#ifndef __ASM_ARM_REGS_NAND
@@ -39,10 +35,19 @@
39#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28) 35#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28)
40#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C) 36#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C)
41#define S3C2440_NFMECC1 S3C2410_NFREG(0x30) 37#define S3C2440_NFMECC1 S3C2410_NFREG(0x30)
42#define S3C2440_NFSECC S3C2410_NFREG(0x34) 38#define S3C2440_NFSECC S3C24E10_NFREG(0x34)
43#define S3C2440_NFSBLK S3C2410_NFREG(0x38) 39#define S3C2440_NFSBLK S3C2410_NFREG(0x38)
44#define S3C2440_NFEBLK S3C2410_NFREG(0x3C) 40#define S3C2440_NFEBLK S3C2410_NFREG(0x3C)
45 41
42#define S3C2412_NFSBLK S3C2410_NFREG(0x20)
43#define S3C2412_NFEBLK S3C2410_NFREG(0x24)
44#define S3C2412_NFSTAT S3C2410_NFREG(0x28)
45#define S3C2412_NFMECC_ERR0 S3C2410_NFREG(0x2C)
46#define S3C2412_NFMECC_ERR1 S3C2410_NFREG(0x30)
47#define S3C2412_NFMECC0 S3C2410_NFREG(0x34)
48#define S3C2412_NFMECC1 S3C2410_NFREG(0x38)
49#define S3C2412_NFSECC S3C2410_NFREG(0x3C)
50
46#define S3C2410_NFCONF_EN (1<<15) 51#define S3C2410_NFCONF_EN (1<<15)
47#define S3C2410_NFCONF_512BYTE (1<<14) 52#define S3C2410_NFCONF_512BYTE (1<<14)
48#define S3C2410_NFCONF_4STEP (1<<13) 53#define S3C2410_NFCONF_4STEP (1<<13)
@@ -77,5 +82,42 @@
77#define S3C2440_NFSTAT_RnB_CHANGE (1<<2) 82#define S3C2440_NFSTAT_RnB_CHANGE (1<<2)
78#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3) 83#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3)
79 84
85#define S3C2412_NFCONF_NANDBOOT (1<<31)
86#define S3C2412_NFCONF_ECCCLKCON (1<<30)
87#define S3C2412_NFCONF_ECC_MLC (1<<24)
88#define S3C2412_NFCONF_TACLS_MASK (7<<12) /* 1 extra bit of Tacls */
89
90#define S3C2412_NFCONT_ECC4_DIRWR (1<<18)
91#define S3C2412_NFCONT_LOCKTIGHT (1<<17)
92#define S3C2412_NFCONT_SOFTLOCK (1<<16)
93#define S3C2412_NFCONT_ECC4_ENCINT (1<<13)
94#define S3C2412_NFCONT_ECC4_DECINT (1<<12)
95#define S3C2412_NFCONT_MAIN_ECC_LOCK (1<<7)
96#define S3C2412_NFCONT_INIT_MAIN_ECC (1<<5)
97#define S3C2412_NFCONT_nFCE1 (1<<2)
98#define S3C2412_NFCONT_nFCE0 (1<<1)
99
100#define S3C2412_NFSTAT_ECC_ENCDONE (1<<7)
101#define S3C2412_NFSTAT_ECC_DECDONE (1<<6)
102#define S3C2412_NFSTAT_ILLEGAL_ACCESS (1<<5)
103#define S3C2412_NFSTAT_RnB_CHANGE (1<<4)
104#define S3C2412_NFSTAT_nFCE1 (1<<3)
105#define S3C2412_NFSTAT_nFCE0 (1<<2)
106#define S3C2412_NFSTAT_Res1 (1<<1)
107#define S3C2412_NFSTAT_READY (1<<0)
108
109#define S3C2412_NFECCERR_SERRDATA(x) (((x) >> 21) & 0xf)
110#define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7)
111#define S3C2412_NFECCERR_MERRDATA(x) (((x) >> 7) & 0x3ff)
112#define S3C2412_NFECCERR_MERRBIT(x) (((x) >> 4) & 0x7)
113#define S3C2412_NFECCERR_SPARE_ERR(x) (((x) >> 2) & 0x3)
114#define S3C2412_NFECCERR_MAIN_ERR(x) (((x) >> 2) & 0x3)
115#define S3C2412_NFECCERR_NONE (0)
116#define S3C2412_NFECCERR_1BIT (1)
117#define S3C2412_NFECCERR_MULTIBIT (2)
118#define S3C2412_NFECCERR_ECCAREA (3)
119
120
121
80#endif /* __ASM_ARM_REGS_NAND */ 122#endif /* __ASM_ARM_REGS_NAND */
81 123
diff --git a/include/asm-arm/arch-s3c2410/regs-power.h b/include/asm-arm/arch-s3c2410/regs-power.h
new file mode 100644
index 0000000000..6c319ea2af
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/regs-power.h
@@ -0,0 +1,34 @@
1/* linux/include/asm/arch-s3c2410/regs-power.h
2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C24XX power control register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_PWR
14#define __ASM_ARM_REGS_PWR __FILE__
15
16#define S3C24XX_PWRREG(x) ((x) + S3C24XX_VA_CLKPWR)
17
18#define S3C2412_PWRMODECON S3C24XX_PWRREG(0x20)
19#define S3C2412_PWRCFG S3C24XX_PWRREG(0x24)
20
21#define S3C2412_PWRCFG_BATF_IGNORE (0<<0)
22#define S3C2412_PWRCFG_BATF_SLEEP (3<<0)
23#define S3C2412_PWRCFG_BATF_MASK (3<<0)
24
25#define S3C2412_PWRCFG_STANDBYWFI_IGNORE (0<<6)
26#define S3C2412_PWRCFG_STANDBYWFI_IDLE (1<<6)
27#define S3C2412_PWRCFG_STANDBYWFI_STOP (2<<6)
28#define S3C2412_PWRCFG_STANDBYWFI_SLEEP (3<<6)
29#define S3C2412_PWRCFG_STANDBYWFI_MASK (3<<6)
30
31#define S3C2412_PWRCFG_RTC_MASKIRQ (1<<8)
32#define S3C2412_PWRCFG_NAND_NORST (1<<9)
33
34#endif /* __ASM_ARM_REGS_PWR */
diff --git a/include/asm-arm/arch-s3c2410/regs-rtc.h b/include/asm-arm/arch-s3c2410/regs-rtc.h
index 228983f89b..cd88fd634d 100644
--- a/include/asm-arm/arch-s3c2410/regs-rtc.h
+++ b/include/asm-arm/arch-s3c2410/regs-rtc.h
@@ -8,17 +8,12 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 Internal RTC register definition 10 * S3C2410 Internal RTC register definition
11 *
12 * Changelog:
13 * 19-06-2003 BJD Created file
14 * 12-03-2004 BJD Updated include protection
15 * 15-01-2005 LCVR Changed S3C2410_VA to S3C24XX_VA (s3c2400 support)
16*/ 11*/
17 12
18#ifndef __ASM_ARCH_REGS_RTC_H 13#ifndef __ASM_ARCH_REGS_RTC_H
19#define __ASM_ARCH_REGS_RTC_H __FILE__ 14#define __ASM_ARCH_REGS_RTC_H __FILE__
20 15
21#define S3C2410_RTCREG(x) ((x) + S3C24XX_VA_RTC) 16#define S3C2410_RTCREG(x) (x)
22 17
23#define S3C2410_RTCCON S3C2410_RTCREG(0x40) 18#define S3C2410_RTCCON S3C2410_RTCREG(0x40)
24#define S3C2410_RTCCON_RTCEN (1<<0) 19#define S3C2410_RTCCON_RTCEN (1<<0)
diff --git a/include/asm-arm/arch-s3c2410/regs-sdi.h b/include/asm-arm/arch-s3c2410/regs-sdi.h
index ca9a26fbec..06e716e5b4 100644
--- a/include/asm-arm/arch-s3c2410/regs-sdi.h
+++ b/include/asm-arm/arch-s3c2410/regs-sdi.h
@@ -8,11 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 MMC/SDIO register definitions 10 * S3C2410 MMC/SDIO register definitions
11 *
12 * Changelog:
13 * 18-Aug-2004 Ben Dooks Created initial file
14 * 29-Nov-2004 Koen Martens Added some missing defines, fixed duplicates
15 * 29-Nov-2004 Ben Dooks Updated Koen's patch
16*/ 11*/
17 12
18#ifndef __ASM_ARM_REGS_SDI 13#ifndef __ASM_ARM_REGS_SDI
diff --git a/include/asm-arm/arch-s3c2410/regs-serial.h b/include/asm-arm/arch-s3c2410/regs-serial.h
index 83b01254c4..19c77da9c3 100644
--- a/include/asm-arm/arch-s3c2410/regs-serial.h
+++ b/include/asm-arm/arch-s3c2410/regs-serial.h
@@ -27,10 +27,7 @@
27 * You should have received a copy of the GNU General Public License 27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software 28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 * 30*/
31 * Modifications:
32 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA (s3c2400 support)
33 */
34 31
35#ifndef __ASM_ARM_REGS_SERIAL_H 32#ifndef __ASM_ARM_REGS_SERIAL_H
36#define __ASM_ARM_REGS_SERIAL_H 33#define __ASM_ARM_REGS_SERIAL_H
@@ -82,6 +79,12 @@
82#define S3C2440_UCON2_DIVMASK (7 << 12) 79#define S3C2440_UCON2_DIVMASK (7 << 12)
83#define S3C2440_UCON_DIVSHIFT (12) 80#define S3C2440_UCON_DIVSHIFT (12)
84 81
82#define S3C2412_UCON_CLKMASK (3<<10)
83#define S3C2412_UCON_UCLK (1<<10)
84#define S3C2412_UCON_USYSCLK (3<<10)
85#define S3C2412_UCON_PCLK (0<<10)
86#define S3C2412_UCON_PCLK2 (2<<10)
87
85#define S3C2410_UCON_UCLK (1<<10) 88#define S3C2410_UCON_UCLK (1<<10)
86#define S3C2410_UCON_SBREAK (1<<4) 89#define S3C2410_UCON_SBREAK (1<<4)
87 90
@@ -124,6 +127,15 @@
124#define S3C2410_UMCOM_AFC (1<<4) 127#define S3C2410_UMCOM_AFC (1<<4)
125#define S3C2410_UMCOM_RTS_LOW (1<<0) 128#define S3C2410_UMCOM_RTS_LOW (1<<0)
126 129
130#define S3C2412_UMCON_AFC_63 (0<<5)
131#define S3C2412_UMCON_AFC_56 (1<<5)
132#define S3C2412_UMCON_AFC_48 (2<<5)
133#define S3C2412_UMCON_AFC_40 (3<<5)
134#define S3C2412_UMCON_AFC_32 (4<<5)
135#define S3C2412_UMCON_AFC_24 (5<<5)
136#define S3C2412_UMCON_AFC_16 (6<<5)
137#define S3C2412_UMCON_AFC_8 (7<<5)
138
127#define S3C2410_UFSTAT_TXFULL (1<<9) 139#define S3C2410_UFSTAT_TXFULL (1<<9)
128#define S3C2410_UFSTAT_RXFULL (1<<8) 140#define S3C2410_UFSTAT_RXFULL (1<<8)
129#define S3C2410_UFSTAT_TXMASK (15<<4) 141#define S3C2410_UFSTAT_TXMASK (15<<4)
diff --git a/include/asm-arm/arch-s3c2410/regs-spi.h b/include/asm-arm/arch-s3c2410/regs-spi.h
index 338217858c..3552280d1e 100644
--- a/include/asm-arm/arch-s3c2410/regs-spi.h
+++ b/include/asm-arm/arch-s3c2410/regs-spi.h
@@ -7,13 +7,7 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * S3C2410 SPI register definition 9 * S3C2410 SPI register definition
10 * 10*/
11 * Changelog:
12 * 20-04-2004 KF Created file
13 * 04-10-2004 BJD Removed VA address (no longer mapped)
14 * tidied file for submission
15 * 03-04-2005 LCVR Added S3C2400_SPPIN_nCS definition
16 */
17 11
18#ifndef __ASM_ARCH_REGS_SPI_H 12#ifndef __ASM_ARCH_REGS_SPI_H
19#define __ASM_ARCH_REGS_SPI_H 13#define __ASM_ARCH_REGS_SPI_H
diff --git a/include/asm-arm/arch-s3c2410/regs-timer.h b/include/asm-arm/arch-s3c2410/regs-timer.h
index 169064e275..731918e778 100644
--- a/include/asm-arm/arch-s3c2410/regs-timer.h
+++ b/include/asm-arm/arch-s3c2410/regs-timer.h
@@ -8,13 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 Timer configuration 10 * S3C2410 Timer configuration
11 *
12 * Changelog:
13 * 05-06-2003 BJD Created file
14 * 26-06-2003 BJD Added more timer definitions to mux / control
15 * 12-03-2004 BJD Updated include protection
16 * 10-02-2005 BJD Added S3C2410_TCFG1_MUX4_SHIFT (Guillaume Gourat)
17 * 10-03-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
18*/ 11*/
19 12
20 13
diff --git a/include/asm-arm/arch-s3c2410/regs-udc.h b/include/asm-arm/arch-s3c2410/regs-udc.h
index bf315b7632..3aa31a27da 100644
--- a/include/asm-arm/arch-s3c2410/regs-udc.h
+++ b/include/asm-arm/arch-s3c2410/regs-udc.h
@@ -6,13 +6,7 @@
6 * modify it under the terms of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of 7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version. 8 * the License, or (at your option) any later version.
9 * 9*/
10 * Changelog:
11 * 01-08-2004 Initial creation
12 * 12-09-2004 Cleanup for submission
13 * 24-10-2004 Fixed S3C2410_UDC_MAXP_REG definition
14 * 10-03-2005 Changed S3C2410_VA to S3C24XX_VA
15 */
16 10
17#ifndef __ASM_ARCH_REGS_UDC_H 11#ifndef __ASM_ARCH_REGS_UDC_H
18#define __ASM_ARCH_REGS_UDC_H 12#define __ASM_ARCH_REGS_UDC_H
diff --git a/include/asm-arm/arch-s3c2410/regs-watchdog.h b/include/asm-arm/arch-s3c2410/regs-watchdog.h
index d199ca6aff..f4fff448c7 100644
--- a/include/asm-arm/arch-s3c2410/regs-watchdog.h
+++ b/include/asm-arm/arch-s3c2410/regs-watchdog.h
@@ -1,4 +1,4 @@
1/* linux/include/asm/arch-s3c2410/regs0watchdog.h 1/* linux/include/asm/arch-s3c2410/regs-watchdog.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/
@@ -8,11 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2410 Watchdog timer control 10 * S3C2410 Watchdog timer control
11 *
12 * Changelog:
13 * 21-06-2003 BJD Created file
14 * 12-03-2004 BJD Updated include protection
15 * 10-03-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
16*/ 11*/
17 12
18 13
diff --git a/include/asm-arm/arch-s3c2410/system.h b/include/asm-arm/arch-s3c2410/system.h
index 9b0d85024c..718246d859 100644
--- a/include/asm-arm/arch-s3c2410/system.h
+++ b/include/asm-arm/arch-s3c2410/system.h
@@ -8,14 +8,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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11*/
12 * Changelog:
13 * 12-May-2003 BJD Created file
14 * 14-May-2003 BJD Removed idle to aid debugging
15 * 12-Jun-2003 BJD Added reset via watchdog
16 * 04-Sep-2003 BJD Moved to v2.6
17 * 28-Oct-2004 BJD Added over-ride for idle, and fixed reset panic()
18 */
19 12
20#include <asm/hardware.h> 13#include <asm/hardware.h>
21#include <asm/io.h> 14#include <asm/io.h>
diff --git a/include/asm-arm/arch-s3c2410/timex.h b/include/asm-arm/arch-s3c2410/timex.h
index 3558a3a750..703c337c56 100644
--- a/include/asm-arm/arch-s3c2410/timex.h
+++ b/include/asm-arm/arch-s3c2410/timex.h
@@ -8,12 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 02-Sep-2003 BJD Created file
14 * 05-Jan-2004 BJD Updated for Linux 2.6.0
15 * 22-Nov-2004 BJD Fixed CLOCK_TICK_RATE
16 * 10-Jan-2004 BJD Removed s3c2410_clock_tick_rate
17*/ 11*/
18 12
19#ifndef __ASM_ARCH_TIMEX_H 13#ifndef __ASM_ARCH_TIMEX_H
diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h
index 8e152a05e5..81b3e91c56 100644
--- a/include/asm-arm/arch-s3c2410/uncompress.h
+++ b/include/asm-arm/arch-s3c2410/uncompress.h
@@ -8,15 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 22-May-2003 BJD Created
14 * 08-Sep-2003 BJD Moved to linux v2.6
15 * 12-Mar-2004 BJD Updated header protection
16 * 12-Oct-2004 BJD Take account of debug uart configuration
17 * 15-Nov-2004 BJD Fixed uart configuration
18 * 22-Feb-2005 BJD Added watchdog to uncompress
19 * 04-Apr-2005 LCVR Added support to S3C2400 (no cpuid at GSTATUS1)
20*/ 11*/
21 12
22#ifndef __ASM_ARCH_UNCOMPRESS_H 13#ifndef __ASM_ARCH_UNCOMPRESS_H
diff --git a/include/asm-arm/arch-s3c2410/usb-control.h b/include/asm-arm/arch-s3c2410/usb-control.h
index bd43b566db..35723569a1 100644
--- a/include/asm-arm/arch-s3c2410/usb-control.h
+++ b/include/asm-arm/arch-s3c2410/usb-control.h
@@ -8,11 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 11-Sep-2004 BJD Created file
14 * 21-Sep-2004 BJD Updated port info
15 * 09-Aug-2005 BJD Renamed s3c2410_report_oc s3c2410_usb_report_oc
16*/ 11*/
17 12
18#ifndef __ASM_ARCH_USBCONTROL_H 13#ifndef __ASM_ARCH_USBCONTROL_H
diff --git a/include/asm-arm/arch-s3c2410/vmalloc.h b/include/asm-arm/arch-s3c2410/vmalloc.h
index 33963cd546..0ae3bdb7e0 100644
--- a/include/asm-arm/arch-s3c2410/vmalloc.h
+++ b/include/asm-arm/arch-s3c2410/vmalloc.h
@@ -10,11 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 *
12 * S3C2410 vmalloc definition 12 * S3C2410 vmalloc definition
13 * 13*/
14 * Changelog:
15 * 12-Mar-2004 BJD Fixed header, added include protection
16 * 12=Mar-2004 BJD Fixed VMALLOC_END definitions
17 */
18 14
19#ifndef __ASM_ARCH_VMALLOC_H 15#ifndef __ASM_ARCH_VMALLOC_H
20#define __ASM_ARCH_VMALLOC_H 16#define __ASM_ARCH_VMALLOC_H
diff --git a/include/asm-arm/arch-s3c2410/vr1000-cpld.h b/include/asm-arm/arch-s3c2410/vr1000-cpld.h
index 0ee373ac60..a341b1e1bd 100644
--- a/include/asm-arm/arch-s3c2410/vr1000-cpld.h
+++ b/include/asm-arm/arch-s3c2410/vr1000-cpld.h
@@ -8,10 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 25-May-2003 BJD Created file, added CTRL1 registers
14 * 19-Mar-2004 BJD Added VR1000 CPLD definitions
15*/ 11*/
16 12
17#ifndef __ASM_ARCH_VR1000CPLD_H 13#ifndef __ASM_ARCH_VR1000CPLD_H
diff --git a/include/asm-arm/arch-s3c2410/vr1000-irq.h b/include/asm-arm/arch-s3c2410/vr1000-irq.h
index 694f7715d2..c39a0ffa67 100644
--- a/include/asm-arm/arch-s3c2410/vr1000-irq.h
+++ b/include/asm-arm/arch-s3c2410/vr1000-irq.h
@@ -8,11 +8,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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11*/
12 * Changelog:
13 * 06-Jan-2003 BJD Linux 2.6.0 version
14 * 19-Mar-2004 BJD Updates for VR1000
15 */
16 12
17#ifndef __ASM_ARCH_VR1000IRQ_H 13#ifndef __ASM_ARCH_VR1000IRQ_H
18#define __ASM_ARCH_VR1000IRQ_H 14#define __ASM_ARCH_VR1000IRQ_H
diff --git a/include/asm-arm/arch-s3c2410/vr1000-map.h b/include/asm-arm/arch-s3c2410/vr1000-map.h
index 867c9355fd..1fe4db36c8 100644
--- a/include/asm-arm/arch-s3c2410/vr1000-map.h
+++ b/include/asm-arm/arch-s3c2410/vr1000-map.h
@@ -8,12 +8,6 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * Changelog:
13 * 06-Jan-2003 BJD Linux 2.6.0 version, split specifics from arch/map.h
14 * 12-Mar-2004 BJD Fixed header include protection
15 * 19-Mar-2004 BJD Copied to VR1000 machine headers.
16 * 19-Jan-2005 BJD Updated map definitions
17*/ 11*/
18 12
19/* needs arch/map.h including with this */ 13/* needs arch/map.h including with this */
diff --git a/include/asm-arm/arch-sa1100/io.h b/include/asm-arm/arch-sa1100/io.h
index 040ccde7a1..0756269404 100644
--- a/include/asm-arm/arch-sa1100/io.h
+++ b/include/asm-arm/arch-sa1100/io.h
@@ -22,6 +22,5 @@ static inline void __iomem *__io(unsigned long addr)
22} 22}
23#define __io(a) __io(a) 23#define __io(a) __io(a)
24#define __mem_pci(a) (a) 24#define __mem_pci(a) (a)
25#define __mem_isa(a) (a)
26 25
27#endif 26#endif
diff --git a/include/asm-arm/arch-versatile/io.h b/include/asm-arm/arch-versatile/io.h
index 47e904cf25..c4d01948e0 100644
--- a/include/asm-arm/arch-versatile/io.h
+++ b/include/asm-arm/arch-versatile/io.h
@@ -28,6 +28,5 @@ static inline void __iomem *__io(unsigned long addr)
28} 28}
29#define __io(a) __io(a) 29#define __io(a) __io(a)
30#define __mem_pci(a) (a) 30#define __mem_pci(a) (a)
31#define __mem_isa(a) (a)
32 31
33#endif 32#endif
diff --git a/include/asm-arm/arch-versatile/platform.h b/include/asm-arm/arch-versatile/platform.h
index 72ef874567..2af9d7c9c6 100644
--- a/include/asm-arm/arch-versatile/platform.h
+++ b/include/asm-arm/arch-versatile/platform.h
@@ -65,6 +65,8 @@
65#define VERSATILE_SYS_OSC1_OFFSET 0x1C 65#define VERSATILE_SYS_OSC1_OFFSET 0x1C
66#endif 66#endif
67 67
68#define VERSATILE_SYS_OSCCLCD_OFFSET 0x1c
69
68#define VERSATILE_SYS_LOCK_OFFSET 0x20 70#define VERSATILE_SYS_LOCK_OFFSET 0x20
69#define VERSATILE_SYS_100HZ_OFFSET 0x24 71#define VERSATILE_SYS_100HZ_OFFSET 0x24
70#define VERSATILE_SYS_CFGDATA1_OFFSET 0x28 72#define VERSATILE_SYS_CFGDATA1_OFFSET 0x28
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h
index d53bafa9bf..fce8328208 100644
--- a/include/asm-arm/assembler.h
+++ b/include/asm-arm/assembler.h
@@ -55,30 +55,6 @@
55#define PLD(code...) 55#define PLD(code...)
56#endif 56#endif
57 57
58#define MODE_USR USR_MODE
59#define MODE_FIQ FIQ_MODE
60#define MODE_IRQ IRQ_MODE
61#define MODE_SVC SVC_MODE
62
63#define DEFAULT_FIQ MODE_FIQ
64
65/*
66 * LOADREGS - ldm with PC in register list (eg, ldmfd sp!, {pc})
67 */
68#ifdef __STDC__
69#define LOADREGS(cond, base, reglist...)\
70 ldm##cond base,reglist
71#else
72#define LOADREGS(cond, base, reglist...)\
73 ldm/**/cond base,reglist
74#endif
75
76/*
77 * Build a return instruction for this processor type.
78 */
79#define RETINSTR(instr, regs...)\
80 instr regs
81
82/* 58/*
83 * Enable and disable interrupts 59 * Enable and disable interrupts
84 */ 60 */
@@ -117,18 +93,6 @@
117 msr cpsr_c, \oldcpsr 93 msr cpsr_c, \oldcpsr
118 .endm 94 .endm
119 95
120/*
121 * These two are used to save LR/restore PC over a user-based access.
122 * The old 26-bit architecture requires that we do. On 32-bit
123 * architecture, we can safely ignore this requirement.
124 */
125 .macro save_lr
126 .endm
127
128 .macro restore_pc
129 mov pc, lr
130 .endm
131
132#define USER(x...) \ 96#define USER(x...) \
1339999: x; \ 979999: x; \
134 .section __ex_table,"a"; \ 98 .section __ex_table,"a"; \
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index 4b0ce3e7de..ea88aa6bfc 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 0ac54b1a8b..b41831b643 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/bug.h b/include/asm-arm/bug.h
index 7fb02138f5..0e36fd5d87 100644
--- a/include/asm-arm/bug.h
+++ b/include/asm-arm/bug.h
@@ -1,7 +1,6 @@
1#ifndef _ASMARM_BUG_H 1#ifndef _ASMARM_BUG_H
2#define _ASMARM_BUG_H 2#define _ASMARM_BUG_H
3 3
4#include <linux/config.h>
5 4
6#ifdef CONFIG_BUG 5#ifdef CONFIG_BUG
7#ifdef CONFIG_DEBUG_BUGVERBOSE 6#ifdef CONFIG_DEBUG_BUGVERBOSE
diff --git a/include/asm-arm/bugs.h b/include/asm-arm/bugs.h
index 4c80ec519d..ca54eb0f12 100644
--- a/include/asm-arm/bugs.h
+++ b/include/asm-arm/bugs.h
@@ -10,8 +10,12 @@
10#ifndef __ASM_BUGS_H 10#ifndef __ASM_BUGS_H
11#define __ASM_BUGS_H 11#define __ASM_BUGS_H
12 12
13#ifdef CONFIG_MMU
13extern void check_writebuffer_bugs(void); 14extern void check_writebuffer_bugs(void);
14 15
15#define check_bugs() check_writebuffer_bugs() 16#define check_bugs() check_writebuffer_bugs()
17#else
18#define check_bugs() do { } while (0)
19#endif
16 20
17#endif 21#endif
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index fe0c744e02..f0845646aa 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
@@ -247,14 +263,12 @@ extern void dmac_flush_range(unsigned long, unsigned long);
247 */ 263 */
248#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 264#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
249 do { \ 265 do { \
250 flush_cache_page(vma, vaddr, page_to_pfn(page));\
251 memcpy(dst, src, len); \ 266 memcpy(dst, src, len); \
252 flush_dcache_page(page); \ 267 flush_ptrace_access(vma, page, vaddr, dst, len, 1);\
253 } while (0) 268 } while (0)
254 269
255#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 270#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
256 do { \ 271 do { \
257 flush_cache_page(vma, vaddr, page_to_pfn(page));\
258 memcpy(dst, src, len); \ 272 memcpy(dst, src, len); \
259 } while (0) 273 } while (0)
260 274
@@ -285,10 +299,24 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned l
285 __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags); 299 __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
286 } 300 }
287} 301}
302
303static inline void
304flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
305 unsigned long uaddr, void *kaddr,
306 unsigned long len, int write)
307{
308 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
309 unsigned long addr = (unsigned long)kaddr;
310 __cpuc_coherent_kern_range(addr, addr + len);
311 }
312}
288#else 313#else
289extern void flush_cache_mm(struct mm_struct *mm); 314extern void flush_cache_mm(struct mm_struct *mm);
290extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); 315extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
291extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn); 316extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
317extern void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
318 unsigned long uaddr, void *kaddr,
319 unsigned long len, int write);
292#endif 320#endif
293 321
294/* 322/*
diff --git a/include/asm-arm/domain.h b/include/asm-arm/domain.h
index f8ea2de484..4c2885abbe 100644
--- a/include/asm-arm/domain.h
+++ b/include/asm-arm/domain.h
@@ -50,6 +50,8 @@
50#define domain_val(dom,type) ((type) << (2*(dom))) 50#define domain_val(dom,type) ((type) << (2*(dom)))
51 51
52#ifndef __ASSEMBLY__ 52#ifndef __ASSEMBLY__
53
54#ifdef CONFIG_MMU
53#define set_domain(x) \ 55#define set_domain(x) \
54 do { \ 56 do { \
55 __asm__ __volatile__( \ 57 __asm__ __volatile__( \
@@ -66,5 +68,10 @@
66 set_domain(thread->cpu_domain); \ 68 set_domain(thread->cpu_domain); \
67 } while (0) 69 } while (0)
68 70
71#else
72#define set_domain(x) do { } while (0)
73#define modify_domain(dom,type) do { } while (0)
74#endif
75
69#endif 76#endif
70#endif /* !__ASSEMBLY__ */ 77#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-arm/dyntick.h b/include/asm-arm/dyntick.h
new file mode 100644
index 0000000000..19fab2d2b7
--- /dev/null
+++ b/include/asm-arm/dyntick.h
@@ -0,0 +1,6 @@
1#ifndef _ASMARM_DYNTICK_H
2#define _ASMARM_DYNTICK_H
3
4#include <asm/mach/time.h>
5
6#endif /* _ASMARM_DYNTICK_H */
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index 71061ca5c5..17f0c656d2 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -8,7 +8,6 @@
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10#include <asm/user.h> 10#include <asm/user.h>
11#include <asm/procinfo.h>
12 11
13typedef unsigned long elf_greg_t; 12typedef unsigned long elf_greg_t;
14typedef unsigned long elf_freg_t[3]; 13typedef unsigned long elf_freg_t[3];
@@ -30,11 +29,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
30typedef struct user_fp elf_fpregset_t; 29typedef struct user_fp elf_fpregset_t;
31 30
32/* 31/*
33 * This is used to ensure we don't load something for the wrong architecture.
34 */
35#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
36
37/*
38 * These are used to set parameters in the core dumps. 32 * These are used to set parameters in the core dumps.
39 */ 33 */
40#define ELF_CLASS ELFCLASS32 34#define ELF_CLASS ELFCLASS32
@@ -45,6 +39,14 @@ typedef struct user_fp elf_fpregset_t;
45#endif 39#endif
46#define ELF_ARCH EM_ARM 40#define ELF_ARCH EM_ARM
47 41
42#ifdef __KERNEL__
43#include <asm/procinfo.h>
44
45/*
46 * This is used to ensure we don't load something for the wrong architecture.
47 */
48#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
49
48#define USE_ELF_CORE_DUMP 50#define USE_ELF_CORE_DUMP
49#define ELF_EXEC_PAGESIZE 4096 51#define ELF_EXEC_PAGESIZE 4096
50 52
@@ -81,8 +83,6 @@ typedef struct user_fp elf_fpregset_t;
81extern char elf_platform[]; 83extern char elf_platform[];
82#define ELF_PLATFORM (elf_platform) 84#define ELF_PLATFORM (elf_platform)
83 85
84#ifdef __KERNEL__
85
86/* 86/*
87 * 32-bit code is always OK. Some cpus can do 26-bit, some can't. 87 * 32-bit code is always OK. Some cpus can do 26-bit, some can't.
88 */ 88 */
diff --git a/include/asm-arm/flat.h b/include/asm-arm/flat.h
new file mode 100644
index 0000000000..9669464785
--- /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/floppy.h b/include/asm-arm/floppy.h
index 6ea657c886..54b5ae44ed 100644
--- a/include/asm-arm/floppy.h
+++ b/include/asm-arm/floppy.h
@@ -25,7 +25,7 @@
25 25
26#define fd_inb(port) inb((port)) 26#define fd_inb(port) inb((port))
27#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\ 27#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
28 SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL) 28 IRQF_DISABLED,"floppy",NULL)
29#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL) 29#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
30#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK) 30#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
31#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK) 31#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
diff --git a/include/asm-arm/fpstate.h b/include/asm-arm/fpstate.h
index 132c3c5628..6af4e6bd12 100644
--- a/include/asm-arm/fpstate.h
+++ b/include/asm-arm/fpstate.h
@@ -72,6 +72,14 @@ union fp_state {
72 72
73#define FP_SIZE (sizeof(union fp_state) / sizeof(int)) 73#define FP_SIZE (sizeof(union fp_state) / sizeof(int))
74 74
75struct crunch_state {
76 unsigned int mvdx[16][2];
77 unsigned int mvax[4][3];
78 unsigned int dspsc[2];
79};
80
81#define CRUNCH_SIZE sizeof(struct crunch_state)
82
75#endif 83#endif
76 84
77#endif 85#endif
diff --git a/include/asm-arm/hardware/iop3xx.h b/include/asm-arm/hardware/iop3xx.h
new file mode 100644
index 0000000000..1018a7486a
--- /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 5f10048ec5..adab77780e 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 */
@@ -111,6 +112,8 @@
111#define LOCOMO_ALS 0x00 /* Adjust light cycle */ 112#define LOCOMO_ALS 0x00 /* Adjust light cycle */
112#define LOCOMO_ALD 0x04 /* Adjust light duty */ 113#define LOCOMO_ALD 0x04 /* Adjust light duty */
113 114
115#define LOCOMO_ALC_EN 0x8000
116
114/* Backlight controller: TFT signal */ 117/* Backlight controller: TFT signal */
115#define LOCOMO_BACKLIGHT 0x38 118#define LOCOMO_BACKLIGHT 0x38
116#define LOCOMO_TC 0x00 /* TFT control signal */ 119#define LOCOMO_TC 0x00 /* TFT control signal */
@@ -159,6 +162,7 @@ extern struct bus_type locomo_bus_type;
159#define LOCOMO_DEVID_AUDIO 3 162#define LOCOMO_DEVID_AUDIO 3
160#define LOCOMO_DEVID_LED 4 163#define LOCOMO_DEVID_LED 4
161#define LOCOMO_DEVID_UART 5 164#define LOCOMO_DEVID_UART 5
165#define LOCOMO_DEVID_SPI 6
162 166
163struct locomo_dev { 167struct locomo_dev {
164 struct device dev; 168 struct device dev;
@@ -195,12 +199,16 @@ int locomo_driver_register(struct locomo_driver *);
195void locomo_driver_unregister(struct locomo_driver *); 199void locomo_driver_unregister(struct locomo_driver *);
196 200
197/* GPIO control functions */ 201/* GPIO control functions */
198void 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);
199unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits); 203int locomo_gpio_read_level(struct device *dev, unsigned int bits);
200unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits); 204int locomo_gpio_read_output(struct device *dev, unsigned int bits);
201void 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
202 207
203/* M62332 control function */ 208/* M62332 control function */
204void 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);
205 210
211/* Frontlight control */
212void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);
213
206#endif 214#endif
diff --git a/include/asm-arm/hardware/sharpsl_pm.h b/include/asm-arm/hardware/sharpsl_pm.h
index ecf15b8395..a836e76a14 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/hardware/ssp.h b/include/asm-arm/hardware/ssp.h
index 28aa11b769..3b42e18199 100644
--- a/include/asm-arm/hardware/ssp.h
+++ b/include/asm-arm/hardware/ssp.h
@@ -16,8 +16,8 @@ struct ssp_state {
16}; 16};
17 17
18int ssp_write_word(u16 data); 18int ssp_write_word(u16 data);
19int ssp_read_word(void); 19int ssp_read_word(u16 *data);
20void ssp_flush(void); 20int ssp_flush(void);
21void ssp_enable(void); 21void ssp_enable(void);
22void ssp_disable(void); 22void ssp_disable(void);
23void ssp_save_state(struct ssp_state *ssp); 23void ssp_save_state(struct ssp_state *ssp);
diff --git a/include/asm-arm/hw_irq.h b/include/asm-arm/hw_irq.h
new file mode 100644
index 0000000000..ea85697198
--- /dev/null
+++ b/include/asm-arm/hw_irq.h
@@ -0,0 +1,20 @@
1/*
2 * Nothing to see here yet
3 */
4#ifndef _ARCH_ARM_HW_IRQ_H
5#define _ARCH_ARM_HW_IRQ_H
6
7#include <asm/mach/irq.h>
8
9#if defined(CONFIG_NO_IDLE_HZ)
10# include <asm/dyntick.h>
11# define handle_dynamic_tick(action) \
12 if (!(action->flags & IRQF_TIMER) && system_timer->dyn_tick) { \
13 write_seqlock(&xtime_lock); \
14 if (system_timer->dyn_tick->state & DYN_TICK_ENABLED) \
15 system_timer->dyn_tick->handler(irq, 0, regs); \
16 write_sequnlock(&xtime_lock); \
17 }
18#endif
19
20#endif
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index b3479fc1cc..8076a85c36 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
@@ -291,5 +295,12 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
291 */ 295 */
292#define xlate_dev_kmem_ptr(p) p 296#define xlate_dev_kmem_ptr(p) p
293 297
298/*
299 * Register ISA memory and port locations for glibc iopl/inb/outb
300 * emulation.
301 */
302extern void register_isa_ports(unsigned int mmio, unsigned int io,
303 unsigned int io_shift);
304
294#endif /* __KERNEL__ */ 305#endif /* __KERNEL__ */
295#endif /* __ASM_ARM_IO_H */ 306#endif /* __ASM_ARM_IO_H */
diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h
index 66e67e60bc..283af50a16 100644
--- a/include/asm-arm/irq.h
+++ b/include/asm-arm/irq.h
@@ -21,18 +21,13 @@
21 21
22struct irqaction; 22struct irqaction;
23 23
24extern void disable_irq_nosync(unsigned int);
25extern void disable_irq(unsigned int);
26extern void enable_irq(unsigned int);
27
28/* 24/*
29 * These correspond with the SA_TRIGGER_* defines, and therefore the 25 * Migration helpers
30 * IORESOURCE_IRQ_* defines.
31 */ 26 */
32#define __IRQT_RISEDGE (1 << 0) 27#define __IRQT_FALEDGE IRQ_TYPE_EDGE_FALLING
33#define __IRQT_FALEDGE (1 << 1) 28#define __IRQT_RISEDGE IRQ_TYPE_EDGE_RISING
34#define __IRQT_HIGHLVL (1 << 2) 29#define __IRQT_LOWLVL IRQ_TYPE_LEVEL_LOW
35#define __IRQT_LOWLVL (1 << 3) 30#define __IRQT_HIGHLVL IRQ_TYPE_LEVEL_HIGH
36 31
37#define IRQT_NOEDGE (0) 32#define IRQT_NOEDGE (0)
38#define IRQT_RISING (__IRQT_RISEDGE) 33#define IRQT_RISING (__IRQT_RISEDGE)
@@ -40,12 +35,7 @@ extern void enable_irq(unsigned int);
40#define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE) 35#define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE)
41#define IRQT_LOW (__IRQT_LOWLVL) 36#define IRQT_LOW (__IRQT_LOWLVL)
42#define IRQT_HIGH (__IRQT_HIGHLVL) 37#define IRQT_HIGH (__IRQT_HIGHLVL)
43#define IRQT_PROBE (1 << 4) 38#define IRQT_PROBE IRQ_TYPE_PROBE
44
45int set_irq_type(unsigned int irq, unsigned int type);
46void disable_irq_wake(unsigned int irq);
47void enable_irq_wake(unsigned int irq);
48int setup_irq(unsigned int, struct irqaction *);
49 39
50extern void migrate_irqs(void); 40extern void migrate_irqs(void);
51#endif 41#endif
diff --git a/include/asm-arm/irqflags.h b/include/asm-arm/irqflags.h
new file mode 100644
index 0000000000..6d09974e66
--- /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/irq.h b/include/asm-arm/mach/irq.h
index d4d420ecf3..131f33733d 100644
--- a/include/asm-arm/mach/irq.h
+++ b/include/asm-arm/mach/irq.h
@@ -10,95 +10,9 @@
10#ifndef __ASM_ARM_MACH_IRQ_H 10#ifndef __ASM_ARM_MACH_IRQ_H
11#define __ASM_ARM_MACH_IRQ_H 11#define __ASM_ARM_MACH_IRQ_H
12 12
13struct irqdesc; 13#include <linux/irq.h>
14struct pt_regs;
15struct seq_file;
16
17typedef void (*irq_handler_t)(unsigned int, struct irqdesc *, struct pt_regs *);
18typedef void (*irq_control_t)(unsigned int);
19
20struct irqchip {
21 /*
22 * Acknowledge the IRQ.
23 * If this is a level-based IRQ, then it is expected to mask the IRQ
24 * as well.
25 */
26 void (*ack)(unsigned int);
27 /*
28 * Mask the IRQ in hardware.
29 */
30 void (*mask)(unsigned int);
31 /*
32 * Unmask the IRQ in hardware.
33 */
34 void (*unmask)(unsigned int);
35 /*
36 * Ask the hardware to re-trigger the IRQ.
37 * Note: This method _must_ _not_ call the interrupt handler.
38 * If you are unable to retrigger the interrupt, do not
39 * provide a function, or if you do, return non-zero.
40 */
41 int (*retrigger)(unsigned int);
42 /*
43 * Set the type of the IRQ.
44 */
45 int (*set_type)(unsigned int, unsigned int);
46 /*
47 * Set wakeup-enable on the selected IRQ
48 */
49 int (*set_wake)(unsigned int, unsigned int);
50
51#ifdef CONFIG_SMP
52 /*
53 * Route an interrupt to a CPU
54 */
55 void (*set_cpu)(struct irqdesc *desc, unsigned int irq, unsigned int cpu);
56#endif
57};
58
59struct irqdesc {
60 irq_handler_t handle;
61 struct irqchip *chip;
62 struct irqaction *action;
63 struct list_head pend;
64 void __iomem *base;
65 void *data;
66 unsigned int disable_depth;
67
68 unsigned int triggered: 1; /* IRQ has occurred */
69 unsigned int running : 1; /* IRQ is running */
70 unsigned int pending : 1; /* IRQ is pending */
71 unsigned int probing : 1; /* IRQ in use for a probe */
72 unsigned int probe_ok : 1; /* IRQ can be used for probe */
73 unsigned int valid : 1; /* IRQ claimable */
74 unsigned int noautoenable : 1; /* don't automatically enable IRQ */
75 unsigned int unused :25;
76
77 unsigned int irqs_unhandled;
78 struct proc_dir_entry *procdir;
79
80#ifdef CONFIG_SMP
81 cpumask_t affinity;
82 unsigned int cpu;
83#endif
84
85 /*
86 * IRQ lock detection
87 */
88 unsigned int lck_cnt;
89 unsigned int lck_pc;
90 unsigned int lck_jif;
91};
92
93extern struct irqdesc irq_desc[];
94 14
95/* 15struct seq_file;
96 * Helpful inline function for calling irq descriptor handlers.
97 */
98static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
99{
100 desc->handle(irq, desc, regs);
101}
102 16
103/* 17/*
104 * This is internal. Do not use it. 18 * This is internal. Do not use it.
@@ -106,18 +20,22 @@ static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struc
106extern void (*init_arch_irq)(void); 20extern void (*init_arch_irq)(void);
107extern void init_FIQ(void); 21extern void init_FIQ(void);
108extern int show_fiq_list(struct seq_file *, void *); 22extern int show_fiq_list(struct seq_file *, void *);
109void __set_irq_handler(unsigned int irq, irq_handler_t, int);
110 23
111/* 24/*
112 * External stuff. 25 * Function wrappers
26 */
27#define set_irq_chipdata(irq, d) set_irq_chip_data(irq, d)
28#define get_irq_chipdata(irq) get_irq_chip_data(irq)
29
30/*
31 * Obsolete inline function for calling irq descriptor handlers.
113 */ 32 */
114#define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0) 33static inline void desc_handle_irq(unsigned int irq, struct irq_desc *desc,
115#define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1) 34 struct pt_regs *regs)
116#define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0) 35{
117#define set_irq_chipdata(irq,d) do { irq_desc[irq].base = d; } while (0) 36 desc->handle_irq(irq, desc, regs);
118#define get_irq_chipdata(irq) (irq_desc[irq].base) 37}
119 38
120void set_irq_chip(unsigned int irq, struct irqchip *);
121void set_irq_flags(unsigned int irq, unsigned int flags); 39void set_irq_flags(unsigned int irq, unsigned int flags);
122 40
123#define IRQF_VALID (1 << 0) 41#define IRQF_VALID (1 << 0)
@@ -125,12 +43,25 @@ void set_irq_flags(unsigned int irq, unsigned int flags);
125#define IRQF_NOAUTOEN (1 << 2) 43#define IRQF_NOAUTOEN (1 << 2)
126 44
127/* 45/*
128 * Built-in IRQ handlers. 46 * This is for easy migration, but should be changed in the source
129 */ 47 */
130void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); 48#define do_level_IRQ handle_level_irq
131void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); 49#define do_edge_IRQ handle_edge_irq
132void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); 50#define do_simple_IRQ handle_simple_irq
133void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); 51#define irqdesc irq_desc
134void dummy_mask_unmask_irq(unsigned int irq); 52#define irqchip irq_chip
53
54#define do_bad_IRQ(irq,desc,regs) \
55do { \
56 spin_lock(&desc->lock); \
57 handle_bad_irq(irq, desc, regs); \
58 spin_unlock(&desc->lock); \
59} while(0)
60
61extern unsigned long irq_err_count;
62static inline void ack_bad_irq(int irq)
63{
64 irq_err_count++;
65}
135 66
136#endif 67#endif
diff --git a/include/asm-arm/mach/map.h b/include/asm-arm/mach/map.h
index e8ea67c97c..cef5364ed5 100644
--- a/include/asm-arm/mach/map.h
+++ b/include/asm-arm/mach/map.h
@@ -16,8 +16,6 @@ struct map_desc {
16 unsigned int type; 16 unsigned int type;
17}; 17};
18 18
19struct meminfo;
20
21#define MT_DEVICE 0 19#define MT_DEVICE 0
22#define MT_CACHECLEAN 1 20#define MT_CACHECLEAN 1
23#define MT_MINICLEAN 2 21#define MT_MINICLEAN 2
@@ -28,7 +26,8 @@ struct meminfo;
28#define MT_IXP2000_DEVICE 7 26#define MT_IXP2000_DEVICE 7
29#define MT_NONSHARED_DEVICE 8 27#define MT_NONSHARED_DEVICE 8
30 28
31extern void create_memmap_holes(struct meminfo *); 29#ifdef CONFIG_MMU
32extern void memtable_init(struct meminfo *);
33extern void iotable_init(struct map_desc *, int); 30extern void iotable_init(struct map_desc *, int);
34extern void setup_io_desc(void); 31#else
32#define iotable_init(map,num) do { } while (0)
33#endif
diff --git a/include/asm-arm/mach/pci.h b/include/asm-arm/mach/pci.h
index 25d540ed00..24621c49a0 100644
--- a/include/asm-arm/mach/pci.h
+++ b/include/asm-arm/mach/pci.h
@@ -28,7 +28,7 @@ struct hw_pci {
28struct pci_sys_data { 28struct pci_sys_data {
29 struct list_head node; 29 struct list_head node;
30 int busnr; /* primary bus number */ 30 int busnr; /* primary bus number */
31 unsigned long mem_offset; /* bus->cpu memory mapping offset */ 31 u64 mem_offset; /* bus->cpu memory mapping offset */
32 unsigned long io_offset; /* bus->cpu IO mapping offset */ 32 unsigned long io_offset; /* bus->cpu IO mapping offset */
33 struct pci_bus *bus; /* PCI bus */ 33 struct pci_bus *bus; /* PCI bus */
34 struct resource *resource[3]; /* Primary PCI bus resources */ 34 struct resource *resource[3]; /* Primary PCI bus resources */
@@ -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/time.h b/include/asm-arm/mach/time.h
index 9f28073559..1eb93f5c0d 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;
@@ -69,6 +71,7 @@ extern void timer_tick(struct pt_regs *);
69/* 71/*
70 * Kernel time keeping support. 72 * Kernel time keeping support.
71 */ 73 */
74struct timespec;
72extern int (*set_rtc)(void); 75extern int (*set_rtc)(void);
73extern void save_time_delta(struct timespec *delta, struct timespec *rtc); 76extern void save_time_delta(struct timespec *delta, struct timespec *rtc);
74extern void restore_time_delta(struct timespec *delta, struct timespec *rtc); 77extern void restore_time_delta(struct timespec *delta, struct timespec *rtc);
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index 731e321a57..91d536c215 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -2,6 +2,7 @@
2 * linux/include/asm-arm/memory.h 2 * linux/include/asm-arm/memory.h
3 * 3 *
4 * Copyright (C) 2000-2002 Russell King 4 * Copyright (C) 2000-2002 Russell King
5 * modification for nommu, Hyok S. Choi, 2004
5 * 6 *
6 * 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
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -26,6 +27,8 @@
26#include <asm/arch/memory.h> 27#include <asm/arch/memory.h>
27#include <asm/sizes.h> 28#include <asm/sizes.h>
28 29
30#ifdef CONFIG_MMU
31
29#ifndef TASK_SIZE 32#ifndef TASK_SIZE
30/* 33/*
31 * TASK_SIZE - the maximum size of a user space task. 34 * TASK_SIZE - the maximum size of a user space task.
@@ -48,6 +51,65 @@
48#endif 51#endif
49 52
50/* 53/*
54 * The module space lives between the addresses given by TASK_SIZE
55 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
56 */
57#define MODULE_END (PAGE_OFFSET)
58#define MODULE_START (MODULE_END - 16*1048576)
59
60#if TASK_SIZE > MODULE_START
61#error Top of user space clashes with start of module space
62#endif
63
64/*
65 * The XIP kernel gets mapped at the bottom of the module vm area.
66 * Since we use sections to map it, this macro replaces the physical address
67 * with its virtual address while keeping offset from the base section.
68 */
69#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
70
71/*
72 * Allow 16MB-aligned ioremap pages
73 */
74#define IOREMAP_MAX_ORDER 24
75
76#else /* CONFIG_MMU */
77
78/*
79 * The limitation of user task size can grow up to the end of free ram region.
80 * It is difficult to define and perhaps will never meet the original meaning
81 * of this define that was meant to.
82 * Fortunately, there is no reference for this in noMMU mode, for now.
83 */
84#ifndef TASK_SIZE
85#define TASK_SIZE (CONFIG_DRAM_SIZE)
86#endif
87
88#ifndef TASK_UNMAPPED_BASE
89#define TASK_UNMAPPED_BASE UL(0x00000000)
90#endif
91
92#ifndef PHYS_OFFSET
93#define PHYS_OFFSET (CONFIG_DRAM_BASE)
94#endif
95
96#ifndef END_MEM
97#define END_MEM (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)
98#endif
99
100#ifndef PAGE_OFFSET
101#define PAGE_OFFSET (PHYS_OFFSET)
102#endif
103
104/*
105 * The module can be at any place in ram in nommu mode.
106 */
107#define MODULE_END (END_MEM)
108#define MODULE_START (PHYS_OFFSET)
109
110#endif /* !CONFIG_MMU */
111
112/*
51 * Size of DMA-consistent memory region. Must be multiple of 2M, 113 * Size of DMA-consistent memory region. Must be multiple of 2M,
52 * between 2MB and 14MB inclusive. 114 * between 2MB and 14MB inclusive.
53 */ 115 */
@@ -71,24 +133,6 @@
71#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT) 133#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
72#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 134#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
73 135
74/*
75 * The module space lives between the addresses given by TASK_SIZE
76 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
77 */
78#define MODULE_END (PAGE_OFFSET)
79#define MODULE_START (MODULE_END - 16*1048576)
80
81#if TASK_SIZE > MODULE_START
82#error Top of user space clashes with start of module space
83#endif
84
85/*
86 * The XIP kernel gets mapped at the bottom of the module vm area.
87 * Since we use sections to map it, this macro replaces the physical address
88 * with its virtual address while keeping offset from the base section.
89 */
90#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
91
92#ifndef __ASSEMBLY__ 136#ifndef __ASSEMBLY__
93 137
94/* 138/*
diff --git a/include/asm-arm/mmu.h b/include/asm-arm/mmu.h
index a457cb7198..fe2a23b562 100644
--- a/include/asm-arm/mmu.h
+++ b/include/asm-arm/mmu.h
@@ -1,10 +1,13 @@
1#ifndef __ARM_MMU_H 1#ifndef __ARM_MMU_H
2#define __ARM_MMU_H 2#define __ARM_MMU_H
3 3
4#ifdef CONFIG_MMU
5
4typedef struct { 6typedef struct {
5#if __LINUX_ARM_ARCH__ >= 6 7#if __LINUX_ARM_ARCH__ >= 6
6 unsigned int id; 8 unsigned int id;
7#endif 9#endif
10 unsigned int kvm_seq;
8} mm_context_t; 11} mm_context_t;
9 12
10#if __LINUX_ARM_ARCH__ >= 6 13#if __LINUX_ARM_ARCH__ >= 6
@@ -13,4 +16,18 @@ typedef struct {
13#define ASID(mm) (0) 16#define ASID(mm) (0)
14#endif 17#endif
15 18
19#else
20
21/*
22 * From nommu.h:
23 * Copyright (C) 2002, David McCullough <davidm@snapgear.com>
24 * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com>
25 */
26typedef struct {
27 struct vm_list_struct *vmlist;
28 unsigned long end_brk;
29} mm_context_t;
30
31#endif
32
16#endif 33#endif
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index 81c59facea..d1a65b1edc 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -17,6 +17,8 @@
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/proc-fns.h> 18#include <asm/proc-fns.h>
19 19
20void __check_kvm_seq(struct mm_struct *mm);
21
20#if __LINUX_ARM_ARCH__ >= 6 22#if __LINUX_ARM_ARCH__ >= 6
21 23
22/* 24/*
@@ -45,13 +47,21 @@ static inline void check_context(struct mm_struct *mm)
45{ 47{
46 if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) 48 if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
47 __new_context(mm); 49 __new_context(mm);
50
51 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
52 __check_kvm_seq(mm);
48} 53}
49 54
50#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0) 55#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
51 56
52#else 57#else
53 58
54#define check_context(mm) do { } while (0) 59static inline void check_context(struct mm_struct *mm)
60{
61 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
62 __check_kvm_seq(mm);
63}
64
55#define init_new_context(tsk,mm) 0 65#define init_new_context(tsk,mm) 0
56 66
57#endif 67#endif
@@ -82,6 +92,7 @@ static inline void
82switch_mm(struct mm_struct *prev, struct mm_struct *next, 92switch_mm(struct mm_struct *prev, struct mm_struct *next,
83 struct task_struct *tsk) 93 struct task_struct *tsk)
84{ 94{
95#ifdef CONFIG_MMU
85 unsigned int cpu = smp_processor_id(); 96 unsigned int cpu = smp_processor_id();
86 97
87 if (prev != next) { 98 if (prev != next) {
@@ -91,6 +102,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
91 if (cache_is_vivt()) 102 if (cache_is_vivt())
92 cpu_clear(cpu, prev->cpu_vm_mask); 103 cpu_clear(cpu, prev->cpu_vm_mask);
93 } 104 }
105#endif
94} 106}
95 107
96#define deactivate_mm(tsk,mm) do { } while (0) 108#define deactivate_mm(tsk,mm) do { } while (0)
diff --git a/include/asm-arm/page-nommu.h b/include/asm-arm/page-nommu.h
new file mode 100644
index 0000000000..a1bcad0604
--- /dev/null
+++ b/include/asm-arm/page-nommu.h
@@ -0,0 +1,51 @@
1/*
2 * linux/include/asm-arm/page-nommu.h
3 *
4 * Copyright (C) 2004 Hyok S. Choi
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_PAGE_NOMMU_H
11#define _ASMARM_PAGE_NOMMU_H
12
13#if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13
14#define KTHREAD_SIZE (8192)
15#else
16#define KTHREAD_SIZE PAGE_SIZE
17#endif
18
19#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
20#define free_user_page(page, addr) free_page(addr)
21
22#define clear_page(page) memset((page), 0, PAGE_SIZE)
23#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
24
25#define clear_user_page(page, vaddr, pg) clear_page(page)
26#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
27
28/*
29 * These are used to make use of C type-checking..
30 */
31typedef unsigned long pte_t;
32typedef unsigned long pmd_t;
33typedef unsigned long pgd_t[2];
34typedef unsigned long pgprot_t;
35
36#define pte_val(x) (x)
37#define pmd_val(x) (x)
38#define pgd_val(x) ((x)[0])
39#define pgprot_val(x) (x)
40
41#define __pte(x) (x)
42#define __pmd(x) (x)
43#define __pgprot(x) (x)
44
45/* to align the pointer to the (next) page boundary */
46#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
47
48extern unsigned long memory_start;
49extern unsigned long memory_end;
50
51#endif
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 66cfeb5290..7e85db77d9 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -11,18 +11,24 @@
11#define _ASMARM_PAGE_H 11#define _ASMARM_PAGE_H
12 12
13 13
14#ifdef __KERNEL__
15
14/* PAGE_SHIFT determines the page size */ 16/* PAGE_SHIFT determines the page size */
15#define PAGE_SHIFT 12 17#define PAGE_SHIFT 12
16#define PAGE_SIZE (1UL << PAGE_SHIFT) 18#define PAGE_SIZE (1UL << PAGE_SHIFT)
17#define PAGE_MASK (~(PAGE_SIZE-1)) 19#define PAGE_MASK (~(PAGE_SIZE-1))
18 20
19#ifdef __KERNEL__
20
21/* to align the pointer to the (next) page boundary */ 21/* to align the pointer to the (next) page boundary */
22#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 22#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
23 23
24#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
25 25
26#ifndef CONFIG_MMU
27
28#include "page-nommu.h"
29
30#else
31
26#include <asm/glue.h> 32#include <asm/glue.h>
27 33
28/* 34/*
@@ -168,8 +174,7 @@ typedef unsigned long pgprot_t;
168 174
169#endif /* STRICT_MM_TYPECHECKS */ 175#endif /* STRICT_MM_TYPECHECKS */
170 176
171/* the upper-most page table pointer */ 177#endif /* CONFIG_MMU */
172extern pmd_t *top_pmd;
173 178
174#include <asm/memory.h> 179#include <asm/memory.h>
175 180
@@ -185,8 +190,8 @@ extern pmd_t *top_pmd;
185#define ARCH_SLAB_MINALIGN 8 190#define ARCH_SLAB_MINALIGN 8
186#endif 191#endif
187 192
188#endif /* __KERNEL__ */
189
190#include <asm-generic/page.h> 193#include <asm-generic/page.h>
191 194
195#endif /* __KERNEL__ */
196
192#endif 197#endif
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h
index c4ac2e6776..4d43945529 100644
--- a/include/asm-arm/pgalloc.h
+++ b/include/asm-arm/pgalloc.h
@@ -16,6 +16,10 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18 18
19#define check_pgt_cache() do { } while (0)
20
21#ifdef CONFIG_MMU
22
19#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER)) 23#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))
20#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL)) 24#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))
21 25
@@ -32,8 +36,6 @@ extern void free_pgd_slow(pgd_t *pgd);
32#define pgd_alloc(mm) get_pgd_slow(mm) 36#define pgd_alloc(mm) get_pgd_slow(mm)
33#define pgd_free(pgd) free_pgd_slow(pgd) 37#define pgd_free(pgd) free_pgd_slow(pgd)
34 38
35#define check_pgt_cache() do { } while (0)
36
37/* 39/*
38 * Allocate one PTE table. 40 * Allocate one PTE table.
39 * 41 *
@@ -126,4 +128,6 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
126 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE); 128 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE);
127} 129}
128 130
131#endif /* CONFIG_MMU */
132
129#endif 133#endif
diff --git a/include/asm-arm/pgtable-hwdef.h b/include/asm-arm/pgtable-hwdef.h
index 1bc1f997bd..f3b5120c99 100644
--- a/include/asm-arm/pgtable-hwdef.h
+++ b/include/asm-arm/pgtable-hwdef.h
@@ -28,6 +28,7 @@
28 */ 28 */
29#define PMD_SECT_BUFFERABLE (1 << 2) 29#define PMD_SECT_BUFFERABLE (1 << 2)
30#define PMD_SECT_CACHEABLE (1 << 3) 30#define PMD_SECT_CACHEABLE (1 << 3)
31#define PMD_SECT_XN (1 << 4) /* v6 */
31#define PMD_SECT_AP_WRITE (1 << 10) 32#define PMD_SECT_AP_WRITE (1 << 10)
32#define PMD_SECT_AP_READ (1 << 11) 33#define PMD_SECT_AP_READ (1 << 11)
33#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */ 34#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */
diff --git a/include/asm-arm/pgtable-nommu.h b/include/asm-arm/pgtable-nommu.h
new file mode 100644
index 0000000000..b13322dccf
--- /dev/null
+++ b/include/asm-arm/pgtable-nommu.h
@@ -0,0 +1,123 @@
1/*
2 * linux/include/asm-arm/pgtable-nommu.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 * Copyright (C) 2004 Hyok S. Choi
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#ifndef _ASMARM_PGTABLE_NOMMU_H
12#define _ASMARM_PGTABLE_NOMMU_H
13
14#ifndef __ASSEMBLY__
15
16#include <linux/config.h>
17#include <linux/slab.h>
18#include <asm/processor.h>
19#include <asm/page.h>
20#include <asm/io.h>
21
22/*
23 * Trivial page table functions.
24 */
25#define pgd_present(pgd) (1)
26#define pgd_none(pgd) (0)
27#define pgd_bad(pgd) (0)
28#define pgd_clear(pgdp)
29#define kern_addr_valid(addr) (1)
30#define pmd_offset(a, b) ((void *)0)
31/* FIXME */
32/*
33 * PMD_SHIFT determines the size of the area a second-level page table can map
34 * PGDIR_SHIFT determines what a third-level page table entry can map
35 */
36#define PGDIR_SHIFT 21
37
38#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
39#define PGDIR_MASK (~(PGDIR_SIZE-1))
40/* FIXME */
41
42#define PAGE_NONE __pgprot(0)
43#define PAGE_SHARED __pgprot(0)
44#define PAGE_COPY __pgprot(0)
45#define PAGE_READONLY __pgprot(0)
46#define PAGE_KERNEL __pgprot(0)
47
48//extern void paging_init(struct meminfo *, struct machine_desc *);
49#define swapper_pg_dir ((pgd_t *) 0)
50
51#define __swp_type(x) (0)
52#define __swp_offset(x) (0)
53#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
54#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
55#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
56
57
58typedef pte_t *pte_addr_t;
59
60static inline int pte_file(pte_t pte) { return 0; }
61
62/*
63 * ZERO_PAGE is a global shared page that is always zero: used
64 * for zero-mapped memory areas etc..
65 */
66#define ZERO_PAGE(vaddr) (virt_to_page(0))
67
68/*
69 * Mark the prot value as uncacheable and unbufferable.
70 */
71#define pgprot_noncached(prot) __pgprot(0)
72#define pgprot_writecombine(prot) __pgprot(0)
73
74
75/*
76 * These would be in other places but having them here reduces the diffs.
77 */
78extern unsigned int kobjsize(const void *objp);
79extern int is_in_rom(unsigned long);
80
81/*
82 * No page table caches to initialise.
83 */
84#define pgtable_cache_init() do { } while (0)
85#define io_remap_page_range remap_page_range
86#define io_remap_pfn_range remap_pfn_range
87
88#define MK_IOSPACE_PFN(space, pfn) (pfn)
89#define GET_IOSPACE(pfn) 0
90#define GET_PFN(pfn) (pfn)
91
92
93/*
94 * All 32bit addresses are effectively valid for vmalloc...
95 * Sort of meaningless for non-VM targets.
96 */
97#define VMALLOC_START 0
98#define VMALLOC_END 0xffffffff
99
100#define FIRST_USER_ADDRESS (0)
101
102#else
103
104/*
105 * dummy tlb and user structures.
106 */
107#define v3_tlb_fns (0)
108#define v4_tlb_fns (0)
109#define v4wb_tlb_fns (0)
110#define v4wbi_tlb_fns (0)
111#define v6_tlb_fns (0)
112
113#define v3_user_fns (0)
114#define v4_user_fns (0)
115#define v4_mc_user_fns (0)
116#define v4wb_user_fns (0)
117#define v4wt_user_fns (0)
118#define v6_user_fns (0)
119#define xscale_mc_user_fns (0)
120
121#endif /*__ASSEMBLY__*/
122
123#endif /* _ASMARM_PGTABLE_H */
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index e85c08d78d..ed8cb5963e 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -11,9 +11,15 @@
11#define _ASMARM_PGTABLE_H 11#define _ASMARM_PGTABLE_H
12 12
13#include <asm-generic/4level-fixup.h> 13#include <asm-generic/4level-fixup.h>
14#include <asm/proc-fns.h>
15
16#ifndef CONFIG_MMU
17
18#include "pgtable-nommu.h"
19
20#else
14 21
15#include <asm/memory.h> 22#include <asm/memory.h>
16#include <asm/proc-fns.h>
17#include <asm/arch/vmalloc.h> 23#include <asm/arch/vmalloc.h>
18 24
19/* 25/*
@@ -130,6 +136,13 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
130#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)
131 137
132/* 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/*
133 * ARMv6 supersection address mask and size definitions. 146 * ARMv6 supersection address mask and size definitions.
134 */ 147 */
135#define SUPERSECTION_SHIFT 24 148#define SUPERSECTION_SHIFT 24
@@ -218,9 +231,9 @@ extern struct page *empty_zero_page;
218#define pte_none(pte) (!pte_val(pte)) 231#define pte_none(pte) (!pte_val(pte))
219#define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0)) 232#define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0))
220#define pte_page(pte) (pfn_to_page(pte_pfn(pte))) 233#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
221#define pte_offset_kernel(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) 234#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
222#define pte_offset_map(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) 235#define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
223#define pte_offset_map_nested(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) 236#define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
224#define pte_unmap(pte) do { } while (0) 237#define pte_unmap(pte) do { } while (0)
225#define pte_unmap_nested(pte) do { } while (0) 238#define pte_unmap_nested(pte) do { } while (0)
226 239
@@ -285,7 +298,7 @@ PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
285 clean_pmd_entry(pmdp); \ 298 clean_pmd_entry(pmdp); \
286 } while (0) 299 } while (0)
287 300
288static inline pte_t *pmd_page_kernel(pmd_t pmd) 301static inline pte_t *pmd_page_vaddr(pmd_t pmd)
289{ 302{
290 unsigned long ptr; 303 unsigned long ptr;
291 304
@@ -378,4 +391,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
378 391
379#endif /* !__ASSEMBLY__ */ 392#endif /* !__ASSEMBLY__ */
380 393
394#endif /* CONFIG_MMU */
395
381#endif /* _ASMARM_PGTABLE_H */ 396#endif /* _ASMARM_PGTABLE_H */
diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h
index e9310895e7..ea7e54c319 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
@@ -165,6 +205,8 @@
165 205
166#include <asm/memory.h> 206#include <asm/memory.h>
167 207
208#ifdef CONFIG_MMU
209
168#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm) 210#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
169 211
170#define cpu_get_pgd() \ 212#define cpu_get_pgd() \
@@ -176,6 +218,8 @@
176 (pgd_t *)phys_to_virt(pg); \ 218 (pgd_t *)phys_to_virt(pg); \
177 }) 219 })
178 220
221#endif
222
179#endif /* __ASSEMBLY__ */ 223#endif /* __ASSEMBLY__ */
180#endif /* __KERNEL__ */ 224#endif /* __KERNEL__ */
181#endif /* __ASM_PROCFNS_H */ 225#endif /* __ASM_PROCFNS_H */
diff --git a/include/asm-arm/procinfo.h b/include/asm-arm/procinfo.h
index 8425260552..91a31adfa8 100644
--- a/include/asm-arm/procinfo.h
+++ b/include/asm-arm/procinfo.h
@@ -29,7 +29,8 @@ struct processor;
29struct proc_info_list { 29struct proc_info_list {
30 unsigned int cpu_val; 30 unsigned int cpu_val;
31 unsigned int cpu_mask; 31 unsigned int cpu_mask;
32 unsigned long __cpu_mmu_flags; /* used by head.S */ 32 unsigned long __cpu_mm_mmu_flags; /* used by head.S */
33 unsigned long __cpu_io_mmu_flags; /* used by head.S */
33 unsigned long __cpu_flush; /* used by head.S */ 34 unsigned long __cpu_flush; /* used by head.S */
34 const char *arch_name; 35 const char *arch_name;
35 const char *elf_name; 36 const char *elf_name;
@@ -54,5 +55,6 @@ extern unsigned int elf_hwcap;
54#define HWCAP_VFP 64 55#define HWCAP_VFP 64
55#define HWCAP_EDSP 128 56#define HWCAP_EDSP 128
56#define HWCAP_JAVA 256 57#define HWCAP_JAVA 256
58#define HWCAP_IWMMXT 512
57 59
58#endif 60#endif
diff --git a/include/asm-arm/ptrace.h b/include/asm-arm/ptrace.h
index 2bebe3dc0a..5a8ef787db 100644
--- a/include/asm-arm/ptrace.h
+++ b/include/asm-arm/ptrace.h
@@ -25,6 +25,11 @@
25 25
26#define PTRACE_SET_SYSCALL 23 26#define PTRACE_SET_SYSCALL 23
27 27
28/* PTRACE_SYSCALL is 24 */
29
30#define PTRACE_GETCRUNCHREGS 25
31#define PTRACE_SETCRUNCHREGS 26
32
28/* 33/*
29 * PSR bits 34 * PSR bits
30 */ 35 */
diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h
index ea3ed24652..aa4b5782f0 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/signal.h b/include/asm-arm/signal.h
index ced6916191..d0fb487aba 100644
--- a/include/asm-arm/signal.h
+++ b/include/asm-arm/signal.h
@@ -82,7 +82,6 @@ typedef unsigned long sigset_t;
82 * is running in 26-bit. 82 * is running in 26-bit.
83 * SA_ONSTACK allows alternate signal stacks (see sigaltstack(2)). 83 * SA_ONSTACK allows alternate signal stacks (see sigaltstack(2)).
84 * SA_RESTART flag to get restarting signals (which were the default long ago) 84 * SA_RESTART flag to get restarting signals (which were the default long ago)
85 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
86 * SA_NODEFER prevents the current signal from being masked in the handler. 85 * SA_NODEFER prevents the current signal from being masked in the handler.
87 * SA_RESETHAND clears the handler when the signal is delivered. 86 * SA_RESETHAND clears the handler when the signal is delivered.
88 * 87 *
@@ -101,7 +100,6 @@ typedef unsigned long sigset_t;
101 100
102#define SA_NOMASK SA_NODEFER 101#define SA_NOMASK SA_NODEFER
103#define SA_ONESHOT SA_RESETHAND 102#define SA_ONESHOT SA_RESETHAND
104#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
105 103
106 104
107/* 105/*
@@ -113,10 +111,6 @@ typedef unsigned long sigset_t;
113#define MINSIGSTKSZ 2048 111#define MINSIGSTKSZ 2048
114#define SIGSTKSZ 8192 112#define SIGSTKSZ 8192
115 113
116#ifdef __KERNEL__
117#define SA_TIMER 0x40000000
118#endif
119
120#include <asm-generic/signal.h> 114#include <asm-generic/signal.h>
121 115
122#ifdef __KERNEL__ 116#ifdef __KERNEL__
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 3c51da6438..19f7df702b 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 406ca97a8a..01b7c26a30 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -199,7 +199,21 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
199 : "cc"); 199 : "cc");
200} 200}
201 201
202#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 202static inline int __raw_read_trylock(raw_rwlock_t *rw)
203{
204 unsigned long tmp, tmp2 = 1;
205
206 __asm__ __volatile__(
207"1: ldrex %0, [%2]\n"
208" adds %0, %0, #1\n"
209" strexpl %1, %0, [%2]\n"
210 : "=&r" (tmp), "+r" (tmp2)
211 : "r" (&rw->lock)
212 : "cc");
213
214 smp_mb();
215 return tmp2 == 0;
216}
203 217
204/* read_can_lock - would read_trylock() succeed? */ 218/* read_can_lock - would read_trylock() succeed? */
205#define __raw_read_can_lock(x) ((x)->lock < 0x80000000) 219#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 6001febfe6..f05fbe3157 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
@@ -176,7 +180,6 @@ extern unsigned int user_debug;
176#define wmb() mb() 180#define wmb() mb()
177#define read_barrier_depends() do { } while(0) 181#define read_barrier_depends() do { } while(0)
178#define set_mb(var, value) do { var = value; mb(); } while (0) 182#define set_mb(var, value) do { var = value; mb(); } while (0)
179#define set_wmb(var, value) do { var = value; wmb(); } while (0)
180#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); 183#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
181 184
182/* 185/*
@@ -208,130 +211,7 @@ static inline void sched_cacheflush(void)
208{ 211{
209} 212}
210 213
211/* 214#include <linux/irqflags.h>
212 * CPU interrupt mask handling.
213 */
214#if __LINUX_ARM_ARCH__ >= 6
215
216#define local_irq_save(x) \
217 ({ \
218 __asm__ __volatile__( \
219 "mrs %0, cpsr @ local_irq_save\n" \
220 "cpsid i" \
221 : "=r" (x) : : "memory", "cc"); \
222 })
223
224#define local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc")
225#define local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc")
226#define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
227#define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
228
229#else
230
231/*
232 * Save the current interrupt enable state & disable IRQs
233 */
234#define local_irq_save(x) \
235 ({ \
236 unsigned long temp; \
237 (void) (&temp == &x); \
238 __asm__ __volatile__( \
239 "mrs %0, cpsr @ local_irq_save\n" \
240" orr %1, %0, #128\n" \
241" msr cpsr_c, %1" \
242 : "=r" (x), "=r" (temp) \
243 : \
244 : "memory", "cc"); \
245 })
246
247/*
248 * Enable IRQs
249 */
250#define local_irq_enable() \
251 ({ \
252 unsigned long temp; \
253 __asm__ __volatile__( \
254 "mrs %0, cpsr @ local_irq_enable\n" \
255" bic %0, %0, #128\n" \
256" msr cpsr_c, %0" \
257 : "=r" (temp) \
258 : \
259 : "memory", "cc"); \
260 })
261
262/*
263 * Disable IRQs
264 */
265#define local_irq_disable() \
266 ({ \
267 unsigned long temp; \
268 __asm__ __volatile__( \
269 "mrs %0, cpsr @ local_irq_disable\n" \
270" orr %0, %0, #128\n" \
271" msr cpsr_c, %0" \
272 : "=r" (temp) \
273 : \
274 : "memory", "cc"); \
275 })
276
277/*
278 * Enable FIQs
279 */
280#define local_fiq_enable() \
281 ({ \
282 unsigned long temp; \
283 __asm__ __volatile__( \
284 "mrs %0, cpsr @ stf\n" \
285" bic %0, %0, #64\n" \
286" msr cpsr_c, %0" \
287 : "=r" (temp) \
288 : \
289 : "memory", "cc"); \
290 })
291
292/*
293 * Disable FIQs
294 */
295#define local_fiq_disable() \
296 ({ \
297 unsigned long temp; \
298 __asm__ __volatile__( \
299 "mrs %0, cpsr @ clf\n" \
300" orr %0, %0, #64\n" \
301" msr cpsr_c, %0" \
302 : "=r" (temp) \
303 : \
304 : "memory", "cc"); \
305 })
306
307#endif
308
309/*
310 * Save the current interrupt enable state.
311 */
312#define local_save_flags(x) \
313 ({ \
314 __asm__ __volatile__( \
315 "mrs %0, cpsr @ local_save_flags" \
316 : "=r" (x) : : "memory", "cc"); \
317 })
318
319/*
320 * restore saved IRQ & FIQ state
321 */
322#define local_irq_restore(x) \
323 __asm__ __volatile__( \
324 "msr cpsr_c, %0 @ local_irq_restore\n" \
325 : \
326 : "r" (x) \
327 : "memory", "cc")
328
329#define irqs_disabled() \
330({ \
331 unsigned long flags; \
332 local_save_flags(flags); \
333 (int)(flags & PSR_I_BIT); \
334})
335 215
336#ifdef CONFIG_SMP 216#ifdef CONFIG_SMP
337 217
@@ -406,17 +286,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
406#error SMP is not supported on this platform 286#error SMP is not supported on this platform
407#endif 287#endif
408 case 1: 288 case 1:
409 local_irq_save(flags); 289 raw_local_irq_save(flags);
410 ret = *(volatile unsigned char *)ptr; 290 ret = *(volatile unsigned char *)ptr;
411 *(volatile unsigned char *)ptr = x; 291 *(volatile unsigned char *)ptr = x;
412 local_irq_restore(flags); 292 raw_local_irq_restore(flags);
413 break; 293 break;
414 294
415 case 4: 295 case 4:
416 local_irq_save(flags); 296 raw_local_irq_save(flags);
417 ret = *(volatile unsigned long *)ptr; 297 ret = *(volatile unsigned long *)ptr;
418 *(volatile unsigned long *)ptr = x; 298 *(volatile unsigned long *)ptr = x;
419 local_irq_restore(flags); 299 raw_local_irq_restore(flags);
420 break; 300 break;
421#else 301#else
422 case 1: 302 case 1:
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
index cfbccb63c6..f28b236139 100644
--- a/include/asm-arm/thread_info.h
+++ b/include/asm-arm/thread_info.h
@@ -59,6 +59,7 @@ struct thread_info {
59 struct cpu_context_save cpu_context; /* cpu context */ 59 struct cpu_context_save cpu_context; /* cpu context */
60 __u8 used_cp[16]; /* thread used copro */ 60 __u8 used_cp[16]; /* thread used copro */
61 unsigned long tp_value; 61 unsigned long tp_value;
62 struct crunch_state crunchstate;
62 union fp_state fpstate __attribute__((aligned(8))); 63 union fp_state fpstate __attribute__((aligned(8)));
63 union vfp_state vfpstate; 64 union vfp_state vfpstate;
64 struct restart_block restart_block; 65 struct restart_block restart_block;
@@ -101,16 +102,22 @@ extern void free_thread_info(struct thread_info *);
101#define thread_saved_fp(tsk) \ 102#define thread_saved_fp(tsk) \
102 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) 103 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
103 104
105extern void crunch_task_disable(struct thread_info *);
106extern void crunch_task_copy(struct thread_info *, void *);
107extern void crunch_task_restore(struct thread_info *, void *);
108extern void crunch_task_release(struct thread_info *);
109
104extern void iwmmxt_task_disable(struct thread_info *); 110extern void iwmmxt_task_disable(struct thread_info *);
105extern void iwmmxt_task_copy(struct thread_info *, void *); 111extern void iwmmxt_task_copy(struct thread_info *, void *);
106extern void iwmmxt_task_restore(struct thread_info *, void *); 112extern void iwmmxt_task_restore(struct thread_info *, void *);
107extern void iwmmxt_task_release(struct thread_info *); 113extern void iwmmxt_task_release(struct thread_info *);
114extern void iwmmxt_task_switch(struct thread_info *);
108 115
109#endif 116#endif
110 117
111/* 118/*
112 * We use bit 30 of the preempt_count to indicate that kernel 119 * We use bit 30 of the preempt_count to indicate that kernel
113 * preemption is occuring. See include/asm-arm/hardirq.h. 120 * preemption is occurring. See include/asm-arm/hardirq.h.
114 */ 121 */
115#define PREEMPT_ACTIVE 0x40000000 122#define PREEMPT_ACTIVE 0x40000000
116 123
diff --git a/include/asm-arm/timeofday.h b/include/asm-arm/timeofday.h
new file mode 100644
index 0000000000..27254bd5b9
--- /dev/null
+++ b/include/asm-arm/timeofday.h
@@ -0,0 +1,4 @@
1#ifndef _ASM_ARM_TIMEOFDAY_H
2#define _ASM_ARM_TIMEOFDAY_H
3#include <asm-generic/timeofday.h>
4#endif
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h
index d97fc76189..cd10a0b5f8 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/uaccess.h b/include/asm-arm/uaccess.h
index 064f0f5e8e..87aba57a66 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -41,15 +41,24 @@ struct exception_table_entry
41extern int fixup_exception(struct pt_regs *regs); 41extern int fixup_exception(struct pt_regs *regs);
42 42
43/* 43/*
44 * These two are intentionally not defined anywhere - if the kernel
45 * code generates any references to them, that's a bug.
46 */
47extern int __get_user_bad(void);
48extern int __put_user_bad(void);
49
50/*
44 * Note that this is actually 0x1,0000,0000 51 * Note that this is actually 0x1,0000,0000
45 */ 52 */
46#define KERNEL_DS 0x00000000 53#define KERNEL_DS 0x00000000
47#define USER_DS TASK_SIZE
48
49#define get_ds() (KERNEL_DS) 54#define get_ds() (KERNEL_DS)
55
56#ifdef CONFIG_MMU
57
58#define USER_DS TASK_SIZE
50#define get_fs() (current_thread_info()->addr_limit) 59#define get_fs() (current_thread_info()->addr_limit)
51 60
52static inline void set_fs (mm_segment_t fs) 61static inline void set_fs(mm_segment_t fs)
53{ 62{
54 current_thread_info()->addr_limit = fs; 63 current_thread_info()->addr_limit = fs;
55 modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER); 64 modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER);
@@ -75,8 +84,6 @@ static inline void set_fs (mm_segment_t fs)
75 : "cc"); \ 84 : "cc"); \
76 flag; }) 85 flag; })
77 86
78#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
79
80/* 87/*
81 * Single-value transfer routines. They automatically use the right 88 * Single-value transfer routines. They automatically use the right
82 * size if we just have the right pointer type. Note that the functions 89 * size if we just have the right pointer type. Note that the functions
@@ -87,20 +94,10 @@ static inline void set_fs (mm_segment_t fs)
87 * fixup code, but there are a few places where it intrudes on the 94 * fixup code, but there are a few places where it intrudes on the
88 * main code path. When we only write to user space, there is no 95 * main code path. When we only write to user space, there is no
89 * problem. 96 * problem.
90 *
91 * The "__xxx" versions of the user access functions do not verify the
92 * address space - it must have been done previously with a separate
93 * "access_ok()" call.
94 *
95 * The "xxx_error" versions set the third argument to EFAULT if an
96 * error occurs, and leave it unchanged on success. Note that these
97 * versions are void (ie, don't return a value as such).
98 */ 97 */
99
100extern int __get_user_1(void *); 98extern int __get_user_1(void *);
101extern int __get_user_2(void *); 99extern int __get_user_2(void *);
102extern int __get_user_4(void *); 100extern int __get_user_4(void *);
103extern int __get_user_bad(void);
104 101
105#define __get_user_x(__r2,__p,__e,__s,__i...) \ 102#define __get_user_x(__r2,__p,__e,__s,__i...) \
106 __asm__ __volatile__ ( \ 103 __asm__ __volatile__ ( \
@@ -131,6 +128,74 @@ extern int __get_user_bad(void);
131 __e; \ 128 __e; \
132 }) 129 })
133 130
131extern int __put_user_1(void *, unsigned int);
132extern int __put_user_2(void *, unsigned int);
133extern int __put_user_4(void *, unsigned int);
134extern int __put_user_8(void *, unsigned long long);
135
136#define __put_user_x(__r2,__p,__e,__s) \
137 __asm__ __volatile__ ( \
138 __asmeq("%0", "r0") __asmeq("%2", "r2") \
139 "bl __put_user_" #__s \
140 : "=&r" (__e) \
141 : "0" (__p), "r" (__r2) \
142 : "ip", "lr", "cc")
143
144#define put_user(x,p) \
145 ({ \
146 const register typeof(*(p)) __r2 asm("r2") = (x); \
147 const register typeof(*(p)) __user *__p asm("r0") = (p);\
148 register int __e asm("r0"); \
149 switch (sizeof(*(__p))) { \
150 case 1: \
151 __put_user_x(__r2, __p, __e, 1); \
152 break; \
153 case 2: \
154 __put_user_x(__r2, __p, __e, 2); \
155 break; \
156 case 4: \
157 __put_user_x(__r2, __p, __e, 4); \
158 break; \
159 case 8: \
160 __put_user_x(__r2, __p, __e, 8); \
161 break; \
162 default: __e = __put_user_bad(); break; \
163 } \
164 __e; \
165 })
166
167#else /* CONFIG_MMU */
168
169/*
170 * uClinux has only one addr space, so has simplified address limits.
171 */
172#define USER_DS KERNEL_DS
173
174#define segment_eq(a,b) (1)
175#define __addr_ok(addr) (1)
176#define __range_ok(addr,size) (0)
177#define get_fs() (KERNEL_DS)
178
179static inline void set_fs(mm_segment_t fs)
180{
181}
182
183#define get_user(x,p) __get_user(x,p)
184#define put_user(x,p) __put_user(x,p)
185
186#endif /* CONFIG_MMU */
187
188#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
189
190/*
191 * The "__xxx" versions of the user access functions do not verify the
192 * address space - it must have been done previously with a separate
193 * "access_ok()" call.
194 *
195 * The "xxx_error" versions set the third argument to EFAULT if an
196 * error occurs, and leave it unchanged on success. Note that these
197 * versions are void (ie, don't return a value as such).
198 */
134#define __get_user(x,ptr) \ 199#define __get_user(x,ptr) \
135({ \ 200({ \
136 long __gu_err = 0; \ 201 long __gu_err = 0; \
@@ -212,43 +277,6 @@ do { \
212 : "r" (addr), "i" (-EFAULT) \ 277 : "r" (addr), "i" (-EFAULT) \
213 : "cc") 278 : "cc")
214 279
215extern int __put_user_1(void *, unsigned int);
216extern int __put_user_2(void *, unsigned int);
217extern int __put_user_4(void *, unsigned int);
218extern int __put_user_8(void *, unsigned long long);
219extern int __put_user_bad(void);
220
221#define __put_user_x(__r2,__p,__e,__s) \
222 __asm__ __volatile__ ( \
223 __asmeq("%0", "r0") __asmeq("%2", "r2") \
224 "bl __put_user_" #__s \
225 : "=&r" (__e) \
226 : "0" (__p), "r" (__r2) \
227 : "ip", "lr", "cc")
228
229#define put_user(x,p) \
230 ({ \
231 const register typeof(*(p)) __r2 asm("r2") = (x); \
232 const register typeof(*(p)) __user *__p asm("r0") = (p);\
233 register int __e asm("r0"); \
234 switch (sizeof(*(__p))) { \
235 case 1: \
236 __put_user_x(__r2, __p, __e, 1); \
237 break; \
238 case 2: \
239 __put_user_x(__r2, __p, __e, 2); \
240 break; \
241 case 4: \
242 __put_user_x(__r2, __p, __e, 4); \
243 break; \
244 case 8: \
245 __put_user_x(__r2, __p, __e, 8); \
246 break; \
247 default: __e = __put_user_bad(); break; \
248 } \
249 __e; \
250 })
251
252#define __put_user(x,ptr) \ 280#define __put_user(x,ptr) \
253({ \ 281({ \
254 long __pu_err = 0; \ 282 long __pu_err = 0; \
@@ -353,66 +381,54 @@ do { \
353 : "r" (x), "i" (-EFAULT) \ 381 : "r" (x), "i" (-EFAULT) \
354 : "cc") 382 : "cc")
355 383
356extern unsigned long __arch_copy_from_user(void *to, const void __user *from, unsigned long n); 384
357extern unsigned long __arch_copy_to_user(void __user *to, const void *from, unsigned long n); 385#ifdef CONFIG_MMU
358extern unsigned long __arch_clear_user(void __user *addr, unsigned long n); 386extern unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n);
359extern unsigned long __arch_strncpy_from_user(char *to, const char __user *from, unsigned long count); 387extern unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n);
360extern unsigned long __arch_strnlen_user(const char __user *s, long n); 388extern unsigned long __clear_user(void __user *addr, unsigned long n);
389#else
390#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0)
391#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0)
392#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0)
393#endif
394
395extern unsigned long __strncpy_from_user(char *to, const char __user *from, unsigned long count);
396extern unsigned long __strnlen_user(const char __user *s, long n);
361 397
362static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) 398static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
363{ 399{
364 if (access_ok(VERIFY_READ, from, n)) 400 if (access_ok(VERIFY_READ, from, n))
365 n = __arch_copy_from_user(to, from, n); 401 n = __copy_from_user(to, from, n);
366 else /* security hole - plug it */ 402 else /* security hole - plug it */
367 memzero(to, n); 403 memzero(to, n);
368 return n; 404 return n;
369} 405}
370 406
371static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
372{
373 return __arch_copy_from_user(to, from, n);
374}
375
376static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) 407static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
377{ 408{
378 if (access_ok(VERIFY_WRITE, to, n)) 409 if (access_ok(VERIFY_WRITE, to, n))
379 n = __arch_copy_to_user(to, from, n); 410 n = __copy_to_user(to, from, n);
380 return n; 411 return n;
381} 412}
382 413
383static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
384{
385 return __arch_copy_to_user(to, from, n);
386}
387
388#define __copy_to_user_inatomic __copy_to_user 414#define __copy_to_user_inatomic __copy_to_user
389#define __copy_from_user_inatomic __copy_from_user 415#define __copy_from_user_inatomic __copy_from_user
390 416
391static inline unsigned long clear_user (void __user *to, unsigned long n) 417static inline unsigned long clear_user(void __user *to, unsigned long n)
392{ 418{
393 if (access_ok(VERIFY_WRITE, to, n)) 419 if (access_ok(VERIFY_WRITE, to, n))
394 n = __arch_clear_user(to, n); 420 n = __clear_user(to, n);
395 return n; 421 return n;
396} 422}
397 423
398static inline unsigned long __clear_user (void __user *to, unsigned long n) 424static inline long strncpy_from_user(char *dst, const char __user *src, long count)
399{
400 return __arch_clear_user(to, n);
401}
402
403static inline long strncpy_from_user (char *dst, const char __user *src, long count)
404{ 425{
405 long res = -EFAULT; 426 long res = -EFAULT;
406 if (access_ok(VERIFY_READ, src, 1)) 427 if (access_ok(VERIFY_READ, src, 1))
407 res = __arch_strncpy_from_user(dst, src, count); 428 res = __strncpy_from_user(dst, src, count);
408 return res; 429 return res;
409} 430}
410 431
411static inline long __strncpy_from_user (char *dst, const char __user *src, long count)
412{
413 return __arch_strncpy_from_user(dst, src, count);
414}
415
416#define strlen_user(s) strnlen_user(s, ~0UL >> 1) 432#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
417 433
418static inline long strnlen_user(const char __user *s, long n) 434static inline long strnlen_user(const char __user *s, long n)
@@ -420,7 +436,7 @@ static inline long strnlen_user(const char __user *s, long n)
420 unsigned long res = 0; 436 unsigned long res = 0;
421 437
422 if (__addr_ok(s)) 438 if (__addr_ok(s))
423 res = __arch_strnlen_user(s, n); 439 res = __strnlen_user(s, n);
424 440
425 return res; 441 return res;
426} 442}
diff --git a/include/asm-arm/ucontext.h b/include/asm-arm/ucontext.h
index f853130137..bf65e9f452 100644
--- a/include/asm-arm/ucontext.h
+++ b/include/asm-arm/ucontext.h
@@ -1,12 +1,103 @@
1#ifndef _ASMARM_UCONTEXT_H 1#ifndef _ASMARM_UCONTEXT_H
2#define _ASMARM_UCONTEXT_H 2#define _ASMARM_UCONTEXT_H
3 3
4#include <asm/fpstate.h>
5
6/*
7 * struct sigcontext only has room for the basic registers, but struct
8 * ucontext now has room for all registers which need to be saved and
9 * restored. Coprocessor registers are stored in uc_regspace. Each
10 * coprocessor's saved state should start with a documented 32-bit magic
11 * number, followed by a 32-bit word giving the coproccesor's saved size.
12 * uc_regspace may be expanded if necessary, although this takes some
13 * coordination with glibc.
14 */
15
4struct ucontext { 16struct ucontext {
5 unsigned long uc_flags; 17 unsigned long uc_flags;
6 struct ucontext *uc_link; 18 struct ucontext *uc_link;
7 stack_t uc_stack; 19 stack_t uc_stack;
8 struct sigcontext uc_mcontext; 20 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */ 21 sigset_t uc_sigmask;
22 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
23 int __unused[32 - (sizeof (sigset_t) / sizeof (int))];
24 /* Last for extensibility. Eight byte aligned because some
25 coprocessors require eight byte alignment. */
26 unsigned long uc_regspace[128] __attribute__((__aligned__(8)));
10}; 27};
11 28
29#ifdef __KERNEL__
30
31/*
32 * Coprocessor save state. The magic values and specific
33 * coprocessor's layouts are part of the userspace ABI. Each one of
34 * these should be a multiple of eight bytes and aligned to eight
35 * bytes, to prevent unpredictable padding in the signal frame.
36 */
37
38#ifdef CONFIG_CRUNCH
39#define CRUNCH_MAGIC 0x5065cf03
40#define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8)
41
42struct crunch_sigframe {
43 unsigned long magic;
44 unsigned long size;
45 struct crunch_state storage;
46} __attribute__((__aligned__(8)));
47#endif
48
49#ifdef CONFIG_IWMMXT
50/* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */
51#define IWMMXT_MAGIC 0x12ef842a
52#define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
53
54struct iwmmxt_sigframe {
55 unsigned long magic;
56 unsigned long size;
57 struct iwmmxt_struct storage;
58} __attribute__((__aligned__(8)));
59#endif /* CONFIG_IWMMXT */
60
61#ifdef CONFIG_VFP
62#if __LINUX_ARM_ARCH__ < 6
63/* For ARM pre-v6, we use fstmiax and fldmiax. This adds one extra
64 * word after the registers, and a word of padding at the end for
65 * alignment. */
66#define VFP_MAGIC 0x56465001
67#define VFP_STORAGE_SIZE 152
68#else
69#define VFP_MAGIC 0x56465002
70#define VFP_STORAGE_SIZE 144
71#endif
72
73struct vfp_sigframe
74{
75 unsigned long magic;
76 unsigned long size;
77 union vfp_state storage;
78};
79#endif /* CONFIG_VFP */
80
81/*
82 * Auxiliary signal frame. This saves stuff like FP state.
83 * The layout of this structure is not part of the user ABI,
84 * because the config options aren't. uc_regspace is really
85 * one of these.
86 */
87struct aux_sigframe {
88#ifdef CONFIG_CRUNCH
89 struct crunch_sigframe crunch;
90#endif
91#ifdef CONFIG_IWMMXT
92 struct iwmmxt_sigframe iwmmxt;
93#endif
94#if 0 && defined CONFIG_VFP /* Not yet saved. */
95 struct vfp_sigframe vfp;
96#endif
97 /* Something that isn't a valid magic number for any coprocessor. */
98 unsigned long end_magic;
99} __attribute__((__aligned__(8)));
100
101#endif
102
12#endif /* !_ASMARM_UCONTEXT_H */ 103#endif /* !_ASMARM_UCONTEXT_H */
diff --git a/include/asm-arm/unaligned.h b/include/asm-arm/unaligned.h
index 1b39c2f322..795b9e5b9e 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 1e891f860e..2ab4078334 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 } \
diff --git a/include/asm-arm26/floppy.h b/include/asm-arm26/floppy.h
index 9e090ad7e4..efb732165a 100644
--- a/include/asm-arm26/floppy.h
+++ b/include/asm-arm26/floppy.h
@@ -22,7 +22,7 @@
22 22
23#define fd_inb(port) inb((port)) 23#define fd_inb(port) inb((port))
24#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\ 24#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
25 SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL) 25 IRQF_DISABLED,"floppy",NULL)
26#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL) 26#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
27#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK) 27#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
28#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK) 28#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
diff --git a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h
index 19ac9101a6..63a8881fae 100644
--- a/include/asm-arm26/pgtable.h
+++ b/include/asm-arm26/pgtable.h
@@ -186,12 +186,12 @@ extern struct page *empty_zero_page;
186 * return a pointer to memory (no special alignment) 186 * return a pointer to memory (no special alignment)
187 */ 187 */
188#define pmd_page(pmd) ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT)) 188#define pmd_page(pmd) ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT))
189#define pmd_page_kernel(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT)) 189#define pmd_page_vaddr(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT))
190 190
191#define pte_offset_kernel(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) 191#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
192 192
193#define pte_offset_map(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) 193#define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
194#define pte_offset_map_nested(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) 194#define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
195#define pte_unmap(pte) do { } while (0) 195#define pte_unmap(pte) do { } while (0)
196#define pte_unmap_nested(pte) do { } while (0) 196#define pte_unmap_nested(pte) do { } while (0)
197 197
diff --git a/include/asm-arm26/signal.h b/include/asm-arm26/signal.h
index 37ad253555..967ba4947e 100644
--- a/include/asm-arm26/signal.h
+++ b/include/asm-arm26/signal.h
@@ -82,7 +82,6 @@ typedef unsigned long sigset_t;
82 * is running in 26-bit. 82 * is running in 26-bit.
83 * SA_ONSTACK allows alternate signal stacks (see sigaltstack(2)). 83 * SA_ONSTACK allows alternate signal stacks (see sigaltstack(2)).
84 * SA_RESTART flag to get restarting signals (which were the default long ago) 84 * SA_RESTART flag to get restarting signals (which were the default long ago)
85 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
86 * SA_NODEFER prevents the current signal from being masked in the handler. 85 * SA_NODEFER prevents the current signal from being masked in the handler.
87 * SA_RESETHAND clears the handler when the signal is delivered. 86 * SA_RESETHAND clears the handler when the signal is delivered.
88 * 87 *
@@ -101,7 +100,6 @@ typedef unsigned long sigset_t;
101 100
102#define SA_NOMASK SA_NODEFER 101#define SA_NOMASK SA_NODEFER
103#define SA_ONESHOT SA_RESETHAND 102#define SA_ONESHOT SA_RESETHAND
104#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
105 103
106 104
107/* 105/*
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h
index 3c51da6438..19f7df702b 100644
--- a/include/asm-arm26/socket.h
+++ b/include/asm-arm26/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm26/system.h b/include/asm-arm26/system.h
index d1f69d7061..00ae32aa1d 100644
--- a/include/asm-arm26/system.h
+++ b/include/asm-arm26/system.h
@@ -90,7 +90,6 @@ extern unsigned int user_debug;
90 90
91#define read_barrier_depends() do { } while(0) 91#define read_barrier_depends() do { } while(0)
92#define set_mb(var, value) do { var = value; mb(); } while (0) 92#define set_mb(var, value) do { var = value; mb(); } while (0)
93#define set_wmb(var, value) do { var = value; wmb(); } while (0)
94 93
95/* 94/*
96 * We assume knowledge of how 95 * We assume knowledge of how
diff --git a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h
index 70eb6d91cf..c6d2436c9d 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 } \
diff --git a/include/asm-avr32/Kbuild b/include/asm-avr32/Kbuild
new file mode 100644
index 0000000000..8770e73ce9
--- /dev/null
+++ b/include/asm-avr32/Kbuild
@@ -0,0 +1,3 @@
1include include/asm-generic/Kbuild.asm
2
3headers-y += cachectl.h
diff --git a/include/asm-avr32/a.out.h b/include/asm-avr32/a.out.h
new file mode 100644
index 0000000000..50bf6e31a1
--- /dev/null
+++ b/include/asm-avr32/a.out.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_AVR32_A_OUT_H
2#define __ASM_AVR32_A_OUT_H
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#ifdef __KERNEL__
21
22#define STACK_TOP TASK_SIZE
23
24#endif
25
26#endif /* __ASM_AVR32_A_OUT_H */
diff --git a/include/asm-avr32/addrspace.h b/include/asm-avr32/addrspace.h
new file mode 100644
index 0000000000..366794858e
--- /dev/null
+++ b/include/asm-avr32/addrspace.h
@@ -0,0 +1,43 @@
1/*
2 * Defitions for the address spaces of the AVR32 CPUs. Heavily based on
3 * include/asm-sh/addrspace.h
4 *
5 * Copyright (C) 2004-2006 Atmel Corporation
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#ifndef __ASM_AVR32_ADDRSPACE_H
12#define __ASM_AVR32_ADDRSPACE_H
13
14#ifdef CONFIG_MMU
15
16/* Memory segments when segmentation is enabled */
17#define P0SEG 0x00000000
18#define P1SEG 0x80000000
19#define P2SEG 0xa0000000
20#define P3SEG 0xc0000000
21#define P4SEG 0xe0000000
22
23/* Returns the privileged segment base of a given address */
24#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
25
26/* Returns the physical address of a PnSEG (n=1,2) address */
27#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
28
29/*
30 * Map an address to a certain privileged segment
31 */
32#define P1SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
33 | P1SEG))
34#define P2SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
35 | P2SEG))
36#define P3SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
37 | P3SEG))
38#define P4SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
39 | P4SEG))
40
41#endif /* CONFIG_MMU */
42
43#endif /* __ASM_AVR32_ADDRSPACE_H */
diff --git a/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h b/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h
new file mode 100644
index 0000000000..ce1150d443
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h
@@ -0,0 +1,36 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Peripheral Data Controller (PDC) 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_PDC_H
17#define AT91RM9200_PDC_H
18
19#define AT91_PDC_RPR 0x100 /* Receive Pointer Register */
20#define AT91_PDC_RCR 0x104 /* Receive Counter Register */
21#define AT91_PDC_TPR 0x108 /* Transmit Pointer Register */
22#define AT91_PDC_TCR 0x10c /* Transmit Counter Register */
23#define AT91_PDC_RNPR 0x110 /* Receive Next Pointer Register */
24#define AT91_PDC_RNCR 0x114 /* Receive Next Counter Register */
25#define AT91_PDC_TNPR 0x118 /* Transmit Next Pointer Register */
26#define AT91_PDC_TNCR 0x11c /* Transmit Next Counter Register */
27
28#define AT91_PDC_PTCR 0x120 /* Transfer Control Register */
29#define AT91_PDC_RXTEN (1 << 0) /* Receiver Transfer Enable */
30#define AT91_PDC_RXTDIS (1 << 1) /* Receiver Transfer Disable */
31#define AT91_PDC_TXTEN (1 << 8) /* Transmitter Transfer Enable */
32#define AT91_PDC_TXTDIS (1 << 9) /* Transmitter Transfer Disable */
33
34#define AT91_PDC_PTSR 0x124 /* Transfer Status Register */
35
36#endif
diff --git a/include/asm-avr32/arch-at32ap/at91rm9200_usart.h b/include/asm-avr32/arch-at32ap/at91rm9200_usart.h
new file mode 100644
index 0000000000..79f851e31b
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/at91rm9200_usart.h
@@ -0,0 +1,123 @@
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
new file mode 100644
index 0000000000..39368e18ab
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -0,0 +1,35 @@
1/*
2 * Platform data definitions.
3 */
4#ifndef __ASM_ARCH_BOARD_H
5#define __ASM_ARCH_BOARD_H
6
7#include <linux/types.h>
8
9/* Add basic devices: system manager, interrupt controller, portmuxes, etc. */
10void at32_add_system_devices(void);
11
12#define AT91_NR_UART 4
13extern struct platform_device *at91_default_console_device;
14
15struct platform_device *at32_add_device_usart(unsigned int id);
16
17struct eth_platform_data {
18 u8 valid;
19 u8 mii_phy_addr;
20 u8 is_rmii;
21 u8 hw_addr[6];
22};
23struct platform_device *
24at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
25
26struct platform_device *at32_add_device_spi(unsigned int id);
27
28struct lcdc_platform_data {
29 unsigned long fbmem_start;
30 unsigned long fbmem_size;
31};
32struct platform_device *
33at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data);
34
35#endif /* __ASM_ARCH_BOARD_H */
diff --git a/include/asm-avr32/arch-at32ap/init.h b/include/asm-avr32/arch-at32ap/init.h
new file mode 100644
index 0000000000..43722634e0
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/init.h
@@ -0,0 +1,21 @@
1/*
2 * AT32AP platform initialization calls.
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_AVR32_AT32AP_INIT_H__
11#define __ASM_AVR32_AT32AP_INIT_H__
12
13void setup_platform(void);
14
15/* Called by setup_platform */
16void at32_clock_init(void);
17void at32_portmux_init(void);
18
19void at32_setup_serial_console(unsigned int usart_id);
20
21#endif /* __ASM_AVR32_AT32AP_INIT_H__ */
diff --git a/include/asm-avr32/arch-at32ap/portmux.h b/include/asm-avr32/arch-at32ap/portmux.h
new file mode 100644
index 0000000000..4d50421262
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/portmux.h
@@ -0,0 +1,16 @@
1/*
2 * AT32 portmux interface.
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_AVR32_AT32_PORTMUX_H__
11#define __ASM_AVR32_AT32_PORTMUX_H__
12
13void portmux_set_func(unsigned int portmux_id, unsigned int pin_id,
14 unsigned int function_id);
15
16#endif /* __ASM_AVR32_AT32_PORTMUX_H__ */
diff --git a/include/asm-avr32/arch-at32ap/sm.h b/include/asm-avr32/arch-at32ap/sm.h
new file mode 100644
index 0000000000..265a9ead20
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/sm.h
@@ -0,0 +1,27 @@
1/*
2 * AT32 System Manager interface.
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_AVR32_AT32_SM_H__
11#define __ASM_AVR32_AT32_SM_H__
12
13struct irq_chip;
14struct platform_device;
15
16struct at32_sm {
17 spinlock_t lock;
18 void __iomem *regs;
19 struct irq_chip *eim_chip;
20 unsigned int eim_first_irq;
21 struct platform_device *pdev;
22};
23
24extern struct platform_device at32_sm_device;
25extern struct at32_sm system_manager;
26
27#endif /* __ASM_AVR32_AT32_SM_H__ */
diff --git a/include/asm-avr32/arch-at32ap/smc.h b/include/asm-avr32/arch-at32ap/smc.h
new file mode 100644
index 0000000000..3732b32830
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/smc.h
@@ -0,0 +1,60 @@
1/*
2 * Static Memory Controller for AT32 chips
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * Inspired by the OMAP2 General-Purpose Memory Controller interface
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#ifndef __ARCH_AT32AP_SMC_H
13#define __ARCH_AT32AP_SMC_H
14
15/*
16 * All timing parameters are in nanoseconds.
17 */
18struct smc_config {
19 /* Delay from address valid to assertion of given strobe */
20 u16 ncs_read_setup;
21 u16 nrd_setup;
22 u16 ncs_write_setup;
23 u16 nwe_setup;
24
25 /* Pulse length of given strobe */
26 u16 ncs_read_pulse;
27 u16 nrd_pulse;
28 u16 ncs_write_pulse;
29 u16 nwe_pulse;
30
31 /* Total cycle length of given operation */
32 u16 read_cycle;
33 u16 write_cycle;
34
35 /* Bus width in bytes */
36 u8 bus_width;
37
38 /*
39 * 0: Data is sampled on rising edge of NCS
40 * 1: Data is sampled on rising edge of NRD
41 */
42 unsigned int nrd_controlled:1;
43
44 /*
45 * 0: Data is driven on falling edge of NCS
46 * 1: Data is driven on falling edge of NWR
47 */
48 unsigned int nwe_controlled:1;
49
50 /*
51 * 0: Byte select access type
52 * 1: Byte write access type
53 */
54 unsigned int byte_write:1;
55};
56
57extern int smc_set_configuration(int cs, const struct smc_config *config);
58extern struct smc_config *smc_get_configuration(int cs);
59
60#endif /* __ARCH_AT32AP_SMC_H */
diff --git a/include/asm-avr32/asm.h b/include/asm-avr32/asm.h
new file mode 100644
index 0000000000..515c761895
--- /dev/null
+++ b/include/asm-avr32/asm.h
@@ -0,0 +1,102 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_ASM_H__
9#define __ASM_AVR32_ASM_H__
10
11#include <asm/sysreg.h>
12#include <asm/asm-offsets.h>
13#include <asm/thread_info.h>
14
15#define mask_interrupts ssrf SR_GM_BIT
16#define mask_exceptions ssrf SR_EM_BIT
17#define unmask_interrupts csrf SR_GM_BIT
18#define unmask_exceptions csrf SR_EM_BIT
19
20#ifdef CONFIG_FRAME_POINTER
21 .macro save_fp
22 st.w --sp, r7
23 .endm
24 .macro restore_fp
25 ld.w r7, sp++
26 .endm
27 .macro zero_fp
28 mov r7, 0
29 .endm
30#else
31 .macro save_fp
32 .endm
33 .macro restore_fp
34 .endm
35 .macro zero_fp
36 .endm
37#endif
38 .macro get_thread_info reg
39 mov \reg, sp
40 andl \reg, ~(THREAD_SIZE - 1) & 0xffff
41 .endm
42
43 /* Save and restore registers */
44 .macro save_min sr, tmp=lr
45 pushm lr
46 mfsr \tmp, \sr
47 zero_fp
48 st.w --sp, \tmp
49 .endm
50
51 .macro restore_min sr, tmp=lr
52 ld.w \tmp, sp++
53 mtsr \sr, \tmp
54 popm lr
55 .endm
56
57 .macro save_half sr, tmp=lr
58 save_fp
59 pushm r8-r9,r10,r11,r12,lr
60 zero_fp
61 mfsr \tmp, \sr
62 st.w --sp, \tmp
63 .endm
64
65 .macro restore_half sr, tmp=lr
66 ld.w \tmp, sp++
67 mtsr \sr, \tmp
68 popm r8-r9,r10,r11,r12,lr
69 restore_fp
70 .endm
71
72 .macro save_full_user sr, tmp=lr
73 stmts --sp, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr
74 st.w --sp, lr
75 zero_fp
76 mfsr \tmp, \sr
77 st.w --sp, \tmp
78 .endm
79
80 .macro restore_full_user sr, tmp=lr
81 ld.w \tmp, sp++
82 mtsr \sr, \tmp
83 ld.w lr, sp++
84 ldmts sp++, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr
85 .endm
86
87 /* uaccess macros */
88 .macro branch_if_kernel scratch, label
89 get_thread_info \scratch
90 ld.w \scratch, \scratch[TI_flags]
91 bld \scratch, TIF_USERSPACE
92 brcc \label
93 .endm
94
95 .macro ret_if_privileged scratch, addr, size, ret
96 sub \scratch, \size, 1
97 add \scratch, \addr
98 retcs \ret
99 retmi \ret
100 .endm
101
102#endif /* __ASM_AVR32_ASM_H__ */
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
new file mode 100644
index 0000000000..e0b9c44c12
--- /dev/null
+++ b/include/asm-avr32/atomic.h
@@ -0,0 +1,201 @@
1/*
2 * Atomic operations that C can't guarantee us. Useful for
3 * resource counting etc.
4 *
5 * But use these as seldom as possible since they are slower than
6 * regular operations.
7 *
8 * Copyright (C) 2004-2006 Atmel Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14#ifndef __ASM_AVR32_ATOMIC_H
15#define __ASM_AVR32_ATOMIC_H
16
17#include <asm/system.h>
18
19typedef struct { volatile int counter; } atomic_t;
20#define ATOMIC_INIT(i) { (i) }
21
22#define atomic_read(v) ((v)->counter)
23#define atomic_set(v, i) (((v)->counter) = i)
24
25/*
26 * atomic_sub_return - subtract the atomic variable
27 * @i: integer value to subtract
28 * @v: pointer of type atomic_t
29 *
30 * Atomically subtracts @i from @v. Returns the resulting value.
31 */
32static inline int atomic_sub_return(int i, atomic_t *v)
33{
34 int result;
35
36 asm volatile(
37 "/* atomic_sub_return */\n"
38 "1: ssrf 5\n"
39 " ld.w %0, %2\n"
40 " sub %0, %3\n"
41 " stcond %1, %0\n"
42 " brne 1b"
43 : "=&r"(result), "=o"(v->counter)
44 : "m"(v->counter), "ir"(i)
45 : "cc");
46
47 return result;
48}
49
50/*
51 * atomic_add_return - add integer to atomic variable
52 * @i: integer value to add
53 * @v: pointer of type atomic_t
54 *
55 * Atomically adds @i to @v. Returns the resulting value.
56 */
57static inline int atomic_add_return(int i, atomic_t *v)
58{
59 int result;
60
61 if (__builtin_constant_p(i))
62 result = atomic_sub_return(-i, v);
63 else
64 asm volatile(
65 "/* atomic_add_return */\n"
66 "1: ssrf 5\n"
67 " ld.w %0, %1\n"
68 " add %0, %3\n"
69 " stcond %2, %0\n"
70 " brne 1b"
71 : "=&r"(result), "=o"(v->counter)
72 : "m"(v->counter), "r"(i)
73 : "cc", "memory");
74
75 return result;
76}
77
78/*
79 * atomic_sub_unless - sub unless the number is a given value
80 * @v: pointer of type atomic_t
81 * @a: the amount to add to v...
82 * @u: ...unless v is equal to u.
83 *
84 * If the atomic value v is not equal to u, this function subtracts a
85 * from v, and returns non zero. If v is equal to u then it returns
86 * zero. This is done as an atomic operation.
87*/
88static inline int atomic_sub_unless(atomic_t *v, int a, int u)
89{
90 int tmp, result = 0;
91
92 asm volatile(
93 "/* atomic_sub_unless */\n"
94 "1: ssrf 5\n"
95 " ld.w %0, %3\n"
96 " cp.w %0, %5\n"
97 " breq 1f\n"
98 " sub %0, %4\n"
99 " stcond %2, %0\n"
100 " brne 1b\n"
101 " mov %1, 1\n"
102 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
104 : "m"(v->counter), "ir"(a), "ir"(u)
105 : "cc", "memory");
106
107 return result;
108}
109
110/*
111 * atomic_add_unless - add unless the number is a given value
112 * @v: pointer of type atomic_t
113 * @a: the amount to add to v...
114 * @u: ...unless v is equal to u.
115 *
116 * If the atomic value v is not equal to u, this function adds a to v,
117 * and returns non zero. If v is equal to u then it returns zero. This
118 * is done as an atomic operation.
119*/
120static inline int atomic_add_unless(atomic_t *v, int a, int u)
121{
122 int tmp, result;
123
124 if (__builtin_constant_p(a))
125 result = atomic_sub_unless(v, -a, u);
126 else {
127 result = 0;
128 asm volatile(
129 "/* atomic_add_unless */\n"
130 "1: ssrf 5\n"
131 " ld.w %0, %3\n"
132 " cp.w %0, %5\n"
133 " breq 1f\n"
134 " add %0, %4\n"
135 " stcond %2, %0\n"
136 " brne 1b\n"
137 " mov %1, 1\n"
138 "1:"
139 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
140 : "m"(v->counter), "r"(a), "ir"(u)
141 : "cc", "memory");
142 }
143
144 return result;
145}
146
147/*
148 * atomic_sub_if_positive - conditionally subtract integer from atomic variable
149 * @i: integer value to subtract
150 * @v: pointer of type atomic_t
151 *
152 * Atomically test @v and subtract @i if @v is greater or equal than @i.
153 * The function returns the old value of @v minus @i.
154 */
155static inline int atomic_sub_if_positive(int i, atomic_t *v)
156{
157 int result;
158
159 asm volatile(
160 "/* atomic_sub_if_positive */\n"
161 "1: ssrf 5\n"
162 " ld.w %0, %2\n"
163 " sub %0, %3\n"
164 " brlt 1f\n"
165 " stcond %1, %0\n"
166 " brne 1b\n"
167 "1:"
168 : "=&r"(result), "=o"(v->counter)
169 : "m"(v->counter), "ir"(i)
170 : "cc", "memory");
171
172 return result;
173}
174
175#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
176#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
177
178#define atomic_sub(i, v) (void)atomic_sub_return(i, v)
179#define atomic_add(i, v) (void)atomic_add_return(i, v)
180#define atomic_dec(v) atomic_sub(1, (v))
181#define atomic_inc(v) atomic_add(1, (v))
182
183#define atomic_dec_return(v) atomic_sub_return(1, v)
184#define atomic_inc_return(v) atomic_add_return(1, v)
185
186#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
187#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0)
188#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
189#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0)
190
191#define atomic_inc_not_zero(v) atomic_add_unless(v, 1, 0)
192#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
193
194#define smp_mb__before_atomic_dec() barrier()
195#define smp_mb__after_atomic_dec() barrier()
196#define smp_mb__before_atomic_inc() barrier()
197#define smp_mb__after_atomic_inc() barrier()
198
199#include <asm-generic/atomic.h>
200
201#endif /* __ASM_AVR32_ATOMIC_H */
diff --git a/include/asm-avr32/auxvec.h b/include/asm-avr32/auxvec.h
new file mode 100644
index 0000000000..d5dd435bf8
--- /dev/null
+++ b/include/asm-avr32/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_AVR32_AUXVEC_H
2#define __ASM_AVR32_AUXVEC_H
3
4#endif /* __ASM_AVR32_AUXVEC_H */
diff --git a/include/asm-avr32/bitops.h b/include/asm-avr32/bitops.h
new file mode 100644
index 0000000000..5299f8c8e1
--- /dev/null
+++ b/include/asm-avr32/bitops.h
@@ -0,0 +1,296 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_BITOPS_H
9#define __ASM_AVR32_BITOPS_H
10
11#include <asm/byteorder.h>
12#include <asm/system.h>
13
14/*
15 * clear_bit() doesn't provide any barrier for the compiler
16 */
17#define smp_mb__before_clear_bit() barrier()
18#define smp_mb__after_clear_bit() barrier()
19
20/*
21 * set_bit - Atomically set a bit in memory
22 * @nr: the bit to set
23 * @addr: the address to start counting from
24 *
25 * This function is atomic and may not be reordered. See __set_bit()
26 * if you do not require the atomic guarantees.
27 *
28 * Note that @nr may be almost arbitrarily large; this function is not
29 * restricted to acting on a single-word quantity.
30 */
31static inline void set_bit(int nr, volatile void * addr)
32{
33 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
34 unsigned long tmp;
35
36 if (__builtin_constant_p(nr)) {
37 asm volatile(
38 "1: ssrf 5\n"
39 " ld.w %0, %2\n"
40 " sbr %0, %3\n"
41 " stcond %1, %0\n"
42 " brne 1b"
43 : "=&r"(tmp), "=o"(*p)
44 : "m"(*p), "i"(nr)
45 : "cc");
46 } else {
47 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
48 asm volatile(
49 "1: ssrf 5\n"
50 " ld.w %0, %2\n"
51 " or %0, %3\n"
52 " stcond %1, %0\n"
53 " brne 1b"
54 : "=&r"(tmp), "=o"(*p)
55 : "m"(*p), "r"(mask)
56 : "cc");
57 }
58}
59
60/*
61 * clear_bit - Clears a bit in memory
62 * @nr: Bit to clear
63 * @addr: Address to start counting from
64 *
65 * clear_bit() is atomic and may not be reordered. However, it does
66 * not contain a memory barrier, so if it is used for locking purposes,
67 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
68 * in order to ensure changes are visible on other processors.
69 */
70static inline void clear_bit(int nr, volatile void * addr)
71{
72 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
73 unsigned long tmp;
74
75 if (__builtin_constant_p(nr)) {
76 asm volatile(
77 "1: ssrf 5\n"
78 " ld.w %0, %2\n"
79 " cbr %0, %3\n"
80 " stcond %1, %0\n"
81 " brne 1b"
82 : "=&r"(tmp), "=o"(*p)
83 : "m"(*p), "i"(nr)
84 : "cc");
85 } else {
86 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
87 asm volatile(
88 "1: ssrf 5\n"
89 " ld.w %0, %2\n"
90 " andn %0, %3\n"
91 " stcond %1, %0\n"
92 " brne 1b"
93 : "=&r"(tmp), "=o"(*p)
94 : "m"(*p), "r"(mask)
95 : "cc");
96 }
97}
98
99/*
100 * change_bit - Toggle a bit in memory
101 * @nr: Bit to change
102 * @addr: Address to start counting from
103 *
104 * change_bit() is atomic and may not be reordered.
105 * Note that @nr may be almost arbitrarily large; this function is not
106 * restricted to acting on a single-word quantity.
107 */
108static inline void change_bit(int nr, volatile void * addr)
109{
110 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
111 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
112 unsigned long tmp;
113
114 asm volatile(
115 "1: ssrf 5\n"
116 " ld.w %0, %2\n"
117 " eor %0, %3\n"
118 " stcond %1, %0\n"
119 " brne 1b"
120 : "=&r"(tmp), "=o"(*p)
121 : "m"(*p), "r"(mask)
122 : "cc");
123}
124
125/*
126 * test_and_set_bit - Set a bit and return its old value
127 * @nr: Bit to set
128 * @addr: Address to count from
129 *
130 * This operation is atomic and cannot be reordered.
131 * It also implies a memory barrier.
132 */
133static inline int test_and_set_bit(int nr, volatile void * addr)
134{
135 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
136 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
137 unsigned long tmp, old;
138
139 if (__builtin_constant_p(nr)) {
140 asm volatile(
141 "1: ssrf 5\n"
142 " ld.w %0, %3\n"
143 " mov %2, %0\n"
144 " sbr %0, %4\n"
145 " stcond %1, %0\n"
146 " brne 1b"
147 : "=&r"(tmp), "=o"(*p), "=&r"(old)
148 : "m"(*p), "i"(nr)
149 : "memory", "cc");
150 } else {
151 asm volatile(
152 "1: ssrf 5\n"
153 " ld.w %2, %3\n"
154 " or %0, %2, %4\n"
155 " stcond %1, %0\n"
156 " brne 1b"
157 : "=&r"(tmp), "=o"(*p), "=&r"(old)
158 : "m"(*p), "r"(mask)
159 : "memory", "cc");
160 }
161
162 return (old & mask) != 0;
163}
164
165/*
166 * test_and_clear_bit - Clear a bit and return its old value
167 * @nr: Bit to clear
168 * @addr: Address to count from
169 *
170 * This operation is atomic and cannot be reordered.
171 * It also implies a memory barrier.
172 */
173static inline int test_and_clear_bit(int nr, volatile void * addr)
174{
175 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
176 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
177 unsigned long tmp, old;
178
179 if (__builtin_constant_p(nr)) {
180 asm volatile(
181 "1: ssrf 5\n"
182 " ld.w %0, %3\n"
183 " mov %2, %0\n"
184 " cbr %0, %4\n"
185 " stcond %1, %0\n"
186 " brne 1b"
187 : "=&r"(tmp), "=o"(*p), "=&r"(old)
188 : "m"(*p), "i"(nr)
189 : "memory", "cc");
190 } else {
191 asm volatile(
192 "1: ssrf 5\n"
193 " ld.w %0, %3\n"
194 " mov %2, %0\n"
195 " andn %0, %4\n"
196 " stcond %1, %0\n"
197 " brne 1b"
198 : "=&r"(tmp), "=o"(*p), "=&r"(old)
199 : "m"(*p), "r"(mask)
200 : "memory", "cc");
201 }
202
203 return (old & mask) != 0;
204}
205
206/*
207 * test_and_change_bit - Change a bit and return its old value
208 * @nr: Bit to change
209 * @addr: Address to count from
210 *
211 * This operation is atomic and cannot be reordered.
212 * It also implies a memory barrier.
213 */
214static inline int test_and_change_bit(int nr, volatile void * addr)
215{
216 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
217 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
218 unsigned long tmp, old;
219
220 asm volatile(
221 "1: ssrf 5\n"
222 " ld.w %2, %3\n"
223 " eor %0, %2, %4\n"
224 " stcond %1, %0\n"
225 " brne 1b"
226 : "=&r"(tmp), "=o"(*p), "=&r"(old)
227 : "m"(*p), "r"(mask)
228 : "memory", "cc");
229
230 return (old & mask) != 0;
231}
232
233#include <asm-generic/bitops/non-atomic.h>
234
235/* Find First bit Set */
236static inline unsigned long __ffs(unsigned long word)
237{
238 unsigned long result;
239
240 asm("brev %1\n\t"
241 "clz %0,%1"
242 : "=r"(result), "=&r"(word)
243 : "1"(word));
244 return result;
245}
246
247/* Find First Zero */
248static inline unsigned long ffz(unsigned long word)
249{
250 return __ffs(~word);
251}
252
253/* Find Last bit Set */
254static inline int fls(unsigned long word)
255{
256 unsigned long result;
257
258 asm("clz %0,%1" : "=r"(result) : "r"(word));
259 return 32 - result;
260}
261
262unsigned long find_first_zero_bit(const unsigned long *addr,
263 unsigned long size);
264unsigned long find_next_zero_bit(const unsigned long *addr,
265 unsigned long size,
266 unsigned long offset);
267unsigned long find_first_bit(const unsigned long *addr,
268 unsigned long size);
269unsigned long find_next_bit(const unsigned long *addr,
270 unsigned long size,
271 unsigned long offset);
272
273/*
274 * ffs: find first bit set. This is defined the same way as
275 * the libc and compiler builtin ffs routines, therefore
276 * differs in spirit from the above ffz (man ffs).
277 *
278 * The difference is that bit numbering starts at 1, and if no bit is set,
279 * the function returns 0.
280 */
281static inline int ffs(unsigned long word)
282{
283 if(word == 0)
284 return 0;
285 return __ffs(word) + 1;
286}
287
288#include <asm-generic/bitops/fls64.h>
289#include <asm-generic/bitops/sched.h>
290#include <asm-generic/bitops/hweight.h>
291
292#include <asm-generic/bitops/ext2-non-atomic.h>
293#include <asm-generic/bitops/ext2-atomic.h>
294#include <asm-generic/bitops/minix-le.h>
295
296#endif /* __ASM_AVR32_BITOPS_H */
diff --git a/include/asm-avr32/bug.h b/include/asm-avr32/bug.h
new file mode 100644
index 0000000000..521766bc93
--- /dev/null
+++ b/include/asm-avr32/bug.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_BUG_H
9#define __ASM_AVR32_BUG_H
10
11#ifdef CONFIG_BUG
12
13/*
14 * According to our Chief Architect, this compact opcode is very
15 * unlikely to ever be implemented.
16 */
17#define AVR32_BUG_OPCODE 0x5df0
18
19#ifdef CONFIG_DEBUG_BUGVERBOSE
20
21#define BUG() \
22 do { \
23 asm volatile(".hword %0\n\t" \
24 ".hword %1\n\t" \
25 ".long %2" \
26 : \
27 : "n"(AVR32_BUG_OPCODE), \
28 "i"(__LINE__), "X"(__FILE__)); \
29 } while (0)
30
31#else
32
33#define BUG() \
34 do { \
35 asm volatile(".hword %0\n\t" \
36 : : "n"(AVR32_BUG_OPCODE)); \
37 } while (0)
38
39#endif /* CONFIG_DEBUG_BUGVERBOSE */
40
41#define HAVE_ARCH_BUG
42
43#endif /* CONFIG_BUG */
44
45#include <asm-generic/bug.h>
46
47#endif /* __ASM_AVR32_BUG_H */
diff --git a/include/asm-avr32/bugs.h b/include/asm-avr32/bugs.h
new file mode 100644
index 0000000000..7635e77062
--- /dev/null
+++ b/include/asm-avr32/bugs.h
@@ -0,0 +1,15 @@
1/*
2 * This is included by init/main.c to check for architecture-dependent bugs.
3 *
4 * Needs:
5 * void check_bugs(void);
6 */
7#ifndef __ASM_AVR32_BUGS_H
8#define __ASM_AVR32_BUGS_H
9
10static void __init check_bugs(void)
11{
12 cpu_data->loops_per_jiffy = loops_per_jiffy;
13}
14
15#endif /* __ASM_AVR32_BUGS_H */
diff --git a/include/asm-avr32/byteorder.h b/include/asm-avr32/byteorder.h
new file mode 100644
index 0000000000..402ff4125c
--- /dev/null
+++ b/include/asm-avr32/byteorder.h
@@ -0,0 +1,25 @@
1/*
2 * AVR32 endian-conversion functions.
3 */
4#ifndef __ASM_AVR32_BYTEORDER_H
5#define __ASM_AVR32_BYTEORDER_H
6
7#include <asm/types.h>
8#include <linux/compiler.h>
9
10#ifdef __CHECKER__
11extern unsigned long __builtin_bswap_32(unsigned long x);
12extern unsigned short __builtin_bswap_16(unsigned short x);
13#endif
14
15#define __arch__swab32(x) __builtin_bswap_32(x)
16#define __arch__swab16(x) __builtin_bswap_16(x)
17
18#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
19# define __BYTEORDER_HAS_U64__
20# define __SWAB_64_THRU_32__
21#endif
22
23#include <linux/byteorder/big_endian.h>
24
25#endif /* __ASM_AVR32_BYTEORDER_H */
diff --git a/include/asm-avr32/cache.h b/include/asm-avr32/cache.h
new file mode 100644
index 0000000000..dabb955f3c
--- /dev/null
+++ b/include/asm-avr32/cache.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_AVR32_CACHE_H
2#define __ASM_AVR32_CACHE_H
3
4#define L1_CACHE_SHIFT 5
5#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
6
7#ifndef __ASSEMBLER__
8struct cache_info {
9 unsigned int ways;
10 unsigned int sets;
11 unsigned int linesz;
12};
13#endif /* __ASSEMBLER */
14
15/* Cache operation constants */
16#define ICACHE_FLUSH 0x00
17#define ICACHE_INVALIDATE 0x01
18#define ICACHE_LOCK 0x02
19#define ICACHE_UNLOCK 0x03
20#define ICACHE_PREFETCH 0x04
21
22#define DCACHE_FLUSH 0x08
23#define DCACHE_LOCK 0x09
24#define DCACHE_UNLOCK 0x0a
25#define DCACHE_INVALIDATE 0x0b
26#define DCACHE_CLEAN 0x0c
27#define DCACHE_CLEAN_INVAL 0x0d
28
29#endif /* __ASM_AVR32_CACHE_H */
diff --git a/include/asm-avr32/cachectl.h b/include/asm-avr32/cachectl.h
new file mode 100644
index 0000000000..4faf1ce600
--- /dev/null
+++ b/include/asm-avr32/cachectl.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_AVR32_CACHECTL_H
2#define __ASM_AVR32_CACHECTL_H
3
4/*
5 * Operations that can be performed through the cacheflush system call
6 */
7
8/* Clean the data cache, then invalidate the icache */
9#define CACHE_IFLUSH 0
10
11#endif /* __ASM_AVR32_CACHECTL_H */
diff --git a/include/asm-avr32/cacheflush.h b/include/asm-avr32/cacheflush.h
new file mode 100644
index 0000000000..f1bf170898
--- /dev/null
+++ b/include/asm-avr32/cacheflush.h
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_CACHEFLUSH_H
9#define __ASM_AVR32_CACHEFLUSH_H
10
11/* Keep includes the same across arches. */
12#include <linux/mm.h>
13
14#define CACHE_OP_ICACHE_INVALIDATE 0x01
15#define CACHE_OP_DCACHE_INVALIDATE 0x0b
16#define CACHE_OP_DCACHE_CLEAN 0x0c
17#define CACHE_OP_DCACHE_CLEAN_INVAL 0x0d
18
19/*
20 * Invalidate any cacheline containing virtual address vaddr without
21 * writing anything back to memory.
22 *
23 * Note that this function may corrupt unrelated data structures when
24 * applied on buffers that are not cacheline aligned in both ends.
25 */
26static inline void invalidate_dcache_line(void *vaddr)
27{
28 asm volatile("cache %0[0], %1"
29 :
30 : "r"(vaddr), "n"(CACHE_OP_DCACHE_INVALIDATE)
31 : "memory");
32}
33
34/*
35 * Make sure any cacheline containing virtual address vaddr is written
36 * to memory.
37 */
38static inline void clean_dcache_line(void *vaddr)
39{
40 asm volatile("cache %0[0], %1"
41 :
42 : "r"(vaddr), "n"(CACHE_OP_DCACHE_CLEAN)
43 : "memory");
44}
45
46/*
47 * Make sure any cacheline containing virtual address vaddr is written
48 * to memory and then invalidate it.
49 */
50static inline void flush_dcache_line(void *vaddr)
51{
52 asm volatile("cache %0[0], %1"
53 :
54 : "r"(vaddr), "n"(CACHE_OP_DCACHE_CLEAN_INVAL)
55 : "memory");
56}
57
58/*
59 * Invalidate any instruction cacheline containing virtual address
60 * vaddr.
61 */
62static inline void invalidate_icache_line(void *vaddr)
63{
64 asm volatile("cache %0[0], %1"
65 :
66 : "r"(vaddr), "n"(CACHE_OP_ICACHE_INVALIDATE)
67 : "memory");
68}
69
70/*
71 * Applies the above functions on all lines that are touched by the
72 * specified virtual address range.
73 */
74void invalidate_dcache_region(void *start, size_t len);
75void clean_dcache_region(void *start, size_t len);
76void flush_dcache_region(void *start, size_t len);
77void invalidate_icache_region(void *start, size_t len);
78
79/*
80 * Make sure any pending writes are completed before continuing.
81 */
82#define flush_write_buffer() asm volatile("sync 0" : : : "memory")
83
84/*
85 * The following functions are called when a virtual mapping changes.
86 * We do not need to flush anything in this case.
87 */
88#define flush_cache_all() do { } while (0)
89#define flush_cache_mm(mm) do { } while (0)
90#define flush_cache_range(vma, start, end) do { } while (0)
91#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
92#define flush_cache_vmap(start, end) do { } while (0)
93#define flush_cache_vunmap(start, end) do { } while (0)
94
95/*
96 * I think we need to implement this one to be able to reliably
97 * execute pages from RAMDISK. However, if we implement the
98 * flush_dcache_*() functions, it might not be needed anymore.
99 *
100 * #define flush_icache_page(vma, page) do { } while (0)
101 */
102extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
103
104/*
105 * These are (I think) related to D-cache aliasing. We might need to
106 * do something here, but only for certain configurations. No such
107 * configurations exist at this time.
108 */
109#define flush_dcache_page(page) do { } while (0)
110#define flush_dcache_mmap_lock(page) do { } while (0)
111#define flush_dcache_mmap_unlock(page) do { } while (0)
112
113/*
114 * These are for I/D cache coherency. In this case, we do need to
115 * flush with all configurations.
116 */
117extern void flush_icache_range(unsigned long start, unsigned long end);
118extern void flush_icache_user_range(struct vm_area_struct *vma,
119 struct page *page,
120 unsigned long addr, int len);
121
122#define copy_to_user_page(vma, page, vaddr, dst, src, len) do { \
123 memcpy(dst, src, len); \
124 flush_icache_user_range(vma, page, vaddr, len); \
125} while(0)
126#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
127 memcpy(dst, src, len)
128
129#endif /* __ASM_AVR32_CACHEFLUSH_H */
diff --git a/include/asm-avr32/checksum.h b/include/asm-avr32/checksum.h
new file mode 100644
index 0000000000..41b7af09ed
--- /dev/null
+++ b/include/asm-avr32/checksum.h
@@ -0,0 +1,156 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_CHECKSUM_H
9#define __ASM_AVR32_CHECKSUM_H
10
11/*
12 * computes the checksum of a memory block at buff, length len,
13 * and adds in "sum" (32-bit)
14 *
15 * returns a 32-bit number suitable for feeding into itself
16 * or csum_tcpudp_magic
17 *
18 * this function must be called with even lengths, except
19 * for the last fragment, which may be odd
20 *
21 * it's best to have buff aligned on a 32-bit boundary
22 */
23unsigned int csum_partial(const unsigned char * buff, int len,
24 unsigned int sum);
25
26/*
27 * the same as csum_partial, but copies from src while it
28 * checksums, and handles user-space pointer exceptions correctly, when needed.
29 *
30 * here even more important to align src and dst on a 32-bit (or even
31 * better 64-bit) boundary
32 */
33unsigned int csum_partial_copy_generic(const char *src, char *dst, int len,
34 int sum, int *src_err_ptr,
35 int *dst_err_ptr);
36
37/*
38 * Note: when you get a NULL pointer exception here this means someone
39 * passed in an incorrect kernel address to one of these functions.
40 *
41 * If you use these functions directly please don't forget the
42 * verify_area().
43 */
44static inline
45unsigned int csum_partial_copy_nocheck(const char *src, char *dst,
46 int len, int sum)
47{
48 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
49}
50
51static inline
52unsigned int csum_partial_copy_from_user (const char __user *src, char *dst,
53 int len, int sum, int *err_ptr)
54{
55 return csum_partial_copy_generic((const char __force *)src, dst, len,
56 sum, err_ptr, NULL);
57}
58
59/*
60 * This is a version of ip_compute_csum() optimized for IP headers,
61 * which always checksum on 4 octet boundaries.
62 */
63static inline unsigned short ip_fast_csum(unsigned char *iph,
64 unsigned int ihl)
65{
66 unsigned int sum, tmp;
67
68 __asm__ __volatile__(
69 " ld.w %0, %1++\n"
70 " ld.w %3, %1++\n"
71 " sub %2, 4\n"
72 " add %0, %3\n"
73 " ld.w %3, %1++\n"
74 " adc %0, %0, %3\n"
75 " ld.w %3, %1++\n"
76 " adc %0, %0, %3\n"
77 " acr %0\n"
78 "1: ld.w %3, %1++\n"
79 " add %0, %3\n"
80 " acr %0\n"
81 " sub %2, 1\n"
82 " brne 1b\n"
83 " lsl %3, %0, 16\n"
84 " andl %0, 0\n"
85 " mov %2, 0xffff\n"
86 " add %0, %3\n"
87 " adc %0, %0, %2\n"
88 " com %0\n"
89 " lsr %0, 16\n"
90 : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp)
91 : "1"(iph), "2"(ihl)
92 : "memory", "cc");
93 return sum;
94}
95
96/*
97 * Fold a partial checksum
98 */
99
100static inline unsigned int csum_fold(unsigned int sum)
101{
102 unsigned int tmp;
103
104 asm(" bfextu %1, %0, 0, 16\n"
105 " lsr %0, 16\n"
106 " add %0, %1\n"
107 " bfextu %1, %0, 16, 16\n"
108 " add %0, %1"
109 : "=&r"(sum), "=&r"(tmp)
110 : "0"(sum));
111
112 return ~sum;
113}
114
115static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
116 unsigned long daddr,
117 unsigned short len,
118 unsigned short proto,
119 unsigned int sum)
120{
121 asm(" add %0, %1\n"
122 " adc %0, %0, %2\n"
123 " adc %0, %0, %3\n"
124 " acr %0"
125 : "=r"(sum)
126 : "r"(daddr), "r"(saddr), "r"(ntohs(len) | (proto << 16)),
127 "0"(sum)
128 : "cc");
129
130 return sum;
131}
132
133/*
134 * computes the checksum of the TCP/UDP pseudo-header
135 * returns a 16-bit checksum, already complemented
136 */
137static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
138 unsigned long daddr,
139 unsigned short len,
140 unsigned short proto,
141 unsigned int sum)
142{
143 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
144}
145
146/*
147 * this routine is used for miscellaneous IP-like checksums, mainly
148 * in icmp.c
149 */
150
151static inline unsigned short ip_compute_csum(unsigned char * buff, int len)
152{
153 return csum_fold(csum_partial(buff, len, 0));
154}
155
156#endif /* __ASM_AVR32_CHECKSUM_H */
diff --git a/include/asm-avr32/cputime.h b/include/asm-avr32/cputime.h
new file mode 100644
index 0000000000..e87e0f81cb
--- /dev/null
+++ b/include/asm-avr32/cputime.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_CPUTIME_H
2#define __ASM_AVR32_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ASM_AVR32_CPUTIME_H */
diff --git a/include/asm-avr32/current.h b/include/asm-avr32/current.h
new file mode 100644
index 0000000000..c7b0549eab
--- /dev/null
+++ b/include/asm-avr32/current.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_AVR32_CURRENT_H
2#define __ASM_AVR32_CURRENT_H
3
4#include <linux/thread_info.h>
5
6struct task_struct;
7
8inline static struct task_struct * get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current get_current()
14
15#endif /* __ASM_AVR32_CURRENT_H */
diff --git a/include/asm-avr32/delay.h b/include/asm-avr32/delay.h
new file mode 100644
index 0000000000..cc3b2e3343
--- /dev/null
+++ b/include/asm-avr32/delay.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_AVR32_DELAY_H
2#define __ASM_AVR32_DELAY_H
3
4/*
5 * Copyright (C) 1993 Linus Torvalds
6 *
7 * Delay routines calling functions in arch/avr32/lib/delay.c
8 */
9
10extern void __bad_udelay(void);
11extern void __bad_ndelay(void);
12
13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long usecs);
16extern void __delay(unsigned long loops);
17
18#define udelay(n) (__builtin_constant_p(n) ? \
19 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
20 __udelay(n))
21
22#define ndelay(n) (__builtin_constant_p(n) ? \
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n))
25
26#endif /* __ASM_AVR32_DELAY_H */
diff --git a/include/asm-avr32/div64.h b/include/asm-avr32/div64.h
new file mode 100644
index 0000000000..d7ddd4fdec
--- /dev/null
+++ b/include/asm-avr32/div64.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_DIV64_H
2#define __ASM_AVR32_DIV64_H
3
4#include <asm-generic/div64.h>
5
6#endif /* __ASM_AVR32_DIV64_H */
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
new file mode 100644
index 0000000000..4c40cb41cd
--- /dev/null
+++ b/include/asm-avr32/dma-mapping.h
@@ -0,0 +1,320 @@
1#ifndef __ASM_AVR32_DMA_MAPPING_H
2#define __ASM_AVR32_DMA_MAPPING_H
3
4#include <linux/mm.h>
5#include <linux/device.h>
6#include <asm/scatterlist.h>
7#include <asm/processor.h>
8#include <asm/cacheflush.h>
9#include <asm/io.h>
10
11extern void dma_cache_sync(void *vaddr, size_t size, int direction);
12
13/*
14 * Return whether the given device DMA address mask can be supported
15 * properly. For example, if your device can only drive the low 24-bits
16 * during bus mastering, then you would pass 0x00ffffff as the mask
17 * to this function.
18 */
19static inline int dma_supported(struct device *dev, u64 mask)
20{
21 /* Fix when needed. I really don't know of any limitations */
22 return 1;
23}
24
25static inline int dma_set_mask(struct device *dev, u64 dma_mask)
26{
27 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
28 return -EIO;
29
30 *dev->dma_mask = dma_mask;
31 return 0;
32}
33
34/**
35 * dma_alloc_coherent - allocate consistent memory for DMA
36 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
37 * @size: required memory size
38 * @handle: bus-specific DMA address
39 *
40 * Allocate some uncached, unbuffered memory for a device for
41 * performing DMA. This function allocates pages, and will
42 * return the CPU-viewed address, and sets @handle to be the
43 * device-viewed address.
44 */
45extern void *dma_alloc_coherent(struct device *dev, size_t size,
46 dma_addr_t *handle, gfp_t gfp);
47
48/**
49 * dma_free_coherent - free memory allocated by dma_alloc_coherent
50 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
51 * @size: size of memory originally requested in dma_alloc_coherent
52 * @cpu_addr: CPU-view address returned from dma_alloc_coherent
53 * @handle: device-view address returned from dma_alloc_coherent
54 *
55 * Free (and unmap) a DMA buffer previously allocated by
56 * dma_alloc_coherent().
57 *
58 * References to memory and mappings associated with cpu_addr/handle
59 * during and after this call executing are illegal.
60 */
61extern void dma_free_coherent(struct device *dev, size_t size,
62 void *cpu_addr, dma_addr_t handle);
63
64/**
65 * dma_alloc_writecombine - allocate write-combining memory for DMA
66 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
67 * @size: required memory size
68 * @handle: bus-specific DMA address
69 *
70 * Allocate some uncached, buffered memory for a device for
71 * performing DMA. This function allocates pages, and will
72 * return the CPU-viewed address, and sets @handle to be the
73 * device-viewed address.
74 */
75extern void *dma_alloc_writecombine(struct device *dev, size_t size,
76 dma_addr_t *handle, gfp_t gfp);
77
78/**
79 * dma_free_coherent - free memory allocated by dma_alloc_writecombine
80 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
81 * @size: size of memory originally requested in dma_alloc_writecombine
82 * @cpu_addr: CPU-view address returned from dma_alloc_writecombine
83 * @handle: device-view address returned from dma_alloc_writecombine
84 *
85 * Free (and unmap) a DMA buffer previously allocated by
86 * dma_alloc_writecombine().
87 *
88 * References to memory and mappings associated with cpu_addr/handle
89 * during and after this call executing are illegal.
90 */
91extern void dma_free_writecombine(struct device *dev, size_t size,
92 void *cpu_addr, dma_addr_t handle);
93
94/**
95 * dma_map_single - map a single buffer for streaming DMA
96 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
97 * @cpu_addr: CPU direct mapped address of buffer
98 * @size: size of buffer to map
99 * @dir: DMA transfer direction
100 *
101 * Ensure that any data held in the cache is appropriately discarded
102 * or written back.
103 *
104 * The device owns this memory once this call has completed. The CPU
105 * can regain ownership by calling dma_unmap_single() or dma_sync_single().
106 */
107static inline dma_addr_t
108dma_map_single(struct device *dev, void *cpu_addr, size_t size,
109 enum dma_data_direction direction)
110{
111 dma_cache_sync(cpu_addr, size, direction);
112 return virt_to_bus(cpu_addr);
113}
114
115/**
116 * dma_unmap_single - unmap a single buffer previously mapped
117 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
118 * @handle: DMA address of buffer
119 * @size: size of buffer to map
120 * @dir: DMA transfer direction
121 *
122 * Unmap a single streaming mode DMA translation. The handle and size
123 * must match what was provided in the previous dma_map_single() call.
124 * All other usages are undefined.
125 *
126 * After this call, reads by the CPU to the buffer are guaranteed to see
127 * whatever the device wrote there.
128 */
129static inline void
130dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
131 enum dma_data_direction direction)
132{
133
134}
135
136/**
137 * dma_map_page - map a portion of a page for streaming DMA
138 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
139 * @page: page that buffer resides in
140 * @offset: offset into page for start of buffer
141 * @size: size of buffer to map
142 * @dir: DMA transfer direction
143 *
144 * Ensure that any data held in the cache is appropriately discarded
145 * or written back.
146 *
147 * The device owns this memory once this call has completed. The CPU
148 * can regain ownership by calling dma_unmap_page() or dma_sync_single().
149 */
150static inline dma_addr_t
151dma_map_page(struct device *dev, struct page *page,
152 unsigned long offset, size_t size,
153 enum dma_data_direction direction)
154{
155 return dma_map_single(dev, page_address(page) + offset,
156 size, direction);
157}
158
159/**
160 * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
161 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
162 * @handle: DMA address of buffer
163 * @size: size of buffer to map
164 * @dir: DMA transfer direction
165 *
166 * Unmap a single streaming mode DMA translation. The handle and size
167 * must match what was provided in the previous dma_map_single() call.
168 * All other usages are undefined.
169 *
170 * After this call, reads by the CPU to the buffer are guaranteed to see
171 * whatever the device wrote there.
172 */
173static inline void
174dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
175 enum dma_data_direction direction)
176{
177 dma_unmap_single(dev, dma_address, size, direction);
178}
179
180/**
181 * dma_map_sg - map a set of SG buffers for streaming mode DMA
182 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
183 * @sg: list of buffers
184 * @nents: number of buffers to map
185 * @dir: DMA transfer direction
186 *
187 * Map a set of buffers described by scatterlist in streaming
188 * mode for DMA. This is the scatter-gather version of the
189 * above pci_map_single interface. Here the scatter gather list
190 * elements are each tagged with the appropriate dma address
191 * and length. They are obtained via sg_dma_{address,length}(SG).
192 *
193 * NOTE: An implementation may be able to use a smaller number of
194 * DMA address/length pairs than there are SG table elements.
195 * (for example via virtual mapping capabilities)
196 * The routine returns the number of addr/length pairs actually
197 * used, at most nents.
198 *
199 * Device ownership issues as mentioned above for pci_map_single are
200 * the same here.
201 */
202static inline int
203dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
204 enum dma_data_direction direction)
205{
206 int i;
207
208 for (i = 0; i < nents; i++) {
209 char *virt;
210
211 sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
212 virt = page_address(sg[i].page) + sg[i].offset;
213 dma_cache_sync(virt, sg[i].length, direction);
214 }
215
216 return nents;
217}
218
219/**
220 * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
221 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
222 * @sg: list of buffers
223 * @nents: number of buffers to map
224 * @dir: DMA transfer direction
225 *
226 * Unmap a set of streaming mode DMA translations.
227 * Again, CPU read rules concerning calls here are the same as for
228 * pci_unmap_single() above.
229 */
230static inline void
231dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
232 enum dma_data_direction direction)
233{
234
235}
236
237/**
238 * dma_sync_single_for_cpu
239 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
240 * @handle: DMA address of buffer
241 * @size: size of buffer to map
242 * @dir: DMA transfer direction
243 *
244 * Make physical memory consistent for a single streaming mode DMA
245 * translation after a transfer.
246 *
247 * If you perform a dma_map_single() but wish to interrogate the
248 * buffer using the cpu, yet do not wish to teardown the DMA mapping,
249 * you must call this function before doing so. At the next point you
250 * give the DMA address back to the card, you must first perform a
251 * dma_sync_single_for_device, and then the device again owns the
252 * buffer.
253 */
254static inline void
255dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
256 size_t size, enum dma_data_direction direction)
257{
258 dma_cache_sync(bus_to_virt(dma_handle), size, direction);
259}
260
261static inline void
262dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
263 size_t size, enum dma_data_direction direction)
264{
265 dma_cache_sync(bus_to_virt(dma_handle), size, direction);
266}
267
268/**
269 * dma_sync_sg_for_cpu
270 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
271 * @sg: list of buffers
272 * @nents: number of buffers to map
273 * @dir: DMA transfer direction
274 *
275 * Make physical memory consistent for a set of streaming
276 * mode DMA translations after a transfer.
277 *
278 * The same as dma_sync_single_for_* but for a scatter-gather list,
279 * same rules and usage.
280 */
281static inline void
282dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
283 int nents, enum dma_data_direction direction)
284{
285 int i;
286
287 for (i = 0; i < nents; i++) {
288 dma_cache_sync(page_address(sg[i].page) + sg[i].offset,
289 sg[i].length, direction);
290 }
291}
292
293static inline void
294dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
295 int nents, enum dma_data_direction direction)
296{
297 int i;
298
299 for (i = 0; i < nents; i++) {
300 dma_cache_sync(page_address(sg[i].page) + sg[i].offset,
301 sg[i].length, direction);
302 }
303}
304
305/* Now for the API extensions over the pci_ one */
306
307#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
308#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
309
310static inline int dma_is_consistent(dma_addr_t dma_addr)
311{
312 return 1;
313}
314
315static inline int dma_get_cache_alignment(void)
316{
317 return boot_cpu_data.dcache.linesz;
318}
319
320#endif /* __ASM_AVR32_DMA_MAPPING_H */
diff --git a/include/asm-avr32/dma.h b/include/asm-avr32/dma.h
new file mode 100644
index 0000000000..9e91205590
--- /dev/null
+++ b/include/asm-avr32/dma.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_AVR32_DMA_H
2#define __ASM_AVR32_DMA_H
3
4/* The maximum address that we can perform a DMA transfer to on this platform.
5 * Not really applicable to AVR32, but some functions need it. */
6#define MAX_DMA_ADDRESS 0xffffffff
7
8#endif /* __ASM_AVR32_DMA_H */
diff --git a/include/asm-avr32/elf.h b/include/asm-avr32/elf.h
new file mode 100644
index 0000000000..d334b4994d
--- /dev/null
+++ b/include/asm-avr32/elf.h
@@ -0,0 +1,110 @@
1#ifndef __ASM_AVR32_ELF_H
2#define __ASM_AVR32_ELF_H
3
4/* AVR32 relocation numbers */
5#define R_AVR32_NONE 0
6#define R_AVR32_32 1
7#define R_AVR32_16 2
8#define R_AVR32_8 3
9#define R_AVR32_32_PCREL 4
10#define R_AVR32_16_PCREL 5
11#define R_AVR32_8_PCREL 6
12#define R_AVR32_DIFF32 7
13#define R_AVR32_DIFF16 8
14#define R_AVR32_DIFF8 9
15#define R_AVR32_GOT32 10
16#define R_AVR32_GOT16 11
17#define R_AVR32_GOT8 12
18#define R_AVR32_21S 13
19#define R_AVR32_16U 14
20#define R_AVR32_16S 15
21#define R_AVR32_8S 16
22#define R_AVR32_8S_EXT 17
23#define R_AVR32_22H_PCREL 18
24#define R_AVR32_18W_PCREL 19
25#define R_AVR32_16B_PCREL 20
26#define R_AVR32_16N_PCREL 21
27#define R_AVR32_14UW_PCREL 22
28#define R_AVR32_11H_PCREL 23
29#define R_AVR32_10UW_PCREL 24
30#define R_AVR32_9H_PCREL 25
31#define R_AVR32_9UW_PCREL 26
32#define R_AVR32_HI16 27
33#define R_AVR32_LO16 28
34#define R_AVR32_GOTPC 29
35#define R_AVR32_GOTCALL 30
36#define R_AVR32_LDA_GOT 31
37#define R_AVR32_GOT21S 32
38#define R_AVR32_GOT18SW 33
39#define R_AVR32_GOT16S 34
40#define R_AVR32_GOT7UW 35
41#define R_AVR32_32_CPENT 36
42#define R_AVR32_CPCALL 37
43#define R_AVR32_16_CP 38
44#define R_AVR32_9W_CP 39
45#define R_AVR32_RELATIVE 40
46#define R_AVR32_GLOB_DAT 41
47#define R_AVR32_JMP_SLOT 42
48#define R_AVR32_ALIGN 43
49
50/*
51 * ELF register definitions..
52 */
53
54#include <asm/ptrace.h>
55#include <asm/user.h>
56
57typedef unsigned long elf_greg_t;
58
59#define ELF_NGREG (sizeof (struct pt_regs) / sizeof (elf_greg_t))
60typedef elf_greg_t elf_gregset_t[ELF_NGREG];
61
62typedef struct user_fpu_struct elf_fpregset_t;
63
64/*
65 * This is used to ensure we don't load something for the wrong architecture.
66 */
67#define elf_check_arch(x) ( (x)->e_machine == EM_AVR32 )
68
69/*
70 * These are used to set parameters in the core dumps.
71 */
72#define ELF_CLASS ELFCLASS32
73#ifdef __LITTLE_ENDIAN__
74#define ELF_DATA ELFDATA2LSB
75#else
76#define ELF_DATA ELFDATA2MSB
77#endif
78#define ELF_ARCH EM_AVR32
79
80#define USE_ELF_CORE_DUMP
81#define ELF_EXEC_PAGESIZE 4096
82
83/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
84 use of this is to invoke "./ld.so someprog" to test out a new version of
85 the loader. We need to make sure that it is out of the way of the program
86 that it will "exec", and that there is sufficient room for the brk. */
87
88#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
89
90
91/* This yields a mask that user programs can use to figure out what
92 instruction set this CPU supports. This could be done in user space,
93 but it's not easy, and we've already done it here. */
94
95#define ELF_HWCAP (0)
96
97/* This yields a string that ld.so will use to load implementation
98 specific libraries for optimization. This is more specific in
99 intent than poking at uname or /proc/cpuinfo.
100
101 For the moment, we have only optimizations for the Intel generations,
102 but that could change... */
103
104#define ELF_PLATFORM (NULL)
105
106#ifdef __KERNEL__
107#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
108#endif
109
110#endif /* __ASM_AVR32_ELF_H */
diff --git a/include/asm-avr32/emergency-restart.h b/include/asm-avr32/emergency-restart.h
new file mode 100644
index 0000000000..3e7e014776
--- /dev/null
+++ b/include/asm-avr32/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_EMERGENCY_RESTART_H
2#define __ASM_AVR32_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* __ASM_AVR32_EMERGENCY_RESTART_H */
diff --git a/include/asm-avr32/errno.h b/include/asm-avr32/errno.h
new file mode 100644
index 0000000000..558a7249f0
--- /dev/null
+++ b/include/asm-avr32/errno.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_ERRNO_H
2#define __ASM_AVR32_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* __ASM_AVR32_ERRNO_H */
diff --git a/include/asm-avr32/fcntl.h b/include/asm-avr32/fcntl.h
new file mode 100644
index 0000000000..14c0c4402b
--- /dev/null
+++ b/include/asm-avr32/fcntl.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_FCNTL_H
2#define __ASM_AVR32_FCNTL_H
3
4#include <asm-generic/fcntl.h>
5
6#endif /* __ASM_AVR32_FCNTL_H */
diff --git a/include/asm-avr32/futex.h b/include/asm-avr32/futex.h
new file mode 100644
index 0000000000..10419f14a6
--- /dev/null
+++ b/include/asm-avr32/futex.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_FUTEX_H
2#define __ASM_AVR32_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif /* __ASM_AVR32_FUTEX_H */
diff --git a/include/asm-avr32/hardirq.h b/include/asm-avr32/hardirq.h
new file mode 100644
index 0000000000..267354356f
--- /dev/null
+++ b/include/asm-avr32/hardirq.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_AVR32_HARDIRQ_H
2#define __ASM_AVR32_HARDIRQ_H
3
4#include <linux/threads.h>
5#include <asm/irq.h>
6
7#ifndef __ASSEMBLY__
8
9#include <linux/cache.h>
10
11/* entry.S is sensitive to the offsets of these fields */
12typedef struct {
13 unsigned int __softirq_pending;
14} ____cacheline_aligned irq_cpustat_t;
15
16void ack_bad_irq(unsigned int irq);
17
18/* Standard mappings for irq_cpustat_t above */
19#include <linux/irq_cpustat.h>
20
21#endif /* __ASSEMBLY__ */
22
23#define HARDIRQ_BITS 12
24
25/*
26 * The hardirq mask has to be large enough to have
27 * space for potentially all IRQ sources in the system
28 * nesting on a single CPU:
29 */
30#if (1 << HARDIRQ_BITS) < NR_IRQS
31# error HARDIRQ_BITS is too low!
32#endif
33
34#endif /* __ASM_AVR32_HARDIRQ_H */
diff --git a/include/asm-avr32/hw_irq.h b/include/asm-avr32/hw_irq.h
new file mode 100644
index 0000000000..218b0a6bfd
--- /dev/null
+++ b/include/asm-avr32/hw_irq.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_AVR32_HW_IRQ_H
2#define __ASM_AVR32_HW_IRQ_H
3
4static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
5{
6 /* Nothing to do */
7}
8
9#endif /* __ASM_AVR32_HW_IRQ_H */
diff --git a/include/asm-avr32/intc.h b/include/asm-avr32/intc.h
new file mode 100644
index 0000000000..1ac9ca75e8
--- /dev/null
+++ b/include/asm-avr32/intc.h
@@ -0,0 +1,128 @@
1#ifndef __ASM_AVR32_INTC_H
2#define __ASM_AVR32_INTC_H
3
4#include <linux/sysdev.h>
5#include <linux/interrupt.h>
6
7struct irq_controller;
8struct irqaction;
9struct pt_regs;
10
11struct platform_device;
12
13/* Information about the internal interrupt controller */
14struct intc_device {
15 /* ioremapped address of configuration block */
16 void __iomem *regs;
17
18 /* the physical device */
19 struct platform_device *pdev;
20
21 /* Number of interrupt lines per group. */
22 unsigned int irqs_per_group;
23
24 /* The highest group ID + 1 */
25 unsigned int nr_groups;
26
27 /*
28 * Bitfield indicating which groups are actually in use. The
29 * size of the array is
30 * ceil(group_max / (8 * sizeof(unsigned int))).
31 */
32 unsigned int group_mask[];
33};
34
35struct irq_controller_class {
36 /*
37 * A short name identifying this kind of controller.
38 */
39 const char *typename;
40 /*
41 * Handle the IRQ. Must do any necessary acking and masking.
42 */
43 irqreturn_t (*handle)(int irq, void *dev_id, struct pt_regs *regs);
44 /*
45 * Register a new IRQ handler.
46 */
47 int (*setup)(struct irq_controller *ctrl, unsigned int irq,
48 struct irqaction *action);
49 /*
50 * Unregister a IRQ handler.
51 */
52 void (*free)(struct irq_controller *ctrl, unsigned int irq,
53 void *dev_id);
54 /*
55 * Mask the IRQ in the interrupt controller.
56 */
57 void (*mask)(struct irq_controller *ctrl, unsigned int irq);
58 /*
59 * Unmask the IRQ in the interrupt controller.
60 */
61 void (*unmask)(struct irq_controller *ctrl, unsigned int irq);
62 /*
63 * Set the type of the IRQ. See below for possible types.
64 * Return -EINVAL if a given type is not supported
65 */
66 int (*set_type)(struct irq_controller *ctrl, unsigned int irq,
67 unsigned int type);
68 /*
69 * Return the IRQ type currently set
70 */
71 unsigned int (*get_type)(struct irq_controller *ctrl, unsigned int irq);
72};
73
74struct irq_controller {
75 struct irq_controller_class *class;
76 unsigned int irq_group;
77 unsigned int first_irq;
78 unsigned int nr_irqs;
79 struct list_head list;
80};
81
82struct intc_group_desc {
83 struct irq_controller *ctrl;
84 irqreturn_t (*handle)(int, void *, struct pt_regs *);
85 unsigned long flags;
86 void *dev_id;
87 const char *devname;
88};
89
90/*
91 * The internal interrupt controller. Defined in board/part-specific
92 * devices.c.
93 * TODO: Should probably be defined per-cpu.
94 */
95extern struct intc_device intc;
96
97extern int request_internal_irq(unsigned int irq,
98 irqreturn_t (*handler)(int, void *, struct pt_regs *),
99 unsigned long irqflags,
100 const char *devname, void *dev_id);
101extern void free_internal_irq(unsigned int irq);
102
103/* Only used by time_init() */
104extern int setup_internal_irq(unsigned int irq, struct intc_group_desc *desc);
105
106/*
107 * Set interrupt priority for a given group. `group' can be found by
108 * using irq_to_group(irq). Priority can be from 0 (lowest) to 3
109 * (highest). Higher-priority interrupts will preempt lower-priority
110 * interrupts (unless interrupts are masked globally).
111 *
112 * This function does not check for conflicts within a group.
113 */
114extern int intc_set_priority(unsigned int group,
115 unsigned int priority);
116
117/*
118 * Returns a bitmask of pending interrupts in a group.
119 */
120extern unsigned long intc_get_pending(unsigned int group);
121
122/*
123 * Register a new external interrupt controller. Returns the first
124 * external IRQ number that is assigned to the new controller.
125 */
126extern int intc_register_controller(struct irq_controller *ctrl);
127
128#endif /* __ASM_AVR32_INTC_H */
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
new file mode 100644
index 0000000000..2fc8f111dc
--- /dev/null
+++ b/include/asm-avr32/io.h
@@ -0,0 +1,253 @@
1#ifndef __ASM_AVR32_IO_H
2#define __ASM_AVR32_IO_H
3
4#include <linux/string.h>
5
6#ifdef __KERNEL__
7
8#include <asm/addrspace.h>
9#include <asm/byteorder.h>
10
11/* virt_to_phys will only work when address is in P1 or P2 */
12static __inline__ unsigned long virt_to_phys(volatile void *address)
13{
14 return PHYSADDR(address);
15}
16
17static __inline__ void * phys_to_virt(unsigned long address)
18{
19 return (void *)P1SEGADDR(address);
20}
21
22#define cached_to_phys(addr) ((unsigned long)PHYSADDR(addr))
23#define uncached_to_phys(addr) ((unsigned long)PHYSADDR(addr))
24#define phys_to_cached(addr) ((void *)P1SEGADDR(addr))
25#define phys_to_uncached(addr) ((void *)P2SEGADDR(addr))
26
27/*
28 * Generic IO read/write. These perform native-endian accesses. Note
29 * that some architectures will want to re-define __raw_{read,write}w.
30 */
31extern void __raw_writesb(unsigned int addr, const void *data, int bytelen);
32extern void __raw_writesw(unsigned int addr, const void *data, int wordlen);
33extern void __raw_writesl(unsigned int addr, const void *data, int longlen);
34
35extern void __raw_readsb(unsigned int addr, void *data, int bytelen);
36extern void __raw_readsw(unsigned int addr, void *data, int wordlen);
37extern void __raw_readsl(unsigned int addr, void *data, int longlen);
38
39static inline void writeb(unsigned char b, volatile void __iomem *addr)
40{
41 *(volatile unsigned char __force *)addr = b;
42}
43static inline void writew(unsigned short b, volatile void __iomem *addr)
44{
45 *(volatile unsigned short __force *)addr = b;
46}
47static inline void writel(unsigned int b, volatile void __iomem *addr)
48{
49 *(volatile unsigned int __force *)addr = b;
50}
51#define __raw_writeb writeb
52#define __raw_writew writew
53#define __raw_writel writel
54
55static inline unsigned char readb(const volatile void __iomem *addr)
56{
57 return *(const volatile unsigned char __force *)addr;
58}
59static inline unsigned short readw(const volatile void __iomem *addr)
60{
61 return *(const volatile unsigned short __force *)addr;
62}
63static inline unsigned int readl(const volatile void __iomem *addr)
64{
65 return *(const volatile unsigned int __force *)addr;
66}
67#define __raw_readb readb
68#define __raw_readw readw
69#define __raw_readl readl
70
71#define writesb(p, d, l) __raw_writesb((unsigned int)p, d, l)
72#define writesw(p, d, l) __raw_writesw((unsigned int)p, d, l)
73#define writesl(p, d, l) __raw_writesl((unsigned int)p, d, l)
74
75#define readsb(p, d, l) __raw_readsb((unsigned int)p, d, l)
76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l)
77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l)
78
79/*
80 * These two are only here because ALSA _thinks_ it needs them...
81 */
82static inline void memcpy_fromio(void * to, const volatile void __iomem *from,
83 unsigned long count)
84{
85 char *p = to;
86 while (count) {
87 count--;
88 *p = readb(from);
89 p++;
90 from++;
91 }
92}
93
94static inline void memcpy_toio(volatile void __iomem *to, const void * from,
95 unsigned long count)
96{
97 const char *p = from;
98 while (count) {
99 count--;
100 writeb(*p, to);
101 p++;
102 to++;
103 }
104}
105
106static inline void memset_io(volatile void __iomem *addr, unsigned char val,
107 unsigned long count)
108{
109 memset((void __force *)addr, val, count);
110}
111
112/*
113 * Bad read/write accesses...
114 */
115extern void __readwrite_bug(const char *fn);
116
117#define IO_SPACE_LIMIT 0xffffffff
118
119/* Convert I/O port address to virtual address */
120#define __io(p) ((void __iomem *)phys_to_uncached(p))
121
122/*
123 * IO port access primitives
124 * -------------------------
125 *
126 * The AVR32 doesn't have special IO access instructions; all IO is memory
127 * mapped. Note that these are defined to perform little endian accesses
128 * only. Their primary purpose is to access PCI and ISA peripherals.
129 *
130 * Note that for a big endian machine, this implies that the following
131 * big endian mode connectivity is in place.
132 *
133 * The machine specific io.h include defines __io to translate an "IO"
134 * address to a memory address.
135 *
136 * Note that we prevent GCC re-ordering or caching values in expressions
137 * by introducing sequence points into the in*() definitions. Note that
138 * __raw_* do not guarantee this behaviour.
139 *
140 * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space.
141 */
142#define outb(v, p) __raw_writeb(v, __io(p))
143#define outw(v, p) __raw_writew(cpu_to_le16(v), __io(p))
144#define outl(v, p) __raw_writel(cpu_to_le32(v), __io(p))
145
146#define inb(p) __raw_readb(__io(p))
147#define inw(p) le16_to_cpu(__raw_readw(__io(p)))
148#define inl(p) le32_to_cpu(__raw_readl(__io(p)))
149
150static inline void __outsb(unsigned long port, void *addr, unsigned int count)
151{
152 while (count--) {
153 outb(*(u8 *)addr, port);
154 addr++;
155 }
156}
157
158static inline void __insb(unsigned long port, void *addr, unsigned int count)
159{
160 while (count--) {
161 *(u8 *)addr = inb(port);
162 addr++;
163 }
164}
165
166static inline void __outsw(unsigned long port, void *addr, unsigned int count)
167{
168 while (count--) {
169 outw(*(u16 *)addr, port);
170 addr += 2;
171 }
172}
173
174static inline void __insw(unsigned long port, void *addr, unsigned int count)
175{
176 while (count--) {
177 *(u16 *)addr = inw(port);
178 addr += 2;
179 }
180}
181
182static inline void __outsl(unsigned long port, void *addr, unsigned int count)
183{
184 while (count--) {
185 outl(*(u32 *)addr, port);
186 addr += 4;
187 }
188}
189
190static inline void __insl(unsigned long port, void *addr, unsigned int count)
191{
192 while (count--) {
193 *(u32 *)addr = inl(port);
194 addr += 4;
195 }
196}
197
198#define outsb(port, addr, count) __outsb(port, addr, count)
199#define insb(port, addr, count) __insb(port, addr, count)
200#define outsw(port, addr, count) __outsw(port, addr, count)
201#define insw(port, addr, count) __insw(port, addr, count)
202#define outsl(port, addr, count) __outsl(port, addr, count)
203#define insl(port, addr, count) __insl(port, addr, count)
204
205extern void __iomem *__ioremap(unsigned long offset, size_t size,
206 unsigned long flags);
207extern void __iounmap(void __iomem *addr);
208
209/*
210 * ioremap - map bus memory into CPU space
211 * @offset bus address of the memory
212 * @size size of the resource to map
213 *
214 * ioremap performs a platform specific sequence of operations to make
215 * bus memory CPU accessible via the readb/.../writel functions and
216 * the other mmio helpers. The returned address is not guaranteed to
217 * be usable directly as a virtual address.
218 */
219#define ioremap(offset, size) \
220 __ioremap((offset), (size), 0)
221
222#define iounmap(addr) \
223 __iounmap(addr)
224
225#define cached(addr) P1SEGADDR(addr)
226#define uncached(addr) P2SEGADDR(addr)
227
228#define virt_to_bus virt_to_phys
229#define bus_to_virt phys_to_virt
230#define page_to_bus page_to_phys
231#define bus_to_page phys_to_page
232
233#define dma_cache_wback_inv(_start, _size) \
234 flush_dcache_region(_start, _size)
235#define dma_cache_inv(_start, _size) \
236 invalidate_dcache_region(_start, _size)
237#define dma_cache_wback(_start, _size) \
238 clean_dcache_region(_start, _size)
239
240/*
241 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
242 * access
243 */
244#define xlate_dev_mem_ptr(p) __va(p)
245
246/*
247 * Convert a virtual cached pointer to an uncached pointer
248 */
249#define xlate_dev_kmem_ptr(p) p
250
251#endif /* __KERNEL__ */
252
253#endif /* __ASM_AVR32_IO_H */
diff --git a/include/asm-avr32/ioctl.h b/include/asm-avr32/ioctl.h
new file mode 100644
index 0000000000..c8472c1398
--- /dev/null
+++ b/include/asm-avr32/ioctl.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_IOCTL_H
2#define __ASM_AVR32_IOCTL_H
3
4#include <asm-generic/ioctl.h>
5
6#endif /* __ASM_AVR32_IOCTL_H */
diff --git a/include/asm-avr32/ioctls.h b/include/asm-avr32/ioctls.h
new file mode 100644
index 0000000000..0500426b71
--- /dev/null
+++ b/include/asm-avr32/ioctls.h
@@ -0,0 +1,83 @@
1#ifndef __ASM_AVR32_IOCTLS_H
2#define __ASM_AVR32_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52
53#define FIONCLEX 0x5450
54#define FIOCLEX 0x5451
55#define FIOASYNC 0x5452
56#define TIOCSERCONFIG 0x5453
57#define TIOCSERGWILD 0x5454
58#define TIOCSERSWILD 0x5455
59#define TIOCGLCKTRMIOS 0x5456
60#define TIOCSLCKTRMIOS 0x5457
61#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
62#define TIOCSERGETLSR 0x5459 /* Get line status register */
63#define TIOCSERGETMULTI 0x545A /* Get multiport config */
64#define TIOCSERSETMULTI 0x545B /* Set multiport config */
65
66#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
67#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
68#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
69#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
70#define FIOQSIZE 0x5460
71
72/* Used for packet mode */
73#define TIOCPKT_DATA 0
74#define TIOCPKT_FLUSHREAD 1
75#define TIOCPKT_FLUSHWRITE 2
76#define TIOCPKT_STOP 4
77#define TIOCPKT_START 8
78#define TIOCPKT_NOSTOP 16
79#define TIOCPKT_DOSTOP 32
80
81#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
82
83#endif /* __ASM_AVR32_IOCTLS_H */
diff --git a/include/asm-avr32/ipcbuf.h b/include/asm-avr32/ipcbuf.h
new file mode 100644
index 0000000000..1552c9698f
--- /dev/null
+++ b/include/asm-avr32/ipcbuf.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_AVR32_IPCBUF_H
2#define __ASM_AVR32_IPCBUF_H
3
4/*
5* The user_ipc_perm structure for AVR32 architecture.
6* Note extra padding because this structure is passed back and forth
7* between kernel and user space.
8*
9* Pad space is left for:
10* - 32-bit mode_t and seq
11* - 2 miscellaneous 32-bit values
12*/
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASM_AVR32_IPCBUF_H */
diff --git a/include/asm-avr32/irq.h b/include/asm-avr32/irq.h
new file mode 100644
index 0000000000..f7e725707d
--- /dev/null
+++ b/include/asm-avr32/irq.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_AVR32_IRQ_H
2#define __ASM_AVR32_IRQ_H
3
4#define NR_INTERNAL_IRQS 64
5#define NR_EXTERNAL_IRQS 64
6#define NR_IRQS (NR_INTERNAL_IRQS + NR_EXTERNAL_IRQS)
7
8#define irq_canonicalize(i) (i)
9
10#endif /* __ASM_AVR32_IOCTLS_H */
diff --git a/include/asm-avr32/irqflags.h b/include/asm-avr32/irqflags.h
new file mode 100644
index 0000000000..93570daac3
--- /dev/null
+++ b/include/asm-avr32/irqflags.h
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_IRQFLAGS_H
9#define __ASM_AVR32_IRQFLAGS_H
10
11#include <asm/sysreg.h>
12
13static inline unsigned long __raw_local_save_flags(void)
14{
15 return sysreg_read(SR);
16}
17
18#define raw_local_save_flags(x) \
19 do { (x) = __raw_local_save_flags(); } while (0)
20
21/*
22 * This will restore ALL status register flags, not only the interrupt
23 * mask flag.
24 *
25 * The empty asm statement informs the compiler of this fact while
26 * also serving as a barrier.
27 */
28static inline void raw_local_irq_restore(unsigned long flags)
29{
30 sysreg_write(SR, flags);
31 asm volatile("" : : : "memory", "cc");
32}
33
34static inline void raw_local_irq_disable(void)
35{
36 asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
37}
38
39static inline void raw_local_irq_enable(void)
40{
41 asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
42}
43
44static inline int raw_irqs_disabled_flags(unsigned long flags)
45{
46 return (flags & SYSREG_BIT(GM)) != 0;
47}
48
49static inline int raw_irqs_disabled(void)
50{
51 unsigned long flags = __raw_local_save_flags();
52
53 return raw_irqs_disabled_flags(flags);
54}
55
56static inline unsigned long __raw_local_irq_save(void)
57{
58 unsigned long flags = __raw_local_save_flags();
59
60 raw_local_irq_disable();
61
62 return flags;
63}
64
65#define raw_local_irq_save(flags) \
66 do { (flags) = __raw_local_irq_save(); } while (0)
67
68#endif /* __ASM_AVR32_IRQFLAGS_H */
diff --git a/include/asm-avr32/kdebug.h b/include/asm-avr32/kdebug.h
new file mode 100644
index 0000000000..f583b643ff
--- /dev/null
+++ b/include/asm-avr32/kdebug.h
@@ -0,0 +1,38 @@
1#ifndef __ASM_AVR32_KDEBUG_H
2#define __ASM_AVR32_KDEBUG_H
3
4#include <linux/notifier.h>
5
6struct pt_regs;
7
8struct die_args {
9 struct pt_regs *regs;
10 int trapnr;
11};
12
13int register_die_notifier(struct notifier_block *nb);
14int unregister_die_notifier(struct notifier_block *nb);
15int register_page_fault_notifier(struct notifier_block *nb);
16int unregister_page_fault_notifier(struct notifier_block *nb);
17extern struct atomic_notifier_head avr32_die_chain;
18
19/* Grossly misnamed. */
20enum die_val {
21 DIE_FAULT,
22 DIE_BREAKPOINT,
23 DIE_SSTEP,
24 DIE_PAGE_FAULT,
25};
26
27static inline int notify_die(enum die_val val, struct pt_regs *regs,
28 int trap, int sig)
29{
30 struct die_args args = {
31 .regs = regs,
32 .trapnr = trap,
33 };
34
35 return atomic_notifier_call_chain(&avr32_die_chain, val, &args);
36}
37
38#endif /* __ASM_AVR32_KDEBUG_H */
diff --git a/include/asm-avr32/kmap_types.h b/include/asm-avr32/kmap_types.h
new file mode 100644
index 0000000000..b7f5c68701
--- /dev/null
+++ b/include/asm-avr32/kmap_types.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_AVR32_KMAP_TYPES_H
2#define __ASM_AVR32_KMAP_TYPES_H
3
4#ifdef CONFIG_DEBUG_HIGHMEM
5# define D(n) __KM_FENCE_##n ,
6#else
7# define D(n)
8#endif
9
10enum km_type {
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_PTE2,
21D(10) KM_IRQ0,
22D(11) KM_IRQ1,
23D(12) KM_SOFTIRQ0,
24D(13) KM_SOFTIRQ1,
25D(14) KM_TYPE_NR
26};
27
28#undef D
29
30#endif /* __ASM_AVR32_KMAP_TYPES_H */
diff --git a/include/asm-avr32/kprobes.h b/include/asm-avr32/kprobes.h
new file mode 100644
index 0000000000..09a5cbe2f8
--- /dev/null
+++ b/include/asm-avr32/kprobes.h
@@ -0,0 +1,34 @@
1/*
2 * Kernel Probes (KProbes)
3 *
4 * Copyright (C) 2005-2006 Atmel Corporation
5 * Copyright (C) IBM Corporation, 2002, 2004
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#ifndef __ASM_AVR32_KPROBES_H
12#define __ASM_AVR32_KPROBES_H
13
14#include <linux/types.h>
15
16typedef u16 kprobe_opcode_t;
17#define BREAKPOINT_INSTRUCTION 0xd673 /* breakpoint */
18#define MAX_INSN_SIZE 2
19
20#define ARCH_INACTIVE_KPROBE_COUNT 1
21
22#define arch_remove_kprobe(p) do { } while (0)
23
24/* Architecture specific copy of original instruction */
25struct arch_specific_insn {
26 kprobe_opcode_t insn[MAX_INSN_SIZE];
27};
28
29extern int kprobe_exceptions_notify(struct notifier_block *self,
30 unsigned long val, void *data);
31
32#define flush_insn_slot(p) do { } while (0)
33
34#endif /* __ASM_AVR32_KPROBES_H */
diff --git a/include/asm-avr32/linkage.h b/include/asm-avr32/linkage.h
new file mode 100644
index 0000000000..f7b285e910
--- /dev/null
+++ b/include/asm-avr32/linkage.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#define __ALIGN .balign 2
5#define __ALIGN_STR ".balign 2"
6
7#endif /* __ASM_LINKAGE_H */
diff --git a/include/asm-avr32/local.h b/include/asm-avr32/local.h
new file mode 100644
index 0000000000..1c1619694d
--- /dev/null
+++ b/include/asm-avr32/local.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_LOCAL_H
2#define __ASM_AVR32_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif /* __ASM_AVR32_LOCAL_H */
diff --git a/include/asm-avr32/mach/serial_at91.h b/include/asm-avr32/mach/serial_at91.h
new file mode 100644
index 0000000000..1290bb3280
--- /dev/null
+++ b/include/asm-avr32/mach/serial_at91.h
@@ -0,0 +1,33 @@
1/*
2 * linux/include/asm-arm/mach/serial_at91.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12
13/*
14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot.
16 */
17struct at91_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23 int (*open)(struct uart_port *);
24 void (*close)(struct uart_port *);
25};
26
27#if defined(CONFIG_SERIAL_AT91)
28void at91_register_uart_fns(struct at91_port_fns *fns);
29#else
30#define at91_register_uart_fns(fns) do { } while (0)
31#endif
32
33
diff --git a/include/asm-avr32/mman.h b/include/asm-avr32/mman.h
new file mode 100644
index 0000000000..648f91e718
--- /dev/null
+++ b/include/asm-avr32/mman.h
@@ -0,0 +1,17 @@
1#ifndef __ASM_AVR32_MMAN_H__
2#define __ASM_AVR32_MMAN_H__
3
4#include <asm-generic/mman.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ASM_AVR32_MMAN_H__ */
diff --git a/include/asm-avr32/mmu.h b/include/asm-avr32/mmu.h
new file mode 100644
index 0000000000..60c2d2650d
--- /dev/null
+++ b/include/asm-avr32/mmu.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_AVR32_MMU_H
2#define __ASM_AVR32_MMU_H
3
4/* Default "unsigned long" context */
5typedef unsigned long mm_context_t;
6
7#define MMU_ITLB_ENTRIES 64
8#define MMU_DTLB_ENTRIES 64
9
10#endif /* __ASM_AVR32_MMU_H */
diff --git a/include/asm-avr32/mmu_context.h b/include/asm-avr32/mmu_context.h
new file mode 100644
index 0000000000..31add1ae80
--- /dev/null
+++ b/include/asm-avr32/mmu_context.h
@@ -0,0 +1,148 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * ASID handling taken from SH implementation.
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2003 Paul Mundt
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#ifndef __ASM_AVR32_MMU_CONTEXT_H
13#define __ASM_AVR32_MMU_CONTEXT_H
14
15#include <asm/tlbflush.h>
16#include <asm/pgalloc.h>
17#include <asm/sysreg.h>
18
19/*
20 * The MMU "context" consists of two things:
21 * (a) TLB cache version
22 * (b) ASID (Address Space IDentifier)
23 */
24#define MMU_CONTEXT_ASID_MASK 0x000000ff
25#define MMU_CONTEXT_VERSION_MASK 0xffffff00
26#define MMU_CONTEXT_FIRST_VERSION 0x00000100
27#define NO_CONTEXT 0
28
29#define MMU_NO_ASID 0x100
30
31/* Virtual Page Number mask */
32#define MMU_VPN_MASK 0xfffff000
33
34/* Cache of MMU context last used */
35extern unsigned long mmu_context_cache;
36
37/*
38 * Get MMU context if needed
39 */
40static inline void
41get_mmu_context(struct mm_struct *mm)
42{
43 unsigned long mc = mmu_context_cache;
44
45 if (((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0)
46 /* It's up to date, do nothing */
47 return;
48
49 /* It's old, we need to get new context with new version */
50 mc = ++mmu_context_cache;
51 if (!(mc & MMU_CONTEXT_ASID_MASK)) {
52 /*
53 * We have exhausted all ASIDs of this version.
54 * Flush the TLB and start new cycle.
55 */
56 flush_tlb_all();
57 /*
58 * Fix version. Note that we avoid version #0
59 * to distinguish NO_CONTEXT.
60 */
61 if (!mc)
62 mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
63 }
64 mm->context = mc;
65}
66
67/*
68 * Initialize the context related info for a new mm_struct
69 * instance.
70 */
71static inline int init_new_context(struct task_struct *tsk,
72 struct mm_struct *mm)
73{
74 mm->context = NO_CONTEXT;
75 return 0;
76}
77
78/*
79 * Destroy context related info for an mm_struct that is about
80 * to be put to rest.
81 */
82static inline void destroy_context(struct mm_struct *mm)
83{
84 /* Do nothing */
85}
86
87static inline void set_asid(unsigned long asid)
88{
89 /* XXX: We're destroying TLBEHI[8:31] */
90 sysreg_write(TLBEHI, asid & MMU_CONTEXT_ASID_MASK);
91 cpu_sync_pipeline();
92}
93
94static inline unsigned long get_asid(void)
95{
96 unsigned long asid;
97
98 asid = sysreg_read(TLBEHI);
99 return asid & MMU_CONTEXT_ASID_MASK;
100}
101
102static inline void activate_context(struct mm_struct *mm)
103{
104 get_mmu_context(mm);
105 set_asid(mm->context & MMU_CONTEXT_ASID_MASK);
106}
107
108static inline void switch_mm(struct mm_struct *prev,
109 struct mm_struct *next,
110 struct task_struct *tsk)
111{
112 if (likely(prev != next)) {
113 unsigned long __pgdir = (unsigned long)next->pgd;
114
115 sysreg_write(PTBR, __pgdir);
116 activate_context(next);
117 }
118}
119
120#define deactivate_mm(tsk,mm) do { } while(0)
121
122#define activate_mm(prev, next) switch_mm((prev), (next), NULL)
123
124static inline void
125enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
126{
127}
128
129
130static inline void enable_mmu(void)
131{
132 sysreg_write(MMUCR, (SYSREG_BIT(MMUCR_S)
133 | SYSREG_BIT(E)
134 | SYSREG_BIT(MMUCR_I)));
135 nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
136
137 if (mmu_context_cache == NO_CONTEXT)
138 mmu_context_cache = MMU_CONTEXT_FIRST_VERSION;
139
140 set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK);
141}
142
143static inline void disable_mmu(void)
144{
145 sysreg_write(MMUCR, SYSREG_BIT(MMUCR_S));
146}
147
148#endif /* __ASM_AVR32_MMU_CONTEXT_H */
diff --git a/include/asm-avr32/module.h b/include/asm-avr32/module.h
new file mode 100644
index 0000000000..451444538a
--- /dev/null
+++ b/include/asm-avr32/module.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_AVR32_MODULE_H
2#define __ASM_AVR32_MODULE_H
3
4struct mod_arch_syminfo {
5 unsigned long got_offset;
6 int got_initialized;
7};
8
9struct mod_arch_specific {
10 /* Starting offset of got in the module core memory. */
11 unsigned long got_offset;
12 /* Size of the got. */
13 unsigned long got_size;
14 /* Number of symbols in syminfo. */
15 int nsyms;
16 /* Additional symbol information (got offsets). */
17 struct mod_arch_syminfo *syminfo;
18};
19
20#define Elf_Shdr Elf32_Shdr
21#define Elf_Sym Elf32_Sym
22#define Elf_Ehdr Elf32_Ehdr
23
24#define MODULE_PROC_FAMILY "AVR32v1"
25
26#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
27
28#endif /* __ASM_AVR32_MODULE_H */
diff --git a/include/asm-avr32/msgbuf.h b/include/asm-avr32/msgbuf.h
new file mode 100644
index 0000000000..ac18bc4da7
--- /dev/null
+++ b/include/asm-avr32/msgbuf.h
@@ -0,0 +1,31 @@
1#ifndef __ASM_AVR32_MSGBUF_H
2#define __ASM_AVR32_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* __ASM_AVR32_MSGBUF_H */
diff --git a/include/asm-avr32/mutex.h b/include/asm-avr32/mutex.h
new file mode 100644
index 0000000000..458c1f7fbc
--- /dev/null
+++ b/include/asm-avr32/mutex.h
@@ -0,0 +1,9 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/include/asm-avr32/namei.h b/include/asm-avr32/namei.h
new file mode 100644
index 0000000000..f0a26de06c
--- /dev/null
+++ b/include/asm-avr32/namei.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_AVR32_NAMEI_H
2#define __ASM_AVR32_NAMEI_H
3
4/* This dummy routine may be changed to something useful */
5#define __emul_prefix() NULL
6
7#endif /* __ASM_AVR32_NAMEI_H */
diff --git a/include/asm-avr32/numnodes.h b/include/asm-avr32/numnodes.h
new file mode 100644
index 0000000000..0b864d7ce3
--- /dev/null
+++ b/include/asm-avr32/numnodes.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_AVR32_NUMNODES_H
2#define __ASM_AVR32_NUMNODES_H
3
4/* Max 4 nodes */
5#define NODES_SHIFT 2
6
7#endif /* __ASM_AVR32_NUMNODES_H */
diff --git a/include/asm-avr32/ocd.h b/include/asm-avr32/ocd.h
new file mode 100644
index 0000000000..46f73180a1
--- /dev/null
+++ b/include/asm-avr32/ocd.h
@@ -0,0 +1,78 @@
1/*
2 * AVR32 OCD Registers
3 *
4 * Copyright (C) 2004-2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_AVR32_OCD_H
11#define __ASM_AVR32_OCD_H
12
13/* Debug Registers */
14#define DBGREG_DID 0
15#define DBGREG_DC 8
16#define DBGREG_DS 16
17#define DBGREG_RWCS 28
18#define DBGREG_RWA 36
19#define DBGREG_RWD 40
20#define DBGREG_WT 44
21#define DBGREG_DTC 52
22#define DBGREG_DTSA0 56
23#define DBGREG_DTSA1 60
24#define DBGREG_DTEA0 72
25#define DBGREG_DTEA1 76
26#define DBGREG_BWC0A 88
27#define DBGREG_BWC0B 92
28#define DBGREG_BWC1A 96
29#define DBGREG_BWC1B 100
30#define DBGREG_BWC2A 104
31#define DBGREG_BWC2B 108
32#define DBGREG_BWC3A 112
33#define DBGREG_BWC3B 116
34#define DBGREG_BWA0A 120
35#define DBGREG_BWA0B 124
36#define DBGREG_BWA1A 128
37#define DBGREG_BWA1B 132
38#define DBGREG_BWA2A 136
39#define DBGREG_BWA2B 140
40#define DBGREG_BWA3A 144
41#define DBGREG_BWA3B 148
42#define DBGREG_BWD3A 153
43#define DBGREG_BWD3B 156
44
45#define DBGREG_PID 284
46
47#define SABAH_OCD 0x01
48#define SABAH_ICACHE 0x02
49#define SABAH_MEM_CACHED 0x04
50#define SABAH_MEM_UNCACHED 0x05
51
52/* Fields in the Development Control register */
53#define DC_SS_BIT 8
54
55#define DC_SS (1 << DC_SS_BIT)
56#define DC_DBE (1 << 13)
57#define DC_RID (1 << 27)
58#define DC_ORP (1 << 28)
59#define DC_MM (1 << 29)
60#define DC_RES (1 << 30)
61
62/* Fields in the Development Status register */
63#define DS_SSS (1 << 0)
64#define DS_SWB (1 << 1)
65#define DS_HWB (1 << 2)
66#define DS_BP_SHIFT 8
67#define DS_BP_MASK (0xff << DS_BP_SHIFT)
68
69#define __mfdr(addr) \
70({ \
71 register unsigned long value; \
72 asm volatile("mfdr %0, %1" : "=r"(value) : "i"(addr)); \
73 value; \
74})
75#define __mtdr(addr, value) \
76 asm volatile("mtdr %0, %1" : : "i"(addr), "r"(value))
77
78#endif /* __ASM_AVR32_OCD_H */
diff --git a/include/asm-avr32/page.h b/include/asm-avr32/page.h
new file mode 100644
index 0000000000..0f630b3e99
--- /dev/null
+++ b/include/asm-avr32/page.h
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PAGE_H
9#define __ASM_AVR32_PAGE_H
10
11#ifdef __KERNEL__
12
13/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12
15#ifdef __ASSEMBLY__
16#define PAGE_SIZE (1 << PAGE_SHIFT)
17#else
18#define PAGE_SIZE (1UL << PAGE_SHIFT)
19#endif
20#define PAGE_MASK (~(PAGE_SIZE-1))
21#define PTE_MASK PAGE_MASK
22
23#ifndef __ASSEMBLY__
24
25#include <asm/addrspace.h>
26
27extern void clear_page(void *to);
28extern void copy_page(void *to, void *from);
29
30#define clear_user_page(page, vaddr, pg) clear_page(page)
31#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
32
33/*
34 * These are used to make use of C type-checking..
35 */
36typedef struct { unsigned long pte; } pte_t;
37typedef struct { unsigned long pgd; } pgd_t;
38typedef struct { unsigned long pgprot; } pgprot_t;
39
40#define pte_val(x) ((x).pte)
41#define pgd_val(x) ((x).pgd)
42#define pgprot_val(x) ((x).pgprot)
43
44#define __pte(x) ((pte_t) { (x) })
45#define __pgd(x) ((pgd_t) { (x) })
46#define __pgprot(x) ((pgprot_t) { (x) })
47
48/* FIXME: These should be removed soon */
49extern unsigned long memory_start, memory_end;
50
51/* Pure 2^n version of get_order */
52static inline int get_order(unsigned long size)
53{
54 unsigned lz;
55
56 size = (size - 1) >> PAGE_SHIFT;
57 asm("clz %0, %1" : "=r"(lz) : "r"(size));
58 return 32 - lz;
59}
60
61#endif /* !__ASSEMBLY__ */
62
63/* Align the pointer to the (next) page boundary */
64#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
65
66/*
67 * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
68 * permanently to the physical addresses 0x00000000 -> 0x1fffffff when
69 * segmentation is enabled. We want to make use of this in order to
70 * minimize TLB pressure.
71 */
72#define PAGE_OFFSET (0x80000000UL)
73
74/*
75 * ALSA uses virt_to_page() on DMA pages, which I'm not entirely sure
76 * is a good idea. Anyway, we can't simply subtract PAGE_OFFSET here
77 * in that case, so we'll have to mask out the three most significant
78 * bits of the address instead...
79 *
80 * What's the difference between __pa() and virt_to_phys() anyway?
81 */
82#define __pa(x) PHYSADDR(x)
83#define __va(x) ((void *)(P1SEGADDR(x)))
84
85#define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT)
86
87#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT))
88#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
89
90#ifndef CONFIG_NEED_MULTIPLE_NODES
91
92#define PHYS_PFN_OFFSET (CONFIG_PHYS_OFFSET >> PAGE_SHIFT)
93
94#define pfn_to_page(pfn) (mem_map + ((pfn) - PHYS_PFN_OFFSET))
95#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PHYS_PFN_OFFSET)
96#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
97#endif /* CONFIG_NEED_MULTIPLE_NODES */
98
99#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
100#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
101
102#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
103 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
104
105/*
106 * Memory above this physical address will be considered highmem.
107 */
108#define HIGHMEM_START 0x20000000UL
109
110#endif /* __KERNEL__ */
111
112#endif /* __ASM_AVR32_PAGE_H */
diff --git a/include/asm-avr32/param.h b/include/asm-avr32/param.h
new file mode 100644
index 0000000000..34bc8d4c3b
--- /dev/null
+++ b/include/asm-avr32/param.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_AVR32_PARAM_H
2#define __ASM_AVR32_PARAM_H
3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ
6# define USER_HZ 100 /* User interfaces are in "ticks" */
7# define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
8#endif
9
10#ifndef HZ
11# define HZ 100
12#endif
13
14/* TODO: Should be configurable */
15#define EXEC_PAGESIZE 4096
16
17#ifndef NOGROUP
18# define NOGROUP (-1)
19#endif
20
21#define MAXHOSTNAMELEN 64
22
23#endif /* __ASM_AVR32_PARAM_H */
diff --git a/include/asm-avr32/pci.h b/include/asm-avr32/pci.h
new file mode 100644
index 0000000000..0f5f134b89
--- /dev/null
+++ b/include/asm-avr32/pci.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_AVR32_PCI_H__
2#define __ASM_AVR32_PCI_H__
3
4/* We don't support PCI yet, but some drivers require this file anyway */
5
6#define PCI_DMA_BUS_IS_PHYS (1)
7
8#endif /* __ASM_AVR32_PCI_H__ */
diff --git a/include/asm-avr32/percpu.h b/include/asm-avr32/percpu.h
new file mode 100644
index 0000000000..69227b4cd0
--- /dev/null
+++ b/include/asm-avr32/percpu.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_PERCPU_H
2#define __ASM_AVR32_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_AVR32_PERCPU_H */
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h
new file mode 100644
index 0000000000..7492cfb92c
--- /dev/null
+++ b/include/asm-avr32/pgalloc.h
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PGALLOC_H
9#define __ASM_AVR32_PGALLOC_H
10
11#include <asm/processor.h>
12#include <linux/threads.h>
13#include <linux/slab.h>
14#include <linux/mm.h>
15
16#define pmd_populate_kernel(mm, pmd, pte) \
17 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
18
19static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
20 struct page *pte)
21{
22 set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte)));
23}
24
25/*
26 * Allocate and free page tables
27 */
28static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
29{
30 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t));
31 pgd_t *pgd = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL);
32
33 if (pgd)
34 memset(pgd, 0, pgd_size);
35
36 return pgd;
37}
38
39static inline void pgd_free(pgd_t *pgd)
40{
41 kfree(pgd);
42}
43
44static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
45 unsigned long address)
46{
47 int count = 0;
48 pte_t *pte;
49
50 do {
51 pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT);
52 if (pte)
53 clear_page(pte);
54 else {
55 current->state = TASK_UNINTERRUPTIBLE;
56 schedule_timeout(HZ);
57 }
58 } while (!pte && (count++ < 10));
59
60 return pte;
61}
62
63static inline struct page *pte_alloc_one(struct mm_struct *mm,
64 unsigned long address)
65{
66 int count = 0;
67 struct page *pte;
68
69 do {
70 pte = alloc_pages(GFP_KERNEL, 0);
71 if (pte)
72 clear_page(page_address(pte));
73 else {
74 current->state = TASK_UNINTERRUPTIBLE;
75 schedule_timeout(HZ);
76 }
77 } while (!pte && (count++ < 10));
78
79 return pte;
80}
81
82static inline void pte_free_kernel(pte_t *pte)
83{
84 free_page((unsigned long)pte);
85}
86
87static inline void pte_free(struct page *pte)
88{
89 __free_page(pte);
90}
91
92#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
93
94#define check_pgt_cache() do { } while(0)
95
96#endif /* __ASM_AVR32_PGALLOC_H */
diff --git a/include/asm-avr32/pgtable-2level.h b/include/asm-avr32/pgtable-2level.h
new file mode 100644
index 0000000000..425dd567b5
--- /dev/null
+++ b/include/asm-avr32/pgtable-2level.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PGTABLE_2LEVEL_H
9#define __ASM_AVR32_PGTABLE_2LEVEL_H
10
11#include <asm-generic/pgtable-nopmd.h>
12
13/*
14 * Traditional 2-level paging structure
15 */
16#define PGDIR_SHIFT 22
17#define PTRS_PER_PGD 1024
18
19#define PTRS_PER_PTE 1024
20
21#ifndef __ASSEMBLY__
22#define pte_ERROR(e) \
23 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
24#define pgd_ERROR(e) \
25 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
26
27/*
28 * Certain architectures need to do special things when PTEs
29 * within a page table are directly modified. Thus, the following
30 * hook is made available.
31 */
32#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
33#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep, pteval)
34
35/*
36 * (pmds are folded into pgds so this doesn't get actually called,
37 * but the define is needed for a generic inline function.)
38 */
39#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
40
41#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
42#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
43#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
44
45#endif /* !__ASSEMBLY__ */
46
47#endif /* __ASM_AVR32_PGTABLE_2LEVEL_H */
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h
new file mode 100644
index 0000000000..6b8ca9db2b
--- /dev/null
+++ b/include/asm-avr32/pgtable.h
@@ -0,0 +1,408 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PGTABLE_H
9#define __ASM_AVR32_PGTABLE_H
10
11#include <asm/addrspace.h>
12
13#ifndef __ASSEMBLY__
14#include <linux/sched.h>
15
16#endif /* !__ASSEMBLY__ */
17
18/*
19 * Use two-level page tables just as the i386 (without PAE)
20 */
21#include <asm/pgtable-2level.h>
22
23/*
24 * The following code might need some cleanup when the values are
25 * final...
26 */
27#define PMD_SIZE (1UL << PMD_SHIFT)
28#define PMD_MASK (~(PMD_SIZE-1))
29#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
30#define PGDIR_MASK (~(PGDIR_SIZE-1))
31
32#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
33#define FIRST_USER_ADDRESS 0
34
35#define PTE_PHYS_MASK 0x1ffff000
36
37#ifndef __ASSEMBLY__
38extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
39extern void paging_init(void);
40
41/*
42 * ZERO_PAGE is a global shared page that is always zero: used for
43 * zero-mapped memory areas etc.
44 */
45extern struct page *empty_zero_page;
46#define ZERO_PAGE(vaddr) (empty_zero_page)
47
48/*
49 * Just any arbitrary offset to the start of the vmalloc VM area: the
50 * current 8 MiB value just means that there will be a 8 MiB "hole"
51 * after the uncached physical memory (P2 segment) until the vmalloc
52 * area starts. That means that any out-of-bounds memory accesses will
53 * hopefully be caught; we don't know if the end of the P1/P2 segments
54 * are actually used for anything, but it is anyway safer to let the
55 * MMU catch these kinds of errors than to rely on the memory bus.
56 *
57 * A "hole" of the same size is added to the end of the P3 segment as
58 * well. It might seem wasteful to use 16 MiB of virtual address space
59 * on this, but we do have 512 MiB of it...
60 *
61 * The vmalloc() routines leave a hole of 4 KiB between each vmalloced
62 * area for the same reason.
63 */
64#define VMALLOC_OFFSET (8 * 1024 * 1024)
65#define VMALLOC_START (P3SEG + VMALLOC_OFFSET)
66#define VMALLOC_END (P4SEG - VMALLOC_OFFSET)
67#endif /* !__ASSEMBLY__ */
68
69/*
70 * Page flags. Some of these flags are not directly supported by
71 * hardware, so we have to emulate them.
72 */
73#define _TLBEHI_BIT_VALID 9
74#define _TLBEHI_VALID (1 << _TLBEHI_BIT_VALID)
75
76#define _PAGE_BIT_WT 0 /* W-bit : write-through */
77#define _PAGE_BIT_DIRTY 1 /* D-bit : page changed */
78#define _PAGE_BIT_SZ0 2 /* SZ0-bit : Size of page */
79#define _PAGE_BIT_SZ1 3 /* SZ1-bit : Size of page */
80#define _PAGE_BIT_EXECUTE 4 /* X-bit : execute access allowed */
81#define _PAGE_BIT_RW 5 /* AP0-bit : write access allowed */
82#define _PAGE_BIT_USER 6 /* AP1-bit : user space access allowed */
83#define _PAGE_BIT_BUFFER 7 /* B-bit : bufferable */
84#define _PAGE_BIT_GLOBAL 8 /* G-bit : global (ignore ASID) */
85#define _PAGE_BIT_CACHABLE 9 /* C-bit : cachable */
86
87/* If we drop support for 1K pages, we get two extra bits */
88#define _PAGE_BIT_PRESENT 10
89#define _PAGE_BIT_ACCESSED 11 /* software: page was accessed */
90
91/* The following flags are only valid when !PRESENT */
92#define _PAGE_BIT_FILE 0 /* software: pagecache or swap? */
93
94#define _PAGE_WT (1 << _PAGE_BIT_WT)
95#define _PAGE_DIRTY (1 << _PAGE_BIT_DIRTY)
96#define _PAGE_EXECUTE (1 << _PAGE_BIT_EXECUTE)
97#define _PAGE_RW (1 << _PAGE_BIT_RW)
98#define _PAGE_USER (1 << _PAGE_BIT_USER)
99#define _PAGE_BUFFER (1 << _PAGE_BIT_BUFFER)
100#define _PAGE_GLOBAL (1 << _PAGE_BIT_GLOBAL)
101#define _PAGE_CACHABLE (1 << _PAGE_BIT_CACHABLE)
102
103/* Software flags */
104#define _PAGE_ACCESSED (1 << _PAGE_BIT_ACCESSED)
105#define _PAGE_PRESENT (1 << _PAGE_BIT_PRESENT)
106#define _PAGE_FILE (1 << _PAGE_BIT_FILE)
107
108/*
109 * Page types, i.e. sizes. _PAGE_TYPE_NONE corresponds to what is
110 * usually called _PAGE_PROTNONE on other architectures.
111 *
112 * XXX: Find out if _PAGE_PROTNONE is equivalent with !_PAGE_USER. If
113 * so, we can encode all possible page sizes (although we can't really
114 * support 1K pages anyway due to the _PAGE_PRESENT and _PAGE_ACCESSED
115 * bits)
116 *
117 */
118#define _PAGE_TYPE_MASK ((1 << _PAGE_BIT_SZ0) | (1 << _PAGE_BIT_SZ1))
119#define _PAGE_TYPE_NONE (0 << _PAGE_BIT_SZ0)
120#define _PAGE_TYPE_SMALL (1 << _PAGE_BIT_SZ0)
121#define _PAGE_TYPE_MEDIUM (2 << _PAGE_BIT_SZ0)
122#define _PAGE_TYPE_LARGE (3 << _PAGE_BIT_SZ0)
123
124/*
125 * Mask which drop software flags. We currently can't handle more than
126 * 512 MiB of physical memory, so we can use bits 29-31 for other
127 * stuff. With a fixed 4K page size, we can use bits 10-11 as well as
128 * bits 2-3 (SZ)
129 */
130#define _PAGE_FLAGS_HARDWARE_MASK 0xfffff3ff
131
132#define _PAGE_FLAGS_CACHE_MASK (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT)
133
134/* TODO: Check for saneness */
135/* User-mode page table flags (to be set in a pgd or pmd entry) */
136#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_TYPE_SMALL | _PAGE_RW \
137 | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
138/* Kernel-mode page table flags */
139#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_TYPE_SMALL | _PAGE_RW \
140 | _PAGE_ACCESSED | _PAGE_DIRTY)
141/* Flags that may be modified by software */
142#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY \
143 | _PAGE_FLAGS_CACHE_MASK)
144
145#define _PAGE_FLAGS_READ (_PAGE_CACHABLE | _PAGE_BUFFER)
146#define _PAGE_FLAGS_WRITE (_PAGE_FLAGS_READ | _PAGE_RW | _PAGE_DIRTY)
147
148#define _PAGE_NORMAL(x) __pgprot((x) | _PAGE_PRESENT | _PAGE_TYPE_SMALL \
149 | _PAGE_ACCESSED)
150
151#define PAGE_NONE (_PAGE_ACCESSED | _PAGE_TYPE_NONE)
152#define PAGE_READ (_PAGE_FLAGS_READ | _PAGE_USER)
153#define PAGE_EXEC (_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_USER)
154#define PAGE_WRITE (_PAGE_FLAGS_WRITE | _PAGE_USER)
155#define PAGE_KERNEL _PAGE_NORMAL(_PAGE_FLAGS_WRITE | _PAGE_EXECUTE | _PAGE_GLOBAL)
156#define PAGE_KERNEL_RO _PAGE_NORMAL(_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_GLOBAL)
157
158#define _PAGE_P(x) _PAGE_NORMAL((x) & ~(_PAGE_RW | _PAGE_DIRTY))
159#define _PAGE_S(x) _PAGE_NORMAL(x)
160
161#define PAGE_COPY _PAGE_P(PAGE_WRITE | PAGE_READ)
162
163#ifndef __ASSEMBLY__
164/*
165 * The hardware supports flags for write- and execute access. Read is
166 * always allowed if the page is loaded into the TLB, so the "-w-",
167 * "--x" and "-wx" mappings are implemented as "rw-", "r-x" and "rwx",
168 * respectively.
169 *
170 * The "---" case is handled by software; the page will simply not be
171 * loaded into the TLB if the page type is _PAGE_TYPE_NONE.
172 */
173
174#define __P000 __pgprot(PAGE_NONE)
175#define __P001 _PAGE_P(PAGE_READ)
176#define __P010 _PAGE_P(PAGE_WRITE)
177#define __P011 _PAGE_P(PAGE_WRITE | PAGE_READ)
178#define __P100 _PAGE_P(PAGE_EXEC)
179#define __P101 _PAGE_P(PAGE_EXEC | PAGE_READ)
180#define __P110 _PAGE_P(PAGE_EXEC | PAGE_WRITE)
181#define __P111 _PAGE_P(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
182
183#define __S000 __pgprot(PAGE_NONE)
184#define __S001 _PAGE_S(PAGE_READ)
185#define __S010 _PAGE_S(PAGE_WRITE)
186#define __S011 _PAGE_S(PAGE_WRITE | PAGE_READ)
187#define __S100 _PAGE_S(PAGE_EXEC)
188#define __S101 _PAGE_S(PAGE_EXEC | PAGE_READ)
189#define __S110 _PAGE_S(PAGE_EXEC | PAGE_WRITE)
190#define __S111 _PAGE_S(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
191
192#define pte_none(x) (!pte_val(x))
193#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
194
195#define pte_clear(mm,addr,xp) \
196 do { \
197 set_pte_at(mm, addr, xp, __pte(0)); \
198 } while (0)
199
200/*
201 * The following only work if pte_present() is true.
202 * Undefined behaviour if not..
203 */
204static inline int pte_read(pte_t pte)
205{
206 return pte_val(pte) & _PAGE_USER;
207}
208static inline int pte_write(pte_t pte)
209{
210 return pte_val(pte) & _PAGE_RW;
211}
212static inline int pte_exec(pte_t pte)
213{
214 return pte_val(pte) & _PAGE_EXECUTE;
215}
216static inline int pte_dirty(pte_t pte)
217{
218 return pte_val(pte) & _PAGE_DIRTY;
219}
220static inline int pte_young(pte_t pte)
221{
222 return pte_val(pte) & _PAGE_ACCESSED;
223}
224
225/*
226 * The following only work if pte_present() is not true.
227 */
228static inline int pte_file(pte_t pte)
229{
230 return pte_val(pte) & _PAGE_FILE;
231}
232
233/* Mutator functions for PTE bits */
234static inline pte_t pte_rdprotect(pte_t pte)
235{
236 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER));
237 return pte;
238}
239static inline pte_t pte_wrprotect(pte_t pte)
240{
241 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW));
242 return pte;
243}
244static inline pte_t pte_exprotect(pte_t pte)
245{
246 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE));
247 return pte;
248}
249static inline pte_t pte_mkclean(pte_t pte)
250{
251 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY));
252 return pte;
253}
254static inline pte_t pte_mkold(pte_t pte)
255{
256 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED));
257 return pte;
258}
259static inline pte_t pte_mkread(pte_t pte)
260{
261 set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER));
262 return pte;
263}
264static inline pte_t pte_mkwrite(pte_t pte)
265{
266 set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW));
267 return pte;
268}
269static inline pte_t pte_mkexec(pte_t pte)
270{
271 set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE));
272 return pte;
273}
274static inline pte_t pte_mkdirty(pte_t pte)
275{
276 set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY));
277 return pte;
278}
279static inline pte_t pte_mkyoung(pte_t pte)
280{
281 set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED));
282 return pte;
283}
284
285#define pmd_none(x) (!pmd_val(x))
286#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
287#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
288#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) \
289 != _KERNPG_TABLE)
290
291/*
292 * Permanent address of a page. We don't support highmem, so this is
293 * trivial.
294 */
295#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
296#define pte_page(x) phys_to_page(pte_val(x) & PTE_PHYS_MASK)
297
298/*
299 * Mark the prot value as uncacheable and unbufferable
300 */
301#define pgprot_noncached(prot) \
302 __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE))
303
304/*
305 * Mark the prot value as uncacheable but bufferable
306 */
307#define pgprot_writecombine(prot) \
308 __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER)
309
310/*
311 * Conversion functions: convert a page and protection to a page entry,
312 * and a page entry and page directory to the page they refer to.
313 *
314 * extern pte_t mk_pte(struct page *page, pgprot_t pgprot)
315 */
316#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
317
318static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
319{
320 set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK)
321 | pgprot_val(newprot)));
322 return pte;
323}
324
325#define page_pte(page) page_pte_prot(page, __pgprot(0))
326
327#define pmd_page_vaddr(pmd) \
328 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
329
330#define pmd_page(pmd) (phys_to_page(pmd_val(pmd)))
331
332/* to find an entry in a page-table-directory. */
333#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
334#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
335#define pgd_offset_current(address) \
336 ((pgd_t *)__mfsr(SYSREG_PTBR) + pgd_index(address))
337
338/* to find an entry in a kernel page-table-directory */
339#define pgd_offset_k(address) pgd_offset(&init_mm, address)
340
341/* Find an entry in the third-level page table.. */
342#define pte_index(address) \
343 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
344#define pte_offset(dir, address) \
345 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
346#define pte_offset_kernel(dir, address) \
347 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
348#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
349#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
350#define pte_unmap(pte) do { } while (0)
351#define pte_unmap_nested(pte) do { } while (0)
352
353struct vm_area_struct;
354extern void update_mmu_cache(struct vm_area_struct * vma,
355 unsigned long address, pte_t pte);
356
357/*
358 * Encode and decode a swap entry
359 *
360 * Constraints:
361 * _PAGE_FILE at bit 0
362 * _PAGE_TYPE_* at bits 2-3 (for emulating _PAGE_PROTNONE)
363 * _PAGE_PRESENT at bit 10
364 *
365 * We encode the type into bits 4-9 and offset into bits 11-31. This
366 * gives us a 21 bits offset, or 2**21 * 4K = 8G usable swap space per
367 * device, and 64 possible types.
368 *
369 * NOTE: We should set ZEROs at the position of _PAGE_PRESENT
370 * and _PAGE_PROTNONE bits
371 */
372#define __swp_type(x) (((x).val >> 4) & 0x3f)
373#define __swp_offset(x) ((x).val >> 11)
374#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
375#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
376#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
377
378/*
379 * Encode and decode a nonlinear file mapping entry. We have to
380 * preserve _PAGE_FILE and _PAGE_PRESENT here. _PAGE_TYPE_* isn't
381 * necessary, since _PAGE_FILE implies !_PAGE_PROTNONE (?)
382 */
383#define PTE_FILE_MAX_BITS 30
384#define pte_to_pgoff(pte) (((pte_val(pte) >> 1) & 0x1ff) \
385 | ((pte_val(pte) >> 11) << 9))
386#define pgoff_to_pte(off) ((pte_t) { ((((off) & 0x1ff) << 1) \
387 | (((off) >> 9) << 11) \
388 | _PAGE_FILE) })
389
390typedef pte_t *pte_addr_t;
391
392#define kern_addr_valid(addr) (1)
393
394#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
395 remap_pfn_range(vma, vaddr, pfn, size, prot)
396
397#define MK_IOSPACE_PFN(space, pfn) (pfn)
398#define GET_IOSPACE(pfn) 0
399#define GET_PFN(pfn) (pfn)
400
401/* No page table caches to initialize (?) */
402#define pgtable_cache_init() do { } while(0)
403
404#include <asm-generic/pgtable.h>
405
406#endif /* !__ASSEMBLY__ */
407
408#endif /* __ASM_AVR32_PGTABLE_H */
diff --git a/include/asm-avr32/poll.h b/include/asm-avr32/poll.h
new file mode 100644
index 0000000000..736e29755d
--- /dev/null
+++ b/include/asm-avr32/poll.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_AVR32_POLL_H
2#define __ASM_AVR32_POLL_H
3
4/* These are specified by iBCS2 */
5#define POLLIN 0x0001
6#define POLLPRI 0x0002
7#define POLLOUT 0x0004
8#define POLLERR 0x0008
9#define POLLHUP 0x0010
10#define POLLNVAL 0x0020
11
12/* The rest seem to be more-or-less nonstandard. Check them! */
13#define POLLRDNORM 0x0040
14#define POLLRDBAND 0x0080
15#define POLLWRNORM 0x0100
16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
20
21struct pollfd {
22 int fd;
23 short events;
24 short revents;
25};
26
27#endif /* __ASM_AVR32_POLL_H */
diff --git a/include/asm-avr32/posix_types.h b/include/asm-avr32/posix_types.h
new file mode 100644
index 0000000000..2831b039b3
--- /dev/null
+++ b/include/asm-avr32/posix_types.h
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_POSIX_TYPES_H
9#define __ASM_AVR32_POSIX_TYPES_H
10
11/*
12 * This file is generally used by user-level software, so you need to
13 * be a little careful about namespace pollution etc. Also, we cannot
14 * assume GCC is being used.
15 */
16
17typedef unsigned long __kernel_ino_t;
18typedef unsigned short __kernel_mode_t;
19typedef unsigned short __kernel_nlink_t;
20typedef long __kernel_off_t;
21typedef int __kernel_pid_t;
22typedef unsigned short __kernel_ipc_pid_t;
23typedef unsigned int __kernel_uid_t;
24typedef unsigned int __kernel_gid_t;
25typedef unsigned long __kernel_size_t;
26typedef int __kernel_ssize_t;
27typedef int __kernel_ptrdiff_t;
28typedef long __kernel_time_t;
29typedef long __kernel_suseconds_t;
30typedef long __kernel_clock_t;
31typedef int __kernel_timer_t;
32typedef int __kernel_clockid_t;
33typedef int __kernel_daddr_t;
34typedef char * __kernel_caddr_t;
35typedef unsigned short __kernel_uid16_t;
36typedef unsigned short __kernel_gid16_t;
37typedef unsigned int __kernel_uid32_t;
38typedef unsigned int __kernel_gid32_t;
39
40typedef unsigned short __kernel_old_uid_t;
41typedef unsigned short __kernel_old_gid_t;
42typedef unsigned short __kernel_old_dev_t;
43
44#ifdef __GNUC__
45typedef long long __kernel_loff_t;
46#endif
47
48typedef struct {
49#if defined(__KERNEL__) || defined(__USE_ALL)
50 int val[2];
51#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
52 int __val[2];
53#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
54} __kernel_fsid_t;
55
56#if defined(__KERNEL__)
57
58#undef __FD_SET
59static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
60{
61 unsigned long __tmp = __fd / __NFDBITS;
62 unsigned long __rem = __fd % __NFDBITS;
63 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
64}
65
66#undef __FD_CLR
67static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
68{
69 unsigned long __tmp = __fd / __NFDBITS;
70 unsigned long __rem = __fd % __NFDBITS;
71 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
72}
73
74
75#undef __FD_ISSET
76static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
77{
78 unsigned long __tmp = __fd / __NFDBITS;
79 unsigned long __rem = __fd % __NFDBITS;
80 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
81}
82
83/*
84 * This will unroll the loop for the normal constant case (8 ints,
85 * for a 256-bit fd_set)
86 */
87#undef __FD_ZERO
88static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
89{
90 unsigned long *__tmp = __p->fds_bits;
91 int __i;
92
93 if (__builtin_constant_p(__FDSET_LONGS)) {
94 switch (__FDSET_LONGS) {
95 case 16:
96 __tmp[ 0] = 0; __tmp[ 1] = 0;
97 __tmp[ 2] = 0; __tmp[ 3] = 0;
98 __tmp[ 4] = 0; __tmp[ 5] = 0;
99 __tmp[ 6] = 0; __tmp[ 7] = 0;
100 __tmp[ 8] = 0; __tmp[ 9] = 0;
101 __tmp[10] = 0; __tmp[11] = 0;
102 __tmp[12] = 0; __tmp[13] = 0;
103 __tmp[14] = 0; __tmp[15] = 0;
104 return;
105
106 case 8:
107 __tmp[ 0] = 0; __tmp[ 1] = 0;
108 __tmp[ 2] = 0; __tmp[ 3] = 0;
109 __tmp[ 4] = 0; __tmp[ 5] = 0;
110 __tmp[ 6] = 0; __tmp[ 7] = 0;
111 return;
112
113 case 4:
114 __tmp[ 0] = 0; __tmp[ 1] = 0;
115 __tmp[ 2] = 0; __tmp[ 3] = 0;
116 return;
117 }
118 }
119 __i = __FDSET_LONGS;
120 while (__i) {
121 __i--;
122 *__tmp = 0;
123 __tmp++;
124 }
125}
126
127#endif /* defined(__KERNEL__) */
128
129#endif /* __ASM_AVR32_POSIX_TYPES_H */
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h
new file mode 100644
index 0000000000..f6913778a4
--- /dev/null
+++ b/include/asm-avr32/processor.h
@@ -0,0 +1,147 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PROCESSOR_H
9#define __ASM_AVR32_PROCESSOR_H
10
11#include <asm/page.h>
12#include <asm/cache.h>
13
14#define TASK_SIZE 0x80000000
15
16#ifndef __ASSEMBLY__
17
18static inline void *current_text_addr(void)
19{
20 register void *pc asm("pc");
21 return pc;
22}
23
24enum arch_type {
25 ARCH_AVR32A,
26 ARCH_AVR32B,
27 ARCH_MAX
28};
29
30enum cpu_type {
31 CPU_MORGAN,
32 CPU_AT32AP,
33 CPU_MAX
34};
35
36enum tlb_config {
37 TLB_NONE,
38 TLB_SPLIT,
39 TLB_UNIFIED,
40 TLB_INVALID
41};
42
43struct avr32_cpuinfo {
44 struct clk *clk;
45 unsigned long loops_per_jiffy;
46 enum arch_type arch_type;
47 enum cpu_type cpu_type;
48 unsigned short arch_revision;
49 unsigned short cpu_revision;
50 enum tlb_config tlb_config;
51
52 struct cache_info icache;
53 struct cache_info dcache;
54};
55
56extern struct avr32_cpuinfo boot_cpu_data;
57
58#ifdef CONFIG_SMP
59extern struct avr32_cpuinfo cpu_data[];
60#define current_cpu_data cpu_data[smp_processor_id()]
61#else
62#define cpu_data (&boot_cpu_data)
63#define current_cpu_data boot_cpu_data
64#endif
65
66/* This decides where the kernel will search for a free chunk of vm
67 * space during mmap's
68 */
69#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
70
71#define cpu_relax() barrier()
72#define cpu_sync_pipeline() asm volatile("sub pc, -2" : : : "memory")
73
74struct cpu_context {
75 unsigned long sr;
76 unsigned long pc;
77 unsigned long ksp; /* Kernel stack pointer */
78 unsigned long r7;
79 unsigned long r6;
80 unsigned long r5;
81 unsigned long r4;
82 unsigned long r3;
83 unsigned long r2;
84 unsigned long r1;
85 unsigned long r0;
86};
87
88/* This struct contains the CPU context as stored by switch_to() */
89struct thread_struct {
90 struct cpu_context cpu_context;
91 unsigned long single_step_addr;
92 u16 single_step_insn;
93};
94
95#define INIT_THREAD { \
96 .cpu_context = { \
97 .ksp = sizeof(init_stack) + (long)&init_stack, \
98 }, \
99}
100
101/*
102 * Do necessary setup to start up a newly executed thread.
103 */
104#define start_thread(regs, new_pc, new_sp) \
105 do { \
106 set_fs(USER_DS); \
107 memset(regs, 0, sizeof(*regs)); \
108 regs->sr = MODE_USER; \
109 regs->pc = new_pc & ~1; \
110 regs->sp = new_sp; \
111 } while(0)
112
113struct task_struct;
114
115/* Free all resources held by a thread */
116extern void release_thread(struct task_struct *);
117
118/* Create a kernel thread without removing it from tasklists */
119extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
120
121/* Prepare to copy thread state - unlazy all lazy status */
122#define prepare_to_copy(tsk) do { } while(0)
123
124/* Return saved PC of a blocked thread */
125#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
126
127struct pt_regs;
128void show_trace(struct task_struct *task, unsigned long *stack,
129 struct pt_regs *regs);
130
131extern unsigned long get_wchan(struct task_struct *p);
132
133#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
134#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
135
136#define ARCH_HAS_PREFETCH
137
138static inline void prefetch(const void *x)
139{
140 const char *c = x;
141 asm volatile("pref %0" : : "r"(c));
142}
143#define PREFETCH_STRIDE L1_CACHE_BYTES
144
145#endif /* __ASSEMBLY__ */
146
147#endif /* __ASM_AVR32_PROCESSOR_H */
diff --git a/include/asm-avr32/ptrace.h b/include/asm-avr32/ptrace.h
new file mode 100644
index 0000000000..60f0f19a81
--- /dev/null
+++ b/include/asm-avr32/ptrace.h
@@ -0,0 +1,154 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PTRACE_H
9#define __ASM_AVR32_PTRACE_H
10
11#define PTRACE_GETREGS 12
12#define PTRACE_SETREGS 13
13
14/*
15 * Status Register bits
16 */
17#define SR_H 0x40000000
18#define SR_R 0x20000000
19#define SR_J 0x10000000
20#define SR_DM 0x08000000
21#define SR_D 0x04000000
22#define MODE_NMI 0x01c00000
23#define MODE_EXCEPTION 0x01800000
24#define MODE_INT3 0x01400000
25#define MODE_INT2 0x01000000
26#define MODE_INT1 0x00c00000
27#define MODE_INT0 0x00800000
28#define MODE_SUPERVISOR 0x00400000
29#define MODE_USER 0x00000000
30#define MODE_MASK 0x01c00000
31#define SR_EM 0x00200000
32#define SR_I3M 0x00100000
33#define SR_I2M 0x00080000
34#define SR_I1M 0x00040000
35#define SR_I0M 0x00020000
36#define SR_GM 0x00010000
37
38#define SR_H_BIT 30
39#define SR_R_BIT 29
40#define SR_J_BIT 28
41#define SR_DM_BIT 27
42#define SR_D_BIT 26
43#define MODE_SHIFT 22
44#define SR_EM_BIT 21
45#define SR_I3M_BIT 20
46#define SR_I2M_BIT 19
47#define SR_I1M_BIT 18
48#define SR_I0M_BIT 17
49#define SR_GM_BIT 16
50
51/* The user-visible part */
52#define SR_L 0x00000020
53#define SR_Q 0x00000010
54#define SR_V 0x00000008
55#define SR_N 0x00000004
56#define SR_Z 0x00000002
57#define SR_C 0x00000001
58
59#define SR_L_BIT 5
60#define SR_Q_BIT 4
61#define SR_V_BIT 3
62#define SR_N_BIT 2
63#define SR_Z_BIT 1
64#define SR_C_BIT 0
65
66/*
67 * The order is defined by the stmts instruction. r0 is stored first,
68 * so it gets the highest address.
69 *
70 * Registers 0-12 are general-purpose registers (r12 is normally used for
71 * the function return value).
72 * Register 13 is the stack pointer
73 * Register 14 is the link register
74 * Register 15 is the program counter (retrieved from the RAR sysreg)
75 */
76#define FRAME_SIZE_FULL 72
77#define REG_R12_ORIG 68
78#define REG_R0 64
79#define REG_R1 60
80#define REG_R2 56
81#define REG_R3 52
82#define REG_R4 48
83#define REG_R5 44
84#define REG_R6 40
85#define REG_R7 36
86#define REG_R8 32
87#define REG_R9 28
88#define REG_R10 24
89#define REG_R11 20
90#define REG_R12 16
91#define REG_SP 12
92#define REG_LR 8
93
94#define FRAME_SIZE_MIN 8
95#define REG_PC 4
96#define REG_SR 0
97
98#ifndef __ASSEMBLY__
99struct pt_regs {
100 /* These are always saved */
101 unsigned long sr;
102 unsigned long pc;
103
104 /* These are sometimes saved */
105 unsigned long lr;
106 unsigned long sp;
107 unsigned long r12;
108 unsigned long r11;
109 unsigned long r10;
110 unsigned long r9;
111 unsigned long r8;
112 unsigned long r7;
113 unsigned long r6;
114 unsigned long r5;
115 unsigned long r4;
116 unsigned long r3;
117 unsigned long r2;
118 unsigned long r1;
119 unsigned long r0;
120
121 /* Only saved on system call */
122 unsigned long r12_orig;
123};
124
125#ifdef __KERNEL__
126# define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
127extern void show_regs (struct pt_regs *);
128
129static __inline__ int valid_user_regs(struct pt_regs *regs)
130{
131 /*
132 * Some of the Java bits might be acceptable if/when we
133 * implement some support for that stuff...
134 */
135 if ((regs->sr & 0xffff0000) == 0)
136 return 1;
137
138 /*
139 * Force status register flags to be sane and report this
140 * illegal behaviour...
141 */
142 regs->sr &= 0x0000ffff;
143 return 0;
144}
145
146#define instruction_pointer(regs) ((regs)->pc)
147
148#define profile_pc(regs) instruction_pointer(regs)
149
150#endif /* __KERNEL__ */
151
152#endif /* ! __ASSEMBLY__ */
153
154#endif /* __ASM_AVR32_PTRACE_H */
diff --git a/include/asm-avr32/resource.h b/include/asm-avr32/resource.h
new file mode 100644
index 0000000000..c6dd101472
--- /dev/null
+++ b/include/asm-avr32/resource.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_RESOURCE_H
2#define __ASM_AVR32_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* __ASM_AVR32_RESOURCE_H */
diff --git a/include/asm-avr32/scatterlist.h b/include/asm-avr32/scatterlist.h
new file mode 100644
index 0000000000..bfe7d75342
--- /dev/null
+++ b/include/asm-avr32/scatterlist.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_AVR32_SCATTERLIST_H
2#define __ASM_AVR32_SCATTERLIST_H
3
4struct scatterlist {
5 struct page *page;
6 unsigned int offset;
7 dma_addr_t dma_address;
8 unsigned int length;
9};
10
11/* These macros should be used after a pci_map_sg call has been done
12 * to get bus addresses of each of the SG entries and their lengths.
13 * You should only work with the number of sg entries pci_map_sg
14 * returns.
15 */
16#define sg_dma_address(sg) ((sg)->dma_address)
17#define sg_dma_len(sg) ((sg)->length)
18
19#define ISA_DMA_THRESHOLD (0xffffffff)
20
21#endif /* __ASM_AVR32_SCATTERLIST_H */
diff --git a/include/asm-avr32/sections.h b/include/asm-avr32/sections.h
new file mode 100644
index 0000000000..aa14252e41
--- /dev/null
+++ b/include/asm-avr32/sections.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_SECTIONS_H
2#define __ASM_AVR32_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif /* __ASM_AVR32_SECTIONS_H */
diff --git a/include/asm-avr32/semaphore.h b/include/asm-avr32/semaphore.h
new file mode 100644
index 0000000000..ef99ddccc1
--- /dev/null
+++ b/include/asm-avr32/semaphore.h
@@ -0,0 +1,109 @@
1/*
2 * SMP- and interrupt-safe semaphores.
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * Based on include/asm-i386/semaphore.h
7 * Copyright (C) 1996 Linus Torvalds
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#ifndef __ASM_AVR32_SEMAPHORE_H
14#define __ASM_AVR32_SEMAPHORE_H
15
16#include <linux/linkage.h>
17
18#include <asm/system.h>
19#include <asm/atomic.h>
20#include <linux/wait.h>
21#include <linux/rwsem.h>
22
23struct semaphore {
24 atomic_t count;
25 int sleepers;
26 wait_queue_head_t wait;
27};
28
29#define __SEMAPHORE_INITIALIZER(name, n) \
30{ \
31 .count = ATOMIC_INIT(n), \
32 .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
33}
34
35#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
36 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
37
38#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
39#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
40
41static inline void sema_init (struct semaphore *sem, int val)
42{
43 atomic_set(&sem->count, val);
44 sem->sleepers = 0;
45 init_waitqueue_head(&sem->wait);
46}
47
48static inline void init_MUTEX (struct semaphore *sem)
49{
50 sema_init(sem, 1);
51}
52
53static inline void init_MUTEX_LOCKED (struct semaphore *sem)
54{
55 sema_init(sem, 0);
56}
57
58void __down(struct semaphore * sem);
59int __down_interruptible(struct semaphore * sem);
60void __up(struct semaphore * sem);
61
62/*
63 * This is ugly, but we want the default case to fall through.
64 * "__down_failed" is a special asm handler that calls the C
65 * routine that actually waits. See arch/i386/kernel/semaphore.c
66 */
67static inline void down(struct semaphore * sem)
68{
69 might_sleep();
70 if (unlikely(atomic_dec_return (&sem->count) < 0))
71 __down (sem);
72}
73
74/*
75 * Interruptible try to acquire a semaphore. If we obtained
76 * it, return zero. If we were interrupted, returns -EINTR
77 */
78static inline int down_interruptible(struct semaphore * sem)
79{
80 int ret = 0;
81
82 might_sleep();
83 if (unlikely(atomic_dec_return (&sem->count) < 0))
84 ret = __down_interruptible (sem);
85 return ret;
86}
87
88/*
89 * Non-blockingly attempt to down() a semaphore.
90 * Returns zero if we acquired it
91 */
92static inline int down_trylock(struct semaphore * sem)
93{
94 return atomic_dec_if_positive(&sem->count) < 0;
95}
96
97/*
98 * Note! This is subtle. We jump to wake people up only if
99 * the semaphore was negative (== somebody was waiting on it).
100 * The default case (no contention) will result in NO
101 * jumps for both down() and up().
102 */
103static inline void up(struct semaphore * sem)
104{
105 if (unlikely(atomic_inc_return (&sem->count) <= 0))
106 __up (sem);
107}
108
109#endif /*__ASM_AVR32_SEMAPHORE_H */
diff --git a/include/asm-avr32/sembuf.h b/include/asm-avr32/sembuf.h
new file mode 100644
index 0000000000..e472216e0c
--- /dev/null
+++ b/include/asm-avr32/sembuf.h
@@ -0,0 +1,25 @@
1#ifndef __ASM_AVR32_SEMBUF_H
2#define __ASM_AVR32_SEMBUF_H
3
4/*
5* The semid64_ds structure for AVR32 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* __ASM_AVR32_SEMBUF_H */
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
new file mode 100644
index 0000000000..10193da411
--- /dev/null
+++ b/include/asm-avr32/setup.h
@@ -0,0 +1,141 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * Based on linux/include/asm-arm/setup.h
5 * Copyright (C) 1997-1999 Russel King
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#ifndef __ASM_AVR32_SETUP_H__
12#define __ASM_AVR32_SETUP_H__
13
14#define COMMAND_LINE_SIZE 256
15
16/* Magic number indicating that a tag table is present */
17#define ATAG_MAGIC 0xa2a25441
18
19#ifndef __ASSEMBLY__
20
21/*
22 * Generic memory range, used by several tags.
23 *
24 * addr is always physical.
25 * size is measured in bytes.
26 * next is for use by the OS, e.g. for grouping regions into
27 * linked lists.
28 */
29struct tag_mem_range {
30 u32 addr;
31 u32 size;
32 struct tag_mem_range * next;
33};
34
35/* The list ends with an ATAG_NONE node. */
36#define ATAG_NONE 0x00000000
37
38struct tag_header {
39 u32 size;
40 u32 tag;
41};
42
43/* The list must start with an ATAG_CORE node */
44#define ATAG_CORE 0x54410001
45
46struct tag_core {
47 u32 flags;
48 u32 pagesize;
49 u32 rootdev;
50};
51
52/* it is allowed to have multiple ATAG_MEM nodes */
53#define ATAG_MEM 0x54410002
54/* ATAG_MEM uses tag_mem_range */
55
56/* command line: \0 terminated string */
57#define ATAG_CMDLINE 0x54410003
58
59struct tag_cmdline {
60 char cmdline[1]; /* this is the minimum size */
61};
62
63/* Ramdisk image (may be compressed) */
64#define ATAG_RDIMG 0x54410004
65/* ATAG_RDIMG uses tag_mem_range */
66
67/* Information about various clocks present in the system */
68#define ATAG_CLOCK 0x54410005
69
70struct tag_clock {
71 u32 clock_id; /* Which clock are we talking about? */
72 u32 clock_flags; /* Special features */
73 u64 clock_hz; /* Clock speed in Hz */
74};
75
76/* The clock types we know about */
77#define CLOCK_BOOTCPU 0
78
79/* Memory reserved for the system (e.g. the bootloader) */
80#define ATAG_RSVD_MEM 0x54410006
81/* ATAG_RSVD_MEM uses tag_mem_range */
82
83/* Ethernet information */
84
85#define ATAG_ETHERNET 0x54410007
86
87struct tag_ethernet {
88 u8 mac_index;
89 u8 mii_phy_addr;
90 u8 hw_address[6];
91};
92
93#define ETH_INVALID_PHY 0xff
94
95struct tag {
96 struct tag_header hdr;
97 union {
98 struct tag_core core;
99 struct tag_mem_range mem_range;
100 struct tag_cmdline cmdline;
101 struct tag_clock clock;
102 struct tag_ethernet ethernet;
103 } u;
104};
105
106struct tagtable {
107 u32 tag;
108 int (*parse)(struct tag *);
109};
110
111#define __tag __attribute_used__ __attribute__((__section__(".taglist")))
112#define __tagtable(tag, fn) \
113 static struct tagtable __tagtable_##fn __tag = { tag, fn }
114
115#define tag_member_present(tag,member) \
116 ((unsigned long)(&((struct tag *)0L)->member + 1) \
117 <= (tag)->hdr.size * 4)
118
119#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
120#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
121
122#define for_each_tag(t,base) \
123 for (t = base; t->hdr.size; t = tag_next(t))
124
125extern struct tag_mem_range *mem_phys;
126extern struct tag_mem_range *mem_reserved;
127extern struct tag_mem_range *mem_ramdisk;
128
129extern struct tag *bootloader_tags;
130
131extern void setup_bootmem(void);
132extern void setup_processor(void);
133extern void board_setup_fbmem(unsigned long fbmem_start,
134 unsigned long fbmem_size);
135
136/* Chip-specific hook to enable the use of SDRAM */
137void chip_enable_sdram(void);
138
139#endif /* !__ASSEMBLY__ */
140
141#endif /* __ASM_AVR32_SETUP_H__ */
diff --git a/include/asm-avr32/shmbuf.h b/include/asm-avr32/shmbuf.h
new file mode 100644
index 0000000000..c62fba4173
--- /dev/null
+++ b/include/asm-avr32/shmbuf.h
@@ -0,0 +1,42 @@
1#ifndef __ASM_AVR32_SHMBUF_H
2#define __ASM_AVR32_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* __ASM_AVR32_SHMBUF_H */
diff --git a/include/asm-avr32/shmparam.h b/include/asm-avr32/shmparam.h
new file mode 100644
index 0000000000..3681266c77
--- /dev/null
+++ b/include/asm-avr32/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_SHMPARAM_H
2#define __ASM_AVR32_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* __ASM_AVR32_SHMPARAM_H */
diff --git a/include/asm-avr32/sigcontext.h b/include/asm-avr32/sigcontext.h
new file mode 100644
index 0000000000..e04062b5f3
--- /dev/null
+++ b/include/asm-avr32/sigcontext.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_SIGCONTEXT_H
9#define __ASM_AVR32_SIGCONTEXT_H
10
11struct sigcontext {
12 unsigned long oldmask;
13
14 /* CPU registers */
15 unsigned long sr;
16 unsigned long pc;
17 unsigned long lr;
18 unsigned long sp;
19 unsigned long r12;
20 unsigned long r11;
21 unsigned long r10;
22 unsigned long r9;
23 unsigned long r8;
24 unsigned long r7;
25 unsigned long r6;
26 unsigned long r5;
27 unsigned long r4;
28 unsigned long r3;
29 unsigned long r2;
30 unsigned long r1;
31 unsigned long r0;
32};
33
34#endif /* __ASM_AVR32_SIGCONTEXT_H */
diff --git a/include/asm-avr32/siginfo.h b/include/asm-avr32/siginfo.h
new file mode 100644
index 0000000000..5ee93f40a8
--- /dev/null
+++ b/include/asm-avr32/siginfo.h
@@ -0,0 +1,6 @@
1#ifndef _AVR32_SIGINFO_H
2#define _AVR32_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/include/asm-avr32/signal.h b/include/asm-avr32/signal.h
new file mode 100644
index 0000000000..caffefeeba
--- /dev/null
+++ b/include/asm-avr32/signal.h
@@ -0,0 +1,168 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_SIGNAL_H
9#define __ASM_AVR32_SIGNAL_H
10
11#include <linux/types.h>
12
13/* Avoid too many header ordering problems. */
14struct siginfo;
15
16#ifdef __KERNEL__
17/* Most things should be clean enough to redefine this at will, if care
18 is taken to make libc match. */
19
20#define _NSIG 64
21#define _NSIG_BPW 32
22#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
23
24typedef unsigned long old_sigset_t; /* at least 32 bits */
25
26typedef struct {
27 unsigned long sig[_NSIG_WORDS];
28} sigset_t;
29
30#else
31/* Here we must cater to libcs that poke about in kernel headers. */
32
33#define NSIG 32
34typedef unsigned long sigset_t;
35
36#endif /* __KERNEL__ */
37
38#define SIGHUP 1
39#define SIGINT 2
40#define SIGQUIT 3
41#define SIGILL 4
42#define SIGTRAP 5
43#define SIGABRT 6
44#define SIGIOT 6
45#define SIGBUS 7
46#define SIGFPE 8
47#define SIGKILL 9
48#define SIGUSR1 10
49#define SIGSEGV 11
50#define SIGUSR2 12
51#define SIGPIPE 13
52#define SIGALRM 14
53#define SIGTERM 15
54#define SIGSTKFLT 16
55#define SIGCHLD 17
56#define SIGCONT 18
57#define SIGSTOP 19
58#define SIGTSTP 20
59#define SIGTTIN 21
60#define SIGTTOU 22
61#define SIGURG 23
62#define SIGXCPU 24
63#define SIGXFSZ 25
64#define SIGVTALRM 26
65#define SIGPROF 27
66#define SIGWINCH 28
67#define SIGIO 29
68#define SIGPOLL SIGIO
69/*
70#define SIGLOST 29
71*/
72#define SIGPWR 30
73#define SIGSYS 31
74#define SIGUNUSED 31
75
76/* These should not be considered constants from userland. */
77#define SIGRTMIN 32
78#define SIGRTMAX (_NSIG-1)
79
80/*
81 * SA_FLAGS values:
82 *
83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
84 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
85 * SA_SIGINFO deliver the signal with SIGINFO structs
86 * SA_ONSTACK indicates that a registered stack_t will be used.
87 * SA_RESTART flag to get restarting signals (which were the default long ago)
88 * SA_NODEFER prevents the current signal from being masked in the handler.
89 * SA_RESETHAND clears the handler when the signal is delivered.
90 *
91 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
92 * Unix names RESETHAND and NODEFER respectively.
93 */
94#define SA_NOCLDSTOP 0x00000001
95#define SA_NOCLDWAIT 0x00000002
96#define SA_SIGINFO 0x00000004
97#define SA_RESTORER 0x04000000
98#define SA_ONSTACK 0x08000000
99#define SA_RESTART 0x10000000
100#define SA_NODEFER 0x40000000
101#define SA_RESETHAND 0x80000000
102
103#define SA_NOMASK SA_NODEFER
104#define SA_ONESHOT SA_RESETHAND
105
106/*
107 * sigaltstack controls
108 */
109#define SS_ONSTACK 1
110#define SS_DISABLE 2
111
112#define MINSIGSTKSZ 2048
113#define SIGSTKSZ 8192
114
115#include <asm-generic/signal.h>
116
117#ifdef __KERNEL__
118struct old_sigaction {
119 __sighandler_t sa_handler;
120 old_sigset_t sa_mask;
121 unsigned long sa_flags;
122 __sigrestore_t sa_restorer;
123};
124
125struct sigaction {
126 __sighandler_t sa_handler;
127 unsigned long sa_flags;
128 __sigrestore_t sa_restorer;
129 sigset_t sa_mask; /* mask last for extensibility */
130};
131
132struct k_sigaction {
133 struct sigaction sa;
134};
135#else
136/* Here we must cater to libcs that poke about in kernel headers. */
137
138struct sigaction {
139 union {
140 __sighandler_t _sa_handler;
141 void (*_sa_sigaction)(int, struct siginfo *, void *);
142 } _u;
143 sigset_t sa_mask;
144 unsigned long sa_flags;
145 void (*sa_restorer)(void);
146};
147
148#define sa_handler _u._sa_handler
149#define sa_sigaction _u._sa_sigaction
150
151#endif /* __KERNEL__ */
152
153typedef struct sigaltstack {
154 void __user *ss_sp;
155 int ss_flags;
156 size_t ss_size;
157} stack_t;
158
159#ifdef __KERNEL__
160
161#include <asm/sigcontext.h>
162#undef __HAVE_ARCH_SIG_BITOPS
163
164#define ptrace_signal_deliver(regs, cookie) do { } while (0)
165
166#endif /* __KERNEL__ */
167
168#endif
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
new file mode 100644
index 0000000000..543229de81
--- /dev/null
+++ b/include/asm-avr32/socket.h
@@ -0,0 +1,53 @@
1#ifndef __ASM_AVR32_SOCKET_H
2#define __ASM_AVR32_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52
53#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-avr32/sockios.h b/include/asm-avr32/sockios.h
new file mode 100644
index 0000000000..84f3d65b3b
--- /dev/null
+++ b/include/asm-avr32/sockios.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_AVR32_SOCKIOS_H
2#define __ASM_AVR32_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */
11
12#endif /* __ASM_AVR32_SOCKIOS_H */
diff --git a/include/asm-avr32/stat.h b/include/asm-avr32/stat.h
new file mode 100644
index 0000000000..e72881e102
--- /dev/null
+++ b/include/asm-avr32/stat.h
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_STAT_H
9#define __ASM_AVR32_STAT_H
10
11struct __old_kernel_stat {
12 unsigned short st_dev;
13 unsigned short st_ino;
14 unsigned short st_mode;
15 unsigned short st_nlink;
16 unsigned short st_uid;
17 unsigned short st_gid;
18 unsigned short st_rdev;
19 unsigned long st_size;
20 unsigned long st_atime;
21 unsigned long st_mtime;
22 unsigned long st_ctime;
23};
24
25struct stat {
26 unsigned long st_dev;
27 unsigned long st_ino;
28 unsigned short st_mode;
29 unsigned short st_nlink;
30 unsigned short st_uid;
31 unsigned short st_gid;
32 unsigned long st_rdev;
33 unsigned long st_size;
34 unsigned long st_blksize;
35 unsigned long st_blocks;
36 unsigned long st_atime;
37 unsigned long st_atime_nsec;
38 unsigned long st_mtime;
39 unsigned long st_mtime_nsec;
40 unsigned long st_ctime;
41 unsigned long st_ctime_nsec;
42 unsigned long __unused4;
43 unsigned long __unused5;
44};
45
46#define STAT_HAVE_NSEC 1
47
48struct stat64 {
49 unsigned long long st_dev;
50
51 unsigned long long st_ino;
52 unsigned int st_mode;
53 unsigned int st_nlink;
54
55 unsigned long st_uid;
56 unsigned long st_gid;
57
58 unsigned long long st_rdev;
59
60 long long st_size;
61 unsigned long __pad1; /* align 64-bit st_blocks */
62 unsigned long st_blksize;
63
64 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
65
66 unsigned long st_atime;
67 unsigned long st_atime_nsec;
68
69 unsigned long st_mtime;
70 unsigned long st_mtime_nsec;
71
72 unsigned long st_ctime;
73 unsigned long st_ctime_nsec;
74
75 unsigned long __unused1;
76 unsigned long __unused2;
77};
78
79#endif /* __ASM_AVR32_STAT_H */
diff --git a/include/asm-avr32/statfs.h b/include/asm-avr32/statfs.h
new file mode 100644
index 0000000000..2961bd18c5
--- /dev/null
+++ b/include/asm-avr32/statfs.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_STATFS_H
2#define __ASM_AVR32_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* __ASM_AVR32_STATFS_H */
diff --git a/include/asm-avr32/string.h b/include/asm-avr32/string.h
new file mode 100644
index 0000000000..c91a623cd5
--- /dev/null
+++ b/include/asm-avr32/string.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_STRING_H
9#define __ASM_AVR32_STRING_H
10
11#define __HAVE_ARCH_MEMSET
12extern void *memset(void *b, int c, size_t len);
13
14#define __HAVE_ARCH_MEMCPY
15extern void *memcpy(void *to, const void *from, size_t len);
16
17#endif /* __ASM_AVR32_STRING_H */
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
new file mode 100644
index 0000000000..f91975f330
--- /dev/null
+++ b/include/asm-avr32/sysreg.h
@@ -0,0 +1,332 @@
1/*
2 * AVR32 System Registers
3 *
4 * Copyright (C) 2004-2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_AVR32_SYSREG_H__
11#define __ASM_AVR32_SYSREG_H__
12
13/* sysreg register offsets */
14#define SYSREG_SR 0x0000
15#define SYSREG_EVBA 0x0004
16#define SYSREG_ACBA 0x0008
17#define SYSREG_CPUCR 0x000c
18#define SYSREG_ECR 0x0010
19#define SYSREG_RSR_SUP 0x0014
20#define SYSREG_RSR_INT0 0x0018
21#define SYSREG_RSR_INT1 0x001c
22#define SYSREG_RSR_INT2 0x0020
23#define SYSREG_RSR_INT3 0x0024
24#define SYSREG_RSR_EX 0x0028
25#define SYSREG_RSR_NMI 0x002c
26#define SYSREG_RSR_DBG 0x0030
27#define SYSREG_RAR_SUP 0x0034
28#define SYSREG_RAR_INT0 0x0038
29#define SYSREG_RAR_INT1 0x003c
30#define SYSREG_RAR_INT2 0x0040
31#define SYSREG_RAR_INT3 0x0044
32#define SYSREG_RAR_EX 0x0048
33#define SYSREG_RAR_NMI 0x004c
34#define SYSREG_RAR_DBG 0x0050
35#define SYSREG_JECR 0x0054
36#define SYSREG_JOSP 0x0058
37#define SYSREG_JAVA_LV0 0x005c
38#define SYSREG_JAVA_LV1 0x0060
39#define SYSREG_JAVA_LV2 0x0064
40#define SYSREG_JAVA_LV3 0x0068
41#define SYSREG_JAVA_LV4 0x006c
42#define SYSREG_JAVA_LV5 0x0070
43#define SYSREG_JAVA_LV6 0x0074
44#define SYSREG_JAVA_LV7 0x0078
45#define SYSREG_JTBA 0x007c
46#define SYSREG_JBCR 0x0080
47#define SYSREG_CONFIG0 0x0100
48#define SYSREG_CONFIG1 0x0104
49#define SYSREG_COUNT 0x0108
50#define SYSREG_COMPARE 0x010c
51#define SYSREG_TLBEHI 0x0110
52#define SYSREG_TLBELO 0x0114
53#define SYSREG_PTBR 0x0118
54#define SYSREG_TLBEAR 0x011c
55#define SYSREG_MMUCR 0x0120
56#define SYSREG_TLBARLO 0x0124
57#define SYSREG_TLBARHI 0x0128
58#define SYSREG_PCCNT 0x012c
59#define SYSREG_PCNT0 0x0130
60#define SYSREG_PCNT1 0x0134
61#define SYSREG_PCCR 0x0138
62#define SYSREG_BEAR 0x013c
63
64/* Bitfields in SR */
65#define SYSREG_SR_C_OFFSET 0
66#define SYSREG_SR_C_SIZE 1
67#define SYSREG_Z_OFFSET 1
68#define SYSREG_Z_SIZE 1
69#define SYSREG_SR_N_OFFSET 2
70#define SYSREG_SR_N_SIZE 1
71#define SYSREG_SR_V_OFFSET 3
72#define SYSREG_SR_V_SIZE 1
73#define SYSREG_Q_OFFSET 4
74#define SYSREG_Q_SIZE 1
75#define SYSREG_GM_OFFSET 16
76#define SYSREG_GM_SIZE 1
77#define SYSREG_I0M_OFFSET 17
78#define SYSREG_I0M_SIZE 1
79#define SYSREG_I1M_OFFSET 18
80#define SYSREG_I1M_SIZE 1
81#define SYSREG_I2M_OFFSET 19
82#define SYSREG_I2M_SIZE 1
83#define SYSREG_I3M_OFFSET 20
84#define SYSREG_I3M_SIZE 1
85#define SYSREG_EM_OFFSET 21
86#define SYSREG_EM_SIZE 1
87#define SYSREG_M0_OFFSET 22
88#define SYSREG_M0_SIZE 1
89#define SYSREG_M1_OFFSET 23
90#define SYSREG_M1_SIZE 1
91#define SYSREG_M2_OFFSET 24
92#define SYSREG_M2_SIZE 1
93#define SYSREG_SR_D_OFFSET 26
94#define SYSREG_SR_D_SIZE 1
95#define SYSREG_DM_OFFSET 27
96#define SYSREG_DM_SIZE 1
97#define SYSREG_SR_J_OFFSET 28
98#define SYSREG_SR_J_SIZE 1
99#define SYSREG_R_OFFSET 29
100#define SYSREG_R_SIZE 1
101#define SYSREG_H_OFFSET 30
102#define SYSREG_H_SIZE 1
103
104/* Bitfields in EVBA */
105
106/* Bitfields in ACBA */
107
108/* Bitfields in CPUCR */
109#define SYSREG_BI_OFFSET 0
110#define SYSREG_BI_SIZE 1
111#define SYSREG_BE_OFFSET 1
112#define SYSREG_BE_SIZE 1
113#define SYSREG_FE_OFFSET 2
114#define SYSREG_FE_SIZE 1
115#define SYSREG_RE_OFFSET 3
116#define SYSREG_RE_SIZE 1
117#define SYSREG_IBE_OFFSET 4
118#define SYSREG_IBE_SIZE 1
119#define SYSREG_IEE_OFFSET 5
120#define SYSREG_IEE_SIZE 1
121
122/* Bitfields in ECR */
123#define SYSREG_ECR_OFFSET 0
124#define SYSREG_ECR_SIZE 32
125
126/* Bitfields in RSR_SUP */
127
128/* Bitfields in RSR_INT0 */
129
130/* Bitfields in RSR_INT1 */
131
132/* Bitfields in RSR_INT2 */
133
134/* Bitfields in RSR_INT3 */
135
136/* Bitfields in RSR_EX */
137
138/* Bitfields in RSR_NMI */
139
140/* Bitfields in RSR_DBG */
141
142/* Bitfields in RAR_SUP */
143
144/* Bitfields in RAR_INT0 */
145
146/* Bitfields in RAR_INT1 */
147
148/* Bitfields in RAR_INT2 */
149
150/* Bitfields in RAR_INT3 */
151
152/* Bitfields in RAR_EX */
153
154/* Bitfields in RAR_NMI */
155
156/* Bitfields in RAR_DBG */
157
158/* Bitfields in JECR */
159
160/* Bitfields in JOSP */
161
162/* Bitfields in JAVA_LV0 */
163
164/* Bitfields in JAVA_LV1 */
165
166/* Bitfields in JAVA_LV2 */
167
168/* Bitfields in JAVA_LV3 */
169
170/* Bitfields in JAVA_LV4 */
171
172/* Bitfields in JAVA_LV5 */
173
174/* Bitfields in JAVA_LV6 */
175
176/* Bitfields in JAVA_LV7 */
177
178/* Bitfields in JTBA */
179
180/* Bitfields in JBCR */
181
182/* Bitfields in CONFIG0 */
183#define SYSREG_CONFIG0_D_OFFSET 1
184#define SYSREG_CONFIG0_D_SIZE 1
185#define SYSREG_CONFIG0_S_OFFSET 2
186#define SYSREG_CONFIG0_S_SIZE 1
187#define SYSREG_O_OFFSET 3
188#define SYSREG_O_SIZE 1
189#define SYSREG_P_OFFSET 4
190#define SYSREG_P_SIZE 1
191#define SYSREG_CONFIG0_J_OFFSET 5
192#define SYSREG_CONFIG0_J_SIZE 1
193#define SYSREG_F_OFFSET 6
194#define SYSREG_F_SIZE 1
195#define SYSREG_MMUT_OFFSET 7
196#define SYSREG_MMUT_SIZE 3
197#define SYSREG_AR_OFFSET 10
198#define SYSREG_AR_SIZE 3
199#define SYSREG_AT_OFFSET 13
200#define SYSREG_AT_SIZE 3
201#define SYSREG_PROCESSORREVISION_OFFSET 16
202#define SYSREG_PROCESSORREVISION_SIZE 8
203#define SYSREG_PROCESSORID_OFFSET 24
204#define SYSREG_PROCESSORID_SIZE 8
205
206/* Bitfields in CONFIG1 */
207#define SYSREG_DASS_OFFSET 0
208#define SYSREG_DASS_SIZE 3
209#define SYSREG_DLSZ_OFFSET 3
210#define SYSREG_DLSZ_SIZE 3
211#define SYSREG_DSET_OFFSET 6
212#define SYSREG_DSET_SIZE 4
213#define SYSREG_IASS_OFFSET 10
214#define SYSREG_IASS_SIZE 2
215#define SYSREG_ILSZ_OFFSET 13
216#define SYSREG_ILSZ_SIZE 3
217#define SYSREG_ISET_OFFSET 16
218#define SYSREG_ISET_SIZE 4
219#define SYSREG_DMMUSZ_OFFSET 20
220#define SYSREG_DMMUSZ_SIZE 6
221#define SYSREG_IMMUSZ_OFFSET 26
222#define SYSREG_IMMUSZ_SIZE 6
223
224/* Bitfields in COUNT */
225
226/* Bitfields in COMPARE */
227
228/* Bitfields in TLBEHI */
229#define SYSREG_ASID_OFFSET 0
230#define SYSREG_ASID_SIZE 8
231#define SYSREG_TLBEHI_I_OFFSET 8
232#define SYSREG_TLBEHI_I_SIZE 1
233#define SYSREG_TLBEHI_V_OFFSET 9
234#define SYSREG_TLBEHI_V_SIZE 1
235#define SYSREG_VPN_OFFSET 10
236#define SYSREG_VPN_SIZE 22
237
238/* Bitfields in TLBELO */
239#define SYSREG_W_OFFSET 0
240#define SYSREG_W_SIZE 1
241#define SYSREG_TLBELO_D_OFFSET 1
242#define SYSREG_TLBELO_D_SIZE 1
243#define SYSREG_SZ_OFFSET 2
244#define SYSREG_SZ_SIZE 2
245#define SYSREG_AP_OFFSET 4
246#define SYSREG_AP_SIZE 3
247#define SYSREG_B_OFFSET 7
248#define SYSREG_B_SIZE 1
249#define SYSREG_G_OFFSET 8
250#define SYSREG_G_SIZE 1
251#define SYSREG_TLBELO_C_OFFSET 9
252#define SYSREG_TLBELO_C_SIZE 1
253#define SYSREG_PFN_OFFSET 10
254#define SYSREG_PFN_SIZE 22
255
256/* Bitfields in PTBR */
257
258/* Bitfields in TLBEAR */
259
260/* Bitfields in MMUCR */
261#define SYSREG_E_OFFSET 0
262#define SYSREG_E_SIZE 1
263#define SYSREG_M_OFFSET 1
264#define SYSREG_M_SIZE 1
265#define SYSREG_MMUCR_I_OFFSET 2
266#define SYSREG_MMUCR_I_SIZE 1
267#define SYSREG_MMUCR_N_OFFSET 3
268#define SYSREG_MMUCR_N_SIZE 1
269#define SYSREG_MMUCR_S_OFFSET 4
270#define SYSREG_MMUCR_S_SIZE 1
271#define SYSREG_DLA_OFFSET 8
272#define SYSREG_DLA_SIZE 6
273#define SYSREG_DRP_OFFSET 14
274#define SYSREG_DRP_SIZE 6
275#define SYSREG_ILA_OFFSET 20
276#define SYSREG_ILA_SIZE 6
277#define SYSREG_IRP_OFFSET 26
278#define SYSREG_IRP_SIZE 6
279
280/* Bitfields in TLBARLO */
281
282/* Bitfields in TLBARHI */
283
284/* Bitfields in PCCNT */
285
286/* Bitfields in PCNT0 */
287
288/* Bitfields in PCNT1 */
289
290/* Bitfields in PCCR */
291
292/* Bitfields in BEAR */
293
294/* Constants for ECR */
295#define ECR_UNRECOVERABLE 0
296#define ECR_TLB_MULTIPLE 1
297#define ECR_BUS_ERROR_WRITE 2
298#define ECR_BUS_ERROR_READ 3
299#define ECR_NMI 4
300#define ECR_ADDR_ALIGN_X 5
301#define ECR_PROTECTION_X 6
302#define ECR_DEBUG 7
303#define ECR_ILLEGAL_OPCODE 8
304#define ECR_UNIMPL_INSTRUCTION 9
305#define ECR_PRIVILEGE_VIOLATION 10
306#define ECR_FPE 11
307#define ECR_COPROC_ABSENT 12
308#define ECR_ADDR_ALIGN_R 13
309#define ECR_ADDR_ALIGN_W 14
310#define ECR_PROTECTION_R 15
311#define ECR_PROTECTION_W 16
312#define ECR_DTLB_MODIFIED 17
313#define ECR_TLB_MISS_X 20
314#define ECR_TLB_MISS_R 24
315#define ECR_TLB_MISS_W 28
316
317/* Bit manipulation macros */
318#define SYSREG_BIT(name) (1 << SYSREG_##name##_OFFSET)
319#define SYSREG_BF(name,value) (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) << SYSREG_##name##_OFFSET)
320#define SYSREG_BFEXT(name,value) (((value) >> SYSREG_##name##_OFFSET) & ((1 << SYSREG_##name##_SIZE) - 1))
321#define SYSREG_BFINS(name,value,old) (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) << SYSREG_##name##_OFFSET)) | SYSREG_BF(name,value))
322
323#ifdef __CHECKER__
324extern unsigned long __builtin_mfsr(unsigned long reg);
325extern void __builtin_mtsr(unsigned long reg, unsigned long value);
326#endif
327
328/* Register access macros */
329#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg)
330#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
331
332#endif /* __ASM_AVR32_SYSREG_H__ */
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
new file mode 100644
index 0000000000..ac59605869
--- /dev/null
+++ b/include/asm-avr32/system.h
@@ -0,0 +1,155 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_SYSTEM_H
9#define __ASM_AVR32_SYSTEM_H
10
11#include <linux/compiler.h>
12#include <linux/types.h>
13
14#include <asm/ptrace.h>
15#include <asm/sysreg.h>
16
17#define xchg(ptr,x) \
18 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
19
20#define nop() asm volatile("nop")
21
22#define mb() asm volatile("" : : : "memory")
23#define rmb() mb()
24#define wmb() asm volatile("sync 0" : : : "memory")
25#define read_barrier_depends() do { } while(0)
26#define set_mb(var, value) do { var = value; mb(); } while(0)
27
28/*
29 * Help PathFinder and other Nexus-compliant debuggers keep track of
30 * the current PID by emitting an Ownership Trace Message each time we
31 * switch task.
32 */
33#ifdef CONFIG_OWNERSHIP_TRACE
34#include <asm/ocd.h>
35#define finish_arch_switch(prev) \
36 do { \
37 __mtdr(DBGREG_PID, prev->pid); \
38 __mtdr(DBGREG_PID, current->pid); \
39 } while(0)
40#endif
41
42/*
43 * switch_to(prev, next, last) should switch from task `prev' to task
44 * `next'. `prev' will never be the same as `next'.
45 *
46 * We just delegate everything to the __switch_to assembly function,
47 * which is implemented in arch/avr32/kernel/switch_to.S
48 *
49 * mb() tells GCC not to cache `current' across this call.
50 */
51struct cpu_context;
52struct task_struct;
53extern struct task_struct *__switch_to(struct task_struct *,
54 struct cpu_context *,
55 struct cpu_context *);
56#define switch_to(prev, next, last) \
57 do { \
58 last = __switch_to(prev, &prev->thread.cpu_context + 1, \
59 &next->thread.cpu_context); \
60 } while (0)
61
62#ifdef CONFIG_SMP
63# error "The AVR32 port does not support SMP"
64#else
65# define smp_mb() barrier()
66# define smp_rmb() barrier()
67# define smp_wmb() barrier()
68# define smp_read_barrier_depends() do { } while(0)
69#endif
70
71#include <linux/irqflags.h>
72
73extern void __xchg_called_with_bad_pointer(void);
74
75#ifdef __CHECKER__
76extern unsigned long __builtin_xchg(void *ptr, unsigned long x);
77#endif
78
79#define xchg_u32(val, m) __builtin_xchg((void *)m, val)
80
81static inline unsigned long __xchg(unsigned long x,
82 volatile void *ptr,
83 int size)
84{
85 switch(size) {
86 case 4:
87 return xchg_u32(x, ptr);
88 default:
89 __xchg_called_with_bad_pointer();
90 return x;
91 }
92}
93
94static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
95 unsigned long new)
96{
97 __u32 ret;
98
99 asm volatile(
100 "1: ssrf 5\n"
101 " ld.w %[ret], %[m]\n"
102 " cp.w %[ret], %[old]\n"
103 " brne 2f\n"
104 " stcond %[m], %[new]\n"
105 " brne 1b\n"
106 "2:\n"
107 : [ret] "=&r"(ret), [m] "=m"(*m)
108 : "m"(m), [old] "ir"(old), [new] "r"(new)
109 : "memory", "cc");
110 return ret;
111}
112
113extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels(
114 volatile int * m, unsigned long old, unsigned long new);
115#define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels
116
117/* This function doesn't exist, so you'll get a linker error
118 if something tries to do an invalid cmpxchg(). */
119extern void __cmpxchg_called_with_bad_pointer(void);
120
121#define __HAVE_ARCH_CMPXCHG 1
122
123static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
124 unsigned long new, int size)
125{
126 switch (size) {
127 case 4:
128 return __cmpxchg_u32(ptr, old, new);
129 case 8:
130 return __cmpxchg_u64(ptr, old, new);
131 }
132
133 __cmpxchg_called_with_bad_pointer();
134 return old;
135}
136
137#define cmpxchg(ptr, old, new) \
138 ((typeof(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), \
139 (unsigned long)(new), \
140 sizeof(*(ptr))))
141
142struct pt_regs;
143extern void __die(const char *, struct pt_regs *, unsigned long,
144 const char *, const char *, unsigned long);
145extern void __die_if_kernel(const char *, struct pt_regs *, unsigned long,
146 const char *, const char *, unsigned long);
147
148#define die(msg, regs, err) \
149 __die(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
150#define die_if_kernel(msg, regs, err) \
151 __die_if_kernel(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
152
153#define arch_align_stack(x) (x)
154
155#endif /* __ASM_AVR32_SYSTEM_H */
diff --git a/include/asm-avr32/termbits.h b/include/asm-avr32/termbits.h
new file mode 100644
index 0000000000..9dc6eacafa
--- /dev/null
+++ b/include/asm-avr32/termbits.h
@@ -0,0 +1,173 @@
1#ifndef __ASM_AVR32_TERMBITS_H
2#define __ASM_AVR32_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20/* c_cc characters */
21#define VINTR 0
22#define VQUIT 1
23#define VERASE 2
24#define VKILL 3
25#define VEOF 4
26#define VTIME 5
27#define VMIN 6
28#define VSWTC 7
29#define VSTART 8
30#define VSTOP 9
31#define VSUSP 10
32#define VEOL 11
33#define VREPRINT 12
34#define VDISCARD 13
35#define VWERASE 14
36#define VLNEXT 15
37#define VEOL2 16
38
39/* c_iflag bits */
40#define IGNBRK 0000001
41#define BRKINT 0000002
42#define IGNPAR 0000004
43#define PARMRK 0000010
44#define INPCK 0000020
45#define ISTRIP 0000040
46#define INLCR 0000100
47#define IGNCR 0000200
48#define ICRNL 0000400
49#define IUCLC 0001000
50#define IXON 0002000
51#define IXANY 0004000
52#define IXOFF 0010000
53#define IMAXBEL 0020000
54#define IUTF8 0040000
55
56/* c_oflag bits */
57#define OPOST 0000001
58#define OLCUC 0000002
59#define ONLCR 0000004
60#define OCRNL 0000010
61#define ONOCR 0000020
62#define ONLRET 0000040
63#define OFILL 0000100
64#define OFDEL 0000200
65#define NLDLY 0000400
66#define NL0 0000000
67#define NL1 0000400
68#define CRDLY 0003000
69#define CR0 0000000
70#define CR1 0001000
71#define CR2 0002000
72#define CR3 0003000
73#define TABDLY 0014000
74#define TAB0 0000000
75#define TAB1 0004000
76#define TAB2 0010000
77#define TAB3 0014000
78#define XTABS 0014000
79#define BSDLY 0020000
80#define BS0 0000000
81#define BS1 0020000
82#define VTDLY 0040000
83#define VT0 0000000
84#define VT1 0040000
85#define FFDLY 0100000
86#define FF0 0000000
87#define FF1 0100000
88
89/* c_cflag bit meaning */
90#define CBAUD 0010017
91#define B0 0000000 /* hang up */
92#define B50 0000001
93#define B75 0000002
94#define B110 0000003
95#define B134 0000004
96#define B150 0000005
97#define B200 0000006
98#define B300 0000007
99#define B600 0000010
100#define B1200 0000011
101#define B1800 0000012
102#define B2400 0000013
103#define B4800 0000014
104#define B9600 0000015
105#define B19200 0000016
106#define B38400 0000017
107#define EXTA B19200
108#define EXTB B38400
109#define CSIZE 0000060
110#define CS5 0000000
111#define CS6 0000020
112#define CS7 0000040
113#define CS8 0000060
114#define CSTOPB 0000100
115#define CREAD 0000200
116#define PARENB 0000400
117#define PARODD 0001000
118#define HUPCL 0002000
119#define CLOCAL 0004000
120#define CBAUDEX 0010000
121#define B57600 0010001
122#define B115200 0010002
123#define B230400 0010003
124#define B460800 0010004
125#define B500000 0010005
126#define B576000 0010006
127#define B921600 0010007
128#define B1000000 0010010
129#define B1152000 0010011
130#define B1500000 0010012
131#define B2000000 0010013
132#define B2500000 0010014
133#define B3000000 0010015
134#define B3500000 0010016
135#define B4000000 0010017
136#define CIBAUD 002003600000 /* input baud rate (not used) */
137#define CMSPAR 010000000000 /* mark or space (stick) parity */
138#define CRTSCTS 020000000000 /* flow control */
139
140/* c_lflag bits */
141#define ISIG 0000001
142#define ICANON 0000002
143#define XCASE 0000004
144#define ECHO 0000010
145#define ECHOE 0000020
146#define ECHOK 0000040
147#define ECHONL 0000100
148#define NOFLSH 0000200
149#define TOSTOP 0000400
150#define ECHOCTL 0001000
151#define ECHOPRT 0002000
152#define ECHOKE 0004000
153#define FLUSHO 0010000
154#define PENDIN 0040000
155#define IEXTEN 0100000
156
157/* tcflow() and TCXONC use these */
158#define TCOOFF 0
159#define TCOON 1
160#define TCIOFF 2
161#define TCION 3
162
163/* tcflush() and TCFLSH use these */
164#define TCIFLUSH 0
165#define TCOFLUSH 1
166#define TCIOFLUSH 2
167
168/* tcsetattr uses these */
169#define TCSANOW 0
170#define TCSADRAIN 1
171#define TCSAFLUSH 2
172
173#endif /* __ASM_AVR32_TERMBITS_H */
diff --git a/include/asm-avr32/termios.h b/include/asm-avr32/termios.h
new file mode 100644
index 0000000000..615bc0639e
--- /dev/null
+++ b/include/asm-avr32/termios.h
@@ -0,0 +1,80 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TERMIOS_H
9#define __ASM_AVR32_TERMIOS_H
10
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49/* line disciplines */
50#define N_TTY 0
51#define N_SLIP 1
52#define N_MOUSE 2
53#define N_PPP 3
54#define N_STRIP 4
55#define N_AX25 5
56#define N_X25 6 /* X.25 async */
57#define N_6PACK 7
58#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
59#define N_R3964 9 /* Reserved for Simatic R3964 module */
60#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
61#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
62#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
63#define N_HDLC 13 /* synchronous HDLC */
64#define N_SYNC_PPP 14 /* synchronous PPP */
65#define N_HCI 15 /* Bluetooth HCI UART */
66
67#ifdef __KERNEL__
68/* intr=^C quit=^\ erase=del kill=^U
69 eof=^D vtime=\0 vmin=\1 sxtc=\0
70 start=^Q stop=^S susp=^Z eol=\0
71 reprint=^R discard=^U werase=^W lnext=^V
72 eol2=\0
73*/
74#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
75
76#include <asm-generic/termios.h>
77
78#endif /* __KERNEL__ */
79
80#endif /* __ASM_AVR32_TERMIOS_H */
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h
new file mode 100644
index 0000000000..d1f5b35ebd
--- /dev/null
+++ b/include/asm-avr32/thread_info.h
@@ -0,0 +1,106 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_THREAD_INFO_H
9#define __ASM_AVR32_THREAD_INFO_H
10
11#include <asm/page.h>
12
13#define THREAD_SIZE_ORDER 1
14#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
15
16#ifndef __ASSEMBLY__
17#include <asm/types.h>
18
19struct task_struct;
20struct exec_domain;
21
22struct thread_info {
23 struct task_struct *task; /* main task structure */
24 struct exec_domain *exec_domain; /* execution domain */
25 unsigned long flags; /* low level flags */
26 __u32 cpu;
27 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
28 struct restart_block restart_block;
29 __u8 supervisor_stack[0];
30};
31
32#define INIT_THREAD_INFO(tsk) \
33{ \
34 .task = &tsk, \
35 .exec_domain = &default_exec_domain, \
36 .flags = 0, \
37 .cpu = 0, \
38 .preempt_count = 1, \
39 .restart_block = { \
40 .fn = do_no_restart_syscall \
41 } \
42}
43
44#define init_thread_info (init_thread_union.thread_info)
45#define init_stack (init_thread_union.stack)
46
47/*
48 * Get the thread information struct from C.
49 * We do the usual trick and use the lower end of the stack for this
50 */
51static inline struct thread_info *current_thread_info(void)
52{
53 unsigned long addr = ~(THREAD_SIZE - 1);
54
55 asm("and %0, sp" : "=r"(addr) : "0"(addr));
56 return (struct thread_info *)addr;
57}
58
59/* thread information allocation */
60#define alloc_thread_info(ti) \
61 ((struct thread_info *) __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
62#define free_thread_info(ti) free_pages((unsigned long)(ti), 1)
63#define get_thread_info(ti) get_task_struct((ti)->task)
64#define put_thread_info(ti) put_task_struct((ti)->task)
65
66#endif /* !__ASSEMBLY__ */
67
68#define PREEMPT_ACTIVE 0x40000000
69
70/*
71 * Thread information flags
72 * - these are process state flags that various assembly files may need to access
73 * - pending work-to-be-done flags are in LSW
74 * - other flags in MSW
75 */
76#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
77#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
78#define TIF_SIGPENDING 2 /* signal pending */
79#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
80#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
81 TIF_NEED_RESCHED */
82#define TIF_BREAKPOINT 5 /* true if we should break after return */
83#define TIF_SINGLE_STEP 6 /* single step after next break */
84#define TIF_MEMDIE 7
85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */
86#define TIF_USERSPACE 31 /* true if FS sets userspace */
87
88#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
89#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
90#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
91#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
92#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
93#define _TIF_BREAKPOINT (1 << TIF_BREAKPOINT)
94#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
95#define _TIF_MEMDIE (1 << TIF_MEMDIE)
96#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
97
98/* XXX: These two masks must never span more than 16 bits! */
99/* work to do on interrupt/exception return */
100#define _TIF_WORK_MASK 0x0000013e
101/* work to do on any return to userspace */
102#define _TIF_ALLWORK_MASK 0x0000013f
103/* work to do on return from debug mode */
104#define _TIF_DBGWORK_MASK 0x0000017e
105
106#endif /* __ASM_AVR32_THREAD_INFO_H */
diff --git a/include/asm-avr32/timex.h b/include/asm-avr32/timex.h
new file mode 100644
index 0000000000..5e44ecb3ce
--- /dev/null
+++ b/include/asm-avr32/timex.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TIMEX_H
9#define __ASM_AVR32_TIMEX_H
10
11/*
12 * This is the frequency of the timer used for Linux's timer interrupt.
13 * The value should be defined as accurate as possible or under certain
14 * circumstances Linux timekeeping might become inaccurate or fail.
15 *
16 * For many system the exact clockrate of the timer isn't known but due to
17 * the way this value is used we can get away with a wrong value as long
18 * as this value is:
19 *
20 * - a multiple of HZ
21 * - a divisor of the actual rate
22 *
23 * 500000 is a good such cheat value.
24 *
25 * The obscure number 1193182 is the same as used by the original i8254
26 * time in legacy PC hardware; the chip is never found in AVR32 systems.
27 */
28#define CLOCK_TICK_RATE 500000 /* Underlying HZ */
29
30typedef unsigned long cycles_t;
31
32static inline cycles_t get_cycles (void)
33{
34 return 0;
35}
36
37extern int read_current_timer(unsigned long *timer_value);
38#define ARCH_HAS_READ_CURRENT_TIMER 1
39
40#endif /* __ASM_AVR32_TIMEX_H */
diff --git a/include/asm-avr32/tlb.h b/include/asm-avr32/tlb.h
new file mode 100644
index 0000000000..5c55f9ce7c
--- /dev/null
+++ b/include/asm-avr32/tlb.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TLB_H
9#define __ASM_AVR32_TLB_H
10
11#define tlb_start_vma(tlb, vma) \
12 flush_cache_range(vma, vma->vm_start, vma->vm_end)
13
14#define tlb_end_vma(tlb, vma) \
15 flush_tlb_range(vma, vma->vm_start, vma->vm_end)
16
17#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while(0)
18
19/*
20 * Flush whole TLB for MM
21 */
22#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
23
24#include <asm-generic/tlb.h>
25
26/*
27 * For debugging purposes
28 */
29extern void show_dtlb_entry(unsigned int index);
30extern void dump_dtlb(void);
31
32#endif /* __ASM_AVR32_TLB_H */
diff --git a/include/asm-avr32/tlbflush.h b/include/asm-avr32/tlbflush.h
new file mode 100644
index 0000000000..730e268f81
--- /dev/null
+++ b/include/asm-avr32/tlbflush.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TLBFLUSH_H
9#define __ASM_AVR32_TLBFLUSH_H
10
11#include <asm/mmu.h>
12
13/*
14 * TLB flushing:
15 *
16 * - flush_tlb() flushes the current mm struct TLBs
17 * - flush_tlb_all() flushes all processes' TLB entries
18 * - flush_tlb_mm(mm) flushes the specified mm context TLBs
19 * - flush_tlb_page(vma, vmaddr) flushes one page
20 * - flush_tlb_range(vma, start, end) flushes a range of pages
21 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
22 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
23 */
24extern void flush_tlb(void);
25extern void flush_tlb_all(void);
26extern void flush_tlb_mm(struct mm_struct *mm);
27extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
28 unsigned long end);
29extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
30extern void __flush_tlb_page(unsigned long asid, unsigned long page);
31
32static inline void flush_tlb_pgtables(struct mm_struct *mm,
33 unsigned long start, unsigned long end)
34{
35 /* Nothing to do */
36}
37
38extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
39
40#endif /* __ASM_AVR32_TLBFLUSH_H */
diff --git a/include/asm-avr32/topology.h b/include/asm-avr32/topology.h
new file mode 100644
index 0000000000..5b766cbb48
--- /dev/null
+++ b/include/asm-avr32/topology.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_TOPOLOGY_H
2#define __ASM_AVR32_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* __ASM_AVR32_TOPOLOGY_H */
diff --git a/include/asm-avr32/traps.h b/include/asm-avr32/traps.h
new file mode 100644
index 0000000000..6a8fb944f4
--- /dev/null
+++ b/include/asm-avr32/traps.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TRAPS_H
9#define __ASM_AVR32_TRAPS_H
10
11#include <linux/list.h>
12
13struct undef_hook {
14 struct list_head node;
15 u32 insn_mask;
16 u32 insn_val;
17 int (*fn)(struct pt_regs *regs, u32 insn);
18};
19
20void register_undef_hook(struct undef_hook *hook);
21void unregister_undef_hook(struct undef_hook *hook);
22
23#endif /* __ASM_AVR32_TRAPS_H */
diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h
new file mode 100644
index 0000000000..3f47db9675
--- /dev/null
+++ b/include/asm-avr32/types.h
@@ -0,0 +1,70 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TYPES_H
9#define __ASM_AVR32_TYPES_H
10
11#ifndef __ASSEMBLY__
12
13typedef unsigned short umode_t;
14
15/*
16 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
17 * header files exported to user space
18 */
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
29typedef __signed__ long long __s64;
30typedef unsigned long long __u64;
31#endif
32
33#endif /* __ASSEMBLY__ */
34
35/*
36 * These aren't exported outside the kernel to avoid name space clashes
37 */
38#ifdef __KERNEL__
39
40#define BITS_PER_LONG 32
41
42#ifndef __ASSEMBLY__
43
44typedef signed char s8;
45typedef unsigned char u8;
46
47typedef signed short s16;
48typedef unsigned short u16;
49
50typedef signed int s32;
51typedef unsigned int u32;
52
53typedef signed long long s64;
54typedef unsigned long long u64;
55
56/* Dma addresses are 32-bits wide. */
57
58typedef u32 dma_addr_t;
59
60#ifdef CONFIG_LBD
61typedef u64 sector_t;
62#define HAVE_SECTOR_T
63#endif
64
65#endif /* __ASSEMBLY__ */
66
67#endif /* __KERNEL__ */
68
69
70#endif /* __ASM_AVR32_TYPES_H */
diff --git a/include/asm-avr32/uaccess.h b/include/asm-avr32/uaccess.h
new file mode 100644
index 0000000000..821deb5a9d
--- /dev/null
+++ b/include/asm-avr32/uaccess.h
@@ -0,0 +1,335 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_UACCESS_H
9#define __ASM_AVR32_UACCESS_H
10
11#include <linux/errno.h>
12#include <linux/sched.h>
13
14#define VERIFY_READ 0
15#define VERIFY_WRITE 1
16
17typedef struct {
18 unsigned int is_user_space;
19} mm_segment_t;
20
21/*
22 * The fs value determines whether argument validity checking should be
23 * performed or not. If get_fs() == USER_DS, checking is performed, with
24 * get_fs() == KERNEL_DS, checking is bypassed.
25 *
26 * For historical reasons (Data Segment Register?), these macros are misnamed.
27 */
28#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
29#define segment_eq(a,b) ((a).is_user_space == (b).is_user_space)
30
31#define USER_ADDR_LIMIT 0x80000000
32
33#define KERNEL_DS MAKE_MM_SEG(0)
34#define USER_DS MAKE_MM_SEG(1)
35
36#define get_ds() (KERNEL_DS)
37
38static inline mm_segment_t get_fs(void)
39{
40 return MAKE_MM_SEG(test_thread_flag(TIF_USERSPACE));
41}
42
43static inline void set_fs(mm_segment_t s)
44{
45 if (s.is_user_space)
46 set_thread_flag(TIF_USERSPACE);
47 else
48 clear_thread_flag(TIF_USERSPACE);
49}
50
51/*
52 * Test whether a block of memory is a valid user space address.
53 * Returns 0 if the range is valid, nonzero otherwise.
54 *
55 * We do the following checks:
56 * 1. Is the access from kernel space?
57 * 2. Does (addr + size) set the carry bit?
58 * 3. Is (addr + size) a negative number (i.e. >= 0x80000000)?
59 *
60 * If yes on the first check, access is granted.
61 * If no on any of the others, access is denied.
62 */
63#define __range_ok(addr, size) \
64 (test_thread_flag(TIF_USERSPACE) \
65 && (((unsigned long)(addr) >= 0x80000000) \
66 || ((unsigned long)(size) > 0x80000000) \
67 || (((unsigned long)(addr) + (unsigned long)(size)) > 0x80000000)))
68
69#define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0))
70
71static inline int
72verify_area(int type, const void __user *addr, unsigned long size)
73{
74 return access_ok(type, addr, size) ? 0 : -EFAULT;
75}
76
77/* Generic arbitrary sized copy. Return the number of bytes NOT copied */
78extern __kernel_size_t __copy_user(void *to, const void *from,
79 __kernel_size_t n);
80
81extern __kernel_size_t copy_to_user(void __user *to, const void *from,
82 __kernel_size_t n);
83extern __kernel_size_t copy_from_user(void *to, const void __user *from,
84 __kernel_size_t n);
85
86static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
87 __kernel_size_t n)
88{
89 return __copy_user((void __force *)to, from, n);
90}
91static inline __kernel_size_t __copy_from_user(void *to,
92 const void __user *from,
93 __kernel_size_t n)
94{
95 return __copy_user(to, (const void __force *)from, n);
96}
97
98#define __copy_to_user_inatomic __copy_to_user
99#define __copy_from_user_inatomic __copy_from_user
100
101/*
102 * put_user: - Write a simple value into user space.
103 * @x: Value to copy to user space.
104 * @ptr: Destination address, in user space.
105 *
106 * Context: User context only. This function may sleep.
107 *
108 * This macro copies a single simple value from kernel space to user
109 * space. It supports simple types like char and int, but not larger
110 * data types like structures or arrays.
111 *
112 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
113 * to the result of dereferencing @ptr.
114 *
115 * Returns zero on success, or -EFAULT on error.
116 */
117#define put_user(x,ptr) \
118 __put_user_check((x),(ptr),sizeof(*(ptr)))
119
120/*
121 * get_user: - Get a simple variable from user space.
122 * @x: Variable to store result.
123 * @ptr: Source address, in user space.
124 *
125 * Context: User context only. This function may sleep.
126 *
127 * This macro copies a single simple variable from user space to kernel
128 * space. It supports simple types like char and int, but not larger
129 * data types like structures or arrays.
130 *
131 * @ptr must have pointer-to-simple-variable type, and the result of
132 * dereferencing @ptr must be assignable to @x without a cast.
133 *
134 * Returns zero on success, or -EFAULT on error.
135 * On error, the variable @x is set to zero.
136 */
137#define get_user(x,ptr) \
138 __get_user_check((x),(ptr),sizeof(*(ptr)))
139
140/*
141 * __put_user: - Write a simple value into user space, with less checking.
142 * @x: Value to copy to user space.
143 * @ptr: Destination address, in user space.
144 *
145 * Context: User context only. This function may sleep.
146 *
147 * This macro copies a single simple value from kernel space to user
148 * space. It supports simple types like char and int, but not larger
149 * data types like structures or arrays.
150 *
151 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
152 * to the result of dereferencing @ptr.
153 *
154 * Caller must check the pointer with access_ok() before calling this
155 * function.
156 *
157 * Returns zero on success, or -EFAULT on error.
158 */
159#define __put_user(x,ptr) \
160 __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
161
162/*
163 * __get_user: - Get a simple variable from user space, with less checking.
164 * @x: Variable to store result.
165 * @ptr: Source address, in user space.
166 *
167 * Context: User context only. This function may sleep.
168 *
169 * This macro copies a single simple variable from user space to kernel
170 * space. It supports simple types like char and int, but not larger
171 * data types like structures or arrays.
172 *
173 * @ptr must have pointer-to-simple-variable type, and the result of
174 * dereferencing @ptr must be assignable to @x without a cast.
175 *
176 * Caller must check the pointer with access_ok() before calling this
177 * function.
178 *
179 * Returns zero on success, or -EFAULT on error.
180 * On error, the variable @x is set to zero.
181 */
182#define __get_user(x,ptr) \
183 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
184
185extern int __get_user_bad(void);
186extern int __put_user_bad(void);
187
188#define __get_user_nocheck(x, ptr, size) \
189({ \
190 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \
191 int __gu_err = 0; \
192 \
193 switch (size) { \
194 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \
195 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \
196 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \
197 case 8: __get_user_asm("d", __gu_val, ptr, __gu_err); break; \
198 default: __gu_err = __get_user_bad(); break; \
199 } \
200 \
201 x = __gu_val; \
202 __gu_err; \
203})
204
205#define __get_user_check(x, ptr, size) \
206({ \
207 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \
208 const typeof(*(ptr)) __user * __gu_addr = (ptr); \
209 int __gu_err = 0; \
210 \
211 if (access_ok(VERIFY_READ, __gu_addr, size)) { \
212 switch (size) { \
213 case 1: \
214 __get_user_asm("ub", __gu_val, __gu_addr, \
215 __gu_err); \
216 break; \
217 case 2: \
218 __get_user_asm("uh", __gu_val, __gu_addr, \
219 __gu_err); \
220 break; \
221 case 4: \
222 __get_user_asm("w", __gu_val, __gu_addr, \
223 __gu_err); \
224 break; \
225 case 8: \
226 __get_user_asm("d", __gu_val, __gu_addr, \
227 __gu_err); \
228 break; \
229 default: \
230 __gu_err = __get_user_bad(); \
231 break; \
232 } \
233 } else { \
234 __gu_err = -EFAULT; \
235 } \
236 x = __gu_val; \
237 __gu_err; \
238})
239
240#define __get_user_asm(suffix, __gu_val, ptr, __gu_err) \
241 asm volatile( \
242 "1: ld." suffix " %1, %3 \n" \
243 "2: \n" \
244 " .section .fixup, \"ax\" \n" \
245 "3: mov %0, %4 \n" \
246 " rjmp 2b \n" \
247 " .previous \n" \
248 " .section __ex_table, \"a\" \n" \
249 " .long 1b, 3b \n" \
250 " .previous \n" \
251 : "=r"(__gu_err), "=r"(__gu_val) \
252 : "0"(__gu_err), "m"(*(ptr)), "i"(-EFAULT))
253
254#define __put_user_nocheck(x, ptr, size) \
255({ \
256 typeof(*(ptr)) __pu_val; \
257 int __pu_err = 0; \
258 \
259 __pu_val = (x); \
260 switch (size) { \
261 case 1: __put_user_asm("b", ptr, __pu_val, __pu_err); break; \
262 case 2: __put_user_asm("h", ptr, __pu_val, __pu_err); break; \
263 case 4: __put_user_asm("w", ptr, __pu_val, __pu_err); break; \
264 case 8: __put_user_asm("d", ptr, __pu_val, __pu_err); break; \
265 default: __pu_err = __put_user_bad(); break; \
266 } \
267 __pu_err; \
268})
269
270#define __put_user_check(x, ptr, size) \
271({ \
272 typeof(*(ptr)) __pu_val; \
273 typeof(*(ptr)) __user *__pu_addr = (ptr); \
274 int __pu_err = 0; \
275 \
276 __pu_val = (x); \
277 if (access_ok(VERIFY_WRITE, __pu_addr, size)) { \
278 switch (size) { \
279 case 1: \
280 __put_user_asm("b", __pu_addr, __pu_val, \
281 __pu_err); \
282 break; \
283 case 2: \
284 __put_user_asm("h", __pu_addr, __pu_val, \
285 __pu_err); \
286 break; \
287 case 4: \
288 __put_user_asm("w", __pu_addr, __pu_val, \
289 __pu_err); \
290 break; \
291 case 8: \
292 __put_user_asm("d", __pu_addr, __pu_val, \
293 __pu_err); \
294 break; \
295 default: \
296 __pu_err = __put_user_bad(); \
297 break; \
298 } \
299 } else { \
300 __pu_err = -EFAULT; \
301 } \
302 __pu_err; \
303})
304
305#define __put_user_asm(suffix, ptr, __pu_val, __gu_err) \
306 asm volatile( \
307 "1: st." suffix " %1, %3 \n" \
308 "2: \n" \
309 " .section .fixup, \"ax\" \n" \
310 "3: mov %0, %4 \n" \
311 " rjmp 2b \n" \
312 " .previous \n" \
313 " .section __ex_table, \"a\" \n" \
314 " .long 1b, 3b \n" \
315 " .previous \n" \
316 : "=r"(__gu_err), "=m"(*(ptr)) \
317 : "0"(__gu_err), "r"(__pu_val), "i"(-EFAULT))
318
319extern __kernel_size_t clear_user(void __user *addr, __kernel_size_t size);
320extern __kernel_size_t __clear_user(void __user *addr, __kernel_size_t size);
321
322extern long strncpy_from_user(char *dst, const char __user *src, long count);
323extern long __strncpy_from_user(char *dst, const char __user *src, long count);
324
325extern long strnlen_user(const char __user *__s, long __n);
326extern long __strnlen_user(const char __user *__s, long __n);
327
328#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
329
330struct exception_table_entry
331{
332 unsigned long insn, fixup;
333};
334
335#endif /* __ASM_AVR32_UACCESS_H */
diff --git a/include/asm-avr32/ucontext.h b/include/asm-avr32/ucontext.h
new file mode 100644
index 0000000000..ac7259c2a7
--- /dev/null
+++ b/include/asm-avr32/ucontext.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_AVR32_UCONTEXT_H
2#define __ASM_AVR32_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext * uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask;
10};
11
12#endif /* __ASM_AVR32_UCONTEXT_H */
diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h
new file mode 100644
index 0000000000..3042723fcb
--- /dev/null
+++ b/include/asm-avr32/unaligned.h
@@ -0,0 +1,25 @@
1#ifndef __ASM_AVR32_UNALIGNED_H
2#define __ASM_AVR32_UNALIGNED_H
3
4/*
5 * AVR32 can handle some unaligned accesses, depending on the
6 * implementation. The AVR32 AP implementation can handle unaligned
7 * words, but halfwords must be halfword-aligned, and doublewords must
8 * be word-aligned.
9 *
10 * TODO: Make all this CPU-specific and optimize.
11 */
12
13#include <linux/string.h>
14
15/* Use memmove here, so gcc does not insert a __builtin_memcpy. */
16
17#define get_unaligned(ptr) \
18 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
19
20#define put_unaligned(val, ptr) \
21 ({ __typeof__(*(ptr)) __tmp = (val); \
22 memmove((ptr), &__tmp, sizeof(*(ptr))); \
23 (void)0; })
24
25#endif /* __ASM_AVR32_UNALIGNED_H */
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h
new file mode 100644
index 0000000000..1f528f9269
--- /dev/null
+++ b/include/asm-avr32/unistd.h
@@ -0,0 +1,387 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_UNISTD_H
9#define __ASM_AVR32_UNISTD_H
10
11/*
12 * This file contains the system call numbers.
13 */
14
15#define __NR_restart_syscall 0
16#define __NR_exit 1
17#define __NR_fork 2
18#define __NR_read 3
19#define __NR_write 4
20#define __NR_open 5
21#define __NR_close 6
22#define __NR_umask 7
23#define __NR_creat 8
24#define __NR_link 9
25#define __NR_unlink 10
26#define __NR_execve 11
27#define __NR_chdir 12
28#define __NR_time 13
29#define __NR_mknod 14
30#define __NR_chmod 15
31#define __NR_chown 16
32#define __NR_lchown 17
33#define __NR_lseek 18
34#define __NR__llseek 19
35#define __NR_getpid 20
36#define __NR_mount 21
37#define __NR_umount2 22
38#define __NR_setuid 23
39#define __NR_getuid 24
40#define __NR_stime 25
41#define __NR_ptrace 26
42#define __NR_alarm 27
43#define __NR_pause 28
44#define __NR_utime 29
45#define __NR_stat 30
46#define __NR_fstat 31
47#define __NR_lstat 32
48#define __NR_access 33
49#define __NR_chroot 34
50#define __NR_sync 35
51#define __NR_fsync 36
52#define __NR_kill 37
53#define __NR_rename 38
54#define __NR_mkdir 39
55#define __NR_rmdir 40
56#define __NR_dup 41
57#define __NR_pipe 42
58#define __NR_times 43
59#define __NR_clone 44
60#define __NR_brk 45
61#define __NR_setgid 46
62#define __NR_getgid 47
63#define __NR_getcwd 48
64#define __NR_geteuid 49
65#define __NR_getegid 50
66#define __NR_acct 51
67#define __NR_setfsuid 52
68#define __NR_setfsgid 53
69#define __NR_ioctl 54
70#define __NR_fcntl 55
71#define __NR_setpgid 56
72#define __NR_mremap 57
73#define __NR_setresuid 58
74#define __NR_getresuid 59
75#define __NR_setreuid 60
76#define __NR_setregid 61
77#define __NR_ustat 62
78#define __NR_dup2 63
79#define __NR_getppid 64
80#define __NR_getpgrp 65
81#define __NR_setsid 66
82#define __NR_rt_sigaction 67
83#define __NR_rt_sigreturn 68
84#define __NR_rt_sigprocmask 69
85#define __NR_rt_sigpending 70
86#define __NR_rt_sigtimedwait 71
87#define __NR_rt_sigqueueinfo 72
88#define __NR_rt_sigsuspend 73
89#define __NR_sethostname 74
90#define __NR_setrlimit 75
91#define __NR_getrlimit 76 /* SuS compliant getrlimit */
92#define __NR_getrusage 77
93#define __NR_gettimeofday 78
94#define __NR_settimeofday 79
95#define __NR_getgroups 80
96#define __NR_setgroups 81
97#define __NR_select 82
98#define __NR_symlink 83
99#define __NR_fchdir 84
100#define __NR_readlink 85
101#define __NR_pread 86
102#define __NR_pwrite 87
103#define __NR_swapon 88
104#define __NR_reboot 89
105#define __NR_mmap2 90
106#define __NR_munmap 91
107#define __NR_truncate 92
108#define __NR_ftruncate 93
109#define __NR_fchmod 94
110#define __NR_fchown 95
111#define __NR_getpriority 96
112#define __NR_setpriority 97
113#define __NR_wait4 98
114#define __NR_statfs 99
115#define __NR_fstatfs 100
116#define __NR_vhangup 101
117#define __NR_sigaltstack 102
118#define __NR_syslog 103
119#define __NR_setitimer 104
120#define __NR_getitimer 105
121#define __NR_swapoff 106
122#define __NR_sysinfo 107
123#define __NR_ipc 108
124#define __NR_sendfile 109
125#define __NR_setdomainname 110
126#define __NR_uname 111
127#define __NR_adjtimex 112
128#define __NR_mprotect 113
129#define __NR_vfork 114
130#define __NR_init_module 115
131#define __NR_delete_module 116
132#define __NR_quotactl 117
133#define __NR_getpgid 118
134#define __NR_bdflush 119
135#define __NR_sysfs 120
136#define __NR_personality 121
137#define __NR_afs_syscall 122 /* Syscall for Andrew File System */
138#define __NR_getdents 123
139#define __NR_flock 124
140#define __NR_msync 125
141#define __NR_readv 126
142#define __NR_writev 127
143#define __NR_getsid 128
144#define __NR_fdatasync 129
145#define __NR__sysctl 130
146#define __NR_mlock 131
147#define __NR_munlock 132
148#define __NR_mlockall 133
149#define __NR_munlockall 134
150#define __NR_sched_setparam 135
151#define __NR_sched_getparam 136
152#define __NR_sched_setscheduler 137
153#define __NR_sched_getscheduler 138
154#define __NR_sched_yield 139
155#define __NR_sched_get_priority_max 140
156#define __NR_sched_get_priority_min 141
157#define __NR_sched_rr_get_interval 142
158#define __NR_nanosleep 143
159#define __NR_poll 144
160#define __NR_nfsservctl 145
161#define __NR_setresgid 146
162#define __NR_getresgid 147
163#define __NR_prctl 148
164#define __NR_socket 149
165#define __NR_bind 150
166#define __NR_connect 151
167#define __NR_listen 152
168#define __NR_accept 153
169#define __NR_getsockname 154
170#define __NR_getpeername 155
171#define __NR_socketpair 156
172#define __NR_send 157
173#define __NR_recv 158
174#define __NR_sendto 159
175#define __NR_recvfrom 160
176#define __NR_shutdown 161
177#define __NR_setsockopt 162
178#define __NR_getsockopt 163
179#define __NR_sendmsg 164
180#define __NR_recvmsg 165
181#define __NR_truncate64 166
182#define __NR_ftruncate64 167
183#define __NR_stat64 168
184#define __NR_lstat64 169
185#define __NR_fstat64 170
186#define __NR_pivot_root 171
187#define __NR_mincore 172
188#define __NR_madvise 173
189#define __NR_getdents64 174
190#define __NR_fcntl64 175
191#define __NR_gettid 176
192#define __NR_readahead 177
193#define __NR_setxattr 178
194#define __NR_lsetxattr 179
195#define __NR_fsetxattr 180
196#define __NR_getxattr 181
197#define __NR_lgetxattr 182
198#define __NR_fgetxattr 183
199#define __NR_listxattr 184
200#define __NR_llistxattr 185
201#define __NR_flistxattr 186
202#define __NR_removexattr 187
203#define __NR_lremovexattr 188
204#define __NR_fremovexattr 189
205#define __NR_tkill 190
206#define __NR_sendfile64 191
207#define __NR_futex 192
208#define __NR_sched_setaffinity 193
209#define __NR_sched_getaffinity 194
210#define __NR_capget 195
211#define __NR_capset 196
212#define __NR_io_setup 197
213#define __NR_io_destroy 198
214#define __NR_io_getevents 199
215#define __NR_io_submit 200
216#define __NR_io_cancel 201
217#define __NR_fadvise64 202
218#define __NR_exit_group 203
219#define __NR_lookup_dcookie 204
220#define __NR_epoll_create 205
221#define __NR_epoll_ctl 206
222#define __NR_epoll_wait 207
223#define __NR_remap_file_pages 208
224#define __NR_set_tid_address 209
225
226#define __NR_timer_create 210
227#define __NR_timer_settime 211
228#define __NR_timer_gettime 212
229#define __NR_timer_getoverrun 213
230#define __NR_timer_delete 214
231#define __NR_clock_settime 215
232#define __NR_clock_gettime 216
233#define __NR_clock_getres 217
234#define __NR_clock_nanosleep 218
235#define __NR_statfs64 219
236#define __NR_fstatfs64 220
237#define __NR_tgkill 221
238 /* 222 reserved for tux */
239#define __NR_utimes 223
240#define __NR_fadvise64_64 224
241
242#define __NR_cacheflush 225
243
244#define __NR_vserver 226
245#define __NR_mq_open 227
246#define __NR_mq_unlink 228
247#define __NR_mq_timedsend 229
248#define __NR_mq_timedreceive 230
249#define __NR_mq_notify 231
250#define __NR_mq_getsetattr 232
251#define __NR_kexec_load 233
252#define __NR_waitid 234
253#define __NR_add_key 235
254#define __NR_request_key 236
255#define __NR_keyctl 237
256#define __NR_ioprio_set 238
257#define __NR_ioprio_get 239
258#define __NR_inotify_init 240
259#define __NR_inotify_add_watch 241
260#define __NR_inotify_rm_watch 242
261#define __NR_openat 243
262#define __NR_mkdirat 244
263#define __NR_mknodat 245
264#define __NR_fchownat 246
265#define __NR_futimesat 247
266#define __NR_fstatat64 248
267#define __NR_unlinkat 249
268#define __NR_renameat 250
269#define __NR_linkat 251
270#define __NR_symlinkat 252
271#define __NR_readlinkat 253
272#define __NR_fchmodat 254
273#define __NR_faccessat 255
274#define __NR_pselect6 256
275#define __NR_ppoll 257
276#define __NR_unshare 258
277#define __NR_set_robust_list 259
278#define __NR_get_robust_list 260
279#define __NR_splice 261
280#define __NR_sync_file_range 262
281#define __NR_tee 263
282#define __NR_vmsplice 264
283
284#define NR_syscalls 265
285
286
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
309#define __ARCH_WANT_STAT64
310#define __ARCH_WANT_SYS_ALARM
311#define __ARCH_WANT_SYS_GETHOSTNAME
312#define __ARCH_WANT_SYS_PAUSE
313#define __ARCH_WANT_SYS_TIME
314#define __ARCH_WANT_SYS_UTIME
315#define __ARCH_WANT_SYS_WAITPID
316#define __ARCH_WANT_SYS_FADVISE64
317#define __ARCH_WANT_SYS_GETPGRP
318#define __ARCH_WANT_SYS_LLSEEK
319#define __ARCH_WANT_SYS_GETPGRP
320#define __ARCH_WANT_SYS_RT_SIGACTION
321#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
379/*
380 * "Conditional" syscalls
381 *
382 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
383 * but it doesn't work on all toolchains, so we just do it by hand
384 */
385#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
386
387#endif /* __ASM_AVR32_UNISTD_H */
diff --git a/include/asm-avr32/user.h b/include/asm-avr32/user.h
new file mode 100644
index 0000000000..060fb3acee
--- /dev/null
+++ b/include/asm-avr32/user.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Note: We may not need these definitions for AVR32, as we don't
9 * support a.out.
10 */
11#ifndef __ASM_AVR32_USER_H
12#define __ASM_AVR32_USER_H
13
14#include <linux/types.h>
15#include <asm/ptrace.h>
16#include <asm/page.h>
17
18/*
19 * Core file format: The core file is written in such a way that gdb
20 * can understand it and provide useful information to the user (under
21 * linux we use the `trad-core' bfd). The file contents are as follows:
22 *
23 * upage: 1 page consisting of a user struct that tells gdb
24 * what is present in the file. Directly after this is a
25 * copy of the task_struct, which is currently not used by gdb,
26 * but it may come in handy at some point. All of the registers
27 * are stored as part of the upage. The upage should always be
28 * only one page long.
29 * data: The data segment follows next. We use current->end_text to
30 * current->brk to pick up all of the user variables, plus any memory
31 * that may have been sbrk'ed. No attempt is made to determine if a
32 * page is demand-zero or if a page is totally unused, we just cover
33 * the entire range. All of the addresses are rounded in such a way
34 * that an integral number of pages is written.
35 * stack: We need the stack information in order to get a meaningful
36 * backtrace. We need to write the data from usp to
37 * current->start_stack, so we round each of these in order to be able
38 * to write an integer number of pages.
39 */
40
41struct user_fpu_struct {
42 /* We have no FPU (yet) */
43};
44
45struct user {
46 struct pt_regs regs; /* entire machine state */
47 size_t u_tsize; /* text size (pages) */
48 size_t u_dsize; /* data size (pages) */
49 size_t u_ssize; /* stack size (pages) */
50 unsigned long start_code; /* text starting address */
51 unsigned long start_data; /* data starting address */
52 unsigned long start_stack; /* stack starting address */
53 long int signal; /* signal causing core dump */
54 struct regs * u_ar0; /* help gdb find registers */
55 unsigned long magic; /* identifies a core file */
56 char u_comm[32]; /* user command name */
57};
58
59#define NBPG PAGE_SIZE
60#define UPAGES 1
61#define HOST_TEXT_START_ADDR (u.start_code)
62#define HOST_DATA_START_ADDR (u.start_data)
63#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
64
65#endif /* __ASM_AVR32_USER_H */
diff --git a/include/asm-cris/Kbuild b/include/asm-cris/Kbuild
new file mode 100644
index 0000000000..14498d5a2f
--- /dev/null
+++ b/include/asm-cris/Kbuild
@@ -0,0 +1,5 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += arch-v10/ arch-v32/
4
5unifdef-y += rs485.h
diff --git a/include/asm-cris/arch-v10/Kbuild b/include/asm-cris/arch-v10/Kbuild
new file mode 100644
index 0000000000..d7f27dc094
--- /dev/null
+++ b/include/asm-cris/arch-v10/Kbuild
@@ -0,0 +1,2 @@
1header-y += ptrace.h
2header-y += user.h
diff --git a/include/asm-cris/arch-v10/irq.h b/include/asm-cris/arch-v10/irq.h
index 4fa8945b02..b1128a9984 100644
--- a/include/asm-cris/arch-v10/irq.h
+++ b/include/asm-cris/arch-v10/irq.h
@@ -141,7 +141,7 @@ __asm__ ( \
141 * it here, we would not get the multiple_irq at all. 141 * it here, we would not get the multiple_irq at all.
142 * 142 *
143 * The non-blocking here is based on the knowledge that the timer interrupt is 143 * The non-blocking here is based on the knowledge that the timer interrupt is
144 * registred as a fast interrupt (SA_INTERRUPT) so that we _know_ there will not 144 * registred as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not
145 * be an sti() before the timer irq handler is run to acknowledge the interrupt. 145 * be an sti() before the timer irq handler is run to acknowledge the interrupt.
146 */ 146 */
147 147
diff --git a/include/asm-cris/arch-v32/Kbuild b/include/asm-cris/arch-v32/Kbuild
new file mode 100644
index 0000000000..d7f27dc094
--- /dev/null
+++ b/include/asm-cris/arch-v32/Kbuild
@@ -0,0 +1,2 @@
1header-y += ptrace.h
2header-y += user.h
diff --git a/include/asm-cris/arch-v32/arbiter.h b/include/asm-cris/arch-v32/arbiter.h
index dba3c285ca..081a911d7a 100644
--- a/include/asm-cris/arch-v32/arbiter.h
+++ b/include/asm-cris/arch-v32/arbiter.h
@@ -20,8 +20,8 @@ enum
20 arbiter_all_accesses = 0xff 20 arbiter_all_accesses = 0xff
21}; 21};
22 22
23int crisv32_arbiter_allocate_bandwith(int client, int region, 23int crisv32_arbiter_allocate_bandwidth(int client, int region,
24 unsigned long bandwidth); 24 unsigned long bandwidth);
25int crisv32_arbiter_watch(unsigned long start, unsigned long size, 25int crisv32_arbiter_watch(unsigned long start, unsigned long size,
26 unsigned long clients, unsigned long accesses, 26 unsigned long clients, unsigned long accesses,
27 watch_callback* cb); 27 watch_callback* cb);
diff --git a/include/asm-cris/arch-v32/irq.h b/include/asm-cris/arch-v32/irq.h
index eeb0a80262..bac94ee6bc 100644
--- a/include/asm-cris/arch-v32/irq.h
+++ b/include/asm-cris/arch-v32/irq.h
@@ -98,7 +98,7 @@ __asm__ ( \
98 * if we had BLOCK'edit here, we would not get the multiple_irq at all. 98 * if we had BLOCK'edit here, we would not get the multiple_irq at all.
99 * 99 *
100 * The non-blocking here is based on the knowledge that the timer interrupt is 100 * The non-blocking here is based on the knowledge that the timer interrupt is
101 * registred as a fast interrupt (SA_INTERRUPT) so that we _know_ there will not 101 * registred as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not
102 * be an sti() before the timer irq handler is run to acknowledge the interrupt. 102 * be an sti() before the timer irq handler is run to acknowledge the interrupt.
103 */ 103 */
104#define BUILD_TIMER_IRQ(nr, mask) \ 104#define BUILD_TIMER_IRQ(nr, mask) \
diff --git a/include/asm-cris/byteorder.h b/include/asm-cris/byteorder.h
index a1a222adaa..0cd9db1cc8 100644
--- a/include/asm-cris/byteorder.h
+++ b/include/asm-cris/byteorder.h
@@ -3,14 +3,15 @@
3 3
4#ifdef __GNUC__ 4#ifdef __GNUC__
5 5
6#ifdef __KERNEL__
6#include <asm/arch/byteorder.h> 7#include <asm/arch/byteorder.h>
7 8
8/* defines are necessary because the other files detect the presence 9/* defines are necessary because the other files detect the presence
9 * of a defined __arch_swab32, not an inline 10 * of a defined __arch_swab32, not an inline
10 */ 11 */
11
12#define __arch__swab32(x) ___arch__swab32(x) 12#define __arch__swab32(x) ___arch__swab32(x)
13#define __arch__swab16(x) ___arch__swab16(x) 13#define __arch__swab16(x) ___arch__swab16(x)
14#endif /* __KERNEL__ */
14 15
15#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 16#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
16# define __BYTEORDER_HAS_U64__ 17# define __BYTEORDER_HAS_U64__
diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h
index 87a60bd8e6..96a40c1de5 100644
--- a/include/asm-cris/elf.h
+++ b/include/asm-cris/elf.h
@@ -5,7 +5,6 @@
5 * ELF register definitions.. 5 * ELF register definitions..
6 */ 6 */
7 7
8#include <asm/arch/elf.h>
9#include <asm/user.h> 8#include <asm/user.h>
10 9
11#define R_CRIS_NONE 0 10#define R_CRIS_NONE 0
@@ -46,6 +45,9 @@ typedef unsigned long elf_fpregset_t;
46#define ELF_DATA ELFDATA2LSB 45#define ELF_DATA ELFDATA2LSB
47#define ELF_ARCH EM_CRIS 46#define ELF_ARCH EM_CRIS
48 47
48#ifdef __KERNEL__
49#include <asm/arch/elf.h>
50
49/* The master for these definitions is {binutils}/include/elf/cris.h: */ 51/* The master for these definitions is {binutils}/include/elf/cris.h: */
50/* User symbols in this file have a leading underscore. */ 52/* User symbols in this file have a leading underscore. */
51#define EF_CRIS_UNDERSCORE 0x00000001 53#define EF_CRIS_UNDERSCORE 0x00000001
@@ -87,8 +89,8 @@ typedef unsigned long elf_fpregset_t;
87 89
88#define ELF_PLATFORM (NULL) 90#define ELF_PLATFORM (NULL)
89 91
90#ifdef __KERNEL__
91#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 92#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
92#endif 93
94#endif /* __KERNEL__ */
93 95
94#endif 96#endif
diff --git a/include/asm-cris/hw_irq.h b/include/asm-cris/hw_irq.h
index 341536a234..298066020a 100644
--- a/include/asm-cris/hw_irq.h
+++ b/include/asm-cris/hw_irq.h
@@ -1,7 +1,5 @@
1#ifndef _ASM_HW_IRQ_H 1#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H 2#define _ASM_HW_IRQ_H
3 3
4static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
5
6#endif 4#endif
7 5
diff --git a/include/asm-cris/irq.h b/include/asm-cris/irq.h
index 4b33879221..998cce9f32 100644
--- a/include/asm-cris/irq.h
+++ b/include/asm-cris/irq.h
@@ -1,11 +1,6 @@
1#ifndef _ASM_IRQ_H 1#ifndef _ASM_IRQ_H
2#define _ASM_IRQ_H 2#define _ASM_IRQ_H
3 3
4/*
5 * IRQ line status macro IRQ_PER_CPU is used
6 */
7#define ARCH_HAS_IRQ_PER_CPU
8
9#include <asm/arch/irq.h> 4#include <asm/arch/irq.h>
10 5
11static inline int irq_canonicalize(int irq) 6static inline int irq_canonicalize(int irq)
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index 81832e9e15..9f13c32552 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -1,6 +1,8 @@
1#ifndef _CRIS_PAGE_H 1#ifndef _CRIS_PAGE_H
2#define _CRIS_PAGE_H 2#define _CRIS_PAGE_H
3 3
4#ifdef __KERNEL__
5
4#include <asm/arch/page.h> 6#include <asm/arch/page.h>
5 7
6/* PAGE_SHIFT determines the page size */ 8/* PAGE_SHIFT determines the page size */
@@ -12,8 +14,6 @@
12#endif 14#endif
13#define PAGE_MASK (~(PAGE_SIZE-1)) 15#define PAGE_MASK (~(PAGE_SIZE-1))
14 16
15#ifdef __KERNEL__
16
17#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 17#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
18#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) 18#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
19 19
@@ -73,10 +73,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
73#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 73#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
74 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 74 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
75 75
76#endif /* __KERNEL__ */
77
78#include <asm-generic/memory_model.h> 76#include <asm-generic/memory_model.h>
79#include <asm-generic/page.h> 77#include <asm-generic/page.h>
80 78
79#endif /* __KERNEL__ */
80
81#endif /* _CRIS_PAGE_H */ 81#endif /* _CRIS_PAGE_H */
82 82
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
index 5d76c1c0d6..c94a710701 100644
--- a/include/asm-cris/pgtable.h
+++ b/include/asm-cris/pgtable.h
@@ -253,7 +253,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
253{ pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } 253{ pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; }
254 254
255#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 255#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
256#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 256#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
257 257
258/* to find an entry in a page-table-directory. */ 258/* to find an entry in a page-table-directory. */
259#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 259#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
@@ -271,7 +271,7 @@ static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
271#define __pte_offset(address) \ 271#define __pte_offset(address) \
272 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 272 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
273#define pte_offset_kernel(dir, address) \ 273#define pte_offset_kernel(dir, address) \
274 ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) 274 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
275#define pte_offset_map(dir, address) \ 275#define pte_offset_map(dir, address) \
276 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 276 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
277#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) 277#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
diff --git a/include/asm-cris/posix_types.h b/include/asm-cris/posix_types.h
index 6d26fee4a6..7b9ed22ab5 100644
--- a/include/asm-cris/posix_types.h
+++ b/include/asm-cris/posix_types.h
@@ -6,8 +6,6 @@
6#ifndef __ARCH_CRIS_POSIX_TYPES_H 6#ifndef __ARCH_CRIS_POSIX_TYPES_H
7#define __ARCH_CRIS_POSIX_TYPES_H 7#define __ARCH_CRIS_POSIX_TYPES_H
8 8
9#include <asm/bitops.h>
10
11/* 9/*
12 * This file is generally used by user-level software, so you need to 10 * This file is generally used by user-level software, so you need to
13 * be a little careful about namespace pollution etc. Also, we cannot 11 * be a little careful about namespace pollution etc. Also, we cannot
@@ -53,9 +51,8 @@ typedef struct {
53#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ 51#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
54} __kernel_fsid_t; 52} __kernel_fsid_t;
55 53
56/* should this ifdef be here ? */ 54#ifdef __KERNEL__
57 55#include <asm/bitops.h>
58#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
59 56
60#undef __FD_SET 57#undef __FD_SET
61#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) 58#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp))
@@ -69,6 +66,6 @@ typedef struct {
69#undef __FD_ZERO 66#undef __FD_ZERO
70#define __FD_ZERO(fdsetp) memset((void *)(fdsetp), 0, __FDSET_LONGS << 2) 67#define __FD_ZERO(fdsetp) memset((void *)(fdsetp), 0, __FDSET_LONGS << 2)
71 68
72#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ 69#endif /* __KERNEL__ */
73 70
74#endif /* __ARCH_CRIS_POSIX_TYPES_H */ 71#endif /* __ARCH_CRIS_POSIX_TYPES_H */
diff --git a/include/asm-cris/signal.h b/include/asm-cris/signal.h
index dfe039593a..349ae682b5 100644
--- a/include/asm-cris/signal.h
+++ b/include/asm-cris/signal.h
@@ -74,7 +74,6 @@ typedef unsigned long sigset_t;
74 * SA_FLAGS values: 74 * SA_FLAGS values:
75 * 75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used. 76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago) 77 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered. 79 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -95,7 +94,6 @@ typedef unsigned long sigset_t;
95 94
96#define SA_NOMASK SA_NODEFER 95#define SA_NOMASK SA_NODEFER
97#define SA_ONESHOT SA_RESETHAND 96#define SA_ONESHOT SA_RESETHAND
98#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
99 97
100#define SA_RESTORER 0x04000000 98#define SA_RESTORER 0x04000000
101 99
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 8b1da3e58c..01cfdf1d6d 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -50,6 +50,7 @@
50#define SO_ACCEPTCONN 30 50#define SO_ACCEPTCONN 30
51 51
52#define SO_PEERSEC 31 52#define SO_PEERSEC 31
53#define SO_PASSSEC 34
53 54
54#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
55 56
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h
index b1c593b6db..b869f6161a 100644
--- a/include/asm-cris/system.h
+++ b/include/asm-cris/system.h
@@ -17,7 +17,6 @@ extern struct task_struct *resume(struct task_struct *prev, struct task_struct *
17#define wmb() mb() 17#define wmb() mb()
18#define read_barrier_depends() do { } while(0) 18#define read_barrier_depends() do { } while(0)
19#define set_mb(var, value) do { var = value; mb(); } while (0) 19#define set_mb(var, value) do { var = value; mb(); } while (0)
20#define set_wmb(var, value) do { var = value; wmb(); } while (0)
21 20
22#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
23#define smp_mb() mb() 22#define smp_mb() mb()
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index c2954e90aa..7372efae05 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_CRIS_UNISTD_H_ 1#ifndef _ASM_CRIS_UNISTD_H_
2#define _ASM_CRIS_UNISTD_H_ 2#define _ASM_CRIS_UNISTD_H_
3 3
4#include <asm/arch/unistd.h>
5
6/* 4/*
7 * This file contains the system call numbers, and stub macros for libc. 5 * This file contains the system call numbers, and stub macros for libc.
8 */ 6 */
@@ -299,6 +297,7 @@
299 297
300#define NR_syscalls 289 298#define NR_syscalls 289
301 299
300#include <asm/arch/unistd.h>
302 301
303#define __ARCH_WANT_IPC_PARSE_VERSION 302#define __ARCH_WANT_IPC_PARSE_VERSION
304#define __ARCH_WANT_OLD_READDIR 303#define __ARCH_WANT_OLD_READDIR
@@ -322,7 +321,6 @@
322#define __ARCH_WANT_SYS_SIGPENDING 321#define __ARCH_WANT_SYS_SIGPENDING
323#define __ARCH_WANT_SYS_SIGPROCMASK 322#define __ARCH_WANT_SYS_SIGPROCMASK
324#define __ARCH_WANT_SYS_RT_SIGACTION 323#define __ARCH_WANT_SYS_RT_SIGACTION
325#endif
326 324
327#ifdef __KERNEL_SYSCALLS__ 325#ifdef __KERNEL_SYSCALLS__
328 326
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-frv/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index 980ae1b0cd..1f70d47148 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -157,23 +157,105 @@ static inline int __test_bit(int nr, const volatile void * addr)
157 __constant_test_bit((nr),(addr)) : \ 157 __constant_test_bit((nr),(addr)) : \
158 __test_bit((nr),(addr))) 158 __test_bit((nr),(addr)))
159 159
160#include <asm-generic/bitops/ffs.h>
161#include <asm-generic/bitops/__ffs.h>
162#include <asm-generic/bitops/find.h> 160#include <asm-generic/bitops/find.h>
163 161
164/* 162/**
165 * fls: find last bit set. 163 * fls - find last bit set
164 * @x: the word to search
165 *
166 * This is defined the same way as ffs:
167 * - return 32..1 to indicate bit 31..0 most significant bit set
168 * - return 0 to indicate no bits set
166 */ 169 */
167#define fls(x) \ 170#define fls(x) \
168({ \ 171({ \
169 int bit; \ 172 int bit; \
170 \ 173 \
171 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x)); \ 174 asm(" subcc %1,gr0,gr0,icc0 \n" \
175 " ckne icc0,cc4 \n" \
176 " cscan.p %1,gr0,%0 ,cc4,#1 \n" \
177 " csub %0,%0,%0 ,cc4,#0 \n" \
178 " csub %2,%0,%0 ,cc4,#1 \n" \
179 : "=&r"(bit) \
180 : "r"(x), "r"(32) \
181 : "icc0", "cc4" \
182 ); \
172 \ 183 \
173 bit ? 33 - bit : bit; \ 184 bit; \
174}) 185})
175 186
176#include <asm-generic/bitops/fls64.h> 187/**
188 * fls64 - find last bit set in a 64-bit value
189 * @n: the value to search
190 *
191 * This is defined the same way as ffs:
192 * - return 64..1 to indicate bit 63..0 most significant bit set
193 * - return 0 to indicate no bits set
194 */
195static inline __attribute__((const))
196int fls64(u64 n)
197{
198 union {
199 u64 ll;
200 struct { u32 h, l; };
201 } _;
202 int bit, x, y;
203
204 _.ll = n;
205
206 asm(" subcc.p %3,gr0,gr0,icc0 \n"
207 " subcc %4,gr0,gr0,icc1 \n"
208 " ckne icc0,cc4 \n"
209 " ckne icc1,cc5 \n"
210 " norcr cc4,cc5,cc6 \n"
211 " csub.p %0,%0,%0 ,cc6,1 \n"
212 " orcr cc5,cc4,cc4 \n"
213 " andcr cc4,cc5,cc4 \n"
214 " cscan.p %3,gr0,%0 ,cc4,0 \n"
215 " setlos #64,%1 \n"
216 " cscan.p %4,gr0,%0 ,cc4,1 \n"
217 " setlos #32,%2 \n"
218 " csub.p %1,%0,%0 ,cc4,0 \n"
219 " csub %2,%0,%0 ,cc4,1 \n"
220 : "=&r"(bit), "=r"(x), "=r"(y)
221 : "0r"(_.h), "r"(_.l)
222 : "icc0", "icc1", "cc4", "cc5", "cc6"
223 );
224 return bit;
225
226}
227
228/**
229 * ffs - find first bit set
230 * @x: the word to search
231 *
232 * - return 32..1 to indicate bit 31..0 most least significant bit set
233 * - return 0 to indicate no bits set
234 */
235static inline __attribute__((const))
236int ffs(int x)
237{
238 /* Note: (x & -x) gives us a mask that is the least significant
239 * (rightmost) 1-bit of the value in x.
240 */
241 return fls(x & -x);
242}
243
244/**
245 * __ffs - find first bit set
246 * @x: the word to search
247 *
248 * - return 31..0 to indicate bit 31..0 most least significant bit set
249 * - if no bits are set in x, the result is undefined
250 */
251static inline __attribute__((const))
252int __ffs(unsigned long x)
253{
254 int bit;
255 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x & -x));
256 return 31 - bit;
257}
258
177#include <asm-generic/bitops/sched.h> 259#include <asm-generic/bitops/sched.h>
178#include <asm-generic/bitops/hweight.h> 260#include <asm-generic/bitops/hweight.h>
179 261
diff --git a/include/asm-frv/cpu-irqs.h b/include/asm-frv/cpu-irqs.h
index 5cd691e1f8..478f3498fc 100644
--- a/include/asm-frv/cpu-irqs.h
+++ b/include/asm-frv/cpu-irqs.h
@@ -14,36 +14,6 @@
14 14
15#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
16 16
17#include <asm/irq-routing.h>
18
19#define IRQ_BASE_CPU (NR_IRQ_ACTIONS_PER_GROUP * 0)
20
21/* IRQ IDs presented to drivers */
22enum {
23 IRQ_CPU__UNUSED = IRQ_BASE_CPU,
24 IRQ_CPU_UART0,
25 IRQ_CPU_UART1,
26 IRQ_CPU_TIMER0,
27 IRQ_CPU_TIMER1,
28 IRQ_CPU_TIMER2,
29 IRQ_CPU_DMA0,
30 IRQ_CPU_DMA1,
31 IRQ_CPU_DMA2,
32 IRQ_CPU_DMA3,
33 IRQ_CPU_DMA4,
34 IRQ_CPU_DMA5,
35 IRQ_CPU_DMA6,
36 IRQ_CPU_DMA7,
37 IRQ_CPU_EXTERNAL0,
38 IRQ_CPU_EXTERNAL1,
39 IRQ_CPU_EXTERNAL2,
40 IRQ_CPU_EXTERNAL3,
41 IRQ_CPU_EXTERNAL4,
42 IRQ_CPU_EXTERNAL5,
43 IRQ_CPU_EXTERNAL6,
44 IRQ_CPU_EXTERNAL7,
45};
46
47/* IRQ to level mappings */ 17/* IRQ to level mappings */
48#define IRQ_GDBSTUB_LEVEL 15 18#define IRQ_GDBSTUB_LEVEL 15
49#define IRQ_UART_LEVEL 13 19#define IRQ_UART_LEVEL 13
@@ -82,6 +52,30 @@ enum {
82#define IRQ_XIRQ6_LEVEL 7 52#define IRQ_XIRQ6_LEVEL 7
83#define IRQ_XIRQ7_LEVEL 8 53#define IRQ_XIRQ7_LEVEL 8
84 54
55/* IRQ IDs presented to drivers */
56#define IRQ_CPU__UNUSED IRQ_BASE_CPU
57#define IRQ_CPU_UART0 (IRQ_BASE_CPU + IRQ_UART0_LEVEL)
58#define IRQ_CPU_UART1 (IRQ_BASE_CPU + IRQ_UART1_LEVEL)
59#define IRQ_CPU_TIMER0 (IRQ_BASE_CPU + IRQ_TIMER0_LEVEL)
60#define IRQ_CPU_TIMER1 (IRQ_BASE_CPU + IRQ_TIMER1_LEVEL)
61#define IRQ_CPU_TIMER2 (IRQ_BASE_CPU + IRQ_TIMER2_LEVEL)
62#define IRQ_CPU_DMA0 (IRQ_BASE_CPU + IRQ_DMA0_LEVEL)
63#define IRQ_CPU_DMA1 (IRQ_BASE_CPU + IRQ_DMA1_LEVEL)
64#define IRQ_CPU_DMA2 (IRQ_BASE_CPU + IRQ_DMA2_LEVEL)
65#define IRQ_CPU_DMA3 (IRQ_BASE_CPU + IRQ_DMA3_LEVEL)
66#define IRQ_CPU_DMA4 (IRQ_BASE_CPU + IRQ_DMA4_LEVEL)
67#define IRQ_CPU_DMA5 (IRQ_BASE_CPU + IRQ_DMA5_LEVEL)
68#define IRQ_CPU_DMA6 (IRQ_BASE_CPU + IRQ_DMA6_LEVEL)
69#define IRQ_CPU_DMA7 (IRQ_BASE_CPU + IRQ_DMA7_LEVEL)
70#define IRQ_CPU_EXTERNAL0 (IRQ_BASE_CPU + IRQ_XIRQ0_LEVEL)
71#define IRQ_CPU_EXTERNAL1 (IRQ_BASE_CPU + IRQ_XIRQ1_LEVEL)
72#define IRQ_CPU_EXTERNAL2 (IRQ_BASE_CPU + IRQ_XIRQ2_LEVEL)
73#define IRQ_CPU_EXTERNAL3 (IRQ_BASE_CPU + IRQ_XIRQ3_LEVEL)
74#define IRQ_CPU_EXTERNAL4 (IRQ_BASE_CPU + IRQ_XIRQ4_LEVEL)
75#define IRQ_CPU_EXTERNAL5 (IRQ_BASE_CPU + IRQ_XIRQ5_LEVEL)
76#define IRQ_CPU_EXTERNAL6 (IRQ_BASE_CPU + IRQ_XIRQ6_LEVEL)
77#define IRQ_CPU_EXTERNAL7 (IRQ_BASE_CPU + IRQ_XIRQ7_LEVEL)
78
85#endif /* !__ASSEMBLY__ */ 79#endif /* !__ASSEMBLY__ */
86 80
87#endif /* _ASM_CPU_IRQS_H */ 81#endif /* _ASM_CPU_IRQS_H */
diff --git a/include/asm-frv/elf.h b/include/asm-frv/elf.h
index 38656da00e..7df58a3e6e 100644
--- a/include/asm-frv/elf.h
+++ b/include/asm-frv/elf.h
@@ -64,7 +64,7 @@ typedef unsigned long elf_greg_t;
64#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t)) 64#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
65typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 65typedef elf_greg_t elf_gregset_t[ELF_NGREG];
66 66
67typedef struct fpmedia_struct elf_fpregset_t; 67typedef struct user_fpmedia_regs elf_fpregset_t;
68 68
69/* 69/*
70 * This is used to ensure we don't load something for the wrong architecture. 70 * This is used to ensure we don't load something for the wrong architecture.
@@ -116,6 +116,7 @@ do { \
116} while(0) 116} while(0)
117 117
118#define USE_ELF_CORE_DUMP 118#define USE_ELF_CORE_DUMP
119#define ELF_FDPIC_CORE_EFLAGS EF_FRV_FDPIC
119#define ELF_EXEC_PAGESIZE 16384 120#define ELF_EXEC_PAGESIZE 16384
120 121
121/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 122/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
@@ -125,9 +126,6 @@ do { \
125 126
126#define ELF_ET_DYN_BASE 0x08000000UL 127#define ELF_ET_DYN_BASE 0x08000000UL
127 128
128#define ELF_CORE_COPY_REGS(pr_reg, regs) \
129 memcpy(&pr_reg[0], &regs->sp, 31 * sizeof(uint32_t));
130
131/* This yields a mask that user programs can use to figure out what 129/* This yields a mask that user programs can use to figure out what
132 instruction set this cpu supports. */ 130 instruction set this cpu supports. */
133 131
diff --git a/include/asm-frv/gdb-stub.h b/include/asm-frv/gdb-stub.h
index c58479a4be..24f9738670 100644
--- a/include/asm-frv/gdb-stub.h
+++ b/include/asm-frv/gdb-stub.h
@@ -89,6 +89,7 @@ extern void gdbstub_do_rx(void);
89 89
90extern asmlinkage void __debug_stub_init_break(void); 90extern asmlinkage void __debug_stub_init_break(void);
91extern asmlinkage void __break_hijack_kernel_event(void); 91extern asmlinkage void __break_hijack_kernel_event(void);
92extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
92extern asmlinkage void start_kernel(void); 93extern asmlinkage void start_kernel(void);
93 94
94extern asmlinkage void gdbstub_rx_handler(void); 95extern asmlinkage void gdbstub_rx_handler(void);
@@ -114,5 +115,26 @@ extern void console_set_baud(unsigned baud);
114#define gdbstub_proto(FMT,...) ({ 0; }) 115#define gdbstub_proto(FMT,...) ({ 0; })
115#endif 116#endif
116 117
118/*
119 * we dedicate GR31 to keeping a pointer to the gdbstub exception frame
120 * - gr31 is destroyed on entry to the gdbstub if !MMU
121 * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU
122 */
123register struct frv_frame0 *__debug_frame0 asm("gr31");
124
125#define __debug_frame (&__debug_frame0->regs)
126#define __debug_user_context (&__debug_frame0->uc)
127#define __debug_regs (&__debug_frame0->debug)
128#define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X)))
129
130struct frv_debug_status {
131 unsigned long bpsr;
132 unsigned long dcr;
133 unsigned long brr;
134 unsigned long nmar;
135};
136
137extern struct frv_debug_status __debug_status;
138
117#endif /* _LANGUAGE_ASSEMBLY */ 139#endif /* _LANGUAGE_ASSEMBLY */
118#endif /* __ASM_GDB_STUB_H */ 140#endif /* __ASM_GDB_STUB_H */
diff --git a/include/asm-frv/hardirq.h b/include/asm-frv/hardirq.h
index 7581b5a755..fc47515822 100644
--- a/include/asm-frv/hardirq.h
+++ b/include/asm-frv/hardirq.h
@@ -26,5 +26,10 @@ typedef struct {
26#error SMP not available on FR-V 26#error SMP not available on FR-V
27#endif /* CONFIG_SMP */ 27#endif /* CONFIG_SMP */
28 28
29extern atomic_t irq_err_count;
30static inline void ack_bad_irq(int irq)
31{
32 atomic_inc(&irq_err_count);
33}
29 34
30#endif 35#endif
diff --git a/include/asm-frv/irq-routing.h b/include/asm-frv/irq-routing.h
deleted file mode 100644
index 686fb2b39d..0000000000
--- a/include/asm-frv/irq-routing.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/* irq-routing.h: multiplexed IRQ routing
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_IRQ_ROUTING_H
13#define _ASM_IRQ_ROUTING_H
14
15#ifndef __ASSEMBLY__
16
17#include <linux/spinlock.h>
18#include <asm/irq.h>
19
20struct irq_source;
21struct irq_level;
22
23/*
24 * IRQ action distribution sets
25 */
26struct irq_group {
27 int first_irq; /* first IRQ distributed here */
28 void (*control)(struct irq_group *group, int index, int on);
29
30 struct irqaction *actions[NR_IRQ_ACTIONS_PER_GROUP]; /* IRQ action chains */
31 struct irq_source *sources[NR_IRQ_ACTIONS_PER_GROUP]; /* IRQ sources */
32 int disable_cnt[NR_IRQ_ACTIONS_PER_GROUP]; /* disable counts */
33};
34
35/*
36 * IRQ source manager
37 */
38struct irq_source {
39 struct irq_source *next;
40 struct irq_level *level;
41 const char *muxname;
42 volatile void __iomem *muxdata;
43 unsigned long irqmask;
44
45 void (*doirq)(struct irq_source *source);
46};
47
48/*
49 * IRQ level management (per CPU IRQ priority / entry vector)
50 */
51struct irq_level {
52 int usage;
53 int disable_count;
54 unsigned long flags; /* current SA_INTERRUPT and SA_SHIRQ settings */
55 spinlock_t lock;
56 struct irq_source *sources;
57};
58
59extern struct irq_level frv_irq_levels[16];
60extern struct irq_group *irq_groups[NR_IRQ_GROUPS];
61
62extern void frv_irq_route(struct irq_source *source, int irqlevel);
63extern void frv_irq_route_external(struct irq_source *source, int irq);
64extern void frv_irq_set_group(struct irq_group *group);
65extern void distribute_irqs(struct irq_group *group, unsigned long irqmask);
66extern void route_cpu_irqs(void);
67
68#endif /* !__ASSEMBLY__ */
69
70#endif /* _ASM_IRQ_ROUTING_H */
diff --git a/include/asm-frv/irq.h b/include/asm-frv/irq.h
index 58b619215a..8fefd6b827 100644
--- a/include/asm-frv/irq.h
+++ b/include/asm-frv/irq.h
@@ -1,6 +1,6 @@
1/* irq.h: FRV IRQ definitions 1/* irq.h: FRV IRQ definitions
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -12,32 +12,22 @@
12#ifndef _ASM_IRQ_H_ 12#ifndef _ASM_IRQ_H_
13#define _ASM_IRQ_H_ 13#define _ASM_IRQ_H_
14 14
15
16/*
17 * the system has an on-CPU PIC and another PIC on the FPGA and other PICs on other peripherals,
18 * so we do some routing in irq-routing.[ch] to reduce the number of false-positives seen by
19 * drivers
20 */
21
22/* this number is used when no interrupt has been assigned */ 15/* this number is used when no interrupt has been assigned */
23#define NO_IRQ (-1) 16#define NO_IRQ (-1)
24 17
25#define NR_IRQ_LOG2_ACTIONS_PER_GROUP 5 18#define NR_IRQS 48
26#define NR_IRQ_ACTIONS_PER_GROUP (1 << NR_IRQ_LOG2_ACTIONS_PER_GROUP) 19#define IRQ_BASE_CPU (0 * 16)
27#define NR_IRQ_GROUPS 4 20#define IRQ_BASE_FPGA (1 * 16)
28#define NR_IRQS (NR_IRQ_ACTIONS_PER_GROUP * NR_IRQ_GROUPS) 21#define IRQ_BASE_MB93493 (2 * 16)
29 22
30/* probe returns a 32-bit IRQ mask:-/ */ 23/* probe returns a 32-bit IRQ mask:-/ */
31#define MIN_PROBE_IRQ (NR_IRQS - 32) 24#define MIN_PROBE_IRQ (NR_IRQS - 32)
32 25
26#ifndef __ASSEMBLY__
33static inline int irq_canonicalize(int irq) 27static inline int irq_canonicalize(int irq)
34{ 28{
35 return irq; 29 return irq;
36} 30}
37 31#endif
38extern void disable_irq_nosync(unsigned int irq);
39extern void disable_irq(unsigned int irq);
40extern void enable_irq(unsigned int irq);
41
42 32
43#endif /* _ASM_IRQ_H_ */ 33#endif /* _ASM_IRQ_H_ */
diff --git a/include/asm-frv/mb93091-fpga-irqs.h b/include/asm-frv/mb93091-fpga-irqs.h
index 341bfc52a0..19778c5ba9 100644
--- a/include/asm-frv/mb93091-fpga-irqs.h
+++ b/include/asm-frv/mb93091-fpga-irqs.h
@@ -12,11 +12,9 @@
12#ifndef _ASM_MB93091_FPGA_IRQS_H 12#ifndef _ASM_MB93091_FPGA_IRQS_H
13#define _ASM_MB93091_FPGA_IRQS_H 13#define _ASM_MB93091_FPGA_IRQS_H
14 14
15#ifndef __ASSEMBLY__ 15#include <asm/irq.h>
16
17#include <asm/irq-routing.h>
18 16
19#define IRQ_BASE_FPGA (NR_IRQ_ACTIONS_PER_GROUP * 1) 17#ifndef __ASSEMBLY__
20 18
21/* IRQ IDs presented to drivers */ 19/* IRQ IDs presented to drivers */
22enum { 20enum {
diff --git a/include/asm-frv/mb93093-fpga-irqs.h b/include/asm-frv/mb93093-fpga-irqs.h
index 1e0f11c2fc..590266b1a6 100644
--- a/include/asm-frv/mb93093-fpga-irqs.h
+++ b/include/asm-frv/mb93093-fpga-irqs.h
@@ -12,11 +12,9 @@
12#ifndef _ASM_MB93093_FPGA_IRQS_H 12#ifndef _ASM_MB93093_FPGA_IRQS_H
13#define _ASM_MB93093_FPGA_IRQS_H 13#define _ASM_MB93093_FPGA_IRQS_H
14 14
15#ifndef __ASSEMBLY__ 15#include <asm/irq.h>
16
17#include <asm/irq-routing.h>
18 16
19#define IRQ_BASE_FPGA (NR_IRQ_ACTIONS_PER_GROUP * 1) 17#ifndef __ASSEMBLY__
20 18
21/* IRQ IDs presented to drivers */ 19/* IRQ IDs presented to drivers */
22enum { 20enum {
diff --git a/include/asm-frv/mb93493-irqs.h b/include/asm-frv/mb93493-irqs.h
index 15096e7313..82c7aeddd3 100644
--- a/include/asm-frv/mb93493-irqs.h
+++ b/include/asm-frv/mb93493-irqs.h
@@ -12,11 +12,9 @@
12#ifndef _ASM_MB93493_IRQS_H 12#ifndef _ASM_MB93493_IRQS_H
13#define _ASM_MB93493_IRQS_H 13#define _ASM_MB93493_IRQS_H
14 14
15#ifndef __ASSEMBLY__ 15#include <asm/irq.h>
16
17#include <asm/irq-routing.h>
18 16
19#define IRQ_BASE_MB93493 (NR_IRQ_ACTIONS_PER_GROUP * 2) 17#ifndef __ASSEMBLY__
20 18
21/* IRQ IDs presented to drivers */ 19/* IRQ IDs presented to drivers */
22enum { 20enum {
diff --git a/include/asm-frv/mb93493-regs.h b/include/asm-frv/mb93493-regs.h
index c54aa9d144..8a1f6aac8c 100644
--- a/include/asm-frv/mb93493-regs.h
+++ b/include/asm-frv/mb93493-regs.h
@@ -15,6 +15,7 @@
15#include <asm/mb-regs.h> 15#include <asm/mb-regs.h>
16#include <asm/mb93493-irqs.h> 16#include <asm/mb93493-irqs.h>
17 17
18#define __addr_MB93493(X) ((volatile unsigned long *)(__region_CS3 + (X)))
18#define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); }) 19#define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); })
19 20
20#define __set_MB93493(X,V) \ 21#define __set_MB93493(X,V) \
@@ -26,6 +27,7 @@ do { \
26#define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V)) 27#define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V))
27#define MB93493_STSR_EN 28#define MB93493_STSR_EN
28 29
30#define __addr_MB93493_IQSR(X) __addr_MB93493(0x3d0 + (X) * 4)
29#define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4) 31#define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4)
30#define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V)) 32#define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V))
31 33
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 7af7485e88..2fb3c6f05e 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -217,7 +217,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
217} 217}
218 218
219#define pgd_page(pgd) (pud_page((pud_t){ pgd })) 219#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
220#define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) 220#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
221 221
222/* 222/*
223 * allocating and freeing a pud is trivial: the 1-entry pud is 223 * allocating and freeing a pud is trivial: the 1-entry pud is
@@ -246,7 +246,7 @@ static inline void pud_clear(pud_t *pud) { }
246#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) 246#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
247 247
248#define pud_page(pud) (pmd_page((pmd_t){ pud })) 248#define pud_page(pud) (pmd_page((pmd_t){ pud }))
249#define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) 249#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
250 250
251/* 251/*
252 * (pmds are folded into pgds so this doesn't get actually called, 252 * (pmds are folded into pgds so this doesn't get actually called,
@@ -362,7 +362,7 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address)
362#define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) 362#define pmd_bad(x) (pmd_val(x) & xAMPRx_SS)
363#define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) 363#define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0)
364 364
365#define pmd_page_kernel(pmd) \ 365#define pmd_page_vaddr(pmd) \
366 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 366 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
367 367
368#ifndef CONFIG_DISCONTIGMEM 368#ifndef CONFIG_DISCONTIGMEM
@@ -458,7 +458,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
458#define pte_index(address) \ 458#define pte_index(address) \
459 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 459 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
460#define pte_offset_kernel(dir, address) \ 460#define pte_offset_kernel(dir, address) \
461 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) 461 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
462 462
463#if defined(CONFIG_HIGHPTE) 463#if defined(CONFIG_HIGHPTE)
464#define pte_offset_map(dir, address) \ 464#define pte_offset_map(dir, address) \
diff --git a/include/asm-frv/processor.h b/include/asm-frv/processor.h
index 1c4dba1c5f..3744f2e47f 100644
--- a/include/asm-frv/processor.h
+++ b/include/asm-frv/processor.h
@@ -21,6 +21,7 @@
21 */ 21 */
22#define current_text_addr() ({ __label__ _l; _l: &&_l;}) 22#define current_text_addr() ({ __label__ _l; _l: &&_l;})
23 23
24#include <linux/compiler.h>
24#include <linux/linkage.h> 25#include <linux/linkage.h>
25#include <asm/sections.h> 26#include <asm/sections.h>
26#include <asm/segment.h> 27#include <asm/segment.h>
@@ -139,7 +140,7 @@ unsigned long get_wchan(struct task_struct *p);
139extern struct task_struct *alloc_task_struct(void); 140extern struct task_struct *alloc_task_struct(void);
140extern void free_task_struct(struct task_struct *p); 141extern void free_task_struct(struct task_struct *p);
141 142
142#define cpu_relax() do { } while (0) 143#define cpu_relax() barrier()
143 144
144/* data cache prefetch */ 145/* data cache prefetch */
145#define ARCH_HAS_PREFETCH 146#define ARCH_HAS_PREFETCH
diff --git a/include/asm-frv/ptrace.h b/include/asm-frv/ptrace.h
index b2cce0718e..7ff525162a 100644
--- a/include/asm-frv/ptrace.h
+++ b/include/asm-frv/ptrace.h
@@ -62,18 +62,10 @@
62#ifndef __ASSEMBLY__ 62#ifndef __ASSEMBLY__
63 63
64/* 64/*
65 * dedicate GR28; to keeping the a pointer to the current exception frame 65 * we dedicate GR28 to keeping a pointer to the current exception frame
66 * - gr28 is destroyed on entry to the kernel from userspace
66 */ 67 */
67register struct pt_regs *__frame asm("gr28"); 68register struct pt_regs *__frame asm("gr28");
68register struct pt_regs *__debug_frame asm("gr31");
69
70#ifndef container_of
71#define container_of(ptr, type, member) ({ \
72 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
73 (type *)( (char *)__mptr - offsetof(type,member) );})
74#endif
75
76#define __debug_regs container_of(__debug_frame, struct pt_debug_regs, normal_regs)
77 69
78#define user_mode(regs) (!((regs)->psr & PSR_S)) 70#define user_mode(regs) (!((regs)->psr & PSR_S))
79#define instruction_pointer(regs) ((regs)->pc) 71#define instruction_pointer(regs) ((regs)->pc)
diff --git a/include/asm-frv/registers.h b/include/asm-frv/registers.h
index fccfd95cff..9666119fcf 100644
--- a/include/asm-frv/registers.h
+++ b/include/asm-frv/registers.h
@@ -23,7 +23,13 @@
23 * 23 *
24 * +0x2000 +---------------------- 24 * +0x2000 +----------------------
25 * | union { 25 * | union {
26 * | struct user_context 26 * | struct frv_frame0 {
27 * | struct user_context {
28 * | struct user_int_regs
29 * | struct user_fpmedia_regs
30 * | }
31 * | struct frv_debug_regs
32 * | }
27 * | struct pt_regs [user exception] 33 * | struct pt_regs [user exception]
28 * | } 34 * | }
29 * +---------------------- <-- __kernel_frame0_ptr (maybe GR28) 35 * +---------------------- <-- __kernel_frame0_ptr (maybe GR28)
@@ -51,11 +57,11 @@
51#define _ASM_REGISTERS_H 57#define _ASM_REGISTERS_H
52 58
53#ifndef __ASSEMBLY__ 59#ifndef __ASSEMBLY__
54#define __OFFSET(X) (X) 60#define __OFFSET(X,N) ((X)+(N)*4)
55#define __OFFSETC(X,N) xxxxxxxxxxxxxxxxxxxxxxxx 61#define __OFFSETC(X,N) xxxxxxxxxxxxxxxxxxxxxxxx
56#else 62#else
57#define __OFFSET(X) ((X)*4) 63#define __OFFSET(X,N) ((X)+(N)*4)
58#define __OFFSETC(X,N) ((X)*4+(N)) 64#define __OFFSETC(X,N) ((X)+(N))
59#endif 65#endif
60 66
61/*****************************************************************************/ 67/*****************************************************************************/
@@ -117,30 +123,13 @@ struct pt_regs {
117 123
118#endif 124#endif
119 125
120#define REG_PSR __OFFSET( 0) /* Processor Status Register */
121#define REG_ISR __OFFSET( 1) /* Integer Status Register */
122#define REG_CCR __OFFSET( 2) /* Condition Code Register */
123#define REG_CCCR __OFFSET( 3) /* Condition Code for Conditional Insns Register */
124#define REG_LR __OFFSET( 4) /* Link Register */
125#define REG_LCR __OFFSET( 5) /* Loop Count Register */
126#define REG_PC __OFFSET( 6) /* Program Counter */
127
128#define REG__STATUS __OFFSET( 7) /* exception status */
129#define REG__STATUS_STEP 0x00000001 /* - reenable single stepping on return */ 126#define REG__STATUS_STEP 0x00000001 /* - reenable single stepping on return */
130#define REG__STATUS_STEPPED 0x00000002 /* - single step caused exception */ 127#define REG__STATUS_STEPPED 0x00000002 /* - single step caused exception */
131#define REG__STATUS_BROKE 0x00000004 /* - BREAK insn caused exception */ 128#define REG__STATUS_BROKE 0x00000004 /* - BREAK insn caused exception */
132#define REG__STATUS_SYSC_ENTRY 0x40000000 /* - T on syscall entry (ptrace.c only) */ 129#define REG__STATUS_SYSC_ENTRY 0x40000000 /* - T on syscall entry (ptrace.c only) */
133#define REG__STATUS_SYSC_EXIT 0x80000000 /* - T on syscall exit (ptrace.c only) */ 130#define REG__STATUS_SYSC_EXIT 0x80000000 /* - T on syscall exit (ptrace.c only) */
134 131
135#define REG_SYSCALLNO __OFFSET( 8) /* syscall number or -1 */ 132#define REG_GR(R) __OFFSET(REG_GR0, (R))
136#define REG_ORIG_GR8 __OFFSET( 9) /* saved GR8 for signal handling */
137#define REG_GNER0 __OFFSET(10)
138#define REG_GNER1 __OFFSET(11)
139#define REG_IACC0 __OFFSET(12)
140
141#define REG_TBR __OFFSET(14) /* Trap Vector Register */
142#define REG_GR(R) __OFFSET((14+(R)))
143#define REG__END REG_GR(32)
144 133
145#define REG_SP REG_GR(1) 134#define REG_SP REG_GR(1)
146#define REG_FP REG_GR(2) 135#define REG_FP REG_GR(2)
@@ -149,27 +138,21 @@ struct pt_regs {
149 138
150/*****************************************************************************/ 139/*****************************************************************************/
151/* 140/*
152 * extension tacked in front of the exception frame in debug mode 141 * debugging registers
153 */ 142 */
154#ifndef __ASSEMBLY__ 143#ifndef __ASSEMBLY__
155 144
156struct pt_debug_regs 145struct frv_debug_regs
157{ 146{
158 unsigned long bpsr;
159 unsigned long dcr; 147 unsigned long dcr;
160 unsigned long brr; 148 unsigned long ibar[4] __attribute__((aligned(8)));
161 unsigned long nmar; 149 unsigned long dbar[4] __attribute__((aligned(8)));
162 struct pt_regs normal_regs; 150 unsigned long dbdr[4][4] __attribute__((aligned(8)));
151 unsigned long dbmr[4][4] __attribute__((aligned(8)));
163} __attribute__((aligned(8))); 152} __attribute__((aligned(8)));
164 153
165#endif 154#endif
166 155
167#define REG_NMAR __OFFSET(-1)
168#define REG_BRR __OFFSET(-2)
169#define REG_DCR __OFFSET(-3)
170#define REG_BPSR __OFFSET(-4)
171#define REG__DEBUG_XTRA __OFFSET(4)
172
173/*****************************************************************************/ 156/*****************************************************************************/
174/* 157/*
175 * userspace registers 158 * userspace registers
@@ -223,33 +206,27 @@ struct user_context
223 void *extension; 206 void *extension;
224} __attribute__((aligned(8))); 207} __attribute__((aligned(8)));
225 208
209struct frv_frame0 {
210 union {
211 struct pt_regs regs;
212 struct user_context uc;
213 };
214
215 struct frv_debug_regs debug;
216
217} __attribute__((aligned(32)));
218
226#endif 219#endif
227 220
228#define NR_USER_INT_REGS (14 + 64) 221#define __INT_GR(R) __OFFSET(__INT_GR0, (R))
229#define NR_USER_FPMEDIA_REGS (64 + 2 + 2 + 8 + 8/4 + 1) 222
230#define NR_USER_CONTEXT (NR_USER_INT_REGS + NR_USER_FPMEDIA_REGS + 1) 223#define __FPMEDIA_FR(R) __OFFSET(__FPMEDIA_FR0, (R))
231 224#define __FPMEDIA_FNER(R) __OFFSET(__FPMEDIA_FNER0, (R))
232#define USER_CONTEXT_SIZE (((NR_USER_CONTEXT + 1) & ~1) * 4) 225#define __FPMEDIA_MSR(R) __OFFSET(__FPMEDIA_MSR0, (R))
233 226#define __FPMEDIA_ACC(R) __OFFSET(__FPMEDIA_ACC0, (R))
234#define __THREAD_FRAME __OFFSET(0) 227#define __FPMEDIA_ACCG(R) __OFFSETC(__FPMEDIA_ACCG0, (R))
235#define __THREAD_CURR __OFFSET(1) 228#define __FPMEDIA_FSR(R) __OFFSET(__FPMEDIA_FSR0, (R))
236#define __THREAD_SP __OFFSET(2) 229
237#define __THREAD_FP __OFFSET(3) 230#define __THREAD_GR(R) __OFFSET(__THREAD_GR16, (R) - 16)
238#define __THREAD_LR __OFFSET(4)
239#define __THREAD_PC __OFFSET(5)
240#define __THREAD_GR(R) __OFFSET(6 + (R) - 16)
241#define __THREAD_FRAME0 __OFFSET(19)
242#define __THREAD_USER __OFFSET(19)
243
244#define __USER_INT __OFFSET(0)
245#define __INT_GR(R) __OFFSET(14 + (R))
246
247#define __USER_FPMEDIA __OFFSET(NR_USER_INT_REGS)
248#define __FPMEDIA_FR(R) __OFFSET(NR_USER_INT_REGS + (R))
249#define __FPMEDIA_FNER(R) __OFFSET(NR_USER_INT_REGS + 64 + (R))
250#define __FPMEDIA_MSR(R) __OFFSET(NR_USER_INT_REGS + 66 + (R))
251#define __FPMEDIA_ACC(R) __OFFSET(NR_USER_INT_REGS + 68 + (R))
252#define __FPMEDIA_ACCG(R) __OFFSETC(NR_USER_INT_REGS + 76, (R))
253#define __FPMEDIA_FSR(R) __OFFSET(NR_USER_INT_REGS + 78 + (R))
254 231
255#endif /* _ASM_REGISTERS_H */ 232#endif /* _ASM_REGISTERS_H */
diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h
index dcc1b35929..2079197d48 100644
--- a/include/asm-frv/signal.h
+++ b/include/asm-frv/signal.h
@@ -74,7 +74,6 @@ typedef unsigned long sigset_t;
74 * SA_FLAGS values: 74 * SA_FLAGS values:
75 * 75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used. 76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago) 77 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered. 79 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -94,7 +93,6 @@ typedef unsigned long sigset_t;
94 93
95#define SA_NOMASK SA_NODEFER 94#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND 95#define SA_ONESHOT SA_RESETHAND
97#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
98 96
99#define SA_RESTORER 0x04000000 97#define SA_RESTORER 0x04000000
100 98
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index 7177f8b981..31db18fc87 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -48,6 +48,7 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
53 54
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index 351863dfd0..1166899317 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -179,7 +179,6 @@ do { \
179#define rmb() asm volatile ("membar" : : :"memory") 179#define rmb() asm volatile ("membar" : : :"memory")
180#define wmb() asm volatile ("membar" : : :"memory") 180#define wmb() asm volatile ("membar" : : :"memory")
181#define set_mb(var, value) do { var = value; mb(); } while (0) 181#define set_mb(var, value) do { var = value; mb(); } while (0)
182#define set_wmb(var, value) do { var = value; wmb(); } while (0)
183 182
184#define smp_mb() mb() 183#define smp_mb() mb()
185#define smp_rmb() rmb() 184#define smp_rmb() rmb()
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h
index ea426abf01..d66c48e6ef 100644
--- a/include/asm-frv/thread_info.h
+++ b/include/asm-frv/thread_info.h
@@ -19,6 +19,8 @@
19#include <asm/processor.h> 19#include <asm/processor.h>
20#endif 20#endif
21 21
22#define THREAD_SIZE 8192
23
22/* 24/*
23 * low level task data that entry.S needs immediate access to 25 * low level task data that entry.S needs immediate access to
24 * - this struct should fit entirely inside of one cache line 26 * - this struct should fit entirely inside of one cache line
@@ -46,15 +48,7 @@ struct thread_info {
46 48
47#else /* !__ASSEMBLY__ */ 49#else /* !__ASSEMBLY__ */
48 50
49/* offsets into the thread_info struct for assembly code access */ 51#include <asm/asm-offsets.h>
50#define TI_TASK 0x00000000
51#define TI_EXEC_DOMAIN 0x00000004
52#define TI_FLAGS 0x00000008
53#define TI_STATUS 0x0000000C
54#define TI_CPU 0x00000010
55#define TI_PRE_COUNT 0x00000014
56#define TI_ADDR_LIMIT 0x00000018
57#define TI_RESTART_BLOCK 0x0000001C
58 52
59#endif 53#endif
60 54
@@ -83,12 +77,6 @@ struct thread_info {
83#define init_thread_info (init_thread_union.thread_info) 77#define init_thread_info (init_thread_union.thread_info)
84#define init_stack (init_thread_union.stack) 78#define init_stack (init_thread_union.stack)
85 79
86#ifdef CONFIG_SMALL_TASKS
87#define THREAD_SIZE 4096
88#else
89#define THREAD_SIZE 8192
90#endif
91
92/* how to get the thread information struct from C */ 80/* how to get the thread information struct from C */
93register struct thread_info *__current_thread_info asm("gr15"); 81register struct thread_info *__current_thread_info asm("gr15");
94 82
@@ -111,11 +99,7 @@ register struct thread_info *__current_thread_info asm("gr15");
111 99
112#define free_thread_info(info) kfree(info) 100#define free_thread_info(info) kfree(info)
113 101
114#else /* !__ASSEMBLY__ */ 102#endif /* __ASSEMBLY__ */
115
116#define THREAD_SIZE 8192
117
118#endif
119 103
120/* 104/*
121 * thread information flags 105 * thread information flags
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index b80dbd8394..d104d1b91d 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 } \
diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h
index 68c6fea994..7b88d3931e 100644
--- a/include/asm-generic/4level-fixup.h
+++ b/include/asm-generic/4level-fixup.h
@@ -21,6 +21,10 @@
21#define pud_present(pud) 1 21#define pud_present(pud) 1
22#define pud_ERROR(pud) do { } while (0) 22#define pud_ERROR(pud) do { } while (0)
23#define pud_clear(pud) pgd_clear(pud) 23#define pud_clear(pud) pgd_clear(pud)
24#define pud_val(pud) pgd_val(pud)
25#define pud_populate(mm, pud, pmd) pgd_populate(mm, pud, pmd)
26#define pud_page(pud) pgd_page(pud)
27#define pud_page_vaddr(pud) pgd_page_vaddr(pud)
24 28
25#undef pud_free_tlb 29#undef pud_free_tlb
26#define pud_free_tlb(tlb, x) do { } while (0) 30#define pud_free_tlb(tlb, x) do { } while (0)
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
new file mode 100644
index 0000000000..3c06be3817
--- /dev/null
+++ b/include/asm-generic/Kbuild
@@ -0,0 +1,12 @@
1header-y += atomic.h
2header-y += errno-base.h
3header-y += errno.h
4header-y += fcntl.h
5header-y += ioctl.h
6header-y += ipc.h
7header-y += mman.h
8header-y += signal.h
9header-y += statfs.h
10
11unifdef-y += resource.h
12unifdef-y += siginfo.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
new file mode 100644
index 0000000000..a84c3d88a1
--- /dev/null
+++ b/include/asm-generic/Kbuild.asm
@@ -0,0 +1,34 @@
1unifdef-y += a.out.h
2unifdef-y += auxvec.h
3unifdef-y += byteorder.h
4unifdef-y += errno.h
5unifdef-y += fcntl.h
6unifdef-y += ioctl.h
7unifdef-y += ioctls.h
8unifdef-y += ipcbuf.h
9unifdef-y += mman.h
10unifdef-y += msgbuf.h
11unifdef-y += param.h
12unifdef-y += poll.h
13unifdef-y += posix_types.h
14unifdef-y += ptrace.h
15unifdef-y += resource.h
16unifdef-y += sembuf.h
17unifdef-y += shmbuf.h
18unifdef-y += sigcontext.h
19unifdef-y += siginfo.h
20unifdef-y += signal.h
21unifdef-y += socket.h
22unifdef-y += sockios.h
23unifdef-y += stat.h
24unifdef-y += statfs.h
25unifdef-y += termbits.h
26unifdef-y += termios.h
27unifdef-y += types.h
28unifdef-y += unistd.h
29unifdef-y += user.h
30
31# These probably shouldn't be exported
32unifdef-y += shmparam.h
33unifdef-y += elf.h
34unifdef-y += page.h
diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h
new file mode 100644
index 0000000000..50764550a6
--- /dev/null
+++ b/include/asm-generic/audit_change_attr.h
@@ -0,0 +1,22 @@
1__NR_chmod,
2__NR_fchmod,
3#ifdef __NR_chown
4__NR_chown,
5__NR_fchown,
6__NR_lchown,
7#endif
8__NR_setxattr,
9__NR_lsetxattr,
10__NR_fsetxattr,
11__NR_removexattr,
12__NR_lremovexattr,
13__NR_fremovexattr,
14#ifdef __NR_fchownat
15__NR_fchownat,
16__NR_fchmodat,
17#endif
18#ifdef __NR_chown32
19__NR_chown32,
20__NR_fchown32,
21__NR_lchown32,
22#endif
diff --git a/include/asm-generic/audit_dir_write.h b/include/asm-generic/audit_dir_write.h
new file mode 100644
index 0000000000..6621bd82cb
--- /dev/null
+++ b/include/asm-generic/audit_dir_write.h
@@ -0,0 +1,18 @@
1__NR_rename,
2__NR_mkdir,
3__NR_rmdir,
4#ifdef __NR_creat
5__NR_creat,
6#endif
7__NR_link,
8__NR_unlink,
9__NR_symlink,
10__NR_mknod,
11#ifdef __NR_mkdirat
12__NR_mkdirat,
13__NR_mknodat,
14__NR_unlinkat,
15__NR_renameat,
16__NR_linkat,
17__NR_symlinkat,
18#endif
diff --git a/include/asm-generic/audit_read.h b/include/asm-generic/audit_read.h
new file mode 100644
index 0000000000..0e87464d98
--- /dev/null
+++ b/include/asm-generic/audit_read.h
@@ -0,0 +1,8 @@
1__NR_readlink,
2__NR_quotactl,
3__NR_listxattr,
4__NR_llistxattr,
5__NR_flistxattr,
6__NR_getxattr,
7__NR_lgetxattr,
8__NR_fgetxattr,
diff --git a/include/asm-generic/audit_write.h b/include/asm-generic/audit_write.h
new file mode 100644
index 0000000000..f10d367fb2
--- /dev/null
+++ b/include/asm-generic/audit_write.h
@@ -0,0 +1,11 @@
1#include <asm-generic/audit_dir_write.h>
2__NR_acct,
3__NR_swapon,
4__NR_quotactl,
5__NR_truncate,
6#ifdef __NR_truncate64
7__NR_truncate64,
8#endif
9#ifdef __NR_bind
10__NR_bind, /* bind can affect fs object only in one way... */
11#endif
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 0cd9711895..a525089515 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,8 +37,24 @@
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))
41#endif
38#endif 42#endif
43
44#define WARN_ON_ONCE(condition) ({ \
45 static int __warn_once = 1; \
46 typeof(condition) __ret_warn_once = (condition);\
47 \
48 if (likely(__warn_once)) \
49 if (WARN_ON(__ret_warn_once)) \
50 __warn_once = 0; \
51 unlikely(__ret_warn_once); \
52})
53
54#ifdef CONFIG_SMP
55# define WARN_ON_SMP(x) WARN_ON(x)
56#else
57# define WARN_ON_SMP(x) do { } while (0)
39#endif 58#endif
40 59
41#endif 60#endif
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 6f178563e3..09204e40d6 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -24,7 +24,9 @@ typedef u64 cputime64_t;
24 24
25#define cputime64_zero (0ULL) 25#define cputime64_zero (0ULL)
26#define cputime64_add(__a, __b) ((__a) + (__b)) 26#define cputime64_add(__a, __b) ((__a) + (__b))
27#define cputime64_sub(__a, __b) ((__a) - (__b))
27#define cputime64_to_jiffies64(__ct) (__ct) 28#define cputime64_to_jiffies64(__ct) (__ct)
29#define jiffies64_to_cputime64(__jif) (__jif)
28#define cputime_to_cputime64(__ct) ((u64) __ct) 30#define cputime_to_cputime64(__ct) ((u64) __ct)
29 31
30 32
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h
new file mode 100644
index 0000000000..9202fd02d5
--- /dev/null
+++ b/include/asm-generic/libata-portmap.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H
2#define __ASM_GENERIC_LIBATA_PORTMAP_H
3
4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ 14
7
8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ 15
11
12#endif
diff --git a/include/asm-generic/mutex-null.h b/include/asm-generic/mutex-null.h
index 5cf8b7ce0c..254a126ede 100644
--- a/include/asm-generic/mutex-null.h
+++ b/include/asm-generic/mutex-null.h
@@ -10,15 +10,10 @@
10#ifndef _ASM_GENERIC_MUTEX_NULL_H 10#ifndef _ASM_GENERIC_MUTEX_NULL_H
11#define _ASM_GENERIC_MUTEX_NULL_H 11#define _ASM_GENERIC_MUTEX_NULL_H
12 12
13/* extra parameter only needed for mutex debugging: */ 13#define __mutex_fastpath_lock(count, fail_fn) fail_fn(count)
14#ifndef __IP__ 14#define __mutex_fastpath_lock_retval(count, fail_fn) fail_fn(count)
15# define __IP__ 15#define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count)
16#endif 16#define __mutex_fastpath_trylock(count, fail_fn) fail_fn(count)
17 17#define __mutex_slowpath_needs_to_unlock() 1
18#define __mutex_fastpath_lock(count, fail_fn) fail_fn(count __RET_IP__)
19#define __mutex_fastpath_lock_retval(count, fail_fn) fail_fn(count __RET_IP__)
20#define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count __RET_IP__)
21#define __mutex_fastpath_trylock(count, fail_fn) fail_fn(count)
22#define __mutex_slowpath_needs_to_unlock() 1
23 18
24#endif 19#endif
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index c0caf433a7..6d45ee5472 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -7,13 +7,18 @@
7 7
8extern unsigned long __per_cpu_offset[NR_CPUS]; 8extern unsigned long __per_cpu_offset[NR_CPUS];
9 9
10#define per_cpu_offset(x) (__per_cpu_offset[x])
11
10/* Separate out the type, so (int[3], foo) works. */ 12/* Separate out the type, so (int[3], foo) works. */
11#define DEFINE_PER_CPU(type, name) \ 13#define DEFINE_PER_CPU(type, name) \
12 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 14 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
13 15
14/* var is in discarded region: offset to particular copy we want */ 16/* var is in discarded region: offset to particular copy we want */
15#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) 17#define per_cpu(var, cpu) (*({ \
18 extern int simple_indentifier_##var(void); \
19 RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))
16#define __get_cpu_var(var) per_cpu(var, smp_processor_id()) 20#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
21#define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id())
17 22
18/* A macro to avoid #include hell... */ 23/* A macro to avoid #include hell... */
19#define percpu_modcopy(pcpudst, src, size) \ 24#define percpu_modcopy(pcpudst, src, size) \
@@ -30,6 +35,7 @@ do { \
30 35
31#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 36#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
32#define __get_cpu_var(var) per_cpu__##var 37#define __get_cpu_var(var) per_cpu__##var
38#define __raw_get_cpu_var(var) per_cpu__##var
33 39
34#endif /* SMP */ 40#endif /* SMP */
35 41
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index c8d53ba20e..29ff5d84d8 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -47,7 +47,7 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
47#define __pmd(x) ((pmd_t) { __pud(x) } ) 47#define __pmd(x) ((pmd_t) { __pud(x) } )
48 48
49#define pud_page(pud) (pmd_page((pmd_t){ pud })) 49#define pud_page(pud) (pmd_page((pmd_t){ pud }))
50#define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) 50#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
51 51
52/* 52/*
53 * allocating and freeing a pmd is trivial: the 1-entry pmd is 53 * allocating and freeing a pmd is trivial: the 1-entry pmd is
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h
index 82e29f0ce4..5664645005 100644
--- a/include/asm-generic/pgtable-nopud.h
+++ b/include/asm-generic/pgtable-nopud.h
@@ -44,7 +44,7 @@ static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
44#define __pud(x) ((pud_t) { __pgd(x) } ) 44#define __pud(x) ((pud_t) { __pgd(x) } )
45 45
46#define pgd_page(pgd) (pud_page((pud_t){ pgd })) 46#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
47#define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) 47#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
48 48
49/* 49/*
50 * allocating and freeing a pud is trivial: the 1-entry pud is 50 * allocating and freeing a pud is trivial: the 1-entry pud is
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index c2059a3a06..349260cd86 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_GENERIC_PGTABLE_H 1#ifndef _ASM_GENERIC_PGTABLE_H
2#define _ASM_GENERIC_PGTABLE_H 2#define _ASM_GENERIC_PGTABLE_H
3 3
4#ifndef __ASSEMBLY__
5
4#ifndef __HAVE_ARCH_PTEP_ESTABLISH 6#ifndef __HAVE_ARCH_PTEP_ESTABLISH
5/* 7/*
6 * Establish a new mapping: 8 * Establish a new mapping:
@@ -188,7 +190,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
188}) 190})
189#endif 191#endif
190 192
191#ifndef __ASSEMBLY__
192/* 193/*
193 * When walking page tables, we usually want to skip any p?d_none entries; 194 * When walking page tables, we usually want to skip any p?d_none entries;
194 * and any p?d_bad entries - reporting the error before resetting to none. 195 * and any p?d_bad entries - reporting the error before resetting to none.
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index cef08db34a..4087037a42 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -114,6 +114,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
114/* Set the current date and time in the real time clock. */ 114/* Set the current date and time in the real time clock. */
115static inline int set_rtc_time(struct rtc_time *time) 115static inline int set_rtc_time(struct rtc_time *time)
116{ 116{
117 unsigned long flags;
117 unsigned char mon, day, hrs, min, sec; 118 unsigned char mon, day, hrs, min, sec;
118 unsigned char save_control, save_freq_select; 119 unsigned char save_control, save_freq_select;
119 unsigned int yrs; 120 unsigned int yrs;
@@ -131,7 +132,7 @@ static inline int set_rtc_time(struct rtc_time *time)
131 if (yrs > 255) /* They are unsigned */ 132 if (yrs > 255) /* They are unsigned */
132 return -EINVAL; 133 return -EINVAL;
133 134
134 spin_lock_irq(&rtc_lock); 135 spin_lock_irqsave(&rtc_lock, flags);
135#ifdef CONFIG_MACH_DECSTATION 136#ifdef CONFIG_MACH_DECSTATION
136 real_yrs = yrs; 137 real_yrs = yrs;
137 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) || 138 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
@@ -152,7 +153,7 @@ static inline int set_rtc_time(struct rtc_time *time)
152 * whether the chip is in binary mode or not. 153 * whether the chip is in binary mode or not.
153 */ 154 */
154 if (yrs > 169) { 155 if (yrs > 169) {
155 spin_unlock_irq(&rtc_lock); 156 spin_unlock_irqrestore(&rtc_lock, flags);
156 return -EINVAL; 157 return -EINVAL;
157 } 158 }
158 159
@@ -187,7 +188,7 @@ static inline int set_rtc_time(struct rtc_time *time)
187 CMOS_WRITE(save_control, RTC_CONTROL); 188 CMOS_WRITE(save_control, RTC_CONTROL);
188 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 189 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
189 190
190 spin_unlock_irq(&rtc_lock); 191 spin_unlock_irqrestore(&rtc_lock, flags);
191 192
192 return 0; 193 return 0;
193} 194}
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 0b49f9e070..962cad7cfb 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -14,5 +14,6 @@ extern char _end[];
14extern char __per_cpu_start[], __per_cpu_end[]; 14extern char __per_cpu_start[], __per_cpu_end[];
15extern char __kprobes_text_start[], __kprobes_text_end[]; 15extern char __kprobes_text_start[], __kprobes_text_end[];
16extern char __initdata_begin[], __initdata_end[]; 16extern char __initdata_begin[], __initdata_end[];
17extern char __start_rodata[], __end_rodata[];
17 18
18#endif /* _ASM_GENERIC_SECTIONS_H_ */ 19#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9d11550b48..69240b52f8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -58,6 +58,20 @@
58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ 58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
59 } \ 59 } \
60 \ 60 \
61 /* Kernel symbol table: Normal unused symbols */ \
62 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
64 *(__ksymtab_unused) \
65 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
66 } \
67 \
68 /* Kernel symbol table: GPL-only unused symbols */ \
69 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
70 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
71 *(__ksymtab_unused_gpl) \
72 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
73 } \
74 \
61 /* Kernel symbol table: GPL-future-only symbols */ \ 75 /* Kernel symbol table: GPL-future-only symbols */ \
62 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ 76 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ 77 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
@@ -79,6 +93,20 @@
79 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ 93 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
80 } \ 94 } \
81 \ 95 \
96 /* Kernel symbol table: Normal unused symbols */ \
97 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
99 *(__kcrctab_unused) \
100 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
101 } \
102 \
103 /* Kernel symbol table: GPL-only unused symbols */ \
104 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
105 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
106 *(__kcrctab_unused_gpl) \
107 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
108 } \
109 \
82 /* Kernel symbol table: GPL-future-only symbols */ \ 110 /* Kernel symbol table: GPL-future-only symbols */ \
83 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ 111 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
84 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ 112 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
@@ -90,15 +118,15 @@
90 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ 118 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
91 *(__ksymtab_strings) \ 119 *(__ksymtab_strings) \
92 } \ 120 } \
93 __end_rodata = .; \
94 . = ALIGN(4096); \
95 \ 121 \
96 /* Built-in module parameters. */ \ 122 /* Built-in module parameters. */ \
97 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 123 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start___param) = .; \ 124 VMLINUX_SYMBOL(__start___param) = .; \
99 *(__param) \ 125 *(__param) \
100 VMLINUX_SYMBOL(__stop___param) = .; \ 126 VMLINUX_SYMBOL(__stop___param) = .; \
101 } 127 } \
128 __end_rodata = .; \
129 . = ALIGN(4096);
102 130
103#define SECURITY_INIT \ 131#define SECURITY_INIT \
104 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ 132 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
@@ -166,3 +194,6 @@
166 .stab.index 0 : { *(.stab.index) } \ 194 .stab.index 0 : { *(.stab.index) } \
167 .stab.indexstr 0 : { *(.stab.indexstr) } \ 195 .stab.indexstr 0 : { *(.stab.indexstr) } \
168 .comment 0 : { *(.comment) } 196 .comment 0 : { *(.comment) }
197
198#define NOTES \
199 .notes : { *(.note.*) } :note
diff --git a/include/asm-h8300/Kbuild b/include/asm-h8300/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-h8300/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index f9f9d3eea8..3b4f2903f9 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -1,6 +1,7 @@
1#ifndef _H8300_PAGE_H 1#ifndef _H8300_PAGE_H
2#define _H8300_PAGE_H 2#define _H8300_PAGE_H
3 3
4#ifdef __KERNEL__
4 5
5/* PAGE_SHIFT determines the page size */ 6/* PAGE_SHIFT determines the page size */
6 7
@@ -8,8 +9,6 @@
8#define PAGE_SIZE (1UL << PAGE_SHIFT) 9#define PAGE_SIZE (1UL << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1)) 10#define PAGE_MASK (~(PAGE_SIZE-1))
10 11
11#ifdef __KERNEL__
12
13#include <asm/setup.h> 12#include <asm/setup.h>
14 13
15#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
@@ -66,7 +65,6 @@ extern unsigned long memory_end;
66 65
67#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 66#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
68#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) 67#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
69#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
70#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) 68#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
71#define pfn_valid(page) (page < max_mapnr) 69#define pfn_valid(page) (page < max_mapnr)
72 70
@@ -77,9 +75,9 @@ extern unsigned long memory_end;
77 75
78#endif /* __ASSEMBLY__ */ 76#endif /* __ASSEMBLY__ */
79 77
80#endif /* __KERNEL__ */
81
82#include <asm-generic/memory_model.h> 78#include <asm-generic/memory_model.h>
83#include <asm-generic/page.h> 79#include <asm-generic/page.h>
84 80
81#endif /* __KERNEL__ */
82
85#endif /* _H8300_PAGE_H */ 83#endif /* _H8300_PAGE_H */
diff --git a/include/asm-h8300/processor.h b/include/asm-h8300/processor.h
index c7e2f454b8..99b664aa20 100644
--- a/include/asm-h8300/processor.h
+++ b/include/asm-h8300/processor.h
@@ -17,6 +17,7 @@
17 */ 17 */
18#define current_text_addr() ({ __label__ _l; _l: &&_l;}) 18#define current_text_addr() ({ __label__ _l; _l: &&_l;})
19 19
20#include <linux/compiler.h>
20#include <asm/segment.h> 21#include <asm/segment.h>
21#include <asm/fpu.h> 22#include <asm/fpu.h>
22#include <asm/ptrace.h> 23#include <asm/ptrace.h>
@@ -129,6 +130,6 @@ unsigned long get_wchan(struct task_struct *p);
129 eip; }) 130 eip; })
130#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 131#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
131 132
132#define cpu_relax() do { } while (0) 133#define cpu_relax() barrier()
133 134
134#endif 135#endif
diff --git a/include/asm-h8300/signal.h b/include/asm-h8300/signal.h
index 8eccdc1761..7bc15048a6 100644
--- a/include/asm-h8300/signal.h
+++ b/include/asm-h8300/signal.h
@@ -74,7 +74,6 @@ typedef unsigned long sigset_t;
74 * SA_FLAGS values: 74 * SA_FLAGS values:
75 * 75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used. 76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago) 77 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered. 79 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -94,7 +93,6 @@ typedef unsigned long sigset_t;
94 93
95#define SA_NOMASK SA_NODEFER 94#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND 95#define SA_ONESHOT SA_RESETHAND
97#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
98 96
99#define SA_RESTORER 0x04000000 97#define SA_RESTORER 0x04000000
100 98
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index d98cf85baf..ebc830fee0 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-h8300/system.h b/include/asm-h8300/system.h
index 134e0929fc..5084a9d429 100644
--- a/include/asm-h8300/system.h
+++ b/include/asm-h8300/system.h
@@ -84,7 +84,6 @@ asmlinkage void resume(void);
84#define wmb() asm volatile ("" : : :"memory") 84#define wmb() asm volatile ("" : : :"memory")
85#define set_rmb(var, value) do { xchg(&var, value); } while (0) 85#define set_rmb(var, value) do { xchg(&var, value); } while (0)
86#define set_mb(var, value) set_rmb(var, value) 86#define set_mb(var, value) set_rmb(var, value)
87#define set_wmb(var, value) do { var = value; wmb(); } while (0)
88 87
89#ifdef CONFIG_SMP 88#ifdef CONFIG_SMP
90#define smp_mb() mb() 89#define smp_mb() mb()
diff --git a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h
index 226dd596c2..a2dd90462d 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); \
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild
new file mode 100644
index 0000000000..147e4ac1eb
--- /dev/null
+++ b/include/asm-i386/Kbuild
@@ -0,0 +1,11 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += boot.h
4header-y += debugreg.h
5header-y += ldt.h
6header-y += ptrace-abi.h
7header-y += ucontext.h
8
9unifdef-y += mtrr.h
10unifdef-y += setup.h
11unifdef-y += vm86.h
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index 20f5239542..6016632d03 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 0000000000..6c47e3b948
--- /dev/null
+++ b/include/asm-i386/alternative-asm.i
@@ -0,0 +1,14 @@
1#include <linux/config.h>
2
3#ifdef CONFIG_SMP
4 .macro LOCK_PREFIX
51: lock
6 .section .smp_locks,"a"
7 .align 4
8 .long 1b
9 .previous
10 .endm
11#else
12 .macro LOCK_PREFIX
13 .endm
14#endif
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index d79e9ee10f..b01a7ec409 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -5,6 +5,8 @@
5 5
6#include <asm/types.h> 6#include <asm/types.h>
7 7
8#include <linux/types.h>
9
8struct alt_instr { 10struct alt_instr {
9 u8 *instr; /* original instruction */ 11 u8 *instr; /* original instruction */
10 u8 *replacement; 12 u8 *replacement;
@@ -17,11 +19,19 @@ struct alt_instr {
17extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); 19extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
18 20
19struct module; 21struct module;
22#ifdef CONFIG_SMP
20extern void alternatives_smp_module_add(struct module *mod, char *name, 23extern void alternatives_smp_module_add(struct module *mod, char *name,
21 void *locks, void *locks_end, 24 void *locks, void *locks_end,
22 void *text, void *text_end); 25 void *text, void *text_end);
23extern void alternatives_smp_module_del(struct module *mod); 26extern void alternatives_smp_module_del(struct module *mod);
24extern void alternatives_smp_switch(int smp); 27extern void alternatives_smp_switch(int smp);
28#else
29static inline void alternatives_smp_module_add(struct module *mod, char *name,
30 void *locks, void *locks_end,
31 void *text, void *text_end) {}
32static inline void alternatives_smp_module_del(struct module *mod) {}
33static inline void alternatives_smp_switch(int smp) {}
34#endif
25 35
26#endif 36#endif
27 37
@@ -78,9 +88,6 @@ extern void alternatives_smp_switch(int smp);
78/* 88/*
79 * Alternative inline assembly for SMP. 89 * Alternative inline assembly for SMP.
80 * 90 *
81 * alternative_smp() takes two versions (SMP first, UP second) and is
82 * for more complex stuff such as spinlocks.
83 *
84 * The LOCK_PREFIX macro defined here replaces the LOCK and 91 * The LOCK_PREFIX macro defined here replaces the LOCK and
85 * LOCK_PREFIX macros used everywhere in the source tree. 92 * LOCK_PREFIX macros used everywhere in the source tree.
86 * 93 *
@@ -100,21 +107,6 @@ extern void alternatives_smp_switch(int smp);
100 */ 107 */
101 108
102#ifdef CONFIG_SMP 109#ifdef CONFIG_SMP
103#define alternative_smp(smpinstr, upinstr, args...) \
104 asm volatile ("661:\n\t" smpinstr "\n662:\n" \
105 ".section .smp_altinstructions,\"a\"\n" \
106 " .align 4\n" \
107 " .long 661b\n" /* label */ \
108 " .long 663f\n" /* new instruction */ \
109 " .byte 0x68\n" /* X86_FEATURE_UP */ \
110 " .byte 662b-661b\n" /* sourcelen */ \
111 " .byte 664f-663f\n" /* replacementlen */ \
112 ".previous\n" \
113 ".section .smp_altinstr_replacement,\"awx\"\n" \
114 "663:\n\t" upinstr "\n" /* replacement */ \
115 "664:\n\t.fill 662b-661b,1,0x42\n" /* space for original */ \
116 ".previous" : args)
117
118#define LOCK_PREFIX \ 110#define LOCK_PREFIX \
119 ".section .smp_locks,\"a\"\n" \ 111 ".section .smp_locks,\"a\"\n" \
120 " .align 4\n" \ 112 " .align 4\n" \
@@ -123,8 +115,6 @@ extern void alternatives_smp_switch(int smp);
123 "661:\n\tlock; " 115 "661:\n\tlock; "
124 116
125#else /* ! CONFIG_SMP */ 117#else /* ! CONFIG_SMP */
126#define alternative_smp(smpinstr, upinstr, args...) \
127 asm volatile (upinstr : args)
128#define LOCK_PREFIX "" 118#define LOCK_PREFIX ""
129#endif 119#endif
130 120
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 1d8362cb2c..3a42b7d6fc 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/*
@@ -111,26 +101,12 @@ extern void init_apic_mappings (void);
111extern void smp_local_timer_interrupt (struct pt_regs * regs); 101extern void smp_local_timer_interrupt (struct pt_regs * regs);
112extern void setup_boot_APIC_clock (void); 102extern void setup_boot_APIC_clock (void);
113extern void setup_secondary_APIC_clock (void); 103extern void setup_secondary_APIC_clock (void);
114extern void setup_apic_nmi_watchdog (void);
115extern int reserve_lapic_nmi(void);
116extern void release_lapic_nmi(void);
117extern void disable_timer_nmi_watchdog(void);
118extern void enable_timer_nmi_watchdog(void);
119extern void nmi_watchdog_tick (struct pt_regs * regs);
120extern int APIC_init_uniprocessor (void); 104extern int APIC_init_uniprocessor (void);
121extern void disable_APIC_timer(void); 105extern void disable_APIC_timer(void);
122extern void enable_APIC_timer(void); 106extern void enable_APIC_timer(void);
123 107
124extern void enable_NMI_through_LVT0 (void * dummy); 108extern void enable_NMI_through_LVT0 (void * dummy);
125 109
126extern unsigned int nmi_watchdog;
127#define NMI_NONE 0
128#define NMI_IO_APIC 1
129#define NMI_LOCAL_APIC 2
130#define NMI_INVALID 3
131
132extern int disable_timer_pin_1;
133
134void smp_send_timer_broadcast_ipi(struct pt_regs *regs); 110void smp_send_timer_broadcast_ipi(struct pt_regs *regs);
135void switch_APIC_timer_to_ipi(void *cpumask); 111void switch_APIC_timer_to_ipi(void *cpumask);
136void switch_ipi_to_APIC_timer(void *cpumask); 112void switch_ipi_to_APIC_timer(void *cpumask);
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index 4f061fa737..51a1662425 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -46,8 +46,8 @@ static __inline__ void atomic_add(int i, atomic_t *v)
46{ 46{
47 __asm__ __volatile__( 47 __asm__ __volatile__(
48 LOCK_PREFIX "addl %1,%0" 48 LOCK_PREFIX "addl %1,%0"
49 :"=m" (v->counter) 49 :"+m" (v->counter)
50 :"ir" (i), "m" (v->counter)); 50 :"ir" (i));
51} 51}
52 52
53/** 53/**
@@ -61,8 +61,8 @@ static __inline__ void atomic_sub(int i, atomic_t *v)
61{ 61{
62 __asm__ __volatile__( 62 __asm__ __volatile__(
63 LOCK_PREFIX "subl %1,%0" 63 LOCK_PREFIX "subl %1,%0"
64 :"=m" (v->counter) 64 :"+m" (v->counter)
65 :"ir" (i), "m" (v->counter)); 65 :"ir" (i));
66} 66}
67 67
68/** 68/**
@@ -80,8 +80,8 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
80 80
81 __asm__ __volatile__( 81 __asm__ __volatile__(
82 LOCK_PREFIX "subl %2,%0; sete %1" 82 LOCK_PREFIX "subl %2,%0; sete %1"
83 :"=m" (v->counter), "=qm" (c) 83 :"+m" (v->counter), "=qm" (c)
84 :"ir" (i), "m" (v->counter) : "memory"); 84 :"ir" (i) : "memory");
85 return c; 85 return c;
86} 86}
87 87
@@ -95,8 +95,7 @@ static __inline__ void atomic_inc(atomic_t *v)
95{ 95{
96 __asm__ __volatile__( 96 __asm__ __volatile__(
97 LOCK_PREFIX "incl %0" 97 LOCK_PREFIX "incl %0"
98 :"=m" (v->counter) 98 :"+m" (v->counter));
99 :"m" (v->counter));
100} 99}
101 100
102/** 101/**
@@ -109,8 +108,7 @@ static __inline__ void atomic_dec(atomic_t *v)
109{ 108{
110 __asm__ __volatile__( 109 __asm__ __volatile__(
111 LOCK_PREFIX "decl %0" 110 LOCK_PREFIX "decl %0"
112 :"=m" (v->counter) 111 :"+m" (v->counter));
113 :"m" (v->counter));
114} 112}
115 113
116/** 114/**
@@ -127,8 +125,8 @@ static __inline__ int atomic_dec_and_test(atomic_t *v)
127 125
128 __asm__ __volatile__( 126 __asm__ __volatile__(
129 LOCK_PREFIX "decl %0; sete %1" 127 LOCK_PREFIX "decl %0; sete %1"
130 :"=m" (v->counter), "=qm" (c) 128 :"+m" (v->counter), "=qm" (c)
131 :"m" (v->counter) : "memory"); 129 : : "memory");
132 return c != 0; 130 return c != 0;
133} 131}
134 132
@@ -146,8 +144,8 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)
146 144
147 __asm__ __volatile__( 145 __asm__ __volatile__(
148 LOCK_PREFIX "incl %0; sete %1" 146 LOCK_PREFIX "incl %0; sete %1"
149 :"=m" (v->counter), "=qm" (c) 147 :"+m" (v->counter), "=qm" (c)
150 :"m" (v->counter) : "memory"); 148 : : "memory");
151 return c != 0; 149 return c != 0;
152} 150}
153 151
@@ -166,8 +164,8 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)
166 164
167 __asm__ __volatile__( 165 __asm__ __volatile__(
168 LOCK_PREFIX "addl %2,%0; sets %1" 166 LOCK_PREFIX "addl %2,%0; sets %1"
169 :"=m" (v->counter), "=qm" (c) 167 :"+m" (v->counter), "=qm" (c)
170 :"ir" (i), "m" (v->counter) : "memory"); 168 :"ir" (i) : "memory");
171 return c; 169 return c;
172} 170}
173 171
diff --git a/include/asm-i386/cpu.h b/include/asm-i386/cpu.h
index e7252c216c..b1bc7b1b64 100644
--- a/include/asm-i386/cpu.h
+++ b/include/asm-i386/cpu.h
@@ -7,8 +7,6 @@
7#include <linux/nodemask.h> 7#include <linux/nodemask.h>
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9 9
10#include <asm/node.h>
11
12struct i386_cpu { 10struct i386_cpu {
13 struct cpu cpu; 11 struct cpu cpu;
14}; 12};
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index 3ecedbafa8..d314ebb3d5 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -72,6 +72,7 @@
72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ 72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */ 73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
74#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */ 74#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */
75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
75 76
76/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 77/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
77#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 78#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/delay.h b/include/asm-i386/delay.h
index 456db8501c..b1c7650dc7 100644
--- a/include/asm-i386/delay.h
+++ b/include/asm-i386/delay.h
@@ -23,4 +23,6 @@ extern void __delay(unsigned long loops);
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ 23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n)) 24 __ndelay(n))
25 25
26void use_tsc_delay(void);
27
26#endif /* defined(_I386_DELAY_H) */ 28#endif /* defined(_I386_DELAY_H) */
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 89b8b82c82..5874ef119f 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 9cf20cacf7..81999a3ebe 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -21,8 +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 if (direction == DMA_NONE) 24 BUG_ON(!valid_dma_direction(direction));
25 BUG();
26 WARN_ON(size == 0); 25 WARN_ON(size == 0);
27 flush_write_buffers(); 26 flush_write_buffers();
28 return virt_to_phys(ptr); 27 return virt_to_phys(ptr);
@@ -32,8 +31,7 @@ static inline void
32dma_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,
33 enum dma_data_direction direction) 32 enum dma_data_direction direction)
34{ 33{
35 if (direction == DMA_NONE) 34 BUG_ON(!valid_dma_direction(direction));
36 BUG();
37} 35}
38 36
39static inline int 37static inline int
@@ -42,8 +40,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
42{ 40{
43 int i; 41 int i;
44 42
45 if (direction == DMA_NONE) 43 BUG_ON(!valid_dma_direction(direction));
46 BUG();
47 WARN_ON(nents == 0 || sg[0].length == 0); 44 WARN_ON(nents == 0 || sg[0].length == 0);
48 45
49 for (i = 0; i < nents; i++ ) { 46 for (i = 0; i < nents; i++ ) {
@@ -60,7 +57,7 @@ static inline dma_addr_t
60dma_map_page(struct device *dev, struct page *page, unsigned long offset, 57dma_map_page(struct device *dev, struct page *page, unsigned long offset,
61 size_t size, enum dma_data_direction direction) 58 size_t size, enum dma_data_direction direction)
62{ 59{
63 BUG_ON(direction == DMA_NONE); 60 BUG_ON(!valid_dma_direction(direction));
64 return page_to_phys(page) + offset; 61 return page_to_phys(page) + offset;
65} 62}
66 63
@@ -68,7 +65,7 @@ static inline void
68dma_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,
69 enum dma_data_direction direction) 66 enum dma_data_direction direction)
70{ 67{
71 BUG_ON(direction == DMA_NONE); 68 BUG_ON(!valid_dma_direction(direction));
72} 69}
73 70
74 71
@@ -76,7 +73,7 @@ static inline void
76dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 73dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
77 enum dma_data_direction direction) 74 enum dma_data_direction direction)
78{ 75{
79 BUG_ON(direction == DMA_NONE); 76 BUG_ON(!valid_dma_direction(direction));
80} 77}
81 78
82static inline void 79static inline void
diff --git a/include/asm-i386/dwarf2.h b/include/asm-i386/dwarf2.h
new file mode 100644
index 0000000000..6d66398a30
--- /dev/null
+++ b/include/asm-i386/dwarf2.h
@@ -0,0 +1,61 @@
1#ifndef _DWARF2_H
2#define _DWARF2_H
3
4#ifndef __ASSEMBLY__
5#warning "asm/dwarf2.h should be only included in pure assembly files"
6#endif
7
8/*
9 Macros for dwarf2 CFI unwind table entries.
10 See "as.info" for details on these pseudo ops. Unfortunately
11 they are only supported in very new binutils, so define them
12 away for older version.
13 */
14
15#ifdef CONFIG_UNWIND_INFO
16
17#define CFI_STARTPROC .cfi_startproc
18#define CFI_ENDPROC .cfi_endproc
19#define CFI_DEF_CFA .cfi_def_cfa
20#define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register
21#define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset
22#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
23#define CFI_OFFSET .cfi_offset
24#define CFI_REL_OFFSET .cfi_rel_offset
25#define CFI_REGISTER .cfi_register
26#define CFI_RESTORE .cfi_restore
27#define CFI_REMEMBER_STATE .cfi_remember_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
36
37#else
38
39/* Due to the structure of pre-exisiting code, don't use assembler line
40 comment character # to ignore the arguments. Instead, use a dummy macro. */
41.macro ignore a=0, b=0, c=0, d=0
42.endm
43
44#define CFI_STARTPROC ignore
45#define CFI_ENDPROC ignore
46#define CFI_DEF_CFA ignore
47#define CFI_DEF_CFA_REGISTER ignore
48#define CFI_DEF_CFA_OFFSET ignore
49#define CFI_ADJUST_CFA_OFFSET ignore
50#define CFI_OFFSET ignore
51#define CFI_REL_OFFSET ignore
52#define CFI_REGISTER ignore
53#define CFI_RESTORE ignore
54#define CFI_REMEMBER_STATE ignore
55#define CFI_RESTORE_STATE ignore
56#define CFI_UNDEFINED ignore
57#define CFI_SIGNAL_FRAME ignore
58
59#endif
60
61#endif
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index ca82acb8cb..f7514fb6e8 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 4153d80e4d..db4344d9f7 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -7,8 +7,6 @@
7 7
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <asm/user.h> 9#include <asm/user.h>
10#include <asm/processor.h>
11#include <asm/system.h> /* for savesegment */
12#include <asm/auxvec.h> 10#include <asm/auxvec.h>
13 11
14#include <linux/utsname.h> 12#include <linux/utsname.h>
@@ -47,6 +45,12 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
47#define ELF_DATA ELFDATA2LSB 45#define ELF_DATA ELFDATA2LSB
48#define ELF_ARCH EM_386 46#define ELF_ARCH EM_386
49 47
48#ifdef __KERNEL__
49
50#include <asm/processor.h>
51#include <asm/system.h> /* for savesegment */
52#include <asm/desc.h>
53
50/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx 54/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
51 contains a pointer to a function which might be registered using `atexit'. 55 contains a pointer to a function which might be registered using `atexit'.
52 This provides a mean for the dynamic linker to call DT_FINI functions for 56 This provides a mean for the dynamic linker to call DT_FINI functions for
@@ -110,7 +114,6 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
110 114
111#define ELF_PLATFORM (system_utsname.machine) 115#define ELF_PLATFORM (system_utsname.machine)
112 116
113#ifdef __KERNEL__
114#define SET_PERSONALITY(ex, ibcs2) do { } while (0) 117#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
115 118
116/* 119/*
@@ -129,15 +132,41 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct
129#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 132#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
130#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs) 133#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
131 134
132#define VSYSCALL_BASE (__fix_to_virt(FIX_VSYSCALL)) 135#define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO))
133#define VSYSCALL_EHDR ((const struct elfhdr *) VSYSCALL_BASE) 136#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
134#define VSYSCALL_ENTRY ((unsigned long) &__kernel_vsyscall) 137
138#ifdef CONFIG_COMPAT_VDSO
139# define VDSO_COMPAT_BASE VDSO_HIGH_BASE
140# define VDSO_PRELINK VDSO_HIGH_BASE
141#else
142# define VDSO_COMPAT_BASE VDSO_BASE
143# define VDSO_PRELINK 0
144#endif
145
146#define VDSO_COMPAT_SYM(x) \
147 (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK)
148
149#define VDSO_SYM(x) \
150 (VDSO_BASE + (unsigned long)(x) - VDSO_PRELINK)
151
152#define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE)
153#define VDSO_EHDR ((const struct elfhdr *) VDSO_COMPAT_BASE)
154
135extern void __kernel_vsyscall; 155extern void __kernel_vsyscall;
136 156
157#define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall)
158
159#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
160struct linux_binprm;
161extern int arch_setup_additional_pages(struct linux_binprm *bprm,
162 int executable_stack);
163
164extern unsigned int vdso_enabled;
165
137#define ARCH_DLINFO \ 166#define ARCH_DLINFO \
138do { \ 167do if (vdso_enabled) { \
139 NEW_AUX_ENT(AT_SYSINFO, VSYSCALL_ENTRY); \ 168 NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \
140 NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE); \ 169 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \
141} while (0) 170} while (0)
142 171
143/* 172/*
@@ -148,15 +177,15 @@ do { \
148 * Dumping its extra ELF program headers includes all the other information 177 * Dumping its extra ELF program headers includes all the other information
149 * a debugger needs to easily find how the vsyscall DSO was being used. 178 * a debugger needs to easily find how the vsyscall DSO was being used.
150 */ 179 */
151#define ELF_CORE_EXTRA_PHDRS (VSYSCALL_EHDR->e_phnum) 180#define ELF_CORE_EXTRA_PHDRS (VDSO_HIGH_EHDR->e_phnum)
152#define ELF_CORE_WRITE_EXTRA_PHDRS \ 181#define ELF_CORE_WRITE_EXTRA_PHDRS \
153do { \ 182do { \
154 const struct elf_phdr *const vsyscall_phdrs = \ 183 const struct elf_phdr *const vsyscall_phdrs = \
155 (const struct elf_phdr *) (VSYSCALL_BASE \ 184 (const struct elf_phdr *) (VDSO_HIGH_BASE \
156 + VSYSCALL_EHDR->e_phoff); \ 185 + VDSO_HIGH_EHDR->e_phoff); \
157 int i; \ 186 int i; \
158 Elf32_Off ofs = 0; \ 187 Elf32_Off ofs = 0; \
159 for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \ 188 for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) { \
160 struct elf_phdr phdr = vsyscall_phdrs[i]; \ 189 struct elf_phdr phdr = vsyscall_phdrs[i]; \
161 if (phdr.p_type == PT_LOAD) { \ 190 if (phdr.p_type == PT_LOAD) { \
162 BUG_ON(ofs != 0); \ 191 BUG_ON(ofs != 0); \
@@ -174,10 +203,10 @@ do { \
174#define ELF_CORE_WRITE_EXTRA_DATA \ 203#define ELF_CORE_WRITE_EXTRA_DATA \
175do { \ 204do { \
176 const struct elf_phdr *const vsyscall_phdrs = \ 205 const struct elf_phdr *const vsyscall_phdrs = \
177 (const struct elf_phdr *) (VSYSCALL_BASE \ 206 (const struct elf_phdr *) (VDSO_HIGH_BASE \
178 + VSYSCALL_EHDR->e_phoff); \ 207 + VDSO_HIGH_EHDR->e_phoff); \
179 int i; \ 208 int i; \
180 for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \ 209 for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) { \
181 if (vsyscall_phdrs[i].p_type == PT_LOAD) \ 210 if (vsyscall_phdrs[i].p_type == PT_LOAD) \
182 DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \ 211 DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \
183 PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \ 212 PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index f7e068f4d2..02428cb366 100644
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -19,7 +19,11 @@
19 * Leave one empty page between vmalloc'ed areas and 19 * Leave one empty page between vmalloc'ed areas and
20 * the start of the fixmap. 20 * the start of the fixmap.
21 */ 21 */
22#define __FIXADDR_TOP 0xfffff000 22#ifndef CONFIG_COMPAT_VDSO
23extern unsigned long __FIXADDR_TOP;
24#else
25#define __FIXADDR_TOP 0xfffff000
26#endif
23 27
24#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
25#include <linux/kernel.h> 29#include <linux/kernel.h>
@@ -51,7 +55,7 @@
51 */ 55 */
52enum fixed_addresses { 56enum fixed_addresses {
53 FIX_HOLE, 57 FIX_HOLE,
54 FIX_VSYSCALL, 58 FIX_VDSO,
55#ifdef CONFIG_X86_LOCAL_APIC 59#ifdef CONFIG_X86_LOCAL_APIC
56 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ 60 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
57#endif 61#endif
@@ -93,6 +97,7 @@ enum fixed_addresses {
93 97
94extern void __set_fixmap (enum fixed_addresses idx, 98extern void __set_fixmap (enum fixed_addresses idx,
95 unsigned long phys, pgprot_t flags); 99 unsigned long phys, pgprot_t flags);
100extern void reserve_top_address(unsigned long reserve);
96 101
97#define set_fixmap(idx, phys) \ 102#define set_fixmap(idx, phys) \
98 __set_fixmap(idx, phys, PAGE_KERNEL) 103 __set_fixmap(idx, phys, PAGE_KERNEL)
@@ -115,14 +120,6 @@ extern void __set_fixmap (enum fixed_addresses idx,
115#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 120#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
116#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) 121#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
117 122
118/*
119 * This is the range that is readable by user mode, and things
120 * acting like user mode such as get_user_pages.
121 */
122#define FIXADDR_USER_START (__fix_to_virt(FIX_VSYSCALL))
123#define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE)
124
125
126extern void __this_fixmap_does_not_exist(void); 123extern void __this_fixmap_does_not_exist(void);
127 124
128/* 125/*
diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h
index 03403045c1..359ead60b7 100644
--- a/include/asm-i386/floppy.h
+++ b/include/asm-i386/floppy.h
@@ -144,12 +144,11 @@ static int vdma_get_dma_residue(unsigned int dummy)
144static int fd_request_irq(void) 144static int fd_request_irq(void)
145{ 145{
146 if(can_use_virtual_dma) 146 if(can_use_virtual_dma)
147 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 147 return request_irq(FLOPPY_IRQ, floppy_hardint,
148 "floppy", NULL); 148 IRQF_DISABLED, "floppy", NULL);
149 else 149 else
150 return request_irq(FLOPPY_IRQ, floppy_interrupt, 150 return request_irq(FLOPPY_IRQ, floppy_interrupt,
151 SA_INTERRUPT|SA_SAMPLE_RANDOM, 151 IRQF_DISABLED, "floppy", NULL);
152 "floppy", NULL);
153 152
154} 153}
155 154
diff --git a/include/asm-i386/frame.i b/include/asm-i386/frame.i
new file mode 100644
index 0000000000..4d68ddce18
--- /dev/null
+++ b/include/asm-i386/frame.i
@@ -0,0 +1,24 @@
1#include <linux/config.h>
2#include <asm/dwarf2.h>
3
4/* The annotation hides the frame from the unwinder and makes it look
5 like a ordinary ebp save/restore. This avoids some special cases for
6 frame pointer later */
7#ifdef CONFIG_FRAME_POINTER
8 .macro FRAME
9 pushl %ebp
10 CFI_ADJUST_CFA_OFFSET 4
11 CFI_REL_OFFSET ebp,0
12 movl %esp,%ebp
13 .endm
14 .macro ENDFRAME
15 popl %ebp
16 CFI_ADJUST_CFA_OFFSET -4
17 CFI_RESTORE ebp
18 .endm
19#else
20 .macro FRAME
21 .endm
22 .macro ENDFRAME
23 .endm
24#endif
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
index 7b8ceefd01..946d97cfea 100644
--- a/include/asm-i386/futex.h
+++ b/include/asm-i386/futex.h
@@ -20,8 +20,8 @@
20 .align 8\n\ 20 .align 8\n\
21 .long 1b,3b\n\ 21 .long 1b,3b\n\
22 .previous" \ 22 .previous" \
23 : "=r" (oldval), "=r" (ret), "=m" (*uaddr) \ 23 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
24 : "i" (-EFAULT), "m" (*uaddr), "0" (oparg), "1" (0)) 24 : "i" (-EFAULT), "0" (oparg), "1" (0))
25 25
26#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \ 26#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
27 __asm__ __volatile ( \ 27 __asm__ __volatile ( \
@@ -38,9 +38,9 @@
38 .align 8\n\ 38 .align 8\n\
39 .long 1b,4b,2b,4b\n\ 39 .long 1b,4b,2b,4b\n\
40 .previous" \ 40 .previous" \
41 : "=&a" (oldval), "=&r" (ret), "=m" (*uaddr), \ 41 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \
42 "=&r" (tem) \ 42 "=&r" (tem) \
43 : "r" (oparg), "i" (-EFAULT), "m" (*uaddr), "1" (0)) 43 : "r" (oparg), "i" (-EFAULT), "1" (0))
44 44
45static inline int 45static inline int
46futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 46futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
@@ -123,7 +123,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
123 " .long 1b,3b \n" 123 " .long 1b,3b \n"
124 " .previous \n" 124 " .previous \n"
125 125
126 : "=a" (oldval), "=m" (*uaddr) 126 : "=a" (oldval), "+m" (*uaddr)
127 : "i" (-EFAULT), "r" (newval), "0" (oldval) 127 : "i" (-EFAULT), "r" (newval), "0" (oldval)
128 : "memory" 128 : "memory"
129 ); 129 );
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h
index b3783a32ab..8ffbb0f074 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 95d3fd0902..87e5a351d8 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -19,6 +19,8 @@
19 19
20struct hw_interrupt_type; 20struct hw_interrupt_type;
21 21
22#define NMI_VECTOR 0x02
23
22/* 24/*
23 * Various low-level irq details needed by irq.c, process.c, 25 * Various low-level irq details needed by irq.c, process.c,
24 * time.c, io_apic.c and smp.c 26 * time.c, io_apic.c and smp.c
@@ -67,14 +69,4 @@ extern atomic_t irq_mis_count;
67 69
68#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) 70#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
69 71
70#if defined(CONFIG_X86_IO_APIC)
71static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
72{
73 if (IO_APIC_IRQ(i))
74 send_IPI_self(IO_APIC_VECTOR(i));
75}
76#else
77static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
78#endif
79
80#endif /* _ASM_HW_IRQ_H */ 72#endif /* _ASM_HW_IRQ_H */
diff --git a/include/asm-i386/intel_arch_perfmon.h b/include/asm-i386/intel_arch_perfmon.h
new file mode 100644
index 0000000000..b52cd60a07
--- /dev/null
+++ b/include/asm-i386/intel_arch_perfmon.h
@@ -0,0 +1,31 @@
1#ifndef X86_INTEL_ARCH_PERFMON_H
2#define X86_INTEL_ARCH_PERFMON_H 1
3
4#define MSR_ARCH_PERFMON_PERFCTR0 0xc1
5#define MSR_ARCH_PERFMON_PERFCTR1 0xc2
6
7#define MSR_ARCH_PERFMON_EVENTSEL0 0x186
8#define MSR_ARCH_PERFMON_EVENTSEL1 0x187
9
10#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22)
11#define ARCH_PERFMON_EVENTSEL_INT (1 << 20)
12#define ARCH_PERFMON_EVENTSEL_OS (1 << 17)
13#define ARCH_PERFMON_EVENTSEL_USR (1 << 16)
14
15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c)
16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
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};
30
31#endif /* X86_INTEL_ARCH_PERFMON_H */
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 5092e819b8..5d309275a1 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -188,6 +188,16 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
188/* 1 if "noapic" boot option passed */ 188/* 1 if "noapic" boot option passed */
189extern int skip_ioapic_setup; 189extern int skip_ioapic_setup;
190 190
191static inline void disable_ioapic_setup(void)
192{
193 skip_ioapic_setup = 1;
194}
195
196static inline int ioapic_setup_disabled(void)
197{
198 return skip_ioapic_setup;
199}
200
191/* 201/*
192 * If we use the IO-APIC for IRQ routing, disable automatic 202 * If we use the IO-APIC for IRQ routing, disable automatic
193 * assignment of PCI IRQ's. 203 * assignment of PCI IRQ's.
@@ -206,6 +216,7 @@ extern int (*ioapic_renumber_irq)(int ioapic, int irq);
206 216
207#else /* !CONFIG_X86_IO_APIC */ 217#else /* !CONFIG_X86_IO_APIC */
208#define io_apic_assign_pci_irqs 0 218#define io_apic_assign_pci_irqs 0
219static inline void disable_ioapic_setup(void) { }
209#endif 220#endif
210 221
211extern int assign_irq_vector(int irq); 222extern int assign_irq_vector(int irq);
diff --git a/include/asm-i386/irqflags.h b/include/asm-i386/irqflags.h
new file mode 100644
index 0000000000..e1bdb97c07
--- /dev/null
+++ b/include/asm-i386/irqflags.h
@@ -0,0 +1,127 @@
1/*
2 * include/asm-i386/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14
15static inline unsigned long __raw_local_save_flags(void)
16{
17 unsigned long flags;
18
19 __asm__ __volatile__(
20 "pushfl ; popl %0"
21 : "=g" (flags)
22 : /* no input */
23 );
24
25 return flags;
26}
27
28#define raw_local_save_flags(flags) \
29 do { (flags) = __raw_local_save_flags(); } while (0)
30
31static inline void raw_local_irq_restore(unsigned long flags)
32{
33 __asm__ __volatile__(
34 "pushl %0 ; popfl"
35 : /* no output */
36 :"g" (flags)
37 :"memory", "cc"
38 );
39}
40
41static inline void raw_local_irq_disable(void)
42{
43 __asm__ __volatile__("cli" : : : "memory");
44}
45
46static inline void raw_local_irq_enable(void)
47{
48 __asm__ __volatile__("sti" : : : "memory");
49}
50
51/*
52 * Used in the idle loop; sti takes one instruction cycle
53 * to complete:
54 */
55static inline void raw_safe_halt(void)
56{
57 __asm__ __volatile__("sti; hlt" : : : "memory");
58}
59
60/*
61 * Used when interrupts are already enabled or to
62 * shutdown the processor:
63 */
64static inline void halt(void)
65{
66 __asm__ __volatile__("hlt": : :"memory");
67}
68
69static inline int raw_irqs_disabled_flags(unsigned long flags)
70{
71 return !(flags & (1 << 9));
72}
73
74static inline int raw_irqs_disabled(void)
75{
76 unsigned long flags = __raw_local_save_flags();
77
78 return raw_irqs_disabled_flags(flags);
79}
80
81/*
82 * For spinlocks, etc:
83 */
84static inline unsigned long __raw_local_irq_save(void)
85{
86 unsigned long flags = __raw_local_save_flags();
87
88 raw_local_irq_disable();
89
90 return flags;
91}
92
93#define raw_local_irq_save(flags) \
94 do { (flags) = __raw_local_irq_save(); } while (0)
95
96#endif /* __ASSEMBLY__ */
97
98/*
99 * Do the CPU's IRQ-state tracing from assembly code. We call a
100 * C function, so save all the C-clobbered registers:
101 */
102#ifdef CONFIG_TRACE_IRQFLAGS
103
104# define TRACE_IRQS_ON \
105 pushl %eax; \
106 pushl %ecx; \
107 pushl %edx; \
108 call trace_hardirqs_on; \
109 popl %edx; \
110 popl %ecx; \
111 popl %eax;
112
113# define TRACE_IRQS_OFF \
114 pushl %eax; \
115 pushl %ecx; \
116 pushl %edx; \
117 call trace_hardirqs_off; \
118 popl %edx; \
119 popl %ecx; \
120 popl %eax;
121
122#else
123# define TRACE_IRQS_ON
124# define TRACE_IRQS_OFF
125#endif
126
127#endif
diff --git a/include/asm-i386/k8.h b/include/asm-i386/k8.h
new file mode 100644
index 0000000000..dfd88a6e60
--- /dev/null
+++ b/include/asm-i386/k8.h
@@ -0,0 +1 @@
#include <asm-x86_64/k8.h>
diff --git a/include/asm-i386/kdebug.h b/include/asm-i386/kdebug.h
index 96d0828ce0..d18cdb9fc9 100644
--- a/include/asm-i386/kdebug.h
+++ b/include/asm-i386/kdebug.h
@@ -19,6 +19,8 @@ struct die_args {
19 19
20extern int register_die_notifier(struct notifier_block *); 20extern int register_die_notifier(struct notifier_block *);
21extern int unregister_die_notifier(struct notifier_block *); 21extern int unregister_die_notifier(struct notifier_block *);
22extern int register_page_fault_notifier(struct notifier_block *);
23extern int unregister_page_fault_notifier(struct notifier_block *);
22extern struct atomic_notifier_head i386die_chain; 24extern struct atomic_notifier_head i386die_chain;
23 25
24 26
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h
index 53f0e06672..4dfc9f5ed0 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/kprobes.h b/include/asm-i386/kprobes.h
index 57d157c5cf..8774d06689 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -44,6 +44,8 @@ typedef u8 kprobe_opcode_t;
44 44
45#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 45#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
46#define ARCH_SUPPORTS_KRETPROBES 46#define ARCH_SUPPORTS_KRETPROBES
47#define ARCH_INACTIVE_KPROBE_COUNT 0
48#define flush_insn_slot(p) do { } while (0)
47 49
48void arch_remove_kprobe(struct kprobe *p); 50void arch_remove_kprobe(struct kprobe *p);
49void kretprobe_trampoline(void); 51void kretprobe_trampoline(void);
diff --git a/include/asm-i386/local.h b/include/asm-i386/local.h
index e67fa08260..12060e22f7 100644
--- a/include/asm-i386/local.h
+++ b/include/asm-i386/local.h
@@ -17,32 +17,30 @@ static __inline__ void local_inc(local_t *v)
17{ 17{
18 __asm__ __volatile__( 18 __asm__ __volatile__(
19 "incl %0" 19 "incl %0"
20 :"=m" (v->counter) 20 :"+m" (v->counter));
21 :"m" (v->counter));
22} 21}
23 22
24static __inline__ void local_dec(local_t *v) 23static __inline__ void local_dec(local_t *v)
25{ 24{
26 __asm__ __volatile__( 25 __asm__ __volatile__(
27 "decl %0" 26 "decl %0"
28 :"=m" (v->counter) 27 :"+m" (v->counter));
29 :"m" (v->counter));
30} 28}
31 29
32static __inline__ void local_add(long i, local_t *v) 30static __inline__ void local_add(long i, local_t *v)
33{ 31{
34 __asm__ __volatile__( 32 __asm__ __volatile__(
35 "addl %1,%0" 33 "addl %1,%0"
36 :"=m" (v->counter) 34 :"+m" (v->counter)
37 :"ir" (i), "m" (v->counter)); 35 :"ir" (i));
38} 36}
39 37
40static __inline__ void local_sub(long i, local_t *v) 38static __inline__ void local_sub(long i, local_t *v)
41{ 39{
42 __asm__ __volatile__( 40 __asm__ __volatile__(
43 "subl %1,%0" 41 "subl %1,%0"
44 :"=m" (v->counter) 42 :"+m" (v->counter)
45 :"ir" (i), "m" (v->counter)); 43 :"ir" (i));
46} 44}
47 45
48/* On x86, these are no better than the atomic variants. */ 46/* On x86, these are no better than the atomic variants. */
@@ -55,12 +53,26 @@ static __inline__ void local_sub(long i, local_t *v)
55 * much more efficient than these naive implementations. Note they take 53 * much more efficient than these naive implementations. Note they take
56 * a variable, not an address. 54 * a variable, not an address.
57 */ 55 */
58#define cpu_local_read(v) local_read(&__get_cpu_var(v)) 56
59#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i)) 57/* Need to disable preemption for the cpu local counters otherwise we could
60#define cpu_local_inc(v) local_inc(&__get_cpu_var(v)) 58 still access a variable of a previous CPU in a non atomic way. */
61#define cpu_local_dec(v) local_dec(&__get_cpu_var(v)) 59#define cpu_local_wrap_v(v) \
62#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v)) 60 ({ local_t res__; \
63#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v)) 61 preempt_disable(); \
62 res__ = (v); \
63 preempt_enable(); \
64 res__; })
65#define cpu_local_wrap(v) \
66 ({ preempt_disable(); \
67 v; \
68 preempt_enable(); }) \
69
70#define cpu_local_read(v) cpu_local_wrap_v(local_read(&__get_cpu_var(v)))
71#define cpu_local_set(v, i) cpu_local_wrap(local_set(&__get_cpu_var(v), (i)))
72#define cpu_local_inc(v) cpu_local_wrap(local_inc(&__get_cpu_var(v)))
73#define cpu_local_dec(v) cpu_local_wrap(local_dec(&__get_cpu_var(v)))
74#define cpu_local_add(i, v) cpu_local_wrap(local_add((i), &__get_cpu_var(v)))
75#define cpu_local_sub(i, v) cpu_local_wrap(local_sub((i), &__get_cpu_var(v)))
64 76
65#define __cpu_local_inc(v) cpu_local_inc(v) 77#define __cpu_local_inc(v) cpu_local_inc(v)
66#define __cpu_local_dec(v) cpu_local_dec(v) 78#define __cpu_local_dec(v) cpu_local_dec(v)
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 6312c3e798..4182c347ef 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/mach_ipi.h b/include/asm-i386/mach-default/mach_ipi.h
index a1d0072e36..0dba244c86 100644
--- a/include/asm-i386/mach-default/mach_ipi.h
+++ b/include/asm-i386/mach-default/mach_ipi.h
@@ -1,6 +1,9 @@
1#ifndef __ASM_MACH_IPI_H 1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H 2#define __ASM_MACH_IPI_H
3 3
4/* Avoid include hell */
5#define NMI_VECTOR 0x02
6
4void send_IPI_mask_bitmask(cpumask_t mask, int vector); 7void send_IPI_mask_bitmask(cpumask_t mask, int vector);
5void __send_IPI_shortcut(unsigned int shortcut, int vector); 8void __send_IPI_shortcut(unsigned int shortcut, int vector);
6 9
@@ -13,7 +16,7 @@ static inline void send_IPI_mask(cpumask_t mask, int vector)
13 16
14static inline void __local_send_IPI_allbutself(int vector) 17static inline void __local_send_IPI_allbutself(int vector)
15{ 18{
16 if (no_broadcast) { 19 if (no_broadcast || vector == NMI_VECTOR) {
17 cpumask_t mask = cpu_online_map; 20 cpumask_t mask = cpu_online_map;
18 21
19 cpu_clear(smp_processor_id(), mask); 22 cpu_clear(smp_processor_id(), mask);
@@ -24,7 +27,7 @@ static inline void __local_send_IPI_allbutself(int vector)
24 27
25static inline void __local_send_IPI_all(int vector) 28static inline void __local_send_IPI_all(int vector)
26{ 29{
27 if (no_broadcast) 30 if (no_broadcast || vector == NMI_VECTOR)
28 send_IPI_mask(cpu_online_map, vector); 31 send_IPI_mask(cpu_online_map, vector);
29 else 32 else
30 __send_IPI_shortcut(APIC_DEST_ALLINC, vector); 33 __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
diff --git a/include/asm-i386/mach-default/mach_mpspec.h b/include/asm-i386/mach-default/mach_mpspec.h
index 6b5dadcf1d..51c9a97759 100644
--- a/include/asm-i386/mach-default/mach_mpspec.h
+++ b/include/asm-i386/mach-default/mach_mpspec.h
@@ -3,6 +3,10 @@
3 3
4#define MAX_IRQ_SOURCES 256 4#define MAX_IRQ_SOURCES 256
5 5
6#if CONFIG_BASE_SMALL == 0
7#define MAX_MP_BUSSES 256
8#else
6#define MAX_MP_BUSSES 32 9#define MAX_MP_BUSSES 32
10#endif
7 11
8#endif /* __ASM_MACH_MPSPEC_H */ 12#endif /* __ASM_MACH_MPSPEC_H */
diff --git a/include/asm-i386/mach-default/mach_timer.h b/include/asm-i386/mach-default/mach_timer.h
index 4b9703bb02..807992fd41 100644
--- a/include/asm-i386/mach-default/mach_timer.h
+++ b/include/asm-i386/mach-default/mach_timer.h
@@ -15,7 +15,9 @@
15#ifndef _MACH_TIMER_H 15#ifndef _MACH_TIMER_H
16#define _MACH_TIMER_H 16#define _MACH_TIMER_H
17 17
18#define CALIBRATE_LATCH (5 * LATCH) 18#define CALIBRATE_TIME_MSEC 30 /* 30 msecs */
19#define CALIBRATE_LATCH \
20 ((CLOCK_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
19 21
20static inline void mach_prepare_counter(void) 22static inline void mach_prepare_counter(void)
21{ 23{
diff --git a/include/asm-i386/mach-default/setup_arch_pre.h b/include/asm-i386/mach-default/setup_arch.h
index fb42099e7b..fb42099e7b 100644
--- a/include/asm-i386/mach-default/setup_arch_pre.h
+++ b/include/asm-i386/mach-default/setup_arch.h
diff --git a/include/asm-i386/mach-default/setup_arch_post.h b/include/asm-i386/mach-default/setup_arch_post.h
deleted file mode 100644
index 2fc4888721..0000000000
--- a/include/asm-i386/mach-default/setup_arch_post.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/**
2 * machine_specific_memory_setup - Hook for machine specific memory setup.
3 *
4 * Description:
5 * This is included late in kernel/setup.c so that it can make
6 * use of all of the static functions.
7 **/
8
9static char * __init machine_specific_memory_setup(void)
10{
11 char *who;
12
13
14 who = "BIOS-e820";
15
16 /*
17 * Try to copy the BIOS-supplied E820-map.
18 *
19 * Otherwise fake a memory map; one section from 0k->640k,
20 * the next section from 1mb->appropriate_mem_k
21 */
22 sanitize_e820_map(E820_MAP, &E820_MAP_NR);
23 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
24 unsigned long mem_size;
25
26 /* compare results from other methods and take the greater */
27 if (ALT_MEM_K < EXT_MEM_K) {
28 mem_size = EXT_MEM_K;
29 who = "BIOS-88";
30 } else {
31 mem_size = ALT_MEM_K;
32 who = "BIOS-e801";
33 }
34
35 e820.nr_map = 0;
36 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
37 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
38 }
39 return who;
40}
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h
index b5f3f0d0b2..26333685a7 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 9fd0732862..254a0fe01c 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[logical_apicid];
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-summit/mach_mpparse.h b/include/asm-i386/mach-summit/mach_mpparse.h
index 1cce2b924a..9426839917 100644
--- a/include/asm-i386/mach-summit/mach_mpparse.h
+++ b/include/asm-i386/mach-summit/mach_mpparse.h
@@ -2,6 +2,7 @@
2#define __ASM_MACH_MPPARSE_H 2#define __ASM_MACH_MPPARSE_H
3 3
4#include <mach_apic.h> 4#include <mach_apic.h>
5#include <asm/tsc.h>
5 6
6extern int use_cyclone; 7extern int use_cyclone;
7 8
@@ -29,6 +30,7 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
29 (!strncmp(productid, "VIGIL SMP", 9) 30 (!strncmp(productid, "VIGIL SMP", 9)
30 || !strncmp(productid, "EXA", 3) 31 || !strncmp(productid, "EXA", 3)
31 || !strncmp(productid, "RUTHLESS SMP", 12))){ 32 || !strncmp(productid, "RUTHLESS SMP", 12))){
33 mark_tsc_unstable();
32 use_cyclone = 1; /*enable cyclone-timer*/ 34 use_cyclone = 1; /*enable cyclone-timer*/
33 setup_summit(); 35 setup_summit();
34 return 1; 36 return 1;
@@ -42,6 +44,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
42 if (!strncmp(oem_id, "IBM", 3) && 44 if (!strncmp(oem_id, "IBM", 3) &&
43 (!strncmp(oem_table_id, "SERVIGIL", 8) 45 (!strncmp(oem_table_id, "SERVIGIL", 8)
44 || !strncmp(oem_table_id, "EXA", 3))){ 46 || !strncmp(oem_table_id, "EXA", 3))){
47 mark_tsc_unstable();
45 use_cyclone = 1; /*enable cyclone-timer*/ 48 use_cyclone = 1; /*enable cyclone-timer*/
46 setup_summit(); 49 setup_summit();
47 return 1; 50 return 1;
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 95568e6ca9..8db618c5a7 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-visws/setup_arch_pre.h b/include/asm-i386/mach-visws/setup_arch.h
index b92d6d9a4d..33f700ef68 100644
--- a/include/asm-i386/mach-visws/setup_arch_pre.h
+++ b/include/asm-i386/mach-visws/setup_arch.h
@@ -1,5 +1,8 @@
1/* Hook to call BIOS initialisation function */ 1/* Hook to call BIOS initialisation function */
2 2
3extern unsigned long sgivwfb_mem_phys;
4extern unsigned long sgivwfb_mem_size;
5
3/* no action for visws */ 6/* no action for visws */
4 7
5#define ARCH_SETUP 8#define ARCH_SETUP
diff --git a/include/asm-i386/mach-visws/setup_arch_post.h b/include/asm-i386/mach-visws/setup_arch_post.h
deleted file mode 100644
index cdbd895a54..0000000000
--- a/include/asm-i386/mach-visws/setup_arch_post.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/* Hook for machine specific memory setup.
2 *
3 * This is included late in kernel/setup.c so that it can make use of all of
4 * the static functions. */
5
6#define MB (1024 * 1024)
7
8unsigned long sgivwfb_mem_phys;
9unsigned long sgivwfb_mem_size;
10
11long long mem_size __initdata = 0;
12
13static char * __init machine_specific_memory_setup(void)
14{
15 long long gfx_mem_size = 8 * MB;
16
17 mem_size = ALT_MEM_K;
18
19 if (!mem_size) {
20 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
21 mem_size = 128 * MB;
22 }
23
24 /*
25 * this hardcodes the graphics memory to 8 MB
26 * it really should be sized dynamically (or at least
27 * set as a boot param)
28 */
29 if (!sgivwfb_mem_size) {
30 printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n");
31 sgivwfb_mem_size = 8 * MB;
32 }
33
34 /*
35 * Trim to nearest MB
36 */
37 sgivwfb_mem_size &= ~((1 << 20) - 1);
38 sgivwfb_mem_phys = mem_size - gfx_mem_size;
39
40 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
41 add_memory_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM);
42 add_memory_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED);
43
44 return "PROM";
45
46 /* Remove gcc warnings */
47 (void) sanitize_e820_map(NULL, NULL);
48 (void) copy_e820_map(NULL, 0);
49}
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index eaf5180989..099fe9f5c1 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/mach-voyager/setup_arch_pre.h b/include/asm-i386/mach-voyager/setup_arch.h
index 48f7e6ff49..84d01ad334 100644
--- a/include/asm-i386/mach-voyager/setup_arch_pre.h
+++ b/include/asm-i386/mach-voyager/setup_arch.h
@@ -3,7 +3,7 @@
3 3
4/* Hook to call BIOS initialisation function */ 4/* Hook to call BIOS initialisation function */
5 5
6/* for voyager, pass the voyager BIOS/SUS info area to the detection 6/* for voyager, pass the voyager BIOS/SUS info area to the detection
7 * routines */ 7 * routines */
8 8
9#define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO); 9#define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO);
diff --git a/include/asm-i386/mach-voyager/setup_arch_post.h b/include/asm-i386/mach-voyager/setup_arch_post.h
deleted file mode 100644
index f6f6c2cbc7..0000000000
--- a/include/asm-i386/mach-voyager/setup_arch_post.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* Hook for machine specific memory setup.
2 *
3 * This is included late in kernel/setup.c so that it can make use of all of
4 * the static functions. */
5
6static char * __init machine_specific_memory_setup(void)
7{
8 char *who;
9
10 who = "NOT VOYAGER";
11
12 if(voyager_level == 5) {
13 __u32 addr, length;
14 int i;
15
16 who = "Voyager-SUS";
17
18 e820.nr_map = 0;
19 for(i=0; voyager_memory_detect(i, &addr, &length); i++) {
20 add_memory_region(addr, length, E820_RAM);
21 }
22 return who;
23 } else if(voyager_level == 4) {
24 __u32 tom;
25 __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8;
26 /* select the DINO config space */
27 outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
28 /* Read DINO top of memory register */
29 tom = ((inb(catbase + 0x4) & 0xf0) << 16)
30 + ((inb(catbase + 0x5) & 0x7f) << 24);
31
32 if(inb(catbase) != VOYAGER_DINO) {
33 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
34 tom = (EXT_MEM_K)<<10;
35 }
36 who = "Voyager-TOM";
37 add_memory_region(0, 0x9f000, E820_RAM);
38 /* map from 1M to top of memory */
39 add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM);
40 /* FIXME: Should check the ASICs to see if I need to
41 * take out the 8M window. Just do it at the moment
42 * */
43 add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED);
44 return who;
45 }
46
47 who = "BIOS-e820";
48
49 /*
50 * Try to copy the BIOS-supplied E820-map.
51 *
52 * Otherwise fake a memory map; one section from 0k->640k,
53 * the next section from 1mb->appropriate_mem_k
54 */
55 sanitize_e820_map(E820_MAP, &E820_MAP_NR);
56 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
57 unsigned long mem_size;
58
59 /* compare results from other methods and take the greater */
60 if (ALT_MEM_K < EXT_MEM_K) {
61 mem_size = EXT_MEM_K;
62 who = "BIOS-88";
63 } else {
64 mem_size = ALT_MEM_K;
65 who = "BIOS-e801";
66 }
67
68 e820.nr_map = 0;
69 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
70 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
71 }
72 return who;
73}
diff --git a/include/asm-i386/mmu.h b/include/asm-i386/mmu.h
index f431a0b86d..8358dd3df7 100644
--- a/include/asm-i386/mmu.h
+++ b/include/asm-i386/mmu.h
@@ -12,6 +12,7 @@ typedef struct {
12 int size; 12 int size;
13 struct semaphore sem; 13 struct semaphore sem;
14 void *ldt; 14 void *ldt;
15 void *vdso;
15} mm_context_t; 16} mm_context_t;
16 17
17#endif 18#endif
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index e33e9f9e4c..61b0733220 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -14,7 +14,7 @@ extern struct pglist_data *node_data[];
14 14
15#ifdef CONFIG_X86_NUMAQ 15#ifdef CONFIG_X86_NUMAQ
16 #include <asm/numaq.h> 16 #include <asm/numaq.h>
17#else /* summit or generic arch */ 17#elif defined(CONFIG_ACPI_SRAT)/* summit or generic arch */
18 #include <asm/srat.h> 18 #include <asm/srat.h>
19#endif 19#endif
20 20
@@ -38,10 +38,16 @@ static inline void get_memcfg_numa(void)
38} 38}
39 39
40extern int early_pfn_to_nid(unsigned long pfn); 40extern int early_pfn_to_nid(unsigned long pfn);
41extern void numa_kva_reserve(void);
41 42
42#else /* !CONFIG_NUMA */ 43#else /* !CONFIG_NUMA */
44
43#define get_memcfg_numa get_memcfg_numa_flat 45#define get_memcfg_numa get_memcfg_numa_flat
44#define get_zholes_size(n) (0) 46#define get_zholes_size(n) (0)
47
48static inline void numa_kva_reserve(void)
49{
50}
45#endif /* CONFIG_NUMA */ 51#endif /* CONFIG_NUMA */
46 52
47#ifdef CONFIG_DISCONTIGMEM 53#ifdef CONFIG_DISCONTIGMEM
diff --git a/include/asm-i386/mutex.h b/include/asm-i386/mutex.h
index 05a5385312..7a17d9e58a 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 21f16638fc..269d315719 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -5,24 +5,41 @@
5#define ASM_NMI_H 5#define ASM_NMI_H
6 6
7#include <linux/pm.h> 7#include <linux/pm.h>
8 8
9struct pt_regs; 9/**
10 10 * do_nmi_callback
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/**
22 * unset_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
17extern int nmi_watchdog_enabled;
18extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
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 *);
27extern void disable_timer_nmi_watchdog(void);
28extern void enable_timer_nmi_watchdog(void);
29extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
30
31extern atomic_t nmi_active;
32extern unsigned int nmi_watchdog;
33#define NMI_DEFAULT -1
34#define NMI_NONE 0
35#define NMI_IO_APIC 1
36#define NMI_LOCAL_APIC 2
37#define NMI_INVALID 3
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
28#endif /* ASM_NMI_H */ 45#endif /* ASM_NMI_H */
diff --git a/include/asm-i386/node.h b/include/asm-i386/node.h
deleted file mode 100644
index e13c6ffa72..0000000000
--- a/include/asm-i386/node.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_I386_NODE_H_
2#define _ASM_I386_NODE_H_
3
4#include <linux/device.h>
5#include <linux/mmzone.h>
6#include <linux/node.h>
7#include <linux/topology.h>
8#include <linux/nodemask.h>
9
10struct i386_node {
11 struct node node;
12};
13extern struct i386_node node_devices[MAX_NUMNODES];
14
15static inline int arch_register_node(int num){
16 int p_node;
17 struct node *parent = NULL;
18
19 if (!node_online(num))
20 return 0;
21 p_node = parent_node(num);
22
23 if (p_node != num)
24 parent = &node_devices[p_node].node;
25
26 return register_node(&node_devices[num].node, num, parent);
27}
28
29#endif /* _ASM_I386_NODE_H_ */
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index e3a552fa55..f5bf544c72 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -96,6 +96,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
96 96
97#ifndef __ASSEMBLY__ 97#ifndef __ASSEMBLY__
98 98
99struct vm_area_struct;
100
99/* 101/*
100 * This much address space is reserved for vmalloc() and iomap() 102 * This much address space is reserved for vmalloc() and iomap()
101 * as well as fixmap mappings. 103 * as well as fixmap mappings.
@@ -139,6 +141,7 @@ extern int page_is_ram(unsigned long pagenr);
139#include <asm-generic/memory_model.h> 141#include <asm-generic/memory_model.h>
140#include <asm-generic/page.h> 142#include <asm-generic/page.h>
141 143
144#define __HAVE_ARCH_GATE_AREA 1
142#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */
143 146
144#endif /* _I386_PAGE_H */ 147#endif /* _I386_PAGE_H */
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index 2756d4b04c..201c86a671 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -21,8 +21,9 @@
21#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 21#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
22#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 22#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
23 23
24#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
24#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte_low, 0)) 25#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte_low, 0))
25#define pte_same(a, b) ((a).pte_low == (b).pte_low) 26
26#define pte_page(x) pfn_to_page(pte_pfn(x)) 27#define pte_page(x) pfn_to_page(pte_pfn(x))
27#define pte_none(x) (!(x).pte_low) 28#define pte_none(x) (!(x).pte_low)
28#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) 29#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT)))
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index dccb1b3337..0d89917323 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -77,7 +77,7 @@ static inline void pud_clear (pud_t * pud) { }
77#define pud_page(pud) \ 77#define pud_page(pud) \
78((struct page *) __va(pud_val(pud) & PAGE_MASK)) 78((struct page *) __va(pud_val(pud) & PAGE_MASK))
79 79
80#define pud_page_kernel(pud) \ 80#define pud_page_vaddr(pud) \
81((unsigned long) __va(pud_val(pud) & PAGE_MASK)) 81((unsigned long) __va(pud_val(pud) & PAGE_MASK))
82 82
83 83
@@ -105,6 +105,7 @@ static inline void pmd_clear(pmd_t *pmd)
105 *(tmp + 1) = 0; 105 *(tmp + 1) = 0;
106} 106}
107 107
108#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
108static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 109static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
109{ 110{
110 pte_t res; 111 pte_t res;
@@ -117,6 +118,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
117 return res; 118 return res;
118} 119}
119 120
121#define __HAVE_ARCH_PTE_SAME
120static inline int pte_same(pte_t a, pte_t b) 122static inline int pte_same(pte_t a, pte_t b)
121{ 123{
122 return a.pte_low == b.pte_low && a.pte_high == b.pte_high; 124 return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 09697fec3d..541b3e2343 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -246,6 +246,23 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
246# include <asm/pgtable-2level.h> 246# include <asm/pgtable-2level.h>
247#endif 247#endif
248 248
249/*
250 * We only update the dirty/accessed state if we set
251 * 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
253 * race with other CPU's that might be updating the dirty
254 * bit at the same time.
255 */
256#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
257#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \
258do { \
259 if (dirty) { \
260 (ptep)->pte_low = (entry).pte_low; \
261 flush_tlb_page(vma, address); \
262 } \
263} while (0)
264
265#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
249static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 266static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
250{ 267{
251 if (!pte_dirty(*ptep)) 268 if (!pte_dirty(*ptep))
@@ -253,6 +270,7 @@ static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned
253 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); 270 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low);
254} 271}
255 272
273#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
256static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 274static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
257{ 275{
258 if (!pte_young(*ptep)) 276 if (!pte_young(*ptep))
@@ -260,6 +278,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned
260 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); 278 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low);
261} 279}
262 280
281#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
263static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) 282static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
264{ 283{
265 pte_t pte; 284 pte_t pte;
@@ -272,6 +291,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
272 return pte; 291 return pte;
273} 292}
274 293
294#define __HAVE_ARCH_PTEP_SET_WRPROTECT
275static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 295static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
276{ 296{
277 clear_bit(_PAGE_BIT_RW, &ptep->pte_low); 297 clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
@@ -364,11 +384,11 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
364#define pte_index(address) \ 384#define pte_index(address) \
365 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 385 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
366#define pte_offset_kernel(dir, address) \ 386#define pte_offset_kernel(dir, address) \
367 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) 387 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
368 388
369#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 389#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
370 390
371#define pmd_page_kernel(pmd) \ 391#define pmd_page_vaddr(pmd) \
372 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 392 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
373 393
374/* 394/*
@@ -391,8 +411,6 @@ extern pte_t *lookup_address(unsigned long address);
391 static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} 411 static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;}
392#endif 412#endif
393 413
394extern void noexec_setup(const char *str);
395
396#if defined(CONFIG_HIGHPTE) 414#if defined(CONFIG_HIGHPTE)
397#define pte_offset_map(dir, address) \ 415#define pte_offset_map(dir, address) \
398 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) 416 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
@@ -411,23 +429,8 @@ extern void noexec_setup(const char *str);
411/* 429/*
412 * The i386 doesn't have any external MMU info: the kernel page 430 * The i386 doesn't have any external MMU info: the kernel page
413 * tables contain all the necessary information. 431 * tables contain all the necessary information.
414 *
415 * Also, we only update the dirty/accessed state if we set
416 * the dirty bit by hand in the kernel, since the hardware
417 * will do the accessed bit for us, and we don't want to
418 * race with other CPU's that might be updating the dirty
419 * bit at the same time.
420 */ 432 */
421#define update_mmu_cache(vma,address,pte) do { } while (0) 433#define update_mmu_cache(vma,address,pte) do { } while (0)
422#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
423#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
424 do { \
425 if (__dirty) { \
426 (__ptep)->pte_low = (__entry).pte_low; \
427 flush_tlb_page(__vma, __address); \
428 } \
429 } while (0)
430
431#endif /* !__ASSEMBLY__ */ 434#endif /* !__ASSEMBLY__ */
432 435
433#ifdef CONFIG_FLATMEM 436#ifdef CONFIG_FLATMEM
@@ -441,12 +444,6 @@ extern void noexec_setup(const char *str);
441#define GET_IOSPACE(pfn) 0 444#define GET_IOSPACE(pfn) 0
442#define GET_PFN(pfn) (pfn) 445#define GET_PFN(pfn) (pfn)
443 446
444#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
445#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
446#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
447#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
448#define __HAVE_ARCH_PTEP_SET_WRPROTECT
449#define __HAVE_ARCH_PTE_SAME
450#include <asm-generic/pgtable.h> 447#include <asm-generic/pgtable.h>
451 448
452#endif /* _I386_PGTABLE_H */ 449#endif /* _I386_PGTABLE_H */
diff --git a/include/asm-i386/posix_types.h b/include/asm-i386/posix_types.h
index 4e47ed059a..133e31e7df 100644
--- a/include/asm-i386/posix_types.h
+++ b/include/asm-i386/posix_types.h
@@ -51,12 +51,12 @@ typedef struct {
51#undef __FD_SET 51#undef __FD_SET
52#define __FD_SET(fd,fdsetp) \ 52#define __FD_SET(fd,fdsetp) \
53 __asm__ __volatile__("btsl %1,%0": \ 53 __asm__ __volatile__("btsl %1,%0": \
54 "=m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd))) 54 "+m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd)))
55 55
56#undef __FD_CLR 56#undef __FD_CLR
57#define __FD_CLR(fd,fdsetp) \ 57#define __FD_CLR(fd,fdsetp) \
58 __asm__ __volatile__("btrl %1,%0": \ 58 __asm__ __volatile__("btrl %1,%0": \
59 "=m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd))) 59 "+m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd)))
60 60
61#undef __FD_ISSET 61#undef __FD_ISSET
62#define __FD_ISSET(fd,fdsetp) (__extension__ ({ \ 62#define __FD_ISSET(fd,fdsetp) (__extension__ ({ \
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 0c83cf12ee..2277127696 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -71,8 +71,12 @@ struct cpuinfo_x86 {
71 cpumask_t llc_shared_map; /* cpus sharing the last level cache */ 71 cpumask_t llc_shared_map; /* cpus sharing the last level cache */
72#endif 72#endif
73 unsigned char x86_max_cores; /* cpuid returned max cores value */ 73 unsigned char x86_max_cores; /* cpuid returned max cores value */
74 unsigned char booted_cores; /* number of cores as seen by OS */
75 unsigned char apicid; 74 unsigned char apicid;
75#ifdef CONFIG_SMP
76 unsigned char booted_cores; /* number of cores as seen by OS */
77 __u8 phys_proc_id; /* Physical processor id. */
78 __u8 cpu_core_id; /* Core id */
79#endif
76} __attribute__((__aligned__(SMP_CACHE_BYTES))); 80} __attribute__((__aligned__(SMP_CACHE_BYTES)));
77 81
78#define X86_VENDOR_INTEL 0 82#define X86_VENDOR_INTEL 0
@@ -104,14 +108,13 @@ extern struct cpuinfo_x86 cpu_data[];
104#define current_cpu_data boot_cpu_data 108#define current_cpu_data boot_cpu_data
105#endif 109#endif
106 110
107extern int phys_proc_id[NR_CPUS];
108extern int cpu_core_id[NR_CPUS];
109extern int cpu_llc_id[NR_CPUS]; 111extern int cpu_llc_id[NR_CPUS];
110extern char ignore_fpu_irq; 112extern char ignore_fpu_irq;
111 113
112extern void identify_cpu(struct cpuinfo_x86 *); 114extern void identify_cpu(struct cpuinfo_x86 *);
113extern void print_cpu_info(struct cpuinfo_x86 *); 115extern void print_cpu_info(struct cpuinfo_x86 *);
114extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 116extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
117extern unsigned short num_cache_leaves;
115 118
116#ifdef CONFIG_X86_HT 119#ifdef CONFIG_X86_HT
117extern void detect_ht(struct cpuinfo_x86 *c); 120extern void detect_ht(struct cpuinfo_x86 *c);
@@ -140,6 +143,18 @@ static inline void detect_ht(struct cpuinfo_x86 *c) {}
140#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ 143#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
141#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ 144#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
142 145
146static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
147 unsigned int *ecx, unsigned int *edx)
148{
149 /* ecx is often an input as well as an output. */
150 __asm__("cpuid"
151 : "=a" (*eax),
152 "=b" (*ebx),
153 "=c" (*ecx),
154 "=d" (*edx)
155 : "0" (*eax), "2" (*ecx));
156}
157
143/* 158/*
144 * Generic CPUID function 159 * Generic CPUID function
145 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx 160 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
@@ -147,24 +162,18 @@ static inline void detect_ht(struct cpuinfo_x86 *c) {}
147 */ 162 */
148static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) 163static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
149{ 164{
150 __asm__("cpuid" 165 *eax = op;
151 : "=a" (*eax), 166 *ecx = 0;
152 "=b" (*ebx), 167 __cpuid(eax, ebx, ecx, edx);
153 "=c" (*ecx),
154 "=d" (*edx)
155 : "0" (op), "c"(0));
156} 168}
157 169
158/* Some CPUID calls want 'count' to be placed in ecx */ 170/* Some CPUID calls want 'count' to be placed in ecx */
159static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, 171static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
160 int *edx) 172 int *edx)
161{ 173{
162 __asm__("cpuid" 174 *eax = op;
163 : "=a" (*eax), 175 *ecx = count;
164 "=b" (*ebx), 176 __cpuid(eax, ebx, ecx, edx);
165 "=c" (*ecx),
166 "=d" (*edx)
167 : "0" (op), "c" (count));
168} 177}
169 178
170/* 179/*
@@ -172,42 +181,30 @@ static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
172 */ 181 */
173static inline unsigned int cpuid_eax(unsigned int op) 182static inline unsigned int cpuid_eax(unsigned int op)
174{ 183{
175 unsigned int eax; 184 unsigned int eax, ebx, ecx, edx;
176 185
177 __asm__("cpuid" 186 cpuid(op, &eax, &ebx, &ecx, &edx);
178 : "=a" (eax)
179 : "0" (op)
180 : "bx", "cx", "dx");
181 return eax; 187 return eax;
182} 188}
183static inline unsigned int cpuid_ebx(unsigned int op) 189static inline unsigned int cpuid_ebx(unsigned int op)
184{ 190{
185 unsigned int eax, ebx; 191 unsigned int eax, ebx, ecx, edx;
186 192
187 __asm__("cpuid" 193 cpuid(op, &eax, &ebx, &ecx, &edx);
188 : "=a" (eax), "=b" (ebx)
189 : "0" (op)
190 : "cx", "dx" );
191 return ebx; 194 return ebx;
192} 195}
193static inline unsigned int cpuid_ecx(unsigned int op) 196static inline unsigned int cpuid_ecx(unsigned int op)
194{ 197{
195 unsigned int eax, ecx; 198 unsigned int eax, ebx, ecx, edx;
196 199
197 __asm__("cpuid" 200 cpuid(op, &eax, &ebx, &ecx, &edx);
198 : "=a" (eax), "=c" (ecx)
199 : "0" (op)
200 : "bx", "dx" );
201 return ecx; 201 return ecx;
202} 202}
203static inline unsigned int cpuid_edx(unsigned int op) 203static inline unsigned int cpuid_edx(unsigned int op)
204{ 204{
205 unsigned int eax, edx; 205 unsigned int eax, ebx, ecx, edx;
206 206
207 __asm__("cpuid" 207 cpuid(op, &eax, &ebx, &ecx, &edx);
208 : "=a" (eax), "=d" (edx)
209 : "0" (op)
210 : "bx", "cx");
211 return edx; 208 return edx;
212} 209}
213 210
@@ -554,7 +551,7 @@ extern void prepare_to_copy(struct task_struct *tsk);
554extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 551extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
555 552
556extern unsigned long thread_saved_pc(struct task_struct *tsk); 553extern unsigned long thread_saved_pc(struct task_struct *tsk);
557void show_trace(struct task_struct *task, unsigned long *stack); 554void show_trace(struct task_struct *task, struct pt_regs *regs, unsigned long *stack);
558 555
559unsigned long get_wchan(struct task_struct *p); 556unsigned long get_wchan(struct task_struct *p);
560 557
diff --git a/include/asm-i386/ptrace-abi.h b/include/asm-i386/ptrace-abi.h
new file mode 100644
index 0000000000..a44901817a
--- /dev/null
+++ b/include/asm-i386/ptrace-abi.h
@@ -0,0 +1,39 @@
1#ifndef I386_PTRACE_ABI_H
2#define I386_PTRACE_ABI_H
3
4#define EBX 0
5#define ECX 1
6#define EDX 2
7#define ESI 3
8#define EDI 4
9#define EBP 5
10#define EAX 6
11#define DS 7
12#define ES 8
13#define FS 9
14#define GS 10
15#define ORIG_EAX 11
16#define EIP 12
17#define CS 13
18#define EFL 14
19#define UESP 15
20#define SS 16
21#define FRAME_SIZE 17
22
23/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
24#define PTRACE_GETREGS 12
25#define PTRACE_SETREGS 13
26#define PTRACE_GETFPREGS 14
27#define PTRACE_SETFPREGS 15
28#define PTRACE_GETFPXREGS 18
29#define PTRACE_SETFPXREGS 19
30
31#define PTRACE_OLDSETOPTIONS 21
32
33#define PTRACE_GET_THREAD_AREA 25
34#define PTRACE_SET_THREAD_AREA 26
35
36#define PTRACE_SYSEMU 31
37#define PTRACE_SYSEMU_SINGLESTEP 32
38
39#endif
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index f324c53b6f..a4a0e5207d 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -1,24 +1,7 @@
1#ifndef _I386_PTRACE_H 1#ifndef _I386_PTRACE_H
2#define _I386_PTRACE_H 2#define _I386_PTRACE_H
3 3
4#define EBX 0 4#include <asm/ptrace-abi.h>
5#define ECX 1
6#define EDX 2
7#define ESI 3
8#define EDI 4
9#define EBP 5
10#define EAX 6
11#define DS 7
12#define ES 8
13#define FS 9
14#define GS 10
15#define ORIG_EAX 11
16#define EIP 12
17#define CS 13
18#define EFL 14
19#define UESP 15
20#define SS 16
21#define FRAME_SIZE 17
22 5
23/* this struct defines the way the registers are stored on the 6/* this struct defines the way the registers are stored on the
24 stack during a system call. */ 7 stack during a system call. */
@@ -41,25 +24,10 @@ struct pt_regs {
41 int xss; 24 int xss;
42}; 25};
43 26
44/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
45#define PTRACE_GETREGS 12
46#define PTRACE_SETREGS 13
47#define PTRACE_GETFPREGS 14
48#define PTRACE_SETFPREGS 15
49#define PTRACE_GETFPXREGS 18
50#define PTRACE_SETFPXREGS 19
51
52#define PTRACE_OLDSETOPTIONS 21
53
54#define PTRACE_GET_THREAD_AREA 25
55#define PTRACE_SET_THREAD_AREA 26
56
57#define PTRACE_SYSEMU 31
58#define PTRACE_SYSEMU_SINGLESTEP 32
59
60#ifdef __KERNEL__ 27#ifdef __KERNEL__
61 28
62#include <asm/vm86.h> 29#include <asm/vm86.h>
30#include <asm/segment.h>
63 31
64struct task_struct; 32struct task_struct;
65extern 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);
@@ -73,18 +41,14 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int erro
73 */ 41 */
74static inline int user_mode(struct pt_regs *regs) 42static inline int user_mode(struct pt_regs *regs)
75{ 43{
76 return (regs->xcs & 3) != 0; 44 return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL;
77} 45}
78static inline int user_mode_vm(struct pt_regs *regs) 46static inline int user_mode_vm(struct pt_regs *regs)
79{ 47{
80 return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0; 48 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
81} 49}
82#define instruction_pointer(regs) ((regs)->eip) 50#define instruction_pointer(regs) ((regs)->eip)
83#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
84extern unsigned long profile_pc(struct pt_regs *regs); 51extern unsigned long profile_pc(struct pt_regs *regs);
85#else
86#define profile_pc(regs) instruction_pointer(regs)
87#endif
88#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
89 53
90#endif 54#endif
diff --git a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h
index 94f00195d5..c3e5db32fa 100644
--- a/include/asm-i386/rwlock.h
+++ b/include/asm-i386/rwlock.h
@@ -20,56 +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 alternative_smp("lock; subl $1,(%0)\n\t" \
25 "jns 1f\n" \
26 "call " helper "\n\t" \
27 "1:\n", \
28 "subl $1,(%0)\n\t", \
29 :"a" (rw) : "memory")
30
31#define __build_read_lock_const(rw, helper) \
32 alternative_smp("lock; subl $1,%0\n\t" \
33 "jns 1f\n" \
34 "pushl %%eax\n\t" \
35 "leal %0,%%eax\n\t" \
36 "call " helper "\n\t" \
37 "popl %%eax\n\t" \
38 "1:\n", \
39 "subl $1,%0\n\t", \
40 "=m" (*(volatile int *)rw) : : "memory")
41
42#define __build_read_lock(rw, helper) do { \
43 if (__builtin_constant_p(rw)) \
44 __build_read_lock_const(rw, helper); \
45 else \
46 __build_read_lock_ptr(rw, helper); \
47 } while (0)
48
49#define __build_write_lock_ptr(rw, helper) \
50 alternative_smp("lock; subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
51 "jz 1f\n" \
52 "call " helper "\n\t" \
53 "1:\n", \
54 "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t", \
55 :"a" (rw) : "memory")
56
57#define __build_write_lock_const(rw, helper) \
58 alternative_smp("lock; subl $" RW_LOCK_BIAS_STR ",%0\n\t" \
59 "jz 1f\n" \
60 "pushl %%eax\n\t" \
61 "leal %0,%%eax\n\t" \
62 "call " helper "\n\t" \
63 "popl %%eax\n\t" \
64 "1:\n", \
65 "subl $" RW_LOCK_BIAS_STR ",%0\n\t", \
66 "=m" (*(volatile int *)rw) : : "memory")
67
68#define __build_write_lock(rw, helper) do { \
69 if (__builtin_constant_p(rw)) \
70 __build_write_lock_const(rw, helper); \
71 else \
72 __build_write_lock_ptr(rw, helper); \
73 } while (0)
74 24
75#endif 25#endif
diff --git a/include/asm-i386/rwsem.h b/include/asm-i386/rwsem.h
index be4ab85923..bc598d6388 100644
--- a/include/asm-i386/rwsem.h
+++ b/include/asm-i386/rwsem.h
@@ -40,6 +40,7 @@
40 40
41#include <linux/list.h> 41#include <linux/list.h>
42#include <linux/spinlock.h> 42#include <linux/spinlock.h>
43#include <linux/lockdep.h>
43 44
44struct rwsem_waiter; 45struct rwsem_waiter;
45 46
@@ -61,36 +62,34 @@ struct rw_semaphore {
61#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 62#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
62 spinlock_t wait_lock; 63 spinlock_t wait_lock;
63 struct list_head wait_list; 64 struct list_head wait_list;
64#if RWSEM_DEBUG 65#ifdef CONFIG_DEBUG_LOCK_ALLOC
65 int debug; 66 struct lockdep_map dep_map;
66#endif 67#endif
67}; 68};
68 69
69/* 70#ifdef CONFIG_DEBUG_LOCK_ALLOC
70 * initialisation 71# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
71 */
72#if RWSEM_DEBUG
73#define __RWSEM_DEBUG_INIT , 0
74#else 72#else
75#define __RWSEM_DEBUG_INIT /* */ 73# define __RWSEM_DEP_MAP_INIT(lockname)
76#endif 74#endif
77 75
76
78#define __RWSEM_INITIALIZER(name) \ 77#define __RWSEM_INITIALIZER(name) \
79{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ 78{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \
80 __RWSEM_DEBUG_INIT } 79 __RWSEM_DEP_MAP_INIT(name) }
81 80
82#define DECLARE_RWSEM(name) \ 81#define DECLARE_RWSEM(name) \
83 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 82 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
84 83
85static inline void init_rwsem(struct rw_semaphore *sem) 84extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
86{ 85 struct lock_class_key *key);
87 sem->count = RWSEM_UNLOCKED_VALUE; 86
88 spin_lock_init(&sem->wait_lock); 87#define init_rwsem(sem) \
89 INIT_LIST_HEAD(&sem->wait_list); 88do { \
90#if RWSEM_DEBUG 89 static struct lock_class_key __key; \
91 sem->debug = 0; 90 \
92#endif 91 __init_rwsem((sem), #sem, &__key); \
93} 92} while (0)
94 93
95/* 94/*
96 * lock for reading 95 * lock for reading
@@ -100,20 +99,12 @@ static inline void __down_read(struct rw_semaphore *sem)
100 __asm__ __volatile__( 99 __asm__ __volatile__(
101 "# beginning down_read\n\t" 100 "# beginning down_read\n\t"
102LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ 101LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */
103 " js 2f\n\t" /* jump if we weren't granted the lock */ 102 " jns 1f\n"
103 " call call_rwsem_down_read_failed\n"
104 "1:\n\t" 104 "1:\n\t"
105 LOCK_SECTION_START("")
106 "2:\n\t"
107 " pushl %%ecx\n\t"
108 " pushl %%edx\n\t"
109 " call rwsem_down_read_failed\n\t"
110 " popl %%edx\n\t"
111 " popl %%ecx\n\t"
112 " jmp 1b\n"
113 LOCK_SECTION_END
114 "# ending down_read\n\t" 105 "# ending down_read\n\t"
115 : "=m"(sem->count) 106 : "+m" (sem->count)
116 : "a"(sem), "m"(sem->count) 107 : "a" (sem)
117 : "memory", "cc"); 108 : "memory", "cc");
118} 109}
119 110
@@ -134,8 +125,8 @@ LOCK_PREFIX " cmpxchgl %2,%0\n\t"
134 " jnz 1b\n\t" 125 " jnz 1b\n\t"
135 "2:\n\t" 126 "2:\n\t"
136 "# ending __down_read_trylock\n\t" 127 "# ending __down_read_trylock\n\t"
137 : "+m"(sem->count), "=&a"(result), "=&r"(tmp) 128 : "+m" (sem->count), "=&a" (result), "=&r" (tmp)
138 : "i"(RWSEM_ACTIVE_READ_BIAS) 129 : "i" (RWSEM_ACTIVE_READ_BIAS)
139 : "memory", "cc"); 130 : "memory", "cc");
140 return result>=0 ? 1 : 0; 131 return result>=0 ? 1 : 0;
141} 132}
@@ -143,7 +134,7 @@ LOCK_PREFIX " cmpxchgl %2,%0\n\t"
143/* 134/*
144 * lock for writing 135 * lock for writing
145 */ 136 */
146static inline void __down_write(struct rw_semaphore *sem) 137static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
147{ 138{
148 int tmp; 139 int tmp;
149 140
@@ -152,21 +143,20 @@ static inline void __down_write(struct rw_semaphore *sem)
152 "# beginning down_write\n\t" 143 "# beginning down_write\n\t"
153LOCK_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 */
154 " testl %%edx,%%edx\n\t" /* was the count 0 before? */ 145 " testl %%edx,%%edx\n\t" /* was the count 0 before? */
155 " jnz 2f\n\t" /* jump if we weren't granted the lock */ 146 " jz 1f\n"
156 "1:\n\t" 147 " call call_rwsem_down_write_failed\n"
157 LOCK_SECTION_START("") 148 "1:\n"
158 "2:\n\t"
159 " pushl %%ecx\n\t"
160 " call rwsem_down_write_failed\n\t"
161 " popl %%ecx\n\t"
162 " jmp 1b\n"
163 LOCK_SECTION_END
164 "# ending down_write" 149 "# ending down_write"
165 : "=m"(sem->count), "=d"(tmp) 150 : "+m" (sem->count), "=d" (tmp)
166 : "a"(sem), "1"(tmp), "m"(sem->count) 151 : "a" (sem), "1" (tmp)
167 : "memory", "cc"); 152 : "memory", "cc");
168} 153}
169 154
155static inline void __down_write(struct rw_semaphore *sem)
156{
157 __down_write_nested(sem, 0);
158}
159
170/* 160/*
171 * trylock for writing -- returns 1 if successful, 0 if contention 161 * trylock for writing -- returns 1 if successful, 0 if contention
172 */ 162 */
@@ -189,20 +179,12 @@ static inline void __up_read(struct rw_semaphore *sem)
189 __asm__ __volatile__( 179 __asm__ __volatile__(
190 "# beginning __up_read\n\t" 180 "# beginning __up_read\n\t"
191LOCK_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 */
192 " js 2f\n\t" /* jump if the lock is being waited upon */ 182 " jns 1f\n\t"
193 "1:\n\t" 183 " call call_rwsem_wake\n"
194 LOCK_SECTION_START("") 184 "1:\n"
195 "2:\n\t"
196 " decw %%dx\n\t" /* do nothing if still outstanding active readers */
197 " jnz 1b\n\t"
198 " pushl %%ecx\n\t"
199 " call rwsem_wake\n\t"
200 " popl %%ecx\n\t"
201 " jmp 1b\n"
202 LOCK_SECTION_END
203 "# ending __up_read\n" 185 "# ending __up_read\n"
204 : "=m"(sem->count), "=d"(tmp) 186 : "+m" (sem->count), "=d" (tmp)
205 : "a"(sem), "1"(tmp), "m"(sem->count) 187 : "a" (sem), "1" (tmp)
206 : "memory", "cc"); 188 : "memory", "cc");
207} 189}
208 190
@@ -215,20 +197,12 @@ static inline void __up_write(struct rw_semaphore *sem)
215 "# beginning __up_write\n\t" 197 "# beginning __up_write\n\t"
216 " movl %2,%%edx\n\t" 198 " movl %2,%%edx\n\t"
217LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ 199LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
218 " jnz 2f\n\t" /* jump if the lock is being waited upon */ 200 " jz 1f\n"
201 " call call_rwsem_wake\n"
219 "1:\n\t" 202 "1:\n\t"
220 LOCK_SECTION_START("")
221 "2:\n\t"
222 " decw %%dx\n\t" /* did the active count reduce to 0? */
223 " jnz 1b\n\t" /* jump back if not */
224 " pushl %%ecx\n\t"
225 " call rwsem_wake\n\t"
226 " popl %%ecx\n\t"
227 " jmp 1b\n"
228 LOCK_SECTION_END
229 "# ending __up_write\n" 203 "# ending __up_write\n"
230 : "=m"(sem->count) 204 : "+m" (sem->count)
231 : "a"(sem), "i"(-RWSEM_ACTIVE_WRITE_BIAS), "m"(sem->count) 205 : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS)
232 : "memory", "cc", "edx"); 206 : "memory", "cc", "edx");
233} 207}
234 208
@@ -240,20 +214,12 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
240 __asm__ __volatile__( 214 __asm__ __volatile__(
241 "# beginning __downgrade_write\n\t" 215 "# beginning __downgrade_write\n\t"
242LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ 216LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
243 " js 2f\n\t" /* jump if the lock is being waited upon */ 217 " jns 1f\n\t"
218 " call call_rwsem_downgrade_wake\n"
244 "1:\n\t" 219 "1:\n\t"
245 LOCK_SECTION_START("")
246 "2:\n\t"
247 " pushl %%ecx\n\t"
248 " pushl %%edx\n\t"
249 " call rwsem_downgrade_wake\n\t"
250 " popl %%edx\n\t"
251 " popl %%ecx\n\t"
252 " jmp 1b\n"
253 LOCK_SECTION_END
254 "# ending __downgrade_write\n" 220 "# ending __downgrade_write\n"
255 : "=m"(sem->count) 221 : "+m" (sem->count)
256 : "a"(sem), "i"(-RWSEM_WAITING_BIAS), "m"(sem->count) 222 : "a" (sem), "i" (-RWSEM_WAITING_BIAS)
257 : "memory", "cc"); 223 : "memory", "cc");
258} 224}
259 225
@@ -264,8 +230,8 @@ static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
264{ 230{
265 __asm__ __volatile__( 231 __asm__ __volatile__(
266LOCK_PREFIX "addl %1,%0" 232LOCK_PREFIX "addl %1,%0"
267 : "=m"(sem->count) 233 : "+m" (sem->count)
268 : "ir"(delta), "m"(sem->count)); 234 : "ir" (delta));
269} 235}
270 236
271/* 237/*
@@ -276,10 +242,9 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
276 int tmp = delta; 242 int tmp = delta;
277 243
278 __asm__ __volatile__( 244 __asm__ __volatile__(
279LOCK_PREFIX "xadd %0,(%2)" 245LOCK_PREFIX "xadd %0,%1"
280 : "+r"(tmp), "=m"(sem->count) 246 : "+r" (tmp), "+m" (sem->count)
281 : "r"(sem), "m"(sem->count) 247 : : "memory");
282 : "memory");
283 248
284 return tmp+delta; 249 return tmp+delta;
285} 250}
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index faf995307b..b7ab59685b 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 f7a0f310c5..4e34a468c3 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -100,14 +100,11 @@ 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" 107 :"+m" (sem->count)
108 "jmp 1b\n"
109 LOCK_SECTION_END
110 :"=m" (sem->count)
111 : 108 :
112 :"memory","ax"); 109 :"memory","ax");
113} 110}
@@ -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,23 +157,17 @@ 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" 170 :"+m" (sem->count)
182 "jmp 1b\n"
183 LOCK_SECTION_END
184 ".subsection 0\n"
185 :"=m" (sem->count)
186 : 171 :
187 :"memory","ax"); 172 :"memory","ax");
188} 173}
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index ee941457b5..2734909eff 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -6,6 +6,7 @@
6#ifndef _i386_SETUP_H 6#ifndef _i386_SETUP_H
7#define _i386_SETUP_H 7#define _i386_SETUP_H
8 8
9#ifdef __KERNEL__
9#include <linux/pfn.h> 10#include <linux/pfn.h>
10 11
11/* 12/*
@@ -13,6 +14,7 @@
13 */ 14 */
14#define MAXMEM_PFN PFN_DOWN(MAXMEM) 15#define MAXMEM_PFN PFN_DOWN(MAXMEM)
15#define MAX_NONPAE_PFN (1 << 20) 16#define MAX_NONPAE_PFN (1 << 20)
17#endif
16 18
17#define PARAM_SIZE 4096 19#define PARAM_SIZE 4096
18#define COMMAND_LINE_SIZE 256 20#define COMMAND_LINE_SIZE 256
@@ -59,6 +61,21 @@ extern unsigned char boot_params[PARAM_SIZE];
59#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) 61#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
60#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) 62#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
61 63
64/*
65 * Do NOT EVER look at the BIOS memory size location.
66 * It does not work on many machines.
67 */
68#define LOWMEMSIZE() (0x9f000)
69
70struct e820entry;
71
72char * __init machine_specific_memory_setup(void);
73
74int __init copy_e820_map(struct e820entry * biosmap, int nr_map);
75int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
76void __init add_memory_region(unsigned long long start,
77 unsigned long long size, int type);
78
62#endif /* __ASSEMBLY__ */ 79#endif /* __ASSEMBLY__ */
63 80
64#endif /* _i386_SETUP_H */ 81#endif /* _i386_SETUP_H */
diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h
index 026fd23148..c3e8adec59 100644
--- a/include/asm-i386/signal.h
+++ b/include/asm-i386/signal.h
@@ -2,7 +2,6 @@
2#define _ASMi386_SIGNAL_H 2#define _ASMi386_SIGNAL_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/linkage.h>
6#include <linux/time.h> 5#include <linux/time.h>
7#include <linux/compiler.h> 6#include <linux/compiler.h>
8 7
@@ -10,6 +9,9 @@
10struct siginfo; 9struct siginfo;
11 10
12#ifdef __KERNEL__ 11#ifdef __KERNEL__
12
13#include <linux/linkage.h>
14
13/* Most things should be clean enough to redefine this at will, if care 15/* Most things should be clean enough to redefine this at will, if care
14 is taken to make libc match. */ 16 is taken to make libc match. */
15 17
@@ -77,7 +79,6 @@ typedef unsigned long sigset_t;
77 * SA_FLAGS values: 79 * SA_FLAGS values:
78 * 80 *
79 * SA_ONSTACK indicates that a registered stack_t will be used. 81 * SA_ONSTACK indicates that a registered stack_t will be used.
80 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
81 * SA_RESTART flag to get restarting signals (which were the default long ago) 82 * SA_RESTART flag to get restarting signals (which were the default long ago)
82 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
83 * SA_RESETHAND clears the handler when the signal is delivered. 84 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -97,7 +98,6 @@ typedef unsigned long sigset_t;
97 98
98#define SA_NOMASK SA_NODEFER 99#define SA_NOMASK SA_NODEFER
99#define SA_ONESHOT SA_RESETHAND 100#define SA_ONESHOT SA_RESETHAND
100#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
101 101
102#define SA_RESTORER 0x04000000 102#define SA_RESTORER 0x04000000
103 103
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 142d10e34a..915c26a31b 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,17 +82,12 @@ 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
92extern int __cpu_disable(void); 87extern int __cpu_disable(void);
93extern void __cpu_die(unsigned int cpu); 88extern void __cpu_die(unsigned int cpu);
89extern unsigned int num_processors;
90
94#endif /* !__ASSEMBLY__ */ 91#endif /* !__ASSEMBLY__ */
95 92
96#else /* CONFIG_SMP */ 93#else /* CONFIG_SMP */
@@ -100,4 +97,15 @@ extern void __cpu_die(unsigned int cpu);
100#define NO_PROC_ID 0xFF /* No processor magic marker */ 97#define NO_PROC_ID 0xFF /* No processor magic marker */
101 98
102#endif 99#endif
100
101#ifndef __ASSEMBLY__
102#ifdef CONFIG_X86_LOCAL_APIC
103static __inline int logical_smp_processor_id(void)
104{
105 /* we don't want to mark this access volatile - bad code generation */
106 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
107}
108#endif
109#endif
110
103#endif 111#endif
diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h
index 802ae76195..5755d57c4e 100644
--- a/include/asm-i386/socket.h
+++ b/include/asm-i386/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index 04ba30234c..b0b3043f05 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,66 +21,66 @@
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 ; 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#define __raw_spin_lock_string_flags \
35 "\n1:\t" \
36 "lock ; decb %0\n\t" \
37 "jns 5f\n" \
38 "2:\t" \
39 "testl $0x200, %1\n\t" \
40 "jz 4f\n\t" \
41 "sti\n" \
42 "3:\t" \
43 "rep;nop\n\t" \
44 "cmpb $0, %0\n\t" \
45 "jle 3b\n\t" \
46 "cli\n\t" \
47 "jmp 1b\n" \
48 "4:\t" \
49 "rep;nop\n\t" \
50 "cmpb $0, %0\n\t" \
51 "jg 1b\n\t" \
52 "jmp 4b\n" \
53 "5:\n\t"
54
55#define __raw_spin_lock_string_up \
56 "\n\tdecb %0"
57 28
58static inline void __raw_spin_lock(raw_spinlock_t *lock) 29static inline void __raw_spin_lock(raw_spinlock_t *lock)
59{ 30{
60 alternative_smp( 31 asm volatile("\n1:\t"
61 __raw_spin_lock_string, 32 LOCK_PREFIX " ; decb %0\n\t"
62 __raw_spin_lock_string_up, 33 "jns 3f\n"
63 "=m" (lock->slock) : : "memory"); 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");
64} 41}
65 42
43/*
44 * It is easier for the lock validator if interrupts are not re-enabled
45 * in the middle of a lock-acquire. This is a performance feature anyway
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.
50 */
51#ifndef CONFIG_PROVE_LOCKING
66static 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)
67{ 53{
68 alternative_smp( 54 asm volatile(
69 __raw_spin_lock_string_flags, 55 "\n1:\t"
70 __raw_spin_lock_string_up, 56 LOCK_PREFIX " ; decb %0\n\t"
71 "=m" (lock->slock) : "r" (flags) : "memory"); 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");
72} 75}
76#endif
73 77
74static inline int __raw_spin_trylock(raw_spinlock_t *lock) 78static inline int __raw_spin_trylock(raw_spinlock_t *lock)
75{ 79{
76 char oldval; 80 char oldval;
77 __asm__ __volatile__( 81 asm volatile(
78 "xchgb %b0,%1" 82 "xchgb %b0,%1"
79 :"=q" (oldval), "=m" (lock->slock) 83 :"=q" (oldval), "+m" (lock->slock)
80 :"0" (0) : "memory"); 84 :"0" (0) : "memory");
81 return oldval > 0; 85 return oldval > 0;
82} 86}
@@ -90,38 +94,29 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
90 94
91#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) 95#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE)
92 96
93#define __raw_spin_unlock_string \
94 "movb $1,%0" \
95 :"=m" (lock->slock) : : "memory"
96
97
98static inline void __raw_spin_unlock(raw_spinlock_t *lock) 97static inline void __raw_spin_unlock(raw_spinlock_t *lock)
99{ 98{
100 __asm__ __volatile__( 99 asm volatile("movb $1,%0" : "+m" (lock->slock) :: "memory");
101 __raw_spin_unlock_string
102 );
103} 100}
104 101
105#else 102#else
106 103
107#define __raw_spin_unlock_string \
108 "xchgb %b0, %1" \
109 :"=q" (oldval), "=m" (lock->slock) \
110 :"0" (oldval) : "memory"
111
112static inline void __raw_spin_unlock(raw_spinlock_t *lock) 104static inline void __raw_spin_unlock(raw_spinlock_t *lock)
113{ 105{
114 char oldval = 1; 106 char oldval = 1;
115 107
116 __asm__ __volatile__( 108 asm volatile("xchgb %b0, %1"
117 __raw_spin_unlock_string 109 : "=q" (oldval), "+m" (lock->slock)
118 ); 110 : "0" (oldval) : "memory");
119} 111}
120 112
121#endif 113#endif
122 114
123#define __raw_spin_unlock_wait(lock) \ 115static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
124 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 116{
117 while (__raw_spin_is_locked(lock))
118 cpu_relax();
119}
125 120
126/* 121/*
127 * Read-write spinlocks, allowing multiple readers 122 * Read-write spinlocks, allowing multiple readers
@@ -148,22 +143,36 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
148 * read_can_lock - would read_trylock() succeed? 143 * read_can_lock - would read_trylock() succeed?
149 * @lock: the rwlock in question. 144 * @lock: the rwlock in question.
150 */ 145 */
151#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}
152 150
153/** 151/**
154 * write_can_lock - would write_trylock() succeed? 152 * write_can_lock - would write_trylock() succeed?
155 * @lock: the rwlock in question. 153 * @lock: the rwlock in question.
156 */ 154 */
157#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}
158 159
159static inline void __raw_read_lock(raw_rwlock_t *rw) 160static inline void __raw_read_lock(raw_rwlock_t *rw)
160{ 161{
161 __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");
162} 167}
163 168
164static inline void __raw_write_lock(raw_rwlock_t *rw) 169static inline void __raw_write_lock(raw_rwlock_t *rw)
165{ 170{
166 __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");
167} 176}
168 177
169static inline int __raw_read_trylock(raw_rwlock_t *lock) 178static inline int __raw_read_trylock(raw_rwlock_t *lock)
@@ -187,13 +196,13 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
187 196
188static inline void __raw_read_unlock(raw_rwlock_t *rw) 197static inline void __raw_read_unlock(raw_rwlock_t *rw)
189{ 198{
190 asm volatile(LOCK_PREFIX "incl %0" :"=m" (rw->lock) : : "memory"); 199 asm volatile(LOCK_PREFIX "incl %0" :"+m" (rw->lock) : : "memory");
191} 200}
192 201
193static inline void __raw_write_unlock(raw_rwlock_t *rw) 202static inline void __raw_write_unlock(raw_rwlock_t *rw)
194{ 203{
195 asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0" 204 asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0"
196 : "=m" (rw->lock) : : "memory"); 205 : "+m" (rw->lock) : : "memory");
197} 206}
198 207
199#endif /* __ASM_SPINLOCK_H */ 208#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-i386/stacktrace.h b/include/asm-i386/stacktrace.h
new file mode 100644
index 0000000000..7d1f6a5cbf
--- /dev/null
+++ b/include/asm-i386/stacktrace.h
@@ -0,0 +1 @@
#include <asm-x86_64/stacktrace.h>
diff --git a/include/asm-i386/sync_bitops.h b/include/asm-i386/sync_bitops.h
new file mode 100644
index 0000000000..c94d51c993
--- /dev/null
+++ b/include/asm-i386/sync_bitops.h
@@ -0,0 +1,156 @@
1#ifndef _I386_SYNC_BITOPS_H
2#define _I386_SYNC_BITOPS_H
3
4/*
5 * Copyright 1992, Linus Torvalds.
6 */
7
8/*
9 * These have to be done with inline assembly: that way the bit-setting
10 * is guaranteed to be atomic. All bit operations return 0 if the bit
11 * was cleared before the operation and != 0 if it was not.
12 *
13 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
14 */
15
16#define ADDR (*(volatile long *) addr)
17
18/**
19 * sync_set_bit - Atomically set a bit in memory
20 * @nr: the bit to set
21 * @addr: the address to start counting from
22 *
23 * This function is atomic and may not be reordered. See __set_bit()
24 * if you do not require the atomic guarantees.
25 *
26 * Note: there are no guarantees that this function will not be reordered
27 * on non x86 architectures, so if you are writting portable code,
28 * make sure not to rely on its reordering guarantees.
29 *
30 * Note that @nr may be almost arbitrarily large; this function is not
31 * restricted to acting on a single-word quantity.
32 */
33static inline void sync_set_bit(int nr, volatile unsigned long * addr)
34{
35 __asm__ __volatile__("lock; btsl %1,%0"
36 :"+m" (ADDR)
37 :"Ir" (nr)
38 : "memory");
39}
40
41/**
42 * sync_clear_bit - Clears a bit in memory
43 * @nr: Bit to clear
44 * @addr: Address to start counting from
45 *
46 * sync_clear_bit() is atomic and may not be reordered. However, it does
47 * not contain a memory barrier, so if it is used for locking purposes,
48 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
49 * in order to ensure changes are visible on other processors.
50 */
51static inline void sync_clear_bit(int nr, volatile unsigned long * addr)
52{
53 __asm__ __volatile__("lock; btrl %1,%0"
54 :"+m" (ADDR)
55 :"Ir" (nr)
56 : "memory");
57}
58
59/**
60 * sync_change_bit - Toggle a bit in memory
61 * @nr: Bit to change
62 * @addr: Address to start counting from
63 *
64 * change_bit() is atomic and may not be reordered. It may be
65 * reordered on other architectures than x86.
66 * Note that @nr may be almost arbitrarily large; this function is not
67 * restricted to acting on a single-word quantity.
68 */
69static inline void sync_change_bit(int nr, volatile unsigned long * addr)
70{
71 __asm__ __volatile__("lock; btcl %1,%0"
72 :"+m" (ADDR)
73 :"Ir" (nr)
74 : "memory");
75}
76
77/**
78 * sync_test_and_set_bit - Set a bit and return its old value
79 * @nr: Bit to set
80 * @addr: Address to count from
81 *
82 * This operation is atomic and cannot be reordered.
83 * It may be reordered on other architectures than x86.
84 * It also implies a memory barrier.
85 */
86static inline int sync_test_and_set_bit(int nr, volatile unsigned long * addr)
87{
88 int oldbit;
89
90 __asm__ __volatile__("lock; btsl %2,%1\n\tsbbl %0,%0"
91 :"=r" (oldbit),"+m" (ADDR)
92 :"Ir" (nr) : "memory");
93 return oldbit;
94}
95
96/**
97 * sync_test_and_clear_bit - Clear a bit and return its old value
98 * @nr: Bit to clear
99 * @addr: Address to count from
100 *
101 * This operation is atomic and cannot be reordered.
102 * It can be reorderdered on other architectures other than x86.
103 * It also implies a memory barrier.
104 */
105static inline int sync_test_and_clear_bit(int nr, volatile unsigned long * addr)
106{
107 int oldbit;
108
109 __asm__ __volatile__("lock; btrl %2,%1\n\tsbbl %0,%0"
110 :"=r" (oldbit),"+m" (ADDR)
111 :"Ir" (nr) : "memory");
112 return oldbit;
113}
114
115/**
116 * sync_test_and_change_bit - Change a bit and return its old value
117 * @nr: Bit to change
118 * @addr: Address to count from
119 *
120 * This operation is atomic and cannot be reordered.
121 * It also implies a memory barrier.
122 */
123static inline int sync_test_and_change_bit(int nr, volatile unsigned long* addr)
124{
125 int oldbit;
126
127 __asm__ __volatile__("lock; btcl %2,%1\n\tsbbl %0,%0"
128 :"=r" (oldbit),"+m" (ADDR)
129 :"Ir" (nr) : "memory");
130 return oldbit;
131}
132
133static __always_inline int sync_const_test_bit(int nr, const volatile unsigned long *addr)
134{
135 return ((1UL << (nr & 31)) &
136 (((const volatile unsigned int *)addr)[nr >> 5])) != 0;
137}
138
139static inline int sync_var_test_bit(int nr, const volatile unsigned long * addr)
140{
141 int oldbit;
142
143 __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
144 :"=r" (oldbit)
145 :"m" (ADDR),"Ir" (nr));
146 return oldbit;
147}
148
149#define sync_test_bit(nr,addr) \
150 (__builtin_constant_p(nr) ? \
151 sync_constant_test_bit((nr),(addr)) : \
152 sync_var_test_bit((nr),(addr)))
153
154#undef ADDR
155
156#endif /* _I386_SYNC_BITOPS_H */
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 0249f912a2..a6dabbcd6e 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -11,9 +11,14 @@
11struct task_struct; /* one of the stranger aspects of C forward declarations.. */ 11struct task_struct; /* one of the stranger aspects of C forward declarations.. */
12extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); 12extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
13 13
14/*
15 * Saving eflags is important. It switches not only IOPL between tasks,
16 * it also protects other tasks from NT leaking through sysenter etc.
17 */
14#define switch_to(prev,next,last) do { \ 18#define switch_to(prev,next,last) do { \
15 unsigned long esi,edi; \ 19 unsigned long esi,edi; \
16 asm volatile("pushl %%ebp\n\t" \ 20 asm volatile("pushfl\n\t" /* Save flags */ \
21 "pushl %%ebp\n\t" \
17 "movl %%esp,%0\n\t" /* save ESP */ \ 22 "movl %%esp,%0\n\t" /* save ESP */ \
18 "movl %5,%%esp\n\t" /* restore ESP */ \ 23 "movl %5,%%esp\n\t" /* restore ESP */ \
19 "movl $1f,%1\n\t" /* save EIP */ \ 24 "movl $1f,%1\n\t" /* save EIP */ \
@@ -21,6 +26,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
21 "jmp __switch_to\n" \ 26 "jmp __switch_to\n" \
22 "1:\t" \ 27 "1:\t" \
23 "popl %%ebp\n\t" \ 28 "popl %%ebp\n\t" \
29 "popfl" \
24 :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ 30 :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
25 "=a" (last),"=S" (esi),"=D" (edi) \ 31 "=a" (last),"=S" (esi),"=D" (edi) \
26 :"m" (next->thread.esp),"m" (next->thread.eip), \ 32 :"m" (next->thread.esp),"m" (next->thread.eip), \
@@ -82,10 +88,6 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
82#define savesegment(seg, value) \ 88#define savesegment(seg, value) \
83 asm volatile("mov %%" #seg ",%0":"=rm" (value)) 89 asm volatile("mov %%" #seg ",%0":"=rm" (value))
84 90
85/*
86 * Clear and set 'TS' bit respectively
87 */
88#define clts() __asm__ __volatile__ ("clts")
89#define read_cr0() ({ \ 91#define read_cr0() ({ \
90 unsigned int __dummy; \ 92 unsigned int __dummy; \
91 __asm__ __volatile__( \ 93 __asm__ __volatile__( \
@@ -94,7 +96,7 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
94 __dummy; \ 96 __dummy; \
95}) 97})
96#define write_cr0(x) \ 98#define write_cr0(x) \
97 __asm__ __volatile__("movl %0,%%cr0": :"r" (x)); 99 __asm__ __volatile__("movl %0,%%cr0": :"r" (x))
98 100
99#define read_cr2() ({ \ 101#define read_cr2() ({ \
100 unsigned int __dummy; \ 102 unsigned int __dummy; \
@@ -104,7 +106,7 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
104 __dummy; \ 106 __dummy; \
105}) 107})
106#define write_cr2(x) \ 108#define write_cr2(x) \
107 __asm__ __volatile__("movl %0,%%cr2": :"r" (x)); 109 __asm__ __volatile__("movl %0,%%cr2": :"r" (x))
108 110
109#define read_cr3() ({ \ 111#define read_cr3() ({ \
110 unsigned int __dummy; \ 112 unsigned int __dummy; \
@@ -114,7 +116,7 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
114 __dummy; \ 116 __dummy; \
115}) 117})
116#define write_cr3(x) \ 118#define write_cr3(x) \
117 __asm__ __volatile__("movl %0,%%cr3": :"r" (x)); 119 __asm__ __volatile__("movl %0,%%cr3": :"r" (x))
118 120
119#define read_cr4() ({ \ 121#define read_cr4() ({ \
120 unsigned int __dummy; \ 122 unsigned int __dummy; \
@@ -123,7 +125,6 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
123 :"=r" (__dummy)); \ 125 :"=r" (__dummy)); \
124 __dummy; \ 126 __dummy; \
125}) 127})
126
127#define read_cr4_safe() ({ \ 128#define read_cr4_safe() ({ \
128 unsigned int __dummy; \ 129 unsigned int __dummy; \
129 /* This could fault if %cr4 does not exist */ \ 130 /* This could fault if %cr4 does not exist */ \
@@ -135,15 +136,19 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
135 : "=r" (__dummy): "0" (0)); \ 136 : "=r" (__dummy): "0" (0)); \
136 __dummy; \ 137 __dummy; \
137}) 138})
138
139#define write_cr4(x) \ 139#define write_cr4(x) \
140 __asm__ __volatile__("movl %0,%%cr4": :"r" (x)); 140 __asm__ __volatile__("movl %0,%%cr4": :"r" (x))
141
142/*
143 * Clear and set 'TS' bit respectively
144 */
145#define clts() __asm__ __volatile__ ("clts")
141#define stts() write_cr0(8 | read_cr0()) 146#define stts() write_cr0(8 | read_cr0())
142 147
143#endif /* __KERNEL__ */ 148#endif /* __KERNEL__ */
144 149
145#define wbinvd() \ 150#define wbinvd() \
146 __asm__ __volatile__ ("wbinvd": : :"memory"); 151 __asm__ __volatile__ ("wbinvd": : :"memory")
147 152
148static inline unsigned long get_limit(unsigned long segment) 153static inline unsigned long get_limit(unsigned long segment)
149{ 154{
@@ -262,6 +267,9 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
262#define cmpxchg(ptr,o,n)\ 267#define cmpxchg(ptr,o,n)\
263 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 268 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
264 (unsigned long)(n),sizeof(*(ptr)))) 269 (unsigned long)(n),sizeof(*(ptr))))
270#define sync_cmpxchg(ptr,o,n)\
271 ((__typeof__(*(ptr)))__sync_cmpxchg((ptr),(unsigned long)(o),\
272 (unsigned long)(n),sizeof(*(ptr))))
265#endif 273#endif
266 274
267static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, 275static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
@@ -291,6 +299,39 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
291 return old; 299 return old;
292} 300}
293 301
302/*
303 * Always use locked operations when touching memory shared with a
304 * hypervisor, since the system may be SMP even if the guest kernel
305 * isn't.
306 */
307static inline unsigned long __sync_cmpxchg(volatile void *ptr,
308 unsigned long old,
309 unsigned long new, int size)
310{
311 unsigned long prev;
312 switch (size) {
313 case 1:
314 __asm__ __volatile__("lock; cmpxchgb %b1,%2"
315 : "=a"(prev)
316 : "q"(new), "m"(*__xg(ptr)), "0"(old)
317 : "memory");
318 return prev;
319 case 2:
320 __asm__ __volatile__("lock; cmpxchgw %w1,%2"
321 : "=a"(prev)
322 : "r"(new), "m"(*__xg(ptr)), "0"(old)
323 : "memory");
324 return prev;
325 case 4:
326 __asm__ __volatile__("lock; cmpxchgl %1,%2"
327 : "=a"(prev)
328 : "r"(new), "m"(*__xg(ptr)), "0"(old)
329 : "memory");
330 return prev;
331 }
332 return old;
333}
334
294#ifndef CONFIG_X86_CMPXCHG 335#ifndef CONFIG_X86_CMPXCHG
295/* 336/*
296 * Building a kernel capable running on 80386. It may be necessary to 337 * Building a kernel capable running on 80386. It may be necessary to
@@ -427,7 +468,7 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long l
427 * does not enforce ordering, since there is no data dependency between 468 * does not enforce ordering, since there is no data dependency between
428 * the read of "a" and the read of "b". Therefore, on some CPUs, such 469 * the read of "a" and the read of "b". Therefore, on some CPUs, such
429 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() 470 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
430 * in cases like thiswhere there are no data dependencies. 471 * in cases like this where there are no data dependencies.
431 **/ 472 **/
432 473
433#define read_barrier_depends() do { } while(0) 474#define read_barrier_depends() do { } while(0)
@@ -454,27 +495,7 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long l
454#define set_mb(var, value) do { var = value; barrier(); } while (0) 495#define set_mb(var, value) do { var = value; barrier(); } while (0)
455#endif 496#endif
456 497
457#define set_wmb(var, value) do { var = value; wmb(); } while (0) 498#include <linux/irqflags.h>
458
459/* interrupt control.. */
460#define local_save_flags(x) do { typecheck(unsigned long,x); __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */); } while (0)
461#define local_irq_restore(x) do { typecheck(unsigned long,x); __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc"); } while (0)
462#define local_irq_disable() __asm__ __volatile__("cli": : :"memory")
463#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
464/* used in the idle loop; sti takes one instruction cycle to complete */
465#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
466/* used when interrupts are already enabled or to shutdown the processor */
467#define halt() __asm__ __volatile__("hlt": : :"memory")
468
469#define irqs_disabled() \
470({ \
471 unsigned long flags; \
472 local_save_flags(flags); \
473 !(flags & (1<<9)); \
474})
475
476/* For spinlocks etc */
477#define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
478 499
479/* 500/*
480 * disable hlt during certain critical i/o operations 501 * disable hlt during certain critical i/o operations
diff --git a/include/asm-i386/therm_throt.h b/include/asm-i386/therm_throt.h
new file mode 100644
index 0000000000..399bf6026b
--- /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/thread_info.h b/include/asm-i386/thread_info.h
index 8420ed1249..54d6d7aea9 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -37,6 +37,7 @@ struct thread_info {
37 0-0xBFFFFFFF for user-thead 37 0-0xBFFFFFFF for user-thead
38 0-0xFFFFFFFF for kernel-thread 38 0-0xFFFFFFFF for kernel-thread
39 */ 39 */
40 void *sysenter_return;
40 struct restart_block restart_block; 41 struct restart_block restart_block;
41 42
42 unsigned long previous_esp; /* ESP of the previous stack in case 43 unsigned long previous_esp; /* ESP of the previous stack in case
@@ -83,17 +84,15 @@ struct thread_info {
83#define init_stack (init_thread_union.stack) 84#define init_stack (init_thread_union.stack)
84 85
85 86
87/* how to get the current stack pointer from C */
88register unsigned long current_stack_pointer asm("esp") __attribute_used__;
89
86/* how to get the thread information struct from C */ 90/* how to get the thread information struct from C */
87static inline struct thread_info *current_thread_info(void) 91static inline struct thread_info *current_thread_info(void)
88{ 92{
89 struct thread_info *ti; 93 return (struct thread_info *)(current_stack_pointer & ~(THREAD_SIZE - 1));
90 __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1)));
91 return ti;
92} 94}
93 95
94/* how to get the current stack pointer from C */
95register unsigned long current_stack_pointer asm("esp") __attribute_used__;
96
97/* thread information allocation */ 96/* thread information allocation */
98#ifdef CONFIG_DEBUG_STACK_USAGE 97#ifdef CONFIG_DEBUG_STACK_USAGE
99#define alloc_thread_info(tsk) \ 98#define alloc_thread_info(tsk) \
@@ -140,8 +139,9 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
140#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 139#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
141#define TIF_SECCOMP 8 /* secure computing */ 140#define TIF_SECCOMP 8 /* secure computing */
142#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ 141#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
143#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 142#define TIF_MEMDIE 16
144#define TIF_MEMDIE 17 143#define TIF_DEBUG 17 /* uses debug registers */
144#define TIF_IO_BITMAP 18 /* uses I/O bitmap */
145 145
146#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 146#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
147#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 147#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -153,7 +153,8 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
153#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 153#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
154#define _TIF_SECCOMP (1<<TIF_SECCOMP) 154#define _TIF_SECCOMP (1<<TIF_SECCOMP)
155#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 155#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
156#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 156#define _TIF_DEBUG (1<<TIF_DEBUG)
157#define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP)
157 158
158/* work to do on interrupt/exception return */ 159/* work to do on interrupt/exception return */
159#define _TIF_WORK_MASK \ 160#define _TIF_WORK_MASK \
@@ -162,6 +163,9 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
162/* work to do on any return to u-space */ 163/* work to do on any return to u-space */
163#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 164#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
164 165
166/* flags to check in __switch_to() */
167#define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP)
168
165/* 169/*
166 * Thread-synchronous status. 170 * Thread-synchronous status.
167 * 171 *
@@ -170,6 +174,9 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
170 * have to worry about atomic accesses. 174 * have to worry about atomic accesses.
171 */ 175 */
172#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ 176#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
177#define TS_POLLING 0x0002 /* True if in idle loop and not sleeping */
178
179#define tsk_is_polling(t) ((t)->thread_info->status & TS_POLLING)
173 180
174#endif /* __KERNEL__ */ 181#endif /* __KERNEL__ */
175 182
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h
index aed1643747..d0ebd05f85 100644
--- a/include/asm-i386/timer.h
+++ b/include/asm-i386/timer.h
@@ -3,68 +3,11 @@
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/pm.h> 4#include <linux/pm.h>
5 5
6/**
7 * struct timer_ops - used to define a timer source
8 *
9 * @name: name of the timer.
10 * @init: Probes and initializes the timer. Takes clock= override
11 * string as an argument. Returns 0 on success, anything else
12 * on failure.
13 * @mark_offset: called by the timer interrupt.
14 * @get_offset: called by gettimeofday(). Returns the number of microseconds
15 * since the last timer interupt.
16 * @monotonic_clock: returns the number of nanoseconds since the init of the
17 * timer.
18 * @delay: delays this many clock cycles.
19 */
20struct timer_opts {
21 char* name;
22 void (*mark_offset)(void);
23 unsigned long (*get_offset)(void);
24 unsigned long long (*monotonic_clock)(void);
25 void (*delay)(unsigned long);
26 unsigned long (*read_timer)(void);
27 int (*suspend)(pm_message_t state);
28 int (*resume)(void);
29};
30
31struct init_timer_opts {
32 int (*init)(char *override);
33 struct timer_opts *opts;
34};
35
36#define TICK_SIZE (tick_nsec / 1000) 6#define TICK_SIZE (tick_nsec / 1000)
37
38extern struct timer_opts* __init select_timer(void);
39extern void clock_fallback(void);
40void setup_pit_timer(void); 7void setup_pit_timer(void);
41
42/* Modifiers for buggy PIT handling */ 8/* Modifiers for buggy PIT handling */
43
44extern int pit_latch_buggy; 9extern int pit_latch_buggy;
45
46extern struct timer_opts *cur_timer;
47extern int timer_ack; 10extern int timer_ack;
48
49/* list of externed timers */
50extern struct timer_opts timer_none;
51extern struct timer_opts timer_pit;
52extern struct init_timer_opts timer_pit_init;
53extern struct init_timer_opts timer_tsc_init;
54#ifdef CONFIG_X86_CYCLONE_TIMER
55extern struct init_timer_opts timer_cyclone_init;
56#endif
57
58extern unsigned long calibrate_tsc(void);
59extern unsigned long read_timer_tsc(void);
60extern void init_cpu_khz(void);
61extern int recalibrate_cpu_khz(void); 11extern int recalibrate_cpu_khz(void);
62#ifdef CONFIG_HPET_TIMER
63extern struct init_timer_opts timer_hpet_init;
64extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr);
65#endif
66 12
67#ifdef CONFIG_X86_PM_TIMER
68extern struct init_timer_opts timer_pmtmr_init;
69#endif
70#endif 13#endif
diff --git a/include/asm-i386/timex.h b/include/asm-i386/timex.h
index d434984303..3666044409 100644
--- a/include/asm-i386/timex.h
+++ b/include/asm-i386/timex.h
@@ -7,6 +7,7 @@
7#define _ASMi386_TIMEX_H 7#define _ASMi386_TIMEX_H
8 8
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/tsc.h>
10 11
11#ifdef CONFIG_X86_ELAN 12#ifdef CONFIG_X86_ELAN
12# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */ 13# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */
@@ -15,39 +16,6 @@
15#endif 16#endif
16 17
17 18
18/*
19 * Standard way to access the cycle counter on i586+ CPUs.
20 * Currently only used on SMP.
21 *
22 * If you really have a SMP machine with i486 chips or older,
23 * compile for that, and this will just always return zero.
24 * That's ok, it just means that the nicer scheduling heuristics
25 * won't work for you.
26 *
27 * We only use the low 32 bits, and we'd simply better make sure
28 * that we reschedule before that wraps. Scheduling at least every
29 * four billion cycles just basically sounds like a good idea,
30 * regardless of how fast the machine is.
31 */
32typedef unsigned long long cycles_t;
33
34static inline cycles_t get_cycles (void)
35{
36 unsigned long long ret=0;
37
38#ifndef CONFIG_X86_TSC
39 if (!cpu_has_tsc)
40 return 0;
41#endif
42
43#if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
44 rdtscll(ret);
45#endif
46 return ret;
47}
48
49extern unsigned int cpu_khz;
50
51extern int read_current_timer(unsigned long *timer_value); 19extern int read_current_timer(unsigned long *timer_value);
52#define ARCH_HAS_READ_CURRENT_TIMER 1 20#define ARCH_HAS_READ_CURRENT_TIMER 1
53 21
diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
index d57ca5c540..360648b0f2 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 b94e5eeef9..6adbd9b1ae 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -28,10 +28,8 @@
28#define _ASM_I386_TOPOLOGY_H 28#define _ASM_I386_TOPOLOGY_H
29 29
30#ifdef CONFIG_X86_HT 30#ifdef CONFIG_X86_HT
31#define topology_physical_package_id(cpu) \ 31#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id)
32 (phys_proc_id[cpu] == BAD_APICID ? -1 : phys_proc_id[cpu]) 32#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id)
33#define topology_core_id(cpu) \
34 (cpu_core_id[cpu] == BAD_APICID ? 0 : cpu_core_id[cpu])
35#define topology_core_siblings(cpu) (cpu_core_map[cpu]) 33#define topology_core_siblings(cpu) (cpu_core_map[cpu])
36#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) 34#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
37#endif 35#endif
@@ -114,4 +112,9 @@ extern unsigned long node_remap_size[];
114 112
115extern cpumask_t cpu_coregroup_map(int cpu); 113extern cpumask_t cpu_coregroup_map(int cpu);
116 114
115#ifdef CONFIG_SMP
116#define mc_capable() (boot_cpu_data.x86_max_cores > 1)
117#define smt_capable() (smp_num_siblings > 1)
118#endif
119
117#endif /* _ASM_I386_TOPOLOGY_H */ 120#endif /* _ASM_I386_TOPOLOGY_H */
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
new file mode 100644
index 0000000000..c13933185c
--- /dev/null
+++ b/include/asm-i386/tsc.h
@@ -0,0 +1,48 @@
1/*
2 * linux/include/asm-i386/tsc.h
3 *
4 * i386 TSC related functions
5 */
6#ifndef _ASM_i386_TSC_H
7#define _ASM_i386_TSC_H
8
9#include <asm/processor.h>
10
11/*
12 * Standard way to access the cycle counter on i586+ CPUs.
13 * Currently only used on SMP.
14 *
15 * If you really have a SMP machine with i486 chips or older,
16 * compile for that, and this will just always return zero.
17 * That's ok, it just means that the nicer scheduling heuristics
18 * won't work for you.
19 *
20 * We only use the low 32 bits, and we'd simply better make sure
21 * that we reschedule before that wraps. Scheduling at least every
22 * four billion cycles just basically sounds like a good idea,
23 * regardless of how fast the machine is.
24 */
25typedef unsigned long long cycles_t;
26
27extern unsigned int cpu_khz;
28extern unsigned int tsc_khz;
29
30static inline cycles_t get_cycles(void)
31{
32 unsigned long long ret = 0;
33
34#ifndef CONFIG_X86_TSC
35 if (!cpu_has_tsc)
36 return 0;
37#endif
38
39#if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
40 rdtscll(ret);
41#endif
42 return ret;
43}
44
45extern void tsc_init(void);
46extern void mark_tsc_unstable(void);
47
48#endif
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 8462f8e0e6..54d905ebc6 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -390,8 +390,12 @@ unsigned long __must_check __copy_to_user_ll(void __user *to,
390 const void *from, unsigned long n); 390 const void *from, unsigned long n);
391unsigned long __must_check __copy_from_user_ll(void *to, 391unsigned long __must_check __copy_from_user_ll(void *to,
392 const void __user *from, unsigned long n); 392 const void __user *from, unsigned long n);
393unsigned long __must_check __copy_from_user_ll_nozero(void *to,
394 const void __user *from, unsigned long n);
393unsigned long __must_check __copy_from_user_ll_nocache(void *to, 395unsigned long __must_check __copy_from_user_ll_nocache(void *to,
394 const void __user *from, unsigned long n); 396 const void __user *from, unsigned long n);
397unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to,
398 const void __user *from, unsigned long n);
395 399
396/* 400/*
397 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault 401 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
@@ -458,10 +462,41 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
458 * 462 *
459 * If some data could not be copied, this function will pad the copied 463 * If some data could not be copied, this function will pad the copied
460 * data to the requested size using zero bytes. 464 * data to the requested size using zero bytes.
465 *
466 * An alternate version - __copy_from_user_inatomic() - may be called from
467 * atomic context and will fail rather than sleep. In this case the
468 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
469 * for explanation of why this is needed.
461 */ 470 */
462static __always_inline unsigned long 471static __always_inline unsigned long
463__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) 472__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
464{ 473{
474 /* Avoid zeroing the tail if the copy fails..
475 * If 'n' is constant and 1, 2, or 4, we do still zero on a failure,
476 * but as the zeroing behaviour is only significant when n is not
477 * constant, that shouldn't be a problem.
478 */
479 if (__builtin_constant_p(n)) {
480 unsigned long ret;
481
482 switch (n) {
483 case 1:
484 __get_user_size(*(u8 *)to, from, 1, ret, 1);
485 return ret;
486 case 2:
487 __get_user_size(*(u16 *)to, from, 2, ret, 2);
488 return ret;
489 case 4:
490 __get_user_size(*(u32 *)to, from, 4, ret, 4);
491 return ret;
492 }
493 }
494 return __copy_from_user_ll_nozero(to, from, n);
495}
496static __always_inline unsigned long
497__copy_from_user(void *to, const void __user *from, unsigned long n)
498{
499 might_sleep();
465 if (__builtin_constant_p(n)) { 500 if (__builtin_constant_p(n)) {
466 unsigned long ret; 501 unsigned long ret;
467 502
@@ -482,9 +517,10 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
482 517
483#define ARCH_HAS_NOCACHE_UACCESS 518#define ARCH_HAS_NOCACHE_UACCESS
484 519
485static __always_inline unsigned long __copy_from_user_inatomic_nocache(void *to, 520static __always_inline unsigned long __copy_from_user_nocache(void *to,
486 const void __user *from, unsigned long n) 521 const void __user *from, unsigned long n)
487{ 522{
523 might_sleep();
488 if (__builtin_constant_p(n)) { 524 if (__builtin_constant_p(n)) {
489 unsigned long ret; 525 unsigned long ret;
490 526
@@ -504,17 +540,9 @@ static __always_inline unsigned long __copy_from_user_inatomic_nocache(void *to,
504} 540}
505 541
506static __always_inline unsigned long 542static __always_inline unsigned long
507__copy_from_user(void *to, const void __user *from, unsigned long n) 543__copy_from_user_inatomic_nocache(void *to, const void __user *from, unsigned long n)
508{ 544{
509 might_sleep(); 545 return __copy_from_user_ll_nocache_nozero(to, from, n);
510 return __copy_from_user_inatomic(to, from, n);
511}
512
513static __always_inline unsigned long
514__copy_from_user_nocache(void *to, const void __user *from, unsigned long n)
515{
516 might_sleep();
517 return __copy_from_user_inatomic_nocache(to, from, n);
518} 546}
519 547
520unsigned long __must_check copy_to_user(void __user *to, 548unsigned long __must_check copy_to_user(void __user *to,
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index fc1c8ddae1..bd9987087a 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 } \
diff --git a/include/asm-i386/unwind.h b/include/asm-i386/unwind.h
new file mode 100644
index 0000000000..5031d693b8
--- /dev/null
+++ b/include/asm-i386/unwind.h
@@ -0,0 +1,107 @@
1#ifndef _ASM_I386_UNWIND_H
2#define _ASM_I386_UNWIND_H
3
4/*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
8 */
9
10#ifdef CONFIG_STACK_UNWIND
11
12#include <linux/sched.h>
13#include <asm/fixmap.h>
14#include <asm/ptrace.h>
15#include <asm/uaccess.h>
16
17struct unwind_frame_info
18{
19 struct pt_regs regs;
20 struct task_struct *task;
21 unsigned call_frame:1;
22};
23
24#define UNW_PC(frame) (frame)->regs.eip
25#define UNW_SP(frame) (frame)->regs.esp
26#ifdef CONFIG_FRAME_POINTER
27#define UNW_FP(frame) (frame)->regs.ebp
28#define FRAME_RETADDR_OFFSET 4
29#define FRAME_LINK_OFFSET 0
30#define STACK_BOTTOM(tsk) STACK_LIMIT((tsk)->thread.esp0)
31#define STACK_TOP(tsk) ((tsk)->thread.esp0)
32#else
33#define UNW_FP(frame) ((void)(frame), 0)
34#endif
35#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
36
37#define UNW_REGISTER_INFO \
38 PTREGS_INFO(eax), \
39 PTREGS_INFO(ecx), \
40 PTREGS_INFO(edx), \
41 PTREGS_INFO(ebx), \
42 PTREGS_INFO(esp), \
43 PTREGS_INFO(ebp), \
44 PTREGS_INFO(esi), \
45 PTREGS_INFO(edi), \
46 PTREGS_INFO(eip)
47
48#define UNW_DEFAULT_RA(raItem, dataAlign) \
49 ((raItem).where == Memory && \
50 !((raItem).value * (dataAlign) + 4))
51
52static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
53 /*const*/ struct pt_regs *regs)
54{
55 if (user_mode_vm(regs))
56 info->regs = *regs;
57 else {
58 memcpy(&info->regs, regs, offsetof(struct pt_regs, esp));
59 info->regs.esp = (unsigned long)&regs->esp;
60 info->regs.xss = __KERNEL_DS;
61 }
62}
63
64static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
65{
66 memset(&info->regs, 0, sizeof(info->regs));
67 info->regs.eip = info->task->thread.eip;
68 info->regs.xcs = __KERNEL_CS;
69 __get_user(info->regs.ebp, (long *)info->task->thread.esp);
70 info->regs.esp = info->task->thread.esp;
71 info->regs.xss = __KERNEL_DS;
72 info->regs.xds = __USER_DS;
73 info->regs.xes = __USER_DS;
74}
75
76extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *,
77 asmlinkage int (*callback)(struct unwind_frame_info *,
78 void *arg),
79 void *arg);
80
81static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
82{
83#if 0 /* This can only work when selector register and EFLAGS saves/restores
84 are properly annotated (and tracked in UNW_REGISTER_INFO). */
85 return user_mode_vm(&info->regs);
86#else
87 return info->regs.eip < PAGE_OFFSET
88 || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
89 && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
90 || info->regs.esp < PAGE_OFFSET;
91#endif
92}
93
94#else
95
96#define UNW_PC(frame) ((void)(frame), 0)
97#define UNW_SP(frame) ((void)(frame), 0)
98#define UNW_FP(frame) ((void)(frame), 0)
99
100static inline int arch_unw_user_mode(const void *info)
101{
102 return 0;
103}
104
105#endif
106
107#endif /* _ASM_I386_UNWIND_H */
diff --git a/include/asm-ia64/Kbuild b/include/asm-ia64/Kbuild
new file mode 100644
index 0000000000..15818a18bc
--- /dev/null
+++ b/include/asm-ia64/Kbuild
@@ -0,0 +1,17 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += break.h
4header-y += fpu.h
5header-y += fpswa.h
6header-y += gcc_intrin.h
7header-y += ia64regs.h
8header-y += intel_intrin.h
9header-y += intrinsics.h
10header-y += perfmon_default_smpl.h
11header-y += ptrace_offsets.h
12header-y += rse.h
13header-y += setup.h
14header-y += ucontext.h
15
16unifdef-y += perfmon.h
17unifdef-y += ustack.h
diff --git a/include/asm-ia64/esi.h b/include/asm-ia64/esi.h
new file mode 100644
index 0000000000..84aac0e0b5
--- /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 6a332a9f09..07d77f3a8c 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/hw_irq.h b/include/asm-ia64/hw_irq.h
index ea8b8c407a..27f9df6b91 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -97,8 +97,7 @@ extern int reserve_irq_vector (int vector);
97extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); 97extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect);
98extern void register_percpu_irq (ia64_vector vec, struct irqaction *action); 98extern void register_percpu_irq (ia64_vector vec, struct irqaction *action);
99 99
100static inline void 100static inline void ia64_resend_irq(unsigned int vector)
101hw_resend_irq (struct hw_interrupt_type *h, unsigned int vector)
102{ 101{
103 platform_send_ipi(smp_processor_id(), vector, IA64_IPI_DM_INT, 0); 102 platform_send_ipi(smp_processor_id(), vector, IA64_IPI_DM_INT, 0);
104} 103}
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 781ee2c7e8..43bfff6c6b 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -90,7 +90,7 @@ phys_to_virt (unsigned long address)
90#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 90#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
91extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size); 91extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
92extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */ 92extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */
93extern int valid_mmap_phys_addr_range (unsigned long addr, size_t count); 93extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
94 94
95/* 95/*
96 * The following two macros are deprecated and scheduled for removal. 96 * The following two macros are deprecated and scheduled for removal.
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index dbe86c0bbc..79479e2c69 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -14,11 +14,6 @@
14#define NR_IRQS 256 14#define NR_IRQS 256
15#define NR_IRQ_VECTORS NR_IRQS 15#define NR_IRQ_VECTORS NR_IRQS
16 16
17/*
18 * IRQ line status macro IRQ_PER_CPU is used
19 */
20#define ARCH_HAS_IRQ_PER_CPU
21
22static __inline__ int 17static __inline__ int
23irq_canonicalize (int irq) 18irq_canonicalize (int irq)
24{ 19{
diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h
index c195a9ad12..aed7142f9e 100644
--- a/include/asm-ia64/kdebug.h
+++ b/include/asm-ia64/kdebug.h
@@ -40,6 +40,8 @@ struct die_args {
40 40
41extern int register_die_notifier(struct notifier_block *); 41extern int register_die_notifier(struct notifier_block *);
42extern int unregister_die_notifier(struct notifier_block *); 42extern int unregister_die_notifier(struct notifier_block *);
43extern int register_page_fault_notifier(struct notifier_block *);
44extern int unregister_page_fault_notifier(struct notifier_block *);
43extern struct atomic_notifier_head ia64die_chain; 45extern struct atomic_notifier_head ia64die_chain;
44 46
45enum die_val { 47enum die_val {
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 8c0fc227f0..1b45b71c79 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 {
@@ -82,6 +83,7 @@ struct kprobe_ctlblk {
82#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 83#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
83 84
84#define ARCH_SUPPORTS_KRETPROBES 85#define ARCH_SUPPORTS_KRETPROBES
86#define ARCH_INACTIVE_KPROBE_COUNT 1
85 87
86#define SLOT0_OPCODE_SHIFT (37) 88#define SLOT0_OPCODE_SHIFT (37)
87#define SLOT1_p1_OPCODE_SHIFT (37 - (64-46)) 89#define SLOT1_p1_OPCODE_SHIFT (37 - (64-46))
@@ -93,7 +95,7 @@ struct kprobe_ctlblk {
93#define IP_RELATIVE_PREDICT_OPCODE (7) 95#define IP_RELATIVE_PREDICT_OPCODE (7)
94#define LONG_BRANCH_OPCODE (0xC) 96#define LONG_BRANCH_OPCODE (0xC)
95#define LONG_CALL_OPCODE (0xD) 97#define LONG_CALL_OPCODE (0xD)
96#define arch_remove_kprobe(p) do {} while (0) 98#define flush_insn_slot(p) do { } while (0)
97 99
98typedef struct kprobe_opcode { 100typedef struct kprobe_opcode {
99 bundle_t bundle; 101 bundle_t bundle;
@@ -107,7 +109,7 @@ struct fnptr {
107/* Architecture specific copy of original instruction*/ 109/* Architecture specific copy of original instruction*/
108struct arch_specific_insn { 110struct arch_specific_insn {
109 /* copy of the instruction to be emulated */ 111 /* copy of the instruction to be emulated */
110 kprobe_opcode_t insn; 112 kprobe_opcode_t *insn;
111 #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 113 #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1
112 #define INST_FLAG_FIX_BRANCH_REG 2 114 #define INST_FLAG_FIX_BRANCH_REG 2
113 #define INST_FLAG_BREAK_INST 4 115 #define INST_FLAG_BREAK_INST 4
@@ -124,5 +126,6 @@ static inline void jprobe_return(void)
124} 126}
125extern void invalidate_stacked_regs(void); 127extern void invalidate_stacked_regs(void);
126extern void flush_register_stack(void); 128extern void flush_register_stack(void);
129extern void arch_remove_kprobe(struct kprobe *p);
127 130
128#endif /* _ASM_KPROBES_H */ 131#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h
index 27c9203d8c..76203f9a87 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 894bc4d89d..c3b1f862e6 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -55,7 +55,13 @@ 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);
60 extern int vmemmap_find_next_valid_pfn(int, int);
61#else
62static inline int vmemmap_find_next_valid_pfn(int node, int i)
63{
64 return i + 1;
65}
59#endif 66#endif
60
61#endif /* meminit_h */ 67#endif /* meminit_h */
diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h
index 6ba179f127..c73b87832a 100644
--- a/include/asm-ia64/mman.h
+++ b/include/asm-ia64/mman.h
@@ -22,4 +22,12 @@
22#define MCL_CURRENT 1 /* lock all current mappings */ 22#define MCL_CURRENT 1 /* lock all current mappings */
23#define MCL_FUTURE 2 /* lock all future mappings */ 23#define MCL_FUTURE 2 /* lock all future mappings */
24 24
25#ifdef __KERNEL__
26#ifndef __ASSEMBLY__
27#define arch_mmap_check ia64_mmap_check
28int ia64_mmap_check(unsigned long addr, unsigned long len,
29 unsigned long flags);
30#endif
31#endif
32
25#endif /* _ASM_IA64_MMAN_H */ 33#endif /* _ASM_IA64_MMAN_H */
diff --git a/include/asm-ia64/module.h b/include/asm-ia64/module.h
index 85c82bd819..d2da61e4c4 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/nodedata.h b/include/asm-ia64/nodedata.h
index a140310bf8..2fb337b0e9 100644
--- a/include/asm-ia64/nodedata.h
+++ b/include/asm-ia64/nodedata.h
@@ -46,6 +46,18 @@ struct ia64_node_data {
46 */ 46 */
47#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid]) 47#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
48 48
49/*
50 * LOCAL_DATA_ADDR - This is to calculate the address of other node's
51 * "local_node_data" at hot-plug phase. The local_node_data
52 * is pointed by per_cpu_page. Kernel usually use it for
53 * just executing cpu. However, when new node is hot-added,
54 * the addresses of local data for other nodes are necessary
55 * to update all of them.
56 */
57#define LOCAL_DATA_ADDR(pgdat) \
58 ((struct ia64_node_data *)((u64)(pgdat) + \
59 L1_CACHE_ALIGN(sizeof(struct pglist_data))))
60
49#endif /* CONFIG_NUMA */ 61#endif /* CONFIG_NUMA */
50 62
51#endif /* _ASM_IA64_NODEDATA_H */ 63#endif /* _ASM_IA64_NODEDATA_H */
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
index e5a8260593..7d5e2ccc37 100644
--- a/include/asm-ia64/numa.h
+++ b/include/asm-ia64/numa.h
@@ -64,7 +64,13 @@ extern int paddr_to_nid(unsigned long paddr);
64 64
65#define local_nodeid (cpu_to_node_map[smp_processor_id()]) 65#define local_nodeid (cpu_to_node_map[smp_processor_id()])
66 66
67extern void map_cpu_to_node(int cpu, int nid);
68extern void unmap_cpu_from_node(int cpu, int nid);
69
70
67#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)
68 74
69#define paddr_to_nid(addr) 0 75#define paddr_to_nid(addr) 0
70 76
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index f5a949ec6e..947cb72b52 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -7,6 +7,7 @@
7 * David Mosberger-Tang <davidm@hpl.hp.com> 7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 */ 8 */
9 9
10# ifdef __KERNEL__
10 11
11#include <asm/intrinsics.h> 12#include <asm/intrinsics.h>
12#include <asm/types.h> 13#include <asm/types.h>
@@ -64,7 +65,6 @@
64# define __pa(x) ((x) - PAGE_OFFSET) 65# define __pa(x) ((x) - PAGE_OFFSET)
65# define __va(x) ((x) + PAGE_OFFSET) 66# define __va(x) ((x) + PAGE_OFFSET)
66#else /* !__ASSEMBLY */ 67#else /* !__ASSEMBLY */
67# ifdef __KERNEL__
68# define STRICT_MM_TYPECHECKS 68# define STRICT_MM_TYPECHECKS
69 69
70extern void clear_page (void *page); 70extern void clear_page (void *page);
@@ -174,7 +174,6 @@ get_order (unsigned long size)
174 return order; 174 return order;
175} 175}
176 176
177# endif /* __KERNEL__ */
178#endif /* !__ASSEMBLY__ */ 177#endif /* !__ASSEMBLY__ */
179 178
180#ifdef STRICT_MM_TYPECHECKS 179#ifdef STRICT_MM_TYPECHECKS
@@ -228,4 +227,5 @@ get_order (unsigned long size)
228 (((current->personality & READ_IMPLIES_EXEC) != 0) \ 227 (((current->personality & READ_IMPLIES_EXEC) != 0) \
229 ? VM_EXEC : 0)) 228 ? VM_EXEC : 0))
230 229
230# endif /* __KERNEL__ */
231#endif /* _ASM_IA64_PAGE_H */ 231#endif /* _ASM_IA64_PAGE_H */
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 37e52a2836..2c8fd92d0e 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 */
@@ -1433,7 +1445,12 @@ typedef union pal_version_u {
1433} pal_version_u_t; 1445} pal_version_u_t;
1434 1446
1435 1447
1436/* Return PAL version information */ 1448/*
1449 * Return PAL version information. While the documentation states that
1450 * PAL_VERSION can be called in either physical or virtual mode, some
1451 * implementations only allow physical calls. We don't call it very often,
1452 * so the overhead isn't worth eliminating.
1453 */
1437static inline s64 1454static inline s64
1438ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version) 1455ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version)
1439{ 1456{
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
index ae357d504f..fbe5cf3ab8 100644
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -36,12 +36,14 @@
36#ifdef CONFIG_SMP 36#ifdef CONFIG_SMP
37 37
38extern unsigned long __per_cpu_offset[NR_CPUS]; 38extern unsigned long __per_cpu_offset[NR_CPUS];
39#define per_cpu_offset(x) (__per_cpu_offset(x))
39 40
40/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ 41/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
41DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); 42DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
42 43
43#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) 44#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
44#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset))) 45#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
46#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
45 47
46extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size); 48extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
47extern void setup_per_cpu_areas (void); 49extern void setup_per_cpu_areas (void);
@@ -51,6 +53,7 @@ extern void *per_cpu_init(void);
51 53
52#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 54#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
53#define __get_cpu_var(var) per_cpu__##var 55#define __get_cpu_var(var) per_cpu__##var
56#define __raw_get_cpu_var(var) per_cpu__##var
54#define per_cpu_init() (__phys_per_cpu_start) 57#define per_cpu_init() (__phys_per_cpu_start)
55 58
56#endif /* SMP */ 59#endif /* SMP */
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 228981cadf..5531827477 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -275,21 +275,23 @@ ia64_phys_addr_valid (unsigned long addr)
275#define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd))) 275#define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd)))
276#define pmd_present(pmd) (pmd_val(pmd) != 0UL) 276#define pmd_present(pmd) (pmd_val(pmd) != 0UL)
277#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) 277#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
278#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK)) 278#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK))
279#define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET)) 279#define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET))
280 280
281#define pud_none(pud) (!pud_val(pud)) 281#define pud_none(pud) (!pud_val(pud))
282#define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud))) 282#define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud)))
283#define pud_present(pud) (pud_val(pud) != 0UL) 283#define pud_present(pud) (pud_val(pud) != 0UL)
284#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) 284#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
285#define pud_page(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) 285#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK))
286#define pud_page(pud) virt_to_page((pud_val(pud) + PAGE_OFFSET))
286 287
287#ifdef CONFIG_PGTABLE_4 288#ifdef CONFIG_PGTABLE_4
288#define pgd_none(pgd) (!pgd_val(pgd)) 289#define pgd_none(pgd) (!pgd_val(pgd))
289#define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd))) 290#define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd)))
290#define pgd_present(pgd) (pgd_val(pgd) != 0UL) 291#define pgd_present(pgd) (pgd_val(pgd) != 0UL)
291#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) 292#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL)
292#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK)) 293#define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK))
294#define pgd_page(pgd) virt_to_page((pgd_val(pgd) + PAGE_OFFSET))
293#endif 295#endif
294 296
295/* 297/*
@@ -360,19 +362,19 @@ pgd_offset (struct mm_struct *mm, unsigned long address)
360#ifdef CONFIG_PGTABLE_4 362#ifdef CONFIG_PGTABLE_4
361/* Find an entry in the second-level page table.. */ 363/* Find an entry in the second-level page table.. */
362#define pud_offset(dir,addr) \ 364#define pud_offset(dir,addr) \
363 ((pud_t *) pgd_page(*(dir)) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) 365 ((pud_t *) pgd_page_vaddr(*(dir)) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))
364#endif 366#endif
365 367
366/* Find an entry in the third-level page table.. */ 368/* Find an entry in the third-level page table.. */
367#define pmd_offset(dir,addr) \ 369#define pmd_offset(dir,addr) \
368 ((pmd_t *) pud_page(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) 370 ((pmd_t *) pud_page_vaddr(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
369 371
370/* 372/*
371 * Find an entry in the third-level page table. This looks more complicated than it 373 * Find an entry in the third-level page table. This looks more complicated than it
372 * should be because some platforms place page tables in high memory. 374 * should be because some platforms place page tables in high memory.
373 */ 375 */
374#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 376#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
375#define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) 377#define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr))
376#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) 378#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr)
377#define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr) 379#define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr)
378#define pte_unmap(pte) do { } while (0) 380#define pte_unmap(pte) do { } while (0)
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 265f4824db..5830d36fd8 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 415abb23b2..1414316efd 100644
--- a/include/asm-ia64/ptrace.h
+++ b/include/asm-ia64/ptrace.h
@@ -56,6 +56,8 @@
56 56
57 57
58#include <asm/fpu.h> 58#include <asm/fpu.h>
59
60#ifdef __KERNEL__
59#ifndef ASM_OFFSETS_C 61#ifndef ASM_OFFSETS_C
60#include <asm/asm-offsets.h> 62#include <asm/asm-offsets.h>
61#endif 63#endif
@@ -79,10 +81,9 @@
79 81
80#define KERNEL_STACK_SIZE IA64_STK_OFFSET 82#define KERNEL_STACK_SIZE IA64_STK_OFFSET
81 83
82#ifndef __ASSEMBLY__ 84#endif /* __KERNEL__ */
83 85
84#include <asm/current.h> 86#ifndef __ASSEMBLY__
85#include <asm/page.h>
86 87
87/* 88/*
88 * This struct defines the way the registers are saved on system 89 * This struct defines the way the registers are saved on system
@@ -229,6 +230,9 @@ struct switch_stack {
229 230
230#ifdef __KERNEL__ 231#ifdef __KERNEL__
231 232
233#include <asm/current.h>
234#include <asm/page.h>
235
232#define __ARCH_SYS_PTRACE 1 236#define __ARCH_SYS_PTRACE 1
233 237
234/* 238/*
diff --git a/include/asm-ia64/rwsem.h b/include/asm-ia64/rwsem.h
index 1327c91ea3..2d1640cc24 100644
--- a/include/asm-ia64/rwsem.h
+++ b/include/asm-ia64/rwsem.h
@@ -33,9 +33,6 @@ struct rw_semaphore {
33 signed long count; 33 signed long count;
34 spinlock_t wait_lock; 34 spinlock_t wait_lock;
35 struct list_head wait_list; 35 struct list_head wait_list;
36#if RWSEM_DEBUG
37 int debug;
38#endif
39}; 36};
40 37
41#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000) 38#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
@@ -45,19 +42,9 @@ struct rw_semaphore {
45#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 42#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
46#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 43#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
47 44
48/*
49 * initialization
50 */
51#if RWSEM_DEBUG
52#define __RWSEM_DEBUG_INIT , 0
53#else
54#define __RWSEM_DEBUG_INIT /* */
55#endif
56
57#define __RWSEM_INITIALIZER(name) \ 45#define __RWSEM_INITIALIZER(name) \
58 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 46 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
59 LIST_HEAD_INIT((name).wait_list) \ 47 LIST_HEAD_INIT((name).wait_list) }
60 __RWSEM_DEBUG_INIT }
61 48
62#define DECLARE_RWSEM(name) \ 49#define DECLARE_RWSEM(name) \
63 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 50 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -73,9 +60,6 @@ init_rwsem (struct rw_semaphore *sem)
73 sem->count = RWSEM_UNLOCKED_VALUE; 60 sem->count = RWSEM_UNLOCKED_VALUE;
74 spin_lock_init(&sem->wait_lock); 61 spin_lock_init(&sem->wait_lock);
75 INIT_LIST_HEAD(&sem->wait_list); 62 INIT_LIST_HEAD(&sem->wait_list);
76#if RWSEM_DEBUG
77 sem->debug = 0;
78#endif
79} 63}
80 64
81/* 65/*
diff --git a/include/asm-ia64/signal.h b/include/asm-ia64/signal.h
index 5e328ed5d0..4f5ca5643c 100644
--- a/include/asm-ia64/signal.h
+++ b/include/asm-ia64/signal.h
@@ -56,7 +56,6 @@
56 * SA_FLAGS values: 56 * SA_FLAGS values:
57 * 57 *
58 * SA_ONSTACK indicates that a registered stack_t will be used. 58 * SA_ONSTACK indicates that a registered stack_t will be used.
59 * SA_INTERRUPT is a no-op, but left due to historical reasons.
60 * SA_RESTART flag to get restarting signals (which were the default long ago) 59 * SA_RESTART flag to get restarting signals (which were the default long ago)
61 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 60 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
62 * SA_RESETHAND clears the handler when the signal is delivered. 61 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -76,7 +75,6 @@
76 75
77#define SA_NOMASK SA_NODEFER 76#define SA_NOMASK SA_NODEFER
78#define SA_ONESHOT SA_RESETHAND 77#define SA_ONESHOT SA_RESETHAND
79#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
80 78
81#define SA_RESTORER 0x04000000 79#define SA_RESTORER 0x04000000
82 80
@@ -114,8 +112,6 @@
114#define _NSIG_BPW 64 112#define _NSIG_BPW 64
115#define _NSIG_WORDS (_NSIG / _NSIG_BPW) 113#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
116 114
117#define SA_PERCPU_IRQ 0x02000000
118
119#endif /* __KERNEL__ */ 115#endif /* __KERNEL__ */
120 116
121#include <asm-generic/signal.h> 117#include <asm-generic/signal.h>
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 719ff309ce..60fd4ae014 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -122,12 +122,11 @@ extern void __init smp_build_cpu_map(void);
122extern void __init init_smp_config (void); 122extern void __init init_smp_config (void);
123extern void smp_do_timer (struct pt_regs *regs); 123extern void smp_do_timer (struct pt_regs *regs);
124 124
125extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
126 int retry, int wait);
127extern void smp_send_reschedule (int cpu); 125extern void smp_send_reschedule (int cpu);
128extern void lock_ipi_calllock(void); 126extern void lock_ipi_calllock(void);
129extern void unlock_ipi_calllock(void); 127extern void unlock_ipi_calllock(void);
130extern void identify_siblings (struct cpuinfo_ia64 *); 128extern void identify_siblings (struct cpuinfo_ia64 *);
129extern int is_multithreading_enabled(void);
131 130
132#else 131#else
133 132
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index cd490b20d5..ba826b3f75 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -85,6 +85,7 @@
85#define SN_SAL_GET_PROM_FEATURE_SET 0x02000065 85#define SN_SAL_GET_PROM_FEATURE_SET 0x02000065
86#define SN_SAL_SET_OS_FEATURE_SET 0x02000066 86#define SN_SAL_SET_OS_FEATURE_SET 0x02000066
87#define SN_SAL_INJECT_ERROR 0x02000067 87#define SN_SAL_INJECT_ERROR 0x02000067
88#define SN_SAL_SET_CPU_NUMBER 0x02000068
88 89
89/* 90/*
90 * Service-specific constants 91 * Service-specific constants
@@ -705,12 +706,9 @@ static inline int
705sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array) 706sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array)
706{ 707{
707 struct ia64_sal_retval ret_stuff; 708 struct ia64_sal_retval ret_stuff;
708 unsigned long irq_flags;
709 709
710 local_irq_save(irq_flags);
711 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len, 710 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len,
712 (u64)nasid_array, perms, 0, 0, 0); 711 (u64)nasid_array, perms, 0, 0, 0);
713 local_irq_restore(irq_flags);
714 return ret_stuff.status; 712 return ret_stuff.status;
715} 713}
716#define SN_MEMPROT_ACCESS_CLASS_0 0x14a080 714#define SN_MEMPROT_ACCESS_CLASS_0 0x14a080
@@ -1142,12 +1140,18 @@ static inline int
1142sn_inject_error(u64 paddr, u64 *data, u64 *ecc) 1140sn_inject_error(u64 paddr, u64 *data, u64 *ecc)
1143{ 1141{
1144 struct ia64_sal_retval ret_stuff; 1142 struct ia64_sal_retval ret_stuff;
1145 unsigned long irq_flags;
1146 1143
1147 local_irq_save(irq_flags);
1148 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_INJECT_ERROR, paddr, (u64)data, 1144 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_INJECT_ERROR, paddr, (u64)data,
1149 (u64)ecc, 0, 0, 0, 0); 1145 (u64)ecc, 0, 0, 0, 0);
1150 local_irq_restore(irq_flags);
1151 return ret_stuff.status; 1146 return ret_stuff.status;
1152} 1147}
1148
1149static inline int
1150ia64_sn_set_cpu_number(int cpu)
1151{
1152 struct ia64_sal_retval rv;
1153
1154 SAL_CALL_NOLOCK(rv, SN_SAL_SET_CPU_NUMBER, cpu, 0, 0, 0, 0, 0, 0);
1155 return rv.status;
1156}
1153#endif /* _ASM_IA64_SN_SN_SAL_H */ 1157#endif /* _ASM_IA64_SN_SN_SAL_H */
diff --git a/include/asm-ia64/sn/tioca_provider.h b/include/asm-ia64/sn/tioca_provider.h
index ab7fe24634..65cdd73c2a 100644
--- a/include/asm-ia64/sn/tioca_provider.h
+++ b/include/asm-ia64/sn/tioca_provider.h
@@ -27,7 +27,7 @@
27#define PV908234 (1 << 1) 27#define PV908234 (1 << 1)
28 /* CA:AGPDMA write request data mismatch with ABC1CL merge */ 28 /* CA:AGPDMA write request data mismatch with ABC1CL merge */
29#define PV895469 (1 << 1) 29#define PV895469 (1 << 1)
30 /* TIO:CA TLB invalidate of written GART entries possibly not occuring in CA*/ 30 /* TIO:CA TLB invalidate of written GART entries possibly not occurring in CA*/
31#define PV910244 (1 << 1) 31#define PV910244 (1 << 1)
32 32
33struct tioca_dmamap{ 33struct tioca_dmamap{
diff --git a/include/asm-ia64/sn/xp.h b/include/asm-ia64/sn/xp.h
index 9bd2f9bf32..6f807e0193 100644
--- a/include/asm-ia64/sn/xp.h
+++ b/include/asm-ia64/sn/xp.h
@@ -60,23 +60,37 @@
60 * the bte_copy() once in the hope that the failure was due to a temporary 60 * the bte_copy() once in the hope that the failure was due to a temporary
61 * aberration (i.e., the link going down temporarily). 61 * aberration (i.e., the link going down temporarily).
62 * 62 *
63 * See bte_copy for definition of the input parameters. 63 * src - physical address of the source of the transfer.
64 * vdst - virtual address of the destination of the transfer.
65 * len - number of bytes to transfer from source to destination.
66 * mode - see bte_copy() for definition.
67 * notification - see bte_copy() for definition.
64 * 68 *
65 * Note: xp_bte_copy() should never be called while holding a spinlock. 69 * Note: xp_bte_copy() should never be called while holding a spinlock.
66 */ 70 */
67static inline bte_result_t 71static inline bte_result_t
68xp_bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification) 72xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
69{ 73{
70 bte_result_t ret; 74 bte_result_t ret;
75 u64 pdst = ia64_tpa(vdst);
71 76
72 77
73 ret = bte_copy(src, dest, len, mode, notification); 78 /*
79 * Ensure that the physically mapped memory is contiguous.
80 *
81 * We do this by ensuring that the memory is from region 7 only.
82 * If the need should arise to use memory from one of the other
83 * regions, then modify the BUG_ON() statement to ensure that the
84 * memory from that region is always physically contiguous.
85 */
86 BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
74 87
88 ret = bte_copy(src, pdst, len, mode, notification);
75 if (ret != BTE_SUCCESS) { 89 if (ret != BTE_SUCCESS) {
76 if (!in_interrupt()) { 90 if (!in_interrupt()) {
77 cond_resched(); 91 cond_resched();
78 } 92 }
79 ret = bte_copy(src, dest, len, mode, notification); 93 ret = bte_copy(src, pdst, len, mode, notification);
80 } 94 }
81 95
82 return ret; 96 return ret;
diff --git a/include/asm-ia64/sn/xpc.h b/include/asm-ia64/sn/xpc.h
index 8406f1ef4c..35e1386f37 100644
--- a/include/asm-ia64/sn/xpc.h
+++ b/include/asm-ia64/sn/xpc.h
@@ -683,7 +683,9 @@ extern struct xpc_vars *xpc_vars;
683extern struct xpc_rsvd_page *xpc_rsvd_page; 683extern struct xpc_rsvd_page *xpc_rsvd_page;
684extern struct xpc_vars_part *xpc_vars_part; 684extern struct xpc_vars_part *xpc_vars_part;
685extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1]; 685extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
686extern char xpc_remote_copy_buffer[]; 686extern char *xpc_remote_copy_buffer;
687extern void *xpc_remote_copy_buffer_base;
688extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **);
687extern struct xpc_rsvd_page *xpc_rsvd_page_init(void); 689extern struct xpc_rsvd_page *xpc_rsvd_page_init(void);
688extern void xpc_allow_IPI_ops(void); 690extern void xpc_allow_IPI_ops(void);
689extern void xpc_restrict_IPI_ops(void); 691extern void xpc_restrict_IPI_ops(void);
@@ -1124,8 +1126,8 @@ xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
1124#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff)) 1126#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
1125#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8)) 1127#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
1126 1128
1127#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f) 1129#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & __IA64_UL_CONST(0x0f0f0f0f0f0f0f0f))
1128#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010) 1130#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & __IA64_UL_CONST(0x1010101010101010))
1129 1131
1130 1132
1131static inline void 1133static inline void
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index a255006fb7..d638ef3d50 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -57,5 +57,6 @@
57#define SO_ACCEPTCONN 30 57#define SO_ACCEPTCONN 30
58 58
59#define SO_PEERSEC 31 59#define SO_PEERSEC 31
60#define SO_PASSSEC 34
60 61
61#endif /* _ASM_IA64_SOCKET_H */ 62#endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 65db43ce4d..384fbf7f2a 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -24,7 +24,7 @@
24 * 0xa000000000000000+2*PERCPU_PAGE_SIZE 24 * 0xa000000000000000+2*PERCPU_PAGE_SIZE
25 * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page) 25 * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
26 */ 26 */
27#define KERNEL_START (GATE_ADDR+0x100000000) 27#define KERNEL_START (GATE_ADDR+__IA64_UL_CONST(0x100000000))
28#define PERCPU_ADDR (-PERCPU_PAGE_SIZE) 28#define PERCPU_ADDR (-PERCPU_PAGE_SIZE)
29 29
30#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
@@ -98,12 +98,11 @@ extern struct ia64_boot_param {
98#endif 98#endif
99 99
100/* 100/*
101 * XXX check on these---I suspect what Linus really wants here is 101 * XXX check on this ---I suspect what Linus really wants here is
102 * acquire vs release semantics but we can't discuss this stuff with 102 * acquire vs release semantics but we can't discuss this stuff with
103 * Linus just yet. Grrr... 103 * Linus just yet. Grrr...
104 */ 104 */
105#define set_mb(var, value) do { (var) = (value); mb(); } while (0) 105#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
106#define set_wmb(var, value) do { (var) = (value); mb(); } while (0)
107 106
108#define safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */ 107#define safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */
109 108
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index e5392c4d30..8adcde0934 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -27,6 +27,7 @@ struct thread_info {
27 __u32 flags; /* thread_info flags (see TIF_*) */ 27 __u32 flags; /* thread_info flags (see TIF_*) */
28 __u32 cpu; /* current CPU */ 28 __u32 cpu; /* current CPU */
29 __u32 last_cpu; /* Last CPU thread ran on */ 29 __u32 last_cpu; /* Last CPU thread ran on */
30 __u32 status; /* Thread synchronous flags */
30 mm_segment_t addr_limit; /* user-level address space limit */ 31 mm_segment_t addr_limit; /* user-level address space limit */
31 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ 32 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
32 struct restart_block restart_block; 33 struct restart_block restart_block;
@@ -67,7 +68,7 @@ struct thread_info {
67#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET) 68#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
68 69
69#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR 70#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
70#define alloc_task_struct() ((task_t *)__get_free_pages(GFP_KERNEL | __GFP_COMP, KERNEL_STACK_SIZE_ORDER)) 71#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL | __GFP_COMP, KERNEL_STACK_SIZE_ORDER))
71#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER) 72#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER)
72 73
73#endif /* !__ASSEMBLY */ 74#endif /* !__ASSEMBLY */
@@ -103,4 +104,8 @@ struct thread_info {
103/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */ 104/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
104#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) 105#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
105 106
107#define TS_POLLING 1 /* true if in idle loop and not sleeping */
108
109#define tsk_is_polling(t) ((t)->thread_info->status & TS_POLLING)
110
106#endif /* _ASM_IA64_THREAD_INFO_H */ 111#endif /* _ASM_IA64_THREAD_INFO_H */
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index 616b5ed2aa..937c212575 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -112,6 +112,7 @@ void build_cpu_to_node_map(void);
112#define topology_core_id(cpu) (cpu_data(cpu)->core_id) 112#define topology_core_id(cpu) (cpu_data(cpu)->core_id)
113#define topology_core_siblings(cpu) (cpu_core_map[cpu]) 113#define topology_core_siblings(cpu) (cpu_core_map[cpu])
114#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) 114#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
115#define smt_capable() (smp_num_siblings > 1)
115#endif 116#endif
116 117
117#include <asm-generic/topology.h> 118#include <asm-generic/topology.h>
diff --git a/include/asm-ia64/ustack.h b/include/asm-ia64/ustack.h
index da55c91246..a349467913 100644
--- a/include/asm-ia64/ustack.h
+++ b/include/asm-ia64/ustack.h
@@ -5,12 +5,15 @@
5 * Constants for the user stack size 5 * Constants for the user stack size
6 */ 6 */
7 7
8#ifdef __KERNEL__
8#include <asm/page.h> 9#include <asm/page.h>
9 10
10/* The absolute hard limit for stack size is 1/2 of the mappable space in the region */ 11/* The absolute hard limit for stack size is 1/2 of the mappable space in the region */
11#define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2) 12#define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2)
12/* Make a default stack size of 2GB */
13#define DEFAULT_USER_STACK_SIZE (1UL << 31)
14#define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT) 13#define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT)
14#endif
15
16/* Make a default stack size of 2GiB */
17#define DEFAULT_USER_STACK_SIZE (1UL << 31)
15 18
16#endif /* _ASM_IA64_USTACK_H */ 19#endif /* _ASM_IA64_USTACK_H */
diff --git a/include/asm-m32r/Kbuild b/include/asm-m32r/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-m32r/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-m32r/hw_irq.h b/include/asm-m32r/hw_irq.h
index 8d7e9d0e09..7138537cda 100644
--- a/include/asm-m32r/hw_irq.h
+++ b/include/asm-m32r/hw_irq.h
@@ -1,9 +1,4 @@
1#ifndef _ASM_M32R_HW_IRQ_H 1#ifndef _ASM_M32R_HW_IRQ_H
2#define _ASM_M32R_HW_IRQ_H 2#define _ASM_M32R_HW_IRQ_H
3 3
4static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
5{
6 /* Nothing to do */
7}
8
9#endif /* _ASM_M32R_HW_IRQ_H */ 4#endif /* _ASM_M32R_HW_IRQ_H */
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 9688be0036..404a4c2400 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -87,10 +87,9 @@ typedef struct { unsigned long pgprot; } pgprot_t;
87 87
88#define devmem_is_allowed(x) 1 88#define devmem_is_allowed(x) 1
89 89
90#endif /* __KERNEL__ */
91
92#include <asm-generic/memory_model.h> 90#include <asm-generic/memory_model.h>
93#include <asm-generic/page.h> 91#include <asm-generic/page.h>
94 92
93#endif /* __KERNEL__ */
95#endif /* _ASM_M32R_PAGE_H */ 94#endif /* _ASM_M32R_PAGE_H */
96 95
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
index be0f167e34..6a674e3d37 100644
--- a/include/asm-m32r/pgtable-2level.h
+++ b/include/asm-m32r/pgtable-2level.h
@@ -52,9 +52,13 @@ static inline int pgd_present(pgd_t pgd) { return 1; }
52#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) 52#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
53#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) 53#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
54 54
55#define pgd_page(pgd) \ 55#define pgd_page_vaddr(pgd) \
56((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) 56((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
57 57
58#ifndef CONFIG_DISCONTIGMEM
59#define pgd_page(pgd) (mem_map + ((pgd_val(pgd) >> PAGE_SHIFT) - PFN_BASE))
60#endif /* !CONFIG_DISCONTIGMEM */
61
58static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) 62static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
59{ 63{
60 return (pmd_t *) dir; 64 return (pmd_t *) dir;
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
index 1983b7f452..1c15ba7ce3 100644
--- a/include/asm-m32r/pgtable.h
+++ b/include/asm-m32r/pgtable.h
@@ -336,7 +336,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
336 pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); 336 pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK);
337} 337}
338 338
339#define pmd_page_kernel(pmd) \ 339#define pmd_page_vaddr(pmd) \
340 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 340 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
341 341
342#ifndef CONFIG_DISCONTIGMEM 342#ifndef CONFIG_DISCONTIGMEM
@@ -358,7 +358,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
358#define pte_index(address) \ 358#define pte_index(address) \
359 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 359 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
360#define pte_offset_kernel(dir, address) \ 360#define pte_offset_kernel(dir, address) \
361 ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) 361 ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address))
362#define pte_offset_map(dir, address) \ 362#define pte_offset_map(dir, address) \
363 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 363 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
364#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) 364#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h
index a07fa90314..2d2a6c9733 100644
--- a/include/asm-m32r/ptrace.h
+++ b/include/asm-m32r/ptrace.h
@@ -12,8 +12,6 @@
12 * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org> 12 * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org>
13 */ 13 */
14 14
15#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
16
17/* 0 - 13 are integer registers (general purpose registers). */ 15/* 0 - 13 are integer registers (general purpose registers). */
18#define PT_R4 0 16#define PT_R4 0
19#define PT_R5 1 17#define PT_R5 1
@@ -140,6 +138,8 @@ struct pt_regs {
140 138
141#ifdef __KERNEL__ 139#ifdef __KERNEL__
142 140
141#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
142
143#define __ARCH_SYS_PTRACE 1 143#define __ARCH_SYS_PTRACE 1
144 144
145#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) 145#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
diff --git a/include/asm-m32r/signal.h b/include/asm-m32r/signal.h
index 95f69b1919..65423bed32 100644
--- a/include/asm-m32r/signal.h
+++ b/include/asm-m32r/signal.h
@@ -6,7 +6,6 @@
6/* orig : i386 2.4.18 */ 6/* orig : i386 2.4.18 */
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/linkage.h>
10#include <linux/time.h> 9#include <linux/time.h>
11#include <linux/compiler.h> 10#include <linux/compiler.h>
12 11
@@ -81,7 +80,6 @@ typedef unsigned long sigset_t;
81 * SA_FLAGS values: 80 * SA_FLAGS values:
82 * 81 *
83 * SA_ONSTACK indicates that a registered stack_t will be used. 82 * SA_ONSTACK indicates that a registered stack_t will be used.
84 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
85 * SA_RESTART flag to get restarting signals (which were the default long ago) 83 * SA_RESTART flag to get restarting signals (which were the default long ago)
86 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 84 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
87 * SA_RESETHAND clears the handler when the signal is delivered. 85 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -101,7 +99,6 @@ typedef unsigned long sigset_t;
101 99
102#define SA_NOMASK SA_NODEFER 100#define SA_NOMASK SA_NODEFER
103#define SA_ONESHOT SA_RESETHAND 101#define SA_ONESHOT SA_RESETHAND
104#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
105 102
106#define SA_RESTORER 0x04000000 103#define SA_RESTORER 0x04000000
107 104
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 8b6680f223..acdf748fcd 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_M32R_SOCKET_H */ 53#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index f94c1a6735..f9f90727a4 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{
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 33567e8bfe..4ce0619f69 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -18,7 +18,7 @@
18 * switch_to(prev, next) should switch from task `prev' to `next' 18 * switch_to(prev, next) should switch from task `prev' to `next'
19 * `prev' will never be the same as `next'. 19 * `prev' will never be the same as `next'.
20 * 20 *
21 * `next' and `prev' should be task_t, but it isn't always defined 21 * `next' and `prev' should be struct task_struct, but it isn't always defined
22 */ 22 */
23 23
24#define switch_to(prev, next, last) do { \ 24#define switch_to(prev, next, last) do { \
@@ -318,7 +318,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
318 * does not enforce ordering, since there is no data dependency between 318 * does not enforce ordering, since there is no data dependency between
319 * the read of "a" and the read of "b". Therefore, on some CPUs, such 319 * the read of "a" and the read of "b". Therefore, on some CPUs, such
320 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() 320 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
321 * in cases like thiswhere there are no data dependencies. 321 * in cases like this where there are no data dependencies.
322 **/ 322 **/
323 323
324#define read_barrier_depends() do { } while (0) 324#define read_barrier_depends() do { } while (0)
@@ -328,16 +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#define set_wmb(var, value) do { var = value; wmb(); } while (0)
340
341#define arch_align_stack(x) (x) 340#define arch_align_stack(x) (x)
342 341
343#endif /* _ASM_M32R_SYSTEM_H */ 342#endif /* _ASM_M32R_SYSTEM_H */
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index cc31790d80..5c6a9ac6cf 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -3,8 +3,6 @@
3 3
4/* $Id$ */ 4/* $Id$ */
5 5
6#include <asm/syscall.h> /* SYSCALL_* */
7
8/* 6/*
9 * This file contains the system call numbers. 7 * This file contains the system call numbers.
10 */ 8 */
@@ -298,14 +296,17 @@
298#ifdef __KERNEL__ 296#ifdef __KERNEL__
299 297
300#define NR_syscalls 285 298#define NR_syscalls 285
299#include <linux/err.h>
301 300
302/* user-visible error numbers are in the range -1 - -124: see 301/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
303 * <asm-m32r/errno.h> 302 * <asm-m32r/errno.h>
304 */ 303 */
305 304
305#include <asm/syscall.h> /* SYSCALL_* */
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); \
diff --git a/include/asm-m32r/user.h b/include/asm-m32r/user.h
index 2ffd0c65a7..1ad4ded848 100644
--- a/include/asm-m32r/user.h
+++ b/include/asm-m32r/user.h
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <asm/processor.h>
12#include <asm/ptrace.h> 11#include <asm/ptrace.h>
13#include <asm/page.h> 12#include <asm/page.h>
14 13
diff --git a/include/asm-m68k/Kbuild b/include/asm-m68k/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-m68k/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h
index aa968d014b..7c8713468f 100644
--- a/include/asm-m68k/amigaints.h
+++ b/include/asm-m68k/amigaints.h
@@ -13,6 +13,8 @@
13#ifndef _ASMm68k_AMIGAINTS_H_ 13#ifndef _ASMm68k_AMIGAINTS_H_
14#define _ASMm68k_AMIGAINTS_H_ 14#define _ASMm68k_AMIGAINTS_H_
15 15
16#include <asm/irq.h>
17
16/* 18/*
17** Amiga Interrupt sources. 19** Amiga Interrupt sources.
18** 20**
@@ -23,72 +25,52 @@
23#define CIA_IRQS (5) 25#define CIA_IRQS (5)
24#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */ 26#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */
25 27
26/* vertical blanking interrupt */ 28/* builtin serial port interrupts */
27#define IRQ_AMIGA_VERTB 0 29#define IRQ_AMIGA_TBE (IRQ_USER+0)
30#define IRQ_AMIGA_RBF (IRQ_USER+11)
28 31
29/* copper interrupt */ 32/* floppy disk interrupts */
30#define IRQ_AMIGA_COPPER 1 33#define IRQ_AMIGA_DSKBLK (IRQ_USER+1)
34#define IRQ_AMIGA_DSKSYN (IRQ_USER+12)
31 35
32/* Audio interrupts */ 36/* software interrupts */
33#define IRQ_AMIGA_AUD0 2 37#define IRQ_AMIGA_SOFT (IRQ_USER+2)
34#define IRQ_AMIGA_AUD1 3
35#define IRQ_AMIGA_AUD2 4
36#define IRQ_AMIGA_AUD3 5
37 38
38/* Blitter done interrupt */ 39/* interrupts from external hardware */
39#define IRQ_AMIGA_BLIT 6 40#define IRQ_AMIGA_PORTS IRQ_AUTO_2
41#define IRQ_AMIGA_EXTER IRQ_AUTO_6
40 42
41/* floppy disk interrupts */ 43/* copper interrupt */
42#define IRQ_AMIGA_DSKSYN 7 44#define IRQ_AMIGA_COPPER (IRQ_USER+4)
43#define IRQ_AMIGA_DSKBLK 8
44 45
45/* builtin serial port interrupts */ 46/* vertical blanking interrupt */
46#define IRQ_AMIGA_RBF 9 47#define IRQ_AMIGA_VERTB (IRQ_USER+5)
47#define IRQ_AMIGA_TBE 10
48 48
49/* software interrupts */ 49/* Blitter done interrupt */
50#define IRQ_AMIGA_SOFT 11 50#define IRQ_AMIGA_BLIT (IRQ_USER+6)
51 51
52/* interrupts from external hardware */ 52/* Audio interrupts */
53#define IRQ_AMIGA_PORTS 12 53#define IRQ_AMIGA_AUD0 (IRQ_USER+7)
54#define IRQ_AMIGA_EXTER 13 54#define IRQ_AMIGA_AUD1 (IRQ_USER+8)
55#define IRQ_AMIGA_AUD2 (IRQ_USER+9)
56#define IRQ_AMIGA_AUD3 (IRQ_USER+10)
55 57
56/* CIA interrupt sources */ 58/* CIA interrupt sources */
57#define IRQ_AMIGA_CIAA 14 59#define IRQ_AMIGA_CIAA (IRQ_USER+14)
58#define IRQ_AMIGA_CIAA_TA 14 60#define IRQ_AMIGA_CIAA_TA (IRQ_USER+14)
59#define IRQ_AMIGA_CIAA_TB 15 61#define IRQ_AMIGA_CIAA_TB (IRQ_USER+15)
60#define IRQ_AMIGA_CIAA_ALRM 16 62#define IRQ_AMIGA_CIAA_ALRM (IRQ_USER+16)
61#define IRQ_AMIGA_CIAA_SP 17 63#define IRQ_AMIGA_CIAA_SP (IRQ_USER+17)
62#define IRQ_AMIGA_CIAA_FLG 18 64#define IRQ_AMIGA_CIAA_FLG (IRQ_USER+18)
63#define IRQ_AMIGA_CIAB 19 65#define IRQ_AMIGA_CIAB (IRQ_USER+19)
64#define IRQ_AMIGA_CIAB_TA 19 66#define IRQ_AMIGA_CIAB_TA (IRQ_USER+19)
65#define IRQ_AMIGA_CIAB_TB 20 67#define IRQ_AMIGA_CIAB_TB (IRQ_USER+20)
66#define IRQ_AMIGA_CIAB_ALRM 21 68#define IRQ_AMIGA_CIAB_ALRM (IRQ_USER+21)
67#define IRQ_AMIGA_CIAB_SP 22 69#define IRQ_AMIGA_CIAB_SP (IRQ_USER+22)
68#define IRQ_AMIGA_CIAB_FLG 23 70#define IRQ_AMIGA_CIAB_FLG (IRQ_USER+23)
69
70/* auto-vector interrupts */
71#define IRQ_AMIGA_AUTO 24
72#define IRQ_AMIGA_AUTO_0 24 /* This is just a dummy */
73#define IRQ_AMIGA_AUTO_1 25
74#define IRQ_AMIGA_AUTO_2 26
75#define IRQ_AMIGA_AUTO_3 27
76#define IRQ_AMIGA_AUTO_4 28
77#define IRQ_AMIGA_AUTO_5 29
78#define IRQ_AMIGA_AUTO_6 30
79#define IRQ_AMIGA_AUTO_7 31
80
81#define IRQ_FLOPPY IRQ_AMIGA_DSKBLK
82 71
83/* INTREQR masks */
84#define IRQ1_MASK 0x0007 /* INTREQR mask for IRQ 1 */
85#define IRQ2_MASK 0x0008 /* INTREQR mask for IRQ 2 */
86#define IRQ3_MASK 0x0070 /* INTREQR mask for IRQ 3 */
87#define IRQ4_MASK 0x0780 /* INTREQR mask for IRQ 4 */
88#define IRQ5_MASK 0x1800 /* INTREQR mask for IRQ 5 */
89#define IRQ6_MASK 0x2000 /* INTREQR mask for IRQ 6 */
90#define IRQ7_MASK 0x4000 /* INTREQR mask for IRQ 7 */
91 72
73/* INTREQR masks */
92#define IF_SETCLR 0x8000 /* set/clr bit */ 74#define IF_SETCLR 0x8000 /* set/clr bit */
93#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */ 75#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */
94#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */ 76#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */
@@ -106,9 +88,6 @@
106#define IF_DSKBLK 0x0002 /* diskblock DMA finished */ 88#define IF_DSKBLK 0x0002 /* diskblock DMA finished */
107#define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */ 89#define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */
108 90
109extern void amiga_do_irq(int irq, struct pt_regs *fp);
110extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
111
112/* CIA interrupt control register bits */ 91/* CIA interrupt control register bits */
113 92
114#define CIA_ICR_TA 0x01 93#define CIA_ICR_TA 0x01
@@ -125,6 +104,7 @@ extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
125 104
126extern struct ciabase ciaa_base, ciab_base; 105extern struct ciabase ciaa_base, ciab_base;
127 106
107extern void cia_init_IRQ(struct ciabase *base);
128extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask); 108extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask);
129extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask); 109extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask);
130 110
diff --git a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h
index 4304e1c33e..a1373b9aa2 100644
--- a/include/asm-m68k/apollohw.h
+++ b/include/asm-m68k/apollohw.h
@@ -3,6 +3,8 @@
3#ifndef _ASMm68k_APOLLOHW_H_ 3#ifndef _ASMm68k_APOLLOHW_H_
4#define _ASMm68k_APOLLOHW_H_ 4#define _ASMm68k_APOLLOHW_H_
5 5
6#include <linux/types.h>
7
6/* 8/*
7 apollo models 9 apollo models
8*/ 10*/
@@ -101,4 +103,6 @@ extern u_long timer_physaddr;
101 103
102#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) 104#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
103 105
106#define IRQ_APOLLO IRQ_USER
107
104#endif 108#endif
diff --git a/include/asm-m68k/atari_stdma.h b/include/asm-m68k/atari_stdma.h
index 64f92880ce..b4eadf8527 100644
--- a/include/asm-m68k/atari_stdma.h
+++ b/include/asm-m68k/atari_stdma.h
@@ -3,7 +3,7 @@
3#define _atari_stdma_h 3#define _atari_stdma_h
4 4
5 5
6#include <asm/irq.h> 6#include <linux/interrupt.h>
7 7
8 8
9/***************************** Prototypes *****************************/ 9/***************************** Prototypes *****************************/
diff --git a/include/asm-m68k/atariints.h b/include/asm-m68k/atariints.h
index 42952c8905..0ed454fc24 100644
--- a/include/asm-m68k/atariints.h
+++ b/include/asm-m68k/atariints.h
@@ -45,17 +45,6 @@
45#define IRQ_TYPE_FAST 1 45#define IRQ_TYPE_FAST 1
46#define IRQ_TYPE_PRIO 2 46#define IRQ_TYPE_PRIO 2
47 47
48#define IRQ_SPURIOUS (0)
49
50/* auto-vector interrupts */
51#define IRQ_AUTO_1 (1)
52#define IRQ_AUTO_2 (2)
53#define IRQ_AUTO_3 (3)
54#define IRQ_AUTO_4 (4)
55#define IRQ_AUTO_5 (5)
56#define IRQ_AUTO_6 (6)
57#define IRQ_AUTO_7 (7)
58
59/* ST-MFP interrupts */ 48/* ST-MFP interrupts */
60#define IRQ_MFP_BUSY (8) 49#define IRQ_MFP_BUSY (8)
61#define IRQ_MFP_DCD (9) 50#define IRQ_MFP_DCD (9)
diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h
index 28a859b039..f40d2f8510 100644
--- a/include/asm-m68k/bvme6000hw.h
+++ b/include/asm-m68k/bvme6000hw.h
@@ -109,23 +109,23 @@ typedef struct {
109 109
110#define BVME_IRQ_TYPE_PRIO 0 110#define BVME_IRQ_TYPE_PRIO 0
111 111
112#define BVME_IRQ_PRN 0x54 112#define BVME_IRQ_PRN (IRQ_USER+20)
113#define BVME_IRQ_I596 0x1a 113#define BVME_IRQ_TIMER (IRQ_USER+25)
114#define BVME_IRQ_SCSI 0x1b 114#define BVME_IRQ_I596 IRQ_AUTO_2
115#define BVME_IRQ_TIMER 0x59 115#define BVME_IRQ_SCSI IRQ_AUTO_3
116#define BVME_IRQ_RTC 0x1e 116#define BVME_IRQ_RTC IRQ_AUTO_6
117#define BVME_IRQ_ABORT 0x1f 117#define BVME_IRQ_ABORT IRQ_AUTO_7
118 118
119/* SCC interrupts */ 119/* SCC interrupts */
120#define BVME_IRQ_SCC_BASE 0x40 120#define BVME_IRQ_SCC_BASE IRQ_USER
121#define BVME_IRQ_SCCB_TX 0x40 121#define BVME_IRQ_SCCB_TX IRQ_USER
122#define BVME_IRQ_SCCB_STAT 0x42 122#define BVME_IRQ_SCCB_STAT (IRQ_USER+2)
123#define BVME_IRQ_SCCB_RX 0x44 123#define BVME_IRQ_SCCB_RX (IRQ_USER+4)
124#define BVME_IRQ_SCCB_SPCOND 0x46 124#define BVME_IRQ_SCCB_SPCOND (IRQ_USER+6)
125#define BVME_IRQ_SCCA_TX 0x48 125#define BVME_IRQ_SCCA_TX (IRQ_USER+8)
126#define BVME_IRQ_SCCA_STAT 0x4a 126#define BVME_IRQ_SCCA_STAT (IRQ_USER+10)
127#define BVME_IRQ_SCCA_RX 0x4c 127#define BVME_IRQ_SCCA_RX (IRQ_USER+12)
128#define BVME_IRQ_SCCA_SPCOND 0x4e 128#define BVME_IRQ_SCCA_SPCOND (IRQ_USER+14)
129 129
130/* Address control registers */ 130/* Address control registers */
131 131
diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h
index 8aba971b13..24d3ff4491 100644
--- a/include/asm-m68k/cacheflush.h
+++ b/include/asm-m68k/cacheflush.h
@@ -3,26 +3,30 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5 5
6/* cache code */
7#define FLUSH_I_AND_D (0x00000808)
8#define FLUSH_I (0x00000008)
9
6/* 10/*
7 * Cache handling functions 11 * Cache handling functions
8 */ 12 */
9 13
10#define flush_icache() \ 14static inline void flush_icache(void)
11({ \ 15{
12 if (CPU_IS_040_OR_060) \ 16 if (CPU_IS_040_OR_060)
13 __asm__ __volatile__("nop\n\t" \ 17 asm volatile ( "nop\n"
14 ".chip 68040\n\t" \ 18 " .chip 68040\n"
15 "cinva %%ic\n\t" \ 19 " cpusha %bc\n"
16 ".chip 68k" : ); \ 20 " .chip 68k");
17 else { \ 21 else {
18 unsigned long _tmp; \ 22 unsigned long tmp;
19 __asm__ __volatile__("movec %%cacr,%0\n\t" \ 23 asm volatile ( "movec %%cacr,%0\n"
20 "orw %1,%0\n\t" \ 24 " or.w %1,%0\n"
21 "movec %0,%%cacr" \ 25 " movec %0,%%cacr"
22 : "=&d" (_tmp) \ 26 : "=&d" (tmp)
23 : "id" (FLUSH_I)); \ 27 : "id" (FLUSH_I));
24 } \ 28 }
25}) 29}
26 30
27/* 31/*
28 * invalidate the cache for the specified memory range. 32 * invalidate the cache for the specified memory range.
@@ -43,10 +47,6 @@ extern void cache_push(unsigned long paddr, int len);
43 */ 47 */
44extern void cache_push_v(unsigned long vaddr, int len); 48extern void cache_push_v(unsigned long vaddr, int len);
45 49
46/* cache code */
47#define FLUSH_I_AND_D (0x00000808)
48#define FLUSH_I (0x00000008)
49
50/* This is needed whenever the virtual mapping of the current 50/* This is needed whenever the virtual mapping of the current
51 process changes. */ 51 process changes. */
52#define __flush_cache_all() \ 52#define __flush_cache_all() \
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index dffd59cf13..cebbb03370 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -1,11 +1,91 @@
1#ifndef _M68K_DMA_MAPPING_H 1#ifndef _M68K_DMA_MAPPING_H
2#define _M68K_DMA_MAPPING_H 2#define _M68K_DMA_MAPPING_H
3 3
4#include <asm/cache.h>
4 5
5#ifdef CONFIG_PCI 6struct scatterlist;
6#include <asm-generic/dma-mapping.h> 7
7#else 8static inline int dma_supported(struct device *dev, u64 mask)
8#include <asm-generic/dma-mapping-broken.h> 9{
9#endif 10 return 1;
11}
12
13static inline int dma_set_mask(struct device *dev, u64 mask)
14{
15 return 0;
16}
17
18static inline int dma_get_cache_alignment(void)
19{
20 return 1 << L1_CACHE_SHIFT;
21}
22
23static inline int dma_is_consistent(dma_addr_t dma_addr)
24{
25 return 0;
26}
27
28extern void *dma_alloc_coherent(struct device *, size_t,
29 dma_addr_t *, int);
30extern void dma_free_coherent(struct device *, size_t,
31 void *, dma_addr_t);
32
33static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
34 dma_addr_t *handle, int flag)
35{
36 return dma_alloc_coherent(dev, size, handle, flag);
37}
38static inline void dma_free_noncoherent(struct device *dev, size_t size,
39 void *addr, dma_addr_t handle)
40{
41 dma_free_coherent(dev, size, addr, handle);
42}
43static inline void dma_cache_sync(void *vaddr, size_t size,
44 enum dma_data_direction dir)
45{
46 /* we use coherent allocation, so not much to do here. */
47}
48
49extern dma_addr_t dma_map_single(struct device *, void *, size_t,
50 enum dma_data_direction);
51static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
52 size_t size, enum dma_data_direction dir)
53{
54}
55
56extern dma_addr_t dma_map_page(struct device *, struct page *,
57 unsigned long, size_t size,
58 enum dma_data_direction);
59static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
60 size_t size, enum dma_data_direction dir)
61{
62}
63
64extern int dma_map_sg(struct device *, struct scatterlist *, int,
65 enum dma_data_direction);
66static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
67 int nhwentries, enum dma_data_direction dir)
68{
69}
70
71extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
72 enum dma_data_direction);
73extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
74 enum dma_data_direction);
75
76static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
77 size_t size, enum dma_data_direction dir)
78{
79}
80
81static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
82 int nents, enum dma_data_direction dir)
83{
84}
85
86static inline int dma_mapping_error(dma_addr_t handle)
87{
88 return 0;
89}
10 90
11#endif /* _M68K_DMA_MAPPING_H */ 91#endif /* _M68K_DMA_MAPPING_H */
diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h
index 63a05ed95c..57f4fdda65 100644
--- a/include/asm-m68k/floppy.h
+++ b/include/asm-m68k/floppy.h
@@ -88,8 +88,8 @@ static __inline__ void fd_outb(unsigned char value, int port)
88static int fd_request_irq(void) 88static int fd_request_irq(void)
89{ 89{
90 if(MACH_IS_Q40) 90 if(MACH_IS_Q40)
91 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 91 return request_irq(FLOPPY_IRQ, floppy_hardint,
92 "floppy", floppy_hardint); 92 IRQF_DISABLED, "floppy", floppy_hardint);
93 else if(MACH_IS_SUN3X) 93 else if(MACH_IS_SUN3X)
94 return sun3xflop_request_irq(); 94 return sun3xflop_request_irq();
95 return -ENXIO; 95 return -ENXIO;
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index 9727ca9d9f..3257f98810 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -1,13 +1,9 @@
1#ifndef _M68K_IRQ_H_ 1#ifndef _M68K_IRQ_H_
2#define _M68K_IRQ_H_ 2#define _M68K_IRQ_H_
3 3
4#include <linux/interrupt.h> 4#include <linux/linkage.h>
5 5#include <linux/hardirq.h>
6/* 6#include <linux/spinlock_types.h>
7 * # of m68k interrupts
8 */
9
10#define SYS_IRQS 8
11 7
12/* 8/*
13 * This should be the same as the max(NUM_X_SOURCES) for all the 9 * This should be the same as the max(NUM_X_SOURCES) for all the
@@ -15,10 +11,20 @@
15 * Currently the Atari has 72 and the Amiga 24, but if both are 11 * Currently the Atari has 72 and the Amiga 24, but if both are
16 * supported in the kernel it is better to make room for 72. 12 * supported in the kernel it is better to make room for 72.
17 */ 13 */
18#if defined(CONFIG_ATARI) || defined(CONFIG_MAC) 14#if defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
19#define NR_IRQS (72+SYS_IRQS) 15#define NR_IRQS 200
16#elif defined(CONFIG_ATARI) || defined(CONFIG_MAC)
17#define NR_IRQS 72
18#elif defined(CONFIG_Q40)
19#define NR_IRQS 43
20#elif defined(CONFIG_AMIGA)
21#define NR_IRQS 32
22#elif defined(CONFIG_APOLLO)
23#define NR_IRQS 24
24#elif defined(CONFIG_HP300)
25#define NR_IRQS 8
20#else 26#else
21#define NR_IRQS (24+SYS_IRQS) 27#error unknown nr of irqs
22#endif 28#endif
23 29
24/* 30/*
@@ -40,57 +46,29 @@
40 * that routine requires service. 46 * that routine requires service.
41 */ 47 */
42 48
43#define IRQ1 (1) /* level 1 interrupt */ 49#define IRQ_SPURIOUS 0
44#define IRQ2 (2) /* level 2 interrupt */
45#define IRQ3 (3) /* level 3 interrupt */
46#define IRQ4 (4) /* level 4 interrupt */
47#define IRQ5 (5) /* level 5 interrupt */
48#define IRQ6 (6) /* level 6 interrupt */
49#define IRQ7 (7) /* level 7 interrupt (non-maskable) */
50 50
51/* 51#define IRQ_AUTO_1 1 /* level 1 interrupt */
52 * "Generic" interrupt sources 52#define IRQ_AUTO_2 2 /* level 2 interrupt */
53 */ 53#define IRQ_AUTO_3 3 /* level 3 interrupt */
54 54#define IRQ_AUTO_4 4 /* level 4 interrupt */
55#define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */ 55#define IRQ_AUTO_5 5 /* level 5 interrupt */
56#define IRQ_AUTO_6 6 /* level 6 interrupt */
57#define IRQ_AUTO_7 7 /* level 7 interrupt (non-maskable) */
56 58
57static __inline__ int irq_canonicalize(int irq) 59#define IRQ_USER 8
58{
59 return irq;
60}
61
62/*
63 * Machine specific interrupt sources.
64 *
65 * Adding an interrupt service routine for a source with this bit
66 * set indicates a special machine specific interrupt source.
67 * The machine specific files define these sources.
68 *
69 * The IRQ_MACHSPEC bit is now gone - the only thing it did was to
70 * introduce unnecessary overhead.
71 *
72 * All interrupt handling is actually machine specific so it is better
73 * to use function pointers, as used by the Sparc port, and select the
74 * interrupt handling functions when initializing the kernel. This way
75 * we save some unnecessary overhead at run-time.
76 * 01/11/97 - Jes
77 */
78 60
79extern void (*enable_irq)(unsigned int); 61extern unsigned int irq_canonicalize(unsigned int irq);
80extern void (*disable_irq)(unsigned int); 62extern void enable_irq(unsigned int);
63extern void disable_irq(unsigned int);
81#define disable_irq_nosync disable_irq 64#define disable_irq_nosync disable_irq
82 65
83struct pt_regs; 66struct pt_regs;
84 67
85extern int cpu_request_irq(unsigned int,
86 irqreturn_t (*)(int, void *, struct pt_regs *),
87 unsigned long, const char *, void *);
88extern void cpu_free_irq(unsigned int, void *);
89
90/* 68/*
91 * various flags for request_irq() - the Amiga now uses the standard 69 * various flags for request_irq() - the Amiga now uses the standard
92 * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ 70 * mechanism like all other architectures - IRQF_DISABLED and
93 * are your friends. 71 * IRQF_SHARED are your friends.
94 */ 72 */
95#ifndef MACH_AMIGA_ONLY 73#ifndef MACH_AMIGA_ONLY
96#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ 74#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
@@ -105,29 +83,45 @@ extern void cpu_free_irq(unsigned int, void *);
105 * interrupt source (if it supports chaining). 83 * interrupt source (if it supports chaining).
106 */ 84 */
107typedef struct irq_node { 85typedef struct irq_node {
108 irqreturn_t (*handler)(int, void *, struct pt_regs *); 86 int (*handler)(int, void *, struct pt_regs *);
109 unsigned long flags;
110 void *dev_id; 87 void *dev_id;
111 const char *devname;
112 struct irq_node *next; 88 struct irq_node *next;
89 unsigned long flags;
90 const char *devname;
113} irq_node_t; 91} irq_node_t;
114 92
115/* 93/*
116 * This structure has only 4 elements for speed reasons 94 * This structure has only 4 elements for speed reasons
117 */ 95 */
118typedef struct irq_handler { 96typedef struct irq_handler {
119 irqreturn_t (*handler)(int, void *, struct pt_regs *); 97 int (*handler)(int, void *, struct pt_regs *);
120 unsigned long flags; 98 unsigned long flags;
121 void *dev_id; 99 void *dev_id;
122 const char *devname; 100 const char *devname;
123} irq_handler_t; 101} irq_handler_t;
124 102
125/* count of spurious interrupts */ 103struct irq_controller {
126extern volatile unsigned int num_spurious; 104 const char *name;
105 spinlock_t lock;
106 int (*startup)(unsigned int irq);
107 void (*shutdown)(unsigned int irq);
108 void (*enable)(unsigned int irq);
109 void (*disable)(unsigned int irq);
110};
111
112extern int m68k_irq_startup(unsigned int);
113extern void m68k_irq_shutdown(unsigned int);
127 114
128/* 115/*
129 * This function returns a new irq_node_t 116 * This function returns a new irq_node_t
130 */ 117 */
131extern irq_node_t *new_irq_node(void); 118extern irq_node_t *new_irq_node(void);
132 119
120extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *));
121extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
122 void (*handler)(unsigned int, struct pt_regs *));
123extern void m68k_setup_irq_controller(struct irq_controller *, unsigned int, unsigned int);
124
125asmlinkage void m68k_handle_int(unsigned int, struct pt_regs *);
126
133#endif /* _M68K_IRQ_H_ */ 127#endif /* _M68K_IRQ_H_ */
diff --git a/include/asm-m68k/mac_oss.h b/include/asm-m68k/mac_oss.h
index 7644a639cd..7221f72519 100644
--- a/include/asm-m68k/mac_oss.h
+++ b/include/asm-m68k/mac_oss.h
@@ -69,12 +69,12 @@
69 69
70#define OSS_IRQLEV_DISABLED 0 70#define OSS_IRQLEV_DISABLED 0
71#define OSS_IRQLEV_IOPISM 1 /* ADB? */ 71#define OSS_IRQLEV_IOPISM 1 /* ADB? */
72#define OSS_IRQLEV_SCSI 2 72#define OSS_IRQLEV_SCSI IRQ_AUTO_2
73#define OSS_IRQLEV_NUBUS 3 /* keep this on its own level */ 73#define OSS_IRQLEV_NUBUS IRQ_AUTO_3 /* keep this on its own level */
74#define OSS_IRQLEV_IOPSCC 4 /* matches VIA alternate mapping */ 74#define OSS_IRQLEV_IOPSCC IRQ_AUTO_4 /* matches VIA alternate mapping */
75#define OSS_IRQLEV_SOUND 5 /* matches VIA alternate mapping */ 75#define OSS_IRQLEV_SOUND IRQ_AUTO_5 /* matches VIA alternate mapping */
76#define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */ 76#define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */
77#define OSS_IRQLEV_VIA1 6 /* matches VIA alternate mapping */ 77#define OSS_IRQLEV_VIA1 IRQ_AUTO_6 /* matches VIA alternate mapping */
78#define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */ 78#define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */
79 79
80#ifndef __ASSEMBLY__ 80#ifndef __ASSEMBLY__
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h
index 7d3fee3423..df898f27e4 100644
--- a/include/asm-m68k/machdep.h
+++ b/include/asm-m68k/machdep.h
@@ -13,14 +13,8 @@ struct buffer_head;
13extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)); 13extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *));
14/* machine dependent irq functions */ 14/* machine dependent irq functions */
15extern void (*mach_init_IRQ) (void); 15extern void (*mach_init_IRQ) (void);
16extern irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *);
17extern int (*mach_request_irq) (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
18 unsigned long flags, const char *devname, void *dev_id);
19extern void (*mach_free_irq) (unsigned int irq, void *dev_id);
20extern void (*mach_get_model) (char *model); 16extern void (*mach_get_model) (char *model);
21extern int (*mach_get_hardware_list) (char *buffer); 17extern int (*mach_get_hardware_list) (char *buffer);
22extern int (*mach_get_irq_list) (struct seq_file *p, void *v);
23extern irqreturn_t (*mach_process_int) (int irq, struct pt_regs *fp);
24/* machine dependent timer functions */ 18/* machine dependent timer functions */
25extern unsigned long (*mach_gettimeoffset)(void); 19extern unsigned long (*mach_gettimeoffset)(void);
26extern int (*mach_hwclk)(int, struct rtc_time*); 20extern int (*mach_hwclk)(int, struct rtc_time*);
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h
index 6fc3d19512..27d11da2b4 100644
--- a/include/asm-m68k/macintosh.h
+++ b/include/asm-m68k/macintosh.h
@@ -11,17 +11,7 @@
11extern void mac_reset(void); 11extern void mac_reset(void);
12extern void mac_poweroff(void); 12extern void mac_poweroff(void);
13extern void mac_init_IRQ(void); 13extern void mac_init_IRQ(void);
14extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *,
15 struct pt_regs *),
16 unsigned long, const char *, void *);
17extern void mac_free_irq(unsigned int, void *);
18extern void mac_enable_irq(unsigned int);
19extern void mac_disable_irq(unsigned int);
20extern int mac_irq_pending(unsigned int); 14extern int mac_irq_pending(unsigned int);
21extern int show_mac_interrupts(struct seq_file *, void *);
22#if 0
23extern void mac_default_handler(int irq);
24#endif
25extern void mac_identify(void); 15extern void mac_identify(void);
26extern void mac_report_hardware(void); 16extern void mac_report_hardware(void);
27extern void mac_debugging_penguin(int); 17extern void mac_debugging_penguin(int);
diff --git a/include/asm-m68k/macints.h b/include/asm-m68k/macints.h
index fd8c3a9fea..679c48ab44 100644
--- a/include/asm-m68k/macints.h
+++ b/include/asm-m68k/macints.h
@@ -59,17 +59,6 @@
59#define IRQ_SRC(irq) (irq >> 3) 59#define IRQ_SRC(irq) (irq >> 3)
60#define IRQ_IDX(irq) (irq & 7) 60#define IRQ_IDX(irq) (irq & 7)
61 61
62#define IRQ_SPURIOUS (0)
63
64/* auto-vector interrupts */
65#define IRQ_AUTO_1 (1)
66#define IRQ_AUTO_2 (2)
67#define IRQ_AUTO_3 (3)
68#define IRQ_AUTO_4 (4)
69#define IRQ_AUTO_5 (5)
70#define IRQ_AUTO_6 (6)
71#define IRQ_AUTO_7 (7)
72
73/* VIA1 interrupts */ 62/* VIA1 interrupts */
74#define IRQ_VIA1_0 (8) /* one second int. */ 63#define IRQ_VIA1_0 (8) /* one second int. */
75#define IRQ_VIA1_1 (9) /* VBlank int. */ 64#define IRQ_VIA1_1 (9) /* VBlank int. */
@@ -163,7 +152,4 @@
163#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ 152#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */
164#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ 153#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */
165 154
166extern irq_node_t *mac_irq_list[NUM_MAC_SOURCES];
167extern void mac_do_irq_list(int irq, struct pt_regs *);
168
169#endif /* asm/macints.h */ 155#endif /* asm/macints.h */
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
index 1ccc7338a5..61e4406ed9 100644
--- a/include/asm-m68k/motorola_pgtable.h
+++ b/include/asm-m68k/motorola_pgtable.h
@@ -150,6 +150,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
150#define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) 150#define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE)
151#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) 151#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE)
152#define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) 152#define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; })
153#define pgd_page(pgd) (mem_map + ((unsigned long)(__va(pgd_val(pgd)) - PAGE_OFFSET) >> PAGE_SHIFT))
153 154
154#define pte_ERROR(e) \ 155#define pte_ERROR(e) \
155 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) 156 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
diff --git a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h
index f245139f36..b810431084 100644
--- a/include/asm-m68k/mvme147hw.h
+++ b/include/asm-m68k/mvme147hw.h
@@ -1,6 +1,8 @@
1#ifndef _MVME147HW_H_ 1#ifndef _MVME147HW_H_
2#define _MVME147HW_H_ 2#define _MVME147HW_H_
3 3
4#include <asm/irq.h>
5
4typedef struct { 6typedef struct {
5 unsigned char 7 unsigned char
6 ctrl, 8 ctrl,
@@ -72,39 +74,39 @@ struct pcc_regs {
72#define PCC_LEVEL_SCSI_PORT 0x04 74#define PCC_LEVEL_SCSI_PORT 0x04
73#define PCC_LEVEL_SCSI_DMA 0x04 75#define PCC_LEVEL_SCSI_DMA 0x04
74 76
75#define PCC_IRQ_AC_FAIL 0x40 77#define PCC_IRQ_AC_FAIL (IRQ_USER+0)
76#define PCC_IRQ_BERR 0x41 78#define PCC_IRQ_BERR (IRQ_USER+1)
77#define PCC_IRQ_ABORT 0x42 79#define PCC_IRQ_ABORT (IRQ_USER+2)
78/* #define PCC_IRQ_SERIAL 0x43 */ 80/* #define PCC_IRQ_SERIAL (IRQ_USER+3) */
79#define PCC_IRQ_PRINTER 0x47 81#define PCC_IRQ_PRINTER (IRQ_USER+7)
80#define PCC_IRQ_TIMER1 0x48 82#define PCC_IRQ_TIMER1 (IRQ_USER+8)
81#define PCC_IRQ_TIMER2 0x49 83#define PCC_IRQ_TIMER2 (IRQ_USER+9)
82#define PCC_IRQ_SOFTWARE1 0x4a 84#define PCC_IRQ_SOFTWARE1 (IRQ_USER+10)
83#define PCC_IRQ_SOFTWARE2 0x4b 85#define PCC_IRQ_SOFTWARE2 (IRQ_USER+11)
84 86
85 87
86#define M147_SCC_A_ADDR 0xfffe3002 88#define M147_SCC_A_ADDR 0xfffe3002
87#define M147_SCC_B_ADDR 0xfffe3000 89#define M147_SCC_B_ADDR 0xfffe3000
88#define M147_SCC_PCLK 5000000 90#define M147_SCC_PCLK 5000000
89 91
90#define MVME147_IRQ_SCSI_PORT 0x45 92#define MVME147_IRQ_SCSI_PORT (IRQ_USER+0x45)
91#define MVME147_IRQ_SCSI_DMA 0x46 93#define MVME147_IRQ_SCSI_DMA (IRQ_USER+0x46)
92 94
93/* SCC interrupts, for MVME147 */ 95/* SCC interrupts, for MVME147 */
94 96
95#define MVME147_IRQ_TYPE_PRIO 0 97#define MVME147_IRQ_TYPE_PRIO 0
96#define MVME147_IRQ_SCC_BASE 0x60 98#define MVME147_IRQ_SCC_BASE (IRQ_USER+32)
97#define MVME147_IRQ_SCCB_TX 0x60 99#define MVME147_IRQ_SCCB_TX (IRQ_USER+32)
98#define MVME147_IRQ_SCCB_STAT 0x62 100#define MVME147_IRQ_SCCB_STAT (IRQ_USER+34)
99#define MVME147_IRQ_SCCB_RX 0x64 101#define MVME147_IRQ_SCCB_RX (IRQ_USER+36)
100#define MVME147_IRQ_SCCB_SPCOND 0x66 102#define MVME147_IRQ_SCCB_SPCOND (IRQ_USER+38)
101#define MVME147_IRQ_SCCA_TX 0x68 103#define MVME147_IRQ_SCCA_TX (IRQ_USER+40)
102#define MVME147_IRQ_SCCA_STAT 0x6a 104#define MVME147_IRQ_SCCA_STAT (IRQ_USER+42)
103#define MVME147_IRQ_SCCA_RX 0x6c 105#define MVME147_IRQ_SCCA_RX (IRQ_USER+44)
104#define MVME147_IRQ_SCCA_SPCOND 0x6e 106#define MVME147_IRQ_SCCA_SPCOND (IRQ_USER+46)
105 107
106#define MVME147_LANCE_BASE 0xfffe1800 108#define MVME147_LANCE_BASE 0xfffe1800
107#define MVME147_LANCE_IRQ 0x44 109#define MVME147_LANCE_IRQ (IRQ_USER+4)
108 110
109#define ETHERNET_ADDRESS 0xfffe0778 111#define ETHERNET_ADDRESS 0xfffe0778
110 112
diff --git a/include/asm-m68k/mvme16xhw.h b/include/asm-m68k/mvme16xhw.h
index 5d07231d24..6117f56653 100644
--- a/include/asm-m68k/mvme16xhw.h
+++ b/include/asm-m68k/mvme16xhw.h
@@ -66,28 +66,28 @@ typedef struct {
66 66
67#define MVME162_IRQ_TYPE_PRIO 0 67#define MVME162_IRQ_TYPE_PRIO 0
68 68
69#define MVME167_IRQ_PRN 0x54 69#define MVME167_IRQ_PRN (IRQ_USER+20)
70#define MVME16x_IRQ_I596 0x57 70#define MVME16x_IRQ_I596 (IRQ_USER+23)
71#define MVME16x_IRQ_SCSI 0x55 71#define MVME16x_IRQ_SCSI (IRQ_USER+21)
72#define MVME16x_IRQ_FLY 0x7f 72#define MVME16x_IRQ_FLY (IRQ_USER+63)
73#define MVME167_IRQ_SER_ERR 0x5c 73#define MVME167_IRQ_SER_ERR (IRQ_USER+28)
74#define MVME167_IRQ_SER_MODEM 0x5d 74#define MVME167_IRQ_SER_MODEM (IRQ_USER+29)
75#define MVME167_IRQ_SER_TX 0x5e 75#define MVME167_IRQ_SER_TX (IRQ_USER+30)
76#define MVME167_IRQ_SER_RX 0x5f 76#define MVME167_IRQ_SER_RX (IRQ_USER+31)
77#define MVME16x_IRQ_TIMER 0x59 77#define MVME16x_IRQ_TIMER (IRQ_USER+25)
78#define MVME167_IRQ_ABORT 0x6e 78#define MVME167_IRQ_ABORT (IRQ_USER+46)
79#define MVME162_IRQ_ABORT 0x5e 79#define MVME162_IRQ_ABORT (IRQ_USER+30)
80 80
81/* SCC interrupts, for MVME162 */ 81/* SCC interrupts, for MVME162 */
82#define MVME162_IRQ_SCC_BASE 0x40 82#define MVME162_IRQ_SCC_BASE (IRQ_USER+0)
83#define MVME162_IRQ_SCCB_TX 0x40 83#define MVME162_IRQ_SCCB_TX (IRQ_USER+0)
84#define MVME162_IRQ_SCCB_STAT 0x42 84#define MVME162_IRQ_SCCB_STAT (IRQ_USER+2)
85#define MVME162_IRQ_SCCB_RX 0x44 85#define MVME162_IRQ_SCCB_RX (IRQ_USER+4)
86#define MVME162_IRQ_SCCB_SPCOND 0x46 86#define MVME162_IRQ_SCCB_SPCOND (IRQ_USER+6)
87#define MVME162_IRQ_SCCA_TX 0x48 87#define MVME162_IRQ_SCCA_TX (IRQ_USER+8)
88#define MVME162_IRQ_SCCA_STAT 0x4a 88#define MVME162_IRQ_SCCA_STAT (IRQ_USER+10)
89#define MVME162_IRQ_SCCA_RX 0x4c 89#define MVME162_IRQ_SCCA_RX (IRQ_USER+12)
90#define MVME162_IRQ_SCCA_SPCOND 0x4e 90#define MVME162_IRQ_SCCA_SPCOND (IRQ_USER+14)
91 91
92/* MVME162 version register */ 92/* MVME162 version register */
93 93
diff --git a/include/asm-m68k/oplib.h b/include/asm-m68k/oplib.h
index c3594f473e..06caa2d084 100644
--- a/include/asm-m68k/oplib.h
+++ b/include/asm-m68k/oplib.h
@@ -244,11 +244,6 @@ extern void prom_getstring(int node, char *prop, char *buf, int bufsize);
244/* Does the passed node have the given "name"? YES=1 NO=0 */ 244/* Does the passed node have the given "name"? YES=1 NO=0 */
245extern int prom_nodematch(int thisnode, char *name); 245extern int prom_nodematch(int thisnode, char *name);
246 246
247/* Puts in buffer a prom name in the form name@x,y or name (x for which_io
248 * and y for first regs phys address
249 */
250extern int prom_getname(int node, char *buf, int buflen);
251
252/* Search all siblings starting at the passed node for "name" matching 247/* Search all siblings starting at the passed node for "name" matching
253 * the given string. Returns the node on success, zero on failure. 248 * the given string. Returns the node on success, zero on failure.
254 */ 249 */
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index db017f838c..fcc165ddd0 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -2,6 +2,8 @@
2#define _M68K_PAGE_H 2#define _M68K_PAGE_H
3 3
4 4
5#ifdef __KERNEL__
6
5/* PAGE_SHIFT determines the page size */ 7/* PAGE_SHIFT determines the page size */
6#ifndef CONFIG_SUN3 8#ifndef CONFIG_SUN3
7#define PAGE_SHIFT (12) 9#define PAGE_SHIFT (12)
@@ -15,8 +17,6 @@
15#endif 17#endif
16#define PAGE_MASK (~(PAGE_SIZE-1)) 18#define PAGE_MASK (~(PAGE_SIZE-1))
17 19
18#ifdef __KERNEL__
19
20#include <asm/setup.h> 20#include <asm/setup.h>
21 21
22#if PAGE_SHIFT < 13 22#if PAGE_SHIFT < 13
@@ -175,8 +175,8 @@ static inline void *__va(unsigned long x)
175#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 175#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
176 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 176 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
177 177
178#endif /* __KERNEL__ */
179
180#include <asm-generic/page.h> 178#include <asm-generic/page.h>
181 179
180#endif /* __KERNEL__ */
181
182#endif /* _M68K_PAGE_H */ 182#endif /* _M68K_PAGE_H */
diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h
index d7c9b5c5e6..8e612266da 100644
--- a/include/asm-m68k/scatterlist.h
+++ b/include/asm-m68k/scatterlist.h
@@ -2,18 +2,17 @@
2#define _M68K_SCATTERLIST_H 2#define _M68K_SCATTERLIST_H
3 3
4struct scatterlist { 4struct scatterlist {
5 /* These two are only valid if ADDRESS member of this
6 * struct is NULL.
7 */
8 struct page *page; 5 struct page *page;
9 unsigned int offset; 6 unsigned int offset;
10
11 unsigned int length; 7 unsigned int length;
12 8
13 __u32 dvma_address; /* A place to hang host-specific addresses at. */ 9 __u32 dma_address; /* A place to hang host-specific addresses at. */
14}; 10};
15 11
16/* This is bogus and should go away. */ 12/* This is bogus and should go away. */
17#define ISA_DMA_THRESHOLD (0x00ffffff) 13#define ISA_DMA_THRESHOLD (0x00ffffff)
18 14
15#define sg_dma_address(sg) ((sg)->dma_address)
16#define sg_dma_len(sg) ((sg)->length)
17
19#endif /* !(_M68K_SCATTERLIST_H) */ 18#endif /* !(_M68K_SCATTERLIST_H) */
diff --git a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h
index b7b7ea20ca..de1ba6ead3 100644
--- a/include/asm-m68k/signal.h
+++ b/include/asm-m68k/signal.h
@@ -74,7 +74,6 @@ typedef unsigned long sigset_t;
74 * SA_FLAGS values: 74 * SA_FLAGS values:
75 * 75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used. 76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago) 77 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered. 79 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -94,7 +93,6 @@ typedef unsigned long sigset_t;
94 93
95#define SA_NOMASK SA_NODEFER 94#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND 95#define SA_ONESHOT SA_RESETHAND
97#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
98 96
99/* 97/*
100 * sigaltstack controls 98 * sigaltstack controls
@@ -156,13 +154,17 @@ typedef struct sigaltstack {
156 154
157static inline void sigaddset(sigset_t *set, int _sig) 155static inline void sigaddset(sigset_t *set, int _sig)
158{ 156{
159 __asm__("bfset %0{%1,#1}" : "=m" (*set) : "id" ((_sig - 1) ^ 31) 157 asm ("bfset %0{%1,#1}"
158 : "+od" (*set)
159 : "id" ((_sig - 1) ^ 31)
160 : "cc"); 160 : "cc");
161} 161}
162 162
163static inline void sigdelset(sigset_t *set, int _sig) 163static inline void sigdelset(sigset_t *set, int _sig)
164{ 164{
165 __asm__("bfclr %0{%1,#1}" : "=m"(*set) : "id"((_sig - 1) ^ 31) 165 asm ("bfclr %0{%1,#1}"
166 : "+od" (*set)
167 : "id" ((_sig - 1) ^ 31)
166 : "cc"); 168 : "cc");
167} 169}
168 170
@@ -175,8 +177,10 @@ static inline int __const_sigismember(sigset_t *set, int _sig)
175static inline int __gen_sigismember(sigset_t *set, int _sig) 177static inline int __gen_sigismember(sigset_t *set, int _sig)
176{ 178{
177 int ret; 179 int ret;
178 __asm__("bfextu %1{%2,#1},%0" 180 asm ("bfextu %1{%2,#1},%0"
179 : "=d"(ret) : "m"(*set), "id"((_sig-1) ^ 31)); 181 : "=d" (ret)
182 : "od" (*set), "id" ((_sig-1) ^ 31)
183 : "cc");
180 return ret; 184 return ret;
181} 185}
182 186
@@ -187,7 +191,10 @@ static inline int __gen_sigismember(sigset_t *set, int _sig)
187 191
188static inline int sigfindinword(unsigned long word) 192static inline int sigfindinword(unsigned long word)
189{ 193{
190 __asm__("bfffo %1{#0,#0},%0" : "=d"(word) : "d"(word & -word) : "cc"); 194 asm ("bfffo %1{#0,#0},%0"
195 : "=d" (word)
196 : "d" (word & -word)
197 : "cc");
191 return word ^ 31; 198 return word ^ 31;
192} 199}
193 200
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index f578ca4b77..a5966ec005 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h
index bd038fccb6..de91fa071b 100644
--- a/include/asm-m68k/sun3ints.h
+++ b/include/asm-m68k/sun3ints.h
@@ -12,37 +12,25 @@
12#define SUN3INTS_H 12#define SUN3INTS_H
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/kernel_stat.h>
18#include <linux/interrupt.h> 15#include <linux/interrupt.h>
19#include <linux/seq_file.h>
20#include <asm/segment.h>
21#include <asm/intersil.h> 16#include <asm/intersil.h>
22#include <asm/oplib.h> 17#include <asm/oplib.h>
18#include <asm/traps.h>
23 19
24#define SUN3_INT_VECS 192 20#define SUN3_INT_VECS 192
25 21
26void sun3_enable_irq(unsigned int irq); 22void sun3_enable_irq(unsigned int irq);
27void sun3_disable_irq(unsigned int irq); 23void sun3_disable_irq(unsigned int irq);
28int sun3_request_irq(unsigned int irq,
29 irqreturn_t (*handler)(int, void *, struct pt_regs *),
30 unsigned long flags, const char *devname, void *dev_id
31 );
32extern void sun3_init_IRQ (void); 24extern void sun3_init_IRQ (void);
33extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *);
34extern void sun3_free_irq (unsigned int irq, void *dev_id);
35extern void sun3_enable_interrupts (void); 25extern void sun3_enable_interrupts (void);
36extern void sun3_disable_interrupts (void); 26extern void sun3_disable_interrupts (void);
37extern int show_sun3_interrupts(struct seq_file *, void *);
38extern irqreturn_t sun3_process_int(int, struct pt_regs *);
39extern volatile unsigned char* sun3_intreg; 27extern volatile unsigned char* sun3_intreg;
40 28
41/* master list of VME vectors -- don't fuck with this */ 29/* master list of VME vectors -- don't fuck with this */
42#define SUN3_VEC_FLOPPY 0x40 30#define SUN3_VEC_FLOPPY (IRQ_USER+0)
43#define SUN3_VEC_VMESCSI0 0x40 31#define SUN3_VEC_VMESCSI0 (IRQ_USER+0)
44#define SUN3_VEC_VMESCSI1 0x41 32#define SUN3_VEC_VMESCSI1 (IRQ_USER+1)
45#define SUN3_VEC_CG 0xA8 33#define SUN3_VEC_CG (IRQ_USER+104)
46 34
47 35
48#endif /* SUN3INTS_H */ 36#endif /* SUN3INTS_H */
diff --git a/include/asm-m68k/sun3xflop.h b/include/asm-m68k/sun3xflop.h
index 98a9f79dab..ca8cc41138 100644
--- a/include/asm-m68k/sun3xflop.h
+++ b/include/asm-m68k/sun3xflop.h
@@ -208,7 +208,8 @@ static int sun3xflop_request_irq(void)
208 208
209 if(!once) { 209 if(!once) {
210 once = 1; 210 once = 1;
211 error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", NULL); 211 error = request_irq(FLOPPY_IRQ, sun3xflop_hardint,
212 IRQF_DISABLED, "floppy", NULL);
212 return ((error == 0) ? 0 : -1); 213 return ((error == 0) ? 0 : -1);
213 } else return 0; 214 } else return 0;
214} 215}
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
index d6dd8052cd..131a0cb0f4 100644
--- a/include/asm-m68k/system.h
+++ b/include/asm-m68k/system.h
@@ -80,7 +80,6 @@ static inline int irqs_disabled(void)
80#define wmb() barrier() 80#define wmb() barrier()
81#define read_barrier_depends() do { } while(0) 81#define read_barrier_depends() do { } while(0)
82#define set_mb(var, value) do { xchg(&var, value); } while (0) 82#define set_mb(var, value) do { xchg(&var, value); } while (0)
83#define set_wmb(var, value) do { var = value; wmb(); } while (0)
84 83
85#define smp_mb() barrier() 84#define smp_mb() barrier()
86#define smp_rmb() barrier() 85#define smp_rmb() barrier()
diff --git a/include/asm-m68k/traps.h b/include/asm-m68k/traps.h
index 4750561912..8caef25624 100644
--- a/include/asm-m68k/traps.h
+++ b/include/asm-m68k/traps.h
@@ -13,8 +13,15 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/linkage.h>
17#include <asm/ptrace.h>
18
16typedef void (*e_vector)(void); 19typedef void (*e_vector)(void);
17 20
21asmlinkage void auto_inthandler(void);
22asmlinkage void user_inthandler(void);
23asmlinkage void bad_inthandler(void);
24
18extern e_vector vectors[]; 25extern e_vector vectors[];
19 26
20#endif 27#endif
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index b761ef218c..88b1f47400 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -181,144 +181,164 @@ asm volatile ("\n" \
181unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n); 181unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
182unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n); 182unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n);
183 183
184#define __constant_copy_from_user_asm(res, to, from, tmp, n, s1, s2, s3)\
185 asm volatile ("\n" \
186 "1: moves."#s1" (%2)+,%3\n" \
187 " move."#s1" %3,(%1)+\n" \
188 "2: moves."#s2" (%2)+,%3\n" \
189 " move."#s2" %3,(%1)+\n" \
190 " .ifnc \""#s3"\",\"\"\n" \
191 "3: moves."#s3" (%2)+,%3\n" \
192 " move."#s3" %3,(%1)+\n" \
193 " .endif\n" \
194 "4:\n" \
195 " .section __ex_table,\"a\"\n" \
196 " .align 4\n" \
197 " .long 1b,10f\n" \
198 " .long 2b,20f\n" \
199 " .ifnc \""#s3"\",\"\"\n" \
200 " .long 3b,30f\n" \
201 " .endif\n" \
202 " .previous\n" \
203 "\n" \
204 " .section .fixup,\"ax\"\n" \
205 " .even\n" \
206 "10: clr."#s1" (%1)+\n" \
207 "20: clr."#s2" (%1)+\n" \
208 " .ifnc \""#s3"\",\"\"\n" \
209 "30: clr."#s3" (%1)+\n" \
210 " .endif\n" \
211 " moveq.l #"#n",%0\n" \
212 " jra 4b\n" \
213 " .previous\n" \
214 : "+d" (res), "+&a" (to), "+a" (from), "=&d" (tmp) \
215 : : "memory")
216
184static __always_inline unsigned long 217static __always_inline unsigned long
185__constant_copy_from_user(void *to, const void __user *from, unsigned long n) 218__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
186{ 219{
187 unsigned long res = 0, tmp; 220 unsigned long res = 0, tmp;
188 221
189 /* limit the inlined version to 3 moves */
190 if (n == 11 || n > 12)
191 return __generic_copy_from_user(to, from, n);
192
193 switch (n) { 222 switch (n) {
194 case 1: 223 case 1:
195 __get_user_asm(res, *(u8 *)to, (u8 *)from, u8, b, d, 1); 224 __get_user_asm(res, *(u8 *)to, (u8 *)from, u8, b, d, 1);
196 return res; 225 break;
197 case 2: 226 case 2:
198 __get_user_asm(res, *(u16 *)to, (u16 *)from, u16, w, d, 2); 227 __get_user_asm(res, *(u16 *)to, (u16 *)from, u16, w, d, 2);
199 return res; 228 break;
229 case 3:
230 __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,);
231 break;
200 case 4: 232 case 4:
201 __get_user_asm(res, *(u32 *)to, (u32 *)from, u32, l, r, 4); 233 __get_user_asm(res, *(u32 *)to, (u32 *)from, u32, l, r, 4);
202 return res; 234 break;
235 case 5:
236 __constant_copy_from_user_asm(res, to, from, tmp, 5, l, b,);
237 break;
238 case 6:
239 __constant_copy_from_user_asm(res, to, from, tmp, 6, l, w,);
240 break;
241 case 7:
242 __constant_copy_from_user_asm(res, to, from, tmp, 7, l, w, b);
243 break;
244 case 8:
245 __constant_copy_from_user_asm(res, to, from, tmp, 8, l, l,);
246 break;
247 case 9:
248 __constant_copy_from_user_asm(res, to, from, tmp, 9, l, l, b);
249 break;
250 case 10:
251 __constant_copy_from_user_asm(res, to, from, tmp, 10, l, l, w);
252 break;
253 case 12:
254 __constant_copy_from_user_asm(res, to, from, tmp, 12, l, l, l);
255 break;
256 default:
257 /* we limit the inlined version to 3 moves */
258 return __generic_copy_from_user(to, from, n);
203 } 259 }
204 260
205 asm volatile ("\n"
206 " .ifndef .Lfrom_user\n"
207 " .set .Lfrom_user,1\n"
208 " .macro copy_from_user to,from,tmp\n"
209 " .if .Lcnt >= 4\n"
210 "1: moves.l (\\from)+,\\tmp\n"
211 " move.l \\tmp,(\\to)+\n"
212 " .set .Lcnt,.Lcnt-4\n"
213 " .elseif .Lcnt & 2\n"
214 "1: moves.w (\\from)+,\\tmp\n"
215 " move.w \\tmp,(\\to)+\n"
216 " .set .Lcnt,.Lcnt-2\n"
217 " .elseif .Lcnt & 1\n"
218 "1: moves.b (\\from)+,\\tmp\n"
219 " move.b \\tmp,(\\to)+\n"
220 " .set .Lcnt,.Lcnt-1\n"
221 " .else\n"
222 " .exitm\n"
223 " .endif\n"
224 "\n"
225 " .section __ex_table,\"a\"\n"
226 " .align 4\n"
227 " .long 1b,3f\n"
228 " .previous\n"
229 " .endm\n"
230 " .endif\n"
231 "\n"
232 " .set .Lcnt,%c4\n"
233 " copy_from_user %1,%2,%3\n"
234 " copy_from_user %1,%2,%3\n"
235 " copy_from_user %1,%2,%3\n"
236 "2:\n"
237 " .section .fixup,\"ax\"\n"
238 " .even\n"
239 "3: moveq.l %4,%0\n"
240 " move.l %5,%1\n"
241 " .rept %c4 / 4\n"
242 " clr.l (%1)+\n"
243 " .endr\n"
244 " .if %c4 & 2\n"
245 " clr.w (%1)+\n"
246 " .endif\n"
247 " .if %c4 & 1\n"
248 " clr.b (%1)+\n"
249 " .endif\n"
250 " jra 2b\n"
251 " .previous\n"
252 : "+r" (res), "+a" (to), "+a" (from), "=&d" (tmp)
253 : "i" (n), "g" (to)
254 : "memory");
255
256 return res; 261 return res;
257} 262}
258 263
264#define __constant_copy_to_user_asm(res, to, from, tmp, n, s1, s2, s3) \
265 asm volatile ("\n" \
266 " move."#s1" (%2)+,%3\n" \
267 "11: moves."#s1" %3,(%1)+\n" \
268 "12: move."#s2" (%2)+,%3\n" \
269 "21: moves."#s2" %3,(%1)+\n" \
270 "22:\n" \
271 " .ifnc \""#s3"\",\"\"\n" \
272 " move."#s3" (%2)+,%3\n" \
273 "31: moves."#s3" %3,(%1)+\n" \
274 "32:\n" \
275 " .endif\n" \
276 "4:\n" \
277 "\n" \
278 " .section __ex_table,\"a\"\n" \
279 " .align 4\n" \
280 " .long 11b,5f\n" \
281 " .long 12b,5f\n" \
282 " .long 21b,5f\n" \
283 " .long 22b,5f\n" \
284 " .ifnc \""#s3"\",\"\"\n" \
285 " .long 31b,5f\n" \
286 " .long 32b,5f\n" \
287 " .endif\n" \
288 " .previous\n" \
289 "\n" \
290 " .section .fixup,\"ax\"\n" \
291 " .even\n" \
292 "5: moveq.l #"#n",%0\n" \
293 " jra 4b\n" \
294 " .previous\n" \
295 : "+d" (res), "+a" (to), "+a" (from), "=&d" (tmp) \
296 : : "memory")
297
259static __always_inline unsigned long 298static __always_inline unsigned long
260__constant_copy_to_user(void __user *to, const void *from, unsigned long n) 299__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
261{ 300{
262 unsigned long res = 0, tmp; 301 unsigned long res = 0, tmp;
263 302
264 /* limit the inlined version to 3 moves */
265 if (n == 11 || n > 12)
266 return __generic_copy_to_user(to, from, n);
267
268 switch (n) { 303 switch (n) {
269 case 1: 304 case 1:
270 __put_user_asm(res, *(u8 *)from, (u8 *)to, b, d, 1); 305 __put_user_asm(res, *(u8 *)from, (u8 *)to, b, d, 1);
271 return res; 306 break;
272 case 2: 307 case 2:
273 __put_user_asm(res, *(u16 *)from, (u16 *)to, w, d, 2); 308 __put_user_asm(res, *(u16 *)from, (u16 *)to, w, d, 2);
274 return res; 309 break;
310 case 3:
311 __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,);
312 break;
275 case 4: 313 case 4:
276 __put_user_asm(res, *(u32 *)from, (u32 *)to, l, r, 4); 314 __put_user_asm(res, *(u32 *)from, (u32 *)to, l, r, 4);
277 return res; 315 break;
316 case 5:
317 __constant_copy_to_user_asm(res, to, from, tmp, 5, l, b,);
318 break;
319 case 6:
320 __constant_copy_to_user_asm(res, to, from, tmp, 6, l, w,);
321 break;
322 case 7:
323 __constant_copy_to_user_asm(res, to, from, tmp, 7, l, w, b);
324 break;
325 case 8:
326 __constant_copy_to_user_asm(res, to, from, tmp, 8, l, l,);
327 break;
328 case 9:
329 __constant_copy_to_user_asm(res, to, from, tmp, 9, l, l, b);
330 break;
331 case 10:
332 __constant_copy_to_user_asm(res, to, from, tmp, 10, l, l, w);
333 break;
334 case 12:
335 __constant_copy_to_user_asm(res, to, from, tmp, 12, l, l, l);
336 break;
337 default:
338 /* limit the inlined version to 3 moves */
339 return __generic_copy_to_user(to, from, n);
278 } 340 }
279 341
280 asm volatile ("\n"
281 " .ifndef .Lto_user\n"
282 " .set .Lto_user,1\n"
283 " .macro copy_to_user to,from,tmp\n"
284 " .if .Lcnt >= 4\n"
285 " move.l (\\from)+,\\tmp\n"
286 "11: moves.l \\tmp,(\\to)+\n"
287 "12: .set .Lcnt,.Lcnt-4\n"
288 " .elseif .Lcnt & 2\n"
289 " move.w (\\from)+,\\tmp\n"
290 "11: moves.w \\tmp,(\\to)+\n"
291 "12: .set .Lcnt,.Lcnt-2\n"
292 " .elseif .Lcnt & 1\n"
293 " move.b (\\from)+,\\tmp\n"
294 "11: moves.b \\tmp,(\\to)+\n"
295 "12: .set .Lcnt,.Lcnt-1\n"
296 " .else\n"
297 " .exitm\n"
298 " .endif\n"
299 "\n"
300 " .section __ex_table,\"a\"\n"
301 " .align 4\n"
302 " .long 11b,3f\n"
303 " .long 12b,3f\n"
304 " .previous\n"
305 " .endm\n"
306 " .endif\n"
307 "\n"
308 " .set .Lcnt,%c4\n"
309 " copy_to_user %1,%2,%3\n"
310 " copy_to_user %1,%2,%3\n"
311 " copy_to_user %1,%2,%3\n"
312 "2:\n"
313 " .section .fixup,\"ax\"\n"
314 " .even\n"
315 "3: moveq.l %4,%0\n"
316 " jra 2b\n"
317 " .previous\n"
318 : "+r" (res), "+a" (to), "+a" (from), "=&d" (tmp)
319 : "i" (n)
320 : "memory");
321
322 return res; 342 return res;
323} 343}
324 344
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index 7c0b6296b4..751632b904 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); \
diff --git a/include/asm-m68knommu/Kbuild b/include/asm-m68knommu/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-m68knommu/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-m68knommu/bootstd.h b/include/asm-m68knommu/bootstd.h
index 3fdc79f06d..bdc1a4ac4f 100644
--- a/include/asm-m68knommu/bootstd.h
+++ b/include/asm-m68knommu/bootstd.h
@@ -52,7 +52,7 @@ type name(void) \
52 __asm__ __volatile__ ("trap #2" \ 52 __asm__ __volatile__ ("trap #2" \
53 : "=g" (__res) \ 53 : "=g" (__res) \
54 : "0" (__res) \ 54 : "0" (__res) \
55 : "%d0"); \ 55 ); \
56 __bsc_return(type,__res); \ 56 __bsc_return(type,__res); \
57} 57}
58 58
@@ -64,7 +64,7 @@ type name(atype a) \
64 __asm__ __volatile__ ("trap #2" \ 64 __asm__ __volatile__ ("trap #2" \
65 : "=g" (__res) \ 65 : "=g" (__res) \
66 : "0" (__res), "d" (__a) \ 66 : "0" (__res), "d" (__a) \
67 : "%d0"); \ 67 ); \
68 __bsc_return(type,__res); \ 68 __bsc_return(type,__res); \
69} 69}
70 70
@@ -77,7 +77,7 @@ type name(atype a, btype b) \
77 __asm__ __volatile__ ("trap #2" \ 77 __asm__ __volatile__ ("trap #2" \
78 : "=g" (__res) \ 78 : "=g" (__res) \
79 : "0" (__res), "d" (__a), "d" (__b) \ 79 : "0" (__res), "d" (__a), "d" (__b) \
80 : "%d0"); \ 80 ); \
81 __bsc_return(type,__res); \ 81 __bsc_return(type,__res); \
82} 82}
83 83
@@ -92,7 +92,7 @@ type name(atype a, btype b, ctype c) \
92 : "=g" (__res) \ 92 : "=g" (__res) \
93 : "0" (__res), "d" (__a), "d" (__b), \ 93 : "0" (__res), "d" (__a), "d" (__b), \
94 "d" (__c) \ 94 "d" (__c) \
95 : "%d0"); \ 95 ); \
96 __bsc_return(type,__res); \ 96 __bsc_return(type,__res); \
97} 97}
98 98
@@ -108,7 +108,7 @@ type name(atype a, btype b, ctype c, dtype d) \
108 : "=g" (__res) \ 108 : "=g" (__res) \
109 : "0" (__res), "d" (__a), "d" (__b), \ 109 : "0" (__res), "d" (__a), "d" (__b), \
110 "d" (__c), "d" (__d) \ 110 "d" (__c), "d" (__d) \
111 : "%d0"); \ 111 ); \
112 __bsc_return(type,__res); \ 112 __bsc_return(type,__res); \
113} 113}
114 114
@@ -125,7 +125,7 @@ type name(atype a, btype b, ctype c, dtype d, etype e) \
125 : "=g" (__res) \ 125 : "=g" (__res) \
126 : "0" (__res), "d" (__a), "d" (__b), \ 126 : "0" (__res), "d" (__a), "d" (__b), \
127 "d" (__c), "d" (__d), "d" (__e) \ 127 "d" (__c), "d" (__d), "d" (__e) \
128 : "%d0"); \ 128 ); \
129 __bsc_return(type,__res); \ 129 __bsc_return(type,__res); \
130} 130}
131 131
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index 49925e91e8..c3aadf3b0d 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -57,13 +57,13 @@ static inline void __flush_cache_all(void)
57 "nop\n\t" 57 "nop\n\t"
58 : : : "d0" ); 58 : : : "d0" );
59#endif /* CONFIG_M527x || CONFIG_M528x */ 59#endif /* CONFIG_M527x || CONFIG_M528x */
60#ifdef CONFIG_M5272 60#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272)
61 __asm__ __volatile__ ( 61 __asm__ __volatile__ (
62 "movel #0x01000000, %%d0\n\t" 62 "movel #0x81000100, %%d0\n\t"
63 "movec %%d0, %%CACR\n\t" 63 "movec %%d0, %%CACR\n\t"
64 "nop\n\t" 64 "nop\n\t"
65 : : : "d0" ); 65 : : : "d0" );
66#endif /* CONFIG_M5272 */ 66#endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */
67#ifdef CONFIG_M5249 67#ifdef CONFIG_M5249
68 __asm__ __volatile__ ( 68 __asm__ __volatile__ (
69 "movel #0xa1000200, %%d0\n\t" 69 "movel #0xa1000200, %%d0\n\t"
@@ -71,6 +71,13 @@ static inline void __flush_cache_all(void)
71 "nop\n\t" 71 "nop\n\t"
72 : : : "d0" ); 72 : : : "d0" );
73#endif /* CONFIG_M5249 */ 73#endif /* CONFIG_M5249 */
74#ifdef CONFIG_M532x
75 __asm__ __volatile__ (
76 "movel #0x81000200, %%d0\n\t"
77 "movec %%d0, %%CACR\n\t"
78 "nop\n\t"
79 : : : "d0" );
80#endif /* CONFIG_M532x */
74} 81}
75 82
76#endif /* _M68KNOMMU_CACHEFLUSH_H */ 83#endif /* _M68KNOMMU_CACHEFLUSH_H */
diff --git a/include/asm-m68knommu/coldfire.h b/include/asm-m68knommu/coldfire.h
index 2fabca91df..83a9fa4e61 100644
--- a/include/asm-m68knommu/coldfire.h
+++ b/include/asm-m68knommu/coldfire.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * coldfire.h -- Motorola ColdFire CPU sepecific defines 4 * coldfire.h -- Motorola ColdFire CPU sepecific defines
5 * 5 *
6 * (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 1999-2006, Greg Ungerer (gerg@snapgear.com)
7 * (C) Copyright 2000, Lineo (www.lineo.com) 7 * (C) Copyright 2000, Lineo (www.lineo.com)
8 */ 8 */
9 9
@@ -14,6 +14,19 @@
14 14
15 15
16/* 16/*
17 * Define master clock frequency. This is essentially done at config
18 * time now. No point enumerating dozens of possible clock options
19 * here. Also the peripheral clock (bus clock) divide ratio is set
20 * at config time too.
21 */
22#ifdef CONFIG_CLOCK_SET
23#define MCF_CLK CONFIG_CLOCK_FREQ
24#define MCF_BUSCLK (CONFIG_CLOCK_FREQ / CONFIG_CLOCK_DIV)
25#else
26#error "Don't know what your ColdFire CPU clock frequency is??"
27#endif
28
29/*
17 * Define the processor support peripherals base address. 30 * Define the processor support peripherals base address.
18 * This is generally setup by the boards start up code. 31 * This is generally setup by the boards start up code.
19 */ 32 */
@@ -29,64 +42,9 @@
29 defined(CONFIG_M520x) 42 defined(CONFIG_M520x)
30#undef MCF_MBAR 43#undef MCF_MBAR
31#define MCF_MBAR MCF_IPSBAR 44#define MCF_MBAR MCF_IPSBAR
32#endif 45#elif defined(CONFIG_M532x)
33 46#undef MCF_MBAR
34/* 47#define MCF_MBAR 0x00000000
35 * Define master clock frequency.
36 */
37#if defined(CONFIG_CLOCK_11MHz)
38#define MCF_CLK 11289600
39#elif defined(CONFIG_CLOCK_16MHz)
40#define MCF_CLK 16000000
41#elif defined(CONFIG_CLOCK_20MHz)
42#define MCF_CLK 20000000
43#elif defined(CONFIG_CLOCK_24MHz)
44#define MCF_CLK 24000000
45#elif defined(CONFIG_CLOCK_25MHz)
46#define MCF_CLK 25000000
47#elif defined(CONFIG_CLOCK_33MHz)
48#define MCF_CLK 33000000
49#elif defined(CONFIG_CLOCK_40MHz)
50#define MCF_CLK 40000000
51#elif defined(CONFIG_CLOCK_45MHz)
52#define MCF_CLK 45000000
53#elif defined(CONFIG_CLOCK_48MHz)
54#define MCF_CLK 48000000
55#elif defined(CONFIG_CLOCK_50MHz)
56#define MCF_CLK 50000000
57#elif defined(CONFIG_CLOCK_54MHz)
58#define MCF_CLK 54000000
59#elif defined(CONFIG_CLOCK_60MHz)
60#define MCF_CLK 60000000
61#elif defined(CONFIG_CLOCK_62_5MHz)
62#define MCF_CLK 62500000
63#elif defined(CONFIG_CLOCK_64MHz)
64#define MCF_CLK 64000000
65#elif defined(CONFIG_CLOCK_66MHz)
66#define MCF_CLK 66000000
67#elif defined(CONFIG_CLOCK_70MHz)
68#define MCF_CLK 70000000
69#elif defined(CONFIG_CLOCK_100MHz)
70#define MCF_CLK 100000000
71#elif defined(CONFIG_CLOCK_140MHz)
72#define MCF_CLK 140000000
73#elif defined(CONFIG_CLOCK_150MHz)
74#define MCF_CLK 150000000
75#elif defined(CONFIG_CLOCK_166MHz)
76#define MCF_CLK 166000000
77#else
78#error "Don't know what your ColdFire CPU clock frequency is??"
79#endif
80
81/*
82 * One some ColdFire family members the bus clock (used by internal
83 * peripherals) is not the same as the CPU clock.
84 */
85#if defined(CONFIG_M523x) || defined(CONFIG_M5249) || defined(CONFIG_M527x) || \
86 defined(CONFIG_M520x)
87#define MCF_BUSCLK (MCF_CLK / 2)
88#else
89#define MCF_BUSCLK MCF_CLK
90#endif 48#endif
91 49
92/****************************************************************************/ 50/****************************************************************************/
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index c5247516fc..45e7a2fd16 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -62,8 +62,8 @@ extern void (*mach_disable_irq)(unsigned int);
62 62
63/* 63/*
64 * various flags for request_irq() - the Amiga now uses the standard 64 * various flags for request_irq() - the Amiga now uses the standard
65 * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ 65 * mechanism like all other architectures - IRQF_DISABLED and
66 * are your friends. 66 * IRQF_SHARED are your friends.
67 */ 67 */
68#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ 68#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
69#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */ 69#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
@@ -83,7 +83,7 @@ extern void (*mach_disable_irq)(unsigned int);
83/* 83/*
84 * Some drivers want these entry points 84 * Some drivers want these entry points
85 */ 85 */
86#define enable_irq(x) 0 86#define enable_irq(x) do { } while (0)
87#define disable_irq(x) do { } while (0) 87#define disable_irq(x) do { } while (0)
88#define disable_irq_nosync(x) disable_irq(x) 88#define disable_irq_nosync(x) disable_irq(x)
89 89
diff --git a/include/asm-m68knommu/m5249sim.h b/include/asm-m68knommu/m5249sim.h
index 9344f529bd..399814f0b2 100644
--- a/include/asm-m68knommu/m5249sim.h
+++ b/include/asm-m68knommu/m5249sim.h
@@ -157,7 +157,7 @@
157 movel %d0,0x180(%a1) /* set PLL register */ 157 movel %d0,0x180(%a1) /* set PLL register */
158 nop 158 nop
159 159
160#ifdef CONFIG_CLOCK_140MHz 160#if CONFIG_CLOCK_FREQ == 140000000
161 /* 161 /*
162 * Set initial clock frequency. This assumes M5249C3 board 162 * Set initial clock frequency. This assumes M5249C3 board
163 * is fitted with 11.2896MHz crystal. It will program the 163 * is fitted with 11.2896MHz crystal. It will program the
diff --git a/include/asm-m68knommu/m532xsim.h b/include/asm-m68knommu/m532xsim.h
new file mode 100644
index 0000000000..1835fd20a8
--- /dev/null
+++ b/include/asm-m68knommu/m532xsim.h
@@ -0,0 +1,2238 @@
1/****************************************************************************/
2
3/*
4 * m532xsim.h -- ColdFire 5329 registers
5 */
6
7/****************************************************************************/
8#ifndef m532xsim_h
9#define m532xsim_h
10/****************************************************************************/
11
12#define MCF_REG32(x) (*(volatile unsigned long *)(x))
13#define MCF_REG16(x) (*(volatile unsigned short *)(x))
14#define MCF_REG08(x) (*(volatile unsigned char *)(x))
15
16#define MCFINT_VECBASE 64
17#define MCFINT_UART0 26 /* Interrupt number for UART0 */
18#define MCFINT_UART1 27 /* Interrupt number for UART1 */
19
20#define MCF_WTM_WCR MCF_REG16(0xFC098000)
21
22/*
23 * Define the 532x SIM register set addresses.
24 */
25#define MCFSIM_IPRL 0xFC048004
26#define MCFSIM_IPRH 0xFC048000
27#define MCFSIM_IPR MCFSIM_IPRL
28#define MCFSIM_IMRL 0xFC04800C
29#define MCFSIM_IMRH 0xFC048008
30#define MCFSIM_IMR MCFSIM_IMRL
31#define MCFSIM_ICR0 0xFC048040
32#define MCFSIM_ICR1 0xFC048041
33#define MCFSIM_ICR2 0xFC048042
34#define MCFSIM_ICR3 0xFC048043
35#define MCFSIM_ICR4 0xFC048044
36#define MCFSIM_ICR5 0xFC048045
37#define MCFSIM_ICR6 0xFC048046
38#define MCFSIM_ICR7 0xFC048047
39#define MCFSIM_ICR8 0xFC048048
40#define MCFSIM_ICR9 0xFC048049
41#define MCFSIM_ICR10 0xFC04804A
42#define MCFSIM_ICR11 0xFC04804B
43
44/*
45 * Some symbol defines for the above...
46 */
47#define MCFSIM_SWDICR MCFSIM_ICR0 /* Watchdog timer ICR */
48#define MCFSIM_TIMER1ICR MCFSIM_ICR1 /* Timer 1 ICR */
49#define MCFSIM_TIMER2ICR MCFSIM_ICR2 /* Timer 2 ICR */
50#define MCFSIM_UART1ICR MCFSIM_ICR4 /* UART 1 ICR */
51#define MCFSIM_UART2ICR MCFSIM_ICR5 /* UART 2 ICR */
52#define MCFSIM_DMA0ICR MCFSIM_ICR6 /* DMA 0 ICR */
53#define MCFSIM_DMA1ICR MCFSIM_ICR7 /* DMA 1 ICR */
54#define MCFSIM_DMA2ICR MCFSIM_ICR8 /* DMA 2 ICR */
55#define MCFSIM_DMA3ICR MCFSIM_ICR9 /* DMA 3 ICR */
56
57
58#define MCFSIM_IMR_MASKALL 0xFFFFFFFF /* All SIM intr sources */
59
60#define MCFSIM_IMR_SIMR0 0xFC04801C
61#define MCFSIM_IMR_SIMR1 0xFC04C01C
62#define MCFSIM_IMR_CIMR0 0xFC04801D
63#define MCFSIM_IMR_CIMR1 0xFC04C01D
64
65#define MCFSIM_ICR_TIMER1 (0xFC048040+32)
66#define MCFSIM_ICR_TIMER2 (0xFC048040+33)
67
68
69/*
70 * Macro to set IMR register. It is 32 bits on the 5307.
71 */
72#define mcf_getimr() \
73 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IMR))
74
75#define mcf_setimr(imr) \
76 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IMR)) = (imr);
77
78#define mcf_getipr() \
79 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IPR))
80
81#define mcf_getiprl() \
82 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IPRL))
83
84#define mcf_getiprh() \
85 *((volatile unsigned long *) (MCF_MBAR + MCFSIM_IPRH))
86
87
88#define mcf_enable_irq0(irq) \
89 *((volatile unsigned char*) (MCFSIM_IMR_CIMR0)) = (irq);
90
91#define mcf_enable_irq1(irq) \
92 *((volatile unsigned char*) (MCFSIM_IMR_CIMR1)) = (irq);
93
94#define mcf_disable_irq0(irq) \
95 *((volatile unsigned char*) (MCFSIM_IMR_SIMR0)) = (irq);
96
97#define mcf_disable_irq1(irq) \
98 *((volatile unsigned char*) (MCFSIM_IMR_SIMR1)) = (irq);
99
100/*
101 * Define the Cache register flags.
102 */
103#define CACR_EC (1<<31)
104#define CACR_ESB (1<<29)
105#define CACR_DPI (1<<28)
106#define CACR_HLCK (1<<27)
107#define CACR_CINVA (1<<24)
108#define CACR_DNFB (1<<10)
109#define CACR_DCM_WTHRU (0<<8)
110#define CACR_DCM_WBACK (1<<8)
111#define CACR_DCM_OFF_PRE (2<<8)
112#define CACR_DCM_OFF_IMP (3<<8)
113#define CACR_DW (1<<5)
114
115#define ACR_BASE_POS 24
116#define ACR_MASK_POS 16
117#define ACR_ENABLE (1<<15)
118#define ACR_USER (0<<13)
119#define ACR_SUPER (1<<13)
120#define ACR_ANY (2<<13)
121#define ACR_CM_WTHRU (0<<5)
122#define ACR_CM_WBACK (1<<5)
123#define ACR_CM_OFF_PRE (2<<5)
124#define ACR_CM_OFF_IMP (3<<5)
125#define ACR_WPROTECT (1<<2)
126
127/*********************************************************************
128 *
129 * Inter-IC (I2C) Module
130 *
131 *********************************************************************/
132
133/* Read/Write access macros for general use */
134#define MCF532x_I2C_I2ADR (volatile u8 *) (0xFC058000) // Address
135#define MCF532x_I2C_I2FDR (volatile u8 *) (0xFC058004) // Freq Divider
136#define MCF532x_I2C_I2CR (volatile u8 *) (0xFC058008) // Control
137#define MCF532x_I2C_I2SR (volatile u8 *) (0xFC05800C) // Status
138#define MCF532x_I2C_I2DR (volatile u8 *) (0xFC058010) // Data I/O
139
140/* Bit level definitions and macros */
141#define MCF532x_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
142
143#define MCF532x_I2C_I2FDR_IC(x) (((x)&0x3F))
144
145#define MCF532x_I2C_I2CR_IEN (0x80) // I2C enable
146#define MCF532x_I2C_I2CR_IIEN (0x40) // interrupt enable
147#define MCF532x_I2C_I2CR_MSTA (0x20) // master/slave mode
148#define MCF532x_I2C_I2CR_MTX (0x10) // transmit/receive mode
149#define MCF532x_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
150#define MCF532x_I2C_I2CR_RSTA (0x04) // repeat start
151
152#define MCF532x_I2C_I2SR_ICF (0x80) // data transfer bit
153#define MCF532x_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
154#define MCF532x_I2C_I2SR_IBB (0x20) // I2C bus busy
155#define MCF532x_I2C_I2SR_IAL (0x10) // aribitration lost
156#define MCF532x_I2C_I2SR_SRW (0x04) // slave read/write
157#define MCF532x_I2C_I2SR_IIF (0x02) // I2C interrupt
158#define MCF532x_I2C_I2SR_RXAK (0x01) // received acknowledge
159
160#define MCF532x_PAR_FECI2C (volatile u8 *) (0xFC0A4053)
161
162
163/*
164 * The M5329EVB board needs a help getting its devices initialized
165 * at kernel start time if dBUG doesn't set it up (for example
166 * it is not used), so we need to do it manually.
167 */
168#ifdef __ASSEMBLER__
169.macro m5329EVB_setup
170 movel #0xFC098000, %a7
171 movel #0x0, (%a7)
172#define CORE_SRAM 0x80000000
173#define CORE_SRAM_SIZE 0x8000
174 movel #CORE_SRAM, %d0
175 addl #0x221, %d0
176 movec %d0,%RAMBAR1
177 movel #CORE_SRAM, %sp
178 addl #CORE_SRAM_SIZE, %sp
179 jsr sysinit
180.endm
181#define PLATFORM_SETUP m5329EVB_setup
182
183#endif /* __ASSEMBLER__ */
184
185/*********************************************************************
186 *
187 * Chip Configuration Module (CCM)
188 *
189 *********************************************************************/
190
191/* Register read/write macros */
192#define MCF_CCM_CCR MCF_REG16(0xFC0A0004)
193#define MCF_CCM_RCON MCF_REG16(0xFC0A0008)
194#define MCF_CCM_CIR MCF_REG16(0xFC0A000A)
195#define MCF_CCM_MISCCR MCF_REG16(0xFC0A0010)
196#define MCF_CCM_CDR MCF_REG16(0xFC0A0012)
197#define MCF_CCM_UHCSR MCF_REG16(0xFC0A0014)
198#define MCF_CCM_UOCSR MCF_REG16(0xFC0A0016)
199
200/* Bit definitions and macros for MCF_CCM_CCR */
201#define MCF_CCM_CCR_RESERVED (0x0001)
202#define MCF_CCM_CCR_PLL_MODE (0x0003)
203#define MCF_CCM_CCR_OSC_MODE (0x0005)
204#define MCF_CCM_CCR_BOOTPS(x) (((x)&0x0003)<<3|0x0001)
205#define MCF_CCM_CCR_LOAD (0x0021)
206#define MCF_CCM_CCR_LIMP (0x0041)
207#define MCF_CCM_CCR_CSC(x) (((x)&0x0003)<<8|0x0001)
208
209/* Bit definitions and macros for MCF_CCM_RCON */
210#define MCF_CCM_RCON_RESERVED (0x0001)
211#define MCF_CCM_RCON_PLL_MODE (0x0003)
212#define MCF_CCM_RCON_OSC_MODE (0x0005)
213#define MCF_CCM_RCON_BOOTPS(x) (((x)&0x0003)<<3|0x0001)
214#define MCF_CCM_RCON_LOAD (0x0021)
215#define MCF_CCM_RCON_LIMP (0x0041)
216#define MCF_CCM_RCON_CSC(x) (((x)&0x0003)<<8|0x0001)
217
218/* Bit definitions and macros for MCF_CCM_CIR */
219#define MCF_CCM_CIR_PRN(x) (((x)&0x003F)<<0)
220#define MCF_CCM_CIR_PIN(x) (((x)&0x03FF)<<6)
221
222/* Bit definitions and macros for MCF_CCM_MISCCR */
223#define MCF_CCM_MISCCR_USBSRC (0x0001)
224#define MCF_CCM_MISCCR_USBDIV (0x0002)
225#define MCF_CCM_MISCCR_SSI_SRC (0x0010)
226#define MCF_CCM_MISCCR_TIM_DMA (0x0020)
227#define MCF_CCM_MISCCR_SSI_PUS (0x0040)
228#define MCF_CCM_MISCCR_SSI_PUE (0x0080)
229#define MCF_CCM_MISCCR_LCD_CHEN (0x0100)
230#define MCF_CCM_MISCCR_LIMP (0x1000)
231#define MCF_CCM_MISCCR_PLL_LOCK (0x2000)
232
233/* Bit definitions and macros for MCF_CCM_CDR */
234#define MCF_CCM_CDR_SSIDIV(x) (((x)&0x000F)<<0)
235#define MCF_CCM_CDR_LPDIV(x) (((x)&0x000F)<<8)
236
237/* Bit definitions and macros for MCF_CCM_UHCSR */
238#define MCF_CCM_UHCSR_XPDE (0x0001)
239#define MCF_CCM_UHCSR_UHMIE (0x0002)
240#define MCF_CCM_UHCSR_WKUP (0x0004)
241#define MCF_CCM_UHCSR_PORTIND(x) (((x)&0x0003)<<14)
242
243/* Bit definitions and macros for MCF_CCM_UOCSR */
244#define MCF_CCM_UOCSR_XPDE (0x0001)
245#define MCF_CCM_UOCSR_UOMIE (0x0002)
246#define MCF_CCM_UOCSR_WKUP (0x0004)
247#define MCF_CCM_UOCSR_PWRFLT (0x0008)
248#define MCF_CCM_UOCSR_SEND (0x0010)
249#define MCF_CCM_UOCSR_VVLD (0x0020)
250#define MCF_CCM_UOCSR_BVLD (0x0040)
251#define MCF_CCM_UOCSR_AVLD (0x0080)
252#define MCF_CCM_UOCSR_DPPU (0x0100)
253#define MCF_CCM_UOCSR_DCR_VBUS (0x0200)
254#define MCF_CCM_UOCSR_CRG_VBUS (0x0400)
255#define MCF_CCM_UOCSR_DRV_VBUS (0x0800)
256#define MCF_CCM_UOCSR_DMPD (0x1000)
257#define MCF_CCM_UOCSR_DPPD (0x2000)
258#define MCF_CCM_UOCSR_PORTIND(x) (((x)&0x0003)<<14)
259
260/*********************************************************************
261 *
262 * DMA Timers (DTIM)
263 *
264 *********************************************************************/
265
266/* Register read/write macros */
267#define MCF_DTIM0_DTMR MCF_REG16(0xFC070000)
268#define MCF_DTIM0_DTXMR MCF_REG08(0xFC070002)
269#define MCF_DTIM0_DTER MCF_REG08(0xFC070003)
270#define MCF_DTIM0_DTRR MCF_REG32(0xFC070004)
271#define MCF_DTIM0_DTCR MCF_REG32(0xFC070008)
272#define MCF_DTIM0_DTCN MCF_REG32(0xFC07000C)
273#define MCF_DTIM1_DTMR MCF_REG16(0xFC074000)
274#define MCF_DTIM1_DTXMR MCF_REG08(0xFC074002)
275#define MCF_DTIM1_DTER MCF_REG08(0xFC074003)
276#define MCF_DTIM1_DTRR MCF_REG32(0xFC074004)
277#define MCF_DTIM1_DTCR MCF_REG32(0xFC074008)
278#define MCF_DTIM1_DTCN MCF_REG32(0xFC07400C)
279#define MCF_DTIM2_DTMR MCF_REG16(0xFC078000)
280#define MCF_DTIM2_DTXMR MCF_REG08(0xFC078002)
281#define MCF_DTIM2_DTER MCF_REG08(0xFC078003)
282#define MCF_DTIM2_DTRR MCF_REG32(0xFC078004)
283#define MCF_DTIM2_DTCR MCF_REG32(0xFC078008)
284#define MCF_DTIM2_DTCN MCF_REG32(0xFC07800C)
285#define MCF_DTIM3_DTMR MCF_REG16(0xFC07C000)
286#define MCF_DTIM3_DTXMR MCF_REG08(0xFC07C002)
287#define MCF_DTIM3_DTER MCF_REG08(0xFC07C003)
288#define MCF_DTIM3_DTRR MCF_REG32(0xFC07C004)
289#define MCF_DTIM3_DTCR MCF_REG32(0xFC07C008)
290#define MCF_DTIM3_DTCN MCF_REG32(0xFC07C00C)
291#define MCF_DTIM_DTMR(x) MCF_REG16(0xFC070000+((x)*0x4000))
292#define MCF_DTIM_DTXMR(x) MCF_REG08(0xFC070002+((x)*0x4000))
293#define MCF_DTIM_DTER(x) MCF_REG08(0xFC070003+((x)*0x4000))
294#define MCF_DTIM_DTRR(x) MCF_REG32(0xFC070004+((x)*0x4000))
295#define MCF_DTIM_DTCR(x) MCF_REG32(0xFC070008+((x)*0x4000))
296#define MCF_DTIM_DTCN(x) MCF_REG32(0xFC07000C+((x)*0x4000))
297
298/* Bit definitions and macros for MCF_DTIM_DTMR */
299#define MCF_DTIM_DTMR_RST (0x0001)
300#define MCF_DTIM_DTMR_CLK(x) (((x)&0x0003)<<1)
301#define MCF_DTIM_DTMR_FRR (0x0008)
302#define MCF_DTIM_DTMR_ORRI (0x0010)
303#define MCF_DTIM_DTMR_OM (0x0020)
304#define MCF_DTIM_DTMR_CE(x) (((x)&0x0003)<<6)
305#define MCF_DTIM_DTMR_PS(x) (((x)&0x00FF)<<8)
306#define MCF_DTIM_DTMR_CE_ANY (0x00C0)
307#define MCF_DTIM_DTMR_CE_FALL (0x0080)
308#define MCF_DTIM_DTMR_CE_RISE (0x0040)
309#define MCF_DTIM_DTMR_CE_NONE (0x0000)
310#define MCF_DTIM_DTMR_CLK_DTIN (0x0006)
311#define MCF_DTIM_DTMR_CLK_DIV16 (0x0004)
312#define MCF_DTIM_DTMR_CLK_DIV1 (0x0002)
313#define MCF_DTIM_DTMR_CLK_STOP (0x0000)
314
315/* Bit definitions and macros for MCF_DTIM_DTXMR */
316#define MCF_DTIM_DTXMR_MODE16 (0x01)
317#define MCF_DTIM_DTXMR_DMAEN (0x80)
318
319/* Bit definitions and macros for MCF_DTIM_DTER */
320#define MCF_DTIM_DTER_CAP (0x01)
321#define MCF_DTIM_DTER_REF (0x02)
322
323/* Bit definitions and macros for MCF_DTIM_DTRR */
324#define MCF_DTIM_DTRR_REF(x) (((x)&0xFFFFFFFF)<<0)
325
326/* Bit definitions and macros for MCF_DTIM_DTCR */
327#define MCF_DTIM_DTCR_CAP(x) (((x)&0xFFFFFFFF)<<0)
328
329/* Bit definitions and macros for MCF_DTIM_DTCN */
330#define MCF_DTIM_DTCN_CNT(x) (((x)&0xFFFFFFFF)<<0)
331
332/*********************************************************************
333 *
334 * FlexBus Chip Selects (FBCS)
335 *
336 *********************************************************************/
337
338/* Register read/write macros */
339#define MCF_FBCS0_CSAR MCF_REG32(0xFC008000)
340#define MCF_FBCS0_CSMR MCF_REG32(0xFC008004)
341#define MCF_FBCS0_CSCR MCF_REG32(0xFC008008)
342#define MCF_FBCS1_CSAR MCF_REG32(0xFC00800C)
343#define MCF_FBCS1_CSMR MCF_REG32(0xFC008010)
344#define MCF_FBCS1_CSCR MCF_REG32(0xFC008014)
345#define MCF_FBCS2_CSAR MCF_REG32(0xFC008018)
346#define MCF_FBCS2_CSMR MCF_REG32(0xFC00801C)
347#define MCF_FBCS2_CSCR MCF_REG32(0xFC008020)
348#define MCF_FBCS3_CSAR MCF_REG32(0xFC008024)
349#define MCF_FBCS3_CSMR MCF_REG32(0xFC008028)
350#define MCF_FBCS3_CSCR MCF_REG32(0xFC00802C)
351#define MCF_FBCS4_CSAR MCF_REG32(0xFC008030)
352#define MCF_FBCS4_CSMR MCF_REG32(0xFC008034)
353#define MCF_FBCS4_CSCR MCF_REG32(0xFC008038)
354#define MCF_FBCS5_CSAR MCF_REG32(0xFC00803C)
355#define MCF_FBCS5_CSMR MCF_REG32(0xFC008040)
356#define MCF_FBCS5_CSCR MCF_REG32(0xFC008044)
357#define MCF_FBCS_CSAR(x) MCF_REG32(0xFC008000+((x)*0x00C))
358#define MCF_FBCS_CSMR(x) MCF_REG32(0xFC008004+((x)*0x00C))
359#define MCF_FBCS_CSCR(x) MCF_REG32(0xFC008008+((x)*0x00C))
360
361/* Bit definitions and macros for MCF_FBCS_CSAR */
362#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000)
363
364/* Bit definitions and macros for MCF_FBCS_CSMR */
365#define MCF_FBCS_CSMR_V (0x00000001)
366#define MCF_FBCS_CSMR_WP (0x00000100)
367#define MCF_FBCS_CSMR_BAM(x) (((x)&0x0000FFFF)<<16)
368#define MCF_FBCS_CSMR_BAM_4G (0xFFFF0000)
369#define MCF_FBCS_CSMR_BAM_2G (0x7FFF0000)
370#define MCF_FBCS_CSMR_BAM_1G (0x3FFF0000)
371#define MCF_FBCS_CSMR_BAM_1024M (0x3FFF0000)
372#define MCF_FBCS_CSMR_BAM_512M (0x1FFF0000)
373#define MCF_FBCS_CSMR_BAM_256M (0x0FFF0000)
374#define MCF_FBCS_CSMR_BAM_128M (0x07FF0000)
375#define MCF_FBCS_CSMR_BAM_64M (0x03FF0000)
376#define MCF_FBCS_CSMR_BAM_32M (0x01FF0000)
377#define MCF_FBCS_CSMR_BAM_16M (0x00FF0000)
378#define MCF_FBCS_CSMR_BAM_8M (0x007F0000)
379#define MCF_FBCS_CSMR_BAM_4M (0x003F0000)
380#define MCF_FBCS_CSMR_BAM_2M (0x001F0000)
381#define MCF_FBCS_CSMR_BAM_1M (0x000F0000)
382#define MCF_FBCS_CSMR_BAM_1024K (0x000F0000)
383#define MCF_FBCS_CSMR_BAM_512K (0x00070000)
384#define MCF_FBCS_CSMR_BAM_256K (0x00030000)
385#define MCF_FBCS_CSMR_BAM_128K (0x00010000)
386#define MCF_FBCS_CSMR_BAM_64K (0x00000000)
387
388/* Bit definitions and macros for MCF_FBCS_CSCR */
389#define MCF_FBCS_CSCR_BSTW (0x00000008)
390#define MCF_FBCS_CSCR_BSTR (0x00000010)
391#define MCF_FBCS_CSCR_BEM (0x00000020)
392#define MCF_FBCS_CSCR_PS(x) (((x)&0x00000003)<<6)
393#define MCF_FBCS_CSCR_AA (0x00000100)
394#define MCF_FBCS_CSCR_SBM (0x00000200)
395#define MCF_FBCS_CSCR_WS(x) (((x)&0x0000003F)<<10)
396#define MCF_FBCS_CSCR_WRAH(x) (((x)&0x00000003)<<16)
397#define MCF_FBCS_CSCR_RDAH(x) (((x)&0x00000003)<<18)
398#define MCF_FBCS_CSCR_ASET(x) (((x)&0x00000003)<<20)
399#define MCF_FBCS_CSCR_SWSEN (0x00800000)
400#define MCF_FBCS_CSCR_SWS(x) (((x)&0x0000003F)<<26)
401#define MCF_FBCS_CSCR_PS_8 (0x0040)
402#define MCF_FBCS_CSCR_PS_16 (0x0080)
403#define MCF_FBCS_CSCR_PS_32 (0x0000)
404
405/*********************************************************************
406 *
407 * General Purpose I/O (GPIO)
408 *
409 *********************************************************************/
410
411/* Register read/write macros */
412#define MCF_GPIO_PODR_FECH MCF_REG08(0xFC0A4000)
413#define MCF_GPIO_PODR_FECL MCF_REG08(0xFC0A4001)
414#define MCF_GPIO_PODR_SSI MCF_REG08(0xFC0A4002)
415#define MCF_GPIO_PODR_BUSCTL MCF_REG08(0xFC0A4003)
416#define MCF_GPIO_PODR_BE MCF_REG08(0xFC0A4004)
417#define MCF_GPIO_PODR_CS MCF_REG08(0xFC0A4005)
418#define MCF_GPIO_PODR_PWM MCF_REG08(0xFC0A4006)
419#define MCF_GPIO_PODR_FECI2C MCF_REG08(0xFC0A4007)
420#define MCF_GPIO_PODR_UART MCF_REG08(0xFC0A4009)
421#define MCF_GPIO_PODR_QSPI MCF_REG08(0xFC0A400A)
422#define MCF_GPIO_PODR_TIMER MCF_REG08(0xFC0A400B)
423#define MCF_GPIO_PODR_LCDDATAH MCF_REG08(0xFC0A400D)
424#define MCF_GPIO_PODR_LCDDATAM MCF_REG08(0xFC0A400E)
425#define MCF_GPIO_PODR_LCDDATAL MCF_REG08(0xFC0A400F)
426#define MCF_GPIO_PODR_LCDCTLH MCF_REG08(0xFC0A4010)
427#define MCF_GPIO_PODR_LCDCTLL MCF_REG08(0xFC0A4011)
428#define MCF_GPIO_PDDR_FECH MCF_REG08(0xFC0A4014)
429#define MCF_GPIO_PDDR_FECL MCF_REG08(0xFC0A4015)
430#define MCF_GPIO_PDDR_SSI MCF_REG08(0xFC0A4016)
431#define MCF_GPIO_PDDR_BUSCTL MCF_REG08(0xFC0A4017)
432#define MCF_GPIO_PDDR_BE MCF_REG08(0xFC0A4018)
433#define MCF_GPIO_PDDR_CS MCF_REG08(0xFC0A4019)
434#define MCF_GPIO_PDDR_PWM MCF_REG08(0xFC0A401A)
435#define MCF_GPIO_PDDR_FECI2C MCF_REG08(0xFC0A401B)
436#define MCF_GPIO_PDDR_UART MCF_REG08(0xFC0A401C)
437#define MCF_GPIO_PDDR_QSPI MCF_REG08(0xFC0A401E)
438#define MCF_GPIO_PDDR_TIMER MCF_REG08(0xFC0A401F)
439#define MCF_GPIO_PDDR_LCDDATAH MCF_REG08(0xFC0A4021)
440#define MCF_GPIO_PDDR_LCDDATAM MCF_REG08(0xFC0A4022)
441#define MCF_GPIO_PDDR_LCDDATAL MCF_REG08(0xFC0A4023)
442#define MCF_GPIO_PDDR_LCDCTLH MCF_REG08(0xFC0A4024)
443#define MCF_GPIO_PDDR_LCDCTLL MCF_REG08(0xFC0A4025)
444#define MCF_GPIO_PPDSDR_FECH MCF_REG08(0xFC0A4028)
445#define MCF_GPIO_PPDSDR_FECL MCF_REG08(0xFC0A4029)
446#define MCF_GPIO_PPDSDR_SSI MCF_REG08(0xFC0A402A)
447#define MCF_GPIO_PPDSDR_BUSCTL MCF_REG08(0xFC0A402B)
448#define MCF_GPIO_PPDSDR_BE MCF_REG08(0xFC0A402C)
449#define MCF_GPIO_PPDSDR_CS MCF_REG08(0xFC0A402D)
450#define MCF_GPIO_PPDSDR_PWM MCF_REG08(0xFC0A402E)
451#define MCF_GPIO_PPDSDR_FECI2C MCF_REG08(0xFC0A402F)
452#define MCF_GPIO_PPDSDR_UART MCF_REG08(0xFC0A4031)
453#define MCF_GPIO_PPDSDR_QSPI MCF_REG08(0xFC0A4032)
454#define MCF_GPIO_PPDSDR_TIMER MCF_REG08(0xFC0A4033)
455#define MCF_GPIO_PPDSDR_LCDDATAH MCF_REG08(0xFC0A4035)
456#define MCF_GPIO_PPDSDR_LCDDATAM MCF_REG08(0xFC0A4036)
457#define MCF_GPIO_PPDSDR_LCDDATAL MCF_REG08(0xFC0A4037)
458#define MCF_GPIO_PPDSDR_LCDCTLH MCF_REG08(0xFC0A4038)
459#define MCF_GPIO_PPDSDR_LCDCTLL MCF_REG08(0xFC0A4039)
460#define MCF_GPIO_PCLRR_FECH MCF_REG08(0xFC0A403C)
461#define MCF_GPIO_PCLRR_FECL MCF_REG08(0xFC0A403D)
462#define MCF_GPIO_PCLRR_SSI MCF_REG08(0xFC0A403E)
463#define MCF_GPIO_PCLRR_BUSCTL MCF_REG08(0xFC0A403F)
464#define MCF_GPIO_PCLRR_BE MCF_REG08(0xFC0A4040)
465#define MCF_GPIO_PCLRR_CS MCF_REG08(0xFC0A4041)
466#define MCF_GPIO_PCLRR_PWM MCF_REG08(0xFC0A4042)
467#define MCF_GPIO_PCLRR_FECI2C MCF_REG08(0xFC0A4043)
468#define MCF_GPIO_PCLRR_UART MCF_REG08(0xFC0A4045)
469#define MCF_GPIO_PCLRR_QSPI MCF_REG08(0xFC0A4046)
470#define MCF_GPIO_PCLRR_TIMER MCF_REG08(0xFC0A4047)
471#define MCF_GPIO_PCLRR_LCDDATAH MCF_REG08(0xFC0A4049)
472#define MCF_GPIO_PCLRR_LCDDATAM MCF_REG08(0xFC0A404A)
473#define MCF_GPIO_PCLRR_LCDDATAL MCF_REG08(0xFC0A404B)
474#define MCF_GPIO_PCLRR_LCDCTLH MCF_REG08(0xFC0A404C)
475#define MCF_GPIO_PCLRR_LCDCTLL MCF_REG08(0xFC0A404D)
476#define MCF_GPIO_PAR_FEC MCF_REG08(0xFC0A4050)
477#define MCF_GPIO_PAR_PWM MCF_REG08(0xFC0A4051)
478#define MCF_GPIO_PAR_BUSCTL MCF_REG08(0xFC0A4052)
479#define MCF_GPIO_PAR_FECI2C MCF_REG08(0xFC0A4053)
480#define MCF_GPIO_PAR_BE MCF_REG08(0xFC0A4054)
481#define MCF_GPIO_PAR_CS MCF_REG08(0xFC0A4055)
482#define MCF_GPIO_PAR_SSI MCF_REG16(0xFC0A4056)
483#define MCF_GPIO_PAR_UART MCF_REG16(0xFC0A4058)
484#define MCF_GPIO_PAR_QSPI MCF_REG16(0xFC0A405A)
485#define MCF_GPIO_PAR_TIMER MCF_REG08(0xFC0A405C)
486#define MCF_GPIO_PAR_LCDDATA MCF_REG08(0xFC0A405D)
487#define MCF_GPIO_PAR_LCDCTL MCF_REG16(0xFC0A405E)
488#define MCF_GPIO_PAR_IRQ MCF_REG16(0xFC0A4060)
489#define MCF_GPIO_MSCR_FLEXBUS MCF_REG08(0xFC0A4064)
490#define MCF_GPIO_MSCR_SDRAM MCF_REG08(0xFC0A4065)
491#define MCF_GPIO_DSCR_I2C MCF_REG08(0xFC0A4068)
492#define MCF_GPIO_DSCR_PWM MCF_REG08(0xFC0A4069)
493#define MCF_GPIO_DSCR_FEC MCF_REG08(0xFC0A406A)
494#define MCF_GPIO_DSCR_UART MCF_REG08(0xFC0A406B)
495#define MCF_GPIO_DSCR_QSPI MCF_REG08(0xFC0A406C)
496#define MCF_GPIO_DSCR_TIMER MCF_REG08(0xFC0A406D)
497#define MCF_GPIO_DSCR_SSI MCF_REG08(0xFC0A406E)
498#define MCF_GPIO_DSCR_LCD MCF_REG08(0xFC0A406F)
499#define MCF_GPIO_DSCR_DEBUG MCF_REG08(0xFC0A4070)
500#define MCF_GPIO_DSCR_CLKRST MCF_REG08(0xFC0A4071)
501#define MCF_GPIO_DSCR_IRQ MCF_REG08(0xFC0A4072)
502
503/* Bit definitions and macros for MCF_GPIO_PODR_FECH */
504#define MCF_GPIO_PODR_FECH_PODR_FECH0 (0x01)
505#define MCF_GPIO_PODR_FECH_PODR_FECH1 (0x02)
506#define MCF_GPIO_PODR_FECH_PODR_FECH2 (0x04)
507#define MCF_GPIO_PODR_FECH_PODR_FECH3 (0x08)
508#define MCF_GPIO_PODR_FECH_PODR_FECH4 (0x10)
509#define MCF_GPIO_PODR_FECH_PODR_FECH5 (0x20)
510#define MCF_GPIO_PODR_FECH_PODR_FECH6 (0x40)
511#define MCF_GPIO_PODR_FECH_PODR_FECH7 (0x80)
512
513/* Bit definitions and macros for MCF_GPIO_PODR_FECL */
514#define MCF_GPIO_PODR_FECL_PODR_FECL0 (0x01)
515#define MCF_GPIO_PODR_FECL_PODR_FECL1 (0x02)
516#define MCF_GPIO_PODR_FECL_PODR_FECL2 (0x04)
517#define MCF_GPIO_PODR_FECL_PODR_FECL3 (0x08)
518#define MCF_GPIO_PODR_FECL_PODR_FECL4 (0x10)
519#define MCF_GPIO_PODR_FECL_PODR_FECL5 (0x20)
520#define MCF_GPIO_PODR_FECL_PODR_FECL6 (0x40)
521#define MCF_GPIO_PODR_FECL_PODR_FECL7 (0x80)
522
523/* Bit definitions and macros for MCF_GPIO_PODR_SSI */
524#define MCF_GPIO_PODR_SSI_PODR_SSI0 (0x01)
525#define MCF_GPIO_PODR_SSI_PODR_SSI1 (0x02)
526#define MCF_GPIO_PODR_SSI_PODR_SSI2 (0x04)
527#define MCF_GPIO_PODR_SSI_PODR_SSI3 (0x08)
528#define MCF_GPIO_PODR_SSI_PODR_SSI4 (0x10)
529
530/* Bit definitions and macros for MCF_GPIO_PODR_BUSCTL */
531#define MCF_GPIO_PODR_BUSCTL_POSDR_BUSCTL0 (0x01)
532#define MCF_GPIO_PODR_BUSCTL_PODR_BUSCTL1 (0x02)
533#define MCF_GPIO_PODR_BUSCTL_PODR_BUSCTL2 (0x04)
534#define MCF_GPIO_PODR_BUSCTL_PODR_BUSCTL3 (0x08)
535
536/* Bit definitions and macros for MCF_GPIO_PODR_BE */
537#define MCF_GPIO_PODR_BE_PODR_BE0 (0x01)
538#define MCF_GPIO_PODR_BE_PODR_BE1 (0x02)
539#define MCF_GPIO_PODR_BE_PODR_BE2 (0x04)
540#define MCF_GPIO_PODR_BE_PODR_BE3 (0x08)
541
542/* Bit definitions and macros for MCF_GPIO_PODR_CS */
543#define MCF_GPIO_PODR_CS_PODR_CS1 (0x02)
544#define MCF_GPIO_PODR_CS_PODR_CS2 (0x04)
545#define MCF_GPIO_PODR_CS_PODR_CS3 (0x08)
546#define MCF_GPIO_PODR_CS_PODR_CS4 (0x10)
547#define MCF_GPIO_PODR_CS_PODR_CS5 (0x20)
548
549/* Bit definitions and macros for MCF_GPIO_PODR_PWM */
550#define MCF_GPIO_PODR_PWM_PODR_PWM2 (0x04)
551#define MCF_GPIO_PODR_PWM_PODR_PWM3 (0x08)
552#define MCF_GPIO_PODR_PWM_PODR_PWM4 (0x10)
553#define MCF_GPIO_PODR_PWM_PODR_PWM5 (0x20)
554
555/* Bit definitions and macros for MCF_GPIO_PODR_FECI2C */
556#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C0 (0x01)
557#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C1 (0x02)
558#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C2 (0x04)
559#define MCF_GPIO_PODR_FECI2C_PODR_FECI2C3 (0x08)
560
561/* Bit definitions and macros for MCF_GPIO_PODR_UART */
562#define MCF_GPIO_PODR_UART_PODR_UART0 (0x01)
563#define MCF_GPIO_PODR_UART_PODR_UART1 (0x02)
564#define MCF_GPIO_PODR_UART_PODR_UART2 (0x04)
565#define MCF_GPIO_PODR_UART_PODR_UART3 (0x08)
566#define MCF_GPIO_PODR_UART_PODR_UART4 (0x10)
567#define MCF_GPIO_PODR_UART_PODR_UART5 (0x20)
568#define MCF_GPIO_PODR_UART_PODR_UART6 (0x40)
569#define MCF_GPIO_PODR_UART_PODR_UART7 (0x80)
570
571/* Bit definitions and macros for MCF_GPIO_PODR_QSPI */
572#define MCF_GPIO_PODR_QSPI_PODR_QSPI0 (0x01)
573#define MCF_GPIO_PODR_QSPI_PODR_QSPI1 (0x02)
574#define MCF_GPIO_PODR_QSPI_PODR_QSPI2 (0x04)
575#define MCF_GPIO_PODR_QSPI_PODR_QSPI3 (0x08)
576#define MCF_GPIO_PODR_QSPI_PODR_QSPI4 (0x10)
577#define MCF_GPIO_PODR_QSPI_PODR_QSPI5 (0x20)
578
579/* Bit definitions and macros for MCF_GPIO_PODR_TIMER */
580#define MCF_GPIO_PODR_TIMER_PODR_TIMER0 (0x01)
581#define MCF_GPIO_PODR_TIMER_PODR_TIMER1 (0x02)
582#define MCF_GPIO_PODR_TIMER_PODR_TIMER2 (0x04)
583#define MCF_GPIO_PODR_TIMER_PODR_TIMER3 (0x08)
584
585/* Bit definitions and macros for MCF_GPIO_PODR_LCDDATAH */
586#define MCF_GPIO_PODR_LCDDATAH_PODR_LCDDATAH0 (0x01)
587#define MCF_GPIO_PODR_LCDDATAH_PODR_LCDDATAH1 (0x02)
588
589/* Bit definitions and macros for MCF_GPIO_PODR_LCDDATAM */
590#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM0 (0x01)
591#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM1 (0x02)
592#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM2 (0x04)
593#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM3 (0x08)
594#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM4 (0x10)
595#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM5 (0x20)
596#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM6 (0x40)
597#define MCF_GPIO_PODR_LCDDATAM_PODR_LCDDATAM7 (0x80)
598
599/* Bit definitions and macros for MCF_GPIO_PODR_LCDDATAL */
600#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL0 (0x01)
601#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL1 (0x02)
602#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL2 (0x04)
603#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL3 (0x08)
604#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL4 (0x10)
605#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL5 (0x20)
606#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL6 (0x40)
607#define MCF_GPIO_PODR_LCDDATAL_PODR_LCDDATAL7 (0x80)
608
609/* Bit definitions and macros for MCF_GPIO_PODR_LCDCTLH */
610#define MCF_GPIO_PODR_LCDCTLH_PODR_LCDCTLH0 (0x01)
611
612/* Bit definitions and macros for MCF_GPIO_PODR_LCDCTLL */
613#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL0 (0x01)
614#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL1 (0x02)
615#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL2 (0x04)
616#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL3 (0x08)
617#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL4 (0x10)
618#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL5 (0x20)
619#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL6 (0x40)
620#define MCF_GPIO_PODR_LCDCTLL_PODR_LCDCTLL7 (0x80)
621
622/* Bit definitions and macros for MCF_GPIO_PDDR_FECH */
623#define MCF_GPIO_PDDR_FECH_PDDR_FECH0 (0x01)
624#define MCF_GPIO_PDDR_FECH_PDDR_FECH1 (0x02)
625#define MCF_GPIO_PDDR_FECH_PDDR_FECH2 (0x04)
626#define MCF_GPIO_PDDR_FECH_PDDR_FECH3 (0x08)
627#define MCF_GPIO_PDDR_FECH_PDDR_FECH4 (0x10)
628#define MCF_GPIO_PDDR_FECH_PDDR_FECH5 (0x20)
629#define MCF_GPIO_PDDR_FECH_PDDR_FECH6 (0x40)
630#define MCF_GPIO_PDDR_FECH_PDDR_FECH7 (0x80)
631
632/* Bit definitions and macros for MCF_GPIO_PDDR_FECL */
633#define MCF_GPIO_PDDR_FECL_PDDR_FECL0 (0x01)
634#define MCF_GPIO_PDDR_FECL_PDDR_FECL1 (0x02)
635#define MCF_GPIO_PDDR_FECL_PDDR_FECL2 (0x04)
636#define MCF_GPIO_PDDR_FECL_PDDR_FECL3 (0x08)
637#define MCF_GPIO_PDDR_FECL_PDDR_FECL4 (0x10)
638#define MCF_GPIO_PDDR_FECL_PDDR_FECL5 (0x20)
639#define MCF_GPIO_PDDR_FECL_PDDR_FECL6 (0x40)
640#define MCF_GPIO_PDDR_FECL_PDDR_FECL7 (0x80)
641
642/* Bit definitions and macros for MCF_GPIO_PDDR_SSI */
643#define MCF_GPIO_PDDR_SSI_PDDR_SSI0 (0x01)
644#define MCF_GPIO_PDDR_SSI_PDDR_SSI1 (0x02)
645#define MCF_GPIO_PDDR_SSI_PDDR_SSI2 (0x04)
646#define MCF_GPIO_PDDR_SSI_PDDR_SSI3 (0x08)
647#define MCF_GPIO_PDDR_SSI_PDDR_SSI4 (0x10)
648
649/* Bit definitions and macros for MCF_GPIO_PDDR_BUSCTL */
650#define MCF_GPIO_PDDR_BUSCTL_POSDR_BUSCTL0 (0x01)
651#define MCF_GPIO_PDDR_BUSCTL_PDDR_BUSCTL1 (0x02)
652#define MCF_GPIO_PDDR_BUSCTL_PDDR_BUSCTL2 (0x04)
653#define MCF_GPIO_PDDR_BUSCTL_PDDR_BUSCTL3 (0x08)
654
655/* Bit definitions and macros for MCF_GPIO_PDDR_BE */
656#define MCF_GPIO_PDDR_BE_PDDR_BE0 (0x01)
657#define MCF_GPIO_PDDR_BE_PDDR_BE1 (0x02)
658#define MCF_GPIO_PDDR_BE_PDDR_BE2 (0x04)
659#define MCF_GPIO_PDDR_BE_PDDR_BE3 (0x08)
660
661/* Bit definitions and macros for MCF_GPIO_PDDR_CS */
662#define MCF_GPIO_PDDR_CS_PDDR_CS1 (0x02)
663#define MCF_GPIO_PDDR_CS_PDDR_CS2 (0x04)
664#define MCF_GPIO_PDDR_CS_PDDR_CS3 (0x08)
665#define MCF_GPIO_PDDR_CS_PDDR_CS4 (0x10)
666#define MCF_GPIO_PDDR_CS_PDDR_CS5 (0x20)
667
668/* Bit definitions and macros for MCF_GPIO_PDDR_PWM */
669#define MCF_GPIO_PDDR_PWM_PDDR_PWM2 (0x04)
670#define MCF_GPIO_PDDR_PWM_PDDR_PWM3 (0x08)
671#define MCF_GPIO_PDDR_PWM_PDDR_PWM4 (0x10)
672#define MCF_GPIO_PDDR_PWM_PDDR_PWM5 (0x20)
673
674/* Bit definitions and macros for MCF_GPIO_PDDR_FECI2C */
675#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C0 (0x01)
676#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C1 (0x02)
677#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C2 (0x04)
678#define MCF_GPIO_PDDR_FECI2C_PDDR_FECI2C3 (0x08)
679
680/* Bit definitions and macros for MCF_GPIO_PDDR_UART */
681#define MCF_GPIO_PDDR_UART_PDDR_UART0 (0x01)
682#define MCF_GPIO_PDDR_UART_PDDR_UART1 (0x02)
683#define MCF_GPIO_PDDR_UART_PDDR_UART2 (0x04)
684#define MCF_GPIO_PDDR_UART_PDDR_UART3 (0x08)
685#define MCF_GPIO_PDDR_UART_PDDR_UART4 (0x10)
686#define MCF_GPIO_PDDR_UART_PDDR_UART5 (0x20)
687#define MCF_GPIO_PDDR_UART_PDDR_UART6 (0x40)
688#define MCF_GPIO_PDDR_UART_PDDR_UART7 (0x80)
689
690/* Bit definitions and macros for MCF_GPIO_PDDR_QSPI */
691#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI0 (0x01)
692#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI1 (0x02)
693#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI2 (0x04)
694#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI3 (0x08)
695#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI4 (0x10)
696#define MCF_GPIO_PDDR_QSPI_PDDR_QSPI5 (0x20)
697
698/* Bit definitions and macros for MCF_GPIO_PDDR_TIMER */
699#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER0 (0x01)
700#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER1 (0x02)
701#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER2 (0x04)
702#define MCF_GPIO_PDDR_TIMER_PDDR_TIMER3 (0x08)
703
704/* Bit definitions and macros for MCF_GPIO_PDDR_LCDDATAH */
705#define MCF_GPIO_PDDR_LCDDATAH_PDDR_LCDDATAH0 (0x01)
706#define MCF_GPIO_PDDR_LCDDATAH_PDDR_LCDDATAH1 (0x02)
707
708/* Bit definitions and macros for MCF_GPIO_PDDR_LCDDATAM */
709#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM0 (0x01)
710#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM1 (0x02)
711#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM2 (0x04)
712#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM3 (0x08)
713#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM4 (0x10)
714#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM5 (0x20)
715#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM6 (0x40)
716#define MCF_GPIO_PDDR_LCDDATAM_PDDR_LCDDATAM7 (0x80)
717
718/* Bit definitions and macros for MCF_GPIO_PDDR_LCDDATAL */
719#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL0 (0x01)
720#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL1 (0x02)
721#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL2 (0x04)
722#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL3 (0x08)
723#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL4 (0x10)
724#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL5 (0x20)
725#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL6 (0x40)
726#define MCF_GPIO_PDDR_LCDDATAL_PDDR_LCDDATAL7 (0x80)
727
728/* Bit definitions and macros for MCF_GPIO_PDDR_LCDCTLH */
729#define MCF_GPIO_PDDR_LCDCTLH_PDDR_LCDCTLH0 (0x01)
730
731/* Bit definitions and macros for MCF_GPIO_PDDR_LCDCTLL */
732#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL0 (0x01)
733#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL1 (0x02)
734#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL2 (0x04)
735#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL3 (0x08)
736#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL4 (0x10)
737#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL5 (0x20)
738#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL6 (0x40)
739#define MCF_GPIO_PDDR_LCDCTLL_PDDR_LCDCTLL7 (0x80)
740
741/* Bit definitions and macros for MCF_GPIO_PPDSDR_FECH */
742#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH0 (0x01)
743#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH1 (0x02)
744#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH2 (0x04)
745#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH3 (0x08)
746#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH4 (0x10)
747#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH5 (0x20)
748#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH6 (0x40)
749#define MCF_GPIO_PPDSDR_FECH_PPDSDR_FECH7 (0x80)
750
751/* Bit definitions and macros for MCF_GPIO_PPDSDR_FECL */
752#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL0 (0x01)
753#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL1 (0x02)
754#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL2 (0x04)
755#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL3 (0x08)
756#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL4 (0x10)
757#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL5 (0x20)
758#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL6 (0x40)
759#define MCF_GPIO_PPDSDR_FECL_PPDSDR_FECL7 (0x80)
760
761/* Bit definitions and macros for MCF_GPIO_PPDSDR_SSI */
762#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI0 (0x01)
763#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI1 (0x02)
764#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI2 (0x04)
765#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI3 (0x08)
766#define MCF_GPIO_PPDSDR_SSI_PPDSDR_SSI4 (0x10)
767
768/* Bit definitions and macros for MCF_GPIO_PPDSDR_BUSCTL */
769#define MCF_GPIO_PPDSDR_BUSCTL_POSDR_BUSCTL0 (0x01)
770#define MCF_GPIO_PPDSDR_BUSCTL_PPDSDR_BUSCTL1 (0x02)
771#define MCF_GPIO_PPDSDR_BUSCTL_PPDSDR_BUSCTL2 (0x04)
772#define MCF_GPIO_PPDSDR_BUSCTL_PPDSDR_BUSCTL3 (0x08)
773
774/* Bit definitions and macros for MCF_GPIO_PPDSDR_BE */
775#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE0 (0x01)
776#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE1 (0x02)
777#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE2 (0x04)
778#define MCF_GPIO_PPDSDR_BE_PPDSDR_BE3 (0x08)
779
780/* Bit definitions and macros for MCF_GPIO_PPDSDR_CS */
781#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS1 (0x02)
782#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS2 (0x04)
783#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS3 (0x08)
784#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS4 (0x10)
785#define MCF_GPIO_PPDSDR_CS_PPDSDR_CS5 (0x20)
786
787/* Bit definitions and macros for MCF_GPIO_PPDSDR_PWM */
788#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM2 (0x04)
789#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM3 (0x08)
790#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM4 (0x10)
791#define MCF_GPIO_PPDSDR_PWM_PPDSDR_PWM5 (0x20)
792
793/* Bit definitions and macros for MCF_GPIO_PPDSDR_FECI2C */
794#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C0 (0x01)
795#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C1 (0x02)
796#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C2 (0x04)
797#define MCF_GPIO_PPDSDR_FECI2C_PPDSDR_FECI2C3 (0x08)
798
799/* Bit definitions and macros for MCF_GPIO_PPDSDR_UART */
800#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART0 (0x01)
801#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART1 (0x02)
802#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART2 (0x04)
803#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART3 (0x08)
804#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART4 (0x10)
805#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART5 (0x20)
806#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART6 (0x40)
807#define MCF_GPIO_PPDSDR_UART_PPDSDR_UART7 (0x80)
808
809/* Bit definitions and macros for MCF_GPIO_PPDSDR_QSPI */
810#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI0 (0x01)
811#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI1 (0x02)
812#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI2 (0x04)
813#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI3 (0x08)
814#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI4 (0x10)
815#define MCF_GPIO_PPDSDR_QSPI_PPDSDR_QSPI5 (0x20)
816
817/* Bit definitions and macros for MCF_GPIO_PPDSDR_TIMER */
818#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER0 (0x01)
819#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER1 (0x02)
820#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER2 (0x04)
821#define MCF_GPIO_PPDSDR_TIMER_PPDSDR_TIMER3 (0x08)
822
823/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDDATAH */
824#define MCF_GPIO_PPDSDR_LCDDATAH_PPDSDR_LCDDATAH0 (0x01)
825#define MCF_GPIO_PPDSDR_LCDDATAH_PPDSDR_LCDDATAH1 (0x02)
826
827/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDDATAM */
828#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM0 (0x01)
829#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM1 (0x02)
830#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM2 (0x04)
831#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM3 (0x08)
832#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM4 (0x10)
833#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM5 (0x20)
834#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM6 (0x40)
835#define MCF_GPIO_PPDSDR_LCDDATAM_PPDSDR_LCDDATAM7 (0x80)
836
837/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDDATAL */
838#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL0 (0x01)
839#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL1 (0x02)
840#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL2 (0x04)
841#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL3 (0x08)
842#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL4 (0x10)
843#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL5 (0x20)
844#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL6 (0x40)
845#define MCF_GPIO_PPDSDR_LCDDATAL_PPDSDR_LCDDATAL7 (0x80)
846
847/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDCTLH */
848#define MCF_GPIO_PPDSDR_LCDCTLH_PPDSDR_LCDCTLH0 (0x01)
849
850/* Bit definitions and macros for MCF_GPIO_PPDSDR_LCDCTLL */
851#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL0 (0x01)
852#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL1 (0x02)
853#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL2 (0x04)
854#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL3 (0x08)
855#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL4 (0x10)
856#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL5 (0x20)
857#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL6 (0x40)
858#define MCF_GPIO_PPDSDR_LCDCTLL_PPDSDR_LCDCTLL7 (0x80)
859
860/* Bit definitions and macros for MCF_GPIO_PCLRR_FECH */
861#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH0 (0x01)
862#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH1 (0x02)
863#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH2 (0x04)
864#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH3 (0x08)
865#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH4 (0x10)
866#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH5 (0x20)
867#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH6 (0x40)
868#define MCF_GPIO_PCLRR_FECH_PCLRR_FECH7 (0x80)
869
870/* Bit definitions and macros for MCF_GPIO_PCLRR_FECL */
871#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL0 (0x01)
872#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL1 (0x02)
873#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL2 (0x04)
874#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL3 (0x08)
875#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL4 (0x10)
876#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL5 (0x20)
877#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL6 (0x40)
878#define MCF_GPIO_PCLRR_FECL_PCLRR_FECL7 (0x80)
879
880/* Bit definitions and macros for MCF_GPIO_PCLRR_SSI */
881#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI0 (0x01)
882#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI1 (0x02)
883#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI2 (0x04)
884#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI3 (0x08)
885#define MCF_GPIO_PCLRR_SSI_PCLRR_SSI4 (0x10)
886
887/* Bit definitions and macros for MCF_GPIO_PCLRR_BUSCTL */
888#define MCF_GPIO_PCLRR_BUSCTL_POSDR_BUSCTL0 (0x01)
889#define MCF_GPIO_PCLRR_BUSCTL_PCLRR_BUSCTL1 (0x02)
890#define MCF_GPIO_PCLRR_BUSCTL_PCLRR_BUSCTL2 (0x04)
891#define MCF_GPIO_PCLRR_BUSCTL_PCLRR_BUSCTL3 (0x08)
892
893/* Bit definitions and macros for MCF_GPIO_PCLRR_BE */
894#define MCF_GPIO_PCLRR_BE_PCLRR_BE0 (0x01)
895#define MCF_GPIO_PCLRR_BE_PCLRR_BE1 (0x02)
896#define MCF_GPIO_PCLRR_BE_PCLRR_BE2 (0x04)
897#define MCF_GPIO_PCLRR_BE_PCLRR_BE3 (0x08)
898
899/* Bit definitions and macros for MCF_GPIO_PCLRR_CS */
900#define MCF_GPIO_PCLRR_CS_PCLRR_CS1 (0x02)
901#define MCF_GPIO_PCLRR_CS_PCLRR_CS2 (0x04)
902#define MCF_GPIO_PCLRR_CS_PCLRR_CS3 (0x08)
903#define MCF_GPIO_PCLRR_CS_PCLRR_CS4 (0x10)
904#define MCF_GPIO_PCLRR_CS_PCLRR_CS5 (0x20)
905
906/* Bit definitions and macros for MCF_GPIO_PCLRR_PWM */
907#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM2 (0x04)
908#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM3 (0x08)
909#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM4 (0x10)
910#define MCF_GPIO_PCLRR_PWM_PCLRR_PWM5 (0x20)
911
912/* Bit definitions and macros for MCF_GPIO_PCLRR_FECI2C */
913#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C0 (0x01)
914#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C1 (0x02)
915#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C2 (0x04)
916#define MCF_GPIO_PCLRR_FECI2C_PCLRR_FECI2C3 (0x08)
917
918/* Bit definitions and macros for MCF_GPIO_PCLRR_UART */
919#define MCF_GPIO_PCLRR_UART_PCLRR_UART0 (0x01)
920#define MCF_GPIO_PCLRR_UART_PCLRR_UART1 (0x02)
921#define MCF_GPIO_PCLRR_UART_PCLRR_UART2 (0x04)
922#define MCF_GPIO_PCLRR_UART_PCLRR_UART3 (0x08)
923#define MCF_GPIO_PCLRR_UART_PCLRR_UART4 (0x10)
924#define MCF_GPIO_PCLRR_UART_PCLRR_UART5 (0x20)
925#define MCF_GPIO_PCLRR_UART_PCLRR_UART6 (0x40)
926#define MCF_GPIO_PCLRR_UART_PCLRR_UART7 (0x80)
927
928/* Bit definitions and macros for MCF_GPIO_PCLRR_QSPI */
929#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI0 (0x01)
930#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI1 (0x02)
931#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI2 (0x04)
932#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI3 (0x08)
933#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI4 (0x10)
934#define MCF_GPIO_PCLRR_QSPI_PCLRR_QSPI5 (0x20)
935
936/* Bit definitions and macros for MCF_GPIO_PCLRR_TIMER */
937#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER0 (0x01)
938#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER1 (0x02)
939#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER2 (0x04)
940#define MCF_GPIO_PCLRR_TIMER_PCLRR_TIMER3 (0x08)
941
942/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDDATAH */
943#define MCF_GPIO_PCLRR_LCDDATAH_PCLRR_LCDDATAH0 (0x01)
944#define MCF_GPIO_PCLRR_LCDDATAH_PCLRR_LCDDATAH1 (0x02)
945
946/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDDATAM */
947#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM0 (0x01)
948#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM1 (0x02)
949#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM2 (0x04)
950#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM3 (0x08)
951#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM4 (0x10)
952#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM5 (0x20)
953#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM6 (0x40)
954#define MCF_GPIO_PCLRR_LCDDATAM_PCLRR_LCDDATAM7 (0x80)
955
956/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDDATAL */
957#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL0 (0x01)
958#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL1 (0x02)
959#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL2 (0x04)
960#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL3 (0x08)
961#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL4 (0x10)
962#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL5 (0x20)
963#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL6 (0x40)
964#define MCF_GPIO_PCLRR_LCDDATAL_PCLRR_LCDDATAL7 (0x80)
965
966/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDCTLH */
967#define MCF_GPIO_PCLRR_LCDCTLH_PCLRR_LCDCTLH0 (0x01)
968
969/* Bit definitions and macros for MCF_GPIO_PCLRR_LCDCTLL */
970#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL0 (0x01)
971#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL1 (0x02)
972#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL2 (0x04)
973#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL3 (0x08)
974#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL4 (0x10)
975#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL5 (0x20)
976#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL6 (0x40)
977#define MCF_GPIO_PCLRR_LCDCTLL_PCLRR_LCDCTLL7 (0x80)
978
979/* Bit definitions and macros for MCF_GPIO_PAR_FEC */
980#define MCF_GPIO_PAR_FEC_PAR_FEC_MII(x) (((x)&0x03)<<0)
981#define MCF_GPIO_PAR_FEC_PAR_FEC_7W(x) (((x)&0x03)<<2)
982#define MCF_GPIO_PAR_FEC_PAR_FEC_7W_GPIO (0x00)
983#define MCF_GPIO_PAR_FEC_PAR_FEC_7W_URTS1 (0x04)
984#define MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC (0x0C)
985#define MCF_GPIO_PAR_FEC_PAR_FEC_MII_GPIO (0x00)
986#define MCF_GPIO_PAR_FEC_PAR_FEC_MII_UART (0x01)
987#define MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC (0x03)
988
989/* Bit definitions and macros for MCF_GPIO_PAR_PWM */
990#define MCF_GPIO_PAR_PWM_PAR_PWM1(x) (((x)&0x03)<<0)
991#define MCF_GPIO_PAR_PWM_PAR_PWM3(x) (((x)&0x03)<<2)
992#define MCF_GPIO_PAR_PWM_PAR_PWM5 (0x10)
993#define MCF_GPIO_PAR_PWM_PAR_PWM7 (0x20)
994
995/* Bit definitions and macros for MCF_GPIO_PAR_BUSCTL */
996#define MCF_GPIO_PAR_BUSCTL_PAR_TS(x) (((x)&0x03)<<3)
997#define MCF_GPIO_PAR_BUSCTL_PAR_RWB (0x20)
998#define MCF_GPIO_PAR_BUSCTL_PAR_TA (0x40)
999#define MCF_GPIO_PAR_BUSCTL_PAR_OE (0x80)
1000#define MCF_GPIO_PAR_BUSCTL_PAR_OE_GPIO (0x00)
1001#define MCF_GPIO_PAR_BUSCTL_PAR_OE_OE (0x80)
1002#define MCF_GPIO_PAR_BUSCTL_PAR_TA_GPIO (0x00)
1003#define MCF_GPIO_PAR_BUSCTL_PAR_TA_TA (0x40)
1004#define MCF_GPIO_PAR_BUSCTL_PAR_RWB_GPIO (0x00)
1005#define MCF_GPIO_PAR_BUSCTL_PAR_RWB_RWB (0x20)
1006#define MCF_GPIO_PAR_BUSCTL_PAR_TS_GPIO (0x00)
1007#define MCF_GPIO_PAR_BUSCTL_PAR_TS_DACK0 (0x10)
1008#define MCF_GPIO_PAR_BUSCTL_PAR_TS_TS (0x18)
1009
1010/* Bit definitions and macros for MCF_GPIO_PAR_FECI2C */
1011#define MCF_GPIO_PAR_FECI2C_PAR_SDA(x) (((x)&0x03)<<0)
1012#define MCF_GPIO_PAR_FECI2C_PAR_SCL(x) (((x)&0x03)<<2)
1013#define MCF_GPIO_PAR_FECI2C_PAR_MDIO(x) (((x)&0x03)<<4)
1014#define MCF_GPIO_PAR_FECI2C_PAR_MDC(x) (((x)&0x03)<<6)
1015#define MCF_GPIO_PAR_FECI2C_PAR_MDC_GPIO (0x00)
1016#define MCF_GPIO_PAR_FECI2C_PAR_MDC_UTXD2 (0x40)
1017#define MCF_GPIO_PAR_FECI2C_PAR_MDC_SCL (0x80)
1018#define MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC (0xC0)
1019#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_GPIO (0x00)
1020#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_URXD2 (0x10)
1021#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_SDA (0x20)
1022#define MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO (0x30)
1023#define MCF_GPIO_PAR_FECI2C_PAR_SCL_GPIO (0x00)
1024#define MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 (0x04)
1025#define MCF_GPIO_PAR_FECI2C_PAR_SCL_SCL (0x0C)
1026#define MCF_GPIO_PAR_FECI2C_PAR_SDA_GPIO (0x00)
1027#define MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2 (0x02)
1028#define MCF_GPIO_PAR_FECI2C_PAR_SDA_SDA (0x03)
1029
1030/* Bit definitions and macros for MCF_GPIO_PAR_BE */
1031#define MCF_GPIO_PAR_BE_PAR_BE0 (0x01)
1032#define MCF_GPIO_PAR_BE_PAR_BE1 (0x02)
1033#define MCF_GPIO_PAR_BE_PAR_BE2 (0x04)
1034#define MCF_GPIO_PAR_BE_PAR_BE3 (0x08)
1035
1036/* Bit definitions and macros for MCF_GPIO_PAR_CS */
1037#define MCF_GPIO_PAR_CS_PAR_CS1 (0x02)
1038#define MCF_GPIO_PAR_CS_PAR_CS2 (0x04)
1039#define MCF_GPIO_PAR_CS_PAR_CS3 (0x08)
1040#define MCF_GPIO_PAR_CS_PAR_CS4 (0x10)
1041#define MCF_GPIO_PAR_CS_PAR_CS5 (0x20)
1042#define MCF_GPIO_PAR_CS_PAR_CS_CS1_GPIO (0x00)
1043#define MCF_GPIO_PAR_CS_PAR_CS_CS1_SDCS1 (0x01)
1044#define MCF_GPIO_PAR_CS_PAR_CS_CS1_CS1 (0x03)
1045
1046/* Bit definitions and macros for MCF_GPIO_PAR_SSI */
1047#define MCF_GPIO_PAR_SSI_PAR_MCLK (0x0080)
1048#define MCF_GPIO_PAR_SSI_PAR_TXD(x) (((x)&0x0003)<<8)
1049#define MCF_GPIO_PAR_SSI_PAR_RXD(x) (((x)&0x0003)<<10)
1050#define MCF_GPIO_PAR_SSI_PAR_FS(x) (((x)&0x0003)<<12)
1051#define MCF_GPIO_PAR_SSI_PAR_BCLK(x) (((x)&0x0003)<<14)
1052
1053/* Bit definitions and macros for MCF_GPIO_PAR_UART */
1054#define MCF_GPIO_PAR_UART_PAR_UTXD0 (0x0001)
1055#define MCF_GPIO_PAR_UART_PAR_URXD0 (0x0002)
1056#define MCF_GPIO_PAR_UART_PAR_URTS0 (0x0004)
1057#define MCF_GPIO_PAR_UART_PAR_UCTS0 (0x0008)
1058#define MCF_GPIO_PAR_UART_PAR_UTXD1(x) (((x)&0x0003)<<4)
1059#define MCF_GPIO_PAR_UART_PAR_URXD1(x) (((x)&0x0003)<<6)
1060#define MCF_GPIO_PAR_UART_PAR_URTS1(x) (((x)&0x0003)<<8)
1061#define MCF_GPIO_PAR_UART_PAR_UCTS1(x) (((x)&0x0003)<<10)
1062#define MCF_GPIO_PAR_UART_PAR_UCTS1_GPIO (0x0000)
1063#define MCF_GPIO_PAR_UART_PAR_UCTS1_SSI_BCLK (0x0800)
1064#define MCF_GPIO_PAR_UART_PAR_UCTS1_ULPI_D7 (0x0400)
1065#define MCF_GPIO_PAR_UART_PAR_UCTS1_UCTS1 (0x0C00)
1066#define MCF_GPIO_PAR_UART_PAR_URTS1_GPIO (0x0000)
1067#define MCF_GPIO_PAR_UART_PAR_URTS1_SSI_FS (0x0200)
1068#define MCF_GPIO_PAR_UART_PAR_URTS1_ULPI_D6 (0x0100)
1069#define MCF_GPIO_PAR_UART_PAR_URTS1_URTS1 (0x0300)
1070#define MCF_GPIO_PAR_UART_PAR_URXD1_GPIO (0x0000)
1071#define MCF_GPIO_PAR_UART_PAR_URXD1_SSI_RXD (0x0080)
1072#define MCF_GPIO_PAR_UART_PAR_URXD1_ULPI_D5 (0x0040)
1073#define MCF_GPIO_PAR_UART_PAR_URXD1_URXD1 (0x00C0)
1074#define MCF_GPIO_PAR_UART_PAR_UTXD1_GPIO (0x0000)
1075#define MCF_GPIO_PAR_UART_PAR_UTXD1_SSI_TXD (0x0020)
1076#define MCF_GPIO_PAR_UART_PAR_UTXD1_ULPI_D4 (0x0010)
1077#define MCF_GPIO_PAR_UART_PAR_UTXD1_UTXD1 (0x0030)
1078
1079/* Bit definitions and macros for MCF_GPIO_PAR_QSPI */
1080#define MCF_GPIO_PAR_QSPI_PAR_SCK(x) (((x)&0x0003)<<4)
1081#define MCF_GPIO_PAR_QSPI_PAR_DOUT(x) (((x)&0x0003)<<6)
1082#define MCF_GPIO_PAR_QSPI_PAR_DIN(x) (((x)&0x0003)<<8)
1083#define MCF_GPIO_PAR_QSPI_PAR_PCS0(x) (((x)&0x0003)<<10)
1084#define MCF_GPIO_PAR_QSPI_PAR_PCS1(x) (((x)&0x0003)<<12)
1085#define MCF_GPIO_PAR_QSPI_PAR_PCS2(x) (((x)&0x0003)<<14)
1086
1087/* Bit definitions and macros for MCF_GPIO_PAR_TIMER */
1088#define MCF_GPIO_PAR_TIMER_PAR_TIN0(x) (((x)&0x03)<<0)
1089#define MCF_GPIO_PAR_TIMER_PAR_TIN1(x) (((x)&0x03)<<2)
1090#define MCF_GPIO_PAR_TIMER_PAR_TIN2(x) (((x)&0x03)<<4)
1091#define MCF_GPIO_PAR_TIMER_PAR_TIN3(x) (((x)&0x03)<<6)
1092#define MCF_GPIO_PAR_TIMER_PAR_TIN3_GPIO (0x00)
1093#define MCF_GPIO_PAR_TIMER_PAR_TIN3_TOUT3 (0x80)
1094#define MCF_GPIO_PAR_TIMER_PAR_TIN3_URXD2 (0x40)
1095#define MCF_GPIO_PAR_TIMER_PAR_TIN3_TIN3 (0xC0)
1096#define MCF_GPIO_PAR_TIMER_PAR_TIN2_GPIO (0x00)
1097#define MCF_GPIO_PAR_TIMER_PAR_TIN2_TOUT2 (0x20)
1098#define MCF_GPIO_PAR_TIMER_PAR_TIN2_UTXD2 (0x10)
1099#define MCF_GPIO_PAR_TIMER_PAR_TIN2_TIN2 (0x30)
1100#define MCF_GPIO_PAR_TIMER_PAR_TIN1_GPIO (0x00)
1101#define MCF_GPIO_PAR_TIMER_PAR_TIN1_TOUT1 (0x08)
1102#define MCF_GPIO_PAR_TIMER_PAR_TIN1_DACK1 (0x04)
1103#define MCF_GPIO_PAR_TIMER_PAR_TIN1_TIN1 (0x0C)
1104#define MCF_GPIO_PAR_TIMER_PAR_TIN0_GPIO (0x00)
1105#define MCF_GPIO_PAR_TIMER_PAR_TIN0_TOUT0 (0x02)
1106#define MCF_GPIO_PAR_TIMER_PAR_TIN0_DREQ0 (0x01)
1107#define MCF_GPIO_PAR_TIMER_PAR_TIN0_TIN0 (0x03)
1108
1109/* Bit definitions and macros for MCF_GPIO_PAR_LCDDATA */
1110#define MCF_GPIO_PAR_LCDDATA_PAR_LD7_0(x) (((x)&0x03)<<0)
1111#define MCF_GPIO_PAR_LCDDATA_PAR_LD15_8(x) (((x)&0x03)<<2)
1112#define MCF_GPIO_PAR_LCDDATA_PAR_LD16(x) (((x)&0x03)<<4)
1113#define MCF_GPIO_PAR_LCDDATA_PAR_LD17(x) (((x)&0x03)<<6)
1114
1115/* Bit definitions and macros for MCF_GPIO_PAR_LCDCTL */
1116#define MCF_GPIO_PAR_LCDCTL_PAR_CLS (0x0001)
1117#define MCF_GPIO_PAR_LCDCTL_PAR_PS (0x0002)
1118#define MCF_GPIO_PAR_LCDCTL_PAR_REV (0x0004)
1119#define MCF_GPIO_PAR_LCDCTL_PAR_SPL_SPR (0x0008)
1120#define MCF_GPIO_PAR_LCDCTL_PAR_CONTRAST (0x0010)
1121#define MCF_GPIO_PAR_LCDCTL_PAR_LSCLK (0x0020)
1122#define MCF_GPIO_PAR_LCDCTL_PAR_LP_HSYNC (0x0040)
1123#define MCF_GPIO_PAR_LCDCTL_PAR_FLM_VSYNC (0x0080)
1124#define MCF_GPIO_PAR_LCDCTL_PAR_ACD_OE (0x0100)
1125
1126/* Bit definitions and macros for MCF_GPIO_PAR_IRQ */
1127#define MCF_GPIO_PAR_IRQ_PAR_IRQ1(x) (((x)&0x0003)<<4)
1128#define MCF_GPIO_PAR_IRQ_PAR_IRQ2(x) (((x)&0x0003)<<6)
1129#define MCF_GPIO_PAR_IRQ_PAR_IRQ4(x) (((x)&0x0003)<<8)
1130#define MCF_GPIO_PAR_IRQ_PAR_IRQ5(x) (((x)&0x0003)<<10)
1131#define MCF_GPIO_PAR_IRQ_PAR_IRQ6(x) (((x)&0x0003)<<12)
1132
1133/* Bit definitions and macros for MCF_GPIO_MSCR_FLEXBUS */
1134#define MCF_GPIO_MSCR_FLEXBUS_MSCR_ADDRCTL(x) (((x)&0x03)<<0)
1135#define MCF_GPIO_MSCR_FLEXBUS_MSCR_DLOWER(x) (((x)&0x03)<<2)
1136#define MCF_GPIO_MSCR_FLEXBUS_MSCR_DUPPER(x) (((x)&0x03)<<4)
1137
1138/* Bit definitions and macros for MCF_GPIO_MSCR_SDRAM */
1139#define MCF_GPIO_MSCR_SDRAM_MSCR_SDRAM(x) (((x)&0x03)<<0)
1140#define MCF_GPIO_MSCR_SDRAM_MSCR_SDCLK(x) (((x)&0x03)<<2)
1141#define MCF_GPIO_MSCR_SDRAM_MSCR_SDCLKB(x) (((x)&0x03)<<4)
1142
1143/* Bit definitions and macros for MCF_GPIO_DSCR_I2C */
1144#define MCF_GPIO_DSCR_I2C_I2C_DSE(x) (((x)&0x03)<<0)
1145
1146/* Bit definitions and macros for MCF_GPIO_DSCR_PWM */
1147#define MCF_GPIO_DSCR_PWM_PWM_DSE(x) (((x)&0x03)<<0)
1148
1149/* Bit definitions and macros for MCF_GPIO_DSCR_FEC */
1150#define MCF_GPIO_DSCR_FEC_FEC_DSE(x) (((x)&0x03)<<0)
1151
1152/* Bit definitions and macros for MCF_GPIO_DSCR_UART */
1153#define MCF_GPIO_DSCR_UART_UART0_DSE(x) (((x)&0x03)<<0)
1154#define MCF_GPIO_DSCR_UART_UART1_DSE(x) (((x)&0x03)<<2)
1155
1156/* Bit definitions and macros for MCF_GPIO_DSCR_QSPI */
1157#define MCF_GPIO_DSCR_QSPI_QSPI_DSE(x) (((x)&0x03)<<0)
1158
1159/* Bit definitions and macros for MCF_GPIO_DSCR_TIMER */
1160#define MCF_GPIO_DSCR_TIMER_TIMER_DSE(x) (((x)&0x03)<<0)
1161
1162/* Bit definitions and macros for MCF_GPIO_DSCR_SSI */
1163#define MCF_GPIO_DSCR_SSI_SSI_DSE(x) (((x)&0x03)<<0)
1164
1165/* Bit definitions and macros for MCF_GPIO_DSCR_LCD */
1166#define MCF_GPIO_DSCR_LCD_LCD_DSE(x) (((x)&0x03)<<0)
1167
1168/* Bit definitions and macros for MCF_GPIO_DSCR_DEBUG */
1169#define MCF_GPIO_DSCR_DEBUG_DEBUG_DSE(x) (((x)&0x03)<<0)
1170
1171/* Bit definitions and macros for MCF_GPIO_DSCR_CLKRST */
1172#define MCF_GPIO_DSCR_CLKRST_CLKRST_DSE(x) (((x)&0x03)<<0)
1173
1174/* Bit definitions and macros for MCF_GPIO_DSCR_IRQ */
1175#define MCF_GPIO_DSCR_IRQ_IRQ_DSE(x) (((x)&0x03)<<0)
1176
1177/*********************************************************************
1178 *
1179 * Interrupt Controller (INTC)
1180 *
1181 *********************************************************************/
1182
1183/* Register read/write macros */
1184#define MCF_INTC0_IPRH MCF_REG32(0xFC048000)
1185#define MCF_INTC0_IPRL MCF_REG32(0xFC048004)
1186#define MCF_INTC0_IMRH MCF_REG32(0xFC048008)
1187#define MCF_INTC0_IMRL MCF_REG32(0xFC04800C)
1188#define MCF_INTC0_INTFRCH MCF_REG32(0xFC048010)
1189#define MCF_INTC0_INTFRCL MCF_REG32(0xFC048014)
1190#define MCF_INTC0_ICONFIG MCF_REG16(0xFC04801A)
1191#define MCF_INTC0_SIMR MCF_REG08(0xFC04801C)
1192#define MCF_INTC0_CIMR MCF_REG08(0xFC04801D)
1193#define MCF_INTC0_CLMASK MCF_REG08(0xFC04801E)
1194#define MCF_INTC0_SLMASK MCF_REG08(0xFC04801F)
1195#define MCF_INTC0_ICR0 MCF_REG08(0xFC048040)
1196#define MCF_INTC0_ICR1 MCF_REG08(0xFC048041)
1197#define MCF_INTC0_ICR2 MCF_REG08(0xFC048042)
1198#define MCF_INTC0_ICR3 MCF_REG08(0xFC048043)
1199#define MCF_INTC0_ICR4 MCF_REG08(0xFC048044)
1200#define MCF_INTC0_ICR5 MCF_REG08(0xFC048045)
1201#define MCF_INTC0_ICR6 MCF_REG08(0xFC048046)
1202#define MCF_INTC0_ICR7 MCF_REG08(0xFC048047)
1203#define MCF_INTC0_ICR8 MCF_REG08(0xFC048048)
1204#define MCF_INTC0_ICR9 MCF_REG08(0xFC048049)
1205#define MCF_INTC0_ICR10 MCF_REG08(0xFC04804A)
1206#define MCF_INTC0_ICR11 MCF_REG08(0xFC04804B)
1207#define MCF_INTC0_ICR12 MCF_REG08(0xFC04804C)
1208#define MCF_INTC0_ICR13 MCF_REG08(0xFC04804D)
1209#define MCF_INTC0_ICR14 MCF_REG08(0xFC04804E)
1210#define MCF_INTC0_ICR15 MCF_REG08(0xFC04804F)
1211#define MCF_INTC0_ICR16 MCF_REG08(0xFC048050)
1212#define MCF_INTC0_ICR17 MCF_REG08(0xFC048051)
1213#define MCF_INTC0_ICR18 MCF_REG08(0xFC048052)
1214#define MCF_INTC0_ICR19 MCF_REG08(0xFC048053)
1215#define MCF_INTC0_ICR20 MCF_REG08(0xFC048054)
1216#define MCF_INTC0_ICR21 MCF_REG08(0xFC048055)
1217#define MCF_INTC0_ICR22 MCF_REG08(0xFC048056)
1218#define MCF_INTC0_ICR23 MCF_REG08(0xFC048057)
1219#define MCF_INTC0_ICR24 MCF_REG08(0xFC048058)
1220#define MCF_INTC0_ICR25 MCF_REG08(0xFC048059)
1221#define MCF_INTC0_ICR26 MCF_REG08(0xFC04805A)
1222#define MCF_INTC0_ICR27 MCF_REG08(0xFC04805B)
1223#define MCF_INTC0_ICR28 MCF_REG08(0xFC04805C)
1224#define MCF_INTC0_ICR29 MCF_REG08(0xFC04805D)
1225#define MCF_INTC0_ICR30 MCF_REG08(0xFC04805E)
1226#define MCF_INTC0_ICR31 MCF_REG08(0xFC04805F)
1227#define MCF_INTC0_ICR32 MCF_REG08(0xFC048060)
1228#define MCF_INTC0_ICR33 MCF_REG08(0xFC048061)
1229#define MCF_INTC0_ICR34 MCF_REG08(0xFC048062)
1230#define MCF_INTC0_ICR35 MCF_REG08(0xFC048063)
1231#define MCF_INTC0_ICR36 MCF_REG08(0xFC048064)
1232#define MCF_INTC0_ICR37 MCF_REG08(0xFC048065)
1233#define MCF_INTC0_ICR38 MCF_REG08(0xFC048066)
1234#define MCF_INTC0_ICR39 MCF_REG08(0xFC048067)
1235#define MCF_INTC0_ICR40 MCF_REG08(0xFC048068)
1236#define MCF_INTC0_ICR41 MCF_REG08(0xFC048069)
1237#define MCF_INTC0_ICR42 MCF_REG08(0xFC04806A)
1238#define MCF_INTC0_ICR43 MCF_REG08(0xFC04806B)
1239#define MCF_INTC0_ICR44 MCF_REG08(0xFC04806C)
1240#define MCF_INTC0_ICR45 MCF_REG08(0xFC04806D)
1241#define MCF_INTC0_ICR46 MCF_REG08(0xFC04806E)
1242#define MCF_INTC0_ICR47 MCF_REG08(0xFC04806F)
1243#define MCF_INTC0_ICR48 MCF_REG08(0xFC048070)
1244#define MCF_INTC0_ICR49 MCF_REG08(0xFC048071)
1245#define MCF_INTC0_ICR50 MCF_REG08(0xFC048072)
1246#define MCF_INTC0_ICR51 MCF_REG08(0xFC048073)
1247#define MCF_INTC0_ICR52 MCF_REG08(0xFC048074)
1248#define MCF_INTC0_ICR53 MCF_REG08(0xFC048075)
1249#define MCF_INTC0_ICR54 MCF_REG08(0xFC048076)
1250#define MCF_INTC0_ICR55 MCF_REG08(0xFC048077)
1251#define MCF_INTC0_ICR56 MCF_REG08(0xFC048078)
1252#define MCF_INTC0_ICR57 MCF_REG08(0xFC048079)
1253#define MCF_INTC0_ICR58 MCF_REG08(0xFC04807A)
1254#define MCF_INTC0_ICR59 MCF_REG08(0xFC04807B)
1255#define MCF_INTC0_ICR60 MCF_REG08(0xFC04807C)
1256#define MCF_INTC0_ICR61 MCF_REG08(0xFC04807D)
1257#define MCF_INTC0_ICR62 MCF_REG08(0xFC04807E)
1258#define MCF_INTC0_ICR63 MCF_REG08(0xFC04807F)
1259#define MCF_INTC0_ICR(x) MCF_REG08(0xFC048040+((x)*0x001))
1260#define MCF_INTC0_SWIACK MCF_REG08(0xFC0480E0)
1261#define MCF_INTC0_L1IACK MCF_REG08(0xFC0480E4)
1262#define MCF_INTC0_L2IACK MCF_REG08(0xFC0480E8)
1263#define MCF_INTC0_L3IACK MCF_REG08(0xFC0480EC)
1264#define MCF_INTC0_L4IACK MCF_REG08(0xFC0480F0)
1265#define MCF_INTC0_L5IACK MCF_REG08(0xFC0480F4)
1266#define MCF_INTC0_L6IACK MCF_REG08(0xFC0480F8)
1267#define MCF_INTC0_L7IACK MCF_REG08(0xFC0480FC)
1268#define MCF_INTC0_LIACK(x) MCF_REG08(0xFC0480E4+((x)*0x004))
1269#define MCF_INTC1_IPRH MCF_REG32(0xFC04C000)
1270#define MCF_INTC1_IPRL MCF_REG32(0xFC04C004)
1271#define MCF_INTC1_IMRH MCF_REG32(0xFC04C008)
1272#define MCF_INTC1_IMRL MCF_REG32(0xFC04C00C)
1273#define MCF_INTC1_INTFRCH MCF_REG32(0xFC04C010)
1274#define MCF_INTC1_INTFRCL MCF_REG32(0xFC04C014)
1275#define MCF_INTC1_ICONFIG MCF_REG16(0xFC04C01A)
1276#define MCF_INTC1_SIMR MCF_REG08(0xFC04C01C)
1277#define MCF_INTC1_CIMR MCF_REG08(0xFC04C01D)
1278#define MCF_INTC1_CLMASK MCF_REG08(0xFC04C01E)
1279#define MCF_INTC1_SLMASK MCF_REG08(0xFC04C01F)
1280#define MCF_INTC1_ICR0 MCF_REG08(0xFC04C040)
1281#define MCF_INTC1_ICR1 MCF_REG08(0xFC04C041)
1282#define MCF_INTC1_ICR2 MCF_REG08(0xFC04C042)
1283#define MCF_INTC1_ICR3 MCF_REG08(0xFC04C043)
1284#define MCF_INTC1_ICR4 MCF_REG08(0xFC04C044)
1285#define MCF_INTC1_ICR5 MCF_REG08(0xFC04C045)
1286#define MCF_INTC1_ICR6 MCF_REG08(0xFC04C046)
1287#define MCF_INTC1_ICR7 MCF_REG08(0xFC04C047)
1288#define MCF_INTC1_ICR8 MCF_REG08(0xFC04C048)
1289#define MCF_INTC1_ICR9 MCF_REG08(0xFC04C049)
1290#define MCF_INTC1_ICR10 MCF_REG08(0xFC04C04A)
1291#define MCF_INTC1_ICR11 MCF_REG08(0xFC04C04B)
1292#define MCF_INTC1_ICR12 MCF_REG08(0xFC04C04C)
1293#define MCF_INTC1_ICR13 MCF_REG08(0xFC04C04D)
1294#define MCF_INTC1_ICR14 MCF_REG08(0xFC04C04E)
1295#define MCF_INTC1_ICR15 MCF_REG08(0xFC04C04F)
1296#define MCF_INTC1_ICR16 MCF_REG08(0xFC04C050)
1297#define MCF_INTC1_ICR17 MCF_REG08(0xFC04C051)
1298#define MCF_INTC1_ICR18 MCF_REG08(0xFC04C052)
1299#define MCF_INTC1_ICR19 MCF_REG08(0xFC04C053)
1300#define MCF_INTC1_ICR20 MCF_REG08(0xFC04C054)
1301#define MCF_INTC1_ICR21 MCF_REG08(0xFC04C055)
1302#define MCF_INTC1_ICR22 MCF_REG08(0xFC04C056)
1303#define MCF_INTC1_ICR23 MCF_REG08(0xFC04C057)
1304#define MCF_INTC1_ICR24 MCF_REG08(0xFC04C058)
1305#define MCF_INTC1_ICR25 MCF_REG08(0xFC04C059)
1306#define MCF_INTC1_ICR26 MCF_REG08(0xFC04C05A)
1307#define MCF_INTC1_ICR27 MCF_REG08(0xFC04C05B)
1308#define MCF_INTC1_ICR28 MCF_REG08(0xFC04C05C)
1309#define MCF_INTC1_ICR29 MCF_REG08(0xFC04C05D)
1310#define MCF_INTC1_ICR30 MCF_REG08(0xFC04C05E)
1311#define MCF_INTC1_ICR31 MCF_REG08(0xFC04C05F)
1312#define MCF_INTC1_ICR32 MCF_REG08(0xFC04C060)
1313#define MCF_INTC1_ICR33 MCF_REG08(0xFC04C061)
1314#define MCF_INTC1_ICR34 MCF_REG08(0xFC04C062)
1315#define MCF_INTC1_ICR35 MCF_REG08(0xFC04C063)
1316#define MCF_INTC1_ICR36 MCF_REG08(0xFC04C064)
1317#define MCF_INTC1_ICR37 MCF_REG08(0xFC04C065)
1318#define MCF_INTC1_ICR38 MCF_REG08(0xFC04C066)
1319#define MCF_INTC1_ICR39 MCF_REG08(0xFC04C067)
1320#define MCF_INTC1_ICR40 MCF_REG08(0xFC04C068)
1321#define MCF_INTC1_ICR41 MCF_REG08(0xFC04C069)
1322#define MCF_INTC1_ICR42 MCF_REG08(0xFC04C06A)
1323#define MCF_INTC1_ICR43 MCF_REG08(0xFC04C06B)
1324#define MCF_INTC1_ICR44 MCF_REG08(0xFC04C06C)
1325#define MCF_INTC1_ICR45 MCF_REG08(0xFC04C06D)
1326#define MCF_INTC1_ICR46 MCF_REG08(0xFC04C06E)
1327#define MCF_INTC1_ICR47 MCF_REG08(0xFC04C06F)
1328#define MCF_INTC1_ICR48 MCF_REG08(0xFC04C070)
1329#define MCF_INTC1_ICR49 MCF_REG08(0xFC04C071)
1330#define MCF_INTC1_ICR50 MCF_REG08(0xFC04C072)
1331#define MCF_INTC1_ICR51 MCF_REG08(0xFC04C073)
1332#define MCF_INTC1_ICR52 MCF_REG08(0xFC04C074)
1333#define MCF_INTC1_ICR53 MCF_REG08(0xFC04C075)
1334#define MCF_INTC1_ICR54 MCF_REG08(0xFC04C076)
1335#define MCF_INTC1_ICR55 MCF_REG08(0xFC04C077)
1336#define MCF_INTC1_ICR56 MCF_REG08(0xFC04C078)
1337#define MCF_INTC1_ICR57 MCF_REG08(0xFC04C079)
1338#define MCF_INTC1_ICR58 MCF_REG08(0xFC04C07A)
1339#define MCF_INTC1_ICR59 MCF_REG08(0xFC04C07B)
1340#define MCF_INTC1_ICR60 MCF_REG08(0xFC04C07C)
1341#define MCF_INTC1_ICR61 MCF_REG08(0xFC04C07D)
1342#define MCF_INTC1_ICR62 MCF_REG08(0xFC04C07E)
1343#define MCF_INTC1_ICR63 MCF_REG08(0xFC04C07F)
1344#define MCF_INTC1_ICR(x) MCF_REG08(0xFC04C040+((x)*0x001))
1345#define MCF_INTC1_SWIACK MCF_REG08(0xFC04C0E0)
1346#define MCF_INTC1_L1IACK MCF_REG08(0xFC04C0E4)
1347#define MCF_INTC1_L2IACK MCF_REG08(0xFC04C0E8)
1348#define MCF_INTC1_L3IACK MCF_REG08(0xFC04C0EC)
1349#define MCF_INTC1_L4IACK MCF_REG08(0xFC04C0F0)
1350#define MCF_INTC1_L5IACK MCF_REG08(0xFC04C0F4)
1351#define MCF_INTC1_L6IACK MCF_REG08(0xFC04C0F8)
1352#define MCF_INTC1_L7IACK MCF_REG08(0xFC04C0FC)
1353#define MCF_INTC1_LIACK(x) MCF_REG08(0xFC04C0E4+((x)*0x004))
1354#define MCF_INTC_IPRH(x) MCF_REG32(0xFC048000+((x)*0x4000))
1355#define MCF_INTC_IPRL(x) MCF_REG32(0xFC048004+((x)*0x4000))
1356#define MCF_INTC_IMRH(x) MCF_REG32(0xFC048008+((x)*0x4000))
1357#define MCF_INTC_IMRL(x) MCF_REG32(0xFC04800C+((x)*0x4000))
1358#define MCF_INTC_INTFRCH(x) MCF_REG32(0xFC048010+((x)*0x4000))
1359#define MCF_INTC_INTFRCL(x) MCF_REG32(0xFC048014+((x)*0x4000))
1360#define MCF_INTC_ICONFIG(x) MCF_REG16(0xFC04801A+((x)*0x4000))
1361#define MCF_INTC_SIMR(x) MCF_REG08(0xFC04801C+((x)*0x4000))
1362#define MCF_INTC_CIMR(x) MCF_REG08(0xFC04801D+((x)*0x4000))
1363#define MCF_INTC_CLMASK(x) MCF_REG08(0xFC04801E+((x)*0x4000))
1364#define MCF_INTC_SLMASK(x) MCF_REG08(0xFC04801F+((x)*0x4000))
1365#define MCF_INTC_ICR0(x) MCF_REG08(0xFC048040+((x)*0x4000))
1366#define MCF_INTC_ICR1(x) MCF_REG08(0xFC048041+((x)*0x4000))
1367#define MCF_INTC_ICR2(x) MCF_REG08(0xFC048042+((x)*0x4000))
1368#define MCF_INTC_ICR3(x) MCF_REG08(0xFC048043+((x)*0x4000))
1369#define MCF_INTC_ICR4(x) MCF_REG08(0xFC048044+((x)*0x4000))
1370#define MCF_INTC_ICR5(x) MCF_REG08(0xFC048045+((x)*0x4000))
1371#define MCF_INTC_ICR6(x) MCF_REG08(0xFC048046+((x)*0x4000))
1372#define MCF_INTC_ICR7(x) MCF_REG08(0xFC048047+((x)*0x4000))
1373#define MCF_INTC_ICR8(x) MCF_REG08(0xFC048048+((x)*0x4000))
1374#define MCF_INTC_ICR9(x) MCF_REG08(0xFC048049+((x)*0x4000))
1375#define MCF_INTC_ICR10(x) MCF_REG08(0xFC04804A+((x)*0x4000))
1376#define MCF_INTC_ICR11(x) MCF_REG08(0xFC04804B+((x)*0x4000))
1377#define MCF_INTC_ICR12(x) MCF_REG08(0xFC04804C+((x)*0x4000))
1378#define MCF_INTC_ICR13(x) MCF_REG08(0xFC04804D+((x)*0x4000))
1379#define MCF_INTC_ICR14(x) MCF_REG08(0xFC04804E+((x)*0x4000))
1380#define MCF_INTC_ICR15(x) MCF_REG08(0xFC04804F+((x)*0x4000))
1381#define MCF_INTC_ICR16(x) MCF_REG08(0xFC048050+((x)*0x4000))
1382#define MCF_INTC_ICR17(x) MCF_REG08(0xFC048051+((x)*0x4000))
1383#define MCF_INTC_ICR18(x) MCF_REG08(0xFC048052+((x)*0x4000))
1384#define MCF_INTC_ICR19(x) MCF_REG08(0xFC048053+((x)*0x4000))
1385#define MCF_INTC_ICR20(x) MCF_REG08(0xFC048054+((x)*0x4000))
1386#define MCF_INTC_ICR21(x) MCF_REG08(0xFC048055+((x)*0x4000))
1387#define MCF_INTC_ICR22(x) MCF_REG08(0xFC048056+((x)*0x4000))
1388#define MCF_INTC_ICR23(x) MCF_REG08(0xFC048057+((x)*0x4000))
1389#define MCF_INTC_ICR24(x) MCF_REG08(0xFC048058+((x)*0x4000))
1390#define MCF_INTC_ICR25(x) MCF_REG08(0xFC048059+((x)*0x4000))
1391#define MCF_INTC_ICR26(x) MCF_REG08(0xFC04805A+((x)*0x4000))
1392#define MCF_INTC_ICR27(x) MCF_REG08(0xFC04805B+((x)*0x4000))
1393#define MCF_INTC_ICR28(x) MCF_REG08(0xFC04805C+((x)*0x4000))
1394#define MCF_INTC_ICR29(x) MCF_REG08(0xFC04805D+((x)*0x4000))
1395#define MCF_INTC_ICR30(x) MCF_REG08(0xFC04805E+((x)*0x4000))
1396#define MCF_INTC_ICR31(x) MCF_REG08(0xFC04805F+((x)*0x4000))
1397#define MCF_INTC_ICR32(x) MCF_REG08(0xFC048060+((x)*0x4000))
1398#define MCF_INTC_ICR33(x) MCF_REG08(0xFC048061+((x)*0x4000))
1399#define MCF_INTC_ICR34(x) MCF_REG08(0xFC048062+((x)*0x4000))
1400#define MCF_INTC_ICR35(x) MCF_REG08(0xFC048063+((x)*0x4000))
1401#define MCF_INTC_ICR36(x) MCF_REG08(0xFC048064+((x)*0x4000))
1402#define MCF_INTC_ICR37(x) MCF_REG08(0xFC048065+((x)*0x4000))
1403#define MCF_INTC_ICR38(x) MCF_REG08(0xFC048066+((x)*0x4000))
1404#define MCF_INTC_ICR39(x) MCF_REG08(0xFC048067+((x)*0x4000))
1405#define MCF_INTC_ICR40(x) MCF_REG08(0xFC048068+((x)*0x4000))
1406#define MCF_INTC_ICR41(x) MCF_REG08(0xFC048069+((x)*0x4000))
1407#define MCF_INTC_ICR42(x) MCF_REG08(0xFC04806A+((x)*0x4000))
1408#define MCF_INTC_ICR43(x) MCF_REG08(0xFC04806B+((x)*0x4000))
1409#define MCF_INTC_ICR44(x) MCF_REG08(0xFC04806C+((x)*0x4000))
1410#define MCF_INTC_ICR45(x) MCF_REG08(0xFC04806D+((x)*0x4000))
1411#define MCF_INTC_ICR46(x) MCF_REG08(0xFC04806E+((x)*0x4000))
1412#define MCF_INTC_ICR47(x) MCF_REG08(0xFC04806F+((x)*0x4000))
1413#define MCF_INTC_ICR48(x) MCF_REG08(0xFC048070+((x)*0x4000))
1414#define MCF_INTC_ICR49(x) MCF_REG08(0xFC048071+((x)*0x4000))
1415#define MCF_INTC_ICR50(x) MCF_REG08(0xFC048072+((x)*0x4000))
1416#define MCF_INTC_ICR51(x) MCF_REG08(0xFC048073+((x)*0x4000))
1417#define MCF_INTC_ICR52(x) MCF_REG08(0xFC048074+((x)*0x4000))
1418#define MCF_INTC_ICR53(x) MCF_REG08(0xFC048075+((x)*0x4000))
1419#define MCF_INTC_ICR54(x) MCF_REG08(0xFC048076+((x)*0x4000))
1420#define MCF_INTC_ICR55(x) MCF_REG08(0xFC048077+((x)*0x4000))
1421#define MCF_INTC_ICR56(x) MCF_REG08(0xFC048078+((x)*0x4000))
1422#define MCF_INTC_ICR57(x) MCF_REG08(0xFC048079+((x)*0x4000))
1423#define MCF_INTC_ICR58(x) MCF_REG08(0xFC04807A+((x)*0x4000))
1424#define MCF_INTC_ICR59(x) MCF_REG08(0xFC04807B+((x)*0x4000))
1425#define MCF_INTC_ICR60(x) MCF_REG08(0xFC04807C+((x)*0x4000))
1426#define MCF_INTC_ICR61(x) MCF_REG08(0xFC04807D+((x)*0x4000))
1427#define MCF_INTC_ICR62(x) MCF_REG08(0xFC04807E+((x)*0x4000))
1428#define MCF_INTC_ICR63(x) MCF_REG08(0xFC04807F+((x)*0x4000))
1429#define MCF_INTC_SWIACK(x) MCF_REG08(0xFC0480E0+((x)*0x4000))
1430#define MCF_INTC_L1IACK(x) MCF_REG08(0xFC0480E4+((x)*0x4000))
1431#define MCF_INTC_L2IACK(x) MCF_REG08(0xFC0480E8+((x)*0x4000))
1432#define MCF_INTC_L3IACK(x) MCF_REG08(0xFC0480EC+((x)*0x4000))
1433#define MCF_INTC_L4IACK(x) MCF_REG08(0xFC0480F0+((x)*0x4000))
1434#define MCF_INTC_L5IACK(x) MCF_REG08(0xFC0480F4+((x)*0x4000))
1435#define MCF_INTC_L6IACK(x) MCF_REG08(0xFC0480F8+((x)*0x4000))
1436#define MCF_INTC_L7IACK(x) MCF_REG08(0xFC0480FC+((x)*0x4000))
1437
1438/* Bit definitions and macros for MCF_INTC_IPRH */
1439#define MCF_INTC_IPRH_INT32 (0x00000001)
1440#define MCF_INTC_IPRH_INT33 (0x00000002)
1441#define MCF_INTC_IPRH_INT34 (0x00000004)
1442#define MCF_INTC_IPRH_INT35 (0x00000008)
1443#define MCF_INTC_IPRH_INT36 (0x00000010)
1444#define MCF_INTC_IPRH_INT37 (0x00000020)
1445#define MCF_INTC_IPRH_INT38 (0x00000040)
1446#define MCF_INTC_IPRH_INT39 (0x00000080)
1447#define MCF_INTC_IPRH_INT40 (0x00000100)
1448#define MCF_INTC_IPRH_INT41 (0x00000200)
1449#define MCF_INTC_IPRH_INT42 (0x00000400)
1450#define MCF_INTC_IPRH_INT43 (0x00000800)
1451#define MCF_INTC_IPRH_INT44 (0x00001000)
1452#define MCF_INTC_IPRH_INT45 (0x00002000)
1453#define MCF_INTC_IPRH_INT46 (0x00004000)
1454#define MCF_INTC_IPRH_INT47 (0x00008000)
1455#define MCF_INTC_IPRH_INT48 (0x00010000)
1456#define MCF_INTC_IPRH_INT49 (0x00020000)
1457#define MCF_INTC_IPRH_INT50 (0x00040000)
1458#define MCF_INTC_IPRH_INT51 (0x00080000)
1459#define MCF_INTC_IPRH_INT52 (0x00100000)
1460#define MCF_INTC_IPRH_INT53 (0x00200000)
1461#define MCF_INTC_IPRH_INT54 (0x00400000)
1462#define MCF_INTC_IPRH_INT55 (0x00800000)
1463#define MCF_INTC_IPRH_INT56 (0x01000000)
1464#define MCF_INTC_IPRH_INT57 (0x02000000)
1465#define MCF_INTC_IPRH_INT58 (0x04000000)
1466#define MCF_INTC_IPRH_INT59 (0x08000000)
1467#define MCF_INTC_IPRH_INT60 (0x10000000)
1468#define MCF_INTC_IPRH_INT61 (0x20000000)
1469#define MCF_INTC_IPRH_INT62 (0x40000000)
1470#define MCF_INTC_IPRH_INT63 (0x80000000)
1471
1472/* Bit definitions and macros for MCF_INTC_IPRL */
1473#define MCF_INTC_IPRL_INT0 (0x00000001)
1474#define MCF_INTC_IPRL_INT1 (0x00000002)
1475#define MCF_INTC_IPRL_INT2 (0x00000004)
1476#define MCF_INTC_IPRL_INT3 (0x00000008)
1477#define MCF_INTC_IPRL_INT4 (0x00000010)
1478#define MCF_INTC_IPRL_INT5 (0x00000020)
1479#define MCF_INTC_IPRL_INT6 (0x00000040)
1480#define MCF_INTC_IPRL_INT7 (0x00000080)
1481#define MCF_INTC_IPRL_INT8 (0x00000100)
1482#define MCF_INTC_IPRL_INT9 (0x00000200)
1483#define MCF_INTC_IPRL_INT10 (0x00000400)
1484#define MCF_INTC_IPRL_INT11 (0x00000800)
1485#define MCF_INTC_IPRL_INT12 (0x00001000)
1486#define MCF_INTC_IPRL_INT13 (0x00002000)
1487#define MCF_INTC_IPRL_INT14 (0x00004000)
1488#define MCF_INTC_IPRL_INT15 (0x00008000)
1489#define MCF_INTC_IPRL_INT16 (0x00010000)
1490#define MCF_INTC_IPRL_INT17 (0x00020000)
1491#define MCF_INTC_IPRL_INT18 (0x00040000)
1492#define MCF_INTC_IPRL_INT19 (0x00080000)
1493#define MCF_INTC_IPRL_INT20 (0x00100000)
1494#define MCF_INTC_IPRL_INT21 (0x00200000)
1495#define MCF_INTC_IPRL_INT22 (0x00400000)
1496#define MCF_INTC_IPRL_INT23 (0x00800000)
1497#define MCF_INTC_IPRL_INT24 (0x01000000)
1498#define MCF_INTC_IPRL_INT25 (0x02000000)
1499#define MCF_INTC_IPRL_INT26 (0x04000000)
1500#define MCF_INTC_IPRL_INT27 (0x08000000)
1501#define MCF_INTC_IPRL_INT28 (0x10000000)
1502#define MCF_INTC_IPRL_INT29 (0x20000000)
1503#define MCF_INTC_IPRL_INT30 (0x40000000)
1504#define MCF_INTC_IPRL_INT31 (0x80000000)
1505
1506/* Bit definitions and macros for MCF_INTC_IMRH */
1507#define MCF_INTC_IMRH_INT_MASK32 (0x00000001)
1508#define MCF_INTC_IMRH_INT_MASK33 (0x00000002)
1509#define MCF_INTC_IMRH_INT_MASK34 (0x00000004)
1510#define MCF_INTC_IMRH_INT_MASK35 (0x00000008)
1511#define MCF_INTC_IMRH_INT_MASK36 (0x00000010)
1512#define MCF_INTC_IMRH_INT_MASK37 (0x00000020)
1513#define MCF_INTC_IMRH_INT_MASK38 (0x00000040)
1514#define MCF_INTC_IMRH_INT_MASK39 (0x00000080)
1515#define MCF_INTC_IMRH_INT_MASK40 (0x00000100)
1516#define MCF_INTC_IMRH_INT_MASK41 (0x00000200)
1517#define MCF_INTC_IMRH_INT_MASK42 (0x00000400)
1518#define MCF_INTC_IMRH_INT_MASK43 (0x00000800)
1519#define MCF_INTC_IMRH_INT_MASK44 (0x00001000)
1520#define MCF_INTC_IMRH_INT_MASK45 (0x00002000)
1521#define MCF_INTC_IMRH_INT_MASK46 (0x00004000)
1522#define MCF_INTC_IMRH_INT_MASK47 (0x00008000)
1523#define MCF_INTC_IMRH_INT_MASK48 (0x00010000)
1524#define MCF_INTC_IMRH_INT_MASK49 (0x00020000)
1525#define MCF_INTC_IMRH_INT_MASK50 (0x00040000)
1526#define MCF_INTC_IMRH_INT_MASK51 (0x00080000)
1527#define MCF_INTC_IMRH_INT_MASK52 (0x00100000)
1528#define MCF_INTC_IMRH_INT_MASK53 (0x00200000)
1529#define MCF_INTC_IMRH_INT_MASK54 (0x00400000)
1530#define MCF_INTC_IMRH_INT_MASK55 (0x00800000)
1531#define MCF_INTC_IMRH_INT_MASK56 (0x01000000)
1532#define MCF_INTC_IMRH_INT_MASK57 (0x02000000)
1533#define MCF_INTC_IMRH_INT_MASK58 (0x04000000)
1534#define MCF_INTC_IMRH_INT_MASK59 (0x08000000)
1535#define MCF_INTC_IMRH_INT_MASK60 (0x10000000)
1536#define MCF_INTC_IMRH_INT_MASK61 (0x20000000)
1537#define MCF_INTC_IMRH_INT_MASK62 (0x40000000)
1538#define MCF_INTC_IMRH_INT_MASK63 (0x80000000)
1539
1540/* Bit definitions and macros for MCF_INTC_IMRL */
1541#define MCF_INTC_IMRL_INT_MASK0 (0x00000001)
1542#define MCF_INTC_IMRL_INT_MASK1 (0x00000002)
1543#define MCF_INTC_IMRL_INT_MASK2 (0x00000004)
1544#define MCF_INTC_IMRL_INT_MASK3 (0x00000008)
1545#define MCF_INTC_IMRL_INT_MASK4 (0x00000010)
1546#define MCF_INTC_IMRL_INT_MASK5 (0x00000020)
1547#define MCF_INTC_IMRL_INT_MASK6 (0x00000040)
1548#define MCF_INTC_IMRL_INT_MASK7 (0x00000080)
1549#define MCF_INTC_IMRL_INT_MASK8 (0x00000100)
1550#define MCF_INTC_IMRL_INT_MASK9 (0x00000200)
1551#define MCF_INTC_IMRL_INT_MASK10 (0x00000400)
1552#define MCF_INTC_IMRL_INT_MASK11 (0x00000800)
1553#define MCF_INTC_IMRL_INT_MASK12 (0x00001000)
1554#define MCF_INTC_IMRL_INT_MASK13 (0x00002000)
1555#define MCF_INTC_IMRL_INT_MASK14 (0x00004000)
1556#define MCF_INTC_IMRL_INT_MASK15 (0x00008000)
1557#define MCF_INTC_IMRL_INT_MASK16 (0x00010000)
1558#define MCF_INTC_IMRL_INT_MASK17 (0x00020000)
1559#define MCF_INTC_IMRL_INT_MASK18 (0x00040000)
1560#define MCF_INTC_IMRL_INT_MASK19 (0x00080000)
1561#define MCF_INTC_IMRL_INT_MASK20 (0x00100000)
1562#define MCF_INTC_IMRL_INT_MASK21 (0x00200000)
1563#define MCF_INTC_IMRL_INT_MASK22 (0x00400000)
1564#define MCF_INTC_IMRL_INT_MASK23 (0x00800000)
1565#define MCF_INTC_IMRL_INT_MASK24 (0x01000000)
1566#define MCF_INTC_IMRL_INT_MASK25 (0x02000000)
1567#define MCF_INTC_IMRL_INT_MASK26 (0x04000000)
1568#define MCF_INTC_IMRL_INT_MASK27 (0x08000000)
1569#define MCF_INTC_IMRL_INT_MASK28 (0x10000000)
1570#define MCF_INTC_IMRL_INT_MASK29 (0x20000000)
1571#define MCF_INTC_IMRL_INT_MASK30 (0x40000000)
1572#define MCF_INTC_IMRL_INT_MASK31 (0x80000000)
1573
1574/* Bit definitions and macros for MCF_INTC_INTFRCH */
1575#define MCF_INTC_INTFRCH_INTFRC32 (0x00000001)
1576#define MCF_INTC_INTFRCH_INTFRC33 (0x00000002)
1577#define MCF_INTC_INTFRCH_INTFRC34 (0x00000004)
1578#define MCF_INTC_INTFRCH_INTFRC35 (0x00000008)
1579#define MCF_INTC_INTFRCH_INTFRC36 (0x00000010)
1580#define MCF_INTC_INTFRCH_INTFRC37 (0x00000020)
1581#define MCF_INTC_INTFRCH_INTFRC38 (0x00000040)
1582#define MCF_INTC_INTFRCH_INTFRC39 (0x00000080)
1583#define MCF_INTC_INTFRCH_INTFRC40 (0x00000100)
1584#define MCF_INTC_INTFRCH_INTFRC41 (0x00000200)
1585#define MCF_INTC_INTFRCH_INTFRC42 (0x00000400)
1586#define MCF_INTC_INTFRCH_INTFRC43 (0x00000800)
1587#define MCF_INTC_INTFRCH_INTFRC44 (0x00001000)
1588#define MCF_INTC_INTFRCH_INTFRC45 (0x00002000)
1589#define MCF_INTC_INTFRCH_INTFRC46 (0x00004000)
1590#define MCF_INTC_INTFRCH_INTFRC47 (0x00008000)
1591#define MCF_INTC_INTFRCH_INTFRC48 (0x00010000)
1592#define MCF_INTC_INTFRCH_INTFRC49 (0x00020000)
1593#define MCF_INTC_INTFRCH_INTFRC50 (0x00040000)
1594#define MCF_INTC_INTFRCH_INTFRC51 (0x00080000)
1595#define MCF_INTC_INTFRCH_INTFRC52 (0x00100000)
1596#define MCF_INTC_INTFRCH_INTFRC53 (0x00200000)
1597#define MCF_INTC_INTFRCH_INTFRC54 (0x00400000)
1598#define MCF_INTC_INTFRCH_INTFRC55 (0x00800000)
1599#define MCF_INTC_INTFRCH_INTFRC56 (0x01000000)
1600#define MCF_INTC_INTFRCH_INTFRC57 (0x02000000)
1601#define MCF_INTC_INTFRCH_INTFRC58 (0x04000000)
1602#define MCF_INTC_INTFRCH_INTFRC59 (0x08000000)
1603#define MCF_INTC_INTFRCH_INTFRC60 (0x10000000)
1604#define MCF_INTC_INTFRCH_INTFRC61 (0x20000000)
1605#define MCF_INTC_INTFRCH_INTFRC62 (0x40000000)
1606#define MCF_INTC_INTFRCH_INTFRC63 (0x80000000)
1607
1608/* Bit definitions and macros for MCF_INTC_INTFRCL */
1609#define MCF_INTC_INTFRCL_INTFRC0 (0x00000001)
1610#define MCF_INTC_INTFRCL_INTFRC1 (0x00000002)
1611#define MCF_INTC_INTFRCL_INTFRC2 (0x00000004)
1612#define MCF_INTC_INTFRCL_INTFRC3 (0x00000008)
1613#define MCF_INTC_INTFRCL_INTFRC4 (0x00000010)
1614#define MCF_INTC_INTFRCL_INTFRC5 (0x00000020)
1615#define MCF_INTC_INTFRCL_INTFRC6 (0x00000040)
1616#define MCF_INTC_INTFRCL_INTFRC7 (0x00000080)
1617#define MCF_INTC_INTFRCL_INTFRC8 (0x00000100)
1618#define MCF_INTC_INTFRCL_INTFRC9 (0x00000200)
1619#define MCF_INTC_INTFRCL_INTFRC10 (0x00000400)
1620#define MCF_INTC_INTFRCL_INTFRC11 (0x00000800)
1621#define MCF_INTC_INTFRCL_INTFRC12 (0x00001000)
1622#define MCF_INTC_INTFRCL_INTFRC13 (0x00002000)
1623#define MCF_INTC_INTFRCL_INTFRC14 (0x00004000)
1624#define MCF_INTC_INTFRCL_INTFRC15 (0x00008000)
1625#define MCF_INTC_INTFRCL_INTFRC16 (0x00010000)
1626#define MCF_INTC_INTFRCL_INTFRC17 (0x00020000)
1627#define MCF_INTC_INTFRCL_INTFRC18 (0x00040000)
1628#define MCF_INTC_INTFRCL_INTFRC19 (0x00080000)
1629#define MCF_INTC_INTFRCL_INTFRC20 (0x00100000)
1630#define MCF_INTC_INTFRCL_INTFRC21 (0x00200000)
1631#define MCF_INTC_INTFRCL_INTFRC22 (0x00400000)
1632#define MCF_INTC_INTFRCL_INTFRC23 (0x00800000)
1633#define MCF_INTC_INTFRCL_INTFRC24 (0x01000000)
1634#define MCF_INTC_INTFRCL_INTFRC25 (0x02000000)
1635#define MCF_INTC_INTFRCL_INTFRC26 (0x04000000)
1636#define MCF_INTC_INTFRCL_INTFRC27 (0x08000000)
1637#define MCF_INTC_INTFRCL_INTFRC28 (0x10000000)
1638#define MCF_INTC_INTFRCL_INTFRC29 (0x20000000)
1639#define MCF_INTC_INTFRCL_INTFRC30 (0x40000000)
1640#define MCF_INTC_INTFRCL_INTFRC31 (0x80000000)
1641
1642/* Bit definitions and macros for MCF_INTC_ICONFIG */
1643#define MCF_INTC_ICONFIG_EMASK (0x0020)
1644#define MCF_INTC_ICONFIG_ELVLPRI1 (0x0200)
1645#define MCF_INTC_ICONFIG_ELVLPRI2 (0x0400)
1646#define MCF_INTC_ICONFIG_ELVLPRI3 (0x0800)
1647#define MCF_INTC_ICONFIG_ELVLPRI4 (0x1000)
1648#define MCF_INTC_ICONFIG_ELVLPRI5 (0x2000)
1649#define MCF_INTC_ICONFIG_ELVLPRI6 (0x4000)
1650#define MCF_INTC_ICONFIG_ELVLPRI7 (0x8000)
1651
1652/* Bit definitions and macros for MCF_INTC_SIMR */
1653#define MCF_INTC_SIMR_SIMR(x) (((x)&0x7F)<<0)
1654
1655/* Bit definitions and macros for MCF_INTC_CIMR */
1656#define MCF_INTC_CIMR_CIMR(x) (((x)&0x7F)<<0)
1657
1658/* Bit definitions and macros for MCF_INTC_CLMASK */
1659#define MCF_INTC_CLMASK_CLMASK(x) (((x)&0x0F)<<0)
1660
1661/* Bit definitions and macros for MCF_INTC_SLMASK */
1662#define MCF_INTC_SLMASK_SLMASK(x) (((x)&0x0F)<<0)
1663
1664/* Bit definitions and macros for MCF_INTC_ICR */
1665#define MCF_INTC_ICR_IL(x) (((x)&0x07)<<0)
1666
1667/* Bit definitions and macros for MCF_INTC_SWIACK */
1668#define MCF_INTC_SWIACK_VECTOR(x) (((x)&0xFF)<<0)
1669
1670/* Bit definitions and macros for MCF_INTC_LIACK */
1671#define MCF_INTC_LIACK_VECTOR(x) (((x)&0xFF)<<0)
1672
1673/********************************************************************/
1674/*********************************************************************
1675*
1676* LCD Controller (LCDC)
1677*
1678*********************************************************************/
1679
1680/* Register read/write macros */
1681#define MCF_LCDC_LSSAR MCF_REG32(0xFC0AC000)
1682#define MCF_LCDC_LSR MCF_REG32(0xFC0AC004)
1683#define MCF_LCDC_LVPWR MCF_REG32(0xFC0AC008)
1684#define MCF_LCDC_LCPR MCF_REG32(0xFC0AC00C)
1685#define MCF_LCDC_LCWHBR MCF_REG32(0xFC0AC010)
1686#define MCF_LCDC_LCCMR MCF_REG32(0xFC0AC014)
1687#define MCF_LCDC_LPCR MCF_REG32(0xFC0AC018)
1688#define MCF_LCDC_LHCR MCF_REG32(0xFC0AC01C)
1689#define MCF_LCDC_LVCR MCF_REG32(0xFC0AC020)
1690#define MCF_LCDC_LPOR MCF_REG32(0xFC0AC024)
1691#define MCF_LCDC_LSCR MCF_REG32(0xFC0AC028)
1692#define MCF_LCDC_LPCCR MCF_REG32(0xFC0AC02C)
1693#define MCF_LCDC_LDCR MCF_REG32(0xFC0AC030)
1694#define MCF_LCDC_LRMCR MCF_REG32(0xFC0AC034)
1695#define MCF_LCDC_LICR MCF_REG32(0xFC0AC038)
1696#define MCF_LCDC_LIER MCF_REG32(0xFC0AC03C)
1697#define MCF_LCDC_LISR MCF_REG32(0xFC0AC040)
1698#define MCF_LCDC_LGWSAR MCF_REG32(0xFC0AC050)
1699#define MCF_LCDC_LGWSR MCF_REG32(0xFC0AC054)
1700#define MCF_LCDC_LGWVPWR MCF_REG32(0xFC0AC058)
1701#define MCF_LCDC_LGWPOR MCF_REG32(0xFC0AC05C)
1702#define MCF_LCDC_LGWPR MCF_REG32(0xFC0AC060)
1703#define MCF_LCDC_LGWCR MCF_REG32(0xFC0AC064)
1704#define MCF_LCDC_LGWDCR MCF_REG32(0xFC0AC068)
1705#define MCF_LCDC_BPLUT_BASE MCF_REG32(0xFC0AC800)
1706#define MCF_LCDC_GWLUT_BASE MCF_REG32(0xFC0ACC00)
1707
1708/* Bit definitions and macros for MCF_LCDC_LSSAR */
1709#define MCF_LCDC_LSSAR_SSA(x) (((x)&0x3FFFFFFF)<<2)
1710
1711/* Bit definitions and macros for MCF_LCDC_LSR */
1712#define MCF_LCDC_LSR_YMAX(x) (((x)&0x000003FF)<<0)
1713#define MCF_LCDC_LSR_XMAX(x) (((x)&0x0000003F)<<20)
1714
1715/* Bit definitions and macros for MCF_LCDC_LVPWR */
1716#define MCF_LCDC_LVPWR_VPW(x) (((x)&0x000003FF)<<0)
1717
1718/* Bit definitions and macros for MCF_LCDC_LCPR */
1719#define MCF_LCDC_LCPR_CYP(x) (((x)&0x000003FF)<<0)
1720#define MCF_LCDC_LCPR_CXP(x) (((x)&0x000003FF)<<16)
1721#define MCF_LCDC_LCPR_OP (0x10000000)
1722#define MCF_LCDC_LCPR_CC(x) (((x)&0x00000003)<<30)
1723#define MCF_LCDC_LCPR_CC_TRANSPARENT (0x00000000)
1724#define MCF_LCDC_LCPR_CC_OR (0x40000000)
1725#define MCF_LCDC_LCPR_CC_XOR (0x80000000)
1726#define MCF_LCDC_LCPR_CC_AND (0xC0000000)
1727#define MCF_LCDC_LCPR_OP_ON (0x10000000)
1728#define MCF_LCDC_LCPR_OP_OFF (0x00000000)
1729
1730/* Bit definitions and macros for MCF_LCDC_LCWHBR */
1731#define MCF_LCDC_LCWHBR_BD(x) (((x)&0x000000FF)<<0)
1732#define MCF_LCDC_LCWHBR_CH(x) (((x)&0x0000001F)<<16)
1733#define MCF_LCDC_LCWHBR_CW(x) (((x)&0x0000001F)<<24)
1734#define MCF_LCDC_LCWHBR_BK_EN (0x80000000)
1735#define MCF_LCDC_LCWHBR_BK_EN_ON (0x80000000)
1736#define MCF_LCDC_LCWHBR_BK_EN_OFF (0x00000000)
1737
1738/* Bit definitions and macros for MCF_LCDC_LCCMR */
1739#define MCF_LCDC_LCCMR_CUR_COL_B(x) (((x)&0x0000003F)<<0)
1740#define MCF_LCDC_LCCMR_CUR_COL_G(x) (((x)&0x0000003F)<<6)
1741#define MCF_LCDC_LCCMR_CUR_COL_R(x) (((x)&0x0000003F)<<12)
1742
1743/* Bit definitions and macros for MCF_LCDC_LPCR */
1744#define MCF_LCDC_LPCR_PCD(x) (((x)&0x0000003F)<<0)
1745#define MCF_LCDC_LPCR_SHARP (0x00000040)
1746#define MCF_LCDC_LPCR_SCLKSEL (0x00000080)
1747#define MCF_LCDC_LPCR_ACD(x) (((x)&0x0000007F)<<8)
1748#define MCF_LCDC_LPCR_ACDSEL (0x00008000)
1749#define MCF_LCDC_LPCR_REV_VS (0x00010000)
1750#define MCF_LCDC_LPCR_SWAP_SEL (0x00020000)
1751#define MCF_LCDC_LPCR_ENDSEL (0x00040000)
1752#define MCF_LCDC_LPCR_SCLKIDLE (0x00080000)
1753#define MCF_LCDC_LPCR_OEPOL (0x00100000)
1754#define MCF_LCDC_LPCR_CLKPOL (0x00200000)
1755#define MCF_LCDC_LPCR_LPPOL (0x00400000)
1756#define MCF_LCDC_LPCR_FLM (0x00800000)
1757#define MCF_LCDC_LPCR_PIXPOL (0x01000000)
1758#define MCF_LCDC_LPCR_BPIX(x) (((x)&0x00000007)<<25)
1759#define MCF_LCDC_LPCR_PBSIZ(x) (((x)&0x00000003)<<28)
1760#define MCF_LCDC_LPCR_COLOR (0x40000000)
1761#define MCF_LCDC_LPCR_TFT (0x80000000)
1762#define MCF_LCDC_LPCR_MODE_MONOCGROME (0x00000000)
1763#define MCF_LCDC_LPCR_MODE_CSTN (0x40000000)
1764#define MCF_LCDC_LPCR_MODE_TFT (0xC0000000)
1765#define MCF_LCDC_LPCR_PBSIZ_1 (0x00000000)
1766#define MCF_LCDC_LPCR_PBSIZ_2 (0x10000000)
1767#define MCF_LCDC_LPCR_PBSIZ_4 (0x20000000)
1768#define MCF_LCDC_LPCR_PBSIZ_8 (0x30000000)
1769#define MCF_LCDC_LPCR_BPIX_1bpp (0x00000000)
1770#define MCF_LCDC_LPCR_BPIX_2bpp (0x02000000)
1771#define MCF_LCDC_LPCR_BPIX_4bpp (0x04000000)
1772#define MCF_LCDC_LPCR_BPIX_8bpp (0x06000000)
1773#define MCF_LCDC_LPCR_BPIX_12bpp (0x08000000)
1774#define MCF_LCDC_LPCR_BPIX_16bpp (0x0A000000)
1775#define MCF_LCDC_LPCR_BPIX_18bpp (0x0C000000)
1776
1777#define MCF_LCDC_LPCR_PANEL_TYPE(x) (((x)&0x00000003)<<30)
1778
1779/* Bit definitions and macros for MCF_LCDC_LHCR */
1780#define MCF_LCDC_LHCR_H_WAIT_2(x) (((x)&0x000000FF)<<0)
1781#define MCF_LCDC_LHCR_H_WAIT_1(x) (((x)&0x000000FF)<<8)
1782#define MCF_LCDC_LHCR_H_WIDTH(x) (((x)&0x0000003F)<<26)
1783
1784/* Bit definitions and macros for MCF_LCDC_LVCR */
1785#define MCF_LCDC_LVCR_V_WAIT_2(x) (((x)&0x000000FF)<<0)
1786#define MCF_LCDC_LVCR_V_WAIT_1(x) (((x)&0x000000FF)<<8)
1787#define MCF_LCDC_LVCR_V_WIDTH(x) (((x)&0x0000003F)<<26)
1788
1789/* Bit definitions and macros for MCF_LCDC_LPOR */
1790#define MCF_LCDC_LPOR_POS(x) (((x)&0x0000001F)<<0)
1791
1792/* Bit definitions and macros for MCF_LCDC_LPCCR */
1793#define MCF_LCDC_LPCCR_PW(x) (((x)&0x000000FF)<<0)
1794#define MCF_LCDC_LPCCR_CC_EN (0x00000100)
1795#define MCF_LCDC_LPCCR_SCR(x) (((x)&0x00000003)<<9)
1796#define MCF_LCDC_LPCCR_LDMSK (0x00008000)
1797#define MCF_LCDC_LPCCR_CLS_HI_WIDTH(x) (((x)&0x000001FF)<<16)
1798#define MCF_LCDC_LPCCR_SCR_LINEPULSE (0x00000000)
1799#define MCF_LCDC_LPCCR_SCR_PIXELCLK (0x00002000)
1800#define MCF_LCDC_LPCCR_SCR_LCDCLOCK (0x00004000)
1801
1802/* Bit definitions and macros for MCF_LCDC_LDCR */
1803#define MCF_LCDC_LDCR_TM(x) (((x)&0x0000001F)<<0)
1804#define MCF_LCDC_LDCR_HM(x) (((x)&0x0000001F)<<16)
1805#define MCF_LCDC_LDCR_BURST (0x80000000)
1806
1807/* Bit definitions and macros for MCF_LCDC_LRMCR */
1808#define MCF_LCDC_LRMCR_SEL_REF (0x00000001)
1809
1810/* Bit definitions and macros for MCF_LCDC_LICR */
1811#define MCF_LCDC_LICR_INTCON (0x00000001)
1812#define MCF_LCDC_LICR_INTSYN (0x00000004)
1813#define MCF_LCDC_LICR_GW_INT_CON (0x00000010)
1814
1815/* Bit definitions and macros for MCF_LCDC_LIER */
1816#define MCF_LCDC_LIER_BOF_EN (0x00000001)
1817#define MCF_LCDC_LIER_EOF_EN (0x00000002)
1818#define MCF_LCDC_LIER_ERR_RES_EN (0x00000004)
1819#define MCF_LCDC_LIER_UDR_ERR_EN (0x00000008)
1820#define MCF_LCDC_LIER_GW_BOF_EN (0x00000010)
1821#define MCF_LCDC_LIER_GW_EOF_EN (0x00000020)
1822#define MCF_LCDC_LIER_GW_ERR_RES_EN (0x00000040)
1823#define MCF_LCDC_LIER_GW_UDR_ERR_EN (0x00000080)
1824
1825/* Bit definitions and macros for MCF_LCDC_LISR */
1826#define MCF_LCDC_LISR_BOF (0x00000001)
1827#define MCF_LCDC_LISR_EOF (0x00000002)
1828#define MCF_LCDC_LISR_ERR_RES (0x00000004)
1829#define MCF_LCDC_LISR_UDR_ERR (0x00000008)
1830#define MCF_LCDC_LISR_GW_BOF (0x00000010)
1831#define MCF_LCDC_LISR_GW_EOF (0x00000020)
1832#define MCF_LCDC_LISR_GW_ERR_RES (0x00000040)
1833#define MCF_LCDC_LISR_GW_UDR_ERR (0x00000080)
1834
1835/* Bit definitions and macros for MCF_LCDC_LGWSAR */
1836#define MCF_LCDC_LGWSAR_GWSA(x) (((x)&0x3FFFFFFF)<<2)
1837
1838/* Bit definitions and macros for MCF_LCDC_LGWSR */
1839#define MCF_LCDC_LGWSR_GWH(x) (((x)&0x000003FF)<<0)
1840#define MCF_LCDC_LGWSR_GWW(x) (((x)&0x0000003F)<<20)
1841
1842/* Bit definitions and macros for MCF_LCDC_LGWVPWR */
1843#define MCF_LCDC_LGWVPWR_GWVPW(x) (((x)&0x000003FF)<<0)
1844
1845/* Bit definitions and macros for MCF_LCDC_LGWPOR */
1846#define MCF_LCDC_LGWPOR_GWPO(x) (((x)&0x0000001F)<<0)
1847
1848/* Bit definitions and macros for MCF_LCDC_LGWPR */
1849#define MCF_LCDC_LGWPR_GWYP(x) (((x)&0x000003FF)<<0)
1850#define MCF_LCDC_LGWPR_GWXP(x) (((x)&0x000003FF)<<16)
1851
1852/* Bit definitions and macros for MCF_LCDC_LGWCR */
1853#define MCF_LCDC_LGWCR_GWCKB(x) (((x)&0x0000003F)<<0)
1854#define MCF_LCDC_LGWCR_GWCKG(x) (((x)&0x0000003F)<<6)
1855#define MCF_LCDC_LGWCR_GWCKR(x) (((x)&0x0000003F)<<12)
1856#define MCF_LCDC_LGWCR_GW_RVS (0x00200000)
1857#define MCF_LCDC_LGWCR_GWE (0x00400000)
1858#define MCF_LCDC_LGWCR_GWCKE (0x00800000)
1859#define MCF_LCDC_LGWCR_GWAV(x) (((x)&0x000000FF)<<24)
1860
1861/* Bit definitions and macros for MCF_LCDC_LGWDCR */
1862#define MCF_LCDC_LGWDCR_GWTM(x) (((x)&0x0000001F)<<0)
1863#define MCF_LCDC_LGWDCR_GWHM(x) (((x)&0x0000001F)<<16)
1864#define MCF_LCDC_LGWDCR_GWBT (0x80000000)
1865
1866/* Bit definitions and macros for MCF_LCDC_LSCR */
1867#define MCF_LCDC_LSCR_PS_RISE_DELAY(x) (((x)&0x0000003F)<<26)
1868#define MCF_LCDC_LSCR_CLS_RISE_DELAY(x) (((x)&0x000000FF)<<16)
1869#define MCF_LCDC_LSCR_REV_TOGGLE_DELAY(x) (((x)&0x0000000F)<<8)
1870#define MCF_LCDC_LSCR_GRAY_2(x) (((x)&0x0000000F)<<4)
1871#define MCF_LCDC_LSCR_GRAY_1(x) (((x)&0x0000000F)<<0)
1872
1873/* Bit definitions and macros for MCF_LCDC_BPLUT_BASE */
1874#define MCF_LCDC_BPLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1875
1876/* Bit definitions and macros for MCF_LCDC_GWLUT_BASE */
1877#define MCF_LCDC_GWLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1878
1879/*********************************************************************
1880 *
1881 * Phase Locked Loop (PLL)
1882 *
1883 *********************************************************************/
1884
1885/* Register read/write macros */
1886#define MCF_PLL_PODR MCF_REG08(0xFC0C0000)
1887#define MCF_PLL_PLLCR MCF_REG08(0xFC0C0004)
1888#define MCF_PLL_PMDR MCF_REG08(0xFC0C0008)
1889#define MCF_PLL_PFDR MCF_REG08(0xFC0C000C)
1890
1891/* Bit definitions and macros for MCF_PLL_PODR */
1892#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0)
1893#define MCF_PLL_PODR_CPUDIV(x) (((x)&0x0F)<<4)
1894
1895/* Bit definitions and macros for MCF_PLL_PLLCR */
1896#define MCF_PLL_PLLCR_DITHDEV(x) (((x)&0x07)<<0)
1897#define MCF_PLL_PLLCR_DITHEN (0x80)
1898
1899/* Bit definitions and macros for MCF_PLL_PMDR */
1900#define MCF_PLL_PMDR_MODDIV(x) (((x)&0xFF)<<0)
1901
1902/* Bit definitions and macros for MCF_PLL_PFDR */
1903#define MCF_PLL_PFDR_MFD(x) (((x)&0xFF)<<0)
1904
1905/*********************************************************************
1906 *
1907 * System Control Module Registers (SCM)
1908 *
1909 *********************************************************************/
1910
1911/* Register read/write macros */
1912#define MCF_SCM_MPR MCF_REG32(0xFC000000)
1913#define MCF_SCM_PACRA MCF_REG32(0xFC000020)
1914#define MCF_SCM_PACRB MCF_REG32(0xFC000024)
1915#define MCF_SCM_PACRC MCF_REG32(0xFC000028)
1916#define MCF_SCM_PACRD MCF_REG32(0xFC00002C)
1917#define MCF_SCM_PACRE MCF_REG32(0xFC000040)
1918#define MCF_SCM_PACRF MCF_REG32(0xFC000044)
1919
1920#define MCF_SCM_BCR MCF_REG32(0xFC040024)
1921
1922/*********************************************************************
1923 *
1924 * SDRAM Controller (SDRAMC)
1925 *
1926 *********************************************************************/
1927
1928/* Register read/write macros */
1929#define MCF_SDRAMC_SDMR MCF_REG32(0xFC0B8000)
1930#define MCF_SDRAMC_SDCR MCF_REG32(0xFC0B8004)
1931#define MCF_SDRAMC_SDCFG1 MCF_REG32(0xFC0B8008)
1932#define MCF_SDRAMC_SDCFG2 MCF_REG32(0xFC0B800C)
1933#define MCF_SDRAMC_LIMP_FIX MCF_REG32(0xFC0B8080)
1934#define MCF_SDRAMC_SDDS MCF_REG32(0xFC0B8100)
1935#define MCF_SDRAMC_SDCS0 MCF_REG32(0xFC0B8110)
1936#define MCF_SDRAMC_SDCS1 MCF_REG32(0xFC0B8114)
1937#define MCF_SDRAMC_SDCS2 MCF_REG32(0xFC0B8118)
1938#define MCF_SDRAMC_SDCS3 MCF_REG32(0xFC0B811C)
1939#define MCF_SDRAMC_SDCS(x) MCF_REG32(0xFC0B8110+((x)*0x004))
1940
1941/* Bit definitions and macros for MCF_SDRAMC_SDMR */
1942#define MCF_SDRAMC_SDMR_CMD (0x00010000)
1943#define MCF_SDRAMC_SDMR_AD(x) (((x)&0x00000FFF)<<18)
1944#define MCF_SDRAMC_SDMR_BNKAD(x) (((x)&0x00000003)<<30)
1945#define MCF_SDRAMC_SDMR_BNKAD_LMR (0x00000000)
1946#define MCF_SDRAMC_SDMR_BNKAD_LEMR (0x40000000)
1947
1948/* Bit definitions and macros for MCF_SDRAMC_SDCR */
1949#define MCF_SDRAMC_SDCR_IPALL (0x00000002)
1950#define MCF_SDRAMC_SDCR_IREF (0x00000004)
1951#define MCF_SDRAMC_SDCR_DQS_OE(x) (((x)&0x0000000F)<<8)
1952#define MCF_SDRAMC_SDCR_PS(x) (((x)&0x00000003)<<12)
1953#define MCF_SDRAMC_SDCR_RCNT(x) (((x)&0x0000003F)<<16)
1954#define MCF_SDRAMC_SDCR_OE_RULE (0x00400000)
1955#define MCF_SDRAMC_SDCR_MUX(x) (((x)&0x00000003)<<24)
1956#define MCF_SDRAMC_SDCR_REF (0x10000000)
1957#define MCF_SDRAMC_SDCR_DDR (0x20000000)
1958#define MCF_SDRAMC_SDCR_CKE (0x40000000)
1959#define MCF_SDRAMC_SDCR_MODE_EN (0x80000000)
1960#define MCF_SDRAMC_SDCR_PS_16 (0x00002000)
1961#define MCF_SDRAMC_SDCR_PS_32 (0x00000000)
1962
1963/* Bit definitions and macros for MCF_SDRAMC_SDCFG1 */
1964#define MCF_SDRAMC_SDCFG1_WTLAT(x) (((x)&0x00000007)<<4)
1965#define MCF_SDRAMC_SDCFG1_REF2ACT(x) (((x)&0x0000000F)<<8)
1966#define MCF_SDRAMC_SDCFG1_PRE2ACT(x) (((x)&0x00000007)<<12)
1967#define MCF_SDRAMC_SDCFG1_ACT2RW(x) (((x)&0x00000007)<<16)
1968#define MCF_SDRAMC_SDCFG1_RDLAT(x) (((x)&0x0000000F)<<20)
1969#define MCF_SDRAMC_SDCFG1_SWT2RD(x) (((x)&0x00000007)<<24)
1970#define MCF_SDRAMC_SDCFG1_SRD2RW(x) (((x)&0x0000000F)<<28)
1971
1972/* Bit definitions and macros for MCF_SDRAMC_SDCFG2 */
1973#define MCF_SDRAMC_SDCFG2_BL(x) (((x)&0x0000000F)<<16)
1974#define MCF_SDRAMC_SDCFG2_BRD2WT(x) (((x)&0x0000000F)<<20)
1975#define MCF_SDRAMC_SDCFG2_BWT2RW(x) (((x)&0x0000000F)<<24)
1976#define MCF_SDRAMC_SDCFG2_BRD2PRE(x) (((x)&0x0000000F)<<28)
1977
1978/* Device Errata - LIMP mode work around */
1979#define MCF_SDRAMC_REFRESH (0x40000000)
1980
1981/* Bit definitions and macros for MCF_SDRAMC_SDDS */
1982#define MCF_SDRAMC_SDDS_SB_D(x) (((x)&0x00000003)<<0)
1983#define MCF_SDRAMC_SDDS_SB_S(x) (((x)&0x00000003)<<2)
1984#define MCF_SDRAMC_SDDS_SB_A(x) (((x)&0x00000003)<<4)
1985#define MCF_SDRAMC_SDDS_SB_C(x) (((x)&0x00000003)<<6)
1986#define MCF_SDRAMC_SDDS_SB_E(x) (((x)&0x00000003)<<8)
1987
1988/* Bit definitions and macros for MCF_SDRAMC_SDCS */
1989#define MCF_SDRAMC_SDCS_CSSZ(x) (((x)&0x0000001F)<<0)
1990#define MCF_SDRAMC_SDCS_BASE(x) (((x)&0x00000FFF)<<20)
1991#define MCF_SDRAMC_SDCS_BA(x) ((x)&0xFFF00000)
1992#define MCF_SDRAMC_SDCS_CSSZ_DIABLE (0x00000000)
1993#define MCF_SDRAMC_SDCS_CSSZ_1MBYTE (0x00000013)
1994#define MCF_SDRAMC_SDCS_CSSZ_2MBYTE (0x00000014)
1995#define MCF_SDRAMC_SDCS_CSSZ_4MBYTE (0x00000015)
1996#define MCF_SDRAMC_SDCS_CSSZ_8MBYTE (0x00000016)
1997#define MCF_SDRAMC_SDCS_CSSZ_16MBYTE (0x00000017)
1998#define MCF_SDRAMC_SDCS_CSSZ_32MBYTE (0x00000018)
1999#define MCF_SDRAMC_SDCS_CSSZ_64MBYTE (0x00000019)
2000#define MCF_SDRAMC_SDCS_CSSZ_128MBYTE (0x0000001A)
2001#define MCF_SDRAMC_SDCS_CSSZ_256MBYTE (0x0000001B)
2002#define MCF_SDRAMC_SDCS_CSSZ_512MBYTE (0x0000001C)
2003#define MCF_SDRAMC_SDCS_CSSZ_1GBYTE (0x0000001D)
2004#define MCF_SDRAMC_SDCS_CSSZ_2GBYTE (0x0000001E)
2005#define MCF_SDRAMC_SDCS_CSSZ_4GBYTE (0x0000001F)
2006
2007/*********************************************************************
2008 *
2009 * FlexCAN module registers
2010 *
2011 *********************************************************************/
2012#define MCF_FLEXCAN_BASEADDR(x) (0xFC020000+(x)*0x0800)
2013#define MCF_FLEXCAN_CANMCR(x) MCF_REG32(0xFC020000+(x)*0x0800+0x00)
2014#define MCF_FLEXCAN_CANCTRL(x) MCF_REG32(0xFC020000+(x)*0x0800+0x04)
2015#define MCF_FLEXCAN_TIMER(x) MCF_REG32(0xFC020000+(x)*0x0800+0x08)
2016#define MCF_FLEXCAN_RXGMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x10)
2017#define MCF_FLEXCAN_RX14MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x14)
2018#define MCF_FLEXCAN_RX15MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x18)
2019#define MCF_FLEXCAN_ERRCNT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x1C)
2020#define MCF_FLEXCAN_ERRSTAT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x20)
2021#define MCF_FLEXCAN_IMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x28)
2022#define MCF_FLEXCAN_IFLAG(x) MCF_REG32(0xFC020000+(x)*0x0800+0x30)
2023
2024#define MCF_FLEXCAN_MB_CNT(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x0)
2025#define MCF_FLEXCAN_MB_ID(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x4)
2026#define MCF_FLEXCAN_MB_DB(x,y,z) MCF_REG08(0xFC020080+(x)*0x0800+(y)*0x10+0x8+(z)*0x1)
2027
2028/*
2029 * FlexCAN Module Configuration Register
2030 */
2031#define CANMCR_MDIS (0x80000000)
2032#define CANMCR_FRZ (0x40000000)
2033#define CANMCR_HALT (0x10000000)
2034#define CANMCR_SOFTRST (0x02000000)
2035#define CANMCR_FRZACK (0x01000000)
2036#define CANMCR_SUPV (0x00800000)
2037#define CANMCR_MAXMB(x) ((x)&0x0F)
2038
2039/*
2040 * FlexCAN Control Register
2041 */
2042#define CANCTRL_PRESDIV(x) (((x)&0xFF)<<24)
2043#define CANCTRL_RJW(x) (((x)&0x03)<<22)
2044#define CANCTRL_PSEG1(x) (((x)&0x07)<<19)
2045#define CANCTRL_PSEG2(x) (((x)&0x07)<<16)
2046#define CANCTRL_BOFFMSK (0x00008000)
2047#define CANCTRL_ERRMSK (0x00004000)
2048#define CANCTRL_CLKSRC (0x00002000)
2049#define CANCTRL_LPB (0x00001000)
2050#define CANCTRL_SAMP (0x00000080)
2051#define CANCTRL_BOFFREC (0x00000040)
2052#define CANCTRL_TSYNC (0x00000020)
2053#define CANCTRL_LBUF (0x00000010)
2054#define CANCTRL_LOM (0x00000008)
2055#define CANCTRL_PROPSEG(x) ((x)&0x07)
2056
2057/*
2058 * FlexCAN Error Counter Register
2059 */
2060#define ERRCNT_RXECTR(x) (((x)&0xFF)<<8)
2061#define ERRCNT_TXECTR(x) ((x)&0xFF)
2062
2063/*
2064 * FlexCAN Error and Status Register
2065 */
2066#define ERRSTAT_BITERR(x) (((x)&0x03)<<14)
2067#define ERRSTAT_ACKERR (0x00002000)
2068#define ERRSTAT_CRCERR (0x00001000)
2069#define ERRSTAT_FRMERR (0x00000800)
2070#define ERRSTAT_STFERR (0x00000400)
2071#define ERRSTAT_TXWRN (0x00000200)
2072#define ERRSTAT_RXWRN (0x00000100)
2073#define ERRSTAT_IDLE (0x00000080)
2074#define ERRSTAT_TXRX (0x00000040)
2075#define ERRSTAT_FLTCONF(x) (((x)&0x03)<<4)
2076#define ERRSTAT_BOFFINT (0x00000004)
2077#define ERRSTAT_ERRINT (0x00000002)
2078
2079/*
2080 * Interrupt Mask Register
2081 */
2082#define IMASK_BUF15M (0x8000)
2083#define IMASK_BUF14M (0x4000)
2084#define IMASK_BUF13M (0x2000)
2085#define IMASK_BUF12M (0x1000)
2086#define IMASK_BUF11M (0x0800)
2087#define IMASK_BUF10M (0x0400)
2088#define IMASK_BUF9M (0x0200)
2089#define IMASK_BUF8M (0x0100)
2090#define IMASK_BUF7M (0x0080)
2091#define IMASK_BUF6M (0x0040)
2092#define IMASK_BUF5M (0x0020)
2093#define IMASK_BUF4M (0x0010)
2094#define IMASK_BUF3M (0x0008)
2095#define IMASK_BUF2M (0x0004)
2096#define IMASK_BUF1M (0x0002)
2097#define IMASK_BUF0M (0x0001)
2098#define IMASK_BUFnM(x) (0x1<<(x))
2099#define IMASK_BUFF_ENABLE_ALL (0x1111)
2100#define IMASK_BUFF_DISABLE_ALL (0x0000)
2101
2102/*
2103 * Interrupt Flag Register
2104 */
2105#define IFLAG_BUF15M (0x8000)
2106#define IFLAG_BUF14M (0x4000)
2107#define IFLAG_BUF13M (0x2000)
2108#define IFLAG_BUF12M (0x1000)
2109#define IFLAG_BUF11M (0x0800)
2110#define IFLAG_BUF10M (0x0400)
2111#define IFLAG_BUF9M (0x0200)
2112#define IFLAG_BUF8M (0x0100)
2113#define IFLAG_BUF7M (0x0080)
2114#define IFLAG_BUF6M (0x0040)
2115#define IFLAG_BUF5M (0x0020)
2116#define IFLAG_BUF4M (0x0010)
2117#define IFLAG_BUF3M (0x0008)
2118#define IFLAG_BUF2M (0x0004)
2119#define IFLAG_BUF1M (0x0002)
2120#define IFLAG_BUF0M (0x0001)
2121#define IFLAG_BUFF_SET_ALL (0xFFFF)
2122#define IFLAG_BUFF_CLEAR_ALL (0x0000)
2123#define IFLAG_BUFnM(x) (0x1<<(x))
2124
2125/*
2126 * Message Buffers
2127 */
2128#define MB_CNT_CODE(x) (((x)&0x0F)<<24)
2129#define MB_CNT_SRR (0x00400000)
2130#define MB_CNT_IDE (0x00200000)
2131#define MB_CNT_RTR (0x00100000)
2132#define MB_CNT_LENGTH(x) (((x)&0x0F)<<16)
2133#define MB_CNT_TIMESTAMP(x) ((x)&0xFFFF)
2134#define MB_ID_STD(x) (((x)&0x07FF)<<18)
2135#define MB_ID_EXT(x) ((x)&0x3FFFF)
2136
2137/*********************************************************************
2138 *
2139 * Edge Port Module (EPORT)
2140 *
2141 *********************************************************************/
2142
2143/* Register read/write macros */
2144#define MCF_EPORT_EPPAR MCF_REG16(0xFC094000)
2145#define MCF_EPORT_EPDDR MCF_REG08(0xFC094002)
2146#define MCF_EPORT_EPIER MCF_REG08(0xFC094003)
2147#define MCF_EPORT_EPDR MCF_REG08(0xFC094004)
2148#define MCF_EPORT_EPPDR MCF_REG08(0xFC094005)
2149#define MCF_EPORT_EPFR MCF_REG08(0xFC094006)
2150
2151/* Bit definitions and macros for MCF_EPORT_EPPAR */
2152#define MCF_EPORT_EPPAR_EPPA1(x) (((x)&0x0003)<<2)
2153#define MCF_EPORT_EPPAR_EPPA2(x) (((x)&0x0003)<<4)
2154#define MCF_EPORT_EPPAR_EPPA3(x) (((x)&0x0003)<<6)
2155#define MCF_EPORT_EPPAR_EPPA4(x) (((x)&0x0003)<<8)
2156#define MCF_EPORT_EPPAR_EPPA5(x) (((x)&0x0003)<<10)
2157#define MCF_EPORT_EPPAR_EPPA6(x) (((x)&0x0003)<<12)
2158#define MCF_EPORT_EPPAR_EPPA7(x) (((x)&0x0003)<<14)
2159#define MCF_EPORT_EPPAR_LEVEL (0)
2160#define MCF_EPORT_EPPAR_RISING (1)
2161#define MCF_EPORT_EPPAR_FALLING (2)
2162#define MCF_EPORT_EPPAR_BOTH (3)
2163#define MCF_EPORT_EPPAR_EPPA7_LEVEL (0x0000)
2164#define MCF_EPORT_EPPAR_EPPA7_RISING (0x4000)
2165#define MCF_EPORT_EPPAR_EPPA7_FALLING (0x8000)
2166#define MCF_EPORT_EPPAR_EPPA7_BOTH (0xC000)
2167#define MCF_EPORT_EPPAR_EPPA6_LEVEL (0x0000)
2168#define MCF_EPORT_EPPAR_EPPA6_RISING (0x1000)
2169#define MCF_EPORT_EPPAR_EPPA6_FALLING (0x2000)
2170#define MCF_EPORT_EPPAR_EPPA6_BOTH (0x3000)
2171#define MCF_EPORT_EPPAR_EPPA5_LEVEL (0x0000)
2172#define MCF_EPORT_EPPAR_EPPA5_RISING (0x0400)
2173#define MCF_EPORT_EPPAR_EPPA5_FALLING (0x0800)
2174#define MCF_EPORT_EPPAR_EPPA5_BOTH (0x0C00)
2175#define MCF_EPORT_EPPAR_EPPA4_LEVEL (0x0000)
2176#define MCF_EPORT_EPPAR_EPPA4_RISING (0x0100)
2177#define MCF_EPORT_EPPAR_EPPA4_FALLING (0x0200)
2178#define MCF_EPORT_EPPAR_EPPA4_BOTH (0x0300)
2179#define MCF_EPORT_EPPAR_EPPA3_LEVEL (0x0000)
2180#define MCF_EPORT_EPPAR_EPPA3_RISING (0x0040)
2181#define MCF_EPORT_EPPAR_EPPA3_FALLING (0x0080)
2182#define MCF_EPORT_EPPAR_EPPA3_BOTH (0x00C0)
2183#define MCF_EPORT_EPPAR_EPPA2_LEVEL (0x0000)
2184#define MCF_EPORT_EPPAR_EPPA2_RISING (0x0010)
2185#define MCF_EPORT_EPPAR_EPPA2_FALLING (0x0020)
2186#define MCF_EPORT_EPPAR_EPPA2_BOTH (0x0030)
2187#define MCF_EPORT_EPPAR_EPPA1_LEVEL (0x0000)
2188#define MCF_EPORT_EPPAR_EPPA1_RISING (0x0004)
2189#define MCF_EPORT_EPPAR_EPPA1_FALLING (0x0008)
2190#define MCF_EPORT_EPPAR_EPPA1_BOTH (0x000C)
2191
2192/* Bit definitions and macros for MCF_EPORT_EPDDR */
2193#define MCF_EPORT_EPDDR_EPDD1 (0x02)
2194#define MCF_EPORT_EPDDR_EPDD2 (0x04)
2195#define MCF_EPORT_EPDDR_EPDD3 (0x08)
2196#define MCF_EPORT_EPDDR_EPDD4 (0x10)
2197#define MCF_EPORT_EPDDR_EPDD5 (0x20)
2198#define MCF_EPORT_EPDDR_EPDD6 (0x40)
2199#define MCF_EPORT_EPDDR_EPDD7 (0x80)
2200
2201/* Bit definitions and macros for MCF_EPORT_EPIER */
2202#define MCF_EPORT_EPIER_EPIE1 (0x02)
2203#define MCF_EPORT_EPIER_EPIE2 (0x04)
2204#define MCF_EPORT_EPIER_EPIE3 (0x08)
2205#define MCF_EPORT_EPIER_EPIE4 (0x10)
2206#define MCF_EPORT_EPIER_EPIE5 (0x20)
2207#define MCF_EPORT_EPIER_EPIE6 (0x40)
2208#define MCF_EPORT_EPIER_EPIE7 (0x80)
2209
2210/* Bit definitions and macros for MCF_EPORT_EPDR */
2211#define MCF_EPORT_EPDR_EPD1 (0x02)
2212#define MCF_EPORT_EPDR_EPD2 (0x04)
2213#define MCF_EPORT_EPDR_EPD3 (0x08)
2214#define MCF_EPORT_EPDR_EPD4 (0x10)
2215#define MCF_EPORT_EPDR_EPD5 (0x20)
2216#define MCF_EPORT_EPDR_EPD6 (0x40)
2217#define MCF_EPORT_EPDR_EPD7 (0x80)
2218
2219/* Bit definitions and macros for MCF_EPORT_EPPDR */
2220#define MCF_EPORT_EPPDR_EPPD1 (0x02)
2221#define MCF_EPORT_EPPDR_EPPD2 (0x04)
2222#define MCF_EPORT_EPPDR_EPPD3 (0x08)
2223#define MCF_EPORT_EPPDR_EPPD4 (0x10)
2224#define MCF_EPORT_EPPDR_EPPD5 (0x20)
2225#define MCF_EPORT_EPPDR_EPPD6 (0x40)
2226#define MCF_EPORT_EPPDR_EPPD7 (0x80)
2227
2228/* Bit definitions and macros for MCF_EPORT_EPFR */
2229#define MCF_EPORT_EPFR_EPF1 (0x02)
2230#define MCF_EPORT_EPFR_EPF2 (0x04)
2231#define MCF_EPORT_EPFR_EPF3 (0x08)
2232#define MCF_EPORT_EPFR_EPF4 (0x10)
2233#define MCF_EPORT_EPFR_EPF5 (0x20)
2234#define MCF_EPORT_EPFR_EPF6 (0x40)
2235#define MCF_EPORT_EPFR_EPF7 (0x80)
2236
2237/********************************************************************/
2238#endif /* m532xsim_h */
diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h
index 45d1ac57ea..7b61a8a529 100644
--- a/include/asm-m68knommu/mcfcache.h
+++ b/include/asm-m68knommu/mcfcache.h
@@ -92,6 +92,21 @@
92.endm 92.endm
93#endif /* CONFIG_M5249 || CONFIG_M5307 */ 93#endif /* CONFIG_M5249 || CONFIG_M5307 */
94 94
95#if defined(CONFIG_M532x)
96.macro CACHE_ENABLE
97 movel #0x01000000,%d0 /* invalidate cache cmd */
98 movec %d0,%CACR /* do invalidate cache */
99 nop
100 movel #0x4001C000,%d0 /* set SDRAM cached (write-thru) */
101 movec %d0,%ACR0
102 movel #0x00000000,%d0 /* no other regions cached */
103 movec %d0,%ACR1
104 movel #0x80000200,%d0 /* setup cache mask */
105 movec %d0,%CACR /* enable cache */
106 nop
107.endm
108#endif /* CONFIG_M532x */
109
95#if defined(CONFIG_M5407) 110#if defined(CONFIG_M5407)
96/* 111/*
97 * Version 4 cores have a true harvard style separate instruction 112 * Version 4 cores have a true harvard style separate instruction
diff --git a/include/asm-m68knommu/mcfpit.h b/include/asm-m68knommu/mcfpit.h
index 0d2672dd51..f570cf64fd 100644
--- a/include/asm-m68knommu/mcfpit.h
+++ b/include/asm-m68knommu/mcfpit.h
@@ -28,11 +28,9 @@
28/* 28/*
29 * Define the PIT timer register set addresses. 29 * Define the PIT timer register set addresses.
30 */ 30 */
31struct mcfpit { 31#define MCFPIT_PCSR 0x0 /* PIT control register */
32 unsigned short pcsr; /* PIT control and status */ 32#define MCFPIT_PMR 0x2 /* PIT modulus register */
33 unsigned short pmr; /* PIT modulus register */ 33#define MCFPIT_PCNTR 0x4 /* PIT count register */
34 unsigned short pcntr; /* PIT count register */
35} __attribute__((packed));
36 34
37/* 35/*
38 * Bit definitions for the PIT Control and Status register. 36 * Bit definitions for the PIT Control and Status register.
diff --git a/include/asm-m68knommu/mcfsim.h b/include/asm-m68knommu/mcfsim.h
index 97a0c2734a..1074ae717f 100644
--- a/include/asm-m68knommu/mcfsim.h
+++ b/include/asm-m68knommu/mcfsim.h
@@ -35,6 +35,8 @@
35#include <asm/m528xsim.h> 35#include <asm/m528xsim.h>
36#elif defined(CONFIG_M5307) 36#elif defined(CONFIG_M5307)
37#include <asm/m5307sim.h> 37#include <asm/m5307sim.h>
38#elif defined(CONFIG_M532x)
39#include <asm/m532xsim.h>
38#elif defined(CONFIG_M5407) 40#elif defined(CONFIG_M5407)
39#include <asm/m5407sim.h> 41#include <asm/m5407sim.h>
40#endif 42#endif
@@ -100,6 +102,7 @@
100#define MCFSIM_IMR_MASKALL 0x3ffe /* All intr sources */ 102#define MCFSIM_IMR_MASKALL 0x3ffe /* All intr sources */
101#endif 103#endif
102 104
105
103/* 106/*
104 * PIT interrupt settings, if not found in mXXXXsim.h file. 107 * PIT interrupt settings, if not found in mXXXXsim.h file.
105 */ 108 */
diff --git a/include/asm-m68knommu/mcftimer.h b/include/asm-m68knommu/mcftimer.h
index 68bf33ac10..6f4d796e03 100644
--- a/include/asm-m68knommu/mcftimer.h
+++ b/include/asm-m68knommu/mcftimer.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * mcftimer.h -- ColdFire internal TIMER support defines. 4 * mcftimer.h -- ColdFire internal TIMER support defines.
5 * 5 *
6 * (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 1999-2006, Greg Ungerer <gerg@snapgear.com>
7 * (C) Copyright 2000, Lineo Inc. (www.lineo.com) 7 * (C) Copyright 2000, Lineo Inc. (www.lineo.com)
8 */ 8 */
9 9
@@ -27,6 +27,11 @@
27#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) 27#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407)
28#define MCFTIMER_BASE1 0x140 /* Base address of TIMER1 */ 28#define MCFTIMER_BASE1 0x140 /* Base address of TIMER1 */
29#define MCFTIMER_BASE2 0x180 /* Base address of TIMER2 */ 29#define MCFTIMER_BASE2 0x180 /* Base address of TIMER2 */
30#elif defined(CONFIG_M532x)
31#define MCFTIMER_BASE1 0xfc070000 /* Base address of TIMER1 */
32#define MCFTIMER_BASE2 0xfc074000 /* Base address of TIMER2 */
33#define MCFTIMER_BASE3 0xfc078000 /* Base address of TIMER3 */
34#define MCFTIMER_BASE4 0xfc07c000 /* Base address of TIMER4 */
30#endif 35#endif
31 36
32 37
@@ -34,23 +39,14 @@
34 * Define the TIMER register set addresses. 39 * Define the TIMER register set addresses.
35 */ 40 */
36#define MCFTIMER_TMR 0x00 /* Timer Mode reg (r/w) */ 41#define MCFTIMER_TMR 0x00 /* Timer Mode reg (r/w) */
37#define MCFTIMER_TRR 0x02 /* Timer Reference (r/w) */ 42#define MCFTIMER_TRR 0x04 /* Timer Reference (r/w) */
38#define MCFTIMER_TCR 0x04 /* Timer Capture reg (r/w) */ 43#define MCFTIMER_TCR 0x08 /* Timer Capture reg (r/w) */
39#define MCFTIMER_TCN 0x06 /* Timer Counter reg (r/w) */ 44#define MCFTIMER_TCN 0x0C /* Timer Counter reg (r/w) */
45#if defined(CONFIG_M532x)
46#define MCFTIMER_TER 0x03 /* Timer Event reg (r/w) */
47#else
40#define MCFTIMER_TER 0x11 /* Timer Event reg (r/w) */ 48#define MCFTIMER_TER 0x11 /* Timer Event reg (r/w) */
41 49#endif
42struct mcftimer {
43 unsigned short tmr; /* Timer Mode reg (r/w) */
44 unsigned short reserved1;
45 unsigned short trr; /* Timer Reference (r/w) */
46 unsigned short reserved2;
47 unsigned short tcr; /* Timer Capture reg (r/w) */
48 unsigned short reserved3;
49 unsigned short tcn; /* Timer Counter reg (r/w) */
50 unsigned short reserved4;
51 unsigned char reserved5;
52 unsigned char ter; /* Timer Event reg (r/w) */
53} __attribute__((packed));
54 50
55/* 51/*
56 * Bit definitions for the Timer Mode Register (TMR). 52 * Bit definitions for the Timer Mode Register (TMR).
diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h
index 8040e43786..dc0146c525 100644
--- a/include/asm-m68knommu/mcfuart.h
+++ b/include/asm-m68knommu/mcfuart.h
@@ -44,6 +44,10 @@
44#define MCFUART_BASE1 0x60000 /* Base address of UART1 */ 44#define MCFUART_BASE1 0x60000 /* Base address of UART1 */
45#define MCFUART_BASE2 0x64000 /* Base address of UART2 */ 45#define MCFUART_BASE2 0x64000 /* Base address of UART2 */
46#define MCFUART_BASE3 0x68000 /* Base address of UART2 */ 46#define MCFUART_BASE3 0x68000 /* Base address of UART2 */
47#elif defined(CONFIG_M532x)
48#define MCFUART_BASE1 0xfc060000 /* Base address of UART1 */
49#define MCFUART_BASE2 0xfc064000 /* Base address of UART2 */
50#define MCFUART_BASE3 0xfc068000 /* Base address of UART3 */
47#endif 51#endif
48 52
49 53
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h
index a22bf5a881..2a1b8bdcb2 100644
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -1,6 +1,7 @@
1#ifndef _M68KNOMMU_PAGE_H 1#ifndef _M68KNOMMU_PAGE_H
2#define _M68KNOMMU_PAGE_H 2#define _M68KNOMMU_PAGE_H
3 3
4#ifdef __KERNEL__
4 5
5/* PAGE_SHIFT determines the page size */ 6/* PAGE_SHIFT determines the page size */
6 7
@@ -8,8 +9,6 @@
8#define PAGE_SIZE (1UL << PAGE_SHIFT) 9#define PAGE_SIZE (1UL << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1)) 10#define PAGE_MASK (~(PAGE_SIZE-1))
10 11
11#ifdef __KERNEL__
12
13#include <asm/setup.h> 12#include <asm/setup.h>
14 13
15#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
@@ -76,8 +75,8 @@ extern unsigned long memory_end;
76 75
77#endif /* __ASSEMBLY__ */ 76#endif /* __ASSEMBLY__ */
78 77
79#endif /* __KERNEL__ */
80
81#include <asm-generic/page.h> 78#include <asm-generic/page.h>
82 79
80#endif /* __KERNEL__ */
81
83#endif /* _M68KNOMMU_PAGE_H */ 82#endif /* _M68KNOMMU_PAGE_H */
diff --git a/include/asm-m68knommu/page_offset.h b/include/asm-m68knommu/page_offset.h
index 8ed6d7b7d9..d4e73e0ba6 100644
--- a/include/asm-m68knommu/page_offset.h
+++ b/include/asm-m68knommu/page_offset.h
@@ -1,46 +1,5 @@
1 1
2 2
3/* This handles the memory map.. */ 3/* This handles the memory map.. */
4 4#define PAGE_OFFSET_RAW CONFIG_RAMBASE
5#ifdef CONFIG_COLDFIRE
6#if defined(CONFIG_SMALL)
7#define PAGE_OFFSET_RAW 0x30020000
8#elif defined(CONFIG_CFV240)
9#define PAGE_OFFSET_RAW 0x02000000
10#else
11#define PAGE_OFFSET_RAW 0x00000000
12#endif
13#endif
14
15#ifdef CONFIG_M68360
16#define PAGE_OFFSET_RAW 0x00000000
17#endif
18
19#ifdef CONFIG_PILOT
20#ifdef CONFIG_M68328
21#define PAGE_OFFSET_RAW 0x10000000
22#endif
23#ifdef CONFIG_M68EZ328
24#define PAGE_OFFSET_RAW 0x00000000
25#endif
26#endif
27#ifdef CONFIG_UCSIMM
28#define PAGE_OFFSET_RAW 0x00000000
29#endif
30
31#if defined(CONFIG_UCDIMM) || defined(CONFIG_DRAGEN2)
32#ifdef CONFIG_M68VZ328
33#define PAGE_OFFSET_RAW 0x00000000
34#endif /* CONFIG_M68VZ328 */
35#endif /* CONFIG_UCDIMM */
36
37#ifdef CONFIG_M68EZ328ADS
38#define PAGE_OFFSET_RAW 0x00000000
39#endif
40#ifdef CONFIG_ALMA_ANS
41#define PAGE_OFFSET_RAW 0x00000000
42#endif
43#ifdef CONFIG_M68EN302
44#define PAGE_OFFSET_RAW 0x00000000
45#endif
46 5
diff --git a/include/asm-m68knommu/processor.h b/include/asm-m68knommu/processor.h
index 278b00bc60..9d3a1bf412 100644
--- a/include/asm-m68knommu/processor.h
+++ b/include/asm-m68knommu/processor.h
@@ -13,6 +13,7 @@
13 */ 13 */
14#define current_text_addr() ({ __label__ _l; _l: &&_l;}) 14#define current_text_addr() ({ __label__ _l; _l: &&_l;})
15 15
16#include <linux/compiler.h>
16#include <linux/threads.h> 17#include <linux/threads.h>
17#include <asm/types.h> 18#include <asm/types.h>
18#include <asm/segment.h> 19#include <asm/segment.h>
@@ -78,19 +79,31 @@ struct thread_struct {
78} 79}
79 80
80/* 81/*
82 * Coldfire stacks need to be re-aligned on trap exit, conventional
83 * 68k can handle this case cleanly.
84 */
85#if defined(CONFIG_COLDFIRE)
86#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
87#else
88#define reformat(_regs) do { } while (0)
89#endif
90
91/*
81 * Do necessary setup to start up a newly executed thread. 92 * Do necessary setup to start up a newly executed thread.
82 * 93 *
83 * pass the data segment into user programs if it exists, 94 * pass the data segment into user programs if it exists,
84 * it can't hurt anything as far as I can tell 95 * it can't hurt anything as far as I can tell
85 */ 96 */
86#define start_thread(_regs, _pc, _usp) \ 97#define start_thread(_regs, _pc, _usp) \
87do { \ 98do { \
88 set_fs(USER_DS); /* reads from user space */ \ 99 set_fs(USER_DS); /* reads from user space */ \
89 (_regs)->pc = (_pc); \ 100 (_regs)->pc = (_pc); \
90 if (current->mm) \ 101 ((struct switch_stack *)(_regs))[-1].a6 = 0; \
91 (_regs)->d5 = current->mm->start_data; \ 102 reformat(_regs); \
92 (_regs)->sr &= ~0x2000; \ 103 if (current->mm) \
93 wrusp(_usp); \ 104 (_regs)->d5 = current->mm->start_data; \
105 (_regs)->sr &= ~0x2000; \
106 wrusp(_usp); \
94} while(0) 107} while(0)
95 108
96/* Forward declaration, a strange C thing */ 109/* Forward declaration, a strange C thing */
@@ -125,6 +138,6 @@ unsigned long get_wchan(struct task_struct *p);
125 eip; }) 138 eip; })
126#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 139#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
127 140
128#define cpu_relax() do { } while (0) 141#define cpu_relax() barrier()
129 142
130#endif 143#endif
diff --git a/include/asm-m68knommu/ptrace.h b/include/asm-m68knommu/ptrace.h
index 1e19c457de..47258e86e8 100644
--- a/include/asm-m68knommu/ptrace.h
+++ b/include/asm-m68knommu/ptrace.h
@@ -46,11 +46,9 @@ struct pt_regs {
46#else 46#else
47 unsigned short sr; 47 unsigned short sr;
48 unsigned long pc; 48 unsigned long pc;
49#ifndef NO_FORMAT_VEC
50 unsigned format : 4; /* frame format specifier */ 49 unsigned format : 4; /* frame format specifier */
51 unsigned vector : 12; /* vector offset */ 50 unsigned vector : 12; /* vector offset */
52#endif 51#endif
53#endif
54}; 52};
55 53
56/* 54/*
diff --git a/include/asm-m68knommu/signal.h b/include/asm-m68knommu/signal.h
index 1d13187f60..216c08be54 100644
--- a/include/asm-m68knommu/signal.h
+++ b/include/asm-m68knommu/signal.h
@@ -74,7 +74,6 @@ typedef unsigned long sigset_t;
74 * SA_FLAGS values: 74 * SA_FLAGS values:
75 * 75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used. 76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago) 77 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered. 79 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -94,7 +93,6 @@ typedef unsigned long sigset_t;
94 93
95#define SA_NOMASK SA_NODEFER 94#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND 95#define SA_ONESHOT SA_RESETHAND
97#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
98 96
99/* 97/*
100 * sigaltstack controls 98 * sigaltstack controls
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index 2bbe2db00a..2a81449867 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -106,7 +106,6 @@ asmlinkage void resume(void);
106#define wmb() asm volatile ("" : : :"memory") 106#define wmb() asm volatile ("" : : :"memory")
107#define set_rmb(var, value) do { xchg(&var, value); } while (0) 107#define set_rmb(var, value) do { xchg(&var, value); } while (0)
108#define set_mb(var, value) set_rmb(var, value) 108#define set_mb(var, value) set_rmb(var, value)
109#define set_wmb(var, value) do { var = value; wmb(); } while (0)
110 109
111#ifdef CONFIG_SMP 110#ifdef CONFIG_SMP
112#define smp_mb() mb() 111#define smp_mb() mb()
diff --git a/include/asm-m68knommu/uaccess.h b/include/asm-m68knommu/uaccess.h
index 05be9515a2..62b29b10bc 100644
--- a/include/asm-m68knommu/uaccess.h
+++ b/include/asm-m68knommu/uaccess.h
@@ -93,7 +93,7 @@ extern int __put_user_bad(void);
93#define get_user(x, ptr) \ 93#define get_user(x, ptr) \
94({ \ 94({ \
95 int __gu_err = 0; \ 95 int __gu_err = 0; \
96 typeof(*(ptr)) __gu_val = 0; \ 96 typeof(x) __gu_val = 0; \
97 switch (sizeof(*(ptr))) { \ 97 switch (sizeof(*(ptr))) { \
98 case 1: \ 98 case 1: \
99 __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \ 99 __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \
@@ -105,23 +105,23 @@ extern int __put_user_bad(void);
105 __get_user_asm(__gu_err, __gu_val, ptr, l, "=r"); \ 105 __get_user_asm(__gu_err, __gu_val, ptr, l, "=r"); \
106 break; \ 106 break; \
107 case 8: \ 107 case 8: \
108 memcpy(&__gu_val, ptr, sizeof (*(ptr))); \ 108 memcpy((void *) &__gu_val, ptr, sizeof (*(ptr))); \
109 break; \ 109 break; \
110 default: \ 110 default: \
111 __gu_val = 0; \ 111 __gu_val = 0; \
112 __gu_err = __get_user_bad(); \ 112 __gu_err = __get_user_bad(); \
113 break; \ 113 break; \
114 } \ 114 } \
115 (x) = __gu_val; \ 115 (x) = (typeof(*(ptr))) __gu_val; \
116 __gu_err; \ 116 __gu_err; \
117}) 117})
118#define __get_user(x, ptr) get_user(x, ptr) 118#define __get_user(x, ptr) get_user(x, ptr)
119 119
120extern int __get_user_bad(void); 120extern int __get_user_bad(void);
121 121
122#define __get_user_asm(err,x,ptr,bwl,reg) \ 122#define __get_user_asm(err,x,ptr,bwl,reg) \
123 __asm__ ("move" #bwl " %1,%0" \ 123 __asm__ ("move" #bwl " %1,%0" \
124 : "=d" (x) \ 124 : "=d" (x) \
125 : "m" (*__ptr(ptr))) 125 : "m" (*__ptr(ptr)))
126 126
127#define copy_from_user(to, from, n) (memcpy(to, from, n), 0) 127#define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
diff --git a/include/asm-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h
index 1b2abdf281..21fdc37c5c 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); \
diff --git a/include/asm-mips/Kbuild b/include/asm-mips/Kbuild
new file mode 100644
index 0000000000..7897f05e31
--- /dev/null
+++ b/include/asm-mips/Kbuild
@@ -0,0 +1,3 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += cachectl.h sgidefs.h sysmips.h
diff --git a/include/asm-mips/apm.h b/include/asm-mips/apm.h
index e8c69208f6..4b99ffc115 100644
--- a/include/asm-mips/apm.h
+++ b/include/asm-mips/apm.h
@@ -13,7 +13,6 @@
13#ifndef MIPS_ASM_SA1100_APM_H 13#ifndef MIPS_ASM_SA1100_APM_H
14#define MIPS_ASM_SA1100_APM_H 14#define MIPS_ASM_SA1100_APM_H
15 15
16#include <linux/config.h>
17#include <linux/apm_bios.h> 16#include <linux/apm_bios.h>
18 17
19/* 18/*
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
index 2c42f6b00a..92e62ef711 100644
--- a/include/asm-mips/asmmacro.h
+++ b/include/asm-mips/asmmacro.h
@@ -26,14 +26,14 @@
26 ori \reg, \reg, TCSTATUS_IXMT 26 ori \reg, \reg, TCSTATUS_IXMT
27 xori \reg, \reg, TCSTATUS_IXMT 27 xori \reg, \reg, TCSTATUS_IXMT
28 mtc0 \reg, CP0_TCSTATUS 28 mtc0 \reg, CP0_TCSTATUS
29 ehb 29 _ehb
30 .endm 30 .endm
31 31
32 .macro local_irq_disable reg=t0 32 .macro local_irq_disable reg=t0
33 mfc0 \reg, CP0_TCSTATUS 33 mfc0 \reg, CP0_TCSTATUS
34 ori \reg, \reg, TCSTATUS_IXMT 34 ori \reg, \reg, TCSTATUS_IXMT
35 mtc0 \reg, CP0_TCSTATUS 35 mtc0 \reg, CP0_TCSTATUS
36 ehb 36 _ehb
37 .endm 37 .endm
38#else 38#else
39 .macro local_irq_enable reg=t0 39 .macro local_irq_enable reg=t0
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 13d44e1402..e64abc0d82 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -22,8 +22,8 @@
22#ifndef _ASM_ATOMIC_H 22#ifndef _ASM_ATOMIC_H
23#define _ASM_ATOMIC_H 23#define _ASM_ATOMIC_H
24 24
25#include <linux/irqflags.h>
25#include <asm/cpu-features.h> 26#include <asm/cpu-features.h>
26#include <asm/interrupt.h>
27#include <asm/war.h> 27#include <asm/war.h>
28 28
29typedef struct { volatile int counter; } atomic_t; 29typedef struct { volatile int counter; } atomic_t;
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 098cec2636..1bb89c5a10 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -31,7 +31,7 @@
31 31
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33 33
34#include <asm/interrupt.h> 34#include <linux/irqflags.h>
35#include <asm/sgidefs.h> 35#include <asm/sgidefs.h>
36#include <asm/war.h> 36#include <asm/war.h>
37 37
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 3b745e76f4..78c35ec463 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
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 47bc8f6c20..36416fdfcf 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,13 @@ 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, 49extern void (*__flush_icache_page)(struct vm_area_struct *vma,
51 struct page *page); 50 struct page *page);
51static inline void flush_icache_page(struct vm_area_struct *vma,
52 struct page *page)
53{
54}
55
52extern void (*flush_icache_range)(unsigned long start, unsigned long end); 56extern void (*flush_icache_range)(unsigned long start, unsigned long end);
53#define flush_cache_vmap(start, end) flush_cache_all() 57#define flush_cache_vmap(start, end) flush_cache_all()
54#define flush_cache_vunmap(start, end) flush_cache_all() 58#define flush_cache_vunmap(start, end) flush_cache_all()
@@ -60,7 +64,7 @@ static inline void copy_to_user_page(struct vm_area_struct *vma,
60 if (cpu_has_dc_aliases) 64 if (cpu_has_dc_aliases)
61 flush_cache_page(vma, vaddr, page_to_pfn(page)); 65 flush_cache_page(vma, vaddr, page_to_pfn(page));
62 memcpy(dst, src, len); 66 memcpy(dst, src, len);
63 flush_icache_page(vma, page); 67 __flush_icache_page(vma, page);
64} 68}
65 69
66static inline void copy_from_user_page(struct vm_area_struct *vma, 70static inline void copy_from_user_page(struct vm_area_struct *vma,
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 986511db54..900f472fdd 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -145,8 +145,5 @@ static inline void __user *compat_alloc_user_space(long len)
145 145
146 return (void __user *) (regs->regs[29] - len); 146 return (void __user *) (regs->regs[29] - len);
147} 147}
148#if defined (__MIPSEL__)
149#define __COMPAT_ENDIAN_SWAP__ 1
150#endif
151 148
152#endif /* _ASM_COMPAT_H */ 149#endif /* _ASM_COMPAT_H */
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 881ce1f980..eadca266f1 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -143,12 +143,8 @@
143#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) 143#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
144#endif 144#endif
145 145
146#ifdef CONFIG_MIPS_MT
147#ifndef cpu_has_mipsmt 146#ifndef cpu_has_mipsmt
148# define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT) 147#define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT)
149#endif
150#else
151# define cpu_has_mipsmt 0
152#endif 148#endif
153 149
154#ifdef CONFIG_32BIT 150#ifdef CONFIG_32BIT
@@ -187,24 +183,20 @@
187# endif 183# endif
188#endif 184#endif
189 185
190#ifdef CONFIG_CPU_MIPSR2 186#if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)
191# if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint) 187# define cpu_has_vint (cpu_data[0].options & MIPS_CPU_VINT)
192# define cpu_has_vint (cpu_data[0].options & MIPS_CPU_VINT) 188#elif !defined(cpu_has_vint)
193# else
194# define cpu_has_vint 0
195# endif
196# if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)
197# define cpu_has_veic (cpu_data[0].options & MIPS_CPU_VEIC)
198# else
199# define cpu_has_veic 0
200# endif
201#else
202# define cpu_has_vint 0 189# define cpu_has_vint 0
190#endif
191
192#if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)
193# define cpu_has_veic (cpu_data[0].options & MIPS_CPU_VEIC)
194#elif !defined(cpu_has_veic)
203# define cpu_has_veic 0 195# define cpu_has_veic 0
204#endif 196#endif
205 197
206#ifndef cpu_has_subset_pcaches 198#ifndef cpu_has_inclusive_pcaches
207#define cpu_has_subset_pcaches (cpu_data[0].options & MIPS_CPU_SUBSET_CACHES) 199#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES)
208#endif 200#endif
209 201
210#ifndef cpu_dcache_line_size 202#ifndef cpu_dcache_line_size
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index dff2a0a52f..d38fdbf845 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -242,7 +242,7 @@
242#define MIPS_CPU_EJTAG 0x00008000 /* EJTAG exception */ 242#define MIPS_CPU_EJTAG 0x00008000 /* EJTAG exception */
243#define MIPS_CPU_NOFPUEX 0x00010000 /* no FPU exception */ 243#define MIPS_CPU_NOFPUEX 0x00010000 /* no FPU exception */
244#define MIPS_CPU_LLSC 0x00020000 /* CPU has ll/sc instructions */ 244#define MIPS_CPU_LLSC 0x00020000 /* CPU has ll/sc instructions */
245#define MIPS_CPU_SUBSET_CACHES 0x00040000 /* P-cache subset enforced */ 245#define MIPS_CPU_INCLUSIVE_CACHES 0x00040000 /* P-cache subset enforced */
246#define MIPS_CPU_PREFETCH 0x00080000 /* CPU has usable prefetch */ 246#define MIPS_CPU_PREFETCH 0x00080000 /* CPU has usable prefetch */
247#define MIPS_CPU_VINT 0x00100000 /* CPU supports MIPSR2 vectored interrupts */ 247#define MIPS_CPU_VINT 0x00100000 /* CPU supports MIPSR2 vectored interrupts */
248#define MIPS_CPU_VEIC 0x00200000 /* CPU supports MIPSR2 external interrupt controller mode */ 248#define MIPS_CPU_VEIC 0x00200000 /* CPU supports MIPSR2 external interrupt controller mode */
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
index 787220e6c1..00a50ec1c1 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/fixmap.h b/include/asm-mips/fixmap.h
index 1cadefbbc0..6959bdb593 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -69,7 +69,11 @@ extern void __set_fixmap (enum fixed_addresses idx,
69 * the start of the fixmap, and leave one page empty 69 * the start of the fixmap, and leave one page empty
70 * at the top of mem.. 70 * at the top of mem..
71 */ 71 */
72#if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX)
73#define FIXADDR_TOP (0xff000000UL - 0x2000)
74#else
72#define FIXADDR_TOP (0xffffe000UL) 75#define FIXADDR_TOP (0xffffe000UL)
76#endif
73#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 77#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
74#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 78#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
75 79
diff --git a/include/asm-mips/galileo-boards/gt96100.h b/include/asm-mips/galileo-boards/gt96100.h
deleted file mode 100644
index aabd1b629c..0000000000
--- 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 66943c451c..0fe02945fe 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/hw_irq.h b/include/asm-mips/hw_irq.h
index c854d017c0..458d9fdc76 100644
--- a/include/asm-mips/hw_irq.h
+++ b/include/asm-mips/hw_irq.h
@@ -19,9 +19,9 @@ extern void init_8259A(int aeoi);
19 19
20extern atomic_t irq_err_count; 20extern atomic_t irq_err_count;
21 21
22/* This may not be apropriate for all machines, we'll see ... */ 22/*
23static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) 23 * interrupt-retrigger: NOP for now. This may not be apropriate for all
24{ 24 * machines, we'll see ...
25} 25 */
26 26
27#endif /* __ASM_HW_IRQ_H */ 27#endif /* __ASM_HW_IRQ_H */
diff --git a/include/asm-mips/inst.h b/include/asm-mips/inst.h
index 1ed8d0f625..6489f00731 100644
--- a/include/asm-mips/inst.h
+++ b/include/asm-mips/inst.h
@@ -74,7 +74,7 @@ enum spec3_op {
74 ins_op, dinsm_op, dinsu_op, dins_op, 74 ins_op, dinsm_op, dinsu_op, dins_op,
75 bshfl_op = 0x20, 75 bshfl_op = 0x20,
76 dbshfl_op = 0x24, 76 dbshfl_op = 0x24,
77 rdhwr_op = 0x3f 77 rdhwr_op = 0x3b
78}; 78};
79 79
80/* 80/*
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/irqflags.h
index a99d686751..43ca09a3a3 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/irqflags.h
@@ -8,13 +8,15 @@
8 * Copyright (C) 1999 Silicon Graphics 8 * Copyright (C) 1999 Silicon Graphics
9 * Copyright (C) 2000 MIPS Technologies, Inc. 9 * Copyright (C) 2000 MIPS Technologies, Inc.
10 */ 10 */
11#ifndef _ASM_INTERRUPT_H 11#ifndef _ASM_IRQFLAGS_H
12#define _ASM_INTERRUPT_H 12#define _ASM_IRQFLAGS_H
13
14#ifndef __ASSEMBLY__
13 15
14#include <asm/hazards.h> 16#include <asm/hazards.h>
15 17
16__asm__ ( 18__asm__ (
17 " .macro local_irq_enable \n" 19 " .macro raw_local_irq_enable \n"
18 " .set push \n" 20 " .set push \n"
19 " .set reorder \n" 21 " .set reorder \n"
20 " .set noat \n" 22 " .set noat \n"
@@ -35,10 +37,10 @@ __asm__ (
35 " .set pop \n" 37 " .set pop \n"
36 " .endm"); 38 " .endm");
37 39
38static inline void local_irq_enable(void) 40static inline void raw_local_irq_enable(void)
39{ 41{
40 __asm__ __volatile__( 42 __asm__ __volatile__(
41 "local_irq_enable" 43 "raw_local_irq_enable"
42 : /* no outputs */ 44 : /* no outputs */
43 : /* no inputs */ 45 : /* no inputs */
44 : "memory"); 46 : "memory");
@@ -63,7 +65,7 @@ static inline void local_irq_enable(void)
63 * Workaround: mask EXL bit of the result or place a nop before mfc0. 65 * Workaround: mask EXL bit of the result or place a nop before mfc0.
64 */ 66 */
65__asm__ ( 67__asm__ (
66 " .macro local_irq_disable\n" 68 " .macro raw_local_irq_disable\n"
67 " .set push \n" 69 " .set push \n"
68 " .set noat \n" 70 " .set noat \n"
69#ifdef CONFIG_MIPS_MT_SMTC 71#ifdef CONFIG_MIPS_MT_SMTC
@@ -84,17 +86,17 @@ __asm__ (
84 " .set pop \n" 86 " .set pop \n"
85 " .endm \n"); 87 " .endm \n");
86 88
87static inline void local_irq_disable(void) 89static inline void raw_local_irq_disable(void)
88{ 90{
89 __asm__ __volatile__( 91 __asm__ __volatile__(
90 "local_irq_disable" 92 "raw_local_irq_disable"
91 : /* no outputs */ 93 : /* no outputs */
92 : /* no inputs */ 94 : /* no inputs */
93 : "memory"); 95 : "memory");
94} 96}
95 97
96__asm__ ( 98__asm__ (
97 " .macro local_save_flags flags \n" 99 " .macro raw_local_save_flags flags \n"
98 " .set push \n" 100 " .set push \n"
99 " .set reorder \n" 101 " .set reorder \n"
100#ifdef CONFIG_MIPS_MT_SMTC 102#ifdef CONFIG_MIPS_MT_SMTC
@@ -105,13 +107,13 @@ __asm__ (
105 " .set pop \n" 107 " .set pop \n"
106 " .endm \n"); 108 " .endm \n");
107 109
108#define local_save_flags(x) \ 110#define raw_local_save_flags(x) \
109__asm__ __volatile__( \ 111__asm__ __volatile__( \
110 "local_save_flags %0" \ 112 "raw_local_save_flags %0" \
111 : "=r" (x)) 113 : "=r" (x))
112 114
113__asm__ ( 115__asm__ (
114 " .macro local_irq_save result \n" 116 " .macro raw_local_irq_save result \n"
115 " .set push \n" 117 " .set push \n"
116 " .set reorder \n" 118 " .set reorder \n"
117 " .set noat \n" 119 " .set noat \n"
@@ -135,15 +137,15 @@ __asm__ (
135 " .set pop \n" 137 " .set pop \n"
136 " .endm \n"); 138 " .endm \n");
137 139
138#define local_irq_save(x) \ 140#define raw_local_irq_save(x) \
139__asm__ __volatile__( \ 141__asm__ __volatile__( \
140 "local_irq_save\t%0" \ 142 "raw_local_irq_save\t%0" \
141 : "=r" (x) \ 143 : "=r" (x) \
142 : /* no inputs */ \ 144 : /* no inputs */ \
143 : "memory") 145 : "memory")
144 146
145__asm__ ( 147__asm__ (
146 " .macro local_irq_restore flags \n" 148 " .macro raw_local_irq_restore flags \n"
147 " .set push \n" 149 " .set push \n"
148 " .set noreorder \n" 150 " .set noreorder \n"
149 " .set noat \n" 151 " .set noat \n"
@@ -182,40 +184,42 @@ __asm__ (
182 " .set pop \n" 184 " .set pop \n"
183 " .endm \n"); 185 " .endm \n");
184 186
185#define local_irq_restore(flags) \ 187#define raw_local_irq_restore(flags) \
186do { \ 188do { \
187 unsigned long __tmp1; \ 189 unsigned long __tmp1; \
188 \ 190 \
189 __asm__ __volatile__( \ 191 __asm__ __volatile__( \
190 "local_irq_restore\t%0" \ 192 "raw_local_irq_restore\t%0" \
191 : "=r" (__tmp1) \ 193 : "=r" (__tmp1) \
192 : "0" (flags) \ 194 : "0" (flags) \
193 : "memory"); \ 195 : "memory"); \
194} while(0) 196} while(0)
195 197
196static inline int irqs_disabled(void) 198static inline int raw_irqs_disabled_flags(unsigned long flags)
197{ 199{
198#ifdef CONFIG_MIPS_MT_SMTC 200#ifdef CONFIG_MIPS_MT_SMTC
199 /* 201 /*
200 * SMTC model uses TCStatus.IXMT to disable interrupts for a thread/CPU 202 * SMTC model uses TCStatus.IXMT to disable interrupts for a thread/CPU
201 */ 203 */
202 unsigned long __result; 204 return flags & 0x400;
203
204 __asm__ __volatile__(
205 " .set noreorder \n"
206 " mfc0 %0, $2, 1 \n"
207 " andi %0, 0x400 \n"
208 " slt %0, $0, %0 \n"
209 " .set reorder \n"
210 : "=r" (__result));
211
212 return __result;
213#else 205#else
214 unsigned long flags;
215 local_save_flags(flags);
216
217 return !(flags & 1); 206 return !(flags & 1);
218#endif 207#endif
219} 208}
220 209
221#endif /* _ASM_INTERRUPT_H */ 210#endif
211
212/*
213 * Do the CPU's IRQ-state tracing from assembly code.
214 */
215#ifdef CONFIG_TRACE_IRQFLAGS
216# define TRACE_IRQS_ON \
217 jal trace_hardirqs_on
218# define TRACE_IRQS_OFF \
219 jal trace_hardirqs_off
220#else
221# define TRACE_IRQS_ON
222# define TRACE_IRQS_OFF
223#endif
224
225#endif /* _ASM_IRQFLAGS_H */
diff --git a/include/asm-mips/mach-atlas/mc146818rtc.h b/include/asm-mips/mach-atlas/mc146818rtc.h
index 397522ea55..a73a569842 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-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
index d5b38a247e..eeb0c3115b 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
@@ -316,7 +316,7 @@ typedef struct dbdma_chan_config {
316 au1x_ddma_desc_t *chan_desc_base; 316 au1x_ddma_desc_t *chan_desc_base;
317 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr; 317 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
318 void *chan_callparam; 318 void *chan_callparam;
319 void (*chan_callback)(int, void *, struct pt_regs *); 319 void (*chan_callback)(int, void *);
320} chan_tab_t; 320} chan_tab_t;
321 321
322#define DEV_FLAGS_INUSE (1 << 0) 322#define DEV_FLAGS_INUSE (1 << 0)
@@ -334,8 +334,8 @@ typedef struct dbdma_chan_config {
334 * meaningful name. The 'callback' is called during dma completion 334 * meaningful name. The 'callback' is called during dma completion
335 * interrupt. 335 * interrupt.
336 */ 336 */
337u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, 337extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
338 void (*callback)(int, void *, struct pt_regs *), void *callparam); 338 void (*callback)(int, void *), void *callparam);
339 339
340#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS 340#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
341 341
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
index d7cbacdd21..1bd4e27caf 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_psc.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h
@@ -512,7 +512,7 @@ typedef struct psc_smb {
512 512
513/* Transmit register control. 513/* Transmit register control.
514*/ 514*/
515#define PSC_SMBTXRX_RSR (1 << 30) 515#define PSC_SMBTXRX_RSR (1 << 28)
516#define PSC_SMBTXRX_STP (1 << 29) 516#define PSC_SMBTXRX_STP (1 << 29)
517#define PSC_SMBTXRX_DATAMASK (0xff) 517#define PSC_SMBTXRX_DATAMASK (0xff)
518 518
diff --git a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
index e0e08fc5d7..c6dfa59d19 100644
--- a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
@@ -27,7 +27,7 @@
27#define cpu_has_mcheck 0 27#define cpu_has_mcheck 0
28#define cpu_has_ejtag 0 28#define cpu_has_ejtag 0
29 29
30#define cpu_has_subset_pcaches 0 30#define cpu_has_inclusive_pcaches 0
31#define cpu_dcache_line_size() 32 31#define cpu_dcache_line_size() 32
32#define cpu_icache_line_size() 32 32#define cpu_icache_line_size() 32
33#define cpu_scache_line_size() 0 33#define cpu_scache_line_size() 0
diff --git a/include/asm-mips/mach-dec/mc146818rtc.h b/include/asm-mips/mach-dec/mc146818rtc.h
index 6d37a56758..6724e99e43 100644
--- a/include/asm-mips/mach-dec/mc146818rtc.h
+++ b/include/asm-mips/mach-dec/mc146818rtc.h
@@ -19,6 +19,8 @@
19 19
20extern volatile u8 *dec_rtc_base; 20extern volatile u8 *dec_rtc_base;
21 21
22#define ARCH_RTC_LOCATION
23
22#define RTC_PORT(x) CPHYSADDR((long)dec_rtc_base) 24#define RTC_PORT(x) CPHYSADDR((long)dec_rtc_base)
23#define RTC_IO_EXTENT dec_kn_slot_size 25#define RTC_IO_EXTENT dec_kn_slot_size
24#define RTC_IOMAPPED 0 26#define RTC_IOMAPPED 0
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 0ef1e6c25a..0000000000
--- 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/cpu-feature-overrides.h b/include/asm-mips/mach-excite/cpu-feature-overrides.h
index abb76b2fd8..0d31854222 100644
--- a/include/asm-mips/mach-excite/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-excite/cpu-feature-overrides.h
@@ -31,7 +31,7 @@
31#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 32#define cpu_has_64bits 1
33 33
34#define cpu_has_subset_pcaches 0 34#define cpu_has_inclusive_pcaches 0
35 35
36#define cpu_dcache_line_size() 32 36#define cpu_dcache_line_size() 32
37#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
diff --git a/include/asm-mips/mach-excite/excite.h b/include/asm-mips/mach-excite/excite.h
index c52610de2b..4c29ba4499 100644
--- a/include/asm-mips/mach-excite/excite.h
+++ b/include/asm-mips/mach-excite/excite.h
@@ -1,14 +1,13 @@
1#ifndef __EXCITE_H__ 1#ifndef __EXCITE_H__
2#define __EXCITE_H__ 2#define __EXCITE_H__
3 3
4#include <linux/config.h>
5#include <linux/init.h> 4#include <linux/init.h>
6#include <asm/addrspace.h> 5#include <asm/addrspace.h>
7#include <asm/types.h> 6#include <asm/types.h>
8 7
9#define EXCITE_CPU_EXT_CLOCK 100000000 8#define EXCITE_CPU_EXT_CLOCK 100000000
10 9
11#if !defined(__ASSEMBLER__) 10#if !defined(__ASSEMBLY__)
12void __init excite_kgdb_init(void); 11void __init excite_kgdb_init(void);
13void excite_procfs_init(void); 12void excite_procfs_init(void);
14extern 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 0000000000..38fcda703a
--- /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-generic/floppy.h b/include/asm-mips/mach-generic/floppy.h
index 682a5858f8..001a8ce17c 100644
--- a/include/asm-mips/mach-generic/floppy.h
+++ b/include/asm-mips/mach-generic/floppy.h
@@ -98,7 +98,7 @@ static inline void fd_disable_irq(void)
98static inline int fd_request_irq(void) 98static inline int fd_request_irq(void)
99{ 99{
100 return request_irq(FLOPPY_IRQ, floppy_interrupt, 100 return request_irq(FLOPPY_IRQ, floppy_interrupt,
101 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL); 101 IRQF_DISABLED, "floppy", NULL);
102} 102}
103 103
104static inline void fd_free_irq(void) 104static inline void fd_free_irq(void)
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
index 19c2d13598..a071974b67 100644
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -34,7 +34,7 @@
34#define cpu_has_4kex 1 34#define cpu_has_4kex 1
35#define cpu_has_4k_cache 1 35#define cpu_has_4k_cache 1
36 36
37#define cpu_has_subset_pcaches 1 37#define cpu_has_inclusive_pcaches 1
38 38
39#define cpu_dcache_line_size() 32 39#define cpu_dcache_line_size() 32
40#define cpu_icache_line_size() 64 40#define cpu_icache_line_size() 64
diff --git a/include/asm-mips/mach-ja/cpu-feature-overrides.h b/include/asm-mips/mach-ja/cpu-feature-overrides.h
index 90ff087083..84b6dead0e 100644
--- a/include/asm-mips/mach-ja/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ja/cpu-feature-overrides.h
@@ -31,7 +31,7 @@
31#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 32#define cpu_has_64bits 1
33 33
34#define cpu_has_subset_pcaches 0 34#define cpu_has_inclusive_pcaches 0
35 35
36#define cpu_dcache_line_size() 32 36#define cpu_dcache_line_size() 32
37#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
diff --git a/include/asm-mips/mach-jazz/floppy.h b/include/asm-mips/mach-jazz/floppy.h
index c9dad99b12..56e9ca6ae4 100644
--- a/include/asm-mips/mach-jazz/floppy.h
+++ b/include/asm-mips/mach-jazz/floppy.h
@@ -90,7 +90,7 @@ static inline void fd_disable_irq(void)
90static inline int fd_request_irq(void) 90static inline int fd_request_irq(void)
91{ 91{
92 return request_irq(FLOPPY_IRQ, floppy_interrupt, 92 return request_irq(FLOPPY_IRQ, floppy_interrupt,
93 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL); 93 IRQF_DISABLED, "floppy", NULL);
94} 94}
95 95
96static inline void fd_free_irq(void) 96static inline void fd_free_irq(void)
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index e960679f54..7f3e3f9bd2 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -39,7 +39,7 @@
39#define cpu_has_nofpuex 0 39#define cpu_has_nofpuex 0
40/* #define cpu_has_64bits ? */ 40/* #define cpu_has_64bits ? */
41/* #define cpu_has_64bit_zero_reg ? */ 41/* #define cpu_has_64bit_zero_reg ? */
42/* #define cpu_has_subset_pcaches ? */ 42/* #define cpu_has_inclusive_pcaches ? */
43#define cpu_icache_snoops_remote_store 1 43#define cpu_icache_snoops_remote_store 1
44#endif 44#endif
45 45
@@ -65,7 +65,7 @@
65#define cpu_has_nofpuex 0 65#define cpu_has_nofpuex 0
66/* #define cpu_has_64bits ? */ 66/* #define cpu_has_64bits ? */
67/* #define cpu_has_64bit_zero_reg ? */ 67/* #define cpu_has_64bit_zero_reg ? */
68/* #define cpu_has_subset_pcaches ? */ 68/* #define cpu_has_inclusive_pcaches ? */
69#define cpu_icache_snoops_remote_store 1 69#define cpu_icache_snoops_remote_store 1
70#endif 70#endif
71 71
diff --git a/include/asm-mips/mach-mips/irq.h b/include/asm-mips/mach-mips/irq.h
index 083d9c512a..e994b0c012 100644
--- a/include/asm-mips/mach-mips/irq.h
+++ b/include/asm-mips/mach-mips/irq.h
@@ -4,10 +4,4 @@
4 4
5#define NR_IRQS 256 5#define NR_IRQS 256
6 6
7#ifdef CONFIG_SMP
8
9#define ARCH_HAS_IRQ_PER_CPU
10
11#endif
12
13#endif /* __ASM_MACH_MIPS_IRQ_H */ 7#endif /* __ASM_MACH_MIPS_IRQ_H */
diff --git a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
index 782b986241..57a12ded06 100644
--- a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
@@ -34,7 +34,7 @@
34#define cpu_has_nofpuex 0 34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1 35#define cpu_has_64bits 1
36 36
37#define cpu_has_subset_pcaches 0 37#define cpu_has_inclusive_pcaches 0
38 38
39#define cpu_dcache_line_size() 32 39#define cpu_dcache_line_size() 32
40#define cpu_icache_line_size() 32 40#define cpu_icache_line_size() 32
diff --git a/include/asm-mips/mach-qemu/cpu-feature-overrides.h b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
index f4e370e271..529445dace 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/mach-sibyte/cpu-feature-overrides.h b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
index 193a666cd1..a25968f277 100644
--- a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
@@ -31,7 +31,7 @@
31#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 32#define cpu_has_64bits 1
33 33
34#define cpu_has_subset_pcaches 0 34#define cpu_has_inclusive_pcaches 0
35 35
36#define cpu_dcache_line_size() 32 36#define cpu_dcache_line_size() 32
37#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
diff --git a/include/asm-mips/mach-sim/cpu-feature-overrides.h b/include/asm-mips/mach-sim/cpu-feature-overrides.h
index d736bdadb6..779b022057 100644
--- a/include/asm-mips/mach-sim/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sim/cpu-feature-overrides.h
@@ -34,7 +34,7 @@
34#define cpu_has_nofpuex 0 34#define cpu_has_nofpuex 0
35/* #define cpu_has_64bits ? */ 35/* #define cpu_has_64bits ? */
36/* #define cpu_has_64bit_zero_reg ? */ 36/* #define cpu_has_64bit_zero_reg ? */
37/* #define cpu_has_subset_pcaches ? */ 37/* #define cpu_has_inclusive_pcaches ? */
38#endif 38#endif
39 39
40#ifdef CONFIG_CPU_MIPS64 40#ifdef CONFIG_CPU_MIPS64
@@ -59,7 +59,7 @@
59#define cpu_has_nofpuex 0 59#define cpu_has_nofpuex 0
60/* #define cpu_has_64bits ? */ 60/* #define cpu_has_64bits ? */
61/* #define cpu_has_64bit_zero_reg ? */ 61/* #define cpu_has_64bit_zero_reg ? */
62/* #define cpu_has_subset_pcaches ? */ 62/* #define cpu_has_inclusive_pcaches ? */
63#endif 63#endif
64 64
65#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */ 65#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
index 3073542c93..42cebb7ce7 100644
--- a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
@@ -31,7 +31,7 @@
31#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
32#define cpu_has_64bits 1 32#define cpu_has_64bits 1
33 33
34#define cpu_has_subset_pcaches 0 34#define cpu_has_inclusive_pcaches 0
35 35
36#define cpu_dcache_line_size() 32 36#define cpu_dcache_line_size() 32
37#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h
index fd7ebc54fa..b15e4ea0b0 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/mipsregs.h b/include/asm-mips/mipsregs.h
index 673977901e..1f318d7079 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -470,6 +470,8 @@
470 470
471/* Bits specific to the VR41xx. */ 471/* Bits specific to the VR41xx. */
472#define VR41_CONF_CS (_ULCAST_(1) << 12) 472#define VR41_CONF_CS (_ULCAST_(1) << 12)
473#define VR41_CONF_P4K (_ULCAST_(1) << 13)
474#define VR41_CONF_BP (_ULCAST_(1) << 16)
473#define VR41_CONF_M16 (_ULCAST_(1) << 20) 475#define VR41_CONF_M16 (_ULCAST_(1) << 20)
474#define VR41_CONF_AD (_ULCAST_(1) << 23) 476#define VR41_CONF_AD (_ULCAST_(1) << 23)
475 477
@@ -1416,7 +1418,7 @@ change_c0_##name(unsigned int change, unsigned int new) \
1416 1418
1417#else /* SMTC versions that manage MT scheduling */ 1419#else /* SMTC versions that manage MT scheduling */
1418 1420
1419#include <asm/interrupt.h> 1421#include <linux/irqflags.h>
1420 1422
1421/* 1423/*
1422 * This is a duplicate of dmt() in mipsmtregs.h to avoid problems with 1424 * This is a duplicate of dmt() in mipsmtregs.h to avoid problems with
@@ -1459,7 +1461,8 @@ static inline void __emt(unsigned int previous)
1459static inline void __ehb(void) 1461static inline void __ehb(void)
1460{ 1462{
1461 __asm__ __volatile__( 1463 __asm__ __volatile__(
1462 " ehb \n"); 1464 " .set mips32r2 \n"
1465 " ehb \n" " .set mips0 \n");
1463} 1466}
1464 1467
1465/* 1468/*
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 18b69de87d..fe065d6070 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 6b97744f00..85b258ee70 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -14,8 +14,6 @@
14 14
15#include <spaces.h> 15#include <spaces.h>
16 16
17#endif
18
19/* 17/*
20 * PAGE_SHIFT determines the page size 18 * PAGE_SHIFT determines the page size
21 */ 19 */
@@ -34,10 +32,10 @@
34#define PAGE_SIZE (1UL << PAGE_SHIFT) 32#define PAGE_SIZE (1UL << PAGE_SHIFT)
35#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 33#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
36 34
37
38#ifdef __KERNEL__
39#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
40 36
37#include <asm/cpu-features.h>
38
41extern void clear_page(void * page); 39extern void clear_page(void * page);
42extern void copy_page(void * to, void * from); 40extern void copy_page(void * to, void * from);
43 41
@@ -57,7 +55,7 @@ static inline void clear_user_page(void *addr, unsigned long vaddr,
57 extern void (*flush_data_cache_page)(unsigned long addr); 55 extern void (*flush_data_cache_page)(unsigned long addr);
58 56
59 clear_page(addr); 57 clear_page(addr);
60 if (pages_do_alias((unsigned long) addr, vaddr)) 58 if (pages_do_alias((unsigned long) addr, vaddr & PAGE_MASK))
61 flush_data_cache_page((unsigned long)addr); 59 flush_data_cache_page((unsigned long)addr);
62} 60}
63 61
@@ -67,7 +65,8 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
67 extern void (*flush_data_cache_page)(unsigned long addr); 65 extern void (*flush_data_cache_page)(unsigned long addr);
68 66
69 copy_page(vto, vfrom); 67 copy_page(vto, vfrom);
70 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))
71 flush_data_cache_page((unsigned long)vto); 70 flush_data_cache_page((unsigned long)vto);
72} 71}
73 72
@@ -78,15 +77,17 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
78 #ifdef CONFIG_CPU_MIPS32 77 #ifdef CONFIG_CPU_MIPS32
79 typedef struct { unsigned long pte_low, pte_high; } pte_t; 78 typedef struct { unsigned long pte_low, pte_high; } pte_t;
80 #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; })
81 #else 81 #else
82 typedef struct { unsigned long long pte; } pte_t; 82 typedef struct { unsigned long long pte; } pte_t;
83 #define pte_val(x) ((x).pte) 83 #define pte_val(x) ((x).pte)
84 #define __pte(x) ((pte_t) { (x) } )
84 #endif 85 #endif
85#else 86#else
86typedef struct { unsigned long pte; } pte_t; 87typedef struct { unsigned long pte; } pte_t;
87#define pte_val(x) ((x).pte) 88#define pte_val(x) ((x).pte)
88#endif
89#define __pte(x) ((pte_t) { (x) } ) 89#define __pte(x) ((pte_t) { (x) } )
90#endif
90 91
91/* 92/*
92 * 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
@@ -138,16 +139,14 @@ typedef struct { unsigned long pgprot; } pgprot_t;
138 139
139#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
140 141
141#ifndef CONFIG_SPARSEMEM
142#ifndef CONFIG_NEED_MULTIPLE_NODES
143#define pfn_valid(pfn) ((pfn) < max_mapnr)
144#endif
145#endif
146
147#ifdef CONFIG_FLATMEM 142#ifdef CONFIG_FLATMEM
148 143
149#define pfn_valid(pfn) ((pfn) < max_mapnr) 144#define pfn_valid(pfn) ((pfn) < max_mapnr)
150 145
146#elif defined(CONFIG_SPARSEMEM)
147
148/* pfn_valid is defined in linux/mmzone.h */
149
151#elif defined(CONFIG_NEED_MULTIPLE_NODES) 150#elif defined(CONFIG_NEED_MULTIPLE_NODES)
152 151
153#define pfn_valid(pfn) \ 152#define pfn_valid(pfn) \
@@ -159,8 +158,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
159 : 0); \ 158 : 0); \
160}) 159})
161 160
162#else
163#error Provide a definition of pfn_valid
164#endif 161#endif
165 162
166#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 163#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
@@ -172,8 +169,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
172#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE) 169#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
173#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET) 170#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
174 171
175#endif /* defined (__KERNEL__) */
176
177#ifdef CONFIG_LIMITED_DMA 172#ifdef CONFIG_LIMITED_DMA
178#define WANT_PAGE_VIRTUAL 173#define WANT_PAGE_VIRTUAL
179#endif 174#endif
@@ -181,4 +176,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
181#include <asm-generic/memory_model.h> 176#include <asm-generic/memory_model.h>
182#include <asm-generic/page.h> 177#include <asm-generic/page.h>
183 178
179#endif /* defined (__KERNEL__) */
180
184#endif /* _ASM_PAGE_H */ 181#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 4b26d85281..d20f2e9b28 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -156,9 +156,9 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
156#define __pte_offset(address) \ 156#define __pte_offset(address) \
157 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 157 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
158#define pte_offset(dir, address) \ 158#define pte_offset(dir, address) \
159 ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address)) 159 ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address))
160#define pte_offset_kernel(dir, address) \ 160#define pte_offset_kernel(dir, address) \
161 ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) 161 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
162 162
163#define pte_offset_map(dir, address) \ 163#define pte_offset_map(dir, address) \
164 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 164 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index e3db93212e..d05fb6f38a 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 \
@@ -178,24 +182,26 @@ static inline void pud_clear(pud_t *pudp)
178/* to find an entry in a page-table-directory */ 182/* to find an entry in a page-table-directory */
179#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) 183#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr))
180 184
181static inline unsigned long pud_page(pud_t pud) 185static inline unsigned long pud_page_vaddr(pud_t pud)
182{ 186{
183 return pud_val(pud); 187 return pud_val(pud);
184} 188}
189#define pud_phys(pud) (pud_val(pud) - PAGE_OFFSET)
190#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
185 191
186/* Find an entry in the second-level page table.. */ 192/* Find an entry in the second-level page table.. */
187static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) 193static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
188{ 194{
189 return (pmd_t *) pud_page(*pud) + pmd_index(address); 195 return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address);
190} 196}
191 197
192/* Find an entry in the third-level page table.. */ 198/* Find an entry in the third-level page table.. */
193#define __pte_offset(address) \ 199#define __pte_offset(address) \
194 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 200 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
195#define pte_offset(dir, address) \ 201#define pte_offset(dir, address) \
196 ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address)) 202 ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address))
197#define pte_offset_kernel(dir, address) \ 203#define pte_offset_kernel(dir, address) \
198 ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) 204 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
199#define pte_offset_map(dir, address) \ 205#define pte_offset_map(dir, address) \
200 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 206 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
201#define pte_offset_map_nested(dir, address) \ 207#define pte_offset_map_nested(dir, address) \
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index a36ca1be17..1ca4d1e185 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -87,7 +87,7 @@ extern void paging_init(void);
87 */ 87 */
88#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) 88#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET)
89#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 89#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
90#define pmd_page_kernel(pmd) pmd_val(pmd) 90#define pmd_page_vaddr(pmd) pmd_val(pmd)
91 91
92#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 92#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
93 93
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 4113316ee0..4fb0fc43ff 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
@@ -73,6 +71,7 @@ struct pt_regs {
73#ifdef __KERNEL__ 71#ifdef __KERNEL__
74 72
75#include <linux/linkage.h> 73#include <linux/linkage.h>
74#include <asm/isadep.h>
76 75
77/* 76/*
78 * Does the process account for user or for system time? 77 * 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 584bd9c0ab..035637c67e 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -52,9 +52,9 @@
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 <asm/galileo-boards/ev96100.h>
59#include <asm/galileo-boards/ev96100int.h> 59#include <asm/galileo-boards/ev96100int.h>
60#define EV96100_SERIAL_PORT_DEFNS \ 60#define EV96100_SERIAL_PORT_DEFNS \
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h
index 335dbaf1d8..a885491217 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 f4178bdcfc..7ed0bb611e 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 a1f3a3fa9b..8b391a2f08 100644
--- a/include/asm-mips/signal.h
+++ b/include/asm-mips/signal.h
@@ -64,7 +64,6 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
64 * SA_FLAGS values: 64 * SA_FLAGS values:
65 * 65 *
66 * SA_ONSTACK indicates that a registered stack_t will be used. 66 * SA_ONSTACK indicates that a registered stack_t will be used.
67 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
68 * SA_RESTART flag to get restarting signals (which were the default long ago) 67 * SA_RESTART flag to get restarting signals (which were the default long ago)
69 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 68 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
70 * SA_RESETHAND clears the handler when the signal is delivered. 69 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -84,7 +83,6 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
84 83
85#define SA_NOMASK SA_NODEFER 84#define SA_NOMASK SA_NODEFER
86#define SA_ONESHOT SA_RESETHAND 85#define SA_ONESHOT SA_RESETHAND
87#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
88 86
89#define SA_RESTORER 0x04000000 /* Only for o32 */ 87#define SA_RESTORER 0x04000000 /* Only for o32 */
90 88
@@ -99,15 +97,6 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
99 97
100#ifdef __KERNEL__ 98#ifdef __KERNEL__
101 99
102/*
103 * These values of sa_flags are used only by the kernel as part of the
104 * irq handling routines.
105 *
106 * SA_INTERRUPT is also used by the irq handling routines.
107 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
108 */
109#define SA_SAMPLE_RANDOM SA_RESTART
110
111#ifdef CONFIG_TRAD_SIGNALS 100#ifdef CONFIG_TRAD_SIGNALS
112#define sig_uses_siginfo(ka) ((ka)->sa.sa_flags & SA_SIGINFO) 101#define sig_uses_siginfo(ka) ((ka)->sa.sa_flags & SA_SIGINFO)
113#else 102#else
@@ -119,17 +108,8 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
119#define SIG_BLOCK 1 /* for blocking signals */ 108#define SIG_BLOCK 1 /* for blocking signals */
120#define SIG_UNBLOCK 2 /* for unblocking signals */ 109#define SIG_UNBLOCK 2 /* for unblocking signals */
121#define SIG_SETMASK 3 /* for setting the signal mask */ 110#define SIG_SETMASK 3 /* for setting the signal mask */
122#define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility:
123 set only the low 32 bit of the sigset. */
124
125/* Type of a signal handler. */
126typedef void __signalfn_t(int);
127typedef __signalfn_t __user *__sighandler_t;
128 111
129/* Fake signal functions */ 112#include <asm-generic/signal.h>
130#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
131#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
132#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
133 113
134struct sigaction { 114struct sigaction {
135 unsigned int sa_flags; 115 unsigned int sa_flags;
diff --git a/include/asm-mips/sn/ioc3.h b/include/asm-mips/sn/ioc3.h
index f7d530f306..099677774d 100644
--- a/include/asm-mips/sn/ioc3.h
+++ b/include/asm-mips/sn/ioc3.h
@@ -5,6 +5,8 @@
5#ifndef _IOC3_H 5#ifndef _IOC3_H
6#define _IOC3_H 6#define _IOC3_H
7 7
8#include <linux/types.h>
9
8/* SUPERIO uart register map */ 10/* SUPERIO uart register map */
9typedef volatile struct ioc3_uartregs { 11typedef volatile struct ioc3_uartregs {
10 union { 12 union {
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
index 52238e65af..b63cd0655b 100644
--- a/include/asm-mips/sn/klconfig.h
+++ b/include/asm-mips/sn/klconfig.h
@@ -602,7 +602,7 @@ typedef struct klcpu_s { /* CPU */
602 602
603typedef struct klhub_s { /* HUB */ 603typedef struct klhub_s { /* HUB */
604 klinfo_t hub_info; 604 klinfo_t hub_info;
605 uint hub_flags; /* PCFG_HUB_xxx flags */ 605 unsigned int hub_flags; /* PCFG_HUB_xxx flags */
606 klport_t hub_port; /* hub is connected to this */ 606 klport_t hub_port; /* hub is connected to this */
607 nic_t hub_box_nic; /* nic of containing box */ 607 nic_t hub_box_nic; /* nic of containing box */
608 klconf_off_t hub_mfg_nic; /* MFG NIC string */ 608 klconf_off_t hub_mfg_nic; /* MFG NIC string */
@@ -611,7 +611,7 @@ typedef struct klhub_s { /* HUB */
611 611
612typedef struct klhub_uart_s { /* HUB */ 612typedef struct klhub_uart_s { /* HUB */
613 klinfo_t hubuart_info; 613 klinfo_t hubuart_info;
614 uint hubuart_flags; /* PCFG_HUB_xxx flags */ 614 unsigned int hubuart_flags; /* PCFG_HUB_xxx flags */
615 nic_t hubuart_box_nic; /* nic of containing box */ 615 nic_t hubuart_box_nic; /* nic of containing box */
616} klhub_uart_t ; 616} klhub_uart_t ;
617 617
@@ -710,7 +710,7 @@ typedef struct klvmed_s { /* VME DEVICE - VME BOARD */
710/* XXX - Don't we need the number of ports here?!? */ 710/* XXX - Don't we need the number of ports here?!? */
711typedef struct klrou_s { /* ROUTER */ 711typedef struct klrou_s { /* ROUTER */
712 klinfo_t rou_info ; 712 klinfo_t rou_info ;
713 uint rou_flags ; /* PCFG_ROUTER_xxx flags */ 713 unsigned int rou_flags ; /* PCFG_ROUTER_xxx flags */
714 nic_t rou_box_nic ; /* nic of the containing module */ 714 nic_t rou_box_nic ; /* nic of the containing module */
715 klport_t rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */ 715 klport_t rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */
716 klconf_off_t rou_mfg_nic ; /* MFG NIC string */ 716 klconf_off_t rou_mfg_nic ; /* MFG NIC string */
@@ -733,8 +733,8 @@ typedef struct klgfx_s { /* GRAPHICS Device */
733 klinfo_t gfx_info; 733 klinfo_t gfx_info;
734 klconf_off_t old_gndevs; /* for compatibility with older proms */ 734 klconf_off_t old_gndevs; /* for compatibility with older proms */
735 klconf_off_t old_gdoff0; /* for compatibility with older proms */ 735 klconf_off_t old_gdoff0; /* for compatibility with older proms */
736 uint cookie; /* for compatibility with older proms */ 736 unsigned int cookie; /* for compatibility with older proms */
737 uint moduleslot; 737 unsigned int moduleslot;
738 struct klgfx_s *gfx_next_pipe; 738 struct klgfx_s *gfx_next_pipe;
739 graphics_t gfx_specific; 739 graphics_t gfx_specific;
740 klconf_off_t pad0; /* for compatibility with older proms */ 740 klconf_off_t pad0; /* for compatibility with older proms */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 0bb31e5aac..36ebe4e186 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -69,6 +69,7 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
69#define SO_PEERSEC 30 69#define SO_PEERSEC 30
70#define SO_SNDBUFFORCE 31 70#define SO_SNDBUFFORCE 31
71#define SO_RCVBUFFORCE 33 71#define SO_RCVBUFFORCE 33
72#define SO_PASSSEC 34
72 73
73#ifdef __KERNEL__ 74#ifdef __KERNEL__
74 75
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 669b8e349f..4c1a1b53ae 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,5 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
283 return ret; 327 return ret;
284} 328}
285 329
330
286#endif /* _ASM_SPINLOCK_H */ 331#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 513aa51338..158a4cd12e 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -304,7 +304,7 @@
304 mfc0 v0, CP0_TCSTATUS 304 mfc0 v0, CP0_TCSTATUS
305 ori v0, TCSTATUS_IXMT 305 ori v0, TCSTATUS_IXMT
306 mtc0 v0, CP0_TCSTATUS 306 mtc0 v0, CP0_TCSTATUS
307 ehb 307 _ehb
308 DMT 5 # dmt a1 308 DMT 5 # dmt a1
309 jal mips_ihb 309 jal mips_ihb
310#endif /* CONFIG_MIPS_MT_SMTC */ 310#endif /* CONFIG_MIPS_MT_SMTC */
@@ -325,14 +325,14 @@
325 * restore TCStatus.IXMT. 325 * restore TCStatus.IXMT.
326 */ 326 */
327 LONG_L v1, PT_TCSTATUS(sp) 327 LONG_L v1, PT_TCSTATUS(sp)
328 ehb 328 _ehb
329 mfc0 v0, CP0_TCSTATUS 329 mfc0 v0, CP0_TCSTATUS
330 andi v1, TCSTATUS_IXMT 330 andi v1, TCSTATUS_IXMT
331 /* We know that TCStatua.IXMT should be set from above */ 331 /* We know that TCStatua.IXMT should be set from above */
332 xori v0, v0, TCSTATUS_IXMT 332 xori v0, v0, TCSTATUS_IXMT
333 or v0, v0, v1 333 or v0, v0, v1
334 mtc0 v0, CP0_TCSTATUS 334 mtc0 v0, CP0_TCSTATUS
335 ehb 335 _ehb
336 andi a1, a1, VPECONTROL_TE 336 andi a1, a1, VPECONTROL_TE
337 beqz a1, 1f 337 beqz a1, 1f
338 emt 338 emt
@@ -411,7 +411,7 @@
411 /* Clear TKSU, leave IXMT */ 411 /* Clear TKSU, leave IXMT */
412 xori t0, 0x00001800 412 xori t0, 0x00001800
413 mtc0 t0, CP0_TCSTATUS 413 mtc0 t0, CP0_TCSTATUS
414 ehb 414 _ehb
415 /* We need to leave the global IE bit set, but clear EXL...*/ 415 /* We need to leave the global IE bit set, but clear EXL...*/
416 mfc0 t0, CP0_STATUS 416 mfc0 t0, CP0_STATUS
417 ori t0, ST0_EXL | ST0_ERL 417 ori t0, ST0_EXL | ST0_ERL
@@ -438,7 +438,7 @@
438 * and enable interrupts only for the 438 * and enable interrupts only for the
439 * current TC, using the TCStatus register. 439 * current TC, using the TCStatus register.
440 */ 440 */
441 ehb 441 _ehb
442 mfc0 t0,CP0_TCSTATUS 442 mfc0 t0,CP0_TCSTATUS
443 /* Fortunately CU 0 is in the same place in both registers */ 443 /* Fortunately CU 0 is in the same place in both registers */
444 /* Set TCU0, TKSU (for later inversion) and IXMT */ 444 /* Set TCU0, TKSU (for later inversion) and IXMT */
@@ -447,7 +447,7 @@
447 /* Clear TKSU *and* IXMT */ 447 /* Clear TKSU *and* IXMT */
448 xori t0, 0x00001c00 448 xori t0, 0x00001c00
449 mtc0 t0, CP0_TCSTATUS 449 mtc0 t0, CP0_TCSTATUS
450 ehb 450 _ehb
451 /* We need to leave the global IE bit set, but clear EXL...*/ 451 /* We need to leave the global IE bit set, but clear EXL...*/
452 mfc0 t0, CP0_STATUS 452 mfc0 t0, CP0_STATUS
453 ori t0, ST0_EXL 453 ori t0, ST0_EXL
@@ -479,7 +479,7 @@
479 andi v1, v0, TCSTATUS_IXMT 479 andi v1, v0, TCSTATUS_IXMT
480 ori v0, TCSTATUS_IXMT 480 ori v0, TCSTATUS_IXMT
481 mtc0 v0, CP0_TCSTATUS 481 mtc0 v0, CP0_TCSTATUS
482 ehb 482 _ehb
483 DMT 2 # dmt v0 483 DMT 2 # dmt v0
484 /* 484 /*
485 * We don't know a priori if ra is "live" 485 * We don't know a priori if ra is "live"
@@ -495,7 +495,7 @@
495 xori t0, 0x1e 495 xori t0, 0x1e
496 mtc0 t0, CP0_STATUS 496 mtc0 t0, CP0_STATUS
497#ifdef CONFIG_MIPS_MT_SMTC 497#ifdef CONFIG_MIPS_MT_SMTC
498 ehb 498 _ehb
499 andi v0, v0, VPECONTROL_TE 499 andi v0, v0, VPECONTROL_TE
500 beqz v0, 2f 500 beqz v0, 2f
501 nop /* delay slot */ 501 nop /* delay slot */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 130333d7c4..dcb4701d57 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -13,13 +13,13 @@
13#define _ASM_SYSTEM_H 13#define _ASM_SYSTEM_H
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/irqflags.h>
16 17
17#include <asm/addrspace.h> 18#include <asm/addrspace.h>
18#include <asm/cpu-features.h> 19#include <asm/cpu-features.h>
19#include <asm/dsp.h> 20#include <asm/dsp.h>
20#include <asm/ptrace.h> 21#include <asm/ptrace.h>
21#include <asm/war.h> 22#include <asm/war.h>
22#include <asm/interrupt.h>
23 23
24/* 24/*
25 * read_barrier_depends - Flush all pending reads that subsequents reads 25 * read_barrier_depends - Flush all pending reads that subsequents reads
@@ -143,9 +143,6 @@
143#define set_mb(var, value) \ 143#define set_mb(var, value) \
144do { var = value; mb(); } while (0) 144do { var = value; mb(); } while (0)
145 145
146#define set_wmb(var, value) \
147do { var = value; wmb(); } while (0)
148
149/* 146/*
150 * switch_to(n) should switch tasks to task nr n, first 147 * switch_to(n) should switch tasks to task nr n, first
151 * checking that n isn't the current task, in which case it does nothing. 148 * checking that n isn't the current task, in which case it does nothing.
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index d897c8bb55..2d54373566 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -83,11 +83,11 @@ extern asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs);
83/* 83/*
84 * board specific routines required by time_init(). 84 * board specific routines required by time_init().
85 * board_time_init is defaulted to NULL and can remain so. 85 * board_time_init is defaulted to NULL and can remain so.
86 * board_timer_setup must be setup properly in machine setup routine. 86 * plat_timer_setup must be setup properly in machine setup routine.
87 */ 87 */
88struct irqaction; 88struct irqaction;
89extern void (*board_time_init)(void); 89extern void (*board_time_init)(void);
90extern void (*board_timer_setup)(struct irqaction *irq); 90extern void plat_timer_setup(struct irqaction *irq);
91 91
92/* 92/*
93 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible 93 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h
index 98aa737b34..b80de8e0fb 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/unistd.h b/include/asm-mips/unistd.h
index 8bb0bb9b2e..c39142920f 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)
@@ -326,16 +326,21 @@
326#define __NR_unshare (__NR_Linux + 303) 326#define __NR_unshare (__NR_Linux + 303)
327#define __NR_splice (__NR_Linux + 304) 327#define __NR_splice (__NR_Linux + 304)
328#define __NR_sync_file_range (__NR_Linux + 305) 328#define __NR_sync_file_range (__NR_Linux + 305)
329#define __NR_tee (__NR_Linux + 306)
330#define __NR_vmsplice (__NR_Linux + 307)
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)
329 334
330/* 335/*
331 * Offset of the last Linux o32 flavoured syscall 336 * Offset of the last Linux o32 flavoured syscall
332 */ 337 */
333#define __NR_Linux_syscalls 305 338#define __NR_Linux_syscalls 310
334 339
335#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 340#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
336 341
337#define __NR_O32_Linux 4000 342#define __NR_O32_Linux 4000
338#define __NR_O32_Linux_syscalls 305 343#define __NR_O32_Linux_syscalls 310
339 344
340#if _MIPS_SIM == _MIPS_SIM_ABI64 345#if _MIPS_SIM == _MIPS_SIM_ABI64
341 346
@@ -595,7 +600,7 @@
595#define __NR_mknodat (__NR_Linux + 249) 600#define __NR_mknodat (__NR_Linux + 249)
596#define __NR_fchownat (__NR_Linux + 250) 601#define __NR_fchownat (__NR_Linux + 250)
597#define __NR_futimesat (__NR_Linux + 251) 602#define __NR_futimesat (__NR_Linux + 251)
598#define __NR_fstatat (__NR_Linux + 252) 603#define __NR_newfstatat (__NR_Linux + 252)
599#define __NR_unlinkat (__NR_Linux + 253) 604#define __NR_unlinkat (__NR_Linux + 253)
600#define __NR_renameat (__NR_Linux + 254) 605#define __NR_renameat (__NR_Linux + 254)
601#define __NR_linkat (__NR_Linux + 255) 606#define __NR_linkat (__NR_Linux + 255)
@@ -608,16 +613,21 @@
608#define __NR_unshare (__NR_Linux + 262) 613#define __NR_unshare (__NR_Linux + 262)
609#define __NR_splice (__NR_Linux + 263) 614#define __NR_splice (__NR_Linux + 263)
610#define __NR_sync_file_range (__NR_Linux + 264) 615#define __NR_sync_file_range (__NR_Linux + 264)
616#define __NR_tee (__NR_Linux + 265)
617#define __NR_vmsplice (__NR_Linux + 266)
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)
611 621
612/* 622/*
613 * Offset of the last Linux 64-bit flavoured syscall 623 * Offset of the last Linux 64-bit flavoured syscall
614 */ 624 */
615#define __NR_Linux_syscalls 264 625#define __NR_Linux_syscalls 269
616 626
617#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 627#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
618 628
619#define __NR_64_Linux 5000 629#define __NR_64_Linux 5000
620#define __NR_64_Linux_syscalls 264 630#define __NR_64_Linux_syscalls 269
621 631
622#if _MIPS_SIM == _MIPS_SIM_NABI32 632#if _MIPS_SIM == _MIPS_SIM_NABI32
623 633
@@ -881,7 +891,7 @@
881#define __NR_mknodat (__NR_Linux + 253) 891#define __NR_mknodat (__NR_Linux + 253)
882#define __NR_fchownat (__NR_Linux + 254) 892#define __NR_fchownat (__NR_Linux + 254)
883#define __NR_futimesat (__NR_Linux + 255) 893#define __NR_futimesat (__NR_Linux + 255)
884#define __NR_fstatat (__NR_Linux + 256) 894#define __NR_newfstatat (__NR_Linux + 256)
885#define __NR_unlinkat (__NR_Linux + 257) 895#define __NR_unlinkat (__NR_Linux + 257)
886#define __NR_renameat (__NR_Linux + 258) 896#define __NR_renameat (__NR_Linux + 258)
887#define __NR_linkat (__NR_Linux + 259) 897#define __NR_linkat (__NR_Linux + 259)
@@ -894,16 +904,21 @@
894#define __NR_unshare (__NR_Linux + 266) 904#define __NR_unshare (__NR_Linux + 266)
895#define __NR_splice (__NR_Linux + 267) 905#define __NR_splice (__NR_Linux + 267)
896#define __NR_sync_file_range (__NR_Linux + 268) 906#define __NR_sync_file_range (__NR_Linux + 268)
907#define __NR_tee (__NR_Linux + 269)
908#define __NR_vmsplice (__NR_Linux + 270)
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)
897 912
898/* 913/*
899 * Offset of the last N32 flavoured syscall 914 * Offset of the last N32 flavoured syscall
900 */ 915 */
901#define __NR_Linux_syscalls 268 916#define __NR_Linux_syscalls 273
902 917
903#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 918#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
904 919
905#define __NR_N32_Linux 6000 920#define __NR_N32_Linux 6000
906#define __NR_N32_Linux_syscalls 268 921#define __NR_N32_Linux_syscalls 273
907 922
908#ifdef __KERNEL__ 923#ifdef __KERNEL__
909 924
diff --git a/include/asm-mips/user.h b/include/asm-mips/user.h
index 89bf8b4cab..61f2a093b9 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-mips/vr41xx/capcella.h b/include/asm-mips/vr41xx/capcella.h
index d10ffda50d..e0ee05a3df 100644
--- a/include/asm-mips/vr41xx/capcella.h
+++ b/include/asm-mips/vr41xx/capcella.h
@@ -20,7 +20,7 @@
20#ifndef __ZAO_CAPCELLA_H 20#ifndef __ZAO_CAPCELLA_H
21#define __ZAO_CAPCELLA_H 21#define __ZAO_CAPCELLA_H
22 22
23#include <asm/vr41xx/vr41xx.h> 23#include <asm/vr41xx/irq.h>
24 24
25/* 25/*
26 * General-Purpose I/O Pin Number 26 * General-Purpose I/O Pin Number
diff --git a/include/asm-mips/vr41xx/cmbvr4133.h b/include/asm-mips/vr41xx/cmbvr4133.h
index 42af389019..9490ade58b 100644
--- a/include/asm-mips/vr41xx/cmbvr4133.h
+++ b/include/asm-mips/vr41xx/cmbvr4133.h
@@ -15,8 +15,7 @@
15#ifndef __NEC_CMBVR4133_H 15#ifndef __NEC_CMBVR4133_H
16#define __NEC_CMBVR4133_H 16#define __NEC_CMBVR4133_H
17 17
18#include <asm/addrspace.h> 18#include <asm/vr41xx/irq.h>
19#include <asm/vr41xx/vr41xx.h>
20 19
21/* 20/*
22 * General-Purpose I/O Pin Number 21 * General-Purpose I/O Pin Number
@@ -55,7 +54,4 @@
55#define IDE_SECONDARY_IRQ I8259_IRQ(15) 54#define IDE_SECONDARY_IRQ I8259_IRQ(15)
56#define I8259_IRQ_LAST IDE_SECONDARY_IRQ 55#define I8259_IRQ_LAST IDE_SECONDARY_IRQ
57 56
58#define RTC_PORT(x) (0xaf000100 + (x))
59#define RTC_IO_EXTENT 0x140
60
61#endif /* __NEC_CMBVR4133_H */ 57#endif /* __NEC_CMBVR4133_H */
diff --git a/include/asm-mips/vr41xx/e55.h b/include/asm-mips/vr41xx/e55.h
deleted file mode 100644
index 558f2269bf..0000000000
--- a/include/asm-mips/vr41xx/e55.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * e55.h, Include file for CASIO CASSIOPEIA E-10/15/55/65.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __CASIO_E55_H
21#define __CASIO_E55_H
22
23#include <asm/addrspace.h>
24#include <asm/vr41xx/vr41xx.h>
25
26/*
27 * Board specific address mapping
28 */
29#define VR41XX_ISA_MEM_BASE 0x10000000
30#define VR41XX_ISA_MEM_SIZE 0x04000000
31
32/* VR41XX_ISA_IO_BASE includes offset from real base. */
33#define VR41XX_ISA_IO_BASE 0x1400c000
34#define VR41XX_ISA_IO_SIZE 0x03ff4000
35
36#define ISA_BUS_IO_BASE 0
37#define ISA_BUS_IO_SIZE VR41XX_ISA_IO_SIZE
38
39#define IO_PORT_BASE KSEG1ADDR(VR41XX_ISA_IO_BASE)
40#define IO_PORT_RESOURCE_START ISA_BUS_IO_BASE
41#define IO_PORT_RESOURCE_END (ISA_BUS_IO_BASE + ISA_BUS_IO_SIZE - 1)
42
43#endif /* __CASIO_E55_H */
diff --git a/include/asm-mips/vr41xx/irq.h b/include/asm-mips/vr41xx/irq.h
new file mode 100644
index 0000000000..d315dfbc08
--- /dev/null
+++ b/include/asm-mips/vr41xx/irq.h
@@ -0,0 +1,101 @@
1/*
2 * include/asm-mips/vr41xx/irq.h
3 *
4 * Interrupt numbers for NEC VR4100 series.
5 *
6 * Copyright (C) 1999 Michael Klar
7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
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 __NEC_VR41XX_IRQ_H
18#define __NEC_VR41XX_IRQ_H
19
20/*
21 * CPU core Interrupt Numbers
22 */
23#define MIPS_CPU_IRQ_BASE 0
24#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
25#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
26#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
27#define INT0_IRQ MIPS_CPU_IRQ(2)
28#define INT1_IRQ MIPS_CPU_IRQ(3)
29#define INT2_IRQ MIPS_CPU_IRQ(4)
30#define INT3_IRQ MIPS_CPU_IRQ(5)
31#define INT4_IRQ MIPS_CPU_IRQ(6)
32#define TIMER_IRQ MIPS_CPU_IRQ(7)
33
34/*
35 * SYINT1 Interrupt Numbers
36 */
37#define SYSINT1_IRQ_BASE 8
38#define SYSINT1_IRQ(x) (SYSINT1_IRQ_BASE + (x))
39#define BATTRY_IRQ SYSINT1_IRQ(0)
40#define POWER_IRQ SYSINT1_IRQ(1)
41#define RTCLONG1_IRQ SYSINT1_IRQ(2)
42#define ELAPSEDTIME_IRQ SYSINT1_IRQ(3)
43/* RFU */
44#define PIU_IRQ SYSINT1_IRQ(5)
45#define AIU_IRQ SYSINT1_IRQ(6)
46#define KIU_IRQ SYSINT1_IRQ(7)
47#define GIUINT_IRQ SYSINT1_IRQ(8)
48#define SIU_IRQ SYSINT1_IRQ(9)
49#define BUSERR_IRQ SYSINT1_IRQ(10)
50#define SOFTINT_IRQ SYSINT1_IRQ(11)
51#define CLKRUN_IRQ SYSINT1_IRQ(12)
52#define DOZEPIU_IRQ SYSINT1_IRQ(13)
53#define SYSINT1_IRQ_LAST DOZEPIU_IRQ
54
55/*
56 * SYSINT2 Interrupt Numbers
57 */
58#define SYSINT2_IRQ_BASE 24
59#define SYSINT2_IRQ(x) (SYSINT2_IRQ_BASE + (x))
60#define RTCLONG2_IRQ SYSINT2_IRQ(0)
61#define LED_IRQ SYSINT2_IRQ(1)
62#define HSP_IRQ SYSINT2_IRQ(2)
63#define TCLOCK_IRQ SYSINT2_IRQ(3)
64#define FIR_IRQ SYSINT2_IRQ(4)
65#define CEU_IRQ SYSINT2_IRQ(4) /* same number as FIR_IRQ */
66#define DSIU_IRQ SYSINT2_IRQ(5)
67#define PCI_IRQ SYSINT2_IRQ(6)
68#define SCU_IRQ SYSINT2_IRQ(7)
69#define CSI_IRQ SYSINT2_IRQ(8)
70#define BCU_IRQ SYSINT2_IRQ(9)
71#define ETHERNET_IRQ SYSINT2_IRQ(10)
72#define SYSINT2_IRQ_LAST ETHERNET_IRQ
73
74/*
75 * GIU Interrupt Numbers
76 */
77#define GIU_IRQ_BASE 40
78#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */
79#define GIU_IRQ_LAST GIU_IRQ(31)
80
81/*
82 * VRC4173 Interrupt Numbers
83 */
84#define VRC4173_IRQ_BASE 72
85#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
86#define VRC4173_USB_IRQ VRC4173_IRQ(0)
87#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
88#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
89#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
90#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
91#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
92#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
93#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
94#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
95#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
96#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
97/* RFU */
98#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
99#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
100
101#endif /* __NEC_VR41XX_IRQ_H */
diff --git a/include/asm-mips/vr41xx/mpc30x.h b/include/asm-mips/vr41xx/mpc30x.h
index a6cbe4da66..1d67df843d 100644
--- a/include/asm-mips/vr41xx/mpc30x.h
+++ b/include/asm-mips/vr41xx/mpc30x.h
@@ -20,7 +20,7 @@
20#ifndef __VICTOR_MPC30X_H 20#ifndef __VICTOR_MPC30X_H
21#define __VICTOR_MPC30X_H 21#define __VICTOR_MPC30X_H
22 22
23#include <asm/vr41xx/vr41xx.h> 23#include <asm/vr41xx/irq.h>
24 24
25/* 25/*
26 * General-Purpose I/O Pin Number 26 * General-Purpose I/O Pin Number
diff --git a/include/asm-mips/vr41xx/tb0219.h b/include/asm-mips/vr41xx/tb0219.h
index b318b9612a..dc981b4be0 100644
--- a/include/asm-mips/vr41xx/tb0219.h
+++ b/include/asm-mips/vr41xx/tb0219.h
@@ -23,7 +23,7 @@
23#ifndef __TANBAC_TB0219_H 23#ifndef __TANBAC_TB0219_H
24#define __TANBAC_TB0219_H 24#define __TANBAC_TB0219_H
25 25
26#include <asm/vr41xx/vr41xx.h> 26#include <asm/vr41xx/irq.h>
27 27
28/* 28/*
29 * General-Purpose I/O Pin Number 29 * General-Purpose I/O Pin Number
diff --git a/include/asm-mips/vr41xx/tb0226.h b/include/asm-mips/vr41xx/tb0226.h
index 2513f450e2..de527dcfa5 100644
--- a/include/asm-mips/vr41xx/tb0226.h
+++ b/include/asm-mips/vr41xx/tb0226.h
@@ -20,7 +20,7 @@
20#ifndef __TANBAC_TB0226_H 20#ifndef __TANBAC_TB0226_H
21#define __TANBAC_TB0226_H 21#define __TANBAC_TB0226_H
22 22
23#include <asm/vr41xx/vr41xx.h> 23#include <asm/vr41xx/irq.h>
24 24
25/* 25/*
26 * General-Purpose I/O Pin Number 26 * General-Purpose I/O Pin Number
diff --git a/include/asm-mips/vr41xx/tb0287.h b/include/asm-mips/vr41xx/tb0287.h
index dd9832313a..61bead68ab 100644
--- a/include/asm-mips/vr41xx/tb0287.h
+++ b/include/asm-mips/vr41xx/tb0287.h
@@ -22,7 +22,7 @@
22#ifndef __TANBAC_TB0287_H 22#ifndef __TANBAC_TB0287_H
23#define __TANBAC_TB0287_H 23#define __TANBAC_TB0287_H
24 24
25#include <asm/vr41xx/vr41xx.h> 25#include <asm/vr41xx/irq.h>
26 26
27/* 27/*
28 * General-Purpose I/O Pin Number 28 * General-Purpose I/O Pin Number
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index 70828d5fae..dd3eb3dc58 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -74,59 +74,6 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
74/* 74/*
75 * Interrupt Control Unit 75 * Interrupt Control Unit
76 */ 76 */
77/* CPU core Interrupt Numbers */
78#define MIPS_CPU_IRQ_BASE 0
79#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
80#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
81#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
82#define INT0_IRQ MIPS_CPU_IRQ(2)
83#define INT1_IRQ MIPS_CPU_IRQ(3)
84#define INT2_IRQ MIPS_CPU_IRQ(4)
85#define INT3_IRQ MIPS_CPU_IRQ(5)
86#define INT4_IRQ MIPS_CPU_IRQ(6)
87#define TIMER_IRQ MIPS_CPU_IRQ(7)
88
89/* SYINT1 Interrupt Numbers */
90#define SYSINT1_IRQ_BASE 8
91#define SYSINT1_IRQ(x) (SYSINT1_IRQ_BASE + (x))
92#define BATTRY_IRQ SYSINT1_IRQ(0)
93#define POWER_IRQ SYSINT1_IRQ(1)
94#define RTCLONG1_IRQ SYSINT1_IRQ(2)
95#define ELAPSEDTIME_IRQ SYSINT1_IRQ(3)
96/* RFU */
97#define PIU_IRQ SYSINT1_IRQ(5)
98#define AIU_IRQ SYSINT1_IRQ(6)
99#define KIU_IRQ SYSINT1_IRQ(7)
100#define GIUINT_IRQ SYSINT1_IRQ(8)
101#define SIU_IRQ SYSINT1_IRQ(9)
102#define BUSERR_IRQ SYSINT1_IRQ(10)
103#define SOFTINT_IRQ SYSINT1_IRQ(11)
104#define CLKRUN_IRQ SYSINT1_IRQ(12)
105#define DOZEPIU_IRQ SYSINT1_IRQ(13)
106#define SYSINT1_IRQ_LAST DOZEPIU_IRQ
107
108/* SYSINT2 Interrupt Numbers */
109#define SYSINT2_IRQ_BASE 24
110#define SYSINT2_IRQ(x) (SYSINT2_IRQ_BASE + (x))
111#define RTCLONG2_IRQ SYSINT2_IRQ(0)
112#define LED_IRQ SYSINT2_IRQ(1)
113#define HSP_IRQ SYSINT2_IRQ(2)
114#define TCLOCK_IRQ SYSINT2_IRQ(3)
115#define FIR_IRQ SYSINT2_IRQ(4)
116#define CEU_IRQ SYSINT2_IRQ(4) /* same number as FIR_IRQ */
117#define DSIU_IRQ SYSINT2_IRQ(5)
118#define PCI_IRQ SYSINT2_IRQ(6)
119#define SCU_IRQ SYSINT2_IRQ(7)
120#define CSI_IRQ SYSINT2_IRQ(8)
121#define BCU_IRQ SYSINT2_IRQ(9)
122#define ETHERNET_IRQ SYSINT2_IRQ(10)
123#define SYSINT2_IRQ_LAST ETHERNET_IRQ
124
125/* GIU Interrupt Numbers */
126#define GIU_IRQ_BASE 40
127#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */
128#define GIU_IRQ_LAST GIU_IRQ(31)
129
130extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); 77extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
131extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *)); 78extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *));
132 79
diff --git a/include/asm-mips/vr41xx/vrc4173.h b/include/asm-mips/vr41xx/vrc4173.h
deleted file mode 100644
index 96fdcd54ce..0000000000
--- a/include/asm-mips/vr41xx/vrc4173.h
+++ /dev/null
@@ -1,221 +0,0 @@
1/*
2 * vrc4173.h, Include file for NEC VRC4173.
3 *
4 * Copyright (C) 2000 Michael R. McDonald
5 * Copyright (C) 2001-2003 Montavista Software Inc.
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
7 * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
8 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
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 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __NEC_VRC4173_H
25#define __NEC_VRC4173_H
26
27#include <asm/io.h>
28
29/*
30 * Interrupt Number
31 */
32#define VRC4173_IRQ_BASE 72
33#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
34#define VRC4173_USB_IRQ VRC4173_IRQ(0)
35#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
36#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
37#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
38#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
39#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
40#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
41#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
42#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
43#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
44#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
45/* RFU */
46#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
47#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
48
49/*
50 * PCI I/O accesses
51 */
52#ifdef CONFIG_VRC4173
53
54extern unsigned long vrc4173_io_offset;
55
56#define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0)
57
58#define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port))
59#define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port))
60#define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port))
61#define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port))
62#define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port))
63#define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port))
64
65#define vrc4173_inb(port) inb(vrc4173_io_offset+(port))
66#define vrc4173_inw(port) inw(vrc4173_io_offset+(port))
67#define vrc4173_inl(port) inl(vrc4173_io_offset+(port))
68#define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port))
69#define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port))
70#define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port))
71
72#define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count))
73#define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count))
74#define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count))
75
76#define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count))
77#define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count))
78#define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count))
79
80#else
81
82#define set_vrc4173_io_offset(offset) do {} while (0)
83
84#define vrc4173_outb(val,port) do {} while (0)
85#define vrc4173_outw(val,port) do {} while (0)
86#define vrc4173_outl(val,port) do {} while (0)
87#define vrc4173_outb_p(val,port) do {} while (0)
88#define vrc4173_outw_p(val,port) do {} while (0)
89#define vrc4173_outl_p(val,port) do {} while (0)
90
91#define vrc4173_inb(port) 0
92#define vrc4173_inw(port) 0
93#define vrc4173_inl(port) 0
94#define vrc4173_inb_p(port) 0
95#define vrc4173_inw_p(port) 0
96#define vrc4173_inl_p(port) 0
97
98#define vrc4173_outsb(port,addr,count) do {} while (0)
99#define vrc4173_outsw(port,addr,count) do {} while (0)
100#define vrc4173_outsl(port,addr,count) do {} while (0)
101
102#define vrc4173_insb(port,addr,count) do {} while (0)
103#define vrc4173_insw(port,addr,count) do {} while (0)
104#define vrc4173_insl(port,addr,count) do {} while (0)
105
106#endif
107
108/*
109 * Clock Mask Unit
110 */
111typedef enum vrc4173_clock {
112 VRC4173_PIU_CLOCK,
113 VRC4173_KIU_CLOCK,
114 VRC4173_AIU_CLOCK,
115 VRC4173_PS2_CH1_CLOCK,
116 VRC4173_PS2_CH2_CLOCK,
117 VRC4173_USBU_PCI_CLOCK,
118 VRC4173_CARDU1_PCI_CLOCK,
119 VRC4173_CARDU2_PCI_CLOCK,
120 VRC4173_AC97U_PCI_CLOCK,
121 VRC4173_USBU_48MHz_CLOCK,
122 VRC4173_EXT_48MHz_CLOCK,
123 VRC4173_48MHz_CLOCK,
124} vrc4173_clock_t;
125
126#ifdef CONFIG_VRC4173
127
128extern void vrc4173_supply_clock(vrc4173_clock_t clock);
129extern void vrc4173_mask_clock(vrc4173_clock_t clock);
130
131#else
132
133static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {}
134static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {}
135
136#endif
137
138/*
139 * Interupt Control Unit
140 */
141
142#define VRC4173_PIUINT_COMMAND 0x0040
143#define VRC4173_PIUINT_DATA 0x0020
144#define VRC4173_PIUINT_PAGE1 0x0010
145#define VRC4173_PIUINT_PAGE0 0x0008
146#define VRC4173_PIUINT_DATALOST 0x0004
147#define VRC4173_PIUINT_STATUSCHANGE 0x0001
148
149#ifdef CONFIG_VRC4173
150
151extern void vrc4173_enable_piuint(uint16_t mask);
152extern void vrc4173_disable_piuint(uint16_t mask);
153
154#else
155
156static inline void vrc4173_enable_piuint(uint16_t mask) {}
157static inline void vrc4173_disable_piuint(uint16_t mask) {}
158
159#endif
160
161#define VRC4173_AIUINT_INPUT_DMAEND 0x0800
162#define VRC4173_AIUINT_INPUT_DMAHALT 0x0400
163#define VRC4173_AIUINT_INPUT_DATALOST 0x0200
164#define VRC4173_AIUINT_INPUT_DATA 0x0100
165#define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008
166#define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004
167#define VRC4173_AIUINT_OUTPUT_NODATA 0x0002
168
169#ifdef CONFIG_VRC4173
170
171extern void vrc4173_enable_aiuint(uint16_t mask);
172extern void vrc4173_disable_aiuint(uint16_t mask);
173
174#else
175
176static inline void vrc4173_enable_aiuint(uint16_t mask) {}
177static inline void vrc4173_disable_aiuint(uint16_t mask) {}
178
179#endif
180
181#define VRC4173_KIUINT_DATALOST 0x0004
182#define VRC4173_KIUINT_DATAREADY 0x0002
183#define VRC4173_KIUINT_SCAN 0x0001
184
185#ifdef CONFIG_VRC4173
186
187extern void vrc4173_enable_kiuint(uint16_t mask);
188extern void vrc4173_disable_kiuint(uint16_t mask);
189
190#else
191
192static inline void vrc4173_enable_kiuint(uint16_t mask) {}
193static inline void vrc4173_disable_kiuint(uint16_t mask) {}
194
195#endif
196
197/*
198 * General-Purpose I/O Unit
199 */
200typedef enum vrc4173_function {
201 PS2_CHANNEL1,
202 PS2_CHANNEL2,
203 TOUCHPANEL,
204 KEYBOARD_8SCANLINES,
205 KEYBOARD_10SCANLINES,
206 KEYBOARD_12SCANLINES,
207 GPIO_0_15PINS,
208 GPIO_16_20PINS,
209} vrc4173_function_t;
210
211#ifdef CONFIG_VRC4173
212
213extern void vrc4173_select_function(vrc4173_function_t function);
214
215#else
216
217static inline void vrc4173_select_function(vrc4173_function_t function) {}
218
219#endif
220
221#endif /* __NEC_VRC4173_H */
diff --git a/include/asm-mips/vr41xx/workpad.h b/include/asm-mips/vr41xx/workpad.h
deleted file mode 100644
index 6bfa9c009a..0000000000
--- a/include/asm-mips/vr41xx/workpad.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * workpad.h, Include file for IBM WorkPad z50.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __IBM_WORKPAD_H
21#define __IBM_WORKPAD_H
22
23#include <asm/addrspace.h>
24#include <asm/vr41xx/vr41xx.h>
25
26/*
27 * Board specific address mapping
28 */
29#define VR41XX_ISA_MEM_BASE 0x10000000
30#define VR41XX_ISA_MEM_SIZE 0x04000000
31
32/* VR41XX_ISA_IO_BASE includes offset from real base. */
33#define VR41XX_ISA_IO_BASE 0x15000000
34#define VR41XX_ISA_IO_SIZE 0x03000000
35
36#define ISA_BUS_IO_BASE 0
37#define ISA_BUS_IO_SIZE VR41XX_ISA_IO_SIZE
38
39#define IO_PORT_BASE KSEG1ADDR(VR41XX_ISA_IO_BASE)
40#define IO_PORT_RESOURCE_START ISA_BUS_IO_BASE
41#define IO_PORT_RESOURCE_END (ISA_BUS_IO_BASE + ISA_BUS_IO_SIZE - 1)
42
43#endif /* __IBM_WORKPAD_H */
diff --git a/include/asm-parisc/Kbuild b/include/asm-parisc/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-parisc/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
index 3ce3440d1b..1a7bfe699e 100644
--- a/include/asm-parisc/assembly.h
+++ b/include/asm-parisc/assembly.h
@@ -48,6 +48,7 @@
48#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE) 48#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE)
49 49
50#ifdef CONFIG_PA20 50#ifdef CONFIG_PA20
51#define LDCW ldcw,co
51#define BL b,l 52#define BL b,l
52# ifdef CONFIG_64BIT 53# ifdef CONFIG_64BIT
53# define LEVEL 2.0w 54# define LEVEL 2.0w
@@ -55,6 +56,7 @@
55# define LEVEL 2.0 56# define LEVEL 2.0
56# endif 57# endif
57#else 58#else
59#define LDCW ldcw
58#define BL bl 60#define BL bl
59#define LEVEL 1.1 61#define LEVEL 1.1
60#endif 62#endif
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 289624d8b2..71b4eeea20 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -5,6 +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 9
9#define COMPAT_USER_HZ 100 10#define COMPAT_USER_HZ 100
10 11
@@ -149,4 +150,14 @@ static __inline__ void __user *compat_alloc_user_space(long len)
149 return (void __user *)regs->gr[30]; 150 return (void __user *)regs->gr[30];
150} 151}
151 152
153static inline int __is_compat_task(struct task_struct *t)
154{
155 return personality(t->personality) == PER_LINUX32;
156}
157
158static inline int is_compat_task(void)
159{
160 return __is_compat_task(current);
161}
162
152#endif /* _ASM_PARISC_COMPAT_H */ 163#endif /* _ASM_PARISC_COMPAT_H */
diff --git a/include/asm-parisc/floppy.h b/include/asm-parisc/floppy.h
index ca3aed768c..da2f9c1571 100644
--- a/include/asm-parisc/floppy.h
+++ b/include/asm-parisc/floppy.h
@@ -156,13 +156,11 @@ static int vdma_get_dma_residue(unsigned int dummy)
156static int fd_request_irq(void) 156static int fd_request_irq(void)
157{ 157{
158 if(can_use_virtual_dma) 158 if(can_use_virtual_dma)
159 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 159 return request_irq(FLOPPY_IRQ, floppy_hardint,
160 "floppy", NULL); 160 IRQF_DISABLED, "floppy", NULL);
161 else 161 else
162 return request_irq(FLOPPY_IRQ, floppy_interrupt, 162 return request_irq(FLOPPY_IRQ, floppy_interrupt,
163 SA_INTERRUPT|SA_SAMPLE_RANDOM, 163 IRQF_DISABLED, "floppy", NULL);
164 "floppy", NULL);
165
166} 164}
167 165
168static unsigned long dma_mem_alloc(unsigned long size) 166static unsigned long dma_mem_alloc(unsigned long size)
diff --git a/include/asm-parisc/hw_irq.h b/include/asm-parisc/hw_irq.h
index 151426e275..6707f7df39 100644
--- a/include/asm-parisc/hw_irq.h
+++ b/include/asm-parisc/hw_irq.h
@@ -3,15 +3,6 @@
3 3
4/* 4/*
5 * linux/include/asm/hw_irq.h 5 * linux/include/asm/hw_irq.h
6 *
7 * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
8 *
9 * moved some of the old arch/i386/kernel/irq.h to here. VY
10 *
11 * IRQ/IPI changes taken from work by Thomas Radke
12 * <tomsoft@informatik.tu-chemnitz.de>
13 */ 6 */
14 7
15extern void hw_resend_irq(struct hw_interrupt_type *, unsigned int);
16
17#endif 8#endif
diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h
index 377ba90c7d..5cae260615 100644
--- a/include/asm-parisc/irq.h
+++ b/include/asm-parisc/irq.h
@@ -26,11 +26,6 @@
26 26
27#define NR_IRQS (CPU_IRQ_MAX + 1) 27#define NR_IRQS (CPU_IRQ_MAX + 1)
28 28
29/*
30 * IRQ line status macro IRQ_PER_CPU is used
31 */
32#define ARCH_HAS_IRQ_PER_CPU
33
34static __inline__ int irq_canonicalize(int irq) 29static __inline__ int irq_canonicalize(int irq)
35{ 30{
36 return (irq == 2) ? 9 : irq; 31 return (irq == 2) ? 9 : irq;
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 0695bc958d..57d6d82756 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -1,22 +1,14 @@
1#ifndef _PARISC_PAGE_H 1#ifndef _PARISC_PAGE_H
2#define _PARISC_PAGE_H 2#define _PARISC_PAGE_H
3 3
4#if !defined(__KERNEL__)
5/* this is for userspace applications (4k page size) */
6# define PAGE_SHIFT 12 /* 4k */
7# define PAGE_SIZE (1UL << PAGE_SHIFT)
8# define PAGE_MASK (~(PAGE_SIZE-1))
9#endif
10
11
12#ifdef __KERNEL__ 4#ifdef __KERNEL__
13 5
14#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) 6#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
15# define PAGE_SHIFT 12 /* 4k */ 7# define PAGE_SHIFT 12
16#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB) 8#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
17# define PAGE_SHIFT 14 /* 16k */ 9# define PAGE_SHIFT 14
18#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB) 10#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
19# define PAGE_SHIFT 16 /* 64k */ 11# define PAGE_SHIFT 16
20#else 12#else
21# error "unknown default kernel page size" 13# error "unknown default kernel page size"
22#endif 14#endif
@@ -188,9 +180,9 @@ extern int npmem_ranges;
188#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 180#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
189 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 181 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
190 182
191#endif /* __KERNEL__ */
192
193#include <asm-generic/memory_model.h> 183#include <asm-generic/memory_model.h>
194#include <asm-generic/page.h> 184#include <asm-generic/page.h>
195 185
186#endif /* __KERNEL__ */
187
196#endif /* _PARISC_PAGE_H */ 188#endif /* _PARISC_PAGE_H */
diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
index 08364f957e..c9b2e35326 100644
--- a/include/asm-parisc/pdc.h
+++ b/include/asm-parisc/pdc.h
@@ -278,12 +278,11 @@ typedef struct {
278/* constants for OS (NVM...) */ 278/* constants for OS (NVM...) */
279#define OS_ID_NONE 0 /* Undefined OS ID */ 279#define OS_ID_NONE 0 /* Undefined OS ID */
280#define OS_ID_HPUX 1 /* HP-UX OS */ 280#define OS_ID_HPUX 1 /* HP-UX OS */
281#define OS_ID_LINUX OS_ID_HPUX /* just use the same value as hpux */
282#define OS_ID_MPEXL 2 /* MPE XL OS */ 281#define OS_ID_MPEXL 2 /* MPE XL OS */
283#define OS_ID_OSF 3 /* OSF OS */ 282#define OS_ID_OSF 3 /* OSF OS */
284#define OS_ID_HPRT 4 /* HP-RT OS */ 283#define OS_ID_HPRT 4 /* HP-RT OS */
285#define OS_ID_NOVEL 5 /* NOVELL OS */ 284#define OS_ID_NOVEL 5 /* NOVELL OS */
286#define OS_ID_NT 6 /* NT OS */ 285#define OS_ID_LINUX 6 /* Linux */
287 286
288 287
289/* constants for PDC_CHASSIS */ 288/* constants for PDC_CHASSIS */
@@ -352,8 +351,8 @@ struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
352 cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */ 351 cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */
353 cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */ 352 cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */
354 cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */ 353 cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */
355 cc_pad1 : 5, /* reserved */ 354 cc_pad1 : 10, /* reserved */
356 cc_assoc: 8; /* associativity of I/D-cache */ 355 cc_hv : 3; /* hversion dependent */
357}; 356};
358 357
359struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ 358struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */
@@ -719,6 +718,7 @@ void setup_pdc(void); /* in inventory.c */
719int pdc_add_valid(unsigned long address); 718int pdc_add_valid(unsigned long address);
720int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len); 719int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
721int pdc_chassis_disp(unsigned long disp); 720int pdc_chassis_disp(unsigned long disp);
721int pdc_chassis_warn(unsigned long *warn);
722int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info); 722int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
723int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index, 723int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
724 void *iodc_data, unsigned int iodc_data_size); 724 void *iodc_data, unsigned int iodc_data_size);
@@ -732,6 +732,7 @@ int pdc_model_cpuid(unsigned long *cpu_id);
732int pdc_model_versions(unsigned long *versions, int id); 732int pdc_model_versions(unsigned long *versions, int id);
733int pdc_model_capabilities(unsigned long *capabilities); 733int pdc_model_capabilities(unsigned long *capabilities);
734int pdc_cache_info(struct pdc_cache_info *cache); 734int pdc_cache_info(struct pdc_cache_info *cache);
735int pdc_spaceid_bits(unsigned long *space_bits);
735#ifndef CONFIG_PA20 736#ifndef CONFIG_PA20
736int pdc_btlb_info(struct pdc_btlb_info *btlb); 737int pdc_btlb_info(struct pdc_btlb_info *btlb);
737int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path); 738int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
@@ -775,6 +776,18 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
775 776
776extern void pdc_init(void); 777extern void pdc_init(void);
777 778
779static inline char * os_id_to_string(u16 os_id) {
780 switch(os_id) {
781 case OS_ID_NONE: return "No OS";
782 case OS_ID_HPUX: return "HP-UX";
783 case OS_ID_MPEXL: return "MPE-iX";
784 case OS_ID_OSF: return "OSF";
785 case OS_ID_HPRT: return "HP-RT";
786 case OS_ID_NOVEL: return "Novell Netware";
787 case OS_ID_LINUX: return "Linux";
788 default: return "Unknown";
789 }
790}
778#endif /* __ASSEMBLY__ */ 791#endif /* __ASSEMBLY__ */
779 792
780#endif /* _PARISC_PDC_H */ 793#endif /* _PARISC_PDC_H */
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index b6bcc672ba..c0b61e0d14 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -303,7 +303,8 @@ static inline void pmd_clear(pmd_t *pmd) {
303 303
304 304
305#if PT_NLEVELS == 3 305#if PT_NLEVELS == 3
306#define pgd_page(pgd) ((unsigned long) __va(pgd_address(pgd))) 306#define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_address(pgd)))
307#define pgd_page(pgd) virt_to_page((void *)pgd_page_vaddr(pgd))
307 308
308/* For 64 bit we have three level tables */ 309/* For 64 bit we have three level tables */
309 310
@@ -382,7 +383,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
382 383
383#define pte_page(pte) (pfn_to_page(pte_pfn(pte))) 384#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
384 385
385#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_address(pmd))) 386#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_address(pmd)))
386 387
387#define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd))) 388#define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd)))
388#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) 389#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
@@ -400,7 +401,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
400 401
401#if PT_NLEVELS == 3 402#if PT_NLEVELS == 3
402#define pmd_offset(dir,address) \ 403#define pmd_offset(dir,address) \
403((pmd_t *) pgd_page(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) 404((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1)))
404#else 405#else
405#define pmd_offset(dir,addr) ((pmd_t *) dir) 406#define pmd_offset(dir,addr) ((pmd_t *) dir)
406#endif 407#endif
@@ -408,7 +409,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
408/* Find an entry in the third-level page table.. */ 409/* Find an entry in the third-level page table.. */
409#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) 410#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
410#define pte_offset_kernel(pmd, address) \ 411#define pte_offset_kernel(pmd, address) \
411 ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) 412 ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address))
412#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) 413#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
413#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) 414#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
414#define pte_unmap(pte) do { } while (0) 415#define pte_unmap(pte) do { } while (0)
@@ -506,13 +507,13 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
506 507
507/* TLB page size encoding - see table 3-1 in parisc20.pdf */ 508/* TLB page size encoding - see table 3-1 in parisc20.pdf */
508#define _PAGE_SIZE_ENCODING_4K 0 509#define _PAGE_SIZE_ENCODING_4K 0
509#define _PAGE_SIZE_ENCODING_16K 1 510#define _PAGE_SIZE_ENCODING_16K 1
510#define _PAGE_SIZE_ENCODING_64K 2 511#define _PAGE_SIZE_ENCODING_64K 2
511#define _PAGE_SIZE_ENCODING_256K 3 512#define _PAGE_SIZE_ENCODING_256K 3
512#define _PAGE_SIZE_ENCODING_1M 4 513#define _PAGE_SIZE_ENCODING_1M 4
513#define _PAGE_SIZE_ENCODING_4M 5 514#define _PAGE_SIZE_ENCODING_4M 5
514#define _PAGE_SIZE_ENCODING_16M 6 515#define _PAGE_SIZE_ENCODING_16M 6
515#define _PAGE_SIZE_ENCODING_64M 7 516#define _PAGE_SIZE_ENCODING_64M 7
516 517
517#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) 518#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
518# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K 519# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index ca49dc91f4..b73626f040 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -26,14 +26,12 @@
26 * Default implementation of macro that returns current 26 * Default implementation of macro that returns current
27 * instruction pointer ("program counter"). 27 * instruction pointer ("program counter").
28 */ 28 */
29 29#ifdef CONFIG_PA20
30/* We cannot use MFIA as it was added for PA2.0 - prumpf 30#define current_ia(x) __asm__("mfia %0" : "=r"(x))
31 31#else /* mfia added in pa2.0 */
32 At one point there were no "0f/0b" type local symbols in gas for 32#define current_ia(x) __asm__("blr 0,%0\n\tnop" : "=r"(x))
33 PA-RISC. This is no longer true, but this still seems like the 33#endif
34 nicest way to implement this. */ 34#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
35
36#define current_text_addr() ({ void *pc; __asm__("\n\tblr 0,%0\n\tnop":"=r" (pc)); pc; })
37 35
38#define TASK_SIZE (current->thread.task_size) 36#define TASK_SIZE (current->thread.task_size)
39#define TASK_UNMAPPED_BASE (current->thread.map_base) 37#define TASK_UNMAPPED_BASE (current->thread.map_base)
diff --git a/include/asm-parisc/signal.h b/include/asm-parisc/signal.h
index 25cb23ef7d..98a82fa0cf 100644
--- a/include/asm-parisc/signal.h
+++ b/include/asm-parisc/signal.h
@@ -48,7 +48,6 @@
48 * SA_FLAGS values: 48 * SA_FLAGS values:
49 * 49 *
50 * SA_ONSTACK indicates that a registered stack_t will be used. 50 * SA_ONSTACK indicates that a registered stack_t will be used.
51 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
52 * SA_RESTART flag to get restarting signals (which were the default long ago) 51 * SA_RESTART flag to get restarting signals (which were the default long ago)
53 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 52 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
54 * SA_RESETHAND clears the handler when the signal is delivered. 53 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -69,7 +68,6 @@
69 68
70#define SA_NOMASK SA_NODEFER 69#define SA_NOMASK SA_NODEFER
71#define SA_ONESHOT SA_RESETHAND 70#define SA_ONESHOT SA_RESETHAND
72#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
73 71
74#define SA_RESTORER 0x04000000 /* obsolete -- ignored */ 72#define SA_RESTORER 0x04000000 /* obsolete -- ignored */
75 73
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index 1bf54dc53c..ce2eae1708 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 0x401c 48#define SO_ACCEPTCONN 0x401c
49 49
50#define SO_PEERSEC 0x401d 50#define SO_PEERSEC 0x401d
51#define SO_PASSSEC 0x401e
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index 863876134b..74f037a39e 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -143,8 +143,6 @@ static inline void set_eiem(unsigned long val)
143#define read_barrier_depends() do { } while(0) 143#define read_barrier_depends() do { } while(0)
144 144
145#define set_mb(var, value) do { var = value; mb(); } while (0) 145#define set_mb(var, value) do { var = value; mb(); } while (0)
146#define set_wmb(var, value) do { var = value; wmb(); } while (0)
147
148 146
149#ifndef CONFIG_PA20 147#ifndef CONFIG_PA20
150/* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data, 148/* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data,
@@ -155,13 +153,14 @@ static inline void set_eiem(unsigned long val)
155 type and dynamically select the 16-byte aligned int from the array 153 type and dynamically select the 16-byte aligned int from the array
156 for the semaphore. */ 154 for the semaphore. */
157 155
158#define __PA_LDCW_ALIGNMENT 16 156#define __PA_LDCW_ALIGNMENT 16
159#define __ldcw_align(a) ({ \ 157#define __ldcw_align(a) ({ \
160 unsigned long __ret = (unsigned long) &(a)->lock[0]; \ 158 unsigned long __ret = (unsigned long) &(a)->lock[0]; \
161 __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1); \ 159 __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) \
162 (volatile unsigned int *) __ret; \ 160 & ~(__PA_LDCW_ALIGNMENT - 1); \
161 (volatile unsigned int *) __ret; \
163}) 162})
164#define LDCW "ldcw" 163#define __LDCW "ldcw"
165 164
166#else /*CONFIG_PA20*/ 165#else /*CONFIG_PA20*/
167/* From: "Jim Hull" <jim.hull of hp.com> 166/* From: "Jim Hull" <jim.hull of hp.com>
@@ -171,17 +170,18 @@ static inline void set_eiem(unsigned long val)
171 they only require "natural" alignment (4-byte for ldcw, 8-byte for 170 they only require "natural" alignment (4-byte for ldcw, 8-byte for
172 ldcd). */ 171 ldcd). */
173 172
174#define __PA_LDCW_ALIGNMENT 4 173#define __PA_LDCW_ALIGNMENT 4
175#define __ldcw_align(a) ((volatile unsigned int *)a) 174#define __ldcw_align(a) ((volatile unsigned int *)a)
176#define LDCW "ldcw,co" 175#define __LDCW "ldcw,co"
177 176
178#endif /*!CONFIG_PA20*/ 177#endif /*!CONFIG_PA20*/
179 178
180/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */ 179/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */
181#define __ldcw(a) ({ \ 180#define __ldcw(a) ({ \
182 unsigned __ret; \ 181 unsigned __ret; \
183 __asm__ __volatile__(LDCW " 0(%1),%0" : "=r" (__ret) : "r" (a)); \ 182 __asm__ __volatile__(__LDCW " 0(%1),%0" \
184 __ret; \ 183 : "=r" (__ret) : "r" (a)); \
184 __ret; \
185}) 185})
186 186
187#ifdef CONFIG_SMP 187#ifdef CONFIG_SMP
diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h
index f6c417c8c4..d973e8b346 100644
--- a/include/asm-parisc/uaccess.h
+++ b/include/asm-parisc/uaccess.h
@@ -172,7 +172,11 @@ struct exception_data {
172/* 172/*
173 * The "__put_user/kernel_asm()" macros tell gcc they read from memory 173 * The "__put_user/kernel_asm()" macros tell gcc they read from memory
174 * instead of writing. This is because they do not write to any memory 174 * instead of writing. This is because they do not write to any memory
175 * gcc knows about, so there are no aliasing issues. 175 * gcc knows about, so there are no aliasing issues. These macros must
176 * also be aware that "fixup_put_user_skip_[12]" are executed in the
177 * context of the fault, and any registers used there must be listed
178 * as clobbers. In this case only "r1" is used by the current routines.
179 * r8/r9 are already listed as err/val.
176 */ 180 */
177 181
178#ifdef __LP64__ 182#ifdef __LP64__
@@ -183,7 +187,8 @@ struct exception_data {
183 "\t.dword\t1b,fixup_put_user_skip_1\n" \ 187 "\t.dword\t1b,fixup_put_user_skip_1\n" \
184 "\t.previous" \ 188 "\t.previous" \
185 : "=r"(__pu_err) \ 189 : "=r"(__pu_err) \
186 : "r"(ptr), "r"(x), "0"(__pu_err)) 190 : "r"(ptr), "r"(x), "0"(__pu_err) \
191 : "r1")
187 192
188#define __put_user_asm(stx,x,ptr) \ 193#define __put_user_asm(stx,x,ptr) \
189 __asm__ __volatile__ ( \ 194 __asm__ __volatile__ ( \
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
index 12b867238a..27bcfad1c3 100644
--- a/include/asm-parisc/unistd.h
+++ b/include/asm-parisc/unistd.h
@@ -797,11 +797,6 @@
797 797
798#define SYS_ify(syscall_name) __NR_##syscall_name 798#define SYS_ify(syscall_name) __NR_##syscall_name
799 799
800/* Assume all syscalls are done from PIC code just to be
801 * safe. The worst case scenario is that you lose a register
802 * and save/restore r19 across the syscall. */
803#define PIC
804
805#ifndef ASM_LINE_SEP 800#ifndef ASM_LINE_SEP
806# define ASM_LINE_SEP ; 801# define ASM_LINE_SEP ;
807#endif 802#endif
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild
new file mode 100644
index 0000000000..9827849953
--- /dev/null
+++ b/include/asm-powerpc/Kbuild
@@ -0,0 +1,41 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += auxvec.h
4header-y += ioctls.h
5header-y += mman.h
6header-y += sembuf.h
7header-y += siginfo.h
8header-y += stat.h
9header-y += errno.h
10header-y += ipcbuf.h
11header-y += msgbuf.h
12header-y += shmbuf.h
13header-y += socket.h
14header-y += termbits.h
15header-y += fcntl.h
16header-y += ipc.h
17header-y += poll.h
18header-y += shmparam.h
19header-y += sockios.h
20header-y += ucontext.h
21header-y += ioctl.h
22header-y += linkage.h
23header-y += resource.h
24header-y += sigcontext.h
25header-y += statfs.h
26
27unifdef-y += a.out.h
28unifdef-y += asm-compat.h
29unifdef-y += bootx.h
30unifdef-y += byteorder.h
31unifdef-y += cputable.h
32unifdef-y += elf.h
33unifdef-y += nvram.h
34unifdef-y += param.h
35unifdef-y += posix_types.h
36unifdef-y += ptrace.h
37unifdef-y += seccomp.h
38unifdef-y += signal.h
39unifdef-y += termios.h
40unifdef-y += types.h
41unifdef-y += unistd.h
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h
index bb3c0ab7e6..53283e2540 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -27,8 +27,8 @@ static __inline__ void atomic_add(int a, atomic_t *v)
27 PPC405_ERR77(0,%3) 27 PPC405_ERR77(0,%3)
28" stwcx. %0,0,%3 \n\ 28" stwcx. %0,0,%3 \n\
29 bne- 1b" 29 bne- 1b"
30 : "=&r" (t), "=m" (v->counter) 30 : "=&r" (t), "+m" (v->counter)
31 : "r" (a), "r" (&v->counter), "m" (v->counter) 31 : "r" (a), "r" (&v->counter)
32 : "cc"); 32 : "cc");
33} 33}
34 34
@@ -63,8 +63,8 @@ static __inline__ void atomic_sub(int a, atomic_t *v)
63 PPC405_ERR77(0,%3) 63 PPC405_ERR77(0,%3)
64" stwcx. %0,0,%3 \n\ 64" stwcx. %0,0,%3 \n\
65 bne- 1b" 65 bne- 1b"
66 : "=&r" (t), "=m" (v->counter) 66 : "=&r" (t), "+m" (v->counter)
67 : "r" (a), "r" (&v->counter), "m" (v->counter) 67 : "r" (a), "r" (&v->counter)
68 : "cc"); 68 : "cc");
69} 69}
70 70
@@ -97,8 +97,8 @@ static __inline__ void atomic_inc(atomic_t *v)
97 PPC405_ERR77(0,%2) 97 PPC405_ERR77(0,%2)
98" stwcx. %0,0,%2 \n\ 98" stwcx. %0,0,%2 \n\
99 bne- 1b" 99 bne- 1b"
100 : "=&r" (t), "=m" (v->counter) 100 : "=&r" (t), "+m" (v->counter)
101 : "r" (&v->counter), "m" (v->counter) 101 : "r" (&v->counter)
102 : "cc"); 102 : "cc");
103} 103}
104 104
@@ -141,8 +141,8 @@ static __inline__ void atomic_dec(atomic_t *v)
141 PPC405_ERR77(0,%2)\ 141 PPC405_ERR77(0,%2)\
142" stwcx. %0,0,%2\n\ 142" stwcx. %0,0,%2\n\
143 bne- 1b" 143 bne- 1b"
144 : "=&r" (t), "=m" (v->counter) 144 : "=&r" (t), "+m" (v->counter)
145 : "r" (&v->counter), "m" (v->counter) 145 : "r" (&v->counter)
146 : "cc"); 146 : "cc");
147} 147}
148 148
@@ -253,8 +253,8 @@ static __inline__ void atomic64_add(long a, atomic64_t *v)
253 add %0,%2,%0\n\ 253 add %0,%2,%0\n\
254 stdcx. %0,0,%3 \n\ 254 stdcx. %0,0,%3 \n\
255 bne- 1b" 255 bne- 1b"
256 : "=&r" (t), "=m" (v->counter) 256 : "=&r" (t), "+m" (v->counter)
257 : "r" (a), "r" (&v->counter), "m" (v->counter) 257 : "r" (a), "r" (&v->counter)
258 : "cc"); 258 : "cc");
259} 259}
260 260
@@ -287,8 +287,8 @@ static __inline__ void atomic64_sub(long a, atomic64_t *v)
287 subf %0,%2,%0\n\ 287 subf %0,%2,%0\n\
288 stdcx. %0,0,%3 \n\ 288 stdcx. %0,0,%3 \n\
289 bne- 1b" 289 bne- 1b"
290 : "=&r" (t), "=m" (v->counter) 290 : "=&r" (t), "+m" (v->counter)
291 : "r" (a), "r" (&v->counter), "m" (v->counter) 291 : "r" (a), "r" (&v->counter)
292 : "cc"); 292 : "cc");
293} 293}
294 294
@@ -319,8 +319,8 @@ static __inline__ void atomic64_inc(atomic64_t *v)
319 addic %0,%0,1\n\ 319 addic %0,%0,1\n\
320 stdcx. %0,0,%2 \n\ 320 stdcx. %0,0,%2 \n\
321 bne- 1b" 321 bne- 1b"
322 : "=&r" (t), "=m" (v->counter) 322 : "=&r" (t), "+m" (v->counter)
323 : "r" (&v->counter), "m" (v->counter) 323 : "r" (&v->counter)
324 : "cc"); 324 : "cc");
325} 325}
326 326
@@ -361,8 +361,8 @@ static __inline__ void atomic64_dec(atomic64_t *v)
361 addic %0,%0,-1\n\ 361 addic %0,%0,-1\n\
362 stdcx. %0,0,%2\n\ 362 stdcx. %0,0,%2\n\
363 bne- 1b" 363 bne- 1b"
364 : "=&r" (t), "=m" (v->counter) 364 : "=&r" (t), "+m" (v->counter)
365 : "r" (&v->counter), "m" (v->counter) 365 : "r" (&v->counter)
366 : "cc"); 366 : "cc");
367} 367}
368 368
diff --git a/include/asm-powerpc/backlight.h b/include/asm-powerpc/backlight.h
index 1ba1f27a0b..8cf5c37c38 100644
--- a/include/asm-powerpc/backlight.h
+++ b/include/asm-powerpc/backlight.h
@@ -2,30 +2,40 @@
2 * Routines for handling backlight control on PowerBooks 2 * Routines for handling backlight control on PowerBooks
3 * 3 *
4 * For now, implementation resides in 4 * For now, implementation resides in
5 * arch/powerpc/platforms/powermac/pmac_support.c 5 * arch/powerpc/platforms/powermac/backlight.c
6 * 6 *
7 */ 7 */
8#ifndef __ASM_POWERPC_BACKLIGHT_H 8#ifndef __ASM_POWERPC_BACKLIGHT_H
9#define __ASM_POWERPC_BACKLIGHT_H 9#define __ASM_POWERPC_BACKLIGHT_H
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12/* Abstract values */ 12#include <linux/fb.h>
13#define BACKLIGHT_OFF 0 13#include <linux/mutex.h>
14#define BACKLIGHT_MIN 1
15#define BACKLIGHT_MAX 0xf
16 14
17struct backlight_controller { 15/* For locking instructions, see the implementation file */
18 int (*set_enable)(int enable, int level, void *data); 16extern struct backlight_device *pmac_backlight;
19 int (*set_level)(int level, void *data); 17extern struct mutex pmac_backlight_mutex;
20};
21 18
22extern void register_backlight_controller(struct backlight_controller *ctrler, void *data, char *type); 19extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
23extern void unregister_backlight_controller(struct backlight_controller *ctrler, void *data);
24 20
25extern int set_backlight_enable(int enable); 21extern int pmac_has_backlight_type(const char *type);
26extern int get_backlight_enable(void); 22
27extern int set_backlight_level(int level); 23extern void pmac_backlight_key(int direction);
28extern int get_backlight_level(void); 24static inline void pmac_backlight_key_up(void)
25{
26 pmac_backlight_key(0);
27}
28static inline void pmac_backlight_key_down(void)
29{
30 pmac_backlight_key(1);
31}
32
33extern void pmac_backlight_set_legacy_brightness_pmu(int brightness);
34extern int pmac_backlight_set_legacy_brightness(int brightness);
35extern int pmac_backlight_get_legacy_brightness(void);
36
37extern void pmac_backlight_enable(void);
38extern void pmac_backlight_disable(void);
29 39
30#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
31#endif 41#endif
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 76e2f08c3c..c341063d08 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -65,8 +65,8 @@ static __inline__ void set_bit(int nr, volatile unsigned long *addr)
65 PPC405_ERR77(0,%3) 65 PPC405_ERR77(0,%3)
66 PPC_STLCX "%0,0,%3\n" 66 PPC_STLCX "%0,0,%3\n"
67 "bne- 1b" 67 "bne- 1b"
68 : "=&r"(old), "=m"(*p) 68 : "=&r" (old), "+m" (*p)
69 : "r"(mask), "r"(p), "m"(*p) 69 : "r" (mask), "r" (p)
70 : "cc" ); 70 : "cc" );
71} 71}
72 72
@@ -82,8 +82,8 @@ static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
82 PPC405_ERR77(0,%3) 82 PPC405_ERR77(0,%3)
83 PPC_STLCX "%0,0,%3\n" 83 PPC_STLCX "%0,0,%3\n"
84 "bne- 1b" 84 "bne- 1b"
85 : "=&r"(old), "=m"(*p) 85 : "=&r" (old), "+m" (*p)
86 : "r"(mask), "r"(p), "m"(*p) 86 : "r" (mask), "r" (p)
87 : "cc" ); 87 : "cc" );
88} 88}
89 89
@@ -99,8 +99,8 @@ static __inline__ void change_bit(int nr, volatile unsigned long *addr)
99 PPC405_ERR77(0,%3) 99 PPC405_ERR77(0,%3)
100 PPC_STLCX "%0,0,%3\n" 100 PPC_STLCX "%0,0,%3\n"
101 "bne- 1b" 101 "bne- 1b"
102 : "=&r"(old), "=m"(*p) 102 : "=&r" (old), "+m" (*p)
103 : "r"(mask), "r"(p), "m"(*p) 103 : "r" (mask), "r" (p)
104 : "cc" ); 104 : "cc" );
105} 105}
106 106
@@ -179,8 +179,8 @@ static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
179 "or %0,%0,%2\n" 179 "or %0,%0,%2\n"
180 PPC_STLCX "%0,0,%3\n" 180 PPC_STLCX "%0,0,%3\n"
181 "bne- 1b" 181 "bne- 1b"
182 : "=&r" (old), "=m" (*addr) 182 : "=&r" (old), "+m" (*addr)
183 : "r" (mask), "r" (addr), "m" (*addr) 183 : "r" (mask), "r" (addr)
184 : "cc"); 184 : "cc");
185} 185}
186 186
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index f44b529e32..978b2c7e84 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/cputable.h b/include/asm-powerpc/cputable.h
index fab41c280a..12707ab9dc 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -23,6 +23,7 @@
23#define PPC_FEATURE_SMT 0x00004000 23#define PPC_FEATURE_SMT 0x00004000
24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
25#define PPC_FEATURE_ARCH_2_05 0x00001000 25#define PPC_FEATURE_ARCH_2_05 0x00001000
26#define PPC_FEATURE_PA6T 0x00000800
26 27
27#define PPC_FEATURE_TRUE_LE 0x00000002 28#define PPC_FEATURE_TRUE_LE 0x00000002
28#define PPC_FEATURE_PPC_LE 0x00000001 29#define PPC_FEATURE_PPC_LE 0x00000001
@@ -36,6 +37,7 @@
36struct cpu_spec; 37struct cpu_spec;
37 38
38typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 39typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
40typedef void (*cpu_restore_t)(void);
39 41
40enum powerpc_oprofile_type { 42enum powerpc_oprofile_type {
41 PPC_OPROFILE_INVALID = 0, 43 PPC_OPROFILE_INVALID = 0,
@@ -65,6 +67,8 @@ struct cpu_spec {
65 * BHT, SPD, etc... from head.S before branching to identify_machine 67 * BHT, SPD, etc... from head.S before branching to identify_machine
66 */ 68 */
67 cpu_setup_t cpu_setup; 69 cpu_setup_t cpu_setup;
70 /* Used to restore cpu setup on secondary processors and at resume */
71 cpu_restore_t cpu_restore;
68 72
69 /* Used by oprofile userspace to select the right counters */ 73 /* Used by oprofile userspace to select the right counters */
70 char *oprofile_cpu_type; 74 char *oprofile_cpu_type;
@@ -117,43 +121,35 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
117#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000) 121#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000)
118#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000) 122#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000)
119 123
124/*
125 * Add the 64-bit processor unique features in the top half of the word;
126 * on 32-bit, make the names available but defined to be 0.
127 */
120#ifdef __powerpc64__ 128#ifdef __powerpc64__
121/* Add the 64b processor unique features in the top half of the word */ 129#define LONG_ASM_CONST(x) ASM_CONST(x)
122#define CPU_FTR_SLB ASM_CONST(0x0000000100000000)
123#define CPU_FTR_16M_PAGE ASM_CONST(0x0000000200000000)
124#define CPU_FTR_TLBIEL ASM_CONST(0x0000000400000000)
125#define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000800000000)
126#define CPU_FTR_IABR ASM_CONST(0x0000002000000000)
127#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000)
128#define CPU_FTR_CTRL ASM_CONST(0x0000008000000000)
129#define CPU_FTR_SMT ASM_CONST(0x0000010000000000)
130#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
131#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
132#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
133#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000)
134#define CPU_FTR_PURR ASM_CONST(0x0000400000000000)
135#else 130#else
136/* ensure on 32b processors the flags are available for compiling but 131#define LONG_ASM_CONST(x) 0
137 * don't do anything */
138#define CPU_FTR_SLB ASM_CONST(0x0)
139#define CPU_FTR_16M_PAGE ASM_CONST(0x0)
140#define CPU_FTR_TLBIEL ASM_CONST(0x0)
141#define CPU_FTR_NOEXECUTE ASM_CONST(0x0)
142#define CPU_FTR_IABR ASM_CONST(0x0)
143#define CPU_FTR_MMCRA ASM_CONST(0x0)
144#define CPU_FTR_CTRL ASM_CONST(0x0)
145#define CPU_FTR_SMT ASM_CONST(0x0)
146#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0)
147#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0)
148#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0)
149#define CPU_FTR_PURR ASM_CONST(0x0)
150#endif 132#endif
151 133
134#define CPU_FTR_SLB LONG_ASM_CONST(0x0000000100000000)
135#define CPU_FTR_16M_PAGE LONG_ASM_CONST(0x0000000200000000)
136#define CPU_FTR_TLBIEL LONG_ASM_CONST(0x0000000400000000)
137#define CPU_FTR_NOEXECUTE LONG_ASM_CONST(0x0000000800000000)
138#define CPU_FTR_IABR LONG_ASM_CONST(0x0000002000000000)
139#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000004000000000)
140#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000008000000000)
141#define CPU_FTR_SMT LONG_ASM_CONST(0x0000010000000000)
142#define CPU_FTR_COHERENT_ICACHE LONG_ASM_CONST(0x0000020000000000)
143#define CPU_FTR_LOCKLESS_TLBIE LONG_ASM_CONST(0x0000040000000000)
144#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000)
145#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
146#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000)
147
152#ifndef __ASSEMBLY__ 148#ifndef __ASSEMBLY__
153 149
154#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ 150#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \
155 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ 151 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
156 CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL) 152 CPU_FTR_NODSISRALIGN)
157 153
158/* iSeries doesn't support large pages */ 154/* iSeries doesn't support large pages */
159#ifdef CONFIG_PPC_ISERIES 155#ifdef CONFIG_PPC_ISERIES
@@ -318,24 +314,29 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
318 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ 314 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
319 CPU_FTR_MMCRA | CPU_FTR_CTRL) 315 CPU_FTR_MMCRA | CPU_FTR_CTRL)
320#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 316#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
321 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA) 317 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
318 CPU_FTR_MMCRA)
322#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 319#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
323 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 320 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
324 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) 321 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
325#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 322#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
326 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 323 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
327 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 324 CPU_FTR_MMCRA | CPU_FTR_SMT | \
328 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 325 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
329 CPU_FTR_PURR) 326 CPU_FTR_PURR)
330#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 327#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
331 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 328 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
332 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 329 CPU_FTR_MMCRA | CPU_FTR_SMT | \
333 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 330 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
334 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE) 331 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE)
335#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 332#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
336 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 333 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
337 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 334 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
338 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 335 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
336#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
339 CPU_FTR_PURR | CPU_FTR_REAL_LE)
339#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 340#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
340 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
341#endif 342#endif
@@ -344,7 +345,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
344#define CPU_FTRS_POSSIBLE \ 345#define CPU_FTRS_POSSIBLE \
345 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 346 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
346 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 347 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
347 CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE) 348 CPU_FTRS_CELL | CPU_FTRS_PA6T)
348#else 349#else
349enum { 350enum {
350 CPU_FTRS_POSSIBLE = 351 CPU_FTRS_POSSIBLE =
@@ -383,7 +384,7 @@ enum {
383#define CPU_FTRS_ALWAYS \ 384#define CPU_FTRS_ALWAYS \
384 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ 385 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
385 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ 386 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \
386 CPU_FTRS_CELL & CPU_FTRS_POSSIBLE) 387 CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE)
387#else 388#else
388enum { 389enum {
389 CPU_FTRS_ALWAYS = 390 CPU_FTRS_ALWAYS =
diff --git a/include/asm-powerpc/cputime.h b/include/asm-powerpc/cputime.h
index a21185d478..3108044852 100644
--- a/include/asm-powerpc/cputime.h
+++ b/include/asm-powerpc/cputime.h
@@ -43,6 +43,7 @@ typedef u64 cputime64_t;
43 43
44#define cputime64_zero ((cputime64_t)0) 44#define cputime64_zero ((cputime64_t)0)
45#define cputime64_add(__a, __b) ((__a) + (__b)) 45#define cputime64_add(__a, __b) ((__a) + (__b))
46#define cputime64_sub(__a, __b) ((__a) - (__b))
46#define cputime_to_cputime64(__ct) (__ct) 47#define cputime_to_cputime64(__ct) (__ct)
47 48
48#ifdef __KERNEL__ 49#ifdef __KERNEL__
@@ -74,6 +75,23 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif)
74 return ct; 75 return ct;
75} 76}
76 77
78static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
79{
80 cputime_t ct;
81 u64 sec;
82
83 /* have to be a little careful about overflow */
84 ct = jif % HZ;
85 sec = jif / HZ;
86 if (ct) {
87 ct *= tb_ticks_per_sec;
88 do_div(ct, HZ);
89 }
90 if (sec)
91 ct += (cputime_t) sec * tb_ticks_per_sec;
92 return ct;
93}
94
77static inline u64 cputime64_to_jiffies64(const cputime_t ct) 95static inline u64 cputime64_to_jiffies64(const cputime_t ct)
78{ 96{
79 return mulhdu(ct, __cputime_jiffies_factor); 97 return mulhdu(ct, __cputime_jiffies_factor);
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
index 4df3e80118..6a78439666 100644
--- a/include/asm-powerpc/eeh.h
+++ b/include/asm-powerpc/eeh.h
@@ -205,6 +205,7 @@ static inline void eeh_memset_io(volatile void __iomem *addr, int c,
205 lc |= lc << 8; 205 lc |= lc << 8;
206 lc |= lc << 16; 206 lc |= lc << 16;
207 207
208 __asm__ __volatile__ ("sync" : : : "memory");
208 while(n && !EEH_CHECK_ALIGN(p, 4)) { 209 while(n && !EEH_CHECK_ALIGN(p, 4)) {
209 *((volatile u8 *)p) = c; 210 *((volatile u8 *)p) = c;
210 p++; 211 p++;
@@ -229,6 +230,7 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr
229 void *destsave = dest; 230 void *destsave = dest;
230 unsigned long nsave = n; 231 unsigned long nsave = n;
231 232
233 __asm__ __volatile__ ("sync" : : : "memory");
232 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { 234 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
233 *((u8 *)dest) = *((volatile u8 *)vsrc); 235 *((u8 *)dest) = *((volatile u8 *)vsrc);
234 __asm__ __volatile__ ("eieio" : : : "memory"); 236 __asm__ __volatile__ ("eieio" : : : "memory");
@@ -266,6 +268,7 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
266{ 268{
267 void *vdest = (void __force *) dest; 269 void *vdest = (void __force *) dest;
268 270
271 __asm__ __volatile__ ("sync" : : : "memory");
269 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { 272 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
270 *((volatile u8 *)vdest) = *((u8 *)src); 273 *((volatile u8 *)vdest) = *((u8 *)src);
271 src++; 274 src++;
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index 7e2d169ee8..fd242a2233 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -27,8 +27,7 @@
27#define fd_disable_irq() disable_irq(FLOPPY_IRQ) 27#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
28#define fd_cacheflush(addr,size) /* nothing */ 28#define fd_cacheflush(addr,size) /* nothing */
29#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ 29#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
30 SA_INTERRUPT|SA_SAMPLE_RANDOM, \ 30 IRQF_DISABLED, "floppy", NULL)
31 "floppy", NULL)
32#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 31#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
33 32
34#ifdef CONFIG_PCI 33#ifdef CONFIG_PCI
diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h
index f1b3c00bc1..936422e548 100644
--- a/include/asm-powerpc/futex.h
+++ b/include/asm-powerpc/futex.h
@@ -84,7 +84,33 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
84static inline int 84static inline int
85futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) 85futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
86{ 86{
87 return -ENOSYS; 87 int prev;
88
89 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
90 return -EFAULT;
91
92 __asm__ __volatile__ (
93 LWSYNC_ON_SMP
94"1: lwarx %0,0,%2 # futex_atomic_cmpxchg_inatomic\n\
95 cmpw 0,%0,%3\n\
96 bne- 3f\n"
97 PPC405_ERR77(0,%2)
98"2: stwcx. %4,0,%2\n\
99 bne- 1b\n"
100 ISYNC_ON_SMP
101"3: .section .fixup,\"ax\"\n\
1024: li %0,%5\n\
103 b 3b\n\
104 .previous\n\
105 .section __ex_table,\"a\"\n\
106 .align 3\n\
107 " PPC_LONG "1b,4b,2b,4b\n\
108 .previous" \
109 : "=&r" (prev), "+m" (*uaddr)
110 : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT)
111 : "cc", "memory");
112
113 return prev;
88} 114}
89 115
90#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 0d3c4e8571..257d1cecb8 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -164,9 +164,15 @@
164#define H_VIO_SIGNAL 0x104 164#define H_VIO_SIGNAL 0x104
165#define H_SEND_CRQ 0x108 165#define H_SEND_CRQ 0x108
166#define H_COPY_RDMA 0x110 166#define H_COPY_RDMA 0x110
167#define H_REGISTER_LOGICAL_LAN 0x114
168#define H_FREE_LOGICAL_LAN 0x118
169#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
170#define H_SEND_LOGICAL_LAN 0x120
171#define H_MULTICAST_CTRL 0x130
167#define H_SET_XDABR 0x134 172#define H_SET_XDABR 0x134
168#define H_STUFF_TCE 0x138 173#define H_STUFF_TCE 0x138
169#define H_PUT_TCE_INDIRECT 0x13C 174#define H_PUT_TCE_INDIRECT 0x13C
175#define H_CHANGE_LOGICAL_LAN_MAC 0x14C
170#define H_VTERM_PARTNER_INFO 0x150 176#define H_VTERM_PARTNER_INFO 0x150
171#define H_REGISTER_VTERM 0x154 177#define H_REGISTER_VTERM 0x154
172#define H_FREE_VTERM 0x158 178#define H_FREE_VTERM 0x158
@@ -196,102 +202,59 @@
196#define H_GET_HCA_INFO 0x1B8 202#define H_GET_HCA_INFO 0x1B8
197#define H_GET_PERF_COUNT 0x1BC 203#define H_GET_PERF_COUNT 0x1BC
198#define H_MANAGE_TRACE 0x1C0 204#define H_MANAGE_TRACE 0x1C0
205#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
199#define H_QUERY_INT_STATE 0x1E4 206#define H_QUERY_INT_STATE 0x1E4
200#define H_POLL_PENDING 0x1D8 207#define H_POLL_PENDING 0x1D8
201#define H_JOIN 0x298 208#define H_JOIN 0x298
202#define H_VASI_STATE 0x2A4 209#define H_VASI_STATE 0x2A4
203#define H_ENABLE_CRQ 0x2B0 210#define H_ENABLE_CRQ 0x2B0
211#define MAX_HCALL_OPCODE H_ENABLE_CRQ
204 212
205#ifndef __ASSEMBLY__ 213#ifndef __ASSEMBLY__
206 214
207/* plpar_hcall() -- Generic call interface using above opcodes 215/**
216 * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
217 * @opcode: The hypervisor call to make.
208 * 218 *
209 * The actual call interface is a hypervisor call instruction with 219 * This call supports up to 7 arguments and only returns the status of
210 * the opcode in R3 and input args in R4-R7. 220 * the hcall. Use this version where possible, its slightly faster than
211 * Status is returned in R3 with variable output values in R4-R11. 221 * the other plpar_hcalls.
212 * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now
213 * and return only two out args which MUST ALWAYS BE PROVIDED.
214 */
215long plpar_hcall(unsigned long opcode,
216 unsigned long arg1,
217 unsigned long arg2,
218 unsigned long arg3,
219 unsigned long arg4,
220 unsigned long *out1,
221 unsigned long *out2,
222 unsigned long *out3);
223
224/* Same as plpar_hcall but for those opcodes that return no values
225 * other than status. Slightly more efficient.
226 */ 222 */
227long plpar_hcall_norets(unsigned long opcode, ...); 223long plpar_hcall_norets(unsigned long opcode, ...);
228 224
229/* 225/**
230 * Special hcall interface for ibmveth support. 226 * plpar_hcall: - Make a pseries hypervisor call
231 * Takes 8 input parms. Returns a rc and stores the 227 * @opcode: The hypervisor call to make.
232 * R4 return value in *out1. 228 * @retbuf: Buffer to store up to 4 return arguments in.
233 */
234long plpar_hcall_8arg_2ret(unsigned long opcode,
235 unsigned long arg1,
236 unsigned long arg2,
237 unsigned long arg3,
238 unsigned long arg4,
239 unsigned long arg5,
240 unsigned long arg6,
241 unsigned long arg7,
242 unsigned long arg8,
243 unsigned long *out1);
244
245/* plpar_hcall_4out()
246 * 229 *
247 * same as plpar_hcall except with 4 output arguments. 230 * This call supports up to 6 arguments and 4 return arguments. Use
231 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
248 * 232 *
233 * Used for all but the craziest of phyp interfaces (see plpar_hcall9)
249 */ 234 */
250long plpar_hcall_4out(unsigned long opcode, 235#define PLPAR_HCALL_BUFSIZE 4
251 unsigned long arg1, 236long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
252 unsigned long arg2,
253 unsigned long arg3,
254 unsigned long arg4,
255 unsigned long *out1,
256 unsigned long *out2,
257 unsigned long *out3,
258 unsigned long *out4);
259 237
260long plpar_hcall_7arg_7ret(unsigned long opcode, 238/**
261 unsigned long arg1, 239 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
262 unsigned long arg2, 240 * @opcode: The hypervisor call to make.
263 unsigned long arg3, 241 * @retbuf: Buffer to store up to 9 return arguments in.
264 unsigned long arg4, 242 *
265 unsigned long arg5, 243 * This call supports up to 9 arguments and 9 return arguments. Use
266 unsigned long arg6, 244 * PLPAR_HCALL9_BUFSIZE to size the return argument buffer.
267 unsigned long arg7, 245 */
268 unsigned long *out1, 246#define PLPAR_HCALL9_BUFSIZE 9
269 unsigned long *out2, 247long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
270 unsigned long *out3,
271 unsigned long *out4,
272 unsigned long *out5,
273 unsigned long *out6,
274 unsigned long *out7);
275 248
276long plpar_hcall_9arg_9ret(unsigned long opcode, 249/* For hcall instrumentation. One structure per-hcall, per-CPU */
277 unsigned long arg1, 250struct hcall_stats {
278 unsigned long arg2, 251 unsigned long num_calls; /* number of calls (on this CPU) */
279 unsigned long arg3, 252 unsigned long tb_total; /* total wall time (mftb) of calls. */
280 unsigned long arg4, 253 unsigned long purr_total; /* total cpu time (PURR) of calls. */
281 unsigned long arg5, 254};
282 unsigned long arg6, 255void update_hcall_stats(unsigned long opcode, unsigned long tb_delta,
283 unsigned long arg7, 256 unsigned long purr_delta);
284 unsigned long arg8, 257#define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1)
285 unsigned long arg9,
286 unsigned long *out1,
287 unsigned long *out2,
288 unsigned long *out3,
289 unsigned long *out4,
290 unsigned long *out5,
291 unsigned long *out6,
292 unsigned long *out7,
293 unsigned long *out8,
294 unsigned long *out9);
295 258
296#endif /* __ASSEMBLY__ */ 259#endif /* __ASSEMBLY__ */
297#endif /* __KERNEL__ */ 260#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/hw_irq.h b/include/asm-powerpc/hw_irq.h
index ce0f7db63c..d40359204a 100644
--- a/include/asm-powerpc/hw_irq.h
+++ b/include/asm-powerpc/hw_irq.h
@@ -86,27 +86,27 @@ static inline void local_irq_save_ptr(unsigned long *flags)
86#define mask_irq(irq) \ 86#define mask_irq(irq) \
87 ({ \ 87 ({ \
88 irq_desc_t *desc = get_irq_desc(irq); \ 88 irq_desc_t *desc = get_irq_desc(irq); \
89 if (desc->handler && desc->handler->disable) \ 89 if (desc->chip && desc->chip->disable) \
90 desc->handler->disable(irq); \ 90 desc->chip->disable(irq); \
91 }) 91 })
92#define unmask_irq(irq) \ 92#define unmask_irq(irq) \
93 ({ \ 93 ({ \
94 irq_desc_t *desc = get_irq_desc(irq); \ 94 irq_desc_t *desc = get_irq_desc(irq); \
95 if (desc->handler && desc->handler->enable) \ 95 if (desc->chip && desc->chip->enable) \
96 desc->handler->enable(irq); \ 96 desc->chip->enable(irq); \
97 }) 97 })
98#define ack_irq(irq) \ 98#define ack_irq(irq) \
99 ({ \ 99 ({ \
100 irq_desc_t *desc = get_irq_desc(irq); \ 100 irq_desc_t *desc = get_irq_desc(irq); \
101 if (desc->handler && desc->handler->ack) \ 101 if (desc->chip && desc->chip->ack) \
102 desc->handler->ack(irq); \ 102 desc->chip->ack(irq); \
103 }) 103 })
104 104
105/* Should we handle this via lost interrupts and IPIs or should we don't care like 105/*
106 * we do now ? --BenH. 106 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
107 * or should we not care like we do now ? --BenH.
107 */ 108 */
108struct hw_interrupt_type; 109struct hw_interrupt_type;
109static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
110 110
111#endif /* __KERNEL__ */ 111#endif /* __KERNEL__ */
112#endif /* _ASM_POWERPC_HW_IRQ_H */ 112#endif /* _ASM_POWERPC_HW_IRQ_H */
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h
index 0392159e16..c80e113052 100644
--- a/include/asm-powerpc/i8259.h
+++ b/include/asm-powerpc/i8259.h
@@ -4,11 +4,13 @@
4 4
5#include <linux/irq.h> 5#include <linux/irq.h>
6 6
7extern struct hw_interrupt_type i8259_pic; 7#ifdef CONFIG_PPC_MERGE
8 8extern void i8259_init(struct device_node *node, unsigned long intack_addr);
9extern unsigned int i8259_irq(struct pt_regs *regs);
10#else
9extern void i8259_init(unsigned long intack_addr, int offset); 11extern void i8259_init(unsigned long intack_addr, int offset);
10extern int i8259_irq(struct pt_regs *regs); 12extern int i8259_irq(struct pt_regs *regs);
11extern int i8259_irq_cascade(struct pt_regs *regs, void *unused); 13#endif
12 14
13#endif /* __KERNEL__ */ 15#endif /* __KERNEL__ */
14#endif /* _ASM_POWERPC_I8259_H */ 16#endif /* _ASM_POWERPC_I8259_H */
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 7a42723d10..7ab195a278 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -48,7 +48,7 @@ extern struct dma_mapping_ops ibmebus_dma_ops;
48extern struct bus_type ibmebus_bus_type; 48extern struct bus_type ibmebus_bus_type;
49 49
50struct ibmebus_dev { 50struct ibmebus_dev {
51 char *name; 51 const char *name;
52 struct of_device ofdev; 52 struct of_device ofdev;
53}; 53};
54 54
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index b09b42af6a..c8390f9485 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -12,6 +12,7 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <asm/mpc8xx.h> 13#include <asm/mpc8xx.h>
14#endif 14#endif
15#include <asm/io.h>
15 16
16#ifndef MAX_HWIFS 17#ifndef MAX_HWIFS
17#ifdef __powerpc64__ 18#ifdef __powerpc64__
@@ -21,15 +22,14 @@
21#endif 22#endif
22#endif 23#endif
23 24
25#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
26#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
27#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
28#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
29
24#ifndef __powerpc64__ 30#ifndef __powerpc64__
25#include <linux/hdreg.h> 31#include <linux/hdreg.h>
26#include <linux/ioport.h> 32#include <linux/ioport.h>
27#include <asm/io.h>
28
29extern void __ide_mm_insw(void __iomem *port, void *addr, u32 count);
30extern void __ide_mm_outsw(void __iomem *port, void *addr, u32 count);
31extern void __ide_mm_insl(void __iomem *port, void *addr, u32 count);
32extern void __ide_mm_outsl(void __iomem *port, void *addr, u32 count);
33 33
34struct ide_machdep_calls { 34struct ide_machdep_calls {
35 int (*default_irq)(unsigned long base); 35 int (*default_irq)(unsigned long base);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index a9496f34b0..46bae1cf38 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -19,20 +19,12 @@ extern int check_legacy_ioport(unsigned long base_port);
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <asm/page.h> 20#include <asm/page.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22#ifdef CONFIG_PPC_ISERIES 22#include <asm/paca.h>
23#include <asm/iseries/iseries_io.h>
24#endif
25#include <asm/synch.h> 23#include <asm/synch.h>
26#include <asm/delay.h> 24#include <asm/delay.h>
27 25
28#include <asm-generic/iomap.h> 26#include <asm-generic/iomap.h>
29 27
30#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
31#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
32#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
33#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
34
35
36#define SIO_CONFIG_RA 0x398 28#define SIO_CONFIG_RA 0x398
37#define SIO_CONFIG_RD 0x399 29#define SIO_CONFIG_RD 0x399
38 30
@@ -42,39 +34,53 @@ extern unsigned long isa_io_base;
42extern unsigned long pci_io_base; 34extern unsigned long pci_io_base;
43 35
44#ifdef CONFIG_PPC_ISERIES 36#ifdef CONFIG_PPC_ISERIES
45/* __raw_* accessors aren't supported on iSeries */ 37
46#define __raw_readb(addr) { BUG(); 0; } 38extern int in_8(const volatile unsigned char __iomem *addr);
47#define __raw_readw(addr) { BUG(); 0; } 39extern void out_8(volatile unsigned char __iomem *addr, int val);
48#define __raw_readl(addr) { BUG(); 0; } 40extern int in_le16(const volatile unsigned short __iomem *addr);
49#define __raw_readq(addr) { BUG(); 0; } 41extern int in_be16(const volatile unsigned short __iomem *addr);
50#define __raw_writeb(v, addr) { BUG(); 0; } 42extern void out_le16(volatile unsigned short __iomem *addr, int val);
51#define __raw_writew(v, addr) { BUG(); 0; } 43extern void out_be16(volatile unsigned short __iomem *addr, int val);
52#define __raw_writel(v, addr) { BUG(); 0; } 44extern unsigned in_le32(const volatile unsigned __iomem *addr);
53#define __raw_writeq(v, addr) { BUG(); 0; } 45extern unsigned in_be32(const volatile unsigned __iomem *addr);
54#define readb(addr) iSeries_Read_Byte(addr) 46extern void out_le32(volatile unsigned __iomem *addr, int val);
55#define readw(addr) iSeries_Read_Word(addr) 47extern void out_be32(volatile unsigned __iomem *addr, int val);
56#define readl(addr) iSeries_Read_Long(addr) 48extern unsigned long in_le64(const volatile unsigned long __iomem *addr);
57#define writeb(data, addr) iSeries_Write_Byte((data),(addr)) 49extern unsigned long in_be64(const volatile unsigned long __iomem *addr);
58#define writew(data, addr) iSeries_Write_Word((data),(addr)) 50extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val);
59#define writel(data, addr) iSeries_Write_Long((data),(addr)) 51extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val);
60#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) 52
61#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) 53extern unsigned char __raw_readb(const volatile void __iomem *addr);
62#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) 54extern unsigned short __raw_readw(const volatile void __iomem *addr);
63 55extern unsigned int __raw_readl(const volatile void __iomem *addr);
64#define inb(addr) readb(((void __iomem *)(long)(addr))) 56extern unsigned long __raw_readq(const volatile void __iomem *addr);
65#define inw(addr) readw(((void __iomem *)(long)(addr))) 57extern void __raw_writeb(unsigned char v, volatile void __iomem *addr);
66#define inl(addr) readl(((void __iomem *)(long)(addr))) 58extern void __raw_writew(unsigned short v, volatile void __iomem *addr);
67#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) 59extern void __raw_writel(unsigned int v, volatile void __iomem *addr);
68#define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) 60extern void __raw_writeq(unsigned long v, volatile void __iomem *addr);
69#define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) 61
70/* 62extern void memset_io(volatile void __iomem *addr, int c, unsigned long n);
71 * The *_ns versions below don't do byte-swapping. 63extern void memcpy_fromio(void *dest, const volatile void __iomem *src,
72 * Neither do the standard versions now, these are just here 64 unsigned long n);
73 * for older code. 65extern void memcpy_toio(volatile void __iomem *dest, const void *src,
74 */ 66 unsigned long n);
75#define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 67
76#define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 68#else /* CONFIG_PPC_ISERIES */
77#else 69
70#define in_8(addr) __in_8((addr))
71#define out_8(addr, val) __out_8((addr), (val))
72#define in_le16(addr) __in_le16((addr))
73#define in_be16(addr) __in_be16((addr))
74#define out_le16(addr, val) __out_le16((addr), (val))
75#define out_be16(addr, val) __out_be16((addr), (val))
76#define in_le32(addr) __in_le32((addr))
77#define in_be32(addr) __in_be32((addr))
78#define out_le32(addr, val) __out_le32((addr), (val))
79#define out_be32(addr, val) __out_be32((addr), (val))
80#define in_le64(addr) __in_le64((addr))
81#define in_be64(addr) __in_be64((addr))
82#define out_le64(addr, val) __out_le64((addr), (val))
83#define out_be64(addr, val) __out_be64((addr), (val))
78 84
79static inline unsigned char __raw_readb(const volatile void __iomem *addr) 85static inline unsigned char __raw_readb(const volatile void __iomem *addr)
80{ 86{
@@ -108,23 +114,11 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
108{ 114{
109 *(volatile unsigned long __force *)addr = v; 115 *(volatile unsigned long __force *)addr = v;
110} 116}
111#define readb(addr) eeh_readb(addr)
112#define readw(addr) eeh_readw(addr)
113#define readl(addr) eeh_readl(addr)
114#define readq(addr) eeh_readq(addr)
115#define writeb(data, addr) eeh_writeb((data), (addr))
116#define writew(data, addr) eeh_writew((data), (addr))
117#define writel(data, addr) eeh_writel((data), (addr))
118#define writeq(data, addr) eeh_writeq((data), (addr))
119#define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) 117#define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
120#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) 118#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
121#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) 119#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
122#define inb(port) eeh_inb((unsigned long)port) 120
123#define outb(val, port) eeh_outb(val, (unsigned long)port) 121#endif /* CONFIG_PPC_ISERIES */
124#define inw(port) eeh_inw((unsigned long)port)
125#define outw(val, port) eeh_outw(val, (unsigned long)port)
126#define inl(port) eeh_inl((unsigned long)port)
127#define outl(val, port) eeh_outl(val, (unsigned long)port)
128 122
129/* 123/*
130 * The insw/outsw/insl/outsl macros don't do byte-swapping. 124 * The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -134,32 +128,43 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
134#define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) 128#define insb(port, buf, ns) eeh_insb((port), (buf), (ns))
135#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) 129#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
136#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) 130#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
137#define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
138#define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
139 131
140#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 132#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
141#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 133#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
142#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 134#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
143 135
144#endif 136#define readb(addr) eeh_readb(addr)
137#define readw(addr) eeh_readw(addr)
138#define readl(addr) eeh_readl(addr)
139#define readq(addr) eeh_readq(addr)
140#define writeb(data, addr) eeh_writeb((data), (addr))
141#define writew(data, addr) eeh_writew((data), (addr))
142#define writel(data, addr) eeh_writel((data), (addr))
143#define writeq(data, addr) eeh_writeq((data), (addr))
144#define inb(port) eeh_inb((unsigned long)port)
145#define outb(val, port) eeh_outb(val, (unsigned long)port)
146#define inw(port) eeh_inw((unsigned long)port)
147#define outw(val, port) eeh_outw(val, (unsigned long)port)
148#define inl(port) eeh_inl((unsigned long)port)
149#define outl(val, port) eeh_outl(val, (unsigned long)port)
145 150
146#define readb_relaxed(addr) readb(addr) 151#define readb_relaxed(addr) readb(addr)
147#define readw_relaxed(addr) readw(addr) 152#define readw_relaxed(addr) readw(addr)
148#define readl_relaxed(addr) readl(addr) 153#define readl_relaxed(addr) readl(addr)
149#define readq_relaxed(addr) readq(addr) 154#define readq_relaxed(addr) readq(addr)
150 155
151extern void _insb(volatile u8 __iomem *port, void *buf, int ns); 156extern void _insb(volatile u8 __iomem *port, void *buf, long count);
152extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); 157extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
153extern void _insw(volatile u16 __iomem *port, void *buf, int ns); 158extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
154extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); 159extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
155extern void _insl(volatile u32 __iomem *port, void *buf, int nl); 160extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
156extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); 161extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
157extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
158extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
159extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
160extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
161 162
162#define mmiowb() 163static inline void mmiowb(void)
164{
165 __asm__ __volatile__ ("sync" : : : "memory");
166 get_paca()->io_sync = 0;
167}
163 168
164/* 169/*
165 * output pause versions need a delay at least for the 170 * output pause versions need a delay at least for the
@@ -172,14 +177,6 @@ extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
172#define inl_p(port) inl(port) 177#define inl_p(port) inl(port)
173#define outl_p(val, port) (udelay(1), outl((val), (port))) 178#define outl_p(val, port) (udelay(1), outl((val), (port)))
174 179
175/*
176 * The *_ns versions below don't do byte-swapping.
177 * Neither do the standard versions now, these are just here
178 * for older code.
179 */
180#define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
181#define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
182
183 180
184#define IO_SPACE_LIMIT ~(0UL) 181#define IO_SPACE_LIMIT ~(0UL)
185 182
@@ -271,86 +268,92 @@ static inline void iosync(void)
271 * and should not be used directly by device drivers. Use inb/readb 268 * and should not be used directly by device drivers. Use inb/readb
272 * instead. 269 * instead.
273 */ 270 */
274static inline int in_8(const volatile unsigned char __iomem *addr) 271static inline int __in_8(const volatile unsigned char __iomem *addr)
275{ 272{
276 int ret; 273 int ret;
277 274
278 __asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync" 275 __asm__ __volatile__("sync; lbz%U1%X1 %0,%1; twi 0,%0,0; isync"
279 : "=r" (ret) : "m" (*addr)); 276 : "=r" (ret) : "m" (*addr));
280 return ret; 277 return ret;
281} 278}
282 279
283static inline void out_8(volatile unsigned char __iomem *addr, int val) 280static inline void __out_8(volatile unsigned char __iomem *addr, int val)
284{ 281{
285 __asm__ __volatile__("stb%U0%X0 %1,%0; sync" 282 __asm__ __volatile__("sync; stb%U0%X0 %1,%0"
286 : "=m" (*addr) : "r" (val)); 283 : "=m" (*addr) : "r" (val));
284 get_paca()->io_sync = 1;
287} 285}
288 286
289static inline int in_le16(const volatile unsigned short __iomem *addr) 287static inline int __in_le16(const volatile unsigned short __iomem *addr)
290{ 288{
291 int ret; 289 int ret;
292 290
293 __asm__ __volatile__("lhbrx %0,0,%1; twi 0,%0,0; isync" 291 __asm__ __volatile__("sync; lhbrx %0,0,%1; twi 0,%0,0; isync"
294 : "=r" (ret) : "r" (addr), "m" (*addr)); 292 : "=r" (ret) : "r" (addr), "m" (*addr));
295 return ret; 293 return ret;
296} 294}
297 295
298static inline int in_be16(const volatile unsigned short __iomem *addr) 296static inline int __in_be16(const volatile unsigned short __iomem *addr)
299{ 297{
300 int ret; 298 int ret;
301 299
302 __asm__ __volatile__("lhz%U1%X1 %0,%1; twi 0,%0,0; isync" 300 __asm__ __volatile__("sync; lhz%U1%X1 %0,%1; twi 0,%0,0; isync"
303 : "=r" (ret) : "m" (*addr)); 301 : "=r" (ret) : "m" (*addr));
304 return ret; 302 return ret;
305} 303}
306 304
307static inline void out_le16(volatile unsigned short __iomem *addr, int val) 305static inline void __out_le16(volatile unsigned short __iomem *addr, int val)
308{ 306{
309 __asm__ __volatile__("sthbrx %1,0,%2; sync" 307 __asm__ __volatile__("sync; sthbrx %1,0,%2"
310 : "=m" (*addr) : "r" (val), "r" (addr)); 308 : "=m" (*addr) : "r" (val), "r" (addr));
309 get_paca()->io_sync = 1;
311} 310}
312 311
313static inline void out_be16(volatile unsigned short __iomem *addr, int val) 312static inline void __out_be16(volatile unsigned short __iomem *addr, int val)
314{ 313{
315 __asm__ __volatile__("sth%U0%X0 %1,%0; sync" 314 __asm__ __volatile__("sync; sth%U0%X0 %1,%0"
316 : "=m" (*addr) : "r" (val)); 315 : "=m" (*addr) : "r" (val));
316 get_paca()->io_sync = 1;
317} 317}
318 318
319static inline unsigned in_le32(const volatile unsigned __iomem *addr) 319static inline unsigned __in_le32(const volatile unsigned __iomem *addr)
320{ 320{
321 unsigned ret; 321 unsigned ret;
322 322
323 __asm__ __volatile__("lwbrx %0,0,%1; twi 0,%0,0; isync" 323 __asm__ __volatile__("sync; lwbrx %0,0,%1; twi 0,%0,0; isync"
324 : "=r" (ret) : "r" (addr), "m" (*addr)); 324 : "=r" (ret) : "r" (addr), "m" (*addr));
325 return ret; 325 return ret;
326} 326}
327 327
328static inline unsigned in_be32(const volatile unsigned __iomem *addr) 328static inline unsigned __in_be32(const volatile unsigned __iomem *addr)
329{ 329{
330 unsigned ret; 330 unsigned ret;
331 331
332 __asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync" 332 __asm__ __volatile__("sync; lwz%U1%X1 %0,%1; twi 0,%0,0; isync"
333 : "=r" (ret) : "m" (*addr)); 333 : "=r" (ret) : "m" (*addr));
334 return ret; 334 return ret;
335} 335}
336 336
337static inline void out_le32(volatile unsigned __iomem *addr, int val) 337static inline void __out_le32(volatile unsigned __iomem *addr, int val)
338{ 338{
339 __asm__ __volatile__("stwbrx %1,0,%2; sync" : "=m" (*addr) 339 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr)
340 : "r" (val), "r" (addr)); 340 : "r" (val), "r" (addr));
341 get_paca()->io_sync = 1;
341} 342}
342 343
343static inline void out_be32(volatile unsigned __iomem *addr, int val) 344static inline void __out_be32(volatile unsigned __iomem *addr, int val)
344{ 345{
345 __asm__ __volatile__("stw%U0%X0 %1,%0; sync" 346 __asm__ __volatile__("sync; stw%U0%X0 %1,%0"
346 : "=m" (*addr) : "r" (val)); 347 : "=m" (*addr) : "r" (val));
348 get_paca()->io_sync = 1;
347} 349}
348 350
349static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) 351static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr)
350{ 352{
351 unsigned long tmp, ret; 353 unsigned long tmp, ret;
352 354
353 __asm__ __volatile__( 355 __asm__ __volatile__(
356 "sync\n"
354 "ld %1,0(%2)\n" 357 "ld %1,0(%2)\n"
355 "twi 0,%1,0\n" 358 "twi 0,%1,0\n"
356 "isync\n" 359 "isync\n"
@@ -365,16 +368,16 @@ static inline unsigned long in_le64(const volatile unsigned long __iomem *addr)
365 return ret; 368 return ret;
366} 369}
367 370
368static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) 371static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr)
369{ 372{
370 unsigned long ret; 373 unsigned long ret;
371 374
372 __asm__ __volatile__("ld%U1%X1 %0,%1; twi 0,%0,0; isync" 375 __asm__ __volatile__("sync; ld%U1%X1 %0,%1; twi 0,%0,0; isync"
373 : "=r" (ret) : "m" (*addr)); 376 : "=r" (ret) : "m" (*addr));
374 return ret; 377 return ret;
375} 378}
376 379
377static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val) 380static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val)
378{ 381{
379 unsigned long tmp; 382 unsigned long tmp;
380 383
@@ -386,19 +389,19 @@ static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long
386 "rldicl %1,%1,32,0\n" 389 "rldicl %1,%1,32,0\n"
387 "rlwimi %0,%1,8,8,31\n" 390 "rlwimi %0,%1,8,8,31\n"
388 "rlwimi %0,%1,24,16,23\n" 391 "rlwimi %0,%1,24,16,23\n"
389 "std %0,0(%3)\n" 392 "sync\n"
390 "sync" 393 "std %0,0(%3)"
391 : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr)); 394 : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr));
395 get_paca()->io_sync = 1;
392} 396}
393 397
394static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) 398static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val)
395{ 399{
396 __asm__ __volatile__("std%U0%X0 %1,%0; sync" : "=m" (*addr) : "r" (val)); 400 __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
401 get_paca()->io_sync = 1;
397} 402}
398 403
399#ifndef CONFIG_PPC_ISERIES
400#include <asm/eeh.h> 404#include <asm/eeh.h>
401#endif
402 405
403/** 406/**
404 * check_signature - find BIOS signatures 407 * check_signature - find BIOS signatures
@@ -414,7 +417,6 @@ static inline int check_signature(const volatile void __iomem * io_addr,
414 const unsigned char *signature, int length) 417 const unsigned char *signature, int length)
415{ 418{
416 int retval = 0; 419 int retval = 0;
417#ifndef CONFIG_PPC_ISERIES
418 do { 420 do {
419 if (readb(io_addr) != *signature) 421 if (readb(io_addr) != *signature)
420 goto out; 422 goto out;
@@ -424,7 +426,6 @@ static inline int check_signature(const volatile void __iomem * io_addr,
424 } while (length); 426 } while (length);
425 retval = 1; 427 retval = 1;
426out: 428out:
427#endif
428 return retval; 429 return retval;
429} 430}
430 431
diff --git a/include/asm-powerpc/ipic.h b/include/asm-powerpc/ipic.h
index 0fe396a2b6..53079ec3a5 100644
--- a/include/asm-powerpc/ipic.h
+++ b/include/asm-powerpc/ipic.h
@@ -69,9 +69,6 @@ enum ipic_mcp_irq {
69 IPIC_MCP_MU = 7, 69 IPIC_MCP_MU = 7,
70}; 70};
71 71
72extern void ipic_init(phys_addr_t phys_addr, unsigned int flags,
73 unsigned int irq_offset,
74 unsigned char *senses, unsigned int senses_count);
75extern int ipic_set_priority(unsigned int irq, unsigned int priority); 72extern int ipic_set_priority(unsigned int irq, unsigned int priority);
76extern void ipic_set_highest_priority(unsigned int irq); 73extern void ipic_set_highest_priority(unsigned int irq);
77extern void ipic_set_default_priority(void); 74extern void ipic_set_default_priority(void);
@@ -79,7 +76,16 @@ extern void ipic_enable_mcp(enum ipic_mcp_irq mcp_irq);
79extern void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq); 76extern void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq);
80extern u32 ipic_get_mcp_status(void); 77extern u32 ipic_get_mcp_status(void);
81extern void ipic_clear_mcp_status(u32 mask); 78extern void ipic_clear_mcp_status(u32 mask);
79
80#ifdef CONFIG_PPC_MERGE
81extern void ipic_init(struct device_node *node, unsigned int flags);
82extern unsigned int ipic_get_irq(struct pt_regs *regs);
83#else
84extern void ipic_init(phys_addr_t phys_addr, unsigned int flags,
85 unsigned int irq_offset,
86 unsigned char *senses, unsigned int senses_count);
82extern int ipic_get_irq(struct pt_regs *regs); 87extern int ipic_get_irq(struct pt_regs *regs);
88#endif
83 89
84#endif /* __ASM_IPIC_H__ */ 90#endif /* __ASM_IPIC_H__ */
85#endif /* __KERNEL__ */ 91#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index a10feec29d..4da41efb13 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -9,31 +9,14 @@
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>
12#include <linux/threads.h> 13#include <linux/threads.h>
14#include <linux/list.h>
15#include <linux/radix-tree.h>
13 16
14#include <asm/types.h> 17#include <asm/types.h>
15#include <asm/atomic.h> 18#include <asm/atomic.h>
16 19
17/* this number is used when no interrupt has been assigned */
18#define NO_IRQ (-1)
19
20/*
21 * These constants are used for passing information about interrupt
22 * signal polarity and level/edge sensing to the low-level PIC chip
23 * drivers.
24 */
25#define IRQ_SENSE_MASK 0x1
26#define IRQ_SENSE_LEVEL 0x1 /* interrupt on active level */
27#define IRQ_SENSE_EDGE 0x0 /* interrupt triggered by edge */
28
29#define IRQ_POLARITY_MASK 0x2
30#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */
31#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */
32
33/*
34 * IRQ line status macro IRQ_PER_CPU is used
35 */
36#define ARCH_HAS_IRQ_PER_CPU
37 20
38#define get_irq_desc(irq) (&irq_desc[(irq)]) 21#define get_irq_desc(irq) (&irq_desc[(irq)])
39 22
@@ -41,50 +24,313 @@
41#define for_each_irq(i) \ 24#define for_each_irq(i) \
42 for ((i) = 0; (i) < NR_IRQS; ++(i)) 25 for ((i) = 0; (i) < NR_IRQS; ++(i))
43 26
44#ifdef CONFIG_PPC64 27extern atomic_t ppc_n_lost_interrupts;
45 28
46/* 29#ifdef CONFIG_PPC_MERGE
47 * Maximum number of interrupt sources that we can handle. 30
31/* This number is used when no interrupt has been assigned */
32#define NO_IRQ (0)
33
34/* This is a special irq number to return from get_irq() to tell that
35 * no interrupt happened _and_ ignore it (don't count it as bad). Some
36 * platforms like iSeries rely on that.
48 */ 37 */
38#define NO_IRQ_IGNORE ((unsigned int)-1)
39
40/* Total number of virq in the platform (make it a CONFIG_* option ? */
49#define NR_IRQS 512 41#define NR_IRQS 512
50 42
51/* Interrupt numbers are virtual in case they are sparsely 43/* Number of irqs reserved for the legacy controller */
52 * distributed by the hardware. 44#define NUM_ISA_INTERRUPTS 16
45
46/* This type is the placeholder for a hardware interrupt number. It has to
47 * be big enough to enclose whatever representation is used by a given
48 * platform.
49 */
50typedef unsigned long irq_hw_number_t;
51
52/* Interrupt controller "host" data structure. This could be defined as a
53 * irq domain controller. That is, it handles the mapping between hardware
54 * and virtual interrupt numbers for a given interrupt domain. The host
55 * structure is generally created by the PIC code for a given PIC instance
56 * (though a host can cover more than one PIC if they have a flat number
57 * model). It's the host callbacks that are responsible for setting the
58 * irq_chip on a given irq_desc after it's been mapped.
59 *
60 * The host code and data structures are fairly agnostic to the fact that
61 * we use an open firmware device-tree. We do have references to struct
62 * device_node in two places: in irq_find_host() to find the host matching
63 * a given interrupt controller node, and of course as an argument to its
64 * counterpart host->ops->match() callback. However, those are treated as
65 * generic pointers by the core and the fact that it's actually a device-node
66 * pointer is purely a convention between callers and implementation. This
67 * code could thus be used on other architectures by replacing those two
68 * by some sort of arch-specific void * "token" used to identify interrupt
69 * controllers.
70 */
71struct irq_host;
72struct radix_tree_root;
73
74/* Functions below are provided by the host and called whenever a new mapping
75 * is created or an old mapping is disposed. The host can then proceed to
76 * whatever internal data structures management is required. It also needs
77 * to setup the irq_desc when returning from map().
78 */
79struct irq_host_ops {
80 /* Match an interrupt controller device node to a host, returns
81 * 1 on a match
82 */
83 int (*match)(struct irq_host *h, struct device_node *node);
84
85 /* Create or update a mapping between a virtual irq number and a hw
86 * irq number. This is called only once for a given mapping.
87 */
88 int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw);
89
90 /* Dispose of such a mapping */
91 void (*unmap)(struct irq_host *h, unsigned int virq);
92
93 /* Translate device-tree interrupt specifier from raw format coming
94 * from the firmware to a irq_hw_number_t (interrupt line number) and
95 * type (sense) that can be passed to set_irq_type(). In the absence
96 * of this callback, irq_create_of_mapping() and irq_of_parse_and_map()
97 * will return the hw number in the first cell and IRQ_TYPE_NONE for
98 * the type (which amount to keeping whatever default value the
99 * interrupt controller has for that line)
100 */
101 int (*xlate)(struct irq_host *h, struct device_node *ctrler,
102 u32 *intspec, unsigned int intsize,
103 irq_hw_number_t *out_hwirq, unsigned int *out_type);
104};
105
106struct irq_host {
107 struct list_head link;
108
109 /* type of reverse mapping technique */
110 unsigned int revmap_type;
111#define IRQ_HOST_MAP_LEGACY 0 /* legacy 8259, gets irqs 1..15 */
112#define IRQ_HOST_MAP_NOMAP 1 /* no fast reverse mapping */
113#define IRQ_HOST_MAP_LINEAR 2 /* linear map of interrupts */
114#define IRQ_HOST_MAP_TREE 3 /* radix tree */
115 union {
116 struct {
117 unsigned int size;
118 unsigned int *revmap;
119 } linear;
120 struct radix_tree_root tree;
121 } revmap_data;
122 struct irq_host_ops *ops;
123 void *host_data;
124 irq_hw_number_t inval_irq;
125};
126
127/* The main irq map itself is an array of NR_IRQ entries containing the
128 * associate host and irq number. An entry with a host of NULL is free.
129 * An entry can be allocated if it's free, the allocator always then sets
130 * hwirq first to the host's invalid irq number and then fills ops.
131 */
132struct irq_map_entry {
133 irq_hw_number_t hwirq;
134 struct irq_host *host;
135};
136
137extern struct irq_map_entry irq_map[NR_IRQS];
138
139
140/**
141 * irq_alloc_host - Allocate a new irq_host data structure
142 * @node: device-tree node of the interrupt controller
143 * @revmap_type: type of reverse mapping to use
144 * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map
145 * @ops: map/unmap host callbacks
146 * @inval_irq: provide a hw number in that host space that is always invalid
147 *
148 * Allocates and initialize and irq_host structure. Note that in the case of
149 * IRQ_HOST_MAP_LEGACY, the map() callback will be called before this returns
150 * for all legacy interrupts except 0 (which is always the invalid irq for
151 * a legacy controller). For a IRQ_HOST_MAP_LINEAR, the map is allocated by
152 * this call as well. For a IRQ_HOST_MAP_TREE, the radix tree will be allocated
153 * later during boot automatically (the reverse mapping will use the slow path
154 * until that happens).
155 */
156extern struct irq_host *irq_alloc_host(unsigned int revmap_type,
157 unsigned int revmap_arg,
158 struct irq_host_ops *ops,
159 irq_hw_number_t inval_irq);
160
161
162/**
163 * irq_find_host - Locates a host for a given device node
164 * @node: device-tree node of the interrupt controller
165 */
166extern struct irq_host *irq_find_host(struct device_node *node);
167
168
169/**
170 * irq_set_default_host - Set a "default" host
171 * @host: default host pointer
172 *
173 * For convenience, it's possible to set a "default" host that will be used
174 * whenever NULL is passed to irq_create_mapping(). It makes life easier for
175 * platforms that want to manipulate a few hard coded interrupt numbers that
176 * aren't properly represented in the device-tree.
177 */
178extern void irq_set_default_host(struct irq_host *host);
179
180
181/**
182 * irq_set_virq_count - Set the maximum number of virt irqs
183 * @count: number of linux virtual irqs, capped with NR_IRQS
184 *
185 * This is mainly for use by platforms like iSeries who want to program
186 * the virtual irq number in the controller to avoid the reverse mapping
187 */
188extern void irq_set_virq_count(unsigned int count);
189
190
191/**
192 * irq_create_mapping - Map a hardware interrupt into linux virq space
193 * @host: host owning this hardware interrupt or NULL for default host
194 * @hwirq: hardware irq number in that host space
195 *
196 * Only one mapping per hardware interrupt is permitted. Returns a linux
197 * virq number.
198 * If the sense/trigger is to be specified, set_irq_type() should be called
199 * on the number returned from that call.
200 */
201extern unsigned int irq_create_mapping(struct irq_host *host,
202 irq_hw_number_t hwirq);
203
204
205/**
206 * irq_dispose_mapping - Unmap an interrupt
207 * @virq: linux virq number of the interrupt to unmap
53 */ 208 */
54extern unsigned int virt_irq_to_real_map[NR_IRQS]; 209extern void irq_dispose_mapping(unsigned int virq);
55 210
56/* The maximum virtual IRQ number that we support. This 211/**
57 * can be set by the platform and will be reduced by the 212 * irq_find_mapping - Find a linux virq from an hw irq number.
58 * value of __irq_offset_value. It defaults to and is 213 * @host: host owning this hardware interrupt
59 * capped by (NR_IRQS - 1). 214 * @hwirq: hardware irq number in that host space
215 *
216 * This is a slow path, for use by generic code. It's expected that an
217 * irq controller implementation directly calls the appropriate low level
218 * mapping function.
219 */
220extern unsigned int irq_find_mapping(struct irq_host *host,
221 irq_hw_number_t hwirq);
222
223
224/**
225 * irq_radix_revmap - Find a linux virq from a hw irq number.
226 * @host: host owning this hardware interrupt
227 * @hwirq: hardware irq number in that host space
228 *
229 * This is a fast path, for use by irq controller code that uses radix tree
230 * revmaps
60 */ 231 */
61extern unsigned int virt_irq_max; 232extern unsigned int irq_radix_revmap(struct irq_host *host,
233 irq_hw_number_t hwirq);
234
235/**
236 * irq_linear_revmap - Find a linux virq from a hw irq number.
237 * @host: host owning this hardware interrupt
238 * @hwirq: hardware irq number in that host space
239 *
240 * This is a fast path, for use by irq controller code that uses linear
241 * revmaps. It does fallback to the slow path if the revmap doesn't exist
242 * yet and will create the revmap entry with appropriate locking
243 */
244
245extern unsigned int irq_linear_revmap(struct irq_host *host,
246 irq_hw_number_t hwirq);
247
248
62 249
63/* Create a mapping for a real_irq if it doesn't already exist. 250/**
64 * Return the virtual irq as a convenience. 251 * irq_alloc_virt - Allocate virtual irq numbers
252 * @host: host owning these new virtual irqs
253 * @count: number of consecutive numbers to allocate
254 * @hint: pass a hint number, the allocator will try to use a 1:1 mapping
255 *
256 * This is a low level function that is used internally by irq_create_mapping()
257 * and that can be used by some irq controllers implementations for things
258 * like allocating ranges of numbers for MSIs. The revmaps are left untouched.
259 */
260extern unsigned int irq_alloc_virt(struct irq_host *host,
261 unsigned int count,
262 unsigned int hint);
263
264/**
265 * irq_free_virt - Free virtual irq numbers
266 * @virq: virtual irq number of the first interrupt to free
267 * @count: number of interrupts to free
268 *
269 * This function is the opposite of irq_alloc_virt. It will not clear reverse
270 * maps, this should be done previously by unmap'ing the interrupt. In fact,
271 * all interrupts covered by the range being freed should have been unmapped
272 * prior to calling this.
273 */
274extern void irq_free_virt(unsigned int virq, unsigned int count);
275
276
277/* -- OF helpers -- */
278
279/* irq_create_of_mapping - Map a hardware interrupt into linux virq space
280 * @controller: Device node of the interrupt controller
281 * @inspec: Interrupt specifier from the device-tree
282 * @intsize: Size of the interrupt specifier from the device-tree
283 *
284 * This function is identical to irq_create_mapping except that it takes
285 * as input informations straight from the device-tree (typically the results
286 * of the of_irq_map_*() functions.
287 */
288extern unsigned int irq_create_of_mapping(struct device_node *controller,
289 u32 *intspec, unsigned int intsize);
290
291
292/* irq_of_parse_and_map - Parse nad Map an interrupt into linux virq space
293 * @device: Device node of the device whose interrupt is to be mapped
294 * @index: Index of the interrupt to map
295 *
296 * This function is a wrapper that chains of_irq_map_one() and
297 * irq_create_of_mapping() to make things easier to callers
65 */ 298 */
66int virt_irq_create_mapping(unsigned int real_irq); 299extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
67void virt_irq_init(void);
68 300
69static inline unsigned int virt_irq_to_real(unsigned int virt_irq) 301/* -- End OF helpers -- */
302
303/**
304 * irq_early_init - Init irq remapping subsystem
305 */
306extern void irq_early_init(void);
307
308static __inline__ int irq_canonicalize(int irq)
70{ 309{
71 return virt_irq_to_real_map[virt_irq]; 310 return irq;
72} 311}
73 312
74extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq); 313
314#else /* CONFIG_PPC_MERGE */
315
316/* This number is used when no interrupt has been assigned */
317#define NO_IRQ (-1)
318#define NO_IRQ_IGNORE (-2)
319
75 320
76/* 321/*
77 * List of interrupt controllers. 322 * These constants are used for passing information about interrupt
323 * signal polarity and level/edge sensing to the low-level PIC chip
324 * drivers.
78 */ 325 */
79#define IC_INVALID 0 326#define IRQ_SENSE_MASK 0x1
80#define IC_OPEN_PIC 1 327#define IRQ_SENSE_LEVEL 0x1 /* interrupt on active level */
81#define IC_PPC_XIC 2 328#define IRQ_SENSE_EDGE 0x0 /* interrupt triggered by edge */
82#define IC_CELL_PIC 3
83#define IC_ISERIES 4
84 329
85extern u64 ppc64_interrupt_controller; 330#define IRQ_POLARITY_MASK 0x2
331#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */
332#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */
86 333
87#else /* 32-bit */
88 334
89#if defined(CONFIG_40x) 335#if defined(CONFIG_40x)
90#include <asm/ibm4xx.h> 336#include <asm/ibm4xx.h>
@@ -517,16 +763,11 @@ extern u64 ppc64_interrupt_controller;
517 763
518#endif /* CONFIG_8260 */ 764#endif /* CONFIG_8260 */
519 765
520#endif 766#endif /* Whatever way too big #ifdef */
521 767
522#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 768#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
523/* pedantic: these are long because they are used with set_bit --RR */ 769/* pedantic: these are long because they are used with set_bit --RR */
524extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; 770extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
525extern atomic_t ppc_n_lost_interrupts;
526
527#define virt_irq_create_mapping(x) (x)
528
529#endif
530 771
531/* 772/*
532 * Because many systems have two overlapping names spaces for 773 * Because many systems have two overlapping names spaces for
@@ -565,6 +806,7 @@ static __inline__ int irq_canonicalize(int irq)
565 irq = 9; 806 irq = 9;
566 return irq; 807 return irq;
567} 808}
809#endif /* CONFIG_PPC_MERGE */
568 810
569extern int distribute_irqs; 811extern int distribute_irqs;
570 812
@@ -584,9 +826,8 @@ extern struct thread_info *softirq_ctx[NR_CPUS];
584 826
585extern void irq_ctx_init(void); 827extern void irq_ctx_init(void);
586extern void call_do_softirq(struct thread_info *tp); 828extern void call_do_softirq(struct thread_info *tp);
587extern int call___do_IRQ(int irq, struct pt_regs *regs, 829extern int call_handle_irq(int irq, void *p1, void *p2,
588 struct thread_info *tp); 830 struct thread_info *tp, void *func);
589
590#else 831#else
591#define irq_ctx_init() 832#define irq_ctx_init()
592 833
diff --git a/include/asm-powerpc/irqflags.h b/include/asm-powerpc/irqflags.h
new file mode 100644
index 0000000000..7970cbaeaa
--- /dev/null
+++ b/include/asm-powerpc/irqflags.h
@@ -0,0 +1,31 @@
1/*
2 * include/asm-powerpc/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() macros from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13/*
14 * Get definitions for raw_local_save_flags(x), etc.
15 */
16#include <asm-powerpc/hw_irq.h>
17
18/*
19 * Do the CPU's IRQ-state tracing from assembly code. We call a
20 * C function, so save all the C-clobbered registers:
21 */
22#ifdef CONFIG_TRACE_IRQFLAGS
23
24#error No support on PowerPC yet for CONFIG_TRACE_IRQFLAGS
25
26#else
27# define TRACE_IRQS_ON
28# define TRACE_IRQS_OFF
29#endif
30
31#endif
diff --git a/include/asm-powerpc/iseries/hv_call_xm.h b/include/asm-powerpc/iseries/hv_call_xm.h
index ca9202cb01..392ac3f54d 100644
--- a/include/asm-powerpc/iseries/hv_call_xm.h
+++ b/include/asm-powerpc/iseries/hv_call_xm.h
@@ -16,23 +16,6 @@
16#define HvCallXmSetTce HvCallXm + 11 16#define HvCallXmSetTce HvCallXm + 11
17#define HvCallXmSetTces HvCallXm + 13 17#define HvCallXmSetTces HvCallXm + 13
18 18
19/*
20 * Structure passed to HvCallXm_getTceTableParms
21 */
22struct iommu_table_cb {
23 unsigned long itc_busno; /* Bus number for this tce table */
24 unsigned long itc_start; /* Will be NULL for secondary */
25 unsigned long itc_totalsize; /* Size (in pages) of whole table */
26 unsigned long itc_offset; /* Index into real tce table of the
27 start of our section */
28 unsigned long itc_size; /* Size (in pages) of our section */
29 unsigned long itc_index; /* Index of this tce table */
30 unsigned short itc_maxtables; /* Max num of tables for partition */
31 unsigned char itc_virtbus; /* Flag to indicate virtual bus */
32 unsigned char itc_slotno; /* IOA Tce Slot Index */
33 unsigned char itc_rsvd[4];
34};
35
36static inline void HvCallXm_getTceTableParms(u64 cb) 19static inline void HvCallXm_getTceTableParms(u64 cb)
37{ 20{
38 HvCall1(HvCallXmGetTceTableParms, cb); 21 HvCall1(HvCallXmGetTceTableParms, cb);
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h
index df8b207397..a006fd1e4a 100644
--- a/include/asm-powerpc/iseries/hv_lp_config.h
+++ b/include/asm-powerpc/iseries/hv_lp_config.h
@@ -25,7 +25,6 @@
25 25
26#include <asm/iseries/hv_call_sc.h> 26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iseries/hv_types.h> 27#include <asm/iseries/hv_types.h>
28#include <asm/iseries/it_lp_naca.h>
29 28
30enum { 29enum {
31 HvCallCfg_Cur = 0, 30 HvCallCfg_Cur = 0,
@@ -44,16 +43,8 @@ enum {
44#define HvCallCfgGetHostingLpIndex HvCallCfg + 32 43#define HvCallCfgGetHostingLpIndex HvCallCfg + 32
45 44
46extern HvLpIndex HvLpConfig_getLpIndex_outline(void); 45extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
47 46extern HvLpIndex HvLpConfig_getLpIndex(void);
48static inline HvLpIndex HvLpConfig_getLpIndex(void) 47extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void);
49{
50 return itLpNaca.xLpIndex;
51}
52
53static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
54{
55 return itLpNaca.xPrimaryLpIndex;
56}
57 48
58static inline u64 HvLpConfig_getMsChunks(void) 49static inline u64 HvLpConfig_getMsChunks(void)
59{ 50{
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h
deleted file mode 100644
index f29009bd63..0000000000
--- a/include/asm-powerpc/iseries/iseries_io.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H
2#define _ASM_POWERPC_ISERIES_ISERIES_IO_H
3
4
5#ifdef CONFIG_PPC_ISERIES
6#include <linux/types.h>
7/*
8 * Created by Allan Trautman on Thu Dec 28 2000.
9 *
10 * Remaps the io.h for the iSeries Io
11 * Copyright (C) 2000 Allan H Trautman, IBM Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the:
25 * Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330,
27 * Boston, MA 02111-1307 USA
28 *
29 * Change Activity:
30 * Created December 28, 2000
31 * End Change Activity
32 */
33
34#ifdef CONFIG_PCI
35extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
36extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
37extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
38extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress);
39extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
40extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
41
42extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
43extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
44 size_t n);
45extern void iSeries_memcpy_fromio(void *dest,
46 const volatile void __iomem *source, size_t n);
47#else
48static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
49{
50 return 0xff;
51}
52
53static inline void iSeries_Write_Byte(u8 IoData,
54 volatile void __iomem *IoAddress)
55{
56}
57#endif /* CONFIG_PCI */
58
59#endif /* CONFIG_PPC_ISERIES */
60#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
diff --git a/include/asm-powerpc/iseries/it_exp_vpd_panel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
deleted file mode 100644
index 304a609ae2..0000000000
--- a/include/asm-powerpc/iseries/it_exp_vpd_panel.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (C) 2002 Dave Boutcher IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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#ifndef _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
19#define _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
20
21/*
22 * This struct maps the panel information
23 *
24 * Warning:
25 * This data must match the architecture for the panel information
26 */
27
28#include <asm/types.h>
29
30struct ItExtVpdPanel {
31 /* Definition of the Extended Vpd On Panel Data Area */
32 char systemSerial[8];
33 char mfgID[4];
34 char reserved1[24];
35 char machineType[4];
36 char systemID[6];
37 char somUniqueCnt[4];
38 char serialNumberCount;
39 char reserved2[7];
40 u16 bbu3;
41 u16 bbu2;
42 u16 bbu1;
43 char xLocationLabel[8];
44 u8 xRsvd1[6];
45 u16 xFrameId;
46 u8 xRsvd2[48];
47};
48
49extern struct ItExtVpdPanel xItExtVpdPanel;
50
51#endif /* _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H */
diff --git a/include/asm-powerpc/iseries/it_lp_naca.h b/include/asm-powerpc/iseries/it_lp_naca.h
deleted file mode 100644
index 4fdcf05292..0000000000
--- a/include/asm-powerpc/iseries/it_lp_naca.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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#ifndef _ASM_POWERPC_ISERIES_IT_LP_NACA_H
19#define _ASM_POWERPC_ISERIES_IT_LP_NACA_H
20
21#include <linux/types.h>
22
23/*
24 * This control block contains the data that is shared between the
25 * hypervisor (PLIC) and the OS.
26 */
27
28struct ItLpNaca {
29// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
30 u32 xDesc; // Eye catcher x00-x03
31 u16 xSize; // Size of this class x04-x05
32 u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07
33 u8 xMaxIntHdlrEntries; // Number of entries in array x08-x08
34 u8 xPrimaryLpIndex; // LP Index of Primary x09-x09
35 u8 xServiceLpIndex; // LP Ind of Service Focal Pointx0A-x0A
36 u8 xLpIndex; // LP Index x0B-x0B
37 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D
38 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F
39 u8 xPirEnvironMode; // Piranha or hardware x10-x10
40 u8 xPirConsoleMode; // Piranha console indicator x11-x11
41 u8 xPirDasdMode; // Piranha dasd indicator x12-x12
42 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17
43 u8 flags; // flags, see below x18-x1F
44 u8 xSpVpdFormat; // VPD areas are in CSP format ...
45 u8 xIntProcRatio; // Ratio of int procs to procs ...
46 u8 xRsvd1_2[5]; // Reserved ...
47 u16 xRsvd1_3; // Reserved x20-x21
48 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23
49 u16 xMinSupportedSlicVrmInd;// Min supported OS VRM index x24-x25
50 u16 xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27
51 u64 xLoadAreaAddr; // ER address of load area x28-x2F
52 u32 xLoadAreaChunks; // Chunks for the load area x30-x33
53 u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37
54 // doing an ASR switch on PASE
55 // system call.
56 u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f
57 u8 xRsvd1_4[64]; // x40-x7F
58
59// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
60 u8 xRsvd2_0[128]; // Reserved x00-x7F
61
62// CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators
63// NB: Padding required to keep xInterrruptHdlr at x300 which is required
64// for v4r4 PLIC.
65 u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F
66 u8 xRsvd3_0[384]; // Reserved 180-2FF
67
68// CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt
69// handlers
70 u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF
71};
72
73extern struct ItLpNaca itLpNaca;
74
75#define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */
76#define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */
77#define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */
78#define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */
79
80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h
index b7c6fc12cc..3f68147692 100644
--- a/include/asm-powerpc/iseries/it_lp_queue.h
+++ b/include/asm-powerpc/iseries/it_lp_queue.h
@@ -27,22 +27,20 @@
27#include <asm/types.h> 27#include <asm/types.h>
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
29 29
30struct HvLpEvent; 30#define IT_LP_MAX_QUEUES 8
31 31
32#define ITMaxLpQueues 8 32#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
33#define IT_LP_DEDICATED_IO 1 /* Queue dedicated to IO processor specified */
34#define IT_LP_DEDICATED_LP 2 /* Queue dedicated to LP specified */
35#define IT_LP_SHARED 3 /* Queue shared for both IO and LP */
33 36
34#define NotUsed 0 // Queue will not be used by PLIC 37#define IT_LP_EVENT_STACK_SIZE 4096
35#define DedicatedIo 1 // Queue dedicated to IO processor specified 38#define IT_LP_EVENT_MAX_SIZE 256
36#define DedicatedLp 2 // Queue dedicated to LP specified 39#define IT_LP_EVENT_ALIGN 64
37#define Shared 3 // Queue shared for both IO and LP
38
39#define LpEventStackSize 4096
40#define LpEventMaxSize 256
41#define LpEventAlign 64
42 40
43struct hvlpevent_queue { 41struct hvlpevent_queue {
44/* 42/*
45 * The xSlicCurEventPtr is the pointer to the next event stack entry 43 * The hq_current_event is the pointer to the next event stack entry
46 * that will become valid. The OS must peek at this entry to determine 44 * that will become valid. The OS must peek at this entry to determine
47 * if it is valid. PLIC will set the valid indicator as the very last 45 * if it is valid. PLIC will set the valid indicator as the very last
48 * store into that entry. 46 * store into that entry.
@@ -52,23 +50,23 @@ struct hvlpevent_queue {
52 * location again. 50 * location again.
53 * 51 *
54 * If the event stack fills and there are overflow events, then PLIC 52 * If the event stack fills and there are overflow events, then PLIC
55 * will set the xPlicOverflowIntPending flag in which case the OS will 53 * will set the hq_overflow_pending flag in which case the OS will
56 * have to fetch the additional LP events once they have drained the 54 * have to fetch the additional LP events once they have drained the
57 * event stack. 55 * event stack.
58 * 56 *
59 * The first 16-bytes are known by both the OS and PLIC. The remainder 57 * The first 16-bytes are known by both the OS and PLIC. The remainder
60 * of the cache line is for use by the OS. 58 * of the cache line is for use by the OS.
61 */ 59 */
62 u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending 60 u8 hq_overflow_pending; /* 0x00 Overflow events are pending */
63 u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed 61 u8 hq_status; /* 0x01 DedicatedIo or DedicatedLp or NotUsed */
64 u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation 62 u16 hq_proc_index; /* 0x02 Logical Proc Index for correlation */
65 u8 xPlicRsvd[12]; // 0x04 63 u8 hq_reserved1[12]; /* 0x04 */
66 char *xSlicCurEventPtr; // 0x10 64 char *hq_current_event; /* 0x10 */
67 char *xSlicLastValidEventPtr; // 0x18 65 char *hq_last_event; /* 0x18 */
68 char *xSlicEventStackPtr; // 0x20 66 char *hq_event_stack; /* 0x20 */
69 u8 xIndex; // 0x28 unique sequential index. 67 u8 hq_index; /* 0x28 unique sequential index. */
70 u8 xSlicRsvd[3]; // 0x29-2b 68 u8 hq_reserved2[3]; /* 0x29-2b */
71 spinlock_t lock; 69 spinlock_t hq_lock;
72}; 70};
73 71
74extern struct hvlpevent_queue hvlpevent_queue; 72extern struct hvlpevent_queue hvlpevent_queue;
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h
index 72a97d37aa..7a95d296ab 100644
--- a/include/asm-powerpc/iseries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -122,6 +122,34 @@ enum viorc {
122 viorc_openRejected = 0x0301 122 viorc_openRejected = 0x0301
123}; 123};
124 124
125/*
126 * The structure of the events that flow between us and OS/400 for chario
127 * events. You can't mess with this unless the OS/400 side changes too.
128 */
129struct viocharlpevent {
130 struct HvLpEvent event;
131 u32 reserved;
132 u16 version;
133 u16 subtype_result_code;
134 u8 virtual_device;
135 u8 len;
136 u8 data[VIOCHAR_MAX_DATA];
137};
138
139#define VIOCHAR_WINDOW 10
140
141enum viocharsubtype {
142 viocharopen = 0x0001,
143 viocharclose = 0x0002,
144 viochardata = 0x0003,
145 viocharack = 0x0004,
146 viocharconfig = 0x0005
147};
148
149enum viochar_rc {
150 viochar_rc_ebusy = 1
151};
152
125struct device; 153struct device;
126 154
127extern struct device *iSeries_vio_dev; 155extern struct device *iSeries_vio_dev;
diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h
index c01786ab5f..532bfee934 100644
--- a/include/asm-powerpc/kdebug.h
+++ b/include/asm-powerpc/kdebug.h
@@ -18,6 +18,8 @@ struct die_args {
18 18
19extern int register_die_notifier(struct notifier_block *); 19extern int register_die_notifier(struct notifier_block *);
20extern int unregister_die_notifier(struct notifier_block *); 20extern int unregister_die_notifier(struct notifier_block *);
21extern int register_page_fault_notifier(struct notifier_block *);
22extern int unregister_page_fault_notifier(struct notifier_block *);
21extern struct atomic_notifier_head powerpc_die_chain; 23extern struct atomic_notifier_head powerpc_die_chain;
22 24
23/* Grossly misnamed. */ 25/* Grossly misnamed. */
diff --git a/include/asm-powerpc/kdump.h b/include/asm-powerpc/kdump.h
index 5a5c3b5ab1..10e8eb1e6f 100644
--- a/include/asm-powerpc/kdump.h
+++ b/include/asm-powerpc/kdump.h
@@ -7,7 +7,7 @@
7/* How many bytes to reserve at zero for kdump. The reserve limit should 7/* How many bytes to reserve at zero for kdump. The reserve limit should
8 * be greater or equal to the trampoline's end address. 8 * be greater or equal to the trampoline's end address.
9 * Reserve to the end of the FWNMI area, see head_64.S */ 9 * Reserve to the end of the FWNMI area, see head_64.S */
10#define KDUMP_RESERVE_LIMIT 0x8000 10#define KDUMP_RESERVE_LIMIT 0x10000 /* 64K */
11 11
12#ifdef CONFIG_CRASH_DUMP 12#ifdef CONFIG_CRASH_DUMP
13 13
@@ -15,6 +15,8 @@
15#define KDUMP_TRAMPOLINE_START 0x0100 15#define KDUMP_TRAMPOLINE_START 0x0100
16#define KDUMP_TRAMPOLINE_END 0x3000 16#define KDUMP_TRAMPOLINE_END 0x3000
17 17
18#define KDUMP_MIN_TCE_ENTRIES 2048
19
18#else /* !CONFIG_CRASH_DUMP */ 20#else /* !CONFIG_CRASH_DUMP */
19 21
20#define PHYSICAL_START 0x0 22#define PHYSICAL_START 0x0
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index efe8872ec5..11cbdf81fd 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -32,6 +32,7 @@
32#endif 32#endif
33 33
34#ifndef __ASSEMBLY__ 34#ifndef __ASSEMBLY__
35#include <linux/cpumask.h>
35 36
36#ifdef CONFIG_KEXEC 37#ifdef CONFIG_KEXEC
37 38
@@ -109,13 +110,15 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
109 110
110#define MAX_NOTE_BYTES 1024 111#define MAX_NOTE_BYTES 1024
111 112
112#ifdef __powerpc64__
113extern void kexec_smp_wait(void); /* get and clear naca physid, wait for 113extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
114 master to copy new code to 0 */ 114 master to copy new code to 0 */
115extern void __init kexec_setup(void);
116extern int crashing_cpu; 115extern int crashing_cpu;
117extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)); 116extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
118#endif /* __powerpc64 __ */ 117extern cpumask_t cpus_in_sr;
118static inline int kexec_sr_activated(int cpu)
119{
120 return cpu_isset(cpu,cpus_in_sr);
121}
119 122
120struct kimage; 123struct kimage;
121struct pt_regs; 124struct pt_regs;
@@ -124,10 +127,13 @@ extern int default_machine_kexec_prepare(struct kimage *image);
124extern void default_machine_crash_shutdown(struct pt_regs *regs); 127extern void default_machine_crash_shutdown(struct pt_regs *regs);
125 128
126extern void machine_kexec_simple(struct kimage *image); 129extern void machine_kexec_simple(struct kimage *image);
130extern void crash_kexec_secondary(struct pt_regs *regs);
127extern int overlaps_crashkernel(unsigned long start, unsigned long size); 131extern int overlaps_crashkernel(unsigned long start, unsigned long size);
128extern void reserve_crashkernel(void); 132extern void reserve_crashkernel(void);
129 133
130#else /* !CONFIG_KEXEC */ 134#else /* !CONFIG_KEXEC */
135static inline int kexec_sr_activated(int cpu) { return 0; }
136static inline void crash_kexec_secondary(struct pt_regs *regs) { }
131 137
132static inline int overlaps_crashkernel(unsigned long start, unsigned long size) 138static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
133{ 139{
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index f466bc804f..34e1f89a5f 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -50,6 +50,9 @@ typedef unsigned int kprobe_opcode_t;
50 IS_TWI(instr) || IS_TDI(instr)) 50 IS_TWI(instr) || IS_TDI(instr))
51 51
52#define ARCH_SUPPORTS_KRETPROBES 52#define ARCH_SUPPORTS_KRETPROBES
53#define ARCH_INACTIVE_KPROBE_COUNT 1
54#define flush_insn_slot(p) do { } while (0)
55
53void kretprobe_trampoline(void); 56void kretprobe_trampoline(void);
54extern void arch_remove_kprobe(struct kprobe *p); 57extern void arch_remove_kprobe(struct kprobe *p);
55 58
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h
index 4dc514aabf..821ea0c512 100644
--- a/include/asm-powerpc/lppaca.h
+++ b/include/asm-powerpc/lppaca.h
@@ -27,7 +27,9 @@
27// 27//
28// 28//
29//---------------------------------------------------------------------------- 29//----------------------------------------------------------------------------
30#include <linux/cache.h>
30#include <asm/types.h> 31#include <asm/types.h>
32#include <asm/mmu.h>
31 33
32/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k 34/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
33 * alignment is sufficient to prevent this */ 35 * alignment is sufficient to prevent this */
@@ -114,7 +116,7 @@ struct lppaca {
114 116
115 117
116//============================================================================= 118//=============================================================================
117// CACHE_LINE_3 0x0100 - 0x007F: This line is shared with other processors 119// CACHE_LINE_3 0x0100 - 0x017F: This line is shared with other processors
118//============================================================================= 120//=============================================================================
119 // This is the yield_count. An "odd" value (low bit on) means that 121 // This is the yield_count. An "odd" value (low bit on) means that
120 // the processor is yielded (either because of an OS yield or a PLIC 122 // the processor is yielded (either because of an OS yield or a PLIC
@@ -126,12 +128,29 @@ struct lppaca {
126 u8 reserved6[124]; // Reserved x04-x7F 128 u8 reserved6[124]; // Reserved x04-x7F
127 129
128//============================================================================= 130//=============================================================================
129// CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data 131// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
130//============================================================================= 132//=============================================================================
131 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 133 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
132} __attribute__((__aligned__(0x400))); 134} __attribute__((__aligned__(0x400)));
133 135
134extern struct lppaca lppaca[]; 136extern struct lppaca lppaca[];
135 137
138/*
139 * SLB shadow buffer structure as defined in the PAPR. The save_area
140 * contains adjacent ESID and VSID pairs for each shadowed SLB. The
141 * ESID is stored in the lower 64bits, then the VSID.
142 */
143struct slb_shadow {
144 u32 persistent; // Number of persistent SLBs x00-x03
145 u32 buffer_length; // Total shadow buffer length x04-x07
146 u64 reserved; // Alignment x08-x0f
147 struct {
148 u64 esid;
149 u64 vsid;
150 } save_area[SLB_NUM_BOLTED]; // x10-x40
151} ____cacheline_aligned;
152
153extern struct slb_shadow slb_shadow[];
154
136#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
137#endif /* _ASM_POWERPC_LPPACA_H */ 156#endif /* _ASM_POWERPC_LPPACA_H */
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 73db1f7132..c17c137424 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -81,6 +81,8 @@ struct machdep_calls {
81 void (*tce_free)(struct iommu_table *tbl, 81 void (*tce_free)(struct iommu_table *tbl,
82 long index, 82 long index,
83 long npages); 83 long npages);
84 unsigned long (*tce_get)(struct iommu_table *tbl,
85 long index);
84 void (*tce_flush)(struct iommu_table *tbl); 86 void (*tce_flush)(struct iommu_table *tbl);
85 void (*iommu_dev_setup)(struct pci_dev *dev); 87 void (*iommu_dev_setup)(struct pci_dev *dev);
86 void (*iommu_bus_setup)(struct pci_bus *bus); 88 void (*iommu_bus_setup)(struct pci_bus *bus);
@@ -95,7 +97,7 @@ struct machdep_calls {
95 void (*show_percpuinfo)(struct seq_file *m, int i); 97 void (*show_percpuinfo)(struct seq_file *m, int i);
96 98
97 void (*init_IRQ)(void); 99 void (*init_IRQ)(void);
98 int (*get_irq)(struct pt_regs *); 100 unsigned int (*get_irq)(struct pt_regs *);
99#ifdef CONFIG_KEXEC 101#ifdef CONFIG_KEXEC
100 void (*kexec_cpu_down)(int crash_shutdown, int secondary); 102 void (*kexec_cpu_down)(int crash_shutdown, int secondary);
101#endif 103#endif
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 3a5ebe229a..c3fc7a28e3 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -238,7 +238,6 @@ extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
238 unsigned long ea, unsigned long vsid, int local, 238 unsigned long ea, unsigned long vsid, int local,
239 unsigned long trap); 239 unsigned long trap);
240 240
241extern void htab_finish_init(void);
242extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 241extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
243 unsigned long pstart, unsigned long mode, 242 unsigned long pstart, unsigned long mode,
244 int psize); 243 int psize);
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index 8c6b1a6d94..083ac917bd 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -25,8 +25,13 @@ static inline void enter_lazy_tlb(struct mm_struct *mm,
25{ 25{
26} 26}
27 27
28/*
29 * The proto-VSID space has 2^35 - 1 segments available for user mappings.
30 * Each segment contains 2^28 bytes. Each context maps 2^44 bytes,
31 * so we can support 2^19-1 contexts (19 == 35 + 28 - 44).
32 */
28#define NO_CONTEXT 0 33#define NO_CONTEXT 0
29#define MAX_CONTEXT (0x100000-1) 34#define MAX_CONTEXT ((1UL << 19) - 1)
30 35
31extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 36extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
32extern void destroy_context(struct mm_struct *mm); 37extern void destroy_context(struct mm_struct *mm);
diff --git a/include/asm-powerpc/mpc86xx.h b/include/asm-powerpc/mpc86xx.h
index d0a6718d18..b85df45b1a 100644
--- a/include/asm-powerpc/mpc86xx.h
+++ b/include/asm-powerpc/mpc86xx.h
@@ -15,21 +15,14 @@
15#ifndef __ASM_POWERPC_MPC86xx_H__ 15#ifndef __ASM_POWERPC_MPC86xx_H__
16#define __ASM_POWERPC_MPC86xx_H__ 16#define __ASM_POWERPC_MPC86xx_H__
17 17
18#include <linux/config.h>
19#include <asm/mmu.h> 18#include <asm/mmu.h>
20 19
21#ifdef CONFIG_PPC_86xx 20#ifdef CONFIG_PPC_86xx
22 21
23#ifdef CONFIG_MPC8641_HPCN
24#include <platforms/86xx/mpc8641_hpcn.h>
25#endif
26
27#define _IO_BASE isa_io_base 22#define _IO_BASE isa_io_base
28#define _ISA_MEM_BASE isa_mem_base 23#define _ISA_MEM_BASE isa_mem_base
29#ifdef CONFIG_PCI 24#ifdef CONFIG_PCI
30#define PCI_DRAM_OFFSET pci_dram_offset 25#define PCI_DRAM_OFFSET pci_dram_offset
31#else
32#define PCI_DRAM_OFFSET 0
33#endif 26#endif
34 27
35#define CPU0_BOOT_RELEASE 0x01000000 28#define CPU0_BOOT_RELEASE 0x01000000
@@ -38,7 +31,6 @@
38#define MCM_PORT_CONFIG_OFFSET 0x1010 31#define MCM_PORT_CONFIG_OFFSET 0x1010
39 32
40/* Offset from CCSRBAR */ 33/* Offset from CCSRBAR */
41#define MPC86xx_OPENPIC_OFFSET (0x40000)
42#define MPC86xx_MCM_OFFSET (0x00000) 34#define MPC86xx_MCM_OFFSET (0x00000)
43#define MPC86xx_MCM_SIZE (0x02000) 35#define MPC86xx_MCM_SIZE (0x02000)
44 36
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index f0d22ac34b..a9f9604b9e 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -41,6 +41,7 @@
41#define MPIC_GREG_IPI_VECTOR_PRI_1 0x000b0 41#define MPIC_GREG_IPI_VECTOR_PRI_1 0x000b0
42#define MPIC_GREG_IPI_VECTOR_PRI_2 0x000c0 42#define MPIC_GREG_IPI_VECTOR_PRI_2 0x000c0
43#define MPIC_GREG_IPI_VECTOR_PRI_3 0x000d0 43#define MPIC_GREG_IPI_VECTOR_PRI_3 0x000d0
44#define MPIC_GREG_IPI_STRIDE 0x10
44#define MPIC_GREG_SPURIOUS 0x000e0 45#define MPIC_GREG_SPURIOUS 0x000e0
45#define MPIC_GREG_TIMER_FREQ 0x000f0 46#define MPIC_GREG_TIMER_FREQ 0x000f0
46 47
@@ -68,6 +69,7 @@
68#define MPIC_CPU_IPI_DISPATCH_1 0x00050 69#define MPIC_CPU_IPI_DISPATCH_1 0x00050
69#define MPIC_CPU_IPI_DISPATCH_2 0x00060 70#define MPIC_CPU_IPI_DISPATCH_2 0x00060
70#define MPIC_CPU_IPI_DISPATCH_3 0x00070 71#define MPIC_CPU_IPI_DISPATCH_3 0x00070
72#define MPIC_CPU_IPI_DISPATCH_STRIDE 0x00010
71#define MPIC_CPU_CURRENT_TASK_PRI 0x00080 73#define MPIC_CPU_CURRENT_TASK_PRI 0x00080
72#define MPIC_CPU_TASKPRI_MASK 0x0000000f 74#define MPIC_CPU_TASKPRI_MASK 0x0000000f
73#define MPIC_CPU_WHOAMI 0x00090 75#define MPIC_CPU_WHOAMI 0x00090
@@ -114,8 +116,102 @@
114#define MPIC_VEC_TIMER_1 248 116#define MPIC_VEC_TIMER_1 248
115#define MPIC_VEC_TIMER_0 247 117#define MPIC_VEC_TIMER_0 247
116 118
117/* Type definition of the cascade handler */ 119/*
118typedef int (*mpic_cascade_t)(struct pt_regs *regs, void *data); 120 * Tsi108 implementation of MPIC has many differences from the original one
121 */
122
123/*
124 * Global registers
125 */
126
127#define TSI108_GREG_BASE 0x00000
128#define TSI108_GREG_FEATURE_0 0x00000
129#define TSI108_GREG_GLOBAL_CONF_0 0x00004
130#define TSI108_GREG_VENDOR_ID 0x0000c
131#define TSI108_GREG_IPI_VECTOR_PRI_0 0x00204 /* Doorbell 0 */
132#define TSI108_GREG_IPI_STRIDE 0x0c
133#define TSI108_GREG_SPURIOUS 0x00010
134#define TSI108_GREG_TIMER_FREQ 0x00014
135
136/*
137 * Timer registers
138 */
139#define TSI108_TIMER_BASE 0x0030
140#define TSI108_TIMER_STRIDE 0x10
141#define TSI108_TIMER_CURRENT_CNT 0x00000
142#define TSI108_TIMER_BASE_CNT 0x00004
143#define TSI108_TIMER_VECTOR_PRI 0x00008
144#define TSI108_TIMER_DESTINATION 0x0000c
145
146/*
147 * Per-Processor registers
148 */
149#define TSI108_CPU_BASE 0x00300
150#define TSI108_CPU_STRIDE 0x00040
151#define TSI108_CPU_IPI_DISPATCH_0 0x00200
152#define TSI108_CPU_IPI_DISPATCH_STRIDE 0x00000
153#define TSI108_CPU_CURRENT_TASK_PRI 0x00000
154#define TSI108_CPU_WHOAMI 0xffffffff
155#define TSI108_CPU_INTACK 0x00004
156#define TSI108_CPU_EOI 0x00008
157
158/*
159 * Per-source registers
160 */
161#define TSI108_IRQ_BASE 0x00100
162#define TSI108_IRQ_STRIDE 0x00008
163#define TSI108_IRQ_VECTOR_PRI 0x00000
164#define TSI108_VECPRI_VECTOR_MASK 0x000000ff
165#define TSI108_VECPRI_POLARITY_POSITIVE 0x01000000
166#define TSI108_VECPRI_POLARITY_NEGATIVE 0x00000000
167#define TSI108_VECPRI_SENSE_LEVEL 0x02000000
168#define TSI108_VECPRI_SENSE_EDGE 0x00000000
169#define TSI108_VECPRI_POLARITY_MASK 0x01000000
170#define TSI108_VECPRI_SENSE_MASK 0x02000000
171#define TSI108_IRQ_DESTINATION 0x00004
172
173/* weird mpic register indices and mask bits in the HW info array */
174enum {
175 MPIC_IDX_GREG_BASE = 0,
176 MPIC_IDX_GREG_FEATURE_0,
177 MPIC_IDX_GREG_GLOBAL_CONF_0,
178 MPIC_IDX_GREG_VENDOR_ID,
179 MPIC_IDX_GREG_IPI_VECTOR_PRI_0,
180 MPIC_IDX_GREG_IPI_STRIDE,
181 MPIC_IDX_GREG_SPURIOUS,
182 MPIC_IDX_GREG_TIMER_FREQ,
183
184 MPIC_IDX_TIMER_BASE,
185 MPIC_IDX_TIMER_STRIDE,
186 MPIC_IDX_TIMER_CURRENT_CNT,
187 MPIC_IDX_TIMER_BASE_CNT,
188 MPIC_IDX_TIMER_VECTOR_PRI,
189 MPIC_IDX_TIMER_DESTINATION,
190
191 MPIC_IDX_CPU_BASE,
192 MPIC_IDX_CPU_STRIDE,
193 MPIC_IDX_CPU_IPI_DISPATCH_0,
194 MPIC_IDX_CPU_IPI_DISPATCH_STRIDE,
195 MPIC_IDX_CPU_CURRENT_TASK_PRI,
196 MPIC_IDX_CPU_WHOAMI,
197 MPIC_IDX_CPU_INTACK,
198 MPIC_IDX_CPU_EOI,
199
200 MPIC_IDX_IRQ_BASE,
201 MPIC_IDX_IRQ_STRIDE,
202 MPIC_IDX_IRQ_VECTOR_PRI,
203
204 MPIC_IDX_VECPRI_VECTOR_MASK,
205 MPIC_IDX_VECPRI_POLARITY_POSITIVE,
206 MPIC_IDX_VECPRI_POLARITY_NEGATIVE,
207 MPIC_IDX_VECPRI_SENSE_LEVEL,
208 MPIC_IDX_VECPRI_SENSE_EDGE,
209 MPIC_IDX_VECPRI_POLARITY_MASK,
210 MPIC_IDX_VECPRI_SENSE_MASK,
211 MPIC_IDX_IRQ_DESTINATION,
212 MPIC_IDX_END
213};
214
119 215
120#ifdef CONFIG_MPIC_BROKEN_U3 216#ifdef CONFIG_MPIC_BROKEN_U3
121/* Fixup table entry */ 217/* Fixup table entry */
@@ -132,10 +228,19 @@ struct mpic_irq_fixup
132/* The instance data of a given MPIC */ 228/* The instance data of a given MPIC */
133struct mpic 229struct mpic
134{ 230{
231 /* The device node of the interrupt controller */
232 struct device_node *of_node;
233
234 /* The remapper for this MPIC */
235 struct irq_host *irqhost;
236
135 /* The "linux" controller struct */ 237 /* The "linux" controller struct */
136 hw_irq_controller hc_irq; 238 struct irq_chip hc_irq;
239#ifdef CONFIG_MPIC_BROKEN_U3
240 struct irq_chip hc_ht_irq;
241#endif
137#ifdef CONFIG_SMP 242#ifdef CONFIG_SMP
138 hw_irq_controller hc_ipi; 243 struct irq_chip hc_ipi;
139#endif 244#endif
140 const char *name; 245 const char *name;
141 /* Flags */ 246 /* Flags */
@@ -144,20 +249,12 @@ struct mpic
144 unsigned int isu_size; 249 unsigned int isu_size;
145 unsigned int isu_shift; 250 unsigned int isu_shift;
146 unsigned int isu_mask; 251 unsigned int isu_mask;
147 /* Offset of irq vector numbers */
148 unsigned int irq_offset;
149 unsigned int irq_count; 252 unsigned int irq_count;
150 /* Offset of ipi vector numbers */
151 unsigned int ipi_offset;
152 /* Number of sources */ 253 /* Number of sources */
153 unsigned int num_sources; 254 unsigned int num_sources;
154 /* Number of CPUs */ 255 /* Number of CPUs */
155 unsigned int num_cpus; 256 unsigned int num_cpus;
156 /* cascade handler */ 257 /* default senses array */
157 mpic_cascade_t cascade;
158 void *cascade_data;
159 unsigned int cascade_vec;
160 /* senses array */
161 unsigned char *senses; 258 unsigned char *senses;
162 unsigned int senses_count; 259 unsigned int senses_count;
163 260
@@ -173,15 +270,29 @@ struct mpic
173 volatile u32 __iomem *cpuregs[MPIC_MAX_CPUS]; 270 volatile u32 __iomem *cpuregs[MPIC_MAX_CPUS];
174 volatile u32 __iomem *isus[MPIC_MAX_ISU]; 271 volatile u32 __iomem *isus[MPIC_MAX_ISU];
175 272
273#ifdef CONFIG_MPIC_WEIRD
274 /* Pointer to HW info array */
275 u32 *hw_set;
276#endif
277
176 /* link */ 278 /* link */
177 struct mpic *next; 279 struct mpic *next;
178}; 280};
179 281
282/*
283 * MPIC flags (passed to mpic_alloc)
284 *
285 * The top 4 bits contain an MPIC bhw id that is used to index the
286 * register offsets and some masks when CONFIG_MPIC_WEIRD is set.
287 * Note setting any ID (leaving those bits to 0) means standard MPIC
288 */
289
180/* This is the primary controller, only that one has IPIs and 290/* This is the primary controller, only that one has IPIs and
181 * has afinity control. A non-primary MPIC always uses CPU0 291 * has afinity control. A non-primary MPIC always uses CPU0
182 * registers only 292 * registers only
183 */ 293 */
184#define MPIC_PRIMARY 0x00000001 294#define MPIC_PRIMARY 0x00000001
295
185/* Set this for a big-endian MPIC */ 296/* Set this for a big-endian MPIC */
186#define MPIC_BIG_ENDIAN 0x00000002 297#define MPIC_BIG_ENDIAN 0x00000002
187/* Broken U3 MPIC */ 298/* Broken U3 MPIC */
@@ -190,6 +301,18 @@ struct mpic
190#define MPIC_BROKEN_IPI 0x00000008 301#define MPIC_BROKEN_IPI 0x00000008
191/* MPIC wants a reset */ 302/* MPIC wants a reset */
192#define MPIC_WANTS_RESET 0x00000010 303#define MPIC_WANTS_RESET 0x00000010
304/* Spurious vector requires EOI */
305#define MPIC_SPV_EOI 0x00000020
306/* No passthrough disable */
307#define MPIC_NO_PTHROU_DIS 0x00000040
308
309/* MPIC HW modification ID */
310#define MPIC_REGSET_MASK 0xf0000000
311#define MPIC_REGSET(val) (((val) & 0xf ) << 28)
312#define MPIC_GET_REGSET(flags) (((flags) >> 28) & 0xf)
313
314#define MPIC_REGSET_STANDARD MPIC_REGSET(0) /* Original MPIC */
315#define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */
193 316
194/* Allocate the controller structure and setup the linux irq descs 317/* Allocate the controller structure and setup the linux irq descs
195 * for the range if interrupts passed in. No HW initialization is 318 * for the range if interrupts passed in. No HW initialization is
@@ -213,14 +336,11 @@ struct mpic
213 * The values in the array start at the first source of the MPIC, 336 * The values in the array start at the first source of the MPIC,
214 * that is senses[0] correspond to linux irq "irq_offset". 337 * that is senses[0] correspond to linux irq "irq_offset".
215 */ 338 */
216extern struct mpic *mpic_alloc(unsigned long phys_addr, 339extern struct mpic *mpic_alloc(struct device_node *node,
340 unsigned long phys_addr,
217 unsigned int flags, 341 unsigned int flags,
218 unsigned int isu_size, 342 unsigned int isu_size,
219 unsigned int irq_offset,
220 unsigned int irq_count, 343 unsigned int irq_count,
221 unsigned int ipi_offset,
222 unsigned char *senses,
223 unsigned int senses_num,
224 const char *name); 344 const char *name);
225 345
226/* Assign ISUs, to call before mpic_init() 346/* Assign ISUs, to call before mpic_init()
@@ -232,22 +352,27 @@ extern struct mpic *mpic_alloc(unsigned long phys_addr,
232extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, 352extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
233 unsigned long phys_addr); 353 unsigned long phys_addr);
234 354
355/* Set default sense codes
356 *
357 * @mpic: controller
358 * @senses: array of sense codes
359 * @count: size of above array
360 *
361 * Optionally provide an array (indexed on hardware interrupt numbers
362 * for this MPIC) of default sense codes for the chip. Those are linux
363 * sense codes IRQ_TYPE_*
364 *
365 * The driver gets ownership of the pointer, don't dispose of it or
366 * anything like that. __init only.
367 */
368extern void mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count);
369
370
235/* Initialize the controller. After this has been called, none of the above 371/* Initialize the controller. After this has been called, none of the above
236 * should be called again for this mpic 372 * should be called again for this mpic
237 */ 373 */
238extern void mpic_init(struct mpic *mpic); 374extern void mpic_init(struct mpic *mpic);
239 375
240/* Setup a cascade. Currently, only one cascade is supported this
241 * way, though you can always do a normal request_irq() and add
242 * other cascades this way. You should call this _after_ having
243 * added all the ISUs
244 *
245 * @irq_no: "linux" irq number of the cascade (that is offset'ed vector)
246 * @handler: cascade handler function
247 */
248extern void mpic_setup_cascade(unsigned int irq_no, mpic_cascade_t hanlder,
249 void *data);
250
251/* 376/*
252 * All of the following functions must only be used after the 377 * All of the following functions must only be used after the
253 * ISUs have been assigned and the controller fully initialized 378 * ISUs have been assigned and the controller fully initialized
@@ -284,9 +409,9 @@ extern void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask);
284void smp_mpic_message_pass(int target, int msg); 409void smp_mpic_message_pass(int target, int msg);
285 410
286/* Fetch interrupt from a given mpic */ 411/* Fetch interrupt from a given mpic */
287extern int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs); 412extern unsigned int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs);
288/* This one gets to the primary mpic */ 413/* This one gets to the primary mpic */
289extern int mpic_get_irq(struct pt_regs *regs); 414extern unsigned int mpic_get_irq(struct pt_regs *regs);
290 415
291/* Set the EPIC clock ratio */ 416/* Set the EPIC clock ratio */
292void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio); 417void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio);
@@ -294,8 +419,5 @@ void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio);
294/* Enable/Disable EPIC serial interrupt mode */ 419/* Enable/Disable EPIC serial interrupt mode */
295void mpic_set_serial_int(struct mpic *mpic, int enable); 420void mpic_set_serial_int(struct mpic *mpic, int enable);
296 421
297/* global mpic for pSeries */
298extern struct mpic *pSeries_mpic;
299
300#endif /* __KERNEL__ */ 422#endif /* __KERNEL__ */
301#endif /* _ASM_POWERPC_MPIC_H */ 423#endif /* _ASM_POWERPC_MPIC_H */
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index 6249a7c396..c5c0b0b3cd 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -9,7 +9,7 @@
9/* 9/*
10 * The of_platform_bus_type is a bus type used by drivers that do not 10 * The of_platform_bus_type is a bus type used by drivers that do not
11 * attach to a macio or similar bus but still use OF probing 11 * attach to a macio or similar bus but still use OF probing
12 * mecanism 12 * mechanism
13 */ 13 */
14extern struct bus_type of_platform_bus_type; 14extern struct bus_type of_platform_bus_type;
15 15
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 2d4585f062..0a4e5c93e8 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -23,6 +23,7 @@
23register struct paca_struct *local_paca asm("r13"); 23register struct paca_struct *local_paca asm("r13");
24#define get_paca() local_paca 24#define get_paca() local_paca
25#define get_lppaca() (get_paca()->lppaca_ptr) 25#define get_lppaca() (get_paca()->lppaca_ptr)
26#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
26 27
27struct task_struct; 28struct task_struct;
28 29
@@ -93,11 +94,14 @@ struct paca_struct {
93 u64 saved_r1; /* r1 save for RTAS calls */ 94 u64 saved_r1; /* r1 save for RTAS calls */
94 u64 saved_msr; /* MSR saved here by enter_rtas */ 95 u64 saved_msr; /* MSR saved here by enter_rtas */
95 u8 proc_enabled; /* irq soft-enable flag */ 96 u8 proc_enabled; /* irq soft-enable flag */
97 u8 io_sync; /* writel() needs spin_unlock sync */
96 98
97 /* Stuff for accurate time accounting */ 99 /* Stuff for accurate time accounting */
98 u64 user_time; /* accumulated usermode TB ticks */ 100 u64 user_time; /* accumulated usermode TB ticks */
99 u64 system_time; /* accumulated system TB ticks */ 101 u64 system_time; /* accumulated system TB ticks */
100 u64 startpurr; /* PURR/TB value snapshot */ 102 u64 startpurr; /* PURR/TB value snapshot */
103
104 struct slb_shadow *slb_shadow_ptr;
101}; 105};
102 106
103extern struct paca_struct paca[]; 107extern struct paca_struct paca[];
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index fb597b37c2..b4d38b0b15 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -55,12 +55,6 @@
55#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 55#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
56#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) 56#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START)
57 57
58#ifdef CONFIG_DISCONTIGMEM
59#define page_to_pfn(page) discontigmem_page_to_pfn(page)
60#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
61#define pfn_valid(pfn) discontigmem_pfn_valid(pfn)
62#endif
63
64#ifdef CONFIG_FLATMEM 58#ifdef CONFIG_FLATMEM
65#define pfn_valid(pfn) ((pfn) < max_mapnr) 59#define pfn_valid(pfn) ((pfn) < max_mapnr)
66#endif 60#endif
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 5d2c9e6c4b..46afd29b90 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -242,7 +242,7 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
242#define HAVE_ARCH_PCI_RESOURCE_TO_USER 242#define HAVE_ARCH_PCI_RESOURCE_TO_USER
243extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 243extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
244 const struct resource *rsrc, 244 const struct resource *rsrc,
245 u64 *start, u64 *end); 245 resource_size_t *start, resource_size_t *end);
246#endif /* CONFIG_PPC_MULTIPLATFORM || CONFIG_PPC32 */ 246#endif /* CONFIG_PPC_MULTIPLATFORM || CONFIG_PPC32 */
247 247
248#endif /* __KERNEL__ */ 248#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index 184a7a4d2f..2f2e3024fa 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -14,6 +14,7 @@
14 14
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset) 15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset() get_paca()->data_offset 16#define __my_cpu_offset() get_paca()->data_offset
17#define per_cpu_offset(x) (__per_cpu_offset(x))
17 18
18/* Separate out the type, so (int[3], foo) works. */ 19/* Separate out the type, so (int[3], foo) works. */
19#define DEFINE_PER_CPU(type, name) \ 20#define DEFINE_PER_CPU(type, name) \
@@ -22,6 +23,7 @@
22/* var is in discarded region: offset to particular copy we want */ 23/* var is in discarded region: offset to particular copy we want */
23#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 24#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
24#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 25#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
26#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
25 27
26/* A macro to avoid #include hell... */ 28/* A macro to avoid #include hell... */
27#define percpu_modcopy(pcpudst, src, size) \ 29#define percpu_modcopy(pcpudst, src, size) \
@@ -41,6 +43,7 @@ extern void setup_per_cpu_areas(void);
41 43
42#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 44#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
43#define __get_cpu_var(var) per_cpu__##var 45#define __get_cpu_var(var) per_cpu__##var
46#define __raw_get_cpu_var(var) per_cpu__##var
44 47
45#endif /* SMP */ 48#endif /* SMP */
46 49
diff --git a/include/asm-powerpc/pgalloc.h b/include/asm-powerpc/pgalloc.h
index 9f0917c686..ae63db7b3e 100644
--- a/include/asm-powerpc/pgalloc.h
+++ b/include/asm-powerpc/pgalloc.h
@@ -117,7 +117,7 @@ static inline void pte_free(struct page *ptepage)
117 pte_free_kernel(page_address(ptepage)); 117 pte_free_kernel(page_address(ptepage));
118} 118}
119 119
120#define PGF_CACHENUM_MASK 0xf 120#define PGF_CACHENUM_MASK 0x3
121 121
122typedef struct pgtable_free { 122typedef struct pgtable_free {
123 unsigned long val; 123 unsigned long val;
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index e703615567..345d9b07b3 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -88,10 +88,11 @@
88#define pgd_bad(pgd) (pgd_val(pgd) == 0) 88#define pgd_bad(pgd) (pgd_val(pgd) == 0)
89#define pgd_present(pgd) (pgd_val(pgd) != 0) 89#define pgd_present(pgd) (pgd_val(pgd) != 0)
90#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) 90#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
91#define pgd_page(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) 91#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
92#define pgd_page(pgd) virt_to_page(pgd_page_vaddr(pgd))
92 93
93#define pud_offset(pgdp, addr) \ 94#define pud_offset(pgdp, addr) \
94 (((pud_t *) pgd_page(*(pgdp))) + \ 95 (((pud_t *) pgd_page_vaddr(*(pgdp))) + \
95 (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) 96 (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))
96 97
97#define pud_ERROR(e) \ 98#define pud_ERROR(e) \
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 8dbf5ad815..10f52743f4 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -196,8 +196,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
196 || (pmd_val(pmd) & PMD_BAD_BITS)) 196 || (pmd_val(pmd) & PMD_BAD_BITS))
197#define pmd_present(pmd) (pmd_val(pmd) != 0) 197#define pmd_present(pmd) (pmd_val(pmd) != 0)
198#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) 198#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
199#define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) 199#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
200#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) 200#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd))
201 201
202#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) 202#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval))
203#define pud_none(pud) (!pud_val(pud)) 203#define pud_none(pud) (!pud_val(pud))
@@ -205,7 +205,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
205 || (pud_val(pud) & PUD_BAD_BITS)) 205 || (pud_val(pud) & PUD_BAD_BITS))
206#define pud_present(pud) (pud_val(pud) != 0) 206#define pud_present(pud) (pud_val(pud) != 0)
207#define pud_clear(pudp) (pud_val(*(pudp)) = 0) 207#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
208#define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) 208#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
209#define pud_page(pud) virt_to_page(pud_page_vaddr(pud))
209 210
210#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) 211#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})
211 212
@@ -219,10 +220,10 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
219#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 220#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
220 221
221#define pmd_offset(pudp,addr) \ 222#define pmd_offset(pudp,addr) \
222 (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) 223 (((pmd_t *) pud_page_vaddr(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
223 224
224#define pte_offset_kernel(dir,addr) \ 225#define pte_offset_kernel(dir,addr) \
225 (((pte_t *) pmd_page_kernel(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 226 (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
226 227
227#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) 228#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
228#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) 229#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr))
diff --git a/include/asm-powerpc/pmac_pfunc.h b/include/asm-powerpc/pmac_pfunc.h
index cef61304ff..1330d6a58c 100644
--- a/include/asm-powerpc/pmac_pfunc.h
+++ b/include/asm-powerpc/pmac_pfunc.h
@@ -205,7 +205,7 @@ extern void pmf_do_irq(struct pmf_function *func);
205 * 205 *
206 * The args array contains as many arguments as is required by the function, 206 * The args array contains as many arguments as is required by the function,
207 * this is dependent on the function you are calling, unfortunately Apple 207 * this is dependent on the function you are calling, unfortunately Apple
208 * mecanism provides no way to encode that so you have to get it right at 208 * mechanism provides no way to encode that so you have to get it right at
209 * the call site. Some functions require no args, in which case, you can 209 * the call site. Some functions require no args, in which case, you can
210 * pass NULL. 210 * pass NULL.
211 * 211 *
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index cf79bc7ebb..1115756c79 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -69,6 +69,17 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr);
69void eeh_slot_error_detail (struct pci_dn *pdn, int severity); 69void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
70 70
71/** 71/**
72 * rtas_pci_enableo - enable IO transfers for this slot
73 * @pdn: pci device node
74 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
75 *
76 * Enable I/O transfers to this slot
77 */
78#define EEH_THAW_MMIO 2
79#define EEH_THAW_DMA 3
80int rtas_pci_enable(struct pci_dn *pdn, int function);
81
82/**
72 * rtas_set_slot_reset -- unfreeze a frozen slot 83 * rtas_set_slot_reset -- unfreeze a frozen slot
73 * 84 *
74 * Clear the EEH-frozen condition on a slot. This routine 85 * Clear the EEH-frozen condition on a slot. This routine
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 22e54a2a66..6cb6fb19e5 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -32,6 +32,7 @@
32#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ 32#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
33#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 33#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
34#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 34#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
35#define _CHRP_briq 0x07 /* TotalImpact's briQ */
35 36
36#if defined(__KERNEL__) && defined(CONFIG_PPC32) 37#if defined(__KERNEL__) && defined(CONFIG_PPC32)
37 38
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 010d186d09..5246297693 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -64,11 +64,6 @@ struct boot_param_header
64typedef u32 phandle; 64typedef u32 phandle;
65typedef u32 ihandle; 65typedef u32 ihandle;
66 66
67struct interrupt_info {
68 int line;
69 int sense; /* +ve/-ve logic, edge or level, etc. */
70};
71
72struct property { 67struct property {
73 char *name; 68 char *name;
74 int length; 69 int length;
@@ -77,12 +72,10 @@ struct property {
77}; 72};
78 73
79struct device_node { 74struct device_node {
80 char *name; 75 const char *name;
81 char *type; 76 const char *type;
82 phandle node; 77 phandle node;
83 phandle linux_phandle; 78 phandle linux_phandle;
84 int n_intrs;
85 struct interrupt_info *intrs;
86 char *full_name; 79 char *full_name;
87 80
88 struct property *properties; 81 struct property *properties;
@@ -167,8 +160,8 @@ extern void unflatten_device_tree(void);
167extern void early_init_devtree(void *); 160extern void early_init_devtree(void *);
168extern int device_is_compatible(struct device_node *device, const char *); 161extern int device_is_compatible(struct device_node *device, const char *);
169extern int machine_is_compatible(const char *compat); 162extern int machine_is_compatible(const char *compat);
170extern unsigned char *get_property(struct device_node *node, const char *name, 163extern const void *get_property(struct device_node *node, const char *name,
171 int *lenp); 164 int *lenp);
172extern void print_properties(struct device_node *node); 165extern void print_properties(struct device_node *node);
173extern int prom_n_addr_cells(struct device_node* np); 166extern int prom_n_addr_cells(struct device_node* np);
174extern int prom_n_size_cells(struct device_node* np); 167extern int prom_n_size_cells(struct device_node* np);
@@ -204,18 +197,37 @@ extern int release_OF_resource(struct device_node* node, int index);
204 */ 197 */
205 198
206 199
200/* Helper to read a big number; size is in cells (not bytes) */
201static inline u64 of_read_number(const u32 *cell, int size)
202{
203 u64 r = 0;
204 while (size--)
205 r = (r << 32) | *(cell++);
206 return r;
207}
208
209/* Like of_read_number, but we want an unsigned long result */
210#ifdef CONFIG_PPC32
211static inline unsigned long of_read_ulong(const u32 *cell, int size)
212{
213 return cell[size-1];
214}
215#else
216#define of_read_ulong(cell, size) of_read_number(cell, size)
217#endif
218
207/* Translate an OF address block into a CPU physical address 219/* Translate an OF address block into a CPU physical address
208 */ 220 */
209#define OF_BAD_ADDR ((u64)-1) 221#define OF_BAD_ADDR ((u64)-1)
210extern u64 of_translate_address(struct device_node *np, u32 *addr); 222extern u64 of_translate_address(struct device_node *np, const u32 *addr);
211 223
212/* Extract an address from a device, returns the region size and 224/* Extract an address from a device, returns the region size and
213 * the address space flags too. The PCI version uses a BAR number 225 * the address space flags too. The PCI version uses a BAR number
214 * instead of an absolute index 226 * instead of an absolute index
215 */ 227 */
216extern u32 *of_get_address(struct device_node *dev, int index, 228extern const u32 *of_get_address(struct device_node *dev, int index,
217 u64 *size, unsigned int *flags); 229 u64 *size, unsigned int *flags);
218extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, 230extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
219 u64 *size, unsigned int *flags); 231 u64 *size, unsigned int *flags);
220 232
221/* Get an address as a resource. Note that if your address is 233/* Get an address as a resource. Note that if your address is
@@ -232,7 +244,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar,
232/* Parse the ibm,dma-window property of an OF node into the busno, phys and 244/* Parse the ibm,dma-window property of an OF node into the busno, phys and
233 * size parameters. 245 * size parameters.
234 */ 246 */
235void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, 247void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
236 unsigned long *busno, unsigned long *phys, unsigned long *size); 248 unsigned long *busno, unsigned long *phys, unsigned long *size);
237 249
238extern void kdump_move_device_tree(void); 250extern void kdump_move_device_tree(void);
@@ -240,5 +252,85 @@ extern void kdump_move_device_tree(void);
240/* CPU OF node matching */ 252/* CPU OF node matching */
241struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); 253struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
242 254
255
256/*
257 * OF interrupt mapping
258 */
259
260/* This structure is returned when an interrupt is mapped. The controller
261 * field needs to be put() after use
262 */
263
264#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
265
266struct of_irq {
267 struct device_node *controller; /* Interrupt controller node */
268 u32 size; /* Specifier size */
269 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
270};
271
272/**
273 * of_irq_map_init - Initialize the irq remapper
274 * @flags: flags defining workarounds to enable
275 *
276 * Some machines have bugs in the device-tree which require certain workarounds
277 * to be applied. Call this before any interrupt mapping attempts to enable
278 * those workarounds.
279 */
280#define OF_IMAP_OLDWORLD_MAC 0x00000001
281#define OF_IMAP_NO_PHANDLE 0x00000002
282
283extern void of_irq_map_init(unsigned int flags);
284
285/**
286 * of_irq_map_raw - Low level interrupt tree parsing
287 * @parent: the device interrupt parent
288 * @intspec: interrupt specifier ("interrupts" property of the device)
289 * @ointsize: size of the passed in interrupt specifier
290 * @addr: address specifier (start of "reg" property of the device)
291 * @out_irq: structure of_irq filled by this function
292 *
293 * Returns 0 on success and a negative number on error
294 *
295 * This function is a low-level interrupt tree walking function. It
296 * can be used to do a partial walk with synthetized reg and interrupts
297 * properties, for example when resolving PCI interrupts when no device
298 * node exist for the parent.
299 *
300 */
301
302extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
303 u32 ointsize, const u32 *addr,
304 struct of_irq *out_irq);
305
306
307/**
308 * of_irq_map_one - Resolve an interrupt for a device
309 * @device: the device whose interrupt is to be resolved
310 * @index: index of the interrupt to resolve
311 * @out_irq: structure of_irq filled by this function
312 *
313 * This function resolves an interrupt, walking the tree, for a given
314 * device-tree node. It's the high level pendant to of_irq_map_raw().
315 * It also implements the workarounds for OldWolrd Macs.
316 */
317extern int of_irq_map_one(struct device_node *device, int index,
318 struct of_irq *out_irq);
319
320/**
321 * of_irq_map_pci - Resolve the interrupt for a PCI device
322 * @pdev: the device whose interrupt is to be resolved
323 * @out_irq: structure of_irq filled by this function
324 *
325 * This function resolves the PCI interrupt for a given PCI device. If a
326 * device-node exists for a given pci_dev, it will use normal OF tree
327 * walking. If not, it will implement standard swizzling and walk up the
328 * PCI tree until an device-node is found, at which point it will finish
329 * resolving using the OF tree walking.
330 */
331struct pci_dev;
332extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
333
334
243#endif /* __KERNEL__ */ 335#endif /* __KERNEL__ */
244#endif /* _POWERPC_PROM_H */ 336#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index dc4cb9cc73..4435efe85d 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -215,12 +215,10 @@ do { \
215#define PTRACE_GETVRREGS 18 215#define PTRACE_GETVRREGS 18
216#define PTRACE_SETVRREGS 19 216#define PTRACE_SETVRREGS 19
217 217
218#ifndef __powerpc64__
219/* Get/set all the upper 32-bits of the SPE registers, accumulator, and 218/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
220 * spefscr, in one go */ 219 * spefscr, in one go */
221#define PTRACE_GETEVRREGS 20 220#define PTRACE_GETEVRREGS 20
222#define PTRACE_SETEVRREGS 21 221#define PTRACE_SETEVRREGS 21
223#endif /* __powerpc64__ */
224 222
225/* 223/*
226 * Get or set a debug register. The first 16 are DABR registers and the 224 * Get or set a debug register. The first 16 are DABR registers and the
@@ -235,7 +233,6 @@ do { \
235#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 233#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
236#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 234#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
237 235
238#ifdef __powerpc64__
239/* Calls to trace a 64bit program from a 32bit program */ 236/* Calls to trace a 64bit program from a 32bit program */
240#define PPC_PTRACE_PEEKTEXT_3264 0x95 237#define PPC_PTRACE_PEEKTEXT_3264 0x95
241#define PPC_PTRACE_PEEKDATA_3264 0x94 238#define PPC_PTRACE_PEEKDATA_3264 0x94
@@ -243,6 +240,5 @@ do { \
243#define PPC_PTRACE_POKEDATA_3264 0x92 240#define PPC_PTRACE_POKEDATA_3264 0x92
244#define PPC_PTRACE_PEEKUSR_3264 0x91 241#define PPC_PTRACE_PEEKUSR_3264 0x91
245#define PPC_PTRACE_POKEUSR_3264 0x90 242#define PPC_PTRACE_POKEUSR_3264 0x90
246#endif /* __powerpc64__ */
247 243
248#endif /* _ASM_POWERPC_PTRACE_H */ 244#endif /* _ASM_POWERPC_PTRACE_H */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index cf73475a0c..3a9fcc1581 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -592,6 +592,7 @@
592#define PV_630p 0x0041 592#define PV_630p 0x0041
593#define PV_970MP 0x0044 593#define PV_970MP 0x0044
594#define PV_BE 0x0070 594#define PV_BE 0x0070
595#define PV_PA6T 0x0090
595 596
596/* 597/*
597 * Number of entries in the SLB. If this ever changes we should handle 598 * Number of entries in the SLB. If this ever changes we should handle
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 02e213e3d6..d34f9e1f24 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -170,6 +170,7 @@ extern int rtas_get_sensor(int sensor, int index, int *state);
170extern int rtas_get_power_level(int powerdomain, int *level); 170extern int rtas_get_power_level(int powerdomain, int *level);
171extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 171extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
172extern int rtas_set_indicator(int indicator, int index, int new_value); 172extern int rtas_set_indicator(int indicator, int index, int new_value);
173extern int rtas_set_indicator_fast(int indicator, int index, int new_value);
173extern void rtas_progress(char *s, unsigned short hex); 174extern void rtas_progress(char *s, unsigned short hex);
174extern void rtas_initialize(void); 175extern void rtas_initialize(void);
175 176
@@ -181,6 +182,9 @@ extern int rtas_set_rtc_time(struct rtc_time *rtc_time);
181extern unsigned int rtas_busy_delay_time(int status); 182extern unsigned int rtas_busy_delay_time(int status);
182extern unsigned int rtas_busy_delay(int status); 183extern unsigned int rtas_busy_delay(int status);
183 184
185extern int early_init_dt_scan_rtas(unsigned long node,
186 const char *uname, int depth, void *data);
187
184extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); 188extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
185 189
186/* Error types logged. */ 190/* Error types logged. */
@@ -226,5 +230,21 @@ extern unsigned long rtas_rmo_buf;
226 230
227#define GLOBAL_INTERRUPT_QUEUE 9005 231#define GLOBAL_INTERRUPT_QUEUE 9005
228 232
233/**
234 * rtas_config_addr - Format a busno, devfn and reg for RTAS.
235 * @busno: The bus number.
236 * @devfn: The device and function number as encoded by PCI_DEVFN().
237 * @reg: The register number.
238 *
239 * This function encodes the given busno, devfn and register number as
240 * required for RTAS calls that take a "config_addr" parameter.
241 * See PAPR requirement 7.3.4-1 for more info.
242 */
243static inline u32 rtas_config_addr(int busno, int devfn, int reg)
244{
245 return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) |
246 (devfn << 8) | (reg & 0xff);
247}
248
229#endif /* __KERNEL__ */ 249#endif /* __KERNEL__ */
230#endif /* _POWERPC_RTAS_H */ 250#endif /* _POWERPC_RTAS_H */
diff --git a/include/asm-powerpc/rwsem.h b/include/asm-powerpc/rwsem.h
index 2c2fe96475..e929145e1e 100644
--- a/include/asm-powerpc/rwsem.h
+++ b/include/asm-powerpc/rwsem.h
@@ -28,24 +28,11 @@ struct rw_semaphore {
28#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 28#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
29 spinlock_t wait_lock; 29 spinlock_t wait_lock;
30 struct list_head wait_list; 30 struct list_head wait_list;
31#if RWSEM_DEBUG
32 int debug;
33#endif
34}; 31};
35 32
36/*
37 * initialisation
38 */
39#if RWSEM_DEBUG
40#define __RWSEM_DEBUG_INIT , 0
41#else
42#define __RWSEM_DEBUG_INIT /* */
43#endif
44
45#define __RWSEM_INITIALIZER(name) \ 33#define __RWSEM_INITIALIZER(name) \
46 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 34 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
47 LIST_HEAD_INIT((name).wait_list) \ 35 LIST_HEAD_INIT((name).wait_list) }
48 __RWSEM_DEBUG_INIT }
49 36
50#define DECLARE_RWSEM(name) \ 37#define DECLARE_RWSEM(name) \
51 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 38 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -60,9 +47,6 @@ static inline void init_rwsem(struct rw_semaphore *sem)
60 sem->count = RWSEM_UNLOCKED_VALUE; 47 sem->count = RWSEM_UNLOCKED_VALUE;
61 spin_lock_init(&sem->wait_lock); 48 spin_lock_init(&sem->wait_lock);
62 INIT_LIST_HEAD(&sem->wait_list); 49 INIT_LIST_HEAD(&sem->wait_list);
63#if RWSEM_DEBUG
64 sem->debug = 0;
65#endif
66} 50}
67 51
68/* 52/*
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h
index a4d8f86485..a8c7babf49 100644
--- a/include/asm-powerpc/signal.h
+++ b/include/asm-powerpc/signal.h
@@ -63,7 +63,6 @@ typedef struct {
63 * SA_FLAGS values: 63 * SA_FLAGS values:
64 * 64 *
65 * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). 65 * SA_ONSTACK is not currently supported, but will allow sigaltstack(2).
66 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
67 * SA_RESTART flag to get restarting signals (which were the default long ago) 66 * SA_RESTART flag to get restarting signals (which were the default long ago)
68 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 67 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
69 * SA_RESETHAND clears the handler when the signal is delivered. 68 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -83,7 +82,6 @@ typedef struct {
83 82
84#define SA_NOMASK SA_NODEFER 83#define SA_NOMASK SA_NODEFER
85#define SA_ONESHOT SA_RESETHAND 84#define SA_ONESHOT SA_RESETHAND
86#define SA_INTERRUPT 0x20000000u /* dummy -- ignored */
87 85
88#define SA_RESTORER 0x04000000U 86#define SA_RESTORER 0x04000000U
89 87
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h
index 51e65fc46a..e49f644ca6 100644
--- a/include/asm-powerpc/smu.h
+++ b/include/asm-powerpc/smu.h
@@ -517,7 +517,7 @@ struct smu_sdbp_cpupiddata {
517 * This returns the pointer to an SMU "sdb" partition data or NULL 517 * This returns the pointer to an SMU "sdb" partition data or NULL
518 * if not found. The data format is described below 518 * if not found. The data format is described below
519 */ 519 */
520extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 520extern const struct smu_sdbp_header *smu_get_sdb_partition(int id,
521 unsigned int *size); 521 unsigned int *size);
522 522
523/* Get "sdb" partition data from an SMU satellite */ 523/* Get "sdb" partition data from an SMU satellite */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index e4b8177d4a..c8b1da50e7 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -55,5 +55,6 @@
55#define SO_ACCEPTCONN 30 55#define SO_ACCEPTCONN 30
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58#define SO_PASSSEC 34
58 59
59#endif /* _ASM_POWERPC_SOCKET_H */ 60#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/spinlock.h b/include/asm-powerpc/spinlock.h
index 895cb6d3a4..c31e4382a7 100644
--- a/include/asm-powerpc/spinlock.h
+++ b/include/asm-powerpc/spinlock.h
@@ -36,6 +36,19 @@
36#define LOCK_TOKEN 1 36#define LOCK_TOKEN 1
37#endif 37#endif
38 38
39#if defined(CONFIG_PPC64) && defined(CONFIG_SMP)
40#define CLEAR_IO_SYNC (get_paca()->io_sync = 0)
41#define SYNC_IO do { \
42 if (unlikely(get_paca()->io_sync)) { \
43 mb(); \
44 get_paca()->io_sync = 0; \
45 } \
46 } while (0)
47#else
48#define CLEAR_IO_SYNC
49#define SYNC_IO
50#endif
51
39/* 52/*
40 * This returns the old value in the lock, so we succeeded 53 * This returns the old value in the lock, so we succeeded
41 * in getting the lock if the return value is 0. 54 * in getting the lock if the return value is 0.
@@ -61,6 +74,7 @@ static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock)
61 74
62static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock) 75static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock)
63{ 76{
77 CLEAR_IO_SYNC;
64 return __spin_trylock(lock) == 0; 78 return __spin_trylock(lock) == 0;
65} 79}
66 80
@@ -91,6 +105,7 @@ extern void __rw_yield(raw_rwlock_t *lock);
91 105
92static void __inline__ __raw_spin_lock(raw_spinlock_t *lock) 106static void __inline__ __raw_spin_lock(raw_spinlock_t *lock)
93{ 107{
108 CLEAR_IO_SYNC;
94 while (1) { 109 while (1) {
95 if (likely(__spin_trylock(lock) == 0)) 110 if (likely(__spin_trylock(lock) == 0))
96 break; 111 break;
@@ -107,6 +122,7 @@ static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long
107{ 122{
108 unsigned long flags_dis; 123 unsigned long flags_dis;
109 124
125 CLEAR_IO_SYNC;
110 while (1) { 126 while (1) {
111 if (likely(__spin_trylock(lock) == 0)) 127 if (likely(__spin_trylock(lock) == 0))
112 break; 128 break;
@@ -124,6 +140,7 @@ static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long
124 140
125static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) 141static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock)
126{ 142{
143 SYNC_IO;
127 __asm__ __volatile__("# __raw_spin_unlock\n\t" 144 __asm__ __volatile__("# __raw_spin_unlock\n\t"
128 LWSYNC_ON_SMP: : :"memory"); 145 LWSYNC_ON_SMP: : :"memory");
129 lock->slock = 0; 146 lock->slock = 0;
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 9609d3ee87..b42b53c40f 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -106,7 +106,7 @@ struct spu_context;
106struct spu_runqueue; 106struct spu_runqueue;
107 107
108struct spu { 108struct spu {
109 char *name; 109 const char *name;
110 unsigned long local_store_phys; 110 unsigned long local_store_phys;
111 u8 *local_store; 111 u8 *local_store;
112 unsigned long problem_phys; 112 unsigned long problem_phys;
@@ -117,6 +117,7 @@ struct spu {
117 struct list_head sched_list; 117 struct list_head sched_list;
118 int number; 118 int number;
119 int nid; 119 int nid;
120 unsigned int irqs[3];
120 u32 isrc; 121 u32 isrc;
121 u32 node; 122 u32 node;
122 u64 flags; 123 u64 flags;
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index d075725bf4..4b41deaa8d 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -39,7 +39,6 @@
39#define read_barrier_depends() do { } while(0) 39#define read_barrier_depends() do { } while(0)
40 40
41#define set_mb(var, value) do { var = value; mb(); } while (0) 41#define set_mb(var, value) do { var = value; mb(); } while (0)
42#define set_wmb(var, value) do { var = value; wmb(); } while (0)
43 42
44#ifdef __KERNEL__ 43#ifdef __KERNEL__
45#ifdef CONFIG_SMP 44#ifdef CONFIG_SMP
@@ -54,6 +53,15 @@
54#define smp_read_barrier_depends() do { } while(0) 53#define smp_read_barrier_depends() do { } while(0)
55#endif /* CONFIG_SMP */ 54#endif /* CONFIG_SMP */
56 55
56/*
57 * This is a barrier which prevents following instructions from being
58 * started until the value of the argument x is known. For example, if
59 * x is a variable loaded from memory, this prevents following
60 * instructions from being executed until the load has been performed.
61 */
62#define data_barrier(x) \
63 asm volatile("twi 0,%0,0; isync" : : "r" (x) : "memory");
64
57struct task_struct; 65struct task_struct;
58struct pt_regs; 66struct pt_regs;
59 67
@@ -169,11 +177,6 @@ extern u32 booke_wdt_enabled;
169extern u32 booke_wdt_period; 177extern u32 booke_wdt_period;
170#endif /* CONFIG_BOOKE_WDT */ 178#endif /* CONFIG_BOOKE_WDT */
171 179
172/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
173extern unsigned char e2a(unsigned char);
174extern unsigned char* strne2a(unsigned char *dest,
175 const unsigned char *src, size_t n);
176
177struct device_node; 180struct device_node;
178extern void note_scsi_host(struct device_node *, void *); 181extern void note_scsi_host(struct device_node *, void *);
179 182
@@ -220,8 +223,8 @@ __xchg_u32(volatile void *p, unsigned long val)
220" stwcx. %3,0,%2 \n\ 223" stwcx. %3,0,%2 \n\
221 bne- 1b" 224 bne- 1b"
222 ISYNC_ON_SMP 225 ISYNC_ON_SMP
223 : "=&r" (prev), "=m" (*(volatile unsigned int *)p) 226 : "=&r" (prev), "+m" (*(volatile unsigned int *)p)
224 : "r" (p), "r" (val), "m" (*(volatile unsigned int *)p) 227 : "r" (p), "r" (val)
225 : "cc", "memory"); 228 : "cc", "memory");
226 229
227 return prev; 230 return prev;
@@ -240,8 +243,8 @@ __xchg_u64(volatile void *p, unsigned long val)
240" stdcx. %3,0,%2 \n\ 243" stdcx. %3,0,%2 \n\
241 bne- 1b" 244 bne- 1b"
242 ISYNC_ON_SMP 245 ISYNC_ON_SMP
243 : "=&r" (prev), "=m" (*(volatile unsigned long *)p) 246 : "=&r" (prev), "+m" (*(volatile unsigned long *)p)
244 : "r" (p), "r" (val), "m" (*(volatile unsigned long *)p) 247 : "r" (p), "r" (val)
245 : "cc", "memory"); 248 : "cc", "memory");
246 249
247 return prev; 250 return prev;
@@ -299,8 +302,8 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
299 ISYNC_ON_SMP 302 ISYNC_ON_SMP
300 "\n\ 303 "\n\
3012:" 3042:"
302 : "=&r" (prev), "=m" (*p) 305 : "=&r" (prev), "+m" (*p)
303 : "r" (p), "r" (old), "r" (new), "m" (*p) 306 : "r" (p), "r" (old), "r" (new)
304 : "cc", "memory"); 307 : "cc", "memory");
305 308
306 return prev; 309 return prev;
@@ -322,8 +325,8 @@ __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
322 ISYNC_ON_SMP 325 ISYNC_ON_SMP
323 "\n\ 326 "\n\
3242:" 3272:"
325 : "=&r" (prev), "=m" (*p) 328 : "=&r" (prev), "+m" (*p)
326 : "r" (p), "r" (old), "r" (new), "m" (*p) 329 : "r" (p), "r" (old), "r" (new)
327 : "cc", "memory"); 330 : "cc", "memory");
328 331
329 return prev; 332 return prev;
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 4463148c65..5785ac4737 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -18,8 +18,9 @@
18#include <linux/percpu.h> 18#include <linux/percpu.h>
19 19
20#include <asm/processor.h> 20#include <asm/processor.h>
21#ifdef CONFIG_PPC64 21#ifdef CONFIG_PPC_ISERIES
22#include <asm/paca.h> 22#include <asm/paca.h>
23#include <asm/firmware.h>
23#include <asm/iseries/hv_call.h> 24#include <asm/iseries/hv_call.h>
24#endif 25#endif
25 26
@@ -29,10 +30,6 @@ extern unsigned long tb_ticks_per_usec;
29extern unsigned long tb_ticks_per_sec; 30extern unsigned long tb_ticks_per_sec;
30extern u64 tb_to_xs; 31extern u64 tb_to_xs;
31extern unsigned tb_to_us; 32extern unsigned tb_to_us;
32extern unsigned long tb_last_stamp;
33extern u64 tb_last_jiffy;
34
35DECLARE_PER_CPU(unsigned long, last_jiffy);
36 33
37struct rtc_time; 34struct rtc_time;
38extern void to_tm(int tim, struct rtc_time * tm); 35extern void to_tm(int tim, struct rtc_time * tm);
@@ -177,7 +174,8 @@ static inline void set_dec(int val)
177#ifdef CONFIG_PPC_ISERIES 174#ifdef CONFIG_PPC_ISERIES
178 int cur_dec; 175 int cur_dec;
179 176
180 if (get_lppaca()->shared_proc) { 177 if (firmware_has_feature(FW_FEATURE_ISERIES) &&
178 get_lppaca()->shared_proc) {
181 get_lppaca()->virtual_decr = val; 179 get_lppaca()->virtual_decr = val;
182 cur_dec = get_dec(); 180 cur_dec = get_dec();
183 if (cur_dec > val) 181 if (cur_dec > val)
diff --git a/include/asm-powerpc/todc.h b/include/asm-powerpc/todc.h
new file mode 100644
index 0000000000..60a8c39b8c
--- /dev/null
+++ b/include/asm-powerpc/todc.h
@@ -0,0 +1,487 @@
1/*
2 * Definitions for the M48Txx and mc146818 series of Time of day/Real Time
3 * Clock chips.
4 *
5 * Author: Mark A. Greer <mgreer@mvista.com>
6 *
7 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13/*
14 * Support for the M48T37/M48T59/.../mc146818 Real Time Clock chips.
15 * Purpose is to make one generic file that handles all of these chips instead
16 * of every platform implementing the same code over & over again.
17 */
18
19#ifndef __PPC_KERNEL_TODC_H
20#define __PPC_KERNEL_TODC_H
21
22typedef struct {
23 uint rtc_type; /* your particular chip */
24
25 /*
26 * Following are the addresses of the AS0, AS1, and DATA registers
27 * of these chips. Note that these are board-specific.
28 */
29 unsigned int nvram_as0;
30 unsigned int nvram_as1;
31 unsigned int nvram_data;
32
33 /*
34 * Define bits to stop external set of regs from changing so
35 * the chip can be read/written reliably.
36 */
37 unsigned char enable_read;
38 unsigned char enable_write;
39
40 /*
41 * Following is the number of AS0 address bits. This is normally
42 * 8 but some bad hardware routes address lines incorrectly.
43 */
44 int as0_bits;
45
46 int nvram_size; /* Size of NVRAM on chip */
47 int sw_flags; /* Software control flags */
48
49 /* Following are the register offsets for the particular chip */
50 int year;
51 int month;
52 int day_of_month;
53 int day_of_week;
54 int hours;
55 int minutes;
56 int seconds;
57 int control_b;
58 int control_a;
59 int watchdog;
60 int interrupts;
61 int alarm_date;
62 int alarm_hour;
63 int alarm_minutes;
64 int alarm_seconds;
65 int century;
66 int flags;
67
68 /*
69 * Some RTC chips have their NVRAM buried behind a addr/data pair of
70 * regs on the first level/clock registers. The following fields
71 * are the addresses for those addr/data regs.
72 */
73 int nvram_addr_reg;
74 int nvram_data_reg;
75} todc_info_t;
76
77/*
78 * Define the types of TODC/RTC variants that are supported in
79 * arch/ppc/kernel/todc_time.c
80 * Make a new one of these for any chip somehow differs from what's already
81 * defined. That way, if you ever need to put in code to touch those
82 * bits/registers in todc_time.c, you can put it inside an
83 * 'if (todc_info->rtc_type == TODC_TYPE_XXX)' so you won't break
84 * anyone else.
85 */
86#define TODC_TYPE_MK48T35 1
87#define TODC_TYPE_MK48T37 2
88#define TODC_TYPE_MK48T59 3
89#define TODC_TYPE_DS1693 4 /* Dallas DS1693 RTC */
90#define TODC_TYPE_DS1743 5 /* Dallas DS1743 RTC */
91#define TODC_TYPE_DS1746 6 /* Dallas DS1746 RTC */
92#define TODC_TYPE_DS1747 7 /* Dallas DS1747 RTC */
93#define TODC_TYPE_DS1501 8 /* Dallas DS1501 RTC */
94#define TODC_TYPE_DS1643 9 /* Dallas DS1643 RTC */
95#define TODC_TYPE_PC97307 10 /* PC97307 internal RTC */
96#define TODC_TYPE_DS1557 11 /* Dallas DS1557 RTC */
97#define TODC_TYPE_DS17285 12 /* Dallas DS17285 RTC */
98#define TODC_TYPE_DS1553 13 /* Dallas DS1553 RTC */
99#define TODC_TYPE_MC146818 100 /* Leave room for m48txx's */
100
101/*
102 * Bit to clear/set to enable reads/writes to the chip
103 */
104#define TODC_MK48TXX_CNTL_A_R 0x40
105#define TODC_MK48TXX_CNTL_A_W 0x80
106#define TODC_MK48TXX_DAY_CB 0x80
107
108#define TODC_DS1501_CNTL_B_TE 0x80
109
110/*
111 * Define flag bits used by todc routines.
112 */
113#define TODC_FLAG_2_LEVEL_NVRAM 0x00000001
114
115/*
116 * Define the values for the various RTC's that should to into the todc_info
117 * table.
118 * Note: The XXX_NVRAM_SIZE, XXX_NVRAM_ADDR_REG, and XXX_NVRAM_DATA_REG only
119 * matter if XXX_SW_FLAGS has TODC_FLAG_2_LEVEL_NVRAM set.
120 */
121#define TODC_TYPE_MK48T35_NVRAM_SIZE 0x7ff8
122#define TODC_TYPE_MK48T35_SW_FLAGS 0
123#define TODC_TYPE_MK48T35_YEAR 0x7fff
124#define TODC_TYPE_MK48T35_MONTH 0x7ffe
125#define TODC_TYPE_MK48T35_DOM 0x7ffd /* Day of Month */
126#define TODC_TYPE_MK48T35_DOW 0x7ffc /* Day of Week */
127#define TODC_TYPE_MK48T35_HOURS 0x7ffb
128#define TODC_TYPE_MK48T35_MINUTES 0x7ffa
129#define TODC_TYPE_MK48T35_SECONDS 0x7ff9
130#define TODC_TYPE_MK48T35_CNTL_B 0x7ff9
131#define TODC_TYPE_MK48T35_CNTL_A 0x7ff8
132#define TODC_TYPE_MK48T35_WATCHDOG 0x0000
133#define TODC_TYPE_MK48T35_INTERRUPTS 0x0000
134#define TODC_TYPE_MK48T35_ALARM_DATE 0x0000
135#define TODC_TYPE_MK48T35_ALARM_HOUR 0x0000
136#define TODC_TYPE_MK48T35_ALARM_MINUTES 0x0000
137#define TODC_TYPE_MK48T35_ALARM_SECONDS 0x0000
138#define TODC_TYPE_MK48T35_CENTURY 0x0000
139#define TODC_TYPE_MK48T35_FLAGS 0x0000
140#define TODC_TYPE_MK48T35_NVRAM_ADDR_REG 0
141#define TODC_TYPE_MK48T35_NVRAM_DATA_REG 0
142
143#define TODC_TYPE_MK48T37_NVRAM_SIZE 0x7ff0
144#define TODC_TYPE_MK48T37_SW_FLAGS 0
145#define TODC_TYPE_MK48T37_YEAR 0x7fff
146#define TODC_TYPE_MK48T37_MONTH 0x7ffe
147#define TODC_TYPE_MK48T37_DOM 0x7ffd /* Day of Month */
148#define TODC_TYPE_MK48T37_DOW 0x7ffc /* Day of Week */
149#define TODC_TYPE_MK48T37_HOURS 0x7ffb
150#define TODC_TYPE_MK48T37_MINUTES 0x7ffa
151#define TODC_TYPE_MK48T37_SECONDS 0x7ff9
152#define TODC_TYPE_MK48T37_CNTL_B 0x7ff9
153#define TODC_TYPE_MK48T37_CNTL_A 0x7ff8
154#define TODC_TYPE_MK48T37_WATCHDOG 0x7ff7
155#define TODC_TYPE_MK48T37_INTERRUPTS 0x7ff6
156#define TODC_TYPE_MK48T37_ALARM_DATE 0x7ff5
157#define TODC_TYPE_MK48T37_ALARM_HOUR 0x7ff4
158#define TODC_TYPE_MK48T37_ALARM_MINUTES 0x7ff3
159#define TODC_TYPE_MK48T37_ALARM_SECONDS 0x7ff2
160#define TODC_TYPE_MK48T37_CENTURY 0x7ff1
161#define TODC_TYPE_MK48T37_FLAGS 0x7ff0
162#define TODC_TYPE_MK48T37_NVRAM_ADDR_REG 0
163#define TODC_TYPE_MK48T37_NVRAM_DATA_REG 0
164
165#define TODC_TYPE_MK48T59_NVRAM_SIZE 0x1ff0
166#define TODC_TYPE_MK48T59_SW_FLAGS 0
167#define TODC_TYPE_MK48T59_YEAR 0x1fff
168#define TODC_TYPE_MK48T59_MONTH 0x1ffe
169#define TODC_TYPE_MK48T59_DOM 0x1ffd /* Day of Month */
170#define TODC_TYPE_MK48T59_DOW 0x1ffc /* Day of Week */
171#define TODC_TYPE_MK48T59_HOURS 0x1ffb
172#define TODC_TYPE_MK48T59_MINUTES 0x1ffa
173#define TODC_TYPE_MK48T59_SECONDS 0x1ff9
174#define TODC_TYPE_MK48T59_CNTL_B 0x1ff9
175#define TODC_TYPE_MK48T59_CNTL_A 0x1ff8
176#define TODC_TYPE_MK48T59_WATCHDOG 0x1fff
177#define TODC_TYPE_MK48T59_INTERRUPTS 0x1fff
178#define TODC_TYPE_MK48T59_ALARM_DATE 0x1fff
179#define TODC_TYPE_MK48T59_ALARM_HOUR 0x1fff
180#define TODC_TYPE_MK48T59_ALARM_MINUTES 0x1fff
181#define TODC_TYPE_MK48T59_ALARM_SECONDS 0x1fff
182#define TODC_TYPE_MK48T59_CENTURY 0x1fff
183#define TODC_TYPE_MK48T59_FLAGS 0x1fff
184#define TODC_TYPE_MK48T59_NVRAM_ADDR_REG 0
185#define TODC_TYPE_MK48T59_NVRAM_DATA_REG 0
186
187#define TODC_TYPE_DS1501_NVRAM_SIZE 0x100
188#define TODC_TYPE_DS1501_SW_FLAGS TODC_FLAG_2_LEVEL_NVRAM
189#define TODC_TYPE_DS1501_YEAR (TODC_TYPE_DS1501_NVRAM_SIZE + 0x06)
190#define TODC_TYPE_DS1501_MONTH (TODC_TYPE_DS1501_NVRAM_SIZE + 0x05)
191#define TODC_TYPE_DS1501_DOM (TODC_TYPE_DS1501_NVRAM_SIZE + 0x04)
192#define TODC_TYPE_DS1501_DOW (TODC_TYPE_DS1501_NVRAM_SIZE + 0x03)
193#define TODC_TYPE_DS1501_HOURS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x02)
194#define TODC_TYPE_DS1501_MINUTES (TODC_TYPE_DS1501_NVRAM_SIZE + 0x01)
195#define TODC_TYPE_DS1501_SECONDS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x00)
196#define TODC_TYPE_DS1501_CNTL_B (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0f)
197#define TODC_TYPE_DS1501_CNTL_A (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0f)
198#define TODC_TYPE_DS1501_WATCHDOG (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
199#define TODC_TYPE_DS1501_INTERRUPTS (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
200#define TODC_TYPE_DS1501_ALARM_DATE (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0b)
201#define TODC_TYPE_DS1501_ALARM_HOUR (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0a)
202#define TODC_TYPE_DS1501_ALARM_MINUTES (TODC_TYPE_DS1501_NVRAM_SIZE + 0x09)
203#define TODC_TYPE_DS1501_ALARM_SECONDS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x08)
204#define TODC_TYPE_DS1501_CENTURY (TODC_TYPE_DS1501_NVRAM_SIZE + 0x07)
205#define TODC_TYPE_DS1501_FLAGS (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
206#define TODC_TYPE_DS1501_NVRAM_ADDR_REG 0x10
207#define TODC_TYPE_DS1501_NVRAM_DATA_REG 0x13
208
209#define TODC_TYPE_DS1553_NVRAM_SIZE 0x1ff0
210#define TODC_TYPE_DS1553_SW_FLAGS 0
211#define TODC_TYPE_DS1553_YEAR 0x1fff
212#define TODC_TYPE_DS1553_MONTH 0x1ffe
213#define TODC_TYPE_DS1553_DOM 0x1ffd /* Day of Month */
214#define TODC_TYPE_DS1553_DOW 0x1ffc /* Day of Week */
215#define TODC_TYPE_DS1553_HOURS 0x1ffb
216#define TODC_TYPE_DS1553_MINUTES 0x1ffa
217#define TODC_TYPE_DS1553_SECONDS 0x1ff9
218#define TODC_TYPE_DS1553_CNTL_B 0x1ff9
219#define TODC_TYPE_DS1553_CNTL_A 0x1ff8 /* control_a R/W regs */
220#define TODC_TYPE_DS1553_WATCHDOG 0x1ff7
221#define TODC_TYPE_DS1553_INTERRUPTS 0x1ff6
222#define TODC_TYPE_DS1553_ALARM_DATE 0x1ff5
223#define TODC_TYPE_DS1553_ALARM_HOUR 0x1ff4
224#define TODC_TYPE_DS1553_ALARM_MINUTES 0x1ff3
225#define TODC_TYPE_DS1553_ALARM_SECONDS 0x1ff2
226#define TODC_TYPE_DS1553_CENTURY 0x1ff8
227#define TODC_TYPE_DS1553_FLAGS 0x1ff0
228#define TODC_TYPE_DS1553_NVRAM_ADDR_REG 0
229#define TODC_TYPE_DS1553_NVRAM_DATA_REG 0
230
231#define TODC_TYPE_DS1557_NVRAM_SIZE 0x7fff0
232#define TODC_TYPE_DS1557_SW_FLAGS 0
233#define TODC_TYPE_DS1557_YEAR 0x7ffff
234#define TODC_TYPE_DS1557_MONTH 0x7fffe
235#define TODC_TYPE_DS1557_DOM 0x7fffd /* Day of Month */
236#define TODC_TYPE_DS1557_DOW 0x7fffc /* Day of Week */
237#define TODC_TYPE_DS1557_HOURS 0x7fffb
238#define TODC_TYPE_DS1557_MINUTES 0x7fffa
239#define TODC_TYPE_DS1557_SECONDS 0x7fff9
240#define TODC_TYPE_DS1557_CNTL_B 0x7fff9
241#define TODC_TYPE_DS1557_CNTL_A 0x7fff8 /* control_a R/W regs */
242#define TODC_TYPE_DS1557_WATCHDOG 0x7fff7
243#define TODC_TYPE_DS1557_INTERRUPTS 0x7fff6
244#define TODC_TYPE_DS1557_ALARM_DATE 0x7fff5
245#define TODC_TYPE_DS1557_ALARM_HOUR 0x7fff4
246#define TODC_TYPE_DS1557_ALARM_MINUTES 0x7fff3
247#define TODC_TYPE_DS1557_ALARM_SECONDS 0x7fff2
248#define TODC_TYPE_DS1557_CENTURY 0x7fff8
249#define TODC_TYPE_DS1557_FLAGS 0x7fff0
250#define TODC_TYPE_DS1557_NVRAM_ADDR_REG 0
251#define TODC_TYPE_DS1557_NVRAM_DATA_REG 0
252
253#define TODC_TYPE_DS1643_NVRAM_SIZE 0x1ff8
254#define TODC_TYPE_DS1643_SW_FLAGS 0
255#define TODC_TYPE_DS1643_YEAR 0x1fff
256#define TODC_TYPE_DS1643_MONTH 0x1ffe
257#define TODC_TYPE_DS1643_DOM 0x1ffd /* Day of Month */
258#define TODC_TYPE_DS1643_DOW 0x1ffc /* Day of Week */
259#define TODC_TYPE_DS1643_HOURS 0x1ffb
260#define TODC_TYPE_DS1643_MINUTES 0x1ffa
261#define TODC_TYPE_DS1643_SECONDS 0x1ff9
262#define TODC_TYPE_DS1643_CNTL_B 0x1ff9
263#define TODC_TYPE_DS1643_CNTL_A 0x1ff8 /* control_a R/W regs */
264#define TODC_TYPE_DS1643_WATCHDOG 0x1fff
265#define TODC_TYPE_DS1643_INTERRUPTS 0x1fff
266#define TODC_TYPE_DS1643_ALARM_DATE 0x1fff
267#define TODC_TYPE_DS1643_ALARM_HOUR 0x1fff
268#define TODC_TYPE_DS1643_ALARM_MINUTES 0x1fff
269#define TODC_TYPE_DS1643_ALARM_SECONDS 0x1fff
270#define TODC_TYPE_DS1643_CENTURY 0x1ff8
271#define TODC_TYPE_DS1643_FLAGS 0x1fff
272#define TODC_TYPE_DS1643_NVRAM_ADDR_REG 0
273#define TODC_TYPE_DS1643_NVRAM_DATA_REG 0
274
275#define TODC_TYPE_DS1693_NVRAM_SIZE 0 /* Not handled yet */
276#define TODC_TYPE_DS1693_SW_FLAGS 0
277#define TODC_TYPE_DS1693_YEAR 0x09
278#define TODC_TYPE_DS1693_MONTH 0x08
279#define TODC_TYPE_DS1693_DOM 0x07 /* Day of Month */
280#define TODC_TYPE_DS1693_DOW 0x06 /* Day of Week */
281#define TODC_TYPE_DS1693_HOURS 0x04
282#define TODC_TYPE_DS1693_MINUTES 0x02
283#define TODC_TYPE_DS1693_SECONDS 0x00
284#define TODC_TYPE_DS1693_CNTL_B 0x0b
285#define TODC_TYPE_DS1693_CNTL_A 0x0a
286#define TODC_TYPE_DS1693_WATCHDOG 0xff
287#define TODC_TYPE_DS1693_INTERRUPTS 0xff
288#define TODC_TYPE_DS1693_ALARM_DATE 0x49
289#define TODC_TYPE_DS1693_ALARM_HOUR 0x05
290#define TODC_TYPE_DS1693_ALARM_MINUTES 0x03
291#define TODC_TYPE_DS1693_ALARM_SECONDS 0x01
292#define TODC_TYPE_DS1693_CENTURY 0x48
293#define TODC_TYPE_DS1693_FLAGS 0xff
294#define TODC_TYPE_DS1693_NVRAM_ADDR_REG 0
295#define TODC_TYPE_DS1693_NVRAM_DATA_REG 0
296
297#define TODC_TYPE_DS1743_NVRAM_SIZE 0x1ff8
298#define TODC_TYPE_DS1743_SW_FLAGS 0
299#define TODC_TYPE_DS1743_YEAR 0x1fff
300#define TODC_TYPE_DS1743_MONTH 0x1ffe
301#define TODC_TYPE_DS1743_DOM 0x1ffd /* Day of Month */
302#define TODC_TYPE_DS1743_DOW 0x1ffc /* Day of Week */
303#define TODC_TYPE_DS1743_HOURS 0x1ffb
304#define TODC_TYPE_DS1743_MINUTES 0x1ffa
305#define TODC_TYPE_DS1743_SECONDS 0x1ff9
306#define TODC_TYPE_DS1743_CNTL_B 0x1ff9
307#define TODC_TYPE_DS1743_CNTL_A 0x1ff8 /* control_a R/W regs */
308#define TODC_TYPE_DS1743_WATCHDOG 0x1fff
309#define TODC_TYPE_DS1743_INTERRUPTS 0x1fff
310#define TODC_TYPE_DS1743_ALARM_DATE 0x1fff
311#define TODC_TYPE_DS1743_ALARM_HOUR 0x1fff
312#define TODC_TYPE_DS1743_ALARM_MINUTES 0x1fff
313#define TODC_TYPE_DS1743_ALARM_SECONDS 0x1fff
314#define TODC_TYPE_DS1743_CENTURY 0x1ff8
315#define TODC_TYPE_DS1743_FLAGS 0x1fff
316#define TODC_TYPE_DS1743_NVRAM_ADDR_REG 0
317#define TODC_TYPE_DS1743_NVRAM_DATA_REG 0
318
319#define TODC_TYPE_DS1746_NVRAM_SIZE 0x1fff8
320#define TODC_TYPE_DS1746_SW_FLAGS 0
321#define TODC_TYPE_DS1746_YEAR 0x1ffff
322#define TODC_TYPE_DS1746_MONTH 0x1fffe
323#define TODC_TYPE_DS1746_DOM 0x1fffd /* Day of Month */
324#define TODC_TYPE_DS1746_DOW 0x1fffc /* Day of Week */
325#define TODC_TYPE_DS1746_HOURS 0x1fffb
326#define TODC_TYPE_DS1746_MINUTES 0x1fffa
327#define TODC_TYPE_DS1746_SECONDS 0x1fff9
328#define TODC_TYPE_DS1746_CNTL_B 0x1fff9
329#define TODC_TYPE_DS1746_CNTL_A 0x1fff8 /* control_a R/W regs */
330#define TODC_TYPE_DS1746_WATCHDOG 0x00000
331#define TODC_TYPE_DS1746_INTERRUPTS 0x00000
332#define TODC_TYPE_DS1746_ALARM_DATE 0x00000
333#define TODC_TYPE_DS1746_ALARM_HOUR 0x00000
334#define TODC_TYPE_DS1746_ALARM_MINUTES 0x00000
335#define TODC_TYPE_DS1746_ALARM_SECONDS 0x00000
336#define TODC_TYPE_DS1746_CENTURY 0x00000
337#define TODC_TYPE_DS1746_FLAGS 0x00000
338#define TODC_TYPE_DS1746_NVRAM_ADDR_REG 0
339#define TODC_TYPE_DS1746_NVRAM_DATA_REG 0
340
341#define TODC_TYPE_DS1747_NVRAM_SIZE 0x7fff8
342#define TODC_TYPE_DS1747_SW_FLAGS 0
343#define TODC_TYPE_DS1747_YEAR 0x7ffff
344#define TODC_TYPE_DS1747_MONTH 0x7fffe
345#define TODC_TYPE_DS1747_DOM 0x7fffd /* Day of Month */
346#define TODC_TYPE_DS1747_DOW 0x7fffc /* Day of Week */
347#define TODC_TYPE_DS1747_HOURS 0x7fffb
348#define TODC_TYPE_DS1747_MINUTES 0x7fffa
349#define TODC_TYPE_DS1747_SECONDS 0x7fff9
350#define TODC_TYPE_DS1747_CNTL_B 0x7fff9
351#define TODC_TYPE_DS1747_CNTL_A 0x7fff8 /* control_a R/W regs */
352#define TODC_TYPE_DS1747_WATCHDOG 0x00000
353#define TODC_TYPE_DS1747_INTERRUPTS 0x00000
354#define TODC_TYPE_DS1747_ALARM_DATE 0x00000
355#define TODC_TYPE_DS1747_ALARM_HOUR 0x00000
356#define TODC_TYPE_DS1747_ALARM_MINUTES 0x00000
357#define TODC_TYPE_DS1747_ALARM_SECONDS 0x00000
358#define TODC_TYPE_DS1747_CENTURY 0x00000
359#define TODC_TYPE_DS1747_FLAGS 0x00000
360#define TODC_TYPE_DS1747_NVRAM_ADDR_REG 0
361#define TODC_TYPE_DS1747_NVRAM_DATA_REG 0
362
363#define TODC_TYPE_DS17285_NVRAM_SIZE (0x1000-0x80) /* 4Kx8 NVRAM (minus RTC regs) */
364#define TODC_TYPE_DS17285_SW_FLAGS TODC_FLAG_2_LEVEL_NVRAM
365#define TODC_TYPE_DS17285_SECONDS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x00)
366#define TODC_TYPE_DS17285_ALARM_SECONDS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x01)
367#define TODC_TYPE_DS17285_MINUTES (TODC_TYPE_DS17285_NVRAM_SIZE + 0x02)
368#define TODC_TYPE_DS17285_ALARM_MINUTES (TODC_TYPE_DS17285_NVRAM_SIZE + 0x03)
369#define TODC_TYPE_DS17285_HOURS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x04)
370#define TODC_TYPE_DS17285_ALARM_HOUR (TODC_TYPE_DS17285_NVRAM_SIZE + 0x05)
371#define TODC_TYPE_DS17285_DOW (TODC_TYPE_DS17285_NVRAM_SIZE + 0x06)
372#define TODC_TYPE_DS17285_DOM (TODC_TYPE_DS17285_NVRAM_SIZE + 0x07)
373#define TODC_TYPE_DS17285_MONTH (TODC_TYPE_DS17285_NVRAM_SIZE + 0x08)
374#define TODC_TYPE_DS17285_YEAR (TODC_TYPE_DS17285_NVRAM_SIZE + 0x09)
375#define TODC_TYPE_DS17285_CNTL_A (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0A)
376#define TODC_TYPE_DS17285_CNTL_B (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0B)
377#define TODC_TYPE_DS17285_CNTL_C (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0C)
378#define TODC_TYPE_DS17285_CNTL_D (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0D)
379#define TODC_TYPE_DS17285_WATCHDOG 0
380#define TODC_TYPE_DS17285_INTERRUPTS 0
381#define TODC_TYPE_DS17285_ALARM_DATE 0
382#define TODC_TYPE_DS17285_CENTURY 0
383#define TODC_TYPE_DS17285_FLAGS 0
384#define TODC_TYPE_DS17285_NVRAM_ADDR_REG 0x50
385#define TODC_TYPE_DS17285_NVRAM_DATA_REG 0x53
386
387#define TODC_TYPE_MC146818_NVRAM_SIZE 0 /* XXXX */
388#define TODC_TYPE_MC146818_SW_FLAGS 0
389#define TODC_TYPE_MC146818_YEAR 0x09
390#define TODC_TYPE_MC146818_MONTH 0x08
391#define TODC_TYPE_MC146818_DOM 0x07 /* Day of Month */
392#define TODC_TYPE_MC146818_DOW 0x06 /* Day of Week */
393#define TODC_TYPE_MC146818_HOURS 0x04
394#define TODC_TYPE_MC146818_MINUTES 0x02
395#define TODC_TYPE_MC146818_SECONDS 0x00
396#define TODC_TYPE_MC146818_CNTL_B 0x0a
397#define TODC_TYPE_MC146818_CNTL_A 0x0b /* control_a R/W regs */
398#define TODC_TYPE_MC146818_WATCHDOG 0
399#define TODC_TYPE_MC146818_INTERRUPTS 0x0c
400#define TODC_TYPE_MC146818_ALARM_DATE 0xff
401#define TODC_TYPE_MC146818_ALARM_HOUR 0x05
402#define TODC_TYPE_MC146818_ALARM_MINUTES 0x03
403#define TODC_TYPE_MC146818_ALARM_SECONDS 0x01
404#define TODC_TYPE_MC146818_CENTURY 0xff
405#define TODC_TYPE_MC146818_FLAGS 0xff
406#define TODC_TYPE_MC146818_NVRAM_ADDR_REG 0
407#define TODC_TYPE_MC146818_NVRAM_DATA_REG 0
408
409#define TODC_TYPE_PC97307_NVRAM_SIZE 0 /* No NVRAM? */
410#define TODC_TYPE_PC97307_SW_FLAGS 0
411#define TODC_TYPE_PC97307_YEAR 0x09
412#define TODC_TYPE_PC97307_MONTH 0x08
413#define TODC_TYPE_PC97307_DOM 0x07 /* Day of Month */
414#define TODC_TYPE_PC97307_DOW 0x06 /* Day of Week */
415#define TODC_TYPE_PC97307_HOURS 0x04
416#define TODC_TYPE_PC97307_MINUTES 0x02
417#define TODC_TYPE_PC97307_SECONDS 0x00
418#define TODC_TYPE_PC97307_CNTL_B 0x0a
419#define TODC_TYPE_PC97307_CNTL_A 0x0b /* control_a R/W regs */
420#define TODC_TYPE_PC97307_WATCHDOG 0x0c
421#define TODC_TYPE_PC97307_INTERRUPTS 0x0d
422#define TODC_TYPE_PC97307_ALARM_DATE 0xff
423#define TODC_TYPE_PC97307_ALARM_HOUR 0x05
424#define TODC_TYPE_PC97307_ALARM_MINUTES 0x03
425#define TODC_TYPE_PC97307_ALARM_SECONDS 0x01
426#define TODC_TYPE_PC97307_CENTURY 0xff
427#define TODC_TYPE_PC97307_FLAGS 0xff
428#define TODC_TYPE_PC97307_NVRAM_ADDR_REG 0
429#define TODC_TYPE_PC97307_NVRAM_DATA_REG 0
430
431/*
432 * Define macros to allocate and init the todc_info_t table that will
433 * be used by the todc_time.c routines.
434 */
435#define TODC_ALLOC() \
436 static todc_info_t todc_info_alloc; \
437 todc_info_t *todc_info = &todc_info_alloc;
438
439#define TODC_INIT(clock_type, as0, as1, data, bits) { \
440 todc_info->rtc_type = clock_type; \
441 \
442 todc_info->nvram_as0 = (unsigned int)(as0); \
443 todc_info->nvram_as1 = (unsigned int)(as1); \
444 todc_info->nvram_data = (unsigned int)(data); \
445 \
446 todc_info->as0_bits = (bits); \
447 \
448 todc_info->nvram_size = clock_type ##_NVRAM_SIZE; \
449 todc_info->sw_flags = clock_type ##_SW_FLAGS; \
450 \
451 todc_info->year = clock_type ##_YEAR; \
452 todc_info->month = clock_type ##_MONTH; \
453 todc_info->day_of_month = clock_type ##_DOM; \
454 todc_info->day_of_week = clock_type ##_DOW; \
455 todc_info->hours = clock_type ##_HOURS; \
456 todc_info->minutes = clock_type ##_MINUTES; \
457 todc_info->seconds = clock_type ##_SECONDS; \
458 todc_info->control_b = clock_type ##_CNTL_B; \
459 todc_info->control_a = clock_type ##_CNTL_A; \
460 todc_info->watchdog = clock_type ##_WATCHDOG; \
461 todc_info->interrupts = clock_type ##_INTERRUPTS; \
462 todc_info->alarm_date = clock_type ##_ALARM_DATE; \
463 todc_info->alarm_hour = clock_type ##_ALARM_HOUR; \
464 todc_info->alarm_minutes = clock_type ##_ALARM_MINUTES; \
465 todc_info->alarm_seconds = clock_type ##_ALARM_SECONDS; \
466 todc_info->century = clock_type ##_CENTURY; \
467 todc_info->flags = clock_type ##_FLAGS; \
468 \
469 todc_info->nvram_addr_reg = clock_type ##_NVRAM_ADDR_REG; \
470 todc_info->nvram_data_reg = clock_type ##_NVRAM_DATA_REG; \
471}
472
473extern todc_info_t *todc_info;
474
475unsigned char todc_direct_read_val(int addr);
476void todc_direct_write_val(int addr, unsigned char val);
477unsigned char todc_m48txx_read_val(int addr);
478void todc_m48txx_write_val(int addr, unsigned char val);
479unsigned char todc_mc146818_read_val(int addr);
480void todc_mc146818_write_val(int addr, unsigned char val);
481
482long todc_time_init(void);
483void todc_get_rtc_time(struct rtc_time *);
484int todc_set_rtc_time(struct rtc_time *);
485void todc_calibrate_decr(void);
486
487#endif /* __PPC_KERNEL_TODC_H */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 92f3e5507d..bbc3844b08 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -93,5 +93,10 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
93 93
94#endif /* CONFIG_NUMA */ 94#endif /* CONFIG_NUMA */
95 95
96#ifdef CONFIG_SMP
97#include <asm/cputable.h>
98#define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
99#endif
100
96#endif /* __KERNEL__ */ 101#endif /* __KERNEL__ */
97#endif /* _ASM_POWERPC_TOPOLOGY_H */ 102#endif /* _ASM_POWERPC_TOPOLOGY_H */
diff --git a/include/asm-powerpc/tsi108.h b/include/asm-powerpc/tsi108.h
new file mode 100644
index 0000000000..2c702d35a7
--- /dev/null
+++ b/include/asm-powerpc/tsi108.h
@@ -0,0 +1,111 @@
1/*
2 * common routine and memory layout for Tundra TSI108(Grendel) host bridge
3 * memory controller.
4 *
5 * Author: Jacob Pan (jacob.pan@freescale.com)
6 * Alex Bounine (alexandreb@tundra.com)
7 *
8 * Copyright 2004-2006 Freescale Semiconductor, Inc.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#ifndef __PPC_KERNEL_TSI108_H
17#define __PPC_KERNEL_TSI108_H
18
19#include <asm/pci-bridge.h>
20
21/* Size of entire register space */
22#define TSI108_REG_SIZE (0x10000)
23
24/* Sizes of register spaces for individual blocks */
25#define TSI108_HLP_SIZE 0x1000
26#define TSI108_PCI_SIZE 0x1000
27#define TSI108_CLK_SIZE 0x1000
28#define TSI108_PB_SIZE 0x1000
29#define TSI108_SD_SIZE 0x1000
30#define TSI108_DMA_SIZE 0x1000
31#define TSI108_ETH_SIZE 0x1000
32#define TSI108_I2C_SIZE 0x400
33#define TSI108_MPIC_SIZE 0x400
34#define TSI108_UART0_SIZE 0x200
35#define TSI108_GPIO_SIZE 0x200
36#define TSI108_UART1_SIZE 0x200
37
38/* Offsets within Tsi108(A) CSR space for individual blocks */
39#define TSI108_HLP_OFFSET 0x0000
40#define TSI108_PCI_OFFSET 0x1000
41#define TSI108_CLK_OFFSET 0x2000
42#define TSI108_PB_OFFSET 0x3000
43#define TSI108_SD_OFFSET 0x4000
44#define TSI108_DMA_OFFSET 0x5000
45#define TSI108_ETH_OFFSET 0x6000
46#define TSI108_I2C_OFFSET 0x7000
47#define TSI108_MPIC_OFFSET 0x7400
48#define TSI108_UART0_OFFSET 0x7800
49#define TSI108_GPIO_OFFSET 0x7A00
50#define TSI108_UART1_OFFSET 0x7C00
51
52/* Tsi108 registers used by common code components */
53#define TSI108_PCI_CSR (0x004)
54#define TSI108_PCI_IRP_CFG_CTL (0x180)
55#define TSI108_PCI_IRP_STAT (0x184)
56#define TSI108_PCI_IRP_ENABLE (0x188)
57#define TSI108_PCI_IRP_INTAD (0x18C)
58
59#define TSI108_PCI_IRP_STAT_P_INT (0x00400000)
60#define TSI108_PCI_IRP_ENABLE_P_INT (0x00400000)
61
62#define TSI108_CG_PWRUP_STATUS (0x234)
63
64#define TSI108_PB_ISR (0x00C)
65#define TSI108_PB_ERRCS (0x404)
66#define TSI108_PB_AERR (0x408)
67
68#define TSI108_PB_ERRCS_ES (1 << 1)
69#define TSI108_PB_ISR_PBS_RD_ERR (1 << 8)
70
71#define TSI108_PCI_CFG_BASE_PHYS (0xfb000000)
72#define TSI108_PCI_CFG_SIZE (0x01000000)
73/* Global variables */
74
75extern u32 tsi108_pci_cfg_base;
76/* Exported functions */
77
78extern int tsi108_bridge_init(struct pci_controller *hose, uint phys_csr_base);
79extern unsigned long tsi108_get_mem_size(void);
80extern unsigned long tsi108_get_cpu_clk(void);
81extern unsigned long tsi108_get_sdc_clk(void);
82extern int tsi108_direct_write_config(struct pci_bus *bus, unsigned int devfn,
83 int offset, int len, u32 val);
84extern int tsi108_direct_read_config(struct pci_bus *bus, unsigned int devfn,
85 int offset, int len, u32 * val);
86extern void tsi108_clear_pci_error(u32 pci_cfg_base);
87
88extern phys_addr_t get_csrbase(void);
89
90typedef struct {
91 u32 regs; /* hw registers base address */
92 u32 phyregs; /* phy registers base address */
93 u16 phy; /* phy address */
94 u16 irq_num; /* irq number */
95 u8 mac_addr[6]; /* phy mac address */
96} hw_info;
97
98extern u32 get_vir_csrbase(void);
99extern u32 tsi108_csr_vir_base;
100
101extern inline u32 tsi108_read_reg(u32 reg_offset)
102{
103 return in_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset));
104}
105
106extern inline void tsi108_write_reg(u32 reg_offset, u32 val)
107{
108 out_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset), val);
109}
110
111#endif /* __PPC_KERNEL_TSI108_H */
diff --git a/include/asm-powerpc/tsi108_irq.h b/include/asm-powerpc/tsi108_irq.h
new file mode 100644
index 0000000000..3e4d04effa
--- /dev/null
+++ b/include/asm-powerpc/tsi108_irq.h
@@ -0,0 +1,124 @@
1/*
2 * (C) Copyright 2005 Tundra Semiconductor Corp.
3 * Alex Bounine, <alexandreb at tundra.com).
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * definitions for interrupt controller initialization and external interrupt
26 * demultiplexing on TSI108EMU/SVB boards.
27 */
28
29#ifndef _ASM_PPC_TSI108_IRQ_H
30#define _ASM_PPC_TSI108_IRQ_H
31
32/*
33 * Tsi108 interrupts
34 */
35#ifndef TSI108_IRQ_REG_BASE
36#define TSI108_IRQ_REG_BASE 0
37#endif
38
39#define TSI108_IRQ(x) (TSI108_IRQ_REG_BASE + (x))
40
41#define TSI108_MAX_VECTORS (36 + 4) /* 36 sources + PCI INT demux */
42#define MAX_TASK_PRIO 0xF
43
44#define TSI108_IRQ_SPURIOUS (TSI108_MAX_VECTORS)
45
46#define DEFAULT_PRIO_LVL 10 /* initial priority level */
47
48/* Interrupt vectors assignment to external and internal
49 * sources of requests. */
50
51/* EXTERNAL INTERRUPT SOURCES */
52
53#define IRQ_TSI108_EXT_INT0 TSI108_IRQ(0) /* External Source at INT[0] */
54#define IRQ_TSI108_EXT_INT1 TSI108_IRQ(1) /* External Source at INT[1] */
55#define IRQ_TSI108_EXT_INT2 TSI108_IRQ(2) /* External Source at INT[2] */
56#define IRQ_TSI108_EXT_INT3 TSI108_IRQ(3) /* External Source at INT[3] */
57
58/* INTERNAL INTERRUPT SOURCES */
59
60#define IRQ_TSI108_RESERVED0 TSI108_IRQ(4) /* Reserved IRQ */
61#define IRQ_TSI108_RESERVED1 TSI108_IRQ(5) /* Reserved IRQ */
62#define IRQ_TSI108_RESERVED2 TSI108_IRQ(6) /* Reserved IRQ */
63#define IRQ_TSI108_RESERVED3 TSI108_IRQ(7) /* Reserved IRQ */
64#define IRQ_TSI108_DMA0 TSI108_IRQ(8) /* DMA0 */
65#define IRQ_TSI108_DMA1 TSI108_IRQ(9) /* DMA1 */
66#define IRQ_TSI108_DMA2 TSI108_IRQ(10) /* DMA2 */
67#define IRQ_TSI108_DMA3 TSI108_IRQ(11) /* DMA3 */
68#define IRQ_TSI108_UART0 TSI108_IRQ(12) /* UART0 */
69#define IRQ_TSI108_UART1 TSI108_IRQ(13) /* UART1 */
70#define IRQ_TSI108_I2C TSI108_IRQ(14) /* I2C */
71#define IRQ_TSI108_GPIO TSI108_IRQ(15) /* GPIO */
72#define IRQ_TSI108_GIGE0 TSI108_IRQ(16) /* GIGE0 */
73#define IRQ_TSI108_GIGE1 TSI108_IRQ(17) /* GIGE1 */
74#define IRQ_TSI108_RESERVED4 TSI108_IRQ(18) /* Reserved IRQ */
75#define IRQ_TSI108_HLP TSI108_IRQ(19) /* HLP */
76#define IRQ_TSI108_SDRAM TSI108_IRQ(20) /* SDC */
77#define IRQ_TSI108_PROC_IF TSI108_IRQ(21) /* Processor IF */
78#define IRQ_TSI108_RESERVED5 TSI108_IRQ(22) /* Reserved IRQ */
79#define IRQ_TSI108_PCI TSI108_IRQ(23) /* PCI/X block */
80
81#define IRQ_TSI108_MBOX0 TSI108_IRQ(24) /* Mailbox 0 register */
82#define IRQ_TSI108_MBOX1 TSI108_IRQ(25) /* Mailbox 1 register */
83#define IRQ_TSI108_MBOX2 TSI108_IRQ(26) /* Mailbox 2 register */
84#define IRQ_TSI108_MBOX3 TSI108_IRQ(27) /* Mailbox 3 register */
85
86#define IRQ_TSI108_DBELL0 TSI108_IRQ(28) /* Doorbell 0 */
87#define IRQ_TSI108_DBELL1 TSI108_IRQ(29) /* Doorbell 1 */
88#define IRQ_TSI108_DBELL2 TSI108_IRQ(30) /* Doorbell 2 */
89#define IRQ_TSI108_DBELL3 TSI108_IRQ(31) /* Doorbell 3 */
90
91#define IRQ_TSI108_TIMER0 TSI108_IRQ(32) /* Global Timer 0 */
92#define IRQ_TSI108_TIMER1 TSI108_IRQ(33) /* Global Timer 1 */
93#define IRQ_TSI108_TIMER2 TSI108_IRQ(34) /* Global Timer 2 */
94#define IRQ_TSI108_TIMER3 TSI108_IRQ(35) /* Global Timer 3 */
95
96/*
97 * PCI bus INTA# - INTD# lines demultiplexor
98 */
99#define IRQ_PCI_INTAD_BASE TSI108_IRQ(36)
100#define IRQ_PCI_INTA (IRQ_PCI_INTAD_BASE + 0)
101#define IRQ_PCI_INTB (IRQ_PCI_INTAD_BASE + 1)
102#define IRQ_PCI_INTC (IRQ_PCI_INTAD_BASE + 2)
103#define IRQ_PCI_INTD (IRQ_PCI_INTAD_BASE + 3)
104#define NUM_PCI_IRQS (4)
105
106/* number of entries in vector dispatch table */
107#define IRQ_TSI108_TAB_SIZE (TSI108_MAX_VECTORS + 1)
108
109/* Mapping of MPIC outputs to processors' interrupt pins */
110
111#define IDIR_INT_OUT0 0x1
112#define IDIR_INT_OUT1 0x2
113#define IDIR_INT_OUT2 0x4
114#define IDIR_INT_OUT3 0x8
115
116/*---------------------------------------------------------------
117 * IRQ line configuration parameters */
118
119/* Interrupt delivery modes */
120typedef enum {
121 TSI108_IRQ_DIRECTED,
122 TSI108_IRQ_DISTRIBUTED,
123} TSI108_IRQ_MODE;
124#endif /* _ASM_PPC_TSI108_IRQ_H */
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index 19a1517ac4..55e57844fa 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -42,7 +42,8 @@ extern void __init udbg_init_debug_lpar(void);
42extern void __init udbg_init_pmac_realmode(void); 42extern void __init udbg_init_pmac_realmode(void);
43extern void __init udbg_init_maple_realmode(void); 43extern void __init udbg_init_maple_realmode(void);
44extern void __init udbg_init_iseries(void); 44extern void __init udbg_init_iseries(void);
45extern void __init udbg_init_rtas(void); 45extern void __init udbg_init_rtas_panel(void);
46extern void __init udbg_init_rtas_console(void);
46 47
47#endif /* __KERNEL__ */ 48#endif /* __KERNEL__ */
48#endif /* _ASM_POWERPC_UDBG_H */ 49#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index dc9bd101ca..4b51d42e14 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -46,8 +46,8 @@ struct iommu_table;
46 */ 46 */
47struct vio_dev { 47struct vio_dev {
48 struct iommu_table *iommu_table; /* vio_map_* uses this */ 48 struct iommu_table *iommu_table; /* vio_map_* uses this */
49 char *name; 49 const char *name;
50 char *type; 50 const char *type;
51 uint32_t unit_address; 51 uint32_t unit_address;
52 unsigned int irq; 52 unsigned int irq;
53 struct device dev; 53 struct device dev;
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
index c70344b910..f6a7ff04ff 100644
--- a/include/asm-ppc/cpm2.h
+++ b/include/asm-ppc/cpm2.h
@@ -1093,5 +1093,100 @@ typedef struct im_idma {
1093 1093
1094#define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */ 1094#define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */
1095 1095
1096/* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK
1097 * in order to use clock-computing stuff below for the FCC x
1098 */
1099
1100/* Automatically generates register configurations */
1101#define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */
1102
1103#define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */
1104#define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */
1105#define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */
1106#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */
1107#define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */
1108#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */
1109
1110#define PC_F1RXCLK PC_CLK(F1_RXCLK)
1111#define PC_F1TXCLK PC_CLK(F1_TXCLK)
1112#define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
1113#define CMX1_CLK_MASK ((uint)0xff000000)
1114
1115#define PC_F2RXCLK PC_CLK(F2_RXCLK)
1116#define PC_F2TXCLK PC_CLK(F2_TXCLK)
1117#define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
1118#define CMX2_CLK_MASK ((uint)0x00ff0000)
1119
1120#define PC_F3RXCLK PC_CLK(F3_RXCLK)
1121#define PC_F3TXCLK PC_CLK(F3_TXCLK)
1122#define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
1123#define CMX3_CLK_MASK ((uint)0x0000ff00)
1124
1125#define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
1126#define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
1127
1128#define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
1129
1130/* I/O Pin assignment for FCC1. I don't yet know the best way to do this,
1131 * but there is little variation among the choices.
1132 */
1133#define PA1_COL 0x00000001U
1134#define PA1_CRS 0x00000002U
1135#define PA1_TXER 0x00000004U
1136#define PA1_TXEN 0x00000008U
1137#define PA1_RXDV 0x00000010U
1138#define PA1_RXER 0x00000020U
1139#define PA1_TXDAT 0x00003c00U
1140#define PA1_RXDAT 0x0003c000U
1141#define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT)
1142#define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
1143 PA1_RXDV | PA1_RXER)
1144#define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
1145#define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER)
1146
1147
1148/* I/O Pin assignment for FCC2. I don't yet know the best way to do this,
1149 * but there is little variation among the choices.
1150 */
1151#define PB2_TXER 0x00000001U
1152#define PB2_RXDV 0x00000002U
1153#define PB2_TXEN 0x00000004U
1154#define PB2_RXER 0x00000008U
1155#define PB2_COL 0x00000010U
1156#define PB2_CRS 0x00000020U
1157#define PB2_TXDAT 0x000003c0U
1158#define PB2_RXDAT 0x00003c00U
1159#define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
1160 PB2_RXER | PB2_RXDV | PB2_TXER)
1161#define PB2_PSORB1 (PB2_TXEN)
1162#define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
1163#define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER)
1164
1165
1166/* I/O Pin assignment for FCC3. I don't yet know the best way to do this,
1167 * but there is little variation among the choices.
1168 */
1169#define PB3_RXDV 0x00004000U
1170#define PB3_RXER 0x00008000U
1171#define PB3_TXER 0x00010000U
1172#define PB3_TXEN 0x00020000U
1173#define PB3_COL 0x00040000U
1174#define PB3_CRS 0x00080000U
1175#define PB3_TXDAT 0x0f000000U
1176#define PC3_TXDAT 0x00000010U
1177#define PB3_RXDAT 0x00f00000U
1178#define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
1179 PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
1180#define PB3_PSORB1 0
1181#define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
1182#define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER)
1183#define PC3_DIRC1 (PC3_TXDAT)
1184
1185/* Handy macro to specify mem for FCCs*/
1186#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
1187#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
1188#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
1189#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(2)
1190
1096#endif /* __CPM2__ */ 1191#endif /* __CPM2__ */
1097#endif /* __KERNEL__ */ 1192#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/floppy.h b/include/asm-ppc/floppy.h
index 8ccd4a276f..d3963ca79a 100644
--- a/include/asm-ppc/floppy.h
+++ b/include/asm-ppc/floppy.h
@@ -96,13 +96,11 @@ static int vdma_get_dma_residue(unsigned int dummy)
96static int fd_request_irq(void) 96static int fd_request_irq(void)
97{ 97{
98 if (can_use_virtual_dma) 98 if (can_use_virtual_dma)
99 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 99 return request_irq(FLOPPY_IRQ, floppy_hardint,
100 "floppy", NULL); 100 IRQF_DISABLED, "floppy", NULL);
101 else 101 else
102 return request_irq(FLOPPY_IRQ, floppy_interrupt, 102 return request_irq(FLOPPY_IRQ, floppy_interrupt,
103 SA_INTERRUPT|SA_SAMPLE_RANDOM, 103 IRQF_DISABLED, "floppy", NULL);
104 "floppy", NULL);
105
106} 104}
107 105
108static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) 106static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index cf62b69cb6..499c14691c 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -86,7 +86,7 @@ void ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
86#define PCI_DRAM_OFFSET 0 86#define PCI_DRAM_OFFSET 0
87#endif 87#endif
88 88
89#elif CONFIG_44x 89#elif defined(CONFIG_44x)
90 90
91#if defined(CONFIG_BAMBOO) 91#if defined(CONFIG_BAMBOO)
92#include <platforms/4xx/bamboo.h> 92#include <platforms/4xx/bamboo.h>
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 89c6f1bc3a..3d9a9e6f33 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -63,7 +63,7 @@ extern inline int in_8(const volatile unsigned char __iomem *addr)
63 int ret; 63 int ret;
64 64
65 __asm__ __volatile__( 65 __asm__ __volatile__(
66 "lbz%U1%X1 %0,%1;\n" 66 "sync; lbz%U1%X1 %0,%1;\n"
67 "twi 0,%0,0;\n" 67 "twi 0,%0,0;\n"
68 "isync" : "=r" (ret) : "m" (*addr)); 68 "isync" : "=r" (ret) : "m" (*addr));
69 return ret; 69 return ret;
@@ -78,7 +78,7 @@ extern inline int in_le16(const volatile unsigned short __iomem *addr)
78{ 78{
79 int ret; 79 int ret;
80 80
81 __asm__ __volatile__("lhbrx %0,0,%1;\n" 81 __asm__ __volatile__("sync; lhbrx %0,0,%1;\n"
82 "twi 0,%0,0;\n" 82 "twi 0,%0,0;\n"
83 "isync" : "=r" (ret) : 83 "isync" : "=r" (ret) :
84 "r" (addr), "m" (*addr)); 84 "r" (addr), "m" (*addr));
@@ -89,7 +89,7 @@ extern inline int in_be16(const volatile unsigned short __iomem *addr)
89{ 89{
90 int ret; 90 int ret;
91 91
92 __asm__ __volatile__("lhz%U1%X1 %0,%1;\n" 92 __asm__ __volatile__("sync; lhz%U1%X1 %0,%1;\n"
93 "twi 0,%0,0;\n" 93 "twi 0,%0,0;\n"
94 "isync" : "=r" (ret) : "m" (*addr)); 94 "isync" : "=r" (ret) : "m" (*addr));
95 return ret; 95 return ret;
@@ -97,20 +97,20 @@ extern inline int in_be16(const volatile unsigned short __iomem *addr)
97 97
98extern inline void out_le16(volatile unsigned short __iomem *addr, int val) 98extern inline void out_le16(volatile unsigned short __iomem *addr, int val)
99{ 99{
100 __asm__ __volatile__("sthbrx %1,0,%2; eieio" : "=m" (*addr) : 100 __asm__ __volatile__("sync; sthbrx %1,0,%2" : "=m" (*addr) :
101 "r" (val), "r" (addr)); 101 "r" (val), "r" (addr));
102} 102}
103 103
104extern inline void out_be16(volatile unsigned short __iomem *addr, int val) 104extern inline void out_be16(volatile unsigned short __iomem *addr, int val)
105{ 105{
106 __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); 106 __asm__ __volatile__("sync; sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
107} 107}
108 108
109extern inline unsigned in_le32(const volatile unsigned __iomem *addr) 109extern inline unsigned in_le32(const volatile unsigned __iomem *addr)
110{ 110{
111 unsigned ret; 111 unsigned ret;
112 112
113 __asm__ __volatile__("lwbrx %0,0,%1;\n" 113 __asm__ __volatile__("sync; lwbrx %0,0,%1;\n"
114 "twi 0,%0,0;\n" 114 "twi 0,%0,0;\n"
115 "isync" : "=r" (ret) : 115 "isync" : "=r" (ret) :
116 "r" (addr), "m" (*addr)); 116 "r" (addr), "m" (*addr));
@@ -121,7 +121,7 @@ extern inline unsigned in_be32(const volatile unsigned __iomem *addr)
121{ 121{
122 unsigned ret; 122 unsigned ret;
123 123
124 __asm__ __volatile__("lwz%U1%X1 %0,%1;\n" 124 __asm__ __volatile__("sync; lwz%U1%X1 %0,%1;\n"
125 "twi 0,%0,0;\n" 125 "twi 0,%0,0;\n"
126 "isync" : "=r" (ret) : "m" (*addr)); 126 "isync" : "=r" (ret) : "m" (*addr));
127 return ret; 127 return ret;
@@ -129,13 +129,13 @@ extern inline unsigned in_be32(const volatile unsigned __iomem *addr)
129 129
130extern inline void out_le32(volatile unsigned __iomem *addr, int val) 130extern inline void out_le32(volatile unsigned __iomem *addr, int val)
131{ 131{
132 __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) : 132 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) :
133 "r" (val), "r" (addr)); 133 "r" (val), "r" (addr));
134} 134}
135 135
136extern inline void out_be32(volatile unsigned __iomem *addr, int val) 136extern inline void out_be32(volatile unsigned __iomem *addr, int val)
137{ 137{
138 __asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); 138 __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
139} 139}
140#if defined (CONFIG_8260_PCI9) 140#if defined (CONFIG_8260_PCI9)
141#define readb(addr) in_8((volatile u8 *)(addr)) 141#define readb(addr) in_8((volatile u8 *)(addr))
@@ -259,6 +259,7 @@ extern __inline__ unsigned int name(unsigned int port) \
259{ \ 259{ \
260 unsigned int x; \ 260 unsigned int x; \
261 __asm__ __volatile__( \ 261 __asm__ __volatile__( \
262 "sync\n" \
262 "0:" op " %0,0,%1\n" \ 263 "0:" op " %0,0,%1\n" \
263 "1: twi 0,%0,0\n" \ 264 "1: twi 0,%0,0\n" \
264 "2: isync\n" \ 265 "2: isync\n" \
@@ -284,6 +285,7 @@ extern __inline__ unsigned int name(unsigned int port) \
284extern __inline__ void name(unsigned int val, unsigned int port) \ 285extern __inline__ void name(unsigned int val, unsigned int port) \
285{ \ 286{ \
286 __asm__ __volatile__( \ 287 __asm__ __volatile__( \
288 "sync\n" \
287 "0:" op " %0,0,%1\n" \ 289 "0:" op " %0,0,%1\n" \
288 "1: sync\n" \ 290 "1: sync\n" \
289 "2:\n" \ 291 "2:\n" \
@@ -325,26 +327,12 @@ __do_out_asm(outl, "stwbrx")
325#define inl_p(port) inl((port)) 327#define inl_p(port) inl((port))
326#define outl_p(val, port) outl((val), (port)) 328#define outl_p(val, port) outl((val), (port))
327 329
328extern void _insb(volatile u8 __iomem *port, void *buf, int ns); 330extern void _insb(volatile u8 __iomem *port, void *buf, long count);
329extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); 331extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
330extern void _insw(volatile u16 __iomem *port, void *buf, int ns); 332extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
331extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); 333extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
332extern void _insl(volatile u32 __iomem *port, void *buf, int nl); 334extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
333extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); 335extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
334extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
335extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
336extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
337extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
338
339/*
340 * The *_ns versions below don't do byte-swapping.
341 * Neither do the standard versions now, these are just here
342 * for older code.
343 */
344#define insw_ns(port, buf, ns) _insw_ns((port)+___IO_BASE, (buf), (ns))
345#define outsw_ns(port, buf, ns) _outsw_ns((port)+___IO_BASE, (buf), (ns))
346#define insl_ns(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl))
347#define outsl_ns(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl))
348 336
349 337
350#define IO_SPACE_LIMIT ~0 338#define IO_SPACE_LIMIT ~0
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h
index 4b93481e76..23579d4afa 100644
--- a/include/asm-ppc/mpc8260.h
+++ b/include/asm-ppc/mpc8260.h
@@ -82,6 +82,7 @@ enum ppc_sys_devices {
82 MPC82xx_CPM_SMC2, 82 MPC82xx_CPM_SMC2,
83 MPC82xx_CPM_USB, 83 MPC82xx_CPM_USB,
84 MPC82xx_SEC1, 84 MPC82xx_SEC1,
85 MPC82xx_MDIO_BB,
85 NUM_PPC_SYS_DEVS, 86 NUM_PPC_SYS_DEVS,
86}; 87};
87 88
diff --git a/include/asm-ppc/mpc8260_pci9.h b/include/asm-ppc/mpc8260_pci9.h
index 26b3f6e787..9f7176881c 100644
--- a/include/asm-ppc/mpc8260_pci9.h
+++ b/include/asm-ppc/mpc8260_pci9.h
@@ -30,8 +30,6 @@
30#undef inb 30#undef inb
31#undef inw 31#undef inw
32#undef inl 32#undef inl
33#undef insw_ns
34#undef insl_ns
35#undef memcpy_fromio 33#undef memcpy_fromio
36 34
37extern int readb(volatile unsigned char *addr); 35extern int readb(volatile unsigned char *addr);
@@ -43,8 +41,6 @@ extern void insl(unsigned port, void *buf, int nl);
43extern int inb(unsigned port); 41extern int inb(unsigned port);
44extern int inw(unsigned port); 42extern int inw(unsigned port);
45extern unsigned inl(unsigned port); 43extern unsigned inl(unsigned port);
46extern void insw_ns(unsigned port, void *buf, int ns);
47extern void insl_ns(unsigned port, void *buf, int nl);
48extern void *memcpy_fromio(void *dest, unsigned long src, size_t count); 44extern void *memcpy_fromio(void *dest, unsigned long src, size_t count);
49 45
50#endif /* !__CONFIG_8260_PCI9_DEFS */ 46#endif /* !__CONFIG_8260_PCI9_DEFS */
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h
index adcce33f20..d3a2f2fe23 100644
--- a/include/asm-ppc/mpc8xx.h
+++ b/include/asm-ppc/mpc8xx.h
@@ -110,6 +110,7 @@ enum ppc_sys_devices {
110 MPC8xx_CPM_SMC1, 110 MPC8xx_CPM_SMC1,
111 MPC8xx_CPM_SMC2, 111 MPC8xx_CPM_SMC2,
112 MPC8xx_CPM_USB, 112 MPC8xx_CPM_USB,
113 MPC8xx_MDIO_FEC,
113 NUM_PPC_SYS_DEVS, 114 NUM_PPC_SYS_DEVS,
114}; 115};
115 116
diff --git a/include/asm-ppc/ocp.h b/include/asm-ppc/ocp.h
index 3be5d760ff..16dbc7d174 100644
--- a/include/asm-ppc/ocp.h
+++ b/include/asm-ppc/ocp.h
@@ -26,7 +26,6 @@
26 26
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/devfs_fs_kernel.h>
30#include <linux/device.h> 29#include <linux/device.h>
31 30
32#include <asm/mmu.h> 31#include <asm/mmu.h>
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index 0b19af8250..fe95c8258c 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -170,7 +170,7 @@ extern __inline__ int get_order(unsigned long size)
170#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 170#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
171 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 171 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
172 172
173/* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */ 173/* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
174#define __HAVE_ARCH_GATE_AREA 1 174#define __HAVE_ARCH_GATE_AREA 1
175 175
176#include <asm-generic/memory_model.h> 176#include <asm-generic/memory_model.h>
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index 61434edbad..11ffaaa5da 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -133,7 +133,7 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
133#define HAVE_ARCH_PCI_RESOURCE_TO_USER 133#define HAVE_ARCH_PCI_RESOURCE_TO_USER
134extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 134extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
135 const struct resource *rsrc, 135 const struct resource *rsrc,
136 u64 *start, u64 *end); 136 resource_size_t *start, resource_size_t *end);
137 137
138 138
139#endif /* __KERNEL__ */ 139#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 51fa7c6629..b1fdbf40db 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -526,7 +526,7 @@ static inline int pgd_bad(pgd_t pgd) { return 0; }
526static inline int pgd_present(pgd_t pgd) { return 1; } 526static inline int pgd_present(pgd_t pgd) { return 1; }
527#define pgd_clear(xp) do { } while (0) 527#define pgd_clear(xp) do { } while (0)
528 528
529#define pgd_page(pgd) \ 529#define pgd_page_vaddr(pgd) \
530 ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) 530 ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
531 531
532/* 532/*
@@ -720,12 +720,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
720 * of the pte page. -- paulus 720 * of the pte page. -- paulus
721 */ 721 */
722#ifndef CONFIG_BOOKE 722#ifndef CONFIG_BOOKE
723#define pmd_page_kernel(pmd) \ 723#define pmd_page_vaddr(pmd) \
724 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 724 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
725#define pmd_page(pmd) \ 725#define pmd_page(pmd) \
726 (mem_map + (pmd_val(pmd) >> PAGE_SHIFT)) 726 (mem_map + (pmd_val(pmd) >> PAGE_SHIFT))
727#else 727#else
728#define pmd_page_kernel(pmd) \ 728#define pmd_page_vaddr(pmd) \
729 ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) 729 ((unsigned long) (pmd_val(pmd) & PAGE_MASK))
730#define pmd_page(pmd) \ 730#define pmd_page(pmd) \
731 (mem_map + (__pa(pmd_val(pmd)) >> PAGE_SHIFT)) 731 (mem_map + (__pa(pmd_val(pmd)) >> PAGE_SHIFT))
@@ -748,7 +748,7 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
748#define pte_index(address) \ 748#define pte_index(address) \
749 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 749 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
750#define pte_offset_kernel(dir, addr) \ 750#define pte_offset_kernel(dir, addr) \
751 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) 751 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr))
752#define pte_offset_map(dir, addr) \ 752#define pte_offset_map(dir, addr) \
753 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) 753 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr))
754#define pte_offset_map_nested(dir, addr) \ 754#define pte_offset_map_nested(dir, addr) \
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h
index 4944c0fb8b..602fbadeaf 100644
--- a/include/asm-ppc/reg_booke.h
+++ b/include/asm-ppc/reg_booke.h
@@ -300,14 +300,14 @@ do { \
300#define DBSR_IC 0x80000000 /* Instruction Completion */ 300#define DBSR_IC 0x80000000 /* Instruction Completion */
301#define DBSR_BT 0x40000000 /* Branch taken */ 301#define DBSR_BT 0x40000000 /* Branch taken */
302#define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */ 302#define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */
303#define DBSR_IAC1 0x00800000 /* Instruction Address Compare 1 Event */ 303#define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */
304#define DBSR_IAC2 0x00400000 /* Instruction Address Compare 2 Event */ 304#define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */
305#define DBSR_IAC3 0x00200000 /* Instruction Address Compare 3 Event */ 305#define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */
306#define DBSR_IAC4 0x00100000 /* Instruction Address Compare 4 Event */ 306#define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */
307#define DBSR_DAC1R 0x00080000 /* Data Address Compare 1 Read Event */ 307#define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */
308#define DBSR_DAC1W 0x00040000 /* Data Address Compare 1 Write Event */ 308#define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */
309#define DBSR_DAC2R 0x00020000 /* Data Address Compare 2 Read Event */ 309#define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */
310#define DBSR_DAC2W 0x00010000 /* Data Address Compare 2 Write Event */ 310#define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */
311#endif 311#endif
312 312
313/* Bit definitions related to the ESR. */ 313/* Bit definitions related to the ESR. */
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index fb49c0c49e..738943584c 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -33,7 +33,6 @@
33#define read_barrier_depends() do { } while(0) 33#define read_barrier_depends() do { } while(0)
34 34
35#define set_mb(var, value) do { var = value; mb(); } while (0) 35#define set_mb(var, value) do { var = value; mb(); } while (0)
36#define set_wmb(var, value) do { var = value; wmb(); } while (0)
37 36
38#ifdef CONFIG_SMP 37#ifdef CONFIG_SMP
39#define smp_mb() mb() 38#define smp_mb() mb()
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild
new file mode 100644
index 0000000000..e92b429d2b
--- /dev/null
+++ b/include/asm-s390/Kbuild
@@ -0,0 +1,12 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += dasd.h
4header-y += monwriter.h
5header-y += qeth.h
6header-y += tape390.h
7header-y += ucontext.h
8header-y += vtoc.h
9header-y += zcrypt.h
10
11unifdef-y += cmb.h
12unifdef-y += debug.h
diff --git a/include/asm-s390/appldata.h b/include/asm-s390/appldata.h
new file mode 100644
index 0000000000..79283dac82
--- /dev/null
+++ b/include/asm-s390/appldata.h
@@ -0,0 +1,90 @@
1/*
2 * include/asm-s390/appldata.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 *
6 * Author(s): Melissa Howland <melissah@us.ibm.com>
7 */
8
9#ifndef _ASM_S390_APPLDATA_H
10#define _ASM_S390_APPLDATA_H
11
12#include <asm/io.h>
13
14#ifndef CONFIG_64BIT
15
16#define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */
17#define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */
18#define APPLDATA_GEN_EVENT_REC 0x02
19#define APPLDATA_START_CONFIG_REC 0x03
20
21/*
22 * Parameter list for DIAGNOSE X'DC'
23 */
24struct appldata_parameter_list {
25 u16 diag; /* The DIAGNOSE code X'00DC' */
26 u8 function; /* The function code for the DIAGNOSE */
27 u8 parlist_length; /* Length of the parameter list */
28 u32 product_id_addr; /* Address of the 16-byte product ID */
29 u16 reserved;
30 u16 buffer_length; /* Length of the application data buffer */
31 u32 buffer_addr; /* Address of the application data buffer */
32} __attribute__ ((packed));
33
34#else /* CONFIG_64BIT */
35
36#define APPLDATA_START_INTERVAL_REC 0x80
37#define APPLDATA_STOP_REC 0x81
38#define APPLDATA_GEN_EVENT_REC 0x82
39#define APPLDATA_START_CONFIG_REC 0x83
40
41/*
42 * Parameter list for DIAGNOSE X'DC'
43 */
44struct appldata_parameter_list {
45 u16 diag;
46 u8 function;
47 u8 parlist_length;
48 u32 unused01;
49 u16 reserved;
50 u16 buffer_length;
51 u32 unused02;
52 u64 product_id_addr;
53 u64 buffer_addr;
54} __attribute__ ((packed));
55
56#endif /* CONFIG_64BIT */
57
58struct appldata_product_id {
59 char prod_nr[7]; /* product number */
60 u16 prod_fn; /* product function */
61 u8 record_nr; /* record number */
62 u16 version_nr; /* version */
63 u16 release_nr; /* release */
64 u16 mod_lvl; /* modification level */
65} __attribute__ ((packed));
66
67static inline int appldata_asm(struct appldata_product_id *id,
68 unsigned short fn, void *buffer,
69 unsigned short length)
70{
71 struct appldata_parameter_list parm_list;
72 int ry;
73
74 if (!MACHINE_IS_VM)
75 return -ENOSYS;
76 parm_list.diag = 0xdc;
77 parm_list.function = fn;
78 parm_list.parlist_length = sizeof(parm_list);
79 parm_list.buffer_length = length;
80 parm_list.product_id_addr = (unsigned long) id;
81 parm_list.buffer_addr = virt_to_phys(buffer);
82 asm volatile(
83 " diag %1,%0,0xdc"
84 : "=d" (ry)
85 : "d" (&parm_list), "m" (parm_list), "m" (*id)
86 : "cc");
87 return ry;
88}
89
90#endif /* _ASM_S390_APPLDATA_H */
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index 399bf02894..af20c74624 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 4d2b126ba1..f79c9b792a 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -12,6 +12,9 @@
12 * Copyright (C) 1992, Linus Torvalds 12 * Copyright (C) 1992, Linus Torvalds
13 * 13 *
14 */ 14 */
15
16#ifdef __KERNEL__
17
15#include <linux/compiler.h> 18#include <linux/compiler.h>
16 19
17/* 20/*
@@ -50,19 +53,6 @@
50 * with operation of the form "set_bit(bitnr, flags)". 53 * with operation of the form "set_bit(bitnr, flags)".
51 */ 54 */
52 55
53/* set ALIGN_CS to 1 if the SMP safe bit operations should
54 * align the address to 4 byte boundary. It seems to work
55 * without the alignment.
56 */
57#ifdef __KERNEL__
58#define ALIGN_CS 0
59#else
60#define ALIGN_CS 1
61#ifndef CONFIG_SMP
62#error "bitops won't work without CONFIG_SMP"
63#endif
64#endif
65
66/* bitmap tables from arch/S390/kernel/bitmap.S */ 56/* bitmap tables from arch/S390/kernel/bitmap.S */
67extern const char _oi_bitmap[]; 57extern const char _oi_bitmap[];
68extern const char _ni_bitmap[]; 58extern const char _ni_bitmap[];
@@ -77,16 +67,35 @@ extern const char _sb_findmap[];
77#define __BITOPS_AND "nr" 67#define __BITOPS_AND "nr"
78#define __BITOPS_XOR "xr" 68#define __BITOPS_XOR "xr"
79 69
80#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 70#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
81 __asm__ __volatile__(" l %0,0(%4)\n" \ 71
82 "0: lr %1,%0\n" \ 72#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
83 __op_string " %1,%3\n" \ 73 asm volatile( \
84 " cs %0,%1,0(%4)\n" \ 74 " l %0,%2\n" \
85 " jl 0b" \ 75 "0: lr %1,%0\n" \
86 : "=&d" (__old), "=&d" (__new), \ 76 __op_string " %1,%3\n" \
87 "=m" (*(unsigned long *) __addr) \ 77 " cs %0,%1,%2\n" \
88 : "d" (__val), "a" (__addr), \ 78 " jl 0b" \
89 "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__ */
90 99
91#else /* __s390x__ */ 100#else /* __s390x__ */
92 101
@@ -96,21 +105,41 @@ extern const char _sb_findmap[];
96#define __BITOPS_AND "ngr" 105#define __BITOPS_AND "ngr"
97#define __BITOPS_XOR "xgr" 106#define __BITOPS_XOR "xgr"
98 107
99#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 108#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
100 __asm__ __volatile__(" lg %0,0(%4)\n" \ 109
101 "0: lgr %1,%0\n" \ 110#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
102 __op_string " %1,%3\n" \ 111 asm volatile( \
103 " csg %0,%1,0(%4)\n" \ 112 " lg %0,%2\n" \
104 " jl 0b" \ 113 "0: lgr %1,%0\n" \
105 : "=&d" (__old), "=&d" (__new), \ 114 __op_string " %1,%3\n" \
106 "=m" (*(unsigned long *) __addr) \ 115 " csg %0,%1,%2\n" \
107 : "d" (__val), "a" (__addr), \ 116 " jl 0b" \
108 "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__ */
109 138
110#endif /* __s390x__ */ 139#endif /* __s390x__ */
111 140
112#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE) 141#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
113#define __BITOPS_BARRIER() __asm__ __volatile__ ( "" : : : "memory" ) 142#define __BITOPS_BARRIER() asm volatile("" : : : "memory")
114 143
115#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
116/* 145/*
@@ -121,10 +150,6 @@ static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
121 unsigned long addr, old, new, mask; 150 unsigned long addr, old, new, mask;
122 151
123 addr = (unsigned long) ptr; 152 addr = (unsigned long) ptr;
124#if ALIGN_CS == 1
125 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
126 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
127#endif
128 /* calculate address for CS */ 153 /* calculate address for CS */
129 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 154 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
130 /* make OR mask */ 155 /* make OR mask */
@@ -141,10 +166,6 @@ static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
141 unsigned long addr, old, new, mask; 166 unsigned long addr, old, new, mask;
142 167
143 addr = (unsigned long) ptr; 168 addr = (unsigned long) ptr;
144#if ALIGN_CS == 1
145 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
146 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
147#endif
148 /* calculate address for CS */ 169 /* calculate address for CS */
149 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 170 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
150 /* make AND mask */ 171 /* make AND mask */
@@ -161,10 +182,6 @@ static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
161 unsigned long addr, old, new, mask; 182 unsigned long addr, old, new, mask;
162 183
163 addr = (unsigned long) ptr; 184 addr = (unsigned long) ptr;
164#if ALIGN_CS == 1
165 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
166 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
167#endif
168 /* calculate address for CS */ 185 /* calculate address for CS */
169 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 186 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
170 /* make XOR mask */ 187 /* make XOR mask */
@@ -182,10 +199,6 @@ test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
182 unsigned long addr, old, new, mask; 199 unsigned long addr, old, new, mask;
183 200
184 addr = (unsigned long) ptr; 201 addr = (unsigned long) ptr;
185#if ALIGN_CS == 1
186 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
187 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
188#endif
189 /* calculate address for CS */ 202 /* calculate address for CS */
190 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 203 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
191 /* make OR/test mask */ 204 /* make OR/test mask */
@@ -205,10 +218,6 @@ test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
205 unsigned long addr, old, new, mask; 218 unsigned long addr, old, new, mask;
206 219
207 addr = (unsigned long) ptr; 220 addr = (unsigned long) ptr;
208#if ALIGN_CS == 1
209 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
210 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
211#endif
212 /* calculate address for CS */ 221 /* calculate address for CS */
213 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 222 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
214 /* make AND/test mask */ 223 /* make AND/test mask */
@@ -228,10 +237,6 @@ test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
228 unsigned long addr, old, new, mask; 237 unsigned long addr, old, new, mask;
229 238
230 addr = (unsigned long) ptr; 239 addr = (unsigned long) ptr;
231#if ALIGN_CS == 1
232 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
233 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
234#endif
235 /* calculate address for CS */ 240 /* calculate address for CS */
236 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 241 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
237 /* make XOR/test mask */ 242 /* make XOR/test mask */
@@ -251,10 +256,10 @@ static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
251 unsigned long addr; 256 unsigned long addr;
252 257
253 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 258 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
254 asm volatile("oc 0(1,%1),0(%2)" 259 asm volatile(
255 : "=m" (*(char *) addr) 260 " oc 0(1,%1),0(%2)"
256 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 261 : "=m" (*(char *) addr) : "a" (addr),
257 "m" (*(char *) addr) : "cc" ); 262 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
258} 263}
259 264
260static inline void 265static inline void
@@ -263,40 +268,7 @@ __constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
263 unsigned long addr; 268 unsigned long addr;
264 269
265 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 270 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
266 switch (nr&7) { 271 *(unsigned char *) addr |= 1 << (nr & 7);
267 case 0:
268 asm volatile ("oi 0(%1),0x01" : "=m" (*(char *) addr)
269 : "a" (addr), "m" (*(char *) addr) : "cc" );
270 break;
271 case 1:
272 asm volatile ("oi 0(%1),0x02" : "=m" (*(char *) addr)
273 : "a" (addr), "m" (*(char *) addr) : "cc" );
274 break;
275 case 2:
276 asm volatile ("oi 0(%1),0x04" : "=m" (*(char *) addr)
277 : "a" (addr), "m" (*(char *) addr) : "cc" );
278 break;
279 case 3:
280 asm volatile ("oi 0(%1),0x08" : "=m" (*(char *) addr)
281 : "a" (addr), "m" (*(char *) addr) : "cc" );
282 break;
283 case 4:
284 asm volatile ("oi 0(%1),0x10" : "=m" (*(char *) addr)
285 : "a" (addr), "m" (*(char *) addr) : "cc" );
286 break;
287 case 5:
288 asm volatile ("oi 0(%1),0x20" : "=m" (*(char *) addr)
289 : "a" (addr), "m" (*(char *) addr) : "cc" );
290 break;
291 case 6:
292 asm volatile ("oi 0(%1),0x40" : "=m" (*(char *) addr)
293 : "a" (addr), "m" (*(char *) addr) : "cc" );
294 break;
295 case 7:
296 asm volatile ("oi 0(%1),0x80" : "=m" (*(char *) addr)
297 : "a" (addr), "m" (*(char *) addr) : "cc" );
298 break;
299 }
300} 272}
301 273
302#define set_bit_simple(nr,addr) \ 274#define set_bit_simple(nr,addr) \
@@ -313,10 +285,10 @@ __clear_bit(unsigned long nr, volatile unsigned long *ptr)
313 unsigned long addr; 285 unsigned long addr;
314 286
315 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 287 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
316 asm volatile("nc 0(1,%1),0(%2)" 288 asm volatile(
317 : "=m" (*(char *) addr) 289 " nc 0(1,%1),0(%2)"
318 : "a" (addr), "a" (_ni_bitmap + (nr & 7)), 290 : "=m" (*(char *) addr) : "a" (addr),
319 "m" (*(char *) addr) : "cc" ); 291 "a" (_ni_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc");
320} 292}
321 293
322static inline void 294static inline void
@@ -325,40 +297,7 @@ __constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
325 unsigned long addr; 297 unsigned long addr;
326 298
327 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 299 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
328 switch (nr&7) { 300 *(unsigned char *) addr &= ~(1 << (nr & 7));
329 case 0:
330 asm volatile ("ni 0(%1),0xFE" : "=m" (*(char *) addr)
331 : "a" (addr), "m" (*(char *) addr) : "cc" );
332 break;
333 case 1:
334 asm volatile ("ni 0(%1),0xFD": "=m" (*(char *) addr)
335 : "a" (addr), "m" (*(char *) addr) : "cc" );
336 break;
337 case 2:
338 asm volatile ("ni 0(%1),0xFB" : "=m" (*(char *) addr)
339 : "a" (addr), "m" (*(char *) addr) : "cc" );
340 break;
341 case 3:
342 asm volatile ("ni 0(%1),0xF7" : "=m" (*(char *) addr)
343 : "a" (addr), "m" (*(char *) addr) : "cc" );
344 break;
345 case 4:
346 asm volatile ("ni 0(%1),0xEF" : "=m" (*(char *) addr)
347 : "a" (addr), "m" (*(char *) addr) : "cc" );
348 break;
349 case 5:
350 asm volatile ("ni 0(%1),0xDF" : "=m" (*(char *) addr)
351 : "a" (addr), "m" (*(char *) addr) : "cc" );
352 break;
353 case 6:
354 asm volatile ("ni 0(%1),0xBF" : "=m" (*(char *) addr)
355 : "a" (addr), "m" (*(char *) addr) : "cc" );
356 break;
357 case 7:
358 asm volatile ("ni 0(%1),0x7F" : "=m" (*(char *) addr)
359 : "a" (addr), "m" (*(char *) addr) : "cc" );
360 break;
361 }
362} 301}
363 302
364#define clear_bit_simple(nr,addr) \ 303#define clear_bit_simple(nr,addr) \
@@ -374,10 +313,10 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
374 unsigned long addr; 313 unsigned long addr;
375 314
376 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 315 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
377 asm volatile("xc 0(1,%1),0(%2)" 316 asm volatile(
378 : "=m" (*(char *) addr) 317 " xc 0(1,%1),0(%2)"
379 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 318 : "=m" (*(char *) addr) : "a" (addr),
380 "m" (*(char *) addr) : "cc" ); 319 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
381} 320}
382 321
383static inline void 322static inline void
@@ -386,40 +325,7 @@ __constant_change_bit(const unsigned long nr, volatile unsigned long *ptr)
386 unsigned long addr; 325 unsigned long addr;
387 326
388 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 327 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
389 switch (nr&7) { 328 *(unsigned char *) addr ^= 1 << (nr & 7);
390 case 0:
391 asm volatile ("xi 0(%1),0x01" : "=m" (*(char *) addr)
392 : "a" (addr), "m" (*(char *) addr) : "cc" );
393 break;
394 case 1:
395 asm volatile ("xi 0(%1),0x02" : "=m" (*(char *) addr)
396 : "a" (addr), "m" (*(char *) addr) : "cc" );
397 break;
398 case 2:
399 asm volatile ("xi 0(%1),0x04" : "=m" (*(char *) addr)
400 : "a" (addr), "m" (*(char *) addr) : "cc" );
401 break;
402 case 3:
403 asm volatile ("xi 0(%1),0x08" : "=m" (*(char *) addr)
404 : "a" (addr), "m" (*(char *) addr) : "cc" );
405 break;
406 case 4:
407 asm volatile ("xi 0(%1),0x10" : "=m" (*(char *) addr)
408 : "a" (addr), "m" (*(char *) addr) : "cc" );
409 break;
410 case 5:
411 asm volatile ("xi 0(%1),0x20" : "=m" (*(char *) addr)
412 : "a" (addr), "m" (*(char *) addr) : "cc" );
413 break;
414 case 6:
415 asm volatile ("xi 0(%1),0x40" : "=m" (*(char *) addr)
416 : "a" (addr), "m" (*(char *) addr) : "cc" );
417 break;
418 case 7:
419 asm volatile ("xi 0(%1),0x80" : "=m" (*(char *) addr)
420 : "a" (addr), "m" (*(char *) addr) : "cc" );
421 break;
422 }
423} 329}
424 330
425#define change_bit_simple(nr,addr) \ 331#define change_bit_simple(nr,addr) \
@@ -438,10 +344,11 @@ test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
438 344
439 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 345 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
440 ch = *(unsigned char *) addr; 346 ch = *(unsigned char *) addr;
441 asm volatile("oc 0(1,%1),0(%2)" 347 asm volatile(
442 : "=m" (*(char *) addr) 348 " oc 0(1,%1),0(%2)"
443 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 349 : "=m" (*(char *) addr)
444 "m" (*(char *) addr) : "cc", "memory" ); 350 : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
351 "m" (*(char *) addr) : "cc", "memory");
445 return (ch >> (nr & 7)) & 1; 352 return (ch >> (nr & 7)) & 1;
446} 353}
447#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)
@@ -457,10 +364,11 @@ test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
457 364
458 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 365 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
459 ch = *(unsigned char *) addr; 366 ch = *(unsigned char *) addr;
460 asm volatile("nc 0(1,%1),0(%2)" 367 asm volatile(
461 : "=m" (*(char *) addr) 368 " nc 0(1,%1),0(%2)"
462 : "a" (addr), "a" (_ni_bitmap + (nr & 7)), 369 : "=m" (*(char *) addr)
463 "m" (*(char *) addr) : "cc", "memory" ); 370 : "a" (addr), "a" (_ni_bitmap + (nr & 7)),
371 "m" (*(char *) addr) : "cc", "memory");
464 return (ch >> (nr & 7)) & 1; 372 return (ch >> (nr & 7)) & 1;
465} 373}
466#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)
@@ -476,10 +384,11 @@ test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
476 384
477 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 385 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
478 ch = *(unsigned char *) addr; 386 ch = *(unsigned char *) addr;
479 asm volatile("xc 0(1,%1),0(%2)" 387 asm volatile(
480 : "=m" (*(char *) addr) 388 " xc 0(1,%1),0(%2)"
481 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 389 : "=m" (*(char *) addr)
482 "m" (*(char *) addr) : "cc", "memory" ); 390 : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
391 "m" (*(char *) addr) : "cc", "memory");
483 return (ch >> (nr & 7)) & 1; 392 return (ch >> (nr & 7)) & 1;
484} 393}
485#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)
@@ -591,35 +500,36 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size)
591 500
592 if (!size) 501 if (!size)
593 return 0; 502 return 0;
594 __asm__(" lhi %1,-1\n" 503 asm volatile(
595 " lr %2,%3\n" 504 " lhi %1,-1\n"
596 " slr %0,%0\n" 505 " lr %2,%3\n"
597 " ahi %2,31\n" 506 " slr %0,%0\n"
598 " srl %2,5\n" 507 " ahi %2,31\n"
599 "0: c %1,0(%0,%4)\n" 508 " srl %2,5\n"
600 " jne 1f\n" 509 "0: c %1,0(%0,%4)\n"
601 " la %0,4(%0)\n" 510 " jne 1f\n"
602 " brct %2,0b\n" 511 " la %0,4(%0)\n"
603 " lr %0,%3\n" 512 " brct %2,0b\n"
604 " j 4f\n" 513 " lr %0,%3\n"
605 "1: l %2,0(%0,%4)\n" 514 " j 4f\n"
606 " sll %0,3\n" 515 "1: l %2,0(%0,%4)\n"
607 " lhi %1,0xff\n" 516 " sll %0,3\n"
608 " tml %2,0xffff\n" 517 " lhi %1,0xff\n"
609 " jno 2f\n" 518 " tml %2,0xffff\n"
610 " ahi %0,16\n" 519 " jno 2f\n"
611 " srl %2,16\n" 520 " ahi %0,16\n"
612 "2: tml %2,0x00ff\n" 521 " srl %2,16\n"
613 " jno 3f\n" 522 "2: tml %2,0x00ff\n"
614 " ahi %0,8\n" 523 " jno 3f\n"
615 " srl %2,8\n" 524 " ahi %0,8\n"
616 "3: nr %2,%1\n" 525 " srl %2,8\n"
617 " ic %2,0(%2,%5)\n" 526 "3: nr %2,%1\n"
618 " alr %0,%2\n" 527 " ic %2,0(%2,%5)\n"
619 "4:" 528 " alr %0,%2\n"
620 : "=&a" (res), "=&d" (cmp), "=&a" (count) 529 "4:"
621 : "a" (size), "a" (addr), "a" (&_zb_findmap), 530 : "=&a" (res), "=&d" (cmp), "=&a" (count)
622 "m" (*(addrtype *) addr) : "cc" ); 531 : "a" (size), "a" (addr), "a" (&_zb_findmap),
532 "m" (*(addrtype *) addr) : "cc");
623 return (res < size) ? res : size; 533 return (res < size) ? res : size;
624} 534}
625 535
@@ -632,35 +542,36 @@ find_first_bit(const unsigned long * addr, unsigned long size)
632 542
633 if (!size) 543 if (!size)
634 return 0; 544 return 0;
635 __asm__(" slr %1,%1\n" 545 asm volatile(
636 " lr %2,%3\n" 546 " slr %1,%1\n"
637 " slr %0,%0\n" 547 " lr %2,%3\n"
638 " ahi %2,31\n" 548 " slr %0,%0\n"
639 " srl %2,5\n" 549 " ahi %2,31\n"
640 "0: c %1,0(%0,%4)\n" 550 " srl %2,5\n"
641 " jne 1f\n" 551 "0: c %1,0(%0,%4)\n"
642 " la %0,4(%0)\n" 552 " jne 1f\n"
643 " brct %2,0b\n" 553 " la %0,4(%0)\n"
644 " lr %0,%3\n" 554 " brct %2,0b\n"
645 " j 4f\n" 555 " lr %0,%3\n"
646 "1: l %2,0(%0,%4)\n" 556 " j 4f\n"
647 " sll %0,3\n" 557 "1: l %2,0(%0,%4)\n"
648 " lhi %1,0xff\n" 558 " sll %0,3\n"
649 " tml %2,0xffff\n" 559 " lhi %1,0xff\n"
650 " jnz 2f\n" 560 " tml %2,0xffff\n"
651 " ahi %0,16\n" 561 " jnz 2f\n"
652 " srl %2,16\n" 562 " ahi %0,16\n"
653 "2: tml %2,0x00ff\n" 563 " srl %2,16\n"
654 " jnz 3f\n" 564 "2: tml %2,0x00ff\n"
655 " ahi %0,8\n" 565 " jnz 3f\n"
656 " srl %2,8\n" 566 " ahi %0,8\n"
657 "3: nr %2,%1\n" 567 " srl %2,8\n"
658 " ic %2,0(%2,%5)\n" 568 "3: nr %2,%1\n"
659 " alr %0,%2\n" 569 " ic %2,0(%2,%5)\n"
660 "4:" 570 " alr %0,%2\n"
661 : "=&a" (res), "=&d" (cmp), "=&a" (count) 571 "4:"
662 : "a" (size), "a" (addr), "a" (&_sb_findmap), 572 : "=&a" (res), "=&d" (cmp), "=&a" (count)
663 "m" (*(addrtype *) addr) : "cc" ); 573 : "a" (size), "a" (addr), "a" (&_sb_findmap),
574 "m" (*(addrtype *) addr) : "cc");
664 return (res < size) ? res : size; 575 return (res < size) ? res : size;
665} 576}
666 577
@@ -674,39 +585,40 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size)
674 585
675 if (!size) 586 if (!size)
676 return 0; 587 return 0;
677 __asm__(" lghi %1,-1\n" 588 asm volatile(
678 " lgr %2,%3\n" 589 " lghi %1,-1\n"
679 " slgr %0,%0\n" 590 " lgr %2,%3\n"
680 " aghi %2,63\n" 591 " slgr %0,%0\n"
681 " srlg %2,%2,6\n" 592 " aghi %2,63\n"
682 "0: cg %1,0(%0,%4)\n" 593 " srlg %2,%2,6\n"
683 " jne 1f\n" 594 "0: cg %1,0(%0,%4)\n"
684 " la %0,8(%0)\n" 595 " jne 1f\n"
685 " brct %2,0b\n" 596 " la %0,8(%0)\n"
686 " lgr %0,%3\n" 597 " brct %2,0b\n"
687 " j 5f\n" 598 " lgr %0,%3\n"
688 "1: lg %2,0(%0,%4)\n" 599 " j 5f\n"
689 " sllg %0,%0,3\n" 600 "1: lg %2,0(%0,%4)\n"
690 " clr %2,%1\n" 601 " sllg %0,%0,3\n"
691 " jne 2f\n" 602 " clr %2,%1\n"
692 " aghi %0,32\n" 603 " jne 2f\n"
693 " srlg %2,%2,32\n" 604 " aghi %0,32\n"
694 "2: lghi %1,0xff\n" 605 " srlg %2,%2,32\n"
695 " tmll %2,0xffff\n" 606 "2: lghi %1,0xff\n"
696 " jno 3f\n" 607 " tmll %2,0xffff\n"
697 " aghi %0,16\n" 608 " jno 3f\n"
698 " srl %2,16\n" 609 " aghi %0,16\n"
699 "3: tmll %2,0x00ff\n" 610 " srl %2,16\n"
700 " jno 4f\n" 611 "3: tmll %2,0x00ff\n"
701 " aghi %0,8\n" 612 " jno 4f\n"
702 " srl %2,8\n" 613 " aghi %0,8\n"
703 "4: ngr %2,%1\n" 614 " srl %2,8\n"
704 " ic %2,0(%2,%5)\n" 615 "4: ngr %2,%1\n"
705 " algr %0,%2\n" 616 " ic %2,0(%2,%5)\n"
706 "5:" 617 " algr %0,%2\n"
707 : "=&a" (res), "=&d" (cmp), "=&a" (count) 618 "5:"
619 : "=&a" (res), "=&d" (cmp), "=&a" (count)
708 : "a" (size), "a" (addr), "a" (&_zb_findmap), 620 : "a" (size), "a" (addr), "a" (&_zb_findmap),
709 "m" (*(addrtype *) addr) : "cc" ); 621 "m" (*(addrtype *) addr) : "cc");
710 return (res < size) ? res : size; 622 return (res < size) ? res : size;
711} 623}
712 624
@@ -718,39 +630,40 @@ find_first_bit(const unsigned long * addr, unsigned long size)
718 630
719 if (!size) 631 if (!size)
720 return 0; 632 return 0;
721 __asm__(" slgr %1,%1\n" 633 asm volatile(
722 " lgr %2,%3\n" 634 " slgr %1,%1\n"
723 " slgr %0,%0\n" 635 " lgr %2,%3\n"
724 " aghi %2,63\n" 636 " slgr %0,%0\n"
725 " srlg %2,%2,6\n" 637 " aghi %2,63\n"
726 "0: cg %1,0(%0,%4)\n" 638 " srlg %2,%2,6\n"
727 " jne 1f\n" 639 "0: cg %1,0(%0,%4)\n"
728 " aghi %0,8\n" 640 " jne 1f\n"
729 " brct %2,0b\n" 641 " aghi %0,8\n"
730 " lgr %0,%3\n" 642 " brct %2,0b\n"
731 " j 5f\n" 643 " lgr %0,%3\n"
732 "1: lg %2,0(%0,%4)\n" 644 " j 5f\n"
733 " sllg %0,%0,3\n" 645 "1: lg %2,0(%0,%4)\n"
734 " clr %2,%1\n" 646 " sllg %0,%0,3\n"
735 " jne 2f\n" 647 " clr %2,%1\n"
736 " aghi %0,32\n" 648 " jne 2f\n"
737 " srlg %2,%2,32\n" 649 " aghi %0,32\n"
738 "2: lghi %1,0xff\n" 650 " srlg %2,%2,32\n"
739 " tmll %2,0xffff\n" 651 "2: lghi %1,0xff\n"
740 " jnz 3f\n" 652 " tmll %2,0xffff\n"
741 " aghi %0,16\n" 653 " jnz 3f\n"
742 " srl %2,16\n" 654 " aghi %0,16\n"
743 "3: tmll %2,0x00ff\n" 655 " srl %2,16\n"
744 " jnz 4f\n" 656 "3: tmll %2,0x00ff\n"
745 " aghi %0,8\n" 657 " jnz 4f\n"
746 " srl %2,8\n" 658 " aghi %0,8\n"
747 "4: ngr %2,%1\n" 659 " srl %2,8\n"
748 " ic %2,0(%2,%5)\n" 660 "4: ngr %2,%1\n"
749 " algr %0,%2\n" 661 " ic %2,0(%2,%5)\n"
750 "5:" 662 " algr %0,%2\n"
751 : "=&a" (res), "=&d" (cmp), "=&a" (count) 663 "5:"
664 : "=&a" (res), "=&d" (cmp), "=&a" (count)
752 : "a" (size), "a" (addr), "a" (&_sb_findmap), 665 : "a" (size), "a" (addr), "a" (&_sb_findmap),
753 "m" (*(addrtype *) addr) : "cc" ); 666 "m" (*(addrtype *) addr) : "cc");
754 return (res < size) ? res : size; 667 return (res < size) ? res : size;
755} 668}
756 669
@@ -834,8 +747,6 @@ static inline int sched_find_first_bit(unsigned long *b)
834 747
835#include <asm-generic/bitops/hweight.h> 748#include <asm-generic/bitops/hweight.h>
836 749
837#ifdef __KERNEL__
838
839/* 750/*
840 * ATTENTION: intel byte ordering convention for ext2 and minix !! 751 * ATTENTION: intel byte ordering convention for ext2 and minix !!
841 * bit 0 is the LSB of addr; bit 31 is the MSB of addr; 752 * bit 0 is the LSB of addr; bit 31 is the MSB of addr;
@@ -868,36 +779,37 @@ ext2_find_first_zero_bit(void *vaddr, unsigned int size)
868 779
869 if (!size) 780 if (!size)
870 return 0; 781 return 0;
871 __asm__(" lhi %1,-1\n" 782 asm volatile(
872 " lr %2,%3\n" 783 " lhi %1,-1\n"
873 " ahi %2,31\n" 784 " lr %2,%3\n"
874 " srl %2,5\n" 785 " ahi %2,31\n"
875 " slr %0,%0\n" 786 " srl %2,5\n"
876 "0: cl %1,0(%0,%4)\n" 787 " slr %0,%0\n"
877 " jne 1f\n" 788 "0: cl %1,0(%0,%4)\n"
878 " ahi %0,4\n" 789 " jne 1f\n"
879 " brct %2,0b\n" 790 " ahi %0,4\n"
880 " lr %0,%3\n" 791 " brct %2,0b\n"
881 " j 4f\n" 792 " lr %0,%3\n"
882 "1: l %2,0(%0,%4)\n" 793 " j 4f\n"
883 " sll %0,3\n" 794 "1: l %2,0(%0,%4)\n"
884 " ahi %0,24\n" 795 " sll %0,3\n"
885 " lhi %1,0xff\n" 796 " ahi %0,24\n"
886 " tmh %2,0xffff\n" 797 " lhi %1,0xff\n"
887 " jo 2f\n" 798 " tmh %2,0xffff\n"
888 " ahi %0,-16\n" 799 " jo 2f\n"
889 " srl %2,16\n" 800 " ahi %0,-16\n"
890 "2: tml %2,0xff00\n" 801 " srl %2,16\n"
891 " jo 3f\n" 802 "2: tml %2,0xff00\n"
892 " ahi %0,-8\n" 803 " jo 3f\n"
893 " srl %2,8\n" 804 " ahi %0,-8\n"
894 "3: nr %2,%1\n" 805 " srl %2,8\n"
895 " ic %2,0(%2,%5)\n" 806 "3: nr %2,%1\n"
896 " alr %0,%2\n" 807 " ic %2,0(%2,%5)\n"
897 "4:" 808 " alr %0,%2\n"
898 : "=&a" (res), "=&d" (cmp), "=&a" (count) 809 "4:"
899 : "a" (size), "a" (vaddr), "a" (&_zb_findmap), 810 : "=&a" (res), "=&d" (cmp), "=&a" (count)
900 "m" (*(addrtype *) vaddr) : "cc" ); 811 : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
812 "m" (*(addrtype *) vaddr) : "cc");
901 return (res < size) ? res : size; 813 return (res < size) ? res : size;
902} 814}
903 815
@@ -911,39 +823,40 @@ ext2_find_first_zero_bit(void *vaddr, unsigned long size)
911 823
912 if (!size) 824 if (!size)
913 return 0; 825 return 0;
914 __asm__(" lghi %1,-1\n" 826 asm volatile(
915 " lgr %2,%3\n" 827 " lghi %1,-1\n"
916 " aghi %2,63\n" 828 " lgr %2,%3\n"
917 " srlg %2,%2,6\n" 829 " aghi %2,63\n"
918 " slgr %0,%0\n" 830 " srlg %2,%2,6\n"
919 "0: clg %1,0(%0,%4)\n" 831 " slgr %0,%0\n"
920 " jne 1f\n" 832 "0: clg %1,0(%0,%4)\n"
921 " aghi %0,8\n" 833 " jne 1f\n"
922 " brct %2,0b\n" 834 " aghi %0,8\n"
923 " lgr %0,%3\n" 835 " brct %2,0b\n"
924 " j 5f\n" 836 " lgr %0,%3\n"
925 "1: cl %1,0(%0,%4)\n" 837 " j 5f\n"
926 " jne 2f\n" 838 "1: cl %1,0(%0,%4)\n"
927 " aghi %0,4\n" 839 " jne 2f\n"
928 "2: l %2,0(%0,%4)\n" 840 " aghi %0,4\n"
929 " sllg %0,%0,3\n" 841 "2: l %2,0(%0,%4)\n"
930 " aghi %0,24\n" 842 " sllg %0,%0,3\n"
931 " lghi %1,0xff\n" 843 " aghi %0,24\n"
932 " tmlh %2,0xffff\n" 844 " lghi %1,0xff\n"
933 " jo 3f\n" 845 " tmlh %2,0xffff\n"
934 " aghi %0,-16\n" 846 " jo 3f\n"
935 " srl %2,16\n" 847 " aghi %0,-16\n"
936 "3: tmll %2,0xff00\n" 848 " srl %2,16\n"
937 " jo 4f\n" 849 "3: tmll %2,0xff00\n"
938 " aghi %0,-8\n" 850 " jo 4f\n"
939 " srl %2,8\n" 851 " aghi %0,-8\n"
940 "4: ngr %2,%1\n" 852 " srl %2,8\n"
941 " ic %2,0(%2,%5)\n" 853 "4: ngr %2,%1\n"
942 " algr %0,%2\n" 854 " ic %2,0(%2,%5)\n"
943 "5:" 855 " algr %0,%2\n"
944 : "=&a" (res), "=&d" (cmp), "=&a" (count) 856 "5:"
857 : "=&a" (res), "=&d" (cmp), "=&a" (count)
945 : "a" (size), "a" (vaddr), "a" (&_zb_findmap), 858 : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
946 "m" (*(addrtype *) vaddr) : "cc" ); 859 "m" (*(addrtype *) vaddr) : "cc");
947 return (res < size) ? res : size; 860 return (res < size) ? res : size;
948} 861}
949 862
@@ -963,13 +876,16 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
963 p = addr + offset / __BITOPS_WORDSIZE; 876 p = addr + offset / __BITOPS_WORDSIZE;
964 if (bit) { 877 if (bit) {
965#ifndef __s390x__ 878#ifndef __s390x__
966 asm(" ic %0,0(%1)\n" 879 asm volatile(
967 " icm %0,2,1(%1)\n" 880 " ic %0,0(%1)\n"
968 " icm %0,4,2(%1)\n" 881 " icm %0,2,1(%1)\n"
969 " icm %0,8,3(%1)" 882 " icm %0,4,2(%1)\n"
970 : "=&a" (word) : "a" (p), "m" (*p) : "cc" ); 883 " icm %0,8,3(%1)"
884 : "=&a" (word) : "a" (p), "m" (*p) : "cc");
971#else 885#else
972 asm(" lrvg %0,%1" : "=a" (word) : "m" (*p) ); 886 asm volatile(
887 " lrvg %0,%1"
888 : "=a" (word) : "m" (*p) );
973#endif 889#endif
974 /* 890 /*
975 * s390 version of ffz returns __BITOPS_WORDSIZE 891 * s390 version of ffz returns __BITOPS_WORDSIZE
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h
index 7ddaa05b98..8768983639 100644
--- a/include/asm-s390/bug.h
+++ b/include/asm-s390/bug.h
@@ -5,9 +5,18 @@
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7 7
8static inline __attribute__((noreturn)) void __do_illegal_op(void)
9{
10#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
11 __builtin_trap();
12#else
13 asm volatile(".long 0");
14#endif
15}
16
8#define BUG() do { \ 17#define BUG() do { \
9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 18 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
10 __builtin_trap(); \ 19 __do_illegal_op(); \
11} while (0) 20} while (0)
12 21
13#define HAVE_ARCH_BUG 22#define HAVE_ARCH_BUG
diff --git a/include/asm-s390/byteorder.h b/include/asm-s390/byteorder.h
index 2cc35a0e18..1fe2492baa 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/ccwdev.h b/include/asm-s390/ccwdev.h
index 12456cb2f8..58c70acffc 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -63,7 +63,7 @@ ccw_device_id_match(const struct ccw_device_id *array,
63 return id; 63 return id;
64 } 64 }
65 65
66 return 0; 66 return NULL;
67} 67}
68 68
69/* The struct ccw device is our replacement for the globally accessible 69/* The struct ccw device is our replacement for the globally accessible
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 471f2af2b1..37c362d89f 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/cio.h b/include/asm-s390/cio.h
index 089cf567c3..da063cd5f0 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -270,12 +270,23 @@ struct diag210 {
270 __u32 vrdccrft : 8; /* real device feature (output) */ 270 __u32 vrdccrft : 8; /* real device feature (output) */
271} __attribute__ ((packed,aligned(4))); 271} __attribute__ ((packed,aligned(4)));
272 272
273struct ccw_dev_id {
274 u8 ssid;
275 u16 devno;
276};
277
273extern int diag210(struct diag210 *addr); 278extern int diag210(struct diag210 *addr);
274 279
275extern void wait_cons_dev(void); 280extern void wait_cons_dev(void);
276 281
277extern void clear_all_subchannels(void); 282extern void clear_all_subchannels(void);
278 283
284extern void cio_reset_channel_paths(void);
285
286extern void css_schedule_reprobe(void);
287
288extern void reipl_ccw_dev(struct ccw_dev_id *id);
289
279#endif 290#endif
280 291
281#endif 292#endif
diff --git a/include/asm-s390/cmb.h b/include/asm-s390/cmb.h
index 2d09950a9c..241756f80d 100644
--- a/include/asm-s390/cmb.h
+++ b/include/asm-s390/cmb.h
@@ -44,10 +44,6 @@ struct cmbdata {
44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER,32) 44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER,32)
45/* enable channel measurement */ 45/* enable channel measurement */
46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER,33) 46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER,33)
47/* reset channel measurement block */
48#define BIODASDRESETCMB _IO(DASD_IOCTL_LETTER,34)
49/* read channel measurement data */
50#define BIODASDREADCMB _IOWR(DASD_IOCTL_LETTER,32,__u64)
51/* read channel measurement data */ 47/* read channel measurement data */
52#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER,33,struct cmbdata) 48#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER,33,struct cmbdata)
53 49
diff --git a/include/asm-s390/dasd.h b/include/asm-s390/dasd.h
index 1630c26e8f..c042f95780 100644
--- a/include/asm-s390/dasd.h
+++ b/include/asm-s390/dasd.h
@@ -68,10 +68,12 @@ typedef struct dasd_information2_t {
68 * 0x00: default features 68 * 0x00: default features
69 * 0x01: readonly (ro) 69 * 0x01: readonly (ro)
70 * 0x02: use diag discipline (diag) 70 * 0x02: use diag discipline (diag)
71 * 0x04: set the device initially online (internal use only)
71 */ 72 */
72#define DASD_FEATURE_DEFAULT 0 73#define DASD_FEATURE_DEFAULT 0x00
73#define DASD_FEATURE_READONLY 1 74#define DASD_FEATURE_READONLY 0x01
74#define DASD_FEATURE_USEDIAG 2 75#define DASD_FEATURE_USEDIAG 0x02
76#define DASD_FEATURE_INITIAL_ONLINE 0x04
75 77
76#define DASD_PARTN_BITS 2 78#define DASD_PARTN_BITS 2
77 79
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h
index 7f1ef99fd1..c00dd2b3dc 100644
--- a/include/asm-s390/debug.h
+++ b/include/asm-s390/debug.h
@@ -10,7 +10,6 @@
10#define DEBUG_H 10#define DEBUG_H
11 11
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/string.h>
14 13
15/* Note: 14/* Note:
16 * struct __debug_entry must be defined outside of #ifdef __KERNEL__ 15 * struct __debug_entry must be defined outside of #ifdef __KERNEL__
@@ -35,6 +34,7 @@ struct __debug_entry{
35#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */ 34#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
36 35
37#ifdef __KERNEL__ 36#ifdef __KERNEL__
37#include <linux/string.h>
38#include <linux/spinlock.h> 38#include <linux/spinlock.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/time.h> 40#include <linux/time.h>
diff --git a/include/asm-s390/div64.h b/include/asm-s390/div64.h
index af098dc3cf..6cd978cefb 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/dma.h b/include/asm-s390/dma.h
index 02720c449c..7425c6af6c 100644
--- a/include/asm-s390/dma.h
+++ b/include/asm-s390/dma.h
@@ -11,6 +11,6 @@
11 11
12#define MAX_DMA_ADDRESS 0x80000000 12#define MAX_DMA_ADDRESS 0x80000000
13 13
14#define free_dma(x) 14#define free_dma(x) do { } while (0)
15 15
16#endif /* _ASM_DMA_H */ 16#endif /* _ASM_DMA_H */
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h
index 15fd2eda6c..7f6f641d32 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/elf.h b/include/asm-s390/elf.h
index 710646e64f..c0d629d61d 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -93,19 +93,6 @@
93#define R_390_NUM 61 93#define R_390_NUM 61
94 94
95/* 95/*
96 * ELF register definitions..
97 */
98
99#include <linux/sched.h> /* for task_struct */
100#include <asm/ptrace.h>
101#include <asm/user.h>
102#include <asm/system.h> /* for save_access_regs */
103
104
105typedef s390_fp_regs elf_fpregset_t;
106typedef s390_regs elf_gregset_t;
107
108/*
109 * These are used to set parameters in the core dumps. 96 * These are used to set parameters in the core dumps.
110 */ 97 */
111#ifndef __s390x__ 98#ifndef __s390x__
@@ -117,6 +104,20 @@ typedef s390_regs elf_gregset_t;
117#define ELF_ARCH EM_S390 104#define ELF_ARCH EM_S390
118 105
119/* 106/*
107 * ELF register definitions..
108 */
109
110#include <asm/ptrace.h>
111#include <asm/user.h>
112
113typedef s390_fp_regs elf_fpregset_t;
114typedef s390_regs elf_gregset_t;
115
116#ifdef __KERNEL__
117#include <linux/sched.h> /* for task_struct */
118#include <asm/system.h> /* for save_access_regs */
119
120/*
120 * This is used to ensure we don't load something for the wrong architecture. 121 * This is used to ensure we don't load something for the wrong architecture.
121 */ 122 */
122#define elf_check_arch(x) \ 123#define elf_check_arch(x) \
@@ -198,7 +199,6 @@ static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
198 199
199#define ELF_PLATFORM (NULL) 200#define ELF_PLATFORM (NULL)
200 201
201#ifdef __KERNEL__
202#ifndef __s390x__ 202#ifndef __s390x__
203#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 203#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
204#else /* __s390x__ */ 204#else /* __s390x__ */
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
index 1802775568..5e261e1de6 100644
--- a/include/asm-s390/futex.h
+++ b/include/asm-s390/futex.h
@@ -7,75 +7,21 @@
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10#ifndef __s390x__
11#define __futex_atomic_fixup \
12 ".section __ex_table,\"a\"\n" \
13 " .align 4\n" \
14 " .long 0b,4b,2b,4b,3b,4b\n" \
15 ".previous"
16#else /* __s390x__ */
17#define __futex_atomic_fixup \
18 ".section __ex_table,\"a\"\n" \
19 " .align 8\n" \
20 " .quad 0b,4b,2b,4b,3b,4b\n" \
21 ".previous"
22#endif /* __s390x__ */
23
24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
25 asm volatile(" sacf 256\n" \
26 "0: l %1,0(%6)\n" \
27 "1: " insn \
28 "2: cs %1,%2,0(%6)\n" \
29 "3: jl 1b\n" \
30 " lhi %0,0\n" \
31 "4: sacf 0\n" \
32 __futex_atomic_fixup \
33 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
34 "=m" (*uaddr) \
35 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
36 "m" (*uaddr) : "cc" );
37
38static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 10static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
39{ 11{
40 int op = (encoded_op >> 28) & 7; 12 int op = (encoded_op >> 28) & 7;
41 int cmp = (encoded_op >> 24) & 15; 13 int cmp = (encoded_op >> 24) & 15;
42 int oparg = (encoded_op << 8) >> 20; 14 int oparg = (encoded_op << 8) >> 20;
43 int cmparg = (encoded_op << 20) >> 20; 15 int cmparg = (encoded_op << 20) >> 20;
44 int oldval = 0, newval, ret; 16 int oldval, ret;
17
45 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
46 oparg = 1 << oparg; 19 oparg = 1 << oparg;
47 20
48 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
49 return -EFAULT; 22 return -EFAULT;
50 23
51 inc_preempt_count(); 24 ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval);
52
53 switch (op) {
54 case FUTEX_OP_SET:
55 __futex_atomic_op("lr %2,%5\n",
56 ret, oldval, newval, uaddr, oparg);
57 break;
58 case FUTEX_OP_ADD:
59 __futex_atomic_op("lr %2,%1\nar %2,%5\n",
60 ret, oldval, newval, uaddr, oparg);
61 break;
62 case FUTEX_OP_OR:
63 __futex_atomic_op("lr %2,%1\nor %2,%5\n",
64 ret, oldval, newval, uaddr, oparg);
65 break;
66 case FUTEX_OP_ANDN:
67 __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
68 ret, oldval, newval, uaddr, oparg);
69 break;
70 case FUTEX_OP_XOR:
71 __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
72 ret, oldval, newval, uaddr, oparg);
73 break;
74 default:
75 ret = -ENOSYS;
76 }
77
78 dec_preempt_count();
79 25
80 if (!ret) { 26 if (!ret) {
81 switch (cmp) { 27 switch (cmp) {
@@ -91,31 +37,13 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
91 return ret; 37 return ret;
92} 38}
93 39
94static inline int 40static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr,
95futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) 41 int oldval, int newval)
96{ 42{
97 int ret;
98
99 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 43 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
100 return -EFAULT; 44 return -EFAULT;
101 asm volatile(" cs %1,%4,0(%5)\n" 45
102 "0: lr %0,%1\n" 46 return uaccess.futex_atomic_cmpxchg(uaddr, oldval, newval);
103 "1:\n"
104#ifndef __s390x__
105 ".section __ex_table,\"a\"\n"
106 " .align 4\n"
107 " .long 0b,1b\n"
108 ".previous"
109#else /* __s390x__ */
110 ".section __ex_table,\"a\"\n"
111 " .align 8\n"
112 " .quad 0b,1b\n"
113 ".previous"
114#endif /* __s390x__ */
115 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
116 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
117 : "cc", "memory" );
118 return oldval;
119} 47}
120 48
121#endif /* __KERNEL__ */ 49#endif /* __KERNEL__ */
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index d4614b35f4..63c78b9399 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
@@ -116,7 +114,7 @@ extern void iounmap(void *addr);
116#define outb(x,addr) ((void) writeb(x,addr)) 114#define outb(x,addr) ((void) writeb(x,addr))
117#define outb_p(x,addr) outb(x,addr) 115#define outb_p(x,addr) outb(x,addr)
118 116
119#define mmiowb() 117#define mmiowb() do { } while (0)
120 118
121/* 119/*
122 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 120 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h
index bd1a721f7a..7da991a858 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
new file mode 100644
index 0000000000..3f26131120
--- /dev/null
+++ b/include/asm-s390/irqflags.h
@@ -0,0 +1,106 @@
1/*
2 * include/asm-s390/irqflags.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef __ASM_IRQFLAGS_H
9#define __ASM_IRQFLAGS_H
10
11#ifdef __KERNEL__
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
75/* interrupt control.. */
76static inline unsigned long raw_local_irq_enable(void)
77{
78 return __raw_local_irq_stosm(0x03);
79}
80
81static inline unsigned long raw_local_irq_disable(void)
82{
83 return __raw_local_irq_stnsm(0xfc);
84}
85
86#define raw_local_save_flags(x) \
87do { \
88 typecheck(unsigned long, x); \
89 (x) = __raw_local_irq_stosm(0x00); \
90} while (0)
91
92static inline void raw_local_irq_restore(unsigned long flags)
93{
94 __raw_local_irq_ssm(flags);
95}
96
97static inline int raw_irqs_disabled_flags(unsigned long flags)
98{
99 return !(flags & (3UL << (BITS_PER_LONG - 8)));
100}
101
102/* For spinlocks etc */
103#define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
104
105#endif /* __KERNEL__ */
106#endif /* __ASM_IRQFLAGS_H */
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h
new file mode 100644
index 0000000000..40cc68025e
--- /dev/null
+++ b/include/asm-s390/kdebug.h
@@ -0,0 +1,59 @@
1#ifndef _S390_KDEBUG_H
2#define _S390_KDEBUG_H
3
4/*
5 * Feb 2006 Ported to s390 <grundym@us.ibm.com>
6 */
7#include <linux/notifier.h>
8
9struct pt_regs;
10
11struct die_args {
12 struct pt_regs *regs;
13 const char *str;
14 long err;
15 int trapnr;
16 int signr;
17};
18
19/* Note - you should never unregister because that can race with NMIs.
20 * If you really want to do it first unregister - then synchronize_sched
21 * - then free.
22 */
23extern int register_die_notifier(struct notifier_block *);
24extern int unregister_die_notifier(struct notifier_block *);
25extern int register_page_fault_notifier(struct notifier_block *);
26extern int unregister_page_fault_notifier(struct notifier_block *);
27extern struct atomic_notifier_head s390die_chain;
28
29
30enum die_val {
31 DIE_OOPS = 1,
32 DIE_BPT,
33 DIE_SSTEP,
34 DIE_PANIC,
35 DIE_NMI,
36 DIE_DIE,
37 DIE_NMIWATCHDOG,
38 DIE_KERNELDEBUG,
39 DIE_TRAP,
40 DIE_GPF,
41 DIE_CALL,
42 DIE_NMI_IPI,
43 DIE_PAGE_FAULT,
44};
45
46static inline int notify_die(enum die_val val, const char *str,
47 struct pt_regs *regs, long err, int trap, int sig)
48{
49 struct die_args args = {
50 .regs = regs,
51 .str = str,
52 .err = err,
53 .trapnr = trap,
54 .signr = sig
55 };
56 return atomic_notifier_call_chain(&s390die_chain, val, &args);
57}
58
59#endif
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h
new file mode 100644
index 0000000000..b847ff0ec3
--- /dev/null
+++ b/include/asm-s390/kprobes.h
@@ -0,0 +1,114 @@
1#ifndef _ASM_S390_KPROBES_H
2#define _ASM_S390_KPROBES_H
3/*
4 * Kernel Probes (KProbes)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright (C) IBM Corporation, 2002, 2006
21 *
22 * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
23 * Probes initial implementation ( includes suggestions from
24 * Rusty Russell).
25 * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli
26 * <ananth@in.ibm.com>
27 * 2005-Dec Used as a template for s390 by Mike Grundy
28 * <grundym@us.ibm.com>
29 */
30#include <linux/types.h>
31#include <linux/ptrace.h>
32#include <linux/percpu.h>
33
34#define __ARCH_WANT_KPROBES_INSN_SLOT
35struct pt_regs;
36struct kprobe;
37
38typedef u16 kprobe_opcode_t;
39#define BREAKPOINT_INSTRUCTION 0x0002
40
41/* Maximum instruction size is 3 (16bit) halfwords: */
42#define MAX_INSN_SIZE 0x0003
43#define MAX_STACK_SIZE 64
44#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
45 (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \
46 ? (MAX_STACK_SIZE) \
47 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
48
49#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry)
50
51#define ARCH_SUPPORTS_KRETPROBES
52#define ARCH_INACTIVE_KPROBE_COUNT 0
53
54#define KPROBE_SWAP_INST 0x10
55
56#define FIXUP_PSW_NORMAL 0x08
57#define FIXUP_BRANCH_NOT_TAKEN 0x04
58#define FIXUP_RETURN_REGISTER 0x02
59#define FIXUP_NOT_REQUIRED 0x01
60
61/* Architecture specific copy of original instruction */
62struct arch_specific_insn {
63 /* copy of original instruction */
64 kprobe_opcode_t *insn;
65 int fixup;
66 int ilen;
67 int reg;
68};
69
70struct ins_replace_args {
71 kprobe_opcode_t *ptr;
72 kprobe_opcode_t old;
73 kprobe_opcode_t new;
74};
75struct prev_kprobe {
76 struct kprobe *kp;
77 unsigned long status;
78 unsigned long saved_psw;
79 unsigned long kprobe_saved_imask;
80 unsigned long kprobe_saved_ctl[3];
81};
82
83/* per-cpu kprobe control block */
84struct kprobe_ctlblk {
85 unsigned long kprobe_status;
86 unsigned long kprobe_saved_imask;
87 unsigned long kprobe_saved_ctl[3];
88 struct pt_regs jprobe_saved_regs;
89 unsigned long jprobe_saved_r14;
90 unsigned long jprobe_saved_r15;
91 struct prev_kprobe prev_kprobe;
92 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
93};
94
95void arch_remove_kprobe(struct kprobe *p);
96void kretprobe_trampoline(void);
97int is_prohibited_opcode(kprobe_opcode_t *instruction);
98void get_instruction_type(struct arch_specific_insn *ainsn);
99
100#define flush_insn_slot(p) do { } while (0)
101
102#endif /* _ASM_S390_KPROBES_H */
103
104#ifdef CONFIG_KPROBES
105
106extern int kprobe_exceptions_notify(struct notifier_block *self,
107 unsigned long val, void *data);
108#else /* !CONFIG_KPROBES */
109static inline int kprobe_exceptions_notify(struct notifier_block *self,
110 unsigned long val, void *data)
111{
112 return 0;
113}
114#endif
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 596c8b1721..06583ed0bd 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -35,6 +35,7 @@
35#define __LC_IO_NEW_PSW 0x01f0 35#define __LC_IO_NEW_PSW 0x01f0
36#endif /* !__s390x__ */ 36#endif /* !__s390x__ */
37 37
38#define __LC_IPL_PARMBLOCK_PTR 0x014
38#define __LC_EXT_PARAMS 0x080 39#define __LC_EXT_PARAMS 0x080
39#define __LC_CPU_ADDRESS 0x084 40#define __LC_CPU_ADDRESS 0x084
40#define __LC_EXT_INT_CODE 0x086 41#define __LC_EXT_INT_CODE 0x086
@@ -47,6 +48,7 @@
47#define __LC_PER_ATMID 0x096 48#define __LC_PER_ATMID 0x096
48#define __LC_PER_ADDRESS 0x098 49#define __LC_PER_ADDRESS 0x098
49#define __LC_PER_ACCESS_ID 0x0A1 50#define __LC_PER_ACCESS_ID 0x0A1
51#define __LC_AR_MODE_ID 0x0A3
50 52
51#define __LC_SUBCHANNEL_ID 0x0B8 53#define __LC_SUBCHANNEL_ID 0x0B8
52#define __LC_SUBCHANNEL_NR 0x0BA 54#define __LC_SUBCHANNEL_NR 0x0BA
@@ -106,18 +108,28 @@
106#define __LC_INT_CLOCK 0xDE8 108#define __LC_INT_CLOCK 0xDE8
107#endif /* __s390x__ */ 109#endif /* __s390x__ */
108 110
109#define __LC_PANIC_MAGIC 0xE00
110 111
112#define __LC_PANIC_MAGIC 0xE00
111#ifndef __s390x__ 113#ifndef __s390x__
112#define __LC_PFAULT_INTPARM 0x080 114#define __LC_PFAULT_INTPARM 0x080
113#define __LC_CPU_TIMER_SAVE_AREA 0x0D8 115#define __LC_CPU_TIMER_SAVE_AREA 0x0D8
116#define __LC_CLOCK_COMP_SAVE_AREA 0x0E0
117#define __LC_PSW_SAVE_AREA 0x100
118#define __LC_PREFIX_SAVE_AREA 0x108
114#define __LC_AREGS_SAVE_AREA 0x120 119#define __LC_AREGS_SAVE_AREA 0x120
120#define __LC_FPREGS_SAVE_AREA 0x160
115#define __LC_GPREGS_SAVE_AREA 0x180 121#define __LC_GPREGS_SAVE_AREA 0x180
116#define __LC_CREGS_SAVE_AREA 0x1C0 122#define __LC_CREGS_SAVE_AREA 0x1C0
117#else /* __s390x__ */ 123#else /* __s390x__ */
118#define __LC_PFAULT_INTPARM 0x11B8 124#define __LC_PFAULT_INTPARM 0x11B8
125#define __LC_FPREGS_SAVE_AREA 0x1200
119#define __LC_GPREGS_SAVE_AREA 0x1280 126#define __LC_GPREGS_SAVE_AREA 0x1280
127#define __LC_PSW_SAVE_AREA 0x1300
128#define __LC_PREFIX_SAVE_AREA 0x1318
129#define __LC_FP_CREG_SAVE_AREA 0x131C
130#define __LC_TODREG_SAVE_AREA 0x1324
120#define __LC_CPU_TIMER_SAVE_AREA 0x1328 131#define __LC_CPU_TIMER_SAVE_AREA 0x1328
132#define __LC_CLOCK_COMP_SAVE_AREA 0x1331
121#define __LC_AREGS_SAVE_AREA 0x1340 133#define __LC_AREGS_SAVE_AREA 0x1340
122#define __LC_CREGS_SAVE_AREA 0x1380 134#define __LC_CREGS_SAVE_AREA 0x1380
123#endif /* __s390x__ */ 135#endif /* __s390x__ */
@@ -347,7 +359,7 @@ extern struct _lowcore *lowcore_ptr[];
347 359
348static inline void set_prefix(__u32 address) 360static inline void set_prefix(__u32 address)
349{ 361{
350 __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); 362 asm volatile("spx %0" : : "m" (address) : "memory");
351} 363}
352 364
353#define __PANIC_MAGIC 0xDEADC0DE 365#define __PANIC_MAGIC 0xDEADC0DE
diff --git a/include/asm-s390/monwriter.h b/include/asm-s390/monwriter.h
new file mode 100644
index 0000000000..f0cbf96c52
--- /dev/null
+++ b/include/asm-s390/monwriter.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-s390/monwriter.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Character device driver for writing z/VM APPLDATA monitor records
6 * Version 1.0
7 * Author(s): Melissa Howland <melissah@us.ibm.com>
8 *
9 */
10
11#ifndef _ASM_390_MONWRITER_H
12#define _ASM_390_MONWRITER_H
13
14/* mon_function values */
15#define MONWRITE_START_INTERVAL 0x00 /* start interval recording */
16#define MONWRITE_STOP_INTERVAL 0x01 /* stop interval or config recording */
17#define MONWRITE_GEN_EVENT 0x02 /* generate event record */
18#define MONWRITE_START_CONFIG 0x03 /* start configuration recording */
19
20/* the header the app uses in its write() data */
21struct monwrite_hdr {
22 unsigned char mon_function;
23 unsigned short applid;
24 unsigned char record_num;
25 unsigned short version;
26 unsigned short release;
27 unsigned short mod_level;
28 unsigned short datalen;
29 unsigned char hdrlen;
30
31} __attribute__((packed));
32
33#endif /* _ASM_390_MONWRITER_H */
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index b2628dc5c4..796c400f2b 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
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 436d216601..495ad99c76 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -15,18 +15,20 @@
15 */ 15 */
16#if defined(__s390x__) && defined(MODULE) 16#if defined(__s390x__) && defined(MODULE)
17 17
18#define __reloc_hide(var,offset) \ 18#define __reloc_hide(var,offset) (*({ \
19 (*({ unsigned long *__ptr; \ 19 extern int simple_indentifier_##var(void); \
20 asm ( "larl %0,per_cpu__"#var"@GOTENT" \ 20 unsigned long *__ptr; \
21 : "=a" (__ptr) : "X" (per_cpu__##var) ); \ 21 asm ( "larl %0,per_cpu__"#var"@GOTENT" \
22 (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) 22 : "=a" (__ptr) : "X" (per_cpu__##var) ); \
23 (typeof(&per_cpu__##var))((*__ptr) + (offset)); }))
23 24
24#else 25#else
25 26
26#define __reloc_hide(var, offset) \ 27#define __reloc_hide(var, offset) (*({ \
27 (*({ unsigned long __ptr; \ 28 extern int simple_indentifier_##var(void); \
28 asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ 29 unsigned long __ptr; \
29 (typeof(&per_cpu__##var)) (__ptr + (offset)); })) 30 asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \
31 (typeof(&per_cpu__##var)) (__ptr + (offset)); }))
30 32
31#endif 33#endif
32 34
@@ -40,7 +42,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
40 __typeof__(type) per_cpu__##name 42 __typeof__(type) per_cpu__##name
41 43
42#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) 44#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
45#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
43#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) 46#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
47#define per_cpu_offset(x) (__per_cpu_offset[x])
44 48
45/* A macro to avoid #include hell... */ 49/* A macro to avoid #include hell... */
46#define percpu_modcopy(pcpudst, src, size) \ 50#define percpu_modcopy(pcpudst, src, size) \
@@ -57,6 +61,7 @@ do { \
57 __typeof__(type) per_cpu__##name 61 __typeof__(type) per_cpu__##name
58 62
59#define __get_cpu_var(var) __reloc_hide(var,0) 63#define __get_cpu_var(var) __reloc_hide(var,0)
64#define __raw_get_cpu_var(var) __reloc_hide(var,0)
60#define per_cpu(var,cpu) __reloc_hide(var,0) 65#define per_cpu(var,cpu) __reloc_hide(var,0)
61 66
62#endif /* SMP */ 67#endif /* SMP */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 3002fda89d..803bc70644 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -22,6 +22,16 @@
22extern void diag10(unsigned long addr); 22extern void diag10(unsigned long addr);
23 23
24/* 24/*
25 * Page allocation orders.
26 */
27#ifndef __s390x__
28# define PGD_ALLOC_ORDER 1
29#else /* __s390x__ */
30# define PMD_ALLOC_ORDER 2
31# define PGD_ALLOC_ORDER 2
32#endif /* __s390x__ */
33
34/*
25 * Allocate and free page tables. The xxx_kernel() versions are 35 * Allocate and free page tables. The xxx_kernel() versions are
26 * used to allocate a kernel page table - this turns on ASN bits 36 * used to allocate a kernel page table - this turns on ASN bits
27 * if any. 37 * if any.
@@ -29,30 +39,23 @@ extern void diag10(unsigned long addr);
29 39
30static inline pgd_t *pgd_alloc(struct mm_struct *mm) 40static inline pgd_t *pgd_alloc(struct mm_struct *mm)
31{ 41{
32 pgd_t *pgd; 42 pgd_t *pgd = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ALLOC_ORDER);
33 int i; 43 int i;
34 44
45 if (!pgd)
46 return NULL;
47 for (i = 0; i < PTRS_PER_PGD; i++)
35#ifndef __s390x__ 48#ifndef __s390x__
36 pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,1); 49 pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE));
37 if (pgd != NULL) 50#else
38 for (i = 0; i < USER_PTRS_PER_PGD; i++) 51 pgd_clear(pgd + i);
39 pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); 52#endif
40#else /* __s390x__ */
41 pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2);
42 if (pgd != NULL)
43 for (i = 0; i < PTRS_PER_PGD; i++)
44 pgd_clear(pgd + i);
45#endif /* __s390x__ */
46 return pgd; 53 return pgd;
47} 54}
48 55
49static inline void pgd_free(pgd_t *pgd) 56static inline void pgd_free(pgd_t *pgd)
50{ 57{
51#ifndef __s390x__ 58 free_pages((unsigned long) pgd, PGD_ALLOC_ORDER);
52 free_pages((unsigned long) pgd, 1);
53#else /* __s390x__ */
54 free_pages((unsigned long) pgd, 2);
55#endif /* __s390x__ */
56} 59}
57 60
58#ifndef __s390x__ 61#ifndef __s390x__
@@ -68,20 +71,19 @@ static inline void pgd_free(pgd_t *pgd)
68#else /* __s390x__ */ 71#else /* __s390x__ */
69static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) 72static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
70{ 73{
71 pmd_t *pmd; 74 pmd_t *pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ALLOC_ORDER);
72 int i; 75 int i;
73 76
74 pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2); 77 if (!pmd)
75 if (pmd != NULL) { 78 return NULL;
76 for (i=0; i < PTRS_PER_PMD; i++) 79 for (i=0; i < PTRS_PER_PMD; i++)
77 pmd_clear(pmd+i); 80 pmd_clear(pmd + i);
78 }
79 return pmd; 81 return pmd;
80} 82}
81 83
82static inline void pmd_free (pmd_t *pmd) 84static inline void pmd_free (pmd_t *pmd)
83{ 85{
84 free_pages((unsigned long) pmd, 2); 86 free_pages((unsigned long) pmd, PMD_ALLOC_ORDER);
85} 87}
86 88
87#define __pmd_free_tlb(tlb,pmd) \ 89#define __pmd_free_tlb(tlb,pmd) \
@@ -123,15 +125,14 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
123static inline pte_t * 125static inline pte_t *
124pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) 126pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr)
125{ 127{
126 pte_t *pte; 128 pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL|__GFP_REPEAT);
127 int i; 129 int i;
128 130
129 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 131 if (!pte)
130 if (pte != NULL) { 132 return NULL;
131 for (i=0; i < PTRS_PER_PTE; i++) { 133 for (i=0; i < PTRS_PER_PTE; i++) {
132 pte_clear(mm, vmaddr, pte+i); 134 pte_clear(mm, vmaddr, pte + i);
133 vmaddr += PAGE_SIZE; 135 vmaddr += PAGE_SIZE;
134 }
135 } 136 }
136 return pte; 137 return pte;
137} 138}
@@ -142,7 +143,7 @@ pte_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
142 pte_t *pte = pte_alloc_one_kernel(mm, vmaddr); 143 pte_t *pte = pte_alloc_one_kernel(mm, vmaddr);
143 if (pte) 144 if (pte)
144 return virt_to_page(pte); 145 return virt_to_page(pte);
145 return 0; 146 return NULL;
146} 147}
147 148
148static inline void pte_free_kernel(pte_t *pte) 149static inline void pte_free_kernel(pte_t *pte)
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 859b5e9698..ecdff13b25 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;
@@ -89,19 +89,6 @@ extern char empty_zero_page[PAGE_SIZE];
89# define PTRS_PER_PGD 2048 89# define PTRS_PER_PGD 2048
90#endif /* __s390x__ */ 90#endif /* __s390x__ */
91 91
92/*
93 * pgd entries used up by user/kernel:
94 */
95#ifndef __s390x__
96# define USER_PTRS_PER_PGD 512
97# define USER_PGD_PTRS 512
98# define KERNEL_PGD_PTRS 512
99#else /* __s390x__ */
100# define USER_PTRS_PER_PGD 2048
101# define USER_PGD_PTRS 2048
102# define KERNEL_PGD_PTRS 2048
103#endif /* __s390x__ */
104
105#define FIRST_USER_ADDRESS 0 92#define FIRST_USER_ADDRESS 0
106 93
107#define pte_ERROR(e) \ 94#define pte_ERROR(e) \
@@ -216,12 +203,14 @@ extern char empty_zero_page[PAGE_SIZE];
216#define _PAGE_RO 0x200 /* HW read-only */ 203#define _PAGE_RO 0x200 /* HW read-only */
217#define _PAGE_INVALID 0x400 /* HW invalid */ 204#define _PAGE_INVALID 0x400 /* HW invalid */
218 205
219/* Mask and four different kinds of invalid pages. */ 206/* Mask and six different types of pages. */
220#define _PAGE_INVALID_MASK 0x601 207#define _PAGE_TYPE_MASK 0x601
221#define _PAGE_INVALID_EMPTY 0x400 208#define _PAGE_TYPE_EMPTY 0x400
222#define _PAGE_INVALID_NONE 0x401 209#define _PAGE_TYPE_NONE 0x401
223#define _PAGE_INVALID_SWAP 0x600 210#define _PAGE_TYPE_SWAP 0x600
224#define _PAGE_INVALID_FILE 0x601 211#define _PAGE_TYPE_FILE 0x601
212#define _PAGE_TYPE_RO 0x200
213#define _PAGE_TYPE_RW 0x000
225 214
226#ifndef __s390x__ 215#ifndef __s390x__
227 216
@@ -280,15 +269,14 @@ extern char empty_zero_page[PAGE_SIZE];
280#endif /* __s390x__ */ 269#endif /* __s390x__ */
281 270
282/* 271/*
283 * No mapping available 272 * Page protection definitions.
284 */ 273 */
285#define PAGE_NONE_SHARED __pgprot(_PAGE_INVALID_NONE) 274#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE)
286#define PAGE_NONE_PRIVATE __pgprot(_PAGE_INVALID_NONE) 275#define PAGE_RO __pgprot(_PAGE_TYPE_RO)
287#define PAGE_RO_SHARED __pgprot(_PAGE_RO) 276#define PAGE_RW __pgprot(_PAGE_TYPE_RW)
288#define PAGE_RO_PRIVATE __pgprot(_PAGE_RO) 277
289#define PAGE_COPY __pgprot(_PAGE_RO) 278#define PAGE_KERNEL PAGE_RW
290#define PAGE_SHARED __pgprot(0) 279#define PAGE_COPY PAGE_RO
291#define PAGE_KERNEL __pgprot(0)
292 280
293/* 281/*
294 * The S390 can't do page protection for execute, and considers that the 282 * The S390 can't do page protection for execute, and considers that the
@@ -296,23 +284,23 @@ extern char empty_zero_page[PAGE_SIZE];
296 * the closest we can get.. 284 * the closest we can get..
297 */ 285 */
298 /*xwr*/ 286 /*xwr*/
299#define __P000 PAGE_NONE_PRIVATE 287#define __P000 PAGE_NONE
300#define __P001 PAGE_RO_PRIVATE 288#define __P001 PAGE_RO
301#define __P010 PAGE_COPY 289#define __P010 PAGE_RO
302#define __P011 PAGE_COPY 290#define __P011 PAGE_RO
303#define __P100 PAGE_RO_PRIVATE 291#define __P100 PAGE_RO
304#define __P101 PAGE_RO_PRIVATE 292#define __P101 PAGE_RO
305#define __P110 PAGE_COPY 293#define __P110 PAGE_RO
306#define __P111 PAGE_COPY 294#define __P111 PAGE_RO
307 295
308#define __S000 PAGE_NONE_SHARED 296#define __S000 PAGE_NONE
309#define __S001 PAGE_RO_SHARED 297#define __S001 PAGE_RO
310#define __S010 PAGE_SHARED 298#define __S010 PAGE_RW
311#define __S011 PAGE_SHARED 299#define __S011 PAGE_RW
312#define __S100 PAGE_RO_SHARED 300#define __S100 PAGE_RO
313#define __S101 PAGE_RO_SHARED 301#define __S101 PAGE_RO
314#define __S110 PAGE_SHARED 302#define __S110 PAGE_RW
315#define __S111 PAGE_SHARED 303#define __S111 PAGE_RW
316 304
317/* 305/*
318 * Certain architectures need to do special things when PTEs 306 * Certain architectures need to do special things when PTEs
@@ -377,18 +365,18 @@ static inline int pmd_bad(pmd_t pmd)
377 365
378static inline int pte_none(pte_t pte) 366static inline int pte_none(pte_t pte)
379{ 367{
380 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; 368 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_EMPTY;
381} 369}
382 370
383static inline int pte_present(pte_t pte) 371static inline int pte_present(pte_t pte)
384{ 372{
385 return !(pte_val(pte) & _PAGE_INVALID) || 373 return !(pte_val(pte) & _PAGE_INVALID) ||
386 (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; 374 (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_NONE;
387} 375}
388 376
389static inline int pte_file(pte_t pte) 377static inline int pte_file(pte_t pte)
390{ 378{
391 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; 379 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_FILE;
392} 380}
393 381
394#define pte_same(a,b) (pte_val(a) == pte_val(b)) 382#define pte_same(a,b) (pte_val(a) == pte_val(b))
@@ -461,7 +449,7 @@ static inline void pmd_clear(pmd_t * pmdp)
461 449
462static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 450static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
463{ 451{
464 pte_val(*ptep) = _PAGE_INVALID_EMPTY; 452 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
465} 453}
466 454
467/* 455/*
@@ -477,7 +465,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
477 465
478static inline pte_t pte_wrprotect(pte_t pte) 466static inline pte_t pte_wrprotect(pte_t pte)
479{ 467{
480 /* Do not clobber _PAGE_INVALID_NONE pages! */ 468 /* Do not clobber _PAGE_TYPE_NONE pages! */
481 if (!(pte_val(pte) & _PAGE_INVALID)) 469 if (!(pte_val(pte) & _PAGE_INVALID))
482 pte_val(pte) |= _PAGE_RO; 470 pte_val(pte) |= _PAGE_RO;
483 return pte; 471 return pte;
@@ -556,26 +544,31 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
556 return pte; 544 return pte;
557} 545}
558 546
559static inline pte_t 547static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
560ptep_clear_flush(struct vm_area_struct *vma,
561 unsigned long address, pte_t *ptep)
562{ 548{
563 pte_t pte = *ptep; 549 if (!(pte_val(*ptep) & _PAGE_INVALID)) {
564#ifndef __s390x__ 550#ifndef __s390x__
565 if (!(pte_val(pte) & _PAGE_INVALID)) {
566 /* S390 has 1mb segments, we are emulating 4MB segments */ 551 /* S390 has 1mb segments, we are emulating 4MB segments */
567 pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); 552 pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00);
568 __asm__ __volatile__ ("ipte %2,%3" 553#else
569 : "=m" (*ptep) : "m" (*ptep), 554 /* ipte in zarch mode can do the math */
570 "a" (pto), "a" (address) ); 555 pte_t *pto = ptep;
556#endif
557 asm volatile(
558 " ipte %2,%3"
559 : "=m" (*ptep) : "m" (*ptep),
560 "a" (pto), "a" (address));
571 } 561 }
572#else /* __s390x__ */ 562 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
573 if (!(pte_val(pte) & _PAGE_INVALID)) 563}
574 __asm__ __volatile__ ("ipte %2,%3" 564
575 : "=m" (*ptep) : "m" (*ptep), 565static inline pte_t
576 "a" (ptep), "a" (address) ); 566ptep_clear_flush(struct vm_area_struct *vma,
577#endif /* __s390x__ */ 567 unsigned long address, pte_t *ptep)
578 pte_val(*ptep) = _PAGE_INVALID_EMPTY; 568{
569 pte_t pte = *ptep;
570
571 __ptep_ipte(address, ptep);
579 return pte; 572 return pte;
580} 573}
581 574
@@ -604,30 +597,31 @@ ptep_establish(struct vm_area_struct *vma,
604 * 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
605 * address space. 598 * address space.
606 */ 599 */
607#define page_test_and_clear_dirty(_page) \ 600static inline int page_test_and_clear_dirty(struct page *page)
608({ \ 601{
609 struct page *__page = (_page); \ 602 unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
610 unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ 603 int skey = page_get_storage_key(physpage);
611 int __skey = page_get_storage_key(__physpage); \ 604
612 if (__skey & _PAGE_CHANGED) \ 605 if (skey & _PAGE_CHANGED)
613 page_set_storage_key(__physpage, __skey & ~_PAGE_CHANGED);\ 606 page_set_storage_key(physpage, skey & ~_PAGE_CHANGED);
614 (__skey & _PAGE_CHANGED); \ 607 return skey & _PAGE_CHANGED;
615}) 608}
616 609
617/* 610/*
618 * Test and clear referenced bit in storage key. 611 * Test and clear referenced bit in storage key.
619 */ 612 */
620#define page_test_and_clear_young(page) \ 613static inline int page_test_and_clear_young(struct page *page)
621({ \ 614{
622 struct page *__page = (page); \ 615 unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
623 unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ 616 int ccode;
624 int __ccode; \ 617
625 asm volatile ("rrbe 0,%1\n\t" \ 618 asm volatile (
626 "ipm %0\n\t" \ 619 "rrbe 0,%1\n"
627 "srl %0,28\n\t" \ 620 "ipm %0\n"
628 : "=d" (__ccode) : "a" (__physpage) : "cc" ); \ 621 "srl %0,28\n"
629 (__ccode & 2); \ 622 : "=d" (ccode) : "a" (physpage) : "cc" );
630}) 623 return ccode & 2;
624}
631 625
632/* 626/*
633 * Conversion functions: convert a page and protection to a page entry, 627 * Conversion functions: convert a page and protection to a page entry,
@@ -640,50 +634,41 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
640 return __pte; 634 return __pte;
641} 635}
642 636
643#define mk_pte(pg, pgprot) \ 637static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
644({ \ 638{
645 struct page *__page = (pg); \ 639 unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
646 pgprot_t __pgprot = (pgprot); \ 640
647 unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ 641 return mk_pte_phys(physpage, pgprot);
648 pte_t __pte = mk_pte_phys(__physpage, __pgprot); \ 642}
649 __pte; \ 643
650}) 644static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
651 645{
652#define pfn_pte(pfn, pgprot) \ 646 unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
653({ \ 647
654 pgprot_t __pgprot = (pgprot); \ 648 return mk_pte_phys(physpage, pgprot);
655 unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \ 649}
656 pte_t __pte = mk_pte_phys(__physpage, __pgprot); \
657 __pte; \
658})
659
660#define SetPageUptodate(_page) \
661 do { \
662 struct page *__page = (_page); \
663 if (!test_and_set_bit(PG_uptodate, &__page->flags)) \
664 page_test_and_clear_dirty(_page); \
665 } while (0)
666 650
667#ifdef __s390x__ 651#ifdef __s390x__
668 652
669#define pfn_pmd(pfn, pgprot) \ 653static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
670({ \ 654{
671 pgprot_t __pgprot = (pgprot); \ 655 unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
672 unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \ 656
673 pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot)); \ 657 return __pmd(physpage + pgprot_val(pgprot));
674 __pmd; \ 658}
675})
676 659
677#endif /* __s390x__ */ 660#endif /* __s390x__ */
678 661
679#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) 662#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
680#define pte_page(x) pfn_to_page(pte_pfn(x)) 663#define pte_page(x) pfn_to_page(pte_pfn(x))
681 664
682#define pmd_page_kernel(pmd) (pmd_val(pmd) & PAGE_MASK) 665#define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK)
683 666
684#define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) 667#define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT))
685 668
686#define pgd_page_kernel(pgd) (pgd_val(pgd) & PAGE_MASK) 669#define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK)
670
671#define pgd_page(pgd) (mem_map+(pgd_val(pgd) >> PAGE_SHIFT))
687 672
688/* to find an entry in a page-table-directory */ 673/* to find an entry in a page-table-directory */
689#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 674#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
@@ -705,14 +690,14 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
705/* Find an entry in the second-level page table.. */ 690/* Find an entry in the second-level page table.. */
706#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 691#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
707#define pmd_offset(dir,addr) \ 692#define pmd_offset(dir,addr) \
708 ((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr)) 693 ((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(addr))
709 694
710#endif /* __s390x__ */ 695#endif /* __s390x__ */
711 696
712/* Find an entry in the third-level page table.. */ 697/* Find an entry in the third-level page table.. */
713#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) 698#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
714#define pte_offset_kernel(pmd, address) \ 699#define pte_offset_kernel(pmd, address) \
715 ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) 700 ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address))
716#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) 701#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
717#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) 702#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
718#define pte_unmap(pte) do { } while (0) 703#define pte_unmap(pte) do { } while (0)
@@ -762,7 +747,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
762{ 747{
763 pte_t pte; 748 pte_t pte;
764 offset &= __SWP_OFFSET_MASK; 749 offset &= __SWP_OFFSET_MASK;
765 pte_val(pte) = _PAGE_INVALID_SWAP | ((type & 0x1f) << 2) | 750 pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) |
766 ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); 751 ((offset & 1UL) << 7) | ((offset & ~1UL) << 11);
767 return pte; 752 return pte;
768} 753}
@@ -785,7 +770,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
785 770
786#define pgoff_to_pte(__off) \ 771#define pgoff_to_pte(__off) \
787 ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ 772 ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \
788 | _PAGE_INVALID_FILE }) 773 | _PAGE_TYPE_FILE })
789 774
790#endif /* !__ASSEMBLY__ */ 775#endif /* !__ASSEMBLY__ */
791 776
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index c5cbc4bd84..cbbedc63ba 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.
@@ -199,15 +198,13 @@ unsigned long get_wchan(struct task_struct *p);
199/* 198/*
200 * Give up the time slice of the virtual PU. 199 * Give up the time slice of the virtual PU.
201 */ 200 */
202#ifndef __s390x__ 201static inline void cpu_relax(void)
203# define cpu_relax() asm volatile ("diag 0,0,68" : : : "memory") 202{
204#else /* __s390x__ */ 203 if (MACHINE_HAS_DIAG44)
205# define cpu_relax() \ 204 asm volatile("diag 0,0,68" : : : "memory");
206 do { \ 205 else
207 if (MACHINE_HAS_DIAG44) \ 206 barrier();
208 asm volatile ("diag 0,0,68" : : : "memory"); \ 207}
209 } while (0)
210#endif /* __s390x__ */
211 208
212/* 209/*
213 * Set PSW to specified value. 210 * Set PSW to specified value.
@@ -215,9 +212,9 @@ unsigned long get_wchan(struct task_struct *p);
215static inline void __load_psw(psw_t psw) 212static inline void __load_psw(psw_t psw)
216{ 213{
217#ifndef __s390x__ 214#ifndef __s390x__
218 asm volatile ("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); 215 asm volatile("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
219#else 216#else
220 asm volatile ("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); 217 asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
221#endif 218#endif
222} 219}
223 220
@@ -234,20 +231,20 @@ static inline void __load_psw_mask (unsigned long mask)
234 psw.mask = mask; 231 psw.mask = mask;
235 232
236#ifndef __s390x__ 233#ifndef __s390x__
237 asm volatile ( 234 asm volatile(
238 " basr %0,0\n" 235 " basr %0,0\n"
239 "0: ahi %0,1f-0b\n" 236 "0: ahi %0,1f-0b\n"
240 " st %0,4(%1)\n" 237 " st %0,4(%1)\n"
241 " lpsw 0(%1)\n" 238 " lpsw 0(%1)\n"
242 "1:" 239 "1:"
243 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); 240 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
244#else /* __s390x__ */ 241#else /* __s390x__ */
245 asm volatile ( 242 asm volatile(
246 " larl %0,1f\n" 243 " larl %0,1f\n"
247 " stg %0,8(%1)\n" 244 " stg %0,8(%1)\n"
248 " lpswe 0(%1)\n" 245 " lpswe 0(%1)\n"
249 "1:" 246 "1:"
250 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); 247 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
251#endif /* __s390x__ */ 248#endif /* __s390x__ */
252} 249}
253 250
@@ -276,56 +273,57 @@ static inline void disabled_wait(unsigned long code)
276 * the processor is dead afterwards 273 * the processor is dead afterwards
277 */ 274 */
278#ifndef __s390x__ 275#ifndef __s390x__
279 asm volatile (" stctl 0,0,0(%2)\n" 276 asm volatile(
280 " ni 0(%2),0xef\n" /* switch off protection */ 277 " stctl 0,0,0(%2)\n"
281 " lctl 0,0,0(%2)\n" 278 " ni 0(%2),0xef\n" /* switch off protection */
282 " stpt 0xd8\n" /* store timer */ 279 " lctl 0,0,0(%2)\n"
283 " stckc 0xe0\n" /* store clock comparator */ 280 " stpt 0xd8\n" /* store timer */
284 " stpx 0x108\n" /* store prefix register */ 281 " stckc 0xe0\n" /* store clock comparator */
285 " stam 0,15,0x120\n" /* store access registers */ 282 " stpx 0x108\n" /* store prefix register */
286 " std 0,0x160\n" /* store f0 */ 283 " stam 0,15,0x120\n" /* store access registers */
287 " std 2,0x168\n" /* store f2 */ 284 " std 0,0x160\n" /* store f0 */
288 " std 4,0x170\n" /* store f4 */ 285 " std 2,0x168\n" /* store f2 */
289 " std 6,0x178\n" /* store f6 */ 286 " std 4,0x170\n" /* store f4 */
290 " stm 0,15,0x180\n" /* store general registers */ 287 " std 6,0x178\n" /* store f6 */
291 " stctl 0,15,0x1c0\n" /* store control registers */ 288 " stm 0,15,0x180\n" /* store general registers */
292 " oi 0x1c0,0x10\n" /* fake protection bit */ 289 " stctl 0,15,0x1c0\n" /* store control registers */
293 " lpsw 0(%1)" 290 " oi 0x1c0,0x10\n" /* fake protection bit */
294 : "=m" (ctl_buf) 291 " lpsw 0(%1)"
295 : "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");
296#else /* __s390x__ */ 294#else /* __s390x__ */
297 asm volatile (" stctg 0,0,0(%2)\n" 295 asm volatile(
298 " ni 4(%2),0xef\n" /* switch off protection */ 296 " stctg 0,0,0(%2)\n"
299 " lctlg 0,0,0(%2)\n" 297 " ni 4(%2),0xef\n" /* switch off protection */
300 " lghi 1,0x1000\n" 298 " lctlg 0,0,0(%2)\n"
301 " stpt 0x328(1)\n" /* store timer */ 299 " lghi 1,0x1000\n"
302 " stckc 0x330(1)\n" /* store clock comparator */ 300 " stpt 0x328(1)\n" /* store timer */
303 " stpx 0x318(1)\n" /* store prefix register */ 301 " stckc 0x330(1)\n" /* store clock comparator */
304 " stam 0,15,0x340(1)\n" /* store access registers */ 302 " stpx 0x318(1)\n" /* store prefix register */
305 " stfpc 0x31c(1)\n" /* store fpu control */ 303 " stam 0,15,0x340(1)\n"/* store access registers */
306 " std 0,0x200(1)\n" /* store f0 */ 304 " stfpc 0x31c(1)\n" /* store fpu control */
307 " std 1,0x208(1)\n" /* store f1 */ 305 " std 0,0x200(1)\n" /* store f0 */
308 " std 2,0x210(1)\n" /* store f2 */ 306 " std 1,0x208(1)\n" /* store f1 */
309 " std 3,0x218(1)\n" /* store f3 */ 307 " std 2,0x210(1)\n" /* store f2 */
310 " std 4,0x220(1)\n" /* store f4 */ 308 " std 3,0x218(1)\n" /* store f3 */
311 " std 5,0x228(1)\n" /* store f5 */ 309 " std 4,0x220(1)\n" /* store f4 */
312 " std 6,0x230(1)\n" /* store f6 */ 310 " std 5,0x228(1)\n" /* store f5 */
313 " std 7,0x238(1)\n" /* store f7 */ 311 " std 6,0x230(1)\n" /* store f6 */
314 " std 8,0x240(1)\n" /* store f8 */ 312 " std 7,0x238(1)\n" /* store f7 */
315 " std 9,0x248(1)\n" /* store f9 */ 313 " std 8,0x240(1)\n" /* store f8 */
316 " std 10,0x250(1)\n" /* store f10 */ 314 " std 9,0x248(1)\n" /* store f9 */
317 " std 11,0x258(1)\n" /* store f11 */ 315 " std 10,0x250(1)\n" /* store f10 */
318 " std 12,0x260(1)\n" /* store f12 */ 316 " std 11,0x258(1)\n" /* store f11 */
319 " std 13,0x268(1)\n" /* store f13 */ 317 " std 12,0x260(1)\n" /* store f12 */
320 " std 14,0x270(1)\n" /* store f14 */ 318 " std 13,0x268(1)\n" /* store f13 */
321 " std 15,0x278(1)\n" /* store f15 */ 319 " std 14,0x270(1)\n" /* store f14 */
322 " stmg 0,15,0x280(1)\n" /* store general registers */ 320 " std 15,0x278(1)\n" /* store f15 */
323 " stctg 0,15,0x380(1)\n" /* store control registers */ 321 " stmg 0,15,0x280(1)\n"/* store general registers */
324 " oi 0x384(1),0x10\n" /* fake protection bit */ 322 " stctg 0,15,0x380(1)\n"/* store control registers */
325 " lpswe 0(%1)" 323 " oi 0x384(1),0x10\n"/* fake protection bit */
326 : "=m" (ctl_buf) 324 " lpswe 0(%1)"
327 : "a" (&dw_psw), "a" (&ctl_buf), 325 : "=m" (ctl_buf)
328 "m" (dw_psw) : "cc", "0", "1"); 326 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0");
329#endif /* __s390x__ */ 327#endif /* __s390x__ */
330} 328}
331 329
@@ -339,6 +337,25 @@ struct notifier_block;
339int register_idle_notifier(struct notifier_block *nb); 337int register_idle_notifier(struct notifier_block *nb);
340int unregister_idle_notifier(struct notifier_block *nb); 338int unregister_idle_notifier(struct notifier_block *nb);
341 339
340#define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL
341
342#endif
343
344/*
345 * Helper macro for exception table entries
346 */
347#ifndef __s390x__
348#define EX_TABLE(_fault,_target) \
349 ".section __ex_table,\"a\"\n" \
350 " .align 4\n" \
351 " .long " #_fault "," #_target "\n" \
352 ".previous\n"
353#else
354#define EX_TABLE(_fault,_target) \
355 ".section __ex_table,\"a\"\n" \
356 " .align 8\n" \
357 " .quad " #_fault "," #_target "\n" \
358 ".previous\n"
342#endif 359#endif
343 360
344#endif /* __ASM_S390_PROCESSOR_H */ 361#endif /* __ASM_S390_PROCESSOR_H */
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index 4d75d77b0f..8d2bf65b0b 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -479,7 +479,7 @@ extern void show_regs(struct pt_regs * regs);
479static inline void 479static inline void
480psw_set_key(unsigned int key) 480psw_set_key(unsigned int key)
481{ 481{
482 asm volatile ( "spka 0(%0)" : : "d" (key) ); 482 asm volatile("spka 0(%0)" : : "d" (key));
483} 483}
484 484
485#endif /* __ASSEMBLY__ */ 485#endif /* __ASSEMBLY__ */
diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h
index 0422a085dd..90f4eccaa2 100644
--- a/include/asm-s390/rwsem.h
+++ b/include/asm-s390/rwsem.h
@@ -61,6 +61,9 @@ struct rw_semaphore {
61 signed long count; 61 signed long count;
62 spinlock_t wait_lock; 62 spinlock_t wait_lock;
63 struct list_head wait_list; 63 struct list_head wait_list;
64#ifdef CONFIG_DEBUG_LOCK_ALLOC
65 struct lockdep_map dep_map;
66#endif
64}; 67};
65 68
66#ifndef __s390x__ 69#ifndef __s390x__
@@ -80,8 +83,16 @@ struct rw_semaphore {
80/* 83/*
81 * initialisation 84 * initialisation
82 */ 85 */
86
87#ifdef CONFIG_DEBUG_LOCK_ALLOC
88# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
89#else
90# define __RWSEM_DEP_MAP_INIT(lockname)
91#endif
92
83#define __RWSEM_INITIALIZER(name) \ 93#define __RWSEM_INITIALIZER(name) \
84{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } 94{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \
95 __RWSEM_DEP_MAP_INIT(name) }
85 96
86#define DECLARE_RWSEM(name) \ 97#define DECLARE_RWSEM(name) \
87 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 98 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -93,6 +104,17 @@ static inline void init_rwsem(struct rw_semaphore *sem)
93 INIT_LIST_HEAD(&sem->wait_list); 104 INIT_LIST_HEAD(&sem->wait_list);
94} 105}
95 106
107extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
108 struct lock_class_key *key);
109
110#define init_rwsem(sem) \
111do { \
112 static struct lock_class_key __key; \
113 \
114 __init_rwsem((sem), #sem, &__key); \
115} while (0)
116
117
96/* 118/*
97 * lock for reading 119 * lock for reading
98 */ 120 */
@@ -100,23 +122,23 @@ static inline void __down_read(struct rw_semaphore *sem)
100{ 122{
101 signed long old, new; 123 signed long old, new;
102 124
103 __asm__ __volatile__( 125 asm volatile(
104#ifndef __s390x__ 126#ifndef __s390x__
105 " l %0,0(%3)\n" 127 " l %0,0(%3)\n"
106 "0: lr %1,%0\n" 128 "0: lr %1,%0\n"
107 " ahi %1,%5\n" 129 " ahi %1,%5\n"
108 " cs %0,%1,0(%3)\n" 130 " cs %0,%1,0(%3)\n"
109 " jl 0b" 131 " jl 0b"
110#else /* __s390x__ */ 132#else /* __s390x__ */
111 " lg %0,0(%3)\n" 133 " lg %0,0(%3)\n"
112 "0: lgr %1,%0\n" 134 "0: lgr %1,%0\n"
113 " aghi %1,%5\n" 135 " aghi %1,%5\n"
114 " csg %0,%1,0(%3)\n" 136 " csg %0,%1,0(%3)\n"
115 " jl 0b" 137 " jl 0b"
116#endif /* __s390x__ */ 138#endif /* __s390x__ */
117 : "=&d" (old), "=&d" (new), "=m" (sem->count) 139 : "=&d" (old), "=&d" (new), "=m" (sem->count)
118 : "a" (&sem->count), "m" (sem->count), 140 : "a" (&sem->count), "m" (sem->count),
119 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory" ); 141 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
120 if (old < 0) 142 if (old < 0)
121 rwsem_down_read_failed(sem); 143 rwsem_down_read_failed(sem);
122} 144}
@@ -128,59 +150,64 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
128{ 150{
129 signed long old, new; 151 signed long old, new;
130 152
131 __asm__ __volatile__( 153 asm volatile(
132#ifndef __s390x__ 154#ifndef __s390x__
133 " l %0,0(%3)\n" 155 " l %0,0(%3)\n"
134 "0: ltr %1,%0\n" 156 "0: ltr %1,%0\n"
135 " jm 1f\n" 157 " jm 1f\n"
136 " ahi %1,%5\n" 158 " ahi %1,%5\n"
137 " cs %0,%1,0(%3)\n" 159 " cs %0,%1,0(%3)\n"
138 " jl 0b\n" 160 " jl 0b\n"
139 "1:" 161 "1:"
140#else /* __s390x__ */ 162#else /* __s390x__ */
141 " lg %0,0(%3)\n" 163 " lg %0,0(%3)\n"
142 "0: ltgr %1,%0\n" 164 "0: ltgr %1,%0\n"
143 " jm 1f\n" 165 " jm 1f\n"
144 " aghi %1,%5\n" 166 " aghi %1,%5\n"
145 " csg %0,%1,0(%3)\n" 167 " csg %0,%1,0(%3)\n"
146 " jl 0b\n" 168 " jl 0b\n"
147 "1:" 169 "1:"
148#endif /* __s390x__ */ 170#endif /* __s390x__ */
149 : "=&d" (old), "=&d" (new), "=m" (sem->count) 171 : "=&d" (old), "=&d" (new), "=m" (sem->count)
150 : "a" (&sem->count), "m" (sem->count), 172 : "a" (&sem->count), "m" (sem->count),
151 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory" ); 173 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
152 return old >= 0 ? 1 : 0; 174 return old >= 0 ? 1 : 0;
153} 175}
154 176
155/* 177/*
156 * lock for writing 178 * lock for writing
157 */ 179 */
158static inline void __down_write(struct rw_semaphore *sem) 180static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
159{ 181{
160 signed long old, new, tmp; 182 signed long old, new, tmp;
161 183
162 tmp = RWSEM_ACTIVE_WRITE_BIAS; 184 tmp = RWSEM_ACTIVE_WRITE_BIAS;
163 __asm__ __volatile__( 185 asm volatile(
164#ifndef __s390x__ 186#ifndef __s390x__
165 " l %0,0(%3)\n" 187 " l %0,0(%3)\n"
166 "0: lr %1,%0\n" 188 "0: lr %1,%0\n"
167 " a %1,%5\n" 189 " a %1,%5\n"
168 " cs %0,%1,0(%3)\n" 190 " cs %0,%1,0(%3)\n"
169 " jl 0b" 191 " jl 0b"
170#else /* __s390x__ */ 192#else /* __s390x__ */
171 " lg %0,0(%3)\n" 193 " lg %0,0(%3)\n"
172 "0: lgr %1,%0\n" 194 "0: lgr %1,%0\n"
173 " ag %1,%5\n" 195 " ag %1,%5\n"
174 " csg %0,%1,0(%3)\n" 196 " csg %0,%1,0(%3)\n"
175 " jl 0b" 197 " jl 0b"
176#endif /* __s390x__ */ 198#endif /* __s390x__ */
177 : "=&d" (old), "=&d" (new), "=m" (sem->count) 199 : "=&d" (old), "=&d" (new), "=m" (sem->count)
178 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 200 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
179 : "cc", "memory" ); 201 : "cc", "memory");
180 if (old != 0) 202 if (old != 0)
181 rwsem_down_write_failed(sem); 203 rwsem_down_write_failed(sem);
182} 204}
183 205
206static inline void __down_write(struct rw_semaphore *sem)
207{
208 __down_write_nested(sem, 0);
209}
210
184/* 211/*
185 * trylock for writing -- returns 1 if successful, 0 if contention 212 * trylock for writing -- returns 1 if successful, 0 if contention
186 */ 213 */
@@ -188,24 +215,24 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
188{ 215{
189 signed long old; 216 signed long old;
190 217
191 __asm__ __volatile__( 218 asm volatile(
192#ifndef __s390x__ 219#ifndef __s390x__
193 " l %0,0(%2)\n" 220 " l %0,0(%2)\n"
194 "0: ltr %0,%0\n" 221 "0: ltr %0,%0\n"
195 " jnz 1f\n" 222 " jnz 1f\n"
196 " cs %0,%4,0(%2)\n" 223 " cs %0,%4,0(%2)\n"
197 " jl 0b\n" 224 " jl 0b\n"
198#else /* __s390x__ */ 225#else /* __s390x__ */
199 " lg %0,0(%2)\n" 226 " lg %0,0(%2)\n"
200 "0: ltgr %0,%0\n" 227 "0: ltgr %0,%0\n"
201 " jnz 1f\n" 228 " jnz 1f\n"
202 " csg %0,%4,0(%2)\n" 229 " csg %0,%4,0(%2)\n"
203 " jl 0b\n" 230 " jl 0b\n"
204#endif /* __s390x__ */ 231#endif /* __s390x__ */
205 "1:" 232 "1:"
206 : "=&d" (old), "=m" (sem->count) 233 : "=&d" (old), "=m" (sem->count)
207 : "a" (&sem->count), "m" (sem->count), 234 : "a" (&sem->count), "m" (sem->count),
208 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory" ); 235 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory");
209 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; 236 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0;
210} 237}
211 238
@@ -216,24 +243,24 @@ static inline void __up_read(struct rw_semaphore *sem)
216{ 243{
217 signed long old, new; 244 signed long old, new;
218 245
219 __asm__ __volatile__( 246 asm volatile(
220#ifndef __s390x__ 247#ifndef __s390x__
221 " l %0,0(%3)\n" 248 " l %0,0(%3)\n"
222 "0: lr %1,%0\n" 249 "0: lr %1,%0\n"
223 " ahi %1,%5\n" 250 " ahi %1,%5\n"
224 " cs %0,%1,0(%3)\n" 251 " cs %0,%1,0(%3)\n"
225 " jl 0b" 252 " jl 0b"
226#else /* __s390x__ */ 253#else /* __s390x__ */
227 " lg %0,0(%3)\n" 254 " lg %0,0(%3)\n"
228 "0: lgr %1,%0\n" 255 "0: lgr %1,%0\n"
229 " aghi %1,%5\n" 256 " aghi %1,%5\n"
230 " csg %0,%1,0(%3)\n" 257 " csg %0,%1,0(%3)\n"
231 " jl 0b" 258 " jl 0b"
232#endif /* __s390x__ */ 259#endif /* __s390x__ */
233 : "=&d" (old), "=&d" (new), "=m" (sem->count) 260 : "=&d" (old), "=&d" (new), "=m" (sem->count)
234 : "a" (&sem->count), "m" (sem->count), 261 : "a" (&sem->count), "m" (sem->count),
235 "i" (-RWSEM_ACTIVE_READ_BIAS) 262 "i" (-RWSEM_ACTIVE_READ_BIAS)
236 : "cc", "memory" ); 263 : "cc", "memory");
237 if (new < 0) 264 if (new < 0)
238 if ((new & RWSEM_ACTIVE_MASK) == 0) 265 if ((new & RWSEM_ACTIVE_MASK) == 0)
239 rwsem_wake(sem); 266 rwsem_wake(sem);
@@ -247,23 +274,23 @@ static inline void __up_write(struct rw_semaphore *sem)
247 signed long old, new, tmp; 274 signed long old, new, tmp;
248 275
249 tmp = -RWSEM_ACTIVE_WRITE_BIAS; 276 tmp = -RWSEM_ACTIVE_WRITE_BIAS;
250 __asm__ __volatile__( 277 asm volatile(
251#ifndef __s390x__ 278#ifndef __s390x__
252 " l %0,0(%3)\n" 279 " l %0,0(%3)\n"
253 "0: lr %1,%0\n" 280 "0: lr %1,%0\n"
254 " a %1,%5\n" 281 " a %1,%5\n"
255 " cs %0,%1,0(%3)\n" 282 " cs %0,%1,0(%3)\n"
256 " jl 0b" 283 " jl 0b"
257#else /* __s390x__ */ 284#else /* __s390x__ */
258 " lg %0,0(%3)\n" 285 " lg %0,0(%3)\n"
259 "0: lgr %1,%0\n" 286 "0: lgr %1,%0\n"
260 " ag %1,%5\n" 287 " ag %1,%5\n"
261 " csg %0,%1,0(%3)\n" 288 " csg %0,%1,0(%3)\n"
262 " jl 0b" 289 " jl 0b"
263#endif /* __s390x__ */ 290#endif /* __s390x__ */
264 : "=&d" (old), "=&d" (new), "=m" (sem->count) 291 : "=&d" (old), "=&d" (new), "=m" (sem->count)
265 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 292 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
266 : "cc", "memory" ); 293 : "cc", "memory");
267 if (new < 0) 294 if (new < 0)
268 if ((new & RWSEM_ACTIVE_MASK) == 0) 295 if ((new & RWSEM_ACTIVE_MASK) == 0)
269 rwsem_wake(sem); 296 rwsem_wake(sem);
@@ -277,23 +304,23 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
277 signed long old, new, tmp; 304 signed long old, new, tmp;
278 305
279 tmp = -RWSEM_WAITING_BIAS; 306 tmp = -RWSEM_WAITING_BIAS;
280 __asm__ __volatile__( 307 asm volatile(
281#ifndef __s390x__ 308#ifndef __s390x__
282 " l %0,0(%3)\n" 309 " l %0,0(%3)\n"
283 "0: lr %1,%0\n" 310 "0: lr %1,%0\n"
284 " a %1,%5\n" 311 " a %1,%5\n"
285 " cs %0,%1,0(%3)\n" 312 " cs %0,%1,0(%3)\n"
286 " jl 0b" 313 " jl 0b"
287#else /* __s390x__ */ 314#else /* __s390x__ */
288 " lg %0,0(%3)\n" 315 " lg %0,0(%3)\n"
289 "0: lgr %1,%0\n" 316 "0: lgr %1,%0\n"
290 " ag %1,%5\n" 317 " ag %1,%5\n"
291 " csg %0,%1,0(%3)\n" 318 " csg %0,%1,0(%3)\n"
292 " jl 0b" 319 " jl 0b"
293#endif /* __s390x__ */ 320#endif /* __s390x__ */
294 : "=&d" (old), "=&d" (new), "=m" (sem->count) 321 : "=&d" (old), "=&d" (new), "=m" (sem->count)
295 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 322 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
296 : "cc", "memory" ); 323 : "cc", "memory");
297 if (new > 1) 324 if (new > 1)
298 rwsem_downgrade_wake(sem); 325 rwsem_downgrade_wake(sem);
299} 326}
@@ -305,23 +332,23 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
305{ 332{
306 signed long old, new; 333 signed long old, new;
307 334
308 __asm__ __volatile__( 335 asm volatile(
309#ifndef __s390x__ 336#ifndef __s390x__
310 " l %0,0(%3)\n" 337 " l %0,0(%3)\n"
311 "0: lr %1,%0\n" 338 "0: lr %1,%0\n"
312 " ar %1,%5\n" 339 " ar %1,%5\n"
313 " cs %0,%1,0(%3)\n" 340 " cs %0,%1,0(%3)\n"
314 " jl 0b" 341 " jl 0b"
315#else /* __s390x__ */ 342#else /* __s390x__ */
316 " lg %0,0(%3)\n" 343 " lg %0,0(%3)\n"
317 "0: lgr %1,%0\n" 344 "0: lgr %1,%0\n"
318 " agr %1,%5\n" 345 " agr %1,%5\n"
319 " csg %0,%1,0(%3)\n" 346 " csg %0,%1,0(%3)\n"
320 " jl 0b" 347 " jl 0b"
321#endif /* __s390x__ */ 348#endif /* __s390x__ */
322 : "=&d" (old), "=&d" (new), "=m" (sem->count) 349 : "=&d" (old), "=&d" (new), "=m" (sem->count)
323 : "a" (&sem->count), "m" (sem->count), "d" (delta) 350 : "a" (&sem->count), "m" (sem->count), "d" (delta)
324 : "cc", "memory" ); 351 : "cc", "memory");
325} 352}
326 353
327/* 354/*
@@ -331,23 +358,23 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
331{ 358{
332 signed long old, new; 359 signed long old, new;
333 360
334 __asm__ __volatile__( 361 asm volatile(
335#ifndef __s390x__ 362#ifndef __s390x__
336 " l %0,0(%3)\n" 363 " l %0,0(%3)\n"
337 "0: lr %1,%0\n" 364 "0: lr %1,%0\n"
338 " ar %1,%5\n" 365 " ar %1,%5\n"
339 " cs %0,%1,0(%3)\n" 366 " cs %0,%1,0(%3)\n"
340 " jl 0b" 367 " jl 0b"
341#else /* __s390x__ */ 368#else /* __s390x__ */
342 " lg %0,0(%3)\n" 369 " lg %0,0(%3)\n"
343 "0: lgr %1,%0\n" 370 "0: lgr %1,%0\n"
344 " agr %1,%5\n" 371 " agr %1,%5\n"
345 " csg %0,%1,0(%3)\n" 372 " csg %0,%1,0(%3)\n"
346 " jl 0b" 373 " jl 0b"
347#endif /* __s390x__ */ 374#endif /* __s390x__ */
348 : "=&d" (old), "=&d" (new), "=m" (sem->count) 375 : "=&d" (old), "=&d" (new), "=m" (sem->count)
349 : "a" (&sem->count), "m" (sem->count), "d" (delta) 376 : "a" (&sem->count), "m" (sem->count), "d" (delta)
350 : "cc", "memory" ); 377 : "cc", "memory");
351 return new; 378 return new;
352} 379}
353 380
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h
index 702cf43669..dbce058aef 100644
--- a/include/asm-s390/semaphore.h
+++ b/include/asm-s390/semaphore.h
@@ -37,7 +37,8 @@ struct semaphore {
37 37
38static inline void sema_init (struct semaphore *sem, int val) 38static inline void sema_init (struct semaphore *sem, int val)
39{ 39{
40 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER((*sem),val); 40 atomic_set(&sem->count, val);
41 init_waitqueue_head(&sem->wait);
41} 42}
42 43
43static inline void init_MUTEX (struct semaphore *sem) 44static inline void init_MUTEX (struct semaphore *sem)
@@ -84,17 +85,17 @@ static inline int down_trylock(struct semaphore * sem)
84 * sem->count.counter = --new_val; 85 * sem->count.counter = --new_val;
85 * In the ppc code this is called atomic_dec_if_positive. 86 * In the ppc code this is called atomic_dec_if_positive.
86 */ 87 */
87 __asm__ __volatile__ ( 88 asm volatile(
88 " l %0,0(%3)\n" 89 " l %0,0(%3)\n"
89 "0: ltr %1,%0\n" 90 "0: ltr %1,%0\n"
90 " jle 1f\n" 91 " jle 1f\n"
91 " ahi %1,-1\n" 92 " ahi %1,-1\n"
92 " cs %0,%1,0(%3)\n" 93 " cs %0,%1,0(%3)\n"
93 " jl 0b\n" 94 " jl 0b\n"
94 "1:" 95 "1:"
95 : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter) 96 : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter)
96 : "a" (&sem->count.counter), "m" (sem->count.counter) 97 : "a" (&sem->count.counter), "m" (sem->count.counter)
97 : "cc", "memory" ); 98 : "cc", "memory");
98 return old_val <= 0; 99 return old_val <= 0;
99} 100}
100 101
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index da3fd4a7bb..f1959732b6 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -14,8 +14,6 @@
14 14
15#define PARMAREA 0x10400 15#define PARMAREA 0x10400
16#define COMMAND_LINE_SIZE 896 16#define COMMAND_LINE_SIZE 896
17#define RAMDISK_ORIGIN 0x800000
18#define RAMDISK_SIZE 0x800000
19#define MEMORY_CHUNKS 16 /* max 0x7fff */ 17#define MEMORY_CHUNKS 16 /* max 0x7fff */
20#define IPL_PARMBLOCK_ORIGIN 0x2000 18#define IPL_PARMBLOCK_ORIGIN 0x2000
21 19
@@ -40,15 +38,18 @@ extern unsigned long machine_flags;
40#define MACHINE_IS_VM (machine_flags & 1) 38#define MACHINE_IS_VM (machine_flags & 1)
41#define MACHINE_IS_P390 (machine_flags & 4) 39#define MACHINE_IS_P390 (machine_flags & 4)
42#define MACHINE_HAS_MVPG (machine_flags & 16) 40#define MACHINE_HAS_MVPG (machine_flags & 16)
43#define MACHINE_HAS_DIAG44 (machine_flags & 32)
44#define MACHINE_HAS_IDTE (machine_flags & 128) 41#define MACHINE_HAS_IDTE (machine_flags & 128)
45 42
46#ifndef __s390x__ 43#ifndef __s390x__
47#define MACHINE_HAS_IEEE (machine_flags & 2) 44#define MACHINE_HAS_IEEE (machine_flags & 2)
48#define MACHINE_HAS_CSP (machine_flags & 8) 45#define MACHINE_HAS_CSP (machine_flags & 8)
46#define MACHINE_HAS_DIAG44 (1)
47#define MACHINE_HAS_MVCOS (0)
49#else /* __s390x__ */ 48#else /* __s390x__ */
50#define MACHINE_HAS_IEEE (1) 49#define MACHINE_HAS_IEEE (1)
51#define MACHINE_HAS_CSP (1) 50#define MACHINE_HAS_CSP (1)
51#define MACHINE_HAS_DIAG44 (machine_flags & 32)
52#define MACHINE_HAS_MVCOS (machine_flags & 512)
52#endif /* __s390x__ */ 53#endif /* __s390x__ */
53 54
54 55
@@ -69,52 +70,76 @@ extern unsigned int console_irq;
69#define SET_CONSOLE_3215 do { console_mode = 2; } while (0) 70#define SET_CONSOLE_3215 do { console_mode = 2; } while (0)
70#define SET_CONSOLE_3270 do { console_mode = 3; } while (0) 71#define SET_CONSOLE_3270 do { console_mode = 3; } while (0)
71 72
72struct ipl_list_header { 73
73 u32 length; 74struct ipl_list_hdr {
74 u8 reserved[3]; 75 u32 len;
76 u8 reserved1[3];
75 u8 version; 77 u8 version;
78 u32 blk0_len;
79 u8 pbt;
80 u8 flags;
81 u16 reserved2;
76} __attribute__((packed)); 82} __attribute__((packed));
77 83
78struct ipl_block_fcp { 84struct ipl_block_fcp {
79 u32 length; 85 u8 reserved1[313-1];
80 u8 pbt; 86 u8 opt;
81 u8 reserved1[322-1]; 87 u8 reserved2[3];
88 u16 reserved3;
82 u16 devno; 89 u16 devno;
83 u8 reserved2[4]; 90 u8 reserved4[4];
84 u64 wwpn; 91 u64 wwpn;
85 u64 lun; 92 u64 lun;
86 u32 bootprog; 93 u32 bootprog;
87 u8 reserved3[12]; 94 u8 reserved5[12];
88 u64 br_lba; 95 u64 br_lba;
89 u32 scp_data_len; 96 u32 scp_data_len;
90 u8 reserved4[260]; 97 u8 reserved6[260];
91 u8 scp_data[]; 98 u8 scp_data[];
92} __attribute__((packed)); 99} __attribute__((packed));
93 100
101struct ipl_block_ccw {
102 u8 load_param[8];
103 u8 reserved1[84];
104 u8 reserved2[2];
105 u16 devno;
106 u8 vm_flags;
107 u8 reserved3[3];
108 u32 vm_parm_len;
109} __attribute__((packed));
110
94struct ipl_parameter_block { 111struct ipl_parameter_block {
112 struct ipl_list_hdr hdr;
95 union { 113 union {
96 u32 length; 114 struct ipl_block_fcp fcp;
97 struct ipl_list_header header; 115 struct ipl_block_ccw ccw;
98 } hdr; 116 } ipl_info;
99 struct ipl_block_fcp fcp;
100} __attribute__((packed)); 117} __attribute__((packed));
101 118
102#define IPL_MAX_SUPPORTED_VERSION (0) 119#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
120 sizeof(struct ipl_block_fcp))
103 121
104#define IPL_TYPE_FCP (0) 122#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
123 sizeof(struct ipl_block_ccw))
124
125#define IPL_MAX_SUPPORTED_VERSION (0)
105 126
106/* 127/*
107 * IPL validity flags and parameters as detected in head.S 128 * IPL validity flags and parameters as detected in head.S
108 */ 129 */
109extern u32 ipl_parameter_flags; 130extern u32 ipl_flags;
110extern u16 ipl_devno; 131extern u16 ipl_devno;
111 132
112#define IPL_DEVNO_VALID (ipl_parameter_flags & 1) 133void do_reipl(void);
113#define IPL_PARMBLOCK_VALID (ipl_parameter_flags & 2) 134
135enum {
136 IPL_DEVNO_VALID = 1,
137 IPL_PARMBLOCK_VALID = 2,
138};
114 139
115#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ 140#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
116 IPL_PARMBLOCK_ORIGIN) 141 IPL_PARMBLOCK_ORIGIN)
117#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length) 142#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len)
118 143
119#else /* __ASSEMBLY__ */ 144#else /* __ASSEMBLY__ */
120 145
diff --git a/include/asm-s390/sfp-machine.h b/include/asm-s390/sfp-machine.h
index de69dfa46f..8ca8c77b2d 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/signal.h b/include/asm-s390/signal.h
index 7084626de2..f6cfddb278 100644
--- a/include/asm-s390/signal.h
+++ b/include/asm-s390/signal.h
@@ -84,7 +84,6 @@ typedef unsigned long sigset_t;
84 * SA_FLAGS values: 84 * SA_FLAGS values:
85 * 85 *
86 * SA_ONSTACK indicates that a registered stack_t will be used. 86 * SA_ONSTACK indicates that a registered stack_t will be used.
87 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
88 * SA_RESTART flag to get restarting signals (which were the default long ago) 87 * SA_RESTART flag to get restarting signals (which were the default long ago)
89 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 88 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
90 * SA_RESETHAND clears the handler when the signal is delivered. 89 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -104,7 +103,6 @@ typedef unsigned long sigset_t;
104 103
105#define SA_NOMASK SA_NODEFER 104#define SA_NOMASK SA_NODEFER
106#define SA_ONESHOT SA_RESETHAND 105#define SA_ONESHOT SA_RESETHAND
107#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
108 106
109#define SA_RESTORER 0x04000000 107#define SA_RESTORER 0x04000000
110 108
diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h
index fc56458aff..e16d56f8df 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 657646054c..c3cf030ada 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
@@ -104,7 +104,7 @@ smp_call_function_on(void (*func) (void *info), void *info,
104#define smp_cpu_not_running(cpu) 1 104#define smp_cpu_not_running(cpu) 1
105#define smp_get_cpu(cpu) ({ 0; }) 105#define smp_get_cpu(cpu) ({ 0; })
106#define smp_put_cpu(cpu) ({ 0; }) 106#define smp_put_cpu(cpu) ({ 0; })
107#define smp_setup_cpu_possible_map() 107#define smp_setup_cpu_possible_map() do { } while (0)
108#endif 108#endif
109 109
110#endif 110#endif
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 15a5298c87..1778a49a74 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -56,5 +56,6 @@
56#define SO_ACCEPTCONN 30 56#define SO_ACCEPTCONN 30
57 57
58#define SO_PEERSEC 31 58#define SO_PEERSEC 31
59#define SO_PASSSEC 34
59 60
60#endif /* _ASM_SOCKET_H */ 61#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 273dbecf8a..ce3edf6d63 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -11,17 +11,36 @@
11#ifndef __ASM_SPINLOCK_H 11#ifndef __ASM_SPINLOCK_H
12#define __ASM_SPINLOCK_H 12#define __ASM_SPINLOCK_H
13 13
14#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
15
16static inline int
17_raw_compare_and_swap(volatile unsigned int *lock,
18 unsigned int old, unsigned int new)
19{
20 asm volatile(
21 " cs %0,%3,%1"
22 : "=d" (old), "=Q" (*lock)
23 : "0" (old), "d" (new), "Q" (*lock)
24 : "cc", "memory" );
25 return old;
26}
27
28#else /* __GNUC__ */
29
14static inline int 30static inline int
15_raw_compare_and_swap(volatile unsigned int *lock, 31_raw_compare_and_swap(volatile unsigned int *lock,
16 unsigned int old, unsigned int new) 32 unsigned int old, unsigned int new)
17{ 33{
18 asm volatile ("cs %0,%3,0(%4)" 34 asm volatile(
19 : "=d" (old), "=m" (*lock) 35 " cs %0,%3,0(%4)"
20 : "0" (old), "d" (new), "a" (lock), "m" (*lock) 36 : "=d" (old), "=m" (*lock)
21 : "cc", "memory" ); 37 : "0" (old), "d" (new), "a" (lock), "m" (*lock)
38 : "cc", "memory" );
22 return old; 39 return old;
23} 40}
24 41
42#endif /* __GNUC__ */
43
25/* 44/*
26 * Simple spin lock operations. There are two variants, one clears IRQ's 45 * Simple spin lock operations. There are two variants, one clears IRQ's
27 * on the local processor, one does not. 46 * on the local processor, one does not.
diff --git a/include/asm-s390/string.h b/include/asm-s390/string.h
index 23a4c39048..d074673a6d 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 71a0732cd5..ccbafe4bf2 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,10 +120,15 @@ 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 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(void *)(ptr),sizeof(*(ptr)))) 126({ \
127 __typeof__(*(ptr)) __ret; \
128 __ret = (__typeof__(*(ptr))) \
129 __xchg((unsigned long)(x), (void *)(ptr),sizeof(*(ptr))); \
130 __ret; \
131})
133 132
134static inline unsigned long __xchg(unsigned long x, void * ptr, int size) 133static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
135{ 134{
@@ -142,15 +141,15 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
142 shift = (3 ^ (addr & 3)) << 3; 141 shift = (3 ^ (addr & 3)) << 3;
143 addr ^= addr & 3; 142 addr ^= addr & 3;
144 asm volatile( 143 asm volatile(
145 " l %0,0(%4)\n" 144 " l %0,0(%4)\n"
146 "0: lr 0,%0\n" 145 "0: lr 0,%0\n"
147 " nr 0,%3\n" 146 " nr 0,%3\n"
148 " or 0,%2\n" 147 " or 0,%2\n"
149 " cs %0,0,0(%4)\n" 148 " cs %0,0,0(%4)\n"
150 " jl 0b\n" 149 " jl 0b\n"
151 : "=&d" (old), "=m" (*(int *) addr) 150 : "=&d" (old), "=m" (*(int *) addr)
152 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr), 151 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr),
153 "m" (*(int *) addr) : "memory", "cc", "0" ); 152 "m" (*(int *) addr) : "memory", "cc", "0");
154 x = old >> shift; 153 x = old >> shift;
155 break; 154 break;
156 case 2: 155 case 2:
@@ -158,36 +157,36 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
158 shift = (2 ^ (addr & 2)) << 3; 157 shift = (2 ^ (addr & 2)) << 3;
159 addr ^= addr & 2; 158 addr ^= addr & 2;
160 asm volatile( 159 asm volatile(
161 " l %0,0(%4)\n" 160 " l %0,0(%4)\n"
162 "0: lr 0,%0\n" 161 "0: lr 0,%0\n"
163 " nr 0,%3\n" 162 " nr 0,%3\n"
164 " or 0,%2\n" 163 " or 0,%2\n"
165 " cs %0,0,0(%4)\n" 164 " cs %0,0,0(%4)\n"
166 " jl 0b\n" 165 " jl 0b\n"
167 : "=&d" (old), "=m" (*(int *) addr) 166 : "=&d" (old), "=m" (*(int *) addr)
168 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr), 167 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr),
169 "m" (*(int *) addr) : "memory", "cc", "0" ); 168 "m" (*(int *) addr) : "memory", "cc", "0");
170 x = old >> shift; 169 x = old >> shift;
171 break; 170 break;
172 case 4: 171 case 4:
173 asm volatile ( 172 asm volatile(
174 " l %0,0(%3)\n" 173 " l %0,0(%3)\n"
175 "0: cs %0,%2,0(%3)\n" 174 "0: cs %0,%2,0(%3)\n"
176 " jl 0b\n" 175 " jl 0b\n"
177 : "=&d" (old), "=m" (*(int *) ptr) 176 : "=&d" (old), "=m" (*(int *) ptr)
178 : "d" (x), "a" (ptr), "m" (*(int *) ptr) 177 : "d" (x), "a" (ptr), "m" (*(int *) ptr)
179 : "memory", "cc" ); 178 : "memory", "cc");
180 x = old; 179 x = old;
181 break; 180 break;
182#ifdef __s390x__ 181#ifdef __s390x__
183 case 8: 182 case 8:
184 asm volatile ( 183 asm volatile(
185 " lg %0,0(%3)\n" 184 " lg %0,0(%3)\n"
186 "0: csg %0,%2,0(%3)\n" 185 "0: csg %0,%2,0(%3)\n"
187 " jl 0b\n" 186 " jl 0b\n"
188 : "=&d" (old), "=m" (*(long *) ptr) 187 : "=&d" (old), "=m" (*(long *) ptr)
189 : "d" (x), "a" (ptr), "m" (*(long *) ptr) 188 : "d" (x), "a" (ptr), "m" (*(long *) ptr)
190 : "memory", "cc" ); 189 : "memory", "cc");
191 x = old; 190 x = old;
192 break; 191 break;
193#endif /* __s390x__ */ 192#endif /* __s390x__ */
@@ -219,55 +218,55 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
219 shift = (3 ^ (addr & 3)) << 3; 218 shift = (3 ^ (addr & 3)) << 3;
220 addr ^= addr & 3; 219 addr ^= addr & 3;
221 asm volatile( 220 asm volatile(
222 " l %0,0(%4)\n" 221 " l %0,0(%4)\n"
223 "0: nr %0,%5\n" 222 "0: nr %0,%5\n"
224 " lr %1,%0\n" 223 " lr %1,%0\n"
225 " or %0,%2\n" 224 " or %0,%2\n"
226 " or %1,%3\n" 225 " or %1,%3\n"
227 " cs %0,%1,0(%4)\n" 226 " cs %0,%1,0(%4)\n"
228 " jnl 1f\n" 227 " jnl 1f\n"
229 " xr %1,%0\n" 228 " xr %1,%0\n"
230 " nr %1,%5\n" 229 " nr %1,%5\n"
231 " jnz 0b\n" 230 " jnz 0b\n"
232 "1:" 231 "1:"
233 : "=&d" (prev), "=&d" (tmp) 232 : "=&d" (prev), "=&d" (tmp)
234 : "d" (old << shift), "d" (new << shift), "a" (ptr), 233 : "d" (old << shift), "d" (new << shift), "a" (ptr),
235 "d" (~(255 << shift)) 234 "d" (~(255 << shift))
236 : "memory", "cc" ); 235 : "memory", "cc");
237 return prev >> shift; 236 return prev >> shift;
238 case 2: 237 case 2:
239 addr = (unsigned long) ptr; 238 addr = (unsigned long) ptr;
240 shift = (2 ^ (addr & 2)) << 3; 239 shift = (2 ^ (addr & 2)) << 3;
241 addr ^= addr & 2; 240 addr ^= addr & 2;
242 asm volatile( 241 asm volatile(
243 " l %0,0(%4)\n" 242 " l %0,0(%4)\n"
244 "0: nr %0,%5\n" 243 "0: nr %0,%5\n"
245 " lr %1,%0\n" 244 " lr %1,%0\n"
246 " or %0,%2\n" 245 " or %0,%2\n"
247 " or %1,%3\n" 246 " or %1,%3\n"
248 " cs %0,%1,0(%4)\n" 247 " cs %0,%1,0(%4)\n"
249 " jnl 1f\n" 248 " jnl 1f\n"
250 " xr %1,%0\n" 249 " xr %1,%0\n"
251 " nr %1,%5\n" 250 " nr %1,%5\n"
252 " jnz 0b\n" 251 " jnz 0b\n"
253 "1:" 252 "1:"
254 : "=&d" (prev), "=&d" (tmp) 253 : "=&d" (prev), "=&d" (tmp)
255 : "d" (old << shift), "d" (new << shift), "a" (ptr), 254 : "d" (old << shift), "d" (new << shift), "a" (ptr),
256 "d" (~(65535 << shift)) 255 "d" (~(65535 << shift))
257 : "memory", "cc" ); 256 : "memory", "cc");
258 return prev >> shift; 257 return prev >> shift;
259 case 4: 258 case 4:
260 asm volatile ( 259 asm volatile(
261 " cs %0,%2,0(%3)\n" 260 " cs %0,%2,0(%3)\n"
262 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) 261 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
263 : "memory", "cc" ); 262 : "memory", "cc");
264 return prev; 263 return prev;
265#ifdef __s390x__ 264#ifdef __s390x__
266 case 8: 265 case 8:
267 asm volatile ( 266 asm volatile(
268 " csg %0,%2,0(%3)\n" 267 " csg %0,%2,0(%3)\n"
269 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) 268 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
270 : "memory", "cc" ); 269 : "memory", "cc");
271 return prev; 270 return prev;
272#endif /* __s390x__ */ 271#endif /* __s390x__ */
273 } 272 }
@@ -284,8 +283,8 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
284 * 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 ).
285 */ 284 */
286 285
287#define eieio() __asm__ __volatile__ ( "bcr 15,0" : : : "memory" ) 286#define eieio() asm volatile("bcr 15,0" : : : "memory")
288# define SYNC_OTHER_CORES(x) eieio() 287#define SYNC_OTHER_CORES(x) eieio()
289#define mb() eieio() 288#define mb() eieio()
290#define rmb() eieio() 289#define rmb() eieio()
291#define wmb() eieio() 290#define wmb() eieio()
@@ -299,151 +298,60 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
299 298
300 299
301#define set_mb(var, value) do { var = value; mb(); } while (0) 300#define set_mb(var, value) do { var = value; mb(); } while (0)
302#define set_wmb(var, value) do { var = value; wmb(); } while (0)
303
304/* interrupt control.. */
305#define local_irq_enable() ({ \
306 unsigned long __dummy; \
307 __asm__ __volatile__ ( \
308 "stosm 0(%1),0x03" \
309 : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \
310 })
311
312#define local_irq_disable() ({ \
313 unsigned long __flags; \
314 __asm__ __volatile__ ( \
315 "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
316 __flags; \
317 })
318
319#define local_save_flags(x) \
320 __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) )
321
322#define local_irq_restore(x) \
323 __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory")
324
325#define irqs_disabled() \
326({ \
327 unsigned long flags; \
328 local_save_flags(flags); \
329 !((flags >> __FLAG_SHIFT) & 3); \
330})
331 301
332#ifdef __s390x__ 302#ifdef __s390x__
333 303
334#define __ctl_load(array, low, high) ({ \ 304#define __ctl_load(array, low, high) ({ \
335 typedef struct { char _[sizeof(array)]; } addrtype; \ 305 typedef struct { char _[sizeof(array)]; } addrtype; \
336 __asm__ __volatile__ ( \ 306 asm volatile( \
337 " bras 1,0f\n" \ 307 " lctlg %1,%2,0(%0)\n" \
338 " lctlg 0,0,0(%0)\n" \ 308 : : "a" (&array), "i" (low), "i" (high), \
339 "0: ex %1,0(1)" \ 309 "m" (*(addrtype *)(array))); \
340 : : "a" (&array), "a" (((low)<<4)+(high)), \
341 "m" (*(addrtype *)(array)) : "1" ); \
342 }) 310 })
343 311
344#define __ctl_store(array, low, high) ({ \ 312#define __ctl_store(array, low, high) ({ \
345 typedef struct { char _[sizeof(array)]; } addrtype; \ 313 typedef struct { char _[sizeof(array)]; } addrtype; \
346 __asm__ __volatile__ ( \ 314 asm volatile( \
347 " bras 1,0f\n" \ 315 " stctg %2,%3,0(%1)\n" \
348 " stctg 0,0,0(%1)\n" \ 316 : "=m" (*(addrtype *)(array)) \
349 "0: ex %2,0(1)" \ 317 : "a" (&array), "i" (low), "i" (high)); \
350 : "=m" (*(addrtype *)(array)) \
351 : "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \
352 }) 318 })
353 319
354#define __ctl_set_bit(cr, bit) ({ \
355 __u8 __dummy[24]; \
356 __asm__ __volatile__ ( \
357 " bras 1,0f\n" /* skip indirect insns */ \
358 " stctg 0,0,0(%1)\n" \
359 " lctlg 0,0,0(%1)\n" \
360 "0: ex %2,0(1)\n" /* execute stctl */ \
361 " lg 0,0(%1)\n" \
362 " ogr 0,%3\n" /* set the bit */ \
363 " stg 0,0(%1)\n" \
364 "1: ex %2,6(1)" /* execute lctl */ \
365 : "=m" (__dummy) \
366 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
367 "a" (cr*17), "a" (1L<<(bit)) \
368 : "cc", "0", "1" ); \
369 })
370
371#define __ctl_clear_bit(cr, bit) ({ \
372 __u8 __dummy[16]; \
373 __asm__ __volatile__ ( \
374 " bras 1,0f\n" /* skip indirect insns */ \
375 " stctg 0,0,0(%1)\n" \
376 " lctlg 0,0,0(%1)\n" \
377 "0: ex %2,0(1)\n" /* execute stctl */ \
378 " lg 0,0(%1)\n" \
379 " ngr 0,%3\n" /* set the bit */ \
380 " stg 0,0(%1)\n" \
381 "1: ex %2,6(1)" /* execute lctl */ \
382 : "=m" (__dummy) \
383 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
384 "a" (cr*17), "a" (~(1L<<(bit))) \
385 : "cc", "0", "1" ); \
386 })
387
388#else /* __s390x__ */ 320#else /* __s390x__ */
389 321
390#define __ctl_load(array, low, high) ({ \ 322#define __ctl_load(array, low, high) ({ \
391 typedef struct { char _[sizeof(array)]; } addrtype; \ 323 typedef struct { char _[sizeof(array)]; } addrtype; \
392 __asm__ __volatile__ ( \ 324 asm volatile( \
393 " bras 1,0f\n" \ 325 " lctl %1,%2,0(%0)\n" \
394 " lctl 0,0,0(%0)\n" \ 326 : : "a" (&array), "i" (low), "i" (high), \
395 "0: ex %1,0(1)" \ 327 "m" (*(addrtype *)(array))); \
396 : : "a" (&array), "a" (((low)<<4)+(high)), \ 328})
397 "m" (*(addrtype *)(array)) : "1" ); \
398 })
399 329
400#define __ctl_store(array, low, high) ({ \ 330#define __ctl_store(array, low, high) ({ \
401 typedef struct { char _[sizeof(array)]; } addrtype; \ 331 typedef struct { char _[sizeof(array)]; } addrtype; \
402 __asm__ __volatile__ ( \ 332 asm volatile( \
403 " bras 1,0f\n" \ 333 " stctl %2,%3,0(%1)\n" \
404 " stctl 0,0,0(%1)\n" \ 334 : "=m" (*(addrtype *)(array)) \
405 "0: ex %2,0(1)" \ 335 : "a" (&array), "i" (low), "i" (high)); \
406 : "=m" (*(addrtype *)(array)) \
407 : "a" (&array), "a" (((low)<<4)+(high)): "1" ); \
408 }) 336 })
409 337
410#define __ctl_set_bit(cr, bit) ({ \
411 __u8 __dummy[16]; \
412 __asm__ __volatile__ ( \
413 " bras 1,0f\n" /* skip indirect insns */ \
414 " stctl 0,0,0(%1)\n" \
415 " lctl 0,0,0(%1)\n" \
416 "0: ex %2,0(1)\n" /* execute stctl */ \
417 " l 0,0(%1)\n" \
418 " or 0,%3\n" /* set the bit */ \
419 " st 0,0(%1)\n" \
420 "1: ex %2,4(1)" /* execute lctl */ \
421 : "=m" (__dummy) \
422 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
423 "a" (cr*17), "a" (1<<(bit)) \
424 : "cc", "0", "1" ); \
425 })
426
427#define __ctl_clear_bit(cr, bit) ({ \
428 __u8 __dummy[16]; \
429 __asm__ __volatile__ ( \
430 " bras 1,0f\n" /* skip indirect insns */ \
431 " stctl 0,0,0(%1)\n" \
432 " lctl 0,0,0(%1)\n" \
433 "0: ex %2,0(1)\n" /* execute stctl */ \
434 " l 0,0(%1)\n" \
435 " nr 0,%3\n" /* set the bit */ \
436 " st 0,0(%1)\n" \
437 "1: ex %2,4(1)" /* execute lctl */ \
438 : "=m" (__dummy) \
439 : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \
440 "a" (cr*17), "a" (~(1<<(bit))) \
441 : "cc", "0", "1" ); \
442 })
443#endif /* __s390x__ */ 338#endif /* __s390x__ */
444 339
445/* For spinlocks etc */ 340#define __ctl_set_bit(cr, bit) ({ \
446#define local_irq_save(x) ((x) = local_irq_disable()) 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
354#include <linux/irqflags.h>
447 355
448/* 356/*
449 * Use to set psw mask except for the first byte which 357 * Use to set psw mask except for the first byte which
@@ -452,8 +360,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
452static inline void 360static inline void
453__set_psw_mask(unsigned long mask) 361__set_psw_mask(unsigned long mask)
454{ 362{
455 local_save_flags(mask); 363 __load_psw_mask(mask | (__raw_local_irq_stosm(0x00) & ~(-1UL >> 8)));
456 __load_psw_mask(mask);
457} 364}
458 365
459#define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS) 366#define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS)
@@ -482,4 +389,3 @@ extern void (*_machine_power_off)(void);
482#endif /* __KERNEL__ */ 389#endif /* __KERNEL__ */
483 390
484#endif 391#endif
485
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h
index 8e0c7ed73d..0a518915bf 100644
--- a/include/asm-s390/thread_info.h
+++ b/include/asm-s390/thread_info.h
@@ -63,6 +63,7 @@ struct thread_info {
63 .exec_domain = &default_exec_domain, \ 63 .exec_domain = &default_exec_domain, \
64 .flags = 0, \ 64 .flags = 0, \
65 .cpu = 0, \ 65 .cpu = 0, \
66 .preempt_count = 1, \
66 .restart_block = { \ 67 .restart_block = { \
67 .fn = do_no_restart_syscall, \ 68 .fn = do_no_restart_syscall, \
68 }, \ 69 }, \
diff --git a/include/asm-s390/timex.h b/include/asm-s390/timex.h
index 4848057daf..4df4a41029 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__("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__("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 73cd85bebf..fa4dc916a9 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 0b7c0ca4c3..72ae4efddb 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
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
60 49
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 50#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 51
@@ -85,76 +74,51 @@ struct exception_table_entry
85 unsigned long insn, fixup; 74 unsigned long insn, fixup;
86}; 75};
87 76
88#ifndef __s390x__ 77struct uaccess_ops {
89#define __uaccess_fixup \ 78 size_t (*copy_from_user)(size_t, const void __user *, void *);
90 ".section .fixup,\"ax\"\n" \ 79 size_t (*copy_from_user_small)(size_t, const void __user *, void *);
91 "2: lhi %0,%4\n" \ 80 size_t (*copy_to_user)(size_t, void __user *, const void *);
92 " bras 1,3f\n" \ 81 size_t (*copy_to_user_small)(size_t, void __user *, const void *);
93 " .long 1b\n" \ 82 size_t (*copy_in_user)(size_t, void __user *, const void __user *);
94 "3: l 1,0(1)\n" \ 83 size_t (*clear_user)(size_t, void __user *);
95 " br 1\n" \ 84 size_t (*strnlen_user)(size_t, const char __user *);
96 ".previous\n" \ 85 size_t (*strncpy_from_user)(size_t, const char __user *, char *);
97 ".section __ex_table,\"a\"\n" \ 86 int (*futex_atomic_op)(int op, int __user *, int oparg, int *old);
98 " .align 4\n" \ 87 int (*futex_atomic_cmpxchg)(int __user *, int old, int new);
99 " .long 0b,2b\n" \ 88};
100 ".previous" 89
101#define __uaccess_clobber "cc", "1" 90extern struct uaccess_ops uaccess;
102#else /* __s390x__ */ 91extern struct uaccess_ops uaccess_std;
103#define __uaccess_fixup \ 92extern struct uaccess_ops uaccess_mvcos;
104 ".section .fixup,\"ax\"\n" \ 93
105 "2: lghi %0,%4\n" \ 94static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
106 " jg 1b\n" \ 95{
107 ".previous\n" \ 96 size = uaccess.copy_to_user_small(size, ptr, x);
108 ".section __ex_table,\"a\"\n" \ 97 return size ? -EFAULT : size;
109 " .align 8\n" \ 98}
110 " .quad 0b,2b\n" \ 99
111 ".previous" 100static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
112#define __uaccess_clobber "cc" 101{
113#endif /* __s390x__ */ 102 size = uaccess.copy_from_user_small(size, ptr, x);
103 return size ? -EFAULT : size;
104}
114 105
115/* 106/*
116 * These are the main single-value transfer routines. They automatically 107 * These are the main single-value transfer routines. They automatically
117 * use the right size if we just have the right pointer type. 108 * use the right size if we just have the right pointer type.
118 */ 109 */
119#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
120#define __put_user_asm(x, ptr, err) \
121({ \
122 err = 0; \
123 asm volatile( \
124 "0: mvcs 0(%1,%2),%3,%0\n" \
125 "1:\n" \
126 __uaccess_fixup \
127 : "+&d" (err) \
128 : "d" (sizeof(*(ptr))), "a" (ptr), "Q" (x), \
129 "K" (-EFAULT) \
130 : __uaccess_clobber ); \
131})
132#else
133#define __put_user_asm(x, ptr, err) \
134({ \
135 err = 0; \
136 asm volatile( \
137 "0: mvcs 0(%1,%2),0(%3),%0\n" \
138 "1:\n" \
139 __uaccess_fixup \
140 : "+&d" (err) \
141 : "d" (sizeof(*(ptr))), "a" (ptr), "a" (&(x)), \
142 "K" (-EFAULT), "m" (x) \
143 : __uaccess_clobber ); \
144})
145#endif
146
147#define __put_user(x, ptr) \ 110#define __put_user(x, ptr) \
148({ \ 111({ \
149 __typeof__(*(ptr)) __x = (x); \ 112 __typeof__(*(ptr)) __x = (x); \
150 int __pu_err; \ 113 int __pu_err = -EFAULT; \
151 __chk_user_ptr(ptr); \ 114 __chk_user_ptr(ptr); \
152 switch (sizeof (*(ptr))) { \ 115 switch (sizeof (*(ptr))) { \
153 case 1: \ 116 case 1: \
154 case 2: \ 117 case 2: \
155 case 4: \ 118 case 4: \
156 case 8: \ 119 case 8: \
157 __put_user_asm(__x, ptr, __pu_err); \ 120 __pu_err = __put_user_fn(sizeof (*(ptr)), \
121 ptr, &__x); \
158 break; \ 122 break; \
159 default: \ 123 default: \
160 __put_user_bad(); \ 124 __put_user_bad(); \
@@ -172,60 +136,36 @@ struct exception_table_entry
172 136
173extern int __put_user_bad(void) __attribute__((noreturn)); 137extern int __put_user_bad(void) __attribute__((noreturn));
174 138
175#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
176#define __get_user_asm(x, ptr, err) \
177({ \
178 err = 0; \
179 asm volatile ( \
180 "0: mvcp %O1(%2,%R1),0(%3),%0\n" \
181 "1:\n" \
182 __uaccess_fixup \
183 : "+&d" (err), "=Q" (x) \
184 : "d" (sizeof(*(ptr))), "a" (ptr), \
185 "K" (-EFAULT) \
186 : __uaccess_clobber ); \
187})
188#else
189#define __get_user_asm(x, ptr, err) \
190({ \
191 err = 0; \
192 asm volatile ( \
193 "0: mvcp 0(%2,%5),0(%3),%0\n" \
194 "1:\n" \
195 __uaccess_fixup \
196 : "+&d" (err), "=m" (x) \
197 : "d" (sizeof(*(ptr))), "a" (ptr), \
198 "K" (-EFAULT), "a" (&(x)) \
199 : __uaccess_clobber ); \
200})
201#endif
202
203#define __get_user(x, ptr) \ 139#define __get_user(x, ptr) \
204({ \ 140({ \
205 int __gu_err; \ 141 int __gu_err = -EFAULT; \
206 __chk_user_ptr(ptr); \ 142 __chk_user_ptr(ptr); \
207 switch (sizeof(*(ptr))) { \ 143 switch (sizeof(*(ptr))) { \
208 case 1: { \ 144 case 1: { \
209 unsigned char __x; \ 145 unsigned char __x; \
210 __get_user_asm(__x, ptr, __gu_err); \ 146 __gu_err = __get_user_fn(sizeof (*(ptr)), \
147 ptr, &__x); \
211 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 148 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
212 break; \ 149 break; \
213 }; \ 150 }; \
214 case 2: { \ 151 case 2: { \
215 unsigned short __x; \ 152 unsigned short __x; \
216 __get_user_asm(__x, ptr, __gu_err); \ 153 __gu_err = __get_user_fn(sizeof (*(ptr)), \
154 ptr, &__x); \
217 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 155 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
218 break; \ 156 break; \
219 }; \ 157 }; \
220 case 4: { \ 158 case 4: { \
221 unsigned int __x; \ 159 unsigned int __x; \
222 __get_user_asm(__x, ptr, __gu_err); \ 160 __gu_err = __get_user_fn(sizeof (*(ptr)), \
161 ptr, &__x); \
223 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 162 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
224 break; \ 163 break; \
225 }; \ 164 }; \
226 case 8: { \ 165 case 8: { \
227 unsigned long long __x; \ 166 unsigned long long __x; \
228 __get_user_asm(__x, ptr, __gu_err); \ 167 __gu_err = __get_user_fn(sizeof (*(ptr)), \
168 ptr, &__x); \
229 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 169 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
230 break; \ 170 break; \
231 }; \ 171 }; \
@@ -247,8 +187,6 @@ extern int __get_user_bad(void) __attribute__((noreturn));
247#define __put_user_unaligned __put_user 187#define __put_user_unaligned __put_user
248#define __get_user_unaligned __get_user 188#define __get_user_unaligned __get_user
249 189
250extern long __copy_to_user_asm(const void *from, long n, void __user *to);
251
252/** 190/**
253 * __copy_to_user: - Copy a block of data into user space, with less checking. 191 * __copy_to_user: - Copy a block of data into user space, with less checking.
254 * @to: Destination address, in user space. 192 * @to: Destination address, in user space.
@@ -266,7 +204,10 @@ extern long __copy_to_user_asm(const void *from, long n, void __user *to);
266static inline unsigned long 204static inline unsigned long
267__copy_to_user(void __user *to, const void *from, unsigned long n) 205__copy_to_user(void __user *to, const void *from, unsigned long n)
268{ 206{
269 return __copy_to_user_asm(from, n, to); 207 if (__builtin_constant_p(n) && (n <= 256))
208 return uaccess.copy_to_user_small(n, to, from);
209 else
210 return uaccess.copy_to_user(n, to, from);
270} 211}
271 212
272#define __copy_to_user_inatomic __copy_to_user 213#define __copy_to_user_inatomic __copy_to_user
@@ -294,8 +235,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
294 return n; 235 return n;
295} 236}
296 237
297extern long __copy_from_user_asm(void *to, long n, const void __user *from);
298
299/** 238/**
300 * __copy_from_user: - Copy a block of data from user space, with less checking. 239 * __copy_from_user: - Copy a block of data from user space, with less checking.
301 * @to: Destination address, in kernel space. 240 * @to: Destination address, in kernel space.
@@ -316,7 +255,10 @@ extern long __copy_from_user_asm(void *to, long n, const void __user *from);
316static inline unsigned long 255static inline unsigned long
317__copy_from_user(void *to, const void __user *from, unsigned long n) 256__copy_from_user(void *to, const void __user *from, unsigned long n)
318{ 257{
319 return __copy_from_user_asm(to, n, from); 258 if (__builtin_constant_p(n) && (n <= 256))
259 return uaccess.copy_from_user_small(n, from, to);
260 else
261 return uaccess.copy_from_user(n, from, to);
320} 262}
321 263
322/** 264/**
@@ -346,13 +288,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
346 return n; 288 return n;
347} 289}
348 290
349extern unsigned long __copy_in_user_asm(const void __user *from, long n,
350 void __user *to);
351
352static inline unsigned long 291static inline unsigned long
353__copy_in_user(void __user *to, const void __user *from, unsigned long n) 292__copy_in_user(void __user *to, const void __user *from, unsigned long n)
354{ 293{
355 return __copy_in_user_asm(from, n, to); 294 return uaccess.copy_in_user(n, to, from);
356} 295}
357 296
358static inline unsigned long 297static inline unsigned long
@@ -360,34 +299,28 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
360{ 299{
361 might_sleep(); 300 might_sleep();
362 if (__access_ok(from,n) && __access_ok(to,n)) 301 if (__access_ok(from,n) && __access_ok(to,n))
363 n = __copy_in_user_asm(from, n, to); 302 n = __copy_in_user(to, from, n);
364 return n; 303 return n;
365} 304}
366 305
367/* 306/*
368 * Copy a null terminated string from userspace. 307 * Copy a null terminated string from userspace.
369 */ 308 */
370extern long __strncpy_from_user_asm(long count, char *dst,
371 const char __user *src);
372
373static inline long 309static inline long
374strncpy_from_user(char *dst, const char __user *src, long count) 310strncpy_from_user(char *dst, const char __user *src, long count)
375{ 311{
376 long res = -EFAULT; 312 long res = -EFAULT;
377 might_sleep(); 313 might_sleep();
378 if (access_ok(VERIFY_READ, src, 1)) 314 if (access_ok(VERIFY_READ, src, 1))
379 res = __strncpy_from_user_asm(count, dst, src); 315 res = uaccess.strncpy_from_user(count, src, dst);
380 return res; 316 return res;
381} 317}
382 318
383
384extern long __strnlen_user_asm(long count, const char __user *src);
385
386static inline unsigned long 319static inline unsigned long
387strnlen_user(const char __user * src, unsigned long n) 320strnlen_user(const char __user * src, unsigned long n)
388{ 321{
389 might_sleep(); 322 might_sleep();
390 return __strnlen_user_asm(n, src); 323 return uaccess.strnlen_user(n, src);
391} 324}
392 325
393/** 326/**
@@ -410,12 +343,10 @@ strnlen_user(const char __user * src, unsigned long n)
410 * Zero Userspace 343 * Zero Userspace
411 */ 344 */
412 345
413extern long __clear_user_asm(void __user *to, long n);
414
415static inline unsigned long 346static inline unsigned long
416__clear_user(void __user *to, unsigned long n) 347__clear_user(void __user *to, unsigned long n)
417{ 348{
418 return __clear_user_asm(to, n); 349 return uaccess.clear_user(n, to);
419} 350}
420 351
421static inline unsigned long 352static inline unsigned long
@@ -423,7 +354,7 @@ clear_user(void __user *to, unsigned long n)
423{ 354{
424 might_sleep(); 355 might_sleep();
425 if (access_ok(VERIFY_WRITE, to, n)) 356 if (access_ok(VERIFY_WRITE, to, n))
426 n = __clear_user_asm(to, n); 357 n = uaccess.clear_user(n, to);
427 return n; 358 return n;
428} 359}
429 360
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index e21443d3ea..0361ac5dcd 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -25,17 +25,12 @@
25#define __NR_unlink 10 25#define __NR_unlink 10
26#define __NR_execve 11 26#define __NR_execve 11
27#define __NR_chdir 12 27#define __NR_chdir 12
28#define __NR_time 13
29#define __NR_mknod 14 28#define __NR_mknod 14
30#define __NR_chmod 15 29#define __NR_chmod 15
31#define __NR_lchown 16
32#define __NR_lseek 19 30#define __NR_lseek 19
33#define __NR_getpid 20 31#define __NR_getpid 20
34#define __NR_mount 21 32#define __NR_mount 21
35#define __NR_umount 22 33#define __NR_umount 22
36#define __NR_setuid 23
37#define __NR_getuid 24
38#define __NR_stime 25
39#define __NR_ptrace 26 34#define __NR_ptrace 26
40#define __NR_alarm 27 35#define __NR_alarm 27
41#define __NR_pause 29 36#define __NR_pause 29
@@ -51,11 +46,7 @@
51#define __NR_pipe 42 46#define __NR_pipe 42
52#define __NR_times 43 47#define __NR_times 43
53#define __NR_brk 45 48#define __NR_brk 45
54#define __NR_setgid 46
55#define __NR_getgid 47
56#define __NR_signal 48 49#define __NR_signal 48
57#define __NR_geteuid 49
58#define __NR_getegid 50
59#define __NR_acct 51 50#define __NR_acct 51
60#define __NR_umount2 52 51#define __NR_umount2 52
61#define __NR_ioctl 54 52#define __NR_ioctl 54
@@ -69,18 +60,13 @@
69#define __NR_getpgrp 65 60#define __NR_getpgrp 65
70#define __NR_setsid 66 61#define __NR_setsid 66
71#define __NR_sigaction 67 62#define __NR_sigaction 67
72#define __NR_setreuid 70
73#define __NR_setregid 71
74#define __NR_sigsuspend 72 63#define __NR_sigsuspend 72
75#define __NR_sigpending 73 64#define __NR_sigpending 73
76#define __NR_sethostname 74 65#define __NR_sethostname 74
77#define __NR_setrlimit 75 66#define __NR_setrlimit 75
78#define __NR_getrlimit 76
79#define __NR_getrusage 77 67#define __NR_getrusage 77
80#define __NR_gettimeofday 78 68#define __NR_gettimeofday 78
81#define __NR_settimeofday 79 69#define __NR_settimeofday 79
82#define __NR_getgroups 80
83#define __NR_setgroups 81
84#define __NR_symlink 83 70#define __NR_symlink 83
85#define __NR_readlink 85 71#define __NR_readlink 85
86#define __NR_uselib 86 72#define __NR_uselib 86
@@ -92,12 +78,10 @@
92#define __NR_truncate 92 78#define __NR_truncate 92
93#define __NR_ftruncate 93 79#define __NR_ftruncate 93
94#define __NR_fchmod 94 80#define __NR_fchmod 94
95#define __NR_fchown 95
96#define __NR_getpriority 96 81#define __NR_getpriority 96
97#define __NR_setpriority 97 82#define __NR_setpriority 97
98#define __NR_statfs 99 83#define __NR_statfs 99
99#define __NR_fstatfs 100 84#define __NR_fstatfs 100
100#define __NR_ioperm 101
101#define __NR_socketcall 102 85#define __NR_socketcall 102
102#define __NR_syslog 103 86#define __NR_syslog 103
103#define __NR_setitimer 104 87#define __NR_setitimer 104
@@ -131,11 +115,7 @@
131#define __NR_sysfs 135 115#define __NR_sysfs 135
132#define __NR_personality 136 116#define __NR_personality 136
133#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 117#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
134#define __NR_setfsuid 138
135#define __NR_setfsgid 139
136#define __NR__llseek 140
137#define __NR_getdents 141 118#define __NR_getdents 141
138#define __NR__newselect 142
139#define __NR_flock 143 119#define __NR_flock 143
140#define __NR_msync 144 120#define __NR_msync 144
141#define __NR_readv 145 121#define __NR_readv 145
@@ -157,13 +137,9 @@
157#define __NR_sched_rr_get_interval 161 137#define __NR_sched_rr_get_interval 161
158#define __NR_nanosleep 162 138#define __NR_nanosleep 162
159#define __NR_mremap 163 139#define __NR_mremap 163
160#define __NR_setresuid 164
161#define __NR_getresuid 165
162#define __NR_query_module 167 140#define __NR_query_module 167
163#define __NR_poll 168 141#define __NR_poll 168
164#define __NR_nfsservctl 169 142#define __NR_nfsservctl 169
165#define __NR_setresgid 170
166#define __NR_getresgid 171
167#define __NR_prctl 172 143#define __NR_prctl 172
168#define __NR_rt_sigreturn 173 144#define __NR_rt_sigreturn 173
169#define __NR_rt_sigaction 174 145#define __NR_rt_sigaction 174
@@ -174,7 +150,6 @@
174#define __NR_rt_sigsuspend 179 150#define __NR_rt_sigsuspend 179
175#define __NR_pread64 180 151#define __NR_pread64 180
176#define __NR_pwrite64 181 152#define __NR_pwrite64 181
177#define __NR_chown 182
178#define __NR_getcwd 183 153#define __NR_getcwd 183
179#define __NR_capget 184 154#define __NR_capget 184
180#define __NR_capset 185 155#define __NR_capset 185
@@ -183,39 +158,11 @@
183#define __NR_getpmsg 188 158#define __NR_getpmsg 188
184#define __NR_putpmsg 189 159#define __NR_putpmsg 189
185#define __NR_vfork 190 160#define __NR_vfork 190
186#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
187#define __NR_mmap2 192
188#define __NR_truncate64 193
189#define __NR_ftruncate64 194
190#define __NR_stat64 195
191#define __NR_lstat64 196
192#define __NR_fstat64 197
193#define __NR_lchown32 198
194#define __NR_getuid32 199
195#define __NR_getgid32 200
196#define __NR_geteuid32 201
197#define __NR_getegid32 202
198#define __NR_setreuid32 203
199#define __NR_setregid32 204
200#define __NR_getgroups32 205
201#define __NR_setgroups32 206
202#define __NR_fchown32 207
203#define __NR_setresuid32 208
204#define __NR_getresuid32 209
205#define __NR_setresgid32 210
206#define __NR_getresgid32 211
207#define __NR_chown32 212
208#define __NR_setuid32 213
209#define __NR_setgid32 214
210#define __NR_setfsuid32 215
211#define __NR_setfsgid32 216
212#define __NR_pivot_root 217 161#define __NR_pivot_root 217
213#define __NR_mincore 218 162#define __NR_mincore 218
214#define __NR_madvise 219 163#define __NR_madvise 219
215#define __NR_getdents64 220 164#define __NR_getdents64 220
216#define __NR_fcntl64 221
217#define __NR_readahead 222 165#define __NR_readahead 222
218#define __NR_sendfile64 223
219#define __NR_setxattr 224 166#define __NR_setxattr 224
220#define __NR_lsetxattr 225 167#define __NR_lsetxattr 225
221#define __NR_fsetxattr 226 168#define __NR_fsetxattr 226
@@ -256,7 +203,6 @@
256#define __NR_clock_getres (__NR_timer_create+7) 203#define __NR_clock_getres (__NR_timer_create+7)
257#define __NR_clock_nanosleep (__NR_timer_create+8) 204#define __NR_clock_nanosleep (__NR_timer_create+8)
258/* Number 263 is reserved for vserver */ 205/* Number 263 is reserved for vserver */
259#define __NR_fadvise64_64 264
260#define __NR_statfs64 265 206#define __NR_statfs64 265
261#define __NR_fstatfs64 266 207#define __NR_fstatfs64 266
262#define __NR_remap_file_pages 267 208#define __NR_remap_file_pages 267
@@ -285,7 +231,6 @@
285#define __NR_mknodat 290 231#define __NR_mknodat 290
286#define __NR_fchownat 291 232#define __NR_fchownat 291
287#define __NR_futimesat 292 233#define __NR_futimesat 292
288#define __NR_fstatat64 293
289#define __NR_unlinkat 294 234#define __NR_unlinkat 294
290#define __NR_renameat 295 235#define __NR_renameat 295
291#define __NR_linkat 296 236#define __NR_linkat 296
@@ -310,62 +255,65 @@
310 * have a different name although they do the same (e.g. __NR_chown32 255 * have a different name although they do the same (e.g. __NR_chown32
311 * is __NR_chown on 64 bit). 256 * is __NR_chown on 64 bit).
312 */ 257 */
313#ifdef __s390x__ 258#ifndef __s390x__
314#undef __NR_time 259
315#undef __NR_lchown 260#define __NR_time 13
316#undef __NR_setuid 261#define __NR_lchown 16
317#undef __NR_getuid 262#define __NR_setuid 23
318#undef __NR_stime 263#define __NR_getuid 24
319#undef __NR_setgid 264#define __NR_stime 25
320#undef __NR_getgid 265#define __NR_setgid 46
321#undef __NR_geteuid 266#define __NR_getgid 47
322#undef __NR_getegid 267#define __NR_geteuid 49
323#undef __NR_setreuid 268#define __NR_getegid 50
324#undef __NR_setregid 269#define __NR_setreuid 70
325#undef __NR_getrlimit 270#define __NR_setregid 71
326#undef __NR_getgroups 271#define __NR_getrlimit 76
327#undef __NR_setgroups 272#define __NR_getgroups 80
328#undef __NR_fchown 273#define __NR_setgroups 81
329#undef __NR_ioperm 274#define __NR_fchown 95
330#undef __NR_setfsuid 275#define __NR_ioperm 101
331#undef __NR_setfsgid 276#define __NR_setfsuid 138
332#undef __NR__llseek 277#define __NR_setfsgid 139
333#undef __NR__newselect 278#define __NR__llseek 140
334#undef __NR_setresuid 279#define __NR__newselect 142
335#undef __NR_getresuid 280#define __NR_setresuid 164
336#undef __NR_setresgid 281#define __NR_getresuid 165
337#undef __NR_getresgid 282#define __NR_setresgid 170
338#undef __NR_chown 283#define __NR_getresgid 171
339#undef __NR_ugetrlimit 284#define __NR_chown 182
340#undef __NR_mmap2 285#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
341#undef __NR_truncate64 286#define __NR_mmap2 192
342#undef __NR_ftruncate64 287#define __NR_truncate64 193
343#undef __NR_stat64 288#define __NR_ftruncate64 194
344#undef __NR_lstat64 289#define __NR_stat64 195
345#undef __NR_fstat64 290#define __NR_lstat64 196
346#undef __NR_lchown32 291#define __NR_fstat64 197
347#undef __NR_getuid32 292#define __NR_lchown32 198
348#undef __NR_getgid32 293#define __NR_getuid32 199
349#undef __NR_geteuid32 294#define __NR_getgid32 200
350#undef __NR_getegid32 295#define __NR_geteuid32 201
351#undef __NR_setreuid32 296#define __NR_getegid32 202
352#undef __NR_setregid32 297#define __NR_setreuid32 203
353#undef __NR_getgroups32 298#define __NR_setregid32 204
354#undef __NR_setgroups32 299#define __NR_getgroups32 205
355#undef __NR_fchown32 300#define __NR_setgroups32 206
356#undef __NR_setresuid32 301#define __NR_fchown32 207
357#undef __NR_getresuid32 302#define __NR_setresuid32 208
358#undef __NR_setresgid32 303#define __NR_getresuid32 209
359#undef __NR_getresgid32 304#define __NR_setresgid32 210
360#undef __NR_chown32 305#define __NR_getresgid32 211
361#undef __NR_setuid32 306#define __NR_chown32 212
362#undef __NR_setgid32 307#define __NR_setuid32 213
363#undef __NR_setfsuid32 308#define __NR_setgid32 214
364#undef __NR_setfsgid32 309#define __NR_setfsuid32 215
365#undef __NR_fcntl64 310#define __NR_setfsgid32 216
366#undef __NR_sendfile64 311#define __NR_fcntl64 221
367#undef __NR_fadvise64_64 312#define __NR_sendfile64 223
368#undef __NR_fstatat64 313#define __NR_fadvise64_64 264
314#define __NR_fstatat64 293
315
316#else
369 317
370#define __NR_select 142 318#define __NR_select 142
371#define __NR_getrlimit 191 /* SuS compliant getrlimit */ 319#define __NR_getrlimit 191 /* SuS compliant getrlimit */
@@ -394,11 +342,11 @@
394 342
395#ifdef __KERNEL__ 343#ifdef __KERNEL__
396 344
397/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */ 345#include <linux/err.h>
398 346
399#define __syscall_return(type, res) \ 347#define __syscall_return(type, res) \
400do { \ 348do { \
401 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 349 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
402 errno = -(res); \ 350 errno = -(res); \
403 res = -1; \ 351 res = -1; \
404 } \ 352 } \
@@ -407,145 +355,145 @@ do { \
407 355
408#define _svc_clobber "1", "cc", "memory" 356#define _svc_clobber "1", "cc", "memory"
409 357
410#define _syscall0(type,name) \ 358#define _syscall0(type,name) \
411type name(void) { \ 359type name(void) { \
412 register long __svcres asm("2"); \ 360 register long __svcres asm("2"); \
413 long __res; \ 361 long __res; \
414 __asm__ __volatile__ ( \ 362 asm volatile( \
415 " .if %1 < 256\n" \ 363 " .if %1 < 256\n" \
416 " svc %b1\n" \ 364 " svc %b1\n" \
417 " .else\n" \ 365 " .else\n" \
418 " la %%r1,%1\n" \ 366 " la %%r1,%1\n" \
419 " svc 0\n" \ 367 " svc 0\n" \
420 " .endif" \ 368 " .endif" \
421 : "=d" (__svcres) \ 369 : "=d" (__svcres) \
422 : "i" (__NR_##name) \ 370 : "i" (__NR_##name) \
423 : _svc_clobber ); \ 371 : _svc_clobber); \
424 __res = __svcres; \ 372 __res = __svcres; \
425 __syscall_return(type,__res); \ 373 __syscall_return(type,__res); \
426} 374}
427 375
428#define _syscall1(type,name,type1,arg1) \ 376#define _syscall1(type,name,type1,arg1) \
429type name(type1 arg1) { \ 377type name(type1 arg1) { \
430 register type1 __arg1 asm("2") = arg1; \ 378 register type1 __arg1 asm("2") = arg1; \
431 register long __svcres asm("2"); \ 379 register long __svcres asm("2"); \
432 long __res; \ 380 long __res; \
433 __asm__ __volatile__ ( \ 381 asm volatile( \
434 " .if %1 < 256\n" \ 382 " .if %1 < 256\n" \
435 " svc %b1\n" \ 383 " svc %b1\n" \
436 " .else\n" \ 384 " .else\n" \
437 " la %%r1,%1\n" \ 385 " la %%r1,%1\n" \
438 " svc 0\n" \ 386 " svc 0\n" \
439 " .endif" \ 387 " .endif" \
440 : "=d" (__svcres) \ 388 : "=d" (__svcres) \
441 : "i" (__NR_##name), \ 389 : "i" (__NR_##name), \
442 "0" (__arg1) \ 390 "0" (__arg1) \
443 : _svc_clobber ); \ 391 : _svc_clobber); \
444 __res = __svcres; \ 392 __res = __svcres; \
445 __syscall_return(type,__res); \ 393 __syscall_return(type,__res); \
446} 394}
447 395
448#define _syscall2(type,name,type1,arg1,type2,arg2) \ 396#define _syscall2(type,name,type1,arg1,type2,arg2) \
449type name(type1 arg1, type2 arg2) { \ 397type name(type1 arg1, type2 arg2) { \
450 register type1 __arg1 asm("2") = arg1; \ 398 register type1 __arg1 asm("2") = arg1; \
451 register type2 __arg2 asm("3") = arg2; \ 399 register type2 __arg2 asm("3") = arg2; \
452 register long __svcres asm("2"); \ 400 register long __svcres asm("2"); \
453 long __res; \ 401 long __res; \
454 __asm__ __volatile__ ( \ 402 asm volatile( \
455 " .if %1 < 256\n" \ 403 " .if %1 < 256\n" \
456 " svc %b1\n" \ 404 " svc %b1\n" \
457 " .else\n" \ 405 " .else\n" \
458 " la %%r1,%1\n" \ 406 " la %%r1,%1\n" \
459 " svc 0\n" \ 407 " svc 0\n" \
460 " .endif" \ 408 " .endif" \
461 : "=d" (__svcres) \ 409 : "=d" (__svcres) \
462 : "i" (__NR_##name), \ 410 : "i" (__NR_##name), \
463 "0" (__arg1), \ 411 "0" (__arg1), \
464 "d" (__arg2) \ 412 "d" (__arg2) \
465 : _svc_clobber ); \ 413 : _svc_clobber ); \
466 __res = __svcres; \ 414 __res = __svcres; \
467 __syscall_return(type,__res); \ 415 __syscall_return(type,__res); \
468} 416}
469 417
470#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\ 418#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
471type name(type1 arg1, type2 arg2, type3 arg3) { \ 419type name(type1 arg1, type2 arg2, type3 arg3) { \
472 register type1 __arg1 asm("2") = arg1; \ 420 register type1 __arg1 asm("2") = arg1; \
473 register type2 __arg2 asm("3") = arg2; \ 421 register type2 __arg2 asm("3") = arg2; \
474 register type3 __arg3 asm("4") = arg3; \ 422 register type3 __arg3 asm("4") = arg3; \
475 register long __svcres asm("2"); \ 423 register long __svcres asm("2"); \
476 long __res; \ 424 long __res; \
477 __asm__ __volatile__ ( \ 425 asm volatile( \
478 " .if %1 < 256\n" \ 426 " .if %1 < 256\n" \
479 " svc %b1\n" \ 427 " svc %b1\n" \
480 " .else\n" \ 428 " .else\n" \
481 " la %%r1,%1\n" \ 429 " la %%r1,%1\n" \
482 " svc 0\n" \ 430 " svc 0\n" \
483 " .endif" \ 431 " .endif" \
484 : "=d" (__svcres) \ 432 : "=d" (__svcres) \
485 : "i" (__NR_##name), \ 433 : "i" (__NR_##name), \
486 "0" (__arg1), \ 434 "0" (__arg1), \
487 "d" (__arg2), \ 435 "d" (__arg2), \
488 "d" (__arg3) \ 436 "d" (__arg3) \
489 : _svc_clobber ); \ 437 : _svc_clobber); \
490 __res = __svcres; \ 438 __res = __svcres; \
491 __syscall_return(type,__res); \ 439 __syscall_return(type,__res); \
492} 440}
493 441
494#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\ 442#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
495 type4,name4) \ 443 type4,name4) \
496type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ 444type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
497 register type1 __arg1 asm("2") = arg1; \ 445 register type1 __arg1 asm("2") = arg1; \
498 register type2 __arg2 asm("3") = arg2; \ 446 register type2 __arg2 asm("3") = arg2; \
499 register type3 __arg3 asm("4") = arg3; \ 447 register type3 __arg3 asm("4") = arg3; \
500 register type4 __arg4 asm("5") = arg4; \ 448 register type4 __arg4 asm("5") = arg4; \
501 register long __svcres asm("2"); \ 449 register long __svcres asm("2"); \
502 long __res; \ 450 long __res; \
503 __asm__ __volatile__ ( \ 451 asm volatile( \
504 " .if %1 < 256\n" \ 452 " .if %1 < 256\n" \
505 " svc %b1\n" \ 453 " svc %b1\n" \
506 " .else\n" \ 454 " .else\n" \
507 " la %%r1,%1\n" \ 455 " la %%r1,%1\n" \
508 " svc 0\n" \ 456 " svc 0\n" \
509 " .endif" \ 457 " .endif" \
510 : "=d" (__svcres) \ 458 : "=d" (__svcres) \
511 : "i" (__NR_##name), \ 459 : "i" (__NR_##name), \
512 "0" (__arg1), \ 460 "0" (__arg1), \
513 "d" (__arg2), \ 461 "d" (__arg2), \
514 "d" (__arg3), \ 462 "d" (__arg3), \
515 "d" (__arg4) \ 463 "d" (__arg4) \
516 : _svc_clobber ); \ 464 : _svc_clobber); \
517 __res = __svcres; \ 465 __res = __svcres; \
518 __syscall_return(type,__res); \ 466 __syscall_return(type,__res); \
519} 467}
520 468
521#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\ 469#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
522 type4,name4,type5,name5) \ 470 type4,name4,type5,name5) \
523type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 471type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
524 type5 arg5) { \ 472 type5 arg5) { \
525 register type1 __arg1 asm("2") = arg1; \ 473 register type1 __arg1 asm("2") = arg1; \
526 register type2 __arg2 asm("3") = arg2; \ 474 register type2 __arg2 asm("3") = arg2; \
527 register type3 __arg3 asm("4") = arg3; \ 475 register type3 __arg3 asm("4") = arg3; \
528 register type4 __arg4 asm("5") = arg4; \ 476 register type4 __arg4 asm("5") = arg4; \
529 register type5 __arg5 asm("6") = arg5; \ 477 register type5 __arg5 asm("6") = arg5; \
530 register long __svcres asm("2"); \ 478 register long __svcres asm("2"); \
531 long __res; \ 479 long __res; \
532 __asm__ __volatile__ ( \ 480 asm volatile( \
533 " .if %1 < 256\n" \ 481 " .if %1 < 256\n" \
534 " svc %b1\n" \ 482 " svc %b1\n" \
535 " .else\n" \ 483 " .else\n" \
536 " la %%r1,%1\n" \ 484 " la %%r1,%1\n" \
537 " svc 0\n" \ 485 " svc 0\n" \
538 " .endif" \ 486 " .endif" \
539 : "=d" (__svcres) \ 487 : "=d" (__svcres) \
540 : "i" (__NR_##name), \ 488 : "i" (__NR_##name), \
541 "0" (__arg1), \ 489 "0" (__arg1), \
542 "d" (__arg2), \ 490 "d" (__arg2), \
543 "d" (__arg3), \ 491 "d" (__arg3), \
544 "d" (__arg4), \ 492 "d" (__arg4), \
545 "d" (__arg5) \ 493 "d" (__arg5) \
546 : _svc_clobber ); \ 494 : _svc_clobber); \
547 __res = __svcres; \ 495 __res = __svcres; \
548 __syscall_return(type,__res); \ 496 __syscall_return(type,__res); \
549} 497}
550 498
551#define __ARCH_WANT_IPC_PARSE_VERSION 499#define __ARCH_WANT_IPC_PARSE_VERSION
diff --git a/include/asm-s390/z90crypt.h b/include/asm-s390/z90crypt.h
deleted file mode 100644
index 31a2439b07..0000000000
--- a/include/asm-s390/z90crypt.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2 * include/asm-s390/z90crypt.h
3 *
4 * z90crypt 1.3.3 (user-visible header)
5 *
6 * Copyright (C) 2001, 2005 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_Z90CRYPT_H
28#define __ASM_S390_Z90CRYPT_H
29#include <linux/ioctl.h>
30
31#define z90crypt_VERSION 1
32#define z90crypt_RELEASE 3 // 2 = PCIXCC, 3 = rewrite for coding standards
33#define z90crypt_VARIANT 3 // 3 = CEX2A support
34
35/**
36 * struct ica_rsa_modexpo
37 *
38 * Requirements:
39 * - outputdatalength is at least as large as inputdatalength.
40 * - All key parts are right justified in their fields, padded on
41 * the left with zeroes.
42 * - length(b_key) = inputdatalength
43 * - length(n_modulus) = inputdatalength
44 */
45struct ica_rsa_modexpo {
46 char __user * inputdata;
47 unsigned int inputdatalength;
48 char __user * outputdata;
49 unsigned int outputdatalength;
50 char __user * b_key;
51 char __user * n_modulus;
52};
53
54/**
55 * struct ica_rsa_modexpo_crt
56 *
57 * Requirements:
58 * - inputdatalength is even.
59 * - outputdatalength is at least as large as inputdatalength.
60 * - All key parts are right justified in their fields, padded on
61 * the left with zeroes.
62 * - length(bp_key) = inputdatalength/2 + 8
63 * - length(bq_key) = inputdatalength/2
64 * - length(np_key) = inputdatalength/2 + 8
65 * - length(nq_key) = inputdatalength/2
66 * - length(u_mult_inv) = inputdatalength/2 + 8
67 */
68struct ica_rsa_modexpo_crt {
69 char __user * inputdata;
70 unsigned int inputdatalength;
71 char __user * outputdata;
72 unsigned int outputdatalength;
73 char __user * bp_key;
74 char __user * bq_key;
75 char __user * np_prime;
76 char __user * nq_prime;
77 char __user * u_mult_inv;
78};
79
80#define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks
81
82/**
83 * Interface notes:
84 *
85 * The ioctl()s which are implemented (along with relevant details)
86 * are:
87 *
88 * ICARSAMODEXPO
89 * Perform an RSA operation using a Modulus-Exponent pair
90 * This takes an ica_rsa_modexpo struct as its arg.
91 *
92 * NOTE: please refer to the comments preceding this structure
93 * for the implementation details for the contents of the
94 * block
95 *
96 * ICARSACRT
97 * Perform an RSA operation using a Chinese-Remainder Theorem key
98 * This takes an ica_rsa_modexpo_crt struct as its arg.
99 *
100 * NOTE: please refer to the comments preceding this structure
101 * for the implementation details for the contents of the
102 * block
103 *
104 * Z90STAT_TOTALCOUNT
105 * Return an integer count of all device types together.
106 *
107 * Z90STAT_PCICACOUNT
108 * Return an integer count of all PCICAs.
109 *
110 * Z90STAT_PCICCCOUNT
111 * Return an integer count of all PCICCs.
112 *
113 * Z90STAT_PCIXCCMCL2COUNT
114 * Return an integer count of all MCL2 PCIXCCs.
115 *
116 * Z90STAT_PCIXCCMCL3COUNT
117 * Return an integer count of all MCL3 PCIXCCs.
118 *
119 * Z90STAT_CEX2CCOUNT
120 * Return an integer count of all CEX2Cs.
121 *
122 * Z90STAT_CEX2ACOUNT
123 * Return an integer count of all CEX2As.
124 *
125 * Z90STAT_REQUESTQ_COUNT
126 * Return an integer count of the number of entries waiting to be
127 * sent to a device.
128 *
129 * Z90STAT_PENDINGQ_COUNT
130 * Return an integer count of the number of entries sent to a
131 * device awaiting the reply.
132 *
133 * Z90STAT_TOTALOPEN_COUNT
134 * Return an integer count of the number of open file handles.
135 *
136 * Z90STAT_DOMAIN_INDEX
137 * Return the integer value of the Cryptographic Domain.
138 *
139 * Z90STAT_STATUS_MASK
140 * Return an 64 element array of unsigned chars for the status of
141 * all devices.
142 * 0x01: PCICA
143 * 0x02: PCICC
144 * 0x03: PCIXCC_MCL2
145 * 0x04: PCIXCC_MCL3
146 * 0x05: CEX2C
147 * 0x06: CEX2A
148 * 0x0d: device is disabled via the proc filesystem
149 *
150 * Z90STAT_QDEPTH_MASK
151 * Return an 64 element array of unsigned chars for the queue
152 * depth of all devices.
153 *
154 * Z90STAT_PERDEV_REQCNT
155 * Return an 64 element array of unsigned integers for the number
156 * of successfully completed requests per device since the device
157 * was detected and made available.
158 *
159 * ICAZ90STATUS (deprecated)
160 * Return some device driver status in a ica_z90_status struct
161 * This takes an ica_z90_status struct as its arg.
162 *
163 * NOTE: this ioctl() is deprecated, and has been replaced with
164 * single ioctl()s for each type of status being requested
165 *
166 * Z90STAT_PCIXCCCOUNT (deprecated)
167 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
168 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
169 * MCL2 PCIXCCs.
170 *
171 * Z90QUIESCE (not recommended)
172 * Quiesce the driver. This is intended to stop all new
173 * requests from being processed. Its use is NOT recommended,
174 * except in circumstances where there is no other way to stop
175 * callers from accessing the driver. Its original use was to
176 * allow the driver to be "drained" of work in preparation for
177 * a system shutdown.
178 *
179 * NOTE: once issued, this ban on new work cannot be undone
180 * except by unloading and reloading the driver.
181 */
182
183/**
184 * Supported ioctl calls
185 */
186#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x05, 0)
187#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x06, 0)
188
189/* DEPRECATED status calls (bound for removal at some point) */
190#define ICAZ90STATUS _IOR(Z90_IOCTL_MAGIC, 0x10, struct ica_z90_status)
191#define Z90STAT_PCIXCCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x43, int)
192
193/* unrelated to ICA callers */
194#define Z90QUIESCE _IO(Z90_IOCTL_MAGIC, 0x11)
195
196/* New status calls */
197#define Z90STAT_TOTALCOUNT _IOR(Z90_IOCTL_MAGIC, 0x40, int)
198#define Z90STAT_PCICACOUNT _IOR(Z90_IOCTL_MAGIC, 0x41, int)
199#define Z90STAT_PCICCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x42, int)
200#define Z90STAT_PCIXCCMCL2COUNT _IOR(Z90_IOCTL_MAGIC, 0x4b, int)
201#define Z90STAT_PCIXCCMCL3COUNT _IOR(Z90_IOCTL_MAGIC, 0x4c, int)
202#define Z90STAT_CEX2CCOUNT _IOR(Z90_IOCTL_MAGIC, 0x4d, int)
203#define Z90STAT_CEX2ACOUNT _IOR(Z90_IOCTL_MAGIC, 0x4e, int)
204#define Z90STAT_REQUESTQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x44, int)
205#define Z90STAT_PENDINGQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x45, int)
206#define Z90STAT_TOTALOPEN_COUNT _IOR(Z90_IOCTL_MAGIC, 0x46, int)
207#define Z90STAT_DOMAIN_INDEX _IOR(Z90_IOCTL_MAGIC, 0x47, int)
208#define Z90STAT_STATUS_MASK _IOR(Z90_IOCTL_MAGIC, 0x48, char[64])
209#define Z90STAT_QDEPTH_MASK _IOR(Z90_IOCTL_MAGIC, 0x49, char[64])
210#define Z90STAT_PERDEV_REQCNT _IOR(Z90_IOCTL_MAGIC, 0x4a, int[64])
211
212#endif /* __ASM_S390_Z90CRYPT_H */
diff --git a/include/asm-s390/zcrypt.h b/include/asm-s390/zcrypt.h
new file mode 100644
index 0000000000..7244c68464
--- /dev/null
+++ b/include/asm-s390/zcrypt.h
@@ -0,0 +1,285 @@
1/*
2 * include/asm-s390/zcrypt.h
3 *
4 * zcrypt 2.1.0 (user-visible header)
5 *
6 * Copyright (C) 2001, 2006 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_ZCRYPT_H
28#define __ASM_S390_ZCRYPT_H
29
30#define ZCRYPT_VERSION 2
31#define ZCRYPT_RELEASE 1
32#define ZCRYPT_VARIANT 0
33
34#include <linux/ioctl.h>
35#include <linux/compiler.h>
36
37/**
38 * struct ica_rsa_modexpo
39 *
40 * Requirements:
41 * - outputdatalength is at least as large as inputdatalength.
42 * - All key parts are right justified in their fields, padded on
43 * the left with zeroes.
44 * - length(b_key) = inputdatalength
45 * - length(n_modulus) = inputdatalength
46 */
47struct ica_rsa_modexpo {
48 char __user * inputdata;
49 unsigned int inputdatalength;
50 char __user * outputdata;
51 unsigned int outputdatalength;
52 char __user * b_key;
53 char __user * n_modulus;
54};
55
56/**
57 * struct ica_rsa_modexpo_crt
58 *
59 * Requirements:
60 * - inputdatalength is even.
61 * - outputdatalength is at least as large as inputdatalength.
62 * - All key parts are right justified in their fields, padded on
63 * the left with zeroes.
64 * - length(bp_key) = inputdatalength/2 + 8
65 * - length(bq_key) = inputdatalength/2
66 * - length(np_key) = inputdatalength/2 + 8
67 * - length(nq_key) = inputdatalength/2
68 * - length(u_mult_inv) = inputdatalength/2 + 8
69 */
70struct ica_rsa_modexpo_crt {
71 char __user * inputdata;
72 unsigned int inputdatalength;
73 char __user * outputdata;
74 unsigned int outputdatalength;
75 char __user * bp_key;
76 char __user * bq_key;
77 char __user * np_prime;
78 char __user * nq_prime;
79 char __user * u_mult_inv;
80};
81
82/**
83 * CPRBX
84 * Note that all shorts and ints are big-endian.
85 * All pointer fields are 16 bytes long, and mean nothing.
86 *
87 * A request CPRB is followed by a request_parameter_block.
88 *
89 * The request (or reply) parameter block is organized thus:
90 * function code
91 * VUD block
92 * key block
93 */
94struct ica_CPRBX {
95 unsigned short cprb_len; /* CPRB length 220 */
96 unsigned char cprb_ver_id; /* CPRB version id. 0x02 */
97 unsigned char pad_000[3]; /* Alignment pad bytes */
98 unsigned char func_id[2]; /* function id 0x5432 */
99 unsigned char cprb_flags[4]; /* Flags */
100 unsigned int req_parml; /* request parameter buffer len */
101 unsigned int req_datal; /* request data buffer */
102 unsigned int rpl_msgbl; /* reply message block length */
103 unsigned int rpld_parml; /* replied parameter block len */
104 unsigned int rpl_datal; /* reply data block len */
105 unsigned int rpld_datal; /* replied data block len */
106 unsigned int req_extbl; /* request extension block len */
107 unsigned char pad_001[4]; /* reserved */
108 unsigned int rpld_extbl; /* replied extension block len */
109 unsigned char padx000[16 - sizeof (char *)];
110 unsigned char * req_parmb; /* request parm block 'address' */
111 unsigned char padx001[16 - sizeof (char *)];
112 unsigned char * req_datab; /* request data block 'address' */
113 unsigned char padx002[16 - sizeof (char *)];
114 unsigned char * rpl_parmb; /* reply parm block 'address' */
115 unsigned char padx003[16 - sizeof (char *)];
116 unsigned char * rpl_datab; /* reply data block 'address' */
117 unsigned char padx004[16 - sizeof (char *)];
118 unsigned char * req_extb; /* request extension block 'addr'*/
119 unsigned char padx005[16 - sizeof (char *)];
120 unsigned char * rpl_extb; /* reply extension block 'addres'*/
121 unsigned short ccp_rtcode; /* server return code */
122 unsigned short ccp_rscode; /* server reason code */
123 unsigned int mac_data_len; /* Mac Data Length */
124 unsigned char logon_id[8]; /* Logon Identifier */
125 unsigned char mac_value[8]; /* Mac Value */
126 unsigned char mac_content_flgs;/* Mac content flag byte */
127 unsigned char pad_002; /* Alignment */
128 unsigned short domain; /* Domain */
129 unsigned char usage_domain[4];/* Usage domain */
130 unsigned char cntrl_domain[4];/* Control domain */
131 unsigned char S390enf_mask[4];/* S/390 enforcement mask */
132 unsigned char pad_004[36]; /* reserved */
133};
134
135/**
136 * xcRB
137 */
138struct ica_xcRB {
139 unsigned short agent_ID;
140 unsigned int user_defined;
141 unsigned short request_ID;
142 unsigned int request_control_blk_length;
143 unsigned char padding1[16 - sizeof (char *)];
144 char __user * request_control_blk_addr;
145 unsigned int request_data_length;
146 char padding2[16 - sizeof (char *)];
147 char __user * request_data_address;
148 unsigned int reply_control_blk_length;
149 char padding3[16 - sizeof (char *)];
150 char __user * reply_control_blk_addr;
151 unsigned int reply_data_length;
152 char padding4[16 - sizeof (char *)];
153 char __user * reply_data_addr;
154 unsigned short priority_window;
155 unsigned int status;
156} __attribute__((packed));
157#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
158
159#define ZCRYPT_IOCTL_MAGIC 'z'
160
161/**
162 * Interface notes:
163 *
164 * The ioctl()s which are implemented (along with relevant details)
165 * are:
166 *
167 * ICARSAMODEXPO
168 * Perform an RSA operation using a Modulus-Exponent pair
169 * This takes an ica_rsa_modexpo struct as its arg.
170 *
171 * NOTE: please refer to the comments preceding this structure
172 * for the implementation details for the contents of the
173 * block
174 *
175 * ICARSACRT
176 * Perform an RSA operation using a Chinese-Remainder Theorem key
177 * This takes an ica_rsa_modexpo_crt struct as its arg.
178 *
179 * NOTE: please refer to the comments preceding this structure
180 * for the implementation details for the contents of the
181 * block
182 *
183 * Z90STAT_TOTALCOUNT
184 * Return an integer count of all device types together.
185 *
186 * Z90STAT_PCICACOUNT
187 * Return an integer count of all PCICAs.
188 *
189 * Z90STAT_PCICCCOUNT
190 * Return an integer count of all PCICCs.
191 *
192 * Z90STAT_PCIXCCMCL2COUNT
193 * Return an integer count of all MCL2 PCIXCCs.
194 *
195 * Z90STAT_PCIXCCMCL3COUNT
196 * Return an integer count of all MCL3 PCIXCCs.
197 *
198 * Z90STAT_CEX2CCOUNT
199 * Return an integer count of all CEX2Cs.
200 *
201 * Z90STAT_CEX2ACOUNT
202 * Return an integer count of all CEX2As.
203 *
204 * Z90STAT_REQUESTQ_COUNT
205 * Return an integer count of the number of entries waiting to be
206 * sent to a device.
207 *
208 * Z90STAT_PENDINGQ_COUNT
209 * Return an integer count of the number of entries sent to a
210 * device awaiting the reply.
211 *
212 * Z90STAT_TOTALOPEN_COUNT
213 * Return an integer count of the number of open file handles.
214 *
215 * Z90STAT_DOMAIN_INDEX
216 * Return the integer value of the Cryptographic Domain.
217 *
218 * Z90STAT_STATUS_MASK
219 * Return an 64 element array of unsigned chars for the status of
220 * all devices.
221 * 0x01: PCICA
222 * 0x02: PCICC
223 * 0x03: PCIXCC_MCL2
224 * 0x04: PCIXCC_MCL3
225 * 0x05: CEX2C
226 * 0x06: CEX2A
227 * 0x0d: device is disabled via the proc filesystem
228 *
229 * Z90STAT_QDEPTH_MASK
230 * Return an 64 element array of unsigned chars for the queue
231 * depth of all devices.
232 *
233 * Z90STAT_PERDEV_REQCNT
234 * Return an 64 element array of unsigned integers for the number
235 * of successfully completed requests per device since the device
236 * was detected and made available.
237 *
238 * ICAZ90STATUS (deprecated)
239 * Return some device driver status in a ica_z90_status struct
240 * This takes an ica_z90_status struct as its arg.
241 *
242 * NOTE: this ioctl() is deprecated, and has been replaced with
243 * single ioctl()s for each type of status being requested
244 *
245 * Z90STAT_PCIXCCCOUNT (deprecated)
246 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
247 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
248 * MCL2 PCIXCCs.
249 *
250 * Z90QUIESCE (not recommended)
251 * Quiesce the driver. This is intended to stop all new
252 * requests from being processed. Its use is NOT recommended,
253 * except in circumstances where there is no other way to stop
254 * callers from accessing the driver. Its original use was to
255 * allow the driver to be "drained" of work in preparation for
256 * a system shutdown.
257 *
258 * NOTE: once issued, this ban on new work cannot be undone
259 * except by unloading and reloading the driver.
260 */
261
262/**
263 * Supported ioctl calls
264 */
265#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0)
266#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
267#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
268
269/* New status calls */
270#define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int)
271#define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int)
272#define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int)
273#define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int)
274#define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int)
275#define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int)
276#define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int)
277#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
278#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
279#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
280#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
281#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
282#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
283#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
284
285#endif /* __ASM_S390_ZCRYPT_H */
diff --git a/include/asm-sh/Kbuild b/include/asm-sh/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-sh/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
index 720afc11c2..b860218e40 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 ab1225f1d5..0000000000
--- 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 0000000000..8b091e9365
--- /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 fb627de217..8bdc1ba56f 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 fc21e4db58..1b6916e63e 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/bitops.h b/include/asm-sh/bitops.h
index e34f825085..1c16792cee 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 a6de3d06a3..b4000c8bf3 100644
--- a/include/asm-sh/bugs.h
+++ b/include/asm-sh/bugs.h
@@ -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 656fdfe9e8..e3a180cf50 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 9dfb33edb0..07f62ec9ff 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 753b8466ad..0000000000
--- 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 fa03b30c42..08168afe67 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 0000000000..4bccd7c032
--- /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 817c1821ee..0000000000
--- 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 406aa8d9b9..ffe08d2813 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 f51aed00c6..03fde97a7f 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 b61b6e331d..273f322978 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 a844ea0965..bccb7ddb43 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/shmparam.h b/include/asm-sh/cpu-sh3/shmparam.h
deleted file mode 100644
index da5b5eec81..0000000000
--- 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 3d8e95e8d1..b2394cf76f 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 0f809dec4e..9d308cbe9b 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 727634d886..bb2e1b0306 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 1fe2035931..6e9c7e6ee8 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 f323567e08..515fd57426 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 0000000000..6c90d28331
--- /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 0dfe61f148..3e4b3e6d80 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/shmparam.h b/include/asm-sh/cpu-sh4/shmparam.h
deleted file mode 100644
index a5a0aa9425..0000000000
--- 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 366b09166d..586d649181 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 09aecc0669..0000000000
--- 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 124968f986..56cd4b9772 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 e62a6d0ed9..d9daa02868 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 21bd416c01..0000000000
--- 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/elf.h b/include/asm-sh/elf.h
index 1b63dfeea4..3a07ab40ac 100644
--- a/include/asm-sh/elf.h
+++ b/include/asm-sh/elf.h
@@ -1,6 +1,11 @@
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/processor.h>
5#include <asm/auxvec.h>
6#include <asm/ptrace.h>
7#include <asm/user.h>
8
4/* SH relocation types */ 9/* SH relocation types */
5#define R_SH_NONE 0 10#define R_SH_NONE 0
6#define R_SH_DIR32 1 11#define R_SH_DIR32 1
@@ -46,9 +51,6 @@
46 * ELF register definitions.. 51 * ELF register definitions..
47 */ 52 */
48 53
49#include <asm/ptrace.h>
50#include <asm/user.h>
51
52typedef unsigned long elf_greg_t; 54typedef unsigned long elf_greg_t;
53 55
54#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 56#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
@@ -91,7 +93,7 @@ typedef struct user_fpu_struct elf_fpregset_t;
91 instruction set this CPU supports. This could be done in user space, 93 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. */ 94 but it's not easy, and we've already done it here. */
93 95
94#define ELF_HWCAP (0) 96#define ELF_HWCAP (boot_cpu_data.flags)
95 97
96/* This yields a string that ld.so will use to load implementation 98/* This yields a string that ld.so will use to load implementation
97 specific libraries for optimization. This is more specific in 99 specific libraries for optimization. This is more specific in
@@ -119,4 +121,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) 121#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
120#endif 122#endif
121 123
124#ifdef CONFIG_VSYSCALL
125/* vDSO has arch_setup_additional_pages */
126#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
127struct linux_binprm;
128extern int arch_setup_additional_pages(struct linux_binprm *bprm,
129 int executable_stack);
130
131extern unsigned int vdso_enabled;
132extern void __kernel_vsyscall;
133
134#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
135#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
136
137#define ARCH_DLINFO \
138do { \
139 if (vdso_enabled) \
140 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
141} while (0)
142#endif /* CONFIG_VSYSCALL */
143
122#endif /* __ASM_SH_ELF_H */ 144#endif /* __ASM_SH_ELF_H */
diff --git a/include/asm-sh/fixmap.h b/include/asm-sh/fixmap.h
index 412bccaa07..458e9fa595 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 f29072e1c8..0d5cc04ab0 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/floppy.h b/include/asm-sh/floppy.h
index 38d7a29424..dc1ad464fa 100644
--- a/include/asm-sh/floppy.h
+++ b/include/asm-sh/floppy.h
@@ -146,13 +146,11 @@ static int vdma_get_dma_residue(unsigned int dummy)
146static int fd_request_irq(void) 146static int fd_request_irq(void)
147{ 147{
148 if(can_use_virtual_dma) 148 if(can_use_virtual_dma)
149 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 149 return request_irq(FLOPPY_IRQ, floppy_hardint,
150 "floppy", NULL); 150 IRQF_DISABLED, "floppy", NULL);
151 else 151 else
152 return request_irq(FLOPPY_IRQ, floppy_interrupt, 152 return request_irq(FLOPPY_IRQ, floppy_interrupt,
153 SA_INTERRUPT|SA_SAMPLE_RANDOM, 153 IRQF_DISABLED, "floppy", NULL);
154 "floppy", NULL);
155
156} 154}
157 155
158static unsigned long dma_mem_alloc(unsigned long size) 156static unsigned long dma_mem_alloc(unsigned long size)
diff --git a/include/asm-sh/harp/harp.h b/include/asm-sh/harp/harp.h
deleted file mode 100644
index b2fbcfae99..0000000000
--- 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 68f39e0b39..0000000000
--- 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 87f13d24c6..27e5c34e26 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 67f2489088..0000000000
--- 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/hp6xx/hp6xx.h b/include/asm-sh/hp6xx/hp6xx.h
index a26247fd3d..f35134c159 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 7317980035..2044476ab1 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 5f995f937a..c4cff9d339 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/hw_irq.h b/include/asm-sh/hw_irq.h
index 1d934fb2c5..fed2661696 100644
--- a/include/asm-sh/hw_irq.h
+++ b/include/asm-sh/hw_irq.h
@@ -1,9 +1,4 @@
1#ifndef __ASM_SH_HW_IRQ_H 1#ifndef __ASM_SH_HW_IRQ_H
2#define __ASM_SH_HW_IRQ_H 2#define __ASM_SH_HW_IRQ_H
3 3
4static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
5{
6 /* Nothing to do */
7}
8
9#endif /* __ASM_SH_HW_IRQ_H */ 4#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index 894e64b2d5..ed12d38e8c 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 d705252be2..b28af9a69d 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 0000000000..5d15419b53
--- /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 7f90315cd8..895c5780e4 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 611e67cd06..0e5f365aff 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 9dfe59f6fc..9d235af20c 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 1653ffb75f..7b26f53fe3 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 0000000000..3fce4c451a
--- /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 0000000000..6490e28415
--- /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 0000000000..c74d3c73f3
--- /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 550501fa4f..70389b72ff 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 1707cfb291..0aee96a973 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 72f07be611..cf47df79bb 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 6760d064bd..c7088efe57 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/keyboard.h b/include/asm-sh/mpc1211/keyboard.h
index 5f0b9088c7..71ef4cf424 100644
--- a/include/asm-sh/mpc1211/keyboard.h
+++ b/include/asm-sh/mpc1211/keyboard.h
@@ -57,7 +57,7 @@ extern unsigned char pckbd_sysrq_xlate[128];
57#define AUX_IRQ 12 57#define AUX_IRQ 12
58 58
59#define aux_request_irq(hand, dev_id) \ 59#define aux_request_irq(hand, dev_id) \
60 request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS2 Mouse", dev_id) 60 request_irq(AUX_IRQ, hand, IRQF_SHARED, "PS2 Mouse", dev_id)
61 61
62#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) 62#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
63 63
diff --git a/include/asm-sh/overdrive/fpga.h b/include/asm-sh/overdrive/fpga.h
deleted file mode 100644
index 1cd87992c1..0000000000
--- 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 01d58bc13a..0000000000
--- 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 0dba700e96..0000000000
--- 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 fc746c244f..0000000000
--- 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 a5559e3874..ca8b26d904 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
@@ -104,7 +108,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
104 108
105/* PFN start number, because of __MEMORY_START */ 109/* PFN start number, because of __MEMORY_START */
106#define PFN_START (__MEMORY_START >> PAGE_SHIFT) 110#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
107#define ARCH_PFN_OFFSET (FPN_START) 111#define ARCH_PFN_OFFSET (PFN_START)
108#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 112#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
109#define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr) 113#define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr)
110#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 114#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
@@ -112,9 +116,13 @@ typedef struct { unsigned long pgprot; } pgprot_t;
112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 116#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 117 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
114 118
115#endif /* __KERNEL__ */
116
117#include <asm-generic/memory_model.h> 119#include <asm-generic/memory_model.h>
118#include <asm-generic/page.h> 120#include <asm-generic/page.h>
119 121
122/* vDSO support */
123#ifdef CONFIG_VSYSCALL
124#define __HAVE_ARCH_GATE_AREA
125#endif
126
127#endif /* __KERNEL__ */
120#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 0a523c85b1..6ccc948fe2 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 f4f233f7a4..e841465ab4 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-2level.h b/include/asm-sh/pgtable-2level.h
index b0528aa3cb..b525db6f61 100644
--- a/include/asm-sh/pgtable-2level.h
+++ b/include/asm-sh/pgtable-2level.h
@@ -50,9 +50,12 @@ static inline void pgd_clear (pgd_t * pgdp) { }
50#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) 50#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
51#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) 51#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
52 52
53#define pgd_page(pgd) \ 53#define pgd_page_vaddr(pgd) \
54((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) 54((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
55 55
56#define pgd_page(pgd) \
57 (phys_to_page(pgd_val(pgd)))
58
56static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) 59static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
57{ 60{
58 return (pmd_t *) dir; 61 return (pmd_t *) dir;
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index dcd23a0368..2c8682ad10 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.
@@ -225,7 +260,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
225static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 260static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
226{ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } 261{ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; }
227 262
228#define pmd_page_kernel(pmd) \ 263#define pmd_page_vaddr(pmd) \
229((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 264((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
230 265
231#define pmd_page(pmd) \ 266#define pmd_page(pmd) \
@@ -242,12 +277,17 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
242#define pte_index(address) \ 277#define pte_index(address) \
243 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 278 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
244#define pte_offset_kernel(dir, address) \ 279#define pte_offset_kernel(dir, address) \
245 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) 280 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
246#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 281#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
247#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) 282#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
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 0000000000..56fdbd6b1c
--- /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 fa5bd2d880..474773853c 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -9,10 +9,12 @@
9#define __ASM_SH_PROCESSOR_H 9#define __ASM_SH_PROCESSOR_H
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <linux/compiler.h>
12#include <asm/page.h> 13#include <asm/page.h>
13#include <asm/types.h> 14#include <asm/types.h>
14#include <asm/cache.h> 15#include <asm/cache.h>
15#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/cpu-features.h>
16 18
17/* 19/*
18 * Default implementation of macro that returns current 20 * Default implementation of macro that returns current
@@ -37,27 +39,30 @@ enum cpu_type {
37 CPU_SH7604, 39 CPU_SH7604,
38 40
39 /* SH-3 types */ 41 /* SH-3 types */
40 CPU_SH7705, CPU_SH7707, CPU_SH7708, CPU_SH7708S, CPU_SH7708R, 42 CPU_SH7705, CPU_SH7706, CPU_SH7707,
41 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,
42 46
43 /* SH-4 types */ 47 /* SH-4 types */
44 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, 48 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
45 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,
46 CPU_SH73180, CPU_SH7770, CPU_SH7780, CPU_SH7781, 50 CPU_SH73180, CPU_SH7343, CPU_SH7770, CPU_SH7780, CPU_SH7781,
47 51
48 /* Unknown subtype */ 52 /* Unknown subtype */
49 CPU_SH_NONE 53 CPU_SH_NONE
50}; 54};
51 55
52struct sh_cpuinfo { 56struct sh_cpuinfo {
53 enum cpu_type type; 57 unsigned int type;
54 unsigned long loops_per_jiffy; 58 unsigned long loops_per_jiffy;
55 59
56 struct cache_info icache; 60 struct cache_info icache; /* Primary I-cache */
57 struct cache_info dcache; 61 struct cache_info dcache; /* Primary D-cache */
62 struct cache_info scache; /* Secondary cache */
58 63
59 unsigned long flags; 64 unsigned long flags;
60}; 65} __attribute__ ((aligned(SMP_CACHE_BYTES)));
61 66
62extern struct sh_cpuinfo boot_cpu_data; 67extern struct sh_cpuinfo boot_cpu_data;
63 68
@@ -124,17 +129,6 @@ union sh_fpu_union {
124 struct sh_fpu_soft_struct soft; 129 struct sh_fpu_soft_struct soft;
125}; 130};
126 131
127/*
128 * Processor flags
129 */
130
131#define CPU_HAS_FPU 0x0001 /* Hardware FPU support */
132#define CPU_HAS_P2_FLUSH_BUG 0x0002 /* Need to flush the cache in P2 area */
133#define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */
134#define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */
135#define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */
136#define CPU_HAS_PTEA 0x0020 /* PTEA register */
137
138struct thread_struct { 132struct thread_struct {
139 unsigned long sp; 133 unsigned long sp;
140 unsigned long pc; 134 unsigned long pc;
@@ -148,6 +142,10 @@ struct thread_struct {
148 union sh_fpu_union fpu; 142 union sh_fpu_union fpu;
149}; 143};
150 144
145typedef struct {
146 unsigned long seg;
147} mm_segment_t;
148
151/* Count of active tasks with UBC settings */ 149/* Count of active tasks with UBC settings */
152extern int ubc_usercnt; 150extern int ubc_usercnt;
153 151
@@ -263,7 +261,26 @@ extern unsigned long get_wchan(struct task_struct *p);
263#define KSTK_ESP(tsk) ((tsk)->thread.sp) 261#define KSTK_ESP(tsk) ((tsk)->thread.sp)
264 262
265#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") 263#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
266#define cpu_relax() do { } while (0) 264#define cpu_relax() barrier()
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
267 284
268#endif /* __KERNEL__ */ 285#endif /* __KERNEL__ */
269#endif /* __ASM_SH_PROCESSOR_H */ 286#endif /* __ASM_SH_PROCESSOR_H */
diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h
index 792fc35bd6..ed358a376e 100644
--- a/include/asm-sh/ptrace.h
+++ b/include/asm-sh/ptrace.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_SH_PTRACE_H 1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H 2#define __ASM_SH_PTRACE_H
3 3
4#include <asm/ubc.h>
5
6/* 4/*
7 * Copyright (C) 1999, 2000 Niibe Yutaka 5 * Copyright (C) 1999, 2000 Niibe Yutaka
8 * 6 *
diff --git a/include/asm-sh/r7780rp/ide.h b/include/asm-sh/r7780rp/ide.h
new file mode 100644
index 0000000000..a1ed78e0f6
--- /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 0000000000..f95d9dba31
--- /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 cea9cdf9b9..91aacc9615 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/rts7751r2d.h b/include/asm-sh/rts7751r2d/rts7751r2d.h
index 4e09ba597e..b112ae221f 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
diff --git a/include/asm-sh/rwsem.h b/include/asm-sh/rwsem.h
index 0262d3d1e5..9d2aea5e84 100644
--- a/include/asm-sh/rwsem.h
+++ b/include/asm-sh/rwsem.h
@@ -25,24 +25,11 @@ struct rw_semaphore {
25#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 25#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
26 spinlock_t wait_lock; 26 spinlock_t wait_lock;
27 struct list_head wait_list; 27 struct list_head wait_list;
28#if RWSEM_DEBUG
29 int debug;
30#endif
31}; 28};
32 29
33/*
34 * initialisation
35 */
36#if RWSEM_DEBUG
37#define __RWSEM_DEBUG_INIT , 0
38#else
39#define __RWSEM_DEBUG_INIT /* */
40#endif
41
42#define __RWSEM_INITIALIZER(name) \ 30#define __RWSEM_INITIALIZER(name) \
43 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 31 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
44 LIST_HEAD_INIT((name).wait_list) \ 32 LIST_HEAD_INIT((name).wait_list) }
45 __RWSEM_DEBUG_INIT }
46 33
47#define DECLARE_RWSEM(name) \ 34#define DECLARE_RWSEM(name) \
48 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 35 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -57,9 +44,6 @@ static inline void init_rwsem(struct rw_semaphore *sem)
57 sem->count = RWSEM_UNLOCKED_VALUE; 44 sem->count = RWSEM_UNLOCKED_VALUE;
58 spin_lock_init(&sem->wait_lock); 45 spin_lock_init(&sem->wait_lock);
59 INIT_LIST_HEAD(&sem->wait_list); 46 INIT_LIST_HEAD(&sem->wait_list);
60#if RWSEM_DEBUG
61 sem->debug = 0;
62#endif
63} 47}
64 48
65/* 49/*
diff --git a/include/asm-sh/scatterlist.h b/include/asm-sh/scatterlist.h
index 7b91df1400..d19e7cd3b0 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 0000000000..52e73660c1
--- /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 791c5da038..a1832154a3 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 9eeb86cd6c..0000000000
--- 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 3ec1ded86c..4e24edccb3 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 c6af855297..0000000000
--- 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 f5b93e39e7..3a4acb3e38 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 c9cb1b9412..0000000000
--- 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 0000000000..e7914a54aa
--- /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 738e22bebd..88cd379d90 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 78d8f5744b..0000000000
--- 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 d19de7c8df..34ca8a7f06 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 0000000000..8a6399a8cf
--- /dev/null
+++ b/include/asm-sh/sfp-machine.h
@@ -0,0 +1,86 @@
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#include <linux/config.h>
29
30#define _FP_W_TYPE_SIZE 32
31#define _FP_W_TYPE unsigned long
32#define _FP_WS_TYPE signed long
33#define _FP_I_TYPE long
34
35#define _FP_MUL_MEAT_S(R,X,Y) \
36 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
37#define _FP_MUL_MEAT_D(R,X,Y) \
38 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
39#define _FP_MUL_MEAT_Q(R,X,Y) \
40 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
41
42#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
43#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
44#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
45
46#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
47#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
48#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
49#define _FP_NANSIGN_S 0
50#define _FP_NANSIGN_D 0
51#define _FP_NANSIGN_Q 0
52
53#define _FP_KEEPNANFRACP 1
54
55/*
56 * If one NaN is signaling and the other is not,
57 * we choose that one, otherwise we choose X.
58 */
59#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
60 do { \
61 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
62 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
63 { \
64 R##_s = Y##_s; \
65 _FP_FRAC_COPY_##wc(R,Y); \
66 } \
67 else \
68 { \
69 R##_s = X##_s; \
70 _FP_FRAC_COPY_##wc(R,X); \
71 } \
72 R##_c = FP_CLS_NAN; \
73 } while (0)
74
75//#define FP_ROUNDMODE FPSCR_RM
76#define FP_DENORM_ZERO 1/*FPSCR_DN*/
77
78/* Exception flags. */
79#define FP_EX_INVALID (1<<4)
80#define FP_EX_DIVZERO (1<<3)
81#define FP_EX_OVERFLOW (1<<2)
82#define FP_EX_UNDERFLOW (1<<1)
83#define FP_EX_INEXACT (1<<0)
84
85#endif
86
diff --git a/include/asm-sh/sh03/io.h b/include/asm-sh/sh03/io.h
index 25792e9831..df3b187ef8 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 8d547324d5..0000000000
--- 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 0000000000..36ba138a81
--- /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 0a95604b9b..ba1758d901 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/signal.h b/include/asm-sh/signal.h
index d6e8eb0e65..5c5c1e8520 100644
--- a/include/asm-sh/signal.h
+++ b/include/asm-sh/signal.h
@@ -75,7 +75,6 @@ typedef unsigned long sigset_t;
75 * SA_FLAGS values: 75 * SA_FLAGS values:
76 * 76 *
77 * SA_ONSTACK indicates that a registered stack_t will be used. 77 * SA_ONSTACK indicates that a registered stack_t will be used.
78 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
79 * SA_RESTART flag to get restarting signals (which were the default long ago) 78 * SA_RESTART flag to get restarting signals (which were the default long ago)
80 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
81 * SA_RESETHAND clears the handler when the signal is delivered. 80 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -95,7 +94,6 @@ typedef unsigned long sigset_t;
95 94
96#define SA_NOMASK SA_NODEFER 95#define SA_NOMASK SA_NODEFER
97#define SA_ONESHOT SA_RESETHAND 96#define SA_ONESHOT SA_RESETHAND
98#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
99 97
100#define SA_RESTORER 0x04000000 98#define SA_RESTORER 0x04000000
101 99
diff --git a/include/asm-sh/se/smc37c93x.h b/include/asm-sh/smc37c93x.h
index 585da2a8fc..585da2a8fc 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 f57c4fe969..71ecddf70d 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 bfa97ac062..6b5e4ddc07 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/socket.h b/include/asm-sh/socket.h
index 553904ff93..ca70362eb5 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* __ASM_SH_SOCKET_H */ 53#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index b752e5cbb8..6c1f8fde5a 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -6,13 +6,14 @@
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
12 */ 13 */
13 14
14#define switch_to(prev, next, last) do { \ 15#define switch_to(prev, next, last) do { \
15 task_t *__last; \ 16 struct task_struct *__last; \
16 register unsigned long *__ts1 __asm__ ("r1") = &prev->thread.sp; \ 17 register unsigned long *__ts1 __asm__ ("r1") = &prev->thread.sp; \
17 register unsigned long *__ts2 __asm__ ("r2") = &prev->thread.pc; \ 18 register unsigned long *__ts2 __asm__ ("r2") = &prev->thread.pc; \
18 register unsigned long *__ts4 __asm__ ("r4") = (unsigned long *)prev; \ 19 register unsigned long *__ts4 __asm__ ("r4") = (unsigned long *)prev; \
@@ -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()
@@ -101,10 +130,10 @@ extern void __xchg_called_with_bad_pointer(void);
101#endif 130#endif
102 131
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#define set_wmb(var, value) do { var = value; wmb(); } while (0)
105 133
106/* Interrupt Control */ 134/* Interrupt Control */
107static __inline__ void local_irq_enable(void) 135#ifdef CONFIG_CPU_HAS_SR_RB
136static inline void local_irq_enable(void)
108{ 137{
109 unsigned long __dummy0, __dummy1; 138 unsigned long __dummy0, __dummy1;
110 139
@@ -117,8 +146,22 @@ static __inline__ void local_irq_enable(void)
117 : "1" (~0x000000f0) 146 : "1" (~0x000000f0)
118 : "memory"); 147 : "memory");
119} 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
120 163
121static __inline__ void local_irq_disable(void) 164static inline void local_irq_disable(void)
122{ 165{
123 unsigned long __dummy; 166 unsigned long __dummy;
124 __asm__ __volatile__("stc sr, %0\n\t" 167 __asm__ __volatile__("stc sr, %0\n\t"
@@ -129,6 +172,31 @@ static __inline__ void local_irq_disable(void)
129 : "memory"); 172 : "memory");
130} 173}
131 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
132#define local_save_flags(x) \ 200#define local_save_flags(x) \
133 __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" ) 201 __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" )
134 202
@@ -139,7 +207,7 @@ static __inline__ void local_irq_disable(void)
139 (flags != 0); \ 207 (flags != 0); \
140}) 208})
141 209
142static __inline__ unsigned long local_irq_save(void) 210static inline unsigned long local_irq_save(void)
143{ 211{
144 unsigned long flags, __dummy; 212 unsigned long flags, __dummy;
145 213
@@ -155,35 +223,9 @@ static __inline__ unsigned long local_irq_save(void)
155 return flags; 223 return flags;
156} 224}
157 225
158#ifdef DEBUG_CLI_STI 226#define local_irq_restore(x) do { \
159static __inline__ void local_irq_restore(unsigned long x)
160{
161 if ((x & 0x000000f0) != 0x000000f0)
162 local_irq_enable();
163 else {
164 unsigned long flags;
165 local_save_flags(flags);
166
167 if (flags == 0) {
168 extern void dump_stack(void);
169 printk(KERN_ERR "BUG!\n");
170 dump_stack();
171 local_irq_disable();
172 }
173 }
174}
175#else
176#define local_irq_restore(x) do { \
177 if ((x & 0x000000f0) != 0x000000f0) \
178 local_irq_enable(); \
179} while (0)
180#endif
181
182#define really_restore_flags(x) do { \
183 if ((x & 0x000000f0) != 0x000000f0) \ 227 if ((x & 0x000000f0) != 0x000000f0) \
184 local_irq_enable(); \ 228 local_irq_enable(); \
185 else \
186 local_irq_disable(); \
187} while (0) 229} while (0)
188 230
189/* 231/*
@@ -211,8 +253,8 @@ do { \
211#define back_to_P1() \ 253#define back_to_P1() \
212do { \ 254do { \
213 unsigned long __dummy; \ 255 unsigned long __dummy; \
256 ctrl_barrier(); \
214 __asm__ __volatile__( \ 257 __asm__ __volatile__( \
215 "nop;nop;nop;nop;nop;nop;nop\n\t" \
216 "mov.l 1f, %0\n\t" \ 258 "mov.l 1f, %0\n\t" \
217 "jmp @%0\n\t" \ 259 "jmp @%0\n\t" \
218 " nop\n\t" \ 260 " nop\n\t" \
@@ -225,7 +267,7 @@ do { \
225/* For spinlocks etc */ 267/* For spinlocks etc */
226#define local_irq_save(x) x = local_irq_save() 268#define local_irq_save(x) x = local_irq_save()
227 269
228static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) 270static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
229{ 271{
230 unsigned long flags, retval; 272 unsigned long flags, retval;
231 273
@@ -236,7 +278,7 @@ static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val)
236 return retval; 278 return retval;
237} 279}
238 280
239static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) 281static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
240{ 282{
241 unsigned long flags, retval; 283 unsigned long flags, retval;
242 284
@@ -247,20 +289,70 @@ static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned lon
247 return retval; 289 return retval;
248} 290}
249 291
250static __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)
251{ 339{
252 switch (size) { 340 switch (size) {
253 case 4: 341 case 4:
254 return xchg_u32(ptr, x); 342 return __cmpxchg_u32(ptr, old, new);
255 break;
256 case 1:
257 return xchg_u8(ptr, x);
258 break;
259 } 343 }
260 __xchg_called_with_bad_pointer(); 344 __cmpxchg_called_with_bad_pointer();
261 return x; 345 return old;
262} 346}
263 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
264/* XXX 356/* XXX
265 * disable hlt during certain critical i/o operations 357 * disable hlt during certain critical i/o operations
266 */ 358 */
diff --git a/include/asm-sh/systemh/io.h b/include/asm-sh/systemh/io.h
deleted file mode 100644
index 327849b49d..0000000000
--- 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 4170531bdb..b143bb2a2c 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 7345350d98..3ebc3f9039 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 dd6579c0b0..c7ab28095b 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 0000000000..270a4f4bc8
--- /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 2cb01861e7..5c49ed6715 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 76b5430cb4..5d5e9f94de 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,6 +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
473#define __ARCH_WANT_SYS_RT_SIGSUSPEND
447 474
448#ifdef __KERNEL_SYSCALLS__ 475#ifdef __KERNEL_SYSCALLS__
449 476
diff --git a/include/asm-sh/rts7751r2d/voyagergx_reg.h b/include/asm-sh/voyagergx.h
index f031b5d6cf..99b0807d1c 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 09ca41972a..d19ea62ef8 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/Kbuild b/include/asm-sh64/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-sh64/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-sh64/bug.h b/include/asm-sh64/bug.h
index 81f722efeb..f3a9c9248e 100644
--- a/include/asm-sh64/bug.h
+++ b/include/asm-sh64/bug.h
@@ -1,7 +1,7 @@
1#ifndef __ASM_SH64_BUG_H 1#ifndef __ASM_SH64_BUG_H
2#define __ASM_SH64_BUG_H 2#define __ASM_SH64_BUG_H
3 3
4 4#ifdef CONFIG_BUG
5/* 5/*
6 * Tell the user there is some problem, then force a segfault (in process 6 * Tell the user there is some problem, then force a segfault (in process
7 * context) or a panic (interrupt context). 7 * context) or a panic (interrupt context).
@@ -11,17 +11,9 @@
11 *(volatile int *)0 = 0; \ 11 *(volatile int *)0 = 0; \
12} while (0) 12} while (0)
13 13
14#define BUG_ON(condition) do { \ 14#define HAVE_ARCH_BUG
15 if (unlikely((condition)!=0)) \ 15#endif
16 BUG(); \
17} while(0)
18 16
19#define WARN_ON(condition) do { \ 17#include <asm-generic/bug.h>
20 if (unlikely((condition)!=0)) { \
21 printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
22 dump_stack(); \
23 } \
24} while (0)
25 18
26#endif /* __ASM_SH64_BUG_H */ 19#endif /* __ASM_SH64_BUG_H */
27
diff --git a/include/asm-sh64/byteorder.h b/include/asm-sh64/byteorder.h
index f602ebe334..7419d78820 100644
--- a/include/asm-sh64/byteorder.h
+++ b/include/asm-sh64/byteorder.h
@@ -14,7 +14,7 @@
14 14
15#include <asm/types.h> 15#include <asm/types.h>
16 16
17static __inline__ __const__ __u32 ___arch__swab32(__u32 x) 17static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
18{ 18{
19 __asm__("byterev %0, %0\n\t" 19 __asm__("byterev %0, %0\n\t"
20 "shari %0, 32, %0" 20 "shari %0, 32, %0"
@@ -23,7 +23,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
23 return x; 23 return x;
24} 24}
25 25
26static __inline__ __const__ __u16 ___arch__swab16(__u16 x) 26static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
27{ 27{
28 __asm__("byterev %0, %0\n\t" 28 __asm__("byterev %0, %0\n\t"
29 "shari %0, 48, %0" 29 "shari %0, 48, %0"
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index a74a49e479..68e27a8fca 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -126,22 +126,30 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
126static inline void dma_sync_single_for_cpu(struct device *dev, 126static inline void dma_sync_single_for_cpu(struct device *dev,
127 dma_addr_t dma_handle, size_t size, 127 dma_addr_t dma_handle, size_t size,
128 enum dma_data_direction dir) 128 enum dma_data_direction dir)
129 __attribute__ ((alias("dma_sync_single"))); 129{
130 dma_sync_single(dev, dma_handle, size, dir);
131}
130 132
131static inline void dma_sync_single_for_device(struct device *dev, 133static inline void dma_sync_single_for_device(struct device *dev,
132 dma_addr_t dma_handle, size_t size, 134 dma_addr_t dma_handle, size_t size,
133 enum dma_data_direction dir) 135 enum dma_data_direction dir)
134 __attribute__ ((alias("dma_sync_single"))); 136{
137 dma_sync_single(dev, dma_handle, size, dir);
138}
135 139
136static inline void dma_sync_sg_for_cpu(struct device *dev, 140static inline void dma_sync_sg_for_cpu(struct device *dev,
137 struct scatterlist *sg, int nelems, 141 struct scatterlist *sg, int nelems,
138 enum dma_data_direction dir) 142 enum dma_data_direction dir)
139 __attribute__ ((alias("dma_sync_sg"))); 143{
144 dma_sync_sg(dev, sg, nelems, dir);
145}
140 146
141static inline void dma_sync_sg_for_device(struct device *dev, 147static inline void dma_sync_sg_for_device(struct device *dev,
142 struct scatterlist *sg, int nelems, 148 struct scatterlist *sg, int nelems,
143 enum dma_data_direction dir) 149 enum dma_data_direction dir)
144 __attribute__ ((alias("dma_sync_sg"))); 150{
151 dma_sync_sg(dev, sg, nelems, dir);
152}
145 153
146static inline int dma_get_cache_alignment(void) 154static inline int dma_get_cache_alignment(void)
147{ 155{
diff --git a/include/asm-sh64/hw_irq.h b/include/asm-sh64/hw_irq.h
index ae718d1f2d..ebb39089b0 100644
--- a/include/asm-sh64/hw_irq.h
+++ b/include/asm-sh64/hw_irq.h
@@ -11,6 +11,5 @@
11 * Copyright (C) 2000, 2001 Paolo Alberelli 11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 * 12 *
13 */ 13 */
14static __inline__ void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { /* Nothing to do */ }
15 14
16#endif /* __ASM_SH64_HW_IRQ_H */ 15#endif /* __ASM_SH64_HW_IRQ_H */
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index dee4f77929..252fedbb66 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -123,6 +123,13 @@ void insw(unsigned long port, void *addr, unsigned long count);
123void outsl(unsigned long port, const void *addr, unsigned long count); 123void outsl(unsigned long port, const void *addr, unsigned long count);
124void insl(unsigned long port, void *addr, unsigned long count); 124void insl(unsigned long port, void *addr, unsigned long count);
125 125
126#define __raw_readb readb
127#define __raw_readw readw
128#define __raw_readl readl
129#define __raw_writeb writeb
130#define __raw_writew writew
131#define __raw_writel writel
132
126void memcpy_toio(void __iomem *to, const void *from, long count); 133void memcpy_toio(void __iomem *to, const void *from, long count);
127void memcpy_fromio(void *to, void __iomem *from, long count); 134void memcpy_fromio(void *to, void __iomem *from, long count);
128 135
diff --git a/include/asm-sh64/keyboard.h b/include/asm-sh64/keyboard.h
index 733e2bbe7b..1fab96d792 100644
--- a/include/asm-sh64/keyboard.h
+++ b/include/asm-sh64/keyboard.h
@@ -65,7 +65,7 @@ extern unsigned char pckbd_sysrq_xlate[128];
65#endif 65#endif
66 66
67#define aux_request_irq(hand, dev_id) \ 67#define aux_request_irq(hand, dev_id) \
68 request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS2 Mouse", dev_id) 68 request_irq(AUX_IRQ, hand, IRQF_SHARED, "PS2 Mouse", dev_id)
69 69
70#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) 70#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
71 71
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h
index 34fb34754a..472089aefc 100644
--- a/include/asm-sh64/page.h
+++ b/include/asm-sh64/page.h
@@ -112,9 +112,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
114 114
115#endif /* __KERNEL__ */
116
117#include <asm-generic/memory_model.h> 115#include <asm-generic/memory_model.h>
118#include <asm-generic/page.h> 116#include <asm-generic/page.h>
119 117
118#endif /* __KERNEL__ */
120#endif /* __ASM_SH64_PAGE_H */ 119#endif /* __ASM_SH64_PAGE_H */
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h
index 54c7821893..6b97c4cb1d 100644
--- a/include/asm-sh64/pgtable.h
+++ b/include/asm-sh64/pgtable.h
@@ -190,7 +190,9 @@ static inline int pgd_bad(pgd_t pgd) { return 0; }
190#endif 190#endif
191 191
192 192
193#define pgd_page(pgd_entry) ((unsigned long) (pgd_val(pgd_entry) & PAGE_MASK)) 193#define pgd_page_vaddr(pgd_entry) ((unsigned long) (pgd_val(pgd_entry) & PAGE_MASK))
194#define pgd_page(pgd) (virt_to_page(pgd_val(pgd)))
195
194 196
195/* 197/*
196 * PMD defines. Middle level. 198 * PMD defines. Middle level.
@@ -219,7 +221,7 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
219#define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY) 221#define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY)
220#define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) 222#define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
221 223
222#define pmd_page_kernel(pmd_entry) \ 224#define pmd_page_vaddr(pmd_entry) \
223 ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK)) 225 ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK))
224 226
225#define pmd_page(pmd) \ 227#define pmd_page(pmd) \
diff --git a/include/asm-sh64/processor.h b/include/asm-sh64/processor.h
index 1bf252dad8..eb2bee4b47 100644
--- a/include/asm-sh64/processor.h
+++ b/include/asm-sh64/processor.h
@@ -22,6 +22,7 @@
22#include <asm/cache.h> 22#include <asm/cache.h>
23#include <asm/registers.h> 23#include <asm/registers.h>
24#include <linux/threads.h> 24#include <linux/threads.h>
25#include <linux/compiler.h>
25 26
26/* 27/*
27 * Default implementation of macro that returns current 28 * Default implementation of macro that returns current
@@ -279,7 +280,7 @@ extern unsigned long get_wchan(struct task_struct *p);
279#define KSTK_EIP(tsk) ((tsk)->thread.pc) 280#define KSTK_EIP(tsk) ((tsk)->thread.pc)
280#define KSTK_ESP(tsk) ((tsk)->thread.sp) 281#define KSTK_ESP(tsk) ((tsk)->thread.sp)
281 282
282#define cpu_relax() do { } while (0) 283#define cpu_relax() barrier()
283 284
284#endif /* __ASSEMBLY__ */ 285#endif /* __ASSEMBLY__ */
285#endif /* __ASM_SH64_PROCESSOR_H */ 286#endif /* __ASM_SH64_PROCESSOR_H */
diff --git a/include/asm-sh64/ptrace.h b/include/asm-sh64/ptrace.h
index 56190f5215..a6d4da519d 100644
--- a/include/asm-sh64/ptrace.h
+++ b/include/asm-sh64/ptrace.h
@@ -28,7 +28,7 @@ struct pt_regs {
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 29#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
30#define instruction_pointer(regs) ((regs)->pc) 30#define instruction_pointer(regs) ((regs)->pc)
31#define profile_pc(regs) instruction_pointer(regs) 31#define profile_pc(regs) ((unsigned long)instruction_pointer(regs))
32extern void show_regs(struct pt_regs *); 32extern void show_regs(struct pt_regs *);
33#endif 33#endif
34 34
diff --git a/include/asm-sh64/shmparam.h b/include/asm-sh64/shmparam.h
index d3a99a4dc0..1bb820c833 100644
--- a/include/asm-sh64/shmparam.h
+++ b/include/asm-sh64/shmparam.h
@@ -2,19 +2,11 @@
2#define __ASM_SH64_SHMPARAM_H 2#define __ASM_SH64_SHMPARAM_H
3 3
4/* 4/*
5 * This file is subject to the terms and conditions of the GNU General Public 5 * Set this to a sensible safe default, we'll work out the specifics for the
6 * License. See the file "COPYING" in the main directory of this archive 6 * align mask from the cache descriptor at run-time.
7 * for more details.
8 *
9 * include/asm-sh64/shmparam.h
10 *
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 *
13 */ 7 */
8#define SHMLBA 0x4000
14 9
15#include <asm/cache.h> 10#define __ARCH_FORCE_SHMLBA
16
17/* attach addr a multiple of this */
18#define SHMLBA (cpu_data->dcache.sets * L1_CACHE_BYTES)
19 11
20#endif /* __ASM_SH64_SHMPARAM_H */ 12#endif /* __ASM_SH64_SHMPARAM_H */
diff --git a/include/asm-sh64/signal.h b/include/asm-sh64/signal.h
index 2400dc688a..244e134730 100644
--- a/include/asm-sh64/signal.h
+++ b/include/asm-sh64/signal.h
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/processor.h>
17 16
18/* Avoid too many header ordering problems. */ 17/* Avoid too many header ordering problems. */
19struct siginfo; 18struct siginfo;
@@ -74,7 +73,6 @@ typedef struct {
74 * SA_FLAGS values: 73 * SA_FLAGS values:
75 * 74 *
76 * SA_ONSTACK indicates that a registered stack_t will be used. 75 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago) 76 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 77 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered. 78 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -94,7 +92,6 @@ typedef struct {
94 92
95#define SA_NOMASK SA_NODEFER 93#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND 94#define SA_ONESHOT SA_RESETHAND
97#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
98 95
99#define SA_RESTORER 0x04000000 96#define SA_RESTORER 0x04000000
100 97
diff --git a/include/asm-sh64/system.h b/include/asm-sh64/system.h
index 7606f6e1f0..b1598c26fc 100644
--- a/include/asm-sh64/system.h
+++ b/include/asm-sh64/system.h
@@ -64,9 +64,8 @@ extern void __xchg_called_with_bad_pointer(void);
64#define smp_read_barrier_depends() do { } while (0) 64#define smp_read_barrier_depends() do { } while (0)
65#endif /* CONFIG_SMP */ 65#endif /* CONFIG_SMP */
66 66
67#define set_rmb(var, value) do { xchg(&var, value); } while (0) 67#define set_rmb(var, value) do { (void)xchg(&var, value); } while (0)
68#define set_mb(var, value) set_rmb(var, value) 68#define set_mb(var, value) set_rmb(var, value)
69#define set_wmb(var, value) do { var = value; wmb(); } while (0)
70 69
71/* Interrupt Control */ 70/* Interrupt Control */
72#ifndef HARD_CLI 71#ifndef HARD_CLI
diff --git a/include/asm-sh64/uaccess.h b/include/asm-sh64/uaccess.h
index f4936d8fa6..644c67b65f 100644
--- a/include/asm-sh64/uaccess.h
+++ b/include/asm-sh64/uaccess.h
@@ -128,25 +128,20 @@ do { \
128 128
129#define __get_user_nocheck(x,ptr,size) \ 129#define __get_user_nocheck(x,ptr,size) \
130({ \ 130({ \
131 long __gu_addr = (long)(ptr); \ 131 long __gu_err, __gu_val; \
132 long __gu_err; \ 132 __get_user_size((void *)&__gu_val, (long)(ptr), \
133 __typeof(*(ptr)) __gu_val; \ 133 (size), __gu_err); \
134 __asm__ ("":"=r" (__gu_val)); \ 134 (x) = (__typeof__(*(ptr)))__gu_val; \
135 __asm__ ("":"=r" (__gu_err)); \
136 __get_user_size((void *)&__gu_val, __gu_addr, (size), __gu_err); \
137 (x) = (__typeof__(*(ptr))) __gu_val; \
138 __gu_err; \ 135 __gu_err; \
139}) 136})
140 137
141#define __get_user_check(x,ptr,size) \ 138#define __get_user_check(x,ptr,size) \
142({ \ 139({ \
143 long __gu_addr = (long)(ptr); \ 140 long __gu_addr = (long)(ptr); \
144 long __gu_err = -EFAULT; \ 141 long __gu_err = -EFAULT, __gu_val; \
145 __typeof(*(ptr)) __gu_val; \
146 __asm__ ("":"=r" (__gu_val)); \
147 __asm__ ("":"=r" (__gu_err)); \
148 if (__access_ok(__gu_addr, (size))) \ 142 if (__access_ok(__gu_addr, (size))) \
149 __get_user_size((void *)&__gu_val, __gu_addr, (size), __gu_err); \ 143 __get_user_size((void *)&__gu_val, __gu_addr, \
144 (size), __gu_err); \
150 (x) = (__typeof__(*(ptr))) __gu_val; \ 145 (x) = (__typeof__(*(ptr))) __gu_val; \
151 __gu_err; \ 146 __gu_err; \
152}) 147})
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index 9a1590fffc..c113566bef 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 } \
diff --git a/include/asm-sh64/user.h b/include/asm-sh64/user.h
index 8f32f39a8c..eb3b33edd7 100644
--- a/include/asm-sh64/user.h
+++ b/include/asm-sh64/user.h
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/processor.h>
17#include <asm/ptrace.h> 16#include <asm/ptrace.h>
18#include <asm/page.h> 17#include <asm/page.h>
19 18
diff --git a/include/asm-sparc/Kbuild b/include/asm-sparc/Kbuild
new file mode 100644
index 0000000000..c6a55cf0d3
--- /dev/null
+++ b/include/asm-sparc/Kbuild
@@ -0,0 +1,15 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += apc.h
4header-y += asi.h
5header-y += bpp.h
6header-y += jsflash.h
7header-y += openpromio.h
8header-y += pconf.h
9header-y += reg.h
10header-y += traps.h
11header-y += vfc_ioctls.h
12
13unifdef-y += fbio.h
14unifdef-y += perfctr.h
15unifdef-y += psr.h
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h
index 2d6a997c5b..54652887c1 100644
--- a/include/asm-sparc/ebus.h
+++ b/include/asm-sparc/ebus.h
@@ -13,13 +13,14 @@
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#endif 14#endif
15#include <asm/oplib.h> 15#include <asm/oplib.h>
16#include <asm/prom.h>
17#include <asm/of_device.h>
16 18
17struct linux_ebus_child { 19struct linux_ebus_child {
18 struct linux_ebus_child *next; 20 struct linux_ebus_child *next;
19 struct linux_ebus_device *parent; 21 struct linux_ebus_device *parent;
20 struct linux_ebus *bus; 22 struct linux_ebus *bus;
21 int prom_node; 23 struct device_node *prom_node;
22 char prom_name[64];
23 struct resource resource[PROMREG_MAX]; 24 struct resource resource[PROMREG_MAX];
24 int num_addrs; 25 int num_addrs;
25 unsigned int irqs[PROMINTR_MAX]; 26 unsigned int irqs[PROMINTR_MAX];
@@ -27,27 +28,27 @@ struct linux_ebus_child {
27}; 28};
28 29
29struct linux_ebus_device { 30struct linux_ebus_device {
31 struct of_device ofdev;
30 struct linux_ebus_device *next; 32 struct linux_ebus_device *next;
31 struct linux_ebus_child *children; 33 struct linux_ebus_child *children;
32 struct linux_ebus *bus; 34 struct linux_ebus *bus;
33 int prom_node; 35 struct device_node *prom_node;
34 char prom_name[64];
35 struct resource resource[PROMREG_MAX]; 36 struct resource resource[PROMREG_MAX];
36 int num_addrs; 37 int num_addrs;
37 unsigned int irqs[PROMINTR_MAX]; 38 unsigned int irqs[PROMINTR_MAX];
38 int num_irqs; 39 int num_irqs;
39}; 40};
41#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
40 42
41struct linux_ebus { 43struct linux_ebus {
44 struct of_device ofdev;
42 struct linux_ebus *next; 45 struct linux_ebus *next;
43 struct linux_ebus_device *devices; 46 struct linux_ebus_device *devices;
44 struct linux_pbm_info *parent; 47 struct linux_pbm_info *parent;
45 struct pci_dev *self; 48 struct pci_dev *self;
46 int prom_node; 49 struct device_node *prom_node;
47 char prom_name[64];
48 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
49 int num_ebus_ranges;
50}; 50};
51#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
51 52
52struct linux_ebus_dma { 53struct linux_ebus_dma {
53 unsigned int dcsr; 54 unsigned int dcsr;
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
index 7a941b800b..c53b332c85 100644
--- a/include/asm-sparc/floppy.h
+++ b/include/asm-sparc/floppy.h
@@ -271,7 +271,8 @@ static int sun_fd_request_irq(void)
271 271
272 if(!once) { 272 if(!once) {
273 once = 1; 273 once = 1;
274 error = request_fast_irq(FLOPPY_IRQ, floppy_hardint, SA_INTERRUPT, "floppy"); 274 error = request_fast_irq(FLOPPY_IRQ, floppy_hardint,
275 IRQF_DISABLED, "floppy");
275 return ((error == 0) ? 0 : -1); 276 return ((error == 0) ? 0 : -1);
276 } else return 0; 277 } else return 0;
277} 278}
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index a42df208d5..cab0b851b8 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -249,6 +249,22 @@ extern void __iomem *ioremap(unsigned long offset, unsigned long size);
249#define ioremap_nocache(X,Y) ioremap((X),(Y)) 249#define ioremap_nocache(X,Y) ioremap((X),(Y))
250extern void iounmap(volatile void __iomem *addr); 250extern void iounmap(volatile void __iomem *addr);
251 251
252#define ioread8(X) readb(X)
253#define ioread16(X) readw(X)
254#define ioread32(X) readl(X)
255#define iowrite8(val,X) writeb(val,X)
256#define iowrite16(val,X) writew(val,X)
257#define iowrite32(val,X) writel(val,X)
258
259/* Create a virtual mapping cookie for an IO port range */
260extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
261extern void ioport_unmap(void __iomem *);
262
263/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
264struct pci_dev;
265extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
266extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
267
252/* 268/*
253 * Bus number may be in res->flags... somewhere. 269 * Bus number may be in res->flags... somewhere.
254 */ 270 */
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h
index 88d1886abf..b7dc40bc68 100644
--- a/include/asm-sparc/mman.h
+++ b/include/asm-sparc/mman.h
@@ -35,4 +35,12 @@
35 35
36#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 36#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
37 37
38#ifdef __KERNEL__
39#ifndef __ASSEMBLY__
40#define arch_mmap_check sparc_mmap_check
41int sparc_mmap_check(unsigned long addr, unsigned long len,
42 unsigned long flags);
43#endif
44#endif
45
38#endif /* __SPARC_MMAN_H__ */ 46#endif /* __SPARC_MMAN_H__ */
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
new file mode 100644
index 0000000000..80ea31f6e1
--- /dev/null
+++ b/include/asm-sparc/of_device.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_SPARC_OF_DEVICE_H
2#define _ASM_SPARC_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
7#include <asm/openprom.h>
8#include <asm/prom.h>
9
10extern struct bus_type ebus_bus_type;
11extern struct bus_type sbus_bus_type;
12extern struct bus_type of_bus_type;
13
14/*
15 * The of_device is a kind of "base class" that is a superset of
16 * struct device for use by devices attached to an OF node and
17 * probed using OF properties.
18 */
19struct of_device
20{
21 struct device_node *node;
22 struct device dev;
23 struct resource resource[PROMREG_MAX];
24 unsigned int irqs[PROMINTR_MAX];
25 int num_irqs;
26
27 void *sysdata;
28
29 int slot;
30 int portid;
31 int clock_freq;
32};
33#define to_of_device(d) container_of(d, struct of_device, dev)
34
35extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
36extern void of_iounmap(void __iomem *base, unsigned long size);
37
38extern struct of_device *of_find_device_by_node(struct device_node *);
39
40extern const struct of_device_id *of_match_device(
41 const struct of_device_id *matches, const struct of_device *dev);
42
43extern struct of_device *of_dev_get(struct of_device *dev);
44extern void of_dev_put(struct of_device *dev);
45
46/*
47 * An of_platform_driver driver is attached to a basic of_device on
48 * the ISA, EBUS, and SBUS busses on sparc64.
49 */
50struct of_platform_driver
51{
52 char *name;
53 struct of_device_id *match_table;
54 struct module *owner;
55
56 int (*probe)(struct of_device* dev, const struct of_device_id *match);
57 int (*remove)(struct of_device* dev);
58
59 int (*suspend)(struct of_device* dev, pm_message_t state);
60 int (*resume)(struct of_device* dev);
61 int (*shutdown)(struct of_device* dev);
62
63 struct device_driver driver;
64};
65#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
66
67extern int of_register_driver(struct of_platform_driver *drv,
68 struct bus_type *bus);
69extern void of_unregister_driver(struct of_platform_driver *drv);
70extern int of_device_register(struct of_device *ofdev);
71extern void of_device_unregister(struct of_device *ofdev);
72extern struct of_device *of_platform_device_create(struct device_node *np,
73 const char *bus_id,
74 struct device *parent,
75 struct bus_type *bus);
76extern void of_release_dev(struct device *dev);
77
78#endif /* __KERNEL__ */
79#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h
index f283f8aaf6..91691e52c0 100644
--- a/include/asm-sparc/oplib.h
+++ b/include/asm-sparc/oplib.h
@@ -267,11 +267,6 @@ extern void prom_getstring(int node, char *prop, char *buf, int bufsize);
267/* Does the passed node have the given "name"? YES=1 NO=0 */ 267/* Does the passed node have the given "name"? YES=1 NO=0 */
268extern int prom_nodematch(int thisnode, char *name); 268extern int prom_nodematch(int thisnode, char *name);
269 269
270/* Puts in buffer a prom name in the form name@x,y or name (x for which_io
271 * and y for first regs phys address
272 */
273extern int prom_getname(int node, char *buf, int buflen);
274
275/* Search all siblings starting at the passed node for "name" matching 270/* Search all siblings starting at the passed node for "name" matching
276 * the given string. Returns the node on success, zero on failure. 271 * the given string. Returns the node on success, zero on failure.
277 */ 272 */
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 5bab8a7c25..ff57648eb8 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -8,6 +8,8 @@
8#ifndef _SPARC_PAGE_H 8#ifndef _SPARC_PAGE_H
9#define _SPARC_PAGE_H 9#define _SPARC_PAGE_H
10 10
11#ifdef __KERNEL__
12
11#ifdef CONFIG_SUN4 13#ifdef CONFIG_SUN4
12#define PAGE_SHIFT 13 14#define PAGE_SHIFT 13
13#else 15#else
@@ -21,8 +23,6 @@
21#endif 23#endif
22#define PAGE_MASK (~(PAGE_SIZE-1)) 24#define PAGE_MASK (~(PAGE_SIZE-1))
23 25
24#ifdef __KERNEL__
25
26#include <asm/btfixup.h> 26#include <asm/btfixup.h>
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
@@ -160,9 +160,9 @@ extern unsigned long pfn_base;
160#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 160#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
161 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 161 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
162 162
163#endif /* __KERNEL__ */
164
165#include <asm-generic/memory_model.h> 163#include <asm-generic/memory_model.h>
166#include <asm-generic/page.h> 164#include <asm-generic/page.h>
167 165
166#endif /* __KERNEL__ */
167
168#endif /* _SPARC_PAGE_H */ 168#endif /* _SPARC_PAGE_H */
diff --git a/include/asm-sparc/pbm.h b/include/asm-sparc/pbm.h
index 0aba3a82c2..fedd9c6e87 100644
--- a/include/asm-sparc/pbm.h
+++ b/include/asm-sparc/pbm.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <asm/oplib.h> 24#include <asm/oplib.h>
25#include <asm/prom.h>
25 26
26struct linux_pbm_info { 27struct linux_pbm_info {
27 int prom_node; 28 int prom_node;
@@ -40,7 +41,7 @@ struct linux_pbm_info {
40 */ 41 */
41struct pcidev_cookie { 42struct pcidev_cookie {
42 struct linux_pbm_info *pbm; 43 struct linux_pbm_info *pbm;
43 int prom_node; 44 struct device_node *prom_node;
44}; 45};
45 46
46#endif /* !(__SPARC_PBM_H) */ 47#endif /* !(__SPARC_PBM_H) */
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 226c6475c9..4f0a5ba0d6 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -143,10 +143,10 @@ extern unsigned long empty_zero_page;
143/* 143/*
144 */ 144 */
145BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) 145BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t)
146BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t) 146BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
147 147
148#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) 148#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
149#define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd) 149#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd)
150 150
151BTFIXUPDEF_SETHI(none_mask) 151BTFIXUPDEF_SETHI(none_mask)
152BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) 152BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
new file mode 100644
index 0000000000..86c13dccea
--- /dev/null
+++ b/include/asm-sparc/prom.h
@@ -0,0 +1,104 @@
1#ifndef _SPARC_PROM_H
2#define _SPARC_PROM_H
3#ifdef __KERNEL__
4
5
6/*
7 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers.
9 *
10 * Copyright (C) 1996-2005 Paul Mackerras.
11 *
12 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13 * Updates for SPARC32 by David S. Miller
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <linux/types.h>
22#include <linux/proc_fs.h>
23#include <asm/atomic.h>
24
25typedef u32 phandle;
26typedef u32 ihandle;
27
28struct property {
29 char *name;
30 int length;
31 void *value;
32 struct property *next;
33 unsigned long _flags;
34 unsigned int unique_id;
35};
36
37struct device_node {
38 char *name;
39 char *type;
40 phandle node;
41 char *path_component_name;
42 char *full_name;
43
44 struct property *properties;
45 struct property *deadprops; /* removed properties */
46 struct device_node *parent;
47 struct device_node *child;
48 struct device_node *sibling;
49 struct device_node *next; /* next device of same type */
50 struct device_node *allnext; /* next in list of all nodes */
51 struct proc_dir_entry *pde; /* this node's proc directory */
52 struct kref kref;
53 unsigned long _flags;
54 void *data;
55 unsigned int unique_id;
56};
57
58/* flag descriptions */
59#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
60
61#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
62#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
63
64#define OF_BAD_ADDR ((u64)-1)
65
66static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
67{
68 dn->pde = de;
69}
70
71extern struct device_node *of_find_node_by_name(struct device_node *from,
72 const char *name);
73#define for_each_node_by_name(dn, name) \
74 for (dn = of_find_node_by_name(NULL, name); dn; \
75 dn = of_find_node_by_name(dn, name))
76extern struct device_node *of_find_node_by_type(struct device_node *from,
77 const char *type);
78#define for_each_node_by_type(dn, type) \
79 for (dn = of_find_node_by_type(NULL, type); dn; \
80 dn = of_find_node_by_type(dn, type))
81extern struct device_node *of_find_compatible_node(struct device_node *from,
82 const char *type, const char *compat);
83extern struct device_node *of_find_node_by_path(const char *path);
84extern struct device_node *of_find_node_by_phandle(phandle handle);
85extern struct device_node *of_get_parent(const struct device_node *node);
86extern struct device_node *of_get_next_child(const struct device_node *node,
87 struct device_node *prev);
88extern struct property *of_find_property(struct device_node *np,
89 const char *name,
90 int *lenp);
91extern int of_device_is_compatible(struct device_node *device, const char *);
92extern void *of_get_property(struct device_node *node, const char *name,
93 int *lenp);
94extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
95extern int of_getintprop_default(struct device_node *np,
96 const char *name,
97 int def);
98extern int of_n_addr_cells(struct device_node *np);
99extern int of_n_size_cells(struct device_node *np);
100
101extern void prom_build_devicetree(void);
102
103#endif /* __KERNEL__ */
104#endif /* _SPARC_PROM_H */
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index a13cddcece..d036e4419d 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -11,7 +11,8 @@
11#include <linux/ioport.h> 11#include <linux/ioport.h>
12 12
13#include <asm/oplib.h> 13#include <asm/oplib.h>
14/* #include <asm/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ 14#include <asm/prom.h>
15#include <asm/of_device.h>
15#include <asm/scatterlist.h> 16#include <asm/scatterlist.h>
16 17
17/* We scan which devices are on the SBus using the PROM node device 18/* We scan which devices are on the SBus using the PROM node device
@@ -42,18 +43,19 @@ struct sbus_bus;
42 43
43/* Linux SBUS device tables */ 44/* Linux SBUS device tables */
44struct sbus_dev { 45struct sbus_dev {
45 struct sbus_bus *bus; /* Back ptr to sbus */ 46 struct of_device ofdev;
46 struct sbus_dev *next; /* next device on this SBus or null */ 47 struct sbus_bus *bus;
47 struct sbus_dev *child; /* For ledma and espdma on sun4m */ 48 struct sbus_dev *next;
48 struct sbus_dev *parent; /* Parent device if not toplevel */ 49 struct sbus_dev *child;
49 int prom_node; /* PROM device tree node for this device */ 50 struct sbus_dev *parent;
50 char prom_name[64]; /* PROM device name */ 51 int prom_node;
52 char prom_name[64];
51 int slot; 53 int slot;
52 54
53 struct resource resource[PROMREG_MAX]; 55 struct resource resource[PROMREG_MAX];
54 56
55 struct linux_prom_registers reg_addrs[PROMREG_MAX]; 57 struct linux_prom_registers reg_addrs[PROMREG_MAX];
56 int num_registers, ranges_applied; 58 int num_registers;
57 59
58 struct linux_prom_ranges device_ranges[PROMREG_MAX]; 60 struct linux_prom_ranges device_ranges[PROMREG_MAX];
59 int num_device_ranges; 61 int num_device_ranges;
@@ -61,9 +63,11 @@ struct sbus_dev {
61 unsigned int irqs[4]; 63 unsigned int irqs[4];
62 int num_irqs; 64 int num_irqs;
63}; 65};
66#define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev)
64 67
65/* This struct describes the SBus(s) found on this machine. */ 68/* This struct describes the SBus(s) found on this machine. */
66struct sbus_bus { 69struct sbus_bus {
70 struct of_device ofdev;
67 void *iommu; /* Opaque IOMMU cookie */ 71 void *iommu; /* Opaque IOMMU cookie */
68 struct sbus_dev *devices; /* Link to devices on this SBus */ 72 struct sbus_dev *devices; /* Link to devices on this SBus */
69 struct sbus_bus *next; /* next SBus, if more than one SBus */ 73 struct sbus_bus *next; /* next SBus, if more than one SBus */
@@ -77,6 +81,7 @@ struct sbus_bus {
77 int devid; 81 int devid;
78 int board; 82 int board;
79}; 83};
84#define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev)
80 85
81extern struct sbus_bus *sbus_root; 86extern struct sbus_bus *sbus_root;
82 87
@@ -102,6 +107,7 @@ sbus_is_slave(struct sbus_dev *dev)
102#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ 107#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */
103#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ 108#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */
104extern void sbus_set_sbus64(struct sbus_dev *, int); 109extern void sbus_set_sbus64(struct sbus_dev *, int);
110extern void sbus_fill_device_irq(struct sbus_dev *);
105 111
106/* These yield IOMMU mappings in consistent mode. */ 112/* These yield IOMMU mappings in consistent mode. */
107extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); 113extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
@@ -139,4 +145,10 @@ extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *,
139BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) 145BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int)
140#define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) 146#define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint)
141 147
148extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
149extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
150extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
151extern int sbus_arch_preinit(void);
152extern void sbus_arch_postinit(void);
153
142#endif /* !(_SPARC_SBUS_H) */ 154#endif /* !(_SPARC_SBUS_H) */
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
index aa9960ad0c..d03a21c97a 100644
--- a/include/asm-sparc/signal.h
+++ b/include/asm-sparc/signal.h
@@ -132,16 +132,13 @@ struct sigstack {
132 * usage of signal stacks by using the (now obsolete) sa_restorer field in 132 * usage of signal stacks by using the (now obsolete) sa_restorer field in
133 * the sigaction structure as a stack pointer. This is now possible due to 133 * the sigaction structure as a stack pointer. This is now possible due to
134 * the changes in signal handling. LBT 010493. 134 * the changes in signal handling. LBT 010493.
135 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
136 * SA_RESTART flag to get restarting signals (which were the default long ago) 135 * SA_RESTART flag to get restarting signals (which were the default long ago)
137 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
138 */ 136 */
139#define SA_NOCLDSTOP _SV_IGNCHILD 137#define SA_NOCLDSTOP _SV_IGNCHILD
140#define SA_STACK _SV_SSTACK 138#define SA_STACK _SV_SSTACK
141#define SA_ONSTACK _SV_SSTACK 139#define SA_ONSTACK _SV_SSTACK
142#define SA_RESTART _SV_INTR 140#define SA_RESTART _SV_INTR
143#define SA_ONESHOT _SV_RESET 141#define SA_ONESHOT _SV_RESET
144#define SA_INTERRUPT 0x10u
145#define SA_NOMASK 0x20u 142#define SA_NOMASK 0x20u
146#define SA_NOCLDWAIT 0x100u 143#define SA_NOCLDWAIT 0x100u
147#define SA_SIGINFO 0x200u 144#define SA_SIGINFO 0x200u
@@ -171,7 +168,7 @@ struct sigstack {
171 * statically allocated data.. which is NOT GOOD. 168 * statically allocated data.. which is NOT GOOD.
172 * 169 *
173 */ 170 */
174#define SA_STATIC_ALLOC 0x80 171#define SA_STATIC_ALLOC 0x8000
175#endif 172#endif
176 173
177#include <asm-generic/signal.h> 174#include <asm-generic/signal.h>
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index 4e0ce3a35e..f6c4e5baf3 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -48,6 +48,7 @@
48#define SCM_TIMESTAMP SO_TIMESTAMP 48#define SCM_TIMESTAMP SO_TIMESTAMP
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f
51 52
52/* Security levels - as per NRL IPv6 - don't actually do anything */ 53/* Security levels - as per NRL IPv6 - don't actually do anything */
53#define SO_SECURITY_AUTHENTICATION 0x5001 54#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index cb7dda1e5e..100c3eaf3c 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -199,7 +199,6 @@ static inline unsigned long getipl(void)
199#define wmb() mb() 199#define wmb() mb()
200#define read_barrier_depends() do { } while(0) 200#define read_barrier_depends() do { } while(0)
201#define set_mb(__var, __value) do { __var = __value; mb(); } while(0) 201#define set_mb(__var, __value) do { __var = __value; mb(); } while(0)
202#define set_wmb(__var, __value) set_mb(__var, __value)
203#define smp_mb() __asm__ __volatile__("":::"memory") 202#define smp_mb() __asm__ __volatile__("":::"memory")
204#define smp_rmb() __asm__ __volatile__("":::"memory") 203#define smp_rmb() __asm__ __volatile__("":::"memory")
205#define smp_wmb() __asm__ __volatile__("":::"memory") 204#define smp_wmb() __asm__ __volatile__("":::"memory")
diff --git a/include/asm-sparc64/Kbuild b/include/asm-sparc64/Kbuild
new file mode 100644
index 0000000000..a7f44408c9
--- /dev/null
+++ b/include/asm-sparc64/Kbuild
@@ -0,0 +1,26 @@
1include include/asm-generic/Kbuild.asm
2
3ALTARCH := sparc
4ARCHDEF := defined __sparc__ && defined __arch64__
5ALTARCHDEF := defined __sparc__ && !defined __arch64__
6
7header-y += apb.h
8header-y += asi.h
9header-y += bbc.h
10header-y += bpp.h
11header-y += const.h
12header-y += display7seg.h
13header-y += envctrl.h
14header-y += ipc.h
15header-y += openprom.h
16header-y += openpromio.h
17header-y += pconf.h
18header-y += psrcompat.h
19header-y += pstate.h
20header-y += reg.h
21header-y += uctx.h
22header-y += utrap.h
23header-y += watchdog.h
24
25unifdef-y += fbio.h
26unifdef-y += perfctr.h
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 3c2b5bc865..27c46fbeeb 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -160,6 +160,63 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
160 BUG(); 160 BUG();
161} 161}
162 162
163static inline void
164dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
165 enum dma_data_direction direction)
166{
167 BUG();
168}
169
170static inline void
171dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
172 enum dma_data_direction direction)
173{
174 BUG();
175}
176
163#endif /* PCI */ 177#endif /* PCI */
164 178
179
180/* Now for the API extensions over the pci_ one */
181
182#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
183#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
184#define dma_is_consistent(d) (1)
185
186static inline int
187dma_get_cache_alignment(void)
188{
189 /* no easy way to get cache size on all processors, so return
190 * the maximum possible, to be safe */
191 return (1 << INTERNODE_CACHE_SHIFT);
192}
193
194static inline void
195dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
196 unsigned long offset, size_t size,
197 enum dma_data_direction direction)
198{
199 /* just sync everything, that's all the pci API can do */
200 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
201}
202
203static inline void
204dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
205 unsigned long offset, size_t size,
206 enum dma_data_direction direction)
207{
208 /* just sync everything, that's all the pci API can do */
209 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
210}
211
212static inline void
213dma_cache_sync(void *vaddr, size_t size,
214 enum dma_data_direction direction)
215{
216 /* could define this in terms of the dma_cache ... operations,
217 * but if you get this on a platform, you should convert the platform
218 * to using the generic device DMA API */
219 BUG();
220}
221
165#endif /* _ASM_SPARC64_DMA_MAPPING_H */ 222#endif /* _ASM_SPARC64_DMA_MAPPING_H */
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 7a408a030f..a4afe9d570 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -10,13 +10,14 @@
10 10
11#include <asm/pbm.h> 11#include <asm/pbm.h>
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/prom.h>
14#include <asm/of_device.h>
13 15
14struct linux_ebus_child { 16struct linux_ebus_child {
15 struct linux_ebus_child *next; 17 struct linux_ebus_child *next;
16 struct linux_ebus_device *parent; 18 struct linux_ebus_device *parent;
17 struct linux_ebus *bus; 19 struct linux_ebus *bus;
18 int prom_node; 20 struct device_node *prom_node;
19 char prom_name[64];
20 struct resource resource[PROMREG_MAX]; 21 struct resource resource[PROMREG_MAX];
21 int num_addrs; 22 int num_addrs;
22 unsigned int irqs[PROMINTR_MAX]; 23 unsigned int irqs[PROMINTR_MAX];
@@ -24,32 +25,29 @@ struct linux_ebus_child {
24}; 25};
25 26
26struct linux_ebus_device { 27struct linux_ebus_device {
28 struct of_device ofdev;
27 struct linux_ebus_device *next; 29 struct linux_ebus_device *next;
28 struct linux_ebus_child *children; 30 struct linux_ebus_child *children;
29 struct linux_ebus *bus; 31 struct linux_ebus *bus;
30 int prom_node; 32 struct device_node *prom_node;
31 char prom_name[64];
32 struct resource resource[PROMREG_MAX]; 33 struct resource resource[PROMREG_MAX];
33 int num_addrs; 34 int num_addrs;
34 unsigned int irqs[PROMINTR_MAX]; 35 unsigned int irqs[PROMINTR_MAX];
35 int num_irqs; 36 int num_irqs;
36}; 37};
38#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
37 39
38struct linux_ebus { 40struct linux_ebus {
41 struct of_device ofdev;
39 struct linux_ebus *next; 42 struct linux_ebus *next;
40 struct linux_ebus_device *devices; 43 struct linux_ebus_device *devices;
41 struct pci_pbm_info *parent; 44 struct pci_pbm_info *parent;
42 struct pci_dev *self; 45 struct pci_dev *self;
43 int index; 46 int index;
44 int is_rio; 47 int is_rio;
45 int prom_node; 48 struct device_node *prom_node;
46 char prom_name[64];
47 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
48 int num_ebus_ranges;
49 struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
50 int num_ebus_intmap;
51 struct linux_prom_ebus_intmask ebus_intmask;
52}; 49};
50#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
53 51
54struct ebus_dma_info { 52struct ebus_dma_info {
55 spinlock_t lock; 53 spinlock_t lock;
diff --git a/include/asm-sparc64/fhc.h b/include/asm-sparc64/fhc.h
index f29eaa2540..9e7f1b0d78 100644
--- a/include/asm-sparc64/fhc.h
+++ b/include/asm-sparc64/fhc.h
@@ -10,6 +10,7 @@
10#include <linux/timer.h> 10#include <linux/timer.h>
11 11
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/prom.h>
13#include <asm/upa.h> 14#include <asm/upa.h>
14 15
15struct linux_fhc; 16struct linux_fhc;
@@ -34,8 +35,7 @@ struct linux_central {
34 unsigned long clkregs; 35 unsigned long clkregs;
35 unsigned long clkver; 36 unsigned long clkver;
36 int slots; 37 int slots;
37 int prom_node; 38 struct device_node *prom_node;
38 char prom_name[64];
39 39
40 struct linux_prom_ranges central_ranges[PROMREG_MAX]; 40 struct linux_prom_ranges central_ranges[PROMREG_MAX];
41 int num_central_ranges; 41 int num_central_ranges;
@@ -112,8 +112,7 @@ struct linux_fhc {
112 struct fhc_regs fhc_regs; 112 struct fhc_regs fhc_regs;
113 int board; 113 int board;
114 int jtag_master; 114 int jtag_master;
115 int prom_node; 115 struct device_node *prom_node;
116 char prom_name[64];
117 116
118 struct linux_prom_ranges fhc_ranges[PROMREG_MAX]; 117 struct linux_prom_ranges fhc_ranges[PROMREG_MAX];
119 int num_fhc_ranges; 118 int num_fhc_ranges;
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 07ccd6f04b..abf1500380 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -208,7 +208,55 @@ static void sun_fd_enable_dma(void)
208 pdma_areasize = pdma_size; 208 pdma_areasize = pdma_size;
209} 209}
210 210
211extern irqreturn_t sparc_floppy_irq(int, void *, struct pt_regs *); 211irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie, struct pt_regs *regs)
212{
213 if (likely(doing_pdma)) {
214 void __iomem *stat = (void __iomem *) fdc_status;
215 unsigned char *vaddr = pdma_vaddr;
216 unsigned long size = pdma_size;
217 u8 val;
218
219 while (size) {
220 val = readb(stat);
221 if (unlikely(!(val & 0x80))) {
222 pdma_vaddr = vaddr;
223 pdma_size = size;
224 return IRQ_HANDLED;
225 }
226 if (unlikely(!(val & 0x20))) {
227 pdma_vaddr = vaddr;
228 pdma_size = size;
229 doing_pdma = 0;
230 goto main_interrupt;
231 }
232 if (val & 0x40) {
233 /* read */
234 *vaddr++ = readb(stat + 1);
235 } else {
236 unsigned char data = *vaddr++;
237
238 /* write */
239 writeb(data, stat + 1);
240 }
241 size--;
242 }
243
244 pdma_vaddr = vaddr;
245 pdma_size = size;
246
247 /* Send Terminal Count pulse to floppy controller. */
248 val = readb(auxio_register);
249 val |= AUXIO_AUX1_FTCNT;
250 writeb(val, auxio_register);
251 val &= ~AUXIO_AUX1_FTCNT;
252 writeb(val, auxio_register);
253
254 doing_pdma = 0;
255 }
256
257main_interrupt:
258 return floppy_interrupt(irq, dev_cookie, regs);
259}
212 260
213static int sun_fd_request_irq(void) 261static int sun_fd_request_irq(void)
214{ 262{
@@ -219,7 +267,7 @@ static int sun_fd_request_irq(void)
219 once = 1; 267 once = 1;
220 268
221 error = request_irq(FLOPPY_IRQ, sparc_floppy_irq, 269 error = request_irq(FLOPPY_IRQ, sparc_floppy_irq,
222 SA_INTERRUPT, "floppy", NULL); 270 IRQF_DISABLED, "floppy", NULL);
223 271
224 return ((error == 0) ? 0 : -1); 272 return ((error == 0) ? 0 : -1);
225 } 273 }
@@ -498,15 +546,14 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
498#ifdef CONFIG_PCI 546#ifdef CONFIG_PCI
499static int __init ebus_fdthree_p(struct linux_ebus_device *edev) 547static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
500{ 548{
501 if (!strcmp(edev->prom_name, "fdthree")) 549 if (!strcmp(edev->prom_node->name, "fdthree"))
502 return 1; 550 return 1;
503 if (!strcmp(edev->prom_name, "floppy")) { 551 if (!strcmp(edev->prom_node->name, "floppy")) {
504 char compat[16]; 552 char *compat;
505 prom_getstring(edev->prom_node, 553
506 "compatible", 554 compat = of_get_property(edev->prom_node,
507 compat, sizeof(compat)); 555 "compatible", NULL);
508 compat[15] = '\0'; 556 if (compat && !strcmp(compat, "fdthree"))
509 if (!strcmp(compat, "fdthree"))
510 return 1; 557 return 1;
511 } 558 }
512 return 0; 559 return 0;
@@ -524,12 +571,12 @@ static unsigned long __init isa_floppy_init(void)
524 571
525 for_each_isa(isa_br) { 572 for_each_isa(isa_br) {
526 for_each_isadev(isa_dev, isa_br) { 573 for_each_isadev(isa_dev, isa_br) {
527 if (!strcmp(isa_dev->prom_name, "dma")) { 574 if (!strcmp(isa_dev->prom_node->name, "dma")) {
528 struct sparc_isa_device *child = 575 struct sparc_isa_device *child =
529 isa_dev->child; 576 isa_dev->child;
530 577
531 while (child) { 578 while (child) {
532 if (!strcmp(child->prom_name, 579 if (!strcmp(child->prom_node->name,
533 "floppy")) { 580 "floppy")) {
534 isa_dev = child; 581 isa_dev = child;
535 goto isa_done; 582 goto isa_done;
@@ -614,6 +661,7 @@ static unsigned long __init sun_floppy_init(void)
614 struct linux_ebus_device *edev = NULL; 661 struct linux_ebus_device *edev = NULL;
615 unsigned long config = 0; 662 unsigned long config = 0;
616 void __iomem *auxio_reg; 663 void __iomem *auxio_reg;
664 char *state_prop;
617 665
618 for_each_ebus(ebus) { 666 for_each_ebus(ebus) {
619 for_each_ebusdev(edev, ebus) { 667 for_each_ebusdev(edev, ebus) {
@@ -630,9 +678,8 @@ static unsigned long __init sun_floppy_init(void)
630#endif 678#endif
631 } 679 }
632 680
633 prom_getproperty(edev->prom_node, "status", 681 state_prop = of_get_property(edev->prom_node, "status", NULL);
634 state, sizeof(state)); 682 if (state_prop && !strncmp(state_prop, "disabled", 8))
635 if (!strncmp(state, "disabled", 8))
636 return 0; 683 return 0;
637 684
638 FLOPPY_IRQ = edev->irqs[0]; 685 FLOPPY_IRQ = edev->irqs[0];
@@ -703,7 +750,7 @@ static unsigned long __init sun_floppy_init(void)
703 */ 750 */
704 for_each_ebus(ebus) { 751 for_each_ebus(ebus) {
705 for_each_ebusdev(edev, ebus) { 752 for_each_ebusdev(edev, ebus) {
706 if (!strcmp(edev->prom_name, "ecpp")) { 753 if (!strcmp(edev->prom_node->name, "ecpp")) {
707 config = edev->resource[1].start; 754 config = edev->resource[1].start;
708 goto config_done; 755 goto config_done;
709 } 756 }
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index 4601bbfc3e..d9728b9031 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -9,37 +9,32 @@
9 9
10#include <asm/pbm.h> 10#include <asm/pbm.h>
11#include <asm/oplib.h> 11#include <asm/oplib.h>
12#include <asm/prom.h>
13#include <asm/of_device.h>
12 14
13struct sparc_isa_bridge; 15struct sparc_isa_bridge;
14 16
15struct sparc_isa_device { 17struct sparc_isa_device {
18 struct of_device ofdev;
16 struct sparc_isa_device *next; 19 struct sparc_isa_device *next;
17 struct sparc_isa_device *child; 20 struct sparc_isa_device *child;
18 struct sparc_isa_bridge *bus; 21 struct sparc_isa_bridge *bus;
19 int prom_node; 22 struct device_node *prom_node;
20 char prom_name[64];
21 char compatible[64];
22 struct resource resource; 23 struct resource resource;
23 unsigned int irq; 24 unsigned int irq;
24}; 25};
26#define to_isa_device(d) container_of(d, struct sparc_isa_device, ofdev.dev)
25 27
26struct sparc_isa_bridge { 28struct sparc_isa_bridge {
29 struct of_device ofdev;
27 struct sparc_isa_bridge *next; 30 struct sparc_isa_bridge *next;
28 struct sparc_isa_device *devices; 31 struct sparc_isa_device *devices;
29 struct pci_pbm_info *parent; 32 struct pci_pbm_info *parent;
30 struct pci_dev *self; 33 struct pci_dev *self;
31 int index; 34 int index;
32 int prom_node; 35 struct device_node *prom_node;
33 char prom_name[64];
34#define linux_prom_isa_ranges linux_prom_ebus_ranges
35 struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX];
36 int num_isa_ranges;
37#define linux_prom_isa_intmap linux_prom_ebus_intmap
38 struct linux_prom_isa_intmap isa_intmap[PROMREG_MAX];
39 int num_isa_intmap;
40#define linux_prom_isa_intmask linux_prom_ebus_intmask
41 struct linux_prom_isa_intmap isa_intmask;
42}; 36};
37#define to_isa_bridge(d) container_of(d, struct sparc_isa_bridge, ofdev.dev)
43 38
44extern struct sparc_isa_bridge *isa_chain; 39extern struct sparc_isa_bridge *isa_chain;
45 40
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h
index 4040d127ac..11251bdd00 100644
--- a/include/asm-sparc64/kdebug.h
+++ b/include/asm-sparc64/kdebug.h
@@ -17,6 +17,8 @@ struct die_args {
17 17
18extern int register_die_notifier(struct notifier_block *); 18extern int register_die_notifier(struct notifier_block *);
19extern int unregister_die_notifier(struct notifier_block *); 19extern int unregister_die_notifier(struct notifier_block *);
20extern int register_page_fault_notifier(struct notifier_block *);
21extern int unregister_page_fault_notifier(struct notifier_block *);
20extern struct atomic_notifier_head sparc64die_chain; 22extern struct atomic_notifier_head sparc64die_chain;
21 23
22extern void bad_trap(struct pt_regs *, long); 24extern void bad_trap(struct pt_regs *, long);
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h
index e9bb26f770..c9f5c34d31 100644
--- a/include/asm-sparc64/kprobes.h
+++ b/include/asm-sparc64/kprobes.h
@@ -12,6 +12,8 @@ typedef u32 kprobe_opcode_t;
12 12
13#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 13#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
14#define arch_remove_kprobe(p) do {} while (0) 14#define arch_remove_kprobe(p) do {} while (0)
15#define ARCH_INACTIVE_KPROBE_COUNT 0
16#define flush_insn_slot(p) do { } while (0)
15 17
16/* Architecture specific copy of original instruction*/ 18/* Architecture specific copy of original instruction*/
17struct arch_specific_insn { 19struct arch_specific_insn {
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
index 6fd878e614..8cc1860be6 100644
--- a/include/asm-sparc64/mman.h
+++ b/include/asm-sparc64/mman.h
@@ -35,4 +35,12 @@
35 35
36#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 36#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
37 37
38#ifdef __KERNEL__
39#ifndef __ASSEMBLY__
40#define arch_mmap_check sparc64_mmap_check
41int sparc64_mmap_check(unsigned long addr, unsigned long len,
42 unsigned long flags);
43#endif
44#endif
45
38#endif /* __SPARC64_MMAN_H__ */ 46#endif /* __SPARC64_MMAN_H__ */
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
new file mode 100644
index 0000000000..a62c7b997d
--- /dev/null
+++ b/include/asm-sparc64/of_device.h
@@ -0,0 +1,80 @@
1#ifndef _ASM_SPARC64_OF_DEVICE_H
2#define _ASM_SPARC64_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
7#include <asm/openprom.h>
8#include <asm/prom.h>
9
10extern struct bus_type isa_bus_type;
11extern struct bus_type ebus_bus_type;
12extern struct bus_type sbus_bus_type;
13extern struct bus_type of_bus_type;
14
15/*
16 * The of_device is a kind of "base class" that is a superset of
17 * struct device for use by devices attached to an OF node and
18 * probed using OF properties.
19 */
20struct of_device
21{
22 struct device_node *node;
23 struct device dev;
24 struct resource resource[PROMREG_MAX];
25 unsigned int irqs[PROMINTR_MAX];
26 int num_irqs;
27
28 void *sysdata;
29
30 int slot;
31 int portid;
32 int clock_freq;
33};
34#define to_of_device(d) container_of(d, struct of_device, dev)
35
36extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
37extern void of_iounmap(void __iomem *base, unsigned long size);
38
39extern struct of_device *of_find_device_by_node(struct device_node *);
40
41extern const struct of_device_id *of_match_device(
42 const struct of_device_id *matches, const struct of_device *dev);
43
44extern struct of_device *of_dev_get(struct of_device *dev);
45extern void of_dev_put(struct of_device *dev);
46
47/*
48 * An of_platform_driver driver is attached to a basic of_device on
49 * the ISA, EBUS, and SBUS busses on sparc64.
50 */
51struct of_platform_driver
52{
53 char *name;
54 struct of_device_id *match_table;
55 struct module *owner;
56
57 int (*probe)(struct of_device* dev, const struct of_device_id *match);
58 int (*remove)(struct of_device* dev);
59
60 int (*suspend)(struct of_device* dev, pm_message_t state);
61 int (*resume)(struct of_device* dev);
62 int (*shutdown)(struct of_device* dev);
63
64 struct device_driver driver;
65};
66#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
67
68extern int of_register_driver(struct of_platform_driver *drv,
69 struct bus_type *bus);
70extern void of_unregister_driver(struct of_platform_driver *drv);
71extern int of_device_register(struct of_device *ofdev);
72extern void of_device_unregister(struct of_device *ofdev);
73extern struct of_device *of_platform_device_create(struct device_node *np,
74 const char *bus_id,
75 struct device *parent,
76 struct bus_type *bus);
77extern void of_release_dev(struct device *dev);
78
79#endif /* __KERNEL__ */
80#endif /* _ASM_SPARC64_OF_DEVICE_H */
diff --git a/include/asm-sparc64/openprom.h b/include/asm-sparc64/openprom.h
index b4959d2b0d..e01b80559c 100644
--- a/include/asm-sparc64/openprom.h
+++ b/include/asm-sparc64/openprom.h
@@ -175,7 +175,7 @@ struct linux_nodeops {
175}; 175};
176 176
177/* More fun PROM structures for device probing. */ 177/* More fun PROM structures for device probing. */
178#define PROMREG_MAX 16 178#define PROMREG_MAX 24
179#define PROMVADDR_MAX 16 179#define PROMVADDR_MAX 16
180#define PROMINTR_MAX 15 180#define PROMINTR_MAX 15
181 181
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index dea3e73f09..6a0da3b169 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -287,11 +287,6 @@ extern void prom_getstring(int node, const char *prop, char *buf, int bufsize);
287/* Does the passed node have the given "name"? YES=1 NO=0 */ 287/* Does the passed node have the given "name"? YES=1 NO=0 */
288extern int prom_nodematch(int thisnode, const char *name); 288extern int prom_nodematch(int thisnode, const char *name);
289 289
290/* Puts in buffer a prom name in the form name@x,y or name (x for which_io
291 * and y for first regs phys address
292 */
293extern int prom_getname(int node, char *buf, int buflen);
294
295/* Search all siblings starting at the passed node for "name" matching 290/* Search all siblings starting at the passed node for "name" matching
296 * the given string. Returns the node on success, zero on failure. 291 * the given string. Returns the node on success, zero on failure.
297 */ 292 */
@@ -323,8 +318,9 @@ extern int prom_pathtoinode(const char *path);
323extern int prom_inst2pkg(int); 318extern int prom_inst2pkg(int);
324 319
325/* CPU probing helpers. */ 320/* CPU probing helpers. */
326int cpu_find_by_instance(int instance, int *prom_node, int *mid); 321struct device_node;
327int cpu_find_by_mid(int mid, int *prom_node); 322int cpu_find_by_instance(int instance, struct device_node **dev_node, int *mid);
323int cpu_find_by_mid(int mid, struct device_node **prom_node);
328 324
329/* Client interface level routines. */ 325/* Client interface level routines. */
330extern void prom_set_trap_table(unsigned long tba); 326extern void prom_set_trap_table(unsigned long tba);
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index fdf0ceb760..ff736eafa6 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -3,6 +3,8 @@
3#ifndef _SPARC64_PAGE_H 3#ifndef _SPARC64_PAGE_H
4#define _SPARC64_PAGE_H 4#define _SPARC64_PAGE_H
5 5
6#ifdef __KERNEL__
7
6#include <asm/const.h> 8#include <asm/const.h>
7 9
8#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB) 10#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
@@ -27,8 +29,6 @@
27#define DCACHE_ALIASING_POSSIBLE 29#define DCACHE_ALIASING_POSSIBLE
28#endif 30#endif
29 31
30#ifdef __KERNEL__
31
32#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) 32#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
33#define HPAGE_SHIFT 22 33#define HPAGE_SHIFT 22
34#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) 34#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
@@ -141,8 +141,7 @@ typedef unsigned long pgprot_t;
141#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 141#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
142 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 142 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
143 143
144#endif /* !(__KERNEL__) */
145
146#include <asm-generic/page.h> 144#include <asm-generic/page.h>
147 145
148#endif /* !(_SPARC64_PAGE_H) */ 146#endif /* __KERNEL__ */
147#endif /* _SPARC64_PAGE_H */
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 56b5197d78..d3895873e4 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -67,18 +67,17 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
67 67
68static int ebus_ecpp_p(struct linux_ebus_device *edev) 68static int ebus_ecpp_p(struct linux_ebus_device *edev)
69{ 69{
70 if (!strcmp(edev->prom_name, "ecpp")) 70 if (!strcmp(edev->prom_node->name, "ecpp"))
71 return 1; 71 return 1;
72 if (!strcmp(edev->prom_name, "parallel")) { 72 if (!strcmp(edev->prom_node->name, "parallel")) {
73 char compat[19]; 73 char *compat;
74 prom_getstring(edev->prom_node, 74
75 "compatible", 75 compat = of_get_property(edev->prom_node,
76 compat, sizeof(compat)); 76 "compatible", NULL);
77 compat[18] = '\0'; 77 if (compat &&
78 if (!strcmp(compat, "ecpp")) 78 (!strcmp(compat, "ecpp") ||
79 return 1; 79 !strcmp(compat, "ns87317-ecpp") ||
80 if (!strcmp(compat, "ns87317-ecpp") && 80 !strcmp(compat + 13, "ecpp")))
81 !strcmp(compat + 13, "ecpp"))
82 return 1; 81 return 1;
83 } 82 }
84 return 0; 83 return 0;
@@ -94,12 +93,12 @@ static int parport_isa_probe(int count)
94 struct sparc_isa_device *child; 93 struct sparc_isa_device *child;
95 unsigned long base; 94 unsigned long base;
96 95
97 if (strcmp(isa_dev->prom_name, "dma")) 96 if (strcmp(isa_dev->prom_node->name, "dma"))
98 continue; 97 continue;
99 98
100 child = isa_dev->child; 99 child = isa_dev->child;
101 while (child) { 100 while (child) {
102 if (!strcmp(child->prom_name, "parallel")) 101 if (!strcmp(child->prom_node->name, "parallel"))
103 break; 102 break;
104 child = child->next; 103 child = child->next;
105 } 104 }
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 1396f11093..dcfa762935 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -15,6 +15,8 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/oplib.h> 17#include <asm/oplib.h>
18#include <asm/prom.h>
19#include <asm/of_device.h>
18#include <asm/iommu.h> 20#include <asm/iommu.h>
19 21
20/* The abstraction used here is that there are PCI controllers, 22/* The abstraction used here is that there are PCI controllers,
@@ -153,16 +155,15 @@ struct pci_pbm_info {
153 int chip_revision; 155 int chip_revision;
154 156
155 /* Name used for top-level resources. */ 157 /* Name used for top-level resources. */
156 char name[64]; 158 char *name;
157 159
158 /* OBP specific information. */ 160 /* OBP specific information. */
159 int prom_node; 161 struct device_node *prom_node;
160 char prom_name[64]; 162 struct linux_prom_pci_ranges *pbm_ranges;
161 struct linux_prom_pci_ranges pbm_ranges[PROM_PCIRNG_MAX];
162 int num_pbm_ranges; 163 int num_pbm_ranges;
163 struct linux_prom_pci_intmap pbm_intmap[PROM_PCIIMAP_MAX]; 164 struct linux_prom_pci_intmap *pbm_intmap;
164 int num_pbm_intmap; 165 int num_pbm_intmap;
165 struct linux_prom_pci_intmask pbm_intmask; 166 struct linux_prom_pci_intmask *pbm_intmask;
166 u64 ino_bitmap; 167 u64 ino_bitmap;
167 168
168 /* PBM I/O and Memory space resources. */ 169 /* PBM I/O and Memory space resources. */
@@ -209,7 +210,6 @@ struct pci_controller_info {
209 210
210 /* Operations which are controller specific. */ 211 /* Operations which are controller specific. */
211 void (*scan_bus)(struct pci_controller_info *); 212 void (*scan_bus)(struct pci_controller_info *);
212 unsigned int (*irq_build)(struct pci_pbm_info *, struct pci_dev *, unsigned int);
213 void (*base_address_update)(struct pci_dev *, int); 213 void (*base_address_update)(struct pci_dev *, int);
214 void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *); 214 void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *);
215 215
@@ -217,8 +217,6 @@ struct pci_controller_info {
217 struct pci_ops *pci_ops; 217 struct pci_ops *pci_ops;
218 unsigned int pci_first_busno; 218 unsigned int pci_first_busno;
219 unsigned int pci_last_busno; 219 unsigned int pci_last_busno;
220
221 void *starfire_cookie;
222}; 220};
223 221
224/* PCI devices which are not bridges have this placed in their pci_dev 222/* PCI devices which are not bridges have this placed in their pci_dev
@@ -227,8 +225,8 @@ struct pci_controller_info {
227 */ 225 */
228struct pcidev_cookie { 226struct pcidev_cookie {
229 struct pci_pbm_info *pbm; 227 struct pci_pbm_info *pbm;
230 char prom_name[64]; 228 struct device_node *prom_node;
231 int prom_node; 229 struct of_device *op;
232 struct linux_prom_pci_registers prom_regs[PROMREG_MAX]; 230 struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
233 int num_prom_regs; 231 int num_prom_regs;
234 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX]; 232 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index baef13b589..ced8cbde04 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -11,6 +11,7 @@ extern unsigned long __per_cpu_base;
11extern unsigned long __per_cpu_shift; 11extern unsigned long __per_cpu_shift;
12#define __per_cpu_offset(__cpu) \ 12#define __per_cpu_offset(__cpu) \
13 (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift)) 13 (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift))
14#define per_cpu_offset(x) (__per_cpu_offset(x))
14 15
15/* Separate out the type, so (int[3], foo) works. */ 16/* Separate out the type, so (int[3], foo) works. */
16#define DEFINE_PER_CPU(type, name) \ 17#define DEFINE_PER_CPU(type, name) \
@@ -21,6 +22,7 @@ register unsigned long __local_per_cpu_offset asm("g5");
21/* var is in discarded region: offset to particular copy we want */ 22/* var is in discarded region: offset to particular copy we want */
22#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 23#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
23#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset)) 24#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
25#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
24 26
25/* A macro to avoid #include hell... */ 27/* A macro to avoid #include hell... */
26#define percpu_modcopy(pcpudst, src, size) \ 28#define percpu_modcopy(pcpudst, src, size) \
@@ -37,6 +39,7 @@ do { \
37 39
38#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) 40#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
39#define __get_cpu_var(var) per_cpu__##var 41#define __get_cpu_var(var) per_cpu__##var
42#define __raw_get_cpu_var(var) per_cpu__##var
40 43
41#endif /* SMP */ 44#endif /* SMP */
42 45
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 4e218814bb..b12be7a869 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -234,7 +234,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
234 sz_bits = 0UL; 234 sz_bits = 0UL;
235 if (_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL) { 235 if (_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL) {
236 __asm__ __volatile__( 236 __asm__ __volatile__(
237 "\n661: sethi %uhi(%1), %0\n" 237 "\n661: sethi %%uhi(%1), %0\n"
238 " sllx %0, 32, %0\n" 238 " sllx %0, 32, %0\n"
239 " .section .sun4v_2insn_patch, \"ax\"\n" 239 " .section .sun4v_2insn_patch, \"ax\"\n"
240 " .word 661b\n" 240 " .word 661b\n"
@@ -339,7 +339,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot)
339 " .section .sun4v_2insn_patch, \"ax\"\n" 339 " .section .sun4v_2insn_patch, \"ax\"\n"
340 " .word 661b\n" 340 " .word 661b\n"
341 " andn %0, %4, %0\n" 341 " andn %0, %4, %0\n"
342 " or %0, %3, %0\n" 342 " or %0, %5, %0\n"
343 " .previous\n" 343 " .previous\n"
344 : "=r" (val) 344 : "=r" (val)
345 : "0" (val), "i" (_PAGE_CP_4U | _PAGE_CV_4U), "i" (_PAGE_E_4U), 345 : "0" (val), "i" (_PAGE_CP_4U | _PAGE_CV_4U), "i" (_PAGE_E_4U),
@@ -630,8 +630,9 @@ static inline unsigned long pte_present(pte_t pte)
630#define __pmd_page(pmd) \ 630#define __pmd_page(pmd) \
631 ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) 631 ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL)))
632#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) 632#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
633#define pud_page(pud) \ 633#define pud_page_vaddr(pud) \
634 ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) 634 ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL)))
635#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud))
635#define pmd_none(pmd) (!pmd_val(pmd)) 636#define pmd_none(pmd) (!pmd_val(pmd))
636#define pmd_bad(pmd) (0) 637#define pmd_bad(pmd) (0)
637#define pmd_present(pmd) (pmd_val(pmd) != 0U) 638#define pmd_present(pmd) (pmd_val(pmd) != 0U)
@@ -653,7 +654,7 @@ static inline unsigned long pte_present(pte_t pte)
653 654
654/* Find an entry in the second-level page table.. */ 655/* Find an entry in the second-level page table.. */
655#define pmd_offset(pudp, address) \ 656#define pmd_offset(pudp, address) \
656 ((pmd_t *) pud_page(*(pudp)) + \ 657 ((pmd_t *) pud_page_vaddr(*(pudp)) + \
657 (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) 658 (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)))
658 659
659/* Find an entry in the third-level page table.. */ 660/* Find an entry in the third-level page table.. */
@@ -756,6 +757,8 @@ extern unsigned long *sparc64_valid_addr_bitmap;
756#define kern_addr_valid(addr) \ 757#define kern_addr_valid(addr) \
757 (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) 758 (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap))
758 759
760extern int page_in_phys_avail(unsigned long paddr);
761
759extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 762extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
760 unsigned long pfn, 763 unsigned long pfn,
761 unsigned long size, pgprot_t prot); 764 unsigned long size, pgprot_t prot);
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
new file mode 100644
index 0000000000..99671ed662
--- /dev/null
+++ b/include/asm-sparc64/prom.h
@@ -0,0 +1,112 @@
1#ifndef _SPARC64_PROM_H
2#define _SPARC64_PROM_H
3#ifdef __KERNEL__
4
5
6/*
7 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers.
9 *
10 * Copyright (C) 1996-2005 Paul Mackerras.
11 *
12 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13 * Updates for SPARC64 by David S. Miller
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <linux/types.h>
22#include <linux/proc_fs.h>
23#include <asm/atomic.h>
24
25typedef u32 phandle;
26typedef u32 ihandle;
27
28struct property {
29 char *name;
30 int length;
31 void *value;
32 struct property *next;
33 unsigned long _flags;
34 unsigned int unique_id;
35};
36
37struct of_irq_controller;
38struct device_node {
39 char *name;
40 char *type;
41 phandle node;
42 char *path_component_name;
43 char *full_name;
44
45 struct property *properties;
46 struct property *deadprops; /* removed properties */
47 struct device_node *parent;
48 struct device_node *child;
49 struct device_node *sibling;
50 struct device_node *next; /* next device of same type */
51 struct device_node *allnext; /* next in list of all nodes */
52 struct proc_dir_entry *pde; /* this node's proc directory */
53 struct kref kref;
54 unsigned long _flags;
55 void *data;
56 unsigned int unique_id;
57
58 struct of_irq_controller *irq_trans;
59};
60
61struct of_irq_controller {
62 unsigned int (*irq_build)(struct device_node *, unsigned int, void *);
63 void *data;
64};
65
66/* flag descriptions */
67#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
68
69#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
70#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
71
72#define OF_BAD_ADDR ((u64)-1)
73
74static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
75{
76 dn->pde = de;
77}
78
79extern struct device_node *of_find_node_by_name(struct device_node *from,
80 const char *name);
81#define for_each_node_by_name(dn, name) \
82 for (dn = of_find_node_by_name(NULL, name); dn; \
83 dn = of_find_node_by_name(dn, name))
84extern struct device_node *of_find_node_by_type(struct device_node *from,
85 const char *type);
86#define for_each_node_by_type(dn, type) \
87 for (dn = of_find_node_by_type(NULL, type); dn; \
88 dn = of_find_node_by_type(dn, type))
89extern struct device_node *of_find_compatible_node(struct device_node *from,
90 const char *type, const char *compat);
91extern struct device_node *of_find_node_by_path(const char *path);
92extern struct device_node *of_find_node_by_phandle(phandle handle);
93extern struct device_node *of_get_parent(const struct device_node *node);
94extern struct device_node *of_get_next_child(const struct device_node *node,
95 struct device_node *prev);
96extern struct property *of_find_property(struct device_node *np,
97 const char *name,
98 int *lenp);
99extern int of_device_is_compatible(struct device_node *device, const char *);
100extern void *of_get_property(struct device_node *node, const char *name,
101 int *lenp);
102extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
103extern int of_getintprop_default(struct device_node *np,
104 const char *name,
105 int def);
106extern int of_n_addr_cells(struct device_node *np);
107extern int of_n_size_cells(struct device_node *np);
108
109extern void prom_build_devicetree(void);
110
111#endif /* __KERNEL__ */
112#endif /* _SPARC64_PROM_H */
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h
index 48279e10f3..7efd49d31b 100644
--- a/include/asm-sparc64/sbus.h
+++ b/include/asm-sparc64/sbus.h
@@ -11,6 +11,8 @@
11#include <linux/ioport.h> 11#include <linux/ioport.h>
12 12
13#include <asm/oplib.h> 13#include <asm/oplib.h>
14#include <asm/prom.h>
15#include <asm/of_device.h>
14#include <asm/iommu.h> 16#include <asm/iommu.h>
15#include <asm/scatterlist.h> 17#include <asm/scatterlist.h>
16 18
@@ -42,18 +44,19 @@ struct sbus_bus;
42 44
43/* Linux SBUS device tables */ 45/* Linux SBUS device tables */
44struct sbus_dev { 46struct sbus_dev {
45 struct sbus_bus *bus; /* Our toplevel parent SBUS */ 47 struct of_device ofdev;
46 struct sbus_dev *next; /* Chain of siblings */ 48 struct sbus_bus *bus;
47 struct sbus_dev *child; /* Chain of children */ 49 struct sbus_dev *next;
48 struct sbus_dev *parent;/* Parent device if not toplevel*/ 50 struct sbus_dev *child;
49 int prom_node; /* OBP node of this device */ 51 struct sbus_dev *parent;
50 char prom_name[64]; /* OBP device name property */ 52 int prom_node;
51 int slot; /* SBUS slot number */ 53 char prom_name[64];
54 int slot;
52 55
53 struct resource resource[PROMREG_MAX]; 56 struct resource resource[PROMREG_MAX];
54 57
55 struct linux_prom_registers reg_addrs[PROMREG_MAX]; 58 struct linux_prom_registers reg_addrs[PROMREG_MAX];
56 int num_registers, ranges_applied; 59 int num_registers;
57 60
58 struct linux_prom_ranges device_ranges[PROMREG_MAX]; 61 struct linux_prom_ranges device_ranges[PROMREG_MAX];
59 int num_device_ranges; 62 int num_device_ranges;
@@ -61,9 +64,11 @@ struct sbus_dev {
61 unsigned int irqs[4]; 64 unsigned int irqs[4];
62 int num_irqs; 65 int num_irqs;
63}; 66};
67#define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev)
64 68
65/* This struct describes the SBus(s) found on this machine. */ 69/* This struct describes the SBus(s) found on this machine. */
66struct sbus_bus { 70struct sbus_bus {
71 struct of_device ofdev;
67 void *iommu; /* Opaque IOMMU cookie */ 72 void *iommu; /* Opaque IOMMU cookie */
68 struct sbus_dev *devices; /* Tree of SBUS devices */ 73 struct sbus_dev *devices; /* Tree of SBUS devices */
69 struct sbus_bus *next; /* Next SBUS in system */ 74 struct sbus_bus *next; /* Next SBUS in system */
@@ -75,8 +80,8 @@ struct sbus_bus {
75 int num_sbus_ranges; 80 int num_sbus_ranges;
76 81
77 int portid; 82 int portid;
78 void *starfire_cookie;
79}; 83};
84#define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev)
80 85
81extern struct sbus_bus *sbus_root; 86extern struct sbus_bus *sbus_root;
82 87
@@ -95,6 +100,7 @@ extern struct sbus_bus *sbus_root;
95#define sbus_can_dma_64bit(sdev) (1) 100#define sbus_can_dma_64bit(sdev) (1)
96#define sbus_can_burst64(sdev) (1) 101#define sbus_can_burst64(sdev) (1)
97extern void sbus_set_sbus64(struct sbus_dev *, int); 102extern void sbus_set_sbus64(struct sbus_dev *, int);
103extern void sbus_fill_device_irq(struct sbus_dev *);
98 104
99/* These yield IOMMU mappings in consistent mode. */ 105/* These yield IOMMU mappings in consistent mode. */
100extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); 106extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp);
@@ -119,4 +125,10 @@ extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, in
119#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu 125#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
120extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); 126extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int);
121 127
128extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
129extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
130extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
131extern int sbus_arch_preinit(void);
132extern void sbus_arch_postinit(void);
133
122#endif /* !(_SPARC64_SBUS_H) */ 134#endif /* !(_SPARC64_SBUS_H) */
diff --git a/include/asm-sparc64/sfp-machine.h b/include/asm-sparc64/sfp-machine.h
index 5015bb8d6c..89d42431ef 100644
--- a/include/asm-sparc64/sfp-machine.h
+++ b/include/asm-sparc64/sfp-machine.h
@@ -34,7 +34,7 @@
34#define _FP_MUL_MEAT_D(R,X,Y) \ 34#define _FP_MUL_MEAT_D(R,X,Y) \
35 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) 35 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
36#define _FP_MUL_MEAT_Q(R,X,Y) \ 36#define _FP_MUL_MEAT_Q(R,X,Y) \
37 _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) 37 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
38 38
39#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) 39#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
40#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) 40#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h
index 8c66fded8a..911d0427de 100644
--- a/include/asm-sparc64/shmparam.h
+++ b/include/asm-sparc64/shmparam.h
@@ -1,6 +1,7 @@
1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */ 1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */
2#ifndef _ASMSPARC64_SHMPARAM_H 2#ifndef _ASMSPARC64_SHMPARAM_H
3#define _ASMSPARC64_SHMPARAM_H 3#define _ASMSPARC64_SHMPARAM_H
4#ifdef __KERNEL__
4 5
5#include <asm/spitfire.h> 6#include <asm/spitfire.h>
6 7
@@ -8,4 +9,5 @@
8/* attach addr a multiple of this */ 9/* attach addr a multiple of this */
9#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE) 10#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE)
10 11
12#endif /* __KERNEL__ */
11#endif /* _ASMSPARC64_SHMPARAM_H */ 13#endif /* _ASMSPARC64_SHMPARAM_H */
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
index fdc42a14d4..9968871103 100644
--- a/include/asm-sparc64/signal.h
+++ b/include/asm-sparc64/signal.h
@@ -133,16 +133,13 @@ struct sigstack {
133 * usage of signal stacks by using the (now obsolete) sa_restorer field in 133 * usage of signal stacks by using the (now obsolete) sa_restorer field in
134 * the sigaction structure as a stack pointer. This is now possible due to 134 * the sigaction structure as a stack pointer. This is now possible due to
135 * the changes in signal handling. LBT 010493. 135 * the changes in signal handling. LBT 010493.
136 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
137 * SA_RESTART flag to get restarting signals (which were the default long ago) 136 * SA_RESTART flag to get restarting signals (which were the default long ago)
138 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
139 */ 137 */
140#define SA_NOCLDSTOP _SV_IGNCHILD 138#define SA_NOCLDSTOP _SV_IGNCHILD
141#define SA_STACK _SV_SSTACK 139#define SA_STACK _SV_SSTACK
142#define SA_ONSTACK _SV_SSTACK 140#define SA_ONSTACK _SV_SSTACK
143#define SA_RESTART _SV_INTR 141#define SA_RESTART _SV_INTR
144#define SA_ONESHOT _SV_RESET 142#define SA_ONESHOT _SV_RESET
145#define SA_INTERRUPT 0x10u
146#define SA_NOMASK 0x20u 143#define SA_NOMASK 0x20u
147#define SA_NOCLDWAIT 0x100u 144#define SA_NOCLDWAIT 0x100u
148#define SA_SIGINFO 0x200u 145#define SA_SIGINFO 0x200u
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 59987dad33..754d46a50a 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -48,6 +48,7 @@
48#define SCM_TIMESTAMP SO_TIMESTAMP 48#define SCM_TIMESTAMP SO_TIMESTAMP
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f
51 52
52/* Security levels - as per NRL IPv6 - don't actually do anything */ 53/* Security levels - as per NRL IPv6 - don't actually do anything */
53#define SO_SECURITY_AUTHENTICATION 0x5001 54#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc64/starfire.h b/include/asm-sparc64/starfire.h
index b606cb2b32..48b50b5e35 100644
--- a/include/asm-sparc64/starfire.h
+++ b/include/asm-sparc64/starfire.h
@@ -14,7 +14,7 @@ extern int this_is_starfire;
14extern void check_if_starfire(void); 14extern void check_if_starfire(void);
15extern void starfire_cpu_setup(void); 15extern void starfire_cpu_setup(void);
16extern int starfire_hard_smp_processor_id(void); 16extern int starfire_hard_smp_processor_id(void);
17extern void *starfire_hookup(int); 17extern void starfire_hookup(int);
18extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid); 18extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid);
19 19
20#endif 20#endif
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 4ca68600c6..a8b7432c9a 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -123,8 +123,6 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
123#define read_barrier_depends() do { } while(0) 123#define read_barrier_depends() do { } while(0)
124#define set_mb(__var, __value) \ 124#define set_mb(__var, __value) \
125 do { __var = __value; membar_storeload_storestore(); } while(0) 125 do { __var = __value; membar_storeload_storestore(); } while(0)
126#define set_wmb(__var, __value) \
127 do { __var = __value; wmb(); } while(0)
128 126
129#ifdef CONFIG_SMP 127#ifdef CONFIG_SMP
130#define smp_mb() mb() 128#define smp_mb() mb()
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h
index 0e234e201b..98a6c61358 100644
--- a/include/asm-sparc64/topology.h
+++ b/include/asm-sparc64/topology.h
@@ -1,6 +1,9 @@
1#ifndef _ASM_SPARC64_TOPOLOGY_H 1#ifndef _ASM_SPARC64_TOPOLOGY_H
2#define _ASM_SPARC64_TOPOLOGY_H 2#define _ASM_SPARC64_TOPOLOGY_H
3 3
4#include <asm/spitfire.h>
5#define smt_capable() (tlb_type == hypervisor)
6
4#include <asm-generic/topology.h> 7#include <asm-generic/topology.h>
5 8
6#endif /* _ASM_SPARC64_TOPOLOGY_H */ 9#endif /* _ASM_SPARC64_TOPOLOGY_H */
diff --git a/include/asm-sparc64/vdev.h b/include/asm-sparc64/vdev.h
deleted file mode 100644
index 996e6be7b9..0000000000
--- a/include/asm-sparc64/vdev.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* vdev.h: SUN4V virtual device interfaces and defines.
2 *
3 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
4 */
5
6#ifndef _SPARC64_VDEV_H
7#define _SPARC64_VDEV_H
8
9#include <linux/types.h>
10
11extern u32 sun4v_vdev_devhandle;
12extern int sun4v_vdev_root;
13
14extern unsigned int sun4v_vdev_device_interrupt(unsigned int);
15
16#endif /* !(_SPARC64_VDEV_H) */
diff --git a/include/asm-um/alternative-asm.i b/include/asm-um/alternative-asm.i
new file mode 100644
index 0000000000..cae9faca13
--- /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 0000000000..09d5dca5d9
--- /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/hw_irq.h b/include/asm-um/hw_irq.h
index 4ee38c0b6a..1cf84cf5f2 100644
--- a/include/asm-um/hw_irq.h
+++ b/include/asm-um/hw_irq.h
@@ -4,7 +4,4 @@
4#include "asm/irq.h" 4#include "asm/irq.h"
5#include "asm/archparam.h" 5#include "asm/archparam.h"
6 6
7static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
8{}
9
10#endif 7#endif
diff --git a/include/asm-um/io.h b/include/asm-um/io.h
index 1934d9340e..44e8b8c772 100644
--- a/include/asm-um/io.h
+++ b/include/asm-um/io.h
@@ -45,8 +45,13 @@ static inline void writel(unsigned int b, volatile void __iomem *addr)
45{ 45{
46 *(volatile unsigned int __force *) addr = b; 46 *(volatile unsigned int __force *) addr = b;
47} 47}
48static inline void writeq(unsigned int b, volatile void __iomem *addr)
49{
50 *(volatile unsigned long long __force *) addr = b;
51}
48#define __raw_writeb writeb 52#define __raw_writeb writeb
49#define __raw_writew writew 53#define __raw_writew writew
50#define __raw_writel writel 54#define __raw_writel writel
55#define __raw_writeq writeq
51 56
52#endif 57#endif
diff --git a/include/asm-um/kmap_types.h b/include/asm-um/kmap_types.h
index 0b22ad776e..6c03acdb44 100644
--- a/include/asm-um/kmap_types.h
+++ b/include/asm-um/kmap_types.h
@@ -6,6 +6,24 @@
6#ifndef __UM_KMAP_TYPES_H 6#ifndef __UM_KMAP_TYPES_H
7#define __UM_KMAP_TYPES_H 7#define __UM_KMAP_TYPES_H
8 8
9#include "asm/arch/kmap_types.h" 9/* No more #include "asm/arch/kmap_types.h" ! */
10
11enum km_type {
12 KM_BOUNCE_READ,
13 KM_SKB_SUNRPC_DATA,
14 KM_SKB_DATA_SOFTIRQ,
15 KM_USER0,
16 KM_USER1,
17 KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
18 KM_BIO_SRC_IRQ,
19 KM_BIO_DST_IRQ,
20 KM_PTE0,
21 KM_PTE1,
22 KM_IRQ0,
23 KM_IRQ1,
24 KM_SOFTIRQ0,
25 KM_SOFTIRQ1,
26 KM_TYPE_NR
27};
10 28
11#endif 29#endif
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
index ffe017f6b6..6050e0eb25 100644
--- a/include/asm-um/pgtable-2level.h
+++ b/include/asm-um/pgtable-2level.h
@@ -41,7 +41,7 @@ static inline void pgd_mkuptodate(pgd_t pgd) { }
41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) 41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) 42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
43 43
44#define pmd_page_kernel(pmd) \ 44#define pmd_page_vaddr(pmd) \
45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
46 46
47/* 47/*
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
index 786c257272..ca0c2a92a1 100644
--- a/include/asm-um/pgtable-3level.h
+++ b/include/asm-um/pgtable-3level.h
@@ -74,11 +74,12 @@ extern inline void pud_clear (pud_t *pud)
74 set_pud(pud, __pud(0)); 74 set_pud(pud, __pud(0));
75} 75}
76 76
77#define pud_page(pud) \ 77#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK)
78#define pud_page_vaddr(pud) \
78 ((struct page *) __va(pud_val(pud) & PAGE_MASK)) 79 ((struct page *) __va(pud_val(pud) & PAGE_MASK))
79 80
80/* Find an entry in the second-level page table.. */ 81/* Find an entry in the second-level page table.. */
81#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \ 82#define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \
82 pmd_index(address)) 83 pmd_index(address))
83 84
84static inline unsigned long pte_pfn(pte_t pte) 85static inline unsigned long pte_pfn(pte_t pte)
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index ac64eb9558..188f726217 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);
@@ -349,7 +343,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
349 return pte; 343 return pte;
350} 344}
351 345
352#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 346#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
353 347
354/* 348/*
355 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] 349 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
@@ -389,7 +383,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
389 */ 383 */
390#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 384#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
391#define pte_offset_kernel(dir, address) \ 385#define pte_offset_kernel(dir, address) \
392 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) 386 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
393#define pte_offset_map(dir, address) \ 387#define pte_offset_map(dir, address) \
394 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 388 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
395#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) 389#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index 824c288963..d99bbddffd 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,9 +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 ({ union uml_pt_regs regs; \ 141 get_thread_reg(reg, &tsk->thread.mode.skas.switch_buf)
142 get_thread_regs(&regs, tsk->thread.mode.skas.switch_buf); \
143 UPT_REG(&regs, reg); })
144#else 142#else
145#define KSTK_REG(tsk, reg) (0xbadbabe) 143#define KSTK_REG(tsk, reg) (0xbadbabe)
146#endif 144#endif
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h
index a36f5371b3..99c87c5ce9 100644
--- a/include/asm-um/ptrace-generic.h
+++ b/include/asm-um/ptrace-generic.h
@@ -8,19 +8,7 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11 11#include "asm/arch/ptrace-abi.h"
12#define pt_regs pt_regs_subarch
13#define show_regs show_regs_subarch
14#define send_sigtrap send_sigtrap_subarch
15
16#include "asm/arch/ptrace.h"
17
18#undef pt_regs
19#undef show_regs
20#undef send_sigtrap
21#undef user_mode
22#undef instruction_pointer
23
24#include "sysdep/ptrace.h" 12#include "sysdep/ptrace.h"
25 13
26struct pt_regs { 14struct pt_regs {
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h
index c894e68b1f..03b4af4ac0 100644
--- a/include/asm-um/ptrace-x86_64.h
+++ b/include/asm-um/ptrace-x86_64.h
@@ -11,21 +11,20 @@
11#include "asm/errno.h" 11#include "asm/errno.h"
12#include "asm/host_ldt.h" 12#include "asm/host_ldt.h"
13 13
14#define signal_fault signal_fault_x86_64
15#define __FRAME_OFFSETS /* Needed to get the R* macros */ 14#define __FRAME_OFFSETS /* Needed to get the R* macros */
16#include "asm/ptrace-generic.h" 15#include "asm/ptrace-generic.h"
17#undef signal_fault
18 16
19#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 17#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
20 18
21void signal_fault(struct pt_regs_subarch *regs, void *frame, char *where); 19/* Also defined in sysdep/ptrace.h, so may already be defined. */
22 20#ifndef FS_BASE
23#define FS_BASE (21 * sizeof(unsigned long)) 21#define FS_BASE (21 * sizeof(unsigned long))
24#define GS_BASE (22 * sizeof(unsigned long)) 22#define GS_BASE (22 * sizeof(unsigned long))
25#define DS (23 * sizeof(unsigned long)) 23#define DS (23 * sizeof(unsigned long))
26#define ES (24 * sizeof(unsigned long)) 24#define ES (24 * sizeof(unsigned long))
27#define FS (25 * sizeof(unsigned long)) 25#define FS (25 * sizeof(unsigned long))
28#define GS (26 * sizeof(unsigned long)) 26#define GS (26 * sizeof(unsigned long))
27#endif
29 28
30#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs) 29#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs)
31#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs) 30#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs)
diff --git a/include/asm-v850/Kbuild b/include/asm-v850/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-v850/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-v850/hw_irq.h b/include/asm-v850/hw_irq.h
index a8aab43427..043e94bb6b 100644
--- a/include/asm-v850/hw_irq.h
+++ b/include/asm-v850/hw_irq.h
@@ -1,8 +1,4 @@
1#ifndef __V850_HW_IRQ_H__ 1#ifndef __V850_HW_IRQ_H__
2#define __V850_HW_IRQ_H__ 2#define __V850_HW_IRQ_H__
3 3
4static inline void hw_resend_irq (struct hw_interrupt_type *h, unsigned int i)
5{
6}
7
8#endif /* __V850_HW_IRQ_H__ */ 4#endif /* __V850_HW_IRQ_H__ */
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index ad03c46a1f..d693ffb136 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -14,6 +14,8 @@
14#ifndef __V850_PAGE_H__ 14#ifndef __V850_PAGE_H__
15#define __V850_PAGE_H__ 15#define __V850_PAGE_H__
16 16
17#ifdef __KERNEL__
18
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18 20
19 21
@@ -32,7 +34,6 @@
32#endif 34#endif
33 35
34 36
35#ifdef __KERNEL__
36#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
37 38
38#define STRICT_MM_TYPECHECKS 39#define STRICT_MM_TYPECHECKS
@@ -122,9 +123,9 @@ typedef unsigned long pgprot_t;
122#define __va(x) ((void *)__phys_to_virt ((unsigned long)(x))) 123#define __va(x) ((void *)__phys_to_virt ((unsigned long)(x)))
123 124
124 125
125#endif /* KERNEL */
126
127#include <asm-generic/memory_model.h> 126#include <asm-generic/memory_model.h>
128#include <asm-generic/page.h> 127#include <asm-generic/page.h>
129 128
129#endif /* KERNEL */
130
130#endif /* __V850_PAGE_H__ */ 131#endif /* __V850_PAGE_H__ */
diff --git a/include/asm-v850/param.h b/include/asm-v850/param.h
index 8d796e4bff..3c65bd5737 100644
--- a/include/asm-v850/param.h
+++ b/include/asm-v850/param.h
@@ -14,8 +14,6 @@
14#ifndef __V850_PARAM_H__ 14#ifndef __V850_PARAM_H__
15#define __V850_PARAM_H__ 15#define __V850_PARAM_H__
16 16
17#include <asm/machdep.h> /* For HZ */
18
19#define EXEC_PAGESIZE 4096 17#define EXEC_PAGESIZE 4096
20 18
21#ifndef NOGROUP 19#ifndef NOGROUP
@@ -25,6 +23,8 @@
25#define MAXHOSTNAMELEN 64 /* max length of hostname */ 23#define MAXHOSTNAMELEN 64 /* max length of hostname */
26 24
27#ifdef __KERNEL__ 25#ifdef __KERNEL__
26#include <asm/machdep.h> /* For HZ */
27
28# define USER_HZ 100 28# define USER_HZ 100
29# define CLOCKS_PER_SEC USER_HZ 29# define CLOCKS_PER_SEC USER_HZ
30#endif 30#endif
diff --git a/include/asm-v850/processor.h b/include/asm-v850/processor.h
index 6965b66cca..979e3467f9 100644
--- a/include/asm-v850/processor.h
+++ b/include/asm-v850/processor.h
@@ -18,6 +18,7 @@
18#include <linux/thread_info.h> 18#include <linux/thread_info.h>
19#endif 19#endif
20 20
21#include <linux/compiler.h>
21#include <asm/ptrace.h> 22#include <asm/ptrace.h>
22#include <asm/entry.h> 23#include <asm/entry.h>
23 24
@@ -106,7 +107,7 @@ unsigned long get_wchan (struct task_struct *p);
106#define KSTK_ESP(task) task_sp (task) 107#define KSTK_ESP(task) task_sp (task)
107 108
108 109
109#define cpu_relax() ((void)0) 110#define cpu_relax() barrier()
110 111
111 112
112#else /* __ASSEMBLY__ */ 113#else /* __ASSEMBLY__ */
diff --git a/include/asm-v850/signal.h b/include/asm-v850/signal.h
index cb52caa699..a38df0834b 100644
--- a/include/asm-v850/signal.h
+++ b/include/asm-v850/signal.h
@@ -77,7 +77,6 @@ typedef unsigned long sigset_t;
77 * SA_FLAGS values: 77 * SA_FLAGS values:
78 * 78 *
79 * SA_ONSTACK indicates that a registered stack_t will be used. 79 * SA_ONSTACK indicates that a registered stack_t will be used.
80 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
81 * SA_RESTART flag to get restarting signals (which were the default long ago) 80 * SA_RESTART flag to get restarting signals (which were the default long ago)
82 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 81 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
83 * SA_RESETHAND clears the handler when the signal is delivered. 82 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -97,7 +96,6 @@ typedef unsigned long sigset_t;
97 96
98#define SA_NOMASK SA_NODEFER 97#define SA_NOMASK SA_NODEFER
99#define SA_ONESHOT SA_RESETHAND 98#define SA_ONESHOT SA_RESETHAND
100#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
101 99
102#define SA_RESTORER 0x04000000 100#define SA_RESTORER 0x04000000
103 101
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index 0240d366a0..0dfe55ac2e 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* __V850_SOCKET_H__ */ 53#endif /* __V850_SOCKET_H__ */
diff --git a/include/asm-v850/system.h b/include/asm-v850/system.h
index 7091af4b78..da39916f10 100644
--- a/include/asm-v850/system.h
+++ b/include/asm-v850/system.h
@@ -68,7 +68,6 @@ static inline int irqs_disabled (void)
68#define read_barrier_depends() ((void)0) 68#define read_barrier_depends() ((void)0)
69#define set_rmb(var, value) do { xchg (&var, value); } while (0) 69#define set_rmb(var, value) do { xchg (&var, value); } while (0)
70#define set_mb(var, value) set_rmb (var, value) 70#define set_mb(var, value) set_rmb (var, value)
71#define set_wmb(var, value) do { var = value; wmb (); } while (0)
72 71
73#define smp_mb() mb () 72#define smp_mb() mb ()
74#define smp_rmb() rmb () 73#define smp_rmb() rmb ()
diff --git a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h
index bcb44bfe57..552b7c873a 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 } \
diff --git a/include/asm-x86_64/Kbuild b/include/asm-x86_64/Kbuild
new file mode 100644
index 0000000000..1ee9b07f3f
--- /dev/null
+++ b/include/asm-x86_64/Kbuild
@@ -0,0 +1,22 @@
1include include/asm-generic/Kbuild.asm
2
3ALTARCH := i386
4ARCHDEF := defined __x86_64__
5ALTARCHDEF := defined __i386__
6
7header-y += boot.h
8header-y += bootsetup.h
9header-y += cpufeature.h
10header-y += debugreg.h
11header-y += ldt.h
12header-y += msr.h
13header-y += prctl.h
14header-y += ptrace-abi.h
15header-y += setup.h
16header-y += sigcontext32.h
17header-y += ucontext.h
18header-y += vsyscall32.h
19
20unifdef-y += mce.h
21unifdef-y += mtrr.h
22unifdef-y += vsyscall.h
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index 2c95a319c0..ed59aa4c6f 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 0000000000..e4041f4fa4
--- /dev/null
+++ b/include/asm-x86_64/alternative-asm.i
@@ -0,0 +1,14 @@
1#include <linux/config.h>
2
3#ifdef CONFIG_SMP
4 .macro LOCK_PREFIX
51: lock
6 .section .smp_locks,"a"
7 .align 8
8 .quad 1b
9 .previous
10 .endm
11#else
12 .macro LOCK_PREFIX
13 .endm
14#endif
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h
new file mode 100644
index 0000000000..a584826cc5
--- /dev/null
+++ b/include/asm-x86_64/alternative.h
@@ -0,0 +1,136 @@
1#ifndef _X86_64_ALTERNATIVE_H
2#define _X86_64_ALTERNATIVE_H
3
4#ifdef __KERNEL__
5
6#include <linux/types.h>
7#include <asm/cpufeature.h>
8
9struct alt_instr {
10 u8 *instr; /* original instruction */
11 u8 *replacement;
12 u8 cpuid; /* cpuid bit set for replacement */
13 u8 instrlen; /* length of original instruction */
14 u8 replacementlen; /* length of new instruction, <= instrlen */
15 u8 pad[5];
16};
17
18extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
19
20struct module;
21
22#ifdef CONFIG_SMP
23extern void alternatives_smp_module_add(struct module *mod, char *name,
24 void *locks, void *locks_end,
25 void *text, void *text_end);
26extern void alternatives_smp_module_del(struct module *mod);
27extern void alternatives_smp_switch(int smp);
28#else
29static inline void alternatives_smp_module_add(struct module *mod, char *name,
30 void *locks, void *locks_end,
31 void *text, void *text_end) {}
32static inline void alternatives_smp_module_del(struct module *mod) {}
33static inline void alternatives_smp_switch(int smp) {}
34#endif
35
36#endif
37
38/*
39 * Alternative instructions for different CPU types or capabilities.
40 *
41 * This allows to use optimized instructions even on generic binary
42 * kernels.
43 *
44 * length of oldinstr must be longer or equal the length of newinstr
45 * It can be padded with nops as needed.
46 *
47 * For non barrier like inlines please define new variants
48 * without volatile and memory clobber.
49 */
50#define alternative(oldinstr, newinstr, feature) \
51 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
52 ".section .altinstructions,\"a\"\n" \
53 " .align 8\n" \
54 " .quad 661b\n" /* label */ \
55 " .quad 663f\n" /* new instruction */ \
56 " .byte %c0\n" /* feature bit */ \
57 " .byte 662b-661b\n" /* sourcelen */ \
58 " .byte 664f-663f\n" /* replacementlen */ \
59 ".previous\n" \
60 ".section .altinstr_replacement,\"ax\"\n" \
61 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
62 ".previous" :: "i" (feature) : "memory")
63
64/*
65 * Alternative inline assembly with input.
66 *
67 * Pecularities:
68 * No memory clobber here.
69 * Argument numbers start with 1.
70 * Best is to use constraints that are fixed size (like (%1) ... "r")
71 * If you use variable sized constraints like "m" or "g" in the
72 * replacement make sure to pad to the worst case length.
73 */
74#define alternative_input(oldinstr, newinstr, feature, input...) \
75 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
76 ".section .altinstructions,\"a\"\n" \
77 " .align 8\n" \
78 " .quad 661b\n" /* label */ \
79 " .quad 663f\n" /* new instruction */ \
80 " .byte %c0\n" /* feature bit */ \
81 " .byte 662b-661b\n" /* sourcelen */ \
82 " .byte 664f-663f\n" /* replacementlen */ \
83 ".previous\n" \
84 ".section .altinstr_replacement,\"ax\"\n" \
85 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
86 ".previous" :: "i" (feature), ##input)
87
88/* Like alternative_input, but with a single output argument */
89#define alternative_io(oldinstr, newinstr, feature, output, input...) \
90 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
91 ".section .altinstructions,\"a\"\n" \
92 " .align 8\n" \
93 " .quad 661b\n" /* label */ \
94 " .quad 663f\n" /* new instruction */ \
95 " .byte %c[feat]\n" /* feature bit */ \
96 " .byte 662b-661b\n" /* sourcelen */ \
97 " .byte 664f-663f\n" /* replacementlen */ \
98 ".previous\n" \
99 ".section .altinstr_replacement,\"ax\"\n" \
100 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
101 ".previous" : output : [feat] "i" (feature), ##input)
102
103/*
104 * Alternative inline assembly for SMP.
105 *
106 * The LOCK_PREFIX macro defined here replaces the LOCK and
107 * LOCK_PREFIX macros used everywhere in the source tree.
108 *
109 * SMP alternatives use the same data structures as the other
110 * alternatives and the X86_FEATURE_UP flag to indicate the case of a
111 * UP system running a SMP kernel. The existing apply_alternatives()
112 * works fine for patching a SMP kernel for UP.
113 *
114 * The SMP alternative tables can be kept after boot and contain both
115 * UP and SMP versions of the instructions to allow switching back to
116 * SMP at runtime, when hotplugging in a new CPU, which is especially
117 * useful in virtualized environments.
118 *
119 * The very common lock prefix is handled as special case in a
120 * separate table which is a pure address list without replacement ptr
121 * and size information. That keeps the table sizes small.
122 */
123
124#ifdef CONFIG_SMP
125#define LOCK_PREFIX \
126 ".section .smp_locks,\"a\"\n" \
127 " .align 8\n" \
128 " .quad 661f\n" /* address */ \
129 ".previous\n" \
130 "661:\n\tlock; "
131
132#else /* ! CONFIG_SMP */
133#define LOCK_PREFIX ""
134#endif
135
136#endif /* _X86_64_ALTERNATIVE_H */
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index a731be2204..9e66d32330 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/*
@@ -49,7 +49,8 @@ static __inline unsigned int apic_read(unsigned long reg)
49 49
50static __inline__ void apic_wait_icr_idle(void) 50static __inline__ void apic_wait_icr_idle(void)
51{ 51{
52 while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ); 52 while (apic_read( APIC_ICR ) & APIC_ICR_BUSY)
53 cpu_relax();
53} 54}
54 55
55static inline void ack_APIC_irq(void) 56static inline void ack_APIC_irq(void)
@@ -79,30 +80,20 @@ extern void init_apic_mappings (void);
79extern void smp_local_timer_interrupt (struct pt_regs * regs); 80extern void smp_local_timer_interrupt (struct pt_regs * regs);
80extern void setup_boot_APIC_clock (void); 81extern void setup_boot_APIC_clock (void);
81extern void setup_secondary_APIC_clock (void); 82extern void setup_secondary_APIC_clock (void);
82extern void setup_apic_nmi_watchdog (void);
83extern int reserve_lapic_nmi(void);
84extern void release_lapic_nmi(void);
85extern void disable_timer_nmi_watchdog(void);
86extern void enable_timer_nmi_watchdog(void);
87extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
88extern int APIC_init_uniprocessor (void); 83extern int APIC_init_uniprocessor (void);
89extern void disable_APIC_timer(void); 84extern void disable_APIC_timer(void);
90extern void enable_APIC_timer(void); 85extern void enable_APIC_timer(void);
91extern void clustered_apic_check(void); 86extern void clustered_apic_check(void);
92 87
93extern void nmi_watchdog_default(void); 88extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
94extern int setup_nmi_watchdog(char *); 89 unsigned char msg_type, unsigned char mask);
95
96extern unsigned int nmi_watchdog;
97#define NMI_DEFAULT -1
98#define NMI_NONE 0
99#define NMI_IO_APIC 1
100#define NMI_LOCAL_APIC 2
101#define NMI_INVALID 3
102 90
103extern int disable_timer_pin_1; 91#define K8_APIC_EXT_LVT_BASE 0x500
104 92#define K8_APIC_EXT_INT_MSG_FIX 0x0
105extern void setup_threshold_lvt(unsigned long lvt_off); 93#define K8_APIC_EXT_INT_MSG_SMI 0x2
94#define K8_APIC_EXT_INT_MSG_NMI 0x4
95#define K8_APIC_EXT_INT_MSG_EXT 0x7
96#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0
106 97
107void smp_send_timer_broadcast_ipi(void); 98void smp_send_timer_broadcast_ipi(void);
108void switch_APIC_timer_to_ipi(void *cpumask); 99void switch_APIC_timer_to_ipi(void *cpumask);
@@ -110,8 +101,6 @@ void switch_ipi_to_APIC_timer(void *cpumask);
110 101
111#define ARCH_APICTIMER_STOPS_ON_C3 1 102#define ARCH_APICTIMER_STOPS_ON_C3 1
112 103
113#endif /* CONFIG_X86_LOCAL_APIC */
114
115extern unsigned boot_cpu_id; 104extern unsigned boot_cpu_id;
116 105
117#endif /* __ASM_APIC_H */ 106#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index bd3fa67ed8..007e88d6d4 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -1,7 +1,7 @@
1#ifndef __ARCH_X86_64_ATOMIC__ 1#ifndef __ARCH_X86_64_ATOMIC__
2#define __ARCH_X86_64_ATOMIC__ 2#define __ARCH_X86_64_ATOMIC__
3 3
4#include <asm/types.h> 4#include <asm/alternative.h>
5 5
6/* atomic_t should be 32 bit signed type */ 6/* atomic_t should be 32 bit signed type */
7 7
@@ -52,7 +52,7 @@ typedef struct { volatile int counter; } atomic_t;
52static __inline__ void atomic_add(int i, atomic_t *v) 52static __inline__ void atomic_add(int i, atomic_t *v)
53{ 53{
54 __asm__ __volatile__( 54 __asm__ __volatile__(
55 LOCK "addl %1,%0" 55 LOCK_PREFIX "addl %1,%0"
56 :"=m" (v->counter) 56 :"=m" (v->counter)
57 :"ir" (i), "m" (v->counter)); 57 :"ir" (i), "m" (v->counter));
58} 58}
@@ -67,7 +67,7 @@ static __inline__ void atomic_add(int i, atomic_t *v)
67static __inline__ void atomic_sub(int i, atomic_t *v) 67static __inline__ void atomic_sub(int i, atomic_t *v)
68{ 68{
69 __asm__ __volatile__( 69 __asm__ __volatile__(
70 LOCK "subl %1,%0" 70 LOCK_PREFIX "subl %1,%0"
71 :"=m" (v->counter) 71 :"=m" (v->counter)
72 :"ir" (i), "m" (v->counter)); 72 :"ir" (i), "m" (v->counter));
73} 73}
@@ -86,7 +86,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
86 unsigned char c; 86 unsigned char c;
87 87
88 __asm__ __volatile__( 88 __asm__ __volatile__(
89 LOCK "subl %2,%0; sete %1" 89 LOCK_PREFIX "subl %2,%0; sete %1"
90 :"=m" (v->counter), "=qm" (c) 90 :"=m" (v->counter), "=qm" (c)
91 :"ir" (i), "m" (v->counter) : "memory"); 91 :"ir" (i), "m" (v->counter) : "memory");
92 return c; 92 return c;
@@ -101,7 +101,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
101static __inline__ void atomic_inc(atomic_t *v) 101static __inline__ void atomic_inc(atomic_t *v)
102{ 102{
103 __asm__ __volatile__( 103 __asm__ __volatile__(
104 LOCK "incl %0" 104 LOCK_PREFIX "incl %0"
105 :"=m" (v->counter) 105 :"=m" (v->counter)
106 :"m" (v->counter)); 106 :"m" (v->counter));
107} 107}
@@ -115,7 +115,7 @@ static __inline__ void atomic_inc(atomic_t *v)
115static __inline__ void atomic_dec(atomic_t *v) 115static __inline__ void atomic_dec(atomic_t *v)
116{ 116{
117 __asm__ __volatile__( 117 __asm__ __volatile__(
118 LOCK "decl %0" 118 LOCK_PREFIX "decl %0"
119 :"=m" (v->counter) 119 :"=m" (v->counter)
120 :"m" (v->counter)); 120 :"m" (v->counter));
121} 121}
@@ -133,7 +133,7 @@ static __inline__ int atomic_dec_and_test(atomic_t *v)
133 unsigned char c; 133 unsigned char c;
134 134
135 __asm__ __volatile__( 135 __asm__ __volatile__(
136 LOCK "decl %0; sete %1" 136 LOCK_PREFIX "decl %0; sete %1"
137 :"=m" (v->counter), "=qm" (c) 137 :"=m" (v->counter), "=qm" (c)
138 :"m" (v->counter) : "memory"); 138 :"m" (v->counter) : "memory");
139 return c != 0; 139 return c != 0;
@@ -152,7 +152,7 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)
152 unsigned char c; 152 unsigned char c;
153 153
154 __asm__ __volatile__( 154 __asm__ __volatile__(
155 LOCK "incl %0; sete %1" 155 LOCK_PREFIX "incl %0; sete %1"
156 :"=m" (v->counter), "=qm" (c) 156 :"=m" (v->counter), "=qm" (c)
157 :"m" (v->counter) : "memory"); 157 :"m" (v->counter) : "memory");
158 return c != 0; 158 return c != 0;
@@ -172,7 +172,7 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)
172 unsigned char c; 172 unsigned char c;
173 173
174 __asm__ __volatile__( 174 __asm__ __volatile__(
175 LOCK "addl %2,%0; sets %1" 175 LOCK_PREFIX "addl %2,%0; sets %1"
176 :"=m" (v->counter), "=qm" (c) 176 :"=m" (v->counter), "=qm" (c)
177 :"ir" (i), "m" (v->counter) : "memory"); 177 :"ir" (i), "m" (v->counter) : "memory");
178 return c; 178 return c;
@@ -189,7 +189,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
189{ 189{
190 int __i = i; 190 int __i = i;
191 __asm__ __volatile__( 191 __asm__ __volatile__(
192 LOCK "xaddl %0, %1;" 192 LOCK_PREFIX "xaddl %0, %1;"
193 :"=r"(i) 193 :"=r"(i)
194 :"m"(v->counter), "0"(i)); 194 :"m"(v->counter), "0"(i));
195 return i + __i; 195 return i + __i;
@@ -237,7 +237,7 @@ typedef struct { volatile long counter; } atomic64_t;
237static __inline__ void atomic64_add(long i, atomic64_t *v) 237static __inline__ void atomic64_add(long i, atomic64_t *v)
238{ 238{
239 __asm__ __volatile__( 239 __asm__ __volatile__(
240 LOCK "addq %1,%0" 240 LOCK_PREFIX "addq %1,%0"
241 :"=m" (v->counter) 241 :"=m" (v->counter)
242 :"ir" (i), "m" (v->counter)); 242 :"ir" (i), "m" (v->counter));
243} 243}
@@ -252,7 +252,7 @@ static __inline__ void atomic64_add(long i, atomic64_t *v)
252static __inline__ void atomic64_sub(long i, atomic64_t *v) 252static __inline__ void atomic64_sub(long i, atomic64_t *v)
253{ 253{
254 __asm__ __volatile__( 254 __asm__ __volatile__(
255 LOCK "subq %1,%0" 255 LOCK_PREFIX "subq %1,%0"
256 :"=m" (v->counter) 256 :"=m" (v->counter)
257 :"ir" (i), "m" (v->counter)); 257 :"ir" (i), "m" (v->counter));
258} 258}
@@ -271,7 +271,7 @@ static __inline__ int atomic64_sub_and_test(long i, atomic64_t *v)
271 unsigned char c; 271 unsigned char c;
272 272
273 __asm__ __volatile__( 273 __asm__ __volatile__(
274 LOCK "subq %2,%0; sete %1" 274 LOCK_PREFIX "subq %2,%0; sete %1"
275 :"=m" (v->counter), "=qm" (c) 275 :"=m" (v->counter), "=qm" (c)
276 :"ir" (i), "m" (v->counter) : "memory"); 276 :"ir" (i), "m" (v->counter) : "memory");
277 return c; 277 return c;
@@ -286,7 +286,7 @@ static __inline__ int atomic64_sub_and_test(long i, atomic64_t *v)
286static __inline__ void atomic64_inc(atomic64_t *v) 286static __inline__ void atomic64_inc(atomic64_t *v)
287{ 287{
288 __asm__ __volatile__( 288 __asm__ __volatile__(
289 LOCK "incq %0" 289 LOCK_PREFIX "incq %0"
290 :"=m" (v->counter) 290 :"=m" (v->counter)
291 :"m" (v->counter)); 291 :"m" (v->counter));
292} 292}
@@ -300,7 +300,7 @@ static __inline__ void atomic64_inc(atomic64_t *v)
300static __inline__ void atomic64_dec(atomic64_t *v) 300static __inline__ void atomic64_dec(atomic64_t *v)
301{ 301{
302 __asm__ __volatile__( 302 __asm__ __volatile__(
303 LOCK "decq %0" 303 LOCK_PREFIX "decq %0"
304 :"=m" (v->counter) 304 :"=m" (v->counter)
305 :"m" (v->counter)); 305 :"m" (v->counter));
306} 306}
@@ -318,7 +318,7 @@ static __inline__ int atomic64_dec_and_test(atomic64_t *v)
318 unsigned char c; 318 unsigned char c;
319 319
320 __asm__ __volatile__( 320 __asm__ __volatile__(
321 LOCK "decq %0; sete %1" 321 LOCK_PREFIX "decq %0; sete %1"
322 :"=m" (v->counter), "=qm" (c) 322 :"=m" (v->counter), "=qm" (c)
323 :"m" (v->counter) : "memory"); 323 :"m" (v->counter) : "memory");
324 return c != 0; 324 return c != 0;
@@ -337,7 +337,7 @@ static __inline__ int atomic64_inc_and_test(atomic64_t *v)
337 unsigned char c; 337 unsigned char c;
338 338
339 __asm__ __volatile__( 339 __asm__ __volatile__(
340 LOCK "incq %0; sete %1" 340 LOCK_PREFIX "incq %0; sete %1"
341 :"=m" (v->counter), "=qm" (c) 341 :"=m" (v->counter), "=qm" (c)
342 :"m" (v->counter) : "memory"); 342 :"m" (v->counter) : "memory");
343 return c != 0; 343 return c != 0;
@@ -357,7 +357,7 @@ static __inline__ int atomic64_add_negative(long i, atomic64_t *v)
357 unsigned char c; 357 unsigned char c;
358 358
359 __asm__ __volatile__( 359 __asm__ __volatile__(
360 LOCK "addq %2,%0; sets %1" 360 LOCK_PREFIX "addq %2,%0; sets %1"
361 :"=m" (v->counter), "=qm" (c) 361 :"=m" (v->counter), "=qm" (c)
362 :"ir" (i), "m" (v->counter) : "memory"); 362 :"ir" (i), "m" (v->counter) : "memory");
363 return c; 363 return c;
@@ -374,7 +374,7 @@ static __inline__ long atomic64_add_return(long i, atomic64_t *v)
374{ 374{
375 long __i = i; 375 long __i = i;
376 __asm__ __volatile__( 376 __asm__ __volatile__(
377 LOCK "xaddq %0, %1;" 377 LOCK_PREFIX "xaddq %0, %1;"
378 :"=r"(i) 378 :"=r"(i)
379 :"m"(v->counter), "0"(i)); 379 :"m"(v->counter), "0"(i));
380 return i + __i; 380 return i + __i;
@@ -418,11 +418,11 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t *v)
418 418
419/* These are x86-specific, used by some header files */ 419/* These are x86-specific, used by some header files */
420#define atomic_clear_mask(mask, addr) \ 420#define atomic_clear_mask(mask, addr) \
421__asm__ __volatile__(LOCK "andl %0,%1" \ 421__asm__ __volatile__(LOCK_PREFIX "andl %0,%1" \
422: : "r" (~(mask)),"m" (*addr) : "memory") 422: : "r" (~(mask)),"m" (*addr) : "memory")
423 423
424#define atomic_set_mask(mask, addr) \ 424#define atomic_set_mask(mask, addr) \
425__asm__ __volatile__(LOCK "orl %0,%1" \ 425__asm__ __volatile__(LOCK_PREFIX "orl %0,%1" \
426: : "r" ((unsigned)mask),"m" (*(addr)) : "memory") 426: : "r" ((unsigned)mask),"m" (*(addr)) : "memory")
427 427
428/* Atomic operations are already serializing on x86 */ 428/* Atomic operations are already serializing on x86 */
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index e9bf933d25..5b535eaf53 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -5,12 +5,7 @@
5 * Copyright 1992, Linus Torvalds. 5 * Copyright 1992, Linus Torvalds.
6 */ 6 */
7 7
8 8#include <asm/alternative.h>
9#ifdef CONFIG_SMP
10#define LOCK_PREFIX "lock ; "
11#else
12#define LOCK_PREFIX ""
13#endif
14 9
15#define ADDR (*(volatile long *) addr) 10#define ADDR (*(volatile long *) addr)
16 11
@@ -404,6 +399,8 @@ static __inline__ int fls(int x)
404 return r+1; 399 return r+1;
405} 400}
406 401
402#define ARCH_HAS_FAST_MULTIPLIER 1
403
407#include <asm-generic/bitops/hweight.h> 404#include <asm-generic/bitops/hweight.h>
408 405
409#endif /* __KERNEL__ */ 406#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h
new file mode 100644
index 0000000000..6b93f5a3a5
--- /dev/null
+++ b/include/asm-x86_64/calgary.h
@@ -0,0 +1,62 @@
1/*
2 * Derived from include/asm-powerpc/iommu.h
3 *
4 * Copyright (C) IBM Corporation, 2006
5 *
6 * Author: Jon Mason <jdmason@us.ibm.com>
7 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef _ASM_X86_64_CALGARY_H
25#define _ASM_X86_64_CALGARY_H
26
27#include <linux/spinlock.h>
28#include <linux/device.h>
29#include <linux/dma-mapping.h>
30#include <asm/types.h>
31
32struct iommu_table {
33 unsigned long it_base; /* mapped address of tce table */
34 unsigned long it_hint; /* Hint for next alloc */
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;
39 spinlock_t it_lock; /* Protects it_map */
40 unsigned int it_size; /* Size of iommu table in entries */
41 unsigned char it_busno; /* Bus number this table belongs to */
42};
43
44#define TCE_TABLE_SIZE_UNSPECIFIED ~0
45#define TCE_TABLE_SIZE_64K 0
46#define TCE_TABLE_SIZE_128K 1
47#define TCE_TABLE_SIZE_256K 2
48#define TCE_TABLE_SIZE_512K 3
49#define TCE_TABLE_SIZE_1M 4
50#define TCE_TABLE_SIZE_2M 5
51#define TCE_TABLE_SIZE_4M 6
52#define TCE_TABLE_SIZE_8M 7
53
54#ifdef CONFIG_CALGARY_IOMMU
55extern int calgary_iommu_init(void);
56extern void detect_calgary(void);
57#else
58static inline int calgary_iommu_init(void) { return 1; }
59static inline void detect_calgary(void) { return; }
60#endif
61
62#endif /* _ASM_X86_64_CALGARY_H */
diff --git a/include/asm-x86_64/cpufeature.h b/include/asm-x86_64/cpufeature.h
index 662964b74e..ee792faaca 100644
--- a/include/asm-x86_64/cpufeature.h
+++ b/include/asm-x86_64/cpufeature.h
@@ -46,6 +46,7 @@
46#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */ 46#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */
47#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ 47#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
48#define X86_FEATURE_FXSR_OPT (1*32+25) /* FXSR optimizations */ 48#define X86_FEATURE_FXSR_OPT (1*32+25) /* FXSR optimizations */
49#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
49#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ 50#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
50#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ 51#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
51#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ 52#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */
@@ -65,6 +66,8 @@
65#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */ 66#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */
66#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */ 67#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */
67#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */ 68#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */
69#define X86_FEATURE_UP (3*32+8) /* SMP kernel running on UP */
70#define X86_FEATURE_ARCH_PERFMON (3*32+9) /* Intel Architectural PerfMon */
68 71
69/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 72/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
70#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 73#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index 498f66df36..10174b110a 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -72,6 +72,7 @@ static inline dma_addr_t
72dma_map_single(struct device *hwdev, void *ptr, size_t size, 72dma_map_single(struct device *hwdev, void *ptr, size_t size,
73 int direction) 73 int direction)
74{ 74{
75 BUG_ON(!valid_dma_direction(direction));
75 return dma_ops->map_single(hwdev, ptr, size, direction); 76 return dma_ops->map_single(hwdev, ptr, size, direction);
76} 77}
77 78
@@ -79,6 +80,7 @@ static inline void
79dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size, 80dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
80 int direction) 81 int direction)
81{ 82{
83 BUG_ON(!valid_dma_direction(direction));
82 dma_ops->unmap_single(dev, addr, size, direction); 84 dma_ops->unmap_single(dev, addr, size, direction);
83} 85}
84 86
@@ -91,6 +93,7 @@ static inline void
91dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle, 93dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
92 size_t size, int direction) 94 size_t size, int direction)
93{ 95{
96 BUG_ON(!valid_dma_direction(direction));
94 if (dma_ops->sync_single_for_cpu) 97 if (dma_ops->sync_single_for_cpu)
95 dma_ops->sync_single_for_cpu(hwdev, dma_handle, size, 98 dma_ops->sync_single_for_cpu(hwdev, dma_handle, size,
96 direction); 99 direction);
@@ -101,6 +104,7 @@ static inline void
101dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle, 104dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
102 size_t size, int direction) 105 size_t size, int direction)
103{ 106{
107 BUG_ON(!valid_dma_direction(direction));
104 if (dma_ops->sync_single_for_device) 108 if (dma_ops->sync_single_for_device)
105 dma_ops->sync_single_for_device(hwdev, dma_handle, size, 109 dma_ops->sync_single_for_device(hwdev, dma_handle, size,
106 direction); 110 direction);
@@ -111,6 +115,7 @@ static inline void
111dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle, 115dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
112 unsigned long offset, size_t size, int direction) 116 unsigned long offset, size_t size, int direction)
113{ 117{
118 BUG_ON(!valid_dma_direction(direction));
114 if (dma_ops->sync_single_range_for_cpu) { 119 if (dma_ops->sync_single_range_for_cpu) {
115 dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset, size, direction); 120 dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset, size, direction);
116 } 121 }
@@ -122,6 +127,7 @@ static inline void
122dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle, 127dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
123 unsigned long offset, size_t size, int direction) 128 unsigned long offset, size_t size, int direction)
124{ 129{
130 BUG_ON(!valid_dma_direction(direction));
125 if (dma_ops->sync_single_range_for_device) 131 if (dma_ops->sync_single_range_for_device)
126 dma_ops->sync_single_range_for_device(hwdev, dma_handle, 132 dma_ops->sync_single_range_for_device(hwdev, dma_handle,
127 offset, size, direction); 133 offset, size, direction);
@@ -133,6 +139,7 @@ static inline void
133dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, 139dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
134 int nelems, int direction) 140 int nelems, int direction)
135{ 141{
142 BUG_ON(!valid_dma_direction(direction));
136 if (dma_ops->sync_sg_for_cpu) 143 if (dma_ops->sync_sg_for_cpu)
137 dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction); 144 dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction);
138 flush_write_buffers(); 145 flush_write_buffers();
@@ -142,6 +149,7 @@ static inline void
142dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 149dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
143 int nelems, int direction) 150 int nelems, int direction)
144{ 151{
152 BUG_ON(!valid_dma_direction(direction));
145 if (dma_ops->sync_sg_for_device) { 153 if (dma_ops->sync_sg_for_device) {
146 dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction); 154 dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction);
147 } 155 }
@@ -152,6 +160,7 @@ dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
152static inline int 160static inline int
153dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction) 161dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction)
154{ 162{
163 BUG_ON(!valid_dma_direction(direction));
155 return dma_ops->map_sg(hwdev, sg, nents, direction); 164 return dma_ops->map_sg(hwdev, sg, nents, direction);
156} 165}
157 166
@@ -159,6 +168,7 @@ static inline void
159dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, 168dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
160 int direction) 169 int direction)
161{ 170{
171 BUG_ON(!valid_dma_direction(direction));
162 dma_ops->unmap_sg(hwdev, sg, nents, direction); 172 dma_ops->unmap_sg(hwdev, sg, nents, direction);
163} 173}
164 174
diff --git a/include/asm-x86_64/dma.h b/include/asm-x86_64/dma.h
index c556208d3d..a37c16f062 100644
--- a/include/asm-x86_64/dma.h
+++ b/include/asm-x86_64/dma.h
@@ -1,4 +1,4 @@
1/* $Id: dma.h,v 1.1.1.1 2001/04/19 20:00:38 ak Exp $ 1/*
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels. 2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992. 3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen 4 * High DMA channel support & info by Hannu Savolainen
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h
index 0744db7776..eedc08526b 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 670a3388e7..fa20867741 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 */
@@ -46,17 +42,16 @@ extern void setup_memory_region(void);
46extern void contig_e820_setup(void); 42extern void contig_e820_setup(void);
47extern unsigned long e820_end_of_ram(void); 43extern unsigned long e820_end_of_ram(void);
48extern void e820_reserve_resources(void); 44extern void e820_reserve_resources(void);
45extern void e820_mark_nosave_regions(void);
49extern void e820_print_map(char *who); 46extern void e820_print_map(char *who);
50extern 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);
51extern 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);
52 49
53extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
54extern void e820_setup_gap(void); 50extern void e820_setup_gap(void);
55extern unsigned long e820_hole_size(unsigned long start_pfn, 51extern void e820_register_active_regions(int nid,
56 unsigned long end_pfn); 52 unsigned long start_pfn, unsigned long end_pfn);
57 53
58extern void __init parse_memopt(char *p, char **end); 54extern void finish_e820_parsing(void);
59extern void __init parse_memmapopt(char *p, char **end);
60 55
61extern struct e820map e820; 56extern struct e820map e820;
62 57
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index b4f8f4a41a..a406fcb1e9 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -7,8 +7,6 @@
7 7
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <asm/user.h> 9#include <asm/user.h>
10#include <asm/processor.h>
11#include <asm/compat.h>
12 10
13/* x86-64 relocation types */ 11/* x86-64 relocation types */
14#define R_X86_64_NONE 0 /* No reloc */ 12#define R_X86_64_NONE 0 /* No reloc */
@@ -39,18 +37,23 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
39typedef struct user_i387_struct elf_fpregset_t; 37typedef struct user_i387_struct elf_fpregset_t;
40 38
41/* 39/*
42 * This is used to ensure we don't load something for the wrong architecture.
43 */
44#define elf_check_arch(x) \
45 ((x)->e_machine == EM_X86_64)
46
47/*
48 * These are used to set parameters in the core dumps. 40 * These are used to set parameters in the core dumps.
49 */ 41 */
50#define ELF_CLASS ELFCLASS64 42#define ELF_CLASS ELFCLASS64
51#define ELF_DATA ELFDATA2LSB 43#define ELF_DATA ELFDATA2LSB
52#define ELF_ARCH EM_X86_64 44#define ELF_ARCH EM_X86_64
53 45
46#ifdef __KERNEL__
47#include <asm/processor.h>
48#include <asm/compat.h>
49
50/*
51 * This is used to ensure we don't load something for the wrong architecture.
52 */
53#define elf_check_arch(x) \
54 ((x)->e_machine == EM_X86_64)
55
56
54/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx 57/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
55 contains a pointer to a function which might be registered using `atexit'. 58 contains a pointer to a function which might be registered using `atexit'.
56 This provides a mean for the dynamic linker to call DT_FINI functions for 59 This provides a mean for the dynamic linker to call DT_FINI functions for
@@ -141,7 +144,6 @@ typedef struct user_i387_struct elf_fpregset_t;
141/* I'm not sure if we can use '-' here */ 144/* I'm not sure if we can use '-' here */
142#define ELF_PLATFORM ("x86_64") 145#define ELF_PLATFORM ("x86_64")
143 146
144#ifdef __KERNEL__
145extern void set_personality_64bit(void); 147extern void set_personality_64bit(void);
146#define SET_PERSONALITY(ex, ibcs2) set_personality_64bit() 148#define SET_PERSONALITY(ex, ibcs2) set_personality_64bit()
147/* 149/*
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
index 0b4ffbd1a1..1b620db5b9 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/floppy.h b/include/asm-x86_64/floppy.h
index 52825ce689..32ff5d1327 100644
--- a/include/asm-x86_64/floppy.h
+++ b/include/asm-x86_64/floppy.h
@@ -144,13 +144,11 @@ static int vdma_get_dma_residue(unsigned int dummy)
144static int fd_request_irq(void) 144static int fd_request_irq(void)
145{ 145{
146 if(can_use_virtual_dma) 146 if(can_use_virtual_dma)
147 return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, 147 return request_irq(FLOPPY_IRQ, floppy_hardint,
148 "floppy", NULL); 148 IRQF_DISABLED, "floppy", NULL);
149 else 149 else
150 return request_irq(FLOPPY_IRQ, floppy_interrupt, 150 return request_irq(FLOPPY_IRQ, floppy_interrupt,
151 SA_INTERRUPT|SA_SAMPLE_RANDOM, 151 IRQF_DISABLED, "floppy", NULL);
152 "floppy", NULL);
153
154} 152}
155 153
156static unsigned long dma_mem_alloc(unsigned long size) 154static unsigned long dma_mem_alloc(unsigned long size)
diff --git a/include/asm-x86_64/gart-mapping.h b/include/asm-x86_64/gart-mapping.h
deleted file mode 100644
index ada497b0b5..0000000000
--- a/include/asm-x86_64/gart-mapping.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _X8664_GART_MAPPING_H
2#define _X8664_GART_MAPPING_H 1
3
4#include <linux/types.h>
5#include <asm/types.h>
6
7struct device;
8
9extern void*
10gart_alloc_coherent(struct device *dev, size_t size,
11 dma_addr_t *dma_handle, gfp_t gfp);
12
13extern int
14gart_dma_supported(struct device *hwdev, u64 mask);
15
16#endif /* _X8664_GART_MAPPING_H */
diff --git a/include/asm-x86_64/genapic.h b/include/asm-x86_64/genapic.h
index 50b38e7c58..81e7146653 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/hpet.h b/include/asm-x86_64/hpet.h
index 18ff7ee9e7..b39098408b 100644
--- a/include/asm-x86_64/hpet.h
+++ b/include/asm-x86_64/hpet.h
@@ -55,7 +55,7 @@
55 55
56extern int is_hpet_enabled(void); 56extern int is_hpet_enabled(void);
57extern int hpet_rtc_timer_init(void); 57extern int hpet_rtc_timer_init(void);
58extern int oem_force_hpet_timer(void); 58extern int apic_is_clustered_box(void);
59 59
60extern int hpet_use_timer; 60extern int hpet_use_timer;
61 61
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 3de96fd86a..48a4a5364e 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -12,8 +12,6 @@
12 * <tomsoft@informatik.tu-chemnitz.de> 12 * <tomsoft@informatik.tu-chemnitz.de>
13 * 13 *
14 * hacked by Andi Kleen for x86-64. 14 * hacked by Andi Kleen for x86-64.
15 *
16 * $Id: hw_irq.h,v 1.24 2001/09/14 20:55:03 vojtech Exp $
17 */ 15 */
18 16
19#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
@@ -126,18 +124,9 @@ asmlinkage void IRQ_NAME(nr); \
126__asm__( \ 124__asm__( \
127"\n.p2align\n" \ 125"\n.p2align\n" \
128"IRQ" #nr "_interrupt:\n\t" \ 126"IRQ" #nr "_interrupt:\n\t" \
129 "push $" #nr "-256 ; " \ 127 "push $~(" #nr ") ; " \
130 "jmp common_interrupt"); 128 "jmp common_interrupt");
131 129
132#if defined(CONFIG_X86_IO_APIC)
133static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
134 if (IO_APIC_IRQ(i))
135 send_IPI_self(IO_APIC_VECTOR(i));
136}
137#else
138static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
139#endif
140
141#define platform_legacy_irq(irq) ((irq) < 16) 130#define platform_legacy_irq(irq) ((irq) < 16)
142 131
143#endif 132#endif
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
index cba8a3b0cd..0217b74cc9 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/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index b4f4b172b1..5b52ce5073 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -4,317 +4,15 @@
4/* 4/*
5 * This file contains the system call numbers of the ia32 port, 5 * This file contains the system call numbers of the ia32 port,
6 * this is for the kernel only. 6 * this is for the kernel only.
7 * Only add syscalls here where some part of the kernel needs to know
8 * the number. This should be otherwise in sync with asm-i386/unistd.h. -AK
7 */ 9 */
8 10
9#define __NR_ia32_restart_syscall 0 11#define __NR_ia32_restart_syscall 0
10#define __NR_ia32_exit 1 12#define __NR_ia32_exit 1
11#define __NR_ia32_fork 2
12#define __NR_ia32_read 3 13#define __NR_ia32_read 3
13#define __NR_ia32_write 4 14#define __NR_ia32_write 4
14#define __NR_ia32_open 5 15#define __NR_ia32_sigreturn 119
15#define __NR_ia32_close 6
16#define __NR_ia32_waitpid 7
17#define __NR_ia32_creat 8
18#define __NR_ia32_link 9
19#define __NR_ia32_unlink 10
20#define __NR_ia32_execve 11
21#define __NR_ia32_chdir 12
22#define __NR_ia32_time 13
23#define __NR_ia32_mknod 14
24#define __NR_ia32_chmod 15
25#define __NR_ia32_lchown 16
26#define __NR_ia32_break 17
27#define __NR_ia32_oldstat 18
28#define __NR_ia32_lseek 19
29#define __NR_ia32_getpid 20
30#define __NR_ia32_mount 21
31#define __NR_ia32_umount 22
32#define __NR_ia32_setuid 23
33#define __NR_ia32_getuid 24
34#define __NR_ia32_stime 25
35#define __NR_ia32_ptrace 26
36#define __NR_ia32_alarm 27
37#define __NR_ia32_oldfstat 28
38#define __NR_ia32_pause 29
39#define __NR_ia32_utime 30
40#define __NR_ia32_stty 31
41#define __NR_ia32_gtty 32
42#define __NR_ia32_access 33
43#define __NR_ia32_nice 34
44#define __NR_ia32_ftime 35
45#define __NR_ia32_sync 36
46#define __NR_ia32_kill 37
47#define __NR_ia32_rename 38
48#define __NR_ia32_mkdir 39
49#define __NR_ia32_rmdir 40
50#define __NR_ia32_dup 41
51#define __NR_ia32_pipe 42
52#define __NR_ia32_times 43
53#define __NR_ia32_prof 44
54#define __NR_ia32_brk 45
55#define __NR_ia32_setgid 46
56#define __NR_ia32_getgid 47
57#define __NR_ia32_signal 48
58#define __NR_ia32_geteuid 49
59#define __NR_ia32_getegid 50
60#define __NR_ia32_acct 51
61#define __NR_ia32_umount2 52
62#define __NR_ia32_lock 53
63#define __NR_ia32_ioctl 54
64#define __NR_ia32_fcntl 55
65#define __NR_ia32_mpx 56
66#define __NR_ia32_setpgid 57
67#define __NR_ia32_ulimit 58
68#define __NR_ia32_oldolduname 59
69#define __NR_ia32_umask 60
70#define __NR_ia32_chroot 61
71#define __NR_ia32_ustat 62
72#define __NR_ia32_dup2 63
73#define __NR_ia32_getppid 64
74#define __NR_ia32_getpgrp 65
75#define __NR_ia32_setsid 66
76#define __NR_ia32_sigaction 67
77#define __NR_ia32_sgetmask 68
78#define __NR_ia32_ssetmask 69
79#define __NR_ia32_setreuid 70
80#define __NR_ia32_setregid 71
81#define __NR_ia32_sigsuspend 72
82#define __NR_ia32_sigpending 73
83#define __NR_ia32_sethostname 74
84#define __NR_ia32_setrlimit 75
85#define __NR_ia32_getrlimit 76 /* Back compatible 2Gig limited rlimit */
86#define __NR_ia32_getrusage 77
87#define __NR_ia32_gettimeofday 78
88#define __NR_ia32_settimeofday 79
89#define __NR_ia32_getgroups 80
90#define __NR_ia32_setgroups 81
91#define __NR_ia32_select 82
92#define __NR_ia32_symlink 83
93#define __NR_ia32_oldlstat 84
94#define __NR_ia32_readlink 85
95#define __NR_ia32_uselib 86
96#define __NR_ia32_swapon 87
97#define __NR_ia32_reboot 88
98#define __NR_ia32_readdir 89
99#define __NR_ia32_mmap 90
100#define __NR_ia32_munmap 91
101#define __NR_ia32_truncate 92
102#define __NR_ia32_ftruncate 93
103#define __NR_ia32_fchmod 94
104#define __NR_ia32_fchown 95
105#define __NR_ia32_getpriority 96
106#define __NR_ia32_setpriority 97
107#define __NR_ia32_profil 98
108#define __NR_ia32_statfs 99
109#define __NR_ia32_fstatfs 100
110#define __NR_ia32_ioperm 101
111#define __NR_ia32_socketcall 102
112#define __NR_ia32_syslog 103
113#define __NR_ia32_setitimer 104
114#define __NR_ia32_getitimer 105
115#define __NR_ia32_stat 106
116#define __NR_ia32_lstat 107
117#define __NR_ia32_fstat 108
118#define __NR_ia32_olduname 109
119#define __NR_ia32_iopl 110
120#define __NR_ia32_vhangup 111
121#define __NR_ia32_idle 112
122#define __NR_ia32_vm86old 113
123#define __NR_ia32_wait4 114
124#define __NR_ia32_swapoff 115
125#define __NR_ia32_sysinfo 116
126#define __NR_ia32_ipc 117
127#define __NR_ia32_fsync 118
128#define __NR_ia32_sigreturn 119
129#define __NR_ia32_clone 120
130#define __NR_ia32_setdomainname 121
131#define __NR_ia32_uname 122
132#define __NR_ia32_modify_ldt 123
133#define __NR_ia32_adjtimex 124
134#define __NR_ia32_mprotect 125
135#define __NR_ia32_sigprocmask 126
136#define __NR_ia32_create_module 127
137#define __NR_ia32_init_module 128
138#define __NR_ia32_delete_module 129
139#define __NR_ia32_get_kernel_syms 130
140#define __NR_ia32_quotactl 131
141#define __NR_ia32_getpgid 132
142#define __NR_ia32_fchdir 133
143#define __NR_ia32_bdflush 134
144#define __NR_ia32_sysfs 135
145#define __NR_ia32_personality 136
146#define __NR_ia32_afs_syscall 137 /* Syscall for Andrew File System */
147#define __NR_ia32_setfsuid 138
148#define __NR_ia32_setfsgid 139
149#define __NR_ia32__llseek 140
150#define __NR_ia32_getdents 141
151#define __NR_ia32__newselect 142
152#define __NR_ia32_flock 143
153#define __NR_ia32_msync 144
154#define __NR_ia32_readv 145
155#define __NR_ia32_writev 146
156#define __NR_ia32_getsid 147
157#define __NR_ia32_fdatasync 148
158#define __NR_ia32__sysctl 149
159#define __NR_ia32_mlock 150
160#define __NR_ia32_munlock 151
161#define __NR_ia32_mlockall 152
162#define __NR_ia32_munlockall 153
163#define __NR_ia32_sched_setparam 154
164#define __NR_ia32_sched_getparam 155
165#define __NR_ia32_sched_setscheduler 156
166#define __NR_ia32_sched_getscheduler 157
167#define __NR_ia32_sched_yield 158
168#define __NR_ia32_sched_get_priority_max 159
169#define __NR_ia32_sched_get_priority_min 160
170#define __NR_ia32_sched_rr_get_interval 161
171#define __NR_ia32_nanosleep 162
172#define __NR_ia32_mremap 163
173#define __NR_ia32_setresuid 164
174#define __NR_ia32_getresuid 165
175#define __NR_ia32_vm86 166
176#define __NR_ia32_query_module 167
177#define __NR_ia32_poll 168
178#define __NR_ia32_nfsservctl 169
179#define __NR_ia32_setresgid 170
180#define __NR_ia32_getresgid 171
181#define __NR_ia32_prctl 172
182#define __NR_ia32_rt_sigreturn 173 16#define __NR_ia32_rt_sigreturn 173
183#define __NR_ia32_rt_sigaction 174
184#define __NR_ia32_rt_sigprocmask 175
185#define __NR_ia32_rt_sigpending 176
186#define __NR_ia32_rt_sigtimedwait 177
187#define __NR_ia32_rt_sigqueueinfo 178
188#define __NR_ia32_rt_sigsuspend 179
189#define __NR_ia32_pread 180
190#define __NR_ia32_pwrite 181
191#define __NR_ia32_chown 182
192#define __NR_ia32_getcwd 183
193#define __NR_ia32_capget 184
194#define __NR_ia32_capset 185
195#define __NR_ia32_sigaltstack 186
196#define __NR_ia32_sendfile 187
197#define __NR_ia32_getpmsg 188 /* some people actually want streams */
198#define __NR_ia32_putpmsg 189 /* some people actually want streams */
199#define __NR_ia32_vfork 190
200#define __NR_ia32_ugetrlimit 191 /* SuS compliant getrlimit */
201#define __NR_ia32_mmap2 192
202#define __NR_ia32_truncate64 193
203#define __NR_ia32_ftruncate64 194
204#define __NR_ia32_stat64 195
205#define __NR_ia32_lstat64 196
206#define __NR_ia32_fstat64 197
207#define __NR_ia32_lchown32 198
208#define __NR_ia32_getuid32 199
209#define __NR_ia32_getgid32 200
210#define __NR_ia32_geteuid32 201
211#define __NR_ia32_getegid32 202
212#define __NR_ia32_setreuid32 203
213#define __NR_ia32_setregid32 204
214#define __NR_ia32_getgroups32 205
215#define __NR_ia32_setgroups32 206
216#define __NR_ia32_fchown32 207
217#define __NR_ia32_setresuid32 208
218#define __NR_ia32_getresuid32 209
219#define __NR_ia32_setresgid32 210
220#define __NR_ia32_getresgid32 211
221#define __NR_ia32_chown32 212
222#define __NR_ia32_setuid32 213
223#define __NR_ia32_setgid32 214
224#define __NR_ia32_setfsuid32 215
225#define __NR_ia32_setfsgid32 216
226#define __NR_ia32_pivot_root 217
227#define __NR_ia32_mincore 218
228#define __NR_ia32_madvise 219
229#define __NR_ia32_madvise1 219 /* delete when C lib stub is removed */
230#define __NR_ia32_getdents64 220
231#define __NR_ia32_fcntl64 221
232#define __NR_ia32_tuxcall 222
233#define __NR_ia32_security 223
234#define __NR_ia32_gettid 224
235#define __NR_ia32_readahead 225
236#define __NR_ia32_setxattr 226
237#define __NR_ia32_lsetxattr 227
238#define __NR_ia32_fsetxattr 228
239#define __NR_ia32_getxattr 229
240#define __NR_ia32_lgetxattr 230
241#define __NR_ia32_fgetxattr 231
242#define __NR_ia32_listxattr 232
243#define __NR_ia32_llistxattr 233
244#define __NR_ia32_flistxattr 234
245#define __NR_ia32_removexattr 235
246#define __NR_ia32_lremovexattr 236
247#define __NR_ia32_fremovexattr 237
248#define __NR_ia32_tkill 238
249#define __NR_ia32_sendfile64 239
250#define __NR_ia32_futex 240
251#define __NR_ia32_sched_setaffinity 241
252#define __NR_ia32_sched_getaffinity 242
253#define __NR_ia32_set_thread_area 243
254#define __NR_ia32_get_thread_area 244
255#define __NR_ia32_io_setup 245
256#define __NR_ia32_io_destroy 246
257#define __NR_ia32_io_getevents 247
258#define __NR_ia32_io_submit 248
259#define __NR_ia32_io_cancel 249
260#define __NR_ia32_exit_group 252
261#define __NR_ia32_lookup_dcookie 253
262#define __NR_ia32_sys_epoll_create 254
263#define __NR_ia32_sys_epoll_ctl 255
264#define __NR_ia32_sys_epoll_wait 256
265#define __NR_ia32_remap_file_pages 257
266#define __NR_ia32_set_tid_address 258
267#define __NR_ia32_timer_create 259
268#define __NR_ia32_timer_settime (__NR_ia32_timer_create+1)
269#define __NR_ia32_timer_gettime (__NR_ia32_timer_create+2)
270#define __NR_ia32_timer_getoverrun (__NR_ia32_timer_create+3)
271#define __NR_ia32_timer_delete (__NR_ia32_timer_create+4)
272#define __NR_ia32_clock_settime (__NR_ia32_timer_create+5)
273#define __NR_ia32_clock_gettime (__NR_ia32_timer_create+6)
274#define __NR_ia32_clock_getres (__NR_ia32_timer_create+7)
275#define __NR_ia32_clock_nanosleep (__NR_ia32_timer_create+8)
276#define __NR_ia32_statfs64 268
277#define __NR_ia32_fstatfs64 269
278#define __NR_ia32_tgkill 270
279#define __NR_ia32_utimes 271
280#define __NR_ia32_fadvise64_64 272
281#define __NR_ia32_vserver 273
282#define __NR_ia32_mbind 274
283#define __NR_ia32_get_mempolicy 275
284#define __NR_ia32_set_mempolicy 276
285#define __NR_ia32_mq_open 277
286#define __NR_ia32_mq_unlink (__NR_ia32_mq_open+1)
287#define __NR_ia32_mq_timedsend (__NR_ia32_mq_open+2)
288#define __NR_ia32_mq_timedreceive (__NR_ia32_mq_open+3)
289#define __NR_ia32_mq_notify (__NR_ia32_mq_open+4)
290#define __NR_ia32_mq_getsetattr (__NR_ia32_mq_open+5)
291#define __NR_ia32_kexec 283
292#define __NR_ia32_waitid 284
293/* #define __NR_sys_setaltroot 285 */
294#define __NR_ia32_add_key 286
295#define __NR_ia32_request_key 287
296#define __NR_ia32_keyctl 288
297#define __NR_ia32_ioprio_set 289
298#define __NR_ia32_ioprio_get 290
299#define __NR_ia32_inotify_init 291
300#define __NR_ia32_inotify_add_watch 292
301#define __NR_ia32_inotify_rm_watch 293
302#define __NR_ia32_migrate_pages 294
303#define __NR_ia32_openat 295
304#define __NR_ia32_mkdirat 296
305#define __NR_ia32_mknodat 297
306#define __NR_ia32_fchownat 298
307#define __NR_ia32_futimesat 299
308#define __NR_ia32_fstatat64 300
309#define __NR_ia32_unlinkat 301
310#define __NR_ia32_renameat 302
311#define __NR_ia32_linkat 303
312#define __NR_ia32_symlinkat 304
313#define __NR_ia32_readlinkat 305
314#define __NR_ia32_fchmodat 306
315#define __NR_ia32_faccessat 307
316#define __NR_ia32_pselect6 308
317#define __NR_ia32_ppoll 309
318#define __NR_ia32_unshare 310
319 17
320#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ 18#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff --git a/include/asm-x86_64/intel_arch_perfmon.h b/include/asm-x86_64/intel_arch_perfmon.h
new file mode 100644
index 0000000000..8633331420
--- /dev/null
+++ b/include/asm-x86_64/intel_arch_perfmon.h
@@ -0,0 +1,31 @@
1#ifndef X86_64_INTEL_ARCH_PERFMON_H
2#define X86_64_INTEL_ARCH_PERFMON_H 1
3
4#define MSR_ARCH_PERFMON_PERFCTR0 0xc1
5#define MSR_ARCH_PERFMON_PERFCTR1 0xc2
6
7#define MSR_ARCH_PERFMON_EVENTSEL0 0x186
8#define MSR_ARCH_PERFMON_EVENTSEL1 0x187
9
10#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22)
11#define ARCH_PERFMON_EVENTSEL_INT (1 << 20)
12#define ARCH_PERFMON_EVENTSEL_OS (1 << 17)
13#define ARCH_PERFMON_EVENTSEL_USR (1 << 16)
14
15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c)
16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
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};
30
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 fb7a0909a1..5d1b5c68e3 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -10,8 +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 13#ifdef CONFIG_PCI_MSI
16static inline int use_pci_vector(void) {return 1;} 14static inline int use_pci_vector(void) {return 1;}
17static inline void disable_edge_ioapic_vector(unsigned int vector) { } 15static inline void disable_edge_ioapic_vector(unsigned int vector) { }
@@ -209,10 +207,6 @@ extern int timer_uses_ioapic_pin_0;
209 207
210extern int sis_apic_bug; /* dummy */ 208extern int sis_apic_bug; /* dummy */
211 209
212#else /* !CONFIG_X86_IO_APIC */
213#define io_apic_assign_pci_irqs 0
214#endif
215
216extern int assign_irq_vector(int irq); 210extern int assign_irq_vector(int irq);
217 211
218void enable_NMI_through_LVT0 (void * dummy); 212void enable_NMI_through_LVT0 (void * dummy);
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h
index 9db5a1b4f7..43469d8ab7 100644
--- a/include/asm-x86_64/irq.h
+++ b/include/asm-x86_64/irq.h
@@ -44,9 +44,7 @@ static __inline__ int irq_canonicalize(int irq)
44 return ((irq == 2) ? 9 : irq); 44 return ((irq == 2) ? 9 : irq);
45} 45}
46 46
47#ifdef CONFIG_X86_LOCAL_APIC
48#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ 47#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
49#endif
50 48
51#ifdef CONFIG_HOTPLUG_CPU 49#ifdef CONFIG_HOTPLUG_CPU
52#include <linux/cpumask.h> 50#include <linux/cpumask.h>
diff --git a/include/asm-x86_64/irqflags.h b/include/asm-x86_64/irqflags.h
new file mode 100644
index 0000000000..cce6937e87
--- /dev/null
+++ b/include/asm-x86_64/irqflags.h
@@ -0,0 +1,141 @@
1/*
2 * include/asm-x86_64/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14/*
15 * Interrupt control:
16 */
17
18static inline unsigned long __raw_local_save_flags(void)
19{
20 unsigned long flags;
21
22 __asm__ __volatile__(
23 "# __raw_save_flags\n\t"
24 "pushfq ; popq %q0"
25 : "=g" (flags)
26 : /* no input */
27 : "memory"
28 );
29
30 return flags;
31}
32
33#define raw_local_save_flags(flags) \
34 do { (flags) = __raw_local_save_flags(); } while (0)
35
36static inline void raw_local_irq_restore(unsigned long flags)
37{
38 __asm__ __volatile__(
39 "pushq %0 ; popfq"
40 : /* no output */
41 :"g" (flags)
42 :"memory", "cc"
43 );
44}
45
46#ifdef CONFIG_X86_VSMP
47
48/*
49 * Interrupt control for the VSMP architecture:
50 */
51
52static inline void raw_local_irq_disable(void)
53{
54 unsigned long flags = __raw_local_save_flags();
55
56 raw_local_irq_restore((flags & ~(1 << 9)) | (1 << 18));
57}
58
59static inline void raw_local_irq_enable(void)
60{
61 unsigned long flags = __raw_local_save_flags();
62
63 raw_local_irq_restore((flags | (1 << 9)) & ~(1 << 18));
64}
65
66static inline int raw_irqs_disabled_flags(unsigned long flags)
67{
68 return !(flags & (1<<9)) || (flags & (1 << 18));
69}
70
71#else /* CONFIG_X86_VSMP */
72
73static inline void raw_local_irq_disable(void)
74{
75 __asm__ __volatile__("cli" : : : "memory");
76}
77
78static inline void raw_local_irq_enable(void)
79{
80 __asm__ __volatile__("sti" : : : "memory");
81}
82
83static inline int raw_irqs_disabled_flags(unsigned long flags)
84{
85 return !(flags & (1 << 9));
86}
87
88#endif
89
90/*
91 * For spinlocks, etc.:
92 */
93
94static inline unsigned long __raw_local_irq_save(void)
95{
96 unsigned long flags = __raw_local_save_flags();
97
98 raw_local_irq_disable();
99
100 return flags;
101}
102
103#define raw_local_irq_save(flags) \
104 do { (flags) = __raw_local_irq_save(); } while (0)
105
106static inline int raw_irqs_disabled(void)
107{
108 unsigned long flags = __raw_local_save_flags();
109
110 return raw_irqs_disabled_flags(flags);
111}
112
113/*
114 * Used in the idle loop; sti takes one instruction cycle
115 * to complete:
116 */
117static inline void raw_safe_halt(void)
118{
119 __asm__ __volatile__("sti; hlt" : : : "memory");
120}
121
122/*
123 * Used when interrupts are already enabled or to
124 * shutdown the processor:
125 */
126static inline void halt(void)
127{
128 __asm__ __volatile__("hlt": : :"memory");
129}
130
131#else /* __ASSEMBLY__: */
132# ifdef CONFIG_TRACE_IRQFLAGS
133# define TRACE_IRQS_ON call trace_hardirqs_on_thunk
134# define TRACE_IRQS_OFF call trace_hardirqs_off_thunk
135# else
136# define TRACE_IRQS_ON
137# define TRACE_IRQS_OFF
138# endif
139#endif
140
141#endif
diff --git a/include/asm-x86_64/k8.h b/include/asm-x86_64/k8.h
new file mode 100644
index 0000000000..699dd6961e
--- /dev/null
+++ b/include/asm-x86_64/k8.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_K8_H
2#define _ASM_K8_H 1
3
4#include <linux/pci.h>
5
6extern struct pci_device_id k8_nb_ids[];
7
8extern int early_is_k8_nb(u32 value);
9extern struct pci_dev **k8_northbridges;
10extern int num_k8_northbridges;
11extern int cache_k8_northbridges(void);
12extern void k8_flush_garts(void);
13
14#endif
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h
index cf795631d9..2b0c088e29 100644
--- a/include/asm-x86_64/kdebug.h
+++ b/include/asm-x86_64/kdebug.h
@@ -15,6 +15,8 @@ struct die_args {
15 15
16extern int register_die_notifier(struct notifier_block *); 16extern int register_die_notifier(struct notifier_block *);
17extern int unregister_die_notifier(struct notifier_block *); 17extern int unregister_die_notifier(struct notifier_block *);
18extern int register_page_fault_notifier(struct notifier_block *);
19extern int unregister_page_fault_notifier(struct notifier_block *);
18extern struct atomic_notifier_head die_chain; 20extern struct atomic_notifier_head die_chain;
19 21
20/* Grossly misnamed. */ 22/* Grossly misnamed. */
@@ -47,7 +49,7 @@ static inline int notify_die(enum die_val val, const char *str,
47 return atomic_notifier_call_chain(&die_chain, val, &args); 49 return atomic_notifier_call_chain(&die_chain, val, &args);
48} 50}
49 51
50extern int printk_address(unsigned long address); 52extern void printk_address(unsigned long address);
51extern void die(const char *,struct pt_regs *,long); 53extern void die(const char *,struct pt_regs *,long);
52extern void __die(const char *,struct pt_regs *,long); 54extern void __die(const char *,struct pt_regs *,long);
53extern void show_registers(struct pt_regs *regs); 55extern void show_registers(struct pt_regs *regs);
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h
index c564bae034..5fab957e10 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/kprobes.h b/include/asm-x86_64/kprobes.h
index 98a1e95ddb..cf5317898f 100644
--- a/include/asm-x86_64/kprobes.h
+++ b/include/asm-x86_64/kprobes.h
@@ -43,9 +43,11 @@ typedef u8 kprobe_opcode_t;
43 43
44#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 44#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
45#define ARCH_SUPPORTS_KRETPROBES 45#define ARCH_SUPPORTS_KRETPROBES
46#define ARCH_INACTIVE_KPROBE_COUNT 1
46 47
47void kretprobe_trampoline(void); 48void kretprobe_trampoline(void);
48extern void arch_remove_kprobe(struct kprobe *p); 49extern void arch_remove_kprobe(struct kprobe *p);
50#define flush_insn_slot(p) do { } while (0)
49 51
50/* Architecture specific copy of original instruction*/ 52/* Architecture specific copy of original instruction*/
51struct arch_specific_insn { 53struct arch_specific_insn {
diff --git a/include/asm-x86_64/linkage.h b/include/asm-x86_64/linkage.h
index 291c2d01c4..b5f39d0189 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/local.h b/include/asm-x86_64/local.h
index cd17945bf2..e769e62002 100644
--- a/include/asm-x86_64/local.h
+++ b/include/asm-x86_64/local.h
@@ -59,12 +59,26 @@ static inline void local_sub(long i, local_t *v)
59 * This could be done better if we moved the per cpu data directly 59 * This could be done better if we moved the per cpu data directly
60 * after GS. 60 * after GS.
61 */ 61 */
62#define cpu_local_read(v) local_read(&__get_cpu_var(v)) 62
63#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i)) 63/* Need to disable preemption for the cpu local counters otherwise we could
64#define cpu_local_inc(v) local_inc(&__get_cpu_var(v)) 64 still access a variable of a previous CPU in a non atomic way. */
65#define cpu_local_dec(v) local_dec(&__get_cpu_var(v)) 65#define cpu_local_wrap_v(v) \
66#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v)) 66 ({ local_t res__; \
67#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v)) 67 preempt_disable(); \
68 res__ = (v); \
69 preempt_enable(); \
70 res__; })
71#define cpu_local_wrap(v) \
72 ({ preempt_disable(); \
73 v; \
74 preempt_enable(); }) \
75
76#define cpu_local_read(v) cpu_local_wrap_v(local_read(&__get_cpu_var(v)))
77#define cpu_local_set(v, i) cpu_local_wrap(local_set(&__get_cpu_var(v), (i)))
78#define cpu_local_inc(v) cpu_local_wrap(local_inc(&__get_cpu_var(v)))
79#define cpu_local_dec(v) cpu_local_wrap(local_dec(&__get_cpu_var(v)))
80#define cpu_local_add(i, v) cpu_local_wrap(local_add((i), &__get_cpu_var(v)))
81#define cpu_local_sub(i, v) cpu_local_wrap(local_sub((i), &__get_cpu_var(v)))
68 82
69#define __cpu_local_inc(v) cpu_local_inc(v) 83#define __cpu_local_inc(v) cpu_local_inc(v)
70#define __cpu_local_dec(v) cpu_local_dec(v) 84#define __cpu_local_dec(v) cpu_local_dec(v)
diff --git a/include/asm-x86_64/mach_apic.h b/include/asm-x86_64/mach_apic.h
index 0acea44c93..d33422450c 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 7229785094..5a11146d6d 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -67,13 +67,22 @@ struct mce_log {
67/* Software defined banks */ 67/* Software defined banks */
68#define MCE_EXTENDED_BANK 128 68#define MCE_EXTENDED_BANK 128
69#define MCE_THERMAL_BANK MCE_EXTENDED_BANK + 0 69#define MCE_THERMAL_BANK MCE_EXTENDED_BANK + 0
70#define MCE_THRESHOLD_BASE MCE_EXTENDED_BANK + 1 /* MCE_AMD */ 70
71#define MCE_THRESHOLD_DRAM_ECC MCE_THRESHOLD_BASE + 4 71#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1) /* MCE_AMD */
72#define K8_MCE_THRESHOLD_BANK_0 (MCE_THRESHOLD_BASE + 0 * 9)
73#define K8_MCE_THRESHOLD_BANK_1 (MCE_THRESHOLD_BASE + 1 * 9)
74#define K8_MCE_THRESHOLD_BANK_2 (MCE_THRESHOLD_BASE + 2 * 9)
75#define K8_MCE_THRESHOLD_BANK_3 (MCE_THRESHOLD_BASE + 3 * 9)
76#define K8_MCE_THRESHOLD_BANK_4 (MCE_THRESHOLD_BASE + 4 * 9)
77#define K8_MCE_THRESHOLD_BANK_5 (MCE_THRESHOLD_BASE + 5 * 9)
78#define K8_MCE_THRESHOLD_DRAM_ECC (MCE_THRESHOLD_BANK_4 + 0)
72 79
73#ifdef __KERNEL__ 80#ifdef __KERNEL__
74#include <asm/atomic.h> 81#include <asm/atomic.h>
75 82
76void mce_log(struct mce *m); 83void mce_log(struct mce *m);
84DECLARE_PER_CPU(struct sys_device, device_mce);
85
77#ifdef CONFIG_X86_MCE_INTEL 86#ifdef CONFIG_X86_MCE_INTEL
78void mce_intel_feature_init(struct cpuinfo_x86 *c); 87void mce_intel_feature_init(struct cpuinfo_x86 *c);
79#else 88#else
@@ -90,6 +99,8 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c)
90} 99}
91#endif 100#endif
92 101
102void mce_log_therm_throt_event(unsigned int cpu, __u64 status);
103
93extern atomic_t mce_entry; 104extern atomic_t mce_entry;
94 105
95#endif 106#endif
diff --git a/include/asm-x86_64/mmx.h b/include/asm-x86_64/mmx.h
deleted file mode 100644
index 46b71da998..0000000000
--- 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 14fc3ddd90..017fddb61d 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/msr.h b/include/asm-x86_64/msr.h
index 10f8b51cec..37e194169f 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 11fbee2bd6..16396b1de3 100644
--- a/include/asm-x86_64/mutex.h
+++ b/include/asm-x86_64/mutex.h
@@ -24,14 +24,10 @@ do { \
24 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 24 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
25 \ 25 \
26 __asm__ __volatile__( \ 26 __asm__ __volatile__( \
27 LOCK " 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) \
@@ -74,14 +70,10 @@ do { \
74 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 70 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
75 \ 71 \
76 __asm__ __volatile__( \ 72 __asm__ __volatile__( \
77 LOCK " 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 d3abfc6a8f..f367d4014b 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -5,26 +5,16 @@
5#define ASM_NMI_H 5#define ASM_NMI_H
6 6
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <asm/io.h>
8 9
9struct pt_regs; 10/**
10 11 * do_nmi_callback
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/**
22 * unset_nmi_callback
23 * 12 *
24 * 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.
25 */ 15 */
26void unset_nmi_callback(void); 16int do_nmi_callback(struct pt_regs *regs, int cpu);
27 17
28#ifdef CONFIG_PM 18#ifdef CONFIG_PM
29 19
30/** Replace the PM callback routine for NMI. */ 20/** Replace the PM callback routine for NMI. */
@@ -47,13 +37,44 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev)
47#endif /* CONFIG_PM */ 37#endif /* CONFIG_PM */
48 38
49extern void default_do_nmi(struct pt_regs *); 39extern void default_do_nmi(struct pt_regs *);
50extern void die_nmi(char *str, struct pt_regs *regs); 40extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
51 41
52#define get_nmi_reason() inb(0x61) 42#define get_nmi_reason() inb(0x61)
53 43
54extern int panic_on_timeout; 44extern int panic_on_timeout;
55extern int unknown_nmi_panic; 45extern int unknown_nmi_panic;
46extern int nmi_watchdog_enabled;
56 47
57extern int check_nmi_watchdog(void); 48extern int check_nmi_watchdog(void);
58 49extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
50extern int avail_to_resrv_perfctr_nmi(unsigned int);
51extern int reserve_perfctr_nmi(unsigned int);
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 *);
58extern void disable_timer_nmi_watchdog(void);
59extern void enable_timer_nmi_watchdog(void);
60extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
61
62extern void nmi_watchdog_default(void);
63extern int setup_nmi_watchdog(char *);
64
65extern atomic_t nmi_active;
66extern unsigned int nmi_watchdog;
67#define NMI_DEFAULT -1
68#define NMI_NONE 0
69#define NMI_IO_APIC 1
70#define NMI_LOCAL_APIC 2
71#define NMI_INVALID 3
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
59#endif /* ASM_NMI_H */ 80#endif /* ASM_NMI_H */
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index f7bf875aae..10f346165c 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -19,7 +19,7 @@
19#define EXCEPTION_STACK_ORDER 0 19#define EXCEPTION_STACK_ORDER 0
20#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) 20#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
21 21
22#define DEBUG_STACK_ORDER EXCEPTION_STACK_ORDER 22#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
23#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) 23#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
24 24
25#define IRQSTACK_ORDER 2 25#define IRQSTACK_ORDER 2
diff --git a/include/asm-x86_64/pci-direct.h b/include/asm-x86_64/pci-direct.h
index 036b6ca5b5..eba9cb471d 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/pci.h b/include/asm-x86_64/pci.h
index 2db0620d54..49c5e92805 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -39,8 +39,8 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
39#include <asm/scatterlist.h> 39#include <asm/scatterlist.h>
40#include <linux/string.h> 40#include <linux/string.h>
41#include <asm/page.h> 41#include <asm/page.h>
42#include <linux/dma-mapping.h> /* for have_iommu */
43 42
43extern void pci_iommu_alloc(void);
44extern int iommu_setup(char *opt); 44extern int iommu_setup(char *opt);
45 45
46/* The PCI address space does equal the physical memory 46/* The PCI address space does equal the physical memory
@@ -52,7 +52,7 @@ extern int iommu_setup(char *opt);
52 */ 52 */
53#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) 53#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
54 54
55#ifdef CONFIG_GART_IOMMU 55#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
56 56
57/* 57/*
58 * x86-64 always supports DAC, but sometimes it is useful to force 58 * x86-64 always supports DAC, but sometimes it is useful to force
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index b47c3df9ed..14996d962b 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 7f33aaf9f7..285756010c 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,16 +11,35 @@
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
27#define per_cpu_offset(x) (__per_cpu_offset(x))
28
17/* Separate out the type, so (int[3], foo) works. */ 29/* Separate out the type, so (int[3], foo) works. */
18#define DEFINE_PER_CPU(type, name) \ 30#define DEFINE_PER_CPU(type, name) \
19 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name 31 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
20 32
21/* var is in discarded region: offset to particular copy we want */ 33/* var is in discarded region: offset to particular copy we want */
22#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 34#define per_cpu(var, cpu) (*({ \
23#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 35 extern int simple_indentifier_##var(void); \
36 RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)); }))
37#define __get_cpu_var(var) (*({ \
38 extern int simple_indentifier_##var(void); \
39 RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); }))
40#define __raw_get_cpu_var(var) (*({ \
41 extern int simple_indentifier_##var(void); \
42 RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); }))
24 43
25/* A macro to avoid #include hell... */ 44/* A macro to avoid #include hell... */
26#define percpu_modcopy(pcpudst, src, size) \ 45#define percpu_modcopy(pcpudst, src, size) \
@@ -40,6 +59,7 @@ extern void setup_per_cpu_areas(void);
40 59
41#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 60#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
42#define __get_cpu_var(var) per_cpu__##var 61#define __get_cpu_var(var) per_cpu__##var
62#define __raw_get_cpu_var(var) per_cpu__##var
43 63
44#endif /* SMP */ 64#endif /* SMP */
45 65
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 31e83c3bd0..6899e770b1 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..
@@ -101,9 +98,6 @@ static inline void pgd_clear (pgd_t * pgd)
101 set_pgd(pgd, __pgd(0)); 98 set_pgd(pgd, __pgd(0));
102} 99}
103 100
104#define pud_page(pud) \
105((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK))
106
107#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) 101#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0))
108 102
109struct mm_struct; 103struct mm_struct;
@@ -268,7 +262,7 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
268#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) 262#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
269static 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; }
270static 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; }
271static 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); }
272static 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; }
273static 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; }
274static 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; }
@@ -281,11 +275,12 @@ static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) &
281static 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; }
282static 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; }
283static 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; }
284static 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; }
285static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 279static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
286static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 280static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
287static 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; }
288static 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; }
289 284
290struct vm_area_struct; 285struct vm_area_struct;
291 286
@@ -326,7 +321,8 @@ static inline int pmd_large(pmd_t pte) {
326/* 321/*
327 * Level 4 access. 322 * Level 4 access.
328 */ 323 */
329#define pgd_page(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK)) 324#define pgd_page_vaddr(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK))
325#define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT))
330#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 326#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
331#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) 327#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
332#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) 328#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address))
@@ -335,22 +331,18 @@ static inline int pmd_large(pmd_t pte) {
335 331
336/* PUD - Level3 access */ 332/* PUD - Level3 access */
337/* to find an entry in a page-table-directory. */ 333/* to find an entry in a page-table-directory. */
334#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK))
335#define pud_page(pud) (pfn_to_page(pud_val(pud) >> PAGE_SHIFT))
338#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) 336#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
339#define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address)) 337#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address))
340#define pud_offset_k(pgd, addr) pud_offset(pgd, addr)
341#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) 338#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT)
342 339
343static inline pud_t *__pud_offset_k(pud_t *pud, unsigned long address)
344{
345 return pud + pud_index(address);
346}
347
348/* PMD - Level 2 access */ 340/* PMD - Level 2 access */
349#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) 341#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
350#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 342#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
351 343
352#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 344#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
353#define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \ 345#define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \
354 pmd_index(address)) 346 pmd_index(address))
355#define pmd_none(x) (!pmd_val(x)) 347#define pmd_none(x) (!pmd_val(x))
356#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) 348#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
@@ -388,7 +380,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
388 380
389#define pte_index(address) \ 381#define pte_index(address) \
390 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 382 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
391#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ 383#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
392 pte_index(address)) 384 pte_index(address))
393 385
394/* x86-64 always has all page tables mapped. */ 386/* x86-64 always has all page tables mapped. */
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 3061a38a3b..de9c3147ee 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -69,7 +69,11 @@ struct cpuinfo_x86 {
69 cpumask_t llc_shared_map; /* cpus sharing the last level cache */ 69 cpumask_t llc_shared_map; /* cpus sharing the last level cache */
70#endif 70#endif
71 __u8 apicid; 71 __u8 apicid;
72#ifdef CONFIG_SMP
72 __u8 booted_cores; /* number of cores as seen by OS */ 73 __u8 booted_cores; /* number of cores as seen by OS */
74 __u8 phys_proc_id; /* Physical Processor id. */
75 __u8 cpu_core_id; /* Core id. */
76#endif
73} ____cacheline_aligned; 77} ____cacheline_aligned;
74 78
75#define X86_VENDOR_INTEL 0 79#define X86_VENDOR_INTEL 0
@@ -96,6 +100,7 @@ extern char ignore_irq13;
96extern void identify_cpu(struct cpuinfo_x86 *); 100extern void identify_cpu(struct cpuinfo_x86 *);
97extern void print_cpu_info(struct cpuinfo_x86 *); 101extern void print_cpu_info(struct cpuinfo_x86 *);
98extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 102extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
103extern unsigned short num_cache_leaves;
99 104
100/* 105/*
101 * EFLAGS bits 106 * EFLAGS bits
@@ -227,8 +232,14 @@ struct tss_struct {
227 unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; 232 unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
228} __attribute__((packed)) ____cacheline_aligned; 233} __attribute__((packed)) ____cacheline_aligned;
229 234
235
230extern struct cpuinfo_x86 boot_cpu_data; 236extern struct cpuinfo_x86 boot_cpu_data;
231DECLARE_PER_CPU(struct tss_struct,init_tss); 237DECLARE_PER_CPU(struct tss_struct,init_tss);
238/* Save the original ist values for checking stack pointers during debugging */
239struct orig_ist {
240 unsigned long ist[7];
241};
242DECLARE_PER_CPU(struct orig_ist, orig_ist);
232 243
233#ifdef CONFIG_X86_VSMP 244#ifdef CONFIG_X86_VSMP
234#define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT) 245#define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT)
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 8abf2a43c9..c28fc2db21 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);
@@ -37,7 +35,6 @@ extern void ia32_sysenter_target(void);
37 35
38extern void config_acpi_tables(void); 36extern void config_acpi_tables(void);
39extern void ia32_syscall(void); 37extern void ia32_syscall(void);
40extern void iommu_hole_init(void);
41 38
42extern int pmtimer_mark_offset(void); 39extern int pmtimer_mark_offset(void);
43extern void pmtimer_resume(void); 40extern void pmtimer_resume(void);
@@ -52,10 +49,8 @@ extern unsigned long long monotonic_base;
52extern int sysctl_vsyscall; 49extern int sysctl_vsyscall;
53extern int nohpet; 50extern int nohpet;
54extern unsigned long vxtime_hz; 51extern unsigned long vxtime_hz;
52extern void time_init_gtod(void);
55 53
56extern int numa_setup(char *opt);
57
58extern int setup_early_printk(char *);
59extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); 54extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
60 55
61extern void early_identify_cpu(struct cpuinfo_x86 *c); 56extern void early_identify_cpu(struct cpuinfo_x86 *c);
@@ -75,7 +70,7 @@ extern void main_timer_handler(struct pt_regs *regs);
75 70
76extern unsigned long end_pfn_map; 71extern unsigned long end_pfn_map;
77 72
78extern void show_trace(unsigned long * rsp); 73extern void show_trace(struct task_struct *, struct pt_regs *, unsigned long * rsp);
79extern void show_registers(struct pt_regs *regs); 74extern void show_registers(struct pt_regs *regs);
80 75
81extern void exception_table_check(void); 76extern void exception_table_check(void);
@@ -92,7 +87,7 @@ extern void syscall32_cpu_init(void);
92 87
93extern 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);
94 89
95extern void check_ioapic(void); 90extern void early_quirks(void);
96extern void check_efer(void); 91extern void check_efer(void);
97 92
98extern int unhandled_signal(struct task_struct *tsk, int sig); 93extern int unhandled_signal(struct task_struct *tsk, int sig);
@@ -101,22 +96,18 @@ extern int unsynchronized_tsc(void);
101 96
102extern void select_idle_routine(const struct cpuinfo_x86 *c); 97extern void select_idle_routine(const struct cpuinfo_x86 *c);
103 98
104extern void gart_parse_options(char *);
105extern void __init no_iommu_init(void);
106
107extern unsigned long table_start, table_end; 99extern unsigned long table_start, table_end;
108 100
109extern int exception_trace; 101extern int exception_trace;
110extern int force_iommu, no_iommu;
111extern int using_apic_timer;
112extern int disable_apic;
113extern unsigned cpu_khz; 102extern unsigned cpu_khz;
114extern int ioapic_force;
115extern int skip_ioapic_setup;
116extern int acpi_ht;
117extern int acpi_disabled;
118 103
119#ifdef CONFIG_GART_IOMMU 104extern void no_iommu_init(void);
105extern int force_iommu, no_iommu;
106extern int iommu_detected;
107#ifdef CONFIG_IOMMU
108extern void gart_iommu_init(void);
109extern void gart_parse_options(char *);
110extern void iommu_hole_init(void);
120extern int fallback_aper_order; 111extern int fallback_aper_order;
121extern int fallback_aper_force; 112extern int fallback_aper_force;
122extern int iommu_aperture; 113extern int iommu_aperture;
@@ -130,7 +121,8 @@ extern int fix_aperture;
130 121
131extern int reboot_force; 122extern int reboot_force;
132extern int notsc_setup(char *); 123extern int notsc_setup(char *);
133extern int setup_additional_cpus(char *); 124
125extern int gsi_irq_sharing(int gsi);
134 126
135extern void smp_local_timer_interrupt(struct pt_regs * regs); 127extern void smp_local_timer_interrupt(struct pt_regs * regs);
136 128
diff --git a/include/asm-x86_64/ptrace-abi.h b/include/asm-x86_64/ptrace-abi.h
new file mode 100644
index 0000000000..19184b0806
--- /dev/null
+++ b/include/asm-x86_64/ptrace-abi.h
@@ -0,0 +1,51 @@
1#ifndef _X86_64_PTRACE_ABI_H
2#define _X86_64_PTRACE_ABI_H
3
4#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
5#define R15 0
6#define R14 8
7#define R13 16
8#define R12 24
9#define RBP 32
10#define RBX 40
11/* arguments: interrupts/non tracing syscalls only save upto here*/
12#define R11 48
13#define R10 56
14#define R9 64
15#define R8 72
16#define RAX 80
17#define RCX 88
18#define RDX 96
19#define RSI 104
20#define RDI 112
21#define ORIG_RAX 120 /* = ERROR */
22/* end of arguments */
23/* cpu exception frame or undefined in case of fast syscall. */
24#define RIP 128
25#define CS 136
26#define EFLAGS 144
27#define RSP 152
28#define SS 160
29#define ARGOFFSET R11
30#endif /* __ASSEMBLY__ */
31
32/* top of stack page */
33#define FRAME_SIZE 168
34
35#define PTRACE_OLDSETOPTIONS 21
36
37/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
38#define PTRACE_GETREGS 12
39#define PTRACE_SETREGS 13
40#define PTRACE_GETFPREGS 14
41#define PTRACE_SETFPREGS 15
42#define PTRACE_GETFPXREGS 18
43#define PTRACE_SETFPXREGS 19
44
45/* only useful for access 32bit programs */
46#define PTRACE_GET_THREAD_AREA 25
47#define PTRACE_SET_THREAD_AREA 26
48
49#define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */
50
51#endif
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h
index ca6f15ff61..ab827dc381 100644
--- a/include/asm-x86_64/ptrace.h
+++ b/include/asm-x86_64/ptrace.h
@@ -1,40 +1,9 @@
1#ifndef _X86_64_PTRACE_H 1#ifndef _X86_64_PTRACE_H
2#define _X86_64_PTRACE_H 2#define _X86_64_PTRACE_H
3 3
4#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) 4#include <asm/ptrace-abi.h>
5#define R15 0
6#define R14 8
7#define R13 16
8#define R12 24
9#define RBP 32
10#define RBX 40
11/* arguments: interrupts/non tracing syscalls only save upto here*/
12#define R11 48
13#define R10 56
14#define R9 64
15#define R8 72
16#define RAX 80
17#define RCX 88
18#define RDX 96
19#define RSI 104
20#define RDI 112
21#define ORIG_RAX 120 /* = ERROR */
22/* end of arguments */
23/* cpu exception frame or undefined in case of fast syscall. */
24#define RIP 128
25#define CS 136
26#define EFLAGS 144
27#define RSP 152
28#define SS 160
29#define ARGOFFSET R11
30#endif /* __ASSEMBLY__ */
31 5
32/* top of stack page */ 6#ifndef __ASSEMBLY__
33#define FRAME_SIZE 168
34
35#define PTRACE_OLDSETOPTIONS 21
36
37#ifndef __ASSEMBLY__
38 7
39struct pt_regs { 8struct pt_regs {
40 unsigned long r15; 9 unsigned long r15;
@@ -45,7 +14,7 @@ struct pt_regs {
45 unsigned long rbx; 14 unsigned long rbx;
46/* arguments: non interrupts/non tracing syscalls only save upto here*/ 15/* arguments: non interrupts/non tracing syscalls only save upto here*/
47 unsigned long r11; 16 unsigned long r11;
48 unsigned long r10; 17 unsigned long r10;
49 unsigned long r9; 18 unsigned long r9;
50 unsigned long r8; 19 unsigned long r8;
51 unsigned long rax; 20 unsigned long rax;
@@ -54,32 +23,18 @@ struct pt_regs {
54 unsigned long rsi; 23 unsigned long rsi;
55 unsigned long rdi; 24 unsigned long rdi;
56 unsigned long orig_rax; 25 unsigned long orig_rax;
57/* end of arguments */ 26/* end of arguments */
58/* cpu exception frame or undefined */ 27/* cpu exception frame or undefined */
59 unsigned long rip; 28 unsigned long rip;
60 unsigned long cs; 29 unsigned long cs;
61 unsigned long eflags; 30 unsigned long eflags;
62 unsigned long rsp; 31 unsigned long rsp;
63 unsigned long ss; 32 unsigned long ss;
64/* top of stack page */ 33/* top of stack page */
65}; 34};
66 35
67#endif 36#endif
68 37
69/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
70#define PTRACE_GETREGS 12
71#define PTRACE_SETREGS 13
72#define PTRACE_GETFPREGS 14
73#define PTRACE_SETFPREGS 15
74#define PTRACE_GETFPXREGS 18
75#define PTRACE_SETFPXREGS 19
76
77/* only useful for access 32bit programs */
78#define PTRACE_GET_THREAD_AREA 25
79#define PTRACE_SET_THREAD_AREA 26
80
81#define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */
82
83#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 38#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
84#define user_mode(regs) (!!((regs)->cs & 3)) 39#define user_mode(regs) (!!((regs)->cs & 3))
85#define user_mode_vm(regs) user_mode(regs) 40#define user_mode_vm(regs) user_mode(regs)
diff --git a/include/asm-x86_64/rwlock.h b/include/asm-x86_64/rwlock.h
index 9942cc3930..72aeebed92 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 "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 "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 "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 "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 d4bed33fb3..334ddcdd8f 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 a389aa6fe8..1194888536 100644
--- a/include/asm-x86_64/semaphore.h
+++ b/include/asm-x86_64/semaphore.h
@@ -106,13 +106,10 @@ static inline void down(struct semaphore * sem)
106 106
107 __asm__ __volatile__( 107 __asm__ __volatile__(
108 "# atomic down operation\n\t" 108 "# atomic down operation\n\t"
109 LOCK "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"
133 LOCK "decl %1\n\t" /* --sem->count */ 130 "xorl %0,%0\n\t"
134 "js 2f\n\t" 131 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
135 "xorl %0,%0\n" 132 "jns 2f\n\t"
136 "1:\n" 133 "call __down_failed_interruptible\n"
137 LOCK_SECTION_START("") 134 "2:\n"
138 "2:\tcall __down_failed_interruptible\n\t" 135 :"=&a" (result), "=m" (sem->count)
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"
157 LOCK "decl %1\n\t" /* --sem->count */ 151 "xorl %0,%0\n\t"
158 "js 2f\n\t" 152 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
159 "xorl %0,%0\n" 153 "jns 2f\n\t"
160 "1:\n" 154 "call __down_failed_trylock\n\t"
161 LOCK_SECTION_START("") 155 "2:\n"
162 "2:\tcall __down_failed_trylock\n\t" 156 :"=&a" (result), "=m" (sem->count)
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;
@@ -178,13 +169,10 @@ static inline void up(struct semaphore * sem)
178{ 169{
179 __asm__ __volatile__( 170 __asm__ __volatile__(
180 "# atomic up operation\n\t" 171 "# atomic up operation\n\t"
181 LOCK "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 f8d5579853..4581f978b2 100644
--- a/include/asm-x86_64/signal.h
+++ b/include/asm-x86_64/signal.h
@@ -3,13 +3,13 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/linkage.h>
7#include <linux/time.h> 6#include <linux/time.h>
8 7
9/* Avoid too many header ordering problems. */ 8/* Avoid too many header ordering problems. */
10struct siginfo; 9struct siginfo;
11 10
12#ifdef __KERNEL__ 11#ifdef __KERNEL__
12#include <linux/linkage.h>
13/* Most things should be clean enough to redefine this at will, if care 13/* Most things should be clean enough to redefine this at will, if care
14 is taken to make libc match. */ 14 is taken to make libc match. */
15 15
@@ -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
@@ -83,7 +79,6 @@ typedef unsigned long sigset_t;
83 * SA_FLAGS values: 79 * SA_FLAGS values:
84 * 80 *
85 * SA_ONSTACK indicates that a registered stack_t will be used. 81 * SA_ONSTACK indicates that a registered stack_t will be used.
86 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
87 * SA_RESTART flag to get restarting signals (which were the default long ago) 82 * SA_RESTART flag to get restarting signals (which were the default long ago)
88 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
89 * SA_RESETHAND clears the handler when the signal is delivered. 84 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -103,7 +98,6 @@ typedef unsigned long sigset_t;
103 98
104#define SA_NOMASK SA_NODEFER 99#define SA_NOMASK SA_NODEFER
105#define SA_ONESHOT SA_RESETHAND 100#define SA_ONESHOT SA_RESETHAND
106#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
107 101
108#define SA_RESTORER 0x04000000 102#define SA_RESTORER 0x04000000
109 103
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index 7686b9b25a..d6b7c057ed 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,19 +33,14 @@ 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;
49extern void smp_send_reschedule(int cpu); 39extern void smp_send_reschedule(int cpu);
50void smp_stop_cpu(void); 40void smp_stop_cpu(void);
51extern int smp_call_function_single(int cpuid, void (*func) (void *info),
52 void *info, int retry, int wait);
53 41
54extern cpumask_t cpu_sibling_map[NR_CPUS]; 42extern cpumask_t cpu_sibling_map[NR_CPUS];
55extern cpumask_t cpu_core_map[NR_CPUS]; 43extern cpumask_t cpu_core_map[NR_CPUS];
56extern u8 phys_proc_id[NR_CPUS];
57extern u8 cpu_core_id[NR_CPUS];
58extern u8 cpu_llc_id[NR_CPUS]; 44extern u8 cpu_llc_id[NR_CPUS];
59 45
60#define SMP_TRAMPOLINE_BASE 0x6000 46#define SMP_TRAMPOLINE_BASE 0x6000
@@ -78,20 +64,16 @@ static inline int hard_smp_processor_id(void)
78 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); 64 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
79} 65}
80 66
81extern int safe_smp_processor_id(void);
82extern int __cpu_disable(void); 67extern int __cpu_disable(void);
83extern void __cpu_die(unsigned int cpu); 68extern void __cpu_die(unsigned int cpu);
84extern void prefill_possible_map(void); 69extern void prefill_possible_map(void);
85extern unsigned num_processors; 70extern unsigned num_processors;
86extern unsigned disabled_cpus; 71extern unsigned disabled_cpus;
87 72
88#endif /* !ASSEMBLY */
89
90#define NO_PROC_ID 0xFF /* No processor magic marker */ 73#define NO_PROC_ID 0xFF /* No processor magic marker */
91 74
92#endif 75#endif
93 76
94#ifndef ASSEMBLY
95/* 77/*
96 * Some lowlevel functions might want to know about 78 * Some lowlevel functions might want to know about
97 * the real APIC ID <-> CPU # mapping. 79 * the real APIC ID <-> CPU # mapping.
@@ -113,11 +95,8 @@ static inline int cpu_present_to_apicid(int mps_cpu)
113 return BAD_APICID; 95 return BAD_APICID;
114} 96}
115 97
116#endif /* !ASSEMBLY */
117
118#ifndef CONFIG_SMP 98#ifndef CONFIG_SMP
119#define stack_smp_processor_id() 0 99#define stack_smp_processor_id() 0
120#define safe_smp_processor_id() 0
121#define cpu_logical_map(x) (x) 100#define cpu_logical_map(x) (x)
122#else 101#else
123#include <asm/thread_info.h> 102#include <asm/thread_info.h>
@@ -129,19 +108,23 @@ static inline int cpu_present_to_apicid(int mps_cpu)
129}) 108})
130#endif 109#endif
131 110
132#ifndef __ASSEMBLY__
133static __inline int logical_smp_processor_id(void) 111static __inline int logical_smp_processor_id(void)
134{ 112{
135 /* 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 */
136 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); 114 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
137} 115}
138#endif
139 116
140#ifdef CONFIG_SMP 117#ifdef CONFIG_SMP
141#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 118#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
142#else 119#else
143#define cpu_physical_id(cpu) boot_cpu_id 120#define cpu_physical_id(cpu) boot_cpu_id
144#endif 121static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
145 122 void *info, int retry, int wait)
123{
124 /* Disable interrupts here? */
125 func(info);
126 return 0;
127}
128#endif /* !CONFIG_SMP */
146#endif 129#endif
147 130
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h
index f2cdbeae5d..b467026079 100644
--- a/include/asm-x86_64/socket.h
+++ b/include/asm-x86_64/socket.h
@@ -48,5 +48,6 @@
48#define SO_ACCEPTCONN 30 48#define SO_ACCEPTCONN 30
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
51 52
52#endif /* _ASM_SOCKET_H */ 53#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h
index 5d8a5e3589..3daf5b0059 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,30 +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 ; 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_unlock_string \
35 "movl $1,%0" \
36 :"=m" (lock->slock) : : "memory"
37 24
38static inline void __raw_spin_lock(raw_spinlock_t *lock) 25static inline void __raw_spin_lock(raw_spinlock_t *lock)
39{ 26{
40 __asm__ __volatile__( 27 asm volatile(
41 __raw_spin_lock_string 28 "\n1:\t"
42 :"=m" (lock->slock) : : "memory"); 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");
43} 37}
44 38
45#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 39#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
@@ -48,7 +42,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
48{ 42{
49 int oldval; 43 int oldval;
50 44
51 __asm__ __volatile__( 45 asm volatile(
52 "xchgl %0,%1" 46 "xchgl %0,%1"
53 :"=q" (oldval), "=m" (lock->slock) 47 :"=q" (oldval), "=m" (lock->slock)
54 :"0" (0) : "memory"); 48 :"0" (0) : "memory");
@@ -58,13 +52,14 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
58 52
59static inline void __raw_spin_unlock(raw_spinlock_t *lock) 53static inline void __raw_spin_unlock(raw_spinlock_t *lock)
60{ 54{
61 __asm__ __volatile__( 55 asm volatile("movl $1,%0" :"=m" (lock->slock) :: "memory");
62 __raw_spin_unlock_string
63 );
64} 56}
65 57
66#define __raw_spin_unlock_wait(lock) \ 58static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
67 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 59{
60 while (__raw_spin_is_locked(lock))
61 cpu_relax();
62}
68 63
69/* 64/*
70 * Read-write spinlocks, allowing multiple readers 65 * Read-write spinlocks, allowing multiple readers
@@ -78,26 +73,34 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
78 * 73 *
79 * 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
80 * with the high bit (sign) being the "contended" bit. 75 * with the high bit (sign) being the "contended" bit.
81 *
82 * The inline assembly is non-obvious. Think about it.
83 *
84 * Changed to use the same technique as rw semaphores. See
85 * semaphore.h for details. -ben
86 *
87 * the helpers are in arch/i386/kernel/semaphore.c
88 */ 76 */
89 77
90#define __raw_read_can_lock(x) ((int)(x)->lock > 0) 78static inline int __raw_read_can_lock(raw_rwlock_t *lock)
91#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}
92 87
93static inline void __raw_read_lock(raw_rwlock_t *rw) 88static inline void __raw_read_lock(raw_rwlock_t *rw)
94{ 89{
95 __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");
96} 95}
97 96
98static inline void __raw_write_lock(raw_rwlock_t *rw) 97static inline void __raw_write_lock(raw_rwlock_t *rw)
99{ 98{
100 __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");
101} 104}
102 105
103static inline int __raw_read_trylock(raw_rwlock_t *lock) 106static inline int __raw_read_trylock(raw_rwlock_t *lock)
@@ -121,12 +124,12 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
121 124
122static inline void __raw_read_unlock(raw_rwlock_t *rw) 125static inline void __raw_read_unlock(raw_rwlock_t *rw)
123{ 126{
124 asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); 127 asm volatile(LOCK_PREFIX " ; incl %0" :"=m" (rw->lock) : : "memory");
125} 128}
126 129
127static inline void __raw_write_unlock(raw_rwlock_t *rw) 130static inline void __raw_write_unlock(raw_rwlock_t *rw)
128{ 131{
129 asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0" 132 asm volatile(LOCK_PREFIX " ; addl $" RW_LOCK_BIAS_STR ",%0"
130 : "=m" (rw->lock) : : "memory"); 133 : "=m" (rw->lock) : : "memory");
131} 134}
132 135
diff --git a/include/asm-x86_64/stacktrace.h b/include/asm-x86_64/stacktrace.h
new file mode 100644
index 0000000000..5eb9799bef
--- /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/string.h b/include/asm-x86_64/string.h
index ee6bf27534..9505d9f4be 100644
--- a/include/asm-x86_64/string.h
+++ b/include/asm-x86_64/string.h
@@ -6,7 +6,8 @@
6/* Written 2002 by Andi Kleen */ 6/* Written 2002 by Andi Kleen */
7 7
8/* Only used for special circumstances. Stolen from i386/string.h */ 8/* Only used for special circumstances. Stolen from i386/string.h */
9static inline void * __inline_memcpy(void * to, const void * from, size_t n) 9static __always_inline void *
10__inline_memcpy(void * to, const void * from, size_t n)
10{ 11{
11unsigned long d0, d1, d2; 12unsigned long d0, d1, d2;
12__asm__ __volatile__( 13__asm__ __volatile__(
diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h
index 5f9a018058..ba94ab3d26 100644
--- a/include/asm-x86_64/swiotlb.h
+++ b/include/asm-x86_64/swiotlb.h
@@ -42,6 +42,8 @@ extern void swiotlb_free_coherent (struct device *hwdev, size_t size,
42extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); 42extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
43extern void swiotlb_init(void); 43extern void swiotlb_init(void);
44 44
45extern int swiotlb_force;
46
45#ifdef CONFIG_SWIOTLB 47#ifdef CONFIG_SWIOTLB
46extern int swiotlb; 48extern int swiotlb;
47#else 49#else
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index f48e0dad8b..bd376bc8c4 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -3,15 +3,10 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <asm/segment.h> 5#include <asm/segment.h>
6#include <asm/alternative.h>
6 7
7#ifdef __KERNEL__ 8#ifdef __KERNEL__
8 9
9#ifdef CONFIG_SMP
10#define LOCK_PREFIX "lock ; "
11#else
12#define LOCK_PREFIX ""
13#endif
14
15#define __STR(x) #x 10#define __STR(x) #x
16#define STR(x) __STR(x) 11#define STR(x) __STR(x)
17 12
@@ -19,12 +14,13 @@
19#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"
20 15
21/* frame pointer must be last for get_wchan */ 16/* frame pointer must be last for get_wchan */
22#define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" 17#define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"
23#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" 18#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t"
24 19
25#define __EXTRA_CLOBBER \ 20#define __EXTRA_CLOBBER \
26 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" 21 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15"
27 22
23/* Save restore flags to clear handle leaking NT */
28#define switch_to(prev,next,last) \ 24#define switch_to(prev,next,last) \
29 asm volatile(SAVE_CONTEXT \ 25 asm volatile(SAVE_CONTEXT \
30 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ 26 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
@@ -34,7 +30,7 @@
34 "thread_return:\n\t" \ 30 "thread_return:\n\t" \
35 "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ 31 "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \
36 "movq %P[thread_info](%%rsi),%%r8\n\t" \ 32 "movq %P[thread_info](%%rsi),%%r8\n\t" \
37 LOCK "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ 33 LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \
38 "movq %%rax,%%rdi\n\t" \ 34 "movq %%rax,%%rdi\n\t" \
39 "jc ret_from_fork\n\t" \ 35 "jc ret_from_fork\n\t" \
40 RESTORE_CONTEXT \ 36 RESTORE_CONTEXT \
@@ -69,82 +65,6 @@ extern void load_gs_index(unsigned);
69 ".previous" \ 65 ".previous" \
70 : :"r" (value), "r" (0)) 66 : :"r" (value), "r" (0))
71 67
72#ifdef __KERNEL__
73struct alt_instr {
74 __u8 *instr; /* original instruction */
75 __u8 *replacement;
76 __u8 cpuid; /* cpuid bit set for replacement */
77 __u8 instrlen; /* length of original instruction */
78 __u8 replacementlen; /* length of new instruction, <= instrlen */
79 __u8 pad[5];
80};
81#endif
82
83/*
84 * Alternative instructions for different CPU types or capabilities.
85 *
86 * This allows to use optimized instructions even on generic binary
87 * kernels.
88 *
89 * length of oldinstr must be longer or equal the length of newinstr
90 * It can be padded with nops as needed.
91 *
92 * For non barrier like inlines please define new variants
93 * without volatile and memory clobber.
94 */
95#define alternative(oldinstr, newinstr, feature) \
96 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
97 ".section .altinstructions,\"a\"\n" \
98 " .align 8\n" \
99 " .quad 661b\n" /* label */ \
100 " .quad 663f\n" /* new instruction */ \
101 " .byte %c0\n" /* feature bit */ \
102 " .byte 662b-661b\n" /* sourcelen */ \
103 " .byte 664f-663f\n" /* replacementlen */ \
104 ".previous\n" \
105 ".section .altinstr_replacement,\"ax\"\n" \
106 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
107 ".previous" :: "i" (feature) : "memory")
108
109/*
110 * Alternative inline assembly with input.
111 *
112 * Peculiarities:
113 * No memory clobber here.
114 * Argument numbers start with 1.
115 * Best is to use constraints that are fixed size (like (%1) ... "r")
116 * If you use variable sized constraints like "m" or "g" in the
117 * replacement make sure to pad to the worst case length.
118 */
119#define alternative_input(oldinstr, newinstr, feature, input...) \
120 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
121 ".section .altinstructions,\"a\"\n" \
122 " .align 8\n" \
123 " .quad 661b\n" /* label */ \
124 " .quad 663f\n" /* new instruction */ \
125 " .byte %c0\n" /* feature bit */ \
126 " .byte 662b-661b\n" /* sourcelen */ \
127 " .byte 664f-663f\n" /* replacementlen */ \
128 ".previous\n" \
129 ".section .altinstr_replacement,\"ax\"\n" \
130 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
131 ".previous" :: "i" (feature), ##input)
132
133/* Like alternative_input, but with a single output argument */
134#define alternative_io(oldinstr, newinstr, feature, output, input...) \
135 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
136 ".section .altinstructions,\"a\"\n" \
137 " .align 8\n" \
138 " .quad 661b\n" /* label */ \
139 " .quad 663f\n" /* new instruction */ \
140 " .byte %c[feat]\n" /* feature bit */ \
141 " .byte 662b-661b\n" /* sourcelen */ \
142 " .byte 664f-663f\n" /* replacementlen */ \
143 ".previous\n" \
144 ".section .altinstr_replacement,\"ax\"\n" \
145 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
146 ".previous" : output : [feat] "i" (feature), ##input)
147
148/* 68/*
149 * Clear and set 'TS' bit respectively 69 * Clear and set 'TS' bit respectively
150 */ 70 */
@@ -321,50 +241,14 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
321#endif 241#endif
322#define read_barrier_depends() do {} while(0) 242#define read_barrier_depends() do {} while(0)
323#define set_mb(var, value) do { (void) xchg(&var, value); } while (0) 243#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
324#define set_wmb(var, value) do { var = value; wmb(); } while (0)
325 244
326#define warn_if_not_ulong(x) do { unsigned long foo; (void) (&(x) == &foo); } while (0) 245#define warn_if_not_ulong(x) do { unsigned long foo; (void) (&(x) == &foo); } while (0)
327 246
328/* interrupt control.. */ 247#include <linux/irqflags.h>
329#define local_save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0)
330#define local_irq_restore(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc")
331
332#ifdef CONFIG_X86_VSMP
333/* Interrupt control for VSMP architecture */
334#define local_irq_disable() do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags & ~(1 << 9)) | (1 << 18)); } while (0)
335#define local_irq_enable() do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags | (1 << 9)) & ~(1 << 18)); } while (0)
336
337#define irqs_disabled() \
338({ \
339 unsigned long flags; \
340 local_save_flags(flags); \
341 (flags & (1<<18)) || !(flags & (1<<9)); \
342})
343
344/* For spinlocks etc */
345#define local_irq_save(x) do { local_save_flags(x); local_irq_restore((x & ~(1 << 9)) | (1 << 18)); } while (0)
346#else /* CONFIG_X86_VSMP */
347#define local_irq_disable() __asm__ __volatile__("cli": : :"memory")
348#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
349
350#define irqs_disabled() \
351({ \
352 unsigned long flags; \
353 local_save_flags(flags); \
354 !(flags & (1<<9)); \
355})
356
357/* For spinlocks etc */
358#define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0)
359#endif
360
361/* used in the idle loop; sti takes one instruction cycle to complete */
362#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
363/* used when interrupts are already enabled or to shutdown the processor */
364#define halt() __asm__ __volatile__("hlt": : :"memory")
365 248
366void cpu_idle_wait(void); 249void cpu_idle_wait(void);
367 250
368extern unsigned long arch_align_stack(unsigned long sp); 251extern unsigned long arch_align_stack(unsigned long sp);
252extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
369 253
370#endif 254#endif
diff --git a/include/asm-x86_64/tce.h b/include/asm-x86_64/tce.h
new file mode 100644
index 0000000000..dbb047febc
--- /dev/null
+++ b/include/asm-x86_64/tce.h
@@ -0,0 +1,48 @@
1/*
2 * This file is derived from asm-powerpc/tce.h.
3 *
4 * Copyright (C) IBM Corporation, 2006
5 *
6 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
7 * Author: Jon Mason <jdmason@us.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef _ASM_X86_64_TCE_H
25#define _ASM_X86_64_TCE_H
26
27extern unsigned int specified_table_size;
28struct iommu_table;
29
30#define TCE_ENTRY_SIZE 8 /* in bytes */
31
32#define TCE_READ_SHIFT 0
33#define TCE_WRITE_SHIFT 1
34#define TCE_HUBID_SHIFT 2 /* unused */
35#define TCE_RSVD_SHIFT 8 /* unused */
36#define TCE_RPN_SHIFT 12
37#define TCE_UNUSED_SHIFT 48 /* unused */
38
39#define TCE_RPN_MASK 0x0000fffffffff000ULL
40
41extern void tce_build(struct iommu_table *tbl, unsigned long index,
42 unsigned int npages, unsigned long uaddr, int direction);
43extern void tce_free(struct iommu_table *tbl, long index, unsigned int npages);
44extern void* alloc_tce_table(void);
45extern void free_tce_table(void *tbl);
46extern int build_tce_table(struct pci_dev *dev, void __iomem *bbar);
47
48#endif /* _ASM_X86_64_TCE_H */
diff --git a/include/asm-x86_64/therm_throt.h b/include/asm-x86_64/therm_throt.h
new file mode 100644
index 0000000000..5aac059007
--- /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 4ac0e0a369..787a08114b 100644
--- a/include/asm-x86_64/thread_info.h
+++ b/include/asm-x86_64/thread_info.h
@@ -73,8 +73,21 @@ static inline struct thread_info *stack_thread_info(void)
73} 73}
74 74
75/* thread information allocation */ 75/* thread information allocation */
76#ifdef CONFIG_DEBUG_STACK_USAGE
77#define alloc_thread_info(tsk) \
78 ({ \
79 struct thread_info *ret; \
80 \
81 ret = ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)); \
82 if (ret) \
83 memset(ret, 0, THREAD_SIZE); \
84 ret; \
85 })
86#else
76#define alloc_thread_info(tsk) \ 87#define alloc_thread_info(tsk) \
77 ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)) 88 ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
89#endif
90
78#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) 91#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
79 92
80#else /* !__ASSEMBLY__ */ 93#else /* !__ASSEMBLY__ */
@@ -101,11 +114,14 @@ static inline struct thread_info *stack_thread_info(void)
101#define TIF_IRET 5 /* force IRET */ 114#define TIF_IRET 5 /* force IRET */
102#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 115#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
103#define TIF_SECCOMP 8 /* secure computing */ 116#define TIF_SECCOMP 8 /* secure computing */
104#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
118/* 16 free */
105#define TIF_IA32 17 /* 32bit process */ 119#define TIF_IA32 17 /* 32bit process */
106#define TIF_FORK 18 /* ret_from_fork */ 120#define TIF_FORK 18 /* ret_from_fork */
107#define TIF_ABI_PENDING 19 121#define TIF_ABI_PENDING 19
108#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 */
109 125
110#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 126#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
111#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 127#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -115,10 +131,12 @@ static inline struct thread_info *stack_thread_info(void)
115#define _TIF_IRET (1<<TIF_IRET) 131#define _TIF_IRET (1<<TIF_IRET)
116#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 132#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
117#define _TIF_SECCOMP (1<<TIF_SECCOMP) 133#define _TIF_SECCOMP (1<<TIF_SECCOMP)
118#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 134#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
119#define _TIF_IA32 (1<<TIF_IA32) 135#define _TIF_IA32 (1<<TIF_IA32)
120#define _TIF_FORK (1<<TIF_FORK) 136#define _TIF_FORK (1<<TIF_FORK)
121#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)
122 140
123/* work to do on interrupt/exception return */ 141/* work to do on interrupt/exception return */
124#define _TIF_WORK_MASK \ 142#define _TIF_WORK_MASK \
@@ -126,6 +144,9 @@ static inline struct thread_info *stack_thread_info(void)
126/* work to do on any return to user space */ 144/* work to do on any return to user space */
127#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 145#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
128 146
147/* flags to check in __switch_to() */
148#define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP)
149
129#define PREEMPT_ACTIVE 0x10000000 150#define PREEMPT_ACTIVE 0x10000000
130 151
131/* 152/*
@@ -137,6 +158,9 @@ static inline struct thread_info *stack_thread_info(void)
137 */ 158 */
138#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ 159#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
139#define TS_COMPAT 0x0002 /* 32bit syscall active */ 160#define TS_COMPAT 0x0002 /* 32bit syscall active */
161#define TS_POLLING 0x0004 /* true if in idle loop and not sleeping */
162
163#define tsk_is_polling(t) ((t)->thread_info->status & TS_POLLING)
140 164
141#endif /* __KERNEL__ */ 165#endif /* __KERNEL__ */
142 166
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
index d16d5b60f4..983bd296c8 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 80c4e44d01..6e7a2e976b 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -7,8 +7,6 @@
7#include <asm/mpspec.h> 7#include <asm/mpspec.h>
8#include <asm/bitops.h> 8#include <asm/bitops.h>
9 9
10/* Map the K8 CPU local memory controllers to a simple 1:1 CPU:NODE topology */
11
12extern cpumask_t cpu_online_map; 10extern cpumask_t cpu_online_map;
13 11
14extern unsigned char cpu_to_node[]; 12extern unsigned char cpu_to_node[];
@@ -57,12 +55,12 @@ extern int __node_distance(int, int);
57#endif 55#endif
58 56
59#ifdef CONFIG_SMP 57#ifdef CONFIG_SMP
60#define topology_physical_package_id(cpu) \ 58#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id)
61 (phys_proc_id[cpu] == BAD_APICID ? -1 : phys_proc_id[cpu]) 59#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id)
62#define topology_core_id(cpu) \
63 (cpu_core_id[cpu] == BAD_APICID ? 0 : cpu_core_id[cpu])
64#define topology_core_siblings(cpu) (cpu_core_map[cpu]) 60#define topology_core_siblings(cpu) (cpu_core_map[cpu])
65#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) 61#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
62#define mc_capable() (boot_cpu_data.x86_max_cores > 1)
63#define smt_capable() (smp_num_siblings > 1)
66#endif 64#endif
67 65
68#include <asm-generic/topology.h> 66#include <asm-generic/topology.h>
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 1e1fa003da..19f99178fe 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 94387c915e..6137146516 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
@@ -623,16 +623,17 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
623#ifdef __KERNEL__ 623#ifdef __KERNEL__
624 624
625#define __NR_syscall_max __NR_move_pages 625#define __NR_syscall_max __NR_move_pages
626#include <linux/err.h>
626 627
627#ifndef __NO_STUBS 628#ifndef __NO_STUBS
628 629
629/* user-visible error numbers are in the range -1 - -4095 */ 630/* user-visible error numbers are in the range -1 - -MAX_ERRNO */
630 631
631#define __syscall_clobber "r11","rcx","memory" 632#define __syscall_clobber "r11","rcx","memory"
632 633
633#define __syscall_return(type, res) \ 634#define __syscall_return(type, res) \
634do { \ 635do { \
635 if ((unsigned long)(res) >= (unsigned long)(-127)) { \ 636 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
636 errno = -(res); \ 637 errno = -(res); \
637 res = -1; \ 638 res = -1; \
638 } \ 639 } \
@@ -658,6 +659,7 @@ do { \
658#define __ARCH_WANT_SYS_SIGPENDING 659#define __ARCH_WANT_SYS_SIGPENDING
659#define __ARCH_WANT_SYS_SIGPROCMASK 660#define __ARCH_WANT_SYS_SIGPROCMASK
660#define __ARCH_WANT_SYS_RT_SIGACTION 661#define __ARCH_WANT_SYS_RT_SIGACTION
662#define __ARCH_WANT_SYS_RT_SIGSUSPEND
661#define __ARCH_WANT_SYS_TIME 663#define __ARCH_WANT_SYS_TIME
662#define __ARCH_WANT_COMPAT_SYS_TIME 664#define __ARCH_WANT_COMPAT_SYS_TIME
663 665
@@ -821,8 +823,6 @@ asmlinkage long sys_fork(struct pt_regs regs);
821asmlinkage long sys_vfork(struct pt_regs regs); 823asmlinkage long sys_vfork(struct pt_regs regs);
822asmlinkage long sys_pipe(int *fildes); 824asmlinkage long sys_pipe(int *fildes);
823 825
824#endif /* __KERNEL_SYSCALLS__ */
825
826#ifndef __ASSEMBLY__ 826#ifndef __ASSEMBLY__
827 827
828#include <linux/linkage.h> 828#include <linux/linkage.h>
@@ -838,9 +838,9 @@ asmlinkage long sys_rt_sigaction(int sig,
838 struct sigaction __user *oact, 838 struct sigaction __user *oact,
839 size_t sigsetsize); 839 size_t sigsetsize);
840 840
841#endif /* __ASSEMBLY__ */ 841#endif /* __ASSEMBLY__ */
842 842
843#endif /* __NO_STUBS */ 843#endif /* __KERNEL_SYSCALLS__ */
844 844
845/* 845/*
846 * "Conditional" syscalls 846 * "Conditional" syscalls
@@ -850,5 +850,8 @@ asmlinkage long sys_rt_sigaction(int sig,
850 */ 850 */
851#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 851#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
852 852
853#endif /* __NO_STUBS */
854
853#endif /* __KERNEL__ */ 855#endif /* __KERNEL__ */
854#endif 856
857#endif /* _ASM_X86_64_UNISTD_H_ */
diff --git a/include/asm-x86_64/unwind.h b/include/asm-x86_64/unwind.h
new file mode 100644
index 0000000000..2e7ff10fd7
--- /dev/null
+++ b/include/asm-x86_64/unwind.h
@@ -0,0 +1,112 @@
1#ifndef _ASM_X86_64_UNWIND_H
2#define _ASM_X86_64_UNWIND_H
3
4/*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
8 */
9
10#ifdef CONFIG_STACK_UNWIND
11
12#include <linux/sched.h>
13#include <asm/ptrace.h>
14#include <asm/uaccess.h>
15#include <asm/vsyscall.h>
16
17struct unwind_frame_info
18{
19 struct pt_regs regs;
20 struct task_struct *task;
21 unsigned call_frame:1;
22};
23
24#define UNW_PC(frame) (frame)->regs.rip
25#define UNW_SP(frame) (frame)->regs.rsp
26#ifdef CONFIG_FRAME_POINTER
27#define UNW_FP(frame) (frame)->regs.rbp
28#define FRAME_RETADDR_OFFSET 8
29#define FRAME_LINK_OFFSET 0
30#define STACK_BOTTOM(tsk) (((tsk)->thread.rsp0 - 1) & ~(THREAD_SIZE - 1))
31#define STACK_TOP(tsk) ((tsk)->thread.rsp0)
32#endif
33/* Might need to account for the special exception and interrupt handling
34 stacks here, since normally
35 EXCEPTION_STACK_ORDER < THREAD_ORDER < IRQSTACK_ORDER,
36 but the construct is needed only for getting across the stack switch to
37 the interrupt stack - thus considering the IRQ stack itself is unnecessary,
38 and the overhead of comparing against all exception handling stacks seems
39 not desirable. */
40#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
41
42#define UNW_REGISTER_INFO \
43 PTREGS_INFO(rax), \
44 PTREGS_INFO(rdx), \
45 PTREGS_INFO(rcx), \
46 PTREGS_INFO(rbx), \
47 PTREGS_INFO(rsi), \
48 PTREGS_INFO(rdi), \
49 PTREGS_INFO(rbp), \
50 PTREGS_INFO(rsp), \
51 PTREGS_INFO(r8), \
52 PTREGS_INFO(r9), \
53 PTREGS_INFO(r10), \
54 PTREGS_INFO(r11), \
55 PTREGS_INFO(r12), \
56 PTREGS_INFO(r13), \
57 PTREGS_INFO(r14), \
58 PTREGS_INFO(r15), \
59 PTREGS_INFO(rip)
60
61#define UNW_DEFAULT_RA(raItem, dataAlign) \
62 ((raItem).where == Memory && \
63 !((raItem).value * (dataAlign) + 8))
64
65static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
66 /*const*/ struct pt_regs *regs)
67{
68 info->regs = *regs;
69}
70
71static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
72{
73 extern const char thread_return[];
74
75 memset(&info->regs, 0, sizeof(info->regs));
76 info->regs.rip = (unsigned long)thread_return;
77 info->regs.cs = __KERNEL_CS;
78 __get_user(info->regs.rbp, (unsigned long *)info->task->thread.rsp);
79 info->regs.rsp = info->task->thread.rsp;
80 info->regs.ss = __KERNEL_DS;
81}
82
83extern int arch_unwind_init_running(struct unwind_frame_info *,
84 int (*callback)(struct unwind_frame_info *,
85 void *arg),
86 void *arg);
87
88static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
89{
90#if 0 /* This can only work when selector register saves/restores
91 are properly annotated (and tracked in UNW_REGISTER_INFO). */
92 return user_mode(&info->regs);
93#else
94 return (long)info->regs.rip >= 0
95 || (info->regs.rip >= VSYSCALL_START && info->regs.rip < VSYSCALL_END)
96 || (long)info->regs.rsp >= 0;
97#endif
98}
99
100#else
101
102#define UNW_PC(frame) ((void)(frame), 0UL)
103#define UNW_SP(frame) ((void)(frame), 0UL)
104
105static inline int arch_unw_user_mode(const void *info)
106{
107 return 0;
108}
109
110#endif
111
112#endif /* _ASM_X86_64_UNWIND_H */
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index a85e16f56d..2281e9399b 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -1,11 +1,10 @@
1#ifndef _ASM_X86_64_VSYSCALL_H_ 1#ifndef _ASM_X86_64_VSYSCALL_H_
2#define _ASM_X86_64_VSYSCALL_H_ 2#define _ASM_X86_64_VSYSCALL_H_
3 3
4#include <linux/seqlock.h>
5
6enum vsyscall_num { 4enum vsyscall_num {
7 __NR_vgettimeofday, 5 __NR_vgettimeofday,
8 __NR_vtime, 6 __NR_vtime,
7 __NR_vgetcpu,
9}; 8};
10 9
11#define VSYSCALL_START (-10UL << 20) 10#define VSYSCALL_START (-10UL << 20)
@@ -14,8 +13,10 @@ enum vsyscall_num {
14#define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr)) 13#define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
15 14
16#ifdef __KERNEL__ 15#ifdef __KERNEL__
16#include <linux/seqlock.h>
17 17
18#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) 18#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
19#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))
19#define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) 20#define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16)))
20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) 21#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
21#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) 22#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
@@ -27,6 +28,9 @@ enum vsyscall_num {
27#define VXTIME_HPET 2 28#define VXTIME_HPET 2
28#define VXTIME_PMTMR 3 29#define VXTIME_PMTMR 3
29 30
31#define VGETCPU_RDTSCP 1
32#define VGETCPU_LSL 2
33
30struct vxtime_data { 34struct vxtime_data {
31 long hpet_address; /* HPET base address */ 35 long hpet_address; /* HPET base address */
32 int last; 36 int last;
@@ -41,6 +45,7 @@ struct vxtime_data {
41 45
42/* vsyscall space (readonly) */ 46/* vsyscall space (readonly) */
43extern struct vxtime_data __vxtime; 47extern struct vxtime_data __vxtime;
48extern int __vgetcpu_mode;
44extern struct timespec __xtime; 49extern struct timespec __xtime;
45extern volatile unsigned long __jiffies; 50extern volatile unsigned long __jiffies;
46extern unsigned long __wall_jiffies; 51extern unsigned long __wall_jiffies;
@@ -49,6 +54,7 @@ extern seqlock_t __xtime_lock;
49 54
50/* kernel space (writeable) */ 55/* kernel space (writeable) */
51extern struct vxtime_data vxtime; 56extern struct vxtime_data vxtime;
57extern int vgetcpu_mode;
52extern unsigned long wall_jiffies; 58extern unsigned long wall_jiffies;
53extern struct timezone sys_tz; 59extern struct timezone sys_tz;
54extern int sysctl_vsyscall; 60extern int sysctl_vsyscall;
@@ -56,6 +62,8 @@ extern seqlock_t xtime_lock;
56 62
57extern int sysctl_vsyscall; 63extern int sysctl_vsyscall;
58 64
65extern void vsyscall_set_cpu(int cpu);
66
59#define ARCH_HAVE_XTIME_LOCK 1 67#define ARCH_HAVE_XTIME_LOCK 1
60 68
61#endif /* __KERNEL__ */ 69#endif /* __KERNEL__ */
diff --git a/include/asm-xtensa/Kbuild b/include/asm-xtensa/Kbuild
new file mode 100644
index 0000000000..c68e1680da
--- /dev/null
+++ b/include/asm-xtensa/Kbuild
@@ -0,0 +1 @@
include include/asm-generic/Kbuild.asm
diff --git a/include/asm-xtensa/hw_irq.h b/include/asm-xtensa/hw_irq.h
index ccf436249e..3ddbea759b 100644
--- a/include/asm-xtensa/hw_irq.h
+++ b/include/asm-xtensa/hw_irq.h
@@ -11,8 +11,4 @@
11#ifndef _XTENSA_HW_IRQ_H 11#ifndef _XTENSA_HW_IRQ_H
12#define _XTENSA_HW_IRQ_H 12#define _XTENSA_HW_IRQ_H
13 13
14static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
15{
16}
17
18#endif 14#endif
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index 7b15afb70c..a47cc734c2 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -218,7 +218,7 @@ extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)];
218/* 218/*
219 * The pmd contains the kernel virtual address of the pte page. 219 * The pmd contains the kernel virtual address of the pte page.
220 */ 220 */
221#define pmd_page_kernel(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) 221#define pmd_page_vaddr(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK))
222#define pmd_page(pmd) virt_to_page(pmd_val(pmd)) 222#define pmd_page(pmd) virt_to_page(pmd_val(pmd))
223 223
224/* 224/*
@@ -349,7 +349,7 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
349/* Find an entry in the third-level page table.. */ 349/* Find an entry in the third-level page table.. */
350#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 350#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
351#define pte_offset_kernel(dir,addr) \ 351#define pte_offset_kernel(dir,addr) \
352 ((pte_t*) pmd_page_kernel(*(dir)) + pte_index(addr)) 352 ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr))
353#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) 353#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr))
354#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) 354#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr))
355 355
diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h
index d1d72ad36f..8b96e77c9d 100644
--- a/include/asm-xtensa/processor.h
+++ b/include/asm-xtensa/processor.h
@@ -20,6 +20,7 @@
20#include <xtensa/config/tie.h> 20#include <xtensa/config/tie.h>
21#include <xtensa/config/system.h> 21#include <xtensa/config/system.h>
22 22
23#include <linux/compiler.h>
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
24#include <asm/types.h> 25#include <asm/types.h>
25#include <asm/coprocessor.h> 26#include <asm/coprocessor.h>
@@ -191,7 +192,7 @@ extern unsigned long get_wchan(struct task_struct *p);
191#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) 192#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
192#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1]) 193#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
193 194
194#define cpu_relax() do { } while (0) 195#define cpu_relax() barrier()
195 196
196/* Special register access. */ 197/* Special register access. */
197 198
diff --git a/include/asm-xtensa/rwsem.h b/include/asm-xtensa/rwsem.h
index abcd86dc5a..0aad3a5875 100644
--- a/include/asm-xtensa/rwsem.h
+++ b/include/asm-xtensa/rwsem.h
@@ -31,24 +31,11 @@ struct rw_semaphore {
31#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 31#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
32 spinlock_t wait_lock; 32 spinlock_t wait_lock;
33 struct list_head wait_list; 33 struct list_head wait_list;
34#if RWSEM_DEBUG
35 int debug;
36#endif
37}; 34};
38 35
39/*
40 * initialisation
41 */
42#if RWSEM_DEBUG
43#define __RWSEM_DEBUG_INIT , 0
44#else
45#define __RWSEM_DEBUG_INIT /* */
46#endif
47
48#define __RWSEM_INITIALIZER(name) \ 36#define __RWSEM_INITIALIZER(name) \
49 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 37 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
50 LIST_HEAD_INIT((name).wait_list) \ 38 LIST_HEAD_INIT((name).wait_list) }
51 __RWSEM_DEBUG_INIT }
52 39
53#define DECLARE_RWSEM(name) \ 40#define DECLARE_RWSEM(name) \
54 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 41 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -63,9 +50,6 @@ static inline void init_rwsem(struct rw_semaphore *sem)
63 sem->count = RWSEM_UNLOCKED_VALUE; 50 sem->count = RWSEM_UNLOCKED_VALUE;
64 spin_lock_init(&sem->wait_lock); 51 spin_lock_init(&sem->wait_lock);
65 INIT_LIST_HEAD(&sem->wait_list); 52 INIT_LIST_HEAD(&sem->wait_list);
66#if RWSEM_DEBUG
67 sem->debug = 0;
68#endif
69} 53}
70 54
71/* 55/*
diff --git a/include/asm-xtensa/signal.h b/include/asm-xtensa/signal.h
index a99c9aec64..633ba73bc4 100644
--- a/include/asm-xtensa/signal.h
+++ b/include/asm-xtensa/signal.h
@@ -75,7 +75,6 @@ typedef struct {
75 * SA_FLAGS values: 75 * SA_FLAGS values:
76 * 76 *
77 * SA_ONSTACK indicates that a registered stack_t will be used. 77 * SA_ONSTACK indicates that a registered stack_t will be used.
78 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
79 * SA_RESTART flag to get restarting signals (which were the default long ago) 78 * SA_RESTART flag to get restarting signals (which were the default long ago)
80 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
81 * SA_RESETHAND clears the handler when the signal is delivered. 80 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -95,7 +94,6 @@ typedef struct {
95 94
96#define SA_NOMASK SA_NODEFER 95#define SA_NOMASK SA_NODEFER
97#define SA_ONESHOT SA_RESETHAND 96#define SA_ONESHOT SA_RESETHAND
98#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
99 97
100#define SA_RESTORER 0x04000000 98#define SA_RESTORER 0x04000000
101 99
@@ -109,19 +107,6 @@ typedef struct {
109#define SIGSTKSZ 8192 107#define SIGSTKSZ 8192
110 108
111#ifndef __ASSEMBLY__ 109#ifndef __ASSEMBLY__
112#ifdef __KERNEL__
113
114/*
115 * These values of sa_flags are used only by the kernel as part of the
116 * irq handling routines.
117 *
118 * SA_INTERRUPT is also used by the irq handling routines.
119 * SA_SHIRQ is for shared interrupt support on PCI and EISA.
120 */
121#define SA_SAMPLE_RANDOM SA_RESTART
122#define SA_SHIRQ 0x04000000
123#define SA_PROBEIRQ 0x08000000
124#endif
125 110
126#define SIG_BLOCK 0 /* for blocking signals */ 111#define SIG_BLOCK 0 /* for blocking signals */
127#define SIG_UNBLOCK 1 /* for unblocking signals */ 112#define SIG_UNBLOCK 1 /* for unblocking signals */
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index 00f83f3a6d..971d231be6 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -59,5 +59,6 @@
59 59
60#define SO_ACCEPTCONN 30 60#define SO_ACCEPTCONN 30
61#define SO_PEERSEC 31 61#define SO_PEERSEC 31
62#define SO_PASSSEC 34
62 63
63#endif /* _XTENSA_SOCKET_H */ 64#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
index f986170bd2..932bda92a2 100644
--- a/include/asm-xtensa/system.h
+++ b/include/asm-xtensa/system.h
@@ -99,7 +99,6 @@ static inline void disable_coprocessor(int i)
99#endif 99#endif
100 100
101#define set_mb(var, value) do { var = value; mb(); } while (0) 101#define set_mb(var, value) do { var = value; mb(); } while (0)
102#define set_wmb(var, value) do { var = value; wmb(); } while (0)
103 102
104#if !defined (__ASSEMBLY__) 103#if !defined (__ASSEMBLY__)
105 104
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
new file mode 100644
index 0000000000..5748aecdb4
--- /dev/null
+++ b/include/crypto/algapi.h
@@ -0,0 +1,156 @@
1/*
2 * Cryptographic API for algorithms (i.e., low-level API).
3 *
4 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12#ifndef _CRYPTO_ALGAPI_H
13#define _CRYPTO_ALGAPI_H
14
15#include <linux/crypto.h>
16
17struct module;
18struct seq_file;
19
20struct crypto_type {
21 unsigned int (*ctxsize)(struct crypto_alg *alg);
22 int (*init)(struct crypto_tfm *tfm);
23 void (*exit)(struct crypto_tfm *tfm);
24 void (*show)(struct seq_file *m, struct crypto_alg *alg);
25};
26
27struct crypto_instance {
28 struct crypto_alg alg;
29
30 struct crypto_template *tmpl;
31 struct hlist_node list;
32
33 void *__ctx[] CRYPTO_MINALIGN_ATTR;
34};
35
36struct crypto_template {
37 struct list_head list;
38 struct hlist_head instances;
39 struct module *module;
40
41 struct crypto_instance *(*alloc)(void *param, unsigned int len);
42 void (*free)(struct crypto_instance *inst);
43
44 char name[CRYPTO_MAX_ALG_NAME];
45};
46
47struct crypto_spawn {
48 struct list_head list;
49 struct crypto_alg *alg;
50 struct crypto_instance *inst;
51};
52
53struct scatter_walk {
54 struct scatterlist *sg;
55 unsigned int offset;
56};
57
58struct blkcipher_walk {
59 union {
60 struct {
61 struct page *page;
62 unsigned long offset;
63 } phys;
64
65 struct {
66 u8 *page;
67 u8 *addr;
68 } virt;
69 } src, dst;
70
71 struct scatter_walk in;
72 unsigned int nbytes;
73
74 struct scatter_walk out;
75 unsigned int total;
76
77 void *page;
78 u8 *buffer;
79 u8 *iv;
80
81 int flags;
82};
83
84extern const struct crypto_type crypto_blkcipher_type;
85extern const struct crypto_type crypto_hash_type;
86
87void crypto_mod_put(struct crypto_alg *alg);
88
89int crypto_register_template(struct crypto_template *tmpl);
90void crypto_unregister_template(struct crypto_template *tmpl);
91struct crypto_template *crypto_lookup_template(const char *name);
92
93int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
94 struct crypto_instance *inst);
95void crypto_drop_spawn(struct crypto_spawn *spawn);
96struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn);
97
98struct crypto_alg *crypto_get_attr_alg(void *param, unsigned int len,
99 u32 type, u32 mask);
100struct crypto_instance *crypto_alloc_instance(const char *name,
101 struct crypto_alg *alg);
102
103int blkcipher_walk_done(struct blkcipher_desc *desc,
104 struct blkcipher_walk *walk, int err);
105int blkcipher_walk_virt(struct blkcipher_desc *desc,
106 struct blkcipher_walk *walk);
107int blkcipher_walk_phys(struct blkcipher_desc *desc,
108 struct blkcipher_walk *walk);
109
110static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
111{
112 unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm);
113 unsigned long align = crypto_tfm_alg_alignmask(tfm);
114
115 if (align <= crypto_tfm_ctx_alignment())
116 align = 1;
117 return (void *)ALIGN(addr, align);
118}
119
120static inline void *crypto_instance_ctx(struct crypto_instance *inst)
121{
122 return inst->__ctx;
123}
124
125static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm)
126{
127 return crypto_tfm_ctx(&tfm->base);
128}
129
130static inline void *crypto_blkcipher_ctx_aligned(struct crypto_blkcipher *tfm)
131{
132 return crypto_tfm_ctx_aligned(&tfm->base);
133}
134
135static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm)
136{
137 return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher;
138}
139
140static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm)
141{
142 return crypto_tfm_ctx_aligned(&tfm->base);
143}
144
145static inline void blkcipher_walk_init(struct blkcipher_walk *walk,
146 struct scatterlist *dst,
147 struct scatterlist *src,
148 unsigned int nbytes)
149{
150 walk->in.sg = src;
151 walk->out.sg = dst;
152 walk->total = nbytes;
153}
154
155#endif /* _CRYPTO_ALGAPI_H */
156
diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h
new file mode 100644
index 0000000000..c408522595
--- /dev/null
+++ b/include/crypto/twofish.h
@@ -0,0 +1,22 @@
1#ifndef _CRYPTO_TWOFISH_H
2#define _CRYPTO_TWOFISH_H
3
4#include <linux/types.h>
5
6#define TF_MIN_KEY_SIZE 16
7#define TF_MAX_KEY_SIZE 32
8#define TF_BLOCK_SIZE 16
9
10struct crypto_tfm;
11
12/* Structure for an expanded Twofish key. s contains the key-dependent
13 * S-boxes composed with the MDS matrix; w contains the eight "whitening"
14 * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note
15 * that k[i] corresponds to what the Twofish paper calls K[i+8]. */
16struct twofish_ctx {
17 u32 s[4][256], w[8], k[32];
18};
19
20int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len);
21
22#endif
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index a3dae1803f..c37c34275a 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -37,6 +37,7 @@ extern struct key_type key_type_user;
37extern int user_instantiate(struct key *key, const void *data, size_t datalen); 37extern int user_instantiate(struct key *key, const void *data, size_t datalen);
38extern int user_update(struct key *key, const void *data, size_t datalen); 38extern int user_update(struct key *key, const void *data, size_t datalen);
39extern int user_match(const struct key *key, const void *criterion); 39extern int user_match(const struct key *key, const void *criterion);
40extern void user_revoke(struct key *key);
40extern void user_destroy(struct key *key); 41extern void user_destroy(struct key *key);
41extern void user_describe(const struct key *user, struct seq_file *m); 42extern void user_describe(const struct key *user, struct seq_file *m);
42extern long user_read(const struct key *key, 43extern long user_read(const struct key *key,
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
new file mode 100644
index 0000000000..f7a52e19b4
--- /dev/null
+++ b/include/linux/Kbuild
@@ -0,0 +1,344 @@
1header-y += byteorder/
2header-y += dvb/
3header-y += hdlc/
4header-y += isdn/
5header-y += nfsd/
6header-y += raid/
7header-y += sunrpc/
8header-y += tc_act/
9header-y += netfilter/
10header-y += netfilter_arp/
11header-y += netfilter_bridge/
12header-y += netfilter_ipv4/
13header-y += netfilter_ipv6/
14
15header-y += affs_hardblocks.h
16header-y += aio_abi.h
17header-y += a.out.h
18header-y += arcfb.h
19header-y += atmapi.h
20header-y += atmbr2684.h
21header-y += atmclip.h
22header-y += atm_eni.h
23header-y += atm_he.h
24header-y += atm_idt77105.h
25header-y += atmioc.h
26header-y += atmlec.h
27header-y += atmmpc.h
28header-y += atm_nicstar.h
29header-y += atmppp.h
30header-y += atmsap.h
31header-y += atmsvc.h
32header-y += atm_zatm.h
33header-y += auto_fs4.h
34header-y += auxvec.h
35header-y += awe_voice.h
36header-y += ax25.h
37header-y += b1lli.h
38header-y += baycom.h
39header-y += bfs_fs.h
40header-y += blkpg.h
41header-y += bpqether.h
42header-y += cdk.h
43header-y += chio.h
44header-y += coda_psdev.h
45header-y += coff.h
46header-y += comstats.h
47header-y += consolemap.h
48header-y += cycx_cfm.h
49header-y += dm-ioctl.h
50header-y += dn.h
51header-y += dqblk_v1.h
52header-y += dqblk_v2.h
53header-y += dqblk_xfs.h
54header-y += efs_fs_sb.h
55header-y += elf-fdpic.h
56header-y += elf.h
57header-y += elf-em.h
58header-y += fadvise.h
59header-y += fd.h
60header-y += fdreg.h
61header-y += fib_rules.h
62header-y += ftape-header-segment.h
63header-y += ftape-vendors.h
64header-y += fuse.h
65header-y += futex.h
66header-y += genetlink.h
67header-y += gen_stats.h
68header-y += gigaset_dev.h
69header-y += hdsmart.h
70header-y += hysdn_if.h
71header-y += i2c-dev.h
72header-y += i8k.h
73header-y += icmp.h
74header-y += if_addr.h
75header-y += if_arcnet.h
76header-y += if_arp.h
77header-y += if_bonding.h
78header-y += if_cablemodem.h
79header-y += if_fc.h
80header-y += if_fddi.h
81header-y += if.h
82header-y += if_hippi.h
83header-y += if_infiniband.h
84header-y += if_link.h
85header-y += if_packet.h
86header-y += if_plip.h
87header-y += if_ppp.h
88header-y += if_slip.h
89header-y += if_strip.h
90header-y += if_tunnel.h
91header-y += in6.h
92header-y += in_route.h
93header-y += ioctl.h
94header-y += ip.h
95header-y += ipmi_msgdefs.h
96header-y += ip_mp_alg.h
97header-y += ipsec.h
98header-y += ipx.h
99header-y += irda.h
100header-y += isdn_divertif.h
101header-y += iso_fs.h
102header-y += ite_gpio.h
103header-y += ixjuser.h
104header-y += jffs2.h
105header-y += keyctl.h
106header-y += limits.h
107header-y += magic.h
108header-y += major.h
109header-y += matroxfb.h
110header-y += meye.h
111header-y += minix_fs.h
112header-y += mmtimer.h
113header-y += mqueue.h
114header-y += mtio.h
115header-y += ncp_no.h
116header-y += neighbour.h
117header-y += netfilter_arp.h
118header-y += netrom.h
119header-y += nfs2.h
120header-y += nfs4_mount.h
121header-y += nfs_mount.h
122header-y += param.h
123header-y += pci_ids.h
124header-y += pci_regs.h
125header-y += personality.h
126header-y += pfkeyv2.h
127header-y += pg.h
128header-y += pkt_cls.h
129header-y += pkt_sched.h
130header-y += posix_types.h
131header-y += ppdev.h
132header-y += prctl.h
133header-y += ps2esdi.h
134header-y += qic117.h
135header-y += qnxtypes.h
136header-y += quotaio_v1.h
137header-y += quotaio_v2.h
138header-y += radeonfb.h
139header-y += raw.h
140header-y += resource.h
141header-y += rose.h
142header-y += sctp.h
143header-y += smbno.h
144header-y += snmp.h
145header-y += sockios.h
146header-y += som.h
147header-y += sound.h
148header-y += synclink.h
149header-y += telephony.h
150header-y += termios.h
151header-y += ticable.h
152header-y += times.h
153header-y += tiocl.h
154header-y += tipc.h
155header-y += toshiba.h
156header-y += ultrasound.h
157header-y += un.h
158header-y += utime.h
159header-y += utsname.h
160header-y += video_decoder.h
161header-y += video_encoder.h
162header-y += videotext.h
163header-y += vt.h
164header-y += wavefront.h
165header-y += wireless.h
166header-y += xattr.h
167header-y += x25.h
168header-y += zorro_ids.h
169
170unifdef-y += acct.h
171unifdef-y += adb.h
172unifdef-y += adfs_fs.h
173unifdef-y += agpgart.h
174unifdef-y += apm_bios.h
175unifdef-y += atalk.h
176unifdef-y += atmarp.h
177unifdef-y += atmdev.h
178unifdef-y += atm.h
179unifdef-y += atm_tcp.h
180unifdef-y += audit.h
181unifdef-y += auto_fs.h
182unifdef-y += binfmts.h
183unifdef-y += capability.h
184unifdef-y += capi.h
185unifdef-y += cciss_ioctl.h
186unifdef-y += cdrom.h
187unifdef-y += cm4000_cs.h
188unifdef-y += cn_proc.h
189unifdef-y += coda.h
190unifdef-y += connector.h
191unifdef-y += cramfs_fs.h
192unifdef-y += cuda.h
193unifdef-y += cyclades.h
194unifdef-y += dccp.h
195unifdef-y += dirent.h
196unifdef-y += divert.h
197unifdef-y += elfcore.h
198unifdef-y += errno.h
199unifdef-y += errqueue.h
200unifdef-y += ethtool.h
201unifdef-y += eventpoll.h
202unifdef-y += ext2_fs.h
203unifdef-y += ext3_fs.h
204unifdef-y += fb.h
205unifdef-y += fcntl.h
206unifdef-y += filter.h
207unifdef-y += flat.h
208unifdef-y += fs.h
209unifdef-y += ftape.h
210unifdef-y += gameport.h
211unifdef-y += generic_serial.h
212unifdef-y += genhd.h
213unifdef-y += hayesesp.h
214unifdef-y += hdlcdrv.h
215unifdef-y += hdlc.h
216unifdef-y += hdreg.h
217unifdef-y += hiddev.h
218unifdef-y += hpet.h
219unifdef-y += i2c.h
220unifdef-y += i2o-dev.h
221unifdef-y += icmpv6.h
222unifdef-y += if_bridge.h
223unifdef-y += if_ec.h
224unifdef-y += if_eql.h
225unifdef-y += if_ether.h
226unifdef-y += if_frad.h
227unifdef-y += if_ltalk.h
228unifdef-y += if_pppox.h
229unifdef-y += if_shaper.h
230unifdef-y += if_tr.h
231unifdef-y += if_tun.h
232unifdef-y += if_vlan.h
233unifdef-y += if_wanpipe.h
234unifdef-y += igmp.h
235unifdef-y += inet_diag.h
236unifdef-y += in.h
237unifdef-y += inotify.h
238unifdef-y += input.h
239unifdef-y += ipc.h
240unifdef-y += ipmi.h
241unifdef-y += ipv6.h
242unifdef-y += ipv6_route.h
243unifdef-y += isdn.h
244unifdef-y += isdnif.h
245unifdef-y += isdn_ppp.h
246unifdef-y += isicom.h
247unifdef-y += jbd.h
248unifdef-y += joystick.h
249unifdef-y += kdev_t.h
250unifdef-y += kd.h
251unifdef-y += kernelcapi.h
252unifdef-y += kernel.h
253unifdef-y += keyboard.h
254unifdef-y += llc.h
255unifdef-y += loop.h
256unifdef-y += lp.h
257unifdef-y += mempolicy.h
258unifdef-y += mii.h
259unifdef-y += mman.h
260unifdef-y += mroute.h
261unifdef-y += msdos_fs.h
262unifdef-y += msg.h
263unifdef-y += nbd.h
264unifdef-y += ncp_fs.h
265unifdef-y += ncp.h
266unifdef-y += ncp_mount.h
267unifdef-y += netdevice.h
268unifdef-y += netfilter_bridge.h
269unifdef-y += netfilter_decnet.h
270unifdef-y += netfilter.h
271unifdef-y += netfilter_ipv4.h
272unifdef-y += netfilter_ipv6.h
273unifdef-y += net.h
274unifdef-y += netlink.h
275unifdef-y += nfs3.h
276unifdef-y += nfs4.h
277unifdef-y += nfsacl.h
278unifdef-y += nfs_fs.h
279unifdef-y += nfs.h
280unifdef-y += nfs_idmap.h
281unifdef-y += n_r3964.h
282unifdef-y += nubus.h
283unifdef-y += nvram.h
284unifdef-y += parport.h
285unifdef-y += patchkey.h
286unifdef-y += pci.h
287unifdef-y += pktcdvd.h
288unifdef-y += pmu.h
289unifdef-y += poll.h
290unifdef-y += ppp_defs.h
291unifdef-y += ppp-comp.h
292unifdef-y += ptrace.h
293unifdef-y += qnx4_fs.h
294unifdef-y += quota.h
295unifdef-y += random.h
296unifdef-y += reboot.h
297unifdef-y += reiserfs_fs.h
298unifdef-y += reiserfs_xattr.h
299unifdef-y += romfs_fs.h
300unifdef-y += route.h
301unifdef-y += rtc.h
302unifdef-y += rtnetlink.h
303unifdef-y += scc.h
304unifdef-y += sched.h
305unifdef-y += sdla.h
306unifdef-y += selinux_netlink.h
307unifdef-y += sem.h
308unifdef-y += serial_core.h
309unifdef-y += serial.h
310unifdef-y += serio.h
311unifdef-y += shm.h
312unifdef-y += signal.h
313unifdef-y += smb_fs.h
314unifdef-y += smb.h
315unifdef-y += smb_mount.h
316unifdef-y += socket.h
317unifdef-y += sonet.h
318unifdef-y += sonypi.h
319unifdef-y += soundcard.h
320unifdef-y += stat.h
321unifdef-y += stddef.h
322unifdef-y += sysctl.h
323unifdef-y += tcp.h
324unifdef-y += time.h
325unifdef-y += timex.h
326unifdef-y += tty.h
327unifdef-y += types.h
328unifdef-y += udf_fs_i.h
329unifdef-y += udp.h
330unifdef-y += uinput.h
331unifdef-y += uio.h
332unifdef-y += unistd.h
333unifdef-y += usb_ch9.h
334unifdef-y += usbdevice_fs.h
335unifdef-y += user.h
336unifdef-y += videodev2.h
337unifdef-y += videodev.h
338unifdef-y += wait.h
339unifdef-y += wanrouter.h
340unifdef-y += watchdog.h
341unifdef-y += xfrm.h
342unifdef-y += zftape.h
343
344objhdr-y += version.h
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
index c35833824e..2ed2fd8551 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -259,7 +259,7 @@ struct ac97_codec {
259 int type; 259 int type;
260 u32 model; 260 u32 model;
261 261
262 int modem:1; 262 unsigned int modem:1;
263 263
264 struct ac97_ops *codec_ops; 264 struct ac97_ops *codec_ops;
265 265
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 3d54fbcf96..e86bae7324 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -121,13 +121,17 @@ struct vfsmount;
121struct super_block; 121struct super_block;
122extern void acct_auto_close_mnt(struct vfsmount *m); 122extern void acct_auto_close_mnt(struct vfsmount *m);
123extern void acct_auto_close(struct super_block *sb); 123extern void acct_auto_close(struct super_block *sb);
124extern void acct_process(long exitcode); 124extern void acct_init_pacct(struct pacct_struct *pacct);
125extern void acct_collect(long exitcode, int group_dead);
126extern void acct_process(void);
125extern void acct_update_integrals(struct task_struct *tsk); 127extern void acct_update_integrals(struct task_struct *tsk);
126extern void acct_clear_integrals(struct task_struct *tsk); 128extern void acct_clear_integrals(struct task_struct *tsk);
127#else 129#else
128#define acct_auto_close_mnt(x) do { } while (0) 130#define acct_auto_close_mnt(x) do { } while (0)
129#define acct_auto_close(x) do { } while (0) 131#define acct_auto_close(x) do { } while (0)
130#define acct_process(x) do { } while (0) 132#define acct_init_pacct(x) do { } while (0)
133#define acct_collect(x,y) do { } while (0)
134#define acct_process() do { } while (0)
131#define acct_update_integrals(x) do { } while (0) 135#define acct_update_integrals(x) do { } while (0)
132#define acct_clear_integrals(task) do { } while (0) 136#define acct_clear_integrals(task) do { } while (0)
133#endif 137#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90d6df1551..88b5dfd8ee 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -528,12 +528,18 @@ static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
528 528
529#ifdef CONFIG_ACPI_NUMA 529#ifdef CONFIG_ACPI_NUMA
530int acpi_get_pxm(acpi_handle handle); 530int acpi_get_pxm(acpi_handle handle);
531int acpi_get_node(acpi_handle *handle);
531#else 532#else
532static inline int acpi_get_pxm(acpi_handle handle) 533static inline int acpi_get_pxm(acpi_handle handle)
533{ 534{
534 return 0; 535 return 0;
535} 536}
537static inline int acpi_get_node(acpi_handle *handle)
538{
539 return 0;
540}
536#endif 541#endif
542extern int acpi_paddr_to_node(u64 start_addr, u64 size);
537 543
538extern int pnpacpi_disabled; 544extern int pnpacpi_disabled;
539 545
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h
index 4a5d50c2bd..ef788c2085 100644
--- a/include/linux/adfs_fs.h
+++ b/include/linux/adfs_fs.h
@@ -2,6 +2,7 @@
2#define _ADFS_FS_H 2#define _ADFS_FS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/magic.h>
5 6
6/* 7/*
7 * Disc Record at disc address 0xc00 8 * Disc Record at disc address 0xc00
@@ -38,7 +39,6 @@ struct adfs_discrecord {
38#define ADFS_DR_OFFSET (0x1c0) 39#define ADFS_DR_OFFSET (0x1c0)
39#define ADFS_DR_SIZE 60 40#define ADFS_DR_SIZE 60
40#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) 41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
41#define ADFS_SUPER_MAGIC 0xadf5
42 42
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44#include <linux/adfs_fs_i.h> 44#include <linux/adfs_fs_i.h>
diff --git a/include/linux/aer.h b/include/linux/aer.h
new file mode 100644
index 0000000000..402e178b38
--- /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/affs_fs.h b/include/linux/affs_fs.h
deleted file mode 100644
index c57b5ee87d..0000000000
--- a/include/linux/affs_fs.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _AFFS_FS_H
2#define _AFFS_FS_H
3/*
4 * The affs filesystem constants/structures
5 */
6#define AFFS_SUPER_MAGIC 0xadff
7#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 3671af8696..d894419070 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -40,6 +40,8 @@ enum {
40 ATA_MAX_DEVICES = 2, /* per bus/port */ 40 ATA_MAX_DEVICES = 2, /* per bus/port */
41 ATA_MAX_PRD = 256, /* we could make these 256/256 */ 41 ATA_MAX_PRD = 256, /* we could make these 256/256 */
42 ATA_SECT_SIZE = 512, 42 ATA_SECT_SIZE = 512,
43 ATA_MAX_SECTORS = 256,
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
43 45
44 ATA_ID_WORDS = 256, 46 ATA_ID_WORDS = 256,
45 ATA_ID_SERNO_OFS = 10, 47 ATA_ID_SERNO_OFS = 10,
@@ -168,12 +170,16 @@ enum {
168 XFER_UDMA_2 = 0x42, 170 XFER_UDMA_2 = 0x42,
169 XFER_UDMA_1 = 0x41, 171 XFER_UDMA_1 = 0x41,
170 XFER_UDMA_0 = 0x40, 172 XFER_UDMA_0 = 0x40,
173 XFER_MW_DMA_4 = 0x24, /* CFA only */
174 XFER_MW_DMA_3 = 0x23, /* CFA only */
171 XFER_MW_DMA_2 = 0x22, 175 XFER_MW_DMA_2 = 0x22,
172 XFER_MW_DMA_1 = 0x21, 176 XFER_MW_DMA_1 = 0x21,
173 XFER_MW_DMA_0 = 0x20, 177 XFER_MW_DMA_0 = 0x20,
174 XFER_SW_DMA_2 = 0x12, 178 XFER_SW_DMA_2 = 0x12,
175 XFER_SW_DMA_1 = 0x11, 179 XFER_SW_DMA_1 = 0x11,
176 XFER_SW_DMA_0 = 0x10, 180 XFER_SW_DMA_0 = 0x10,
181 XFER_PIO_6 = 0x0E, /* CFA only */
182 XFER_PIO_5 = 0x0D, /* CFA only */
177 XFER_PIO_4 = 0x0C, 183 XFER_PIO_4 = 0x0C,
178 XFER_PIO_3 = 0x0B, 184 XFER_PIO_3 = 0x0B,
179 XFER_PIO_2 = 0x0A, 185 XFER_PIO_2 = 0x0A,
@@ -272,7 +278,6 @@ struct ata_taskfile {
272}; 278};
273 279
274#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 280#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
275#define ata_id_is_cfa(id) ((id)[0] == 0x848A)
276#define ata_id_is_sata(id) ((id)[93] == 0) 281#define ata_id_is_sata(id) ((id)[93] == 0)
277#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 282#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
278#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 283#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
@@ -304,6 +309,9 @@ static inline unsigned int ata_id_major_version(const u16 *id)
304{ 309{
305 unsigned int mver; 310 unsigned int mver;
306 311
312 if (id[ATA_ID_MAJOR_VER] == 0xFFFF)
313 return 0;
314
307 for (mver = 14; mver >= 1; mver--) 315 for (mver = 14; mver >= 1; mver--)
308 if (id[ATA_ID_MAJOR_VER] & (1 << mver)) 316 if (id[ATA_ID_MAJOR_VER] & (1 << mver))
309 break; 317 break;
@@ -312,8 +320,8 @@ static inline unsigned int ata_id_major_version(const u16 *id)
312 320
313static inline int ata_id_current_chs_valid(const u16 *id) 321static inline int ata_id_current_chs_valid(const u16 *id)
314{ 322{
315 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 323 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
316 has not been issued to the device then the values of 324 has not been issued to the device then the values of
317 id[54] to id[56] are vendor specific. */ 325 id[54] to id[56] are vendor specific. */
318 return (id[53] & 0x01) && /* Current translation valid */ 326 return (id[53] & 0x01) && /* Current translation valid */
319 id[54] && /* cylinders in current translation */ 327 id[54] && /* cylinders in current translation */
@@ -322,6 +330,18 @@ static inline int ata_id_current_chs_valid(const u16 *id)
322 id[56]; /* sectors in current translation */ 330 id[56]; /* sectors in current translation */
323} 331}
324 332
333static inline int ata_id_is_cfa(const u16 *id)
334{
335 u16 v = id[0];
336 if (v == 0x848A) /* Standard CF */
337 return 1;
338 /* Could be CF hiding as standard ATA */
339 if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF &&
340 (id[82] & ( 1 << 2)))
341 return 1;
342 return 0;
343}
344
325static inline int atapi_cdb_len(const u16 *dev_id) 345static inline int atapi_cdb_len(const u16 *dev_id)
326{ 346{
327 u16 tmp = dev_id[0] & 0x3; 347 u16 tmp = dev_id[0] & 0x3;
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 6ba3aa8a81..75b8baca08 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/atmdev.h b/include/linux/atmdev.h
index 1eb238affb..2096e5c728 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -209,6 +209,7 @@ struct atm_cirange {
209 209
210#ifdef __KERNEL__ 210#ifdef __KERNEL__
211 211
212#include <linux/device.h>
212#include <linux/wait.h> /* wait_queue_head_t */ 213#include <linux/wait.h> /* wait_queue_head_t */
213#include <linux/time.h> /* struct timeval */ 214#include <linux/time.h> /* struct timeval */
214#include <linux/net.h> 215#include <linux/net.h>
@@ -358,6 +359,7 @@ struct atm_dev {
358 struct proc_dir_entry *proc_entry; /* proc entry */ 359 struct proc_dir_entry *proc_entry; /* proc entry */
359 char *proc_name; /* proc entry name */ 360 char *proc_name; /* proc entry name */
360#endif 361#endif
362 struct class_device class_dev; /* sysfs class device */
361 struct list_head dev_list; /* linkage */ 363 struct list_head dev_list; /* linkage */
362}; 364};
363 365
@@ -459,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
459 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); 461 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
460 if (dev->ops->dev_close) 462 if (dev->ops->dev_close)
461 dev->ops->dev_close(dev); 463 dev->ops->dev_close(dev);
462 kfree(dev); 464 class_device_put(&dev->class_dev);
463 } 465 }
464} 466}
465 467
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index f267f24427..6f5a1bab8f 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 e051ff9c5b..c3aa097518 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -95,6 +95,11 @@
95#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ 95#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
96#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ 96#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
97#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ 97#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
98#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
99#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
100#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
101#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
102#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
98 103
99#define AUDIT_FIRST_KERN_ANOM_MSG 1700 104#define AUDIT_FIRST_KERN_ANOM_MSG 1700
100#define AUDIT_LAST_KERN_ANOM_MSG 1799 105#define AUDIT_LAST_KERN_ANOM_MSG 1799
@@ -122,10 +127,21 @@
122/* Rule structure sizes -- if these change, different AUDIT_ADD and 127/* Rule structure sizes -- if these change, different AUDIT_ADD and
123 * AUDIT_LIST commands must be implemented. */ 128 * AUDIT_LIST commands must be implemented. */
124#define AUDIT_MAX_FIELDS 64 129#define AUDIT_MAX_FIELDS 64
130#define AUDIT_MAX_KEY_LEN 32
125#define AUDIT_BITMASK_SIZE 64 131#define AUDIT_BITMASK_SIZE 64
126#define AUDIT_WORD(nr) ((__u32)((nr)/32)) 132#define AUDIT_WORD(nr) ((__u32)((nr)/32))
127#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 133#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
128 134
135#define AUDIT_SYSCALL_CLASSES 16
136#define AUDIT_CLASS_DIR_WRITE 0
137#define AUDIT_CLASS_DIR_WRITE_32 1
138#define AUDIT_CLASS_CHATTR 2
139#define AUDIT_CLASS_CHATTR_32 3
140#define AUDIT_CLASS_READ 4
141#define AUDIT_CLASS_READ_32 5
142#define AUDIT_CLASS_WRITE 6
143#define AUDIT_CLASS_WRITE_32 7
144
129/* This bitmask is used to validate user input. It represents all bits that 145/* This bitmask is used to validate user input. It represents all bits that
130 * are currently used in an audit field constant understood by the kernel. 146 * are currently used in an audit field constant understood by the kernel.
131 * If you are adding a new #define AUDIT_<whatever>, please ensure that 147 * If you are adding a new #define AUDIT_<whatever>, please ensure that
@@ -150,12 +166,17 @@
150#define AUDIT_PERS 10 166#define AUDIT_PERS 10
151#define AUDIT_ARCH 11 167#define AUDIT_ARCH 11
152#define AUDIT_MSGTYPE 12 168#define AUDIT_MSGTYPE 12
153#define AUDIT_SE_USER 13 /* security label user */ 169#define AUDIT_SUBJ_USER 13 /* security label user */
154#define AUDIT_SE_ROLE 14 /* security label role */ 170#define AUDIT_SUBJ_ROLE 14 /* security label role */
155#define AUDIT_SE_TYPE 15 /* security label type */ 171#define AUDIT_SUBJ_TYPE 15 /* security label type */
156#define AUDIT_SE_SEN 16 /* security label sensitivity label */ 172#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */
157#define AUDIT_SE_CLR 17 /* security label clearance label */ 173#define AUDIT_SUBJ_CLR 17 /* security label clearance label */
158#define AUDIT_PPID 18 174#define AUDIT_PPID 18
175#define AUDIT_OBJ_USER 19
176#define AUDIT_OBJ_ROLE 20
177#define AUDIT_OBJ_TYPE 21
178#define AUDIT_OBJ_LEV_LOW 22
179#define AUDIT_OBJ_LEV_HIGH 23
159 180
160 /* These are ONLY useful when checking 181 /* These are ONLY useful when checking
161 * at syscall exit time (AUDIT_AT_EXIT). */ 182 * at syscall exit time (AUDIT_AT_EXIT). */
@@ -165,12 +186,15 @@
165#define AUDIT_EXIT 103 186#define AUDIT_EXIT 103
166#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ 187#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
167#define AUDIT_WATCH 105 188#define AUDIT_WATCH 105
189#define AUDIT_PERM 106
168 190
169#define AUDIT_ARG0 200 191#define AUDIT_ARG0 200
170#define AUDIT_ARG1 (AUDIT_ARG0+1) 192#define AUDIT_ARG1 (AUDIT_ARG0+1)
171#define AUDIT_ARG2 (AUDIT_ARG0+2) 193#define AUDIT_ARG2 (AUDIT_ARG0+2)
172#define AUDIT_ARG3 (AUDIT_ARG0+3) 194#define AUDIT_ARG3 (AUDIT_ARG0+3)
173 195
196#define AUDIT_FILTERKEY 210
197
174#define AUDIT_NEGATE 0x80000000 198#define AUDIT_NEGATE 0x80000000
175 199
176/* These are the supported operators. 200/* These are the supported operators.
@@ -238,6 +262,11 @@
238#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) 262#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
239#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 263#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
240 264
265#define AUDIT_PERM_EXEC 1
266#define AUDIT_PERM_WRITE 2
267#define AUDIT_PERM_READ 4
268#define AUDIT_PERM_ATTR 8
269
241struct audit_status { 270struct audit_status {
242 __u32 mask; /* Bit mask for valid entries */ 271 __u32 mask; /* Bit mask for valid entries */
243 __u32 enabled; /* 1 = enabled, 0 = disabled */ 272 __u32 enabled; /* 1 = enabled, 0 = disabled */
@@ -299,6 +328,8 @@ struct mqstat;
299#define AUDITSC_SUCCESS 1 328#define AUDITSC_SUCCESS 1
300#define AUDITSC_FAILURE 2 329#define AUDITSC_FAILURE 2
301#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS ) 330#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS )
331extern int __init audit_register_class(int class, unsigned *list);
332extern int audit_classify_syscall(int abi, unsigned syscall);
302#ifdef CONFIG_AUDITSYSCALL 333#ifdef CONFIG_AUDITSYSCALL
303/* These are defined in auditsc.c */ 334/* These are defined in auditsc.c */
304 /* Public API */ 335 /* Public API */
@@ -312,21 +343,31 @@ extern void __audit_getname(const char *name);
312extern void audit_putname(const char *name); 343extern void audit_putname(const char *name);
313extern void __audit_inode(const char *name, const struct inode *inode); 344extern void __audit_inode(const char *name, const struct inode *inode);
314extern void __audit_inode_child(const char *dname, const struct inode *inode, 345extern void __audit_inode_child(const char *dname, const struct inode *inode,
315 unsigned long pino); 346 const struct inode *parent);
347extern void __audit_inode_update(const struct inode *inode);
348static inline int audit_dummy_context(void)
349{
350 void *p = current->audit_context;
351 return !p || *(int *)p;
352}
316static inline void audit_getname(const char *name) 353static inline void audit_getname(const char *name)
317{ 354{
318 if (unlikely(current->audit_context)) 355 if (unlikely(!audit_dummy_context()))
319 __audit_getname(name); 356 __audit_getname(name);
320} 357}
321static inline void audit_inode(const char *name, const struct inode *inode) { 358static inline void audit_inode(const char *name, const struct inode *inode) {
322 if (unlikely(current->audit_context)) 359 if (unlikely(!audit_dummy_context()))
323 __audit_inode(name, inode); 360 __audit_inode(name, inode);
324} 361}
325static inline void audit_inode_child(const char *dname, 362static inline void audit_inode_child(const char *dname,
326 const struct inode *inode, 363 const struct inode *inode,
327 unsigned long pino) { 364 const struct inode *parent) {
328 if (unlikely(current->audit_context)) 365 if (unlikely(!audit_dummy_context()))
329 __audit_inode_child(dname, inode, pino); 366 __audit_inode_child(dname, inode, parent);
367}
368static inline void audit_inode_update(const struct inode *inode) {
369 if (unlikely(!audit_dummy_context()))
370 __audit_inode_update(inode);
330} 371}
331 372
332 /* Private API (for audit.c only) */ 373 /* Private API (for audit.c only) */
@@ -350,57 +391,61 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
350 391
351static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 392static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
352{ 393{
353 if (unlikely(current->audit_context)) 394 if (unlikely(!audit_dummy_context()))
354 return __audit_ipc_obj(ipcp); 395 return __audit_ipc_obj(ipcp);
355 return 0; 396 return 0;
356} 397}
357static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 398static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
358{ 399{
359 if (unlikely(current->audit_context)) 400 if (unlikely(!audit_dummy_context()))
360 return __audit_ipc_set_perm(qbytes, uid, gid, mode); 401 return __audit_ipc_set_perm(qbytes, uid, gid, mode);
361 return 0; 402 return 0;
362} 403}
363static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) 404static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
364{ 405{
365 if (unlikely(current->audit_context)) 406 if (unlikely(!audit_dummy_context()))
366 return __audit_mq_open(oflag, mode, u_attr); 407 return __audit_mq_open(oflag, mode, u_attr);
367 return 0; 408 return 0;
368} 409}
369static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) 410static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
370{ 411{
371 if (unlikely(current->audit_context)) 412 if (unlikely(!audit_dummy_context()))
372 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); 413 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
373 return 0; 414 return 0;
374} 415}
375static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) 416static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
376{ 417{
377 if (unlikely(current->audit_context)) 418 if (unlikely(!audit_dummy_context()))
378 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); 419 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
379 return 0; 420 return 0;
380} 421}
381static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) 422static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
382{ 423{
383 if (unlikely(current->audit_context)) 424 if (unlikely(!audit_dummy_context()))
384 return __audit_mq_notify(mqdes, u_notification); 425 return __audit_mq_notify(mqdes, u_notification);
385 return 0; 426 return 0;
386} 427}
387static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) 428static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
388{ 429{
389 if (unlikely(current->audit_context)) 430 if (unlikely(!audit_dummy_context()))
390 return __audit_mq_getsetattr(mqdes, mqstat); 431 return __audit_mq_getsetattr(mqdes, mqstat);
391 return 0; 432 return 0;
392} 433}
434extern int audit_n_rules;
393#else 435#else
394#define audit_alloc(t) ({ 0; }) 436#define audit_alloc(t) ({ 0; })
395#define audit_free(t) do { ; } while (0) 437#define audit_free(t) do { ; } while (0)
396#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 438#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
397#define audit_syscall_exit(f,r) do { ; } while (0) 439#define audit_syscall_exit(f,r) do { ; } while (0)
440#define audit_dummy_context() 1
398#define audit_getname(n) do { ; } while (0) 441#define audit_getname(n) do { ; } while (0)
399#define audit_putname(n) do { ; } while (0) 442#define audit_putname(n) do { ; } while (0)
400#define __audit_inode(n,i) do { ; } while (0) 443#define __audit_inode(n,i) do { ; } while (0)
401#define __audit_inode_child(d,i,p) do { ; } while (0) 444#define __audit_inode_child(d,i,p) do { ; } while (0)
445#define __audit_inode_update(i) do { ; } while (0)
402#define audit_inode(n,i) do { ; } while (0) 446#define audit_inode(n,i) do { ; } while (0)
403#define audit_inode_child(d,i,p) do { ; } while (0) 447#define audit_inode_child(d,i,p) do { ; } while (0)
448#define audit_inode_update(i) do { ; } while (0)
404#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 449#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
405#define audit_get_loginuid(c) ({ -1; }) 450#define audit_get_loginuid(c) ({ -1; })
406#define audit_ipc_obj(i) ({ 0; }) 451#define audit_ipc_obj(i) ({ 0; })
@@ -415,6 +460,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
415#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 460#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
416#define audit_mq_notify(d,n) ({ 0; }) 461#define audit_mq_notify(d,n) ({ 0; })
417#define audit_mq_getsetattr(d,s) ({ 0; }) 462#define audit_mq_getsetattr(d,s) ({ 0; })
463#define audit_n_rules 0
418#endif 464#endif
419 465
420#ifdef CONFIG_AUDIT 466#ifdef CONFIG_AUDIT
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b60ffe32cd..76bdaeab6f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -47,7 +47,7 @@
47#define BIO_BUG_ON 47#define BIO_BUG_ON
48#endif 48#endif
49 49
50#define BIO_MAX_PAGES (256) 50#define BIO_MAX_PAGES 256
51#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT) 51#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
52#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 52#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
53 53
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index d9ed279698..dcc5de7cc4 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -24,6 +24,9 @@
24 * The available bitmap operations and their rough meaning in the 24 * The available bitmap operations and their rough meaning in the
25 * case that the bitmap is a single unsigned long are thus: 25 * case that the bitmap is a single unsigned long are thus:
26 * 26 *
27 * Note that nbits should be always a compile time evaluable constant.
28 * Otherwise many inlines will generate horrible code.
29 *
27 * bitmap_zero(dst, nbits) *dst = 0UL 30 * bitmap_zero(dst, nbits) *dst = 0UL
28 * bitmap_fill(dst, nbits) *dst = ~0UL 31 * bitmap_fill(dst, nbits) *dst = ~0UL
29 * bitmap_copy(dst, src, nbits) *dst = *src 32 * bitmap_copy(dst, src, nbits) *dst = *src
@@ -244,6 +247,8 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
244 247
245static inline int bitmap_weight(const unsigned long *src, int nbits) 248static inline int bitmap_weight(const unsigned long *src, int nbits)
246{ 249{
250 if (nbits <= BITS_PER_LONG)
251 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
247 return __bitmap_weight(src, nbits); 252 return __bitmap_weight(src, nbits);
248} 253}
249 254
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index aafe82788b..cfde8b3ee9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -417,9 +417,9 @@ struct request_queue
417 unsigned int sg_timeout; 417 unsigned int sg_timeout;
418 unsigned int sg_reserved_size; 418 unsigned int sg_reserved_size;
419 int node; 419 int node;
420 420#ifdef CONFIG_BLK_DEV_IO_TRACE
421 struct blk_trace *blk_trace; 421 struct blk_trace *blk_trace;
422 422#endif
423 /* 423 /*
424 * reserved for flush operations 424 * reserved for flush operations
425 */ 425 */
@@ -746,6 +746,9 @@ extern void blk_queue_free_tags(request_queue_t *);
746extern int blk_queue_resize_tags(request_queue_t *, int); 746extern int blk_queue_resize_tags(request_queue_t *, int);
747extern void blk_queue_invalidate_tags(request_queue_t *); 747extern void blk_queue_invalidate_tags(request_queue_t *);
748extern long blk_congestion_wait(int rw, long timeout); 748extern long blk_congestion_wait(int rw, long timeout);
749extern struct blk_queue_tag *blk_init_tags(int);
750extern void blk_free_tags(struct blk_queue_tag *);
751extern void blk_congestion_end(int rw);
749 752
750extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *); 753extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
751extern int blkdev_issue_flush(struct block_device *, sector_t *); 754extern int blkdev_issue_flush(struct block_device *, sector_t *);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index a7e8cef73d..7520cc1ff9 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -11,7 +11,7 @@ enum blktrace_cat {
11 BLK_TC_READ = 1 << 0, /* reads */ 11 BLK_TC_READ = 1 << 0, /* reads */
12 BLK_TC_WRITE = 1 << 1, /* writes */ 12 BLK_TC_WRITE = 1 << 1, /* writes */
13 BLK_TC_BARRIER = 1 << 2, /* barrier */ 13 BLK_TC_BARRIER = 1 << 2, /* barrier */
14 BLK_TC_SYNC = 1 << 3, /* barrier */ 14 BLK_TC_SYNC = 1 << 3, /* sync IO */
15 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ 15 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
16 BLK_TC_REQUEUE = 1 << 5, /* requeueing */ 16 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
17 BLK_TC_ISSUE = 1 << 6, /* issue */ 17 BLK_TC_ISSUE = 1 << 6, /* issue */
@@ -19,6 +19,7 @@ enum blktrace_cat {
19 BLK_TC_FS = 1 << 8, /* fs requests */ 19 BLK_TC_FS = 1 << 8, /* fs requests */
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 23
23 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 24 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
24}; 25};
@@ -147,7 +148,7 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
147 u32 what) 148 u32 what)
148{ 149{
149 struct blk_trace *bt = q->blk_trace; 150 struct blk_trace *bt = q->blk_trace;
150 int rw = rq->flags & 0x07; 151 int rw = rq->flags & 0x03;
151 152
152 if (likely(!bt)) 153 if (likely(!bt))
153 return; 154 return;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 22866fa2d9..31e9abb6d9 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -4,11 +4,8 @@
4#ifndef _LINUX_BOOTMEM_H 4#ifndef _LINUX_BOOTMEM_H
5#define _LINUX_BOOTMEM_H 5#define _LINUX_BOOTMEM_H
6 6
7#include <asm/pgtable.h>
8#include <asm/dma.h>
9#include <linux/cache.h>
10#include <linux/init.h>
11#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <asm/dma.h>
12 9
13/* 10/*
14 * simple boot-time physical memory area allocator. 11 * simple boot-time physical memory area allocator.
@@ -41,45 +38,64 @@ typedef struct bootmem_data {
41 struct list_head list; 38 struct list_head list;
42} bootmem_data_t; 39} bootmem_data_t;
43 40
44extern unsigned long __init bootmem_bootmap_pages (unsigned long); 41extern unsigned long bootmem_bootmap_pages(unsigned long);
45extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 42extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46extern void __init free_bootmem (unsigned long addr, unsigned long size); 43extern void free_bootmem(unsigned long addr, unsigned long size);
47extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); 44extern void *__alloc_bootmem(unsigned long size,
48extern void * __init __alloc_bootmem_nopanic (unsigned long size, unsigned long align, unsigned long goal); 45 unsigned long align,
49extern void * __init __alloc_bootmem_low(unsigned long size, 46 unsigned long goal);
50 unsigned long align, 47extern void *__alloc_bootmem_nopanic(unsigned long size,
51 unsigned long goal); 48 unsigned long align,
52extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, 49 unsigned long goal);
53 unsigned long size, 50extern void *__alloc_bootmem_low(unsigned long size,
54 unsigned long align, 51 unsigned long align,
55 unsigned long goal); 52 unsigned long goal);
56extern void * __init __alloc_bootmem_core(struct bootmem_data *bdata, 53extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
57 unsigned long size, unsigned long align, unsigned long goal, 54 unsigned long size,
58 unsigned long limit); 55 unsigned long align,
56 unsigned long goal);
57extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
58 unsigned long size,
59 unsigned long align,
60 unsigned long goal,
61 unsigned long limit);
62
59#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
60extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 64extern void reserve_bootmem(unsigned long addr, unsigned long size);
61#define alloc_bootmem(x) \ 65#define alloc_bootmem(x) \
62 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 66 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
63#define alloc_bootmem_low(x) \ 67#define alloc_bootmem_low(x) \
64 __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0) 68 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
65#define alloc_bootmem_pages(x) \ 69#define alloc_bootmem_pages(x) \
66 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 70 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
67#define alloc_bootmem_low_pages(x) \ 71#define alloc_bootmem_low_pages(x) \
68 __alloc_bootmem_low((x), PAGE_SIZE, 0) 72 __alloc_bootmem_low(x, PAGE_SIZE, 0)
69#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 73#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
70extern unsigned long __init free_all_bootmem (void); 74
71extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); 75extern unsigned long free_all_bootmem(void);
72extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); 76extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
73extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); 77extern void *__alloc_bootmem_node(pg_data_t *pgdat,
74extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); 78 unsigned long size,
75extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); 79 unsigned long align,
80 unsigned long goal);
81extern unsigned long init_bootmem_node(pg_data_t *pgdat,
82 unsigned long freepfn,
83 unsigned long startpfn,
84 unsigned long endpfn);
85extern void reserve_bootmem_node(pg_data_t *pgdat,
86 unsigned long physaddr,
87 unsigned long size);
88extern void free_bootmem_node(pg_data_t *pgdat,
89 unsigned long addr,
90 unsigned long size);
91
76#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 92#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
77#define alloc_bootmem_node(pgdat, x) \ 93#define alloc_bootmem_node(pgdat, x) \
78 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 94 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
79#define alloc_bootmem_pages_node(pgdat, x) \ 95#define alloc_bootmem_pages_node(pgdat, x) \
80 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 96 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
81#define alloc_bootmem_low_pages_node(pgdat, x) \ 97#define alloc_bootmem_low_pages_node(pgdat, x) \
82 __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0) 98 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
83#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 99#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
84 100
85#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 101#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
@@ -89,19 +105,19 @@ static inline void *alloc_remap(int nid, unsigned long size)
89{ 105{
90 return NULL; 106 return NULL;
91} 107}
92#endif 108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
93 109
94extern unsigned long nr_kernel_pages; 110extern unsigned long __meminitdata nr_kernel_pages;
95extern unsigned long nr_all_pages; 111extern unsigned long nr_all_pages;
96 112
97extern void *__init alloc_large_system_hash(const char *tablename, 113extern void *alloc_large_system_hash(const char *tablename,
98 unsigned long bucketsize, 114 unsigned long bucketsize,
99 unsigned long numentries, 115 unsigned long numentries,
100 int scale, 116 int scale,
101 int flags, 117 int flags,
102 unsigned int *_hash_shift, 118 unsigned int *_hash_shift,
103 unsigned int *_hash_mask, 119 unsigned int *_hash_mask,
104 unsigned long limit); 120 unsigned long limit);
105 121
106#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ 122#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */
107#define HASH_EARLY 0x00000002 /* Allocating during early boot? */ 123#define HASH_EARLY 0x00000002 /* Allocating during early boot? */
@@ -114,7 +130,7 @@ extern void *__init alloc_large_system_hash(const char *tablename,
114#else 130#else
115#define HASHDIST_DEFAULT 0 131#define HASHDIST_DEFAULT 0
116#endif 132#endif
117extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ 133extern int hashdist; /* Distribute hashes across NUMA nodes? */
118 134
119 135
120#endif /* _LINUX_BOOTMEM_H */ 136#endif /* _LINUX_BOOTMEM_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index fb7e9b7ccb..737e407d0c 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -149,7 +149,6 @@ void create_empty_buffers(struct page *, unsigned long,
149 unsigned long b_state); 149 unsigned long b_state);
150void end_buffer_read_sync(struct buffer_head *bh, int uptodate); 150void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
151void end_buffer_write_sync(struct buffer_head *bh, int uptodate); 151void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
152void end_buffer_async_write(struct buffer_head *bh, int uptodate);
153 152
154/* Things to do with buffers at mapping->private_list */ 153/* Things to do with buffers at mapping->private_list */
155void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode); 154void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
@@ -214,6 +213,7 @@ int nobh_truncate_page(struct address_space *, loff_t);
214int nobh_writepage(struct page *page, get_block_t *get_block, 213int nobh_writepage(struct page *page, get_block_t *get_block,
215 struct writeback_control *wbc); 214 struct writeback_control *wbc);
216 215
216void buffer_init(void);
217 217
218/* 218/*
219 * inline definitions 219 * inline definitions
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
new file mode 100644
index 0000000000..56499ab9e3
--- /dev/null
+++ b/include/linux/byteorder/Kbuild
@@ -0,0 +1,7 @@
1header-y += big_endian.h
2header-y += little_endian.h
3header-y += pdp_endian.h
4
5unifdef-y += generic.h
6unifdef-y += swabb.h
7unifdef-y += swab.h
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 2216638962..ee5f53f2ca 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/clocksource.h b/include/linux/clocksource.h
new file mode 100644
index 0000000000..d852024ed0
--- /dev/null
+++ b/include/linux/clocksource.h
@@ -0,0 +1,185 @@
1/* linux/include/linux/clocksource.h
2 *
3 * This file contains the structure definitions for clocksources.
4 *
5 * If you are not a clocksource, or timekeeping code, you should
6 * not be including this file!
7 */
8#ifndef _LINUX_CLOCKSOURCE_H
9#define _LINUX_CLOCKSOURCE_H
10
11#include <linux/types.h>
12#include <linux/timex.h>
13#include <linux/time.h>
14#include <linux/list.h>
15#include <asm/div64.h>
16#include <asm/io.h>
17
18/* clocksource cycle base type */
19typedef u64 cycle_t;
20
21/**
22 * struct clocksource - hardware abstraction for a free running counter
23 * Provides mostly state-free accessors to the underlying hardware.
24 *
25 * @name: ptr to clocksource name
26 * @list: list head for registration
27 * @rating: rating value for selection (higher is better)
28 * To avoid rating inflation the following
29 * list should give you a guide as to how
30 * to assign your clocksource a rating
31 * 1-99: Unfit for real use
32 * Only available for bootup and testing purposes.
33 * 100-199: Base level usability.
34 * Functional for real use, but not desired.
35 * 200-299: Good.
36 * A correct and usable clocksource.
37 * 300-399: Desired.
38 * A reasonably fast and accurate clocksource.
39 * 400-499: Perfect
40 * The ideal clocksource. A must-use where
41 * available.
42 * @read: returns a cycle value
43 * @mask: bitmask for two's complement
44 * subtraction of non 64 bit counters
45 * @mult: cycle to nanosecond multiplier
46 * @shift: cycle to nanosecond divisor (power of two)
47 * @update_callback: called when safe to alter clocksource values
48 * @is_continuous: defines if clocksource is free-running.
49 * @cycle_interval: Used internally by timekeeping core, please ignore.
50 * @xtime_interval: Used internally by timekeeping core, please ignore.
51 */
52struct clocksource {
53 char *name;
54 struct list_head list;
55 int rating;
56 cycle_t (*read)(void);
57 cycle_t mask;
58 u32 mult;
59 u32 shift;
60 int (*update_callback)(void);
61 int is_continuous;
62
63 /* timekeeping specific data, ignore */
64 cycle_t cycle_last, cycle_interval;
65 u64 xtime_nsec, xtime_interval;
66 s64 error;
67};
68
69/* simplify initialization of mask field */
70#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
71
72/**
73 * clocksource_khz2mult - calculates mult from khz and shift
74 * @khz: Clocksource frequency in KHz
75 * @shift_constant: Clocksource shift factor
76 *
77 * Helper functions that converts a khz counter frequency to a timsource
78 * multiplier, given the clocksource shift value
79 */
80static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
81{
82 /* khz = cyc/(Million ns)
83 * mult/2^shift = ns/cyc
84 * mult = ns/cyc * 2^shift
85 * mult = 1Million/khz * 2^shift
86 * mult = 1000000 * 2^shift / khz
87 * mult = (1000000<<shift) / khz
88 */
89 u64 tmp = ((u64)1000000) << shift_constant;
90
91 tmp += khz/2; /* round for do_div */
92 do_div(tmp, khz);
93
94 return (u32)tmp;
95}
96
97/**
98 * clocksource_hz2mult - calculates mult from hz and shift
99 * @hz: Clocksource frequency in Hz
100 * @shift_constant: Clocksource shift factor
101 *
102 * Helper functions that converts a hz counter
103 * frequency to a timsource multiplier, given the
104 * clocksource shift value
105 */
106static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
107{
108 /* hz = cyc/(Billion ns)
109 * mult/2^shift = ns/cyc
110 * mult = ns/cyc * 2^shift
111 * mult = 1Billion/hz * 2^shift
112 * mult = 1000000000 * 2^shift / hz
113 * mult = (1000000000<<shift) / hz
114 */
115 u64 tmp = ((u64)1000000000) << shift_constant;
116
117 tmp += hz/2; /* round for do_div */
118 do_div(tmp, hz);
119
120 return (u32)tmp;
121}
122
123/**
124 * clocksource_read: - Access the clocksource's current cycle value
125 * @cs: pointer to clocksource being read
126 *
127 * Uses the clocksource to return the current cycle_t value
128 */
129static inline cycle_t clocksource_read(struct clocksource *cs)
130{
131 return cs->read();
132}
133
134/**
135 * cyc2ns - converts clocksource cycles to nanoseconds
136 * @cs: Pointer to clocksource
137 * @cycles: Cycles
138 *
139 * Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds.
140 *
141 * XXX - This could use some mult_lxl_ll() asm optimization
142 */
143static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles)
144{
145 u64 ret = (u64)cycles;
146 ret = (ret * cs->mult) >> cs->shift;
147 return ret;
148}
149
150/**
151 * clocksource_calculate_interval - Calculates a clocksource interval struct
152 *
153 * @c: Pointer to clocksource.
154 * @length_nsec: Desired interval length in nanoseconds.
155 *
156 * Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
157 * pair and interval request.
158 *
159 * Unless you're the timekeeping code, you should not be using this!
160 */
161static inline void clocksource_calculate_interval(struct clocksource *c,
162 unsigned long length_nsec)
163{
164 u64 tmp;
165
166 /* XXX - All of this could use a whole lot of optimization */
167 tmp = length_nsec;
168 tmp <<= c->shift;
169 tmp += c->mult/2;
170 do_div(tmp, c->mult);
171
172 c->cycle_interval = (cycle_t)tmp;
173 if (c->cycle_interval == 0)
174 c->cycle_interval = 1;
175
176 c->xtime_interval = (u64)c->cycle_interval * c->mult;
177}
178
179
180/* used to install a new clocksource */
181int clocksource_register(struct clocksource*);
182void clocksource_reselect(void);
183struct clocksource* clocksource_get_next(void);
184
185#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index dbb7769009..1c86d65bc4 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -57,7 +57,8 @@ struct proc_event {
57 PROC_EVENT_EXIT = 0x80000000 57 PROC_EVENT_EXIT = 0x80000000
58 } what; 58 } what;
59 __u32 cpu; 59 __u32 cpu;
60 struct timespec timestamp; 60 __u64 __attribute__((aligned(8))) timestamp_ns;
61 /* Number of nano seconds since system boot */
61 union { /* must be last field of proc_event struct */ 62 union { /* must be last field of proc_event struct */
62 struct { 63 struct {
63 __u32 err; 64 __u32 err;
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 7b5c5df5cb..be512cc987 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -27,8 +27,8 @@ extern struct inode_operations coda_dir_inode_operations;
27extern struct inode_operations coda_file_inode_operations; 27extern struct inode_operations coda_file_inode_operations;
28extern struct inode_operations coda_ioctl_inode_operations; 28extern struct inode_operations coda_ioctl_inode_operations;
29 29
30extern struct address_space_operations coda_file_aops; 30extern const struct address_space_operations coda_file_aops;
31extern struct address_space_operations coda_symlink_aops; 31extern const struct address_space_operations coda_symlink_aops;
32 32
33extern const struct file_operations coda_dir_operations; 33extern const struct file_operations coda_dir_operations;
34extern const struct file_operations coda_file_operations; 34extern const struct file_operations coda_file_operations;
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 98f6c52c15..b541bb3d1f 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -1,11 +1,11 @@
1#ifndef __CODA_PSDEV_H 1#ifndef __CODA_PSDEV_H
2#define __CODA_PSDEV_H 2#define __CODA_PSDEV_H
3 3
4#include <linux/magic.h>
5
4#define CODA_PSDEV_MAJOR 67 6#define CODA_PSDEV_MAJOR 67
5#define MAX_CODADEVS 5 /* how many do we allow */ 7#define MAX_CODADEVS 5 /* how many do we allow */
6 8
7#define CODA_SUPER_MAGIC 0x73757245
8
9struct kstatfs; 9struct kstatfs;
10 10
11struct coda_sb_info 11struct coda_sb_info
diff --git a/include/linux/compat.h b/include/linux/compat.h
index dda1697ec7..9760753e66 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -226,5 +226,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
226 226
227asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 227asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
228 228
229extern int compat_printk(const char *fmt, ...);
230
229#endif /* CONFIG_COMPAT */ 231#endif /* CONFIG_COMPAT */
230#endif /* _LINUX_COMPAT_H */ 232#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 89ab677cb9..bea0255196 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -216,6 +216,7 @@ COMPATIBLE_IOCTL(VT_RESIZE)
216COMPATIBLE_IOCTL(VT_RESIZEX) 216COMPATIBLE_IOCTL(VT_RESIZEX)
217COMPATIBLE_IOCTL(VT_LOCKSWITCH) 217COMPATIBLE_IOCTL(VT_LOCKSWITCH)
218COMPATIBLE_IOCTL(VT_UNLOCKSWITCH) 218COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
219COMPATIBLE_IOCTL(VT_GETHIFONTMASK)
219/* Little p (/dev/rtc, /dev/envctrl, etc.) */ 220/* Little p (/dev/rtc, /dev/envctrl, etc.) */
220COMPATIBLE_IOCTL(RTC_AIE_ON) 221COMPATIBLE_IOCTL(RTC_AIE_ON)
221COMPATIBLE_IOCTL(RTC_AIE_OFF) 222COMPATIBLE_IOCTL(RTC_AIE_OFF)
@@ -567,11 +568,6 @@ COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER)
567COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST) 568COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST)
568COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST) 569COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST)
569COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT) 570COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT)
570/* DEVFS */
571COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV)
572COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK)
573COMPATIBLE_IOCTL(DEVFSDIOC_RELEASE_EVENT_QUEUE)
574COMPATIBLE_IOCTL(DEVFSDIOC_SET_DEBUG_MASK)
575/* Raw devices */ 571/* Raw devices */
576COMPATIBLE_IOCTL(RAW_SETBIND) 572COMPATIBLE_IOCTL(RAW_SETBIND)
577COMPATIBLE_IOCTL(RAW_GETBIND) 573COMPATIBLE_IOCTL(RAW_GETBIND)
@@ -673,6 +669,11 @@ COMPATIBLE_IOCTL(CAPI_SET_FLAGS)
673COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) 669COMPATIBLE_IOCTL(CAPI_CLR_FLAGS)
674COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) 670COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT)
675COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) 671COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT)
672/* Siemens Gigaset */
673COMPATIBLE_IOCTL(GIGASET_REDIR)
674COMPATIBLE_IOCTL(GIGASET_CONFIG)
675COMPATIBLE_IOCTL(GIGASET_BRKCHARS)
676COMPATIBLE_IOCTL(GIGASET_VERSION)
676/* Misc. */ 677/* Misc. */
677COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ 678COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
678COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ 679COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 9b4f110949..0780de4402 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -14,7 +14,7 @@
14# define __releases(x) __attribute__((context(1,0))) 14# define __releases(x) __attribute__((context(1,0)))
15# define __acquire(x) __context__(1) 15# define __acquire(x) __context__(1)
16# define __release(x) __context__(-1) 16# define __release(x) __context__(-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/completion.h b/include/linux/completion.h
index 90663ad217..268c5a4a2b 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -18,9 +18,24 @@ struct completion {
18#define COMPLETION_INITIALIZER(work) \ 18#define COMPLETION_INITIALIZER(work) \
19 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } 19 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
20 20
21#define COMPLETION_INITIALIZER_ONSTACK(work) \
22 ({ init_completion(&work); work; })
23
21#define DECLARE_COMPLETION(work) \ 24#define DECLARE_COMPLETION(work) \
22 struct completion work = COMPLETION_INITIALIZER(work) 25 struct completion work = COMPLETION_INITIALIZER(work)
23 26
27/*
28 * Lockdep needs to run a non-constant initializer for on-stack
29 * completions - so we use the _ONSTACK() variant for those that
30 * are on the kernel stack:
31 */
32#ifdef CONFIG_LOCKDEP
33# define DECLARE_COMPLETION_ONSTACK(work) \
34 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
35#else
36# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
37#endif
38
24static inline void init_completion(struct completion *x) 39static inline void init_completion(struct completion *x)
25{ 40{
26 x->done = 0; 41 x->done = 0;
diff --git a/include/linux/console.h b/include/linux/console.h
index 08734e660d..76a1807726 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -63,9 +63,11 @@ extern const struct consw vga_con; /* VGA text console */
63extern const struct consw newport_con; /* SGI Newport console */ 63extern const struct consw newport_con; /* SGI Newport console */
64extern const struct consw prom_con; /* SPARC PROM console */ 64extern const struct consw prom_con; /* SPARC PROM console */
65 65
66int con_is_bound(const struct consw *csw);
67int register_con_driver(const struct consw *csw, int first, int last);
68int unregister_con_driver(const struct consw *csw);
66int take_over_console(const struct consw *sw, int first, int last, int deflt); 69int take_over_console(const struct consw *sw, int first, int last, int deflt);
67void give_up_console(const struct consw *sw); 70void give_up_console(const struct consw *sw);
68
69/* scroll */ 71/* scroll */
70#define SM_UP (1) 72#define SM_UP (1)
71#define SM_DOWN (2) 73#define SM_DOWN (2)
@@ -87,6 +89,7 @@ void give_up_console(const struct consw *sw);
87#define CON_CONSDEV (2) /* Last on the command line */ 89#define CON_CONSDEV (2) /* Last on the command line */
88#define CON_ENABLED (4) 90#define CON_ENABLED (4)
89#define CON_BOOT (8) 91#define CON_BOOT (8)
92#define CON_ANYTIME (16) /* Safe to call when cpu is offline */
90 93
91struct console 94struct console
92{ 95{
@@ -117,9 +120,14 @@ extern void console_stop(struct console *);
117extern void console_start(struct console *); 120extern void console_start(struct console *);
118extern int is_console_locked(void); 121extern int is_console_locked(void);
119 122
123#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND
120/* Suspend and resume console messages over PM events */ 124/* Suspend and resume console messages over PM events */
121extern void suspend_console(void); 125extern void suspend_console(void);
122extern void resume_console(void); 126extern void resume_console(void);
127#else
128static inline void suspend_console(void) {}
129static inline void resume_console(void) {}
130#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
123 131
124/* Some debug stub to catch some of the obvious races in the VT code */ 132/* Some debug stub to catch some of the obvious races in the VT code */
125#if 1 133#if 1
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index f8e5587a0f..25423f79bf 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -9,6 +9,7 @@
9 * to achieve effects such as fast scrolling by changing the origin. 9 * to achieve effects such as fast scrolling by changing the origin.
10 */ 10 */
11 11
12#include <linux/wait.h>
12#include <linux/vt.h> 13#include <linux/vt.h>
13 14
14struct vt_struct; 15struct vt_struct;
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 08d50c53aa..3fef7d67ae 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -31,18 +31,23 @@ struct cpu {
31 struct sys_device sysdev; 31 struct sys_device sysdev;
32}; 32};
33 33
34extern int register_cpu(struct cpu *, int, struct node *); 34extern int register_cpu(struct cpu *cpu, int num);
35extern struct sys_device *get_cpu_sysdev(unsigned cpu); 35extern struct sys_device *get_cpu_sysdev(unsigned cpu);
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37extern void unregister_cpu(struct cpu *, struct node *); 37extern void unregister_cpu(struct cpu *cpu);
38#endif 38#endif
39struct notifier_block; 39struct notifier_block;
40 40
41#ifdef CONFIG_SMP 41#ifdef CONFIG_SMP
42/* Need to know about CPUs going up/down? */ 42/* Need to know about CPUs going up/down? */
43extern int register_cpu_notifier(struct notifier_block *nb); 43extern int register_cpu_notifier(struct notifier_block *nb);
44#ifdef CONFIG_HOTPLUG_CPU
44extern void unregister_cpu_notifier(struct notifier_block *nb); 45extern void unregister_cpu_notifier(struct notifier_block *nb);
45extern int current_in_cpu_hotplug(void); 46#else
47static inline void unregister_cpu_notifier(struct notifier_block *nb)
48{
49}
50#endif
46 51
47int cpu_up(unsigned int cpu); 52int cpu_up(unsigned int cpu);
48 53
@@ -55,10 +60,6 @@ static inline int register_cpu_notifier(struct notifier_block *nb)
55static inline void unregister_cpu_notifier(struct notifier_block *nb) 60static inline void unregister_cpu_notifier(struct notifier_block *nb)
56{ 61{
57} 62}
58static inline int current_in_cpu_hotplug(void)
59{
60 return 0;
61}
62 63
63#endif /* CONFIG_SMP */ 64#endif /* CONFIG_SMP */
64extern struct sysdev_class cpu_sysdev_class; 65extern struct sysdev_class cpu_sysdev_class;
@@ -67,22 +68,33 @@ extern struct sysdev_class cpu_sysdev_class;
67/* Stop CPUs going up and down. */ 68/* Stop CPUs going up and down. */
68extern void lock_cpu_hotplug(void); 69extern void lock_cpu_hotplug(void);
69extern void unlock_cpu_hotplug(void); 70extern void unlock_cpu_hotplug(void);
70extern int lock_cpu_hotplug_interruptible(void);
71#define hotcpu_notifier(fn, pri) { \ 71#define hotcpu_notifier(fn, pri) { \
72 static struct notifier_block fn##_nb = \ 72 static struct notifier_block fn##_nb = \
73 { .notifier_call = fn, .priority = pri }; \ 73 { .notifier_call = fn, .priority = pri }; \
74 register_cpu_notifier(&fn##_nb); \ 74 register_cpu_notifier(&fn##_nb); \
75} 75}
76#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
77#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
76int cpu_down(unsigned int cpu); 78int cpu_down(unsigned int cpu);
77#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 79#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
78#else 80#else
79#define lock_cpu_hotplug() do { } while (0) 81#define lock_cpu_hotplug() do { } while (0)
80#define unlock_cpu_hotplug() do { } while (0) 82#define unlock_cpu_hotplug() do { } while (0)
81#define lock_cpu_hotplug_interruptible() 0 83#define lock_cpu_hotplug_interruptible() 0
82#define hotcpu_notifier(fn, pri) 84#define hotcpu_notifier(fn, pri) do { } while (0)
85#define register_hotcpu_notifier(nb) do { } while (0)
86#define unregister_hotcpu_notifier(nb) do { } while (0)
83 87
84/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */ 88/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
85static inline int cpu_is_offline(int cpu) { return 0; } 89static inline int cpu_is_offline(int cpu) { return 0; }
86#endif 90#endif
87 91
92#ifdef CONFIG_SUSPEND_SMP
93extern int disable_nonboot_cpus(void);
94extern void enable_nonboot_cpus(void);
95#else
96static inline int disable_nonboot_cpus(void) { return 0; }
97static inline void enable_nonboot_cpus(void) {}
98#endif
99
88#endif /* _LINUX_CPU_H_ */ 100#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 466fbe9e48..4ea39fee99 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -100,8 +100,10 @@ struct cpufreq_policy {
100#define CPUFREQ_INCOMPATIBLE (1) 100#define CPUFREQ_INCOMPATIBLE (1)
101#define CPUFREQ_NOTIFY (2) 101#define CPUFREQ_NOTIFY (2)
102 102
103#define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */ 103#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
104#define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */ 104#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
105#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
106#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
105 107
106/******************** cpufreq transition notifiers *******************/ 108/******************** cpufreq transition notifiers *******************/
107 109
@@ -170,9 +172,6 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
170 unsigned int relation); 172 unsigned int relation);
171 173
172 174
173/* pass an event to the cpufreq governor */
174int cpufreq_governor(unsigned int cpu, unsigned int event);
175
176int cpufreq_register_governor(struct cpufreq_governor *governor); 175int cpufreq_register_governor(struct cpufreq_governor *governor);
177void cpufreq_unregister_governor(struct cpufreq_governor *governor); 176void cpufreq_unregister_governor(struct cpufreq_governor *governor);
178 177
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9cbb781d6f..b268a3c0c3 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -317,7 +317,8 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
317 (cpu) < NR_CPUS; \ 317 (cpu) < NR_CPUS; \
318 (cpu) = next_cpu((cpu), (mask))) 318 (cpu) = next_cpu((cpu), (mask)))
319#else /* NR_CPUS == 1 */ 319#else /* NR_CPUS == 1 */
320#define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++) 320#define for_each_cpu_mask(cpu, mask) \
321 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
321#endif /* NR_CPUS */ 322#endif /* NR_CPUS */
322 323
323/* 324/*
@@ -405,7 +406,6 @@ int __any_online_cpu(const cpumask_t *mask);
405#define any_online_cpu(mask) 0 406#define any_online_cpu(mask) 0
406#endif 407#endif
407 408
408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 9354722a92..4d8adf6636 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 a41f38428c..1dba681e42 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/crypto.h b/include/linux/crypto.h
index 5a0470e361..8f2ffa4caa 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -17,20 +17,36 @@
17#ifndef _LINUX_CRYPTO_H 17#ifndef _LINUX_CRYPTO_H
18#define _LINUX_CRYPTO_H 18#define _LINUX_CRYPTO_H
19 19
20#include <asm/atomic.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/slab.h>
24#include <linux/string.h> 25#include <linux/string.h>
25#include <asm/page.h> 26#include <linux/uaccess.h>
26 27
27/* 28/*
28 * Algorithm masks and types. 29 * Algorithm masks and types.
29 */ 30 */
30#define CRYPTO_ALG_TYPE_MASK 0x000000ff 31#define CRYPTO_ALG_TYPE_MASK 0x0000000f
31#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001
32#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002
33#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 34#define CRYPTO_ALG_TYPE_HASH 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005
37
38#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
39
40#define CRYPTO_ALG_LARVAL 0x00000010
41#define CRYPTO_ALG_DEAD 0x00000020
42#define CRYPTO_ALG_DYING 0x00000040
43#define CRYPTO_ALG_ASYNC 0x00000080
44
45/*
46 * Set this bit if and only if the algorithm requires another algorithm of
47 * the same type to handle corner cases.
48 */
49#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
34 50
35/* 51/*
36 * Transform masks and values (for crt_flags). 52 * Transform masks and values (for crt_flags).
@@ -61,82 +77,156 @@
61#define CRYPTO_DIR_ENCRYPT 1 77#define CRYPTO_DIR_ENCRYPT 1
62#define CRYPTO_DIR_DECRYPT 0 78#define CRYPTO_DIR_DECRYPT 0
63 79
80/*
81 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
82 * declaration) is used to ensure that the crypto_tfm context structure is
83 * aligned correctly for the given architecture so that there are no alignment
84 * faults for C data types. In particular, this is required on platforms such
85 * as arm where pointers are 32-bit aligned but there are data types such as
86 * u64 which require 64-bit alignment.
87 */
88#if defined(ARCH_KMALLOC_MINALIGN)
89#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
90#elif defined(ARCH_SLAB_MINALIGN)
91#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
92#endif
93
94#ifdef CRYPTO_MINALIGN
95#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
96#else
97#define CRYPTO_MINALIGN_ATTR
98#endif
99
64struct scatterlist; 100struct scatterlist;
101struct crypto_blkcipher;
102struct crypto_hash;
65struct crypto_tfm; 103struct crypto_tfm;
104struct crypto_type;
105
106struct blkcipher_desc {
107 struct crypto_blkcipher *tfm;
108 void *info;
109 u32 flags;
110};
66 111
67struct cipher_desc { 112struct cipher_desc {
68 struct crypto_tfm *tfm; 113 struct crypto_tfm *tfm;
69 void (*crfn)(void *ctx, u8 *dst, const u8 *src); 114 void (*crfn)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
70 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst, 115 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst,
71 const u8 *src, unsigned int nbytes); 116 const u8 *src, unsigned int nbytes);
72 void *info; 117 void *info;
73}; 118};
74 119
120struct hash_desc {
121 struct crypto_hash *tfm;
122 u32 flags;
123};
124
75/* 125/*
76 * Algorithms: modular crypto algorithm implementations, managed 126 * Algorithms: modular crypto algorithm implementations, managed
77 * via crypto_register_alg() and crypto_unregister_alg(). 127 * via crypto_register_alg() and crypto_unregister_alg().
78 */ 128 */
129struct blkcipher_alg {
130 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
131 unsigned int keylen);
132 int (*encrypt)(struct blkcipher_desc *desc,
133 struct scatterlist *dst, struct scatterlist *src,
134 unsigned int nbytes);
135 int (*decrypt)(struct blkcipher_desc *desc,
136 struct scatterlist *dst, struct scatterlist *src,
137 unsigned int nbytes);
138
139 unsigned int min_keysize;
140 unsigned int max_keysize;
141 unsigned int ivsize;
142};
143
79struct cipher_alg { 144struct cipher_alg {
80 unsigned int cia_min_keysize; 145 unsigned int cia_min_keysize;
81 unsigned int cia_max_keysize; 146 unsigned int cia_max_keysize;
82 int (*cia_setkey)(void *ctx, const u8 *key, 147 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key,
83 unsigned int keylen, u32 *flags); 148 unsigned int keylen);
84 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); 149 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
85 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); 150 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
86 151
87 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, 152 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
88 u8 *dst, const u8 *src, 153 u8 *dst, const u8 *src,
89 unsigned int nbytes); 154 unsigned int nbytes) __deprecated;
90 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, 155 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
91 u8 *dst, const u8 *src, 156 u8 *dst, const u8 *src,
92 unsigned int nbytes); 157 unsigned int nbytes) __deprecated;
93 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, 158 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
94 u8 *dst, const u8 *src, 159 u8 *dst, const u8 *src,
95 unsigned int nbytes); 160 unsigned int nbytes) __deprecated;
96 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, 161 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
97 u8 *dst, const u8 *src, 162 u8 *dst, const u8 *src,
98 unsigned int nbytes); 163 unsigned int nbytes) __deprecated;
99}; 164};
100 165
101struct digest_alg { 166struct digest_alg {
102 unsigned int dia_digestsize; 167 unsigned int dia_digestsize;
103 void (*dia_init)(void *ctx); 168 void (*dia_init)(struct crypto_tfm *tfm);
104 void (*dia_update)(void *ctx, const u8 *data, unsigned int len); 169 void (*dia_update)(struct crypto_tfm *tfm, const u8 *data,
105 void (*dia_final)(void *ctx, u8 *out); 170 unsigned int len);
106 int (*dia_setkey)(void *ctx, const u8 *key, 171 void (*dia_final)(struct crypto_tfm *tfm, u8 *out);
107 unsigned int keylen, u32 *flags); 172 int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key,
173 unsigned int keylen);
174};
175
176struct hash_alg {
177 int (*init)(struct hash_desc *desc);
178 int (*update)(struct hash_desc *desc, struct scatterlist *sg,
179 unsigned int nbytes);
180 int (*final)(struct hash_desc *desc, u8 *out);
181 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
182 unsigned int nbytes, u8 *out);
183 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
184 unsigned int keylen);
185
186 unsigned int digestsize;
108}; 187};
109 188
110struct compress_alg { 189struct compress_alg {
111 int (*coa_init)(void *ctx); 190 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src,
112 void (*coa_exit)(void *ctx); 191 unsigned int slen, u8 *dst, unsigned int *dlen);
113 int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen, 192 int (*coa_decompress)(struct crypto_tfm *tfm, const u8 *src,
114 u8 *dst, unsigned int *dlen); 193 unsigned int slen, u8 *dst, unsigned int *dlen);
115 int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen,
116 u8 *dst, unsigned int *dlen);
117}; 194};
118 195
196#define cra_blkcipher cra_u.blkcipher
119#define cra_cipher cra_u.cipher 197#define cra_cipher cra_u.cipher
120#define cra_digest cra_u.digest 198#define cra_digest cra_u.digest
199#define cra_hash cra_u.hash
121#define cra_compress cra_u.compress 200#define cra_compress cra_u.compress
122 201
123struct crypto_alg { 202struct crypto_alg {
124 struct list_head cra_list; 203 struct list_head cra_list;
204 struct list_head cra_users;
205
125 u32 cra_flags; 206 u32 cra_flags;
126 unsigned int cra_blocksize; 207 unsigned int cra_blocksize;
127 unsigned int cra_ctxsize; 208 unsigned int cra_ctxsize;
128 unsigned int cra_alignmask; 209 unsigned int cra_alignmask;
129 210
130 int cra_priority; 211 int cra_priority;
212 atomic_t cra_refcnt;
131 213
132 const char cra_name[CRYPTO_MAX_ALG_NAME]; 214 char cra_name[CRYPTO_MAX_ALG_NAME];
133 const char cra_driver_name[CRYPTO_MAX_ALG_NAME]; 215 char cra_driver_name[CRYPTO_MAX_ALG_NAME];
216
217 const struct crypto_type *cra_type;
134 218
135 union { 219 union {
220 struct blkcipher_alg blkcipher;
136 struct cipher_alg cipher; 221 struct cipher_alg cipher;
137 struct digest_alg digest; 222 struct digest_alg digest;
223 struct hash_alg hash;
138 struct compress_alg compress; 224 struct compress_alg compress;
139 } cra_u; 225 } cra_u;
226
227 int (*cra_init)(struct crypto_tfm *tfm);
228 void (*cra_exit)(struct crypto_tfm *tfm);
229 void (*cra_destroy)(struct crypto_alg *alg);
140 230
141 struct module *cra_module; 231 struct module *cra_module;
142}; 232};
@@ -151,20 +241,39 @@ int crypto_unregister_alg(struct crypto_alg *alg);
151 * Algorithm query interface. 241 * Algorithm query interface.
152 */ 242 */
153#ifdef CONFIG_CRYPTO 243#ifdef CONFIG_CRYPTO
154int crypto_alg_available(const char *name, u32 flags); 244int crypto_alg_available(const char *name, u32 flags)
245 __deprecated_for_modules;
246int crypto_has_alg(const char *name, u32 type, u32 mask);
155#else 247#else
248static int crypto_alg_available(const char *name, u32 flags);
249 __deprecated_for_modules;
156static inline int crypto_alg_available(const char *name, u32 flags) 250static inline int crypto_alg_available(const char *name, u32 flags)
157{ 251{
158 return 0; 252 return 0;
159} 253}
254
255static inline int crypto_has_alg(const char *name, u32 type, u32 mask)
256{
257 return 0;
258}
160#endif 259#endif
161 260
162/* 261/*
163 * Transforms: user-instantiated objects which encapsulate algorithms 262 * Transforms: user-instantiated objects which encapsulate algorithms
164 * and core processing logic. Managed via crypto_alloc_tfm() and 263 * and core processing logic. Managed via crypto_alloc_*() and
165 * crypto_free_tfm(), as well as the various helpers below. 264 * crypto_free_*(), as well as the various helpers below.
166 */ 265 */
167 266
267struct blkcipher_tfm {
268 void *iv;
269 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
270 unsigned int keylen);
271 int (*encrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
272 struct scatterlist *src, unsigned int nbytes);
273 int (*decrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
274 struct scatterlist *src, unsigned int nbytes);
275};
276
168struct cipher_tfm { 277struct cipher_tfm {
169 void *cit_iv; 278 void *cit_iv;
170 unsigned int cit_ivsize; 279 unsigned int cit_ivsize;
@@ -188,20 +297,20 @@ struct cipher_tfm {
188 struct scatterlist *src, 297 struct scatterlist *src,
189 unsigned int nbytes, u8 *iv); 298 unsigned int nbytes, u8 *iv);
190 void (*cit_xor_block)(u8 *dst, const u8 *src); 299 void (*cit_xor_block)(u8 *dst, const u8 *src);
300 void (*cit_encrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
301 void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
191}; 302};
192 303
193struct digest_tfm { 304struct hash_tfm {
194 void (*dit_init)(struct crypto_tfm *tfm); 305 int (*init)(struct hash_desc *desc);
195 void (*dit_update)(struct crypto_tfm *tfm, 306 int (*update)(struct hash_desc *desc,
196 struct scatterlist *sg, unsigned int nsg); 307 struct scatterlist *sg, unsigned int nsg);
197 void (*dit_final)(struct crypto_tfm *tfm, u8 *out); 308 int (*final)(struct hash_desc *desc, u8 *out);
198 void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, 309 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
199 unsigned int nsg, u8 *out); 310 unsigned int nsg, u8 *out);
200 int (*dit_setkey)(struct crypto_tfm *tfm, 311 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
201 const u8 *key, unsigned int keylen); 312 unsigned int keylen);
202#ifdef CONFIG_CRYPTO_HMAC 313 unsigned int digestsize;
203 void *dit_hmac_block;
204#endif
205}; 314};
206 315
207struct compress_tfm { 316struct compress_tfm {
@@ -213,8 +322,9 @@ struct compress_tfm {
213 u8 *dst, unsigned int *dlen); 322 u8 *dst, unsigned int *dlen);
214}; 323};
215 324
325#define crt_blkcipher crt_u.blkcipher
216#define crt_cipher crt_u.cipher 326#define crt_cipher crt_u.cipher
217#define crt_digest crt_u.digest 327#define crt_hash crt_u.hash
218#define crt_compress crt_u.compress 328#define crt_compress crt_u.compress
219 329
220struct crypto_tfm { 330struct crypto_tfm {
@@ -222,30 +332,43 @@ struct crypto_tfm {
222 u32 crt_flags; 332 u32 crt_flags;
223 333
224 union { 334 union {
335 struct blkcipher_tfm blkcipher;
225 struct cipher_tfm cipher; 336 struct cipher_tfm cipher;
226 struct digest_tfm digest; 337 struct hash_tfm hash;
227 struct compress_tfm compress; 338 struct compress_tfm compress;
228 } crt_u; 339 } crt_u;
229 340
230 struct crypto_alg *__crt_alg; 341 struct crypto_alg *__crt_alg;
231 342
232 char __crt_ctx[] __attribute__ ((__aligned__)); 343 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
344};
345
346#define crypto_cipher crypto_tfm
347#define crypto_comp crypto_tfm
348
349struct crypto_blkcipher {
350 struct crypto_tfm base;
351};
352
353struct crypto_hash {
354 struct crypto_tfm base;
355};
356
357enum {
358 CRYPTOA_UNSPEC,
359 CRYPTOA_ALG,
360};
361
362struct crypto_attr_alg {
363 char name[CRYPTO_MAX_ALG_NAME];
233}; 364};
234 365
235/* 366/*
236 * Transform user interface. 367 * Transform user interface.
237 */ 368 */
238 369
239/*
240 * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm.
241 * If that fails and the kernel supports dynamically loadable modules, it
242 * will then attempt to load a module of the same name or alias. A refcount
243 * is grabbed on the algorithm which is then associated with the new transform.
244 *
245 * crypto_free_tfm() frees up the transform and any associated resources,
246 * then drops the refcount on the associated algorithm.
247 */
248struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); 370struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
371struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
249void crypto_free_tfm(struct crypto_tfm *tfm); 372void crypto_free_tfm(struct crypto_tfm *tfm);
250 373
251/* 374/*
@@ -256,6 +379,16 @@ static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm)
256 return tfm->__crt_alg->cra_name; 379 return tfm->__crt_alg->cra_name;
257} 380}
258 381
382static inline const char *crypto_tfm_alg_driver_name(struct crypto_tfm *tfm)
383{
384 return tfm->__crt_alg->cra_driver_name;
385}
386
387static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm)
388{
389 return tfm->__crt_alg->cra_priority;
390}
391
259static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) 392static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm)
260{ 393{
261 return module_name(tfm->__crt_alg->cra_module); 394 return module_name(tfm->__crt_alg->cra_module);
@@ -266,18 +399,23 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
266 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; 399 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
267} 400}
268 401
402static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
403 __deprecated;
269static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) 404static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
270{ 405{
271 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 406 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
272 return tfm->__crt_alg->cra_cipher.cia_min_keysize; 407 return tfm->__crt_alg->cra_cipher.cia_min_keysize;
273} 408}
274 409
410static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
411 __deprecated;
275static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) 412static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
276{ 413{
277 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 414 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
278 return tfm->__crt_alg->cra_cipher.cia_max_keysize; 415 return tfm->__crt_alg->cra_cipher.cia_max_keysize;
279} 416}
280 417
418static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated;
281static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) 419static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm)
282{ 420{
283 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 421 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
@@ -300,6 +438,21 @@ static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
300 return tfm->__crt_alg->cra_alignmask; 438 return tfm->__crt_alg->cra_alignmask;
301} 439}
302 440
441static inline u32 crypto_tfm_get_flags(struct crypto_tfm *tfm)
442{
443 return tfm->crt_flags;
444}
445
446static inline void crypto_tfm_set_flags(struct crypto_tfm *tfm, u32 flags)
447{
448 tfm->crt_flags |= flags;
449}
450
451static inline void crypto_tfm_clear_flags(struct crypto_tfm *tfm, u32 flags)
452{
453 tfm->crt_flags &= ~flags;
454}
455
303static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) 456static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
304{ 457{
305 return tfm->__crt_ctx; 458 return tfm->__crt_ctx;
@@ -314,50 +467,374 @@ static inline unsigned int crypto_tfm_ctx_alignment(void)
314/* 467/*
315 * API wrappers. 468 * API wrappers.
316 */ 469 */
317static inline void crypto_digest_init(struct crypto_tfm *tfm) 470static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
471 struct crypto_tfm *tfm)
318{ 472{
319 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 473 return (struct crypto_blkcipher *)tfm;
320 tfm->crt_digest.dit_init(tfm);
321} 474}
322 475
323static inline void crypto_digest_update(struct crypto_tfm *tfm, 476static inline struct crypto_blkcipher *crypto_blkcipher_cast(
324 struct scatterlist *sg, 477 struct crypto_tfm *tfm)
325 unsigned int nsg)
326{ 478{
327 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 479 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_BLKCIPHER);
328 tfm->crt_digest.dit_update(tfm, sg, nsg); 480 return __crypto_blkcipher_cast(tfm);
329} 481}
330 482
331static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) 483static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
484 const char *alg_name, u32 type, u32 mask)
332{ 485{
333 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 486 type &= ~CRYPTO_ALG_TYPE_MASK;
334 tfm->crt_digest.dit_final(tfm, out); 487 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
488 mask |= CRYPTO_ALG_TYPE_MASK;
489
490 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
335} 491}
336 492
337static inline void crypto_digest_digest(struct crypto_tfm *tfm, 493static inline struct crypto_tfm *crypto_blkcipher_tfm(
338 struct scatterlist *sg, 494 struct crypto_blkcipher *tfm)
339 unsigned int nsg, u8 *out)
340{ 495{
341 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 496 return &tfm->base;
342 tfm->crt_digest.dit_digest(tfm, sg, nsg, out);
343} 497}
344 498
345static inline int crypto_digest_setkey(struct crypto_tfm *tfm, 499static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
500{
501 crypto_free_tfm(crypto_blkcipher_tfm(tfm));
502}
503
504static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
505{
506 type &= ~CRYPTO_ALG_TYPE_MASK;
507 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
508 mask |= CRYPTO_ALG_TYPE_MASK;
509
510 return crypto_has_alg(alg_name, type, mask);
511}
512
513static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm)
514{
515 return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm));
516}
517
518static inline struct blkcipher_tfm *crypto_blkcipher_crt(
519 struct crypto_blkcipher *tfm)
520{
521 return &crypto_blkcipher_tfm(tfm)->crt_blkcipher;
522}
523
524static inline struct blkcipher_alg *crypto_blkcipher_alg(
525 struct crypto_blkcipher *tfm)
526{
527 return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher;
528}
529
530static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm)
531{
532 return crypto_blkcipher_alg(tfm)->ivsize;
533}
534
535static inline unsigned int crypto_blkcipher_blocksize(
536 struct crypto_blkcipher *tfm)
537{
538 return crypto_tfm_alg_blocksize(crypto_blkcipher_tfm(tfm));
539}
540
541static inline unsigned int crypto_blkcipher_alignmask(
542 struct crypto_blkcipher *tfm)
543{
544 return crypto_tfm_alg_alignmask(crypto_blkcipher_tfm(tfm));
545}
546
547static inline u32 crypto_blkcipher_get_flags(struct crypto_blkcipher *tfm)
548{
549 return crypto_tfm_get_flags(crypto_blkcipher_tfm(tfm));
550}
551
552static inline void crypto_blkcipher_set_flags(struct crypto_blkcipher *tfm,
553 u32 flags)
554{
555 crypto_tfm_set_flags(crypto_blkcipher_tfm(tfm), flags);
556}
557
558static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm,
559 u32 flags)
560{
561 crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags);
562}
563
564static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm,
565 const u8 *key, unsigned int keylen)
566{
567 return crypto_blkcipher_crt(tfm)->setkey(crypto_blkcipher_tfm(tfm),
568 key, keylen);
569}
570
571static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
572 struct scatterlist *dst,
573 struct scatterlist *src,
574 unsigned int nbytes)
575{
576 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
577 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
578}
579
580static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
581 struct scatterlist *dst,
582 struct scatterlist *src,
583 unsigned int nbytes)
584{
585 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
586}
587
588static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
589 struct scatterlist *dst,
590 struct scatterlist *src,
591 unsigned int nbytes)
592{
593 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
594 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
595}
596
597static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
598 struct scatterlist *dst,
599 struct scatterlist *src,
600 unsigned int nbytes)
601{
602 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
603}
604
605static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm,
606 const u8 *src, unsigned int len)
607{
608 memcpy(crypto_blkcipher_crt(tfm)->iv, src, len);
609}
610
611static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm,
612 u8 *dst, unsigned int len)
613{
614 memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len);
615}
616
617static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm)
618{
619 return (struct crypto_cipher *)tfm;
620}
621
622static inline struct crypto_cipher *crypto_cipher_cast(struct crypto_tfm *tfm)
623{
624 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
625 return __crypto_cipher_cast(tfm);
626}
627
628static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
629 u32 type, u32 mask)
630{
631 type &= ~CRYPTO_ALG_TYPE_MASK;
632 type |= CRYPTO_ALG_TYPE_CIPHER;
633 mask |= CRYPTO_ALG_TYPE_MASK;
634
635 return __crypto_cipher_cast(crypto_alloc_base(alg_name, type, mask));
636}
637
638static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
639{
640 return tfm;
641}
642
643static inline void crypto_free_cipher(struct crypto_cipher *tfm)
644{
645 crypto_free_tfm(crypto_cipher_tfm(tfm));
646}
647
648static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask)
649{
650 type &= ~CRYPTO_ALG_TYPE_MASK;
651 type |= CRYPTO_ALG_TYPE_CIPHER;
652 mask |= CRYPTO_ALG_TYPE_MASK;
653
654 return crypto_has_alg(alg_name, type, mask);
655}
656
657static inline struct cipher_tfm *crypto_cipher_crt(struct crypto_cipher *tfm)
658{
659 return &crypto_cipher_tfm(tfm)->crt_cipher;
660}
661
662static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm)
663{
664 return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm));
665}
666
667static inline unsigned int crypto_cipher_alignmask(struct crypto_cipher *tfm)
668{
669 return crypto_tfm_alg_alignmask(crypto_cipher_tfm(tfm));
670}
671
672static inline u32 crypto_cipher_get_flags(struct crypto_cipher *tfm)
673{
674 return crypto_tfm_get_flags(crypto_cipher_tfm(tfm));
675}
676
677static inline void crypto_cipher_set_flags(struct crypto_cipher *tfm,
678 u32 flags)
679{
680 crypto_tfm_set_flags(crypto_cipher_tfm(tfm), flags);
681}
682
683static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm,
684 u32 flags)
685{
686 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags);
687}
688
689static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
346 const u8 *key, unsigned int keylen) 690 const u8 *key, unsigned int keylen)
347{ 691{
348 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 692 return crypto_cipher_crt(tfm)->cit_setkey(crypto_cipher_tfm(tfm),
349 if (tfm->crt_digest.dit_setkey == NULL) 693 key, keylen);
350 return -ENOSYS; 694}
351 return tfm->crt_digest.dit_setkey(tfm, key, keylen); 695
696static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
697 u8 *dst, const u8 *src)
698{
699 crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm),
700 dst, src);
701}
702
703static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
704 u8 *dst, const u8 *src)
705{
706 crypto_cipher_crt(tfm)->cit_decrypt_one(crypto_cipher_tfm(tfm),
707 dst, src);
352} 708}
353 709
354static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, 710void crypto_digest_init(struct crypto_tfm *tfm) __deprecated_for_modules;
711void crypto_digest_update(struct crypto_tfm *tfm,
712 struct scatterlist *sg, unsigned int nsg)
713 __deprecated_for_modules;
714void crypto_digest_final(struct crypto_tfm *tfm, u8 *out)
715 __deprecated_for_modules;
716void crypto_digest_digest(struct crypto_tfm *tfm,
717 struct scatterlist *sg, unsigned int nsg, u8 *out)
718 __deprecated_for_modules;
719
720static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm)
721{
722 return (struct crypto_hash *)tfm;
723}
724
725static inline struct crypto_hash *crypto_hash_cast(struct crypto_tfm *tfm)
726{
727 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_HASH) &
728 CRYPTO_ALG_TYPE_HASH_MASK);
729 return __crypto_hash_cast(tfm);
730}
731
732static int crypto_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
733 unsigned int keylen) __deprecated;
734static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
355 const u8 *key, unsigned int keylen) 735 const u8 *key, unsigned int keylen)
356{ 736{
357 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 737 return tfm->crt_hash.setkey(crypto_hash_cast(tfm), key, keylen);
358 return tfm->crt_cipher.cit_setkey(tfm, key, keylen);
359} 738}
360 739
740static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
741 u32 type, u32 mask)
742{
743 type &= ~CRYPTO_ALG_TYPE_MASK;
744 type |= CRYPTO_ALG_TYPE_HASH;
745 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
746
747 return __crypto_hash_cast(crypto_alloc_base(alg_name, type, mask));
748}
749
750static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
751{
752 return &tfm->base;
753}
754
755static inline void crypto_free_hash(struct crypto_hash *tfm)
756{
757 crypto_free_tfm(crypto_hash_tfm(tfm));
758}
759
760static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
761{
762 type &= ~CRYPTO_ALG_TYPE_MASK;
763 type |= CRYPTO_ALG_TYPE_HASH;
764 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
765
766 return crypto_has_alg(alg_name, type, mask);
767}
768
769static inline struct hash_tfm *crypto_hash_crt(struct crypto_hash *tfm)
770{
771 return &crypto_hash_tfm(tfm)->crt_hash;
772}
773
774static inline unsigned int crypto_hash_blocksize(struct crypto_hash *tfm)
775{
776 return crypto_tfm_alg_blocksize(crypto_hash_tfm(tfm));
777}
778
779static inline unsigned int crypto_hash_alignmask(struct crypto_hash *tfm)
780{
781 return crypto_tfm_alg_alignmask(crypto_hash_tfm(tfm));
782}
783
784static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm)
785{
786 return crypto_hash_crt(tfm)->digestsize;
787}
788
789static inline u32 crypto_hash_get_flags(struct crypto_hash *tfm)
790{
791 return crypto_tfm_get_flags(crypto_hash_tfm(tfm));
792}
793
794static inline void crypto_hash_set_flags(struct crypto_hash *tfm, u32 flags)
795{
796 crypto_tfm_set_flags(crypto_hash_tfm(tfm), flags);
797}
798
799static inline void crypto_hash_clear_flags(struct crypto_hash *tfm, u32 flags)
800{
801 crypto_tfm_clear_flags(crypto_hash_tfm(tfm), flags);
802}
803
804static inline int crypto_hash_init(struct hash_desc *desc)
805{
806 return crypto_hash_crt(desc->tfm)->init(desc);
807}
808
809static inline int crypto_hash_update(struct hash_desc *desc,
810 struct scatterlist *sg,
811 unsigned int nbytes)
812{
813 return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes);
814}
815
816static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
817{
818 return crypto_hash_crt(desc->tfm)->final(desc, out);
819}
820
821static inline int crypto_hash_digest(struct hash_desc *desc,
822 struct scatterlist *sg,
823 unsigned int nbytes, u8 *out)
824{
825 return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out);
826}
827
828static inline int crypto_hash_setkey(struct crypto_hash *hash,
829 const u8 *key, unsigned int keylen)
830{
831 return crypto_hash_crt(hash)->setkey(hash, key, keylen);
832}
833
834static int crypto_cipher_encrypt(struct crypto_tfm *tfm,
835 struct scatterlist *dst,
836 struct scatterlist *src,
837 unsigned int nbytes) __deprecated;
361static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, 838static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
362 struct scatterlist *dst, 839 struct scatterlist *dst,
363 struct scatterlist *src, 840 struct scatterlist *src,
@@ -367,16 +844,23 @@ static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
367 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); 844 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
368} 845}
369 846
847static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
848 struct scatterlist *dst,
849 struct scatterlist *src,
850 unsigned int nbytes, u8 *iv) __deprecated;
370static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, 851static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
371 struct scatterlist *dst, 852 struct scatterlist *dst,
372 struct scatterlist *src, 853 struct scatterlist *src,
373 unsigned int nbytes, u8 *iv) 854 unsigned int nbytes, u8 *iv)
374{ 855{
375 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 856 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
376 BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
377 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); 857 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
378} 858}
379 859
860static int crypto_cipher_decrypt(struct crypto_tfm *tfm,
861 struct scatterlist *dst,
862 struct scatterlist *src,
863 unsigned int nbytes) __deprecated;
380static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, 864static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
381 struct scatterlist *dst, 865 struct scatterlist *dst,
382 struct scatterlist *src, 866 struct scatterlist *src,
@@ -386,16 +870,21 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
386 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); 870 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
387} 871}
388 872
873static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
874 struct scatterlist *dst,
875 struct scatterlist *src,
876 unsigned int nbytes, u8 *iv) __deprecated;
389static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, 877static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
390 struct scatterlist *dst, 878 struct scatterlist *dst,
391 struct scatterlist *src, 879 struct scatterlist *src,
392 unsigned int nbytes, u8 *iv) 880 unsigned int nbytes, u8 *iv)
393{ 881{
394 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 882 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
395 BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
396 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); 883 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
397} 884}
398 885
886static void crypto_cipher_set_iv(struct crypto_tfm *tfm,
887 const u8 *src, unsigned int len) __deprecated;
399static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, 888static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
400 const u8 *src, unsigned int len) 889 const u8 *src, unsigned int len)
401{ 890{
@@ -403,6 +892,8 @@ static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
403 memcpy(tfm->crt_cipher.cit_iv, src, len); 892 memcpy(tfm->crt_cipher.cit_iv, src, len);
404} 893}
405 894
895static void crypto_cipher_get_iv(struct crypto_tfm *tfm,
896 u8 *dst, unsigned int len) __deprecated;
406static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, 897static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
407 u8 *dst, unsigned int len) 898 u8 *dst, unsigned int len)
408{ 899{
@@ -410,34 +901,70 @@ static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
410 memcpy(dst, tfm->crt_cipher.cit_iv, len); 901 memcpy(dst, tfm->crt_cipher.cit_iv, len);
411} 902}
412 903
413static inline int crypto_comp_compress(struct crypto_tfm *tfm, 904static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm)
905{
906 return (struct crypto_comp *)tfm;
907}
908
909static inline struct crypto_comp *crypto_comp_cast(struct crypto_tfm *tfm)
910{
911 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_COMPRESS) &
912 CRYPTO_ALG_TYPE_MASK);
913 return __crypto_comp_cast(tfm);
914}
915
916static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,
917 u32 type, u32 mask)
918{
919 type &= ~CRYPTO_ALG_TYPE_MASK;
920 type |= CRYPTO_ALG_TYPE_COMPRESS;
921 mask |= CRYPTO_ALG_TYPE_MASK;
922
923 return __crypto_comp_cast(crypto_alloc_base(alg_name, type, mask));
924}
925
926static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
927{
928 return tfm;
929}
930
931static inline void crypto_free_comp(struct crypto_comp *tfm)
932{
933 crypto_free_tfm(crypto_comp_tfm(tfm));
934}
935
936static inline int crypto_has_comp(const char *alg_name, u32 type, u32 mask)
937{
938 type &= ~CRYPTO_ALG_TYPE_MASK;
939 type |= CRYPTO_ALG_TYPE_COMPRESS;
940 mask |= CRYPTO_ALG_TYPE_MASK;
941
942 return crypto_has_alg(alg_name, type, mask);
943}
944
945static inline const char *crypto_comp_name(struct crypto_comp *tfm)
946{
947 return crypto_tfm_alg_name(crypto_comp_tfm(tfm));
948}
949
950static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm)
951{
952 return &crypto_comp_tfm(tfm)->crt_compress;
953}
954
955static inline int crypto_comp_compress(struct crypto_comp *tfm,
414 const u8 *src, unsigned int slen, 956 const u8 *src, unsigned int slen,
415 u8 *dst, unsigned int *dlen) 957 u8 *dst, unsigned int *dlen)
416{ 958{
417 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); 959 return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen);
418 return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen);
419} 960}
420 961
421static inline int crypto_comp_decompress(struct crypto_tfm *tfm, 962static inline int crypto_comp_decompress(struct crypto_comp *tfm,
422 const u8 *src, unsigned int slen, 963 const u8 *src, unsigned int slen,
423 u8 *dst, unsigned int *dlen) 964 u8 *dst, unsigned int *dlen)
424{ 965{
425 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); 966 return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen);
426 return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen);
427} 967}
428 968
429/*
430 * HMAC support.
431 */
432#ifdef CONFIG_CRYPTO_HMAC
433void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen);
434void crypto_hmac_update(struct crypto_tfm *tfm,
435 struct scatterlist *sg, unsigned int nsg);
436void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key,
437 unsigned int *keylen, u8 *out);
438void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen,
439 struct scatterlist *sg, unsigned int nsg, u8 *out);
440#endif /* CONFIG_CRYPTO_HMAC */
441
442#endif /* _LINUX_CRYPTO_H */ 969#endif /* _LINUX_CRYPTO_H */
443 970
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 0dd1610a94..44605be594 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -114,6 +114,18 @@ struct dentry {
114 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 114 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
115}; 115};
116 116
117/*
118 * dentry->d_lock spinlock nesting subclasses:
119 *
120 * 0: normal
121 * 1: nested
122 */
123enum dentry_d_lock_class
124{
125 DENTRY_D_LOCK_NORMAL, /* implicitly used by plain spin_lock() APIs. */
126 DENTRY_D_LOCK_NESTED
127};
128
117struct dentry_operations { 129struct dentry_operations {
118 int (*d_revalidate)(struct dentry *, struct nameidata *); 130 int (*d_revalidate)(struct dentry *, struct nameidata *);
119 int (*d_hash) (struct dentry *, struct qstr *); 131 int (*d_hash) (struct dentry *, struct qstr *);
@@ -209,6 +221,7 @@ static inline int dname_external(struct dentry *dentry)
209 */ 221 */
210extern void d_instantiate(struct dentry *, struct inode *); 222extern void d_instantiate(struct dentry *, struct inode *);
211extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 223extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
224extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
212extern void d_delete(struct dentry *); 225extern void d_delete(struct dentry *);
213 226
214/* allocate/de-allocate */ 227/* allocate/de-allocate */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 676333b9fa..d6f4ec467a 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -169,6 +169,12 @@ enum {
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171 171
172/* DCCP CCIDS */
173enum {
174 DCCPC_CCID2 = 2,
175 DCCPC_CCID3 = 3,
176};
177
172/* DCCP features */ 178/* DCCP features */
173enum { 179enum {
174 DCCPF_RESERVED = 0, 180 DCCPF_RESERVED = 0,
@@ -320,7 +326,7 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
320/* initial values for each feature */ 326/* initial values for each feature */
321#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 327#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
322#define DCCPF_INITIAL_ACK_RATIO 2 328#define DCCPF_INITIAL_ACK_RATIO 2
323#define DCCPF_INITIAL_CCID 2 329#define DCCPF_INITIAL_CCID DCCPC_CCID2
324#define DCCPF_INITIAL_SEND_ACK_VECTOR 1 330#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
325/* FIXME: for now we're default to 1 but it should really be 0 */ 331/* FIXME: for now we're default to 1 but it should really be 0 */
326#define DCCPF_INITIAL_SEND_NDP_COUNT 1 332#define DCCPF_INITIAL_SEND_NDP_COUNT 1
@@ -404,6 +410,7 @@ struct dccp_service_list {
404}; 410};
405 411
406#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) 412#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
413#define DCCP_SERVICE_CODE_IS_ABSENT 0
407 414
408static inline int dccp_list_has_service(const struct dccp_service_list *sl, 415static inline int dccp_list_has_service(const struct dccp_service_list *sl,
409 const __be32 service) 416 const __be32 service)
@@ -438,6 +445,7 @@ struct dccp_ackvec;
438 * @dccps_role - Role of this sock, one of %dccp_role 445 * @dccps_role - Role of this sock, one of %dccp_role
439 * @dccps_ndp_count - number of Non Data Packets since last data packet 446 * @dccps_ndp_count - number of Non Data Packets since last data packet
440 * @dccps_hc_rx_ackvec - rx half connection ack vector 447 * @dccps_hc_rx_ackvec - rx half connection ack vector
448 * @dccps_xmit_timer - timer for when CCID is not ready to send
441 */ 449 */
442struct dccp_sock { 450struct dccp_sock {
443 /* inet_connection_sock has to be the first member of dccp_sock */ 451 /* inet_connection_sock has to be the first member of dccp_sock */
@@ -470,6 +478,7 @@ struct dccp_sock {
470 enum dccp_role dccps_role:2; 478 enum dccp_role dccps_role:2;
471 __u8 dccps_hc_rx_insert_options:1; 479 __u8 dccps_hc_rx_insert_options:1;
472 __u8 dccps_hc_tx_insert_options:1; 480 __u8 dccps_hc_tx_insert_options:1;
481 struct timer_list dccps_xmit_timer;
473}; 482};
474 483
475static inline struct dccp_sock *dccp_sk(const struct sock *sk) 484static inline struct dccp_sock *dccp_sk(const struct sock *sk)
@@ -482,11 +491,6 @@ static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
482 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock; 491 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
483} 492}
484 493
485static inline int dccp_service_not_initialized(const struct sock *sk)
486{
487 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE;
488}
489
490static inline const char *dccp_role(const struct sock *sk) 494static inline const char *dccp_role(const struct sock *sk)
491{ 495{
492 switch (dccp_sk(sk)->dccps_role) { 496 switch (dccp_sk(sk)->dccps_role) {
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
new file mode 100644
index 0000000000..88dafa246d
--- /dev/null
+++ b/include/linux/debug_locks.h
@@ -0,0 +1,71 @@
1#ifndef __LINUX_DEBUG_LOCKING_H
2#define __LINUX_DEBUG_LOCKING_H
3
4struct task_struct;
5
6extern int debug_locks;
7extern int debug_locks_silent;
8
9/*
10 * Generic 'turn off all lock debugging' function:
11 */
12extern int debug_locks_off(void);
13
14/*
15 * In the debug case we carry the caller's instruction pointer into
16 * other functions, but we dont want the function argument overhead
17 * in the nondebug case - hence these macros:
18 */
19#define _RET_IP_ (unsigned long)__builtin_return_address(0)
20#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
21
22#define DEBUG_LOCKS_WARN_ON(c) \
23({ \
24 int __ret = 0; \
25 \
26 if (unlikely(c)) { \
27 if (debug_locks_off()) \
28 WARN_ON(1); \
29 __ret = 1; \
30 } \
31 __ret; \
32})
33
34#ifdef CONFIG_SMP
35# define SMP_DEBUG_LOCKS_WARN_ON(c) DEBUG_LOCKS_WARN_ON(c)
36#else
37# define SMP_DEBUG_LOCKS_WARN_ON(c) do { } while (0)
38#endif
39
40#ifdef CONFIG_DEBUG_LOCKING_API_SELFTESTS
41 extern void locking_selftest(void);
42#else
43# define locking_selftest() do { } while (0)
44#endif
45
46#ifdef CONFIG_LOCKDEP
47extern void debug_show_all_locks(void);
48extern void debug_show_held_locks(struct task_struct *task);
49extern void debug_check_no_locks_freed(const void *from, unsigned long len);
50extern void debug_check_no_locks_held(struct task_struct *task);
51#else
52static inline void debug_show_all_locks(void)
53{
54}
55
56static inline void debug_show_held_locks(struct task_struct *task)
57{
58}
59
60static inline void
61debug_check_no_locks_freed(const void *from, unsigned long len)
62{
63}
64
65static inline void
66debug_check_no_locks_held(struct task_struct *task)
67{
68}
69#endif
70
71#endif
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
new file mode 100644
index 0000000000..561e2a7780
--- /dev/null
+++ b/include/linux/delayacct.h
@@ -0,0 +1,121 @@
1/* delayacct.h - per-task delay accounting
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_DELAYACCT_H
18#define _LINUX_DELAYACCT_H
19
20#include <linux/sched.h>
21#include <linux/taskstats_kern.h>
22
23/*
24 * Per-task flags relevant to delay accounting
25 * maintained privately to avoid exhausting similar flags in sched.h:PF_*
26 * Used to set current->delays->flags
27 */
28#define DELAYACCT_PF_SWAPIN 0x00000001 /* I am doing a swapin */
29
30#ifdef CONFIG_TASK_DELAY_ACCT
31
32extern int delayacct_on; /* Delay accounting turned on/off */
33extern kmem_cache_t *delayacct_cache;
34extern void delayacct_init(void);
35extern void __delayacct_tsk_init(struct task_struct *);
36extern void __delayacct_tsk_exit(struct task_struct *);
37extern void __delayacct_blkio_start(void);
38extern void __delayacct_blkio_end(void);
39extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
40extern __u64 __delayacct_blkio_ticks(struct task_struct *);
41
42static inline void delayacct_set_flag(int flag)
43{
44 if (current->delays)
45 current->delays->flags |= flag;
46}
47
48static inline void delayacct_clear_flag(int flag)
49{
50 if (current->delays)
51 current->delays->flags &= ~flag;
52}
53
54static inline void delayacct_tsk_init(struct task_struct *tsk)
55{
56 /* reinitialize in case parent's non-null pointer was dup'ed*/
57 tsk->delays = NULL;
58 if (delayacct_on)
59 __delayacct_tsk_init(tsk);
60}
61
62/* Free tsk->delays. Called from bad fork and __put_task_struct
63 * where there's no risk of tsk->delays being accessed elsewhere
64 */
65static inline void delayacct_tsk_free(struct task_struct *tsk)
66{
67 if (tsk->delays)
68 kmem_cache_free(delayacct_cache, tsk->delays);
69 tsk->delays = NULL;
70}
71
72static inline void delayacct_blkio_start(void)
73{
74 if (current->delays)
75 __delayacct_blkio_start();
76}
77
78static inline void delayacct_blkio_end(void)
79{
80 if (current->delays)
81 __delayacct_blkio_end();
82}
83
84static inline int delayacct_add_tsk(struct taskstats *d,
85 struct task_struct *tsk)
86{
87 if (!delayacct_on || !tsk->delays)
88 return 0;
89 return __delayacct_add_tsk(d, tsk);
90}
91
92static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
93{
94 if (tsk->delays)
95 return __delayacct_blkio_ticks(tsk);
96 return 0;
97}
98
99#else
100static inline void delayacct_set_flag(int flag)
101{}
102static inline void delayacct_clear_flag(int flag)
103{}
104static inline void delayacct_init(void)
105{}
106static inline void delayacct_tsk_init(struct task_struct *tsk)
107{}
108static inline void delayacct_tsk_free(struct task_struct *tsk)
109{}
110static inline void delayacct_blkio_start(void)
111{}
112static inline void delayacct_blkio_end(void)
113{}
114static inline int delayacct_add_tsk(struct taskstats *d,
115 struct task_struct *tsk)
116{ return 0; }
117static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
118{ return 0; }
119#endif /* CONFIG_TASK_DELAY_ACCT */
120
121#endif
diff --git a/include/linux/devfs_fs.h b/include/linux/devfs_fs.h
deleted file mode 100644
index de236f4318..0000000000
--- a/include/linux/devfs_fs.h
+++ /dev/null
@@ -1,41 +0,0 @@
1#ifndef _LINUX_DEVFS_FS_H
2#define _LINUX_DEVFS_FS_H
3
4#include <linux/ioctl.h>
5
6#define DEVFSD_PROTOCOL_REVISION_KERNEL 5
7
8#define DEVFSD_IOCTL_BASE 'd'
9
10/* These are the various ioctls */
11#define DEVFSDIOC_GET_PROTO_REV _IOR(DEVFSD_IOCTL_BASE, 0, int)
12#define DEVFSDIOC_SET_EVENT_MASK _IOW(DEVFSD_IOCTL_BASE, 2, int)
13#define DEVFSDIOC_RELEASE_EVENT_QUEUE _IOW(DEVFSD_IOCTL_BASE, 3, int)
14#define DEVFSDIOC_SET_DEBUG_MASK _IOW(DEVFSD_IOCTL_BASE, 4, int)
15
16#define DEVFSD_NOTIFY_REGISTERED 0
17#define DEVFSD_NOTIFY_UNREGISTERED 1
18#define DEVFSD_NOTIFY_ASYNC_OPEN 2
19#define DEVFSD_NOTIFY_CLOSE 3
20#define DEVFSD_NOTIFY_LOOKUP 4
21#define DEVFSD_NOTIFY_CHANGE 5
22#define DEVFSD_NOTIFY_CREATE 6
23#define DEVFSD_NOTIFY_DELETE 7
24
25#define DEVFS_PATHLEN 1024 /* Never change this otherwise the
26 binary interface will change */
27
28struct devfsd_notify_struct { /* Use native C types to ensure same types in kernel and user space */
29 unsigned int type; /* DEVFSD_NOTIFY_* value */
30 unsigned int mode; /* Mode of the inode or device entry */
31 unsigned int major; /* Major number of device entry */
32 unsigned int minor; /* Minor number of device entry */
33 unsigned int uid; /* Uid of process, inode or device entry */
34 unsigned int gid; /* Gid of process, inode or device entry */
35 unsigned int overrun_count; /* Number of lost events */
36 unsigned int namelen; /* Number of characters not including '\0' */
37 /* The device name MUST come last */
38 char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */
39};
40
41#endif /* _LINUX_DEVFS_FS_H */
diff --git a/include/linux/devfs_fs_kernel.h b/include/linux/devfs_fs_kernel.h
deleted file mode 100644
index 0d74a6f22a..0000000000
--- a/include/linux/devfs_fs_kernel.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _LINUX_DEVFS_FS_KERNEL_H
2#define _LINUX_DEVFS_FS_KERNEL_H
3
4#include <linux/fs.h>
5#include <linux/spinlock.h>
6#include <linux/types.h>
7
8#include <asm/semaphore.h>
9
10#define DEVFS_SUPER_MAGIC 0x1373
11
12#ifdef CONFIG_DEVFS_FS
13extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
14 __attribute__ ((format(printf, 3, 4)));
15extern int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
16 __attribute__ ((format(printf, 3, 4)));
17extern int devfs_mk_symlink(const char *name, const char *link);
18extern int devfs_mk_dir(const char *fmt, ...)
19 __attribute__ ((format(printf, 1, 2)));
20extern void devfs_remove(const char *fmt, ...)
21 __attribute__ ((format(printf, 1, 2)));
22extern int devfs_register_tape(const char *name);
23extern void devfs_unregister_tape(int num);
24extern void mount_devfs_fs(void);
25#else /* CONFIG_DEVFS_FS */
26static inline int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
27{
28 return 0;
29}
30static inline int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
31{
32 return 0;
33}
34static inline int devfs_mk_symlink(const char *name, const char *link)
35{
36 return 0;
37}
38static inline int devfs_mk_dir(const char *fmt, ...)
39{
40 return 0;
41}
42static inline void devfs_remove(const char *fmt, ...)
43{
44}
45static inline int devfs_register_tape(const char *name)
46{
47 return -1;
48}
49static inline void devfs_unregister_tape(int num)
50{
51}
52static inline void mount_devfs_fs(void)
53{
54 return;
55}
56#endif /* CONFIG_DEVFS_FS */
57#endif /* _LINUX_DEVFS_FS_KERNEL_H */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index aee10b2ea4..e3d1c33d15 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -8,9 +8,12 @@
8#ifndef _LINUX_DEVICE_MAPPER_H 8#ifndef _LINUX_DEVICE_MAPPER_H
9#define _LINUX_DEVICE_MAPPER_H 9#define _LINUX_DEVICE_MAPPER_H
10 10
11#ifdef __KERNEL__
12
11struct dm_target; 13struct dm_target;
12struct dm_table; 14struct dm_table;
13struct dm_dev; 15struct dm_dev;
16struct mapped_device;
14 17
15typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; 18typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
16 19
@@ -78,7 +81,7 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d);
78struct target_type { 81struct target_type {
79 const char *name; 82 const char *name;
80 struct module *module; 83 struct module *module;
81 unsigned version[3]; 84 unsigned version[3];
82 dm_ctr_fn ctr; 85 dm_ctr_fn ctr;
83 dm_dtr_fn dtr; 86 dm_dtr_fn dtr;
84 dm_map_fn map; 87 dm_map_fn map;
@@ -128,4 +131,108 @@ struct dm_target {
128int dm_register_target(struct target_type *t); 131int dm_register_target(struct target_type *t);
129int dm_unregister_target(struct target_type *t); 132int dm_unregister_target(struct target_type *t);
130 133
131#endif /* _LINUX_DEVICE_MAPPER_H */ 134
135/*-----------------------------------------------------------------
136 * Functions for creating and manipulating mapped devices.
137 * Drop the reference with dm_put when you finish with the object.
138 *---------------------------------------------------------------*/
139
140/*
141 * DM_ANY_MINOR chooses the next available minor number.
142 */
143#define DM_ANY_MINOR (-1)
144int dm_create(int minor, struct mapped_device **md);
145
146/*
147 * Reference counting for md.
148 */
149struct mapped_device *dm_get_md(dev_t dev);
150void dm_get(struct mapped_device *md);
151void dm_put(struct mapped_device *md);
152
153/*
154 * An arbitrary pointer may be stored alongside a mapped device.
155 */
156void dm_set_mdptr(struct mapped_device *md, void *ptr);
157void *dm_get_mdptr(struct mapped_device *md);
158
159/*
160 * A device can still be used while suspended, but I/O is deferred.
161 */
162int dm_suspend(struct mapped_device *md, int with_lockfs);
163int dm_resume(struct mapped_device *md);
164
165/*
166 * Event functions.
167 */
168uint32_t dm_get_event_nr(struct mapped_device *md);
169int dm_wait_event(struct mapped_device *md, int event_nr);
170
171/*
172 * Info functions.
173 */
174const char *dm_device_name(struct mapped_device *md);
175struct gendisk *dm_disk(struct mapped_device *md);
176int dm_suspended(struct mapped_device *md);
177
178/*
179 * Geometry functions.
180 */
181int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
182int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
183
184
185/*-----------------------------------------------------------------
186 * Functions for manipulating device-mapper tables.
187 *---------------------------------------------------------------*/
188
189/*
190 * First create an empty table.
191 */
192int dm_table_create(struct dm_table **result, int mode,
193 unsigned num_targets, struct mapped_device *md);
194
195/*
196 * Then call this once for each target.
197 */
198int dm_table_add_target(struct dm_table *t, const char *type,
199 sector_t start, sector_t len, char *params);
200
201/*
202 * Finally call this to make the table ready for use.
203 */
204int dm_table_complete(struct dm_table *t);
205
206/*
207 * Table reference counting.
208 */
209struct dm_table *dm_get_table(struct mapped_device *md);
210void dm_table_get(struct dm_table *t);
211void dm_table_put(struct dm_table *t);
212
213/*
214 * Queries
215 */
216sector_t dm_table_get_size(struct dm_table *t);
217unsigned int dm_table_get_num_targets(struct dm_table *t);
218int dm_table_get_mode(struct dm_table *t);
219struct mapped_device *dm_table_get_md(struct dm_table *t);
220
221/*
222 * Trigger an event.
223 */
224void dm_table_event(struct dm_table *t);
225
226/*
227 * The device must be suspended before calling this method.
228 */
229int dm_swap_table(struct mapped_device *md, struct dm_table *t);
230
231/*
232 * Prepare a table for a device that will error all I/O.
233 * To make it active, call dm_suspend(), dm_swap_table() then dm_resume().
234 */
235int dm_create_error_table(struct dm_table **result, struct mapped_device *md);
236
237#endif /* __KERNEL__ */
238#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 1e5f30da98..662e6a1014 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/dm-ioctl.h b/include/linux/dm-ioctl.h
index c67c678661..9623bb6250 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 6 288#define DM_VERSION_MINOR 7
289#define DM_VERSION_PATCHLEVEL 0 289#define DM_VERSION_PATCHLEVEL 0
290#define DM_VERSION_EXTRA "-ioctl (2006-02-17)" 290#define DM_VERSION_EXTRA "-ioctl (2006-06-24)"
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 */
@@ -314,7 +314,7 @@ typedef char ioctl_struct[308];
314#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ 314#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
315 315
316/* 316/*
317 * Set this to improve performance when you aren't going to use open_count. 317 * This flag is now ignored.
318 */ 318 */
319#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ 319#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
320 320
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 635690cf3e..ff203c465f 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/dmaengine.h b/include/linux/dmaengine.h
index 78b236ca04..c94d8f1d62 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -20,7 +20,7 @@
20 */ 20 */
21#ifndef DMAENGINE_H 21#ifndef DMAENGINE_H
22#define DMAENGINE_H 22#define DMAENGINE_H
23#include <linux/config.h> 23
24#ifdef CONFIG_DMA_ENGINE 24#ifdef CONFIG_DMA_ENGINE
25 25
26#include <linux/device.h> 26#include <linux/device.h>
@@ -44,7 +44,7 @@ enum dma_event {
44}; 44};
45 45
46/** 46/**
47 * typedef dma_cookie_t 47 * typedef dma_cookie_t - an opaque DMA cookie
48 * 48 *
49 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 49 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
50 */ 50 */
@@ -80,14 +80,14 @@ struct dma_chan_percpu {
80 80
81/** 81/**
82 * struct dma_chan - devices supply DMA channels, clients use them 82 * struct dma_chan - devices supply DMA channels, clients use them
83 * @client: ptr to the client user of this chan, will be NULL when unused 83 * @client: ptr to the client user of this chan, will be %NULL when unused
84 * @device: ptr to the dma device who supplies this channel, always !NULL 84 * @device: ptr to the dma device who supplies this channel, always !%NULL
85 * @cookie: last cookie value returned to client 85 * @cookie: last cookie value returned to client
86 * @chan_id: 86 * @chan_id: channel ID for sysfs
87 * @class_dev: 87 * @class_dev: class device for sysfs
88 * @refcount: kref, used in "bigref" slow-mode 88 * @refcount: kref, used in "bigref" slow-mode
89 * @slow_ref: 89 * @slow_ref: indicates that the DMA channel is free
90 * @rcu: 90 * @rcu: the DMA channel's RCU head
91 * @client_node: used to add this to the client chan list 91 * @client_node: used to add this to the client chan list
92 * @device_node: used to add this to the device chan list 92 * @device_node: used to add this to the device chan list
93 * @local: per-cpu pointer to a struct dma_chan_percpu 93 * @local: per-cpu pointer to a struct dma_chan_percpu
@@ -162,10 +162,17 @@ struct dma_client {
162 * @chancnt: how many DMA channels are supported 162 * @chancnt: how many DMA channels are supported
163 * @channels: the list of struct dma_chan 163 * @channels: the list of struct dma_chan
164 * @global_node: list_head for global dma_device_list 164 * @global_node: list_head for global dma_device_list
165 * @refcount: 165 * @refcount: reference count
166 * @done: 166 * @done: IO completion struct
167 * @dev_id: 167 * @dev_id: unique device ID
168 * Other func ptrs: used to make use of this device's capabilities 168 * @device_alloc_chan_resources: allocate resources and return the
169 * number of allocated descriptors
170 * @device_free_chan_resources: release DMA channel's resources
171 * @device_memcpy_buf_to_buf: memcpy buf pointer to buf pointer
172 * @device_memcpy_buf_to_pg: memcpy buf pointer to struct page
173 * @device_memcpy_pg_to_pg: memcpy struct page/offset to struct page/offset
174 * @device_memcpy_complete: poll the status of an IOAT DMA transaction
175 * @device_memcpy_issue_pending: push appended descriptors to hardware
169 */ 176 */
170struct dma_device { 177struct dma_device {
171 178
@@ -211,7 +218,7 @@ void dma_async_client_chan_request(struct dma_client *client,
211 * Both @dest and @src must be mappable to a bus address according to the 218 * Both @dest and @src must be mappable to a bus address according to the
212 * DMA mapping API rules for streaming mappings. 219 * DMA mapping API rules for streaming mappings.
213 * Both @dest and @src must stay memory resident (kernel memory or locked 220 * Both @dest and @src must stay memory resident (kernel memory or locked
214 * user space pages) 221 * user space pages).
215 */ 222 */
216static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 223static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
217 void *dest, void *src, size_t len) 224 void *dest, void *src, size_t len)
@@ -225,7 +232,7 @@ static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
225} 232}
226 233
227/** 234/**
228 * dma_async_memcpy_buf_to_pg - offloaded copy 235 * dma_async_memcpy_buf_to_pg - offloaded copy from address to page
229 * @chan: DMA channel to offload copy to 236 * @chan: DMA channel to offload copy to
230 * @page: destination page 237 * @page: destination page
231 * @offset: offset in page to copy to 238 * @offset: offset in page to copy to
@@ -250,18 +257,18 @@ static inline dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
250} 257}
251 258
252/** 259/**
253 * dma_async_memcpy_buf_to_pg - offloaded copy 260 * dma_async_memcpy_pg_to_pg - offloaded copy from page to page
254 * @chan: DMA channel to offload copy to 261 * @chan: DMA channel to offload copy to
255 * @dest_page: destination page 262 * @dest_pg: destination page
256 * @dest_off: offset in page to copy to 263 * @dest_off: offset in page to copy to
257 * @src_page: source page 264 * @src_pg: source page
258 * @src_off: offset in page to copy from 265 * @src_off: offset in page to copy from
259 * @len: length 266 * @len: length
260 * 267 *
261 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus 268 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus
262 * address according to the DMA mapping API rules for streaming mappings. 269 * address according to the DMA mapping API rules for streaming mappings.
263 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident 270 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident
264 * (kernel memory or locked user space pages) 271 * (kernel memory or locked user space pages).
265 */ 272 */
266static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, 273static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
267 struct page *dest_pg, unsigned int dest_off, struct page *src_pg, 274 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
@@ -278,7 +285,7 @@ static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
278 285
279/** 286/**
280 * dma_async_memcpy_issue_pending - flush pending copies to HW 287 * dma_async_memcpy_issue_pending - flush pending copies to HW
281 * @chan: 288 * @chan: target DMA channel
282 * 289 *
283 * This allows drivers to push copies to HW in batches, 290 * This allows drivers to push copies to HW in batches,
284 * reducing MMIO writes where possible. 291 * reducing MMIO writes where possible.
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b2cd2071d4..38dc403be7 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/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index 2fda1b2aab..527504c11c 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -125,14 +125,14 @@ typedef struct fs_disk_quota {
125 125
126/* 126/*
127 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. 127 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
128 * Provides a centralized way to get meta infomation about the quota subsystem. 128 * Provides a centralized way to get meta information about the quota subsystem.
129 * eg. space taken up for user and group quotas, number of dquots currently 129 * eg. space taken up for user and group quotas, number of dquots currently
130 * incore. 130 * incore.
131 */ 131 */
132#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ 132#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */
133 133
134/* 134/*
135 * Some basic infomation about 'quota files'. 135 * Some basic information about 'quota files'.
136 */ 136 */
137typedef struct fs_qfilestat { 137typedef struct fs_qfilestat {
138 __u64 qfs_ino; /* inode number */ 138 __u64 qfs_ino; /* inode number */
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
new file mode 100644
index 0000000000..d97b3a51e2
--- /dev/null
+++ b/include/linux/dvb/Kbuild
@@ -0,0 +1,9 @@
1header-y += ca.h
2header-y += frontend.h
3header-y += net.h
4header-y += osd.h
5header-y += version.h
6
7unifdef-y += audio.h
8unifdef-y += dmx.h
9unifdef-y += video.h
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index 2787b8a22f..c6a2353c4e 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -88,20 +88,6 @@ typedef enum
88#define DMX_PES_PCR DMX_PES_PCR0 88#define DMX_PES_PCR DMX_PES_PCR0
89 89
90 90
91typedef enum
92{
93 DMX_SCRAMBLING_EV,
94 DMX_FRONTEND_EV
95} dmx_event_t;
96
97
98typedef enum
99{
100 DMX_SCRAMBLING_OFF,
101 DMX_SCRAMBLING_ON
102} dmx_scrambling_status_t;
103
104
105typedef struct dmx_filter 91typedef struct dmx_filter
106{ 92{
107 __u8 filter[DMX_FILTER_SIZE]; 93 __u8 filter[DMX_FILTER_SIZE];
@@ -132,17 +118,6 @@ struct dmx_pes_filter_params
132 __u32 flags; 118 __u32 flags;
133}; 119};
134 120
135
136struct dmx_event
137{
138 dmx_event_t event;
139 time_t timeStamp;
140 union
141 {
142 dmx_scrambling_status_t scrambling;
143 } u;
144};
145
146typedef struct dmx_caps { 121typedef struct dmx_caps {
147 __u32 caps; 122 __u32 caps;
148 int num_decoders; 123 int num_decoders;
@@ -171,7 +146,6 @@ struct dmx_stc {
171#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) 146#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
172#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) 147#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
173#define DMX_SET_BUFFER_SIZE _IO('o', 45) 148#define DMX_SET_BUFFER_SIZE _IO('o', 45)
174#define DMX_GET_EVENT _IOR('o', 46, struct dmx_event)
175#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) 149#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
176#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) 150#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
177#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) 151#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
diff --git a/include/linux/edd.h b/include/linux/edd.h
index 162512b886..b2b3e68aa5 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/efs_fs.h b/include/linux/efs_fs.h
index fbfa6b52e2..278ef44958 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -38,7 +38,7 @@ struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern struct inode_operations efs_dir_inode_operations;
40extern const struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern struct address_space_operations efs_symlink_aops; 41extern const struct address_space_operations efs_symlink_aops;
42 42
43extern void efs_read_inode(struct inode *); 43extern void efs_read_inode(struct inode *);
44extern efs_block_t efs_map_block(struct inode *, efs_block_t); 44extern efs_block_t efs_map_block(struct inode *, efs_block_t);
diff --git a/include/linux/efs_fs_sb.h b/include/linux/efs_fs_sb.h
index c76088baef..ff1945e377 100644
--- a/include/linux/efs_fs_sb.h
+++ b/include/linux/efs_fs_sb.h
@@ -9,8 +9,7 @@
9#ifndef __EFS_FS_SB_H__ 9#ifndef __EFS_FS_SB_H__
10#define __EFS_FS_SB_H__ 10#define __EFS_FS_SB_H__
11 11
12/* statfs() magic number for EFS */ 12#include <linux/magic.h>
13#define EFS_SUPER_MAGIC 0x414A53
14 13
15/* EFS superblock magic numbers */ 14/* EFS superblock magic numbers */
16#define EFS_MAGIC 0x072959 15#define EFS_MAGIC 0x072959
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index 4079242dce..1ff7c13925 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/elf-em.h b/include/linux/elf-em.h
index 114a96d256..666e0a5f00 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -11,7 +11,12 @@
11#define EM_486 6 /* Perhaps disused */ 11#define EM_486 6 /* Perhaps disused */
12#define EM_860 7 12#define EM_860 7
13#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ 13#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
14 /* Next two are historical and binaries and
15 modules of these types will be rejected by
16 Linux. */
17#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
14#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ 18#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
19
15#define EM_PARISC 15 /* HPPA */ 20#define EM_PARISC 15 /* HPPA */
16#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ 21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
17#define EM_PPC 20 /* PowerPC */ 22#define EM_PPC 20 /* PowerPC */
@@ -26,6 +31,7 @@
26#define EM_M32R 88 /* Renesas M32R */ 31#define EM_M32R 88 /* Renesas M32R */
27#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 32#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
28#define EM_FRV 0x5441 /* Fujitsu FR-V */ 33#define EM_FRV 0x5441 /* Fujitsu FR-V */
34#define EM_AVR32 0x18ad /* Atmel AVR32 */
29 35
30/* 36/*
31 * This is an interim value that we will use until the committee comes 37 * This is an interim value that we will use until the committee comes
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 0cf0bea010..9631dddae3 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -60,6 +60,16 @@ struct elf_prstatus
60 long pr_instr; /* Current instruction */ 60 long pr_instr; /* Current instruction */
61#endif 61#endif
62 elf_gregset_t pr_reg; /* GP registers */ 62 elf_gregset_t pr_reg; /* GP registers */
63#ifdef CONFIG_BINFMT_ELF_FDPIC
64 /* When using FDPIC, the loadmap addresses need to be communicated
65 * to GDB in order for GDB to do the necessary relocations. The
66 * fields (below) used to communicate this information are placed
67 * immediately after ``pr_reg'', so that the loadmap addresses may
68 * be viewed as part of the register set if so desired.
69 */
70 unsigned long pr_exec_fdpic_loadmap;
71 unsigned long pr_interp_fdpic_loadmap;
72#endif
63 int pr_fpvalid; /* True if math co-processor being used. */ 73 int pr_fpvalid; /* True if math co-processor being used. */
64}; 74};
65 75
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
new file mode 100644
index 0000000000..67396db141
--- /dev/null
+++ b/include/linux/elfnote.h
@@ -0,0 +1,90 @@
1#ifndef _LINUX_ELFNOTE_H
2#define _LINUX_ELFNOTE_H
3/*
4 * Helper macros to generate ELF Note structures, which are put into a
5 * PT_NOTE segment of the final vmlinux image. These are useful for
6 * including name-value pairs of metadata into the kernel binary (or
7 * modules?) for use by external programs.
8 *
9 * Each note has three parts: a name, a type and a desc. The name is
10 * intended to distinguish the note's originator, so it would be a
11 * company, project, subsystem, etc; it must be in a suitable form for
12 * use in a section name. The type is an integer which is used to tag
13 * the data, and is considered to be within the "name" namespace (so
14 * "FooCo"'s type 42 is distinct from "BarProj"'s type 42). The
15 * "desc" field is the actual data. There are no constraints on the
16 * desc field's contents, though typically they're fairly small.
17 *
18 * All notes from a given NAME are put into a section named
19 * .note.NAME. When the kernel image is finally linked, all the notes
20 * are packed into a single .notes section, which is mapped into the
21 * PT_NOTE segment. Because notes for a given name are grouped into
22 * the same section, they'll all be adjacent the output file.
23 *
24 * This file defines macros for both C and assembler use. Their
25 * syntax is slightly different, but they're semantically similar.
26 *
27 * See the ELF specification for more detail about ELF notes.
28 */
29
30#ifdef __ASSEMBLER__
31/*
32 * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
33 * turn out to be the same size and shape), followed by the name and
34 * desc data with appropriate padding. The 'desctype' argument is the
35 * assembler pseudo op defining the type of the data e.g. .asciz while
36 * 'descdata' is the data itself e.g. "hello, world".
37 *
38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
40 */
41#define ELFNOTE(name, type, desctype, descdata) \
42.pushsection .note.name ; \
43 .align 4 ; \
44 .long 2f - 1f /* namesz */ ; \
45 .long 4f - 3f /* descsz */ ; \
46 .long type ; \
471:.asciz "name" ; \
482:.align 4 ; \
493:desctype descdata ; \
504:.align 4 ; \
51.popsection ;
52#else /* !__ASSEMBLER__ */
53#include <linux/elf.h>
54/*
55 * Use an anonymous structure which matches the shape of
56 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and
57 * type of name and desc depend on the macro arguments. "name" must
58 * be a literal string, and "desc" must be passed by value. You may
59 * only define one note per line, since __LINE__ is used to generate
60 * unique symbols.
61 */
62#define _ELFNOTE_PASTE(a,b) a##b
63#define _ELFNOTE(size, name, unique, type, desc) \
64 static const struct { \
65 struct elf##size##_note _nhdr; \
66 unsigned char _name[sizeof(name)] \
67 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
68 typeof(desc) _desc \
69 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
70 } _ELFNOTE_PASTE(_note_, unique) \
71 __attribute_used__ \
72 __attribute__((section(".note." name), \
73 aligned(sizeof(Elf##size##_Word)), \
74 unused)) = { \
75 { \
76 sizeof(name), \
77 sizeof(desc), \
78 type, \
79 }, \
80 name, \
81 desc \
82 }
83#define ELFNOTE(size, name, type, desc) \
84 _ELFNOTE(size, name, __LINE__, type, desc)
85
86#define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
87#define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc)
88#endif /* __ASSEMBLER__ */
89
90#endif /* _LINUX_ELFNOTE_H */
diff --git a/include/linux/err.h b/include/linux/err.h
index ff71d2af5d..1ab1d44f8d 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -13,7 +13,11 @@
13 * This should be a per-architecture thing, to allow different 13 * This should be a per-architecture thing, to allow different
14 * error and pointer decisions. 14 * error and pointer decisions.
15 */ 15 */
16#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L) 16#define MAX_ERRNO 4095
17
18#ifndef __ASSEMBLY__
19
20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
17 21
18static inline void *ERR_PTR(long error) 22static inline void *ERR_PTR(long error)
19{ 23{
@@ -30,4 +34,6 @@ static inline long IS_ERR(const void *ptr)
30 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
31} 35}
32 36
37#endif
38
33#endif /* _LINUX_ERR_H */ 39#endif /* _LINUX_ERR_H */
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 408118a077..92f8d4fab3 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/eventpoll.h b/include/linux/eventpoll.h
index 1e4bdfcf83..84cfa8bbdc 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * include/linux/eventpoll.h ( Efficent event polling implementation ) 2 * include/linux/eventpoll.h ( Efficent event polling implementation )
3 * Copyright (C) 2001,...,2003 Davide Libenzi 3 * Copyright (C) 2001,...,2006 Davide Libenzi
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index facf34e989..33a1aa1073 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -17,6 +17,7 @@
17#define _LINUX_EXT2_FS_H 17#define _LINUX_EXT2_FS_H
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h>
20 21
21/* 22/*
22 * The second extended filesystem constants/structures 23 * The second extended filesystem constants/structures
@@ -63,11 +64,6 @@
63/* First non-reserved inode for old ext2 filesystems */ 64/* First non-reserved inode for old ext2 filesystems */
64#define EXT2_GOOD_OLD_FIRST_INO 11 65#define EXT2_GOOD_OLD_FIRST_INO 11
65 66
66/*
67 * The second extended file system magic number
68 */
69#define EXT2_SUPER_MAGIC 0xEF53
70
71#ifdef __KERNEL__ 67#ifdef __KERNEL__
72#include <linux/ext2_fs_sb.h> 68#include <linux/ext2_fs_sb.h>
73static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) 69static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 757d54d8f1..cc08f56750 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -17,6 +17,7 @@
17#define _LINUX_EXT3_FS_H 17#define _LINUX_EXT3_FS_H
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h>
20 21
21/* 22/*
22 * The second extended filesystem constants/structures 23 * The second extended filesystem constants/structures
@@ -67,11 +68,6 @@
67#define EXT3_GOOD_OLD_FIRST_INO 11 68#define EXT3_GOOD_OLD_FIRST_INO 11
68 69
69/* 70/*
70 * The second extended file system magic number
71 */
72#define EXT3_SUPER_MAGIC 0xEF53
73
74/*
75 * Maximal count of links to a file 71 * Maximal count of links to a file
76 */ 72 */
77#define EXT3_LINK_MAX 32000 73#define EXT3_LINK_MAX 32000
@@ -464,7 +460,7 @@ struct ext3_super_block {
464 */ 460 */
465 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 461 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
466 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 462 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
467 __u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ 463 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
468 /* 464 /*
469 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. 465 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
470 */ 466 */
@@ -477,7 +473,7 @@ struct ext3_super_block {
477 __u8 s_reserved_char_pad; 473 __u8 s_reserved_char_pad;
478 __u16 s_reserved_word_pad; 474 __u16 s_reserved_word_pad;
479 __le32 s_default_mount_opts; 475 __le32 s_default_mount_opts;
480 __le32 s_first_meta_bg; /* First metablock block group */ 476 __le32 s_first_meta_bg; /* First metablock block group */
481 __u32 s_reserved[190]; /* Padding to the end of the block */ 477 __u32 s_reserved[190]; /* Padding to the end of the block */
482}; 478};
483 479
@@ -492,6 +488,15 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
492{ 488{
493 return container_of(inode, struct ext3_inode_info, vfs_inode); 489 return container_of(inode, struct ext3_inode_info, vfs_inode);
494} 490}
491
492static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
493{
494 return ino == EXT3_ROOT_INO ||
495 ino == EXT3_JOURNAL_INO ||
496 ino == EXT3_RESIZE_INO ||
497 (ino >= EXT3_FIRST_INO(sb) &&
498 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
499}
495#else 500#else
496/* Assume that user mode programs are passing in an ext3fs superblock, not 501/* Assume that user mode programs are passing in an ext3fs superblock, not
497 * a kernel struct super_block. This will allow us to call the feature-test 502 * a kernel struct super_block. This will allow us to call the feature-test
@@ -710,6 +715,14 @@ struct dir_private_info {
710 __u32 next_hash; 715 __u32 next_hash;
711}; 716};
712 717
718/* calculate the first block number of the group */
719static inline ext3_fsblk_t
720ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
721{
722 return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
723 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
724}
725
713/* 726/*
714 * Special error return code only used by dx_probe() and its callers. 727 * Special error return code only used by dx_probe() and its callers.
715 */ 728 */
@@ -730,14 +743,16 @@ struct dir_private_info {
730/* balloc.c */ 743/* balloc.c */
731extern int ext3_bg_has_super(struct super_block *sb, int group); 744extern int ext3_bg_has_super(struct super_block *sb, int group);
732extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); 745extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
733extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *); 746extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
734extern int ext3_new_blocks (handle_t *, struct inode *, unsigned long, 747 ext3_fsblk_t goal, int *errp);
735 unsigned long *, int *); 748extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
736extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long, 749 ext3_fsblk_t goal, unsigned long *count, int *errp);
737 unsigned long); 750extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
738extern void ext3_free_blocks_sb (handle_t *, struct super_block *, 751 ext3_fsblk_t block, unsigned long count);
739 unsigned long, unsigned long, int *); 752extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
740extern unsigned long ext3_count_free_blocks (struct super_block *); 753 ext3_fsblk_t block, unsigned long count,
754 unsigned long *pdquot_freed_blocks);
755extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
741extern void ext3_check_blocks_bitmap (struct super_block *); 756extern void ext3_check_blocks_bitmap (struct super_block *);
742extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, 757extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
743 unsigned int block_group, 758 unsigned int block_group,
@@ -773,7 +788,8 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
773 788
774 789
775/* inode.c */ 790/* inode.c */
776int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); 791int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
792 struct buffer_head *bh, ext3_fsblk_t blocknr);
777struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); 793struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
778struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 794struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
779int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, 795int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
@@ -808,7 +824,7 @@ extern int ext3_group_add(struct super_block *sb,
808 struct ext3_new_group_data *input); 824 struct ext3_new_group_data *input);
809extern int ext3_group_extend(struct super_block *sb, 825extern int ext3_group_extend(struct super_block *sb,
810 struct ext3_super_block *es, 826 struct ext3_super_block *es,
811 unsigned long n_blocks_count); 827 ext3_fsblk_t n_blocks_count);
812 828
813/* super.c */ 829/* super.c */
814extern void ext3_error (struct super_block *, const char *, const char *, ...) 830extern void ext3_error (struct super_block *, const char *, const char *, ...)
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 7abf901471..4395e52067 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -21,13 +21,21 @@
21#include <linux/seqlock.h> 21#include <linux/seqlock.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23 23
24/* data type for block offset of block group */
25typedef int ext3_grpblk_t;
26
27/* data type for filesystem-wide blocks number */
28typedef unsigned long ext3_fsblk_t;
29
30#define E3FSBLK "%lu"
31
24struct ext3_reserve_window { 32struct ext3_reserve_window {
25 __u32 _rsv_start; /* First byte reserved */ 33 ext3_fsblk_t _rsv_start; /* First byte reserved */
26 __u32 _rsv_end; /* Last byte reserved or 0 */ 34 ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
27}; 35};
28 36
29struct ext3_reserve_window_node { 37struct ext3_reserve_window_node {
30 struct rb_node rsv_node; 38 struct rb_node rsv_node;
31 __u32 rsv_goal_size; 39 __u32 rsv_goal_size;
32 __u32 rsv_alloc_hit; 40 __u32 rsv_alloc_hit;
33 struct ext3_reserve_window rsv_window; 41 struct ext3_reserve_window rsv_window;
@@ -50,7 +58,7 @@ struct ext3_block_alloc_info {
50 * allocated to this file. This give us the goal (target) for the next 58 * allocated to this file. This give us the goal (target) for the next
51 * allocation when we detect linearly ascending requests. 59 * allocation when we detect linearly ascending requests.
52 */ 60 */
53 __u32 last_alloc_physical_block; 61 ext3_fsblk_t last_alloc_physical_block;
54}; 62};
55 63
56#define rsv_start rsv_window._rsv_start 64#define rsv_start rsv_window._rsv_start
@@ -67,7 +75,7 @@ struct ext3_inode_info {
67 __u8 i_frag_no; 75 __u8 i_frag_no;
68 __u8 i_frag_size; 76 __u8 i_frag_size;
69#endif 77#endif
70 __u32 i_file_acl; 78 ext3_fsblk_t i_file_acl;
71 __u32 i_dir_acl; 79 __u32 i_dir_acl;
72 __u32 i_dtime; 80 __u32 i_dtime;
73 81
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index c8307c02dd..ce0e6109af 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 315d89740d..2f335e9660 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -366,16 +366,21 @@ struct fb_cursor {
366 struct fb_image image; /* Cursor image */ 366 struct fb_image image; /* Cursor image */
367}; 367};
368 368
369#ifdef CONFIG_FB_BACKLIGHT
370/* Settings for the generic backlight code */
371#define FB_BACKLIGHT_LEVELS 128
372#define FB_BACKLIGHT_MAX 0xFF
373#endif
374
369#ifdef __KERNEL__ 375#ifdef __KERNEL__
370 376
371#include <linux/fs.h> 377#include <linux/fs.h>
372#include <linux/init.h> 378#include <linux/init.h>
373#include <linux/tty.h>
374#include <linux/device.h> 379#include <linux/device.h>
375#include <linux/workqueue.h> 380#include <linux/workqueue.h>
376#include <linux/devfs_fs_kernel.h>
377#include <linux/notifier.h> 381#include <linux/notifier.h>
378#include <linux/list.h> 382#include <linux/list.h>
383#include <linux/backlight.h>
379#include <asm/io.h> 384#include <asm/io.h>
380 385
381struct vm_area_struct; 386struct vm_area_struct;
@@ -497,23 +502,19 @@ struct fb_cursor_user {
497#define FB_EVENT_MODE_DELETE 0x04 502#define FB_EVENT_MODE_DELETE 0x04
498/* A driver registered itself */ 503/* A driver registered itself */
499#define FB_EVENT_FB_REGISTERED 0x05 504#define FB_EVENT_FB_REGISTERED 0x05
505/* A driver unregistered itself */
506#define FB_EVENT_FB_UNREGISTERED 0x06
500/* CONSOLE-SPECIFIC: get console to framebuffer mapping */ 507/* CONSOLE-SPECIFIC: get console to framebuffer mapping */
501#define FB_EVENT_GET_CONSOLE_MAP 0x06 508#define FB_EVENT_GET_CONSOLE_MAP 0x07
502/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ 509/* CONSOLE-SPECIFIC: set console to framebuffer mapping */
503#define FB_EVENT_SET_CONSOLE_MAP 0x07 510#define FB_EVENT_SET_CONSOLE_MAP 0x08
504/* A display blank is requested */ 511/* A display blank is requested */
505#define FB_EVENT_BLANK 0x08 512#define FB_EVENT_BLANK 0x09
506/* Private modelist is to be replaced */ 513/* Private modelist is to be replaced */
507#define FB_EVENT_NEW_MODELIST 0x09 514#define FB_EVENT_NEW_MODELIST 0x0A
508/* The resolution of the passed in fb_info about to change and 515/* The resolution of the passed in fb_info about to change and
509 all vc's should be changed */ 516 all vc's should be changed */
510#define FB_EVENT_MODE_CHANGE_ALL 0x0A 517#define FB_EVENT_MODE_CHANGE_ALL 0x0B
511/* CONSOLE-SPECIFIC: set console rotation */
512#define FB_EVENT_SET_CON_ROTATE 0x0B
513/* CONSOLE-SPECIFIC: get console rotation */
514#define FB_EVENT_GET_CON_ROTATE 0x0C
515/* CONSOLE-SPECIFIC: rotate all consoles */
516#define FB_EVENT_SET_CON_ROTATE_ALL 0x0D
517 518
518struct fb_event { 519struct fb_event {
519 struct fb_info *info; 520 struct fb_info *info;
@@ -523,7 +524,7 @@ struct fb_event {
523 524
524extern int fb_register_client(struct notifier_block *nb); 525extern int fb_register_client(struct notifier_block *nb);
525extern int fb_unregister_client(struct notifier_block *nb); 526extern int fb_unregister_client(struct notifier_block *nb);
526 527extern int fb_notifier_call_chain(unsigned long val, void *v);
527/* 528/*
528 * Pixmap structure definition 529 * Pixmap structure definition
529 * 530 *
@@ -555,7 +556,7 @@ struct fb_pixmap {
555 * Frame buffer operations 556 * Frame buffer operations
556 * 557 *
557 * LOCKING NOTE: those functions must _ALL_ be called with the console 558 * LOCKING NOTE: those functions must _ALL_ be called with the console
558 * semaphore held, this is the only suitable locking mecanism we have 559 * semaphore held, this is the only suitable locking mechanism we have
559 * in 2.6. Some may be called at interrupt time at this point though. 560 * in 2.6. Some may be called at interrupt time at this point though.
560 */ 561 */
561 562
@@ -756,6 +757,21 @@ struct fb_info {
756 struct fb_cmap cmap; /* Current cmap */ 757 struct fb_cmap cmap; /* Current cmap */
757 struct list_head modelist; /* mode list */ 758 struct list_head modelist; /* mode list */
758 struct fb_videomode *mode; /* current mode */ 759 struct fb_videomode *mode; /* current mode */
760
761#ifdef CONFIG_FB_BACKLIGHT
762 /* Lock ordering:
763 * bl_mutex (protects bl_dev and bl_curve)
764 * bl_dev->sem (backlight class)
765 */
766 struct mutex bl_mutex;
767
768 /* assigned backlight device */
769 struct backlight_device *bl_dev;
770
771 /* Backlight level curve */
772 u8 bl_curve[FB_BACKLIGHT_LEVELS];
773#endif
774
759 struct fb_ops *fbops; 775 struct fb_ops *fbops;
760 struct device *device; 776 struct device *device;
761 struct class_device *class_device; /* sysfs per device attrs */ 777 struct class_device *class_device; /* sysfs per device attrs */
@@ -870,7 +886,6 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
870 struct fb_fix_screeninfo *fix); 886 struct fb_fix_screeninfo *fix);
871extern int fb_get_options(char *name, char **option); 887extern int fb_get_options(char *name, char **option);
872extern int fb_new_modelist(struct fb_info *info); 888extern int fb_new_modelist(struct fb_info *info);
873extern int fb_con_duit(struct fb_info *info, int event, void *data);
874 889
875extern struct fb_info *registered_fb[FB_MAX]; 890extern struct fb_info *registered_fb[FB_MAX];
876extern int num_registered_fb; 891extern int num_registered_fb;
@@ -895,6 +910,7 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
895extern void framebuffer_release(struct fb_info *info); 910extern void framebuffer_release(struct fb_info *info);
896extern int fb_init_class_device(struct fb_info *fb_info); 911extern int fb_init_class_device(struct fb_info *fb_info);
897extern void fb_cleanup_class_device(struct fb_info *head); 912extern void fb_cleanup_class_device(struct fb_info *head);
913extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
898 914
899/* drivers/video/fbmon.c */ 915/* drivers/video/fbmon.c */
900#define FB_MAXTIMINGS 0 916#define FB_MAXTIMINGS 0
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index c52a63755f..996f5611cd 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -29,6 +29,7 @@
29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ 29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
30#define AT_REMOVEDIR 0x200 /* Remove directory instead of 30#define AT_REMOVEDIR 0x200 /* Remove directory instead of
31 unlinking file. */ 31 unlinking file. */
32#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
32 33
33#ifdef __KERNEL__ 34#ifdef __KERNEL__
34 35
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
new file mode 100644
index 0000000000..4418c8d9d4
--- /dev/null
+++ b/include/linux/fib_rules.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_FIB_RULES_H
2#define __LINUX_FIB_RULES_H
3
4#include <linux/types.h>
5#include <linux/rtnetlink.h>
6
7/* rule is permanent, and cannot be deleted */
8#define FIB_RULE_PERMANENT 1
9
10struct fib_rule_hdr
11{
12 __u8 family;
13 __u8 dst_len;
14 __u8 src_len;
15 __u8 tos;
16
17 __u8 table;
18 __u8 res1; /* reserved */
19 __u8 res2; /* reserved */
20 __u8 action;
21
22 __u32 flags;
23};
24
25enum
26{
27 FRA_UNSPEC,
28 FRA_DST, /* destination address */
29 FRA_SRC, /* source address */
30 FRA_IFNAME, /* interface name */
31 FRA_UNUSED1,
32 FRA_UNUSED2,
33 FRA_PRIORITY, /* priority/preference */
34 FRA_UNUSED3,
35 FRA_UNUSED4,
36 FRA_UNUSED5,
37 FRA_FWMARK, /* netfilter mark */
38 FRA_FLOW, /* flow/class id */
39 FRA_UNUSED6,
40 FRA_UNUSED7,
41 FRA_UNUSED8,
42 FRA_TABLE, /* Extended table id */
43 FRA_FWMASK, /* mask for netfilter mark */
44 __FRA_MAX
45};
46
47#define FRA_MAX (__FRA_MAX - 1)
48
49enum
50{
51 FR_ACT_UNSPEC,
52 FR_ACT_TO_TBL, /* Pass to fixed table */
53 FR_ACT_RES1,
54 FR_ACT_RES2,
55 FR_ACT_RES3,
56 FR_ACT_RES4,
57 FR_ACT_BLACKHOLE, /* Drop without notification */
58 FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
59 FR_ACT_PROHIBIT, /* Drop with EACCES */
60 __FR_ACT_MAX,
61};
62
63#define FR_ACT_MAX (__FR_ACT_MAX - 1)
64
65#endif
diff --git a/include/linux/file.h b/include/linux/file.h
index 9f7c251386..74183e6f7f 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/filter.h b/include/linux/filter.h
index c6cb8f0950..91b2e3b925 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -25,10 +25,10 @@
25 25
26struct sock_filter /* Filter block */ 26struct sock_filter /* Filter block */
27{ 27{
28 __u16 code; /* Actual filter code */ 28 __u16 code; /* Actual filter code */
29 __u8 jt; /* Jump true */ 29 __u8 jt; /* Jump true */
30 __u8 jf; /* Jump false */ 30 __u8 jf; /* Jump false */
31 __u32 k; /* Generic multiuse field */ 31 __u32 k; /* Generic multiuse field */
32}; 32};
33 33
34struct sock_fprog /* Required for SO_ATTACH_FILTER. */ 34struct sock_fprog /* Required for SO_ATTACH_FILTER. */
@@ -41,8 +41,9 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
41struct sk_filter 41struct sk_filter
42{ 42{
43 atomic_t refcnt; 43 atomic_t refcnt;
44 unsigned int len; /* Number of filter blocks */ 44 unsigned int len; /* Number of filter blocks */
45 struct sock_filter insns[0]; 45 struct rcu_head rcu;
46 struct sock_filter insns[0];
46}; 47};
47 48
48static inline unsigned int sk_filter_len(struct sk_filter *fp) 49static inline unsigned int sk_filter_len(struct sk_filter *fp)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dba4cbd157..6eafbe3094 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -27,6 +27,10 @@
27#define BLOCK_SIZE_BITS 10 27#define BLOCK_SIZE_BITS 10
28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) 28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
29 29
30#define SEEK_SET 0 /* seek relative to beginning of file */
31#define SEEK_CUR 1 /* seek relative to current file position */
32#define SEEK_END 2 /* seek relative to end of file */
33
30/* And dynamically-tunable limits and defaults: */ 34/* And dynamically-tunable limits and defaults: */
31struct files_stat_struct { 35struct files_stat_struct {
32 int nr_files; /* read only */ 36 int nr_files; /* read only */
@@ -88,9 +92,10 @@ extern int dir_notify_enable;
88#define FS_REQUIRES_DEV 1 92#define FS_REQUIRES_DEV 1
89#define FS_BINARY_MOUNTDATA 2 93#define FS_BINARY_MOUNTDATA 2
90#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ 94#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
91#define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon 95#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
92 * as nfs_rename() will be cleaned up 96 * during rename() internally.
93 */ 97 */
98
94/* 99/*
95 * These are the fs-independent mount-flags: up to 32 flags are supported 100 * These are the fs-independent mount-flags: up to 32 flags are supported
96 */ 101 */
@@ -392,7 +397,7 @@ struct address_space {
392 unsigned int truncate_count; /* Cover race condition with truncate */ 397 unsigned int truncate_count; /* Cover race condition with truncate */
393 unsigned long nrpages; /* number of total pages */ 398 unsigned long nrpages; /* number of total pages */
394 pgoff_t writeback_index;/* writeback starts here */ 399 pgoff_t writeback_index;/* writeback starts here */
395 struct address_space_operations *a_ops; /* methods */ 400 const struct address_space_operations *a_ops; /* methods */
396 unsigned long flags; /* error bits/gfp mask */ 401 unsigned long flags; /* error bits/gfp mask */
397 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 402 struct backing_dev_info *backing_dev_info; /* device readahead, etc */
398 spinlock_t private_lock; /* for use by the address_space */ 403 spinlock_t private_lock; /* for use by the address_space */
@@ -436,6 +441,21 @@ struct block_device {
436}; 441};
437 442
438/* 443/*
444 * bdev->bd_mutex nesting subclasses for the lock validator:
445 *
446 * 0: normal
447 * 1: 'whole'
448 * 2: 'partition'
449 */
450enum bdev_bd_mutex_lock_class
451{
452 BD_MUTEX_NORMAL,
453 BD_MUTEX_WHOLE,
454 BD_MUTEX_PARTITION
455};
456
457
458/*
439 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 459 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
440 * radix trees 460 * radix trees
441 */ 461 */
@@ -492,7 +512,6 @@ struct inode {
492 struct timespec i_mtime; 512 struct timespec i_mtime;
493 struct timespec i_ctime; 513 struct timespec i_ctime;
494 unsigned int i_blkbits; 514 unsigned int i_blkbits;
495 unsigned long i_blksize;
496 unsigned long i_version; 515 unsigned long i_version;
497 blkcnt_t i_blocks; 516 blkcnt_t i_blocks;
498 unsigned short i_bytes; 517 unsigned short i_bytes;
@@ -508,11 +527,12 @@ struct inode {
508#ifdef CONFIG_QUOTA 527#ifdef CONFIG_QUOTA
509 struct dquot *i_dquot[MAXQUOTAS]; 528 struct dquot *i_dquot[MAXQUOTAS];
510#endif 529#endif
511 /* These three should probably be a union */
512 struct list_head i_devices; 530 struct list_head i_devices;
513 struct pipe_inode_info *i_pipe; 531 union {
514 struct block_device *i_bdev; 532 struct pipe_inode_info *i_pipe;
515 struct cdev *i_cdev; 533 struct block_device *i_bdev;
534 struct cdev *i_cdev;
535 };
516 int i_cindex; 536 int i_cindex;
517 537
518 __u32 i_generation; 538 __u32 i_generation;
@@ -533,16 +553,36 @@ struct inode {
533 unsigned int i_flags; 553 unsigned int i_flags;
534 554
535 atomic_t i_writecount; 555 atomic_t i_writecount;
556#ifdef CONFIG_SECURITY
536 void *i_security; 557 void *i_security;
537 union { 558#endif
538 void *generic_ip; 559 void *i_private; /* fs or device private pointer */
539 } u;
540#ifdef __NEED_I_SIZE_ORDERED 560#ifdef __NEED_I_SIZE_ORDERED
541 seqcount_t i_size_seqcount; 561 seqcount_t i_size_seqcount;
542#endif 562#endif
543}; 563};
544 564
545/* 565/*
566 * inode->i_mutex nesting subclasses for the lock validator:
567 *
568 * 0: the object of the current VFS operation
569 * 1: parent
570 * 2: child/target
571 * 3: quota file
572 *
573 * The locking order between these classes is
574 * parent -> child -> normal -> xattr -> quota
575 */
576enum inode_i_mutex_lock_class
577{
578 I_MUTEX_NORMAL,
579 I_MUTEX_PARENT,
580 I_MUTEX_CHILD,
581 I_MUTEX_XATTR,
582 I_MUTEX_QUOTA
583};
584
585/*
546 * NOTE: in a 32bit arch with a preemptable kernel and 586 * NOTE: in a 32bit arch with a preemptable kernel and
547 * an UP compile the i_size_read/write must be atomic 587 * an UP compile the i_size_read/write must be atomic
548 * with respect to the local cpu (unlike with preempt disabled), 588 * with respect to the local cpu (unlike with preempt disabled),
@@ -607,7 +647,6 @@ struct fown_struct {
607 rwlock_t lock; /* protects pid, uid, euid fields */ 647 rwlock_t lock; /* protects pid, uid, euid fields */
608 int pid; /* pid or -pgrp where SIGIO should be sent */ 648 int pid; /* pid or -pgrp where SIGIO should be sent */
609 uid_t uid, euid; /* uid/euid of process setting the owner */ 649 uid_t uid, euid; /* uid/euid of process setting the owner */
610 void *security;
611 int signum; /* posix.1b rt signal to be delivered on IO */ 650 int signum; /* posix.1b rt signal to be delivered on IO */
612}; 651};
613 652
@@ -650,8 +689,9 @@ struct file {
650 struct file_ra_state f_ra; 689 struct file_ra_state f_ra;
651 690
652 unsigned long f_version; 691 unsigned long f_version;
692#ifdef CONFIG_SECURITY
653 void *f_security; 693 void *f_security;
654 694#endif
655 /* needed for tty driver, and maybe others */ 695 /* needed for tty driver, and maybe others */
656 void *private_data; 696 void *private_data;
657 697
@@ -682,6 +722,7 @@ extern spinlock_t files_lock;
682#define FL_POSIX 1 722#define FL_POSIX 1
683#define FL_FLOCK 2 723#define FL_FLOCK 2
684#define FL_ACCESS 8 /* not trying to lock, just looking */ 724#define FL_ACCESS 8 /* not trying to lock, just looking */
725#define FL_EXISTS 16 /* when unlocking, test for existence */
685#define FL_LEASE 32 /* lease held on this file */ 726#define FL_LEASE 32 /* lease held on this file */
686#define FL_CLOSE 64 /* unlock on close */ 727#define FL_CLOSE 64 /* unlock on close */
687#define FL_SLEEP 128 /* A blocking lock */ 728#define FL_SLEEP 128 /* A blocking lock */
@@ -838,7 +879,9 @@ struct super_block {
838 int s_syncing; 879 int s_syncing;
839 int s_need_sync_fs; 880 int s_need_sync_fs;
840 atomic_t s_active; 881 atomic_t s_active;
882#ifdef CONFIG_SECURITY
841 void *s_security; 883 void *s_security;
884#endif
842 struct xattr_handler **s_xattr; 885 struct xattr_handler **s_xattr;
843 886
844 struct list_head s_inodes; /* all inodes */ 887 struct list_head s_inodes; /* all inodes */
@@ -1100,13 +1143,14 @@ struct super_operations {
1100 int (*statfs) (struct dentry *, struct kstatfs *); 1143 int (*statfs) (struct dentry *, struct kstatfs *);
1101 int (*remount_fs) (struct super_block *, int *, char *); 1144 int (*remount_fs) (struct super_block *, int *, char *);
1102 void (*clear_inode) (struct inode *); 1145 void (*clear_inode) (struct inode *);
1103 void (*umount_begin) (struct super_block *); 1146 void (*umount_begin) (struct vfsmount *, int);
1104 1147
1105 int (*show_options)(struct seq_file *, struct vfsmount *); 1148 int (*show_options)(struct seq_file *, struct vfsmount *);
1106 int (*show_stats)(struct seq_file *, struct vfsmount *); 1149 int (*show_stats)(struct seq_file *, struct vfsmount *);
1107 1150#ifdef CONFIG_QUOTA
1108 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1151 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1109 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1152 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1153#endif
1110}; 1154};
1111 1155
1112/* Inode state bits. Protected by inode_lock. */ 1156/* Inode state bits. Protected by inode_lock. */
@@ -1276,6 +1320,8 @@ struct file_system_type {
1276 struct module *owner; 1320 struct module *owner;
1277 struct file_system_type * next; 1321 struct file_system_type * next;
1278 struct list_head fs_supers; 1322 struct list_head fs_supers;
1323 struct lock_class_key s_lock_key;
1324 struct lock_class_key s_umount_key;
1279}; 1325};
1280 1326
1281extern int get_sb_bdev(struct file_system_type *fs_type, 1327extern int get_sb_bdev(struct file_system_type *fs_type,
@@ -1404,8 +1450,9 @@ extern void bd_set_size(struct block_device *, loff_t size);
1404extern void bd_forget(struct inode *inode); 1450extern void bd_forget(struct inode *inode);
1405extern void bdput(struct block_device *); 1451extern void bdput(struct block_device *);
1406extern struct block_device *open_by_devnum(dev_t, unsigned); 1452extern struct block_device *open_by_devnum(dev_t, unsigned);
1453extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
1407extern const struct file_operations def_blk_fops; 1454extern const struct file_operations def_blk_fops;
1408extern struct address_space_operations def_blk_aops; 1455extern const struct address_space_operations def_blk_aops;
1409extern const struct file_operations def_chr_fops; 1456extern const struct file_operations def_chr_fops;
1410extern const struct file_operations bad_sock_fops; 1457extern const struct file_operations bad_sock_fops;
1411extern const struct file_operations def_fifo_fops; 1458extern const struct file_operations def_fifo_fops;
@@ -1414,6 +1461,7 @@ extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1414extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1461extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1415extern int blkdev_get(struct block_device *, mode_t, unsigned); 1462extern int blkdev_get(struct block_device *, mode_t, unsigned);
1416extern int blkdev_put(struct block_device *); 1463extern int blkdev_put(struct block_device *);
1464extern int blkdev_put_partition(struct block_device *);
1417extern int bd_claim(struct block_device *, void *); 1465extern int bd_claim(struct block_device *, void *);
1418extern void bd_release(struct block_device *); 1466extern void bd_release(struct block_device *);
1419#ifdef CONFIG_SYSFS 1467#ifdef CONFIG_SYSFS
@@ -1767,7 +1815,7 @@ extern struct inode_operations simple_dir_inode_operations;
1767struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 1815struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1768struct dentry *d_alloc_name(struct dentry *, const char *); 1816struct dentry *d_alloc_name(struct dentry *, const char *);
1769extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1817extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1770extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1818extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
1771extern void simple_release_fs(struct vfsmount **mount, int *count); 1819extern void simple_release_fs(struct vfsmount **mount, int *count);
1772 1820
1773extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t); 1821extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t);
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 783c476b86..74ed35a00a 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -69,34 +69,21 @@ enum fs_ioport {
69 fsiop_porte, 69 fsiop_porte,
70}; 70};
71 71
72struct fs_mii_bus_info { 72struct fs_mii_bit {
73 int method; /* mii method */ 73 u32 offset;
74 int id; /* the id of the mii_bus */ 74 u8 bit;
75 int disable_aneg; /* if the controller needs to negothiate speed & duplex */ 75 u8 polarity;
76 int lpa; /* the default board-specific vallues will be applied otherwise */ 76};
77 77struct fs_mii_bb_platform_info {
78 union { 78 struct fs_mii_bit mdio_dir;
79 struct { 79 struct fs_mii_bit mdio_dat;
80 int duplex; 80 struct fs_mii_bit mdc_dat;
81 int speed; 81 int mdio_port; /* port & bit for MDIO */
82 } fixed; 82 int mdio_bit;
83 83 int mdc_port; /* port & bit for MDC */
84 struct { 84 int mdc_bit;
85 /* nothing */ 85 int delay; /* delay in us */
86 } fec; 86 int irq[32]; /* irqs per phy's */
87
88 struct {
89 /* nothing */
90 } scc;
91
92 struct {
93 int mdio_port; /* port & bit for MDIO */
94 int mdio_bit;
95 int mdc_port; /* port & bit for MDC */
96 int mdc_bit;
97 int delay; /* delay in us */
98 } bitbang;
99 } i;
100}; 87};
101 88
102struct fs_platform_info { 89struct fs_platform_info {
@@ -119,6 +106,7 @@ struct fs_platform_info {
119 u32 device_flags; 106 u32 device_flags;
120 107
121 int phy_addr; /* the phy address (-1 no phy) */ 108 int phy_addr; /* the phy address (-1 no phy) */
109 const char* bus_id;
122 int phy_irq; /* the phy irq (if it exists) */ 110 int phy_irq; /* the phy irq (if it exists) */
123 111
124 const struct fs_mii_bus_info *bus_info; 112 const struct fs_mii_bus_info *bus_info;
@@ -130,6 +118,10 @@ struct fs_platform_info {
130 int napi_weight; /* NAPI weight */ 118 int napi_weight; /* NAPI weight */
131 119
132 int use_rmii; /* use RMII mode */ 120 int use_rmii; /* use RMII mode */
121 int has_phy; /* if the network is phy container as well...*/
122};
123struct fs_mii_fec_platform_info {
124 u32 irq[32];
125 u32 mii_speed;
133}; 126};
134
135#endif 127#endif
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index cc5dec70c3..d4f219ffaa 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -67,7 +67,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
67 if (source) { 67 if (source) {
68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); 68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
69 } 69 }
70 audit_inode_child(new_name, source, new_dir->i_ino); 70 audit_inode_child(new_name, source, new_dir);
71} 71}
72 72
73/* 73/*
@@ -98,7 +98,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
98 inode_dir_notify(inode, DN_CREATE); 98 inode_dir_notify(inode, DN_CREATE);
99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
100 dentry->d_inode); 100 dentry->d_inode);
101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
102} 102}
103 103
104/* 104/*
@@ -109,7 +109,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
109 inode_dir_notify(inode, DN_CREATE); 109 inode_dir_notify(inode, DN_CREATE);
110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, 110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
111 dentry->d_name.name, dentry->d_inode); 111 dentry->d_name.name, dentry->d_inode);
112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
113} 113}
114 114
115/* 115/*
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 5425b60021..9fc48a674b 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -9,18 +9,19 @@
9/* This file defines the kernel interface of FUSE */ 9/* This file defines the kernel interface of FUSE */
10 10
11#include <asm/types.h> 11#include <asm/types.h>
12#include <linux/major.h>
12 13
13/** Version number of this interface */ 14/** Version number of this interface */
14#define FUSE_KERNEL_VERSION 7 15#define FUSE_KERNEL_VERSION 7
15 16
16/** Minor version number of this interface */ 17/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 6 18#define FUSE_KERNEL_MINOR_VERSION 7
18 19
19/** The node ID of the root inode */ 20/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 21#define FUSE_ROOT_ID 1
21 22
22/** The major number of the fuse character device */ 23/** The major number of the fuse character device */
23#define FUSE_MAJOR 10 24#define FUSE_MAJOR MISC_MAJOR
24 25
25/** The minor number of the fuse character device */ 26/** The minor number of the fuse character device */
26#define FUSE_MINOR 229 27#define FUSE_MINOR 229
@@ -58,6 +59,13 @@ struct fuse_kstatfs {
58 __u32 spare[6]; 59 __u32 spare[6];
59}; 60};
60 61
62struct fuse_file_lock {
63 __u64 start;
64 __u64 end;
65 __u32 type;
66 __u32 pid; /* tgid */
67};
68
61/** 69/**
62 * Bitmasks for fuse_setattr_in.valid 70 * Bitmasks for fuse_setattr_in.valid
63 */ 71 */
@@ -82,6 +90,7 @@ struct fuse_kstatfs {
82 * INIT request/reply flags 90 * INIT request/reply flags
83 */ 91 */
84#define FUSE_ASYNC_READ (1 << 0) 92#define FUSE_ASYNC_READ (1 << 0)
93#define FUSE_POSIX_LOCKS (1 << 1)
85 94
86enum fuse_opcode { 95enum fuse_opcode {
87 FUSE_LOOKUP = 1, 96 FUSE_LOOKUP = 1,
@@ -112,8 +121,12 @@ enum fuse_opcode {
112 FUSE_READDIR = 28, 121 FUSE_READDIR = 28,
113 FUSE_RELEASEDIR = 29, 122 FUSE_RELEASEDIR = 29,
114 FUSE_FSYNCDIR = 30, 123 FUSE_FSYNCDIR = 30,
124 FUSE_GETLK = 31,
125 FUSE_SETLK = 32,
126 FUSE_SETLKW = 33,
115 FUSE_ACCESS = 34, 127 FUSE_ACCESS = 34,
116 FUSE_CREATE = 35 128 FUSE_CREATE = 35,
129 FUSE_INTERRUPT = 36,
117}; 130};
118 131
119/* The read buffer is required to be at least 8k, but may be much larger */ 132/* The read buffer is required to be at least 8k, but may be much larger */
@@ -199,6 +212,7 @@ struct fuse_flush_in {
199 __u64 fh; 212 __u64 fh;
200 __u32 flush_flags; 213 __u32 flush_flags;
201 __u32 padding; 214 __u32 padding;
215 __u64 lock_owner;
202}; 216};
203 217
204struct fuse_read_in { 218struct fuse_read_in {
@@ -247,6 +261,16 @@ struct fuse_getxattr_out {
247 __u32 padding; 261 __u32 padding;
248}; 262};
249 263
264struct fuse_lk_in {
265 __u64 fh;
266 __u64 owner;
267 struct fuse_file_lock lk;
268};
269
270struct fuse_lk_out {
271 struct fuse_file_lock lk;
272};
273
250struct fuse_access_in { 274struct fuse_access_in {
251 __u32 mask; 275 __u32 mask;
252 __u32 padding; 276 __u32 padding;
@@ -268,6 +292,10 @@ struct fuse_init_out {
268 __u32 max_write; 292 __u32 max_write;
269}; 293};
270 294
295struct fuse_interrupt_in {
296 __u64 unique;
297};
298
271struct fuse_in_header { 299struct fuse_in_header {
272 __u32 len; 300 __u32 len;
273 __u32 opcode; 301 __u32 opcode;
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 966a5b3da4..d097b5b72b 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -12,6 +12,9 @@
12#define FUTEX_REQUEUE 3 12#define FUTEX_REQUEUE 3
13#define FUTEX_CMP_REQUEUE 4 13#define FUTEX_CMP_REQUEUE 4
14#define FUTEX_WAKE_OP 5 14#define FUTEX_WAKE_OP 5
15#define FUTEX_LOCK_PI 6
16#define FUTEX_UNLOCK_PI 7
17#define FUTEX_TRYLOCK_PI 8
15 18
16/* 19/*
17 * Support for robust futexes: the kernel cleans up held futexes at 20 * Support for robust futexes: the kernel cleans up held futexes at
@@ -90,18 +93,22 @@ struct robust_list_head {
90 */ 93 */
91#define ROBUST_LIST_LIMIT 2048 94#define ROBUST_LIST_LIMIT 2048
92 95
93long do_futex(unsigned long uaddr, int op, int val, 96long do_futex(u32 __user *uaddr, int op, u32 val, unsigned long timeout,
94 unsigned long timeout, unsigned long uaddr2, int val2, 97 u32 __user *uaddr2, u32 val2, u32 val3);
95 int val3);
96 98
97extern int handle_futex_death(u32 __user *uaddr, struct task_struct *curr); 99extern int
100handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
98 101
99#ifdef CONFIG_FUTEX 102#ifdef CONFIG_FUTEX
100extern void exit_robust_list(struct task_struct *curr); 103extern void exit_robust_list(struct task_struct *curr);
104extern void exit_pi_state_list(struct task_struct *curr);
101#else 105#else
102static inline void exit_robust_list(struct task_struct *curr) 106static inline void exit_robust_list(struct task_struct *curr)
103{ 107{
104} 108}
109static inline void exit_pi_state_list(struct task_struct *curr)
110{
111}
105#endif 112#endif
106 113
107#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ 114#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
new file mode 100644
index 0000000000..80764f40be
--- /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/genetlink.h b/include/linux/genetlink.h
index 84f12a41dc..9049dc65ae 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -16,6 +16,8 @@ struct genlmsghdr {
16 16
17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) 17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
18 18
19#define GENL_ADMIN_PERM 0x01
20
19/* 21/*
20 * List of reserved static generic netlink identifiers: 22 * List of reserved static generic netlink identifiers:
21 */ 23 */
@@ -43,9 +45,25 @@ enum {
43 CTRL_ATTR_UNSPEC, 45 CTRL_ATTR_UNSPEC,
44 CTRL_ATTR_FAMILY_ID, 46 CTRL_ATTR_FAMILY_ID,
45 CTRL_ATTR_FAMILY_NAME, 47 CTRL_ATTR_FAMILY_NAME,
48 CTRL_ATTR_VERSION,
49 CTRL_ATTR_HDRSIZE,
50 CTRL_ATTR_MAXATTR,
51 CTRL_ATTR_OPS,
46 __CTRL_ATTR_MAX, 52 __CTRL_ATTR_MAX,
47}; 53};
48 54
49#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) 55#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
50 56
57enum {
58 CTRL_ATTR_OP_UNSPEC,
59 CTRL_ATTR_OP_ID,
60 CTRL_ATTR_OP_FLAGS,
61 CTRL_ATTR_OP_POLICY,
62 CTRL_ATTR_OP_DOIT,
63 CTRL_ATTR_OP_DUMPIT,
64 __CTRL_ATTR_OP_MAX,
65};
66
67#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
68
51#endif /* __LINUX_GENERIC_NETLINK_H */ 69#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3498a0c681..e4af57e87c 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -112,8 +112,6 @@ struct gendisk {
112 sector_t capacity; 112 sector_t capacity;
113 113
114 int flags; 114 int flags;
115 char devfs_name[64]; /* devfs crap */
116 int number; /* more of the same */
117 struct device *driverfs_dev; 115 struct device *driverfs_dev;
118 struct kobject kobj; 116 struct kobject kobj;
119 struct kobject *holder_dir; 117 struct kobject *holder_dir;
diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h
new file mode 100644
index 0000000000..c7372d7a97
--- /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 cc9e608444..bf2b6bc3f6 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -9,17 +9,16 @@ struct vm_area_struct;
9 9
10/* 10/*
11 * GFP bitmasks.. 11 * GFP bitmasks..
12 *
13 * Zone modifiers (see linux/mmzone.h - low three bits)
14 *
15 * Do not put any conditional on these. If necessary modify the definitions
16 * without the underscores and use the consistently. The definitions here may
17 * be used in bit comparisons.
12 */ 18 */
13/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
14#define __GFP_DMA ((__force gfp_t)0x01u) 19#define __GFP_DMA ((__force gfp_t)0x01u)
15#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 20#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
16#ifdef CONFIG_DMA_IS_DMA32 21#define __GFP_DMA32 ((__force gfp_t)0x04u)
17#define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
18#elif BITS_PER_LONG < 64
19#define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */
20#else
21#define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */
22#endif
23 22
24/* 23/*
25 * Action modifiers - doesn't change the zoning 24 * Action modifiers - doesn't change the zoning
@@ -46,6 +45,7 @@ struct vm_area_struct;
46#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ 45#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */
47#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 46#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
48#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 47#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
48#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
49 49
50#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 50#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
51#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 51#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
@@ -54,7 +54,7 @@ struct vm_area_struct;
54#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 54#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
55 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 55 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
56 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 56 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
57 __GFP_NOMEMALLOC|__GFP_HARDWALL) 57 __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE)
58 58
59/* This equals 0, but use constants in case they ever change */ 59/* This equals 0, but use constants in case they ever change */
60#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) 60#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
@@ -67,6 +67,13 @@ 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
71#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
72#else
73#define GFP_THISNODE 0
74#endif
75
76
70/* 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
71 platforms, used as appropriate on others */ 78 platforms, used as appropriate on others */
72 79
@@ -76,11 +83,19 @@ struct vm_area_struct;
76#define GFP_DMA32 __GFP_DMA32 83#define GFP_DMA32 __GFP_DMA32
77 84
78 85
79static inline int gfp_zone(gfp_t gfp) 86static inline enum zone_type gfp_zone(gfp_t flags)
80{ 87{
81 int zone = GFP_ZONEMASK & (__force int) gfp; 88 if (flags & __GFP_DMA)
82 BUG_ON(zone >= GFP_ZONETYPES); 89 return ZONE_DMA;
83 return zone; 90#ifdef CONFIG_ZONE_DMA32
91 if (flags & __GFP_DMA32)
92 return ZONE_DMA32;
93#endif
94#ifdef CONFIG_HIGHMEM
95 if (flags & __GFP_HIGHMEM)
96 return ZONE_HIGHMEM;
97#endif
98 return ZONE_NORMAL;
84} 99}
85 100
86/* 101/*
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 114ae583cc..50d8b5744c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/smp_lock.h> 5#include <linux/smp_lock.h>
6#include <linux/lockdep.h>
6#include <asm/hardirq.h> 7#include <asm/hardirq.h>
7#include <asm/system.h> 8#include <asm/system.h>
8 9
@@ -86,9 +87,6 @@ extern void synchronize_irq(unsigned int irq);
86# define synchronize_irq(irq) barrier() 87# define synchronize_irq(irq) barrier()
87#endif 88#endif
88 89
89#define nmi_enter() irq_enter()
90#define nmi_exit() sub_preempt_count(HARDIRQ_OFFSET)
91
92struct task_struct; 90struct task_struct;
93 91
94#ifndef CONFIG_VIRT_CPU_ACCOUNTING 92#ifndef CONFIG_VIRT_CPU_ACCOUNTING
@@ -97,12 +95,35 @@ static inline void account_system_vtime(struct task_struct *tsk)
97} 95}
98#endif 96#endif
99 97
98/*
99 * It is safe to do non-atomic ops on ->hardirq_context,
100 * because NMI handlers may not preempt and the ops are
101 * always balanced, so the interrupted value of ->hardirq_context
102 * will always be restored.
103 */
100#define irq_enter() \ 104#define irq_enter() \
101 do { \ 105 do { \
102 account_system_vtime(current); \ 106 account_system_vtime(current); \
103 add_preempt_count(HARDIRQ_OFFSET); \ 107 add_preempt_count(HARDIRQ_OFFSET); \
108 trace_hardirq_enter(); \
109 } while (0)
110
111/*
112 * Exit irq context without processing softirqs:
113 */
114#define __irq_exit() \
115 do { \
116 trace_hardirq_exit(); \
117 account_system_vtime(current); \
118 sub_preempt_count(HARDIRQ_OFFSET); \
104 } while (0) 119 } while (0)
105 120
121/*
122 * Exit irq context and process softirqs if needed:
123 */
106extern void irq_exit(void); 124extern void irq_exit(void);
107 125
126#define nmi_enter() do { lockdep_off(); irq_enter(); } while (0)
127#define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0)
128
108#endif /* LINUX_HARDIRQ_H */ 129#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 4513f9e409..d4b333938f 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
@@ -224,21 +115,15 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
224int hdlc_open(struct net_device *dev); 115int 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/* Called by hardware driver when DCD line level changes */
228void hdlc_set_carrier(int on, struct net_device *dev);
229 118
119int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
120 int (*rx)(struct sk_buff *skb), size_t size);
230/* 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 */
231static __inline__ void hdlc_proto_detach(hdlc_device *hdlc) 122void detach_hdlc_protocol(struct net_device *dev);
232{
233 if (hdlc->proto.detach)
234 hdlc->proto.detach(hdlc);
235 hdlc->proto.detach = NULL;
236}
237
238 123
239static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) 124static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
240{ 125{
241 return &dev_to_hdlc(dev)->stats; 126 return &dev_to_desc(dev)->stats;
242} 127}
243 128
244 129
@@ -250,8 +135,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
250 skb->mac.raw = skb->data; 135 skb->mac.raw = skb->data;
251 skb->dev = dev; 136 skb->dev = dev;
252 137
253 if (hdlc->proto.type_trans) 138 if (hdlc->proto->type_trans)
254 return hdlc->proto.type_trans(skb, dev); 139 return hdlc->proto->type_trans(skb, dev);
255 else 140 else
256 return htons(ETH_P_HDLC); 141 return htons(ETH_P_HDLC);
257} 142}
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild
new file mode 100644
index 0000000000..1fb26448fa
--- /dev/null
+++ b/include/linux/hdlc/Kbuild
@@ -0,0 +1 @@
header-y += ioctl.h
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h
index 78430ba3ea..5839723643 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/highmem.h b/include/linux/highmem.h
index 85ce7ef9a5..fd7d12daa9 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -24,11 +24,15 @@ static inline void flush_kernel_dcache_page(struct page *page)
24 24
25/* declarations for linux/mm/highmem.c */ 25/* declarations for linux/mm/highmem.c */
26unsigned int nr_free_highpages(void); 26unsigned int nr_free_highpages(void);
27extern unsigned long totalhigh_pages;
27 28
28#else /* CONFIG_HIGHMEM */ 29#else /* CONFIG_HIGHMEM */
29 30
30static inline unsigned int nr_free_highpages(void) { return 0; } 31static inline unsigned int nr_free_highpages(void) { return 0; }
31 32
33#define totalhigh_pages 0
34
35#ifndef ARCH_HAS_KMAP
32static inline void *kmap(struct page *page) 36static inline void *kmap(struct page *page)
33{ 37{
34 might_sleep(); 38 might_sleep();
@@ -41,6 +45,7 @@ static inline void *kmap(struct page *page)
41#define kunmap_atomic(addr, idx) do { } while (0) 45#define kunmap_atomic(addr, idx) do { } while (0)
42#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) 46#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
43#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 47#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
48#endif
44 49
45#endif /* CONFIG_HIGHMEM */ 50#endif /* CONFIG_HIGHMEM */
46 51
diff --git a/include/linux/hpfs_fs.h b/include/linux/hpfs_fs.h
deleted file mode 100644
index a5028dd94d..0000000000
--- a/include/linux/hpfs_fs.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _LINUX_HPFS_FS_H
2#define _LINUX_HPFS_FS_H
3
4/* HPFS magic number (word 0 of block 16) */
5
6#define HPFS_SUPER_MAGIC 0xf995e849
7
8#endif
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 7d2a1b974c..fca93025ab 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -40,7 +40,6 @@ struct hrtimer_base;
40 40
41/** 41/**
42 * struct hrtimer - the basic hrtimer structure 42 * struct hrtimer - the basic hrtimer structure
43 *
44 * @node: red black tree node for time ordered insertion 43 * @node: red black tree node for time ordered insertion
45 * @expires: the absolute expiry time in the hrtimers internal 44 * @expires: the absolute expiry time in the hrtimers internal
46 * representation. The time is related to the clock on 45 * representation. The time is related to the clock on
@@ -59,7 +58,6 @@ struct hrtimer {
59 58
60/** 59/**
61 * struct hrtimer_sleeper - simple sleeper structure 60 * struct hrtimer_sleeper - simple sleeper structure
62 *
63 * @timer: embedded timer structure 61 * @timer: embedded timer structure
64 * @task: task to wake up 62 * @task: task to wake up
65 * 63 *
@@ -72,7 +70,6 @@ struct hrtimer_sleeper {
72 70
73/** 71/**
74 * struct hrtimer_base - the timer base for a specific clock 72 * struct hrtimer_base - the timer base for a specific clock
75 *
76 * @index: clock type index for per_cpu support when moving a timer 73 * @index: clock type index for per_cpu support when moving a timer
77 * to a base on another cpu. 74 * to a base on another cpu.
78 * @lock: lock protecting the base and associated timers 75 * @lock: lock protecting the base and associated timers
@@ -83,6 +80,7 @@ struct hrtimer_sleeper {
83 * @get_softirq_time: function to retrieve the current time from the softirq 80 * @get_softirq_time: function to retrieve the current time from the softirq
84 * @curr_timer: the timer which is executing a callback right now 81 * @curr_timer: the timer which is executing a callback right now
85 * @softirq_time: the time when running the hrtimer queue in the softirq 82 * @softirq_time: the time when running the hrtimer queue in the softirq
83 * @lock_key: the lock_class_key for use with lockdep
86 */ 84 */
87struct hrtimer_base { 85struct hrtimer_base {
88 clockid_t index; 86 clockid_t index;
@@ -94,6 +92,7 @@ struct hrtimer_base {
94 ktime_t (*get_softirq_time)(void); 92 ktime_t (*get_softirq_time)(void);
95 struct hrtimer *curr_timer; 93 struct hrtimer *curr_timer;
96 ktime_t softirq_time; 94 ktime_t softirq_time;
95 struct lock_class_key lock_key;
97}; 96};
98 97
99/* 98/*
@@ -139,6 +138,7 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
139 struct timespec __user *rmtp, 138 struct timespec __user *rmtp,
140 const enum hrtimer_mode mode, 139 const enum hrtimer_mode mode,
141 const clockid_t clockid); 140 const clockid_t clockid);
141extern long hrtimer_nanosleep_restart(struct restart_block *restart_block);
142 142
143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, 143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
144 struct task_struct *tsk); 144 struct task_struct *tsk);
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
new file mode 100644
index 0000000000..21ea7610e1
--- /dev/null
+++ b/include/linux/hw_random.h
@@ -0,0 +1,50 @@
1/*
2 Hardware Random Number Generator
3
4 Please read Documentation/hw_random.txt for details on use.
5
6 ----------------------------------------------------------
7 This software may be used and distributed according to the terms
8 of the GNU General Public License, incorporated herein by reference.
9
10 */
11
12#ifndef LINUX_HWRANDOM_H_
13#define LINUX_HWRANDOM_H_
14#ifdef __KERNEL__
15
16#include <linux/types.h>
17#include <linux/list.h>
18
19/**
20 * struct hwrng - Hardware Random Number Generator driver
21 * @name: Unique RNG name.
22 * @init: Initialization callback (can be NULL).
23 * @cleanup: Cleanup callback (can be NULL).
24 * @data_present: Callback to determine if data is available
25 * on the RNG. If NULL, it is assumed that
26 * there is always data available.
27 * @data_read: Read data from the RNG device.
28 * Returns the number of lower random bytes in "data".
29 * Must not be NULL.
30 * @priv: Private data, for use by the RNG driver.
31 */
32struct hwrng {
33 const char *name;
34 int (*init)(struct hwrng *rng);
35 void (*cleanup)(struct hwrng *rng);
36 int (*data_present)(struct hwrng *rng);
37 int (*data_read)(struct hwrng *rng, u32 *data);
38 unsigned long priv;
39
40 /* internal. */
41 struct list_head list;
42};
43
44/** Register a new Hardware Random Number Generator driver. */
45extern int hwrng_register(struct hwrng *rng);
46/** Unregister a Hardware Random Number Generator driver. */
47extern void hwrng_unregister(struct hwrng *rng);
48
49#endif /* __KERNEL__ */
50#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index c0e7fab28c..c8f8df25c7 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 18b0adf57a..9908f3fc48 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 03914ded86..0000000000
--- 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 cce6074dd7..0a8f750cbe 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -112,6 +112,10 @@
112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ 112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ 113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */ 114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
115#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
116#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
117#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
118#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
115 119
116#define I2C_DRIVERID_I2CDEV 900 120#define I2C_DRIVERID_I2CDEV 900
117#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 121#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 526ddc8eec..9b5d04768c 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,
@@ -193,16 +185,14 @@ struct i2c_algorithm {
193 to NULL. If an adapter algorithm can do SMBus access, set 185 to NULL. If an adapter algorithm can do SMBus access, set
194 smbus_xfer. If set to NULL, the SMBus protocol is simulated 186 smbus_xfer. If set to NULL, the SMBus protocol is simulated
195 using common I2C messages */ 187 using common I2C messages */
188 /* master_xfer should return the number of messages successfully
189 processed, or a negative value on error */
196 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, 190 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
197 int num); 191 int num);
198 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, 192 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
199 unsigned short flags, char read_write, 193 unsigned short flags, char read_write,
200 u8 command, int size, union i2c_smbus_data * data); 194 u8 command, int size, union i2c_smbus_data * data);
201 195
202 /* --- these optional/future use for some adapter types.*/
203 int (*slave_send)(struct i2c_adapter *,char*,int);
204 int (*slave_recv)(struct i2c_adapter *,char*,int);
205
206 /* --- ioctl like call to set div. parameters. */ 196 /* --- ioctl like call to set div. parameters. */
207 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); 197 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
208 198
@@ -218,7 +208,7 @@ struct i2c_adapter {
218 struct module *owner; 208 struct module *owner;
219 unsigned int id; 209 unsigned int id;
220 unsigned int class; 210 unsigned int class;
221 struct i2c_algorithm *algo;/* the algorithm to access the bus */ 211 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
222 void *algo_data; 212 void *algo_data;
223 213
224 /* --- administration stuff. */ 214 /* --- administration stuff. */
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index f0b571f106..878cfe4e58 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 77e66d055f..99620451d9 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -552,7 +552,6 @@ typedef struct ide_drive_s {
552 struct hd_driveid *id; /* drive model identification info */ 552 struct hd_driveid *id; /* drive model identification info */
553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
554 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 554 struct ide_settings_s *settings;/* /proc/ide/ drive settings */
555 char devfs_name[64]; /* devfs crap */
556 555
557 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 556 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
558 557
@@ -572,6 +571,7 @@ typedef struct ide_drive_s {
572 u8 waiting_for_dma; /* dma currently in progress */ 571 u8 waiting_for_dma; /* dma currently in progress */
573 u8 unmask; /* okay to unmask other irqs */ 572 u8 unmask; /* okay to unmask other irqs */
574 u8 bswap; /* byte swap data */ 573 u8 bswap; /* byte swap data */
574 u8 noflush; /* don't attempt flushes */
575 u8 dsc_overlap; /* DSC overlap */ 575 u8 dsc_overlap; /* DSC overlap */
576 u8 nice1; /* give potential excess bandwidth */ 576 u8 nice1; /* give potential excess bandwidth */
577 577
@@ -630,6 +630,7 @@ typedef struct ide_drive_s {
630 unsigned int usage; /* current "open()" count for drive */ 630 unsigned int usage; /* current "open()" count for drive */
631 unsigned int failures; /* current failure count */ 631 unsigned int failures; /* current failure count */
632 unsigned int max_failures; /* maximum allowed failure count */ 632 unsigned int max_failures; /* maximum allowed failure count */
633 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
633 634
634 u64 capacity64; /* total number of sectors */ 635 u64 capacity64; /* total number of sectors */
635 636
@@ -792,6 +793,7 @@ typedef struct hwif_s {
792 unsigned auto_poll : 1; /* supports nop auto-poll */ 793 unsigned auto_poll : 1; /* supports nop auto-poll */
793 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
794 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ 795 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
796 unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */
795 797
796 struct device gendev; 798 struct device gendev;
797 struct completion gendev_rel_comp; /* To deal with device release() */ 799 struct completion gendev_rel_comp; /* To deal with device release() */
@@ -1005,6 +1007,8 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */
1005extern int noautodma; 1007extern int noautodma;
1006 1008
1007extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1009extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
1010int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1011 int uptodate, int nr_sectors);
1008 1012
1009/* 1013/*
1010 * This is used on exit from the driver to designate the next irq handler 1014 * This is used on exit from the driver to designate the next irq handler
@@ -1356,7 +1360,7 @@ extern struct semaphore ide_cfg_sem;
1356 * ide_drive_t->hwif: constant, no locking 1360 * ide_drive_t->hwif: constant, no locking
1357 */ 1361 */
1358 1362
1359#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable(); } while (0) 1363#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1360 1364
1361extern struct bus_type ide_bus_type; 1365extern struct bus_type ide_bus_type;
1362 1366
diff --git a/include/linux/idr.h b/include/linux/idr.h
index d37c8d808b..826803449d 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -66,7 +66,7 @@ struct idr {
66 .id_free = NULL, \ 66 .id_free = NULL, \
67 .layers = 0, \ 67 .layers = 0, \
68 .id_free_cnt = 0, \ 68 .id_free_cnt = 0, \
69 .lock = SPIN_LOCK_UNLOCKED, \ 69 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
70} 70}
71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
72 72
@@ -78,6 +78,7 @@ void *idr_find(struct idr *idp, int id);
78int idr_pre_get(struct idr *idp, gfp_t gfp_mask); 78int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
79int idr_get_new(struct idr *idp, void *ptr, int *id); 79int idr_get_new(struct idr *idp, void *ptr, int *id);
80int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 80int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
81void *idr_replace(struct idr *idp, void *ptr, int id);
81void idr_remove(struct idr *idp, int id); 82void idr_remove(struct idr *idp, int id);
82void idr_destroy(struct idr *idp); 83void idr_destroy(struct idr *idp);
83void idr_init(struct idr *idp); 84void idr_init(struct idr *idp);
diff --git a/include/linux/if.h b/include/linux/if.h
index 374e20ad8b..32bf419351 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,5 +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
216#endif /* _LINUX_IF_H */ 217#endif /* _LINUX_IF_H */
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
new file mode 100644
index 0000000000..dbe8f6120a
--- /dev/null
+++ b/include/linux/if_addr.h
@@ -0,0 +1,55 @@
1#ifndef __LINUX_IF_ADDR_H
2#define __LINUX_IF_ADDR_H
3
4#include <linux/netlink.h>
5
6struct ifaddrmsg
7{
8 __u8 ifa_family;
9 __u8 ifa_prefixlen; /* The prefix length */
10 __u8 ifa_flags; /* Flags */
11 __u8 ifa_scope; /* Address scope */
12 __u32 ifa_index; /* Link index */
13};
14
15/*
16 * Important comment:
17 * IFA_ADDRESS is prefix address, rather than local interface address.
18 * It makes no difference for normally configured broadcast interfaces,
19 * but for point-to-point IFA_ADDRESS is DESTINATION address,
20 * local address is supplied in IFA_LOCAL attribute.
21 */
22enum
23{
24 IFA_UNSPEC,
25 IFA_ADDRESS,
26 IFA_LOCAL,
27 IFA_LABEL,
28 IFA_BROADCAST,
29 IFA_ANYCAST,
30 IFA_CACHEINFO,
31 IFA_MULTICAST,
32 __IFA_MAX,
33};
34
35#define IFA_MAX (__IFA_MAX - 1)
36
37/* ifa_flags */
38#define IFA_F_SECONDARY 0x01
39#define IFA_F_TEMPORARY IFA_F_SECONDARY
40
41#define IFA_F_NODAD 0x02
42#define IFA_F_HOMEADDRESS 0x10
43#define IFA_F_DEPRECATED 0x20
44#define IFA_F_TENTATIVE 0x40
45#define IFA_F_PERMANENT 0x80
46
47struct ifa_cacheinfo
48{
49 __u32 ifa_prefered;
50 __u32 ifa_valid;
51 __u32 cstamp; /* created timestamp, hundredths of seconds */
52 __u32 tstamp; /* updated timestamp, hundredths of seconds */
53};
54
55#endif
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index a8b1a20718..7f5714214e 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 0000000000..e963a077e6
--- /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/if_vlan.h b/include/linux/if_vlan.h
index eef0876d83..ab27408327 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -23,8 +23,8 @@ struct vlan_collection;
23struct vlan_dev_info; 23struct vlan_dev_info;
24struct hlist_node; 24struct hlist_node;
25 25
26#include <linux/proc_fs.h> /* for proc_dir_entry */
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/etherdevice.h>
28 28
29#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) 29#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header)
30 * that VLAN requires. 30 * that VLAN requires.
@@ -155,6 +155,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
155{ 155{
156 struct net_device_stats *stats; 156 struct net_device_stats *stats;
157 157
158 if (skb_bond_should_drop(skb)) {
159 dev_kfree_skb_any(skb);
160 return NET_RX_DROP;
161 }
162
158 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; 163 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
159 if (skb->dev == NULL) { 164 if (skb->dev == NULL) {
160 dev_kfree_skb_any(skb); 165 dev_kfree_skb_any(skb);
@@ -185,7 +190,8 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
185 * This allows the VLAN to have a different MAC than the underlying 190 * This allows the VLAN to have a different MAC than the underlying
186 * device, and still route correctly. 191 * device, and still route correctly.
187 */ 192 */
188 if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN)) 193 if (!compare_ether_addr(eth_hdr(skb)->h_dest,
194 skb->dev->dev_addr))
189 skb->pkt_type = PACKET_HOST; 195 skb->pkt_type = PACKET_HOST;
190 break; 196 break;
191 }; 197 };
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 899c3d4776..03f43e2893 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 94f557fa46..d79fc75fa7 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -52,7 +52,7 @@ enum {
52 52
53/* Internet address. */ 53/* Internet address. */
54struct in_addr { 54struct in_addr {
55 __u32 s_addr; 55 __be32 s_addr;
56}; 56};
57 57
58#define IP_TOS 1 58#define IP_TOS 1
@@ -123,17 +123,17 @@ struct ip_mreqn
123}; 123};
124 124
125struct ip_mreq_source { 125struct ip_mreq_source {
126 __u32 imr_multiaddr; 126 __be32 imr_multiaddr;
127 __u32 imr_interface; 127 __be32 imr_interface;
128 __u32 imr_sourceaddr; 128 __be32 imr_sourceaddr;
129}; 129};
130 130
131struct ip_msfilter { 131struct ip_msfilter {
132 __u32 imsf_multiaddr; 132 __be32 imsf_multiaddr;
133 __u32 imsf_interface; 133 __be32 imsf_interface;
134 __u32 imsf_fmode; 134 __u32 imsf_fmode;
135 __u32 imsf_numsrc; 135 __u32 imsf_numsrc;
136 __u32 imsf_slist[1]; 136 __be32 imsf_slist[1];
137}; 137};
138 138
139#define IP_MSFILTER_SIZE(numsrc) \ 139#define IP_MSFILTER_SIZE(numsrc) \
@@ -177,7 +177,7 @@ struct in_pktinfo
177#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ 177#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
178struct sockaddr_in { 178struct sockaddr_in {
179 sa_family_t sin_family; /* Address family */ 179 sa_family_t sin_family; /* Address family */
180 unsigned short int sin_port; /* Port number */ 180 __be16 sin_port; /* Port number */
181 struct in_addr sin_addr; /* Internet address */ 181 struct in_addr sin_addr; /* Internet address */
182 182
183 /* Pad to size of `struct sockaddr'. */ 183 /* Pad to size of `struct sockaddr'. */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 304aaedea3..9be6a4756f 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) */
@@ -134,6 +134,7 @@ struct in6_flowlabel_req
134#define IPPROTO_ICMPV6 58 /* ICMPv6 */ 134#define IPPROTO_ICMPV6 58 /* ICMPv6 */
135#define IPPROTO_NONE 59 /* IPv6 no next header */ 135#define IPPROTO_NONE 59 /* IPv6 no next header */
136#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ 136#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
137#define IPPROTO_MH 135 /* IPv6 mobility header */
137 138
138/* 139/*
139 * IPv6 TLV options. 140 * IPv6 TLV options.
@@ -142,6 +143,7 @@ struct in6_flowlabel_req
142#define IPV6_TLV_PADN 1 143#define IPV6_TLV_PADN 1
143#define IPV6_TLV_ROUTERALERT 5 144#define IPV6_TLV_ROUTERALERT 5
144#define IPV6_TLV_JUMBO 194 145#define IPV6_TLV_JUMBO 194
146#define IPV6_TLV_HAO 201 /* home address option */
145 147
146/* 148/*
147 * IPV6 socket options 149 * IPV6 socket options
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 6c5587af11..b7c6da7d6d 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -46,5 +46,7 @@
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __be32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49extern int in4_pton(const char *src, int srclen, u8 *dst, char delim, const char **end);
50extern int in6_pton(const char *src, int srclen, u8 *dst, char delim, const char **end);
49#endif 51#endif
50#endif /* _LINUX_INET_H */ 52#endif /* _LINUX_INET_H */
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index a4606e5810..6e8bc54863 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 92297ff24e..5a0ab04627 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 6667785dd1..e92b1455d7 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 41ecbb847f..60aac2cea0 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -3,6 +3,8 @@
3 3
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>
7#include <linux/lockdep.h>
6 8
7#define INIT_FDTABLE \ 9#define INIT_FDTABLE \
8{ \ 10{ \
@@ -21,7 +23,7 @@
21 .count = ATOMIC_INIT(1), \ 23 .count = ATOMIC_INIT(1), \
22 .fdt = &init_files.fdtab, \ 24 .fdt = &init_files.fdtab, \
23 .fdtab = INIT_FDTABLE, \ 25 .fdtab = INIT_FDTABLE, \
24 .file_lock = SPIN_LOCK_UNLOCKED, \ 26 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), \
25 .next_fd = 0, \ 27 .next_fd = 0, \
26 .close_on_exec_init = { { 0, } }, \ 28 .close_on_exec_init = { { 0, } }, \
27 .open_fds_init = { { 0, } }, \ 29 .open_fds_init = { { 0, } }, \
@@ -36,7 +38,7 @@
36 .user_id = 0, \ 38 .user_id = 0, \
37 .next = NULL, \ 39 .next = NULL, \
38 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \ 40 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \
39 .ctx_lock = SPIN_LOCK_UNLOCKED, \ 41 .ctx_lock = __SPIN_LOCK_UNLOCKED(name.ctx_lock), \
40 .reqs_active = 0U, \ 42 .reqs_active = 0U, \
41 .max_reqs = ~0U, \ 43 .max_reqs = ~0U, \
42} 44}
@@ -48,7 +50,7 @@
48 .mm_users = ATOMIC_INIT(2), \ 50 .mm_users = ATOMIC_INIT(2), \
49 .mm_count = ATOMIC_INIT(1), \ 51 .mm_count = ATOMIC_INIT(1), \
50 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \ 52 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
51 .page_table_lock = SPIN_LOCK_UNLOCKED, \ 53 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
52 .mmlist = LIST_HEAD_INIT(name.mmlist), \ 54 .mmlist = LIST_HEAD_INIT(name.mmlist), \
53 .cpu_vm_mask = CPU_MASK_ALL, \ 55 .cpu_vm_mask = CPU_MASK_ALL, \
54} 56}
@@ -69,7 +71,7 @@
69#define INIT_SIGHAND(sighand) { \ 71#define INIT_SIGHAND(sighand) { \
70 .count = ATOMIC_INIT(1), \ 72 .count = ATOMIC_INIT(1), \
71 .action = { { { .sa_handler = NULL, } }, }, \ 73 .action = { { { .sa_handler = NULL, } }, }, \
72 .siglock = SPIN_LOCK_UNLOCKED, \ 74 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
73} 75}
74 76
75extern struct group_info init_groups; 77extern struct group_info init_groups;
@@ -87,6 +89,7 @@ extern struct group_info init_groups;
87 .lock_depth = -1, \ 89 .lock_depth = -1, \
88 .prio = MAX_PRIO-20, \ 90 .prio = MAX_PRIO-20, \
89 .static_prio = MAX_PRIO-20, \ 91 .static_prio = MAX_PRIO-20, \
92 .normal_prio = MAX_PRIO-20, \
90 .policy = SCHED_NORMAL, \ 93 .policy = SCHED_NORMAL, \
91 .cpus_allowed = CPU_MASK_ALL, \ 94 .cpus_allowed = CPU_MASK_ALL, \
92 .mm = NULL, \ 95 .mm = NULL, \
@@ -118,11 +121,13 @@ extern struct group_info init_groups;
118 .list = LIST_HEAD_INIT(tsk.pending.list), \ 121 .list = LIST_HEAD_INIT(tsk.pending.list), \
119 .signal = {{0}}}, \ 122 .signal = {{0}}}, \
120 .blocked = {{0}}, \ 123 .blocked = {{0}}, \
121 .alloc_lock = SPIN_LOCK_UNLOCKED, \ 124 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
122 .proc_lock = SPIN_LOCK_UNLOCKED, \
123 .journal_info = NULL, \ 125 .journal_info = NULL, \
124 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 126 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
125 .fs_excl = ATOMIC_INIT(0), \ 127 .fs_excl = ATOMIC_INIT(0), \
128 .pi_lock = SPIN_LOCK_UNLOCKED, \
129 INIT_TRACE_IRQFLAGS \
130 INIT_LOCKDEP \
126} 131}
127 132
128 133
diff --git a/include/linux/input.h b/include/linux/input.h
index b32c2b6e53..b3253ab72f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -232,7 +232,8 @@ struct input_absinfo {
232#define KEY_PAUSE 119 232#define KEY_PAUSE 119
233 233
234#define KEY_KPCOMMA 121 234#define KEY_KPCOMMA 121
235#define KEY_HANGUEL 122 235#define KEY_HANGEUL 122
236#define KEY_HANGUEL KEY_HANGEUL
236#define KEY_HANJA 123 237#define KEY_HANJA 123
237#define KEY_YEN 124 238#define KEY_YEN 124
238#define KEY_LEFTMETA 125 239#define KEY_LEFTMETA 125
@@ -892,7 +893,6 @@ struct input_dev {
892 893
893 int (*open)(struct input_dev *dev); 894 int (*open)(struct input_dev *dev);
894 void (*close)(struct input_dev *dev); 895 void (*close)(struct input_dev *dev);
895 int (*accept)(struct input_dev *dev, struct file *file);
896 int (*flush)(struct input_dev *dev, struct file *file); 896 int (*flush)(struct input_dev *dev, struct file *file);
897 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); 897 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); 898 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
@@ -960,6 +960,26 @@ struct input_dev {
960 960
961struct input_handle; 961struct input_handle;
962 962
963/**
964 * struct input_handler - implements one of interfaces for input devices
965 * @private: driver-specific data
966 * @event: event handler
967 * @connect: called when attaching a handler to an input device
968 * @disconnect: disconnects a handler from input device
969 * @start: starts handler for given handle. This function is called by
970 * input core right after connect() method and also when a process
971 * that "grabbed" a device releases it
972 * @fops: file operations this driver implements
973 * @minor: beginning of range of 32 minors for devices this driver
974 * can provide
975 * @name: name of the handler, to be shown in /proc/bus/input/handlers
976 * @id_table: pointer to a table of input_device_ids this driver can
977 * handle
978 * @blacklist: prointer to a table of input_device_ids this driver should
979 * ignore even if they match @id_table
980 * @h_list: list of input handles associated with the handler
981 * @node: for placing the driver onto input_handler_list
982 */
963struct input_handler { 983struct input_handler {
964 984
965 void *private; 985 void *private;
@@ -967,6 +987,7 @@ struct input_handler {
967 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 987 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
968 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 988 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
969 void (*disconnect)(struct input_handle *handle); 989 void (*disconnect)(struct input_handle *handle);
990 void (*start)(struct input_handle *handle);
970 991
971 const struct file_operations *fops; 992 const struct file_operations *fops;
972 int minor; 993 int minor;
@@ -1005,6 +1026,7 @@ static inline void init_input_dev(struct input_dev *dev)
1005} 1026}
1006 1027
1007struct input_dev *input_allocate_device(void); 1028struct input_dev *input_allocate_device(void);
1029void input_free_device(struct input_dev *dev);
1008 1030
1009static inline struct input_dev *input_get_device(struct input_dev *dev) 1031static inline struct input_dev *input_get_device(struct input_dev *dev)
1010{ 1032{
@@ -1016,12 +1038,6 @@ static inline void input_put_device(struct input_dev *dev)
1016 class_device_put(&dev->cdev); 1038 class_device_put(&dev->cdev);
1017} 1039}
1018 1040
1019static inline void input_free_device(struct input_dev *dev)
1020{
1021 if (dev)
1022 input_put_device(dev);
1023}
1024
1025int input_register_device(struct input_dev *); 1041int input_register_device(struct input_dev *);
1026void input_unregister_device(struct input_dev *); 1042void input_unregister_device(struct input_dev *);
1027 1043
@@ -1034,10 +1050,10 @@ void input_release_device(struct input_handle *);
1034int input_open_device(struct input_handle *); 1050int input_open_device(struct input_handle *);
1035void input_close_device(struct input_handle *); 1051void input_close_device(struct input_handle *);
1036 1052
1037int input_accept_process(struct input_handle *handle, struct file *file);
1038int input_flush_device(struct input_handle* handle, struct file* file); 1053int input_flush_device(struct input_handle* handle, struct file* file);
1039 1054
1040void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1055void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1056void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1041 1057
1042static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) 1058static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
1043{ 1059{
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 70741e1701..1f97e3d926 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -10,10 +10,60 @@
10#include <linux/irqreturn.h> 10#include <linux/irqreturn.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/irqflags.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14#include <asm/ptrace.h> 15#include <asm/ptrace.h>
15#include <asm/system.h> 16#include <asm/system.h>
16 17
18/*
19 * These correspond to the IORESOURCE_IRQ_* defines in
20 * linux/ioport.h to select the interrupt line behaviour. When
21 * requesting an interrupt without specifying a IRQF_TRIGGER, the
22 * setting should be assumed to be "as already configured", which
23 * may be as per machine or firmware initialisation.
24 */
25#define IRQF_TRIGGER_NONE 0x00000000
26#define IRQF_TRIGGER_RISING 0x00000001
27#define IRQF_TRIGGER_FALLING 0x00000002
28#define IRQF_TRIGGER_HIGH 0x00000004
29#define IRQF_TRIGGER_LOW 0x00000008
30#define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
31 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
32#define IRQF_TRIGGER_PROBE 0x00000010
33
34/*
35 * These flags used only by the kernel as part of the
36 * irq handling routines.
37 *
38 * IRQF_DISABLED - keep irqs disabled when calling the action handler
39 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
40 * IRQF_SHARED - allow sharing the irq among several devices
41 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
42 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
43 */
44#define IRQF_DISABLED 0x00000020
45#define IRQF_SAMPLE_RANDOM 0x00000040
46#define IRQF_SHARED 0x00000080
47#define IRQF_PROBE_SHARED 0x00000100
48#define IRQF_TIMER 0x00000200
49#define IRQF_PERCPU 0x00000400
50
51/*
52 * Migration helpers. Scheduled for removal in 1/2007
53 * Do not use for new code !
54 */
55#define SA_INTERRUPT IRQF_DISABLED
56#define SA_SAMPLE_RANDOM IRQF_SAMPLE_RANDOM
57#define SA_SHIRQ IRQF_SHARED
58#define SA_PROBEIRQ IRQF_PROBE_SHARED
59#define SA_PERCPU IRQF_PERCPU
60
61#define SA_TRIGGER_LOW IRQF_TRIGGER_LOW
62#define SA_TRIGGER_HIGH IRQF_TRIGGER_HIGH
63#define SA_TRIGGER_FALLING IRQF_TRIGGER_FALLING
64#define SA_TRIGGER_RISING IRQF_TRIGGER_RISING
65#define SA_TRIGGER_MASK IRQF_TRIGGER_MASK
66
17struct irqaction { 67struct irqaction {
18 irqreturn_t (*handler)(int, void *, struct pt_regs *); 68 irqreturn_t (*handler)(int, void *, struct pt_regs *);
19 unsigned long flags; 69 unsigned long flags;
@@ -31,12 +81,106 @@ extern int request_irq(unsigned int,
31 unsigned long, const char *, void *); 81 unsigned long, const char *, void *);
32extern void free_irq(unsigned int, void *); 82extern void free_irq(unsigned int, void *);
33 83
84/*
85 * On lockdep we dont want to enable hardirqs in hardirq
86 * context. Use local_irq_enable_in_hardirq() to annotate
87 * kernel code that has to do this nevertheless (pretty much
88 * the only valid case is for old/broken hardware that is
89 * insanely slow).
90 *
91 * NOTE: in theory this might break fragile code that relies
92 * on hardirq delivery - in practice we dont seem to have such
93 * places left. So the only effect should be slightly increased
94 * irqs-off latencies.
95 */
96#ifdef CONFIG_LOCKDEP
97# define local_irq_enable_in_hardirq() do { } while (0)
98#else
99# define local_irq_enable_in_hardirq() local_irq_enable()
100#endif
34 101
35#ifdef CONFIG_GENERIC_HARDIRQS 102#ifdef CONFIG_GENERIC_HARDIRQS
36extern void disable_irq_nosync(unsigned int irq); 103extern void disable_irq_nosync(unsigned int irq);
37extern void disable_irq(unsigned int irq); 104extern void disable_irq(unsigned int irq);
38extern void enable_irq(unsigned int irq); 105extern void enable_irq(unsigned int irq);
106
107/*
108 * Special lockdep variants of irq disabling/enabling.
109 * These should be used for locking constructs that
110 * know that a particular irq context which is disabled,
111 * and which is the only irq-context user of a lock,
112 * that it's safe to take the lock in the irq-disabled
113 * section without disabling hardirqs.
114 *
115 * On !CONFIG_LOCKDEP they are equivalent to the normal
116 * irq disable/enable methods.
117 */
118static inline void disable_irq_nosync_lockdep(unsigned int irq)
119{
120 disable_irq_nosync(irq);
121#ifdef CONFIG_LOCKDEP
122 local_irq_disable();
123#endif
124}
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
134static inline void disable_irq_lockdep(unsigned int irq)
135{
136 disable_irq(irq);
137#ifdef CONFIG_LOCKDEP
138 local_irq_disable();
139#endif
140}
141
142static inline void enable_irq_lockdep(unsigned int irq)
143{
144#ifdef CONFIG_LOCKDEP
145 local_irq_enable();
146#endif
147 enable_irq(irq);
148}
149
150static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
151{
152#ifdef CONFIG_LOCKDEP
153 local_irq_restore(*flags);
39#endif 154#endif
155 enable_irq(irq);
156}
157
158/* IRQ wakeup (PM) control: */
159extern int set_irq_wake(unsigned int irq, unsigned int on);
160
161static inline int enable_irq_wake(unsigned int irq)
162{
163 return set_irq_wake(irq, 1);
164}
165
166static inline int disable_irq_wake(unsigned int irq)
167{
168 return set_irq_wake(irq, 0);
169}
170
171#else /* !CONFIG_GENERIC_HARDIRQS */
172/*
173 * NOTE: non-genirq architectures, if they want to support the lock
174 * validator need to define the methods below in their asm/irq.h
175 * files, under an #ifdef CONFIG_LOCKDEP section.
176 */
177# ifndef CONFIG_LOCKDEP
178# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
179# define disable_irq_lockdep(irq) disable_irq(irq)
180# define enable_irq_lockdep(irq) enable_irq(irq)
181# endif
182
183#endif /* CONFIG_GENERIC_HARDIRQS */
40 184
41#ifndef __ARCH_SET_SOFTIRQ_PENDING 185#ifndef __ARCH_SET_SOFTIRQ_PENDING
42#define set_softirq_pending(x) (local_softirq_pending() = (x)) 186#define set_softirq_pending(x) (local_softirq_pending() = (x))
@@ -72,13 +216,11 @@ static inline void __deprecated save_and_cli(unsigned long *x)
72#define save_and_cli(x) save_and_cli(&x) 216#define save_and_cli(x) save_and_cli(&x)
73#endif /* CONFIG_SMP */ 217#endif /* CONFIG_SMP */
74 218
75/* SoftIRQ primitives. */ 219extern void local_bh_disable(void);
76#define local_bh_disable() \ 220extern void __local_bh_enable(void);
77 do { add_preempt_count(SOFTIRQ_OFFSET); barrier(); } while (0) 221extern void _local_bh_enable(void);
78#define __local_bh_enable() \
79 do { barrier(); sub_preempt_count(SOFTIRQ_OFFSET); } while (0)
80
81extern void local_bh_enable(void); 222extern void local_bh_enable(void);
223extern void local_bh_enable_ip(unsigned long ip);
82 224
83/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high 225/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
84 frequency threaded job scheduling. For almost all the purposes 226 frequency threaded job scheduling. For almost all the purposes
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index cd6bd001ba..d42c833990 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -9,13 +9,15 @@
9#define _LINUX_IOPORT_H 9#define _LINUX_IOPORT_H
10 10
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/types.h>
12/* 13/*
13 * Resources are tree-like, allowing 14 * Resources are tree-like, allowing
14 * nesting etc.. 15 * nesting etc..
15 */ 16 */
16struct resource { 17struct resource {
18 resource_size_t start;
19 resource_size_t end;
17 const char *name; 20 const char *name;
18 unsigned long start, end;
19 unsigned long flags; 21 unsigned long flags;
20 struct resource *parent, *sibling, *child; 22 struct resource *parent, *sibling, *child;
21}; 23};
@@ -53,6 +55,7 @@ struct resource_list {
53#define IORESOURCE_IRQ_LOWEDGE (1<<1) 55#define IORESOURCE_IRQ_LOWEDGE (1<<1)
54#define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 56#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
55#define IORESOURCE_IRQ_LOWLEVEL (1<<3) 57#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
58#define IORESOURCE_IRQ_SHAREABLE (1<<4)
56 59
57/* ISA PnP DMA specific bits (IORESOURCE_BITS) */ 60/* ISA PnP DMA specific bits (IORESOURCE_BITS) */
58#define IORESOURCE_DMA_TYPE_MASK (3<<0) 61#define IORESOURCE_DMA_TYPE_MASK (3<<0)
@@ -94,33 +97,39 @@ extern struct resource iomem_resource;
94extern int request_resource(struct resource *root, struct resource *new); 97extern int request_resource(struct resource *root, struct resource *new);
95extern struct resource * ____request_resource(struct resource *root, struct resource *new); 98extern struct resource * ____request_resource(struct resource *root, struct resource *new);
96extern int release_resource(struct resource *new); 99extern int release_resource(struct resource *new);
97extern __deprecated_for_modules int insert_resource(struct resource *parent, struct resource *new); 100extern int insert_resource(struct resource *parent, struct resource *new);
98extern int allocate_resource(struct resource *root, struct resource *new, 101extern int allocate_resource(struct resource *root, struct resource *new,
99 unsigned long size, 102 resource_size_t size, resource_size_t min,
100 unsigned long min, unsigned long max, 103 resource_size_t max, resource_size_t align,
101 unsigned long align,
102 void (*alignf)(void *, struct resource *, 104 void (*alignf)(void *, struct resource *,
103 unsigned long, unsigned long), 105 resource_size_t, resource_size_t),
104 void *alignf_data); 106 void *alignf_data);
105int adjust_resource(struct resource *res, unsigned long start, 107int adjust_resource(struct resource *res, resource_size_t start,
106 unsigned long size); 108 resource_size_t size);
109
110/* get registered SYSTEM_RAM resources in specified area */
111extern int find_next_system_ram(struct resource *res);
107 112
108/* Convenience shorthand with allocation */ 113/* Convenience shorthand with allocation */
109#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 114#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
110#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) 115#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
111#define rename_region(region, newname) do { (region)->name = (newname); } while (0) 116#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
112 117
113extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name); 118extern struct resource * __request_region(struct resource *,
119 resource_size_t start,
120 resource_size_t n, const char *name);
114 121
115/* Compatibility cruft */ 122/* Compatibility cruft */
116#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 123#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
117#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n)) 124#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
118#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 125#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
119 126
120extern int __check_region(struct resource *, unsigned long, unsigned long); 127extern int __check_region(struct resource *, resource_size_t, resource_size_t);
121extern void __release_region(struct resource *, unsigned long, unsigned long); 128extern void __release_region(struct resource *, resource_size_t,
129 resource_size_t);
122 130
123static inline int __deprecated check_region(unsigned long s, unsigned long n) 131static inline int __deprecated check_region(resource_size_t s,
132 resource_size_t n)
124{ 133{
125 return __check_region(&ioport_resource, s, n); 134 return __check_region(&ioport_resource, s, n);
126} 135}
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 88d5961f7a..8e2042b9d4 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -59,27 +59,6 @@ static inline int task_nice_ioprio(struct task_struct *task)
59/* 59/*
60 * For inheritance, return the highest of the two given priorities 60 * For inheritance, return the highest of the two given priorities
61 */ 61 */
62static inline int ioprio_best(unsigned short aprio, unsigned short bprio) 62extern int ioprio_best(unsigned short aprio, unsigned short bprio);
63{
64 unsigned short aclass = IOPRIO_PRIO_CLASS(aprio);
65 unsigned short bclass = IOPRIO_PRIO_CLASS(bprio);
66
67 if (!ioprio_valid(aprio))
68 return bprio;
69 if (!ioprio_valid(bprio))
70 return aprio;
71
72 if (aclass == IOPRIO_CLASS_NONE)
73 aclass = IOPRIO_CLASS_BE;
74 if (bclass == IOPRIO_CLASS_NONE)
75 bclass = IOPRIO_CLASS_BE;
76
77 if (aclass == bclass)
78 return min(aprio, bprio);
79 if (aclass > bclass)
80 return bprio;
81 else
82 return aprio;
83}
84 63
85#endif 64#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 4b55cf1df7..6b25d36fc5 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -57,6 +57,7 @@
57#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) 57#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
58#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) 58#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
59#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) 59#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
60#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY)
60#define IPOPT_RR (7 |IPOPT_CONTROL) 61#define IPOPT_RR (7 |IPOPT_CONTROL)
61#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) 62#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
62#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) 63#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
@@ -95,7 +96,7 @@ struct iphdr {
95 __be16 frag_off; 96 __be16 frag_off;
96 __u8 ttl; 97 __u8 ttl;
97 __u8 protocol; 98 __u8 protocol;
98 __u16 check; 99 __be16 check;
99 __be32 saddr; 100 __be32 saddr;
100 __be32 daddr; 101 __be32 daddr;
101 /*The options start here. */ 102 /*The options start here. */
@@ -104,22 +105,22 @@ struct iphdr {
104struct ip_auth_hdr { 105struct ip_auth_hdr {
105 __u8 nexthdr; 106 __u8 nexthdr;
106 __u8 hdrlen; /* This one is measured in 32 bit units! */ 107 __u8 hdrlen; /* This one is measured in 32 bit units! */
107 __u16 reserved; 108 __be16 reserved;
108 __u32 spi; 109 __be32 spi;
109 __u32 seq_no; /* Sequence number */ 110 __be32 seq_no; /* Sequence number */
110 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ 111 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
111}; 112};
112 113
113struct ip_esp_hdr { 114struct ip_esp_hdr {
114 __u32 spi; 115 __be32 spi;
115 __u32 seq_no; /* Sequence number */ 116 __be32 seq_no; /* Sequence number */
116 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ 117 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */
117}; 118};
118 119
119struct ip_comp_hdr { 120struct ip_comp_hdr {
120 __u8 nexthdr; 121 __u8 nexthdr;
121 __u8 flags; 122 __u8 flags;
122 __u16 cpi; 123 __be16 cpi;
123}; 124};
124 125
125#endif /* _LINUX_IP_H */ 126#endif /* _LINUX_IP_H */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 5653b2f23b..d09fbeabf1 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -210,11 +210,7 @@ struct kernel_ipmi_msg
210#include <linux/list.h> 210#include <linux/list.h>
211#include <linux/module.h> 211#include <linux/module.h>
212#include <linux/device.h> 212#include <linux/device.h>
213
214#ifdef CONFIG_PROC_FS
215#include <linux/proc_fs.h> 213#include <linux/proc_fs.h>
216extern struct proc_dir_entry *proc_ipmi_root;
217#endif /* CONFIG_PROC_FS */
218 214
219/* Opaque type for a IPMI message user. One of these is needed to 215/* Opaque type for a IPMI message user. One of these is needed to
220 send and receive messages. */ 216 send and receive messages. */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 297853c841..4f435c59de 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -29,6 +29,7 @@ struct in6_ifreq {
29 29
30#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ 30#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */
31#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ 31#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
32#define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */
32 33
33/* 34/*
34 * routing header 35 * routing header
@@ -73,25 +74,47 @@ struct rt0_hdr {
73#define rt0_type rt_hdr.type 74#define rt0_type rt_hdr.type
74}; 75};
75 76
77/*
78 * routing header type 2
79 */
80
81struct rt2_hdr {
82 struct ipv6_rt_hdr rt_hdr;
83 __u32 reserved;
84 struct in6_addr addr;
85
86#define rt2_type rt_hdr.type
87};
88
89/*
90 * home address option in destination options header
91 */
92
93struct ipv6_destopt_hao {
94 __u8 type;
95 __u8 length;
96 struct in6_addr addr;
97} __attribute__ ((__packed__));
98
76struct ipv6_auth_hdr { 99struct ipv6_auth_hdr {
77 __u8 nexthdr; 100 __u8 nexthdr;
78 __u8 hdrlen; /* This one is measured in 32 bit units! */ 101 __u8 hdrlen; /* This one is measured in 32 bit units! */
79 __u16 reserved; 102 __be16 reserved;
80 __u32 spi; 103 __be32 spi;
81 __u32 seq_no; /* Sequence number */ 104 __be32 seq_no; /* Sequence number */
82 __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! */
83}; 106};
84 107
85struct ipv6_esp_hdr { 108struct ipv6_esp_hdr {
86 __u32 spi; 109 __be32 spi;
87 __u32 seq_no; /* Sequence number */ 110 __be32 seq_no; /* Sequence number */
88 __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! */
89}; 112};
90 113
91struct ipv6_comp_hdr { 114struct ipv6_comp_hdr {
92 __u8 nexthdr; 115 __u8 nexthdr;
93 __u8 flags; 116 __u8 flags;
94 __u16 cpi; 117 __be16 cpi;
95}; 118};
96 119
97/* 120/*
@@ -113,7 +136,7 @@ struct ipv6hdr {
113#endif 136#endif
114 __u8 flow_lbl[3]; 137 __u8 flow_lbl[3];
115 138
116 __u16 payload_len; 139 __be16 payload_len;
117 __u8 nexthdr; 140 __u8 nexthdr;
118 __u8 hop_limit; 141 __u8 hop_limit;
119 142
@@ -153,6 +176,7 @@ struct ipv6_devconf {
153 __s32 accept_ra_rt_info_max_plen; 176 __s32 accept_ra_rt_info_max_plen;
154#endif 177#endif
155#endif 178#endif
179 __s32 proxy_ndp;
156 void *sysctl; 180 void *sysctl;
157}; 181};
158 182
@@ -180,6 +204,7 @@ enum {
180 DEVCONF_ACCEPT_RA_RTR_PREF, 204 DEVCONF_ACCEPT_RA_RTR_PREF,
181 DEVCONF_RTR_PROBE_INTERVAL, 205 DEVCONF_RTR_PROBE_INTERVAL,
182 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, 206 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
207 DEVCONF_PROXY_NDP,
183 DEVCONF_MAX 208 DEVCONF_MAX
184}; 209};
185 210
@@ -206,6 +231,9 @@ struct inet6_skb_parm {
206 __u16 lastopt; 231 __u16 lastopt;
207 __u32 nhoff; 232 __u32 nhoff;
208 __u16 flags; 233 __u16 flags;
234#ifdef CONFIG_IPV6_MIP6
235 __u16 dsthao;
236#endif
209 237
210#define IP6SKB_XFRM_TRANSFORMED 1 238#define IP6SKB_XFRM_TRANSFORMED 1
211}; 239};
@@ -242,6 +270,9 @@ struct ipv6_pinfo {
242 struct in6_addr rcv_saddr; 270 struct in6_addr rcv_saddr;
243 struct in6_addr daddr; 271 struct in6_addr daddr;
244 struct in6_addr *daddr_cache; 272 struct in6_addr *daddr_cache;
273#ifdef CONFIG_IPV6_SUBTREES
274 struct in6_addr *saddr_cache;
275#endif
245 276
246 __u32 flow_label; 277 __u32 flow_label;
247 __u32 frag_size; 278 __u32 frag_size;
@@ -430,7 +461,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
430 461
431#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 462#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\
432 (((__sk)->sk_hash == (__hash)) && \ 463 (((__sk)->sk_hash == (__hash)) && \
433 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 464 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
434 ((__sk)->sk_family == AF_INET6) && \ 465 ((__sk)->sk_family == AF_INET6) && \
435 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 466 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
436 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 676e00dfb2..48d3cb3b6a 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1,5 +1,5 @@
1#ifndef __irq_h 1#ifndef _LINUX_IRQ_H
2#define __irq_h 2#define _LINUX_IRQ_H
3 3
4/* 4/*
5 * Please do not include this file in generic code. There is currently 5 * Please do not include this file in generic code. There is currently
@@ -11,7 +11,7 @@
11 11
12#include <linux/smp.h> 12#include <linux/smp.h>
13 13
14#if !defined(CONFIG_S390) 14#ifndef CONFIG_S390
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/cache.h> 17#include <linux/cache.h>
@@ -24,84 +24,175 @@
24 24
25/* 25/*
26 * IRQ line status. 26 * IRQ line status.
27 *
28 * Bits 0-16 are reserved for the IRQF_* bits in linux/interrupt.h
29 *
30 * IRQ types
27 */ 31 */
28#define IRQ_INPROGRESS 1 /* IRQ handler active - do not enter! */ 32#define IRQ_TYPE_NONE 0x00000000 /* Default, unspecified type */
29#define IRQ_DISABLED 2 /* IRQ disabled - do not enter! */ 33#define IRQ_TYPE_EDGE_RISING 0x00000001 /* Edge rising type */
30#define IRQ_PENDING 4 /* IRQ pending - replay on enable */ 34#define IRQ_TYPE_EDGE_FALLING 0x00000002 /* Edge falling type */
31#define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */ 35#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
32#define IRQ_AUTODETECT 16 /* IRQ is being autodetected */ 36#define IRQ_TYPE_LEVEL_HIGH 0x00000004 /* Level high type */
33#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */ 37#define IRQ_TYPE_LEVEL_LOW 0x00000008 /* Level low type */
34#define IRQ_LEVEL 64 /* IRQ level triggered */ 38#define IRQ_TYPE_SENSE_MASK 0x0000000f /* Mask of the above */
35#define IRQ_MASKED 128 /* IRQ masked - shouldn't be seen again */ 39#define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */
36#if defined(ARCH_HAS_IRQ_PER_CPU) 40
37# define IRQ_PER_CPU 256 /* IRQ is per CPU */ 41/* Internal flags */
42#define IRQ_INPROGRESS 0x00010000 /* IRQ handler active - do not enter! */
43#define IRQ_DISABLED 0x00020000 /* IRQ disabled - do not enter! */
44#define IRQ_PENDING 0x00040000 /* IRQ pending - replay on enable */
45#define IRQ_REPLAY 0x00080000 /* IRQ has been replayed but not acked yet */
46#define IRQ_AUTODETECT 0x00100000 /* IRQ is being autodetected */
47#define IRQ_WAITING 0x00200000 /* IRQ not yet seen - for autodetection */
48#define IRQ_LEVEL 0x00400000 /* IRQ level triggered */
49#define IRQ_MASKED 0x00800000 /* IRQ masked - shouldn't be seen again */
50#define IRQ_PER_CPU 0x01000000 /* IRQ is per CPU */
51#ifdef CONFIG_IRQ_PER_CPU
38# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 52# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
39#else 53#else
40# define CHECK_IRQ_PER_CPU(var) 0 54# define CHECK_IRQ_PER_CPU(var) 0
41#endif 55#endif
42 56
43/* 57#define IRQ_NOPROBE 0x02000000 /* IRQ is not valid for probing */
44 * Interrupt controller descriptor. This is all we need 58#define IRQ_NOREQUEST 0x04000000 /* IRQ cannot be requested */
45 * to describe about the low-level hardware. 59#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */
60#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */
61#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */
62
63struct proc_dir_entry;
64
65/**
66 * struct irq_chip - hardware interrupt chip descriptor
67 *
68 * @name: name for /proc/interrupts
69 * @startup: start up the interrupt (defaults to ->enable if NULL)
70 * @shutdown: shut down the interrupt (defaults to ->disable if NULL)
71 * @enable: enable the interrupt (defaults to chip->unmask if NULL)
72 * @disable: disable the interrupt (defaults to chip->mask if NULL)
73 * @ack: start of a new interrupt
74 * @mask: mask an interrupt source
75 * @mask_ack: ack and mask an interrupt source
76 * @unmask: unmask an interrupt source
77 * @eoi: end of interrupt - chip level
78 * @end: end of interrupt - flow level
79 * @set_affinity: set the CPU affinity on SMP machines
80 * @retrigger: resend an IRQ to the CPU
81 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
82 * @set_wake: enable/disable power-management wake-on of an IRQ
83 *
84 * @release: release function solely used by UML
85 * @typename: obsoleted by name, kept as migration helper
46 */ 86 */
47struct hw_interrupt_type { 87struct irq_chip {
48 const char * typename; 88 const char *name;
49 unsigned int (*startup)(unsigned int irq); 89 unsigned int (*startup)(unsigned int irq);
50 void (*shutdown)(unsigned int irq); 90 void (*shutdown)(unsigned int irq);
51 void (*enable)(unsigned int irq); 91 void (*enable)(unsigned int irq);
52 void (*disable)(unsigned int irq); 92 void (*disable)(unsigned int irq);
53 void (*ack)(unsigned int irq); 93
54 void (*end)(unsigned int irq); 94 void (*ack)(unsigned int irq);
55 void (*set_affinity)(unsigned int irq, cpumask_t dest); 95 void (*mask)(unsigned int irq);
96 void (*mask_ack)(unsigned int irq);
97 void (*unmask)(unsigned int irq);
98 void (*eoi)(unsigned int irq);
99
100 void (*end)(unsigned int irq);
101 void (*set_affinity)(unsigned int irq, cpumask_t dest);
102 int (*retrigger)(unsigned int irq);
103 int (*set_type)(unsigned int irq, unsigned int flow_type);
104 int (*set_wake)(unsigned int irq, unsigned int on);
105
56 /* Currently used only by UML, might disappear one day.*/ 106 /* Currently used only by UML, might disappear one day.*/
57#ifdef CONFIG_IRQ_RELEASE_METHOD 107#ifdef CONFIG_IRQ_RELEASE_METHOD
58 void (*release)(unsigned int irq, void *dev_id); 108 void (*release)(unsigned int irq, void *dev_id);
59#endif 109#endif
110 /*
111 * For compatibility, ->typename is copied into ->name.
112 * Will disappear.
113 */
114 const char *typename;
60}; 115};
61 116
62typedef struct hw_interrupt_type hw_irq_controller; 117/**
63 118 * struct irq_desc - interrupt descriptor
64/* 119 *
65 * This is the "IRQ descriptor", which contains various information 120 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
66 * about the irq, including what kind of hardware handling it has, 121 * @chip: low level interrupt hardware access
67 * whether it is disabled etc etc. 122 * @handler_data: per-IRQ data for the irq_chip methods
123 * @chip_data: platform-specific per-chip private data for the chip
124 * methods, to allow shared chip implementations
125 * @action: the irq action chain
126 * @status: status information
127 * @depth: disable-depth, for nested irq_disable() calls
128 * @wake_depth: enable depth, for multiple set_irq_wake() callers
129 * @irq_count: stats field to detect stalled irqs
130 * @irqs_unhandled: stats field for spurious unhandled interrupts
131 * @lock: locking for SMP
132 * @affinity: IRQ affinity on SMP
133 * @cpu: cpu index useful for balancing
134 * @pending_mask: pending rebalanced interrupts
135 * @move_irq: need to re-target IRQ destination
136 * @dir: /proc/irq/ procfs entry
137 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
68 * 138 *
69 * Pad this out to 32 bytes for cache and indexing reasons. 139 * Pad this out to 32 bytes for cache and indexing reasons.
70 */ 140 */
71typedef struct irq_desc { 141struct irq_desc {
72 hw_irq_controller *handler; 142 void fastcall (*handle_irq)(unsigned int irq,
73 void *handler_data; 143 struct irq_desc *desc,
74 struct irqaction *action; /* IRQ action list */ 144 struct pt_regs *regs);
75 unsigned int status; /* IRQ status */ 145 struct irq_chip *chip;
76 unsigned int depth; /* nested irq disables */ 146 void *handler_data;
77 unsigned int irq_count; /* For detecting broken interrupts */ 147 void *chip_data;
78 unsigned int irqs_unhandled; 148 struct irqaction *action; /* IRQ action list */
79 spinlock_t lock; 149 unsigned int status; /* IRQ status */
80#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) 150
81 unsigned int move_irq; /* Flag need to re-target intr dest*/ 151 unsigned int depth; /* nested irq disables */
152 unsigned int wake_depth; /* nested wake enables */
153 unsigned int irq_count; /* For detecting broken IRQs */
154 unsigned int irqs_unhandled;
155 spinlock_t lock;
156#ifdef CONFIG_SMP
157 cpumask_t affinity;
158 unsigned int cpu;
159#endif
160#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
161 cpumask_t pending_mask;
162 unsigned int move_irq; /* need to re-target IRQ dest */
163#endif
164#ifdef CONFIG_PROC_FS
165 struct proc_dir_entry *dir;
82#endif 166#endif
83} ____cacheline_aligned irq_desc_t; 167} ____cacheline_aligned;
84 168
85extern irq_desc_t irq_desc [NR_IRQS]; 169extern struct irq_desc irq_desc[NR_IRQS];
86 170
87/* Return a pointer to the irq descriptor for IRQ. */ 171/*
88static inline irq_desc_t * 172 * Migration helpers for obsolete names, they will go away:
89irq_descp (int irq) 173 */
90{ 174#define hw_interrupt_type irq_chip
91 return irq_desc + irq; 175typedef struct irq_chip hw_irq_controller;
92} 176#define no_irq_type no_irq_chip
177typedef struct irq_desc irq_desc_t;
93 178
94#include <asm/hw_irq.h> /* the arch dependent stuff */ 179/*
180 * Pick up the arch-dependent methods:
181 */
182#include <asm/hw_irq.h>
95 183
96extern int setup_irq(unsigned int irq, struct irqaction * new); 184extern int setup_irq(unsigned int irq, struct irqaction *new);
97 185
98#ifdef CONFIG_GENERIC_HARDIRQS 186#ifdef CONFIG_GENERIC_HARDIRQS
99extern cpumask_t irq_affinity[NR_IRQS]; 187
188#ifndef handle_dynamic_tick
189# define handle_dynamic_tick(a) do { } while (0)
190#endif
100 191
101#ifdef CONFIG_SMP 192#ifdef CONFIG_SMP
102static inline void set_native_irq_info(int irq, cpumask_t mask) 193static inline void set_native_irq_info(int irq, cpumask_t mask)
103{ 194{
104 irq_affinity[irq] = mask; 195 irq_desc[irq].affinity = mask;
105} 196}
106#else 197#else
107static inline void set_native_irq_info(int irq, cpumask_t mask) 198static inline void set_native_irq_info(int irq, cpumask_t mask)
@@ -111,8 +202,7 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
111 202
112#ifdef CONFIG_SMP 203#ifdef CONFIG_SMP
113 204
114#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) 205#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
115extern cpumask_t pending_irq_cpumask[NR_IRQS];
116 206
117void set_pending_irq(unsigned int irq, cpumask_t mask); 207void set_pending_irq(unsigned int irq, cpumask_t mask);
118void move_native_irq(int irq); 208void move_native_irq(int irq);
@@ -133,7 +223,7 @@ static inline void set_irq_info(int irq, cpumask_t mask)
133{ 223{
134} 224}
135 225
136#else // CONFIG_PCI_MSI 226#else /* CONFIG_PCI_MSI */
137 227
138static inline void move_irq(int irq) 228static inline void move_irq(int irq)
139{ 229{
@@ -144,26 +234,36 @@ static inline void set_irq_info(int irq, cpumask_t mask)
144{ 234{
145 set_native_irq_info(irq, mask); 235 set_native_irq_info(irq, mask);
146} 236}
147#endif // CONFIG_PCI_MSI
148 237
149#else // CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE 238#endif /* CONFIG_PCI_MSI */
239
240#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
241
242static inline void move_irq(int irq)
243{
244}
245
246static inline void move_native_irq(int irq)
247{
248}
249
250static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
251{
252}
150 253
151#define move_irq(x)
152#define move_native_irq(x)
153#define set_pending_irq(x,y)
154static inline void set_irq_info(int irq, cpumask_t mask) 254static inline void set_irq_info(int irq, cpumask_t mask)
155{ 255{
156 set_native_irq_info(irq, mask); 256 set_native_irq_info(irq, mask);
157} 257}
158 258
159#endif // CONFIG_GENERIC_PENDING_IRQ 259#endif /* CONFIG_GENERIC_PENDING_IRQ */
160 260
161#else // CONFIG_SMP 261#else /* CONFIG_SMP */
162 262
163#define move_irq(x) 263#define move_irq(x)
164#define move_native_irq(x) 264#define move_native_irq(x)
165 265
166#endif // CONFIG_SMP 266#endif /* CONFIG_SMP */
167 267
168#ifdef CONFIG_IRQBALANCE 268#ifdef CONFIG_IRQBALANCE
169extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask); 269extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
@@ -173,32 +273,145 @@ static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
173} 273}
174#endif 274#endif
175 275
176extern int no_irq_affinity;
177extern int noirqdebug_setup(char *str);
178
179extern fastcall irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
180 struct irqaction *action);
181extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
182extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
183 int action_ret, struct pt_regs *regs);
184extern int can_request_irq(unsigned int irq, unsigned long irqflags);
185
186extern void init_irq_proc(void);
187
188#ifdef CONFIG_AUTO_IRQ_AFFINITY 276#ifdef CONFIG_AUTO_IRQ_AFFINITY
189extern int select_smp_affinity(unsigned int irq); 277extern int select_smp_affinity(unsigned int irq);
190#else 278#else
191static inline int 279static inline int select_smp_affinity(unsigned int irq)
192select_smp_affinity(unsigned int irq)
193{ 280{
194 return 1; 281 return 1;
195} 282}
196#endif 283#endif
197 284
285extern int no_irq_affinity;
286
287/* Handle irq action chains: */
288extern int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
289 struct irqaction *action);
290
291/*
292 * Built-in IRQ handlers for various IRQ types,
293 * callable via desc->chip->handle_irq()
294 */
295extern void fastcall
296handle_level_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
297extern void fastcall
298handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc,
299 struct pt_regs *regs);
300extern void fastcall
301handle_edge_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
302extern void fastcall
303handle_simple_irq(unsigned int irq, struct irq_desc *desc,
304 struct pt_regs *regs);
305extern void fastcall
306handle_percpu_irq(unsigned int irq, struct irq_desc *desc,
307 struct pt_regs *regs);
308extern void fastcall
309handle_bad_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
310
311/*
312 * Get a descriptive string for the highlevel handler, for
313 * /proc/interrupts output:
314 */
315extern const char *
316handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *,
317 struct pt_regs *));
318
319/*
320 * Monolithic do_IRQ implementation.
321 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
322 */
323#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
324extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
198#endif 325#endif
199 326
200extern hw_irq_controller no_irq_type; /* needed in every arch ? */ 327/*
328 * Architectures call this to let the generic IRQ layer
329 * handle an interrupt. If the descriptor is attached to an
330 * irqchip-style controller then we call the ->handle_irq() handler,
331 * and it calls __do_IRQ() if it's attached to an irqtype-style controller.
332 */
333static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs)
334{
335 struct irq_desc *desc = irq_desc + irq;
201 336
337#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
338 desc->handle_irq(irq, desc, regs);
339#else
340 if (likely(desc->handle_irq))
341 desc->handle_irq(irq, desc, regs);
342 else
343 __do_IRQ(irq, regs);
202#endif 344#endif
345}
346
347/* Handling of unhandled and spurious interrupts: */
348extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
349 int action_ret, struct pt_regs *regs);
350
351/* Resending of interrupts :*/
352void check_irq_resend(struct irq_desc *desc, unsigned int irq);
353
354/* Initialize /proc/irq/ */
355extern void init_irq_proc(void);
356
357/* Enable/disable irq debugging output: */
358extern int noirqdebug_setup(char *str);
359
360/* Checks whether the interrupt can be requested by request_irq(): */
361extern int can_request_irq(unsigned int irq, unsigned long irqflags);
362
363/* Dummy irq-chip implementations: */
364extern struct irq_chip no_irq_chip;
365extern struct irq_chip dummy_irq_chip;
366
367extern void
368set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
369 void fastcall (*handle)(unsigned int,
370 struct irq_desc *,
371 struct pt_regs *));
372extern void
373__set_irq_handler(unsigned int irq,
374 void fastcall (*handle)(unsigned int, struct irq_desc *,
375 struct pt_regs *),
376 int is_chained);
377
378/*
379 * Set a highlevel flow handler for a given IRQ:
380 */
381static inline void
382set_irq_handler(unsigned int irq,
383 void fastcall (*handle)(unsigned int, struct irq_desc *,
384 struct pt_regs *))
385{
386 __set_irq_handler(irq, handle, 0);
387}
388
389/*
390 * Set a highlevel chained flow handler for a given IRQ.
391 * (a chained handler is automatically enabled and set to
392 * IRQ_NOREQUEST and IRQ_NOPROBE)
393 */
394static inline void
395set_irq_chained_handler(unsigned int irq,
396 void fastcall (*handle)(unsigned int, struct irq_desc *,
397 struct pt_regs *))
398{
399 __set_irq_handler(irq, handle, 1);
400}
401
402/* Set/get chip/data for an IRQ: */
403
404extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
405extern int set_irq_data(unsigned int irq, void *data);
406extern int set_irq_chip_data(unsigned int irq, void *data);
407extern int set_irq_type(unsigned int irq, unsigned int type);
408
409#define get_irq_chip(irq) (irq_desc[irq].chip)
410#define get_irq_chip_data(irq) (irq_desc[irq].chip_data)
411#define get_irq_data(irq) (irq_desc[irq].handler_data)
412
413#endif /* CONFIG_GENERIC_HARDIRQS */
414
415#endif /* !CONFIG_S390 */
203 416
204#endif /* __irq_h */ 417#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
new file mode 100644
index 0000000000..412e025bc5
--- /dev/null
+++ b/include/linux/irqflags.h
@@ -0,0 +1,96 @@
1/*
2 * include/linux/irqflags.h
3 *
4 * IRQ flags tracing: follow the state of the hardirq and softirq flags and
5 * provide callbacks for transitions between ON and OFF states.
6 *
7 * This file gets included from lowlevel asm headers too, to provide
8 * wrapped versions of the local_irq_*() APIs, based on the
9 * raw_local_irq_*() macros from the lowlevel headers.
10 */
11#ifndef _LINUX_TRACE_IRQFLAGS_H
12#define _LINUX_TRACE_IRQFLAGS_H
13
14#ifdef CONFIG_TRACE_IRQFLAGS
15 extern void trace_hardirqs_on(void);
16 extern void trace_hardirqs_off(void);
17 extern void trace_softirqs_on(unsigned long ip);
18 extern void trace_softirqs_off(unsigned long ip);
19# define trace_hardirq_context(p) ((p)->hardirq_context)
20# define trace_softirq_context(p) ((p)->softirq_context)
21# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
22# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
23# define trace_hardirq_enter() do { current->hardirq_context++; } while (0)
24# define trace_hardirq_exit() do { current->hardirq_context--; } while (0)
25# define trace_softirq_enter() do { current->softirq_context++; } while (0)
26# define trace_softirq_exit() do { current->softirq_context--; } while (0)
27# define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1,
28#else
29# define trace_hardirqs_on() do { } while (0)
30# define trace_hardirqs_off() do { } while (0)
31# define trace_softirqs_on(ip) do { } while (0)
32# define trace_softirqs_off(ip) do { } while (0)
33# define trace_hardirq_context(p) 0
34# define trace_softirq_context(p) 0
35# define trace_hardirqs_enabled(p) 0
36# define trace_softirqs_enabled(p) 0
37# define trace_hardirq_enter() do { } while (0)
38# define trace_hardirq_exit() do { } while (0)
39# define trace_softirq_enter() do { } while (0)
40# define trace_softirq_exit() do { } while (0)
41# define INIT_TRACE_IRQFLAGS
42#endif
43
44#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
45
46#include <asm/irqflags.h>
47
48#define local_irq_enable() \
49 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
50#define local_irq_disable() \
51 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
52#define local_irq_save(flags) \
53 do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0)
54
55#define local_irq_restore(flags) \
56 do { \
57 if (raw_irqs_disabled_flags(flags)) { \
58 raw_local_irq_restore(flags); \
59 trace_hardirqs_off(); \
60 } else { \
61 trace_hardirqs_on(); \
62 raw_local_irq_restore(flags); \
63 } \
64 } while (0)
65#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
66/*
67 * The local_irq_*() APIs are equal to the raw_local_irq*()
68 * if !TRACE_IRQFLAGS.
69 */
70# define raw_local_irq_disable() local_irq_disable()
71# define raw_local_irq_enable() local_irq_enable()
72# define raw_local_irq_save(flags) local_irq_save(flags)
73# define raw_local_irq_restore(flags) local_irq_restore(flags)
74#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
75
76#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
77#define safe_halt() \
78 do { \
79 trace_hardirqs_on(); \
80 raw_safe_halt(); \
81 } while (0)
82
83#define local_save_flags(flags) raw_local_save_flags(flags)
84
85#define irqs_disabled() \
86({ \
87 unsigned long flags; \
88 \
89 raw_local_save_flags(flags); \
90 raw_irqs_disabled_flags(flags); \
91})
92
93#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
94#endif /* CONFIG_X86 */
95
96#endif
diff --git a/include/linux/isdn/Kbuild b/include/linux/isdn/Kbuild
new file mode 100644
index 0000000000..991cdb29ab
--- /dev/null
+++ b/include/linux/isdn/Kbuild
@@ -0,0 +1 @@
header-y += capicmd.h
diff --git a/include/linux/isdn/tpam.h b/include/linux/isdn/tpam.h
deleted file mode 100644
index d18dd0dc57..0000000000
--- a/include/linux/isdn/tpam.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/* $Id: tpam.h,v 1.1.2.1 2001/06/08 08:23:46 kai Exp $
2 *
3 * Turbo PAM ISDN driver for Linux. (Kernel Driver)
4 *
5 * Copyright 2001 Stelian Pop <stelian.pop@fr.alcove.com>, Alcôve
6 *
7 * For all support questions please contact: <support@auvertech.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#ifndef _TPAM_H_
26#define _TPAM_H_
27
28#include <linux/types.h>
29
30/* IOCTL commands */
31#define TPAM_CMD_DSPLOAD 0x0001
32#define TPAM_CMD_DSPSAVE 0x0002
33#define TPAM_CMD_DSPRUN 0x0003
34#define TPAM_CMD_LOOPMODEON 0x0004
35#define TPAM_CMD_LOOPMODEOFF 0x0005
36
37/* addresses of debug information zones on board */
38#define TPAM_TRAPAUDIT_REGISTER 0x005493e4
39#define TPAM_NCOAUDIT_REGISTER 0x00500000
40#define TPAM_MSGAUDIT_REGISTER 0x008E30F0
41
42/* length of debug information zones on board */
43#define TPAM_TRAPAUDIT_LENGTH 10000
44#define TPAM_NCOAUDIT_LENGTH 300000
45#define TPAM_NCOAUDIT_COUNT 30
46#define TPAM_MSGAUDIT_LENGTH 60000
47
48/* IOCTL load/save parameter */
49typedef struct tpam_dsp_ioctl {
50 __u32 address; /* address to load/save data */
51 __u32 data_len; /* size of data to be loaded/saved */
52 __u8 data[0]; /* data */
53} tpam_dsp_ioctl;
54
55#endif /* _TPAM_H_ */
diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h
index 47967878bf..4688ac4284 100644
--- a/include/linux/iso_fs.h
+++ b/include/linux/iso_fs.h
@@ -2,6 +2,8 @@
2#define _ISOFS_FS_H 2#define _ISOFS_FS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/magic.h>
6
5/* 7/*
6 * The isofs filesystem constants/structures 8 * The isofs filesystem constants/structures
7 */ 9 */
@@ -160,6 +162,4 @@ struct iso_directory_record {
160#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) 162#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
161#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) 163#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
162 164
163#define ISOFS_SUPER_MAGIC 0x9660 165#endif /* _ISOFS_FS_H */
164
165#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 20eb34403d..fe89444b1c 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
@@ -72,6 +72,9 @@ extern int journal_enable_debug;
72#endif 72#endif
73 73
74extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry); 74extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry);
75extern void * jbd_slab_alloc(size_t size, gfp_t flags);
76extern void jbd_slab_free(void *ptr, size_t size);
77
75#define jbd_kmalloc(size, flags) \ 78#define jbd_kmalloc(size, flags) \
76 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry) 79 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
77#define jbd_rep_kmalloc(size, flags) \ 80#define jbd_rep_kmalloc(size, flags) \
@@ -94,8 +97,8 @@ extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int re
94 * number of outstanding buffers possible at any time. When the 97 * number of outstanding buffers possible at any time. When the
95 * operation completes, any buffer credits not used are credited back to 98 * operation completes, any buffer credits not used are credited back to
96 * 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
97 * outstanding updates on a transaction might possibly touch. 100 * outstanding updates on a transaction might possibly touch.
98 * 101 *
99 * This is an opaque datatype. 102 * This is an opaque datatype.
100 **/ 103 **/
101typedef struct handle_s handle_t; /* Atomic operation type */ 104typedef struct handle_s handle_t; /* Atomic operation type */
@@ -105,7 +108,7 @@ typedef struct handle_s handle_t; /* Atomic operation type */
105 * 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.
106 * 109 *
107 * journal_t is linked to from the fs superblock structure. 110 * journal_t is linked to from the fs superblock structure.
108 * 111 *
109 * 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
110 * 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
111 * writing process. 114 * writing process.
@@ -125,7 +128,7 @@ typedef struct journal_s journal_t; /* Journal control structure */
125 * On-disk structures 128 * On-disk structures
126 */ 129 */
127 130
128/* 131/*
129 * Descriptor block types: 132 * Descriptor block types:
130 */ 133 */
131 134
@@ -146,8 +149,8 @@ typedef struct journal_header_s
146} journal_header_t; 149} journal_header_t;
147 150
148 151
149/* 152/*
150 * 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
151 */ 154 */
152typedef struct journal_block_tag_s 155typedef struct journal_block_tag_s
153{ 156{
@@ -155,9 +158,9 @@ typedef struct journal_block_tag_s
155 __be32 t_flags; /* See below */ 158 __be32 t_flags; /* See below */
156} journal_block_tag_t; 159} journal_block_tag_t;
157 160
158/* 161/*
159 * 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
160 * be revoked from the log 163 * be revoked from the log
161 */ 164 */
162typedef struct journal_revoke_header_s 165typedef struct journal_revoke_header_s
163{ 166{
@@ -198,9 +201,9 @@ typedef struct journal_superblock_s
198 201
199/* 0x0024 */ 202/* 0x0024 */
200 /* Remaining fields are only valid in a version-2 superblock */ 203 /* Remaining fields are only valid in a version-2 superblock */
201 __be32 s_feature_compat; /* compatible feature set */ 204 __be32 s_feature_compat; /* compatible feature set */
202 __be32 s_feature_incompat; /* incompatible feature set */ 205 __be32 s_feature_incompat; /* incompatible feature set */
203 __be32 s_feature_ro_compat; /* readonly-compatible feature set */ 206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */
204/* 0x0030 */ 207/* 0x0030 */
205 __u8 s_uuid[16]; /* 128-bit uuid for journal */ 208 __u8 s_uuid[16]; /* 128-bit uuid for journal */
206 209
@@ -371,10 +374,10 @@ struct jbd_revoke_table_s;
371 **/ 374 **/
372 375
373/* 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
374 * in so it can be fixed later. 377 * in so it can be fixed later.
375 */ 378 */
376 379
377struct handle_s 380struct handle_s
378{ 381{
379 /* Which compound transaction is this update a part of? */ 382 /* Which compound transaction is this update a part of? */
380 transaction_t *h_transaction; 383 transaction_t *h_transaction;
@@ -432,7 +435,7 @@ struct handle_s
432 * 435 *
433 */ 436 */
434 437
435struct transaction_s 438struct transaction_s
436{ 439{
437 /* Pointer to the journal for this transaction. [no locking] */ 440 /* Pointer to the journal for this transaction. [no locking] */
438 journal_t *t_journal; 441 journal_t *t_journal;
@@ -452,7 +455,7 @@ struct transaction_s
452 T_RUNDOWN, 455 T_RUNDOWN,
453 T_FLUSH, 456 T_FLUSH,
454 T_COMMIT, 457 T_COMMIT,
455 T_FINISHED 458 T_FINISHED
456 } t_state; 459 } t_state;
457 460
458 /* 461 /*
@@ -566,7 +569,7 @@ struct transaction_s
566 * journal_t. 569 * journal_t.
567 * @j_flags: General journaling state flags 570 * @j_flags: General journaling state flags
568 * @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
569 * prior abort)? 572 * prior abort)?
570 * @j_sb_buffer: First part of superblock buffer 573 * @j_sb_buffer: First part of superblock buffer
571 * @j_superblock: Second part of superblock buffer 574 * @j_superblock: Second part of superblock buffer
572 * @j_format_version: Version of the superblock format 575 * @j_format_version: Version of the superblock format
@@ -580,7 +583,7 @@ struct transaction_s
580 * @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
581 * to start committing, or for a barrier lock to be released 584 * to start committing, or for a barrier lock to be released
582 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete 585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
583 * @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
584 * @j_wait_checkpoint: Wait queue to trigger checkpointing 587 * @j_wait_checkpoint: Wait queue to trigger checkpointing
585 * @j_wait_commit: Wait queue to trigger commit 588 * @j_wait_commit: Wait queue to trigger commit
586 * @j_wait_updates: Wait queue to wait for updates to complete 589 * @j_wait_updates: Wait queue to wait for updates to complete
@@ -589,7 +592,7 @@ struct transaction_s
589 * @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
590 * journal. 593 * journal.
591 * @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?
592 * @j_first: The block number of the first usable block 595 * @j_first: The block number of the first usable block
593 * @j_last: The block number one beyond the last usable block 596 * @j_last: The block number one beyond the last usable block
594 * @j_dev: Device where we store the journal 597 * @j_dev: Device where we store the journal
595 * @j_blocksize: blocksize for the location where we store the journal. 598 * @j_blocksize: blocksize for the location where we store the journal.
@@ -601,12 +604,12 @@ struct transaction_s
601 * @j_list_lock: Protects the buffer lists and internal buffer state. 604 * @j_list_lock: Protects the buffer lists and internal buffer state.
602 * @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
603 * block numbers are mapped into this inode via bmap(). 606 * block numbers are mapped into this inode via bmap().
604 * @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
605 * @j_transaction_sequence: Sequence number of the next transaction to grant 608 * @j_transaction_sequence: Sequence number of the next transaction to grant
606 * @j_commit_sequence: Sequence number of the most recently committed 609 * @j_commit_sequence: Sequence number of the most recently committed
607 * transaction 610 * transaction
608 * @j_commit_request: Sequence number of the most recent transaction wanting 611 * @j_commit_request: Sequence number of the most recent transaction wanting
609 * commit 612 * commit
610 * @j_uuid: Uuid of client object. 613 * @j_uuid: Uuid of client object.
611 * @j_task: Pointer to the current commit thread for this journal 614 * @j_task: Pointer to the current commit thread for this journal
612 * @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
@@ -696,7 +699,7 @@ struct journal_s
696 wait_queue_head_t j_wait_updates; 699 wait_queue_head_t j_wait_updates;
697 700
698 /* Semaphore for locking against concurrent checkpoints */ 701 /* Semaphore for locking against concurrent checkpoints */
699 struct mutex j_checkpoint_mutex; 702 struct mutex j_checkpoint_mutex;
700 703
701 /* 704 /*
702 * Journal head: identifies the first unused block in the journal. 705 * Journal head: identifies the first unused block in the journal.
@@ -729,7 +732,7 @@ struct journal_s
729 */ 732 */
730 struct block_device *j_dev; 733 struct block_device *j_dev;
731 int j_blocksize; 734 int j_blocksize;
732 unsigned int j_blk_offset; 735 unsigned long j_blk_offset;
733 736
734 /* 737 /*
735 * 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
@@ -820,8 +823,8 @@ struct journal_s
820 void *j_private; 823 void *j_private;
821}; 824};
822 825
823/* 826/*
824 * Journal flag definitions 827 * Journal flag definitions
825 */ 828 */
826#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ 829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
827#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ 830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
@@ -830,7 +833,7 @@ struct journal_s
830#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
831#define JFS_BARRIER 0x020 /* Use IDE barriers */ 834#define JFS_BARRIER 0x020 /* Use IDE barriers */
832 835
833/* 836/*
834 * Function declarations for the journaling transaction and buffer 837 * Function declarations for the journaling transaction and buffer
835 * management 838 * management
836 */ 839 */
@@ -859,11 +862,11 @@ int __journal_remove_checkpoint(struct journal_head *);
859void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 862void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
860 863
861/* Buffer IO */ 864/* Buffer IO */
862extern int 865extern int
863journal_write_metadata_buffer(transaction_t *transaction, 866journal_write_metadata_buffer(transaction_t *transaction,
864 struct journal_head *jh_in, 867 struct journal_head *jh_in,
865 struct journal_head **jh_out, 868 struct journal_head **jh_out,
866 int blocknr); 869 unsigned long blocknr);
867 870
868/* Transaction locking */ 871/* Transaction locking */
869extern void __wait_on_journal (journal_t *); 872extern void __wait_on_journal (journal_t *);
@@ -887,7 +890,7 @@ static inline handle_t *journal_current_handle(void)
887/* The journaling code user interface: 890/* The journaling code user interface:
888 * 891 *
889 * Create and destroy handles 892 * Create and destroy handles
890 * Register buffer modifications against the current transaction. 893 * Register buffer modifications against the current transaction.
891 */ 894 */
892 895
893extern handle_t *journal_start(journal_t *, int nblocks); 896extern handle_t *journal_start(journal_t *, int nblocks);
@@ -914,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev,
914 int start, int len, int bsize); 917 int start, int len, int bsize);
915extern journal_t * journal_init_inode (struct inode *); 918extern journal_t * journal_init_inode (struct inode *);
916extern int journal_update_format (journal_t *); 919extern int journal_update_format (journal_t *);
917extern int journal_check_used_features 920extern int journal_check_used_features
918 (journal_t *, unsigned long, unsigned long, unsigned long); 921 (journal_t *, unsigned long, unsigned long, unsigned long);
919extern int journal_check_available_features 922extern int journal_check_available_features
920 (journal_t *, unsigned long, unsigned long, unsigned long); 923 (journal_t *, unsigned long, unsigned long, unsigned long);
921extern int journal_set_features 924extern int journal_set_features
922 (journal_t *, unsigned long, unsigned long, unsigned long); 925 (journal_t *, unsigned long, unsigned long, unsigned long);
923extern int journal_create (journal_t *); 926extern int journal_create (journal_t *);
924extern int journal_load (journal_t *journal); 927extern int journal_load (journal_t *journal);
@@ -974,7 +977,6 @@ extern void journal_write_revoke_records(journal_t *, transaction_t *);
974extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 977extern int journal_set_revoke(journal_t *, unsigned long, tid_t);
975extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 978extern int journal_test_revoke(journal_t *, unsigned long, tid_t);
976extern void journal_clear_revoke(journal_t *); 979extern void journal_clear_revoke(journal_t *);
977extern void journal_brelse_array(struct buffer_head *b[], int n);
978extern void journal_switch_revoke_table(journal_t *journal); 980extern void journal_switch_revoke_table(journal_t *journal);
979 981
980/* 982/*
@@ -1012,7 +1014,7 @@ do { \
1012 * 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,
1013 * 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
1014 * (eg. ext3), and that we and should not commit any further 1016 * (eg. ext3), and that we and should not commit any further
1015 * transactions. 1017 * transactions.
1016 */ 1018 */
1017 1019
1018static inline int is_journal_aborted(journal_t *journal) 1020static inline int is_journal_aborted(journal_t *journal)
@@ -1079,7 +1081,7 @@ static inline int jbd_space_needed(journal_t *journal)
1079#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1081#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
1080#define BJ_Locked 8 /* Locked for I/O during commit */ 1082#define BJ_Locked 8 /* Locked for I/O during commit */
1081#define BJ_Types 9 1083#define BJ_Types 9
1082 1084
1083extern int jbd_blocks_per_page(struct inode *inode); 1085extern int jbd_blocks_per_page(struct inode *inode);
1084 1086
1085#ifdef __KERNEL__ 1087#ifdef __KERNEL__
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index c6f70660b3..840631fa5f 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -15,12 +15,12 @@
15#ifndef __LINUX_JFFS2_H__ 15#ifndef __LINUX_JFFS2_H__
16#define __LINUX_JFFS2_H__ 16#define __LINUX_JFFS2_H__
17 17
18#include <linux/magic.h>
19
18/* You must include something which defines the C99 uintXX_t types. 20/* You must include something which defines the C99 uintXX_t types.
19 We don't do it from here because this file is used in too many 21 We don't do it from here because this file is used in too many
20 different environments. */ 22 different environments. */
21 23
22#define JFFS2_SUPER_MAGIC 0x72b6
23
24/* Values we may expect to find in the 'magic' field */ 24/* Values we may expect to find in the 'magic' field */
25#define JFFS2_OLD_MAGIC_BITMASK 0x1984 25#define JFFS2_OLD_MAGIC_BITMASK 0x1984
26#define JFFS2_MAGIC_BITMASK 0x1985 26#define JFFS2_MAGIC_BITMASK 0x1985
@@ -186,6 +186,7 @@ struct jffs2_raw_xref
186 jint32_t hdr_crc; 186 jint32_t hdr_crc;
187 jint32_t ino; /* inode number */ 187 jint32_t ino; /* inode number */
188 jint32_t xid; /* XATTR identifier number */ 188 jint32_t xid; /* XATTR identifier number */
189 jint32_t xseqno; /* xref sequencial number */
189 jint32_t node_crc; 190 jint32_t node_crc;
190} __attribute__((packed)); 191} __attribute__((packed));
191 192
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 043376920f..c8d5f207c3 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -47,8 +47,8 @@
47 * - (NOM / DEN) fits in (32 - LSH) bits. 47 * - (NOM / DEN) fits in (32 - LSH) bits.
48 * - (NOM % DEN) fits in (32 - LSH) bits. 48 * - (NOM % DEN) fits in (32 - LSH) bits.
49 */ 49 */
50#define SH_DIV(NOM,DEN,LSH) ( ((NOM / DEN) << LSH) \ 50#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \
51 + (((NOM % DEN) << LSH) + DEN / 2) / DEN) 51 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
52 52
53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
@@ -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 54e2549f96..849043ce4e 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -57,10 +57,25 @@ do { \
57#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr) 57#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
58#endif 58#endif
59 59
60#define print_symbol(fmt, addr) \ 60static inline void print_symbol(const char *fmt, unsigned long addr)
61do { \ 61{
62 __check_printsym_format(fmt, ""); \ 62 __check_printsym_format(fmt, "");
63 __print_symbol(fmt, addr); \ 63 __print_symbol(fmt, (unsigned long)
64 __builtin_extract_return_addr((void *)addr));
65}
66
67#ifndef CONFIG_64BIT
68#define print_ip_sym(ip) \
69do { \
70 printk("[<%08lx>]", ip); \
71 print_symbol(" %s\n", ip); \
64} while(0) 72} while(0)
73#else
74#define print_ip_sym(ip) \
75do { \
76 printk("[<%016lx>]", ip); \
77 print_symbol(" %s\n", ip); \
78} while(0)
79#endif
65 80
66#endif /*_LINUX_KALLSYMS_H*/ 81#endif /*_LINUX_KALLSYMS_H*/
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 4eb851ece0..efe0ee4cc8 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -155,10 +155,8 @@ static inline void con_schedule_flip(struct tty_struct *t)
155{ 155{
156 unsigned long flags; 156 unsigned long flags;
157 spin_lock_irqsave(&t->buf.lock, flags); 157 spin_lock_irqsave(&t->buf.lock, flags);
158 if (t->buf.tail != NULL) { 158 if (t->buf.tail != NULL)
159 t->buf.tail->active = 0;
160 t->buf.tail->commit = t->buf.tail->used; 159 t->buf.tail->commit = t->buf.tail->used;
161 }
162 spin_unlock_irqrestore(&t->buf.lock, flags); 160 spin_unlock_irqrestore(&t->buf.lock, flags);
163 schedule_work(&t->buf.work); 161 schedule_work(&t->buf.work);
164} 162}
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 8c21aaa248..4d00988dad 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -31,7 +31,10 @@ extern const char linux_banner[];
31#define STACK_MAGIC 0xdeadbeef 31#define STACK_MAGIC 0xdeadbeef
32 32
33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
34#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) 34#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
35#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
36#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
37#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
35 38
36#define KERN_EMERG "<0>" /* system is unusable */ 39#define KERN_EMERG "<0>" /* system is unusable */
37#define KERN_ALERT "<1>" /* action must be taken immediately */ 40#define KERN_ALERT "<1>" /* action must be taken immediately */
@@ -117,6 +120,8 @@ extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
117 __attribute__ ((format (printf, 3, 4))); 120 __attribute__ ((format (printf, 3, 4)));
118extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 121extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
119 __attribute__ ((format (printf, 3, 0))); 122 __attribute__ ((format (printf, 3, 0)));
123extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
124 __attribute__ ((format (printf, 2, 3)));
120 125
121extern int sscanf(const char *, const char *, ...) 126extern int sscanf(const char *, const char *, ...)
122 __attribute__ ((format (scanf, 2, 3))); 127 __attribute__ ((format (scanf, 2, 3)));
@@ -182,6 +187,7 @@ extern void bust_spinlocks(int yes);
182extern 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 */
183extern int panic_timeout; 188extern int panic_timeout;
184extern int panic_on_oops; 189extern int panic_on_oops;
190extern int panic_on_unrecovered_nmi;
185extern int tainted; 191extern int tainted;
186extern const char *print_tainted(void); 192extern const char *print_tainted(void);
187extern void add_taint(unsigned); 193extern void add_taint(unsigned);
@@ -206,6 +212,7 @@ extern enum system_states {
206extern void dump_stack(void); 212extern void dump_stack(void);
207 213
208#ifdef DEBUG 214#ifdef DEBUG
215/* If you are writing a driver, please use dev_dbg instead */
209#define pr_debug(fmt,arg...) \ 216#define pr_debug(fmt,arg...) \
210 printk(KERN_DEBUG fmt,##arg) 217 printk(KERN_DEBUG fmt,##arg)
211#else 218#else
@@ -334,7 +341,20 @@ struct sysinfo {
334/* Force a compilation error if condition is true */ 341/* Force a compilation error if condition is true */
335#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 342#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
336 343
344/* Force a compilation error if condition is true, but also produce a
345 result (of value 0 and type size_t), so the expression can be used
346 e.g. in a structure initializer (or where-ever else comma expressions
347 aren't permitted). */
348#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
349
337/* Trap pasters of __FUNCTION__ at compile-time */ 350/* Trap pasters of __FUNCTION__ at compile-time */
338#define __FUNCTION__ (__func__) 351#define __FUNCTION__ (__func__)
339 352
353/* This helps us to avoid #ifdef CONFIG_NUMA */
354#ifdef CONFIG_NUMA
355#define NUMA_BUILD 1
356#else
357#define NUMA_BUILD 0
358#endif
359
340#endif 360#endif
diff --git a/include/linux/key.h b/include/linux/key.h
index e81ebf910d..169f05e486 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -177,7 +177,8 @@ struct key {
177/* 177/*
178 * kernel managed key type definition 178 * kernel managed key type definition
179 */ 179 */
180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey, const char *op); 180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey,
181 const char *op, void *aux);
181 182
182struct key_type { 183struct key_type {
183 /* name of the type */ 184 /* name of the type */
@@ -248,7 +249,14 @@ extern struct key *key_alloc(struct key_type *type,
248 const char *desc, 249 const char *desc,
249 uid_t uid, gid_t gid, 250 uid_t uid, gid_t gid,
250 struct task_struct *ctx, 251 struct task_struct *ctx,
251 key_perm_t perm, int not_in_quota); 252 key_perm_t perm,
253 unsigned long flags);
254
255
256#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
257#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
258#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
259
252extern int key_payload_reserve(struct key *key, size_t datalen); 260extern int key_payload_reserve(struct key *key, size_t datalen);
253extern int key_instantiate_and_link(struct key *key, 261extern int key_instantiate_and_link(struct key *key,
254 const void *data, 262 const void *data,
@@ -278,6 +286,11 @@ extern struct key *request_key(struct key_type *type,
278 const char *description, 286 const char *description,
279 const char *callout_info); 287 const char *callout_info);
280 288
289extern struct key *request_key_with_auxdata(struct key_type *type,
290 const char *description,
291 const char *callout_info,
292 void *aux);
293
281extern int key_validate(struct key *key); 294extern int key_validate(struct key *key);
282 295
283extern key_ref_t key_create_or_update(key_ref_t keyring, 296extern key_ref_t key_create_or_update(key_ref_t keyring,
@@ -285,7 +298,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring,
285 const char *description, 298 const char *description,
286 const void *payload, 299 const void *payload,
287 size_t plen, 300 size_t plen,
288 int not_in_quota); 301 unsigned long flags);
289 302
290extern int key_update(key_ref_t key, 303extern int key_update(key_ref_t key,
291 const void *payload, 304 const void *payload,
@@ -299,7 +312,7 @@ extern int key_unlink(struct key *keyring,
299 312
300extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 313extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
301 struct task_struct *ctx, 314 struct task_struct *ctx,
302 int not_in_quota, 315 unsigned long flags,
303 struct key *dest); 316 struct key *dest);
304 317
305extern int keyring_clear(struct key *keyring); 318extern int keyring_clear(struct key *keyring);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 2d22932795..bcd9cd173c 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/kthread.h b/include/linux/kthread.h
index ebdd41fd10..1c65e7a9f1 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,37 +4,19 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7/**
8 * kthread_create: create a kthread.
9 * @threadfn: the function to run until signal_pending(current).
10 * @data: data ptr for @threadfn.
11 * @namefmt: printf-style name for the thread.
12 *
13 * Description: This helper function creates and names a kernel
14 * thread. The thread will be stopped: use wake_up_process() to start
15 * it. See also kthread_run(), kthread_create_on_cpu().
16 *
17 * When woken, the thread will run @threadfn() with @data as its
18 * argument. @threadfn can either call do_exit() directly if it is a
19 * standalone thread for which noone will call kthread_stop(), or
20 * return when 'kthread_should_stop()' is true (which means
21 * kthread_stop() has been called). The return value should be zero
22 * or a negative error number: it will be passed to kthread_stop().
23 *
24 * Returns a task_struct or ERR_PTR(-ENOMEM).
25 */
26struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create(int (*threadfn)(void *data),
27 void *data, 8 void *data,
28 const char namefmt[], ...); 9 const char namefmt[], ...);
29 10
30/** 11/**
31 * kthread_run: create and wake a thread. 12 * kthread_run - create and wake a thread.
32 * @threadfn: the function to run until signal_pending(current). 13 * @threadfn: the function to run until signal_pending(current).
33 * @data: data ptr for @threadfn. 14 * @data: data ptr for @threadfn.
34 * @namefmt: printf-style name for the thread. 15 * @namefmt: printf-style name for the thread.
35 * 16 *
36 * Description: Convenient wrapper for kthread_create() followed by 17 * Description: Convenient wrapper for kthread_create() followed by
37 * wake_up_process(). Returns the kthread, or ERR_PTR(-ENOMEM). */ 18 * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
19 */
38#define kthread_run(threadfn, data, namefmt, ...) \ 20#define kthread_run(threadfn, data, namefmt, ...) \
39({ \ 21({ \
40 struct task_struct *__k \ 22 struct task_struct *__k \
@@ -44,50 +26,8 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
44 __k; \ 26 __k; \
45}) 27})
46 28
47/**
48 * kthread_bind: bind a just-created kthread to a cpu.
49 * @k: thread created by kthread_create().
50 * @cpu: cpu (might not be online, must be possible) for @k to run on.
51 *
52 * Description: This function is equivalent to set_cpus_allowed(),
53 * except that @cpu doesn't need to be online, and the thread must be
54 * stopped (ie. just returned from kthread_create().
55 */
56void kthread_bind(struct task_struct *k, unsigned int cpu); 29void kthread_bind(struct task_struct *k, unsigned int cpu);
57
58/**
59 * kthread_stop: stop a thread created by kthread_create().
60 * @k: thread created by kthread_create().
61 *
62 * Sets kthread_should_stop() for @k to return true, wakes it, and
63 * waits for it to exit. Your threadfn() must not call do_exit()
64 * itself if you use this function! This can also be called after
65 * kthread_create() instead of calling wake_up_process(): the thread
66 * will exit without calling threadfn().
67 *
68 * Returns the result of threadfn(), or -EINTR if wake_up_process()
69 * was never called. */
70int kthread_stop(struct task_struct *k); 30int kthread_stop(struct task_struct *k);
71
72/**
73 * kthread_stop_sem: stop a thread created by kthread_create().
74 * @k: thread created by kthread_create().
75 * @s: semaphore that @k waits on while idle.
76 *
77 * Does essentially the same thing as kthread_stop() above, but wakes
78 * @k by calling up(@s).
79 *
80 * Returns the result of threadfn(), or -EINTR if wake_up_process()
81 * was never called. */
82int kthread_stop_sem(struct task_struct *k, struct semaphore *s);
83
84/**
85 * kthread_should_stop: should this kthread return now?
86 *
87 * When someone calls kthread_stop on your kthread, it will be woken
88 * and this will return true. You should then return, and your return
89 * value will be passed through to kthread_stop().
90 */
91int kthread_should_stop(void); 31int kthread_should_stop(void);
92 32
93#endif /* _LINUX_KTHREAD_H */ 33#endif /* _LINUX_KTHREAD_H */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 62bc575807..84eeecd60a 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -56,7 +56,8 @@ typedef union {
56#endif 56#endif
57} ktime_t; 57} ktime_t;
58 58
59#define KTIME_MAX (~((u64)1 << 63)) 59#define KTIME_MAX ((s64)~((u64)1 << 63))
60#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
60 61
61/* 62/*
62 * ktime_t definitions when using the 64-bit scalar representation: 63 * ktime_t definitions when using the 64-bit scalar representation:
@@ -66,7 +67,6 @@ typedef union {
66 67
67/** 68/**
68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 69 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
69 *
70 * @secs: seconds to set 70 * @secs: seconds to set
71 * @nsecs: nanoseconds to set 71 * @nsecs: nanoseconds to set
72 * 72 *
@@ -74,6 +74,10 @@ typedef union {
74 */ 74 */
75static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 75static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
76{ 76{
77#if (BITS_PER_LONG == 64)
78 if (unlikely(secs >= KTIME_SEC_MAX))
79 return (ktime_t){ .tv64 = KTIME_MAX };
80#endif
77 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; 81 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
78} 82}
79 83
@@ -138,7 +142,6 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
138 142
139/** 143/**
140 * ktime_sub - subtract two ktime_t variables 144 * ktime_sub - subtract two ktime_t variables
141 *
142 * @lhs: minuend 145 * @lhs: minuend
143 * @rhs: subtrahend 146 * @rhs: subtrahend
144 * 147 *
@@ -157,7 +160,6 @@ static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157 160
158/** 161/**
159 * ktime_add - add two ktime_t variables 162 * ktime_add - add two ktime_t variables
160 *
161 * @add1: addend1 163 * @add1: addend1
162 * @add2: addend2 164 * @add2: addend2
163 * 165 *
@@ -184,7 +186,6 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
184 186
185/** 187/**
186 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable 188 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
187 *
188 * @kt: addend 189 * @kt: addend
189 * @nsec: the scalar nsec value to add 190 * @nsec: the scalar nsec value to add
190 * 191 *
@@ -194,7 +195,6 @@ extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
194 195
195/** 196/**
196 * timespec_to_ktime - convert a timespec to ktime_t format 197 * timespec_to_ktime - convert a timespec to ktime_t format
197 *
198 * @ts: the timespec variable to convert 198 * @ts: the timespec variable to convert
199 * 199 *
200 * Returns a ktime_t variable with the converted timespec value 200 * Returns a ktime_t variable with the converted timespec value
@@ -207,7 +207,6 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
207 207
208/** 208/**
209 * timeval_to_ktime - convert a timeval to ktime_t format 209 * timeval_to_ktime - convert a timeval to ktime_t format
210 *
211 * @tv: the timeval variable to convert 210 * @tv: the timeval variable to convert
212 * 211 *
213 * Returns a ktime_t variable with the converted timeval value 212 * Returns a ktime_t variable with the converted timeval value
@@ -220,7 +219,6 @@ static inline ktime_t timeval_to_ktime(const struct timeval tv)
220 219
221/** 220/**
222 * ktime_to_timespec - convert a ktime_t variable to timespec format 221 * ktime_to_timespec - convert a ktime_t variable to timespec format
223 *
224 * @kt: the ktime_t variable to convert 222 * @kt: the ktime_t variable to convert
225 * 223 *
226 * Returns the timespec representation of the ktime value 224 * Returns the timespec representation of the ktime value
@@ -233,7 +231,6 @@ static inline struct timespec ktime_to_timespec(const ktime_t kt)
233 231
234/** 232/**
235 * ktime_to_timeval - convert a ktime_t variable to timeval format 233 * ktime_to_timeval - convert a ktime_t variable to timeval format
236 *
237 * @kt: the ktime_t variable to convert 234 * @kt: the ktime_t variable to convert
238 * 235 *
239 * Returns the timeval representation of the ktime value 236 * Returns the timeval representation of the ktime value
diff --git a/include/linux/leds.h b/include/linux/leds.h
index dc23c7c639..88afceffb7 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 20b1cf527c..d6a3d4b345 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -30,12 +30,23 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <asm/scatterlist.h>
33#include <asm/io.h> 34#include <asm/io.h>
34#include <linux/ata.h> 35#include <linux/ata.h>
35#include <linux/workqueue.h> 36#include <linux/workqueue.h>
36#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
37 38
38/* 39/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard
41 * not a legacy or ISA standard.
42 */
43#ifdef CONFIG_ATA_NONSTANDARD
44#include <asm/libata-portmap.h>
45#else
46#include <asm-generic/libata-portmap.h>
47#endif
48
49/*
39 * compile-time options: to be removed as soon as all the drivers are 50 * compile-time options: to be removed as soon as all the drivers are
40 * converted to the new debugging mechanism 51 * converted to the new debugging mechanism
41 */ 52 */
@@ -43,7 +54,7 @@
43#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 54#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
44#undef ATA_IRQ_TRAP /* define to ack screaming irqs */ 55#undef ATA_IRQ_TRAP /* define to ack screaming irqs */
45#undef ATA_NDEBUG /* define to disable quick runtime checks */ 56#undef ATA_NDEBUG /* define to disable quick runtime checks */
46#undef ATA_ENABLE_PATA /* define to enable PATA support in some 57#define ATA_ENABLE_PATA /* define to enable PATA support in some
47 * low-level drivers */ 58 * low-level drivers */
48 59
49 60
@@ -111,8 +122,6 @@ enum {
111 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 122 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
112 ATA_MAX_QUEUE = 32, 123 ATA_MAX_QUEUE = 32,
113 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 124 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
114 ATA_MAX_SECTORS = 200, /* FIXME */
115 ATA_MAX_SECTORS_LBA48 = 65535,
116 ATA_MAX_BUS = 2, 125 ATA_MAX_BUS = 2,
117 ATA_DEF_BUSY_WAIT = 10000, 126 ATA_DEF_BUSY_WAIT = 10000,
118 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 127 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
@@ -130,6 +139,7 @@ enum {
130 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 139 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
131 140
132 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */ 141 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */
142 ATA_DFLAG_SUSPENDED = (1 << 9), /* device suspended */
133 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 143 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
134 144
135 ATA_DFLAG_DETACH = (1 << 16), 145 ATA_DFLAG_DETACH = (1 << 16),
@@ -159,22 +169,28 @@ enum {
159 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */ 169 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */
160 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H 170 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
161 * Register FIS clearing BSY */ 171 * Register FIS clearing BSY */
162
163 ATA_FLAG_DEBUGMSG = (1 << 13), 172 ATA_FLAG_DEBUGMSG = (1 << 13),
164 ATA_FLAG_FLUSH_PORT_TASK = (1 << 14), /* flush port task */
165 173
166 ATA_FLAG_EH_PENDING = (1 << 15), /* EH pending */ 174 /* The following flag belongs to ap->pflags but is kept in
167 ATA_FLAG_EH_IN_PROGRESS = (1 << 16), /* EH in progress */ 175 * ap->flags because it's referenced in many LLDs and will be
168 ATA_FLAG_FROZEN = (1 << 17), /* port is frozen */ 176 * removed in not-too-distant future.
169 ATA_FLAG_RECOVERED = (1 << 18), /* recovery action performed */ 177 */
170 ATA_FLAG_LOADING = (1 << 19), /* boot/loading probe */ 178 ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */
171 ATA_FLAG_UNLOADING = (1 << 20), /* module is unloading */
172 ATA_FLAG_SCSI_HOTPLUG = (1 << 21), /* SCSI hotplug scheduled */
173 179
174 ATA_FLAG_DISABLED = (1 << 22), /* port is disabled, ignore it */ 180 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
175 ATA_FLAG_SUSPENDED = (1 << 23), /* port is suspended (power) */
176 181
177 /* bits 24:31 of ap->flags are reserved for LLDD specific flags */ 182 /* struct ata_port pflags */
183 ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */
184 ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */
185 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */
186 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */
187 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */
188 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
189 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
190
191 ATA_PFLAG_FLUSH_PORT_TASK = (1 << 16), /* flush port task */
192 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
193 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
178 194
179 /* struct ata_queued_cmd flags */ 195 /* struct ata_queued_cmd flags */
180 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 196 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
@@ -189,8 +205,8 @@ enum {
189 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ 205 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */
190 206
191 /* host set flags */ 207 /* host set flags */
192 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ 208 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
193 209
194 /* various lengths of time */ 210 /* various lengths of time */
195 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 211 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
196 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 212 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
@@ -217,8 +233,8 @@ enum {
217 /* encoding various smaller bitmaps into a single 233 /* encoding various smaller bitmaps into a single
218 * unsigned int bitmap 234 * unsigned int bitmap
219 */ 235 */
220 ATA_BITS_PIO = 5, 236 ATA_BITS_PIO = 7,
221 ATA_BITS_MWDMA = 3, 237 ATA_BITS_MWDMA = 5,
222 ATA_BITS_UDMA = 8, 238 ATA_BITS_UDMA = 8,
223 239
224 ATA_SHIFT_PIO = 0, 240 ATA_SHIFT_PIO = 0,
@@ -247,15 +263,24 @@ enum {
247 ATA_EH_REVALIDATE = (1 << 0), 263 ATA_EH_REVALIDATE = (1 << 0),
248 ATA_EH_SOFTRESET = (1 << 1), 264 ATA_EH_SOFTRESET = (1 << 1),
249 ATA_EH_HARDRESET = (1 << 2), 265 ATA_EH_HARDRESET = (1 << 2),
266 ATA_EH_SUSPEND = (1 << 3),
267 ATA_EH_RESUME = (1 << 4),
268 ATA_EH_PM_FREEZE = (1 << 5),
250 269
251 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 270 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
252 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 271 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_SUSPEND |
272 ATA_EH_RESUME | ATA_EH_PM_FREEZE,
253 273
254 /* ata_eh_info->flags */ 274 /* ata_eh_info->flags */
255 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 275 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
276 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
277 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
278 ATA_EHI_QUIET = (1 << 3), /* be quiet */
256 279
257 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 280 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */
258 281
282 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
283
259 /* max repeat if error condition is still set after ->error_handler */ 284 /* max repeat if error condition is still set after ->error_handler */
260 ATA_EH_MAX_REPEAT = 5, 285 ATA_EH_MAX_REPEAT = 5,
261 286
@@ -272,6 +297,11 @@ enum {
272 * most devices. 297 * most devices.
273 */ 298 */
274 ATA_SPINUP_WAIT = 8000, 299 ATA_SPINUP_WAIT = 8000,
300
301 /* Horkage types. May be set by libata or controller on drives
302 (some horkage may be drive/controller pair dependant */
303
304 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
275}; 305};
276 306
277enum hsm_task_states { 307enum hsm_task_states {
@@ -333,23 +363,32 @@ struct ata_probe_ent {
333 struct scsi_host_template *sht; 363 struct scsi_host_template *sht;
334 struct ata_ioports port[ATA_MAX_PORTS]; 364 struct ata_ioports port[ATA_MAX_PORTS];
335 unsigned int n_ports; 365 unsigned int n_ports;
336 unsigned int hard_port_no; 366 unsigned int dummy_port_mask;
337 unsigned int pio_mask; 367 unsigned int pio_mask;
338 unsigned int mwdma_mask; 368 unsigned int mwdma_mask;
339 unsigned int udma_mask; 369 unsigned int udma_mask;
340 unsigned int legacy_mode;
341 unsigned long irq; 370 unsigned long irq;
371 unsigned long irq2;
342 unsigned int irq_flags; 372 unsigned int irq_flags;
343 unsigned long host_flags; 373 unsigned long port_flags;
344 unsigned long host_set_flags; 374 unsigned long _host_flags;
345 void __iomem *mmio_base; 375 void __iomem *mmio_base;
346 void *private_data; 376 void *private_data;
377
378 /* port_info for the secondary port. Together with irq2, it's
379 * used to implement non-uniform secondary port. Currently,
380 * the only user is ata_piix combined mode. This workaround
381 * will be removed together with ata_probe_ent when init model
382 * is updated.
383 */
384 const struct ata_port_info *pinfo2;
347}; 385};
348 386
349struct ata_host_set { 387struct ata_host {
350 spinlock_t lock; 388 spinlock_t lock;
351 struct device *dev; 389 struct device *dev;
352 unsigned long irq; 390 unsigned long irq;
391 unsigned long irq2;
353 void __iomem *mmio_base; 392 void __iomem *mmio_base;
354 unsigned int n_ports; 393 unsigned int n_ports;
355 void *private_data; 394 void *private_data;
@@ -357,7 +396,6 @@ struct ata_host_set {
357 unsigned long flags; 396 unsigned long flags;
358 int simplex_claimed; /* Keep seperate in case we 397 int simplex_claimed; /* Keep seperate in case we
359 ever need to do this locked */ 398 ever need to do this locked */
360 struct ata_host_set *next; /* for legacy mode */
361 struct ata_port *ports[0]; 399 struct ata_port *ports[0];
362}; 400};
363 401
@@ -403,7 +441,7 @@ struct ata_queued_cmd {
403 void *private_data; 441 void *private_data;
404}; 442};
405 443
406struct ata_host_stats { 444struct ata_port_stats {
407 unsigned long unhandled_irq; 445 unsigned long unhandled_irq;
408 unsigned long idle_irq; 446 unsigned long idle_irq;
409 unsigned long rw_reqbuf; 447 unsigned long rw_reqbuf;
@@ -451,6 +489,7 @@ struct ata_device {
451 489
452 /* error history */ 490 /* error history */
453 struct ata_ering ering; 491 struct ata_ering ering;
492 unsigned int horkage; /* List of broken features */
454}; 493};
455 494
456/* Offset into struct ata_device. Fields above it are maintained 495/* Offset into struct ata_device. Fields above it are maintained
@@ -481,13 +520,13 @@ struct ata_eh_context {
481}; 520};
482 521
483struct ata_port { 522struct ata_port {
484 struct Scsi_Host *host; /* our co-allocated scsi host */ 523 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
485 const struct ata_port_operations *ops; 524 const struct ata_port_operations *ops;
486 spinlock_t *lock; 525 spinlock_t *lock;
487 unsigned long flags; /* ATA_FLAG_xxx */ 526 unsigned long flags; /* ATA_FLAG_xxx */
527 unsigned int pflags; /* ATA_PFLAG_xxx */
488 unsigned int id; /* unique id req'd by scsi midlyr */ 528 unsigned int id; /* unique id req'd by scsi midlyr */
489 unsigned int port_no; /* unique port #; from zero */ 529 unsigned int port_no; /* unique port #; from zero */
490 unsigned int hard_port_no; /* hardware port #; from zero */
491 530
492 struct ata_prd *prd; /* our SG list */ 531 struct ata_prd *prd; /* our SG list */
493 dma_addr_t prd_dma; /* and its DMA mapping */ 532 dma_addr_t prd_dma; /* and its DMA mapping */
@@ -506,7 +545,7 @@ struct ata_port {
506 unsigned int hw_sata_spd_limit; 545 unsigned int hw_sata_spd_limit;
507 unsigned int sata_spd_limit; /* SATA PHY speed limit */ 546 unsigned int sata_spd_limit; /* SATA PHY speed limit */
508 547
509 /* record runtime error info, protected by host_set lock */ 548 /* record runtime error info, protected by host lock */
510 struct ata_eh_info eh_info; 549 struct ata_eh_info eh_info;
511 /* EH context owned by EH */ 550 /* EH context owned by EH */
512 struct ata_eh_context eh_context; 551 struct ata_eh_context eh_context;
@@ -520,8 +559,8 @@ struct ata_port {
520 unsigned int active_tag; 559 unsigned int active_tag;
521 u32 sactive; 560 u32 sactive;
522 561
523 struct ata_host_stats stats; 562 struct ata_port_stats stats;
524 struct ata_host_set *host_set; 563 struct ata_host *host;
525 struct device *dev; 564 struct device *dev;
526 565
527 struct work_struct port_task; 566 struct work_struct port_task;
@@ -534,6 +573,9 @@ struct ata_port {
534 struct list_head eh_done_q; 573 struct list_head eh_done_q;
535 wait_queue_head_t eh_wait_q; 574 wait_queue_head_t eh_wait_q;
536 575
576 pm_message_t pm_mesg;
577 int *pm_result;
578
537 void *private_data; 579 void *private_data;
538 580
539 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 581 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
@@ -588,10 +630,13 @@ struct ata_port_operations {
588 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, 630 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
589 u32 val); 631 u32 val);
590 632
633 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
634 int (*port_resume) (struct ata_port *ap);
635
591 int (*port_start) (struct ata_port *ap); 636 int (*port_start) (struct ata_port *ap);
592 void (*port_stop) (struct ata_port *ap); 637 void (*port_stop) (struct ata_port *ap);
593 638
594 void (*host_stop) (struct ata_host_set *host_set); 639 void (*host_stop) (struct ata_host *host);
595 640
596 void (*bmdma_stop) (struct ata_queued_cmd *qc); 641 void (*bmdma_stop) (struct ata_queued_cmd *qc);
597 u8 (*bmdma_status) (struct ata_port *ap); 642 u8 (*bmdma_status) (struct ata_port *ap);
@@ -599,7 +644,7 @@ struct ata_port_operations {
599 644
600struct ata_port_info { 645struct ata_port_info {
601 struct scsi_host_template *sht; 646 struct scsi_host_template *sht;
602 unsigned long host_flags; 647 unsigned long flags;
603 unsigned long pio_mask; 648 unsigned long pio_mask;
604 unsigned long mwdma_mask; 649 unsigned long mwdma_mask;
605 unsigned long udma_mask; 650 unsigned long udma_mask;
@@ -621,9 +666,25 @@ struct ata_timing {
621 666
622#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin) 667#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin)
623 668
624extern const unsigned long sata_deb_timing_boot[]; 669extern const unsigned long sata_deb_timing_normal[];
625extern const unsigned long sata_deb_timing_eh[]; 670extern const unsigned long sata_deb_timing_hotplug[];
626extern const unsigned long sata_deb_timing_before_fsrst[]; 671extern const unsigned long sata_deb_timing_long[];
672
673extern const struct ata_port_operations ata_dummy_port_ops;
674
675static inline const unsigned long *
676sata_ehc_deb_timing(struct ata_eh_context *ehc)
677{
678 if (ehc->i.flags & ATA_EHI_HOTPLUGGED)
679 return sata_deb_timing_hotplug;
680 else
681 return sata_deb_timing_normal;
682}
683
684static inline int ata_port_is_dummy(struct ata_port *ap)
685{
686 return ap->ops == &ata_dummy_port_ops;
687}
627 688
628extern void ata_port_probe(struct ata_port *); 689extern void ata_port_probe(struct ata_port *);
629extern void __sata_phy_reset(struct ata_port *ap); 690extern void __sata_phy_reset(struct ata_port *ap);
@@ -643,17 +704,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
643extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 704extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
644 unsigned int n_ports); 705 unsigned int n_ports);
645extern void ata_pci_remove_one (struct pci_dev *pdev); 706extern void ata_pci_remove_one (struct pci_dev *pdev);
646extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); 707extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
708extern void ata_pci_device_do_resume(struct pci_dev *pdev);
709extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
647extern int ata_pci_device_resume(struct pci_dev *pdev); 710extern int ata_pci_device_resume(struct pci_dev *pdev);
648extern int ata_pci_clear_simplex(struct pci_dev *pdev); 711extern int ata_pci_clear_simplex(struct pci_dev *pdev);
649#endif /* CONFIG_PCI */ 712#endif /* CONFIG_PCI */
650extern int ata_device_add(const struct ata_probe_ent *ent); 713extern int ata_device_add(const struct ata_probe_ent *ent);
651extern void ata_port_detach(struct ata_port *ap); 714extern void ata_port_detach(struct ata_port *ap);
652extern void ata_host_set_remove(struct ata_host_set *host_set); 715extern void ata_host_init(struct ata_host *, struct device *,
716 unsigned long, const struct ata_port_operations *);
717extern void ata_host_remove(struct ata_host *host);
653extern int ata_scsi_detect(struct scsi_host_template *sht); 718extern int ata_scsi_detect(struct scsi_host_template *sht);
654extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 719extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
655extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 720extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
656extern int ata_scsi_release(struct Scsi_Host *host); 721extern int ata_scsi_release(struct Scsi_Host *host);
722extern void ata_sas_port_destroy(struct ata_port *);
723extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
724 struct ata_port_info *, struct Scsi_Host *);
725extern int ata_sas_port_init(struct ata_port *);
726extern int ata_sas_port_start(struct ata_port *ap);
727extern void ata_sas_port_stop(struct ata_port *ap);
728extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
729extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
730 struct ata_port *ap);
657extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 731extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
658extern int sata_scr_valid(struct ata_port *ap); 732extern int sata_scr_valid(struct ata_port *ap);
659extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); 733extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val);
@@ -662,9 +736,9 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val);
662extern int ata_port_online(struct ata_port *ap); 736extern int ata_port_online(struct ata_port *ap);
663extern int ata_port_offline(struct ata_port *ap); 737extern int ata_port_offline(struct ata_port *ap);
664extern int ata_scsi_device_resume(struct scsi_device *); 738extern int ata_scsi_device_resume(struct scsi_device *);
665extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); 739extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
666extern int ata_device_resume(struct ata_device *); 740extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
667extern int ata_device_suspend(struct ata_device *, pm_message_t state); 741extern void ata_host_resume(struct ata_host *host);
668extern int ata_ratelimit(void); 742extern int ata_ratelimit(void);
669extern unsigned int ata_busy_sleep(struct ata_port *ap, 743extern unsigned int ata_busy_sleep(struct ata_port *ap,
670 unsigned long timeout_pat, 744 unsigned long timeout_pat,
@@ -689,7 +763,7 @@ extern u8 ata_altstatus(struct ata_port *ap);
689extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 763extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
690extern int ata_port_start (struct ata_port *ap); 764extern int ata_port_start (struct ata_port *ap);
691extern void ata_port_stop (struct ata_port *ap); 765extern void ata_port_stop (struct ata_port *ap);
692extern void ata_host_stop (struct ata_host_set *host_set); 766extern void ata_host_stop (struct ata_host *host);
693extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 767extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
694extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, 768extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
695 unsigned int buflen, int write_data); 769 unsigned int buflen, int write_data);
@@ -775,7 +849,7 @@ struct pci_bits {
775 unsigned long val; 849 unsigned long val;
776}; 850};
777 851
778extern void ata_pci_host_stop (struct ata_host_set *host_set); 852extern void ata_pci_host_stop (struct ata_host *host);
779extern struct ata_probe_ent * 853extern struct ata_probe_ent *
780ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 854ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
781extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 855extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
@@ -824,19 +898,24 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
824 (ehi)->desc_len = 0; \ 898 (ehi)->desc_len = 0; \
825} while (0) 899} while (0)
826 900
827static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) 901static inline void __ata_ehi_hotplugged(struct ata_eh_info *ehi)
828{ 902{
829 if (ehi->flags & ATA_EHI_HOTPLUGGED) 903 if (ehi->flags & ATA_EHI_HOTPLUGGED)
830 return; 904 return;
831 905
832 ehi->flags |= ATA_EHI_HOTPLUGGED; 906 ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK;
833 ehi->hotplug_timestamp = jiffies; 907 ehi->hotplug_timestamp = jiffies;
834 908
835 ehi->err_mask |= AC_ERR_ATA_BUS;
836 ehi->action |= ATA_EH_SOFTRESET; 909 ehi->action |= ATA_EH_SOFTRESET;
837 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; 910 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
838} 911}
839 912
913static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
914{
915 __ata_ehi_hotplugged(ehi);
916 ehi->err_mask |= AC_ERR_ATA_BUS;
917}
918
840/* 919/*
841 * qc helpers 920 * qc helpers
842 */ 921 */
@@ -887,6 +966,9 @@ static inline unsigned int ata_tag_internal(unsigned int tag)
887 return tag == ATA_MAX_QUEUE - 1; 966 return tag == ATA_MAX_QUEUE - 1;
888} 967}
889 968
969/*
970 * device helpers
971 */
890static inline unsigned int ata_class_enabled(unsigned int class) 972static inline unsigned int ata_class_enabled(unsigned int class)
891{ 973{
892 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; 974 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI;
@@ -917,6 +999,22 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
917 return ata_class_absent(dev->class); 999 return ata_class_absent(dev->class);
918} 1000}
919 1001
1002static inline unsigned int ata_dev_ready(const struct ata_device *dev)
1003{
1004 return ata_dev_enabled(dev) && !(dev->flags & ATA_DFLAG_SUSPENDED);
1005}
1006
1007/*
1008 * port helpers
1009 */
1010static inline int ata_port_max_devices(const struct ata_port *ap)
1011{
1012 if (ap->flags & ATA_FLAG_SLAVE_POSS)
1013 return 2;
1014 return 1;
1015}
1016
1017
920static inline u8 ata_chk_status(struct ata_port *ap) 1018static inline u8 ata_chk_status(struct ata_port *ap)
921{ 1019{
922 return ap->ops->check_status(ap); 1020 return ap->ops->check_status(ap);
diff --git a/include/linux/license.h b/include/linux/license.h
new file mode 100644
index 0000000000..decdbf43cb
--- /dev/null
+++ b/include/linux/license.h
@@ -0,0 +1,14 @@
1#ifndef __LICENSE_H
2#define __LICENSE_H
3
4static inline int license_is_gpl_compatible(const char *license)
5{
6 return (strcmp(license, "GPL") == 0
7 || strcmp(license, "GPL v2") == 0
8 || strcmp(license, "GPL and additional rights") == 0
9 || strcmp(license, "Dual BSD/GPL") == 0
10 || strcmp(license, "Dual MIT/GPL") == 0
11 || strcmp(license, "Dual MPL/GPL") == 0);
12}
13
14#endif
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 932021f872..6c9873f882 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 a02642e471..a9c90287c0 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -4,18 +4,11 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/poison.h>
7#include <linux/prefetch.h> 8#include <linux/prefetch.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
10/* 11/*
11 * These are non-NULL pointers that will result in page faults
12 * under normal circumstances, used to verify that nobody uses
13 * non-initialized list entries.
14 */
15#define LIST_POISON1 ((void *) 0x00100100)
16#define LIST_POISON2 ((void *) 0x00200200)
17
18/*
19 * Simple doubly linked list implementation. 12 * Simple doubly linked list implementation.
20 * 13 *
21 * Some of the internal functions ("__xxx") are useful when 14 * Some of the internal functions ("__xxx") are useful when
@@ -46,6 +39,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
46 * This is only for internal list manipulation where we know 39 * This is only for internal list manipulation where we know
47 * the prev/next entries already! 40 * the prev/next entries already!
48 */ 41 */
42#ifndef CONFIG_DEBUG_LIST
49static inline void __list_add(struct list_head *new, 43static inline void __list_add(struct list_head *new,
50 struct list_head *prev, 44 struct list_head *prev,
51 struct list_head *next) 45 struct list_head *next)
@@ -55,6 +49,11 @@ static inline void __list_add(struct list_head *new,
55 new->prev = prev; 49 new->prev = prev;
56 prev->next = new; 50 prev->next = new;
57} 51}
52#else
53extern void __list_add(struct list_head *new,
54 struct list_head *prev,
55 struct list_head *next);
56#endif
58 57
59/** 58/**
60 * list_add - add a new entry 59 * list_add - add a new entry
@@ -64,10 +63,15 @@ static inline void __list_add(struct list_head *new,
64 * Insert a new entry after the specified head. 63 * Insert a new entry after the specified head.
65 * This is good for implementing stacks. 64 * This is good for implementing stacks.
66 */ 65 */
66#ifndef CONFIG_DEBUG_LIST
67static 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)
68{ 68{
69 __list_add(new, head, head->next); 69 __list_add(new, head, head->next);
70} 70}
71#else
72extern void list_add(struct list_head *new, struct list_head *head);
73#endif
74
71 75
72/** 76/**
73 * list_add_tail - add a new entry 77 * list_add_tail - add a new entry
@@ -160,12 +164,16 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
160 * 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
161 * in an undefined state. 165 * in an undefined state.
162 */ 166 */
167#ifndef CONFIG_DEBUG_LIST
163static inline void list_del(struct list_head *entry) 168static inline void list_del(struct list_head *entry)
164{ 169{
165 __list_del(entry->prev, entry->next); 170 __list_del(entry->prev, entry->next);
166 entry->next = LIST_POISON1; 171 entry->next = LIST_POISON1;
167 entry->prev = LIST_POISON2; 172 entry->prev = LIST_POISON2;
168} 173}
174#else
175extern void list_del(struct list_head *entry);
176#endif
169 177
170/** 178/**
171 * list_del_rcu - deletes entry from list without re-initialization 179 * list_del_rcu - deletes entry from list without re-initialization
@@ -272,6 +280,17 @@ static inline void list_move_tail(struct list_head *list,
272} 280}
273 281
274/** 282/**
283 * list_is_last - tests whether @list is the last entry in list @head
284 * @list: the entry to test
285 * @head: the head of the list
286 */
287static inline int list_is_last(const struct list_head *list,
288 const struct list_head *head)
289{
290 return list->next == head;
291}
292
293/**
275 * list_empty - tests whether a list is empty 294 * list_empty - tests whether a list is empty
276 * @head: the list to test. 295 * @head: the list to test.
277 */ 296 */
@@ -281,16 +300,17 @@ static inline int list_empty(const struct list_head *head)
281} 300}
282 301
283/** 302/**
284 * list_empty_careful - tests whether a list is 303 * list_empty_careful - tests whether a list is empty and not being modified
285 * empty _and_ checks that no other CPU might be 304 * @head: the list to test
286 * in the process of still modifying either member 305 *
306 * Description:
307 * tests whether a list is empty _and_ checks that no other CPU might be
308 * in the process of modifying either member (next or prev)
287 * 309 *
288 * NOTE: using list_empty_careful() without synchronization 310 * NOTE: using list_empty_careful() without synchronization
289 * can only be safe if the only activity that can happen 311 * can only be safe if the only activity that can happen
290 * to the list entry is list_del_init(). Eg. it cannot be used 312 * to the list entry is list_del_init(). Eg. it cannot be used
291 * if another CPU could re-list_add() it. 313 * if another CPU could re-list_add() it.
292 *
293 * @head: the list to test.
294 */ 314 */
295static inline int list_empty_careful(const struct list_head *head) 315static inline int list_empty_careful(const struct list_head *head)
296{ 316{
@@ -350,7 +370,7 @@ static inline void list_splice_init(struct list_head *list,
350 370
351/** 371/**
352 * list_for_each - iterate over a list 372 * list_for_each - iterate over a list
353 * @pos: the &struct list_head to use as a loop counter. 373 * @pos: the &struct list_head to use as a loop cursor.
354 * @head: the head for your list. 374 * @head: the head for your list.
355 */ 375 */
356#define list_for_each(pos, head) \ 376#define list_for_each(pos, head) \
@@ -359,7 +379,7 @@ static inline void list_splice_init(struct list_head *list,
359 379
360/** 380/**
361 * __list_for_each - iterate over a list 381 * __list_for_each - iterate over a list
362 * @pos: the &struct list_head to use as a loop counter. 382 * @pos: the &struct list_head to use as a loop cursor.
363 * @head: the head for your list. 383 * @head: the head for your list.
364 * 384 *
365 * This variant differs from list_for_each() in that it's the 385 * This variant differs from list_for_each() in that it's the
@@ -372,7 +392,7 @@ static inline void list_splice_init(struct list_head *list,
372 392
373/** 393/**
374 * list_for_each_prev - iterate over a list backwards 394 * list_for_each_prev - iterate over a list backwards
375 * @pos: the &struct list_head to use as a loop counter. 395 * @pos: the &struct list_head to use as a loop cursor.
376 * @head: the head for your list. 396 * @head: the head for your list.
377 */ 397 */
378#define list_for_each_prev(pos, head) \ 398#define list_for_each_prev(pos, head) \
@@ -380,8 +400,8 @@ static inline void list_splice_init(struct list_head *list,
380 pos = pos->prev) 400 pos = pos->prev)
381 401
382/** 402/**
383 * list_for_each_safe - iterate over a list safe against removal of list entry 403 * list_for_each_safe - iterate over a list safe against removal of list entry
384 * @pos: the &struct list_head to use as a loop counter. 404 * @pos: the &struct list_head to use as a loop cursor.
385 * @n: another &struct list_head to use as temporary storage 405 * @n: another &struct list_head to use as temporary storage
386 * @head: the head for your list. 406 * @head: the head for your list.
387 */ 407 */
@@ -391,7 +411,7 @@ static inline void list_splice_init(struct list_head *list,
391 411
392/** 412/**
393 * list_for_each_entry - iterate over list of given type 413 * list_for_each_entry - iterate over list of given type
394 * @pos: the type * to use as a loop counter. 414 * @pos: the type * to use as a loop cursor.
395 * @head: the head for your list. 415 * @head: the head for your list.
396 * @member: the name of the list_struct within the struct. 416 * @member: the name of the list_struct within the struct.
397 */ 417 */
@@ -402,7 +422,7 @@ static inline void list_splice_init(struct list_head *list,
402 422
403/** 423/**
404 * list_for_each_entry_reverse - iterate backwards over list of given type. 424 * list_for_each_entry_reverse - iterate backwards over list of given type.
405 * @pos: the type * to use as a loop counter. 425 * @pos: the type * to use as a loop cursor.
406 * @head: the head for your list. 426 * @head: the head for your list.
407 * @member: the name of the list_struct within the struct. 427 * @member: the name of the list_struct within the struct.
408 */ 428 */
@@ -412,21 +432,24 @@ static inline void list_splice_init(struct list_head *list,
412 pos = list_entry(pos->member.prev, typeof(*pos), member)) 432 pos = list_entry(pos->member.prev, typeof(*pos), member))
413 433
414/** 434/**
415 * list_prepare_entry - prepare a pos entry for use as a start point in 435 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue
416 * list_for_each_entry_continue
417 * @pos: the type * to use as a start point 436 * @pos: the type * to use as a start point
418 * @head: the head of the list 437 * @head: the head of the list
419 * @member: the name of the list_struct within the struct. 438 * @member: the name of the list_struct within the struct.
439 *
440 * Prepares a pos entry for use as a start point in list_for_each_entry_continue.
420 */ 441 */
421#define list_prepare_entry(pos, head, member) \ 442#define list_prepare_entry(pos, head, member) \
422 ((pos) ? : list_entry(head, typeof(*pos), member)) 443 ((pos) ? : list_entry(head, typeof(*pos), member))
423 444
424/** 445/**
425 * list_for_each_entry_continue - iterate over list of given type 446 * list_for_each_entry_continue - continue iteration over list of given type
426 * continuing after existing point 447 * @pos: the type * to use as a loop cursor.
427 * @pos: the type * to use as a loop counter.
428 * @head: the head for your list. 448 * @head: the head for your list.
429 * @member: the name of the list_struct within the struct. 449 * @member: the name of the list_struct within the struct.
450 *
451 * Continue to iterate over list of given type, continuing after
452 * the current position.
430 */ 453 */
431#define list_for_each_entry_continue(pos, head, member) \ 454#define list_for_each_entry_continue(pos, head, member) \
432 for (pos = list_entry(pos->member.next, typeof(*pos), member); \ 455 for (pos = list_entry(pos->member.next, typeof(*pos), member); \
@@ -434,11 +457,12 @@ static inline void list_splice_init(struct list_head *list,
434 pos = list_entry(pos->member.next, typeof(*pos), member)) 457 pos = list_entry(pos->member.next, typeof(*pos), member))
435 458
436/** 459/**
437 * list_for_each_entry_from - iterate over list of given type 460 * list_for_each_entry_from - iterate over list of given type from the current point
438 * continuing from existing point 461 * @pos: the type * to use as a loop cursor.
439 * @pos: the type * to use as a loop counter.
440 * @head: the head for your list. 462 * @head: the head for your list.
441 * @member: the name of the list_struct within the struct. 463 * @member: the name of the list_struct within the struct.
464 *
465 * Iterate over list of given type, continuing from current position.
442 */ 466 */
443#define list_for_each_entry_from(pos, head, member) \ 467#define list_for_each_entry_from(pos, head, member) \
444 for (; prefetch(pos->member.next), &pos->member != (head); \ 468 for (; prefetch(pos->member.next), &pos->member != (head); \
@@ -446,7 +470,7 @@ static inline void list_splice_init(struct list_head *list,
446 470
447/** 471/**
448 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 472 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
449 * @pos: the type * to use as a loop counter. 473 * @pos: the type * to use as a loop cursor.
450 * @n: another type * to use as temporary storage 474 * @n: another type * to use as temporary storage
451 * @head: the head for your list. 475 * @head: the head for your list.
452 * @member: the name of the list_struct within the struct. 476 * @member: the name of the list_struct within the struct.
@@ -458,12 +482,14 @@ static inline void list_splice_init(struct list_head *list,
458 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 482 pos = n, n = list_entry(n->member.next, typeof(*n), member))
459 483
460/** 484/**
461 * list_for_each_entry_safe_continue - iterate over list of given type 485 * list_for_each_entry_safe_continue
462 * continuing after existing point safe against removal of list entry 486 * @pos: the type * to use as a loop cursor.
463 * @pos: the type * to use as a loop counter.
464 * @n: another type * to use as temporary storage 487 * @n: another type * to use as temporary storage
465 * @head: the head for your list. 488 * @head: the head for your list.
466 * @member: the name of the list_struct within the struct. 489 * @member: the name of the list_struct within the struct.
490 *
491 * Iterate over list of given type, continuing after current point,
492 * safe against removal of list entry.
467 */ 493 */
468#define list_for_each_entry_safe_continue(pos, n, head, member) \ 494#define list_for_each_entry_safe_continue(pos, n, head, member) \
469 for (pos = list_entry(pos->member.next, typeof(*pos), member), \ 495 for (pos = list_entry(pos->member.next, typeof(*pos), member), \
@@ -472,12 +498,14 @@ static inline void list_splice_init(struct list_head *list,
472 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 498 pos = n, n = list_entry(n->member.next, typeof(*n), member))
473 499
474/** 500/**
475 * list_for_each_entry_safe_from - iterate over list of given type 501 * list_for_each_entry_safe_from
476 * from existing point safe against removal of list entry 502 * @pos: the type * to use as a loop cursor.
477 * @pos: the type * to use as a loop counter.
478 * @n: another type * to use as temporary storage 503 * @n: another type * to use as temporary storage
479 * @head: the head for your list. 504 * @head: the head for your list.
480 * @member: the name of the list_struct within the struct. 505 * @member: the name of the list_struct within the struct.
506 *
507 * Iterate over list of given type from current point, safe against
508 * removal of list entry.
481 */ 509 */
482#define list_for_each_entry_safe_from(pos, n, head, member) \ 510#define list_for_each_entry_safe_from(pos, n, head, member) \
483 for (n = list_entry(pos->member.next, typeof(*pos), member); \ 511 for (n = list_entry(pos->member.next, typeof(*pos), member); \
@@ -485,12 +513,14 @@ static inline void list_splice_init(struct list_head *list,
485 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 513 pos = n, n = list_entry(n->member.next, typeof(*n), member))
486 514
487/** 515/**
488 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against 516 * list_for_each_entry_safe_reverse
489 * removal of list entry 517 * @pos: the type * to use as a loop cursor.
490 * @pos: the type * to use as a loop counter.
491 * @n: another type * to use as temporary storage 518 * @n: another type * to use as temporary storage
492 * @head: the head for your list. 519 * @head: the head for your list.
493 * @member: the name of the list_struct within the struct. 520 * @member: the name of the list_struct within the struct.
521 *
522 * Iterate backwards over list of given type, safe against removal
523 * of list entry.
494 */ 524 */
495#define list_for_each_entry_safe_reverse(pos, n, head, member) \ 525#define list_for_each_entry_safe_reverse(pos, n, head, member) \
496 for (pos = list_entry((head)->prev, typeof(*pos), member), \ 526 for (pos = list_entry((head)->prev, typeof(*pos), member), \
@@ -500,7 +530,7 @@ static inline void list_splice_init(struct list_head *list,
500 530
501/** 531/**
502 * list_for_each_rcu - iterate over an rcu-protected list 532 * list_for_each_rcu - iterate over an rcu-protected list
503 * @pos: the &struct list_head to use as a loop counter. 533 * @pos: the &struct list_head to use as a loop cursor.
504 * @head: the head for your list. 534 * @head: the head for your list.
505 * 535 *
506 * This list-traversal primitive may safely run concurrently with 536 * This list-traversal primitive may safely run concurrently with
@@ -518,12 +548,13 @@ static inline void list_splice_init(struct list_head *list,
518 pos = pos->next) 548 pos = pos->next)
519 549
520/** 550/**
521 * list_for_each_safe_rcu - iterate over an rcu-protected list safe 551 * list_for_each_safe_rcu
522 * against removal of list entry 552 * @pos: the &struct list_head to use as a loop cursor.
523 * @pos: the &struct list_head to use as a loop counter.
524 * @n: another &struct list_head to use as temporary storage 553 * @n: another &struct list_head to use as temporary storage
525 * @head: the head for your list. 554 * @head: the head for your list.
526 * 555 *
556 * Iterate over an rcu-protected list, safe against removal of list entry.
557 *
527 * This list-traversal primitive may safely run concurrently with 558 * This list-traversal primitive may safely run concurrently with
528 * the _rcu list-mutation primitives such as list_add_rcu() 559 * the _rcu list-mutation primitives such as list_add_rcu()
529 * as long as the traversal is guarded by rcu_read_lock(). 560 * as long as the traversal is guarded by rcu_read_lock().
@@ -535,7 +566,7 @@ static inline void list_splice_init(struct list_head *list,
535 566
536/** 567/**
537 * list_for_each_entry_rcu - iterate over rcu list of given type 568 * list_for_each_entry_rcu - iterate over rcu list of given type
538 * @pos: the type * to use as a loop counter. 569 * @pos: the type * to use as a loop cursor.
539 * @head: the head for your list. 570 * @head: the head for your list.
540 * @member: the name of the list_struct within the struct. 571 * @member: the name of the list_struct within the struct.
541 * 572 *
@@ -551,11 +582,12 @@ static inline void list_splice_init(struct list_head *list,
551 582
552 583
553/** 584/**
554 * list_for_each_continue_rcu - iterate over an rcu-protected list 585 * list_for_each_continue_rcu
555 * continuing after existing point. 586 * @pos: the &struct list_head to use as a loop cursor.
556 * @pos: the &struct list_head to use as a loop counter.
557 * @head: the head for your list. 587 * @head: the head for your list.
558 * 588 *
589 * Iterate over an rcu-protected list, continuing after current point.
590 *
559 * This list-traversal primitive may safely run concurrently with 591 * This list-traversal primitive may safely run concurrently with
560 * the _rcu list-mutation primitives such as list_add_rcu() 592 * the _rcu list-mutation primitives such as list_add_rcu()
561 * as long as the traversal is guarded by rcu_read_lock(). 593 * as long as the traversal is guarded by rcu_read_lock().
@@ -681,11 +713,14 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
681 713
682 714
683/** 715/**
684 * hlist_add_head_rcu - adds the specified element to the specified hlist, 716 * hlist_add_head_rcu
685 * while permitting racing traversals.
686 * @n: the element to add to the hash list. 717 * @n: the element to add to the hash list.
687 * @h: the list to add to. 718 * @h: the list to add to.
688 * 719 *
720 * Description:
721 * Adds the specified element to the specified hlist,
722 * while permitting racing traversals.
723 *
689 * The caller must take whatever precautions are necessary 724 * The caller must take whatever precautions are necessary
690 * (such as holding appropriate locks) to avoid racing 725 * (such as holding appropriate locks) to avoid racing
691 * with another list-mutation primitive, such as hlist_add_head_rcu() 726 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -730,11 +765,14 @@ static inline void hlist_add_after(struct hlist_node *n,
730} 765}
731 766
732/** 767/**
733 * hlist_add_before_rcu - adds the specified element to the specified hlist 768 * hlist_add_before_rcu
734 * before the specified node while permitting racing traversals.
735 * @n: the new element to add to the hash list. 769 * @n: the new element to add to the hash list.
736 * @next: the existing element to add the new element before. 770 * @next: the existing element to add the new element before.
737 * 771 *
772 * Description:
773 * Adds the specified element to the specified hlist
774 * before the specified node while permitting racing traversals.
775 *
738 * The caller must take whatever precautions are necessary 776 * The caller must take whatever precautions are necessary
739 * (such as holding appropriate locks) to avoid racing 777 * (such as holding appropriate locks) to avoid racing
740 * with another list-mutation primitive, such as hlist_add_head_rcu() 778 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -755,11 +793,14 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
755} 793}
756 794
757/** 795/**
758 * hlist_add_after_rcu - adds the specified element to the specified hlist 796 * hlist_add_after_rcu
759 * after the specified node while permitting racing traversals.
760 * @prev: the existing element to add the new element after. 797 * @prev: the existing element to add the new element after.
761 * @n: the new element to add to the hash list. 798 * @n: the new element to add to the hash list.
762 * 799 *
800 * Description:
801 * Adds the specified element to the specified hlist
802 * after the specified node while permitting racing traversals.
803 *
763 * The caller must take whatever precautions are necessary 804 * The caller must take whatever precautions are necessary
764 * (such as holding appropriate locks) to avoid racing 805 * (such as holding appropriate locks) to avoid racing
765 * with another list-mutation primitive, such as hlist_add_head_rcu() 806 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -792,8 +833,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
792 833
793/** 834/**
794 * hlist_for_each_entry - iterate over list of given type 835 * hlist_for_each_entry - iterate over list of given type
795 * @tpos: the type * to use as a loop counter. 836 * @tpos: the type * to use as a loop cursor.
796 * @pos: the &struct hlist_node to use as a loop counter. 837 * @pos: the &struct hlist_node to use as a loop cursor.
797 * @head: the head for your list. 838 * @head: the head for your list.
798 * @member: the name of the hlist_node within the struct. 839 * @member: the name of the hlist_node within the struct.
799 */ 840 */
@@ -804,9 +845,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
804 pos = pos->next) 845 pos = pos->next)
805 846
806/** 847/**
807 * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point 848 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
808 * @tpos: the type * to use as a loop counter. 849 * @tpos: the type * to use as a loop cursor.
809 * @pos: the &struct hlist_node to use as a loop counter. 850 * @pos: the &struct hlist_node to use as a loop cursor.
810 * @member: the name of the hlist_node within the struct. 851 * @member: the name of the hlist_node within the struct.
811 */ 852 */
812#define hlist_for_each_entry_continue(tpos, pos, member) \ 853#define hlist_for_each_entry_continue(tpos, pos, member) \
@@ -816,9 +857,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
816 pos = pos->next) 857 pos = pos->next)
817 858
818/** 859/**
819 * hlist_for_each_entry_from - iterate over a hlist continuing from existing point 860 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
820 * @tpos: the type * to use as a loop counter. 861 * @tpos: the type * to use as a loop cursor.
821 * @pos: the &struct hlist_node to use as a loop counter. 862 * @pos: the &struct hlist_node to use as a loop cursor.
822 * @member: the name of the hlist_node within the struct. 863 * @member: the name of the hlist_node within the struct.
823 */ 864 */
824#define hlist_for_each_entry_from(tpos, pos, member) \ 865#define hlist_for_each_entry_from(tpos, pos, member) \
@@ -828,8 +869,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
828 869
829/** 870/**
830 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 871 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
831 * @tpos: the type * to use as a loop counter. 872 * @tpos: the type * to use as a loop cursor.
832 * @pos: the &struct hlist_node to use as a loop counter. 873 * @pos: the &struct hlist_node to use as a loop cursor.
833 * @n: another &struct hlist_node to use as temporary storage 874 * @n: another &struct hlist_node to use as temporary storage
834 * @head: the head for your list. 875 * @head: the head for your list.
835 * @member: the name of the hlist_node within the struct. 876 * @member: the name of the hlist_node within the struct.
@@ -842,8 +883,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
842 883
843/** 884/**
844 * hlist_for_each_entry_rcu - iterate over rcu list of given type 885 * hlist_for_each_entry_rcu - iterate over rcu list of given type
845 * @tpos: the type * to use as a loop counter. 886 * @tpos: the type * to use as a loop cursor.
846 * @pos: the &struct hlist_node to use as a loop counter. 887 * @pos: the &struct hlist_node to use as a loop cursor.
847 * @head: the head for your list. 888 * @head: the head for your list.
848 * @member: the name of the hlist_node within the struct. 889 * @member: the name of the hlist_node within the struct.
849 * 890 *
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index a8876bc651..0d92c468d5 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -49,11 +49,12 @@ struct nlm_host {
49 h_killed : 1, 49 h_killed : 1,
50 h_monitored : 1; 50 h_monitored : 1;
51 wait_queue_head_t h_gracewait; /* wait while reclaiming */ 51 wait_queue_head_t h_gracewait; /* wait while reclaiming */
52 struct rw_semaphore h_rwsem; /* Reboot recovery lock */
52 u32 h_state; /* pseudo-state counter */ 53 u32 h_state; /* pseudo-state counter */
53 u32 h_nsmstate; /* true remote NSM state */ 54 u32 h_nsmstate; /* true remote NSM state */
54 u32 h_pidcount; /* Pseudopids */ 55 u32 h_pidcount; /* Pseudopids */
55 atomic_t h_count; /* reference count */ 56 atomic_t h_count; /* reference count */
56 struct semaphore h_sema; /* mutex for pmap binding */ 57 struct mutex h_mutex; /* mutex for pmap binding */
57 unsigned long h_nextrebind; /* next portmap call */ 58 unsigned long h_nextrebind; /* next portmap call */
58 unsigned long h_expires; /* eligible for GC */ 59 unsigned long h_expires; /* eligible for GC */
59 struct list_head h_lockowners; /* Lockowners for the client */ 60 struct list_head h_lockowners; /* Lockowners for the client */
@@ -122,7 +123,6 @@ struct nlm_block {
122 unsigned int b_id; /* block id */ 123 unsigned int b_id; /* block id */
123 unsigned char b_queued; /* re-queued */ 124 unsigned char b_queued; /* re-queued */
124 unsigned char b_granted; /* VFS granted lock */ 125 unsigned char b_granted; /* VFS granted lock */
125 unsigned char b_done; /* callback complete */
126 struct nlm_file * b_file; /* file in question */ 126 struct nlm_file * b_file; /* file in question */
127}; 127};
128 128
@@ -219,6 +219,7 @@ static __inline__ int
219nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2) 219nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2)
220{ 220{
221 return fl1->fl_pid == fl2->fl_pid 221 return fl1->fl_pid == fl2->fl_pid
222 && fl1->fl_owner == fl2->fl_owner
222 && fl1->fl_start == fl2->fl_start 223 && fl1->fl_start == fl2->fl_start
223 && fl1->fl_end == fl2->fl_end 224 && fl1->fl_end == fl2->fl_end
224 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 225 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
new file mode 100644
index 0000000000..1314ca0f29
--- /dev/null
+++ b/include/linux/lockdep.h
@@ -0,0 +1,353 @@
1/*
2 * Runtime locking correctness validator
3 *
4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 *
6 * see Documentation/lockdep-design.txt for more details.
7 */
8#ifndef __LINUX_LOCKDEP_H
9#define __LINUX_LOCKDEP_H
10
11#ifdef CONFIG_LOCKDEP
12
13#include <linux/linkage.h>
14#include <linux/list.h>
15#include <linux/debug_locks.h>
16#include <linux/stacktrace.h>
17
18/*
19 * Lock-class usage-state bits:
20 */
21enum lock_usage_bit
22{
23 LOCK_USED = 0,
24 LOCK_USED_IN_HARDIRQ,
25 LOCK_USED_IN_SOFTIRQ,
26 LOCK_ENABLED_SOFTIRQS,
27 LOCK_ENABLED_HARDIRQS,
28 LOCK_USED_IN_HARDIRQ_READ,
29 LOCK_USED_IN_SOFTIRQ_READ,
30 LOCK_ENABLED_SOFTIRQS_READ,
31 LOCK_ENABLED_HARDIRQS_READ,
32 LOCK_USAGE_STATES
33};
34
35/*
36 * Usage-state bitmasks:
37 */
38#define LOCKF_USED (1 << LOCK_USED)
39#define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ)
40#define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ)
41#define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS)
42#define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS)
43
44#define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS)
45#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
46
47#define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ)
48#define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ)
49#define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ)
50#define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ)
51
52#define LOCKF_ENABLED_IRQS_READ \
53 (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ)
54#define LOCKF_USED_IN_IRQ_READ \
55 (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
56
57#define MAX_LOCKDEP_SUBCLASSES 8UL
58
59/*
60 * Lock-classes are keyed via unique addresses, by embedding the
61 * lockclass-key into the kernel (or module) .data section. (For
62 * static locks we use the lock address itself as the key.)
63 */
64struct lockdep_subclass_key {
65 char __one_byte;
66} __attribute__ ((__packed__));
67
68struct lock_class_key {
69 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
70};
71
72/*
73 * The lock-class itself:
74 */
75struct lock_class {
76 /*
77 * class-hash:
78 */
79 struct list_head hash_entry;
80
81 /*
82 * global list of all lock-classes:
83 */
84 struct list_head lock_entry;
85
86 struct lockdep_subclass_key *key;
87 unsigned int subclass;
88
89 /*
90 * IRQ/softirq usage tracking bits:
91 */
92 unsigned long usage_mask;
93 struct stack_trace usage_traces[LOCK_USAGE_STATES];
94
95 /*
96 * These fields represent a directed graph of lock dependencies,
97 * to every node we attach a list of "forward" and a list of
98 * "backward" graph nodes.
99 */
100 struct list_head locks_after, locks_before;
101
102 /*
103 * Generation counter, when doing certain classes of graph walking,
104 * to ensure that we check one node only once:
105 */
106 unsigned int version;
107
108 /*
109 * Statistics counter:
110 */
111 unsigned long ops;
112
113 const char *name;
114 int name_version;
115};
116
117/*
118 * Map the lock object (the lock instance) to the lock-class object.
119 * This is embedded into specific lock instances:
120 */
121struct lockdep_map {
122 struct lock_class_key *key;
123 struct lock_class *class_cache;
124 const char *name;
125};
126
127/*
128 * Every lock has a list of other locks that were taken after it.
129 * We only grow the list, never remove from it:
130 */
131struct lock_list {
132 struct list_head entry;
133 struct lock_class *class;
134 struct stack_trace trace;
135};
136
137/*
138 * We record lock dependency chains, so that we can cache them:
139 */
140struct lock_chain {
141 struct list_head entry;
142 u64 chain_key;
143};
144
145struct held_lock {
146 /*
147 * One-way hash of the dependency chain up to this point. We
148 * hash the hashes step by step as the dependency chain grows.
149 *
150 * We use it for dependency-caching and we skip detection
151 * passes and dependency-updates if there is a cache-hit, so
152 * it is absolutely critical for 100% coverage of the validator
153 * to have a unique key value for every unique dependency path
154 * that can occur in the system, to make a unique hash value
155 * as likely as possible - hence the 64-bit width.
156 *
157 * The task struct holds the current hash value (initialized
158 * with zero), here we store the previous hash value:
159 */
160 u64 prev_chain_key;
161 struct lock_class *class;
162 unsigned long acquire_ip;
163 struct lockdep_map *instance;
164
165 /*
166 * The lock-stack is unified in that the lock chains of interrupt
167 * contexts nest ontop of process context chains, but we 'separate'
168 * the hashes by starting with 0 if we cross into an interrupt
169 * context, and we also keep do not add cross-context lock
170 * dependencies - the lock usage graph walking covers that area
171 * anyway, and we'd just unnecessarily increase the number of
172 * dependencies otherwise. [Note: hardirq and softirq contexts
173 * are separated from each other too.]
174 *
175 * The following field is used to detect when we cross into an
176 * interrupt context:
177 */
178 int irq_context;
179 int trylock;
180 int read;
181 int check;
182 int hardirqs_off;
183};
184
185/*
186 * Initialization, self-test and debugging-output methods:
187 */
188extern void lockdep_init(void);
189extern void lockdep_info(void);
190extern void lockdep_reset(void);
191extern void lockdep_reset_lock(struct lockdep_map *lock);
192extern void lockdep_free_key_range(void *start, unsigned long size);
193
194extern void lockdep_off(void);
195extern void lockdep_on(void);
196extern int lockdep_internal(void);
197
198/*
199 * These methods are used by specific locking variants (spinlocks,
200 * rwlocks, mutexes and rwsems) to pass init/acquire/release events
201 * to lockdep:
202 */
203
204extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
205 struct lock_class_key *key);
206
207/*
208 * Reinitialize a lock key - for cases where there is special locking or
209 * special initialization of locks so that the validator gets the scope
210 * of dependencies wrong: they are either too broad (they need a class-split)
211 * or they are too narrow (they suffer from a false class-split):
212 */
213#define lockdep_set_class(lock, key) \
214 lockdep_init_map(&(lock)->dep_map, #key, key)
215#define lockdep_set_class_and_name(lock, key, name) \
216 lockdep_init_map(&(lock)->dep_map, name, key)
217
218/*
219 * Acquire a lock.
220 *
221 * Values for "read":
222 *
223 * 0: exclusive (write) acquire
224 * 1: read-acquire (no recursion allowed)
225 * 2: read-acquire with same-instance recursion allowed
226 *
227 * Values for check:
228 *
229 * 0: disabled
230 * 1: simple checks (freeing, held-at-exit-time, etc.)
231 * 2: full validation
232 */
233extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
234 int trylock, int read, int check, unsigned long ip);
235
236extern void lock_release(struct lockdep_map *lock, int nested,
237 unsigned long ip);
238
239# define INIT_LOCKDEP .lockdep_recursion = 0,
240
241#else /* !LOCKDEP */
242
243static inline void lockdep_off(void)
244{
245}
246
247static inline void lockdep_on(void)
248{
249}
250
251static inline int lockdep_internal(void)
252{
253 return 0;
254}
255
256# define lock_acquire(l, s, t, r, c, i) do { } while (0)
257# define lock_release(l, n, i) do { } while (0)
258# define lockdep_init() do { } while (0)
259# define lockdep_info() do { } while (0)
260# define lockdep_init_map(lock, name, key) do { (void)(key); } while (0)
261# define lockdep_set_class(lock, key) do { (void)(key); } while (0)
262# define lockdep_set_class_and_name(lock, key, name) \
263 do { (void)(key); } while (0)
264# define INIT_LOCKDEP
265# define lockdep_reset() do { debug_locks = 1; } while (0)
266# define lockdep_free_key_range(start, size) do { } while (0)
267/*
268 * The class key takes no space if lockdep is disabled:
269 */
270struct lock_class_key { };
271#endif /* !LOCKDEP */
272
273#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS)
274extern void early_init_irq_lock_class(void);
275#else
276# define early_init_irq_lock_class() do { } while (0)
277#endif
278
279#ifdef CONFIG_TRACE_IRQFLAGS
280extern void early_boot_irqs_off(void);
281extern void early_boot_irqs_on(void);
282#else
283# define early_boot_irqs_off() do { } while (0)
284# define early_boot_irqs_on() do { } while (0)
285#endif
286
287/*
288 * For trivial one-depth nesting of a lock-class, the following
289 * global define can be used. (Subsystems with multiple levels
290 * of nesting should define their own lock-nesting subclasses.)
291 */
292#define SINGLE_DEPTH_NESTING 1
293
294/*
295 * Map the dependency ops to NOP or to real lockdep ops, depending
296 * on the per lock-class debug mode:
297 */
298
299#ifdef CONFIG_DEBUG_LOCK_ALLOC
300# ifdef CONFIG_PROVE_LOCKING
301# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
302# else
303# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
304# endif
305# define spin_release(l, n, i) lock_release(l, n, i)
306#else
307# define spin_acquire(l, s, t, i) do { } while (0)
308# define spin_release(l, n, i) do { } while (0)
309#endif
310
311#ifdef CONFIG_DEBUG_LOCK_ALLOC
312# ifdef CONFIG_PROVE_LOCKING
313# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
314# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, i)
315# else
316# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
317# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, i)
318# endif
319# define rwlock_release(l, n, i) lock_release(l, n, i)
320#else
321# define rwlock_acquire(l, s, t, i) do { } while (0)
322# define rwlock_acquire_read(l, s, t, i) do { } while (0)
323# define rwlock_release(l, n, i) do { } while (0)
324#endif
325
326#ifdef CONFIG_DEBUG_LOCK_ALLOC
327# ifdef CONFIG_PROVE_LOCKING
328# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
329# else
330# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
331# endif
332# define mutex_release(l, n, i) lock_release(l, n, i)
333#else
334# define mutex_acquire(l, s, t, i) do { } while (0)
335# define mutex_release(l, n, i) do { } while (0)
336#endif
337
338#ifdef CONFIG_DEBUG_LOCK_ALLOC
339# ifdef CONFIG_PROVE_LOCKING
340# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
341# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, i)
342# else
343# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
344# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, i)
345# endif
346# define rwsem_release(l, n, i) lock_release(l, n, i)
347#else
348# define rwsem_acquire(l, s, t, i) do { } while (0)
349# define rwsem_acquire_read(l, s, t, i) do { } while (0)
350# define rwsem_release(l, n, i) do { } while (0)
351#endif
352
353#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index e76c7611d6..191a595055 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/magic.h b/include/linux/magic.h
new file mode 100644
index 0000000000..22036dd2ba
--- /dev/null
+++ b/include/linux/magic.h
@@ -0,0 +1,37 @@
1#ifndef __LINUX_MAGIC_H__
2#define __LINUX_MAGIC_H__
3
4#define ADFS_SUPER_MAGIC 0xadf5
5#define AFFS_SUPER_MAGIC 0xadff
6#define AUTOFS_SUPER_MAGIC 0x0187
7#define CODA_SUPER_MAGIC 0x73757245
8#define EFS_SUPER_MAGIC 0x414A53
9#define EXT2_SUPER_MAGIC 0xEF53
10#define EXT3_SUPER_MAGIC 0xEF53
11#define HPFS_SUPER_MAGIC 0xf995e849
12#define ISOFS_SUPER_MAGIC 0x9660
13#define JFFS2_SUPER_MAGIC 0x72b6
14
15#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
16#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
17#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
18#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
19
20#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
21#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */
22#define NFS_SUPER_MAGIC 0x6969
23#define OPENPROM_SUPER_MAGIC 0x9fa1
24#define PROC_SUPER_MAGIC 0x9fa0
25#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
26
27#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
28 /* used by file system utilities that
29 look at the superblock, etc. */
30#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
31#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
32#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
33
34#define SMB_SUPER_MAGIC 0x517B
35#define USBDEVICE_SUPER_MAGIC 0x9fa2
36
37#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index bbc93ae217..432b2fa249 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -89,4 +89,11 @@ extern spinlock_t rtc_lock; /* serialize CMOS RAM access */
89# define RTC_VRT 0x80 /* valid RAM and time */ 89# define RTC_VRT 0x80 /* valid RAM and time */
90/**********************************************************************/ 90/**********************************************************************/
91 91
92#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */
93
94#define RTC_IO_EXTENT 0x8
95#define RTC_IOMAPPED 1 /* Default to I/O mapping. */
96
97#endif /* ARCH_RTC_LOCATION */
98
92#endif /* _MC146818RTC_H */ 99#endif /* _MC146818RTC_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 9112063861..218501cfae 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -63,6 +63,76 @@ extern int online_pages(unsigned long, unsigned long);
63/* reasonably generic interface to expand the physical pages in a zone */ 63/* reasonably generic interface to expand the physical pages in a zone */
64extern int __add_pages(struct zone *zone, unsigned long start_pfn, 64extern int __add_pages(struct zone *zone, unsigned long start_pfn,
65 unsigned long nr_pages); 65 unsigned long nr_pages);
66
67#ifdef CONFIG_NUMA
68extern int memory_add_physaddr_to_nid(u64 start);
69#else
70static inline int memory_add_physaddr_to_nid(u64 start)
71{
72 return 0;
73}
74#endif
75
76#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION
77/*
78 * For supporting node-hotadd, we have to allocate a new pgdat.
79 *
80 * If an arch has generic style NODE_DATA(),
81 * node_data[nid] = kzalloc() works well. But it depends on the architecture.
82 *
83 * In general, generic_alloc_nodedata() is used.
84 * Now, arch_free_nodedata() is just defined for error path of node_hot_add.
85 *
86 */
87extern pg_data_t *arch_alloc_nodedata(int nid);
88extern void arch_free_nodedata(pg_data_t *pgdat);
89extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat);
90
91#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
92
93#define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid)
94#define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat)
95
96#ifdef CONFIG_NUMA
97/*
98 * If ARCH_HAS_NODEDATA_EXTENSION=n, this func is used to allocate pgdat.
99 * XXX: kmalloc_node() can't work well to get new node's memory at this time.
100 * Because, pgdat for the new node is not allocated/initialized yet itself.
101 * To use new node's memory, more consideration will be necessary.
102 */
103#define generic_alloc_nodedata(nid) \
104({ \
105 kzalloc(sizeof(pg_data_t), GFP_KERNEL); \
106})
107/*
108 * This definition is just for error path in node hotadd.
109 * For node hotremove, we have to replace this.
110 */
111#define generic_free_nodedata(pgdat) kfree(pgdat)
112
113extern pg_data_t *node_data[];
114static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
115{
116 node_data[nid] = pgdat;
117}
118
119#else /* !CONFIG_NUMA */
120
121/* never called */
122static inline pg_data_t *generic_alloc_nodedata(int nid)
123{
124 BUG();
125 return NULL;
126}
127static inline void generic_free_nodedata(pg_data_t *pgdat)
128{
129}
130static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
131{
132}
133#endif /* CONFIG_NUMA */
134#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
135
66#else /* ! CONFIG_MEMORY_HOTPLUG */ 136#else /* ! CONFIG_MEMORY_HOTPLUG */
67/* 137/*
68 * Stub functions for when hotplug is off 138 * Stub functions for when hotplug is off
@@ -99,7 +169,8 @@ static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
99 return -ENOSYS; 169 return -ENOSYS;
100} 170}
101 171
102extern int add_memory(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);
103extern int remove_memory(u64 start, u64 size); 174extern int remove_memory(u64 start, u64 size);
104 175
105#endif /* __LINUX_MEMORY_HOTPLUG_H */ 176#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 72440f0a44..09f0f575dd 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -162,9 +162,9 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
162 unsigned long addr); 162 unsigned long addr);
163extern unsigned slab_node(struct mempolicy *policy); 163extern unsigned slab_node(struct mempolicy *policy);
164 164
165extern int policy_zone; 165extern enum zone_type policy_zone;
166 166
167static inline void check_highest_zone(int k) 167static inline void check_highest_zone(enum zone_type k)
168{ 168{
169 if (k > policy_zone) 169 if (k > policy_zone)
170 policy_zone = k; 170 policy_zone = k;
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 5dba23a1c0..48148e0cdb 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -16,7 +16,9 @@ extern int fail_migrate_page(struct address_space *,
16 struct page *, struct page *); 16 struct page *, struct page *);
17 17
18extern int migrate_prep(void); 18extern int migrate_prep(void);
19 19extern int migrate_vmas(struct mm_struct *mm,
20 const nodemask_t *from, const nodemask_t *to,
21 unsigned long flags);
20#else 22#else
21 23
22static inline int isolate_lru_page(struct page *p, struct list_head *list) 24static inline int isolate_lru_page(struct page *p, struct list_head *list)
@@ -30,6 +32,13 @@ static inline int migrate_pages_to(struct list_head *pagelist,
30 32
31static inline int migrate_prep(void) { return -ENOSYS; } 33static inline int migrate_prep(void) { return -ENOSYS; }
32 34
35static inline int migrate_vmas(struct mm_struct *mm,
36 const nodemask_t *from, const nodemask_t *to,
37 unsigned long flags)
38{
39 return -ENOSYS;
40}
41
33/* Possible settings for the migrate_page() method in address_operations */ 42/* Possible settings for the migrate_page() method in address_operations */
34#define migrate_page NULL 43#define migrate_page NULL
35#define fail_migrate_page NULL 44#define fail_migrate_page NULL
diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h
index 1ecc3cc8ce..916e8f72c6 100644
--- a/include/linux/minix_fs.h
+++ b/include/linux/minix_fs.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_MINIX_FS_H 1#ifndef _LINUX_MINIX_FS_H
2#define _LINUX_MINIX_FS_H 2#define _LINUX_MINIX_FS_H
3 3
4#include <linux/magic.h>
5
4/* 6/*
5 * The minix filesystem constants/structures 7 * The minix filesystem constants/structures
6 */ 8 */
@@ -19,10 +21,6 @@
19 21
20#define MINIX_I_MAP_SLOTS 8 22#define MINIX_I_MAP_SLOTS 8
21#define MINIX_Z_MAP_SLOTS 64 23#define MINIX_Z_MAP_SLOTS 64
22#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
23#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
24#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
25#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
26#define MINIX_VALID_FS 0x0001 /* Clean fs. */ 24#define MINIX_VALID_FS 0x0001 /* Clean fs. */
27#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ 25#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
28 26
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 5b584dafb5..b03cfb91e2 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -40,7 +40,6 @@ struct miscdevice {
40 struct list_head list; 40 struct list_head list;
41 struct device *dev; 41 struct device *dev;
42 struct class_device *class; 42 struct class_device *class;
43 char devfs_name[64];
44}; 43};
45 44
46extern int misc_register(struct miscdevice * misc); 45extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3b09444121..7b703b6d43 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -14,6 +14,9 @@
14#include <linux/prio_tree.h> 14#include <linux/prio_tree.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/debug_locks.h>
18#include <linux/backing-dev.h>
19#include <linux/mm_types.h>
17 20
18struct mempolicy; 21struct mempolicy;
19struct anon_vma; 22struct anon_vma;
@@ -36,7 +39,6 @@ extern int sysctl_legacy_va_layout;
36#include <asm/page.h> 39#include <asm/page.h>
37#include <asm/pgtable.h> 40#include <asm/pgtable.h>
38#include <asm/processor.h> 41#include <asm/processor.h>
39#include <asm/atomic.h>
40 42
41#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) 43#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
42 44
@@ -145,7 +147,6 @@ extern unsigned int kobjsize(const void *objp);
145 147
146#define VM_GROWSDOWN 0x00000100 /* general info on the segment */ 148#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
147#define VM_GROWSUP 0x00000200 149#define VM_GROWSUP 0x00000200
148#define VM_SHM 0x00000000 /* Means nothing: delete it later */
149#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 150#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
150#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 151#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
151 152
@@ -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
@@ -207,67 +209,14 @@ struct vm_operations_struct {
207 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 209 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
208 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 210 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
209 unsigned long addr); 211 unsigned long addr);
212 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
213 const nodemask_t *to, unsigned long flags);
210#endif 214#endif
211}; 215};
212 216
213struct mmu_gather; 217struct mmu_gather;
214struct inode; 218struct inode;
215 219
216/*
217 * Each physical page in the system has a struct page associated with
218 * it to keep track of whatever it is we are using the page for at the
219 * moment. Note that we have no way to track which tasks are using
220 * a page.
221 */
222struct page {
223 unsigned long flags; /* Atomic flags, some possibly
224 * updated asynchronously */
225 atomic_t _count; /* Usage count, see below. */
226 atomic_t _mapcount; /* Count of ptes mapped in mms,
227 * to show when page is mapped
228 * & limit reverse map searches.
229 */
230 union {
231 struct {
232 unsigned long private; /* Mapping-private opaque data:
233 * usually used for buffer_heads
234 * if PagePrivate set; used for
235 * swp_entry_t if PageSwapCache;
236 * indicates order in the buddy
237 * system if PG_buddy is set.
238 */
239 struct address_space *mapping; /* If low bit clear, points to
240 * inode address_space, or NULL.
241 * If page mapped as anonymous
242 * memory, low bit is set, and
243 * it points to anon_vma object:
244 * see PAGE_MAPPING_ANON below.
245 */
246 };
247#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
248 spinlock_t ptl;
249#endif
250 };
251 pgoff_t index; /* Our offset within mapping. */
252 struct list_head lru; /* Pageout list, eg. active_list
253 * protected by zone->lru_lock !
254 */
255 /*
256 * On machines where all RAM is mapped into kernel address space,
257 * we can simply calculate the virtual address. On machines with
258 * highmem some memory is mapped into kernel virtual memory
259 * dynamically, so we need a place to store that address.
260 * Note that this field could be 16 bits on x86 ... ;)
261 *
262 * Architectures with slow multiplication can define
263 * WANT_PAGE_VIRTUAL in asm/page.h
264 */
265#if defined(WANT_PAGE_VIRTUAL)
266 void *virtual; /* Kernel virtual address (NULL if
267 not kmapped, ie. highmem) */
268#endif /* WANT_PAGE_VIRTUAL */
269};
270
271#define page_private(page) ((page)->private) 220#define page_private(page) ((page)->private)
272#define set_page_private(page, v) ((page)->private = (v)) 221#define set_page_private(page, v) ((page)->private = (v))
273 222
@@ -277,6 +226,12 @@ struct page {
277 */ 226 */
278#include <linux/page-flags.h> 227#include <linux/page-flags.h>
279 228
229#ifdef CONFIG_DEBUG_VM
230#define VM_BUG_ON(cond) BUG_ON(cond)
231#else
232#define VM_BUG_ON(condition) do { } while(0)
233#endif
234
280/* 235/*
281 * Methods to modify the page usage count. 236 * Methods to modify the page usage count.
282 * 237 *
@@ -291,12 +246,11 @@ struct page {
291 */ 246 */
292 247
293/* 248/*
294 * Drop a ref, return true if the logical refcount fell to zero (the page has 249 * Drop a ref, return true if the refcount fell to zero (the page has no users)
295 * no users)
296 */ 250 */
297static inline int put_page_testzero(struct page *page) 251static inline int put_page_testzero(struct page *page)
298{ 252{
299 BUG_ON(atomic_read(&page->_count) == 0); 253 VM_BUG_ON(atomic_read(&page->_count) == 0);
300 return atomic_dec_and_test(&page->_count); 254 return atomic_dec_and_test(&page->_count);
301} 255}
302 256
@@ -306,11 +260,10 @@ static inline int put_page_testzero(struct page *page)
306 */ 260 */
307static inline int get_page_unless_zero(struct page *page) 261static inline int get_page_unless_zero(struct page *page)
308{ 262{
263 VM_BUG_ON(PageCompound(page));
309 return atomic_inc_not_zero(&page->_count); 264 return atomic_inc_not_zero(&page->_count);
310} 265}
311 266
312extern void FASTCALL(__page_cache_release(struct page *));
313
314static inline int page_count(struct page *page) 267static inline int page_count(struct page *page)
315{ 268{
316 if (unlikely(PageCompound(page))) 269 if (unlikely(PageCompound(page)))
@@ -322,6 +275,7 @@ static inline void get_page(struct page *page)
322{ 275{
323 if (unlikely(PageCompound(page))) 276 if (unlikely(PageCompound(page)))
324 page = (struct page *)page_private(page); 277 page = (struct page *)page_private(page);
278 VM_BUG_ON(atomic_read(&page->_count) == 0);
325 atomic_inc(&page->_count); 279 atomic_inc(&page->_count);
326} 280}
327 281
@@ -335,6 +289,7 @@ static inline void init_page_count(struct page *page)
335} 289}
336 290
337void put_page(struct page *page); 291void put_page(struct page *page);
292void put_pages_list(struct list_head *pages);
338 293
339void split_page(struct page *page, unsigned int order); 294void split_page(struct page *page, unsigned int order);
340 295
@@ -347,43 +302,55 @@ void split_page(struct page *page, unsigned int order);
347 * For the non-reserved pages, page_count(page) denotes a reference count. 302 * For the non-reserved pages, page_count(page) denotes a reference count.
348 * page_count() == 0 means the page is free. page->lru is then used for 303 * page_count() == 0 means the page is free. page->lru is then used for
349 * freelist management in the buddy allocator. 304 * freelist management in the buddy allocator.
350 * page_count() == 1 means the page is used for exactly one purpose 305 * page_count() > 0 means the page has been allocated.
351 * (e.g. a private data page of one process). 306 *
307 * Pages are allocated by the slab allocator in order to provide memory
308 * to kmalloc and kmem_cache_alloc. In this case, the management of the
309 * page, and the fields in 'struct page' are the responsibility of mm/slab.c
310 * unless a particular usage is carefully commented. (the responsibility of
311 * freeing the kmalloc memory is the caller's, of course).
352 * 312 *
353 * A page may be used for kmalloc() or anyone else who does a 313 * A page may be used by anyone else who does a __get_free_page().
354 * __get_free_page(). In this case the page_count() is at least 1, and 314 * In this case, page_count still tracks the references, and should only
355 * all other fields are unused but should be 0 or NULL. The 315 * be used through the normal accessor functions. The top bits of page->flags
356 * management of this page is the responsibility of the one who uses 316 * and page->virtual store page management information, but all other fields
357 * it. 317 * are unused and could be used privately, carefully. The management of this
318 * page is the responsibility of the one who allocated it, and those who have
319 * subsequently been given references to it.
358 * 320 *
359 * The other pages (we may call them "process pages") are completely 321 * The other pages (we may call them "pagecache pages") are completely
360 * managed by the Linux memory manager: I/O, buffers, swapping etc. 322 * managed by the Linux memory manager: I/O, buffers, swapping etc.
361 * The following discussion applies only to them. 323 * The following discussion applies only to them.
362 * 324 *
363 * A page may belong to an inode's memory mapping. In this case, 325 * A pagecache page contains an opaque `private' member, which belongs to the
364 * page->mapping is the pointer to the inode, and page->index is the 326 * page's address_space. Usually, this is the address of a circular list of
365 * file offset of the page, in units of PAGE_CACHE_SIZE. 327 * the page's disk buffers. PG_private must be set to tell the VM to call
328 * into the filesystem to release these pages.
366 * 329 *
367 * A page contains an opaque `private' member, which belongs to the 330 * A page may belong to an inode's memory mapping. In this case, page->mapping
368 * page's address_space. Usually, this is the address of a circular 331 * is the pointer to the inode, and page->index is the file offset of the page,
369 * list of the page's disk buffers. 332 * in units of PAGE_CACHE_SIZE.
370 * 333 *
371 * For pages belonging to inodes, the page_count() is the number of 334 * If pagecache pages are not associated with an inode, they are said to be
372 * attaches, plus 1 if `private' contains something, plus one for 335 * anonymous pages. These may become associated with the swapcache, and in that
373 * the page cache itself. 336 * case PG_swapcache is set, and page->private is an offset into the swapcache.
374 * 337 *
375 * Instead of keeping dirty/clean pages in per address-space lists, we instead 338 * In either case (swapcache or inode backed), the pagecache itself holds one
376 * now tag pages as dirty/under writeback in the radix tree. 339 * reference to the page. Setting PG_private should also increment the
340 * refcount. The each user mapping also has a reference to the page.
377 * 341 *
378 * There is also a per-mapping radix tree mapping index to the page 342 * The pagecache pages are stored in a per-mapping radix tree, which is
379 * in memory if present. The tree is rooted at mapping->root. 343 * rooted at mapping->page_tree, and indexed by offset.
344 * Where 2.4 and early 2.6 kernels kept dirty/clean pages in per-address_space
345 * lists, we instead now tag pages as dirty/writeback in the radix tree.
380 * 346 *
381 * All process pages can do I/O: 347 * All pagecache pages may be subject to I/O:
382 * - inode pages may need to be read from disk, 348 * - inode pages may need to be read from disk,
383 * - inode pages which have been modified and are MAP_SHARED may need 349 * - inode pages which have been modified and are MAP_SHARED may need
384 * to be written to disk, 350 * to be written back to the inode on disk,
385 * - private pages which have been modified may need to be swapped out 351 * - anonymous pages (including MAP_PRIVATE file mappings) which have been
386 * to swap space and (later) to be read back into memory. 352 * modified may need to be swapped out to swap space and (later) to be read
353 * back into memory.
387 */ 354 */
388 355
389/* 356/*
@@ -461,7 +428,7 @@ void split_page(struct page *page, unsigned int order);
461#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 428#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
462#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) 429#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1)
463 430
464static inline unsigned long page_zonenum(struct page *page) 431static inline enum zone_type page_zonenum(struct page *page)
465{ 432{
466 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 433 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
467} 434}
@@ -478,23 +445,33 @@ static inline struct zone *page_zone(struct page *page)
478 return zone_table[page_zone_id(page)]; 445 return zone_table[page_zone_id(page)];
479} 446}
480 447
448static inline unsigned long zone_to_nid(struct zone *zone)
449{
450#ifdef CONFIG_NUMA
451 return zone->node;
452#else
453 return 0;
454#endif
455}
456
481static inline unsigned long page_to_nid(struct page *page) 457static inline unsigned long page_to_nid(struct page *page)
482{ 458{
483 if (FLAGS_HAS_NODE) 459 if (FLAGS_HAS_NODE)
484 return (page->flags >> NODES_PGSHIFT) & NODES_MASK; 460 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
485 else 461 else
486 return page_zone(page)->zone_pgdat->node_id; 462 return zone_to_nid(page_zone(page));
487} 463}
488static inline unsigned long page_to_section(struct page *page) 464static inline unsigned long page_to_section(struct page *page)
489{ 465{
490 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 466 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
491} 467}
492 468
493static inline void set_page_zone(struct page *page, unsigned long zone) 469static inline void set_page_zone(struct page *page, enum zone_type zone)
494{ 470{
495 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); 471 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
496 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; 472 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
497} 473}
474
498static inline void set_page_node(struct page *page, unsigned long node) 475static inline void set_page_node(struct page *page, unsigned long node)
499{ 476{
500 page->flags &= ~(NODES_MASK << NODES_PGSHIFT); 477 page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
@@ -506,7 +483,7 @@ static inline void set_page_section(struct page *page, unsigned long section)
506 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; 483 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
507} 484}
508 485
509static inline void set_page_links(struct page *page, unsigned long zone, 486static inline void set_page_links(struct page *page, enum zone_type zone,
510 unsigned long node, unsigned long pfn) 487 unsigned long node, unsigned long pfn)
511{ 488{
512 set_page_zone(page, zone); 489 set_page_zone(page, zone);
@@ -514,10 +491,10 @@ static inline void set_page_links(struct page *page, unsigned long zone,
514 set_page_section(page, pfn_to_section_nr(pfn)); 491 set_page_section(page, pfn_to_section_nr(pfn));
515} 492}
516 493
517#ifndef CONFIG_DISCONTIGMEM 494/*
518/* The array of struct pages - for discontigmem use pgdat->lmem_map */ 495 * Some inline functions in vmstat.h depend on page_zone()
519extern struct page *mem_map; 496 */
520#endif 497#include <linux/vmstat.h>
521 498
522static __always_inline void *lowmem_page_address(struct page *page) 499static __always_inline void *lowmem_page_address(struct page *page)
523{ 500{
@@ -618,6 +595,12 @@ static inline int page_mapped(struct page *page)
618#define NOPAGE_OOM ((struct page *) (-1)) 595#define NOPAGE_OOM ((struct page *) (-1))
619 596
620/* 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/*
621 * Different kinds of faults, as returned by handle_mm_fault(). 604 * Different kinds of faults, as returned by handle_mm_fault().
622 * Used to decide whether a process gets delivered SIGBUS or 605 * Used to decide whether a process gets delivered SIGBUS or
623 * just gets major/minor fault counters bumped up. 606 * just gets major/minor fault counters bumped up.
@@ -795,6 +778,39 @@ struct shrinker;
795extern struct shrinker *set_shrinker(int, shrinker_t); 778extern struct shrinker *set_shrinker(int, shrinker_t);
796extern void remove_shrinker(struct shrinker *shrinker); 779extern void remove_shrinker(struct shrinker *shrinker);
797 780
781/*
782 * Some shared mappigns will want the pages marked read-only
783 * to track write events. If so, we'll downgrade vm_page_prot
784 * to the private version (using protection_map[] without the
785 * VM_SHARED bit).
786 */
787static inline int vma_wants_writenotify(struct vm_area_struct *vma)
788{
789 unsigned int vm_flags = vma->vm_flags;
790
791 /* If it was private or non-writable, the write bit is already clear */
792 if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
793 return 0;
794
795 /* The backer wishes to know when pages are first written to? */
796 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
797 return 1;
798
799 /* The open routine did something to the protections already? */
800 if (pgprot_val(vma->vm_page_prot) !=
801 pgprot_val(protection_map[vm_flags &
802 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
803 return 0;
804
805 /* Specialty mapping? */
806 if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
807 return 0;
808
809 /* Can the mapping track the dirty pages? */
810 return vma->vm_file && vma->vm_file->f_mapping &&
811 mapping_cap_account_dirty(vma->vm_file->f_mapping);
812}
813
798extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); 814extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
799 815
800int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); 816int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
@@ -872,6 +888,56 @@ extern void free_area_init(unsigned long * zones_size);
872extern void free_area_init_node(int nid, pg_data_t *pgdat, 888extern void free_area_init_node(int nid, pg_data_t *pgdat,
873 unsigned long * zones_size, unsigned long zone_start_pfn, 889 unsigned long * zones_size, unsigned long zone_start_pfn,
874 unsigned long *zholes_size); 890 unsigned long *zholes_size);
891#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
892/*
893 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
894 * zones, allocate the backing mem_map and account for memory holes in a more
895 * architecture independent manner. This is a substitute for creating the
896 * zone_sizes[] and zholes_size[] arrays and passing them to
897 * free_area_init_node()
898 *
899 * An architecture is expected to register range of page frames backed by
900 * physical memory with add_active_range() before calling
901 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
902 * usage, an architecture is expected to do something like
903 *
904 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
905 * max_highmem_pfn};
906 * for_each_valid_physical_page_range()
907 * add_active_range(node_id, start_pfn, end_pfn)
908 * free_area_init_nodes(max_zone_pfns);
909 *
910 * If the architecture guarantees that there are no holes in the ranges
911 * registered with add_active_range(), free_bootmem_active_regions()
912 * will call free_bootmem_node() for each registered physical page range.
913 * Similarly sparse_memory_present_with_active_regions() calls
914 * memory_present() for each range when SPARSEMEM is enabled.
915 *
916 * See mm/page_alloc.c for more information on each function exposed by
917 * CONFIG_ARCH_POPULATES_NODE_MAP
918 */
919extern void free_area_init_nodes(unsigned long *max_zone_pfn);
920extern void add_active_range(unsigned int nid, unsigned long start_pfn,
921 unsigned long end_pfn);
922extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
923 unsigned long new_end_pfn);
924extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
925 unsigned long end_pfn);
926extern void remove_all_active_ranges(void);
927extern unsigned long absent_pages_in_range(unsigned long start_pfn,
928 unsigned long end_pfn);
929extern void get_pfn_range_for_nid(unsigned int nid,
930 unsigned long *start_pfn, unsigned long *end_pfn);
931extern unsigned long find_min_pfn_with_active_regions(void);
932extern unsigned long find_max_pfn_with_active_regions(void);
933extern void free_bootmem_with_active_regions(int nid,
934 unsigned long max_low_pfn);
935extern void sparse_memory_present_with_active_regions(int nid);
936#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
937extern int early_pfn_to_nid(unsigned long pfn);
938#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
939#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
940extern void set_dma_reserve(unsigned long new_dma_reserve);
875extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); 941extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
876extern void setup_per_zone_pages_min(void); 942extern void setup_per_zone_pages_min(void);
877extern void mem_init(void); 943extern void mem_init(void);
@@ -1006,6 +1072,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1006 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1072 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1007} 1073}
1008 1074
1075pgprot_t vm_get_page_prot(unsigned long vm_flags);
1009struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); 1076struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
1010struct page *vmalloc_to_page(void *addr); 1077struct page *vmalloc_to_page(void *addr);
1011unsigned long vmalloc_to_pfn(void *addr); 1078unsigned long vmalloc_to_pfn(void *addr);
@@ -1034,8 +1101,8 @@ static inline void
1034kernel_map_pages(struct page *page, int numpages, int enable) 1101kernel_map_pages(struct page *page, int numpages, int enable)
1035{ 1102{
1036 if (!PageHighMem(page) && !enable) 1103 if (!PageHighMem(page) && !enable)
1037 mutex_debug_check_no_locks_freed(page_address(page), 1104 debug_check_no_locks_freed(page_address(page),
1038 numpages * PAGE_SIZE); 1105 numpages * PAGE_SIZE);
1039} 1106}
1040#endif 1107#endif
1041 1108
@@ -1064,5 +1131,7 @@ void drop_slab(void);
1064extern int randomize_va_space; 1131extern int randomize_va_space;
1065#endif 1132#endif
1066 1133
1134__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma);
1135
1067#endif /* __KERNEL__ */ 1136#endif /* __KERNEL__ */
1068#endif /* _LINUX_MM_H */ 1137#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
new file mode 100644
index 0000000000..c3852fd4a1
--- /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 c1f021eddf..587264a58d 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -77,7 +77,7 @@ struct mmc_host {
77 struct device *dev; 77 struct device *dev;
78 struct class_device class_dev; 78 struct class_device class_dev;
79 int index; 79 int index;
80 struct mmc_host_ops *ops; 80 const struct mmc_host_ops *ops;
81 unsigned int f_min; 81 unsigned int f_min;
82 unsigned int f_max; 82 unsigned int f_max;
83 u32 ocr_avail; 83 u32 ocr_avail;
@@ -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 03a14a30c4..a3594dfd69 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 */
@@ -105,6 +104,8 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
105extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int, 104extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int,
106 struct mmc_command *, int); 105 struct mmc_command *, int);
107 106
107extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int);
108
108extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card); 109extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card);
109 110
110static inline void mmc_claim_host(struct mmc_host *host) 111static inline void mmc_claim_host(struct mmc_host *host)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index d6120fa691..59855b8718 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -46,6 +46,29 @@ struct zone_padding {
46#define ZONE_PADDING(name) 46#define ZONE_PADDING(name)
47#endif 47#endif
48 48
49enum zone_stat_item {
50 NR_ANON_PAGES, /* Mapped anonymous pages */
51 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
52 only modified from process context */
53 NR_FILE_PAGES,
54 NR_SLAB_RECLAIMABLE,
55 NR_SLAB_UNRECLAIMABLE,
56 NR_PAGETABLE, /* used for pagetables */
57 NR_FILE_DIRTY,
58 NR_WRITEBACK,
59 NR_UNSTABLE_NFS, /* NFS unstable pages */
60 NR_BOUNCE,
61 NR_VMSCAN_WRITE,
62#ifdef CONFIG_NUMA
63 NUMA_HIT, /* allocated in intended node */
64 NUMA_MISS, /* allocated in non intended node */
65 NUMA_FOREIGN, /* was intended here, hit elsewhere */
66 NUMA_INTERLEAVE_HIT, /* interleaver preferred this zone */
67 NUMA_LOCAL, /* allocation from local node */
68 NUMA_OTHER, /* allocation from other node */
69#endif
70 NR_VM_ZONE_STAT_ITEMS };
71
49struct per_cpu_pages { 72struct per_cpu_pages {
50 int count; /* number of pages in the list */ 73 int count; /* number of pages in the list */
51 int high; /* high watermark, emptying needed */ 74 int high; /* high watermark, emptying needed */
@@ -55,13 +78,9 @@ struct per_cpu_pages {
55 78
56struct per_cpu_pageset { 79struct per_cpu_pageset {
57 struct per_cpu_pages pcp[2]; /* 0: hot. 1: cold */ 80 struct per_cpu_pages pcp[2]; /* 0: hot. 1: cold */
58#ifdef CONFIG_NUMA 81#ifdef CONFIG_SMP
59 unsigned long numa_hit; /* allocated in intended node */ 82 s8 stat_threshold;
60 unsigned long numa_miss; /* allocated in non intended node */ 83 s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS];
61 unsigned long numa_foreign; /* was intended here, hit elsewhere */
62 unsigned long interleave_hit; /* interleaver prefered this zone */
63 unsigned long local_node; /* allocation from local node */
64 unsigned long other_node; /* allocation from other node */
65#endif 84#endif
66} ____cacheline_aligned_in_smp; 85} ____cacheline_aligned_in_smp;
67 86
@@ -71,53 +90,68 @@ struct per_cpu_pageset {
71#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) 90#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
72#endif 91#endif
73 92
74#define ZONE_DMA 0 93enum zone_type {
75#define ZONE_DMA32 1 94 /*
76#define ZONE_NORMAL 2 95 * ZONE_DMA is used when there are devices that are not able
77#define ZONE_HIGHMEM 3 96 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
78 97 * carve out the portion of memory that is needed for these devices.
79#define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */ 98 * The range is arch specific.
80#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ 99 *
81 100 * Some examples
101 *
102 * Architecture Limit
103 * ---------------------------
104 * parisc, ia64, sparc <4G
105 * s390 <2G
106 * arm26 <48M
107 * arm Various
108 * alpha Unlimited or 0-16MB.
109 *
110 * i386, x86_64 and multiple other arches
111 * <16M.
112 */
113 ZONE_DMA,
114#ifdef CONFIG_ZONE_DMA32
115 /*
116 * x86_64 needs two ZONE_DMAs because it supports devices that are
117 * only able to do DMA to the lower 16M but also 32 bit devices that
118 * can only do DMA areas below 4G.
119 */
120 ZONE_DMA32,
121#endif
122 /*
123 * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
124 * performed on pages in ZONE_NORMAL if the DMA devices support
125 * transfers to all addressable memory.
126 */
127 ZONE_NORMAL,
128#ifdef CONFIG_HIGHMEM
129 /*
130 * A memory area that is only addressable by the kernel through
131 * mapping portions into its own address space. This is for example
132 * used by i386 to allow the kernel to address the memory beyond
133 * 900MB. The kernel will set up special mappings (page
134 * table entries on i386) for each page that the kernel needs to
135 * access.
136 */
137 ZONE_HIGHMEM,
138#endif
139 MAX_NR_ZONES
140};
82 141
83/* 142/*
84 * When a memory allocation must conform to specific limitations (such 143 * When a memory allocation must conform to specific limitations (such
85 * as being suitable for DMA) the caller will pass in hints to the 144 * as being suitable for DMA) the caller will pass in hints to the
86 * allocator in the gfp_mask, in the zone modifier bits. These bits 145 * allocator in the gfp_mask, in the zone modifier bits. These bits
87 * are used to select a priority ordered list of memory zones which 146 * are used to select a priority ordered list of memory zones which
88 * match the requested limits. GFP_ZONEMASK defines which bits within 147 * match the requested limits. See gfp_zone() in include/linux/gfp.h
89 * the gfp_mask should be considered as zone modifiers. Each valid
90 * combination of the zone modifier bits has a corresponding list
91 * of zones (in node_zonelists). Thus for two zone modifiers there
92 * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will
93 * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible
94 * combinations of zone modifiers in "zone modifier space".
95 *
96 * As an optimisation any zone modifier bits which are only valid when
97 * no other zone modifier bits are set (loners) should be placed in
98 * the highest order bits of this field. This allows us to reduce the
99 * extent of the zonelists thus saving space. For example in the case
100 * of three zone modifier bits, we could require up to eight zonelists.
101 * If the left most zone modifier is a "loner" then the highest valid
102 * zonelist would be four allowing us to allocate only five zonelists.
103 * Use the first form for GFP_ZONETYPES when the left most bit is not
104 * a "loner", otherwise use the second.
105 *
106 * NOTE! Make sure this matches the zones in <linux/gfp.h>
107 */ 148 */
108#define GFP_ZONEMASK 0x07
109/* #define GFP_ZONETYPES (GFP_ZONEMASK + 1) */ /* Non-loner */
110#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
111 149
112/* 150#if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM)
113 * On machines where it is needed (eg PCs) we divide physical memory 151#define ZONES_SHIFT 1
114 * into multiple physical zones. On a 32bit PC we have 4 zones: 152#else
115 * 153#define ZONES_SHIFT 2
116 * ZONE_DMA < 16 MB ISA DMA capable memory 154#endif
117 * ZONE_DMA32 0 MB Empty
118 * ZONE_NORMAL 16-896 MB direct mapped by the kernel
119 * ZONE_HIGHMEM > 896 MB only page cache and user processes
120 */
121 155
122struct zone { 156struct zone {
123 /* Fields commonly accessed by the page allocator */ 157 /* Fields commonly accessed by the page allocator */
@@ -134,6 +168,12 @@ struct zone {
134 unsigned long lowmem_reserve[MAX_NR_ZONES]; 168 unsigned long lowmem_reserve[MAX_NR_ZONES];
135 169
136#ifdef CONFIG_NUMA 170#ifdef CONFIG_NUMA
171 int node;
172 /*
173 * zone reclaim becomes active if more unmapped pages exist.
174 */
175 unsigned long min_unmapped_pages;
176 unsigned long min_slab_pages;
137 struct per_cpu_pageset *pageset[NR_CPUS]; 177 struct per_cpu_pageset *pageset[NR_CPUS];
138#else 178#else
139 struct per_cpu_pageset pageset[NR_CPUS]; 179 struct per_cpu_pageset pageset[NR_CPUS];
@@ -165,12 +205,8 @@ struct zone {
165 /* A count of how many reclaimers are scanning this zone */ 205 /* A count of how many reclaimers are scanning this zone */
166 atomic_t reclaim_in_progress; 206 atomic_t reclaim_in_progress;
167 207
168 /* 208 /* Zone statistics */
169 * timestamp (in jiffies) of the last zone reclaim that did not 209 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
170 * result in freeing of pages. This is used to avoid repeated scans
171 * if all memory in the zone is in use.
172 */
173 unsigned long last_unsuccessful_zone_reclaim;
174 210
175 /* 211 /*
176 * prev_priority holds the scanning priority for this zone. It is 212 * prev_priority holds the scanning priority for this zone. It is
@@ -249,7 +285,6 @@ struct zone {
249 char *name; 285 char *name;
250} ____cacheline_internodealigned_in_smp; 286} ____cacheline_internodealigned_in_smp;
251 287
252
253/* 288/*
254 * The "priority" of VM scanning is how much of the queues we will scan in one 289 * The "priority" of VM scanning is how much of the queues we will scan in one
255 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 290 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -272,6 +307,18 @@ struct zonelist {
272 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited 307 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
273}; 308};
274 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
275 322
276/* 323/*
277 * 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
@@ -287,7 +334,7 @@ struct zonelist {
287struct bootmem_data; 334struct bootmem_data;
288typedef struct pglist_data { 335typedef struct pglist_data {
289 struct zone node_zones[MAX_NR_ZONES]; 336 struct zone node_zones[MAX_NR_ZONES];
290 struct zonelist node_zonelists[GFP_ZONETYPES]; 337 struct zonelist node_zonelists[MAX_NR_ZONES];
291 int nr_zones; 338 int nr_zones;
292#ifdef CONFIG_FLAT_NODE_MEM_MAP 339#ifdef CONFIG_FLAT_NODE_MEM_MAP
293 struct page *node_mem_map; 340 struct page *node_mem_map;
@@ -356,12 +403,16 @@ static inline int populated_zone(struct zone *zone)
356 return (!!zone->present_pages); 403 return (!!zone->present_pages);
357} 404}
358 405
359static inline int is_highmem_idx(int idx) 406static inline int is_highmem_idx(enum zone_type idx)
360{ 407{
408#ifdef CONFIG_HIGHMEM
361 return (idx == ZONE_HIGHMEM); 409 return (idx == ZONE_HIGHMEM);
410#else
411 return 0;
412#endif
362} 413}
363 414
364static inline int is_normal_idx(int idx) 415static inline int is_normal_idx(enum zone_type idx)
365{ 416{
366 return (idx == ZONE_NORMAL); 417 return (idx == ZONE_NORMAL);
367} 418}
@@ -374,7 +425,11 @@ static inline int is_normal_idx(int idx)
374 */ 425 */
375static inline int is_highmem(struct zone *zone) 426static inline int is_highmem(struct zone *zone)
376{ 427{
428#ifdef CONFIG_HIGHMEM
377 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; 429 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
430#else
431 return 0;
432#endif
378} 433}
379 434
380static inline int is_normal(struct zone *zone) 435static inline int is_normal(struct zone *zone)
@@ -384,7 +439,11 @@ static inline int is_normal(struct zone *zone)
384 439
385static inline int is_dma32(struct zone *zone) 440static inline int is_dma32(struct zone *zone)
386{ 441{
442#ifdef CONFIG_ZONE_DMA32
387 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; 443 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
444#else
445 return 0;
446#endif
388} 447}
389 448
390static inline int is_dma(struct zone *zone) 449static inline int is_dma(struct zone *zone)
@@ -402,6 +461,10 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
402 void __user *, size_t *, loff_t *); 461 void __user *, size_t *, loff_t *);
403int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *, 462int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
404 void __user *, size_t *, loff_t *); 463 void __user *, size_t *, loff_t *);
464int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
465 struct file *, void __user *, size_t *, loff_t *);
466int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
467 struct file *, void __user *, size_t *, loff_t *);
405 468
406#include <linux/topology.h> 469#include <linux/topology.h>
407/* Returns the number of the current Node. */ 470/* Returns the number of the current Node. */
@@ -469,7 +532,8 @@ extern struct zone *next_zone(struct zone *zone);
469 532
470#endif 533#endif
471 534
472#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)
473#define early_pfn_to_nid(nid) (0UL) 537#define early_pfn_to_nid(nid) (0UL)
474#endif 538#endif
475 539
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f697770858..e0c393cc72 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -148,6 +148,17 @@ struct ccw_device_id {
148#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04 148#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
149#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 149#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
150 150
151/* s390 AP bus devices */
152struct ap_device_id {
153 __u16 match_flags; /* which fields to match against */
154 __u8 dev_type; /* device type */
155 __u8 pad1;
156 __u32 pad2;
157 kernel_ulong_t driver_info;
158};
159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161
151 162
152#define PNP_ID_LEN 8 163#define PNP_ID_LEN 8
153#define PNP_MAX_DEVICES 8 164#define PNP_MAX_DEVICES 8
@@ -297,4 +308,16 @@ struct input_device_id {
297 kernel_ulong_t driver_info; 308 kernel_ulong_t driver_info;
298}; 309};
299 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
300#endif /* LINUX_MOD_DEVICETABLE_H */ 323#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 2d366098ea..2c599175c5 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -156,6 +156,11 @@ extern struct module __this_module;
156*/ 156*/
157#define MODULE_VERSION(_version) MODULE_INFO(version, _version) 157#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
158 158
159/* Optional firmware file (or files) needed by the module
160 * format is simply firmware file name. Multiple firmware
161 * files require multiple MODULE_FIRMWARE() specifiers */
162#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
163
159/* Given an address, look for it in the exception tables */ 164/* Given an address, look for it in the exception tables */
160const struct exception_table_entry *search_exception_tables(unsigned long add); 165const struct exception_table_entry *search_exception_tables(unsigned long add);
161 166
@@ -203,6 +208,15 @@ void *__symbol_get_gpl(const char *symbol);
203#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ 208#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
204 __EXPORT_SYMBOL(sym, "_gpl_future") 209 __EXPORT_SYMBOL(sym, "_gpl_future")
205 210
211
212#ifdef CONFIG_UNUSED_SYMBOLS
213#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
214#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
215#else
216#define EXPORT_UNUSED_SYMBOL(sym)
217#define EXPORT_UNUSED_SYMBOL_GPL(sym)
218#endif
219
206#endif 220#endif
207 221
208struct module_ref 222struct module_ref
@@ -218,17 +232,17 @@ enum module_state
218}; 232};
219 233
220/* Similar stuff for section attributes. */ 234/* Similar stuff for section attributes. */
221#define MODULE_SECT_NAME_LEN 32
222struct module_sect_attr 235struct module_sect_attr
223{ 236{
224 struct module_attribute mattr; 237 struct module_attribute mattr;
225 char name[MODULE_SECT_NAME_LEN]; 238 char *name;
226 unsigned long address; 239 unsigned long address;
227}; 240};
228 241
229struct module_sect_attrs 242struct module_sect_attrs
230{ 243{
231 struct attribute_group grp; 244 struct attribute_group grp;
245 int nsections;
232 struct module_sect_attr attrs[0]; 246 struct module_sect_attr attrs[0];
233}; 247};
234 248
@@ -261,6 +275,15 @@ struct module
261 unsigned int num_gpl_syms; 275 unsigned int num_gpl_syms;
262 const unsigned long *gpl_crcs; 276 const unsigned long *gpl_crcs;
263 277
278 /* unused exported symbols. */
279 const struct kernel_symbol *unused_syms;
280 unsigned int num_unused_syms;
281 const unsigned long *unused_crcs;
282 /* GPL-only, unused exported symbols. */
283 const struct kernel_symbol *unused_gpl_syms;
284 unsigned int num_unused_gpl_syms;
285 const unsigned long *unused_gpl_crcs;
286
264 /* symbols that will be GPL-only in the near future. */ 287 /* symbols that will be GPL-only in the near future. */
265 const struct kernel_symbol *gpl_future_syms; 288 const struct kernel_symbol *gpl_future_syms;
266 unsigned int num_gpl_future_syms; 289 unsigned int num_gpl_future_syms;
@@ -285,6 +308,9 @@ struct module
285 /* The size of the executable code in each section. */ 308 /* The size of the executable code in each section. */
286 unsigned long init_text_size, core_text_size; 309 unsigned long init_text_size, core_text_size;
287 310
311 /* The handle returned from unwind_add_table. */
312 void *unwind_info;
313
288 /* Arch-specific module values */ 314 /* Arch-specific module values */
289 struct mod_arch_specific arch; 315 struct mod_arch_specific arch;
290 316
@@ -337,13 +363,12 @@ static inline int module_is_live(struct module *mod)
337/* Is this address in a module? (second is with no locks, for oops) */ 363/* Is this address in a module? (second is with no locks, for oops) */
338struct module *module_text_address(unsigned long addr); 364struct module *module_text_address(unsigned long addr);
339struct module *__module_text_address(unsigned long addr); 365struct module *__module_text_address(unsigned long addr);
366int is_module_address(unsigned long addr);
340 367
341/* Returns module and fills in value, defined and namebuf, or NULL if 368/* Returns module and fills in value, defined and namebuf, or NULL if
342 symnum out of range. */ 369 symnum out of range. */
343struct module *module_get_kallsym(unsigned int symnum, 370struct module *module_get_kallsym(unsigned int symnum, unsigned long *value,
344 unsigned long *value, 371 char *type, char *name, size_t namelen);
345 char *type,
346 char namebuf[128]);
347 372
348/* Look for this name: can be of form module:name. */ 373/* Look for this name: can be of form module:name. */
349unsigned long module_kallsyms_lookup_name(const char *name); 374unsigned long module_kallsyms_lookup_name(const char *name);
@@ -453,6 +478,8 @@ void module_remove_driver(struct device_driver *);
453#define EXPORT_SYMBOL(sym) 478#define EXPORT_SYMBOL(sym)
454#define EXPORT_SYMBOL_GPL(sym) 479#define EXPORT_SYMBOL_GPL(sym)
455#define EXPORT_SYMBOL_GPL_FUTURE(sym) 480#define EXPORT_SYMBOL_GPL_FUTURE(sym)
481#define EXPORT_UNUSED_SYMBOL(sym)
482#define EXPORT_UNUSED_SYMBOL_GPL(sym)
456 483
457/* Given an address, look for it in the exception tables. */ 484/* Given an address, look for it in the exception tables. */
458static inline const struct exception_table_entry * 485static inline const struct exception_table_entry *
@@ -473,6 +500,11 @@ static inline struct module *__module_text_address(unsigned long addr)
473 return NULL; 500 return NULL;
474} 501}
475 502
503static inline int is_module_address(unsigned long addr)
504{
505 return 0;
506}
507
476/* Get/put a kernel symbol (calls should be symmetric) */ 508/* Get/put a kernel symbol (calls should be symmetric) */
477#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) 509#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
478#define symbol_put(x) do { } while(0) 510#define symbol_put(x) do { } while(0)
@@ -506,8 +538,8 @@ static inline const char *module_address_lookup(unsigned long addr,
506 538
507static inline struct module *module_get_kallsym(unsigned int symnum, 539static inline struct module *module_get_kallsym(unsigned int symnum,
508 unsigned long *value, 540 unsigned long *value,
509 char *type, 541 char *type, char *name,
510 char namebuf[128]) 542 size_t namelen)
511{ 543{
512 return NULL; 544 return NULL;
513} 545}
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 60718f12ca..403d1a97c5 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -28,6 +28,8 @@ struct namespace;
28#define MNT_NOATIME 0x08 28#define MNT_NOATIME 0x08
29#define MNT_NODIRATIME 0x10 29#define MNT_NODIRATIME 0x10
30 30
31#define MNT_SHRINKABLE 0x100
32
31#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 33#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
32#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 34#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
33#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */ 35#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
@@ -78,12 +80,18 @@ extern struct vfsmount *alloc_vfsmnt(const char *name);
78extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 80extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
79 const char *name, void *data); 81 const char *name, void *data);
80 82
83struct file_system_type;
84extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
85 int flags, const char *name,
86 void *data);
87
81struct nameidata; 88struct nameidata;
82 89
83extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 90extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
84 int mnt_flags, struct list_head *fslist); 91 int mnt_flags, struct list_head *fslist);
85 92
86extern void mark_mounts_for_expiry(struct list_head *mounts); 93extern void mark_mounts_for_expiry(struct list_head *mounts);
94extern void shrink_submounts(struct vfsmount *mountpoint, struct list_head *mounts);
87 95
88extern spinlock_t vfsmount_lock; 96extern spinlock_t vfsmount_lock;
89extern dev_t name_to_dev_t(char *name); 97extern dev_t name_to_dev_t(char *name);
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index e05d54a907..7da2cee8e1 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 d9035c73e5..ce6c85815c 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_MSDOS_FS_H 1#ifndef _LINUX_MSDOS_FS_H
2#define _LINUX_MSDOS_FS_H 2#define _LINUX_MSDOS_FS_H
3 3
4#include <linux/magic.h>
5
4/* 6/*
5 * The MS-DOS filesystem constants/structures 7 * The MS-DOS filesystem constants/structures
6 */ 8 */
@@ -18,8 +20,6 @@
18#define CT_LE_L(v) cpu_to_le32(v) 20#define CT_LE_L(v) cpu_to_le32(v)
19 21
20 22
21#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
22
23#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ 23#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */
24#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ 24#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
25 25
@@ -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/mtd/bbm.h b/include/linux/mtd/bbm.h
index 7a7fbe87fe..1221b7c441 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -19,21 +19,21 @@
19 19
20/** 20/**
21 * struct nand_bbt_descr - bad block table descriptor 21 * struct nand_bbt_descr - bad block table descriptor
22 * @param options options for this descriptor 22 * @options: options for this descriptor
23 * @param pages the page(s) where we find the bbt, used with 23 * @pages: the page(s) where we find the bbt, used with
24 * option BBT_ABSPAGE when bbt is searched, 24 * option BBT_ABSPAGE when bbt is searched,
25 * then we store the found bbts pages here. 25 * then we store the found bbts pages here.
26 * Its an array and supports up to 8 chips now 26 * Its an array and supports up to 8 chips now
27 * @param offs offset of the pattern in the oob area of the page 27 * @offs: offset of the pattern in the oob area of the page
28 * @param veroffs offset of the bbt version counter in the oob are of the page 28 * @veroffs: offset of the bbt version counter in the oob area of the page
29 * @param version version read from the bbt page during scan 29 * @version: version read from the bbt page during scan
30 * @param len length of the pattern, if 0 no pattern check is performed 30 * @len: length of the pattern, if 0 no pattern check is performed
31 * @param maxblocks maximum number of blocks to search for a bbt. This number of 31 * @maxblocks: maximum number of blocks to search for a bbt. This
32 * blocks is reserved at the end of the device 32 * number of blocks is reserved at the end of the device
33 * where the tables are written. 33 * where the tables are written.
34 * @param reserved_block_code if non-0, this pattern denotes a reserved 34 * @reserved_block_code: if non-0, this pattern denotes a reserved
35 * (rather than bad) block in the stored bbt 35 * (rather than bad) block in the stored bbt
36 * @param pattern pattern to identify bad block table or factory marked 36 * @pattern: pattern to identify bad block table or factory marked
37 * good / bad blocks, can be NULL, if len = 0 37 * good / bad blocks, can be NULL, if len = 0
38 * 38 *
39 * Descriptor for the bad block table marker and the descriptor for the 39 * Descriptor for the bad block table marker and the descriptor for the
@@ -93,12 +93,15 @@ struct nand_bbt_descr {
93#define ONENAND_BADBLOCK_POS 0 93#define ONENAND_BADBLOCK_POS 0
94 94
95/** 95/**
96 * struct bbt_info - [GENERIC] Bad Block Table data structure 96 * struct bbm_info - [GENERIC] Bad Block Table data structure
97 * @param bbt_erase_shift [INTERN] number of address bits in a bbt entry 97 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
98 * @param badblockpos [INTERN] position of the bad block marker in the oob area 98 * @badblockpos: [INTERN] position of the bad block marker in the oob area
99 * @param bbt [INTERN] bad block table pointer 99 * @options: options for this descriptor
100 * @param badblock_pattern [REPLACEABLE] bad block scan pattern used for initial bad block scan 100 * @bbt: [INTERN] bad block table pointer
101 * @param priv [OPTIONAL] pointer to private bbm date 101 * @isbad_bbt: function to determine if a block is bad
102 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for
103 * initial bad block scan
104 * @priv: [OPTIONAL] pointer to private bbm date
102 */ 105 */
103struct bbm_info { 106struct bbm_info {
104 int bbt_erase_shift; 107 int bbt_erase_shift;
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 09bfae6938..123948b145 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -199,6 +199,18 @@ struct cfi_pri_amdstd {
199 uint8_t TopBottom; 199 uint8_t TopBottom;
200} __attribute__((packed)); 200} __attribute__((packed));
201 201
202/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
203
204struct cfi_pri_atmel {
205 uint8_t pri[3];
206 uint8_t MajorVersion;
207 uint8_t MinorVersion;
208 uint8_t Features;
209 uint8_t BottomBoot;
210 uint8_t BurstMode;
211 uint8_t PageMode;
212} __attribute__((packed));
213
202struct cfi_pri_query { 214struct cfi_pri_query {
203 uint8_t NumFields; 215 uint8_t NumFields;
204 uint32_t ProtField[1]; /* Not host ordered */ 216 uint32_t ProtField[1]; /* Not host ordered */
@@ -464,6 +476,7 @@ struct cfi_fixup {
464#define CFI_ID_ANY 0xffff 476#define CFI_ID_ANY 0xffff
465 477
466#define CFI_MFR_AMD 0x0001 478#define CFI_MFR_AMD 0x0001
479#define CFI_MFR_ATMEL 0x001F
467#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 480#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
468 481
469void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 482void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9b7a2b525d..94a443d452 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -77,11 +77,11 @@ typedef enum {
77 * 77 *
78 * @len: number of bytes to write/read. When a data buffer is given 78 * @len: number of bytes to write/read. When a data buffer is given
79 * (datbuf != NULL) this is the number of data bytes. When 79 * (datbuf != NULL) this is the number of data bytes. When
80 + no data buffer is available this is the number of oob bytes. 80 * no data buffer is available this is the number of oob bytes.
81 * 81 *
82 * @retlen: number of bytes written/read. When a data buffer is given 82 * @retlen: number of bytes written/read. When a data buffer is given
83 * (datbuf != NULL) this is the number of data bytes. When 83 * (datbuf != NULL) this is the number of data bytes. When
84 + no data buffer is available this is the number of oob bytes. 84 * no data buffer is available this is the number of oob bytes.
85 * 85 *
86 * @ooblen: number of oob bytes per page 86 * @ooblen: number of oob bytes per page
87 * @ooboffs: offset of oob data in the oob area (only relevant when 87 * @ooboffs: offset of oob data in the oob area (only relevant when
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 66559272eb..0b4cd2fa64 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -202,7 +202,7 @@ typedef enum {
202struct nand_chip; 202struct nand_chip;
203 203
204/** 204/**
205 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices 205 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
206 * @lock: protection lock 206 * @lock: protection lock
207 * @active: the mtd device which holds the controller currently 207 * @active: the mtd device which holds the controller currently
208 * @wq: wait queue to sleep on if a NAND operation is in progress 208 * @wq: wait queue to sleep on if a NAND operation is in progress
@@ -223,12 +223,15 @@ struct nand_hw_control {
223 * @total: total number of ecc bytes per page 223 * @total: total number of ecc bytes per page
224 * @prepad: padding information for syndrome based ecc generators 224 * @prepad: padding information for syndrome based ecc generators
225 * @postpad: padding information for syndrome based ecc generators 225 * @postpad: padding information for syndrome based ecc generators
226 * @layout: ECC layout control struct pointer
226 * @hwctl: function to control hardware ecc generator. Must only 227 * @hwctl: function to control hardware ecc generator. Must only
227 * be provided if an hardware ECC is available 228 * be provided if an hardware ECC is available
228 * @calculate: function for ecc calculation or readback from ecc hardware 229 * @calculate: function for ecc calculation or readback from ecc hardware
229 * @correct: function for ecc correction, matching to ecc generator (sw/hw) 230 * @correct: function for ecc correction, matching to ecc generator (sw/hw)
230 * @read_page: function to read a page according to the ecc generator requirements 231 * @read_page: function to read a page according to the ecc generator requirements
231 * @write_page: function to write a page according to the ecc generator requirements 232 * @write_page: function to write a page according to the ecc generator requirements
233 * @read_oob: function to read chip OOB data
234 * @write_oob: function to write chip OOB data
232 */ 235 */
233struct nand_ecc_ctrl { 236struct nand_ecc_ctrl {
234 nand_ecc_modes_t mode; 237 nand_ecc_modes_t mode;
@@ -300,11 +303,15 @@ struct nand_buffers {
300 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip 303 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip
301 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready 304 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready
302 * @ecc: [BOARDSPECIFIC] ecc control ctructure 305 * @ecc: [BOARDSPECIFIC] ecc control ctructure
306 * @buffers: buffer structure for read/write
307 * @hwcontrol: platform-specific hardware control structure
308 * @ops: oob operation operands
303 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 309 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support
304 * @scan_bbt: [REPLACEABLE] function to scan bad block table 310 * @scan_bbt: [REPLACEABLE] function to scan bad block table
305 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 311 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
306 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress 312 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress
307 * @state: [INTERN] the current state of the NAND device 313 * @state: [INTERN] the current state of the NAND device
314 * @oob_poi: poison value buffer
308 * @page_shift: [INTERN] number of address bits in a page (column address bits) 315 * @page_shift: [INTERN] number of address bits in a page (column address bits)
309 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 316 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
310 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 317 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
@@ -400,7 +407,6 @@ struct nand_chip {
400 407
401/** 408/**
402 * struct nand_flash_dev - NAND Flash Device ID Structure 409 * struct nand_flash_dev - NAND Flash Device ID Structure
403 *
404 * @name: Identify the device type 410 * @name: Identify the device type
405 * @id: device ID code 411 * @id: device ID code
406 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 412 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0
@@ -519,9 +525,8 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
519 525
520/** 526/**
521 * struct platform_nand_chip - chip level device structure 527 * struct platform_nand_chip - chip level device structure
522 *
523 * @nr_chips: max. number of chips to scan for 528 * @nr_chips: max. number of chips to scan for
524 * @chip_offs: chip number offset 529 * @chip_offset: chip number offset
525 * @nr_partitions: number of partitions pointed to by partitions (or zero) 530 * @nr_partitions: number of partitions pointed to by partitions (or zero)
526 * @partitions: mtd partition list 531 * @partitions: mtd partition list
527 * @chip_delay: R/B delay value in us 532 * @chip_delay: R/B delay value in us
@@ -542,11 +547,10 @@ struct platform_nand_chip {
542 547
543/** 548/**
544 * struct platform_nand_ctrl - controller level device structure 549 * struct platform_nand_ctrl - controller level device structure
545 *
546 * @hwcontrol: platform specific hardware control structure 550 * @hwcontrol: platform specific hardware control structure
547 * @dev_ready: platform specific function to read ready/busy pin 551 * @dev_ready: platform specific function to read ready/busy pin
548 * @select_chip: platform specific chip select function 552 * @select_chip: platform specific chip select function
549 * @priv_data: private data to transport driver specific settings 553 * @priv: private data to transport driver specific settings
550 * 554 *
551 * All fields are optional and depend on the hardware driver requirements 555 * All fields are optional and depend on the hardware driver requirements
552 */ 556 */
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 9ce9a48db4..1f49721552 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -23,7 +23,7 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips);
23/* Free resources held by the OneNAND device */ 23/* Free resources held by the OneNAND device */
24extern void onenand_release(struct mtd_info *mtd); 24extern void onenand_release(struct mtd_info *mtd);
25 25
26/** 26/*
27 * onenand_state_t - chip states 27 * onenand_state_t - chip states
28 * Enumeration for OneNAND flash chip state 28 * Enumeration for OneNAND flash chip state
29 */ 29 */
@@ -42,9 +42,9 @@ typedef enum {
42 42
43/** 43/**
44 * struct onenand_bufferram - OneNAND BufferRAM Data 44 * struct onenand_bufferram - OneNAND BufferRAM Data
45 * @param block block address in BufferRAM 45 * @block: block address in BufferRAM
46 * @param page page address in BufferRAM 46 * @page: page address in BufferRAM
47 * @param valid valid flag 47 * @valid: valid flag
48 */ 48 */
49struct onenand_bufferram { 49struct onenand_bufferram {
50 int block; 50 int block;
@@ -54,32 +54,43 @@ struct onenand_bufferram {
54 54
55/** 55/**
56 * struct onenand_chip - OneNAND Private Flash Chip Data 56 * struct onenand_chip - OneNAND Private Flash Chip Data
57 * @param base [BOARDSPECIFIC] address to access OneNAND 57 * @base: [BOARDSPECIFIC] address to access OneNAND
58 * @param chipsize [INTERN] the size of one chip for multichip arrays 58 * @chipsize: [INTERN] the size of one chip for multichip arrays
59 * @param device_id [INTERN] device ID 59 * @device_id: [INTERN] device ID
60 * @param verstion_id [INTERN] version ID 60 * @density_mask: chip density, used for DDP devices
61 * @param options [BOARDSPECIFIC] various chip options. They can partly be set to inform onenand_scan about 61 * @verstion_id: [INTERN] version ID
62 * @param erase_shift [INTERN] number of address bits in a block 62 * @options: [BOARDSPECIFIC] various chip options. They can
63 * @param page_shift [INTERN] number of address bits in a page 63 * partly be set to inform onenand_scan about
64 * @param ppb_shift [INTERN] number of address bits in a pages per block 64 * @erase_shift: [INTERN] number of address bits in a block
65 * @param page_mask [INTERN] a page per block mask 65 * @page_shift: [INTERN] number of address bits in a page
66 * @param bufferam_index [INTERN] BufferRAM index 66 * @ppb_shift: [INTERN] number of address bits in a pages per block
67 * @param bufferam [INTERN] BufferRAM info 67 * @page_mask: [INTERN] a page per block mask
68 * @param readw [REPLACEABLE] hardware specific function for read short 68 * @bufferram_index: [INTERN] BufferRAM index
69 * @param writew [REPLACEABLE] hardware specific function for write short 69 * @bufferram: [INTERN] BufferRAM info
70 * @param command [REPLACEABLE] hardware specific function for writing commands to the chip 70 * @readw: [REPLACEABLE] hardware specific function for read short
71 * @param wait [REPLACEABLE] hardware specific function for wait on ready 71 * @writew: [REPLACEABLE] hardware specific function for write short
72 * @param read_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area 72 * @command: [REPLACEABLE] hardware specific function for writing
73 * @param write_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area 73 * commands to the chip
74 * @param read_word [REPLACEABLE] hardware specific function for read register of OneNAND 74 * @wait: [REPLACEABLE] hardware specific function for wait on ready
75 * @param write_word [REPLACEABLE] hardware specific function for write register of OneNAND 75 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
76 * @param scan_bbt [REPLACEALBE] hardware specific function for scaning Bad block Table 76 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
77 * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip 77 * @read_word: [REPLACEABLE] hardware specific function for read
78 * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress 78 * register of OneNAND
79 * @param state [INTERN] the current state of the OneNAND device 79 * @write_word: [REPLACEABLE] hardware specific function for write
80 * @param ecclayout [REPLACEABLE] the default ecc placement scheme 80 * register of OneNAND
81 * @param bbm [REPLACEABLE] pointer to Bad Block Management 81 * @mmcontrol: sync burst read function
82 * @param priv [OPTIONAL] pointer to private chip date 82 * @block_markbad: function to mark a block as bad
83 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
84 * Bad block Table
85 * @chip_lock: [INTERN] spinlock used to protect access to this
86 * structure and the chip
87 * @wq: [INTERN] wait queue to sleep on if a OneNAND
88 * operation is in progress
89 * @state: [INTERN] the current state of the OneNAND device
90 * @page_buf: data buffer
91 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
92 * @bbm: [REPLACEABLE] pointer to Bad Block Management
93 * @priv: [OPTIONAL] pointer to private chip date
83 */ 94 */
84struct onenand_chip { 95struct onenand_chip {
85 void __iomem *base; 96 void __iomem *base;
@@ -147,9 +158,9 @@ struct onenand_chip {
147#define ONENAND_MFR_SAMSUNG 0xec 158#define ONENAND_MFR_SAMSUNG 0xec
148 159
149/** 160/**
150 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 161 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure
151 * @param name: Manufacturer name 162 * @name: Manufacturer name
152 * @param id: manufacturer ID code of device. 163 * @id: manufacturer ID code of device.
153*/ 164*/
154struct onenand_manufacturers { 165struct onenand_manufacturers {
155 int id; 166 int id;
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
index 8b5769f004..2537285e10 100644
--- a/include/linux/mutex-debug.h
+++ b/include/linux/mutex-debug.h
@@ -2,22 +2,22 @@
2#define __LINUX_MUTEX_DEBUG_H 2#define __LINUX_MUTEX_DEBUG_H
3 3
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/lockdep.h>
5 6
6/* 7/*
7 * Mutexes - debugging helpers: 8 * Mutexes - debugging helpers:
8 */ 9 */
9 10
10#define __DEBUG_MUTEX_INITIALIZER(lockname) \ 11#define __DEBUG_MUTEX_INITIALIZER(lockname) \
11 , .held_list = LIST_HEAD_INIT(lockname.held_list), \ 12 , .magic = &lockname
12 .name = #lockname , .magic = &lockname
13 13
14#define mutex_init(sem) __mutex_init(sem, __FUNCTION__) 14#define mutex_init(mutex) \
15do { \
16 static struct lock_class_key __key; \
17 \
18 __mutex_init((mutex), #mutex, &__key); \
19} while (0)
15 20
16extern void FASTCALL(mutex_destroy(struct mutex *lock)); 21extern void FASTCALL(mutex_destroy(struct mutex *lock));
17 22
18extern void mutex_debug_show_all_locks(void);
19extern void mutex_debug_show_held_locks(struct task_struct *filter);
20extern void mutex_debug_check_no_locks_held(struct task_struct *task);
21extern void mutex_debug_check_no_locks_freed(const void *from, unsigned long len);
22
23#endif 23#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index f1ac507fa2..27c48daa31 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -13,6 +13,7 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/spinlock_types.h> 14#include <linux/spinlock_types.h>
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/lockdep.h>
16 17
17#include <asm/atomic.h> 18#include <asm/atomic.h>
18 19
@@ -50,11 +51,12 @@ struct mutex {
50 struct list_head wait_list; 51 struct list_head wait_list;
51#ifdef CONFIG_DEBUG_MUTEXES 52#ifdef CONFIG_DEBUG_MUTEXES
52 struct thread_info *owner; 53 struct thread_info *owner;
53 struct list_head held_list;
54 unsigned long acquire_ip;
55 const char *name; 54 const char *name;
56 void *magic; 55 void *magic;
57#endif 56#endif
57#ifdef CONFIG_DEBUG_LOCK_ALLOC
58 struct lockdep_map dep_map;
59#endif
58}; 60};
59 61
60/* 62/*
@@ -74,24 +76,34 @@ struct mutex_waiter {
74# include <linux/mutex-debug.h> 76# include <linux/mutex-debug.h>
75#else 77#else
76# define __DEBUG_MUTEX_INITIALIZER(lockname) 78# define __DEBUG_MUTEX_INITIALIZER(lockname)
77# define mutex_init(mutex) __mutex_init(mutex, NULL) 79# define mutex_init(mutex) \
80do { \
81 static struct lock_class_key __key; \
82 \
83 __mutex_init((mutex), #mutex, &__key); \
84} while (0)
78# define mutex_destroy(mutex) do { } while (0) 85# define mutex_destroy(mutex) do { } while (0)
79# define mutex_debug_show_all_locks() do { } while (0) 86#endif
80# define mutex_debug_show_held_locks(p) do { } while (0) 87
81# define mutex_debug_check_no_locks_held(task) do { } while (0) 88#ifdef CONFIG_DEBUG_LOCK_ALLOC
82# define mutex_debug_check_no_locks_freed(from, len) do { } while (0) 89# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
90 , .dep_map = { .name = #lockname }
91#else
92# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
83#endif 93#endif
84 94
85#define __MUTEX_INITIALIZER(lockname) \ 95#define __MUTEX_INITIALIZER(lockname) \
86 { .count = ATOMIC_INIT(1) \ 96 { .count = ATOMIC_INIT(1) \
87 , .wait_lock = SPIN_LOCK_UNLOCKED \ 97 , .wait_lock = SPIN_LOCK_UNLOCKED \
88 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \ 98 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
89 __DEBUG_MUTEX_INITIALIZER(lockname) } 99 __DEBUG_MUTEX_INITIALIZER(lockname) \
100 __DEP_MAP_MUTEX_INITIALIZER(lockname) }
90 101
91#define DEFINE_MUTEX(mutexname) \ 102#define DEFINE_MUTEX(mutexname) \
92 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) 103 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
93 104
94extern void fastcall __mutex_init(struct mutex *lock, const char *name); 105extern void __mutex_init(struct mutex *lock, const char *name,
106 struct lock_class_key *key);
95 107
96/*** 108/***
97 * mutex_is_locked - is the mutex locked 109 * mutex_is_locked - is the mutex locked
@@ -110,6 +122,13 @@ static inline int fastcall mutex_is_locked(struct mutex *lock)
110 */ 122 */
111extern void fastcall mutex_lock(struct mutex *lock); 123extern void fastcall mutex_lock(struct mutex *lock);
112extern int fastcall mutex_lock_interruptible(struct mutex *lock); 124extern int fastcall mutex_lock_interruptible(struct mutex *lock);
125
126#ifdef CONFIG_DEBUG_LOCK_ALLOC
127extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
128#else
129# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
130#endif
131
113/* 132/*
114 * NOTE: mutex_trylock() follows the spin_trylock() convention, 133 * NOTE: mutex_trylock() follows the spin_trylock() convention,
115 * not the down_trylock() convention! 134 * not the down_trylock() convention!
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 58cb3d3d44..c6470ba006 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -11,7 +11,7 @@ struct open_intent {
11 struct file *file; 11 struct file *file;
12}; 12};
13 13
14enum { MAX_NESTED_LINKS = 5 }; 14enum { MAX_NESTED_LINKS = 8 };
15 15
16struct nameidata { 16struct nameidata {
17 struct dentry *dentry; 17 struct dentry *dentry;
@@ -54,6 +54,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
54#define LOOKUP_OPEN (0x0100) 54#define LOOKUP_OPEN (0x0100)
55#define LOOKUP_CREATE (0x0200) 55#define LOOKUP_CREATE (0x0200)
56#define LOOKUP_ACCESS (0x0400) 56#define LOOKUP_ACCESS (0x0400)
57#define LOOKUP_CHDIR (0x0800)
57 58
58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *)); 59extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
59extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *)); 60extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 1d7cdd20b5..e712e7d47c 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -77,11 +77,11 @@ struct nbd_device {
77 * server. All data are in network byte order. 77 * server. All data are in network byte order.
78 */ 78 */
79struct nbd_request { 79struct nbd_request {
80 __u32 magic; 80 __be32 magic;
81 __u32 type; /* == READ || == WRITE */ 81 __be32 type; /* == READ || == WRITE */
82 char handle[8]; 82 char handle[8];
83 __u64 from; 83 __be64 from;
84 __u32 len; 84 __be32 len;
85} 85}
86#ifdef __GNUC__ 86#ifdef __GNUC__
87 __attribute__ ((packed)) 87 __attribute__ ((packed))
@@ -93,8 +93,8 @@ struct nbd_request {
93 * it has completed an I/O request (or an error occurs). 93 * it has completed an I/O request (or an error occurs).
94 */ 94 */
95struct nbd_reply { 95struct nbd_reply {
96 __u32 magic; 96 __be32 magic;
97 __u32 error; /* 0 = ok, else error */ 97 __be32 error; /* 0 = ok, else error */
98 char handle[8]; /* handle you got from request */ 98 char handle[8]; /* handle you got from request */
99}; 99};
100#endif 100#endif
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index b208f0cd55..02e352be71 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -11,6 +11,7 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/magic.h>
14 15
15#include <linux/ipx.h> 16#include <linux/ipx.h>
16#include <linux/ncp_no.h> 17#include <linux/ncp_no.h>
@@ -185,10 +186,6 @@ struct ncp_entry_info {
185 __u8 file_handle[6]; 186 __u8 file_handle[6];
186}; 187};
187 188
188/* Guess, what 0x564c is :-) */
189#define NCP_SUPER_MAGIC 0x564c
190
191
192static inline struct ncp_server *NCP_SBP(struct super_block *sb) 189static inline struct ncp_server *NCP_SBP(struct super_block *sb)
193{ 190{
194 return sb->s_fs_info; 191 return sb->s_fs_info;
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
new file mode 100644
index 0000000000..bd3bbf668c
--- /dev/null
+++ b/include/linux/neighbour.h
@@ -0,0 +1,159 @@
1#ifndef __LINUX_NEIGHBOUR_H
2#define __LINUX_NEIGHBOUR_H
3
4#include <linux/netlink.h>
5
6struct ndmsg
7{
8 __u8 ndm_family;
9 __u8 ndm_pad1;
10 __u16 ndm_pad2;
11 __s32 ndm_ifindex;
12 __u16 ndm_state;
13 __u8 ndm_flags;
14 __u8 ndm_type;
15};
16
17enum
18{
19 NDA_UNSPEC,
20 NDA_DST,
21 NDA_LLADDR,
22 NDA_CACHEINFO,
23 NDA_PROBES,
24 __NDA_MAX
25};
26
27#define NDA_MAX (__NDA_MAX - 1)
28
29/*
30 * Neighbor Cache Entry Flags
31 */
32
33#define NTF_PROXY 0x08 /* == ATF_PUBL */
34#define NTF_ROUTER 0x80
35
36/*
37 * Neighbor Cache Entry States.
38 */
39
40#define NUD_INCOMPLETE 0x01
41#define NUD_REACHABLE 0x02
42#define NUD_STALE 0x04
43#define NUD_DELAY 0x08
44#define NUD_PROBE 0x10
45#define NUD_FAILED 0x20
46
47/* Dummy states */
48#define NUD_NOARP 0x40
49#define NUD_PERMANENT 0x80
50#define NUD_NONE 0x00
51
52/* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change
53 and make no address resolution or NUD.
54 NUD_PERMANENT is also cannot be deleted by garbage collectors.
55 */
56
57struct nda_cacheinfo
58{
59 __u32 ndm_confirmed;
60 __u32 ndm_used;
61 __u32 ndm_updated;
62 __u32 ndm_refcnt;
63};
64
65/*****************************************************************
66 * Neighbour tables specific messages.
67 *
68 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
69 * NLM_F_DUMP flag set. Every neighbour table configuration is
70 * spread over multiple messages to avoid running into message
71 * size limits on systems with many interfaces. The first message
72 * in the sequence transports all not device specific data such as
73 * statistics, configuration, and the default parameter set.
74 * This message is followed by 0..n messages carrying device
75 * specific parameter sets.
76 * Although the ordering should be sufficient, NDTA_NAME can be
77 * used to identify sequences. The initial message can be identified
78 * by checking for NDTA_CONFIG. The device specific messages do
79 * not contain this TLV but have NDTPA_IFINDEX set to the
80 * corresponding interface index.
81 *
82 * To change neighbour table attributes, send RTM_SETNEIGHTBL
83 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
84 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
85 * otherwise. Device specific parameter sets can be changed by
86 * setting NDTPA_IFINDEX to the interface index of the corresponding
87 * device.
88 ****/
89
90struct ndt_stats
91{
92 __u64 ndts_allocs;
93 __u64 ndts_destroys;
94 __u64 ndts_hash_grows;
95 __u64 ndts_res_failed;
96 __u64 ndts_lookups;
97 __u64 ndts_hits;
98 __u64 ndts_rcv_probes_mcast;
99 __u64 ndts_rcv_probes_ucast;
100 __u64 ndts_periodic_gc_runs;
101 __u64 ndts_forced_gc_runs;
102};
103
104enum {
105 NDTPA_UNSPEC,
106 NDTPA_IFINDEX, /* u32, unchangeable */
107 NDTPA_REFCNT, /* u32, read-only */
108 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
109 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
110 NDTPA_RETRANS_TIME, /* u64, msecs */
111 NDTPA_GC_STALETIME, /* u64, msecs */
112 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
113 NDTPA_QUEUE_LEN, /* u32 */
114 NDTPA_APP_PROBES, /* u32 */
115 NDTPA_UCAST_PROBES, /* u32 */
116 NDTPA_MCAST_PROBES, /* u32 */
117 NDTPA_ANYCAST_DELAY, /* u64, msecs */
118 NDTPA_PROXY_DELAY, /* u64, msecs */
119 NDTPA_PROXY_QLEN, /* u32 */
120 NDTPA_LOCKTIME, /* u64, msecs */
121 __NDTPA_MAX
122};
123#define NDTPA_MAX (__NDTPA_MAX - 1)
124
125struct ndtmsg
126{
127 __u8 ndtm_family;
128 __u8 ndtm_pad1;
129 __u16 ndtm_pad2;
130};
131
132struct ndt_config
133{
134 __u16 ndtc_key_len;
135 __u16 ndtc_entry_size;
136 __u32 ndtc_entries;
137 __u32 ndtc_last_flush; /* delta to now in msecs */
138 __u32 ndtc_last_rand; /* delta to now in msecs */
139 __u32 ndtc_hash_rnd;
140 __u32 ndtc_hash_mask;
141 __u32 ndtc_hash_chain_gc;
142 __u32 ndtc_proxy_qlen;
143};
144
145enum {
146 NDTA_UNSPEC,
147 NDTA_NAME, /* char *, unchangeable */
148 NDTA_THRESH1, /* u32 */
149 NDTA_THRESH2, /* u32 */
150 NDTA_THRESH3, /* u32 */
151 NDTA_CONFIG, /* struct ndt_config, read-only */
152 NDTA_PARMS, /* nested TLV NDTPA_* */
153 NDTA_STATS, /* struct ndt_stats, read-only */
154 NDTA_GC_INTERVAL, /* u64, msecs */
155 __NDTA_MAX
156};
157#define NDTA_MAX (__NDTA_MAX - 1)
158
159#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 385e68f5bd..c257f716e0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -61,6 +61,7 @@ typedef enum {
61#define SOCK_ASYNC_WAITDATA 1 61#define SOCK_ASYNC_WAITDATA 1
62#define SOCK_NOSPACE 2 62#define SOCK_NOSPACE 2
63#define SOCK_PASSCRED 3 63#define SOCK_PASSCRED 3
64#define SOCK_PASSSEC 4
64 65
65#ifndef ARCH_HAS_SOCKET_TYPES 66#ifndef ARCH_HAS_SOCKET_TYPES
66/** 67/**
@@ -168,11 +169,6 @@ struct proto_ops {
168struct net_proto_family { 169struct net_proto_family {
169 int family; 170 int family;
170 int (*create)(struct socket *sock, int protocol); 171 int (*create)(struct socket *sock, int protocol);
171 /* These are counters for the number of different methods of
172 each we support */
173 short authentication;
174 short encryption;
175 short encrypt_net;
176 struct module *owner; 172 struct module *owner;
177}; 173};
178 174
@@ -180,8 +176,8 @@ struct iovec;
180struct kvec; 176struct kvec;
181 177
182extern int sock_wake_async(struct socket *sk, int how, int band); 178extern int sock_wake_async(struct socket *sk, int how, int band);
183extern int sock_register(struct net_proto_family *fam); 179extern int sock_register(const struct net_proto_family *fam);
184extern int sock_unregister(int family); 180extern void sock_unregister(int family);
185extern int sock_create(int family, int type, int proto, 181extern int sock_create(int family, int type, int proto,
186 struct socket **res); 182 struct socket **res);
187extern int sock_create_kern(int family, int type, int proto, 183extern int sock_create_kern(int family, int type, int proto,
@@ -207,6 +203,25 @@ extern int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
207 struct kvec *vec, size_t num, 203 struct kvec *vec, size_t num,
208 size_t len, int flags); 204 size_t len, int flags);
209 205
206extern int kernel_bind(struct socket *sock, struct sockaddr *addr,
207 int addrlen);
208extern int kernel_listen(struct socket *sock, int backlog);
209extern int kernel_accept(struct socket *sock, struct socket **newsock,
210 int flags);
211extern int kernel_connect(struct socket *sock, struct sockaddr *addr,
212 int addrlen, int flags);
213extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr,
214 int *addrlen);
215extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
216 int *addrlen);
217extern int kernel_getsockopt(struct socket *sock, int level, int optname,
218 char *optval, int *optlen);
219extern int kernel_setsockopt(struct socket *sock, int level, int optname,
220 char *optval, int optlen);
221extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
222 size_t size, int flags);
223extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
224
210#ifndef CONFIG_SMP 225#ifndef CONFIG_SMP
211#define SOCKOPS_WRAPPED(name) name 226#define SOCKOPS_WRAPPED(name) name
212#define SOCKOPS_WRAP(name, fam) 227#define SOCKOPS_WRAP(name, fam)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index bc747e5d71..9264139bd8 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 */
@@ -313,8 +313,15 @@ struct net_device
313 313
314 /* Segmentation offload features */ 314 /* Segmentation offload features */
315#define NETIF_F_GSO_SHIFT 16 315#define NETIF_F_GSO_SHIFT 16
316#define NETIF_F_GSO_MASK 0xffff0000
316#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) 317#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
317#define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT) 318#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
319#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
320#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
321#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
322
323 /* List of features with software fallbacks. */
324#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
318 325
319#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) 326#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
320#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) 327#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
@@ -327,7 +334,6 @@ struct net_device
327 334
328 335
329 struct net_device_stats* (*get_stats)(struct net_device *dev); 336 struct net_device_stats* (*get_stats)(struct net_device *dev);
330 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
331 337
332 /* List of functions to handle Wireless Extensions (instead of ioctl). 338 /* List of functions to handle Wireless Extensions (instead of ioctl).
333 * See <net/iw_handler.h> for details. Jean II */ 339 * See <net/iw_handler.h> for details. Jean II */
@@ -335,7 +341,7 @@ struct net_device
335 /* Instance data managed by the core of Wireless Extensions. */ 341 /* Instance data managed by the core of Wireless Extensions. */
336 struct iw_public_data * wireless_data; 342 struct iw_public_data * wireless_data;
337 343
338 struct ethtool_ops *ethtool_ops; 344 const struct ethtool_ops *ethtool_ops;
339 345
340 /* 346 /*
341 * This marks the end of the "visible" part of the structure. All 347 * This marks the end of the "visible" part of the structure. All
@@ -543,7 +549,9 @@ struct packet_type {
543 struct net_device *, 549 struct net_device *,
544 struct packet_type *, 550 struct packet_type *,
545 struct net_device *); 551 struct net_device *);
546 struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); 552 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
553 int features);
554 int (*gso_send_check)(struct sk_buff *skb);
547 void *af_packet_priv; 555 void *af_packet_priv;
548 struct list_head list; 556 struct list_head list;
549}; 557};
@@ -699,7 +707,6 @@ extern int dev_hard_start_xmit(struct sk_buff *skb,
699 707
700extern void dev_init(void); 708extern void dev_init(void);
701 709
702extern int netdev_nit;
703extern int netdev_budget; 710extern int netdev_budget;
704 711
705/* Called by rtnetlink.c:rtnl_unlock() */ 712/* Called by rtnetlink.c:rtnl_unlock() */
@@ -919,10 +926,10 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
919 926
920static inline int netif_tx_trylock(struct net_device *dev) 927static inline int netif_tx_trylock(struct net_device *dev)
921{ 928{
922 int err = spin_trylock(&dev->_xmit_lock); 929 int ok = spin_trylock(&dev->_xmit_lock);
923 if (!err) 930 if (likely(ok))
924 dev->xmit_lock_owner = smp_processor_id(); 931 dev->xmit_lock_owner = smp_processor_id();
925 return err; 932 return ok;
926} 933}
927 934
928static inline void netif_tx_unlock(struct net_device *dev) 935static inline void netif_tx_unlock(struct net_device *dev)
@@ -968,8 +975,8 @@ extern void dev_mcast_init(void);
968extern int netdev_max_backlog; 975extern int netdev_max_backlog;
969extern int weight_p; 976extern int weight_p;
970extern int netdev_set_master(struct net_device *dev, struct net_device *master); 977extern int netdev_set_master(struct net_device *dev, struct net_device *master);
971extern int skb_checksum_help(struct sk_buff *skb, int inward); 978extern int skb_checksum_help(struct sk_buff *skb);
972extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg); 979extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
973#ifdef CONFIG_BUG 980#ifdef CONFIG_BUG
974extern void netdev_rx_csum_fault(struct net_device *dev); 981extern void netdev_rx_csum_fault(struct net_device *dev);
975#else 982#else
@@ -989,11 +996,51 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
989 996
990extern void linkwatch_run_queue(void); 997extern void linkwatch_run_queue(void);
991 998
999static inline int net_gso_ok(int features, int gso_type)
1000{
1001 int feature = gso_type << NETIF_F_GSO_SHIFT;
1002 return (features & feature) == feature;
1003}
1004
1005static inline int skb_gso_ok(struct sk_buff *skb, int features)
1006{
1007 return net_gso_ok(features, skb_shinfo(skb)->gso_type);
1008}
1009
992static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 1010static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
993{ 1011{
994 int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT; 1012 return skb_is_gso(skb) &&
995 return skb_shinfo(skb)->gso_size && 1013 (!skb_gso_ok(skb, dev->features) ||
996 (dev->features & feature) != feature; 1014 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1015}
1016
1017/* On bonding slaves other than the currently active slave, suppress
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 */
1021static inline int skb_bond_should_drop(struct sk_buff *skb)
1022{
1023 struct net_device *dev = skb->dev;
1024 struct net_device *master = dev->master;
1025
1026 if (master &&
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
1032 if (master->priv_flags & IFF_MASTER_ALB) {
1033 if (skb->pkt_type != PACKET_BROADCAST &&
1034 skb->pkt_type != PACKET_MULTICAST)
1035 return 0;
1036 }
1037 if (master->priv_flags & IFF_MASTER_8023AD &&
1038 skb->protocol == __constant_htons(ETH_P_SLOW))
1039 return 0;
1040
1041 return 1;
1042 }
1043 return 0;
997} 1044}
998 1045
999#endif /* __KERNEL__ */ 1046#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 10168e26a8..b7e67d1d43 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -282,6 +282,12 @@ extern void nf_invalidate_cache(int pf);
282 Returns true or false. */ 282 Returns true or false. */
283extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); 283extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
284 284
285extern u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval,
286 u_int32_t csum);
287extern u_int16_t nf_proto_csum_update(struct sk_buff *skb,
288 u_int32_t oldval, u_int32_t newval,
289 u_int16_t csum, int pseudohdr);
290
285struct nf_afinfo { 291struct nf_afinfo {
286 unsigned short family; 292 unsigned short family;
287 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook, 293 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook,
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
new file mode 100644
index 0000000000..312bd2ffee
--- /dev/null
+++ b/include/linux/netfilter/Kbuild
@@ -0,0 +1,40 @@
1header-y += nf_conntrack_sctp.h
2header-y += nf_conntrack_tuple_common.h
3header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h
6header-y += xt_CLASSIFY.h
7header-y += xt_comment.h
8header-y += xt_connbytes.h
9header-y += xt_connmark.h
10header-y += xt_CONNMARK.h
11header-y += xt_conntrack.h
12header-y += xt_dccp.h
13header-y += xt_dscp.h
14header-y += xt_DSCP.h
15header-y += xt_esp.h
16header-y += xt_helper.h
17header-y += xt_length.h
18header-y += xt_limit.h
19header-y += xt_mac.h
20header-y += xt_mark.h
21header-y += xt_MARK.h
22header-y += xt_multiport.h
23header-y += xt_NFQUEUE.h
24header-y += xt_pkttype.h
25header-y += xt_policy.h
26header-y += xt_realm.h
27header-y += xt_sctp.h
28header-y += xt_state.h
29header-y += xt_string.h
30header-y += xt_tcpmss.h
31header-y += xt_tcpudp.h
32header-y += xt_SECMARK.h
33header-y += xt_CONNSECMARK.h
34
35unifdef-y += nf_conntrack_common.h
36unifdef-y += nf_conntrack_ftp.h
37unifdef-y += nf_conntrack_tcp.h
38unifdef-y += nfnetlink.h
39unifdef-y += x_tables.h
40unifdef-y += xt_physdev.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index d2e4bd7a7a..9e0dae0786 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -125,6 +125,10 @@ enum ip_conntrack_events
125 /* Counter highest bit has been set */ 125 /* Counter highest bit has been set */
126 IPCT_COUNTER_FILLING_BIT = 11, 126 IPCT_COUNTER_FILLING_BIT = 11,
127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), 127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
128
129 /* Mark is set */
130 IPCT_MARK_BIT = 12,
131 IPCT_MARK = (1 << IPCT_MARK_BIT),
128}; 132};
129 133
130enum ip_conntrack_expect_events { 134enum ip_conntrack_expect_events {
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index b2feeffde3..6b01ba2977 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -49,6 +49,7 @@ struct ip_ct_tcp
49 u_int32_t last_seq; /* Last sequence number seen in dir */ 49 u_int32_t last_seq; /* Last sequence number seen in dir */
50 u_int32_t last_ack; /* Last sequence number seen in opposite dir */ 50 u_int32_t last_ack; /* Last sequence number seen in opposite dir */
51 u_int32_t last_end; /* Last seq + len */ 51 u_int32_t last_end; /* Last seq + len */
52 u_int16_t last_win; /* Last window advertisement seen in dir */
52}; 53};
53 54
54#endif /* __KERNEL__ */ 55#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 9f5b12cf48..6d8e3e5a80 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -43,7 +43,7 @@ struct nfattr
43 u_int16_t nfa_len; 43 u_int16_t nfa_len;
44 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest 44 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
45 * bit to indicate whether the payload is nested */ 45 * bit to indicate whether the payload is nested */
46} __attribute__ ((packed)); 46};
47 47
48/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from 48/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from
49 * rtnetlink.h, it's time to put this in a generic file */ 49 * rtnetlink.h, it's time to put this in a generic file */
@@ -79,7 +79,7 @@ struct nfgenmsg {
79 u_int8_t nfgen_family; /* AF_xxx */ 79 u_int8_t nfgen_family; /* AF_xxx */
80 u_int8_t version; /* nfnetlink version */ 80 u_int8_t version; /* nfnetlink version */
81 u_int16_t res_id; /* resource id */ 81 u_int16_t res_id; /* resource id */
82} __attribute__ ((packed)); 82};
83 83
84#define NFNETLINK_V0 0 84#define NFNETLINK_V0 0
85 85
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index a7497c7436..87b92f8b98 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -19,18 +19,18 @@ struct nfulnl_msg_packet_hdr {
19 u_int16_t hw_protocol; /* hw protocol (network order) */ 19 u_int16_t hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */ 20 u_int8_t hook; /* netfilter hook */
21 u_int8_t _pad; 21 u_int8_t _pad;
22} __attribute__ ((packed)); 22};
23 23
24struct nfulnl_msg_packet_hw { 24struct nfulnl_msg_packet_hw {
25 u_int16_t hw_addrlen; 25 u_int16_t hw_addrlen;
26 u_int16_t _pad; 26 u_int16_t _pad;
27 u_int8_t hw_addr[8]; 27 u_int8_t hw_addr[8];
28} __attribute__ ((packed)); 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
31 aligned_u64 sec; 31 aligned_u64 sec;
32 aligned_u64 usec; 32 aligned_u64 usec;
33} __attribute__ ((packed)); 33};
34 34
35#define NFULNL_PREFIXLEN 30 /* just like old log target */ 35#define NFULNL_PREFIXLEN 30 /* just like old log target */
36 36
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 9e77437324..36af0360b5 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -22,12 +22,12 @@ struct nfqnl_msg_packet_hw {
22 u_int16_t hw_addrlen; 22 u_int16_t hw_addrlen;
23 u_int16_t _pad; 23 u_int16_t _pad;
24 u_int8_t hw_addr[8]; 24 u_int8_t hw_addr[8];
25} __attribute__ ((packed)); 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
28 aligned_u64 sec; 28 aligned_u64 sec;
29 aligned_u64 usec; 29 aligned_u64 usec;
30} __attribute__ ((packed)); 30};
31 31
32enum nfqnl_attr_type { 32enum nfqnl_attr_type {
33 NFQA_UNSPEC, 33 NFQA_UNSPEC,
@@ -49,7 +49,7 @@ enum nfqnl_attr_type {
49struct nfqnl_msg_verdict_hdr { 49struct nfqnl_msg_verdict_hdr {
50 u_int32_t verdict; 50 u_int32_t verdict;
51 u_int32_t id; 51 u_int32_t id;
52} __attribute__ ((packed)); 52};
53 53
54 54
55enum nfqnl_msg_config_cmds { 55enum nfqnl_msg_config_cmds {
@@ -64,7 +64,7 @@ struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */ 64 u_int8_t command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad; 65 u_int8_t _pad;
66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ 66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */
67} __attribute__ ((packed)); 67};
68 68
69enum nfqnl_config_mode { 69enum nfqnl_config_mode {
70 NFQNL_COPY_NONE, 70 NFQNL_COPY_NONE,
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 48cc32d83f..04319a7610 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -138,16 +138,6 @@ struct xt_counters_info
138 138
139#include <linux/netdevice.h> 139#include <linux/netdevice.h>
140 140
141#define ASSERT_READ_LOCK(x)
142#define ASSERT_WRITE_LOCK(x)
143#include <linux/netfilter_ipv4/listhelp.h>
144
145#ifdef CONFIG_COMPAT
146#define COMPAT_TO_USER 1
147#define COMPAT_FROM_USER -1
148#define COMPAT_CALC_SIZE 0
149#endif
150
151struct xt_match 141struct xt_match
152{ 142{
153 struct list_head list; 143 struct list_head list;
@@ -174,21 +164,24 @@ struct xt_match
174 const void *ip, 164 const void *ip,
175 const struct xt_match *match, 165 const struct xt_match *match,
176 void *matchinfo, 166 void *matchinfo,
177 unsigned int matchinfosize,
178 unsigned int hook_mask); 167 unsigned int hook_mask);
179 168
180 /* Called when entry of this type deleted. */ 169 /* Called when entry of this type deleted. */
181 void (*destroy)(const struct xt_match *match, void *matchinfo, 170 void (*destroy)(const struct xt_match *match, void *matchinfo);
182 unsigned int matchinfosize);
183 171
184 /* Called when userspace align differs from kernel space one */ 172 /* Called when userspace align differs from kernel space one */
185 int (*compat)(void *match, void **dstptr, int *size, int convert); 173 void (*compat_from_user)(void *dst, void *src);
174 int (*compat_to_user)(void __user *dst, void *src);
186 175
187 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 176 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
188 struct module *me; 177 struct module *me;
189 178
179 /* Free to use by each match */
180 unsigned long data;
181
190 char *table; 182 char *table;
191 unsigned int matchsize; 183 unsigned int matchsize;
184 unsigned int compatsize;
192 unsigned int hooks; 185 unsigned int hooks;
193 unsigned short proto; 186 unsigned short proto;
194 187
@@ -211,8 +204,7 @@ struct xt_target
211 const struct net_device *out, 204 const struct net_device *out,
212 unsigned int hooknum, 205 unsigned int hooknum,
213 const struct xt_target *target, 206 const struct xt_target *target,
214 const void *targinfo, 207 const void *targinfo);
215 void *userdata);
216 208
217 /* Called when user tries to insert an entry of this type: 209 /* Called when user tries to insert an entry of this type:
218 hook_mask is a bitmask of hooks from which it can be 210 hook_mask is a bitmask of hooks from which it can be
@@ -222,21 +214,21 @@ struct xt_target
222 const void *entry, 214 const void *entry,
223 const struct xt_target *target, 215 const struct xt_target *target,
224 void *targinfo, 216 void *targinfo,
225 unsigned int targinfosize,
226 unsigned int hook_mask); 217 unsigned int hook_mask);
227 218
228 /* Called when entry of this type deleted. */ 219 /* Called when entry of this type deleted. */
229 void (*destroy)(const struct xt_target *target, void *targinfo, 220 void (*destroy)(const struct xt_target *target, void *targinfo);
230 unsigned int targinfosize);
231 221
232 /* Called when userspace align differs from kernel space one */ 222 /* Called when userspace align differs from kernel space one */
233 int (*compat)(void *target, void **dstptr, int *size, int convert); 223 void (*compat_from_user)(void *dst, void *src);
224 int (*compat_to_user)(void __user *dst, void *src);
234 225
235 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 226 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
236 struct module *me; 227 struct module *me;
237 228
238 char *table; 229 char *table;
239 unsigned int targetsize; 230 unsigned int targetsize;
231 unsigned int compatsize;
240 unsigned int hooks; 232 unsigned int hooks;
241 unsigned short proto; 233 unsigned short proto;
242 234
@@ -290,8 +282,13 @@ struct xt_table_info
290 282
291extern int xt_register_target(struct xt_target *target); 283extern int xt_register_target(struct xt_target *target);
292extern void xt_unregister_target(struct xt_target *target); 284extern void xt_unregister_target(struct xt_target *target);
285extern int xt_register_targets(struct xt_target *target, unsigned int n);
286extern void xt_unregister_targets(struct xt_target *target, unsigned int n);
287
293extern int xt_register_match(struct xt_match *target); 288extern int xt_register_match(struct xt_match *target);
294extern void xt_unregister_match(struct xt_match *target); 289extern void xt_unregister_match(struct xt_match *target);
290extern int xt_register_matches(struct xt_match *match, unsigned int n);
291extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
295 292
296extern int xt_check_match(const struct xt_match *match, unsigned short family, 293extern int xt_check_match(const struct xt_match *match, unsigned short family,
297 unsigned int size, const char *table, unsigned int hook, 294 unsigned int size, const char *table, unsigned int hook,
@@ -388,9 +385,18 @@ struct compat_xt_counters_info
388 385
389extern void xt_compat_lock(int af); 386extern void xt_compat_lock(int af);
390extern void xt_compat_unlock(int af); 387extern void xt_compat_unlock(int af);
391extern int xt_compat_match(void *match, void **dstptr, int *size, int convert); 388
392extern int xt_compat_target(void *target, void **dstptr, int *size, 389extern int xt_compat_match_offset(struct xt_match *match);
393 int convert); 390extern void xt_compat_match_from_user(struct xt_entry_match *m,
391 void **dstptr, int *size);
392extern int xt_compat_match_to_user(struct xt_entry_match *m,
393 void __user **dstptr, int *size);
394
395extern int xt_compat_target_offset(struct xt_target *target);
396extern void xt_compat_target_from_user(struct xt_entry_target *t,
397 void **dstptr, int *size);
398extern int xt_compat_target_to_user(struct xt_entry_target *t,
399 void __user **dstptr, int *size);
394 400
395#endif /* CONFIG_COMPAT */ 401#endif /* CONFIG_COMPAT */
396#endif /* __KERNEL__ */ 402#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h
new file mode 100644
index 0000000000..3c7c963997
--- /dev/null
+++ b/include/linux/netfilter/xt_DSCP.h
@@ -0,0 +1,20 @@
1/* x_tables module for setting the IPv4/IPv6 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * See RFC2474 for a description of the DSCP field within the IP Header.
8 *
9 * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
10*/
11#ifndef _XT_DSCP_TARGET_H
12#define _XT_DSCP_TARGET_H
13#include <linux/netfilter/xt_dscp.h>
14
15/* target info */
16struct xt_DSCP_info {
17 u_int8_t dscp;
18};
19
20#endif /* _XT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h
new file mode 100644
index 0000000000..1da61e6aca
--- /dev/null
+++ b/include/linux/netfilter/xt_dscp.h
@@ -0,0 +1,23 @@
1/* x_tables module for matching the IPv4/IPv6 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * This software is distributed under GNU GPL v2, 1991
5 *
6 * See RFC2474 for a description of the DSCP field within the IP Header.
7 *
8 * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
9*/
10#ifndef _XT_DSCP_H
11#define _XT_DSCP_H
12
13#define XT_DSCP_MASK 0xfc /* 11111100 */
14#define XT_DSCP_SHIFT 2
15#define XT_DSCP_MAX 0x3f /* 00111111 */
16
17/* match info */
18struct xt_dscp_info {
19 u_int8_t dscp;
20 u_int8_t invert;
21};
22
23#endif /* _XT_DSCP_H */
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild
new file mode 100644
index 0000000000..4f13dfcb92
--- /dev/null
+++ b/include/linux/netfilter_arp/Kbuild
@@ -0,0 +1,3 @@
1header-y += arpt_mangle.h
2
3unifdef-y += arp_tables.h
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 62cc27daca..44e39b61d9 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.
@@ -248,8 +248,7 @@ extern unsigned int arpt_do_table(struct sk_buff **pskb,
248 unsigned int hook, 248 unsigned int hook,
249 const struct net_device *in, 249 const struct net_device *in,
250 const struct net_device *out, 250 const struct net_device *out,
251 struct arpt_table *table, 251 struct arpt_table *table);
252 void *userdata);
253 252
254#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) 253#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1))
255#endif /*__KERNEL__*/ 254#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 87764022cc..9a4dd11af8 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -5,10 +5,8 @@
5 */ 5 */
6 6
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER)
9#include <asm/atomic.h>
10#include <linux/if_ether.h> 8#include <linux/if_ether.h>
11#endif 9#include <linux/if_vlan.h>
12 10
13/* Bridge Hooks */ 11/* Bridge Hooks */
14/* After promisc drops, checksum checks. */ 12/* After promisc drops, checksum checks. */
@@ -48,30 +46,20 @@ enum nf_br_hook_priorities {
48 46
49 47
50/* Only used in br_forward.c */ 48/* Only used in br_forward.c */
51static inline 49extern int nf_bridge_copy_header(struct sk_buff *skb);
52void nf_bridge_maybe_copy_header(struct sk_buff *skb) 50static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
53{ 51{
54 if (skb->nf_bridge) { 52 if (skb->nf_bridge)
55 if (skb->protocol == __constant_htons(ETH_P_8021Q)) { 53 return nf_bridge_copy_header(skb);
56 memcpy(skb->data - 18, skb->nf_bridge->data, 18); 54 return 0;
57 skb_push(skb, 4);
58 } else
59 memcpy(skb->data - 16, skb->nf_bridge->data, 16);
60 }
61} 55}
62 56
63/* This is called by the IP fragmenting code and it ensures there is 57/* This is called by the IP fragmenting code and it ensures there is
64 * enough room for the encapsulating header (if there is one). */ 58 * enough room for the encapsulating header (if there is one). */
65static inline 59static inline int nf_bridge_pad(const struct sk_buff *skb)
66int nf_bridge_pad(struct sk_buff *skb)
67{ 60{
68 if (skb->protocol == __constant_htons(ETH_P_IP)) 61 return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
69 return 0; 62 ? VLAN_HLEN : 0;
70 if (skb->nf_bridge) {
71 if (skb->protocol == __constant_htons(ETH_P_8021Q))
72 return 4;
73 }
74 return 0;
75} 63}
76 64
77struct bridge_skb_cb { 65struct bridge_skb_cb {
@@ -79,6 +67,11 @@ struct bridge_skb_cb {
79 __u32 ipv4; 67 __u32 ipv4;
80 } daddr; 68 } daddr;
81}; 69};
70
71extern int brnf_deferred_hooks;
72#else
73#define nf_bridge_maybe_copy_header(skb) (0)
74#define nf_bridge_pad(skb) (0)
82#endif /* CONFIG_BRIDGE_NETFILTER */ 75#endif /* CONFIG_BRIDGE_NETFILTER */
83 76
84#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
new file mode 100644
index 0000000000..76ff4c47d8
--- /dev/null
+++ b/include/linux/netfilter_bridge/Kbuild
@@ -0,0 +1,17 @@
1header-y += ebt_among.h
2header-y += ebt_arp.h
3header-y += ebt_arpreply.h
4header-y += ebt_ip.h
5header-y += ebt_limit.h
6header-y += ebt_log.h
7header-y += ebt_mark_m.h
8header-y += ebt_mark_t.h
9header-y += ebt_nat.h
10header-y += ebt_pkttype.h
11header-y += ebt_redirect.h
12header-y += ebt_stp.h
13header-y += ebt_ulog.h
14header-y += ebt_vlan.h
15
16unifdef-y += ebtables.h
17unifdef-y += ebt_802_3.h
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
new file mode 100644
index 0000000000..591c1a809c
--- /dev/null
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -0,0 +1,63 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_helper_h323_asn1.h
3header-y += ip_conntrack_helper_h323_types.h
4header-y += ip_conntrack_protocol.h
5header-y += ip_conntrack_sctp.h
6header-y += ip_conntrack_tcp.h
7header-y += ip_conntrack_tftp.h
8header-y += ip_nat_pptp.h
9header-y += ipt_addrtype.h
10header-y += ipt_ah.h
11header-y += ipt_CLASSIFY.h
12header-y += ipt_CLUSTERIP.h
13header-y += ipt_comment.h
14header-y += ipt_connbytes.h
15header-y += ipt_connmark.h
16header-y += ipt_CONNMARK.h
17header-y += ipt_conntrack.h
18header-y += ipt_dccp.h
19header-y += ipt_dscp.h
20header-y += ipt_DSCP.h
21header-y += ipt_ecn.h
22header-y += ipt_ECN.h
23header-y += ipt_esp.h
24header-y += ipt_hashlimit.h
25header-y += ipt_helper.h
26header-y += ipt_iprange.h
27header-y += ipt_length.h
28header-y += ipt_limit.h
29header-y += ipt_LOG.h
30header-y += ipt_mac.h
31header-y += ipt_mark.h
32header-y += ipt_MARK.h
33header-y += ipt_multiport.h
34header-y += ipt_NFQUEUE.h
35header-y += ipt_owner.h
36header-y += ipt_physdev.h
37header-y += ipt_pkttype.h
38header-y += ipt_policy.h
39header-y += ipt_realm.h
40header-y += ipt_recent.h
41header-y += ipt_REJECT.h
42header-y += ipt_SAME.h
43header-y += ipt_sctp.h
44header-y += ipt_state.h
45header-y += ipt_string.h
46header-y += ipt_tcpmss.h
47header-y += ipt_TCPMSS.h
48header-y += ipt_tos.h
49header-y += ipt_TOS.h
50header-y += ipt_ttl.h
51header-y += ipt_TTL.h
52header-y += ipt_ULOG.h
53
54unifdef-y += ip_conntrack.h
55unifdef-y += ip_conntrack_h323.h
56unifdef-y += ip_conntrack_irc.h
57unifdef-y += ip_conntrack_pptp.h
58unifdef-y += ip_conntrack_proto_gre.h
59unifdef-y += ip_conntrack_tuple.h
60unifdef-y += ip_nat.h
61unifdef-y += ip_nat_rule.h
62unifdef-y += ip_queue.h
63unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 51dbec1892..64e868034c 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 3cbff73790..943cc6a487 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_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
index 8d69279ccf..77fe868d36 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
@@ -25,6 +25,8 @@ struct ip_conntrack_helper
25 struct ip_conntrack *ct, 25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo); 26 enum ip_conntrack_info conntrackinfo);
27 27
28 void (*destroy)(struct ip_conntrack *ct);
29
28 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct); 30 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
29}; 31};
30 32
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
index 816144c75d..2644b1fadd 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
@@ -31,8 +31,8 @@ struct ip_ct_pptp_master {
31 /* everything below is going to be per-expectation in newnat, 31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */ 32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */ 33 enum pptp_ctrlcall_state cstate; /* call state */
34 u_int16_t pac_call_id; /* call id of PAC, host byte order */ 34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 u_int16_t pns_call_id; /* call id of PNS, host byte order */ 35 __be16 pns_call_id; /* call id of PNS, host byte order */
36 36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack 37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */ 38 * and therefore imposes a fixed limit on the number of maps */
@@ -42,8 +42,8 @@ struct ip_ct_pptp_master {
42/* conntrack_expect private member */ 42/* conntrack_expect private member */
43struct ip_ct_pptp_expect { 43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */ 44 enum pptp_ctrlcall_state cstate; /* call state */
45 u_int16_t pac_call_id; /* call id of PAC */ 45 __be16 pac_call_id; /* call id of PAC */
46 u_int16_t pns_call_id; /* call id of PNS */ 46 __be16 pns_call_id; /* call id of PNS */
47}; 47};
48 48
49 49
@@ -107,8 +107,7 @@ struct PptpControlHeader {
107 107
108struct PptpStartSessionRequest { 108struct PptpStartSessionRequest {
109 __be16 protocolVersion; 109 __be16 protocolVersion;
110 __u8 reserved1; 110 __u16 reserved1;
111 __u8 reserved2;
112 __be32 framingCapability; 111 __be32 framingCapability;
113 __be32 bearerCapability; 112 __be32 bearerCapability;
114 __be16 maxChannels; 113 __be16 maxChannels;
@@ -143,6 +142,8 @@ struct PptpStartSessionReply {
143 142
144struct PptpStopSessionRequest { 143struct PptpStopSessionRequest {
145 __u8 reason; 144 __u8 reason;
145 __u8 reserved1;
146 __u16 reserved2;
146}; 147};
147 148
148/* PptpStopSessionResultCode */ 149/* PptpStopSessionResultCode */
@@ -152,6 +153,7 @@ struct PptpStopSessionRequest {
152struct PptpStopSessionReply { 153struct PptpStopSessionReply {
153 __u8 resultCode; 154 __u8 resultCode;
154 __u8 generalErrorCode; 155 __u8 generalErrorCode;
156 __u16 reserved1;
155}; 157};
156 158
157struct PptpEchoRequest { 159struct PptpEchoRequest {
@@ -188,9 +190,8 @@ struct PptpOutCallRequest {
188 __be32 framingType; 190 __be32 framingType;
189 __be16 packetWindow; 191 __be16 packetWindow;
190 __be16 packetProcDelay; 192 __be16 packetProcDelay;
191 __u16 reserved1;
192 __be16 phoneNumberLength; 193 __be16 phoneNumberLength;
193 __u16 reserved2; 194 __u16 reserved1;
194 __u8 phoneNumber[64]; 195 __u8 phoneNumber[64];
195 __u8 subAddress[64]; 196 __u8 subAddress[64];
196}; 197};
@@ -285,19 +286,19 @@ struct PptpSetLinkInfo {
285}; 286};
286 287
287union pptp_ctrl_union { 288union pptp_ctrl_union {
288 struct PptpStartSessionRequest sreq; 289 struct PptpStartSessionRequest sreq;
289 struct PptpStartSessionReply srep; 290 struct PptpStartSessionReply srep;
290 struct PptpStopSessionRequest streq; 291 struct PptpStopSessionRequest streq;
291 struct PptpStopSessionReply strep; 292 struct PptpStopSessionReply strep;
292 struct PptpOutCallRequest ocreq; 293 struct PptpOutCallRequest ocreq;
293 struct PptpOutCallReply ocack; 294 struct PptpOutCallReply ocack;
294 struct PptpInCallRequest icreq; 295 struct PptpInCallRequest icreq;
295 struct PptpInCallReply icack; 296 struct PptpInCallReply icack;
296 struct PptpInCallConnected iccon; 297 struct PptpInCallConnected iccon;
297 struct PptpClearCallRequest clrreq; 298 struct PptpClearCallRequest clrreq;
298 struct PptpCallDisconnectNotify disc; 299 struct PptpCallDisconnectNotify disc;
299 struct PptpWanErrorNotify wanerr; 300 struct PptpWanErrorNotify wanerr;
300 struct PptpSetLinkInfo setlink; 301 struct PptpSetLinkInfo setlink;
301}; 302};
302 303
303extern int 304extern int
@@ -314,7 +315,7 @@ extern int
314 struct PptpControlHeader *ctlh, 315 struct PptpControlHeader *ctlh,
315 union pptp_ctrl_union *pptpReq); 316 union pptp_ctrl_union *pptpReq);
316 317
317extern int 318extern void
318(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig, 319(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
319 struct ip_conntrack_expect *exp_reply); 320 struct ip_conntrack_expect *exp_reply);
320 321
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
index 8d090ef82f..1d853aa873 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
@@ -49,18 +49,18 @@ struct gre_hdr {
49#else 49#else
50#error "Adjust your <asm/byteorder.h> defines" 50#error "Adjust your <asm/byteorder.h> defines"
51#endif 51#endif
52 __u16 protocol; 52 __be16 protocol;
53}; 53};
54 54
55/* modified GRE header for PPTP */ 55/* modified GRE header for PPTP */
56struct gre_hdr_pptp { 56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */ 57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */ 58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __u16 protocol; /* should be GRE_PROTOCOL_PPTP */ 59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __u16 payload_len; /* size of ppp payload, not inc. gre header */ 60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __u16 call_id; /* peer's call_id for this session */ 61 __be16 call_id; /* peer's call_id for this session */
62 __u32 seq; /* sequence number. Present if S==1 */ 62 __be32 seq; /* sequence number. Present if S==1 */
63 __u32 ack; /* seq number of highest packet recieved by */ 63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */ 64 /* sender in this session */
65}; 65};
66 66
@@ -92,13 +92,13 @@ void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92 92
93 93
94/* get pointer to gre key, if present */ 94/* get pointer to gre key, if present */
95static inline u_int32_t *gre_key(struct gre_hdr *greh) 95static inline __be32 *gre_key(struct gre_hdr *greh)
96{ 96{
97 if (!greh->key) 97 if (!greh->key)
98 return NULL; 98 return NULL;
99 if (greh->csum || greh->routing) 99 if (greh->csum || greh->routing)
100 return (u_int32_t *) (greh+sizeof(*greh)+4); 100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (u_int32_t *) (greh+sizeof(*greh)); 101 return (__be32 *) (greh+sizeof(*greh));
102} 102}
103 103
104/* get pointer ot gre csum, if present */ 104/* get pointer ot gre csum, if present */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
index 2fdabdb4c0..c228bde74c 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 e9f5ed1d9f..bdf553620c 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;
@@ -72,10 +72,6 @@ extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
72extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, 72extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
73 const struct ip_conntrack *ignored_conntrack); 73 const struct ip_conntrack *ignored_conntrack);
74 74
75/* Calculate relative checksum. */
76extern u_int16_t ip_nat_cheat_check(u_int32_t oldvalinv,
77 u_int32_t newval,
78 u_int16_t oldcheck);
79#else /* !__KERNEL__: iptables wants this to compile. */ 75#else /* !__KERNEL__: iptables wants this to compile. */
80#define ip_nat_multi_range ip_nat_multi_range_compat 76#define ip_nat_multi_range ip_nat_multi_range_compat
81#endif /*__KERNEL__*/ 77#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
index 30db23f06b..60566f9fd7 100644
--- a/include/linux/netfilter_ipv4/ip_nat_core.h
+++ b/include/linux/netfilter_ipv4/ip_nat_core.h
@@ -11,8 +11,8 @@ extern unsigned int ip_nat_packet(struct ip_conntrack *ct,
11 unsigned int hooknum, 11 unsigned int hooknum,
12 struct sk_buff **pskb); 12 struct sk_buff **pskb);
13 13
14extern int ip_nat_icmp_reply_translation(struct sk_buff **pskb, 14extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
15 struct ip_conntrack *ct, 15 enum ip_conntrack_info ctinfo,
16 enum ip_nat_manip_type manip, 16 unsigned int hooknum,
17 enum ip_conntrack_dir dir); 17 struct sk_buff **pskb);
18#endif /* _IP_NAT_CORE_H */ 18#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
index eaf66c2e8f..36668bf0f3 100644
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ b/include/linux/netfilter_ipv4/ip_nat_pptp.h
@@ -4,8 +4,8 @@
4 4
5/* conntrack private data */ 5/* conntrack private data */
6struct ip_nat_pptp { 6struct ip_nat_pptp {
7 u_int16_t pns_call_id; /* NAT'ed PNS call id */ 7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 u_int16_t pac_call_id; /* NAT'ed PAC call id */ 8 __be16 pac_call_id; /* NAT'ed PAC call id */
9}; 9};
10 10
11#endif /* _NAT_PPTP_H */ 11#endif /* _NAT_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
index aa08d68c48..a03507f465 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/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index c0dac16e19..a536bbdef1 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -312,8 +312,7 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
312 unsigned int hook, 312 unsigned int hook,
313 const struct net_device *in, 313 const struct net_device *in,
314 const struct net_device *out, 314 const struct net_device *out,
315 struct ipt_table *table, 315 struct ipt_table *table);
316 void *userdata);
317 316
318#define IPT_ALIGN(s) XT_ALIGN(s) 317#define IPT_ALIGN(s) XT_ALIGN(s)
319 318
diff --git a/include/linux/netfilter_ipv4/ipt_DSCP.h b/include/linux/netfilter_ipv4/ipt_DSCP.h
index b30f510b5b..3491e524d5 100644
--- a/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ b/include/linux/netfilter_ipv4/ipt_DSCP.h
@@ -11,10 +11,8 @@
11#ifndef _IPT_DSCP_TARGET_H 11#ifndef _IPT_DSCP_TARGET_H
12#define _IPT_DSCP_TARGET_H 12#define _IPT_DSCP_TARGET_H
13#include <linux/netfilter_ipv4/ipt_dscp.h> 13#include <linux/netfilter_ipv4/ipt_dscp.h>
14#include <linux/netfilter/xt_DSCP.h>
14 15
15/* target info */ 16#define ipt_DSCP_info xt_DSCP_info
16struct ipt_DSCP_info {
17 u_int8_t dscp;
18};
19 17
20#endif /* _IPT_DSCP_TARGET_H */ 18#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_dscp.h b/include/linux/netfilter_ipv4/ipt_dscp.h
index 2fa6dfe928..4b82ca912b 100644
--- a/include/linux/netfilter_ipv4/ipt_dscp.h
+++ b/include/linux/netfilter_ipv4/ipt_dscp.h
@@ -10,14 +10,12 @@
10#ifndef _IPT_DSCP_H 10#ifndef _IPT_DSCP_H
11#define _IPT_DSCP_H 11#define _IPT_DSCP_H
12 12
13#define IPT_DSCP_MASK 0xfc /* 11111100 */ 13#include <linux/netfilter/xt_dscp.h>
14#define IPT_DSCP_SHIFT 2
15#define IPT_DSCP_MAX 0x3f /* 00111111 */
16 14
17/* match info */ 15#define IPT_DSCP_MASK XT_DSCP_MASK
18struct ipt_dscp_info { 16#define IPT_DSCP_SHIFT XT_DSCP_SHIFT
19 u_int8_t dscp; 17#define IPT_DSCP_MAX XT_DSCP_MAX
20 u_int8_t invert; 18
21}; 19#define ipt_dscp_info xt_dscp_info
22 20
23#endif /* _IPT_DSCP_H */ 21#endif /* _IPT_DSCP_H */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index 3ecb3bd636..34ab0fb736 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/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h
deleted file mode 100644
index 5d92cf044d..0000000000
--- a/include/linux/netfilter_ipv4/listhelp.h
+++ /dev/null
@@ -1,123 +0,0 @@
1#ifndef _LISTHELP_H
2#define _LISTHELP_H
3#include <linux/list.h>
4
5/* Header to do more comprehensive job than linux/list.h; assume list
6 is first entry in structure. */
7
8/* Return pointer to first true entry, if any, or NULL. A macro
9 required to allow inlining of cmpfn. */
10#define LIST_FIND(head, cmpfn, type, args...) \
11({ \
12 const struct list_head *__i, *__j = NULL; \
13 \
14 ASSERT_READ_LOCK(head); \
15 list_for_each(__i, (head)) \
16 if (cmpfn((const type)__i , ## args)) { \
17 __j = __i; \
18 break; \
19 } \
20 (type)__j; \
21})
22
23#define LIST_FIND_W(head, cmpfn, type, args...) \
24({ \
25 const struct list_head *__i, *__j = NULL; \
26 \
27 ASSERT_WRITE_LOCK(head); \
28 list_for_each(__i, (head)) \
29 if (cmpfn((type)__i , ## args)) { \
30 __j = __i; \
31 break; \
32 } \
33 (type)__j; \
34})
35
36/* Just like LIST_FIND but we search backwards */
37#define LIST_FIND_B(head, cmpfn, type, args...) \
38({ \
39 const struct list_head *__i, *__j = NULL; \
40 \
41 ASSERT_READ_LOCK(head); \
42 list_for_each_prev(__i, (head)) \
43 if (cmpfn((const type)__i , ## args)) { \
44 __j = __i; \
45 break; \
46 } \
47 (type)__j; \
48})
49
50static inline int
51__list_cmp_same(const void *p1, const void *p2) { return p1 == p2; }
52
53/* Is this entry in the list? */
54static inline int
55list_inlist(struct list_head *head, const void *entry)
56{
57 return LIST_FIND(head, __list_cmp_same, void *, entry) != NULL;
58}
59
60/* Delete from list. */
61#ifdef CONFIG_NETFILTER_DEBUG
62#define LIST_DELETE(head, oldentry) \
63do { \
64 ASSERT_WRITE_LOCK(head); \
65 if (!list_inlist(head, oldentry)) \
66 printk("LIST_DELETE: %s:%u `%s'(%p) not in %s.\n", \
67 __FILE__, __LINE__, #oldentry, oldentry, #head); \
68 else list_del((struct list_head *)oldentry); \
69} while(0)
70#else
71#define LIST_DELETE(head, oldentry) list_del((struct list_head *)oldentry)
72#endif
73
74/* Append. */
75static inline void
76list_append(struct list_head *head, void *new)
77{
78 ASSERT_WRITE_LOCK(head);
79 list_add((new), (head)->prev);
80}
81
82/* Prepend. */
83static inline void
84list_prepend(struct list_head *head, void *new)
85{
86 ASSERT_WRITE_LOCK(head);
87 list_add(new, head);
88}
89
90/* Insert according to ordering function; insert before first true. */
91#define LIST_INSERT(head, new, cmpfn) \
92do { \
93 struct list_head *__i; \
94 ASSERT_WRITE_LOCK(head); \
95 list_for_each(__i, (head)) \
96 if ((new), (typeof (new))__i) \
97 break; \
98 list_add((struct list_head *)(new), __i->prev); \
99} while(0)
100
101/* If the field after the list_head is a nul-terminated string, you
102 can use these functions. */
103static inline int __list_cmp_name(const void *i, const char *name)
104{
105 return strcmp(name, i+sizeof(struct list_head)) == 0;
106}
107
108/* Returns false if same name already in list, otherwise does insert. */
109static inline int
110list_named_insert(struct list_head *head, void *new)
111{
112 if (LIST_FIND(head, __list_cmp_name, void *,
113 new + sizeof(struct list_head)))
114 return 0;
115 list_prepend(head, new);
116 return 1;
117}
118
119/* Find this named element in the list. */
120#define list_named_find(head, name) \
121LIST_FIND(head, __list_cmp_name, void *, name)
122
123#endif /*_LISTHELP_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 52a7b9e764..d97e268cdf 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -73,6 +73,7 @@ enum nf_ip6_hook_priorities {
73}; 73};
74 74
75#ifdef CONFIG_NETFILTER 75#ifdef CONFIG_NETFILTER
76extern int ip6_route_me_harder(struct sk_buff *skb);
76extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 77extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
77 unsigned int dataoff, u_int8_t protocol); 78 unsigned int dataoff, u_int8_t protocol);
78 79
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
new file mode 100644
index 0000000000..9dd978d149
--- /dev/null
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -0,0 +1,21 @@
1header-y += ip6t_HL.h
2header-y += ip6t_LOG.h
3header-y += ip6t_MARK.h
4header-y += ip6t_REJECT.h
5header-y += ip6t_ah.h
6header-y += ip6t_esp.h
7header-y += ip6t_frag.h
8header-y += ip6t_hl.h
9header-y += ip6t_ipv6header.h
10header-y += ip6t_length.h
11header-y += ip6t_limit.h
12header-y += ip6t_mac.h
13header-y += ip6t_mark.h
14header-y += ip6t_multiport.h
15header-y += ip6t_opts.h
16header-y += ip6t_owner.h
17header-y += ip6t_policy.h
18header-y += ip6t_physdev.h
19header-y += ip6t_rt.h
20
21unifdef-y += ip6_tables.h
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index d0d5d1ee4b..d7a8e9c0da 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -300,8 +300,7 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb,
300 unsigned int hook, 300 unsigned int hook,
301 const struct net_device *in, 301 const struct net_device *in,
302 const struct net_device *out, 302 const struct net_device *out,
303 struct ip6t_table *table, 303 struct ip6t_table *table);
304 void *userdata);
305 304
306/* Check for an extension */ 305/* Check for an extension */
307extern int ip6t_ext_hdr(u8 nexthdr); 306extern int ip6t_ext_hdr(u8 nexthdr);
diff --git a/include/linux/netfilter_logging.h b/include/linux/netfilter_logging.h
deleted file mode 100644
index 562bb6aad4..0000000000
--- a/include/linux/netfilter_logging.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Internal logging interface, which relies on the real
2 LOG target modules */
3#ifndef __LINUX_NETFILTER_LOGGING_H
4#define __LINUX_NETFILTER_LOGGING_H
5
6#ifdef __KERNEL__
7#include <asm/atomic.h>
8
9struct nf_logging_t {
10 void (*nf_log_packet)(struct sk_buff **pskb,
11 unsigned int hooknum,
12 const struct net_device *in,
13 const struct net_device *out,
14 const char *prefix);
15 void (*nf_log)(char *pfh, size_t len,
16 const char *prefix);
17};
18
19extern void nf_log_register(int pf, const struct nf_logging_t *logging);
20extern void nf_log_unregister(int pf, const struct nf_logging_t *logging);
21
22extern void nf_log_packet(int pf,
23 struct sk_buff **pskb,
24 unsigned int hooknum,
25 const struct net_device *in,
26 const struct net_device *out,
27 const char *fmt, ...);
28extern void nf_log(int pf,
29 char *pfh, size_t len,
30 const char *fmt, ...);
31#endif /*__KERNEL__*/
32
33#endif /*__LINUX_NETFILTER_LOGGING_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 855b44668c..66411622e0 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -21,6 +21,8 @@
21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ 22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
23#define NETLINK_GENERIC 16 23#define NETLINK_GENERIC 16
24/* leave room for NETLINK_DM (DM Events) */
25#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
24 26
25#define MAX_LINKS 32 27#define MAX_LINKS 32
26 28
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index ca5a873300..1efe60c5c0 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -31,6 +31,7 @@ struct netpoll_info {
31 int rx_flags; 31 int rx_flags;
32 spinlock_t rx_lock; 32 spinlock_t rx_lock;
33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
34 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
34}; 35};
35 36
36void netpoll_poll(struct netpoll *np); 37void netpoll_poll(struct netpoll *np);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 1059e6d69d..db05182ca0 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -157,6 +157,12 @@ enum nfs_opnum4 {
157 OP_ILLEGAL = 10044, 157 OP_ILLEGAL = 10044,
158}; 158};
159 159
160/*Defining first and last NFS4 operations implemented.
161Needs to be updated if more operations are defined in future.*/
162
163#define FIRST_NFS4_OP OP_ACCESS
164#define LAST_NFS4_OP OP_RELEASE_LOCKOWNER
165
160enum nfsstat4 { 166enum nfsstat4 {
161 NFS4_OK = 0, 167 NFS4_OK = 0,
162 NFS4ERR_PERM = 1, 168 NFS4ERR_PERM = 1,
@@ -384,6 +390,7 @@ enum {
384 NFSPROC4_CLNT_DELEGRETURN, 390 NFSPROC4_CLNT_DELEGRETURN,
385 NFSPROC4_CLNT_GETACL, 391 NFSPROC4_CLNT_GETACL,
386 NFSPROC4_CLNT_SETACL, 392 NFSPROC4_CLNT_SETACL,
393 NFSPROC4_CLNT_FS_LOCATIONS,
387}; 394};
388 395
389#endif 396#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7e079f8ce1..98c9b9f667 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -9,6 +9,7 @@
9#ifndef _LINUX_NFS_FS_H 9#ifndef _LINUX_NFS_FS_H
10#define _LINUX_NFS_FS_H 10#define _LINUX_NFS_FS_H
11 11
12#include <linux/magic.h>
12 13
13/* 14/*
14 * Enable debugging support for nfs client. 15 * Enable debugging support for nfs client.
@@ -23,16 +24,6 @@
23#define NFS_MAX_TCP_TIMEOUT (600*HZ) 24#define NFS_MAX_TCP_TIMEOUT (600*HZ)
24 25
25/* 26/*
26 * superblock magic number for NFS
27 */
28#define NFS_SUPER_MAGIC 0x6969
29
30/*
31 * These are the default flags for swap requests
32 */
33#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)
34
35/*
36 * When flushing a cluster of dirty pages, there can be different 27 * When flushing a cluster of dirty pages, there can be different
37 * strategies: 28 * strategies:
38 */ 29 */
@@ -41,16 +32,17 @@
41#define FLUSH_LOWPRI 8 /* low priority background flush */ 32#define FLUSH_LOWPRI 8 /* low priority background flush */
42#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 33#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
43#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ 34#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
35#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */
44 36
45#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
46#include <linux/in.h> 39#include <linux/in.h>
47#include <linux/mm.h> 40#include <linux/mm.h>
48#include <linux/pagemap.h> 41#include <linux/pagemap.h>
42#include <linux/rbtree.h>
49#include <linux/rwsem.h> 43#include <linux/rwsem.h>
50#include <linux/wait.h> 44#include <linux/wait.h>
51 45
52#include <linux/nfs_fs_sb.h>
53
54#include <linux/sunrpc/debug.h> 46#include <linux/sunrpc/debug.h>
55#include <linux/sunrpc/auth.h> 47#include <linux/sunrpc/auth.h>
56#include <linux/sunrpc/clnt.h> 48#include <linux/sunrpc/clnt.h>
@@ -60,13 +52,23 @@
60#include <linux/nfs3.h> 52#include <linux/nfs3.h>
61#include <linux/nfs4.h> 53#include <linux/nfs4.h>
62#include <linux/nfs_xdr.h> 54#include <linux/nfs_xdr.h>
55
56#include <linux/nfs_fs_sb.h>
57
63#include <linux/rwsem.h> 58#include <linux/rwsem.h>
64#include <linux/mempool.h> 59#include <linux/mempool.h>
65 60
66/* 61/*
62 * These are the default flags for swap requests
63 */
64#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)
65
66/*
67 * NFSv3/v4 Access mode cache entry 67 * NFSv3/v4 Access mode cache entry
68 */ 68 */
69struct nfs_access_entry { 69struct nfs_access_entry {
70 struct rb_node rb_node;
71 struct list_head lru;
70 unsigned long jiffies; 72 unsigned long jiffies;
71 struct rpc_cred * cred; 73 struct rpc_cred * cred;
72 int mask; 74 int mask;
@@ -143,7 +145,9 @@ struct nfs_inode {
143 */ 145 */
144 atomic_t data_updates; 146 atomic_t data_updates;
145 147
146 struct nfs_access_entry cache_access; 148 struct rb_root access_cache;
149 struct list_head access_cache_entry_lru;
150 struct list_head access_cache_inode_lru;
147#ifdef CONFIG_NFS_V3_ACL 151#ifdef CONFIG_NFS_V3_ACL
148 struct posix_acl *acl_access; 152 struct posix_acl *acl_access;
149 struct posix_acl *acl_default; 153 struct posix_acl *acl_default;
@@ -197,6 +201,7 @@ struct nfs_inode {
197#define NFS_INO_REVALIDATING (0) /* revalidating attrs */ 201#define NFS_INO_REVALIDATING (0) /* revalidating attrs */
198#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ 202#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */
199#define NFS_INO_STALE (2) /* possible stale inode */ 203#define NFS_INO_STALE (2) /* possible stale inode */
204#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
200 205
201static inline struct nfs_inode *NFS_I(struct inode *inode) 206static inline struct nfs_inode *NFS_I(struct inode *inode)
202{ 207{
@@ -207,8 +212,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
207#define NFS_FH(inode) (&NFS_I(inode)->fh) 212#define NFS_FH(inode) (&NFS_I(inode)->fh)
208#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 213#define NFS_SERVER(inode) (NFS_SB(inode->i_sb))
209#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 214#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client)
210#define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) 215#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops)
211#define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode)))
212#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 216#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf)
213#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) 217#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies)
214#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) 218#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr)
@@ -233,8 +237,12 @@ static inline int nfs_caches_unstable(struct inode *inode)
233 237
234static inline void nfs_mark_for_revalidate(struct inode *inode) 238static inline void nfs_mark_for_revalidate(struct inode *inode)
235{ 239{
240 struct nfs_inode *nfsi = NFS_I(inode);
241
236 spin_lock(&inode->i_lock); 242 spin_lock(&inode->i_lock);
237 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 243 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS;
244 if (S_ISDIR(inode->i_mode))
245 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA;
238 spin_unlock(&inode->i_lock); 246 spin_unlock(&inode->i_lock);
239} 247}
240 248
@@ -291,12 +299,13 @@ extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
291extern int nfs_permission(struct inode *, int, struct nameidata *); 299extern int nfs_permission(struct inode *, int, struct nameidata *);
292extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); 300extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *);
293extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); 301extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
302extern void nfs_access_zap_cache(struct inode *inode);
294extern int nfs_open(struct inode *, struct file *); 303extern int nfs_open(struct inode *, struct file *);
295extern int nfs_release(struct inode *, struct file *); 304extern int nfs_release(struct inode *, struct file *);
296extern int nfs_attribute_timeout(struct inode *inode); 305extern int nfs_attribute_timeout(struct inode *inode);
297extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 306extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
298extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 307extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
299extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 308extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
300extern int nfs_setattr(struct dentry *, struct iattr *); 309extern int nfs_setattr(struct dentry *, struct iattr *);
301extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 310extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
302extern void nfs_begin_attr_update(struct inode *); 311extern void nfs_begin_attr_update(struct inode *);
@@ -324,7 +333,7 @@ extern struct inode_operations nfs_file_inode_operations;
324extern struct inode_operations nfs3_file_inode_operations; 333extern struct inode_operations nfs3_file_inode_operations;
325#endif /* CONFIG_NFS_V3 */ 334#endif /* CONFIG_NFS_V3 */
326extern const struct file_operations nfs_file_operations; 335extern const struct file_operations nfs_file_operations;
327extern struct address_space_operations nfs_file_aops; 336extern const struct address_space_operations nfs_file_aops;
328 337
329static inline struct rpc_cred *nfs_file_cred(struct file *file) 338static inline struct rpc_cred *nfs_file_cred(struct file *file)
330{ 339{
@@ -392,6 +401,15 @@ extern void nfs_unregister_sysctl(void);
392#endif 401#endif
393 402
394/* 403/*
404 * linux/fs/nfs/namespace.c
405 */
406extern struct list_head nfs_automount_list;
407extern struct inode_operations nfs_mountpoint_inode_operations;
408extern struct inode_operations nfs_referral_inode_operations;
409extern int nfs_mountpoint_expiry_timeout;
410extern void nfs_release_automount_timer(void);
411
412/*
395 * linux/fs/nfs/unlink.c 413 * linux/fs/nfs/unlink.c
396 */ 414 */
397extern int nfs_async_unlink(struct dentry *); 415extern int nfs_async_unlink(struct dentry *);
@@ -408,7 +426,7 @@ extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
408extern void nfs_writedata_release(void *); 426extern void nfs_writedata_release(void *);
409 427
410#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 428#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
411struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount); 429struct nfs_write_data *nfs_commit_alloc(void);
412void nfs_commit_free(struct nfs_write_data *p); 430void nfs_commit_free(struct nfs_write_data *p);
413#endif 431#endif
414 432
@@ -457,10 +475,9 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
457} 475}
458 476
459/* 477/*
460 * Allocate and free nfs_write_data structures 478 * Allocate nfs_write_data structures
461 */ 479 */
462extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); 480extern struct nfs_write_data *nfs_writedata_alloc(size_t len);
463extern void nfs_writedata_free(struct nfs_write_data *p);
464 481
465/* 482/*
466 * linux/fs/nfs/read.c 483 * linux/fs/nfs/read.c
@@ -472,10 +489,9 @@ extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
472extern void nfs_readdata_release(void *data); 489extern void nfs_readdata_release(void *data);
473 490
474/* 491/*
475 * Allocate and free nfs_read_data structures 492 * Allocate nfs_read_data structures
476 */ 493 */
477extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); 494extern struct nfs_read_data *nfs_readdata_alloc(size_t len);
478extern void nfs_readdata_free(struct nfs_read_data *p);
479 495
480/* 496/*
481 * linux/fs/nfs3proc.c 497 * linux/fs/nfs3proc.c
@@ -562,6 +578,7 @@ extern void * nfs_root_data(void);
562#define NFSDBG_FILE 0x0040 578#define NFSDBG_FILE 0x0040
563#define NFSDBG_ROOT 0x0080 579#define NFSDBG_ROOT 0x0080
564#define NFSDBG_CALLBACK 0x0100 580#define NFSDBG_CALLBACK 0x0100
581#define NFSDBG_CLIENT 0x0200
565#define NFSDBG_ALL 0xFFFF 582#define NFSDBG_ALL 0xFFFF
566 583
567#ifdef __KERNEL__ 584#ifdef __KERNEL__
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 65dec21af7..7ccfc7ef0a 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -7,13 +7,79 @@
7struct nfs_iostats; 7struct nfs_iostats;
8 8
9/* 9/*
10 * The nfs_client identifies our client state to the server.
11 */
12struct nfs_client {
13 atomic_t cl_count;
14 int cl_cons_state; /* current construction state (-ve: init error) */
15#define NFS_CS_READY 0 /* ready to be used */
16#define NFS_CS_INITING 1 /* busy initialising */
17 int cl_nfsversion; /* NFS protocol version */
18 unsigned long cl_res_state; /* NFS resources state */
19#define NFS_CS_RPCIOD 0 /* - rpciod started */
20#define NFS_CS_CALLBACK 1 /* - callback started */
21#define NFS_CS_IDMAP 2 /* - idmap started */
22#define NFS_CS_RENEWD 3 /* - renewd started */
23 struct sockaddr_in cl_addr; /* server identifier */
24 char * cl_hostname; /* hostname of server */
25 struct list_head cl_share_link; /* link in global client list */
26 struct list_head cl_superblocks; /* List of nfs_server structs */
27
28 struct rpc_clnt * cl_rpcclient;
29 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
30 unsigned long retrans_timeo; /* retransmit timeout */
31 unsigned int retrans_count; /* number of retransmit tries */
32
33#ifdef CONFIG_NFS_V4
34 u64 cl_clientid; /* constant */
35 nfs4_verifier cl_confirm;
36 unsigned long cl_state;
37
38 u32 cl_lockowner_id;
39
40 /*
41 * The following rwsem ensures exclusive access to the server
42 * while we recover the state following a lease expiration.
43 */
44 struct rw_semaphore cl_sem;
45
46 struct list_head cl_delegations;
47 struct list_head cl_state_owners;
48 struct list_head cl_unused;
49 int cl_nunused;
50 spinlock_t cl_lock;
51
52 unsigned long cl_lease_time;
53 unsigned long cl_last_renewal;
54 struct work_struct cl_renewd;
55
56 struct rpc_wait_queue cl_rpcwaitq;
57
58 /* used for the setclientid verifier */
59 struct timespec cl_boot_time;
60
61 /* idmapper */
62 struct idmap * cl_idmap;
63
64 /* Our own IP address, as a null-terminated string.
65 * This is used to generate the clientid, and the callback address.
66 */
67 char cl_ipaddr[16];
68 unsigned char cl_id_uniquifier;
69#endif
70};
71
72/*
10 * NFS client parameters stored in the superblock. 73 * NFS client parameters stored in the superblock.
11 */ 74 */
12struct nfs_server { 75struct nfs_server {
76 struct nfs_client * nfs_client; /* shared client and NFS4 state */
77 struct list_head client_link; /* List of other nfs_server structs
78 * that share the same client
79 */
80 struct list_head master_link; /* link in master servers list */
13 struct rpc_clnt * client; /* RPC client handle */ 81 struct rpc_clnt * client; /* RPC client handle */
14 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */
15 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 82 struct rpc_clnt * client_acl; /* ACL RPC client handle */
16 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */
17 struct nfs_iostats * io_stats; /* I/O statistics */ 83 struct nfs_iostats * io_stats; /* I/O statistics */
18 struct backing_dev_info backing_dev_info; 84 struct backing_dev_info backing_dev_info;
19 int flags; /* various flags */ 85 int flags; /* various flags */
@@ -29,23 +95,14 @@ struct nfs_server {
29 unsigned int acregmax; 95 unsigned int acregmax;
30 unsigned int acdirmin; 96 unsigned int acdirmin;
31 unsigned int acdirmax; 97 unsigned int acdirmax;
32 unsigned long retrans_timeo; /* retransmit timeout */
33 unsigned int retrans_count; /* number of retransmit tries */
34 unsigned int namelen; 98 unsigned int namelen;
35 char * hostname; /* remote hostname */ 99
36 struct nfs_fh fh; 100 struct nfs_fsid fsid;
37 struct sockaddr_in addr; 101 __u64 maxfilesize; /* maximum file size */
38 unsigned long mount_time; /* when this fs was mounted */ 102 unsigned long mount_time; /* when this fs was mounted */
103 dev_t s_dev; /* superblock dev numbers */
104
39#ifdef CONFIG_NFS_V4 105#ifdef CONFIG_NFS_V4
40 /* Our own IP address, as a null-terminated string.
41 * This is used to generate the clientid, and the callback address.
42 */
43 char ip_addr[16];
44 char * mnt_path;
45 struct nfs4_client * nfs4_state; /* all NFSv4 state starts here */
46 struct list_head nfs4_siblings; /* List of other nfs_server structs
47 * that share the same clientid
48 */
49 u32 attr_bitmask[2];/* V4 bitmask representing the set 106 u32 attr_bitmask[2];/* V4 bitmask representing the set
50 of attributes supported on this 107 of attributes supported on this
51 filesystem */ 108 filesystem */
@@ -53,6 +110,7 @@ struct nfs_server {
53 that are supported on this 110 that are supported on this
54 filesystem */ 111 filesystem */
55#endif 112#endif
113 void (*destroy)(struct nfs_server *);
56}; 114};
57 115
58/* Server capabilities */ 116/* Server capabilities */
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 102e560942..15a9f3b728 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -62,15 +62,15 @@ struct idmap_msg {
62#ifdef __KERNEL__ 62#ifdef __KERNEL__
63 63
64/* Forward declaration to make this header independent of others */ 64/* Forward declaration to make this header independent of others */
65struct nfs4_client; 65struct nfs_client;
66 66
67void nfs_idmap_new(struct nfs4_client *); 67int nfs_idmap_new(struct nfs_client *);
68void nfs_idmap_delete(struct nfs4_client *); 68void nfs_idmap_delete(struct nfs_client *);
69 69
70int nfs_map_name_to_uid(struct nfs4_client *, const char *, size_t, __u32 *); 70int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *);
71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *); 71int nfs_map_group_to_gid(struct nfs_client *, const char *, size_t, __u32 *);
72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *); 72int nfs_map_uid_to_name(struct nfs_client *, __u32, char *);
73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *); 73int nfs_map_gid_to_group(struct nfs_client *, __u32, char *);
74 74
75extern unsigned int nfs_idmap_cache_timeout; 75extern unsigned int nfs_idmap_cache_timeout;
76#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 66e2ed6585..1f7bd287c2 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -13,7 +13,6 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/nfs_fs_sb.h>
17#include <linux/sunrpc/auth.h> 16#include <linux/sunrpc/auth.h>
18#include <linux/nfs_xdr.h> 17#include <linux/nfs_xdr.h>
19 18
@@ -63,8 +62,8 @@ extern void nfs_release_request(struct nfs_page *req);
63 62
64extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, 63extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst,
65 unsigned long idx_start, unsigned int npages); 64 unsigned long idx_start, unsigned int npages);
66extern int nfs_scan_list(struct list_head *, struct list_head *, 65extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst,
67 unsigned long, unsigned int); 66 unsigned long idx_start, unsigned int npages);
68extern int nfs_coalesce_requests(struct list_head *, struct list_head *, 67extern int nfs_coalesce_requests(struct list_head *, struct list_head *,
69 unsigned int); 68 unsigned int);
70extern int nfs_wait_on_request(struct nfs_page *); 69extern int nfs_wait_on_request(struct nfs_page *);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 7fafc4c546..dc5397d9d2 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_NFS_XDR_H 1#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H 2#define _LINUX_NFS_XDR_H
3 3
4#include <linux/sunrpc/xprt.h>
5#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
6 5
7/* 6/*
@@ -14,11 +13,19 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 13#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 14#define NFS_MIN_FILE_IO_SIZE (1024U)
16 15
17struct nfs4_fsid { 16struct nfs_fsid {
18 __u64 major; 17 uint64_t major;
19 __u64 minor; 18 uint64_t minor;
20}; 19};
21 20
21/*
22 * Helper for checking equality between 2 fsids.
23 */
24static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
25{
26 return a->major == b->major && a->minor == b->minor;
27}
28
22struct nfs_fattr { 29struct nfs_fattr {
23 unsigned short valid; /* which fields are valid */ 30 unsigned short valid; /* which fields are valid */
24 __u64 pre_size; /* pre_op_attr.size */ 31 __u64 pre_size; /* pre_op_attr.size */
@@ -40,10 +47,7 @@ struct nfs_fattr {
40 } nfs3; 47 } nfs3;
41 } du; 48 } du;
42 dev_t rdev; 49 dev_t rdev;
43 union { 50 struct nfs_fsid fsid;
44 __u64 nfs3; /* also nfs2 */
45 struct nfs4_fsid nfs4;
46 } fsid_u;
47 __u64 fileid; 51 __u64 fileid;
48 struct timespec atime; 52 struct timespec atime;
49 struct timespec mtime; 53 struct timespec mtime;
@@ -57,8 +61,8 @@ struct nfs_fattr {
57#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 61#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
58#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
59#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
60#define NFS_ATTR_FATTR_V4 0x0008 64#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
61#define NFS_ATTR_PRE_CHANGE 0x0010 65#define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */
62 66
63/* 67/*
64 * Info on the file system 68 * Info on the file system
@@ -354,8 +358,8 @@ struct nfs_symlinkargs {
354 struct nfs_fh * fromfh; 358 struct nfs_fh * fromfh;
355 const char * fromname; 359 const char * fromname;
356 unsigned int fromlen; 360 unsigned int fromlen;
357 const char * topath; 361 struct page ** pages;
358 unsigned int tolen; 362 unsigned int pathlen;
359 struct iattr * sattr; 363 struct iattr * sattr;
360}; 364};
361 365
@@ -430,8 +434,8 @@ struct nfs3_symlinkargs {
430 struct nfs_fh * fromfh; 434 struct nfs_fh * fromfh;
431 const char * fromname; 435 const char * fromname;
432 unsigned int fromlen; 436 unsigned int fromlen;
433 const char * topath; 437 struct page ** pages;
434 unsigned int tolen; 438 unsigned int pathlen;
435 struct iattr * sattr; 439 struct iattr * sattr;
436}; 440};
437 441
@@ -529,7 +533,10 @@ struct nfs4_accessres {
529struct nfs4_create_arg { 533struct nfs4_create_arg {
530 u32 ftype; 534 u32 ftype;
531 union { 535 union {
532 struct qstr * symlink; /* NF4LNK */ 536 struct {
537 struct page ** pages;
538 unsigned int len;
539 } symlink; /* NF4LNK */
533 struct { 540 struct {
534 u32 specdata1; 541 u32 specdata1;
535 u32 specdata2; 542 u32 specdata2;
@@ -654,7 +661,7 @@ struct nfs4_rename_res {
654struct nfs4_setclientid { 661struct nfs4_setclientid {
655 const nfs4_verifier * sc_verifier; /* request */ 662 const nfs4_verifier * sc_verifier; /* request */
656 unsigned int sc_name_len; 663 unsigned int sc_name_len;
657 char sc_name[32]; /* request */ 664 char sc_name[48]; /* request */
658 u32 sc_prog; /* request */ 665 u32 sc_prog; /* request */
659 unsigned int sc_netid_len; 666 unsigned int sc_netid_len;
660 char sc_netid[4]; /* request */ 667 char sc_netid[4]; /* request */
@@ -675,6 +682,40 @@ struct nfs4_server_caps_res {
675 u32 has_symlinks; 682 u32 has_symlinks;
676}; 683};
677 684
685struct nfs4_string {
686 unsigned int len;
687 char *data;
688};
689
690#define NFS4_PATHNAME_MAXCOMPONENTS 512
691struct nfs4_pathname {
692 unsigned int ncomponents;
693 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
694};
695
696#define NFS4_FS_LOCATION_MAXSERVERS 10
697struct nfs4_fs_location {
698 unsigned int nservers;
699 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
700 struct nfs4_pathname rootpath;
701};
702
703#define NFS4_FS_LOCATIONS_MAXENTRIES 10
704struct nfs4_fs_locations {
705 struct nfs_fattr fattr;
706 const struct nfs_server *server;
707 struct nfs4_pathname fs_path;
708 int nlocations;
709 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
710};
711
712struct nfs4_fs_locations_arg {
713 const struct nfs_fh *dir_fh;
714 const struct qstr *name;
715 struct page *page;
716 const u32 *bitmask;
717};
718
678#endif /* CONFIG_NFS_V4 */ 719#endif /* CONFIG_NFS_V4 */
679 720
680struct nfs_page; 721struct nfs_page;
@@ -690,12 +731,13 @@ struct nfs_read_data {
690 struct list_head pages; /* Coalesced read requests */ 731 struct list_head pages; /* Coalesced read requests */
691 struct nfs_page *req; /* multi ops per nfs_page */ 732 struct nfs_page *req; /* multi ops per nfs_page */
692 struct page **pagevec; 733 struct page **pagevec;
734 unsigned int npages; /* Max length of pagevec */
693 struct nfs_readargs args; 735 struct nfs_readargs args;
694 struct nfs_readres res; 736 struct nfs_readres res;
695#ifdef CONFIG_NFS_V4 737#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */ 738 unsigned long timestamp; /* For lease renewal */
697#endif 739#endif
698 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 740 struct page *page_array[NFS_PAGEVEC_SIZE];
699}; 741};
700 742
701struct nfs_write_data { 743struct nfs_write_data {
@@ -708,12 +750,13 @@ struct nfs_write_data {
708 struct list_head pages; /* Coalesced requests we wish to flush */ 750 struct list_head pages; /* Coalesced requests we wish to flush */
709 struct nfs_page *req; /* multi ops per nfs_page */ 751 struct nfs_page *req; /* multi ops per nfs_page */
710 struct page **pagevec; 752 struct page **pagevec;
753 unsigned int npages; /* Max length of pagevec */
711 struct nfs_writeargs args; /* argument struct */ 754 struct nfs_writeargs args; /* argument struct */
712 struct nfs_writeres res; /* result struct */ 755 struct nfs_writeres res; /* result struct */
713#ifdef CONFIG_NFS_V4 756#ifdef CONFIG_NFS_V4
714 unsigned long timestamp; /* For lease renewal */ 757 unsigned long timestamp; /* For lease renewal */
715#endif 758#endif
716 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 759 struct page *page_array[NFS_PAGEVEC_SIZE];
717}; 760};
718 761
719struct nfs_access_entry; 762struct nfs_access_entry;
@@ -729,6 +772,9 @@ struct nfs_rpc_ops {
729 772
730 int (*getroot) (struct nfs_server *, struct nfs_fh *, 773 int (*getroot) (struct nfs_server *, struct nfs_fh *,
731 struct nfs_fsinfo *); 774 struct nfs_fsinfo *);
775 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
776 struct qstr *, struct nfs_fh *,
777 struct nfs_fattr *);
732 int (*getattr) (struct nfs_server *, struct nfs_fh *, 778 int (*getattr) (struct nfs_server *, struct nfs_fh *,
733 struct nfs_fattr *); 779 struct nfs_fattr *);
734 int (*setattr) (struct dentry *, struct nfs_fattr *, 780 int (*setattr) (struct dentry *, struct nfs_fattr *,
@@ -750,9 +796,8 @@ struct nfs_rpc_ops {
750 int (*rename) (struct inode *, struct qstr *, 796 int (*rename) (struct inode *, struct qstr *,
751 struct inode *, struct qstr *); 797 struct inode *, struct qstr *);
752 int (*link) (struct inode *, struct inode *, struct qstr *); 798 int (*link) (struct inode *, struct inode *, struct qstr *);
753 int (*symlink) (struct inode *, struct qstr *, struct qstr *, 799 int (*symlink) (struct inode *, struct dentry *, struct page *,
754 struct iattr *, struct nfs_fh *, 800 unsigned int, struct iattr *);
755 struct nfs_fattr *);
756 int (*mkdir) (struct inode *, struct dentry *, struct iattr *); 801 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
757 int (*rmdir) (struct inode *, struct qstr *); 802 int (*rmdir) (struct inode *, struct qstr *);
758 int (*readdir) (struct dentry *, struct rpc_cred *, 803 int (*readdir) (struct dentry *, struct rpc_cred *,
@@ -765,6 +810,7 @@ struct nfs_rpc_ops {
765 struct nfs_fsinfo *); 810 struct nfs_fsinfo *);
766 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 811 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
767 struct nfs_pathconf *); 812 struct nfs_pathconf *);
813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
768 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 814 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
769 void (*read_setup) (struct nfs_read_data *); 815 void (*read_setup) (struct nfs_read_data *);
770 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 816 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
@@ -788,9 +834,9 @@ struct nfs_rpc_ops {
788/* 834/*
789 * Function vectors etc. for the NFS client 835 * Function vectors etc. for the NFS client
790 */ 836 */
791extern struct nfs_rpc_ops nfs_v2_clientops; 837extern const struct nfs_rpc_ops nfs_v2_clientops;
792extern struct nfs_rpc_ops nfs_v3_clientops; 838extern const struct nfs_rpc_ops nfs_v3_clientops;
793extern struct nfs_rpc_ops nfs_v4_clientops; 839extern const struct nfs_rpc_ops nfs_v4_clientops;
794extern struct rpc_version nfs_version2; 840extern struct rpc_version nfs_version2;
795extern struct rpc_version nfs_version3; 841extern struct rpc_version nfs_version3;
796extern struct rpc_version nfs_version4; 842extern struct rpc_version nfs_version4;
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
new file mode 100644
index 0000000000..d9c5455808
--- /dev/null
+++ b/include/linux/nfsd/Kbuild
@@ -0,0 +1,7 @@
1unifdef-y += const.h
2unifdef-y += export.h
3unifdef-y += stats.h
4unifdef-y += syscall.h
5unifdef-y += nfsfh.h
6unifdef-y += debug.h
7unifdef-y += auth.h
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index f9edcd2ff3..31a3cb617c 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;
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
index b6f1e0cda4..28a82fdd92 100644
--- a/include/linux/nfsd/stats.h
+++ b/include/linux/nfsd/stats.h
@@ -9,6 +9,8 @@
9#ifndef LINUX_NFSD_STATS_H 9#ifndef LINUX_NFSD_STATS_H
10#define LINUX_NFSD_STATS_H 10#define LINUX_NFSD_STATS_H
11 11
12#include <linux/nfs4.h>
13
12struct nfsd_stats { 14struct nfsd_stats {
13 unsigned int rchits; /* repcache hits */ 15 unsigned int rchits; /* repcache hits */
14 unsigned int rcmisses; /* repcache hits */ 16 unsigned int rcmisses; /* repcache hits */
@@ -27,6 +29,10 @@ struct nfsd_stats {
27 unsigned int ra_size; /* size of ra cache */ 29 unsigned int ra_size; /* size of ra cache */
28 unsigned int ra_depth[11]; /* number of times ra entry was found that deep 30 unsigned int ra_depth[11]; /* number of times ra entry was found that deep
29 * in the cache (10percentiles). [10] = not found */ 31 * in the cache (10percentiles). [10] = not found */
32#ifdef CONFIG_NFSD_V4
33 unsigned int nfs4_opcount[LAST_NFS4_OP + 1]; /* count of individual nfsv4 operations */
34#endif
35
30}; 36};
31 37
32/* thread usage wraps very million seconds (approx one fortnight) */ 38/* thread usage wraps very million seconds (approx one fortnight) */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index c8f4d2f627..e16904e28c 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/node.h b/include/linux/node.h
index 254dc3de65..bc001bc225 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -26,8 +26,33 @@ struct node {
26 struct sys_device sysdev; 26 struct sys_device sysdev;
27}; 27};
28 28
29extern struct node node_devices[];
30
29extern int register_node(struct node *, int, struct node *); 31extern int register_node(struct node *, int, struct node *);
30extern void unregister_node(struct node *node); 32extern void unregister_node(struct node *node);
33#ifdef CONFIG_NUMA
34extern int register_one_node(int nid);
35extern void unregister_one_node(int nid);
36extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
37extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
38#else
39static inline int register_one_node(int nid)
40{
41 return 0;
42}
43static inline int unregister_one_node(int nid)
44{
45 return 0;
46}
47static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
48{
49 return 0;
50}
51static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
52{
53 return 0;
54}
55#endif
31 56
32#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 57#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
33 58
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 51dbab9710..7ff386a6ae 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -65,7 +65,7 @@ struct raw_notifier_head {
65 } while (0) 65 } while (0)
66 66
67#define ATOMIC_NOTIFIER_INIT(name) { \ 67#define ATOMIC_NOTIFIER_INIT(name) { \
68 .lock = SPIN_LOCK_UNLOCKED, \ 68 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
69 .head = NULL } 69 .head = NULL }
70#define BLOCKING_NOTIFIER_INIT(name) { \ 70#define BLOCKING_NOTIFIER_INIT(name) { \
71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \ 71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \
diff --git a/include/linux/nsc_gpio.h b/include/linux/nsc_gpio.h
new file mode 100644
index 0000000000..7da0cf3702
--- /dev/null
+++ b/include/linux/nsc_gpio.h
@@ -0,0 +1,40 @@
1/**
2 nsc_gpio.c
3
4 National Semiconductor GPIO common access methods.
5
6 struct nsc_gpio_ops abstracts the low-level access
7 operations for the GPIO units on 2 NSC chip families; the GEODE
8 integrated CPU, and the PC-8736[03456] integrated PC-peripheral
9 chips.
10
11 The GPIO units on these chips have the same pin architecture, but
12 the access methods differ. Thus, scx200_gpio and pc8736x_gpio
13 implement their own versions of these routines; and use the common
14 file-operations routines implemented in nsc_gpio module.
15
16 Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com>
17
18 NB: this work was tested on the Geode SC-1100 and PC-87366 chips.
19 NSC sold the GEODE line to AMD, and the PC-8736x line to Winbond.
20*/
21
22struct nsc_gpio_ops {
23 struct module* owner;
24 u32 (*gpio_config) (unsigned iminor, u32 mask, u32 bits);
25 void (*gpio_dump) (struct nsc_gpio_ops *amp, unsigned iminor);
26 int (*gpio_get) (unsigned iminor);
27 void (*gpio_set) (unsigned iminor, int state);
28 void (*gpio_change) (unsigned iminor);
29 int (*gpio_current) (unsigned iminor);
30 struct device* dev; /* for dev_dbg() support, set in init */
31};
32
33extern ssize_t nsc_gpio_write(struct file *file, const char __user *data,
34 size_t len, loff_t *ppos);
35
36extern ssize_t nsc_gpio_read(struct file *file, char __user *buf,
37 size_t len, loff_t *ppos);
38
39extern void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index);
40
diff --git a/include/linux/openprom_fs.h b/include/linux/openprom_fs.h
deleted file mode 100644
index a837aab821..0000000000
--- a/include/linux/openprom_fs.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _LINUX_OPENPROM_FS_H
2#define _LINUX_OPENPROM_FS_H
3
4/*
5 * The openprom filesystem constants/structures
6 */
7
8#define OPENPROM_SUPER_MAGIC 0x9fa1
9
10#endif /* _LINUX_OPENPROM_FS_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0c076d58c6..4830a3bedf 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -5,36 +5,33 @@
5#ifndef PAGE_FLAGS_H 5#ifndef PAGE_FLAGS_H
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/percpu.h>
9#include <linux/cache.h>
10#include <linux/types.h> 8#include <linux/types.h>
11 9
12#include <asm/pgtable.h>
13
14/* 10/*
15 * Various page->flags bits: 11 * Various page->flags bits:
16 * 12 *
17 * PG_reserved is set for special pages, which can never be swapped out. Some 13 * PG_reserved is set for special pages, which can never be swapped out. Some
18 * of them might not even exist (eg empty_bad_page)... 14 * of them might not even exist (eg empty_bad_page)...
19 * 15 *
20 * The PG_private bitflag is set if page->private contains a valid value. 16 * The PG_private bitflag is set on pagecache pages if they contain filesystem
17 * specific data (which is normally at page->private). It can be used by
18 * private allocations for its own usage.
19 *
20 * During initiation of disk I/O, PG_locked is set. This bit is set before I/O
21 * and cleared when writeback _starts_ or when read _completes_. PG_writeback
22 * is set before writeback starts and cleared when it finishes.
21 * 23 *
22 * During disk I/O, PG_locked is used. This bit is set before I/O and 24 * PG_locked also pins a page in pagecache, and blocks truncation of the file
23 * reset when I/O completes. page_waitqueue(page) is a wait queue of all tasks 25 * while it is held.
24 * waiting for the I/O on this page to complete. 26 *
27 * page_waitqueue(page) is a wait queue of all tasks waiting for the page
28 * to become unlocked.
25 * 29 *
26 * PG_uptodate tells whether the page's contents is valid. When a read 30 * PG_uptodate tells whether the page's contents is valid. When a read
27 * completes, the page becomes uptodate, unless a disk I/O error happened. 31 * completes, the page becomes uptodate, unless a disk I/O error happened.
28 * 32 *
29 * For choosing which pages to swap out, inode pages carry a PG_referenced bit, 33 * PG_referenced, PG_reclaim are used for page reclaim for anonymous and
30 * which is set any time the system accesses that page through the (mapping, 34 * file-backed pagecache (see mm/vmscan.c).
31 * index) hash table. This referenced bit, together with the referenced bit
32 * in the page tables, is used to manipulate page->age and move the page across
33 * the active, inactive_dirty and inactive_clean lists.
34 *
35 * Note that the referenced bit, the page->lru list_head and the active,
36 * inactive_dirty and inactive_clean lists are protected by the
37 * zone->lru_lock, and *NOT* by the usual PG_locked bit!
38 * 35 *
39 * PG_error is set to indicate that an I/O error occurred on this page. 36 * PG_error is set to indicate that an I/O error occurred on this page.
40 * 37 *
@@ -46,6 +43,10 @@
46 * space, they need to be kmapped separately for doing IO on the pages. The 43 * space, they need to be kmapped separately for doing IO on the pages. The
47 * struct page (these bits with information) are always mapped into kernel 44 * struct page (these bits with information) are always mapped into kernel
48 * address space... 45 * address space...
46 *
47 * PG_buddy is set to indicate that the page is free and in the buddy system
48 * (see mm/page_alloc.c).
49 *
49 */ 50 */
50 51
51/* 52/*
@@ -78,7 +79,7 @@
78#define PG_checked 8 /* kill me in 2.5.<early>. */ 79#define PG_checked 8 /* kill me in 2.5.<early>. */
79#define PG_arch_1 9 80#define PG_arch_1 9
80#define PG_reserved 10 81#define PG_reserved 10
81#define PG_private 11 /* Has something at ->private */ 82#define PG_private 11 /* If pagecache, has fs-private data */
82 83
83#define PG_writeback 12 /* Page is under writeback */ 84#define PG_writeback 12 /* Page is under writeback */
84#define PG_nosave 13 /* Used for system suspend/resume */ 85#define PG_nosave 13 /* Used for system suspend/resume */
@@ -87,7 +88,7 @@
87 88
88#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 89#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
89#define PG_reclaim 17 /* To be reclaimed asap */ 90#define PG_reclaim 17 /* To be reclaimed asap */
90#define PG_nosave_free 18 /* Free, should not be written */ 91#define PG_nosave_free 18 /* Used for system suspend/resume */
91#define PG_buddy 19 /* Page is free, on buddy lists */ 92#define PG_buddy 19 /* Page is free, on buddy lists */
92 93
93 94
@@ -103,134 +104,6 @@
103#endif 104#endif
104 105
105/* 106/*
106 * Global page accounting. One instance per CPU. Only unsigned longs are
107 * allowed.
108 *
109 * - Fields can be modified with xxx_page_state and xxx_page_state_zone at
110 * any time safely (which protects the instance from modification by
111 * interrupt.
112 * - The __xxx_page_state variants can be used safely when interrupts are
113 * disabled.
114 * - The __xxx_page_state variants can be used if the field is only
115 * modified from process context and protected from preemption, or only
116 * modified from interrupt context. In this case, the field should be
117 * commented here.
118 */
119struct page_state {
120 unsigned long nr_dirty; /* Dirty writeable pages */
121 unsigned long nr_writeback; /* Pages under writeback */
122 unsigned long nr_unstable; /* NFS unstable pages */
123 unsigned long nr_page_table_pages;/* Pages used for pagetables */
124 unsigned long nr_mapped; /* mapped into pagetables.
125 * only modified from process context */
126 unsigned long nr_slab; /* In slab */
127#define GET_PAGE_STATE_LAST nr_slab
128
129 /*
130 * The below are zeroed by get_page_state(). Use get_full_page_state()
131 * to add up all these.
132 */
133 unsigned long pgpgin; /* Disk reads */
134 unsigned long pgpgout; /* Disk writes */
135 unsigned long pswpin; /* swap reads */
136 unsigned long pswpout; /* swap writes */
137
138 unsigned long pgalloc_high; /* page allocations */
139 unsigned long pgalloc_normal;
140 unsigned long pgalloc_dma32;
141 unsigned long pgalloc_dma;
142
143 unsigned long pgfree; /* page freeings */
144 unsigned long pgactivate; /* pages moved inactive->active */
145 unsigned long pgdeactivate; /* pages moved active->inactive */
146
147 unsigned long pgfault; /* faults (major+minor) */
148 unsigned long pgmajfault; /* faults (major only) */
149
150 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */
151 unsigned long pgrefill_normal;
152 unsigned long pgrefill_dma32;
153 unsigned long pgrefill_dma;
154
155 unsigned long pgsteal_high; /* total highmem pages reclaimed */
156 unsigned long pgsteal_normal;
157 unsigned long pgsteal_dma32;
158 unsigned long pgsteal_dma;
159
160 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */
161 unsigned long pgscan_kswapd_normal;
162 unsigned long pgscan_kswapd_dma32;
163 unsigned long pgscan_kswapd_dma;
164
165 unsigned long pgscan_direct_high;/* total highmem pages scanned */
166 unsigned long pgscan_direct_normal;
167 unsigned long pgscan_direct_dma32;
168 unsigned long pgscan_direct_dma;
169
170 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
171 unsigned long slabs_scanned; /* slab objects scanned */
172 unsigned long kswapd_steal; /* pages reclaimed by kswapd */
173 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */
174 unsigned long pageoutrun; /* kswapd's calls to page reclaim */
175 unsigned long allocstall; /* direct reclaim calls */
176
177 unsigned long pgrotated; /* pages rotated to tail of the LRU */
178 unsigned long nr_bounce; /* pages for bounce buffers */
179};
180
181extern void get_page_state(struct page_state *ret);
182extern void get_page_state_node(struct page_state *ret, int node);
183extern void get_full_page_state(struct page_state *ret);
184extern unsigned long read_page_state_offset(unsigned long offset);
185extern void mod_page_state_offset(unsigned long offset, unsigned long delta);
186extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
187
188#define read_page_state(member) \
189 read_page_state_offset(offsetof(struct page_state, member))
190
191#define mod_page_state(member, delta) \
192 mod_page_state_offset(offsetof(struct page_state, member), (delta))
193
194#define __mod_page_state(member, delta) \
195 __mod_page_state_offset(offsetof(struct page_state, member), (delta))
196
197#define inc_page_state(member) mod_page_state(member, 1UL)
198#define dec_page_state(member) mod_page_state(member, 0UL - 1)
199#define add_page_state(member,delta) mod_page_state(member, (delta))
200#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
201
202#define __inc_page_state(member) __mod_page_state(member, 1UL)
203#define __dec_page_state(member) __mod_page_state(member, 0UL - 1)
204#define __add_page_state(member,delta) __mod_page_state(member, (delta))
205#define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta))
206
207#define page_state(member) (*__page_state(offsetof(struct page_state, member)))
208
209#define state_zone_offset(zone, member) \
210({ \
211 unsigned offset; \
212 if (is_highmem(zone)) \
213 offset = offsetof(struct page_state, member##_high); \
214 else if (is_normal(zone)) \
215 offset = offsetof(struct page_state, member##_normal); \
216 else if (is_dma32(zone)) \
217 offset = offsetof(struct page_state, member##_dma32); \
218 else \
219 offset = offsetof(struct page_state, member##_dma); \
220 offset; \
221})
222
223#define __mod_page_state_zone(zone, member, delta) \
224 do { \
225 __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
226 } while (0)
227
228#define mod_page_state_zone(zone, member, delta) \
229 do { \
230 mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
231 } while (0)
232
233/*
234 * Manipulation of page state flags 107 * Manipulation of page state flags
235 */ 108 */
236#define PageLocked(page) \ 109#define PageLocked(page) \
@@ -254,7 +127,13 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
254#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) 127#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
255 128
256#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) 129#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags)
257#ifndef SetPageUptodate 130#ifdef CONFIG_S390
131static inline void SetPageUptodate(struct page *page)
132{
133 if (!test_and_set_bit(PG_uptodate, &page->flags))
134 page_test_and_clear_dirty(page);
135}
136#else
258#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 137#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
259#endif 138#endif
260#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) 139#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags)
@@ -306,7 +185,7 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
306 do { \ 185 do { \
307 if (!test_and_set_bit(PG_writeback, \ 186 if (!test_and_set_bit(PG_writeback, \
308 &(page)->flags)) \ 187 &(page)->flags)) \
309 inc_page_state(nr_writeback); \ 188 inc_zone_page_state(page, NR_WRITEBACK); \
310 } while (0) 189 } while (0)
311#define TestSetPageWriteback(page) \ 190#define TestSetPageWriteback(page) \
312 ({ \ 191 ({ \
@@ -314,14 +193,14 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
314 ret = test_and_set_bit(PG_writeback, \ 193 ret = test_and_set_bit(PG_writeback, \
315 &(page)->flags); \ 194 &(page)->flags); \
316 if (!ret) \ 195 if (!ret) \
317 inc_page_state(nr_writeback); \ 196 inc_zone_page_state(page, NR_WRITEBACK); \
318 ret; \ 197 ret; \
319 }) 198 })
320#define ClearPageWriteback(page) \ 199#define ClearPageWriteback(page) \
321 do { \ 200 do { \
322 if (test_and_clear_bit(PG_writeback, \ 201 if (test_and_clear_bit(PG_writeback, \
323 &(page)->flags)) \ 202 &(page)->flags)) \
324 dec_page_state(nr_writeback); \ 203 dec_zone_page_state(page, NR_WRITEBACK); \
325 } while (0) 204 } while (0)
326#define TestClearPageWriteback(page) \ 205#define TestClearPageWriteback(page) \
327 ({ \ 206 ({ \
@@ -329,7 +208,7 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
329 ret = test_and_clear_bit(PG_writeback, \ 208 ret = test_and_clear_bit(PG_writeback, \
330 &(page)->flags); \ 209 &(page)->flags); \
331 if (ret) \ 210 if (ret) \
332 dec_page_state(nr_writeback); \ 211 dec_zone_page_state(page, NR_WRITEBACK); \
333 ret; \ 212 ret; \
334 }) 213 })
335 214
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 1245df7141..64f9509251 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -113,51 +113,6 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
113extern void remove_from_page_cache(struct page *page); 113extern void remove_from_page_cache(struct page *page);
114extern void __remove_from_page_cache(struct page *page); 114extern void __remove_from_page_cache(struct page *page);
115 115
116extern atomic_t nr_pagecache;
117
118#ifdef CONFIG_SMP
119
120#define PAGECACHE_ACCT_THRESHOLD max(16, NR_CPUS * 2)
121DECLARE_PER_CPU(long, nr_pagecache_local);
122
123/*
124 * pagecache_acct implements approximate accounting for pagecache.
125 * vm_enough_memory() do not need high accuracy. Writers will keep
126 * an offset in their per-cpu arena and will spill that into the
127 * global count whenever the absolute value of the local count
128 * exceeds the counter's threshold.
129 *
130 * MUST be protected from preemption.
131 * current protection is mapping->page_lock.
132 */
133static inline void pagecache_acct(int count)
134{
135 long *local;
136
137 local = &__get_cpu_var(nr_pagecache_local);
138 *local += count;
139 if (*local > PAGECACHE_ACCT_THRESHOLD || *local < -PAGECACHE_ACCT_THRESHOLD) {
140 atomic_add(*local, &nr_pagecache);
141 *local = 0;
142 }
143}
144
145#else
146
147static inline void pagecache_acct(int count)
148{
149 atomic_add(count, &nr_pagecache);
150}
151#endif
152
153static inline unsigned long get_page_cache_size(void)
154{
155 int ret = atomic_read(&nr_pagecache);
156 if (unlikely(ret < 0))
157 ret = 0;
158 return ret;
159}
160
161/* 116/*
162 * Return byte-offset into filesystem object for page. 117 * Return byte-offset into filesystem object for page.
163 */ 118 */
@@ -175,14 +130,29 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
175} 130}
176 131
177extern void FASTCALL(__lock_page(struct page *page)); 132extern void FASTCALL(__lock_page(struct page *page));
133extern void FASTCALL(__lock_page_nosync(struct page *page));
178extern void FASTCALL(unlock_page(struct page *page)); 134extern void FASTCALL(unlock_page(struct page *page));
179 135
136/*
137 * lock_page may only be called if we have the page's inode pinned.
138 */
180static inline void lock_page(struct page *page) 139static inline void lock_page(struct page *page)
181{ 140{
182 might_sleep(); 141 might_sleep();
183 if (TestSetPageLocked(page)) 142 if (TestSetPageLocked(page))
184 __lock_page(page); 143 __lock_page(page);
185} 144}
145
146/*
147 * lock_page_nosync should only be used if we can't pin the page's inode.
148 * Doesn't play quite so well with block device plugging.
149 */
150static inline void lock_page_nosync(struct page *page)
151{
152 might_sleep();
153 if (TestSetPageLocked(page))
154 __lock_page_nosync(page);
155}
186 156
187/* 157/*
188 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 158 * This is exported only for wait_on_page_locked/wait_on_page_writeback.
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d42737eeee..5bf321e82c 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -127,6 +127,10 @@ struct amiga_parport_state {
127 unsigned char statusdir;/* ciab.ddrb & 7 */ 127 unsigned char statusdir;/* ciab.ddrb & 7 */
128}; 128};
129 129
130struct ax88796_parport_state {
131 unsigned char cpr;
132};
133
130struct ip32_parport_state { 134struct ip32_parport_state {
131 unsigned int dcr; 135 unsigned int dcr;
132 unsigned int ecr; 136 unsigned int ecr;
@@ -138,6 +142,7 @@ struct parport_state {
138 /* ARC has no state. */ 142 /* ARC has no state. */
139 struct ax_parport_state ax; 143 struct ax_parport_state ax;
140 struct amiga_parport_state amiga; 144 struct amiga_parport_state amiga;
145 struct ax88796_parport_state ax88796;
141 /* Atari has not state. */ 146 /* Atari has not state. */
142 struct ip32_parport_state ip32; 147 struct ip32_parport_state ip32;
143 void *misc; 148 void *misc;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 62a8c22f5f..5c3a4176eb 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
@@ -161,6 +162,7 @@ struct pci_dev {
161 unsigned int is_enabled:1; /* pci_enable_device has been called */ 162 unsigned int is_enabled:1; /* pci_enable_device has been called */
162 unsigned int is_busmaster:1; /* device is busmaster */ 163 unsigned int is_busmaster:1; /* device is busmaster */
163 unsigned int no_msi:1; /* device may not use msi */ 164 unsigned int no_msi:1; /* device may not use msi */
165 unsigned int no_d1d2:1; /* only allow d0 or d3 */
164 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 166 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
165 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 167 unsigned int broken_parity_status:1; /* Device generates false positive parity */
166 unsigned int msi_enabled:1; 168 unsigned int msi_enabled:1;
@@ -345,6 +347,8 @@ struct pci_driver {
345 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 */
346 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) */
347 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);
348 int (*resume) (struct pci_dev *dev); /* Device woken up */ 352 int (*resume) (struct pci_dev *dev); /* Device woken up */
349 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 */
350 void (*shutdown) (struct pci_dev *dev); 354 void (*shutdown) (struct pci_dev *dev);
@@ -352,6 +356,8 @@ struct pci_driver {
352 struct pci_error_handlers *err_handler; 356 struct pci_error_handlers *err_handler;
353 struct device_driver driver; 357 struct device_driver driver;
354 struct pci_dynids dynids; 358 struct pci_dynids dynids;
359
360 int multithread_probe;
355}; 361};
356 362
357#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)
@@ -400,12 +406,12 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
400extern struct list_head pci_devices; /* list of all devices */ 406extern struct list_head pci_devices; /* list of all devices */
401 407
402void pcibios_fixup_bus(struct pci_bus *); 408void pcibios_fixup_bus(struct pci_bus *);
403int pcibios_enable_device(struct pci_dev *, int mask); 409int __must_check pcibios_enable_device(struct pci_dev *, int mask);
404char *pcibios_setup (char *str); 410char *pcibios_setup (char *str);
405 411
406/* Used only when drivers/pci/setup.c is used */ 412/* Used only when drivers/pci/setup.c is used */
407void pcibios_align_resource(void *, struct resource *, 413void pcibios_align_resource(void *, struct resource *, resource_size_t,
408 unsigned long, unsigned long); 414 resource_size_t);
409void pcibios_update_irq(struct pci_dev *, int irq); 415void pcibios_update_irq(struct pci_dev *, int irq);
410 416
411/* Generic PCI functions used internally */ 417/* Generic PCI functions used internally */
@@ -427,7 +433,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
427struct 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);
428void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 434void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
429unsigned int pci_scan_child_bus(struct pci_bus *bus); 435unsigned int pci_scan_child_bus(struct pci_bus *bus);
430void pci_bus_add_device(struct pci_dev *dev); 436int __must_check pci_bus_add_device(struct pci_dev *dev);
431void pci_read_bridge_bases(struct pci_bus *child); 437void pci_read_bridge_bases(struct pci_bus *child);
432struct 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);
433int 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);
@@ -435,6 +441,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
435extern void pci_dev_put(struct pci_dev *dev); 441extern void pci_dev_put(struct pci_dev *dev);
436extern void pci_remove_bus(struct pci_bus *b); 442extern void pci_remove_bus(struct pci_bus *b);
437extern 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);
438void pci_setup_cardbus(struct pci_bus *bus); 445void pci_setup_cardbus(struct pci_bus *bus);
439 446
440/* Generic PCI functions exported to card drivers */ 447/* Generic PCI functions exported to card drivers */
@@ -487,19 +494,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
487 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);
488} 495}
489 496
490int pci_enable_device(struct pci_dev *dev); 497int __must_check pci_enable_device(struct pci_dev *dev);
491int pci_enable_device_bars(struct pci_dev *dev, int mask); 498int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
492void pci_disable_device(struct pci_dev *dev); 499void pci_disable_device(struct pci_dev *dev);
493void pci_set_master(struct pci_dev *dev); 500void pci_set_master(struct pci_dev *dev);
494#define HAVE_PCI_SET_MWI 501#define HAVE_PCI_SET_MWI
495int pci_set_mwi(struct pci_dev *dev); 502int __must_check pci_set_mwi(struct pci_dev *dev);
496void pci_clear_mwi(struct pci_dev *dev); 503void pci_clear_mwi(struct pci_dev *dev);
497void pci_intx(struct pci_dev *dev, int enable); 504void pci_intx(struct pci_dev *dev, int enable);
498int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 505int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
499int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 506int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
500void 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);
501int pci_assign_resource(struct pci_dev *dev, int i); 508int __must_check pci_assign_resource(struct pci_dev *dev, int i);
502int pci_assign_resource_fixed(struct pci_dev *dev, int i); 509int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
503void pci_restore_bars(struct pci_dev *dev); 510void pci_restore_bars(struct pci_dev *dev);
504 511
505/* ROM control related routines */ 512/* ROM control related routines */
@@ -525,23 +532,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *);
525void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 532void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
526 int (*)(struct pci_dev *, u8, u8)); 533 int (*)(struct pci_dev *, u8, u8));
527#define HAVE_PCI_REQ_REGIONS 2 534#define HAVE_PCI_REQ_REGIONS 2
528int pci_request_regions(struct pci_dev *, const char *); 535int __must_check pci_request_regions(struct pci_dev *, const char *);
529void pci_release_regions(struct pci_dev *); 536void pci_release_regions(struct pci_dev *);
530int pci_request_region(struct pci_dev *, int, const char *); 537int __must_check pci_request_region(struct pci_dev *, int, const char *);
531void pci_release_region(struct pci_dev *, int); 538void pci_release_region(struct pci_dev *, int);
532 539
533/* drivers/pci/bus.c */ 540/* drivers/pci/bus.c */
534int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 541int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
535 unsigned long size, unsigned long align, 542 struct resource *res, resource_size_t size,
536 unsigned long min, unsigned int type_mask, 543 resource_size_t align, resource_size_t min,
537 void (*alignf)(void *, struct resource *, 544 unsigned int type_mask,
538 unsigned long, unsigned long), 545 void (*alignf)(void *, struct resource *,
539 void *alignf_data); 546 resource_size_t, resource_size_t),
547 void *alignf_data);
540void pci_enable_bridges(struct pci_bus *bus); 548void pci_enable_bridges(struct pci_bus *bus);
541 549
542/* Proper probing supporting hot-pluggable devices */ 550/* Proper probing supporting hot-pluggable devices */
543int __pci_register_driver(struct pci_driver *, struct module *); 551int __must_check __pci_register_driver(struct pci_driver *, struct module *);
544static inline int pci_register_driver(struct pci_driver *driver) 552static inline int __must_check pci_register_driver(struct pci_driver *driver)
545{ 553{
546 return __pci_register_driver(driver, THIS_MODULE); 554 return __pci_register_driver(driver, THIS_MODULE);
547} 555}
@@ -730,7 +738,8 @@ static inline char *pci_name(struct pci_dev *pdev)
730 */ 738 */
731#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER 739#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
732static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, 740static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
733 const struct resource *rsrc, u64 *start, u64 *end) 741 const struct resource *rsrc, resource_size_t *start,
742 resource_size_t *end)
734{ 743{
735 *start = rsrc->start; 744 *start = rsrc->start;
736 *end = rsrc->end; 745 *end = rsrc->end;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c2fd2d1993..c9ffbc3843 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
@@ -648,6 +650,8 @@
648#define PCI_DEVICE_ID_SI_962 0x0962 650#define PCI_DEVICE_ID_SI_962 0x0962
649#define PCI_DEVICE_ID_SI_963 0x0963 651#define PCI_DEVICE_ID_SI_963 0x0963
650#define PCI_DEVICE_ID_SI_965 0x0965 652#define PCI_DEVICE_ID_SI_965 0x0965
653#define PCI_DEVICE_ID_SI_966 0x0966
654#define PCI_DEVICE_ID_SI_968 0x0968
651#define PCI_DEVICE_ID_SI_5511 0x5511 655#define PCI_DEVICE_ID_SI_5511 0x5511
652#define PCI_DEVICE_ID_SI_5513 0x5513 656#define PCI_DEVICE_ID_SI_5513 0x5513
653#define PCI_DEVICE_ID_SI_5517 0x5517 657#define PCI_DEVICE_ID_SI_5517 0x5517
@@ -728,7 +732,9 @@
728#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 732#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
729#define PCI_DEVICE_ID_TI_4450 0x8011 733#define PCI_DEVICE_ID_TI_4450 0x8011
730#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 734#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031
735#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034
731#define PCI_DEVICE_ID_TI_X515 0x8036 736#define PCI_DEVICE_ID_TI_X515 0x8036
737#define PCI_DEVICE_ID_TI_XX12 0x8039
732#define PCI_DEVICE_ID_TI_1130 0xac12 738#define PCI_DEVICE_ID_TI_1130 0xac12
733#define PCI_DEVICE_ID_TI_1031 0xac13 739#define PCI_DEVICE_ID_TI_1031 0xac13
734#define PCI_DEVICE_ID_TI_1131 0xac15 740#define PCI_DEVICE_ID_TI_1131 0xac15
@@ -1202,6 +1208,7 @@
1202#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF 1208#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1203#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 1209#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6
1204#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 1210#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7
1211#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448
1205#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450 1212#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1206#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1207#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
@@ -1289,6 +1296,7 @@
1289#define PCI_DEVICE_ID_VIA_8367_0 0x3099 1296#define PCI_DEVICE_ID_VIA_8367_0 0x3099
1290#define PCI_DEVICE_ID_VIA_8653_0 0x3101 1297#define PCI_DEVICE_ID_VIA_8653_0 0x3101
1291#define PCI_DEVICE_ID_VIA_8622 0x3102 1298#define PCI_DEVICE_ID_VIA_8622 0x3102
1299#define PCI_DEVICE_ID_VIA_8235_USB_2 0x3104
1292#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 1300#define PCI_DEVICE_ID_VIA_8233C_0 0x3109
1293#define PCI_DEVICE_ID_VIA_8361 0x3112 1301#define PCI_DEVICE_ID_VIA_8361 0x3112
1294#define PCI_DEVICE_ID_VIA_XM266 0x3116 1302#define PCI_DEVICE_ID_VIA_XM266 0x3116
@@ -1405,6 +1413,7 @@
1405#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1413#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1406#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1414#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1407#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1415#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1416#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1408#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1417#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1409#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1418#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
1410#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 1419#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
@@ -1440,6 +1449,7 @@
1440#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475 1449#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475
1441#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1450#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1442#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1451#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1452#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
1443 1453
1444#define PCI_VENDOR_ID_DLINK 0x1186 1454#define PCI_VENDOR_ID_DLINK 0x1186
1445#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00 1455#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00
@@ -1475,9 +1485,6 @@
1475#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1485#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1476#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1486#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1477#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1487#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1478#define PCI_DEVICE_ID_MARVELL_GT96100 0x9652
1479#define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653
1480
1481 1488
1482#define PCI_VENDOR_ID_V3 0x11b0 1489#define PCI_VENDOR_ID_V3 0x11b0
1483#define PCI_DEVICE_ID_V3_V960 0x0001 1490#define PCI_DEVICE_ID_V3_V960 0x0001
@@ -1722,6 +1729,9 @@
1722#define PCI_VENDOR_ID_DOMEX 0x134a 1729#define PCI_VENDOR_ID_DOMEX 0x134a
1723#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 1730#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
1724 1731
1732#define PCI_VENDOR_ID_INTASHIELD 0x135a
1733#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80
1734
1725#define PCI_VENDOR_ID_QUATECH 0x135C 1735#define PCI_VENDOR_ID_QUATECH 0x135C
1726#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 1736#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
1727#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 1737#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
@@ -1895,6 +1905,7 @@
1895#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1905#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
1896#define PCI_DEVICE_ID_TIGON3_5720 0x1658 1906#define PCI_DEVICE_ID_TIGON3_5720 0x1658
1897#define PCI_DEVICE_ID_TIGON3_5721 0x1659 1907#define PCI_DEVICE_ID_TIGON3_5721 0x1659
1908#define PCI_DEVICE_ID_TIGON3_5722 0x165a
1898#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 1909#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
1899#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 1910#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
1900#define PCI_DEVICE_ID_TIGON3_5714 0x1668 1911#define PCI_DEVICE_ID_TIGON3_5714 0x1668
@@ -1904,6 +1915,7 @@
1904#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 1915#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
1905#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 1916#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
1906#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 1917#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
1918#define PCI_DEVICE_ID_TIGON3_5756 0x1674
1907#define PCI_DEVICE_ID_TIGON3_5750 0x1676 1919#define PCI_DEVICE_ID_TIGON3_5750 0x1676
1908#define PCI_DEVICE_ID_TIGON3_5751 0x1677 1920#define PCI_DEVICE_ID_TIGON3_5751 0x1677
1909#define PCI_DEVICE_ID_TIGON3_5715 0x1678 1921#define PCI_DEVICE_ID_TIGON3_5715 0x1678
@@ -1933,6 +1945,8 @@
1933#define PCI_DEVICE_ID_TIGON3_5901 0x170d 1945#define PCI_DEVICE_ID_TIGON3_5901 0x170d
1934#define PCI_DEVICE_ID_BCM4401B1 0x170c 1946#define PCI_DEVICE_ID_BCM4401B1 0x170c
1935#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
1936#define PCI_DEVICE_ID_BCM4401 0x4401 1950#define PCI_DEVICE_ID_BCM4401 0x4401
1937#define PCI_DEVICE_ID_BCM4401B0 0x4402 1951#define PCI_DEVICE_ID_BCM4401B0 0x4402
1938 1952
@@ -2000,6 +2014,23 @@
2000#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea 2014#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
2001#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb 2015#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
2002 2016
2017#define PCI_VENDOR_ID_ARECA 0x17d3
2018#define PCI_DEVICE_ID_ARECA_1110 0x1110
2019#define PCI_DEVICE_ID_ARECA_1120 0x1120
2020#define PCI_DEVICE_ID_ARECA_1130 0x1130
2021#define PCI_DEVICE_ID_ARECA_1160 0x1160
2022#define PCI_DEVICE_ID_ARECA_1170 0x1170
2023#define PCI_DEVICE_ID_ARECA_1210 0x1210
2024#define PCI_DEVICE_ID_ARECA_1220 0x1220
2025#define PCI_DEVICE_ID_ARECA_1230 0x1230
2026#define PCI_DEVICE_ID_ARECA_1260 0x1260
2027#define PCI_DEVICE_ID_ARECA_1270 0x1270
2028#define PCI_DEVICE_ID_ARECA_1280 0x1280
2029#define PCI_DEVICE_ID_ARECA_1380 0x1380
2030#define PCI_DEVICE_ID_ARECA_1381 0x1381
2031#define PCI_DEVICE_ID_ARECA_1680 0x1680
2032#define PCI_DEVICE_ID_ARECA_1681 0x1681
2033
2003#define PCI_VENDOR_ID_S2IO 0x17d5 2034#define PCI_VENDOR_ID_S2IO 0x17d5
2004#define PCI_DEVICE_ID_S2IO_WIN 0x5731 2035#define PCI_DEVICE_ID_S2IO_WIN 0x5731
2005#define PCI_DEVICE_ID_S2IO_UNI 0x5831 2036#define PCI_DEVICE_ID_S2IO_UNI 0x5831
@@ -2015,6 +2046,13 @@
2015#define PCI_VENDOR_ID_TDI 0x192E 2046#define PCI_VENDOR_ID_TDI 0x192E
2016#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2047#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2017 2048
2049#define PCI_VENDOR_ID_JMICRON 0x197B
2050#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
2051#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
2052#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363
2053#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2054#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2055#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2018 2056
2019#define PCI_VENDOR_ID_TEKRAM 0x1de1 2057#define PCI_VENDOR_ID_TEKRAM 0x1de1
2020#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2058#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
@@ -2131,6 +2169,7 @@
2131#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 2169#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501
2132#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 2170#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530
2133#define PCI_DEVICE_ID_INTEL_82860_HB 0x2531 2171#define PCI_DEVICE_ID_INTEL_82860_HB 0x2531
2172#define PCI_DEVICE_ID_INTEL_E7501_MCH 0x254c
2134#define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560 2173#define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560
2135#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562 2174#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562
2136#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570 2175#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570
@@ -2170,7 +2209,6 @@
2170#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 2209#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815
2171#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e 2210#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
2172#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 2211#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
2173#define PCI_DEVICE_ID_INTEL_GD31244 0x3200
2174#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2212#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2175#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2213#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2176#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2214#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 6bce4a2403..7d0e26cba4 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -196,7 +196,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ 199#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ 200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */
201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
@@ -422,7 +422,23 @@
422#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ 422#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
423#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ 423#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */
424#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ 424#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */
425/* Correctable Err Reporting Enable */
426#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001
427/* Non-fatal Err Reporting Enable */
428#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002
429/* Fatal Err Reporting Enable */
430#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004
425#define PCI_ERR_ROOT_STATUS 48 431#define PCI_ERR_ROOT_STATUS 48
432#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
433/* Multi ERR_COR Received */
434#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002
435/* ERR_FATAL/NONFATAL Recevied */
436#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004
437/* Multi ERR_FATAL/NONFATAL Recevied */
438#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008
439#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
440#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
441#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
426#define PCI_ERR_ROOT_COR_SRC 52 442#define PCI_ERR_ROOT_COR_SRC 52
427#define PCI_ERR_ROOT_SRC 54 443#define PCI_ERR_ROOT_SRC 54
428 444
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index b44e01a709..6cd91e3f98 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 cb9039a21f..46ec72fa2c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -1,9 +1,12 @@
1#ifndef __LINUX_PERCPU_H 1#ifndef __LINUX_PERCPU_H
2#define __LINUX_PERCPU_H 2#define __LINUX_PERCPU_H
3
3#include <linux/spinlock.h> /* For preempt_disable() */ 4#include <linux/spinlock.h> /* For preempt_disable() */
4#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
5#include <linux/smp.h> 6#include <linux/smp.h>
6#include <linux/string.h> /* For memset() */ 7#include <linux/string.h> /* For memset() */
8#include <linux/cpumask.h>
9
7#include <asm/percpu.h> 10#include <asm/percpu.h>
8 11
9/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
@@ -11,8 +14,14 @@
11#define PERCPU_ENOUGH_ROOM 32768 14#define PERCPU_ENOUGH_ROOM 32768
12#endif 15#endif
13 16
14/* Must be an lvalue. */ 17/*
15#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); })) 18 * Must be an lvalue. Since @var must be a simple identifier,
19 * we force a syntax error here if it isn't.
20 */
21#define get_cpu_var(var) (*({ \
22 extern int simple_indentifier_##var(void); \
23 preempt_disable(); \
24 &__get_cpu_var(var); }))
16#define put_cpu_var(var) preempt_enable() 25#define put_cpu_var(var) preempt_enable()
17 26
18#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
@@ -21,39 +30,77 @@ struct percpu_data {
21 void *ptrs[NR_CPUS]; 30 void *ptrs[NR_CPUS];
22}; 31};
23 32
33#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
24/* 34/*
25 * Use this to get to a cpu's version of the per-cpu object allocated using 35 * Use this to get to a cpu's version of the per-cpu object dynamically
26 * alloc_percpu. Non-atomic access to the current CPU's version should 36 * allocated. Non-atomic access to the current CPU's version should
27 * probably be combined with get_cpu()/put_cpu(). 37 * probably be combined with get_cpu()/put_cpu().
28 */ 38 */
29#define per_cpu_ptr(ptr, cpu) \ 39#define percpu_ptr(ptr, cpu) \
30({ \ 40({ \
31 struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \ 41 struct percpu_data *__p = __percpu_disguise(ptr); \
32 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 42 (__typeof__(ptr))__p->ptrs[(cpu)]; \
33}) 43})
34 44
35extern void *__alloc_percpu(size_t size); 45extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu);
36extern void free_percpu(const void *); 46extern void percpu_depopulate(void *__pdata, int cpu);
47extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
48 cpumask_t *mask);
49extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask);
50extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
51extern void percpu_free(void *__pdata);
37 52
38#else /* CONFIG_SMP */ 53#else /* CONFIG_SMP */
39 54
40#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 55#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
56
57static inline void percpu_depopulate(void *__pdata, int cpu)
58{
59}
60
61static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
62{
63}
41 64
42static inline void *__alloc_percpu(size_t size) 65static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp,
66 int cpu)
43{ 67{
44 void *ret = kmalloc(size, GFP_KERNEL); 68 return percpu_ptr(__pdata, cpu);
45 if (ret)
46 memset(ret, 0, size);
47 return ret;
48} 69}
49static inline void free_percpu(const void *ptr) 70
50{ 71static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
51 kfree(ptr); 72 cpumask_t *mask)
73{
74 return 0;
75}
76
77static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
78{
79 return kzalloc(size, gfp);
80}
81
82static inline void percpu_free(void *__pdata)
83{
84 kfree(__pdata);
52} 85}
53 86
54#endif /* CONFIG_SMP */ 87#endif /* CONFIG_SMP */
55 88
56/* Simple wrapper for the common case: zeros memory. */ 89#define percpu_populate_mask(__pdata, size, gfp, mask) \
57#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type)))) 90 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
91#define percpu_depopulate_mask(__pdata, mask) \
92 __percpu_depopulate_mask((__pdata), &(mask))
93#define percpu_alloc_mask(size, gfp, mask) \
94 __percpu_alloc_mask((size), (gfp), &(mask))
95
96#define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map)
97
98/* (legacy) interface for use without CPU hotplug handling */
99
100#define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \
101 cpu_possible_map)
102#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type))
103#define free_percpu(ptr) percpu_free((ptr))
104#define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu))
58 105
59#endif /* __LINUX_PERCPU_H */ 106#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 331521a10a..9447a57ee8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -378,6 +378,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
378 struct mii_ioctl_data *mii_data, int cmd); 378 struct mii_ioctl_data *mii_data, int cmd);
379int phy_start_interrupts(struct phy_device *phydev); 379int phy_start_interrupts(struct phy_device *phydev);
380void phy_print_status(struct phy_device *phydev); 380void phy_print_status(struct phy_device *phydev);
381struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
381 382
382extern struct bus_type mdio_bus_type; 383extern struct bus_type mdio_bus_type;
383#endif /* __PHY_H */ 384#endif /* __PHY_H */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 29960b03be..93da7e2d9f 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -76,6 +76,8 @@ extern int FASTCALL(attach_pid(struct task_struct *task,
76 enum pid_type type, int nr)); 76 enum pid_type type, int nr));
77 77
78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
79extern void FASTCALL(transfer_pid(struct task_struct *old,
80 struct task_struct *new, enum pid_type));
79 81
80/* 82/*
81 * look up a PID in the hash table. Must be called with the tasklist_lock 83 * look up a PID in the hash table. Must be called with the tasklist_lock
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index bd2c5a2bbb..c3f01b3085 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -305,6 +305,7 @@ enum
305 TCA_FW_POLICE, 305 TCA_FW_POLICE,
306 TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ 306 TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */
307 TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ 307 TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */
308 TCA_FW_MASK,
308 __TCA_FW_MAX 309 __TCA_FW_MAX
309}; 310};
310 311
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 782090c689..29cd6dee13 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/plist.h b/include/linux/plist.h
new file mode 100644
index 0000000000..b95818a037
--- /dev/null
+++ b/include/linux/plist.h
@@ -0,0 +1,248 @@
1/*
2 * Descending-priority-sorted double-linked list
3 *
4 * (C) 2002-2003 Intel Corp
5 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>.
6 *
7 * 2001-2005 (c) MontaVista Software, Inc.
8 * Daniel Walker <dwalker@mvista.com>
9 *
10 * (C) 2005 Thomas Gleixner <tglx@linutronix.de>
11 *
12 * Simplifications of the original code by
13 * Oleg Nesterov <oleg@tv-sign.ru>
14 *
15 * Licensed under the FSF's GNU Public License v2 or later.
16 *
17 * Based on simple lists (include/linux/list.h).
18 *
19 * This is a priority-sorted list of nodes; each node has a
20 * priority from INT_MIN (highest) to INT_MAX (lowest).
21 *
22 * Addition is O(K), removal is O(1), change of priority of a node is
23 * O(K) and K is the number of RT priority levels used in the system.
24 * (1 <= K <= 99)
25 *
26 * This list is really a list of lists:
27 *
28 * - The tier 1 list is the prio_list, different priority nodes.
29 *
30 * - The tier 2 list is the node_list, serialized nodes.
31 *
32 * Simple ASCII art explanation:
33 *
34 * |HEAD |
35 * | |
36 * |prio_list.prev|<------------------------------------|
37 * |prio_list.next|<->|pl|<->|pl|<--------------->|pl|<-|
38 * |10 | |10| |21| |21| |21| |40| (prio)
39 * | | | | | | | | | | | |
40 * | | | | | | | | | | | |
41 * |node_list.next|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-|
42 * |node_list.prev|<------------------------------------|
43 *
44 * The nodes on the prio_list list are sorted by priority to simplify
45 * the insertion of new nodes. There are no nodes with duplicate
46 * priorites on the list.
47 *
48 * The nodes on the node_list is ordered by priority and can contain
49 * entries which have the same priority. Those entries are ordered
50 * FIFO
51 *
52 * Addition means: look for the prio_list node in the prio_list
53 * for the priority of the node and insert it before the node_list
54 * entry of the next prio_list node. If it is the first node of
55 * that priority, add it to the prio_list in the right position and
56 * insert it into the serialized node_list list
57 *
58 * Removal means remove it from the node_list and remove it from
59 * the prio_list if the node_list list_head is non empty. In case
60 * of removal from the prio_list it must be checked whether other
61 * entries of the same priority are on the list or not. If there
62 * is another entry of the same priority then this entry has to
63 * replace the removed entry on the prio_list. If the entry which
64 * is removed is the only entry of this priority then a simple
65 * remove from both list is sufficient.
66 *
67 * INT_MIN is the highest priority, 0 is the medium highest, INT_MAX
68 * is lowest priority.
69 *
70 * No locking is done, up to the caller.
71 *
72 */
73#ifndef _LINUX_PLIST_H_
74#define _LINUX_PLIST_H_
75
76#include <linux/kernel.h>
77#include <linux/list.h>
78#include <linux/spinlock_types.h>
79
80struct plist_head {
81 struct list_head prio_list;
82 struct list_head node_list;
83#ifdef CONFIG_DEBUG_PI_LIST
84 spinlock_t *lock;
85#endif
86};
87
88struct plist_node {
89 int prio;
90 struct plist_head plist;
91};
92
93#ifdef CONFIG_DEBUG_PI_LIST
94# define PLIST_HEAD_LOCK_INIT(_lock) .lock = _lock
95#else
96# define PLIST_HEAD_LOCK_INIT(_lock)
97#endif
98
99/**
100 * #PLIST_HEAD_INIT - static struct plist_head initializer
101 *
102 * @head: struct plist_head variable name
103 */
104#define PLIST_HEAD_INIT(head, _lock) \
105{ \
106 .prio_list = LIST_HEAD_INIT((head).prio_list), \
107 .node_list = LIST_HEAD_INIT((head).node_list), \
108 PLIST_HEAD_LOCK_INIT(&(_lock)) \
109}
110
111/**
112 * #PLIST_NODE_INIT - static struct plist_node initializer
113 *
114 * @node: struct plist_node variable name
115 * @__prio: initial node priority
116 */
117#define PLIST_NODE_INIT(node, __prio) \
118{ \
119 .prio = (__prio), \
120 .plist = PLIST_HEAD_INIT((node).plist, NULL), \
121}
122
123/**
124 * plist_head_init - dynamic struct plist_head initializer
125 *
126 * @head: &struct plist_head pointer
127 */
128static inline void
129plist_head_init(struct plist_head *head, spinlock_t *lock)
130{
131 INIT_LIST_HEAD(&head->prio_list);
132 INIT_LIST_HEAD(&head->node_list);
133#ifdef CONFIG_DEBUG_PI_LIST
134 head->lock = lock;
135#endif
136}
137
138/**
139 * plist_node_init - Dynamic struct plist_node initializer
140 *
141 * @node: &struct plist_node pointer
142 * @prio: initial node priority
143 */
144static inline void plist_node_init(struct plist_node *node, int prio)
145{
146 node->prio = prio;
147 plist_head_init(&node->plist, NULL);
148}
149
150extern void plist_add(struct plist_node *node, struct plist_head *head);
151extern void plist_del(struct plist_node *node, struct plist_head *head);
152
153/**
154 * plist_for_each - iterate over the plist
155 *
156 * @pos1: the type * to use as a loop counter.
157 * @head: the head for your list.
158 */
159#define plist_for_each(pos, head) \
160 list_for_each_entry(pos, &(head)->node_list, plist.node_list)
161
162/**
163 * plist_for_each_entry_safe - iterate over a plist of given type safe
164 * against removal of list entry
165 *
166 * @pos1: the type * to use as a loop counter.
167 * @n1: another type * to use as temporary storage
168 * @head: the head for your list.
169 */
170#define plist_for_each_safe(pos, n, head) \
171 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list)
172
173/**
174 * plist_for_each_entry - iterate over list of given type
175 *
176 * @pos: the type * to use as a loop counter.
177 * @head: the head for your list.
178 * @member: the name of the list_struct within the struct.
179 */
180#define plist_for_each_entry(pos, head, mem) \
181 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list)
182
183/**
184 * plist_for_each_entry_safe - iterate over list of given type safe against
185 * removal of list entry
186 *
187 * @pos: the type * to use as a loop counter.
188 * @n: another type * to use as temporary storage
189 * @head: the head for your list.
190 * @m: the name of the list_struct within the struct.
191 */
192#define plist_for_each_entry_safe(pos, n, head, m) \
193 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list)
194
195/**
196 * plist_head_empty - return !0 if a plist_head is empty
197 *
198 * @head: &struct plist_head pointer
199 */
200static inline int plist_head_empty(const struct plist_head *head)
201{
202 return list_empty(&head->node_list);
203}
204
205/**
206 * plist_node_empty - return !0 if plist_node is not on a list
207 *
208 * @node: &struct plist_node pointer
209 */
210static inline int plist_node_empty(const struct plist_node *node)
211{
212 return plist_head_empty(&node->plist);
213}
214
215/* All functions below assume the plist_head is not empty. */
216
217/**
218 * plist_first_entry - get the struct for the first entry
219 *
220 * @ptr: the &struct plist_head pointer.
221 * @type: the type of the struct this is embedded in.
222 * @member: the name of the list_struct within the struct.
223 */
224#ifdef CONFIG_DEBUG_PI_LIST
225# define plist_first_entry(head, type, member) \
226({ \
227 WARN_ON(plist_head_empty(head)); \
228 container_of(plist_first(head), type, member); \
229})
230#else
231# define plist_first_entry(head, type, member) \
232 container_of(plist_first(head), type, member)
233#endif
234
235/**
236 * plist_first - return the first node (and thus, highest priority)
237 *
238 * @head: the &struct plist_head pointer
239 *
240 * Assumes the plist is _not_ empty.
241 */
242static inline struct plist_node* plist_first(const struct plist_head *head)
243{
244 return list_entry(head->node_list.next,
245 struct plist_node, plist.node_list);
246}
247
248#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 658c1b93d5..6b27e07aef 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/pm_legacy.h b/include/linux/pm_legacy.h
index 78027c533b..514729a446 100644
--- a/include/linux/pm_legacy.h
+++ b/include/linux/pm_legacy.h
@@ -15,11 +15,6 @@ struct pm_dev __deprecated *
15pm_register(pm_dev_t type, unsigned long id, pm_callback callback); 15pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
16 16
17/* 17/*
18 * Unregister all devices with matching callback
19 */
20void __deprecated pm_unregister_all(pm_callback callback);
21
22/*
23 * Send a request to all devices 18 * Send a request to all devices
24 */ 19 */
25int __deprecated pm_send_all(pm_request_t rqst, void *data); 20int __deprecated pm_send_all(pm_request_t rqst, void *data);
@@ -35,8 +30,6 @@ static inline struct pm_dev *pm_register(pm_dev_t type,
35 return NULL; 30 return NULL;
36} 31}
37 32
38static inline void pm_unregister_all(pm_callback callback) {}
39
40static inline int pm_send_all(pm_request_t rqst, void *data) 33static inline int pm_send_all(pm_request_t rqst, void *data)
41{ 34{
42 return 0; 35 return 0;
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index ecce5912f4..783177387a 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -230,4 +230,7 @@ extern int pmu_battery_count;
230extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; 230extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
231extern unsigned int pmu_power_flags; 231extern unsigned int pmu_power_flags;
232 232
233/* Backlight */
234extern void pmu_backlight_init(void);
235
233#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 93b0959eb4..ab8a8dd8d6 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -389,7 +389,8 @@ int pnp_start_dev(struct pnp_dev *dev);
389int pnp_stop_dev(struct pnp_dev *dev); 389int pnp_stop_dev(struct pnp_dev *dev);
390int pnp_activate_dev(struct pnp_dev *dev); 390int pnp_activate_dev(struct pnp_dev *dev);
391int pnp_disable_dev(struct pnp_dev *dev); 391int pnp_disable_dev(struct pnp_dev *dev);
392void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); 392void pnp_resource_change(struct resource *resource, resource_size_t start,
393 resource_size_t size);
393 394
394/* protocol helpers */ 395/* protocol helpers */
395int pnp_is_active(struct pnp_dev * dev); 396int pnp_is_active(struct pnp_dev * dev);
@@ -434,7 +435,9 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
434static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 435static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
435static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 436static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
436static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 437static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
437static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } 438static inline void pnp_resource_change(struct resource *resource,
439 resource_size_t start,
440 resource_size_t size) { }
438 441
439/* protocol helpers */ 442/* protocol helpers */
440static inline int pnp_is_active(struct pnp_dev * dev) { return 0; } 443static inline int pnp_is_active(struct pnp_dev * dev) { return 0; }
diff --git a/include/linux/poison.h b/include/linux/poison.h
new file mode 100644
index 0000000000..3e628f990f
--- /dev/null
+++ b/include/linux/poison.h
@@ -0,0 +1,63 @@
1#ifndef _LINUX_POISON_H
2#define _LINUX_POISON_H
3
4/********** include/linux/list.h **********/
5/*
6 * These are non-NULL pointers that will result in page faults
7 * under normal circumstances, used to verify that nobody uses
8 * non-initialized list entries.
9 */
10#define LIST_POISON1 ((void *) 0x00100100)
11#define LIST_POISON2 ((void *) 0x00200200)
12
13/********** mm/slab.c **********/
14/*
15 * Magic nums for obj red zoning.
16 * Placed in the first word before and the first word after an obj.
17 */
18#define RED_INACTIVE 0x5A2CF071UL /* when obj is inactive */
19#define RED_ACTIVE 0x170FC2A5UL /* when obj is active */
20
21/* ...and for poisoning */
22#define POISON_INUSE 0x5a /* for use-uninitialised poisoning */
23#define POISON_FREE 0x6b /* for use-after-free poisoning */
24#define POISON_END 0xa5 /* end-byte of poisoning */
25
26/********** arch/$ARCH/mm/init.c **********/
27#define POISON_FREE_INITMEM 0xcc
28
29/********** arch/x86_64/mm/init.c **********/
30#define POISON_FREE_INITDATA 0xba
31
32/********** arch/ia64/hp/common/sba_iommu.c **********/
33/*
34 * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
35 * value of "SBAIOMMU POISON\0" for spill-over poisoning.
36 */
37
38/********** fs/jbd/journal.c **********/
39#define JBD_POISON_FREE 0x5b
40
41/********** drivers/base/dmapool.c **********/
42#define POOL_POISON_FREED 0xa7 /* !inuse */
43#define POOL_POISON_ALLOCATED 0xa9 /* !initted */
44
45/********** drivers/atm/ **********/
46#define ATM_POISON_FREE 0x12
47#define ATM_POISON 0xdeadbeef
48
49/********** net/ **********/
50#define NEIGHBOR_DEAD 0xdeadbeef
51#define NETFILTER_LINK_POISON 0xdead57ac
52
53/********** kernel/mutexes **********/
54#define MUTEX_DEBUG_INIT 0x11
55#define MUTEX_DEBUG_FREE 0x22
56
57/********** security/ **********/
58#define KEY_DESTROY 0xbd
59
60/********** sound/oss/ **********/
61#define OSS_POISON_FREE 0xAB
62
63#endif
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 95572c434b..a7dd38f30a 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/proc_fs.h b/include/linux/proc_fs.h
index 5810d28fbe..57f70bc8b2 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -4,6 +4,7 @@
4#include <linux/slab.h> 4#include <linux/slab.h>
5#include <linux/fs.h> 5#include <linux/fs.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/magic.h>
7#include <asm/atomic.h> 8#include <asm/atomic.h>
8 9
9/* 10/*
@@ -24,8 +25,6 @@ enum {
24 PROC_ROOT_INO = 1, 25 PROC_ROOT_INO = 1,
25}; 26};
26 27
27#define PROC_SUPER_MAGIC 0x9fa0
28
29/* 28/*
30 * This is not completely implemented yet. The idea is to 29 * This is not completely implemented yet. The idea is to
31 * create an in-memory tree (like the actual /proc filesystem 30 * create an in-memory tree (like the actual /proc filesystem
@@ -99,9 +98,8 @@ extern void proc_misc_init(void);
99 98
100struct mm_struct; 99struct mm_struct;
101 100
101void proc_flush_task(struct task_struct *task);
102struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 102struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
103struct dentry *proc_pid_unhash(struct task_struct *p);
104void proc_pid_flush(struct dentry *proc_dentry);
105int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 103int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
106unsigned long task_vsize(struct mm_struct *); 104unsigned long task_vsize(struct mm_struct *);
107int task_statm(struct mm_struct *, int *, int *, int *, int *); 105int task_statm(struct mm_struct *, int *, int *, int *, int *);
@@ -211,8 +209,7 @@ static inline void proc_net_remove(const char *name)
211#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) 209#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; })
212static inline void proc_net_remove(const char *name) {} 210static inline void proc_net_remove(const char *name) {}
213 211
214static inline struct dentry *proc_pid_unhash(struct task_struct *p) { return NULL; } 212static inline void proc_flush_task(struct task_struct *task) { }
215static inline void proc_pid_flush(struct dentry *proc_dentry) { }
216 213
217static inline struct proc_dir_entry *create_proc_entry(const char *name, 214static inline struct proc_dir_entry *create_proc_entry(const char *name,
218 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 215 mode_t mode, struct proc_dir_entry *parent) { return NULL; }
@@ -248,8 +245,8 @@ extern void kclist_add(struct kcore_list *, void *, size_t);
248#endif 245#endif
249 246
250struct proc_inode { 247struct proc_inode {
251 struct task_struct *task; 248 struct pid *pid;
252 int type; 249 int fd;
253 union { 250 union {
254 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); 251 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **);
255 int (*proc_read)(struct task_struct *task, char *page); 252 int (*proc_read)(struct task_struct *task, char *page);
@@ -268,4 +265,12 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
268 return PROC_I(inode)->pde; 265 return PROC_I(inode)->pde;
269} 266}
270 267
268struct proc_maps_private {
269 struct pid *pid;
270 struct task_struct *task;
271#ifdef CONFIG_MMU
272 struct vm_area_struct *tail_vma;
273#endif
274};
275
271#endif /* _LINUX_PROC_FS_H */ 276#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ee918bc6e1..eeb1976ef7 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
@@ -88,7 +88,6 @@ extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __us
88extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 88extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
89extern int ptrace_attach(struct task_struct *tsk); 89extern int ptrace_attach(struct task_struct *tsk);
90extern int ptrace_detach(struct task_struct *, unsigned int); 90extern int ptrace_detach(struct task_struct *, unsigned int);
91extern void __ptrace_detach(struct task_struct *, unsigned int);
92extern void ptrace_disable(struct task_struct *); 91extern void ptrace_disable(struct task_struct *);
93extern int ptrace_check_attach(struct task_struct *task, int kill); 92extern int ptrace_check_attach(struct task_struct *task, int kill);
94extern int ptrace_request(struct task_struct *child, long request, long addr, long data); 93extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 27f49c85d5..0c7ac444fd 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -11,6 +11,7 @@
11#define _LINUX_QNX4_FS_H 11#define _LINUX_QNX4_FS_H
12 12
13#include <linux/qnxtypes.h> 13#include <linux/qnxtypes.h>
14#include <linux/magic.h>
14 15
15#define QNX4_ROOT_INO 1 16#define QNX4_ROOT_INO 1
16 17
@@ -25,7 +26,6 @@
25 26
26#define QNX4_I_MAP_SLOTS 8 27#define QNX4_I_MAP_SLOTS 8
27#define QNX4_Z_MAP_SLOTS 64 28#define QNX4_Z_MAP_SLOTS 64
28#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
29#define QNX4_VALID_FS 0x0001 /* Clean fs. */ 29#define QNX4_VALID_FS 0x0001 /* Clean fs. */
30#define QNX4_ERROR_FS 0x0002 /* fs has errors. */ 30#define QNX4_ERROR_FS 0x0002 /* fs has errors. */
31#define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ 31#define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild
new file mode 100644
index 0000000000..2415a64c5e
--- /dev/null
+++ b/include/linux/raid/Kbuild
@@ -0,0 +1,2 @@
1header-y += md_p.h
2header-y += md_u.h
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 899437802a..63df898fe2 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -140,6 +140,7 @@ typedef __u16 bitmap_counter_t;
140enum bitmap_state { 140enum bitmap_state {
141 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ 141 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
142 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */ 142 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */
143 BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */
143 BITMAP_HOSTENDIAN = 0x8000, 144 BITMAP_HOSTENDIAN = 0x8000,
144}; 145};
145 146
@@ -244,15 +245,9 @@ struct bitmap {
244 unsigned long daemon_lastrun; /* jiffies of last run */ 245 unsigned long daemon_lastrun; /* jiffies of last run */
245 unsigned long daemon_sleep; /* how many seconds between updates? */ 246 unsigned long daemon_sleep; /* how many seconds between updates? */
246 247
247 /* 248 atomic_t pending_writes; /* pending writes to the bitmap file */
248 * bitmap_writeback_daemon waits for file-pages that have been written,
249 * as there is no way to get a call-back when a page write completes.
250 */
251 mdk_thread_t *writeback_daemon;
252 spinlock_t write_lock;
253 wait_queue_head_t write_wait; 249 wait_queue_head_t write_wait;
254 struct list_head complete_pages; 250
255 mempool_t *write_pool;
256}; 251};
257 252
258/* the bitmap API */ 253/* the bitmap API */
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index 7eaf290e10..ba15469daf 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -13,8 +13,10 @@ typedef struct dev_info dev_info_t;
13 13
14struct linear_private_data 14struct linear_private_data
15{ 15{
16 struct linear_private_data *prev; /* earlier version */
16 dev_info_t **hash_table; 17 dev_info_t **hash_table;
17 sector_t hash_spacing; 18 sector_t hash_spacing;
19 sector_t array_size;
18 int preshift; /* shift before dividing by hash_spacing */ 20 int preshift; /* shift before dividing by hash_spacing */
19 dev_info_t disks[0]; 21 dev_info_t disks[0];
20}; 22};
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 66b44e5e0d..eb3e547c8f 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -85,8 +85,6 @@ extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
85extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev); 85extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev);
86extern void md_unplug_mddev(mddev_t *mddev); 86extern void md_unplug_mddev(mddev_t *mddev);
87 87
88extern void md_print_devices (void);
89
90extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 88extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
91 sector_t sector, int size, struct page *page); 89 sector_t sector, int size, struct page *page);
92extern void md_super_wait(mddev_t *mddev); 90extern void md_super_wait(mddev_t *mddev);
@@ -97,7 +95,5 @@ extern void md_new_event(mddev_t *mddev);
97 95
98extern void md_update_sb(mddev_t * mddev); 96extern void md_update_sb(mddev_t * mddev);
99 97
100#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
101
102#endif 98#endif
103 99
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index e2df61f5b0..d288902958 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -40,7 +40,8 @@ typedef struct mdk_rdev_s mdk_rdev_t;
40 * options passed in raidrun: 40 * options passed in raidrun:
41 */ 41 */
42 42
43#define MAX_CHUNK_SIZE (4096*1024) 43/* Currently this must fix in an 'int' */
44#define MAX_CHUNK_SIZE (1<<30)
44 45
45/* 46/*
46 * MD's 'extended' device 47 * MD's 'extended' device
@@ -57,6 +58,7 @@ struct mdk_rdev_s
57 58
58 struct page *sb_page; 59 struct page *sb_page;
59 int sb_loaded; 60 int sb_loaded;
61 __u64 sb_events;
60 sector_t data_offset; /* start of data in array */ 62 sector_t data_offset; /* start of data in array */
61 sector_t sb_offset; 63 sector_t sb_offset;
62 int sb_size; /* bytes in the superblock */ 64 int sb_size; /* bytes in the superblock */
@@ -87,6 +89,10 @@ struct mdk_rdev_s
87 * array and could again if we did a partial 89 * array and could again if we did a partial
88 * resync from the bitmap 90 * resync from the bitmap
89 */ 91 */
92 sector_t recovery_offset;/* If this device has been partially
93 * recovered, this is where we were
94 * up to.
95 */
90 96
91 atomic_t nr_pending; /* number of pending requests. 97 atomic_t nr_pending; /* number of pending requests.
92 * only maintained for arrays that 98 * only maintained for arrays that
@@ -142,9 +148,10 @@ struct mddev_s
142 148
143 struct mdk_thread_s *thread; /* management thread */ 149 struct mdk_thread_s *thread; /* management thread */
144 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ 150 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
145 sector_t curr_resync; /* blocks scheduled */ 151 sector_t curr_resync; /* last block scheduled */
146 unsigned long resync_mark; /* a recent timestamp */ 152 unsigned long resync_mark; /* a recent timestamp */
147 sector_t resync_mark_cnt;/* blocks written at resync_mark */ 153 sector_t resync_mark_cnt;/* blocks written at resync_mark */
154 sector_t curr_mark_cnt; /* blocks scheduled now */
148 155
149 sector_t resync_max_sectors; /* may be set by personality */ 156 sector_t resync_max_sectors; /* may be set by personality */
150 157
@@ -182,6 +189,8 @@ struct mddev_s
182#define MD_RECOVERY_REQUESTED 6 189#define MD_RECOVERY_REQUESTED 6
183#define MD_RECOVERY_CHECK 7 190#define MD_RECOVERY_CHECK 7
184#define MD_RECOVERY_RESHAPE 8 191#define MD_RECOVERY_RESHAPE 8
192#define MD_RECOVERY_FROZEN 9
193
185 unsigned long recovery; 194 unsigned long recovery;
186 195
187 int in_sync; /* know to not need resync */ 196 int in_sync; /* know to not need resync */
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index f1fbae7e39..b6ebc69bae 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -265,9 +265,12 @@ struct mdp_superblock_1 {
265 265
266/* feature_map bits */ 266/* feature_map bits */
267#define MD_FEATURE_BITMAP_OFFSET 1 267#define MD_FEATURE_BITMAP_OFFSET 1
268#define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and
269 * must be honoured
270 */
268#define MD_FEATURE_RESHAPE_ACTIVE 4 271#define MD_FEATURE_RESHAPE_ACTIVE 4
269 272
270#define MD_FEATURE_ALL 5 273#define MD_FEATURE_ALL (1|2|4)
271 274
272#endif 275#endif
273 276
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
index b1103298a8..c41e56a7c0 100644
--- a/include/linux/raid/raid10.h
+++ b/include/linux/raid/raid10.h
@@ -24,11 +24,16 @@ struct r10_private_data_s {
24 int far_copies; /* number of copies layed out 24 int far_copies; /* number of copies layed out
25 * at large strides across drives 25 * at large strides across drives
26 */ 26 */
27 int far_offset; /* far_copies are offset by 1 stripe
28 * instead of many
29 */
27 int copies; /* near_copies * far_copies. 30 int copies; /* near_copies * far_copies.
28 * must be <= raid_disks 31 * must be <= raid_disks
29 */ 32 */
30 sector_t stride; /* distance between far copies. 33 sector_t stride; /* distance between far copies.
31 * This is size / far_copies 34 * This is size / far_copies unless
35 * far_offset, in which case it is
36 * 1 stripe.
32 */ 37 */
33 38
34 int chunk_shift; /* shift from chunks to sectors */ 39 int chunk_shift; /* shift from chunks to sectors */
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 914af66704..20ed4c9976 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -212,6 +212,7 @@ struct raid5_private_data {
212 mddev_t *mddev; 212 mddev_t *mddev;
213 struct disk_info *spare; 213 struct disk_info *spare;
214 int chunk_size, level, algorithm; 214 int chunk_size, level, algorithm;
215 int max_degraded;
215 int raid_disks, working_disks, failed_disks; 216 int raid_disks, working_disks, failed_disks;
216 int max_nr_stripes; 217 int max_nr_stripes;
217 218
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 6312758393..b4ca73d658 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -163,14 +163,22 @@ extern int rcu_needs_cpu(int cpu);
163 * 163 *
164 * It is illegal to block while in an RCU read-side critical section. 164 * It is illegal to block while in an RCU read-side critical section.
165 */ 165 */
166#define rcu_read_lock() preempt_disable() 166#define rcu_read_lock() \
167 do { \
168 preempt_disable(); \
169 __acquire(RCU); \
170 } while(0)
167 171
168/** 172/**
169 * rcu_read_unlock - marks the end of an RCU read-side critical section. 173 * rcu_read_unlock - marks the end of an RCU read-side critical section.
170 * 174 *
171 * See rcu_read_lock() for more information. 175 * See rcu_read_lock() for more information.
172 */ 176 */
173#define rcu_read_unlock() preempt_enable() 177#define rcu_read_unlock() \
178 do { \
179 __release(RCU); \
180 preempt_enable(); \
181 } while(0)
174 182
175/* 183/*
176 * So where is rcu_write_lock()? It does not exist, as there is no 184 * So where is rcu_write_lock()? It does not exist, as there is no
@@ -193,14 +201,22 @@ extern int rcu_needs_cpu(int cpu);
193 * can use just rcu_read_lock(). 201 * can use just rcu_read_lock().
194 * 202 *
195 */ 203 */
196#define rcu_read_lock_bh() local_bh_disable() 204#define rcu_read_lock_bh() \
205 do { \
206 local_bh_disable(); \
207 __acquire(RCU_BH); \
208 } while(0)
197 209
198/* 210/*
199 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section 211 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
200 * 212 *
201 * See rcu_read_lock_bh() for more information. 213 * See rcu_read_lock_bh() for more information.
202 */ 214 */
203#define rcu_read_unlock_bh() local_bh_enable() 215#define rcu_read_unlock_bh() \
216 do { \
217 __release(RCU_BH); \
218 local_bh_enable(); \
219 } while(0)
204 220
205/** 221/**
206 * rcu_dereference - fetch an RCU-protected pointer in an 222 * rcu_dereference - fetch an RCU-protected pointer in an
@@ -258,6 +274,7 @@ extern void rcu_init(void);
258extern void rcu_check_callbacks(int cpu, int user); 274extern void rcu_check_callbacks(int cpu, int user);
259extern void rcu_restart_cpu(int cpu); 275extern void rcu_restart_cpu(int cpu);
260extern long rcu_batches_completed(void); 276extern long rcu_batches_completed(void);
277extern long rcu_batches_completed_bh(void);
261 278
262/* Exported interfaces */ 279/* Exported interfaces */
263extern void FASTCALL(call_rcu(struct rcu_head *head, 280extern void FASTCALL(call_rcu(struct rcu_head *head,
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 015297ff73..1dd1c70731 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -59,13 +59,13 @@ extern void machine_crash_shutdown(struct pt_regs *);
59 * Architecture independent implemenations of sys_reboot commands. 59 * Architecture independent implemenations of sys_reboot commands.
60 */ 60 */
61 61
62extern void kernel_restart_prepare(char *cmd);
63extern void kernel_shutdown_prepare(enum system_states state); 62extern void kernel_shutdown_prepare(enum system_states state);
64 63
65extern void kernel_restart(char *cmd); 64extern void kernel_restart(char *cmd);
66extern void kernel_halt(void); 65extern void kernel_halt(void);
67extern void kernel_power_off(void); 66extern void kernel_power_off(void);
68extern void kernel_kexec(void); 67
68void ctrl_alt_del(void);
69 69
70/* 70/*
71 * Emergency restart, callable from an interrupt handler. 71 * Emergency restart, callable from an interrupt handler.
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 806ec5b067..fe00f781a6 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 5676c4210e..28493ffaaf 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -12,6 +12,8 @@
12#define _LINUX_REISER_FS_H 12#define _LINUX_REISER_FS_H
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/magic.h>
16
15#ifdef __KERNEL__ 17#ifdef __KERNEL__
16#include <linux/slab.h> 18#include <linux/slab.h>
17#include <linux/interrupt.h> 19#include <linux/interrupt.h>
@@ -227,14 +229,6 @@ struct reiserfs_super_block {
227 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ 229 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \
228 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) 230 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s)))
229 231
230 /* used by gcc */
231#define REISERFS_SUPER_MAGIC 0x52654973
232 /* used by file system utilities that
233 look at the superblock, etc. */
234#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
235#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
236#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
237
238int is_reiserfs_3_5(struct reiserfs_super_block *rs); 232int is_reiserfs_3_5(struct reiserfs_super_block *rs);
239int is_reiserfs_3_6(struct reiserfs_super_block *rs); 233int is_reiserfs_3_6(struct reiserfs_super_block *rs);
240int is_reiserfs_jr(struct reiserfs_super_block *rs); 234int is_reiserfs_jr(struct reiserfs_super_block *rs);
@@ -1973,7 +1967,7 @@ void reiserfs_unmap_buffer(struct buffer_head *);
1973/* file.c */ 1967/* file.c */
1974extern struct inode_operations reiserfs_file_inode_operations; 1968extern struct inode_operations reiserfs_file_inode_operations;
1975extern const struct file_operations reiserfs_file_operations; 1969extern const struct file_operations reiserfs_file_operations;
1976extern struct address_space_operations reiserfs_address_space_operations; 1970extern const struct address_space_operations reiserfs_address_space_operations;
1977 1971
1978/* fix_nodes.c */ 1972/* fix_nodes.c */
1979 1973
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 149be8d9a0..5b3b297aa2 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_xattr.h b/include/linux/reiserfs_xattr.h
index 5e961035c7..966c35851b 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/resource.h b/include/linux/resource.h
index 21a86cb6ac..ae13db7147 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/time.h> 4#include <linux/time.h>
5 5
6struct task_struct;
7
6/* 8/*
7 * Resource control/accounting header file for linux 9 * Resource control/accounting header file for linux
8 */ 10 */
@@ -67,4 +69,6 @@ struct rlimit {
67 */ 69 */
68#include <asm/resource.h> 70#include <asm/resource.h>
69 71
72int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
73
70#endif 74#endif
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
new file mode 100644
index 0000000000..81e9299ca1
--- /dev/null
+++ b/include/linux/resume-trace.h
@@ -0,0 +1,34 @@
1#ifndef RESUME_TRACE_H
2#define RESUME_TRACE_H
3
4#ifdef CONFIG_PM_TRACE
5
6extern int pm_trace_enabled;
7
8struct device;
9extern void set_trace_device(struct device *);
10extern void generate_resume_trace(void *tracedata, unsigned int user);
11
12#define TRACE_DEVICE(dev) set_trace_device(dev)
13#define TRACE_RESUME(user) do { \
14 if (pm_trace_enabled) { \
15 void *tracedata; \
16 asm volatile("movl $1f,%0\n" \
17 ".section .tracedata,\"a\"\n" \
18 "1:\t.word %c1\n" \
19 "\t.long %c2\n" \
20 ".previous" \
21 :"=r" (tracedata) \
22 : "i" (__LINE__), "i" (__FILE__)); \
23 generate_resume_trace(tracedata, user); \
24 } \
25} while (0)
26
27#else
28
29#define TRACE_DEVICE(dev) do { } while (0)
30#define TRACE_RESUME(dev) do { } while (0)
31
32#endif
33
34#endif
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bf97b09000..db2c1df4fe 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -103,6 +103,14 @@ pte_t *page_check_address(struct page *, struct mm_struct *,
103 */ 103 */
104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); 104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
105 105
106/*
107 * Cleans the PTEs of shared mappings.
108 * (and since clean PTEs should also be readonly, write protects them too)
109 *
110 * returns the number of cleaned PTEs.
111 */
112int page_mkclean(struct page *);
113
106#else /* !CONFIG_MMU */ 114#else /* !CONFIG_MMU */
107 115
108#define anon_vma_init() do {} while (0) 116#define anon_vma_init() do {} while (0)
@@ -112,6 +120,12 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
112#define page_referenced(page,l) TestClearPageReferenced(page) 120#define page_referenced(page,l) TestClearPageReferenced(page)
113#define try_to_unmap(page, refs) SWAP_FAIL 121#define try_to_unmap(page, refs) SWAP_FAIL
114 122
123static inline int page_mkclean(struct page *page)
124{
125 return 0;
126}
127
128
115#endif /* CONFIG_MMU */ 129#endif /* CONFIG_MMU */
116 130
117/* 131/*
diff --git a/include/linux/root_dev.h b/include/linux/root_dev.h
index ea4bc9d137..ed241aad7c 100644
--- a/include/linux/root_dev.h
+++ b/include/linux/root_dev.h
@@ -2,6 +2,8 @@
2#define _ROOT_DEV_H_ 2#define _ROOT_DEV_H_
3 3
4#include <linux/major.h> 4#include <linux/major.h>
5#include <linux/types.h>
6#include <linux/kdev_t.h>
5 7
6enum { 8enum {
7 Root_NFS = MKDEV(UNNAMED_MAJOR, 255), 9 Root_NFS = MKDEV(UNNAMED_MAJOR, 255),
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
new file mode 100644
index 0000000000..bf74e63c98
--- /dev/null
+++ b/include/linux/rtc-v3020.h
@@ -0,0 +1,35 @@
1/*
2 * v3020.h - Registers definition and platform data structure for the v3020 RTC.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2006, 8D Technologies inc.
9 */
10#ifndef __LINUX_V3020_H
11#define __LINUX_V3020_H
12
13/* The v3020 has only one data pin but which one
14 * is used depends on the board. */
15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */
17};
18
19#define V3020_STATUS_0 0x00
20#define V3020_STATUS_1 0x01
21#define V3020_SECONDS 0x02
22#define V3020_MINUTES 0x03
23#define V3020_HOURS 0x04
24#define V3020_MONTH_DAY 0x05
25#define V3020_MONTH 0x06
26#define V3020_YEAR 0x07
27#define V3020_WEEK_DAY 0x08
28#define V3020_WEEK 0x09
29
30#define V3020_IS_COMMAND(val) ((val)>=0x0E)
31
32#define V3020_CMD_RAM2CLOCK 0x0E
33#define V3020_CMD_CLOCK2RAM 0x0F
34
35#endif /* __LINUX_V3020_H */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index ab61cd1199..5371e4e745 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -34,8 +34,8 @@ struct rtc_time {
34 * alarm API. 34 * alarm API.
35 */ 35 */
36struct rtc_wkalrm { 36struct rtc_wkalrm {
37 unsigned char enabled; /* 0 = alarm disable, 1 = alarm disabled */ 37 unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */
38 unsigned char pending; /* 0 = alarm pending, 1 = alarm not pending */ 38 unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */
39 struct rtc_time time; /* time the alarm is set to */ 39 struct rtc_time time; /* time the alarm is set to */
40}; 40};
41 41
@@ -102,6 +102,7 @@ struct rtc_pll_info {
102#include <linux/interrupt.h> 102#include <linux/interrupt.h>
103 103
104extern int rtc_month_days(unsigned int month, unsigned int year); 104extern int rtc_month_days(unsigned int month, unsigned int year);
105extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
105extern int rtc_valid_tm(struct rtc_time *tm); 106extern int rtc_valid_tm(struct rtc_time *tm);
106extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); 107extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
107extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); 108extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
@@ -155,6 +156,17 @@ struct rtc_device
155 struct rtc_task *irq_task; 156 struct rtc_task *irq_task;
156 spinlock_t irq_task_lock; 157 spinlock_t irq_task_lock;
157 int irq_freq; 158 int irq_freq;
159 int max_user_freq;
160#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
161 struct work_struct uie_task;
162 struct timer_list uie_timer;
163 /* Those fields are protected by rtc->irq_lock */
164 unsigned int oldsecs;
165 unsigned int irq_active:1;
166 unsigned int stop_uie_polling:1;
167 unsigned int uie_task_active:1;
168 unsigned int uie_timer_active:1;
169#endif
158}; 170};
159#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev) 171#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev)
160 172
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
new file mode 100644
index 0000000000..5d41dee82f
--- /dev/null
+++ b/include/linux/rtmutex.h
@@ -0,0 +1,107 @@
1/*
2 * RT Mutexes: blocking mutual exclusion locks with PI support
3 *
4 * started by Ingo Molnar and Thomas Gleixner:
5 *
6 * Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>
8 *
9 * This file contains the public data structure and API definitions.
10 */
11
12#ifndef __LINUX_RT_MUTEX_H
13#define __LINUX_RT_MUTEX_H
14
15#include <linux/linkage.h>
16#include <linux/plist.h>
17#include <linux/spinlock_types.h>
18
19/*
20 * The rt_mutex structure
21 *
22 * @wait_lock: spinlock to protect the structure
23 * @wait_list: pilist head to enqueue waiters in priority order
24 * @owner: the mutex owner
25 */
26struct rt_mutex {
27 spinlock_t wait_lock;
28 struct plist_head wait_list;
29 struct task_struct *owner;
30#ifdef CONFIG_DEBUG_RT_MUTEXES
31 int save_state;
32 const char *name, *file;
33 int line;
34 void *magic;
35#endif
36};
37
38struct rt_mutex_waiter;
39struct hrtimer_sleeper;
40
41#ifdef CONFIG_DEBUG_RT_MUTEXES
42 extern int rt_mutex_debug_check_no_locks_freed(const void *from,
43 unsigned long len);
44 extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
45#else
46 static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
47 unsigned long len)
48 {
49 return 0;
50 }
51# define rt_mutex_debug_check_no_locks_held(task) do { } while (0)
52#endif
53
54#ifdef CONFIG_DEBUG_RT_MUTEXES
55# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
56 , .name = #mutexname, .file = __FILE__, .line = __LINE__
57# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __FUNCTION__)
58 extern void rt_mutex_debug_task_free(struct task_struct *tsk);
59#else
60# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
61# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL)
62# define rt_mutex_debug_task_free(t) do { } while (0)
63#endif
64
65#define __RT_MUTEX_INITIALIZER(mutexname) \
66 { .wait_lock = SPIN_LOCK_UNLOCKED \
67 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \
68 , .owner = NULL \
69 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
70
71#define DEFINE_RT_MUTEX(mutexname) \
72 struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
73
74/***
75 * rt_mutex_is_locked - is the mutex locked
76 * @lock: the mutex to be queried
77 *
78 * Returns 1 if the mutex is locked, 0 if unlocked.
79 */
80static inline int rt_mutex_is_locked(struct rt_mutex *lock)
81{
82 return lock->owner != NULL;
83}
84
85extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
86extern void rt_mutex_destroy(struct rt_mutex *lock);
87
88extern void rt_mutex_lock(struct rt_mutex *lock);
89extern int rt_mutex_lock_interruptible(struct rt_mutex *lock,
90 int detect_deadlock);
91extern int rt_mutex_timed_lock(struct rt_mutex *lock,
92 struct hrtimer_sleeper *timeout,
93 int detect_deadlock);
94
95extern int rt_mutex_trylock(struct rt_mutex *lock);
96
97extern void rt_mutex_unlock(struct rt_mutex *lock);
98
99#ifdef CONFIG_RT_MUTEXES
100# define INIT_RT_MUTEXES(tsk) \
101 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \
102 INIT_RT_MUTEX_DEBUG(tsk)
103#else
104# define INIT_RT_MUTEXES(tsk)
105#endif
106
107#endif
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index facd9ee37b..3a18addaed 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -2,6 +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_link.h>
5 6
6/**** 7/****
7 * Routing/neighbour discovery messages. 8 * Routing/neighbour discovery messages.
@@ -238,10 +239,8 @@ enum rt_class_t
238 RT_TABLE_DEFAULT=253, 239 RT_TABLE_DEFAULT=253,
239 RT_TABLE_MAIN=254, 240 RT_TABLE_MAIN=254,
240 RT_TABLE_LOCAL=255, 241 RT_TABLE_LOCAL=255,
241 __RT_TABLE_MAX 242 RT_TABLE_MAX=0xFFFFFFFF
242}; 243};
243#define RT_TABLE_MAX (__RT_TABLE_MAX - 1)
244
245 244
246 245
247/* Routing message attributes */ 246/* Routing message attributes */
@@ -263,6 +262,7 @@ enum rtattr_type_t
263 RTA_CACHEINFO, 262 RTA_CACHEINFO,
264 RTA_SESSION, 263 RTA_SESSION,
265 RTA_MP_ALGO, 264 RTA_MP_ALGO,
265 RTA_TABLE,
266 __RTA_MAX 266 __RTA_MAX
267}; 267};
268 268
@@ -383,226 +383,6 @@ struct rta_session
383 } u; 383 } u;
384}; 384};
385 385
386
387/*********************************************************
388 * Interface address.
389 ****/
390
391struct ifaddrmsg
392{
393 unsigned char ifa_family;
394 unsigned char ifa_prefixlen; /* The prefix length */
395 unsigned char ifa_flags; /* Flags */
396 unsigned char ifa_scope; /* See above */
397 int ifa_index; /* Link index */
398};
399
400enum
401{
402 IFA_UNSPEC,
403 IFA_ADDRESS,
404 IFA_LOCAL,
405 IFA_LABEL,
406 IFA_BROADCAST,
407 IFA_ANYCAST,
408 IFA_CACHEINFO,
409 IFA_MULTICAST,
410 __IFA_MAX
411};
412
413#define IFA_MAX (__IFA_MAX - 1)
414
415/* ifa_flags */
416
417#define IFA_F_SECONDARY 0x01
418#define IFA_F_TEMPORARY IFA_F_SECONDARY
419
420#define IFA_F_DEPRECATED 0x20
421#define IFA_F_TENTATIVE 0x40
422#define IFA_F_PERMANENT 0x80
423
424struct ifa_cacheinfo
425{
426 __u32 ifa_prefered;
427 __u32 ifa_valid;
428 __u32 cstamp; /* created timestamp, hundredths of seconds */
429 __u32 tstamp; /* updated timestamp, hundredths of seconds */
430};
431
432
433#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
434#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
435
436/*
437 Important comment:
438 IFA_ADDRESS is prefix address, rather than local interface address.
439 It makes no difference for normally configured broadcast interfaces,
440 but for point-to-point IFA_ADDRESS is DESTINATION address,
441 local address is supplied in IFA_LOCAL attribute.
442 */
443
444/**************************************************************
445 * Neighbour discovery.
446 ****/
447
448struct ndmsg
449{
450 unsigned char ndm_family;
451 unsigned char ndm_pad1;
452 unsigned short ndm_pad2;
453 int ndm_ifindex; /* Link index */
454 __u16 ndm_state;
455 __u8 ndm_flags;
456 __u8 ndm_type;
457};
458
459enum
460{
461 NDA_UNSPEC,
462 NDA_DST,
463 NDA_LLADDR,
464 NDA_CACHEINFO,
465 NDA_PROBES,
466 __NDA_MAX
467};
468
469#define NDA_MAX (__NDA_MAX - 1)
470
471#define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
472#define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
473
474/*
475 * Neighbor Cache Entry Flags
476 */
477
478#define NTF_PROXY 0x08 /* == ATF_PUBL */
479#define NTF_ROUTER 0x80
480
481/*
482 * Neighbor Cache Entry States.
483 */
484
485#define NUD_INCOMPLETE 0x01
486#define NUD_REACHABLE 0x02
487#define NUD_STALE 0x04
488#define NUD_DELAY 0x08
489#define NUD_PROBE 0x10
490#define NUD_FAILED 0x20
491
492/* Dummy states */
493#define NUD_NOARP 0x40
494#define NUD_PERMANENT 0x80
495#define NUD_NONE 0x00
496
497
498struct nda_cacheinfo
499{
500 __u32 ndm_confirmed;
501 __u32 ndm_used;
502 __u32 ndm_updated;
503 __u32 ndm_refcnt;
504};
505
506
507/*****************************************************************
508 * Neighbour tables specific messages.
509 *
510 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
511 * NLM_F_DUMP flag set. Every neighbour table configuration is
512 * spread over multiple messages to avoid running into message
513 * size limits on systems with many interfaces. The first message
514 * in the sequence transports all not device specific data such as
515 * statistics, configuration, and the default parameter set.
516 * This message is followed by 0..n messages carrying device
517 * specific parameter sets.
518 * Although the ordering should be sufficient, NDTA_NAME can be
519 * used to identify sequences. The initial message can be identified
520 * by checking for NDTA_CONFIG. The device specific messages do
521 * not contain this TLV but have NDTPA_IFINDEX set to the
522 * corresponding interface index.
523 *
524 * To change neighbour table attributes, send RTM_SETNEIGHTBL
525 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
526 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
527 * otherwise. Device specific parameter sets can be changed by
528 * setting NDTPA_IFINDEX to the interface index of the corresponding
529 * device.
530 ****/
531
532struct ndt_stats
533{
534 __u64 ndts_allocs;
535 __u64 ndts_destroys;
536 __u64 ndts_hash_grows;
537 __u64 ndts_res_failed;
538 __u64 ndts_lookups;
539 __u64 ndts_hits;
540 __u64 ndts_rcv_probes_mcast;
541 __u64 ndts_rcv_probes_ucast;
542 __u64 ndts_periodic_gc_runs;
543 __u64 ndts_forced_gc_runs;
544};
545
546enum {
547 NDTPA_UNSPEC,
548 NDTPA_IFINDEX, /* u32, unchangeable */
549 NDTPA_REFCNT, /* u32, read-only */
550 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
551 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
552 NDTPA_RETRANS_TIME, /* u64, msecs */
553 NDTPA_GC_STALETIME, /* u64, msecs */
554 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
555 NDTPA_QUEUE_LEN, /* u32 */
556 NDTPA_APP_PROBES, /* u32 */
557 NDTPA_UCAST_PROBES, /* u32 */
558 NDTPA_MCAST_PROBES, /* u32 */
559 NDTPA_ANYCAST_DELAY, /* u64, msecs */
560 NDTPA_PROXY_DELAY, /* u64, msecs */
561 NDTPA_PROXY_QLEN, /* u32 */
562 NDTPA_LOCKTIME, /* u64, msecs */
563 __NDTPA_MAX
564};
565#define NDTPA_MAX (__NDTPA_MAX - 1)
566
567struct ndtmsg
568{
569 __u8 ndtm_family;
570 __u8 ndtm_pad1;
571 __u16 ndtm_pad2;
572};
573
574struct ndt_config
575{
576 __u16 ndtc_key_len;
577 __u16 ndtc_entry_size;
578 __u32 ndtc_entries;
579 __u32 ndtc_last_flush; /* delta to now in msecs */
580 __u32 ndtc_last_rand; /* delta to now in msecs */
581 __u32 ndtc_hash_rnd;
582 __u32 ndtc_hash_mask;
583 __u32 ndtc_hash_chain_gc;
584 __u32 ndtc_proxy_qlen;
585};
586
587enum {
588 NDTA_UNSPEC,
589 NDTA_NAME, /* char *, unchangeable */
590 NDTA_THRESH1, /* u32 */
591 NDTA_THRESH2, /* u32 */
592 NDTA_THRESH3, /* u32 */
593 NDTA_CONFIG, /* struct ndt_config, read-only */
594 NDTA_PARMS, /* nested TLV NDTPA_* */
595 NDTA_STATS, /* struct ndt_stats, read-only */
596 NDTA_GC_INTERVAL, /* u64, msecs */
597 __NDTA_MAX
598};
599#define NDTA_MAX (__NDTA_MAX - 1)
600
601#define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \
602 NLMSG_ALIGN(sizeof(struct ndtmsg))))
603#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
604
605
606/**** 386/****
607 * General form of address family dependent message. 387 * General form of address family dependent message.
608 ****/ 388 ****/
@@ -663,138 +443,6 @@ struct prefix_cacheinfo
663 __u32 valid_time; 443 __u32 valid_time;
664}; 444};
665 445
666/* The struct should be in sync with struct net_device_stats */
667struct rtnl_link_stats
668{
669 __u32 rx_packets; /* total packets received */
670 __u32 tx_packets; /* total packets transmitted */
671 __u32 rx_bytes; /* total bytes received */
672 __u32 tx_bytes; /* total bytes transmitted */
673 __u32 rx_errors; /* bad packets received */
674 __u32 tx_errors; /* packet transmit problems */
675 __u32 rx_dropped; /* no space in linux buffers */
676 __u32 tx_dropped; /* no space available in linux */
677 __u32 multicast; /* multicast packets received */
678 __u32 collisions;
679
680 /* detailed rx_errors: */
681 __u32 rx_length_errors;
682 __u32 rx_over_errors; /* receiver ring buff overflow */
683 __u32 rx_crc_errors; /* recved pkt with crc error */
684 __u32 rx_frame_errors; /* recv'd frame alignment error */
685 __u32 rx_fifo_errors; /* recv'r fifo overrun */
686 __u32 rx_missed_errors; /* receiver missed packet */
687
688 /* detailed tx_errors */
689 __u32 tx_aborted_errors;
690 __u32 tx_carrier_errors;
691 __u32 tx_fifo_errors;
692 __u32 tx_heartbeat_errors;
693 __u32 tx_window_errors;
694
695 /* for cslip etc */
696 __u32 rx_compressed;
697 __u32 tx_compressed;
698};
699
700/* The struct should be in sync with struct ifmap */
701struct rtnl_link_ifmap
702{
703 __u64 mem_start;
704 __u64 mem_end;
705 __u64 base_addr;
706 __u16 irq;
707 __u8 dma;
708 __u8 port;
709};
710
711enum
712{
713 IFLA_UNSPEC,
714 IFLA_ADDRESS,
715 IFLA_BROADCAST,
716 IFLA_IFNAME,
717 IFLA_MTU,
718 IFLA_LINK,
719 IFLA_QDISC,
720 IFLA_STATS,
721 IFLA_COST,
722#define IFLA_COST IFLA_COST
723 IFLA_PRIORITY,
724#define IFLA_PRIORITY IFLA_PRIORITY
725 IFLA_MASTER,
726#define IFLA_MASTER IFLA_MASTER
727 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
728#define IFLA_WIRELESS IFLA_WIRELESS
729 IFLA_PROTINFO, /* Protocol specific information for a link */
730#define IFLA_PROTINFO IFLA_PROTINFO
731 IFLA_TXQLEN,
732#define IFLA_TXQLEN IFLA_TXQLEN
733 IFLA_MAP,
734#define IFLA_MAP IFLA_MAP
735 IFLA_WEIGHT,
736#define IFLA_WEIGHT IFLA_WEIGHT
737 IFLA_OPERSTATE,
738 IFLA_LINKMODE,
739 __IFLA_MAX
740};
741
742
743#define IFLA_MAX (__IFLA_MAX - 1)
744
745#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
746#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
747
748/* ifi_flags.
749
750 IFF_* flags.
751
752 The only change is:
753 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
754 more not changeable by user. They describe link media
755 characteristics and set by device driver.
756
757 Comments:
758 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
759 - If neither of these three flags are set;
760 the interface is NBMA.
761
762 - IFF_MULTICAST does not mean anything special:
763 multicasts can be used on all not-NBMA links.
764 IFF_MULTICAST means that this media uses special encapsulation
765 for multicast frames. Apparently, all IFF_POINTOPOINT and
766 IFF_BROADCAST devices are able to use multicasts too.
767 */
768
769/* IFLA_LINK.
770 For usual devices it is equal ifi_index.
771 If it is a "virtual interface" (f.e. tunnel), ifi_link
772 can point to real physical interface (f.e. for bandwidth calculations),
773 or maybe 0, what means, that real media is unknown (usual
774 for IPIP tunnels, when route to endpoint is allowed to change)
775 */
776
777/* Subtype attributes for IFLA_PROTINFO */
778enum
779{
780 IFLA_INET6_UNSPEC,
781 IFLA_INET6_FLAGS, /* link flags */
782 IFLA_INET6_CONF, /* sysctl parameters */
783 IFLA_INET6_STATS, /* statistics */
784 IFLA_INET6_MCAST, /* MC things. What of them? */
785 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
786 __IFLA_INET6_MAX
787};
788
789#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
790
791struct ifla_cacheinfo
792{
793 __u32 max_reasm_len;
794 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
795 __u32 reachable_time;
796 __u32 retrans_time;
797};
798 446
799/***************************************************************** 447/*****************************************************************
800 * Traffic control messages. 448 * Traffic control messages.
@@ -885,10 +533,13 @@ enum rtnetlink_groups {
885 RTNLGRP_NOP2, 533 RTNLGRP_NOP2,
886 RTNLGRP_DECnet_ROUTE, 534 RTNLGRP_DECnet_ROUTE,
887#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE 535#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
888 RTNLGRP_NOP3, 536 RTNLGRP_DECnet_RULE,
537#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE
889 RTNLGRP_NOP4, 538 RTNLGRP_NOP4,
890 RTNLGRP_IPV6_PREFIX, 539 RTNLGRP_IPV6_PREFIX,
891#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX 540#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
541 RTNLGRP_IPV6_RULE,
542#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
892 __RTNLGRP_MAX 543 __RTNLGRP_MAX
893}; 544};
894#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 545#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
@@ -923,8 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
923#define rtattr_parse_nested(tb, max, rta) \ 574#define rtattr_parse_nested(tb, max, rta) \
924 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) 575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
925 576
926extern struct sock *rtnl;
927
928struct rtnetlink_link 577struct rtnetlink_link
929{ 578{
930 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr); 579 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
@@ -933,6 +582,10 @@ struct rtnetlink_link
933 582
934extern struct rtnetlink_link * rtnetlink_links[NPROTO]; 583extern struct rtnetlink_link * rtnetlink_links[NPROTO];
935extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 584extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
585extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
586extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
587 struct nlmsghdr *nlh, gfp_t flags);
588extern void rtnl_set_sk_err(u32 group, int error);
936extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 589extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
937 590
938extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); 591extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
@@ -1065,6 +718,13 @@ extern void __rtnl_unlock(void);
1065 } \ 718 } \
1066} while(0) 719} while(0)
1067 720
721static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
722{
723 return RTA_GET_U32(rta[RTA_TABLE-1]);
724rtattr_failure:
725 return table;
726}
727
1068#endif /* __KERNEL__ */ 728#endif /* __KERNEL__ */
1069 729
1070 730
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index f30f805080..ae1fcadd59 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -32,30 +32,37 @@ struct rw_semaphore {
32 __s32 activity; 32 __s32 activity;
33 spinlock_t wait_lock; 33 spinlock_t wait_lock;
34 struct list_head wait_list; 34 struct list_head wait_list;
35#if RWSEM_DEBUG 35#ifdef CONFIG_DEBUG_LOCK_ALLOC
36 int debug; 36 struct lockdep_map dep_map;
37#endif 37#endif
38}; 38};
39 39
40/* 40#ifdef CONFIG_DEBUG_LOCK_ALLOC
41 * initialisation 41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42 */
43#if RWSEM_DEBUG
44#define __RWSEM_DEBUG_INIT , 0
45#else 42#else
46#define __RWSEM_DEBUG_INIT /* */ 43# define __RWSEM_DEP_MAP_INIT(lockname)
47#endif 44#endif
48 45
49#define __RWSEM_INITIALIZER(name) \ 46#define __RWSEM_INITIALIZER(name) \
50{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEBUG_INIT } 47{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
51 48
52#define DECLARE_RWSEM(name) \ 49#define DECLARE_RWSEM(name) \
53 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 50 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
54 51
55extern void FASTCALL(init_rwsem(struct rw_semaphore *sem)); 52extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
53 struct lock_class_key *key);
54
55#define init_rwsem(sem) \
56do { \
57 static struct lock_class_key __key; \
58 \
59 __init_rwsem((sem), #sem, &__key); \
60} while (0)
61
56extern void FASTCALL(__down_read(struct rw_semaphore *sem)); 62extern void FASTCALL(__down_read(struct rw_semaphore *sem));
57extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem)); 63extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem));
58extern void FASTCALL(__down_write(struct rw_semaphore *sem)); 64extern void FASTCALL(__down_write(struct rw_semaphore *sem));
65extern void FASTCALL(__down_write_nested(struct rw_semaphore *sem, int subclass));
59extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem)); 66extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem));
60extern void FASTCALL(__up_read(struct rw_semaphore *sem)); 67extern void FASTCALL(__up_read(struct rw_semaphore *sem));
61extern void FASTCALL(__up_write(struct rw_semaphore *sem)); 68extern void FASTCALL(__up_write(struct rw_semaphore *sem));
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index f99fe90732..7b524b4109 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -9,8 +9,6 @@
9 9
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11 11
12#define RWSEM_DEBUG 0
13
14#ifdef __KERNEL__ 12#ifdef __KERNEL__
15 13
16#include <linux/types.h> 14#include <linux/types.h>
@@ -26,89 +24,71 @@ struct rw_semaphore;
26#include <asm/rwsem.h> /* use an arch-specific implementation */ 24#include <asm/rwsem.h> /* use an arch-specific implementation */
27#endif 25#endif
28 26
29#ifndef rwsemtrace
30#if RWSEM_DEBUG
31extern void FASTCALL(rwsemtrace(struct rw_semaphore *sem, const char *str));
32#else
33#define rwsemtrace(SEM,FMT)
34#endif
35#endif
36
37/* 27/*
38 * lock for reading 28 * lock for reading
39 */ 29 */
40static inline void down_read(struct rw_semaphore *sem) 30extern void down_read(struct rw_semaphore *sem);
41{
42 might_sleep();
43 rwsemtrace(sem,"Entering down_read");
44 __down_read(sem);
45 rwsemtrace(sem,"Leaving down_read");
46}
47 31
48/* 32/*
49 * trylock for reading -- returns 1 if successful, 0 if contention 33 * trylock for reading -- returns 1 if successful, 0 if contention
50 */ 34 */
51static inline int down_read_trylock(struct rw_semaphore *sem) 35extern int down_read_trylock(struct rw_semaphore *sem);
52{
53 int ret;
54 rwsemtrace(sem,"Entering down_read_trylock");
55 ret = __down_read_trylock(sem);
56 rwsemtrace(sem,"Leaving down_read_trylock");
57 return ret;
58}
59 36
60/* 37/*
61 * lock for writing 38 * lock for writing
62 */ 39 */
63static inline void down_write(struct rw_semaphore *sem) 40extern void down_write(struct rw_semaphore *sem);
64{
65 might_sleep();
66 rwsemtrace(sem,"Entering down_write");
67 __down_write(sem);
68 rwsemtrace(sem,"Leaving down_write");
69}
70 41
71/* 42/*
72 * trylock for writing -- returns 1 if successful, 0 if contention 43 * trylock for writing -- returns 1 if successful, 0 if contention
73 */ 44 */
74static inline int down_write_trylock(struct rw_semaphore *sem) 45extern int down_write_trylock(struct rw_semaphore *sem);
75{
76 int ret;
77 rwsemtrace(sem,"Entering down_write_trylock");
78 ret = __down_write_trylock(sem);
79 rwsemtrace(sem,"Leaving down_write_trylock");
80 return ret;
81}
82 46
83/* 47/*
84 * release a read lock 48 * release a read lock
85 */ 49 */
86static inline void up_read(struct rw_semaphore *sem) 50extern void up_read(struct rw_semaphore *sem);
87{
88 rwsemtrace(sem,"Entering up_read");
89 __up_read(sem);
90 rwsemtrace(sem,"Leaving up_read");
91}
92 51
93/* 52/*
94 * release a write lock 53 * release a write lock
95 */ 54 */
96static inline void up_write(struct rw_semaphore *sem) 55extern void up_write(struct rw_semaphore *sem);
97{
98 rwsemtrace(sem,"Entering up_write");
99 __up_write(sem);
100 rwsemtrace(sem,"Leaving up_write");
101}
102 56
103/* 57/*
104 * downgrade write lock to read lock 58 * downgrade write lock to read lock
105 */ 59 */
106static inline void downgrade_write(struct rw_semaphore *sem) 60extern void downgrade_write(struct rw_semaphore *sem);
107{ 61
108 rwsemtrace(sem,"Entering downgrade_write"); 62#ifdef CONFIG_DEBUG_LOCK_ALLOC
109 __downgrade_write(sem); 63/*
110 rwsemtrace(sem,"Leaving downgrade_write"); 64 * nested locking. NOTE: rwsems are not allowed to recurse
111} 65 * (which occurs if the same task tries to acquire the same
66 * lock instance multiple times), but multiple locks of the
67 * same lock class might be taken, if the order of the locks
68 * is always the same. This ordering rule can be expressed
69 * to lockdep via the _nested() APIs, but enumerating the
70 * subclasses that are used. (If the nesting relationship is
71 * static then another method for expressing nested locking is
72 * the explicit definition of lock class keys and the use of
73 * lockdep_set_class() at lock initialization time.
74 * See Documentation/lockdep-design.txt for more details.)
75 */
76extern void down_read_nested(struct rw_semaphore *sem, int subclass);
77extern void down_write_nested(struct rw_semaphore *sem, int subclass);
78/*
79 * Take/release a lock when not the owner will release it.
80 *
81 * [ This API should be avoided as much as possible - the
82 * proper abstraction for this case is completions. ]
83 */
84extern void down_read_non_owner(struct rw_semaphore *sem);
85extern void up_read_non_owner(struct rw_semaphore *sem);
86#else
87# define down_read_nested(sem, subclass) down_read(sem)
88# define down_write_nested(sem, subclass) down_write(sem)
89# define down_read_non_owner(sem) down_read(sem)
90# define up_read_non_owner(sem) up_read(sem)
91#endif
112 92
113#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
114#endif /* _LINUX_RWSEM_H */ 94#endif /* _LINUX_RWSEM_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 66ff545552..4efbd9c445 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -5,7 +5,7 @@
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/string.h> 6#include <linux/string.h>
7 7
8static inline void sg_set_buf(struct scatterlist *sg, void *buf, 8static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
9 unsigned int buflen) 9 unsigned int buflen)
10{ 10{
11 sg->page = virt_to_page(buf); 11 sg->page = virt_to_page(buf);
@@ -13,7 +13,7 @@ static inline void sg_set_buf(struct scatterlist *sg, void *buf,
13 sg->length = buflen; 13 sg->length = buflen;
14} 14}
15 15
16static inline void sg_init_one(struct scatterlist *sg, void *buf, 16static inline void sg_init_one(struct scatterlist *sg, const void *buf,
17 unsigned int buflen) 17 unsigned int buflen)
18{ 18{
19 memset(sg, 0, sizeof(*sg)); 19 memset(sg, 0, sizeof(*sg));
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 38b4791e6a..a06fc89cf6 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -73,6 +73,7 @@ struct sched_param {
73#include <linux/seccomp.h> 73#include <linux/seccomp.h>
74#include <linux/rcupdate.h> 74#include <linux/rcupdate.h>
75#include <linux/futex.h> 75#include <linux/futex.h>
76#include <linux/rtmutex.h>
76 77
77#include <linux/time.h> 78#include <linux/time.h>
78#include <linux/param.h> 79#include <linux/param.h>
@@ -83,6 +84,7 @@ struct sched_param {
83#include <asm/processor.h> 84#include <asm/processor.h>
84 85
85struct exec_domain; 86struct exec_domain;
87struct futex_pi_state;
86 88
87/* 89/*
88 * List of flags we want to share for kernel threads, 90 * List of flags we want to share for kernel threads,
@@ -123,6 +125,7 @@ extern unsigned long nr_running(void);
123extern unsigned long nr_uninterruptible(void); 125extern unsigned long nr_uninterruptible(void);
124extern unsigned long nr_active(void); 126extern unsigned long nr_active(void);
125extern unsigned long nr_iowait(void); 127extern unsigned long nr_iowait(void);
128extern unsigned long weighted_cpuload(const int cpu);
126 129
127 130
128/* 131/*
@@ -145,6 +148,7 @@ extern unsigned long nr_iowait(void);
145#define EXIT_DEAD 32 148#define EXIT_DEAD 32
146/* in tsk->state again */ 149/* in tsk->state again */
147#define TASK_NONINTERACTIVE 64 150#define TASK_NONINTERACTIVE 64
151#define TASK_DEAD 128
148 152
149#define __set_task_state(tsk, state_value) \ 153#define __set_task_state(tsk, state_value) \
150 do { (tsk)->state = (state_value); } while (0) 154 do { (tsk)->state = (state_value); } while (0)
@@ -181,11 +185,11 @@ extern unsigned long nr_iowait(void);
181extern rwlock_t tasklist_lock; 185extern rwlock_t tasklist_lock;
182extern spinlock_t mmlist_lock; 186extern spinlock_t mmlist_lock;
183 187
184typedef struct task_struct task_t; 188struct task_struct;
185 189
186extern void sched_init(void); 190extern void sched_init(void);
187extern void sched_init_smp(void); 191extern void sched_init_smp(void);
188extern void init_idle(task_t *idle, int cpu); 192extern void init_idle(struct task_struct *idle, int cpu);
189 193
190extern cpumask_t nohz_cpu_mask; 194extern cpumask_t nohz_cpu_mask;
191 195
@@ -358,6 +362,14 @@ struct sighand_struct {
358 spinlock_t siglock; 362 spinlock_t siglock;
359}; 363};
360 364
365struct pacct_struct {
366 int ac_flag;
367 long ac_exitcode;
368 unsigned long ac_mem;
369 cputime_t ac_utime, ac_stime;
370 unsigned long ac_minflt, ac_majflt;
371};
372
361/* 373/*
362 * NOTE! "signal_struct" does not have it's own 374 * NOTE! "signal_struct" does not have it's own
363 * locking, because a shared signal_struct always 375 * locking, because a shared signal_struct always
@@ -372,7 +384,7 @@ struct signal_struct {
372 wait_queue_head_t wait_chldexit; /* for wait4() */ 384 wait_queue_head_t wait_chldexit; /* for wait4() */
373 385
374 /* current thread group signal load-balancing target: */ 386 /* current thread group signal load-balancing target: */
375 task_t *curr_target; 387 struct task_struct *curr_target;
376 388
377 /* shared signal handling: */ 389 /* shared signal handling: */
378 struct sigpending shared_pending; 390 struct sigpending shared_pending;
@@ -449,6 +461,13 @@ struct signal_struct {
449 struct key *session_keyring; /* keyring inherited over fork */ 461 struct key *session_keyring; /* keyring inherited over fork */
450 struct key *process_keyring; /* keyring private to this process */ 462 struct key *process_keyring; /* keyring private to this process */
451#endif 463#endif
464#ifdef CONFIG_BSD_PROCESS_ACCT
465 struct pacct_struct pacct; /* per-process accounting information */
466#endif
467#ifdef CONFIG_TASKSTATS
468 spinlock_t stats_lock;
469 struct taskstats *stats;
470#endif
452}; 471};
453 472
454/* Context switch must be unlocked if interrupts are to be enabled */ 473/* Context switch must be unlocked if interrupts are to be enabled */
@@ -483,8 +502,11 @@ struct signal_struct {
483 502
484#define MAX_PRIO (MAX_RT_PRIO + 40) 503#define MAX_PRIO (MAX_RT_PRIO + 40)
485 504
486#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) 505#define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO)
506#define rt_task(p) rt_prio((p)->prio)
487#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) 507#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
508#define is_rt_policy(p) ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
509#define has_rt_policy(p) unlikely(is_rt_policy((p)->policy))
488 510
489/* 511/*
490 * Some day this will be a full-fledged user tracking system.. 512 * Some day this will be a full-fledged user tracking system..
@@ -517,11 +539,10 @@ extern struct user_struct *find_user(uid_t);
517extern struct user_struct root_user; 539extern struct user_struct root_user;
518#define INIT_USER (&root_user) 540#define INIT_USER (&root_user)
519 541
520typedef struct prio_array prio_array_t;
521struct backing_dev_info; 542struct backing_dev_info;
522struct reclaim_state; 543struct reclaim_state;
523 544
524#ifdef CONFIG_SCHEDSTATS 545#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
525struct sched_info { 546struct sched_info {
526 /* cumulative counters */ 547 /* cumulative counters */
527 unsigned long cpu_time, /* time spent on the cpu */ 548 unsigned long cpu_time, /* time spent on the cpu */
@@ -532,9 +553,53 @@ struct sched_info {
532 unsigned long last_arrival, /* when we last ran on a cpu */ 553 unsigned long last_arrival, /* when we last ran on a cpu */
533 last_queued; /* when we were last queued to run */ 554 last_queued; /* when we were last queued to run */
534}; 555};
556#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
535 557
558#ifdef CONFIG_SCHEDSTATS
536extern struct file_operations proc_schedstat_operations; 559extern struct file_operations proc_schedstat_operations;
560#endif /* CONFIG_SCHEDSTATS */
561
562#ifdef CONFIG_TASK_DELAY_ACCT
563struct task_delay_info {
564 spinlock_t lock;
565 unsigned int flags; /* Private per-task flags */
566
567 /* For each stat XXX, add following, aligned appropriately
568 *
569 * struct timespec XXX_start, XXX_end;
570 * u64 XXX_delay;
571 * u32 XXX_count;
572 *
573 * Atomicity of updates to XXX_delay, XXX_count protected by
574 * single lock above (split into XXX_lock if contention is an issue).
575 */
576
577 /*
578 * XXX_count is incremented on every XXX operation, the delay
579 * associated with the operation is added to XXX_delay.
580 * XXX_delay contains the accumulated delay time in nanoseconds.
581 */
582 struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */
583 u64 blkio_delay; /* wait for sync block io completion */
584 u64 swapin_delay; /* wait for swapin block io completion */
585 u32 blkio_count; /* total count of the number of sync block */
586 /* io operations performed */
587 u32 swapin_count; /* total count of the number of swapin block */
588 /* io operations performed */
589};
590#endif /* CONFIG_TASK_DELAY_ACCT */
591
592static inline int sched_info_on(void)
593{
594#ifdef CONFIG_SCHEDSTATS
595 return 1;
596#elif defined(CONFIG_TASK_DELAY_ACCT)
597 extern int delayacct_on;
598 return delayacct_on;
599#else
600 return 0;
537#endif 601#endif
602}
538 603
539enum idle_type 604enum idle_type
540{ 605{
@@ -547,9 +612,9 @@ enum idle_type
547/* 612/*
548 * sched-domains (multiprocessor balancing) declarations: 613 * sched-domains (multiprocessor balancing) declarations:
549 */ 614 */
550#ifdef CONFIG_SMP
551#define SCHED_LOAD_SCALE 128UL /* increase resolution of load */ 615#define SCHED_LOAD_SCALE 128UL /* increase resolution of load */
552 616
617#ifdef CONFIG_SMP
553#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 618#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */
554#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ 619#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */
555#define SD_BALANCE_EXEC 4 /* Balance on exec */ 620#define SD_BALANCE_EXEC 4 /* Balance on exec */
@@ -558,6 +623,11 @@ enum idle_type
558#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ 623#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */
559#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ 624#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */
560#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 625#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
626#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */
627
628#define BALANCE_FOR_POWER ((sched_mc_power_savings || sched_smt_power_savings) \
629 ? SD_POWERSAVINGS_BALANCE : 0)
630
561 631
562struct sched_group { 632struct sched_group {
563 struct sched_group *next; /* Must be a circular list */ 633 struct sched_group *next; /* Must be a circular list */
@@ -627,7 +697,7 @@ struct sched_domain {
627#endif 697#endif
628}; 698};
629 699
630extern void partition_sched_domains(cpumask_t *partition1, 700extern int partition_sched_domains(cpumask_t *partition1,
631 cpumask_t *partition2); 701 cpumask_t *partition2);
632 702
633/* 703/*
@@ -677,7 +747,7 @@ extern int groups_search(struct group_info *group_info, gid_t grp);
677 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) 747 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
678 748
679#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK 749#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
680extern void prefetch_stack(struct task_struct*); 750extern void prefetch_stack(struct task_struct *t);
681#else 751#else
682static inline void prefetch_stack(struct task_struct *t) { } 752static inline void prefetch_stack(struct task_struct *t) { }
683#endif 753#endif
@@ -693,6 +763,8 @@ enum sleep_type {
693 SLEEP_INTERRUPTED, 763 SLEEP_INTERRUPTED,
694}; 764};
695 765
766struct prio_array;
767
696struct task_struct { 768struct task_struct {
697 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 769 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
698 struct thread_info *thread_info; 770 struct thread_info *thread_info;
@@ -702,16 +774,20 @@ struct task_struct {
702 774
703 int lock_depth; /* BKL lock depth */ 775 int lock_depth; /* BKL lock depth */
704 776
705#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 777#ifdef CONFIG_SMP
778#ifdef __ARCH_WANT_UNLOCKED_CTXSW
706 int oncpu; 779 int oncpu;
707#endif 780#endif
708 int prio, static_prio; 781#endif
782 int load_weight; /* for niceness load balancing purposes */
783 int prio, static_prio, normal_prio;
709 struct list_head run_list; 784 struct list_head run_list;
710 prio_array_t *array; 785 struct prio_array *array;
711 786
712 unsigned short ioprio; 787 unsigned short ioprio;
788#ifdef CONFIG_BLK_DEV_IO_TRACE
713 unsigned int btrace_seq; 789 unsigned int btrace_seq;
714 790#endif
715 unsigned long sleep_avg; 791 unsigned long sleep_avg;
716 unsigned long long timestamp, last_ran; 792 unsigned long long timestamp, last_ran;
717 unsigned long long sched_time; /* sched_clock time spent running */ 793 unsigned long long sched_time; /* sched_clock time spent running */
@@ -721,7 +797,7 @@ struct task_struct {
721 cpumask_t cpus_allowed; 797 cpumask_t cpus_allowed;
722 unsigned int time_slice, first_time_slice; 798 unsigned int time_slice, first_time_slice;
723 799
724#ifdef CONFIG_SCHEDSTATS 800#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
725 struct sched_info sched_info; 801 struct sched_info sched_info;
726#endif 802#endif
727 803
@@ -745,6 +821,11 @@ struct task_struct {
745 unsigned did_exec:1; 821 unsigned did_exec:1;
746 pid_t pid; 822 pid_t pid;
747 pid_t tgid; 823 pid_t tgid;
824
825#ifdef CONFIG_CC_STACKPROTECTOR
826 /* Canary value for the -fstack-protector gcc feature */
827 unsigned long stack_canary;
828#endif
748 /* 829 /*
749 * pointers to (original) parent process, youngest child, younger sibling, 830 * pointers to (original) parent process, youngest child, younger sibling,
750 * older sibling, respectively. (p->father can be replaced with 831 * older sibling, respectively. (p->father can be replaced with
@@ -791,6 +872,15 @@ struct task_struct {
791 struct key *thread_keyring; /* keyring private to this thread */ 872 struct key *thread_keyring; /* keyring private to this thread */
792 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 873 unsigned char jit_keyring; /* default keyring to attach requested keys to */
793#endif 874#endif
875 /*
876 * fpu_counter contains the number of consecutive context switches
877 * that the FPU is used. If this is over a threshold, the lazy fpu
878 * saving becomes unlazy to save the trap. This is an unsigned char
879 * so that after 256 times the counter wraps and the behavior turns
880 * lazy again; this to deal with bursty apps that only use FPU for
881 * a short time
882 */
883 unsigned char fpu_counter;
794 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 884 int oomkilladj; /* OOM kill score adjustment (bit shift). */
795 char comm[TASK_COMM_LEN]; /* executable name excluding path 885 char comm[TASK_COMM_LEN]; /* executable name excluding path
796 - access with [gs]et_task_comm (which lock 886 - access with [gs]et_task_comm (which lock
@@ -798,8 +888,10 @@ struct task_struct {
798 - initialized normally by flush_old_exec */ 888 - initialized normally by flush_old_exec */
799/* file system info */ 889/* file system info */
800 int link_count, total_link_count; 890 int link_count, total_link_count;
891#ifdef CONFIG_SYSVIPC
801/* ipc stuff */ 892/* ipc stuff */
802 struct sysv_sem sysvsem; 893 struct sysv_sem sysvsem;
894#endif
803/* CPU-specific state of this task */ 895/* CPU-specific state of this task */
804 struct thread_struct thread; 896 struct thread_struct thread;
805/* filesystem information */ 897/* filesystem information */
@@ -831,13 +923,43 @@ struct task_struct {
831 u32 self_exec_id; 923 u32 self_exec_id;
832/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 924/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
833 spinlock_t alloc_lock; 925 spinlock_t alloc_lock;
834/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 926
835 spinlock_t proc_lock; 927 /* Protection of the PI data structures: */
928 spinlock_t pi_lock;
929
930#ifdef CONFIG_RT_MUTEXES
931 /* PI waiters blocked on a rt_mutex held by this task */
932 struct plist_head pi_waiters;
933 /* Deadlock detection and priority inheritance handling */
934 struct rt_mutex_waiter *pi_blocked_on;
935#endif
836 936
837#ifdef CONFIG_DEBUG_MUTEXES 937#ifdef CONFIG_DEBUG_MUTEXES
838 /* mutex deadlock detection */ 938 /* mutex deadlock detection */
839 struct mutex_waiter *blocked_on; 939 struct mutex_waiter *blocked_on;
840#endif 940#endif
941#ifdef CONFIG_TRACE_IRQFLAGS
942 unsigned int irq_events;
943 int hardirqs_enabled;
944 unsigned long hardirq_enable_ip;
945 unsigned int hardirq_enable_event;
946 unsigned long hardirq_disable_ip;
947 unsigned int hardirq_disable_event;
948 int softirqs_enabled;
949 unsigned long softirq_disable_ip;
950 unsigned int softirq_disable_event;
951 unsigned long softirq_enable_ip;
952 unsigned int softirq_enable_event;
953 int hardirq_context;
954 int softirq_context;
955#endif
956#ifdef CONFIG_LOCKDEP
957# define MAX_LOCK_DEPTH 30UL
958 u64 curr_chain_key;
959 int lockdep_depth;
960 struct held_lock held_locks[MAX_LOCK_DEPTH];
961 unsigned int lockdep_recursion;
962#endif
841 963
842/* journalling filesystem info */ 964/* journalling filesystem info */
843 void *journal_info; 965 void *journal_info;
@@ -845,7 +967,6 @@ struct task_struct {
845/* VM state */ 967/* VM state */
846 struct reclaim_state *reclaim_state; 968 struct reclaim_state *reclaim_state;
847 969
848 struct dentry *proc_dentry;
849 struct backing_dev_info *backing_dev_info; 970 struct backing_dev_info *backing_dev_info;
850 971
851 struct io_context *io_context; 972 struct io_context *io_context;
@@ -880,6 +1001,8 @@ struct task_struct {
880#ifdef CONFIG_COMPAT 1001#ifdef CONFIG_COMPAT
881 struct compat_robust_list_head __user *compat_robust_list; 1002 struct compat_robust_list_head __user *compat_robust_list;
882#endif 1003#endif
1004 struct list_head pi_state_list;
1005 struct futex_pi_state *pi_state_cache;
883 1006
884 atomic_t fs_excl; /* holding fs exclusive resources */ 1007 atomic_t fs_excl; /* holding fs exclusive resources */
885 struct rcu_head rcu; 1008 struct rcu_head rcu;
@@ -888,6 +1011,9 @@ struct task_struct {
888 * cache last used pipe for splice 1011 * cache last used pipe for splice
889 */ 1012 */
890 struct pipe_inode_info *splice_pipe; 1013 struct pipe_inode_info *splice_pipe;
1014#ifdef CONFIG_TASK_DELAY_ACCT
1015 struct task_delay_info *delays;
1016#endif
891}; 1017};
892 1018
893static inline pid_t process_group(struct task_struct *tsk) 1019static inline pid_t process_group(struct task_struct *tsk)
@@ -908,6 +1034,16 @@ static inline int pid_alive(struct task_struct *p)
908 return p->pids[PIDTYPE_PID].pid != NULL; 1034 return p->pids[PIDTYPE_PID].pid != NULL;
909} 1035}
910 1036
1037/**
1038 * is_init - check if a task structure is the first user space
1039 * task the kernel created.
1040 * @p: Task structure to be checked.
1041 */
1042static inline int is_init(struct task_struct *tsk)
1043{
1044 return tsk->pid == 1;
1045}
1046
911extern void free_task(struct task_struct *tsk); 1047extern void free_task(struct task_struct *tsk);
912#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 1048#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
913 1049
@@ -926,7 +1062,6 @@ static inline void put_task_struct(struct task_struct *t)
926 /* Not implemented yet, only for 486*/ 1062 /* Not implemented yet, only for 486*/
927#define PF_STARTING 0x00000002 /* being created */ 1063#define PF_STARTING 0x00000002 /* being created */
928#define PF_EXITING 0x00000004 /* getting shut down */ 1064#define PF_EXITING 0x00000004 /* getting shut down */
929#define PF_DEAD 0x00000008 /* Dead */
930#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1065#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
931#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1066#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
932#define PF_DUMPCORE 0x00000200 /* dumped core */ 1067#define PF_DUMPCORE 0x00000200 /* dumped core */
@@ -947,6 +1082,7 @@ static inline void put_task_struct(struct task_struct *t)
947#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1082#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
948#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1083#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
949#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1084#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1085#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
950 1086
951/* 1087/*
952 * Only the _current_ task can read/write to tsk->flags, but other 1088 * Only the _current_ task can read/write to tsk->flags, but other
@@ -974,9 +1110,9 @@ static inline void put_task_struct(struct task_struct *t)
974#define used_math() tsk_used_math(current) 1110#define used_math() tsk_used_math(current)
975 1111
976#ifdef CONFIG_SMP 1112#ifdef CONFIG_SMP
977extern int set_cpus_allowed(task_t *p, cpumask_t new_mask); 1113extern int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask);
978#else 1114#else
979static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask) 1115static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
980{ 1116{
981 if (!cpu_isset(0, new_mask)) 1117 if (!cpu_isset(0, new_mask))
982 return -EINVAL; 1118 return -EINVAL;
@@ -985,7 +1121,8 @@ static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
985#endif 1121#endif
986 1122
987extern unsigned long long sched_clock(void); 1123extern unsigned long long sched_clock(void);
988extern unsigned long long current_sched_time(const task_t *current_task); 1124extern unsigned long long
1125current_sched_time(const struct task_struct *current_task);
989 1126
990/* sched_exec is called by processes performing an exec */ 1127/* sched_exec is called by processes performing an exec */
991#ifdef CONFIG_SMP 1128#ifdef CONFIG_SMP
@@ -1001,16 +1138,29 @@ static inline void idle_task_exit(void) {}
1001#endif 1138#endif
1002 1139
1003extern void sched_idle_next(void); 1140extern void sched_idle_next(void);
1004extern void set_user_nice(task_t *p, long nice); 1141
1005extern int task_prio(const task_t *p); 1142#ifdef CONFIG_RT_MUTEXES
1006extern int task_nice(const task_t *p); 1143extern int rt_mutex_getprio(struct task_struct *p);
1007extern int can_nice(const task_t *p, const int nice); 1144extern void rt_mutex_setprio(struct task_struct *p, int prio);
1008extern int task_curr(const task_t *p); 1145extern void rt_mutex_adjust_pi(struct task_struct *p);
1146#else
1147static inline int rt_mutex_getprio(struct task_struct *p)
1148{
1149 return p->normal_prio;
1150}
1151# define rt_mutex_adjust_pi(p) do { } while (0)
1152#endif
1153
1154extern void set_user_nice(struct task_struct *p, long nice);
1155extern int task_prio(const struct task_struct *p);
1156extern int task_nice(const struct task_struct *p);
1157extern int can_nice(const struct task_struct *p, const int nice);
1158extern int task_curr(const struct task_struct *p);
1009extern int idle_cpu(int cpu); 1159extern int idle_cpu(int cpu);
1010extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 1160extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
1011extern task_t *idle_task(int cpu); 1161extern struct task_struct *idle_task(int cpu);
1012extern task_t *curr_task(int cpu); 1162extern struct task_struct *curr_task(int cpu);
1013extern void set_curr_task(int cpu, task_t *p); 1163extern void set_curr_task(int cpu, struct task_struct *p);
1014 1164
1015void yield(void); 1165void yield(void);
1016 1166
@@ -1056,7 +1206,7 @@ extern void switch_uid(struct user_struct *);
1056 1206
1057#include <asm/current.h> 1207#include <asm/current.h>
1058 1208
1059extern void do_timer(struct pt_regs *); 1209extern void do_timer(unsigned long ticks);
1060 1210
1061extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state)); 1211extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
1062extern int FASTCALL(wake_up_process(struct task_struct * tsk)); 1212extern int FASTCALL(wake_up_process(struct task_struct * tsk));
@@ -1067,8 +1217,8 @@ extern void FASTCALL(wake_up_new_task(struct task_struct * tsk,
1067#else 1217#else
1068 static inline void kick_process(struct task_struct *tsk) { } 1218 static inline void kick_process(struct task_struct *tsk) { }
1069#endif 1219#endif
1070extern void FASTCALL(sched_fork(task_t * p, int clone_flags)); 1220extern void FASTCALL(sched_fork(struct task_struct * p, int clone_flags));
1071extern void FASTCALL(sched_exit(task_t * p)); 1221extern void FASTCALL(sched_exit(struct task_struct * p));
1072 1222
1073extern int in_group_p(gid_t); 1223extern int in_group_p(gid_t);
1074extern int in_egroup_p(gid_t); 1224extern int in_egroup_p(gid_t);
@@ -1101,7 +1251,7 @@ extern int force_sig_info(int, struct siginfo *, struct task_struct *);
1101extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1251extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp);
1102extern int kill_pg_info(int, struct siginfo *, pid_t); 1252extern int kill_pg_info(int, struct siginfo *, pid_t);
1103extern int kill_proc_info(int, struct siginfo *, pid_t); 1253extern int kill_proc_info(int, struct siginfo *, pid_t);
1104extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t); 1254extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t, u32);
1105extern void do_notify_parent(struct task_struct *, int); 1255extern void do_notify_parent(struct task_struct *, int);
1106extern void force_sig(int, struct task_struct *); 1256extern void force_sig(int, struct task_struct *);
1107extern void force_sig_specific(int, struct task_struct *); 1257extern void force_sig_specific(int, struct task_struct *);
@@ -1173,17 +1323,17 @@ extern NORET_TYPE void do_group_exit(int);
1173extern void daemonize(const char *, ...); 1323extern void daemonize(const char *, ...);
1174extern int allow_signal(int); 1324extern int allow_signal(int);
1175extern int disallow_signal(int); 1325extern int disallow_signal(int);
1176extern task_t *child_reaper; 1326extern struct task_struct *child_reaper;
1177 1327
1178extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); 1328extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
1179extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 1329extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
1180task_t *fork_idle(int); 1330struct task_struct *fork_idle(int);
1181 1331
1182extern void set_task_comm(struct task_struct *tsk, char *from); 1332extern void set_task_comm(struct task_struct *tsk, char *from);
1183extern void get_task_comm(char *to, struct task_struct *tsk); 1333extern void get_task_comm(char *to, struct task_struct *tsk);
1184 1334
1185#ifdef CONFIG_SMP 1335#ifdef CONFIG_SMP
1186extern void wait_task_inactive(task_t * p); 1336extern void wait_task_inactive(struct task_struct * p);
1187#else 1337#else
1188#define wait_task_inactive(p) do { } while (0) 1338#define wait_task_inactive(p) do { } while (0)
1189#endif 1339#endif
@@ -1209,13 +1359,13 @@ extern void wait_task_inactive(task_t * p);
1209/* de_thread depends on thread_group_leader not being a pid based check */ 1359/* de_thread depends on thread_group_leader not being a pid based check */
1210#define thread_group_leader(p) (p == p->group_leader) 1360#define thread_group_leader(p) (p == p->group_leader)
1211 1361
1212static inline task_t *next_thread(const task_t *p) 1362static inline struct task_struct *next_thread(const struct task_struct *p)
1213{ 1363{
1214 return list_entry(rcu_dereference(p->thread_group.next), 1364 return list_entry(rcu_dereference(p->thread_group.next),
1215 task_t, thread_group); 1365 struct task_struct, thread_group);
1216} 1366}
1217 1367
1218static inline int thread_group_empty(task_t *p) 1368static inline int thread_group_empty(struct task_struct *p)
1219{ 1369{
1220 return list_empty(&p->thread_group); 1370 return list_empty(&p->thread_group);
1221} 1371}
@@ -1400,6 +1550,11 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
1400extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 1550extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
1401extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 1551extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
1402 1552
1553#include <linux/sysdev.h>
1554extern int sched_mc_power_savings, sched_smt_power_savings;
1555extern struct sysdev_attribute attr_sched_mc_power_savings, attr_sched_smt_power_savings;
1556extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
1557
1403extern void normalize_rt_tasks(void); 1558extern void normalize_rt_tasks(void);
1404 1559
1405#ifdef CONFIG_PM 1560#ifdef CONFIG_PM
@@ -1429,6 +1584,14 @@ static inline void freeze(struct task_struct *p)
1429} 1584}
1430 1585
1431/* 1586/*
1587 * Sometimes we may need to cancel the previous 'freeze' request
1588 */
1589static inline void do_not_freeze(struct task_struct *p)
1590{
1591 p->flags &= ~PF_FREEZE;
1592}
1593
1594/*
1432 * Wake up a frozen process 1595 * Wake up a frozen process
1433 */ 1596 */
1434static inline int thaw_process(struct task_struct *p) 1597static inline int thaw_process(struct task_struct *p)
diff --git a/include/linux/scx200.h b/include/linux/scx200.h
index a22f9e173a..693c0557e7 100644
--- a/include/linux/scx200.h
+++ b/include/linux/scx200.h
@@ -49,10 +49,3 @@ extern unsigned scx200_cb_base;
49#define SCx200_REV 0x3d /* Revision Register */ 49#define SCx200_REV 0x3d /* Revision Register */
50#define SCx200_CBA 0x3e /* Configuration Base Address Register */ 50#define SCx200_CBA 0x3e /* Configuration Base Address Register */
51#define SCx200_CBA_SCRATCH 0x64 /* Configuration Base Address Scratchpad */ 51#define SCx200_CBA_SCRATCH 0x64 /* Configuration Base Address Scratchpad */
52
53/*
54 Local variables:
55 compile-command: "make -C ../.. bzImage modules"
56 c-basic-offset: 8
57 End:
58*/
diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h
index 30cdd648ba..1a82d30c4b 100644
--- a/include/linux/scx200_gpio.h
+++ b/include/linux/scx200_gpio.h
@@ -1,9 +1,10 @@
1#include <linux/spinlock.h> 1#include <linux/spinlock.h>
2 2
3u32 scx200_gpio_configure(int index, u32 set, u32 clear); 3u32 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
@@ -17,7 +18,7 @@ extern long scx200_gpio_shadow[2];
17 18
18/* returns the value of the GPIO pin */ 19/* returns the value of the GPIO pin */
19 20
20static inline int scx200_gpio_get(int index) { 21static inline int scx200_gpio_get(unsigned index) {
21 __SCx200_GPIO_BANK; 22 __SCx200_GPIO_BANK;
22 __SCx200_GPIO_IOADDR + 0x04; 23 __SCx200_GPIO_IOADDR + 0x04;
23 __SCx200_GPIO_INDEX; 24 __SCx200_GPIO_INDEX;
@@ -29,7 +30,7 @@ static inline int scx200_gpio_get(int index) {
29 driven if the GPIO is configured as an output, it might not be the 30 driven if the GPIO is configured as an output, it might not be the
30 state of the GPIO right now if the GPIO is configured as an input) */ 31 state of the GPIO right now if the GPIO is configured as an input) */
31 32
32static inline int scx200_gpio_current(int index) { 33static inline int scx200_gpio_current(unsigned index) {
33 __SCx200_GPIO_BANK; 34 __SCx200_GPIO_BANK;
34 __SCx200_GPIO_INDEX; 35 __SCx200_GPIO_INDEX;
35 36
@@ -38,7 +39,7 @@ static inline int scx200_gpio_current(int index) {
38 39
39/* drive the GPIO signal high */ 40/* drive the GPIO signal high */
40 41
41static inline void scx200_gpio_set_high(int index) { 42static inline void scx200_gpio_set_high(unsigned index) {
42 __SCx200_GPIO_BANK; 43 __SCx200_GPIO_BANK;
43 __SCx200_GPIO_IOADDR; 44 __SCx200_GPIO_IOADDR;
44 __SCx200_GPIO_SHADOW; 45 __SCx200_GPIO_SHADOW;
@@ -49,7 +50,7 @@ static inline void scx200_gpio_set_high(int index) {
49 50
50/* drive the GPIO signal low */ 51/* drive the GPIO signal low */
51 52
52static inline void scx200_gpio_set_low(int index) { 53static inline void scx200_gpio_set_low(unsigned index) {
53 __SCx200_GPIO_BANK; 54 __SCx200_GPIO_BANK;
54 __SCx200_GPIO_IOADDR; 55 __SCx200_GPIO_IOADDR;
55 __SCx200_GPIO_SHADOW; 56 __SCx200_GPIO_SHADOW;
@@ -60,7 +61,7 @@ static inline void scx200_gpio_set_low(int index) {
60 61
61/* drive the GPIO signal to state */ 62/* drive the GPIO signal to state */
62 63
63static inline void scx200_gpio_set(int index, int state) { 64static inline void scx200_gpio_set(unsigned index, int state) {
64 __SCx200_GPIO_BANK; 65 __SCx200_GPIO_BANK;
65 __SCx200_GPIO_IOADDR; 66 __SCx200_GPIO_IOADDR;
66 __SCx200_GPIO_SHADOW; 67 __SCx200_GPIO_SHADOW;
@@ -73,7 +74,7 @@ static inline void scx200_gpio_set(int index, int state) {
73} 74}
74 75
75/* toggle the GPIO signal */ 76/* toggle the GPIO signal */
76static inline void scx200_gpio_change(int index) { 77static inline void scx200_gpio_change(unsigned index) {
77 __SCx200_GPIO_BANK; 78 __SCx200_GPIO_BANK;
78 __SCx200_GPIO_IOADDR; 79 __SCx200_GPIO_IOADDR;
79 __SCx200_GPIO_SHADOW; 80 __SCx200_GPIO_SHADOW;
@@ -87,10 +88,3 @@ static inline void scx200_gpio_change(int index) {
87#undef __SCx200_GPIO_SHADOW 88#undef __SCx200_GPIO_SHADOW
88#undef __SCx200_GPIO_INDEX 89#undef __SCx200_GPIO_INDEX
89#undef __SCx200_GPIO_OUT 90#undef __SCx200_GPIO_OUT
90
91/*
92 Local variables:
93 compile-command: "make -C ../.. bzImage modules"
94 c-basic-offset: 8
95 End:
96*/
diff --git a/include/linux/security.h b/include/linux/security.h
index d2c17bd91a..9b5fea81f5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -31,6 +31,8 @@
31#include <linux/msg.h> 31#include <linux/msg.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/key.h> 33#include <linux/key.h>
34#include <linux/xfrm.h>
35#include <net/flow.h>
34 36
35struct ctl_table; 37struct ctl_table;
36 38
@@ -67,7 +69,7 @@ struct xfrm_state;
67struct xfrm_user_sec_ctx; 69struct xfrm_user_sec_ctx;
68 70
69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 71extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
70extern int cap_netlink_recv(struct sk_buff *skb); 72extern int cap_netlink_recv(struct sk_buff *skb, int cap);
71 73
72/* 74/*
73 * Values used in the task_security_ops calls 75 * Values used in the task_security_ops calls
@@ -88,6 +90,7 @@ extern int cap_netlink_recv(struct sk_buff *skb);
88struct nfsctl_arg; 90struct nfsctl_arg;
89struct sched_param; 91struct sched_param;
90struct swap_info_struct; 92struct swap_info_struct;
93struct request_sock;
91 94
92/* bprm_apply_creds unsafe reasons */ 95/* bprm_apply_creds unsafe reasons */
93#define LSM_UNSAFE_SHARE 1 96#define LSM_UNSAFE_SHARE 1
@@ -567,6 +570,9 @@ struct swap_info_struct;
567 * @p. 570 * @p.
568 * @p contains the task_struct for the process. 571 * @p contains the task_struct for the process.
569 * Return 0 if permission is granted. 572 * Return 0 if permission is granted.
573 * @task_getsecid:
574 * Retrieve the security identifier of the process @p.
575 * @p contains the task_struct for the process and place is into @secid.
570 * @task_setgroups: 576 * @task_setgroups:
571 * Check permission before setting the supplementary group set of the 577 * Check permission before setting the supplementary group set of the
572 * current process. 578 * current process.
@@ -582,6 +588,10 @@ struct swap_info_struct;
582 * @p contains the task_struct of process. 588 * @p contains the task_struct of process.
583 * @ioprio contains the new ioprio value 589 * @ioprio contains the new ioprio value
584 * Return 0 if permission is granted. 590 * Return 0 if permission is granted.
591 * @task_getioprio
592 * Check permission before getting the ioprio value of @p.
593 * @p contains the task_struct of process.
594 * Return 0 if permission is granted.
585 * @task_setrlimit: 595 * @task_setrlimit:
586 * Check permission before setting the resource limits of the current 596 * Check permission before setting the resource limits of the current
587 * process for @resource to @new_rlim. The old resource limit values can 597 * process for @resource to @new_rlim. The old resource limit values can
@@ -615,6 +625,7 @@ struct swap_info_struct;
615 * @p contains the task_struct for process. 625 * @p contains the task_struct for process.
616 * @info contains the signal information. 626 * @info contains the signal information.
617 * @sig contains the signal value. 627 * @sig contains the signal value.
628 * @secid contains the sid of the process where the signal originated
618 * Return 0 if permission is granted. 629 * Return 0 if permission is granted.
619 * @task_wait: 630 * @task_wait:
620 * Check permission before allowing a process to reap a child process @p 631 * Check permission before allowing a process to reap a child process @p
@@ -656,6 +667,7 @@ struct swap_info_struct;
656 * Check permission before processing the received netlink message in 667 * Check permission before processing the received netlink message in
657 * @skb. 668 * @skb.
658 * @skb contains the sk_buff structure for the netlink message. 669 * @skb contains the sk_buff structure for the netlink message.
670 * @cap indicates the capability required
659 * Return 0 if permission is granted. 671 * Return 0 if permission is granted.
660 * 672 *
661 * Security hooks for Unix domain networking. 673 * Security hooks for Unix domain networking.
@@ -803,9 +815,19 @@ struct swap_info_struct;
803 * which is used to copy security attributes between local stream sockets. 815 * which is used to copy security attributes between local stream sockets.
804 * @sk_free_security: 816 * @sk_free_security:
805 * Deallocate security structure. 817 * Deallocate security structure.
806 * @sk_getsid: 818 * @sk_clone_security:
807 * Retrieve the LSM-specific sid for the sock to enable caching of network 819 * Clone/copy security structure.
820 * @sk_getsecid:
821 * Retrieve the LSM-specific secid for the sock to enable caching of network
808 * authorizations. 822 * authorizations.
823 * @sock_graft:
824 * Sets the socket's isec sid to the sock's sid.
825 * @inet_conn_request:
826 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
827 * @inet_csk_clone:
828 * Sets the new child socket's sid to the openreq sid.
829 * @req_classify_flow:
830 * Sets the flow's sid to the openreq sid.
809 * 831 *
810 * Security hooks for XFRM operations. 832 * Security hooks for XFRM operations.
811 * 833 *
@@ -814,9 +836,10 @@ struct swap_info_struct;
814 * used by the XFRM system. 836 * used by the XFRM system.
815 * @sec_ctx contains the security context information being provided by 837 * @sec_ctx contains the security context information being provided by
816 * the user-level policy update program (e.g., setkey). 838 * the user-level policy update program (e.g., setkey).
817 * Allocate a security structure to the xp->security field. 839 * @sk refers to the sock from which to derive the security context.
818 * The security field is initialized to NULL when the xfrm_policy is 840 * Allocate a security structure to the xp->security field; the security
819 * allocated. 841 * field is initialized to NULL when the xfrm_policy is allocated. Only
842 * one of sec_ctx or sock can be specified.
820 * Return 0 if operation was successful (memory to allocate, legal context) 843 * Return 0 if operation was successful (memory to allocate, legal context)
821 * @xfrm_policy_clone_security: 844 * @xfrm_policy_clone_security:
822 * @old contains an existing xfrm_policy in the SPD. 845 * @old contains an existing xfrm_policy in the SPD.
@@ -835,9 +858,14 @@ struct swap_info_struct;
835 * Database by the XFRM system. 858 * Database by the XFRM system.
836 * @sec_ctx contains the security context information being provided by 859 * @sec_ctx contains the security context information being provided by
837 * the user-level SA generation program (e.g., setkey or racoon). 860 * the user-level SA generation program (e.g., setkey or racoon).
838 * Allocate a security structure to the x->security field. The 861 * @polsec contains the security context information associated with a xfrm
839 * security field is initialized to NULL when the xfrm_state is 862 * policy rule from which to take the base context. polsec must be NULL
840 * allocated. 863 * when sec_ctx is specified.
864 * @secid contains the secid from which to take the mls portion of the context.
865 * Allocate a security structure to the x->security field; the security
866 * field is initialized to NULL when the xfrm_state is allocated. Set the
867 * context to correspond to either sec_ctx or polsec, with the mls portion
868 * taken from secid in the latter case.
841 * Return 0 if operation was successful (memory to allocate, legal context). 869 * Return 0 if operation was successful (memory to allocate, legal context).
842 * @xfrm_state_free_security: 870 * @xfrm_state_free_security:
843 * @x contains the xfrm_state. 871 * @x contains the xfrm_state.
@@ -848,13 +876,27 @@ struct swap_info_struct;
848 * @xfrm_policy_lookup: 876 * @xfrm_policy_lookup:
849 * @xp contains the xfrm_policy for which the access control is being 877 * @xp contains the xfrm_policy for which the access control is being
850 * checked. 878 * checked.
851 * @sk_sid contains the sock security label that is used to authorize 879 * @fl_secid contains the flow security label that is used to authorize
852 * access to the policy xp. 880 * access to the policy xp.
853 * @dir contains the direction of the flow (input or output). 881 * @dir contains the direction of the flow (input or output).
854 * Check permission when a sock selects a xfrm_policy for processing 882 * Check permission when a flow selects a xfrm_policy for processing
855 * XFRMs on a packet. The hook is called when selecting either a 883 * XFRMs on a packet. The hook is called when selecting either a
856 * per-socket policy or a generic xfrm policy. 884 * per-socket policy or a generic xfrm policy.
857 * Return 0 if permission is granted. 885 * Return 0 if permission is granted.
886 * @xfrm_state_pol_flow_match:
887 * @x contains the state to match.
888 * @xp contains the policy to check for a match.
889 * @fl contains the flow to check for a match.
890 * Return 1 if there is a match.
891 * @xfrm_flow_state_match:
892 * @fl contains the flow key to match.
893 * @xfrm points to the xfrm_state to match.
894 * Return 1 if there is a match.
895 * @xfrm_decode_session:
896 * @skb points to skb to decode.
897 * @secid points to the flow key secid to set.
898 * @ckall says if all xfrms used should be checked for same secid.
899 * Return 0 if ckall is zero or all xfrms used have the same secid.
858 * 900 *
859 * Security hooks affecting all Key Management operations 901 * Security hooks affecting all Key Management operations
860 * 902 *
@@ -862,6 +904,7 @@ struct swap_info_struct;
862 * Permit allocation of a key and assign security data. Note that key does 904 * Permit allocation of a key and assign security data. Note that key does
863 * not have a serial number assigned at this point. 905 * not have a serial number assigned at this point.
864 * @key points to the key. 906 * @key points to the key.
907 * @flags is the allocation flags
865 * Return 0 if permission is granted, -ve error otherwise. 908 * Return 0 if permission is granted, -ve error otherwise.
866 * @key_free: 909 * @key_free:
867 * Notification of destruction; free security data. 910 * Notification of destruction; free security data.
@@ -1099,6 +1142,16 @@ struct swap_info_struct;
1099 * @name contains the name of the security module being unstacked. 1142 * @name contains the name of the security module being unstacked.
1100 * @ops contains a pointer to the struct security_operations of the module to unstack. 1143 * @ops contains a pointer to the struct security_operations of the module to unstack.
1101 * 1144 *
1145 * @secid_to_secctx:
1146 * Convert secid to security context.
1147 * @secid contains the security ID.
1148 * @secdata contains the pointer that stores the converted security context.
1149 *
1150 * @release_secctx:
1151 * Release the security context.
1152 * @secdata contains the security context.
1153 * @seclen contains the length of the security context.
1154 *
1102 * This is the main security structure. 1155 * This is the main security structure.
1103 */ 1156 */
1104struct security_operations { 1157struct security_operations {
@@ -1217,16 +1270,18 @@ struct security_operations {
1217 int (*task_setpgid) (struct task_struct * p, pid_t pgid); 1270 int (*task_setpgid) (struct task_struct * p, pid_t pgid);
1218 int (*task_getpgid) (struct task_struct * p); 1271 int (*task_getpgid) (struct task_struct * p);
1219 int (*task_getsid) (struct task_struct * p); 1272 int (*task_getsid) (struct task_struct * p);
1273 void (*task_getsecid) (struct task_struct * p, u32 * secid);
1220 int (*task_setgroups) (struct group_info *group_info); 1274 int (*task_setgroups) (struct group_info *group_info);
1221 int (*task_setnice) (struct task_struct * p, int nice); 1275 int (*task_setnice) (struct task_struct * p, int nice);
1222 int (*task_setioprio) (struct task_struct * p, int ioprio); 1276 int (*task_setioprio) (struct task_struct * p, int ioprio);
1277 int (*task_getioprio) (struct task_struct * p);
1223 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); 1278 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
1224 int (*task_setscheduler) (struct task_struct * p, int policy, 1279 int (*task_setscheduler) (struct task_struct * p, int policy,
1225 struct sched_param * lp); 1280 struct sched_param * lp);
1226 int (*task_getscheduler) (struct task_struct * p); 1281 int (*task_getscheduler) (struct task_struct * p);
1227 int (*task_movememory) (struct task_struct * p); 1282 int (*task_movememory) (struct task_struct * p);
1228 int (*task_kill) (struct task_struct * p, 1283 int (*task_kill) (struct task_struct * p,
1229 struct siginfo * info, int sig); 1284 struct siginfo * info, int sig, u32 secid);
1230 int (*task_wait) (struct task_struct * p); 1285 int (*task_wait) (struct task_struct * p);
1231 int (*task_prctl) (int option, unsigned long arg2, 1286 int (*task_prctl) (int option, unsigned long arg2,
1232 unsigned long arg3, unsigned long arg4, 1287 unsigned long arg3, unsigned long arg4,
@@ -1265,7 +1320,7 @@ struct security_operations {
1265 struct sembuf * sops, unsigned nsops, int alter); 1320 struct sembuf * sops, unsigned nsops, int alter);
1266 1321
1267 int (*netlink_send) (struct sock * sk, struct sk_buff * skb); 1322 int (*netlink_send) (struct sock * sk, struct sk_buff * skb);
1268 int (*netlink_recv) (struct sk_buff * skb); 1323 int (*netlink_recv) (struct sk_buff * skb, int cap);
1269 1324
1270 /* allow module stacking */ 1325 /* allow module stacking */
1271 int (*register_security) (const char *name, 1326 int (*register_security) (const char *name,
@@ -1277,6 +1332,8 @@ struct security_operations {
1277 1332
1278 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1333 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1279 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1334 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1335 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1336 void (*release_secctx)(char *secdata, u32 seclen);
1280 1337
1281#ifdef CONFIG_SECURITY_NETWORK 1338#ifdef CONFIG_SECURITY_NETWORK
1282 int (*unix_stream_connect) (struct socket * sock, 1339 int (*unix_stream_connect) (struct socket * sock,
@@ -1284,8 +1341,8 @@ struct security_operations {
1284 int (*unix_may_send) (struct socket * sock, struct socket * other); 1341 int (*unix_may_send) (struct socket * sock, struct socket * other);
1285 1342
1286 int (*socket_create) (int family, int type, int protocol, int kern); 1343 int (*socket_create) (int family, int type, int protocol, int kern);
1287 void (*socket_post_create) (struct socket * sock, int family, 1344 int (*socket_post_create) (struct socket * sock, int family,
1288 int type, int protocol, int kern); 1345 int type, int protocol, int kern);
1289 int (*socket_bind) (struct socket * sock, 1346 int (*socket_bind) (struct socket * sock,
1290 struct sockaddr * address, int addrlen); 1347 struct sockaddr * address, int addrlen);
1291 int (*socket_connect) (struct socket * sock, 1348 int (*socket_connect) (struct socket * sock,
@@ -1305,26 +1362,39 @@ struct security_operations {
1305 int (*socket_shutdown) (struct socket * sock, int how); 1362 int (*socket_shutdown) (struct socket * sock, int how);
1306 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1363 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1307 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1364 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1308 int (*socket_getpeersec_dgram) (struct sk_buff *skb, char **secdata, u32 *seclen); 1365 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid);
1309 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1366 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1310 void (*sk_free_security) (struct sock *sk); 1367 void (*sk_free_security) (struct sock *sk);
1311 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); 1368 void (*sk_clone_security) (const struct sock *sk, struct sock *newsk);
1369 void (*sk_getsecid) (struct sock *sk, u32 *secid);
1370 void (*sock_graft)(struct sock* sk, struct socket *parent);
1371 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
1372 struct request_sock *req);
1373 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req);
1374 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl);
1312#endif /* CONFIG_SECURITY_NETWORK */ 1375#endif /* CONFIG_SECURITY_NETWORK */
1313 1376
1314#ifdef CONFIG_SECURITY_NETWORK_XFRM 1377#ifdef CONFIG_SECURITY_NETWORK_XFRM
1315 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 1378 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
1379 struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk);
1316 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1380 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1317 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1381 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1318 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1382 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
1319 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 1383 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1384 struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec,
1385 u32 secid);
1320 void (*xfrm_state_free_security) (struct xfrm_state *x); 1386 void (*xfrm_state_free_security) (struct xfrm_state *x);
1321 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1387 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1322 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); 1388 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
1389 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1390 struct xfrm_policy *xp, struct flowi *fl);
1391 int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm);
1392 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
1323#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1393#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1324 1394
1325 /* key management security hooks */ 1395 /* key management security hooks */
1326#ifdef CONFIG_KEYS 1396#ifdef CONFIG_KEYS
1327 int (*key_alloc)(struct key *key, struct task_struct *tsk); 1397 int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags);
1328 void (*key_free)(struct key *key); 1398 void (*key_free)(struct key *key);
1329 int (*key_permission)(key_ref_t key_ref, 1399 int (*key_permission)(key_ref_t key_ref,
1330 struct task_struct *context, 1400 struct task_struct *context,
@@ -1525,6 +1595,7 @@ static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
1525 1595
1526static inline int security_inode_alloc (struct inode *inode) 1596static inline int security_inode_alloc (struct inode *inode)
1527{ 1597{
1598 inode->i_security = NULL;
1528 return security_ops->inode_alloc_security (inode); 1599 return security_ops->inode_alloc_security (inode);
1529} 1600}
1530 1601
@@ -1837,6 +1908,11 @@ static inline int security_task_getsid (struct task_struct *p)
1837 return security_ops->task_getsid (p); 1908 return security_ops->task_getsid (p);
1838} 1909}
1839 1910
1911static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
1912{
1913 security_ops->task_getsecid (p, secid);
1914}
1915
1840static inline int security_task_setgroups (struct group_info *group_info) 1916static inline int security_task_setgroups (struct group_info *group_info)
1841{ 1917{
1842 return security_ops->task_setgroups (group_info); 1918 return security_ops->task_setgroups (group_info);
@@ -1852,6 +1928,11 @@ static inline int security_task_setioprio (struct task_struct *p, int ioprio)
1852 return security_ops->task_setioprio (p, ioprio); 1928 return security_ops->task_setioprio (p, ioprio);
1853} 1929}
1854 1930
1931static inline int security_task_getioprio (struct task_struct *p)
1932{
1933 return security_ops->task_getioprio (p);
1934}
1935
1855static inline int security_task_setrlimit (unsigned int resource, 1936static inline int security_task_setrlimit (unsigned int resource,
1856 struct rlimit *new_rlim) 1937 struct rlimit *new_rlim)
1857{ 1938{
@@ -1876,9 +1957,10 @@ static inline int security_task_movememory (struct task_struct *p)
1876} 1957}
1877 1958
1878static inline int security_task_kill (struct task_struct *p, 1959static inline int security_task_kill (struct task_struct *p,
1879 struct siginfo *info, int sig) 1960 struct siginfo *info, int sig,
1961 u32 secid)
1880{ 1962{
1881 return security_ops->task_kill (p, info, sig); 1963 return security_ops->task_kill (p, info, sig, secid);
1882} 1964}
1883 1965
1884static inline int security_task_wait (struct task_struct *p) 1966static inline int security_task_wait (struct task_struct *p)
@@ -2031,9 +2113,19 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
2031 return security_ops->netlink_send(sk, skb); 2113 return security_ops->netlink_send(sk, skb);
2032} 2114}
2033 2115
2034static inline int security_netlink_recv(struct sk_buff * skb) 2116static inline int security_netlink_recv(struct sk_buff * skb, int cap)
2117{
2118 return security_ops->netlink_recv(skb, cap);
2119}
2120
2121static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2035{ 2122{
2036 return security_ops->netlink_recv(skb); 2123 return security_ops->secid_to_secctx(secid, secdata, seclen);
2124}
2125
2126static inline void security_release_secctx(char *secdata, u32 seclen)
2127{
2128 return security_ops->release_secctx(secdata, seclen);
2037} 2129}
2038 2130
2039/* prototypes */ 2131/* prototypes */
@@ -2489,6 +2581,9 @@ static inline int security_task_getsid (struct task_struct *p)
2489 return 0; 2581 return 0;
2490} 2582}
2491 2583
2584static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
2585{ }
2586
2492static inline int security_task_setgroups (struct group_info *group_info) 2587static inline int security_task_setgroups (struct group_info *group_info)
2493{ 2588{
2494 return 0; 2589 return 0;
@@ -2504,6 +2599,11 @@ static inline int security_task_setioprio (struct task_struct *p, int ioprio)
2504 return 0; 2599 return 0;
2505} 2600}
2506 2601
2602static inline int security_task_getioprio (struct task_struct *p)
2603{
2604 return 0;
2605}
2606
2507static inline int security_task_setrlimit (unsigned int resource, 2607static inline int security_task_setrlimit (unsigned int resource,
2508 struct rlimit *new_rlim) 2608 struct rlimit *new_rlim)
2509{ 2609{
@@ -2528,7 +2628,8 @@ static inline int security_task_movememory (struct task_struct *p)
2528} 2628}
2529 2629
2530static inline int security_task_kill (struct task_struct *p, 2630static inline int security_task_kill (struct task_struct *p,
2531 struct siginfo *info, int sig) 2631 struct siginfo *info, int sig,
2632 u32 secid)
2532{ 2633{
2533 return 0; 2634 return 0;
2534} 2635}
@@ -2669,9 +2770,9 @@ static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
2669 return cap_netlink_send (sk, skb); 2770 return cap_netlink_send (sk, skb);
2670} 2771}
2671 2772
2672static inline int security_netlink_recv (struct sk_buff *skb) 2773static inline int security_netlink_recv (struct sk_buff *skb, int cap)
2673{ 2774{
2674 return cap_netlink_recv (skb); 2775 return cap_netlink_recv (skb, cap);
2675} 2776}
2676 2777
2677static inline struct dentry *securityfs_create_dir(const char *name, 2778static inline struct dentry *securityfs_create_dir(const char *name,
@@ -2693,6 +2794,14 @@ static inline void securityfs_remove(struct dentry *dentry)
2693{ 2794{
2694} 2795}
2695 2796
2797static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2798{
2799 return -EOPNOTSUPP;
2800}
2801
2802static inline void security_release_secctx(char *secdata, u32 seclen)
2803{
2804}
2696#endif /* CONFIG_SECURITY */ 2805#endif /* CONFIG_SECURITY */
2697 2806
2698#ifdef CONFIG_SECURITY_NETWORK 2807#ifdef CONFIG_SECURITY_NETWORK
@@ -2716,13 +2825,13 @@ static inline int security_socket_create (int family, int type,
2716 return security_ops->socket_create(family, type, protocol, kern); 2825 return security_ops->socket_create(family, type, protocol, kern);
2717} 2826}
2718 2827
2719static inline void security_socket_post_create(struct socket * sock, 2828static inline int security_socket_post_create(struct socket * sock,
2720 int family, 2829 int family,
2721 int type, 2830 int type,
2722 int protocol, int kern) 2831 int protocol, int kern)
2723{ 2832{
2724 security_ops->socket_post_create(sock, family, type, 2833 return security_ops->socket_post_create(sock, family, type,
2725 protocol, kern); 2834 protocol, kern);
2726} 2835}
2727 2836
2728static inline int security_socket_bind(struct socket * sock, 2837static inline int security_socket_bind(struct socket * sock,
@@ -2808,10 +2917,9 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __
2808 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len); 2917 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
2809} 2918}
2810 2919
2811static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 2920static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2812 u32 *seclen)
2813{ 2921{
2814 return security_ops->socket_getpeersec_dgram(skb, secdata, seclen); 2922 return security_ops->socket_getpeersec_dgram(sock, skb, secid);
2815} 2923}
2816 2924
2817static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) 2925static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
@@ -2824,9 +2932,36 @@ static inline void security_sk_free(struct sock *sk)
2824 return security_ops->sk_free_security(sk); 2932 return security_ops->sk_free_security(sk);
2825} 2933}
2826 2934
2827static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) 2935static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
2936{
2937 return security_ops->sk_clone_security(sk, newsk);
2938}
2939
2940static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
2941{
2942 security_ops->sk_getsecid(sk, &fl->secid);
2943}
2944
2945static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
2946{
2947 security_ops->req_classify_flow(req, fl);
2948}
2949
2950static inline void security_sock_graft(struct sock* sk, struct socket *parent)
2828{ 2951{
2829 return security_ops->sk_getsid(sk, fl, dir); 2952 security_ops->sock_graft(sk, parent);
2953}
2954
2955static inline int security_inet_conn_request(struct sock *sk,
2956 struct sk_buff *skb, struct request_sock *req)
2957{
2958 return security_ops->inet_conn_request(sk, skb, req);
2959}
2960
2961static inline void security_inet_csk_clone(struct sock *newsk,
2962 const struct request_sock *req)
2963{
2964 security_ops->inet_csk_clone(newsk, req);
2830} 2965}
2831#else /* CONFIG_SECURITY_NETWORK */ 2966#else /* CONFIG_SECURITY_NETWORK */
2832static inline int security_unix_stream_connect(struct socket * sock, 2967static inline int security_unix_stream_connect(struct socket * sock,
@@ -2848,11 +2983,12 @@ static inline int security_socket_create (int family, int type,
2848 return 0; 2983 return 0;
2849} 2984}
2850 2985
2851static inline void security_socket_post_create(struct socket * sock, 2986static inline int security_socket_post_create(struct socket * sock,
2852 int family, 2987 int family,
2853 int type, 2988 int type,
2854 int protocol, int kern) 2989 int protocol, int kern)
2855{ 2990{
2991 return 0;
2856} 2992}
2857 2993
2858static inline int security_socket_bind(struct socket * sock, 2994static inline int security_socket_bind(struct socket * sock,
@@ -2936,8 +3072,7 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __
2936 return -ENOPROTOOPT; 3072 return -ENOPROTOOPT;
2937} 3073}
2938 3074
2939static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 3075static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2940 u32 *seclen)
2941{ 3076{
2942 return -ENOPROTOOPT; 3077 return -ENOPROTOOPT;
2943} 3078}
@@ -2951,16 +3086,43 @@ static inline void security_sk_free(struct sock *sk)
2951{ 3086{
2952} 3087}
2953 3088
2954static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) 3089static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
3090{
3091}
3092
3093static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
3094{
3095}
3096
3097static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
3098{
3099}
3100
3101static inline void security_sock_graft(struct sock* sk, struct socket *parent)
3102{
3103}
3104
3105static inline int security_inet_conn_request(struct sock *sk,
3106 struct sk_buff *skb, struct request_sock *req)
2955{ 3107{
2956 return 0; 3108 return 0;
2957} 3109}
3110
3111static inline void security_inet_csk_clone(struct sock *newsk,
3112 const struct request_sock *req)
3113{
3114}
2958#endif /* CONFIG_SECURITY_NETWORK */ 3115#endif /* CONFIG_SECURITY_NETWORK */
2959 3116
2960#ifdef CONFIG_SECURITY_NETWORK_XFRM 3117#ifdef CONFIG_SECURITY_NETWORK_XFRM
2961static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 3118static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2962{ 3119{
2963 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx); 3120 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL);
3121}
3122
3123static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
3124{
3125 return security_ops->xfrm_policy_alloc_security(xp, NULL, sk);
2964} 3126}
2965 3127
2966static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3128static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
@@ -2978,9 +3140,18 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
2978 return security_ops->xfrm_policy_delete_security(xp); 3140 return security_ops->xfrm_policy_delete_security(xp);
2979} 3141}
2980 3142
2981static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 3143static inline int security_xfrm_state_alloc(struct xfrm_state *x,
3144 struct xfrm_user_sec_ctx *sec_ctx)
3145{
3146 return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0);
3147}
3148
3149static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3150 struct xfrm_sec_ctx *polsec, u32 secid)
2982{ 3151{
2983 return security_ops->xfrm_state_alloc_security(x, sec_ctx); 3152 if (!polsec)
3153 return 0;
3154 return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid);
2984} 3155}
2985 3156
2986static inline int security_xfrm_state_delete(struct xfrm_state *x) 3157static inline int security_xfrm_state_delete(struct xfrm_state *x)
@@ -2993,9 +3164,32 @@ static inline void security_xfrm_state_free(struct xfrm_state *x)
2993 security_ops->xfrm_state_free_security(x); 3164 security_ops->xfrm_state_free_security(x);
2994} 3165}
2995 3166
2996static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 3167static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
2997{ 3168{
2998 return security_ops->xfrm_policy_lookup(xp, sk_sid, dir); 3169 return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
3170}
3171
3172static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3173 struct xfrm_policy *xp, struct flowi *fl)
3174{
3175 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
3176}
3177
3178static inline int security_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm)
3179{
3180 return security_ops->xfrm_flow_state_match(fl, xfrm);
3181}
3182
3183static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3184{
3185 return security_ops->xfrm_decode_session(skb, secid, 1);
3186}
3187
3188static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
3189{
3190 int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
3191
3192 BUG_ON(rc);
2999} 3193}
3000#else /* CONFIG_SECURITY_NETWORK_XFRM */ 3194#else /* CONFIG_SECURITY_NETWORK_XFRM */
3001static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 3195static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
@@ -3003,6 +3197,11 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm
3003 return 0; 3197 return 0;
3004} 3198}
3005 3199
3200static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
3201{
3202 return 0;
3203}
3204
3006static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3205static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
3007{ 3206{
3008 return 0; 3207 return 0;
@@ -3017,7 +3216,14 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
3017 return 0; 3216 return 0;
3018} 3217}
3019 3218
3020static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 3219static inline int security_xfrm_state_alloc(struct xfrm_state *x,
3220 struct xfrm_user_sec_ctx *sec_ctx)
3221{
3222 return 0;
3223}
3224
3225static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3226 struct xfrm_sec_ctx *polsec, u32 secid)
3021{ 3227{
3022 return 0; 3228 return 0;
3023} 3229}
@@ -3031,18 +3237,41 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x)
3031 return 0; 3237 return 0;
3032} 3238}
3033 3239
3034static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 3240static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
3035{ 3241{
3036 return 0; 3242 return 0;
3037} 3243}
3244
3245static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3246 struct xfrm_policy *xp, struct flowi *fl)
3247{
3248 return 1;
3249}
3250
3251static inline int security_xfrm_flow_state_match(struct flowi *fl,
3252 struct xfrm_state *xfrm)
3253{
3254 return 1;
3255}
3256
3257static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3258{
3259 return 0;
3260}
3261
3262static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
3263{
3264}
3265
3038#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 3266#endif /* CONFIG_SECURITY_NETWORK_XFRM */
3039 3267
3040#ifdef CONFIG_KEYS 3268#ifdef CONFIG_KEYS
3041#ifdef CONFIG_SECURITY 3269#ifdef CONFIG_SECURITY
3042static inline int security_key_alloc(struct key *key, 3270static inline int security_key_alloc(struct key *key,
3043 struct task_struct *tsk) 3271 struct task_struct *tsk,
3272 unsigned long flags)
3044{ 3273{
3045 return security_ops->key_alloc(key, tsk); 3274 return security_ops->key_alloc(key, tsk, flags);
3046} 3275}
3047 3276
3048static inline void security_key_free(struct key *key) 3277static inline void security_key_free(struct key *key)
@@ -3060,7 +3289,8 @@ static inline int security_key_permission(key_ref_t key_ref,
3060#else 3289#else
3061 3290
3062static inline int security_key_alloc(struct key *key, 3291static inline int security_key_alloc(struct key *key,
3063 struct task_struct *tsk) 3292 struct task_struct *tsk,
3293 unsigned long flags)
3064{ 3294{
3065 return 0; 3295 return 0;
3066} 3296}
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index aad4e390d6..d1b7ca6c1c 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -46,7 +46,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule);
46 46
47/** 47/**
48 * selinux_audit_rule_match - determine if a context ID matches a rule. 48 * selinux_audit_rule_match - determine if a context ID matches a rule.
49 * @ctxid: the context ID to check 49 * @sid: the context ID to check
50 * @field: the field this rule refers to 50 * @field: the field this rule refers to
51 * @op: the operater the rule uses 51 * @op: the operater the rule uses
52 * @rule: pointer to the audit rule to check against 52 * @rule: pointer to the audit rule to check against
@@ -55,7 +55,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule);
55 * Returns 1 if the context id matches the rule, 0 if it does not, and 55 * Returns 1 if the context id matches the rule, 0 if it does not, and
56 * -errno on failure. 56 * -errno on failure.
57 */ 57 */
58int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, 58int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
59 struct selinux_audit_rule *rule, 59 struct selinux_audit_rule *rule,
60 struct audit_context *actx); 60 struct audit_context *actx);
61 61
@@ -70,18 +70,8 @@ int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op,
70void selinux_audit_set_callback(int (*callback)(void)); 70void selinux_audit_set_callback(int (*callback)(void));
71 71
72/** 72/**
73 * selinux_task_ctxid - determine a context ID for a process. 73 * selinux_sid_to_string - map a security context ID to a string
74 * @tsk: the task object 74 * @sid: security context ID to be converted.
75 * @ctxid: ID value returned via this
76 *
77 * On return, ctxid will contain an ID for the context. This value
78 * should only be used opaquely.
79 */
80void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid);
81
82/**
83 * selinux_ctxid_to_string - map a security context ID to a string
84 * @ctxid: security context ID to be converted.
85 * @ctx: address of context string to be returned 75 * @ctx: address of context string to be returned
86 * @ctxlen: length of returned context string. 76 * @ctxlen: length of returned context string.
87 * 77 *
@@ -89,7 +79,7 @@ void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid);
89 * string will be allocated internally, and the caller must call 79 * string will be allocated internally, and the caller must call
90 * kfree() on it after use. 80 * kfree() on it after use.
91 */ 81 */
92int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen); 82int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen);
93 83
94/** 84/**
95 * selinux_get_inode_sid - get the inode's security context ID 85 * selinux_get_inode_sid - get the inode's security context ID
@@ -154,7 +144,7 @@ static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
154 return; 144 return;
155} 145}
156 146
157static inline int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, 147static inline int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
158 struct selinux_audit_rule *rule, 148 struct selinux_audit_rule *rule,
159 struct audit_context *actx) 149 struct audit_context *actx)
160{ 150{
@@ -166,12 +156,7 @@ static inline void selinux_audit_set_callback(int (*callback)(void))
166 return; 156 return;
167} 157}
168 158
169static inline void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid) 159static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
170{
171 *ctxid = 0;
172}
173
174static inline int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen)
175{ 160{
176 *ctx = NULL; 161 *ctx = NULL;
177 *ctxlen = 0; 162 *ctxlen = 0;
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 7bc5c7c12b..46000936f8 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -38,9 +38,17 @@ typedef struct {
38 * These macros triggered gcc-3.x compile-time problems. We think these are 38 * These macros triggered gcc-3.x compile-time problems. We think these are
39 * OK now. Be cautious. 39 * OK now. Be cautious.
40 */ 40 */
41#define SEQLOCK_UNLOCKED { 0, SPIN_LOCK_UNLOCKED } 41#define __SEQLOCK_UNLOCKED(lockname) \
42#define seqlock_init(x) do { *(x) = (seqlock_t) SEQLOCK_UNLOCKED; } while (0) 42 { 0, __SPIN_LOCK_UNLOCKED(lockname) }
43 43
44#define SEQLOCK_UNLOCKED \
45 __SEQLOCK_UNLOCKED(old_style_seqlock_init)
46
47#define seqlock_init(x) \
48 do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0)
49
50#define DEFINE_SEQLOCK(x) \
51 seqlock_t x = __SEQLOCK_UNLOCKED(x)
44 52
45/* Lock out other writers and update the count. 53/* Lock out other writers and update the count.
46 * Acts like a normal spin_lock/unlock. 54 * Acts like a normal spin_lock/unlock.
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0ef50baa7d..86501a3de2 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -130,6 +130,9 @@
130/* SUN4V Hypervisor Console */ 130/* SUN4V Hypervisor Console */
131#define PORT_SUNHV 72 131#define PORT_SUNHV 72
132 132
133#define PORT_S3C2412 73
134
135
133#ifdef __KERNEL__ 136#ifdef __KERNEL__
134 137
135#include <linux/compiler.h> 138#include <linux/compiler.h>
@@ -213,16 +216,18 @@ struct uart_port {
213 unsigned char __iomem *membase; /* read/write[bwl] */ 216 unsigned char __iomem *membase; /* read/write[bwl] */
214 unsigned int irq; /* irq number */ 217 unsigned int irq; /* irq number */
215 unsigned int uartclk; /* base uart clock */ 218 unsigned int uartclk; /* base uart clock */
216 unsigned char fifosize; /* tx fifo size */ 219 unsigned int fifosize; /* tx fifo size */
217 unsigned char x_char; /* xon/xoff char */ 220 unsigned char x_char; /* xon/xoff char */
218 unsigned char regshift; /* reg offset shift */ 221 unsigned char regshift; /* reg offset shift */
219 unsigned char iotype; /* io access style */ 222 unsigned char iotype; /* io access style */
223 unsigned char unused1;
220 224
221#define UPIO_PORT (0) 225#define UPIO_PORT (0)
222#define UPIO_HUB6 (1) 226#define UPIO_HUB6 (1)
223#define UPIO_MEM (2) 227#define UPIO_MEM (2)
224#define UPIO_MEM32 (3) 228#define UPIO_MEM32 (3)
225#define UPIO_AU (4) /* Au1x00 type IO */ 229#define UPIO_AU (4) /* Au1x00 type IO */
230#define UPIO_TSI (5) /* Tsi108/109 type IO */
226 231
227 unsigned int read_status_mask; /* driver specific */ 232 unsigned int read_status_mask; /* driver specific */
228 unsigned int ignore_status_mask; /* driver specific */ 233 unsigned int ignore_status_mask; /* driver specific */
@@ -333,7 +338,6 @@ struct uart_driver {
333 struct module *owner; 338 struct module *owner;
334 const char *driver_name; 339 const char *driver_name;
335 const char *dev_name; 340 const char *dev_name;
336 const char *devfs_name;
337 int major; 341 int major;
338 int minor; 342 int minor;
339 int nr; 343 int nr;
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c057f0b323..f3c5189911 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/signal.h b/include/linux/signal.h
index 1e4ce7225e..117135e33d 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -9,32 +9,6 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10 10
11/* 11/*
12 * These values of sa_flags are used only by the kernel as part of the
13 * irq handling routines.
14 *
15 * SA_INTERRUPT is also used by the irq handling routines.
16 * SA_SHIRQ is for shared interrupt support on PCI and EISA.
17 * SA_PROBEIRQ is set by callers when they expect sharing mismatches to occur
18 */
19#define SA_SAMPLE_RANDOM SA_RESTART
20#define SA_SHIRQ 0x04000000
21#define SA_PROBEIRQ 0x08000000
22
23/*
24 * As above, these correspond to the IORESOURCE_IRQ_* defines in
25 * linux/ioport.h to select the interrupt line behaviour. When
26 * requesting an interrupt without specifying a SA_TRIGGER, the
27 * setting should be assumed to be "as already configured", which
28 * may be as per machine or firmware initialisation.
29 */
30#define SA_TRIGGER_LOW 0x00000008
31#define SA_TRIGGER_HIGH 0x00000004
32#define SA_TRIGGER_FALLING 0x00000002
33#define SA_TRIGGER_RISING 0x00000001
34#define SA_TRIGGER_MASK (SA_TRIGGER_HIGH|SA_TRIGGER_LOW|\
35 SA_TRIGGER_RISING|SA_TRIGGER_FALLING)
36
37/*
38 * Real Time signals may be queued. 12 * Real Time signals may be queued.
39 */ 13 */
40 14
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 16eef03ce0..85577a4ffa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -34,8 +34,9 @@
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
35 35
36#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
37#define CHECKSUM_HW 1 37#define CHECKSUM_PARTIAL 1
38#define CHECKSUM_UNNECESSARY 2 38#define CHECKSUM_UNNECESSARY 2
39#define CHECKSUM_COMPLETE 3
39 40
40#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 41#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
41 ~(SMP_CACHE_BYTES - 1)) 42 ~(SMP_CACHE_BYTES - 1))
@@ -56,17 +57,17 @@
56 * Apparently with secret goal to sell you new device, when you 57 * Apparently with secret goal to sell you new device, when you
57 * will add new protocol to your host. F.e. IPv6. 8) 58 * will add new protocol to your host. F.e. IPv6. 8)
58 * 59 *
59 * HW: the most generic way. Device supplied checksum of _all_ 60 * COMPLETE: the most generic way. Device supplied checksum of _all_
60 * the packet as seen by netif_rx in skb->csum. 61 * the packet as seen by netif_rx in skb->csum.
61 * NOTE: Even if device supports only some protocols, but 62 * NOTE: Even if device supports only some protocols, but
62 * is able to produce some skb->csum, it MUST use HW, 63 * is able to produce some skb->csum, it MUST use COMPLETE,
63 * not UNNECESSARY. 64 * not UNNECESSARY.
64 * 65 *
65 * B. Checksumming on output. 66 * B. Checksumming on output.
66 * 67 *
67 * NONE: skb is checksummed by protocol or csum is not required. 68 * NONE: skb is checksummed by protocol or csum is not required.
68 * 69 *
69 * HW: device is required to csum packet as seen by hard_start_xmit 70 * PARTIAL: device is required to csum packet as seen by hard_start_xmit
70 * from skb->h.raw to the end and to record the checksum 71 * from skb->h.raw to the end and to record the checksum
71 * at skb->h.raw+skb->csum. 72 * at skb->h.raw+skb->csum.
72 * 73 *
@@ -171,7 +172,15 @@ enum {
171 172
172enum { 173enum {
173 SKB_GSO_TCPV4 = 1 << 0, 174 SKB_GSO_TCPV4 = 1 << 0,
174 SKB_GSO_UDPV4 = 1 << 1, 175 SKB_GSO_UDP = 1 << 1,
176
177 /* This indicates the skb is from an untrusted source. */
178 SKB_GSO_DODGY = 1 << 2,
179
180 /* This indicates the tcp segment has CWR set. */
181 SKB_GSO_TCP_ECN = 1 << 3,
182
183 SKB_GSO_TCPV6 = 1 << 4,
175}; 184};
176 185
177/** 186/**
@@ -596,6 +605,14 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
596 return list_->qlen; 605 return list_->qlen;
597} 606}
598 607
608/*
609 * This function creates a split out lock class for each invocation;
610 * this is needed for now since a whole lot of users of the skb-queue
611 * infrastructure in drivers have different locking usage (in hardirq)
612 * than the networking core (in softirq only). In the long run either the
613 * network layer or drivers should need annotation to consolidate the
614 * main types of usage into 3 classes.
615 */
599static inline void skb_queue_head_init(struct sk_buff_head *list) 616static inline void skb_queue_head_init(struct sk_buff_head *list)
600{ 617{
601 spin_lock_init(&list->lock); 618 spin_lock_init(&list->lock);
@@ -1024,6 +1041,21 @@ static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
1024} 1041}
1025 1042
1026/** 1043/**
1044 * pskb_trim_unique - remove end from a paged unique (not cloned) buffer
1045 * @skb: buffer to alter
1046 * @len: new length
1047 *
1048 * This is identical to pskb_trim except that the caller knows that
1049 * the skb is not cloned so we should never get an error due to out-
1050 * of-memory.
1051 */
1052static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
1053{
1054 int err = pskb_trim(skb, len);
1055 BUG_ON(err);
1056}
1057
1058/**
1027 * skb_orphan - orphan a buffer 1059 * skb_orphan - orphan a buffer
1028 * @skb: buffer to orphan 1060 * @skb: buffer to orphan
1029 * 1061 *
@@ -1055,9 +1087,8 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1055 kfree_skb(skb); 1087 kfree_skb(skb);
1056} 1088}
1057 1089
1058#ifndef CONFIG_HAVE_ARCH_DEV_ALLOC_SKB
1059/** 1090/**
1060 * __dev_alloc_skb - allocate an skbuff for sending 1091 * __dev_alloc_skb - allocate an skbuff for receiving
1061 * @length: length to allocate 1092 * @length: length to allocate
1062 * @gfp_mask: get_free_pages mask, passed to alloc_skb 1093 * @gfp_mask: get_free_pages mask, passed to alloc_skb
1063 * 1094 *
@@ -1066,7 +1097,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1066 * the headroom they think they need without accounting for the 1097 * the headroom they think they need without accounting for the
1067 * built in space. The built in space is used for optimisations. 1098 * built in space. The built in space is used for optimisations.
1068 * 1099 *
1069 * %NULL is returned in there is no free memory. 1100 * %NULL is returned if there is no free memory.
1070 */ 1101 */
1071static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1102static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1072 gfp_t gfp_mask) 1103 gfp_t gfp_mask)
@@ -1076,12 +1107,9 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1076 skb_reserve(skb, NET_SKB_PAD); 1107 skb_reserve(skb, NET_SKB_PAD);
1077 return skb; 1108 return skb;
1078} 1109}
1079#else
1080extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
1081#endif
1082 1110
1083/** 1111/**
1084 * dev_alloc_skb - allocate an skbuff for sending 1112 * dev_alloc_skb - allocate an skbuff for receiving
1085 * @length: length to allocate 1113 * @length: length to allocate
1086 * 1114 *
1087 * Allocate a new &sk_buff and assign it a usage count of one. The 1115 * Allocate a new &sk_buff and assign it a usage count of one. The
@@ -1089,7 +1117,7 @@ extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
1089 * the headroom they think they need without accounting for the 1117 * the headroom they think they need without accounting for the
1090 * built in space. The built in space is used for optimisations. 1118 * built in space. The built in space is used for optimisations.
1091 * 1119 *
1092 * %NULL is returned in there is no free memory. Although this function 1120 * %NULL is returned if there is no free memory. Although this function
1093 * allocates memory it can be called from an interrupt. 1121 * allocates memory it can be called from an interrupt.
1094 */ 1122 */
1095static inline struct sk_buff *dev_alloc_skb(unsigned int length) 1123static inline struct sk_buff *dev_alloc_skb(unsigned int length)
@@ -1097,6 +1125,28 @@ static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1097 return __dev_alloc_skb(length, GFP_ATOMIC); 1125 return __dev_alloc_skb(length, GFP_ATOMIC);
1098} 1126}
1099 1127
1128extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1129 unsigned int length, gfp_t gfp_mask);
1130
1131/**
1132 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
1133 * @dev: network device to receive on
1134 * @length: length to allocate
1135 *
1136 * Allocate a new &sk_buff and assign it a usage count of one. The
1137 * buffer has unspecified headroom built in. Users should allocate
1138 * the headroom they think they need without accounting for the
1139 * built in space. The built in space is used for optimisations.
1140 *
1141 * %NULL is returned if there is no free memory. Although this function
1142 * allocates memory it can be called from an interrupt.
1143 */
1144static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1145 unsigned int length)
1146{
1147 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1148}
1149
1100/** 1150/**
1101 * skb_cow - copy header of skb when it is required 1151 * skb_cow - copy header of skb when it is required
1102 * @skb: buffer to cow 1152 * @skb: buffer to cow
@@ -1212,14 +1262,14 @@ static inline int skb_linearize_cow(struct sk_buff *skb)
1212 * @len: length of data pulled 1262 * @len: length of data pulled
1213 * 1263 *
1214 * After doing a pull on a received packet, you need to call this to 1264 * After doing a pull on a received packet, you need to call this to
1215 * update the CHECKSUM_HW checksum, or set ip_summed to CHECKSUM_NONE 1265 * update the CHECKSUM_COMPLETE checksum, or set ip_summed to
1216 * so that it can be recomputed from scratch. 1266 * CHECKSUM_NONE so that it can be recomputed from scratch.
1217 */ 1267 */
1218 1268
1219static inline void skb_postpull_rcsum(struct sk_buff *skb, 1269static inline void skb_postpull_rcsum(struct sk_buff *skb,
1220 const void *start, unsigned int len) 1270 const void *start, unsigned int len)
1221{ 1271{
1222 if (skb->ip_summed == CHECKSUM_HW) 1272 if (skb->ip_summed == CHECKSUM_COMPLETE)
1223 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); 1273 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
1224} 1274}
1225 1275
@@ -1238,7 +1288,7 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1238{ 1288{
1239 if (likely(len >= skb->len)) 1289 if (likely(len >= skb->len))
1240 return 0; 1290 return 0;
1241 if (skb->ip_summed == CHECKSUM_HW) 1291 if (skb->ip_summed == CHECKSUM_COMPLETE)
1242 skb->ip_summed = CHECKSUM_NONE; 1292 skb->ip_summed = CHECKSUM_NONE;
1243 return __pskb_trim(skb, len); 1293 return __pskb_trim(skb, len);
1244} 1294}
@@ -1298,8 +1348,7 @@ extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1298extern void skb_split(struct sk_buff *skb, 1348extern void skb_split(struct sk_buff *skb,
1299 struct sk_buff *skb1, const u32 len); 1349 struct sk_buff *skb1, const u32 len);
1300 1350
1301extern void skb_release_data(struct sk_buff *skb); 1351extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1302extern struct sk_buff *skb_segment(struct sk_buff *skb, int sg);
1303 1352
1304static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1353static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1305 int len, void *buffer) 1354 int len, void *buffer)
@@ -1445,5 +1494,10 @@ static inline void skb_init_secmark(struct sk_buff *skb)
1445{ } 1494{ }
1446#endif 1495#endif
1447 1496
1497static inline int skb_is_gso(const struct sk_buff *skb)
1498{
1499 return skb_shinfo(skb)->gso_size;
1500}
1501
1448#endif /* __KERNEL__ */ 1502#endif /* __KERNEL__ */
1449#endif /* _LINUX_SKBUFF_H */ 1503#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 45ad55b70d..a96fd9310d 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -60,14 +60,13 @@ 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);
67extern void kmem_cache_free(kmem_cache_t *, void *); 67extern void kmem_cache_free(kmem_cache_t *, void *);
68extern unsigned int kmem_cache_size(kmem_cache_t *); 68extern unsigned int kmem_cache_size(kmem_cache_t *);
69extern const char *kmem_cache_name(kmem_cache_t *); 69extern const char *kmem_cache_name(kmem_cache_t *);
70extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags);
71 70
72/* Size description struct for general caches. */ 71/* Size description struct for general caches. */
73struct cache_sizes { 72struct cache_sizes {
@@ -203,7 +202,30 @@ extern int slab_is_available(void);
203 202
204#ifdef CONFIG_NUMA 203#ifdef CONFIG_NUMA
205extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); 204extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
206extern void *kmalloc_node(size_t size, gfp_t flags, int node); 205extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
206
207static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
208{
209 if (__builtin_constant_p(size)) {
210 int i = 0;
211#define CACHE(x) \
212 if (size <= x) \
213 goto found; \
214 else \
215 i++;
216#include "kmalloc_sizes.h"
217#undef CACHE
218 {
219 extern void __you_cannot_kmalloc_that_much(void);
220 __you_cannot_kmalloc_that_much();
221 }
222found:
223 return kmem_cache_alloc_node((flags & GFP_DMA) ?
224 malloc_sizes[i].cs_dmacachep :
225 malloc_sizes[i].cs_cachep, flags, node);
226 }
227 return __kmalloc_node(size, flags, node);
228}
207#else 229#else
208static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) 230static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
209{ 231{
@@ -223,12 +245,11 @@ extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr));
223/* SLOB allocator routines */ 245/* SLOB allocator routines */
224 246
225void kmem_cache_init(void); 247void kmem_cache_init(void);
226struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags);
227struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, 248struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
228 unsigned long, 249 unsigned long,
229 void (*)(void *, struct kmem_cache *, unsigned long), 250 void (*)(void *, struct kmem_cache *, unsigned long),
230 void (*)(void *, struct kmem_cache *, unsigned long)); 251 void (*)(void *, struct kmem_cache *, unsigned long));
231int kmem_cache_destroy(struct kmem_cache *c); 252void kmem_cache_destroy(struct kmem_cache *c);
232void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); 253void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
233void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 254void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
234void kmem_cache_free(struct kmem_cache *c, void *b); 255void kmem_cache_free(struct kmem_cache *c, void *b);
@@ -263,8 +284,6 @@ extern kmem_cache_t *fs_cachep;
263extern kmem_cache_t *sighand_cachep; 284extern kmem_cache_t *sighand_cachep;
264extern kmem_cache_t *bio_cachep; 285extern kmem_cache_t *bio_cachep;
265 286
266extern atomic_t slab_reclaim_pages;
267
268#endif /* __KERNEL__ */ 287#endif /* __KERNEL__ */
269 288
270#endif /* _LINUX_SLAB_H */ 289#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/smb.h b/include/linux/smb.h
index b0162208c9..f098dff93f 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -10,6 +10,7 @@
10#define _LINUX_SMB_H 10#define _LINUX_SMB_H
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/magic.h>
13 14
14enum smb_protocol { 15enum smb_protocol {
15 SMB_PROTOCOL_NONE, 16 SMB_PROTOCOL_NONE,
@@ -88,7 +89,6 @@ struct smb_fattr {
88 struct timespec f_atime; 89 struct timespec f_atime;
89 struct timespec f_mtime; 90 struct timespec f_mtime;
90 struct timespec f_ctime; 91 struct timespec f_ctime;
91 unsigned long f_blksize;
92 unsigned long f_blocks; 92 unsigned long f_blocks;
93 int f_unix; 93 int f_unix;
94}; 94};
@@ -101,8 +101,6 @@ enum smb_conn_state {
101 CONN_RETRYING /* Currently trying to reconnect */ 101 CONN_RETRYING /* Currently trying to reconnect */
102}; 102};
103 103
104#define SMB_SUPER_MAGIC 0x517B
105
106#define SMB_HEADER_LEN 37 /* includes everything up to, but not 104#define SMB_HEADER_LEN 37 /* includes everything up to, but not
107 * including smb_bcc */ 105 * including smb_bcc */
108 106
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c93c3fe430..51649987f6 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -53,6 +53,9 @@ extern void smp_cpus_done(unsigned int max_cpus);
53 */ 53 */
54int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); 54int smp_call_function(void(*func)(void *info), void *info, int retry, int wait);
55 55
56int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
57 int retry, int wait);
58
56/* 59/*
57 * Call a function on all processors 60 * Call a function on all processors
58 */ 61 */
@@ -125,4 +128,6 @@ static inline void smp_send_reschedule(int cpu) { }
125#define put_cpu() preempt_enable() 128#define put_cpu() preempt_enable()
126#define put_cpu_no_resched() preempt_enable_no_resched() 129#define put_cpu_no_resched() preempt_enable_no_resched()
127 130
131void smp_setup_processor_id(void);
132
128#endif /* __LINUX_SMP_H */ 133#endif /* __LINUX_SMP_H */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 4db25d5c7c..854aa6b543 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -155,42 +155,11 @@ enum
155 UDP_MIB_NOPORTS, /* NoPorts */ 155 UDP_MIB_NOPORTS, /* NoPorts */
156 UDP_MIB_INERRORS, /* InErrors */ 156 UDP_MIB_INERRORS, /* InErrors */
157 UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ 157 UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */
158 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */
159 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */
158 __UDP_MIB_MAX 160 __UDP_MIB_MAX
159}; 161};
160 162
161/* sctp mib definitions */
162/*
163 * draft-ietf-sigtran-sctp-mib-07.txt
164 */
165enum
166{
167 SCTP_MIB_NUM = 0,
168 SCTP_MIB_CURRESTAB, /* CurrEstab */
169 SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */
170 SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */
171 SCTP_MIB_ABORTEDS, /* Aborteds */
172 SCTP_MIB_SHUTDOWNS, /* Shutdowns */
173 SCTP_MIB_OUTOFBLUES, /* OutOfBlues */
174 SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */
175 SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */
176 SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */
177 SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */
178 SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */
179 SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */
180 SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */
181 SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */
182 SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */
183 SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */
184 SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */
185 SCTP_MIB_RTOALGORITHM, /* RtoAlgorithm */
186 SCTP_MIB_RTOMIN, /* RtoMin */
187 SCTP_MIB_RTOMAX, /* RtoMax */
188 SCTP_MIB_RTOINITIAL, /* RtoInitial */
189 SCTP_MIB_VALCOOKIELIFE, /* ValCookieLife */
190 SCTP_MIB_MAXINITRETR, /* MaxInitRetr */
191 __SCTP_MIB_MAX
192};
193
194/* linux mib definitions */ 163/* linux mib definitions */
195enum 164enum
196{ 165{
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e928c0dcc2..c8bb68099e 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -642,10 +642,14 @@ struct spi_board_info {
642 u16 bus_num; 642 u16 bus_num;
643 u16 chip_select; 643 u16 chip_select;
644 644
645 /* mode becomes spi_device.mode, and is essential for chips
646 * where the default of SPI_CS_HIGH = 0 is wrong.
647 */
648 u8 mode;
649
645 /* ... may need additional spi_device chip config data here. 650 /* ... may need additional spi_device chip config data here.
646 * avoid stuff protocol drivers can set; but include stuff 651 * avoid stuff protocol drivers can set; but include stuff
647 * needed to behave without being bound to a driver: 652 * needed to behave without being bound to a driver:
648 * - chipselect polarity
649 * - quirks like clock rate mattering when not selected 653 * - quirks like clock rate mattering when not selected
650 */ 654 */
651}; 655};
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index ae23beef9c..b800d2d68b 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -82,14 +82,40 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
82/* 82/*
83 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): 83 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them):
84 */ 84 */
85#if defined(CONFIG_SMP) 85#ifdef CONFIG_SMP
86# include <asm/spinlock.h> 86# include <asm/spinlock.h>
87#else 87#else
88# include <linux/spinlock_up.h> 88# include <linux/spinlock_up.h>
89#endif 89#endif
90 90
91#define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) 91#ifdef CONFIG_DEBUG_SPINLOCK
92#define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) 92 extern void __spin_lock_init(spinlock_t *lock, const char *name,
93 struct lock_class_key *key);
94# define spin_lock_init(lock) \
95do { \
96 static struct lock_class_key __key; \
97 \
98 __spin_lock_init((lock), #lock, &__key); \
99} while (0)
100
101#else
102# define spin_lock_init(lock) \
103 do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
104#endif
105
106#ifdef CONFIG_DEBUG_SPINLOCK
107 extern void __rwlock_init(rwlock_t *lock, const char *name,
108 struct lock_class_key *key);
109# define rwlock_init(lock) \
110do { \
111 static struct lock_class_key __key; \
112 \
113 __rwlock_init((lock), #lock, &__key); \
114} while (0)
115#else
116# define rwlock_init(lock) \
117 do { *(lock) = RW_LOCK_UNLOCKED; } while (0)
118#endif
93 119
94#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) 120#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
95 121
@@ -113,7 +139,6 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
113#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 139#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
114 extern int _raw_spin_trylock(spinlock_t *lock); 140 extern int _raw_spin_trylock(spinlock_t *lock);
115 extern void _raw_spin_unlock(spinlock_t *lock); 141 extern void _raw_spin_unlock(spinlock_t *lock);
116
117 extern void _raw_read_lock(rwlock_t *lock); 142 extern void _raw_read_lock(rwlock_t *lock);
118 extern int _raw_read_trylock(rwlock_t *lock); 143 extern int _raw_read_trylock(rwlock_t *lock);
119 extern void _raw_read_unlock(rwlock_t *lock); 144 extern void _raw_read_unlock(rwlock_t *lock);
@@ -121,17 +146,17 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
121 extern int _raw_write_trylock(rwlock_t *lock); 146 extern int _raw_write_trylock(rwlock_t *lock);
122 extern void _raw_write_unlock(rwlock_t *lock); 147 extern void _raw_write_unlock(rwlock_t *lock);
123#else 148#else
124# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
125# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
126# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) 149# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock)
127# define _raw_spin_lock_flags(lock, flags) \ 150# define _raw_spin_lock_flags(lock, flags) \
128 __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) 151 __raw_spin_lock_flags(&(lock)->raw_lock, *(flags))
152# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
153# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
129# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) 154# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock)
130# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
131# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
132# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
133# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) 155# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock)
156# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
157# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
134# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) 158# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock)
159# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
135#endif 160#endif
136 161
137#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) 162#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock)
@@ -142,11 +167,18 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
142 * 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
143 * 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.
144 */ 169 */
145#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) 170#define spin_trylock(lock) __cond_lock(lock, _spin_trylock(lock))
146#define read_trylock(lock) __cond_lock(_read_trylock(lock)) 171#define read_trylock(lock) __cond_lock(lock, _read_trylock(lock))
147#define write_trylock(lock) __cond_lock(_write_trylock(lock)) 172#define write_trylock(lock) __cond_lock(lock, _write_trylock(lock))
148 173
149#define spin_lock(lock) _spin_lock(lock) 174#define spin_lock(lock) _spin_lock(lock)
175
176#ifdef CONFIG_DEBUG_LOCK_ALLOC
177# define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass)
178#else
179# define spin_lock_nested(lock, subclass) _spin_lock(lock)
180#endif
181
150#define write_lock(lock) _write_lock(lock) 182#define write_lock(lock) _write_lock(lock)
151#define read_lock(lock) _read_lock(lock) 183#define read_lock(lock) _read_lock(lock)
152 184
@@ -172,21 +204,18 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
172/* 204/*
173 * We inline the unlock functions in the nondebug case: 205 * We inline the unlock functions in the nondebug case:
174 */ 206 */
175#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP) 207#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || \
208 !defined(CONFIG_SMP)
176# define spin_unlock(lock) _spin_unlock(lock) 209# define spin_unlock(lock) _spin_unlock(lock)
177# define read_unlock(lock) _read_unlock(lock) 210# define read_unlock(lock) _read_unlock(lock)
178# define write_unlock(lock) _write_unlock(lock) 211# define write_unlock(lock) _write_unlock(lock)
179#else
180# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
181# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock)
182# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock)
183#endif
184
185#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP)
186# define spin_unlock_irq(lock) _spin_unlock_irq(lock) 212# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
187# define read_unlock_irq(lock) _read_unlock_irq(lock) 213# define read_unlock_irq(lock) _read_unlock_irq(lock)
188# define write_unlock_irq(lock) _write_unlock_irq(lock) 214# define write_unlock_irq(lock) _write_unlock_irq(lock)
189#else 215#else
216# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
217# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock)
218# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock)
190# define spin_unlock_irq(lock) \ 219# define spin_unlock_irq(lock) \
191 do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0) 220 do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
192# define read_unlock_irq(lock) \ 221# define read_unlock_irq(lock) \
@@ -207,19 +236,19 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
207 _write_unlock_irqrestore(lock, flags) 236 _write_unlock_irqrestore(lock, flags)
208#define write_unlock_bh(lock) _write_unlock_bh(lock) 237#define write_unlock_bh(lock) _write_unlock_bh(lock)
209 238
210#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) 239#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock))
211 240
212#define spin_trylock_irq(lock) \ 241#define spin_trylock_irq(lock) \
213({ \ 242({ \
214 local_irq_disable(); \ 243 local_irq_disable(); \
215 _spin_trylock(lock) ? \ 244 spin_trylock(lock) ? \
216 1 : ({ local_irq_enable(); 0; }); \ 245 1 : ({ local_irq_enable(); 0; }); \
217}) 246})
218 247
219#define spin_trylock_irqsave(lock, flags) \ 248#define spin_trylock_irqsave(lock, flags) \
220({ \ 249({ \
221 local_irq_save(flags); \ 250 local_irq_save(flags); \
222 _spin_trylock(lock) ? \ 251 spin_trylock(lock) ? \
223 1 : ({ local_irq_restore(flags); 0; }); \ 252 1 : ({ local_irq_restore(flags); 0; }); \
224}) 253})
225 254
@@ -235,7 +264,7 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
235 */ 264 */
236extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); 265extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
237#define atomic_dec_and_lock(atomic, lock) \ 266#define atomic_dec_and_lock(atomic, lock) \
238 __cond_lock(_atomic_dec_and_lock(atomic, lock)) 267 __cond_lock(lock, _atomic_dec_and_lock(atomic, lock))
239 268
240/** 269/**
241 * 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 78e6989ffb..8828b8155e 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -19,39 +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 _read_lock(rwlock_t *lock) __acquires(rwlock_t); 23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
24void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); 24 __acquires(lock);
25void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); 25void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock);
26void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); 26void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock);
27void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); 27void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock);
28void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); 28void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(lock);
29void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); 29void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(lock);
30void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); 30void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(lock);
31void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock);
32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock);
31unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
32 __acquires(spinlock_t); 34 __acquires(lock);
33unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 35unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
34 __acquires(rwlock_t); 36 __acquires(lock);
35unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 37unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
36 __acquires(rwlock_t); 38 __acquires(lock);
37int __lockfunc _spin_trylock(spinlock_t *lock); 39int __lockfunc _spin_trylock(spinlock_t *lock);
38int __lockfunc _read_trylock(rwlock_t *lock); 40int __lockfunc _read_trylock(rwlock_t *lock);
39int __lockfunc _write_trylock(rwlock_t *lock); 41int __lockfunc _write_trylock(rwlock_t *lock);
40int __lockfunc _spin_trylock_bh(spinlock_t *lock); 42int __lockfunc _spin_trylock_bh(spinlock_t *lock);
41void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); 43void __lockfunc _spin_unlock(spinlock_t *lock) __releases(lock);
42void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); 44void __lockfunc _read_unlock(rwlock_t *lock) __releases(lock);
43void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); 45void __lockfunc _write_unlock(rwlock_t *lock) __releases(lock);
44void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); 46void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(lock);
45void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); 47void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(lock);
46void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); 48void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(lock);
47void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); 49void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(lock);
48void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); 50void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(lock);
49void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); 51void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(lock);
50void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) 52void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
51 __releases(spinlock_t); 53 __releases(lock);
52void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 54void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
53 __releases(rwlock_t); 55 __releases(lock);
54void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 56void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
55 __releases(rwlock_t); 57 __releases(lock);
56 58
57#endif /* __LINUX_SPINLOCK_API_SMP_H */ 59#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index cd81cee566..67faa044c5 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -49,6 +49,7 @@
49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0) 49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
50 50
51#define _spin_lock(lock) __LOCK(lock) 51#define _spin_lock(lock) __LOCK(lock)
52#define _spin_lock_nested(lock, subclass) __LOCK(lock)
52#define _read_lock(lock) __LOCK(lock) 53#define _read_lock(lock) __LOCK(lock)
53#define _write_lock(lock) __LOCK(lock) 54#define _write_lock(lock) __LOCK(lock)
54#define _spin_lock_bh(lock) __LOCK_BH(lock) 55#define _spin_lock_bh(lock) __LOCK_BH(lock)
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 9cb51e0703..dc5fb69e4d 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -9,6 +9,8 @@
9 * Released under the General Public License (GPL). 9 * Released under the General Public License (GPL).
10 */ 10 */
11 11
12#include <linux/lockdep.h>
13
12#if defined(CONFIG_SMP) 14#if defined(CONFIG_SMP)
13# include <asm/spinlock_types.h> 15# include <asm/spinlock_types.h>
14#else 16#else
@@ -24,6 +26,9 @@ typedef struct {
24 unsigned int magic, owner_cpu; 26 unsigned int magic, owner_cpu;
25 void *owner; 27 void *owner;
26#endif 28#endif
29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lockdep_map dep_map;
31#endif
27} spinlock_t; 32} spinlock_t;
28 33
29#define SPINLOCK_MAGIC 0xdead4ead 34#define SPINLOCK_MAGIC 0xdead4ead
@@ -37,31 +42,53 @@ typedef struct {
37 unsigned int magic, owner_cpu; 42 unsigned int magic, owner_cpu;
38 void *owner; 43 void *owner;
39#endif 44#endif
45#ifdef CONFIG_DEBUG_LOCK_ALLOC
46 struct lockdep_map dep_map;
47#endif
40} rwlock_t; 48} rwlock_t;
41 49
42#define RWLOCK_MAGIC 0xdeaf1eed 50#define RWLOCK_MAGIC 0xdeaf1eed
43 51
44#define SPINLOCK_OWNER_INIT ((void *)-1L) 52#define SPINLOCK_OWNER_INIT ((void *)-1L)
45 53
54#ifdef CONFIG_DEBUG_LOCK_ALLOC
55# define SPIN_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
56#else
57# define SPIN_DEP_MAP_INIT(lockname)
58#endif
59
60#ifdef CONFIG_DEBUG_LOCK_ALLOC
61# define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
62#else
63# define RW_DEP_MAP_INIT(lockname)
64#endif
65
46#ifdef CONFIG_DEBUG_SPINLOCK 66#ifdef CONFIG_DEBUG_SPINLOCK
47# define SPIN_LOCK_UNLOCKED \ 67# define __SPIN_LOCK_UNLOCKED(lockname) \
48 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ 68 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
49 .magic = SPINLOCK_MAGIC, \ 69 .magic = SPINLOCK_MAGIC, \
50 .owner = SPINLOCK_OWNER_INIT, \ 70 .owner = SPINLOCK_OWNER_INIT, \
51 .owner_cpu = -1 } 71 .owner_cpu = -1, \
52#define RW_LOCK_UNLOCKED \ 72 SPIN_DEP_MAP_INIT(lockname) }
73#define __RW_LOCK_UNLOCKED(lockname) \
53 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ 74 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
54 .magic = RWLOCK_MAGIC, \ 75 .magic = RWLOCK_MAGIC, \
55 .owner = SPINLOCK_OWNER_INIT, \ 76 .owner = SPINLOCK_OWNER_INIT, \
56 .owner_cpu = -1 } 77 .owner_cpu = -1, \
78 RW_DEP_MAP_INIT(lockname) }
57#else 79#else
58# define SPIN_LOCK_UNLOCKED \ 80# define __SPIN_LOCK_UNLOCKED(lockname) \
59 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED } 81 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
60#define RW_LOCK_UNLOCKED \ 82 SPIN_DEP_MAP_INIT(lockname) }
61 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED } 83#define __RW_LOCK_UNLOCKED(lockname) \
84 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
85 RW_DEP_MAP_INIT(lockname) }
62#endif 86#endif
63 87
64#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED 88#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
65#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED 89#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
90
91#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
92#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
66 93
67#endif /* __LINUX_SPINLOCK_TYPES_H */ 94#endif /* __LINUX_SPINLOCK_TYPES_H */
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index 04135b0e19..27644af20b 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -12,10 +12,14 @@
12 * Released under the General Public License (GPL). 12 * Released under the General Public License (GPL).
13 */ 13 */
14 14
15#ifdef CONFIG_DEBUG_SPINLOCK 15#if defined(CONFIG_DEBUG_SPINLOCK) || \
16 defined(CONFIG_DEBUG_LOCK_ALLOC)
16 17
17typedef struct { 18typedef struct {
18 volatile unsigned int slock; 19 volatile unsigned int slock;
20#ifdef CONFIG_DEBUG_LOCK_ALLOC
21 struct lockdep_map dep_map;
22#endif
19} raw_spinlock_t; 23} raw_spinlock_t;
20 24
21#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 25#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
@@ -30,6 +34,9 @@ typedef struct { } raw_spinlock_t;
30 34
31typedef struct { 35typedef struct {
32 /* no debug version on UP */ 36 /* no debug version on UP */
37#ifdef CONFIG_DEBUG_LOCK_ALLOC
38 struct lockdep_map dep_map;
39#endif
33} raw_rwlock_t; 40} raw_rwlock_t;
34 41
35#define __RAW_RW_LOCK_UNLOCKED { } 42#define __RAW_RW_LOCK_UNLOCKED { }
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index 31accf2f0b..ea54c4c9a4 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#ifdef CONFIG_DEBUG_SPINLOCK 20#ifdef CONFIG_DEBUG_SPINLOCK
21
22#define __raw_spin_is_locked(x) ((x)->slock == 0) 21#define __raw_spin_is_locked(x) ((x)->slock == 0)
23 22
24static inline void __raw_spin_lock(raw_spinlock_t *lock) 23static inline void __raw_spin_lock(raw_spinlock_t *lock)
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
new file mode 100644
index 0000000000..50e2b01e51
--- /dev/null
+++ b/include/linux/stacktrace.h
@@ -0,0 +1,21 @@
1#ifndef __LINUX_STACKTRACE_H
2#define __LINUX_STACKTRACE_H
3
4#ifdef CONFIG_STACKTRACE
5struct stack_trace {
6 unsigned int nr_entries, max_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 */
10};
11
12extern void save_stack_trace(struct stack_trace *trace,
13 struct task_struct *task);
14
15extern void print_stack_trace(struct stack_trace *trace, int spaces);
16#else
17# define save_stack_trace(trace, task) do { } while (0)
18# define print_stack_trace(trace) do { } while (0)
19#endif
20
21#endif
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index b3a2cadf90..ea65dfb60c 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -10,11 +10,13 @@
10#define NULL ((void *)0) 10#define NULL ((void *)0)
11#endif 11#endif
12 12
13#ifdef __KERNEL__
13#undef offsetof 14#undef offsetof
14#ifdef __compiler_offsetof 15#ifdef __compiler_offsetof
15#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) 16#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
16#else 17#else
17#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 18#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
18#endif 19#endif
20#endif /* __KERNEL__ */
19 21
20#endif 22#endif
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild
new file mode 100644
index 0000000000..fb438f158e
--- /dev/null
+++ b/include/linux/sunrpc/Kbuild
@@ -0,0 +1 @@
unifdef-y += debug.h
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index a6de332e57..862c0d8c83 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -109,13 +109,13 @@ struct rpc_credops {
109 void (*crdestroy)(struct rpc_cred *); 109 void (*crdestroy)(struct rpc_cred *);
110 110
111 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 111 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
112 u32 * (*crmarshal)(struct rpc_task *, u32 *); 112 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
113 int (*crrefresh)(struct rpc_task *); 113 int (*crrefresh)(struct rpc_task *);
114 u32 * (*crvalidate)(struct rpc_task *, u32 *); 114 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
115 int (*crwrap_req)(struct rpc_task *, kxdrproc_t, 115 int (*crwrap_req)(struct rpc_task *, kxdrproc_t,
116 void *, u32 *, void *); 116 void *, __be32 *, void *);
117 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, 117 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t,
118 void *, u32 *, void *); 118 void *, __be32 *, void *);
119}; 119};
120 120
121extern struct rpc_authops authunix_ops; 121extern struct rpc_authops authunix_ops;
@@ -134,10 +134,10 @@ struct rpc_cred * rpcauth_bindcred(struct rpc_task *);
134void rpcauth_holdcred(struct rpc_task *); 134void rpcauth_holdcred(struct rpc_task *);
135void put_rpccred(struct rpc_cred *); 135void put_rpccred(struct rpc_cred *);
136void rpcauth_unbindcred(struct rpc_task *); 136void rpcauth_unbindcred(struct rpc_task *);
137u32 * rpcauth_marshcred(struct rpc_task *, u32 *); 137__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
138u32 * rpcauth_checkverf(struct rpc_task *, u32 *); 138__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
139int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, u32 *data, void *obj); 139int 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); 140int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj);
141int rpcauth_refreshcred(struct rpc_task *); 141int rpcauth_refreshcred(struct rpc_task *);
142void rpcauth_invalcred(struct rpc_task *); 142void rpcauth_invalcred(struct rpc_task *);
143int rpcauth_uptodatecred(struct rpc_task *); 143int rpcauth_uptodatecred(struct rpc_task *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8fe9f35eba..f6d1d646ce 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -18,18 +18,6 @@
18#include <linux/sunrpc/timer.h> 18#include <linux/sunrpc/timer.h>
19#include <asm/signal.h> 19#include <asm/signal.h>
20 20
21/*
22 * This defines an RPC port mapping
23 */
24struct rpc_portmap {
25 __u32 pm_prog;
26 __u32 pm_vers;
27 __u32 pm_prot;
28 __u16 pm_port;
29 unsigned char pm_binding : 1; /* doing a getport() */
30 struct rpc_wait_queue pm_bindwait; /* waiting on getport() */
31};
32
33struct rpc_inode; 21struct rpc_inode;
34 22
35/* 23/*
@@ -40,7 +28,9 @@ struct rpc_clnt {
40 atomic_t cl_users; /* number of references */ 28 atomic_t cl_users; /* number of references */
41 struct rpc_xprt * cl_xprt; /* transport */ 29 struct rpc_xprt * cl_xprt; /* transport */
42 struct rpc_procinfo * cl_procinfo; /* procedure info */ 30 struct rpc_procinfo * cl_procinfo; /* procedure info */
43 u32 cl_maxproc; /* max procedure number */ 31 u32 cl_prog, /* RPC program number */
32 cl_vers, /* RPC version number */
33 cl_maxproc; /* max procedure number */
44 34
45 char * cl_server; /* server machine name */ 35 char * cl_server; /* server machine name */
46 char * cl_protname; /* protocol name */ 36 char * cl_protname; /* protocol name */
@@ -55,7 +45,6 @@ struct rpc_clnt {
55 cl_dead : 1;/* abandoned */ 45 cl_dead : 1;/* abandoned */
56 46
57 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 47 struct rpc_rtt * cl_rtt; /* RTO estimator data */
58 struct rpc_portmap * cl_pmap; /* port mapping */
59 48
60 int cl_nodelen; /* nodename length */ 49 int cl_nodelen; /* nodename length */
61 char cl_nodename[UNX_MAXNODENAME]; 50 char cl_nodename[UNX_MAXNODENAME];
@@ -64,14 +53,8 @@ struct rpc_clnt {
64 struct dentry * cl_dentry; /* inode */ 53 struct dentry * cl_dentry; /* inode */
65 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 54 struct rpc_clnt * cl_parent; /* Points to parent of clones */
66 struct rpc_rtt cl_rtt_default; 55 struct rpc_rtt cl_rtt_default;
67 struct rpc_portmap cl_pmap_default;
68 char cl_inline_name[32]; 56 char cl_inline_name[32];
69}; 57};
70#define cl_timeout cl_xprt->timeout
71#define cl_prog cl_pmap->pm_prog
72#define cl_vers cl_pmap->pm_vers
73#define cl_port cl_pmap->pm_port
74#define cl_prot cl_pmap->pm_prot
75 58
76/* 59/*
77 * General RPC program info 60 * General RPC program info
@@ -106,24 +89,36 @@ struct rpc_procinfo {
106 char * p_name; /* name of procedure */ 89 char * p_name; /* name of procedure */
107}; 90};
108 91
109#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
110#define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr)
111
112#ifdef __KERNEL__ 92#ifdef __KERNEL__
113 93
114struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, 94struct rpc_create_args {
115 struct rpc_program *info, 95 int protocol;
116 u32 version, rpc_authflavor_t authflavor); 96 struct sockaddr *address;
117struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname, 97 size_t addrsize;
118 struct rpc_program *info, 98 struct rpc_timeout *timeout;
119 u32 version, rpc_authflavor_t authflavor); 99 char *servername;
100 struct rpc_program *program;
101 u32 version;
102 rpc_authflavor_t authflavor;
103 unsigned long flags;
104};
105
106/* Values for "flags" field */
107#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
108#define RPC_CLNT_CREATE_INTR (1UL << 1)
109#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
110#define RPC_CLNT_CREATE_ONESHOT (1UL << 3)
111#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4)
112#define RPC_CLNT_CREATE_NOPING (1UL << 5)
113
114struct rpc_clnt *rpc_create(struct rpc_create_args *args);
120struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 115struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
121 struct rpc_program *, int); 116 struct rpc_program *, int);
122struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 117struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
123int rpc_shutdown_client(struct rpc_clnt *); 118int rpc_shutdown_client(struct rpc_clnt *);
124int rpc_destroy_client(struct rpc_clnt *); 119int rpc_destroy_client(struct rpc_clnt *);
125void rpc_release_client(struct rpc_clnt *); 120void rpc_release_client(struct rpc_clnt *);
126void rpc_getport(struct rpc_task *, struct rpc_clnt *); 121void rpc_getport(struct rpc_task *);
127int rpc_register(u32, u32, int, unsigned short, int *); 122int rpc_register(u32, u32, int, unsigned short, int *);
128 123
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 124void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
@@ -140,6 +135,8 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
140size_t rpc_max_payload(struct rpc_clnt *); 135size_t rpc_max_payload(struct rpc_clnt *);
141void rpc_force_rebind(struct rpc_clnt *); 136void rpc_force_rebind(struct rpc_clnt *);
142int rpc_ping(struct rpc_clnt *clnt, int flags); 137int rpc_ping(struct rpc_clnt *clnt, int flags);
138size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
139char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
143 140
144/* 141/*
145 * Helper function for NFSroot support 142 * Helper function for NFSroot support
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 9b8bcf125c..6e112cc5cd 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -126,7 +126,7 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
126/* Just increments the mechanism's reference count and returns its input: */ 126/* Just increments the mechanism's reference count and returns its input: */
127struct gss_api_mech * gss_mech_get(struct gss_api_mech *); 127struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
128 128
129/* For every succesful gss_mech_get or gss_mech_get_by_* call there must be a 129/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
130 * corresponding call to gss_mech_put. */ 130 * corresponding call to gss_mech_put. */
131void gss_mech_put(struct gss_api_mech *); 131void gss_mech_put(struct gss_api_mech *);
132 132
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 1279280d71..e30ba20191 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -46,8 +46,8 @@ struct krb5_ctx {
46 unsigned char seed[16]; 46 unsigned char seed[16];
47 int signalg; 47 int signalg;
48 int sealalg; 48 int sealalg;
49 struct crypto_tfm *enc; 49 struct crypto_blkcipher *enc;
50 struct crypto_tfm *seq; 50 struct crypto_blkcipher *seq;
51 s32 endtime; 51 s32 endtime;
52 u32 seq_send; 52 u32 seq_send;
53 struct xdr_netobj mech_used; 53 struct xdr_netobj mech_used;
@@ -136,26 +136,27 @@ gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset,
136 136
137 137
138u32 138u32
139krb5_encrypt(struct crypto_tfm * key, 139krb5_encrypt(struct crypto_blkcipher *key,
140 void *iv, void *in, void *out, int length); 140 void *iv, void *in, void *out, int length);
141 141
142u32 142u32
143krb5_decrypt(struct crypto_tfm * key, 143krb5_decrypt(struct crypto_blkcipher *key,
144 void *iv, void *in, void *out, int length); 144 void *iv, void *in, void *out, int length);
145 145
146int 146int
147gss_encrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *outbuf, int offset, 147gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *outbuf,
148 struct page **pages); 148 int offset, struct page **pages);
149 149
150int 150int
151gss_decrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *inbuf, int offset); 151gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
152 int offset);
152 153
153s32 154s32
154krb5_make_seq_num(struct crypto_tfm * key, 155krb5_make_seq_num(struct crypto_blkcipher *key,
155 int direction, 156 int direction,
156 s32 seqnum, unsigned char *cksum, unsigned char *buf); 157 s32 seqnum, unsigned char *cksum, unsigned char *buf);
157 158
158s32 159s32
159krb5_get_seq_num(struct crypto_tfm * key, 160krb5_get_seq_num(struct crypto_blkcipher *key,
160 unsigned char *cksum, 161 unsigned char *cksum,
161 unsigned char *buf, int *direction, s32 * seqnum); 162 unsigned char *buf, int *direction, s32 * seqnum);
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 336e218c27..2cf3fbb40b 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -19,9 +19,9 @@ struct spkm3_ctx {
19 unsigned int req_flags ; 19 unsigned int req_flags ;
20 struct xdr_netobj share_key; 20 struct xdr_netobj share_key;
21 int conf_alg; 21 int conf_alg;
22 struct crypto_tfm* derived_conf_key; 22 struct crypto_blkcipher *derived_conf_key;
23 int intg_alg; 23 int intg_alg;
24 struct crypto_tfm* derived_integ_key; 24 struct crypto_blkcipher *derived_integ_key;
25 int keyestb_alg; /* alg used to get share_key */ 25 int keyestb_alg; /* alg used to get share_key */
26 int owf_alg; /* one way function */ 26 int owf_alg; /* one way function */
27}; 27};
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index f43f237360..d9f5934ac9 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -95,7 +95,7 @@ enum rpc_auth_stat {
95 * 2GB. 95 * 2GB.
96 */ 96 */
97 97
98typedef u32 rpc_fraghdr; 98typedef __be32 rpc_fraghdr;
99 99
100#define RPC_LAST_STREAM_FRAGMENT (1U << 31) 100#define RPC_LAST_STREAM_FRAGMENT (1U << 31)
101#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) 101#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT)
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 2c2189cb30..a2eb9b4a9d 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -42,9 +42,9 @@ RPC_I(struct inode *inode)
42extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 42extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
43 43
44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(char *); 45extern int rpc_rmdir(struct dentry *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(char *); 47extern int rpc_unlink(struct dentry *);
48extern struct vfsmount *rpc_get_mount(void); 48extern struct vfsmount *rpc_get_mount(void);
49extern void rpc_put_mount(void); 49extern void rpc_put_mount(void);
50 50
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 82a91bb223..f399c138f7 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -127,7 +127,6 @@ struct rpc_call_ops {
127 */ 127 */
128#define RPC_TASK_ASYNC 0x0001 /* is an async task */ 128#define RPC_TASK_ASYNC 0x0001 /* is an async task */
129#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */ 129#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */
130#define RPC_TASK_CHILD 0x0008 /* is child of other task */
131#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ 130#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */
132#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ 131#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */
133#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ 132#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
@@ -136,7 +135,6 @@ struct rpc_call_ops {
136#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */ 135#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */
137 136
138#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 137#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
139#define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD)
140#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 138#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
141#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 139#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
142#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 140#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
@@ -253,7 +251,6 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
253 const struct rpc_call_ops *ops, void *data); 251 const struct rpc_call_ops *ops, void *data);
254struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, 252struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
255 const struct rpc_call_ops *ops, void *data); 253 const struct rpc_call_ops *ops, void *data);
256struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
257void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, 254void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
258 int flags, const struct rpc_call_ops *ops, 255 int flags, const struct rpc_call_ops *ops,
259 void *data); 256 void *data);
@@ -261,8 +258,6 @@ void rpc_release_task(struct rpc_task *);
261void rpc_exit_task(struct rpc_task *); 258void rpc_exit_task(struct rpc_task *);
262void rpc_killall_tasks(struct rpc_clnt *); 259void rpc_killall_tasks(struct rpc_clnt *);
263int rpc_execute(struct rpc_task *); 260int rpc_execute(struct rpc_task *);
264void rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
265 rpc_action action);
266void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 261void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
267void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 262void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
268void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 263void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 5035643845..73140ee5c6 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -78,28 +78,45 @@ struct svc_serv {
78 */ 78 */
79#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) 79#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2)
80 80
81static inline u32 svc_getu32(struct kvec *iov) 81static inline u32 svc_getnl(struct kvec *iov)
82{ 82{
83 u32 val, *vp; 83 __be32 val, *vp;
84 vp = iov->iov_base; 84 vp = iov->iov_base;
85 val = *vp++; 85 val = *vp++;
86 iov->iov_base = (void*)vp; 86 iov->iov_base = (void*)vp;
87 iov->iov_len -= sizeof(u32); 87 iov->iov_len -= sizeof(__be32);
88 return ntohl(val);
89}
90
91static inline void svc_putnl(struct kvec *iov, u32 val)
92{
93 __be32 *vp = iov->iov_base + iov->iov_len;
94 *vp = htonl(val);
95 iov->iov_len += sizeof(__be32);
96}
97
98static inline __be32 svc_getu32(struct kvec *iov)
99{
100 __be32 val, *vp;
101 vp = iov->iov_base;
102 val = *vp++;
103 iov->iov_base = (void*)vp;
104 iov->iov_len -= sizeof(__be32);
88 return val; 105 return val;
89} 106}
90 107
91static inline void svc_ungetu32(struct kvec *iov) 108static inline void svc_ungetu32(struct kvec *iov)
92{ 109{
93 u32 *vp = (u32 *)iov->iov_base; 110 __be32 *vp = (__be32 *)iov->iov_base;
94 iov->iov_base = (void *)(vp - 1); 111 iov->iov_base = (void *)(vp - 1);
95 iov->iov_len += sizeof(*vp); 112 iov->iov_len += sizeof(*vp);
96} 113}
97 114
98static inline void svc_putu32(struct kvec *iov, u32 val) 115static inline void svc_putu32(struct kvec *iov, __be32 val)
99{ 116{
100 u32 *vp = iov->iov_base + iov->iov_len; 117 __be32 *vp = iov->iov_base + iov->iov_len;
101 *vp = val; 118 *vp = val;
102 iov->iov_len += sizeof(u32); 119 iov->iov_len += sizeof(__be32);
103} 120}
104 121
105 122
@@ -130,7 +147,7 @@ struct svc_rqst {
130 short rq_arghi; /* pages available in argument page list */ 147 short rq_arghi; /* pages available in argument page list */
131 short rq_resused; /* pages used for result */ 148 short rq_resused; /* pages used for result */
132 149
133 u32 rq_xid; /* transmission id */ 150 __be32 rq_xid; /* transmission id */
134 u32 rq_prog; /* program number */ 151 u32 rq_prog; /* program number */
135 u32 rq_vers; /* program version */ 152 u32 rq_vers; /* program version */
136 u32 rq_proc; /* procedure number */ 153 u32 rq_proc; /* procedure number */
@@ -139,7 +156,7 @@ struct svc_rqst {
139 rq_secure : 1; /* secure port */ 156 rq_secure : 1; /* secure port */
140 157
141 158
142 __u32 rq_daddr; /* dest addr of request - reply from here */ 159 __be32 rq_daddr; /* dest addr of request - reply from here */
143 160
144 void * rq_argp; /* decoded arguments */ 161 void * rq_argp; /* decoded arguments */
145 void * rq_resp; /* xdr'd results */ 162 void * rq_resp; /* xdr'd results */
@@ -159,7 +176,9 @@ struct svc_rqst {
159 * determine what device number 176 * determine what device number
160 * to report (real or virtual) 177 * to report (real or virtual)
161 */ 178 */
162 179 int rq_sendfile_ok; /* turned off in gss privacy
180 * to prevent encrypting page
181 * cache pages */
163 wait_queue_head_t rq_wait; /* synchronization */ 182 wait_queue_head_t rq_wait; /* synchronization */
164}; 183};
165 184
@@ -167,7 +186,7 @@ struct svc_rqst {
167 * Check buffer bounds after decoding arguments 186 * Check buffer bounds after decoding arguments
168 */ 187 */
169static inline int 188static inline int
170xdr_argsize_check(struct svc_rqst *rqstp, u32 *p) 189xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
171{ 190{
172 char *cp = (char *)p; 191 char *cp = (char *)p;
173 struct kvec *vec = &rqstp->rq_arg.head[0]; 192 struct kvec *vec = &rqstp->rq_arg.head[0];
@@ -176,7 +195,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p)
176} 195}
177 196
178static inline int 197static inline int
179xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) 198xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
180{ 199{
181 struct kvec *vec = &rqstp->rq_res.head[0]; 200 struct kvec *vec = &rqstp->rq_res.head[0];
182 char *cp = (char*)p; 201 char *cp = (char*)p;
@@ -247,10 +266,10 @@ struct svc_deferred_req {
247 u32 prot; /* protocol (UDP or TCP) */ 266 u32 prot; /* protocol (UDP or TCP) */
248 struct sockaddr_in addr; 267 struct sockaddr_in addr;
249 struct svc_sock *svsk; /* where reply must go */ 268 struct svc_sock *svsk; /* where reply must go */
250 u32 daddr; /* where reply must come from */ 269 __be32 daddr; /* where reply must come from */
251 struct cache_deferred_req handle; 270 struct cache_deferred_req handle;
252 int argslen; 271 int argslen;
253 u32 args[0]; 272 __be32 args[0];
254}; 273};
255 274
256/* 275/*
@@ -282,7 +301,7 @@ struct svc_version {
282 * A return value of 0 means drop the request. 301 * A return value of 0 means drop the request.
283 * vs_dispatch == NULL means use default dispatcher. 302 * vs_dispatch == NULL means use default dispatcher.
284 */ 303 */
285 int (*vs_dispatch)(struct svc_rqst *, u32 *); 304 int (*vs_dispatch)(struct svc_rqst *, __be32 *);
286}; 305};
287 306
288/* 307/*
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 2fe2087edd..a6601650de 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);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 84c35d42d2..953723b09b 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,20 +180,21 @@ 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);
197 198
198#endif /* __KERNEL__ */ 199#endif /* __KERNEL__ */
199 200
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index e8bbe8118d..6cf6265807 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -12,6 +12,7 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h>
15#include <linux/sunrpc/sched.h> 16#include <linux/sunrpc/sched.h>
16#include <linux/sunrpc/xdr.h> 17#include <linux/sunrpc/xdr.h>
17 18
@@ -37,7 +38,7 @@ extern unsigned int xprt_max_resvport;
37 38
38#define RPC_MIN_RESVPORT (1U) 39#define RPC_MIN_RESVPORT (1U)
39#define RPC_MAX_RESVPORT (65535U) 40#define RPC_MAX_RESVPORT (65535U)
40#define RPC_DEF_MIN_RESVPORT (650U) 41#define RPC_DEF_MIN_RESVPORT (665U)
41#define RPC_DEF_MAX_RESVPORT (1023U) 42#define RPC_DEF_MAX_RESVPORT (1023U)
42 43
43/* 44/*
@@ -51,6 +52,14 @@ struct rpc_timeout {
51 unsigned char to_exponential; 52 unsigned char to_exponential;
52}; 53};
53 54
55enum rpc_display_format_t {
56 RPC_DISPLAY_ADDR = 0,
57 RPC_DISPLAY_PORT,
58 RPC_DISPLAY_PROTO,
59 RPC_DISPLAY_ALL,
60 RPC_DISPLAY_MAX,
61};
62
54struct rpc_task; 63struct rpc_task;
55struct rpc_xprt; 64struct rpc_xprt;
56struct seq_file; 65struct seq_file;
@@ -70,7 +79,7 @@ struct rpc_rqst {
70 * This is the private part 79 * This is the private part
71 */ 80 */
72 struct rpc_task * rq_task; /* RPC task data */ 81 struct rpc_task * rq_task; /* RPC task data */
73 __u32 rq_xid; /* request XID */ 82 __be32 rq_xid; /* request XID */
74 int rq_cong; /* has incremented xprt->cong */ 83 int rq_cong; /* has incremented xprt->cong */
75 int rq_received; /* receive completed */ 84 int rq_received; /* receive completed */
76 u32 rq_seqno; /* gss seq no. used on req. */ 85 u32 rq_seqno; /* gss seq no. used on req. */
@@ -103,8 +112,10 @@ struct rpc_rqst {
103 112
104struct rpc_xprt_ops { 113struct rpc_xprt_ops {
105 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 114 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
115 char * (*print_addr)(struct rpc_xprt *xprt, enum rpc_display_format_t format);
106 int (*reserve_xprt)(struct rpc_task *task); 116 int (*reserve_xprt)(struct rpc_task *task);
107 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 117 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
118 void (*rpcbind)(struct rpc_task *task);
108 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
109 void (*connect)(struct rpc_task *task); 120 void (*connect)(struct rpc_task *task);
110 void * (*buf_alloc)(struct rpc_task *task, size_t size); 121 void * (*buf_alloc)(struct rpc_task *task, size_t size);
@@ -119,12 +130,14 @@ struct rpc_xprt_ops {
119}; 130};
120 131
121struct rpc_xprt { 132struct rpc_xprt {
133 struct kref kref; /* Reference count */
122 struct rpc_xprt_ops * ops; /* transport methods */ 134 struct rpc_xprt_ops * ops; /* transport methods */
123 struct socket * sock; /* BSD socket layer */ 135 struct socket * sock; /* BSD socket layer */
124 struct sock * inet; /* INET layer */ 136 struct sock * inet; /* INET layer */
125 137
126 struct rpc_timeout timeout; /* timeout parms */ 138 struct rpc_timeout timeout; /* timeout parms */
127 struct sockaddr_in addr; /* server address */ 139 struct sockaddr_storage addr; /* server address */
140 size_t addrlen; /* size of server address */
128 int prot; /* IP protocol */ 141 int prot; /* IP protocol */
129 142
130 unsigned long cong; /* current congestion */ 143 unsigned long cong; /* current congestion */
@@ -138,6 +151,7 @@ struct rpc_xprt {
138 unsigned int tsh_size; /* size of transport specific 151 unsigned int tsh_size; /* size of transport specific
139 header */ 152 header */
140 153
154 struct rpc_wait_queue binding; /* requests waiting on rpcbind */
141 struct rpc_wait_queue sending; /* requests waiting to send */ 155 struct rpc_wait_queue sending; /* requests waiting to send */
142 struct rpc_wait_queue resend; /* requests waiting to resend */ 156 struct rpc_wait_queue resend; /* requests waiting to resend */
143 struct rpc_wait_queue pending; /* requests in flight */ 157 struct rpc_wait_queue pending; /* requests in flight */
@@ -157,9 +171,9 @@ struct rpc_xprt {
157 /* 171 /*
158 * State of TCP reply receive stuff 172 * State of TCP reply receive stuff
159 */ 173 */
160 u32 tcp_recm, /* Fragment header */ 174 __be32 tcp_recm, /* Fragment header */
161 tcp_xid, /* Current XID */ 175 tcp_xid; /* Current XID */
162 tcp_reclen, /* fragment length */ 176 u32 tcp_reclen, /* fragment length */
163 tcp_offset; /* fragment offset */ 177 tcp_offset; /* fragment offset */
164 unsigned long tcp_copied, /* copied to request */ 178 unsigned long tcp_copied, /* copied to request */
165 tcp_flags; 179 tcp_flags;
@@ -205,6 +219,8 @@ struct rpc_xprt {
205 void (*old_data_ready)(struct sock *, int); 219 void (*old_data_ready)(struct sock *, int);
206 void (*old_state_change)(struct sock *); 220 void (*old_state_change)(struct sock *);
207 void (*old_write_space)(struct sock *); 221 void (*old_write_space)(struct sock *);
222
223 char * address_strings[RPC_DISPLAY_MAX];
208}; 224};
209 225
210#define XPRT_LAST_FRAG (1 << 0) 226#define XPRT_LAST_FRAG (1 << 0)
@@ -217,26 +233,27 @@ struct rpc_xprt {
217/* 233/*
218 * Transport operations used by ULPs 234 * Transport operations used by ULPs
219 */ 235 */
220struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to);
221void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); 236void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
222 237
223/* 238/*
224 * Generic internal transport functions 239 * Generic internal transport functions
225 */ 240 */
241struct rpc_xprt * xprt_create_transport(int proto, struct sockaddr *addr, size_t size, struct rpc_timeout *toparms);
226void xprt_connect(struct rpc_task *task); 242void xprt_connect(struct rpc_task *task);
227void xprt_reserve(struct rpc_task *task); 243void xprt_reserve(struct rpc_task *task);
228int xprt_reserve_xprt(struct rpc_task *task); 244int xprt_reserve_xprt(struct rpc_task *task);
229int xprt_reserve_xprt_cong(struct rpc_task *task); 245int xprt_reserve_xprt_cong(struct rpc_task *task);
230int xprt_prepare_transmit(struct rpc_task *task); 246int xprt_prepare_transmit(struct rpc_task *task);
231void xprt_transmit(struct rpc_task *task); 247void xprt_transmit(struct rpc_task *task);
232void xprt_abort_transmit(struct rpc_task *task); 248void xprt_end_transmit(struct rpc_task *task);
233int xprt_adjust_timeout(struct rpc_rqst *req); 249int xprt_adjust_timeout(struct rpc_rqst *req);
234void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 250void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
235void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 251void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
236void xprt_release(struct rpc_task *task); 252void xprt_release(struct rpc_task *task);
237int xprt_destroy(struct rpc_xprt *xprt); 253struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
254void xprt_put(struct rpc_xprt *xprt);
238 255
239static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) 256static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
240{ 257{
241 return p + xprt->tsh_size; 258 return p + xprt->tsh_size;
242} 259}
@@ -251,7 +268,7 @@ void xprt_wait_for_buffer_space(struct rpc_task *task);
251void xprt_write_space(struct rpc_xprt *xprt); 268void xprt_write_space(struct rpc_xprt *xprt);
252void xprt_update_rtt(struct rpc_task *task); 269void xprt_update_rtt(struct rpc_task *task);
253void xprt_adjust_cwnd(struct rpc_task *task, int result); 270void xprt_adjust_cwnd(struct rpc_task *task, int result);
254struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid); 271struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
255void xprt_complete_rqst(struct rpc_task *task, int copied); 272void xprt_complete_rqst(struct rpc_task *task, int copied);
256void xprt_release_rqst_cong(struct rpc_task *task); 273void xprt_release_rqst_cong(struct rpc_task *task);
257void xprt_disconnect(struct rpc_xprt *xprt); 274void xprt_disconnect(struct rpc_xprt *xprt);
@@ -269,6 +286,8 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
269#define XPRT_CONNECTED (1) 286#define XPRT_CONNECTED (1)
270#define XPRT_CONNECTING (2) 287#define XPRT_CONNECTING (2)
271#define XPRT_CLOSE_WAIT (3) 288#define XPRT_CLOSE_WAIT (3)
289#define XPRT_BOUND (4)
290#define XPRT_BINDING (5)
272 291
273static inline void xprt_set_connected(struct rpc_xprt *xprt) 292static inline void xprt_set_connected(struct rpc_xprt *xprt)
274{ 293{
@@ -312,6 +331,33 @@ static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt)
312 return test_and_set_bit(XPRT_CONNECTING, &xprt->state); 331 return test_and_set_bit(XPRT_CONNECTING, &xprt->state);
313} 332}
314 333
334static inline void xprt_set_bound(struct rpc_xprt *xprt)
335{
336 test_and_set_bit(XPRT_BOUND, &xprt->state);
337}
338
339static inline int xprt_bound(struct rpc_xprt *xprt)
340{
341 return test_bit(XPRT_BOUND, &xprt->state);
342}
343
344static inline void xprt_clear_bound(struct rpc_xprt *xprt)
345{
346 clear_bit(XPRT_BOUND, &xprt->state);
347}
348
349static inline void xprt_clear_binding(struct rpc_xprt *xprt)
350{
351 smp_mb__before_clear_bit();
352 clear_bit(XPRT_BINDING, &xprt->state);
353 smp_mb__after_clear_bit();
354}
355
356static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
357{
358 return test_and_set_bit(XPRT_BINDING, &xprt->state);
359}
360
315#endif /* __KERNEL__*/ 361#endif /* __KERNEL__*/
316 362
317#endif /* _LINUX_SUNRPC_XPRT_H */ 363#endif /* _LINUX_SUNRPC_XPRT_H */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index e82cb10fb3..b1237f16ec 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -10,29 +10,11 @@
10#include <linux/pm.h> 10#include <linux/pm.h>
11 11
12/* page backup entry */ 12/* page backup entry */
13typedef struct pbe { 13struct pbe {
14 unsigned long address; /* address of the copy */ 14 unsigned long address; /* address of the copy */
15 unsigned long orig_address; /* original address of page */ 15 unsigned long orig_address; /* original address of page */
16 struct pbe *next; 16 struct pbe *next;
17} suspend_pagedir_t; 17};
18
19#define for_each_pbe(pbe, pblist) \
20 for (pbe = pblist ; pbe ; pbe = pbe->next)
21
22#define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe))
23#define PB_PAGE_SKIP (PBES_PER_PAGE-1)
24
25#define for_each_pb_page(pbe, pblist) \
26 for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)
27
28
29#define SWAP_FILENAME_MAXLENGTH 32
30
31
32extern dev_t swsusp_resume_device;
33
34/* mm/vmscan.c */
35extern int shrink_mem(void);
36 18
37/* mm/page_alloc.c */ 19/* mm/page_alloc.c */
38extern void drain_local_pages(void); 20extern void drain_local_pages(void);
@@ -53,25 +35,16 @@ static inline void pm_restore_console(void) {}
53static inline int software_suspend(void) 35static inline int software_suspend(void)
54{ 36{
55 printk("Warning: fake suspend called\n"); 37 printk("Warning: fake suspend called\n");
56 return -EPERM; 38 return -ENOSYS;
57} 39}
58#endif /* CONFIG_PM */ 40#endif /* CONFIG_PM */
59 41
60#ifdef CONFIG_SUSPEND_SMP
61extern void disable_nonboot_cpus(void);
62extern void enable_nonboot_cpus(void);
63#else
64static inline void disable_nonboot_cpus(void) {}
65static inline void enable_nonboot_cpus(void) {}
66#endif
67
68void save_processor_state(void); 42void save_processor_state(void);
69void restore_processor_state(void); 43void restore_processor_state(void);
70struct saved_context; 44struct saved_context;
71void __save_processor_state(struct saved_context *ctxt); 45void __save_processor_state(struct saved_context *ctxt);
72void __restore_processor_state(struct saved_context *ctxt); 46void __restore_processor_state(struct saved_context *ctxt);
73unsigned long get_safe_page(gfp_t gfp_mask); 47unsigned long get_safe_page(gfp_t gfp_mask);
74int swsusp_add_arch_pages(unsigned long start, unsigned long end);
75 48
76/* 49/*
77 * XXX: We try to keep some more pages free so that I/O operations succeed 50 * XXX: We try to keep some more pages free so that I/O operations succeed
diff --git a/include/linux/swap.h b/include/linux/swap.h
index dc3f3aa0c8..e7c36ba2a2 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -10,6 +10,10 @@
10#include <asm/atomic.h> 10#include <asm/atomic.h>
11#include <asm/page.h> 11#include <asm/page.h>
12 12
13struct notifier_block;
14
15struct bio;
16
13#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ 17#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
14#define SWAP_FLAG_PRIO_MASK 0x7fff 18#define SWAP_FLAG_PRIO_MASK 0x7fff
15#define SWAP_FLAG_PRIO_SHIFT 0 19#define SWAP_FLAG_PRIO_SHIFT 0
@@ -156,13 +160,14 @@ struct swap_list_t {
156 160
157/* linux/mm/oom_kill.c */ 161/* linux/mm/oom_kill.c */
158extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 162extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
163extern int register_oom_notifier(struct notifier_block *nb);
164extern int unregister_oom_notifier(struct notifier_block *nb);
159 165
160/* linux/mm/memory.c */ 166/* linux/mm/memory.c */
161extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 167extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
162 168
163/* linux/mm/page_alloc.c */ 169/* linux/mm/page_alloc.c */
164extern unsigned long totalram_pages; 170extern unsigned long totalram_pages;
165extern unsigned long totalhigh_pages;
166extern unsigned long totalreserve_pages; 171extern unsigned long totalreserve_pages;
167extern long nr_swap_pages; 172extern long nr_swap_pages;
168extern unsigned int nr_free_pages(void); 173extern unsigned int nr_free_pages(void);
@@ -189,7 +194,8 @@ extern long vm_total_pages;
189 194
190#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
191extern int zone_reclaim_mode; 196extern int zone_reclaim_mode;
192extern int zone_reclaim_interval; 197extern int sysctl_min_unmapped_ratio;
198extern int sysctl_min_slab_ratio;
193extern int zone_reclaim(struct zone *, gfp_t, unsigned int); 199extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
194#else 200#else
195#define zone_reclaim_mode 0 201#define zone_reclaim_mode 0
@@ -199,6 +205,8 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
199} 205}
200#endif 206#endif
201 207
208extern int kswapd_run(int nid);
209
202#ifdef CONFIG_MMU 210#ifdef CONFIG_MMU
203/* linux/mm/shmem.c */ 211/* linux/mm/shmem.c */
204extern int shmem_unuse(swp_entry_t entry, struct page *page); 212extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -210,7 +218,9 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
210/* linux/mm/page_io.c */ 218/* linux/mm/page_io.c */
211extern int swap_readpage(struct file *, struct page *); 219extern int swap_readpage(struct file *, struct page *);
212extern int swap_writepage(struct page *page, struct writeback_control *wbc); 220extern int swap_writepage(struct page *page, struct writeback_control *wbc);
213extern int rw_swap_page_sync(int, swp_entry_t, struct page *); 221extern int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page,
222 struct bio **bio_chain);
223extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err);
214 224
215/* linux/mm/swap_state.c */ 225/* linux/mm/swap_state.c */
216extern struct address_space swapper_space; 226extern struct address_space swapper_space;
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 2993302f79..0577f5284c 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.11 2006/02/06 21:20:29 paulkf Exp $ 4 * $Id: synclink.h,v 3.13 2006/05/23 18:25:06 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -97,6 +97,8 @@
97#define HDLC_TXIDLE_ALT_MARK_SPACE 4 97#define HDLC_TXIDLE_ALT_MARK_SPACE 4
98#define HDLC_TXIDLE_SPACE 5 98#define HDLC_TXIDLE_SPACE 5
99#define HDLC_TXIDLE_MARK 6 99#define HDLC_TXIDLE_MARK 6
100#define HDLC_TXIDLE_CUSTOM_8 0x10000000
101#define HDLC_TXIDLE_CUSTOM_16 0x20000000
100 102
101#define HDLC_ENCODING_NRZ 0 103#define HDLC_ENCODING_NRZ 0
102#define HDLC_ENCODING_NRZB 1 104#define HDLC_ENCODING_NRZB 1
@@ -170,6 +172,7 @@ typedef struct _MGSL_PARAMS
170#define SYNCLINK_GT_DEVICE_ID 0x0070 172#define SYNCLINK_GT_DEVICE_ID 0x0070
171#define SYNCLINK_GT4_DEVICE_ID 0x0080 173#define SYNCLINK_GT4_DEVICE_ID 0x0080
172#define SYNCLINK_AC_DEVICE_ID 0x0090 174#define SYNCLINK_AC_DEVICE_ID 0x0090
175#define SYNCLINK_GT2_DEVICE_ID 0x00A0
173#define MGSL_MAX_SERIAL_NUMBER 30 176#define MGSL_MAX_SERIAL_NUMBER 30
174 177
175/* 178/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 33785b79d5..2d1c3d5c83 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>
@@ -174,9 +175,9 @@ asmlinkage long sys_waitid(int which, pid_t pid,
174 int options, struct rusage __user *ru); 175 int options, struct rusage __user *ru);
175asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options); 176asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options);
176asmlinkage long sys_set_tid_address(int __user *tidptr); 177asmlinkage long sys_set_tid_address(int __user *tidptr);
177asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, 178asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
178 struct timespec __user *utime, u32 __user *uaddr2, 179 struct timespec __user *utime, u32 __user *uaddr2,
179 int val3); 180 u32 val3);
180 181
181asmlinkage long sys_init_module(void __user *umod, unsigned long len, 182asmlinkage long sys_init_module(void __user *umod, unsigned long len,
182 const char __user *uargs); 183 const char __user *uargs);
@@ -596,5 +597,6 @@ 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);
599 601
600#endif 602#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index c7132029af..1b24bd45e0 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -55,7 +55,7 @@ enum
55 CTL_KERN=1, /* General kernel info and control */ 55 CTL_KERN=1, /* General kernel info and control */
56 CTL_VM=2, /* VM management */ 56 CTL_VM=2, /* VM management */
57 CTL_NET=3, /* Networking */ 57 CTL_NET=3, /* Networking */
58 CTL_PROC=4, /* Process info */ 58 /* was CTL_PROC */
59 CTL_FS=5, /* Filesystems */ 59 CTL_FS=5, /* Filesystems */
60 CTL_DEBUG=6, /* Debugging */ 60 CTL_DEBUG=6, /* Debugging */
61 CTL_DEV=7, /* Devices */ 61 CTL_DEV=7, /* Devices */
@@ -148,9 +148,14 @@ enum
148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ 148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
149 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ 149 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
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 */
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 */
151}; 155};
152 156
153 157
158
154/* CTL_VM names: */ 159/* CTL_VM names: */
155enum 160enum
156{ 161{
@@ -185,8 +190,10 @@ enum
185 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */ 190 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
186 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ 191 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
187 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ 192 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
188 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */ 193 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
189 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 194 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
195 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
196 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
190}; 197};
191 198
192 199
@@ -407,6 +414,10 @@ enum
407 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, 414 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
408 NET_TCP_DMA_COPYBREAK=116, 415 NET_TCP_DMA_COPYBREAK=116,
409 NET_TCP_SLOW_START_AFTER_IDLE=117, 416 NET_TCP_SLOW_START_AFTER_IDLE=117,
417 NET_CIPSOV4_CACHE_ENABLE=118,
418 NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
419 NET_CIPSOV4_RBM_OPTFMT=120,
420 NET_CIPSOV4_RBM_STRICTVALID=121,
410}; 421};
411 422
412enum { 423enum {
@@ -548,6 +559,7 @@ enum {
548 NET_IPV6_ACCEPT_RA_RTR_PREF=20, 559 NET_IPV6_ACCEPT_RA_RTR_PREF=20,
549 NET_IPV6_RTR_PROBE_INTERVAL=21, 560 NET_IPV6_RTR_PROBE_INTERVAL=21,
550 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, 561 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
562 NET_IPV6_PROXY_NDP=23,
551 __NET_IPV6_MAX 563 __NET_IPV6_MAX
552}; 564};
553 565
@@ -767,8 +779,6 @@ enum {
767 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 779 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
768}; 780};
769 781
770/* CTL_PROC names: */
771
772/* CTL_FS names: */ 782/* CTL_FS names: */
773enum 783enum
774{ 784{
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 1ea5d3cda6..6d5c43d31d 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/taskstats.h b/include/linux/taskstats.h
new file mode 100644
index 0000000000..f1cb6cddd1
--- /dev/null
+++ b/include/linux/taskstats.h
@@ -0,0 +1,137 @@
1/* taskstats.h - exporting per-task statistics
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 *
6 * 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 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it would be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 */
14
15#ifndef _LINUX_TASKSTATS_H
16#define _LINUX_TASKSTATS_H
17
18/* Format for per-task data returned to userland when
19 * - a task exits
20 * - listener requests stats for a task
21 *
22 * The struct is versioned. Newer versions should only add fields to
23 * the bottom of the struct to maintain backward compatibility.
24 *
25 *
26 * To add new fields
27 * a) bump up TASKSTATS_VERSION
28 * b) add comment indicating new version number at end of struct
29 * c) add new fields after version comment; maintain 64-bit alignment
30 */
31
32#define TASKSTATS_VERSION 1
33
34struct taskstats {
35
36 /* Version 1 */
37 __u16 version;
38 __u16 padding[3]; /* Userspace should not interpret the padding
39 * field which can be replaced by useful
40 * fields if struct taskstats is extended.
41 */
42
43 /* Delay accounting fields start
44 *
45 * All values, until comment "Delay accounting fields end" are
46 * available only if delay accounting is enabled, even though the last
47 * few fields are not delays
48 *
49 * xxx_count is the number of delay values recorded
50 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
51 *
52 * xxx_delay_total wraps around to zero on overflow
53 * xxx_count incremented regardless of overflow
54 */
55
56 /* Delay waiting for cpu, while runnable
57 * count, delay_total NOT updated atomically
58 */
59 __u64 cpu_count;
60 __u64 cpu_delay_total;
61
62 /* Following four fields atomically updated using task->delays->lock */
63
64 /* Delay waiting for synchronous block I/O to complete
65 * does not account for delays in I/O submission
66 */
67 __u64 blkio_count;
68 __u64 blkio_delay_total;
69
70 /* Delay waiting for page fault I/O (swap in only) */
71 __u64 swapin_count;
72 __u64 swapin_delay_total;
73
74 /* cpu "wall-clock" running time
75 * On some architectures, value will adjust for cpu time stolen
76 * from the kernel in involuntary waits due to virtualization.
77 * Value is cumulative, in nanoseconds, without a corresponding count
78 * and wraps around to zero silently on overflow
79 */
80 __u64 cpu_run_real_total;
81
82 /* cpu "virtual" running time
83 * Uses time intervals seen by the kernel i.e. no adjustment
84 * for kernel's involuntary waits due to virtualization.
85 * Value is cumulative, in nanoseconds, without a corresponding count
86 * and wraps around to zero silently on overflow
87 */
88 __u64 cpu_run_virtual_total;
89 /* Delay accounting fields end */
90 /* version 1 ends here */
91};
92
93
94/*
95 * Commands sent from userspace
96 * Not versioned. New commands should only be inserted at the enum's end
97 * prior to __TASKSTATS_CMD_MAX
98 */
99
100enum {
101 TASKSTATS_CMD_UNSPEC = 0, /* Reserved */
102 TASKSTATS_CMD_GET, /* user->kernel request/get-response */
103 TASKSTATS_CMD_NEW, /* kernel->user event */
104 __TASKSTATS_CMD_MAX,
105};
106
107#define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1)
108
109enum {
110 TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */
111 TASKSTATS_TYPE_PID, /* Process id */
112 TASKSTATS_TYPE_TGID, /* Thread group id */
113 TASKSTATS_TYPE_STATS, /* taskstats structure */
114 TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
115 TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
116 __TASKSTATS_TYPE_MAX,
117};
118
119#define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1)
120
121enum {
122 TASKSTATS_CMD_ATTR_UNSPEC = 0,
123 TASKSTATS_CMD_ATTR_PID,
124 TASKSTATS_CMD_ATTR_TGID,
125 TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
126 TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
127 __TASKSTATS_CMD_ATTR_MAX,
128};
129
130#define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1)
131
132/* NETLINK_GENERIC related info */
133
134#define TASKSTATS_GENL_NAME "TASKSTATS"
135#define TASKSTATS_GENL_VERSION 0x1
136
137#endif /* _LINUX_TASKSTATS_H */
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
new file mode 100644
index 0000000000..16894b7edc
--- /dev/null
+++ b/include/linux/taskstats_kern.h
@@ -0,0 +1,89 @@
1/* taskstats_kern.h - kernel header for per-task statistics interface
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 */
6
7#ifndef _LINUX_TASKSTATS_KERN_H
8#define _LINUX_TASKSTATS_KERN_H
9
10#include <linux/taskstats.h>
11#include <linux/sched.h>
12#include <net/genetlink.h>
13
14#ifdef CONFIG_TASKSTATS
15extern kmem_cache_t *taskstats_cache;
16extern struct mutex taskstats_exit_mutex;
17
18static inline void taskstats_exit_free(struct taskstats *tidstats)
19{
20 if (tidstats)
21 kmem_cache_free(taskstats_cache, tidstats);
22}
23
24static inline void taskstats_tgid_init(struct signal_struct *sig)
25{
26 spin_lock_init(&sig->stats_lock);
27 sig->stats = NULL;
28}
29
30static inline void taskstats_tgid_alloc(struct signal_struct *sig)
31{
32 struct taskstats *stats;
33 unsigned long flags;
34
35 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
36 if (!stats)
37 return;
38
39 spin_lock_irqsave(&sig->stats_lock, flags);
40 if (!sig->stats) {
41 sig->stats = stats;
42 stats = NULL;
43 }
44 spin_unlock_irqrestore(&sig->stats_lock, flags);
45
46 if (stats)
47 kmem_cache_free(taskstats_cache, stats);
48}
49
50static inline void taskstats_tgid_free(struct signal_struct *sig)
51{
52 struct taskstats *stats = NULL;
53 unsigned long flags;
54
55 spin_lock_irqsave(&sig->stats_lock, flags);
56 if (sig->stats) {
57 stats = sig->stats;
58 sig->stats = NULL;
59 }
60 spin_unlock_irqrestore(&sig->stats_lock, flags);
61 if (stats)
62 kmem_cache_free(taskstats_cache, stats);
63}
64
65extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
66extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
67extern void taskstats_init_early(void);
68extern void taskstats_tgid_alloc(struct signal_struct *);
69#else
70static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
71{}
72static inline void taskstats_exit_free(struct taskstats *ptidstats)
73{}
74static inline void taskstats_exit_send(struct task_struct *tsk,
75 struct taskstats *tidstats,
76 int group_dead, unsigned int cpu)
77{}
78static inline void taskstats_tgid_init(struct signal_struct *sig)
79{}
80static inline void taskstats_tgid_alloc(struct signal_struct *sig)
81{}
82static inline void taskstats_tgid_free(struct signal_struct *sig)
83{}
84static inline void taskstats_init_early(void)
85{}
86#endif /* CONFIG_TASKSTATS */
87
88#endif
89
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
new file mode 100644
index 0000000000..78dfbac363
--- /dev/null
+++ b/include/linux/tc_act/Kbuild
@@ -0,0 +1,4 @@
1header-y += tc_gact.h
2header-y += tc_ipt.h
3header-y += tc_mirred.h
4header-y += tc_pedit.h
diff --git a/include/linux/tc_ematch/Kbuild b/include/linux/tc_ematch/Kbuild
new file mode 100644
index 0000000000..4a58a1c32a
--- /dev/null
+++ b/include/linux/tc_ematch/Kbuild
@@ -0,0 +1,4 @@
1header-y += tc_em_cmp.h
2header-y += tc_em_meta.h
3header-y += tc_em_nbyte.h
4header-y += tc_em_text.h
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8ebf497907..0e058a2d1c 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/time.h b/include/linux/time.h
index 0cd696cee9..a5b739967b 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -28,10 +28,13 @@ struct timezone {
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29 29
30/* Parameters used to convert the timespec values: */ 30/* Parameters used to convert the timespec values: */
31#define MSEC_PER_SEC 1000L 31#define MSEC_PER_SEC 1000L
32#define USEC_PER_SEC 1000000L 32#define USEC_PER_MSEC 1000L
33#define NSEC_PER_SEC 1000000000L 33#define NSEC_PER_USEC 1000L
34#define NSEC_PER_USEC 1000L 34#define NSEC_PER_MSEC 1000000L
35#define USEC_PER_SEC 1000000L
36#define NSEC_PER_SEC 1000000000L
37#define FSEC_PER_SEC 1000000000000000L
35 38
36static inline int timespec_equal(struct timespec *a, struct timespec *b) 39static inline int timespec_equal(struct timespec *a, struct timespec *b)
37{ 40{
@@ -68,6 +71,18 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
68extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); 71extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
69 72
70/* 73/*
74 * sub = lhs - rhs, in normalized form
75 */
76static inline struct timespec timespec_sub(struct timespec lhs,
77 struct timespec rhs)
78{
79 struct timespec ts_delta;
80 set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
81 lhs.tv_nsec - rhs.tv_nsec);
82 return ts_delta;
83}
84
85/*
71 * Returns true if the timespec is norm, false if denorm: 86 * Returns true if the timespec is norm, false if denorm:
72 */ 87 */
73#define timespec_valid(ts) \ 88#define timespec_valid(ts) \
@@ -77,6 +92,8 @@ extern struct timespec xtime;
77extern struct timespec wall_to_monotonic; 92extern struct timespec wall_to_monotonic;
78extern seqlock_t xtime_lock; 93extern seqlock_t xtime_lock;
79 94
95void timekeeping_init(void);
96
80static inline unsigned long get_seconds(void) 97static inline unsigned long get_seconds(void)
81{ 98{
82 return xtime.tv_sec; 99 return xtime.tv_sec;
@@ -100,6 +117,7 @@ extern int do_getitimer(int which, struct itimerval *value);
100extern void getnstimeofday(struct timespec *tv); 117extern void getnstimeofday(struct timespec *tv);
101 118
102extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 119extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
120extern int timekeeping_is_continuous(void);
103 121
104/** 122/**
105 * timespec_to_ns - Convert timespec to nanoseconds 123 * timespec_to_ns - Convert timespec to nanoseconds
@@ -142,6 +160,20 @@ extern struct timespec ns_to_timespec(const s64 nsec);
142 */ 160 */
143extern struct timeval ns_to_timeval(const s64 nsec); 161extern struct timeval ns_to_timeval(const s64 nsec);
144 162
163/**
164 * timespec_add_ns - Adds nanoseconds to a timespec
165 * @a: pointer to timespec to be incremented
166 * @ns: unsigned nanoseconds value to be added
167 */
168static inline void timespec_add_ns(struct timespec *a, u64 ns)
169{
170 ns += a->tv_nsec;
171 while(unlikely(ns >= NSEC_PER_SEC)) {
172 ns -= NSEC_PER_SEC;
173 a->tv_sec++;
174 }
175 a->tv_nsec = ns;
176}
145#endif /* __KERNEL__ */ 177#endif /* __KERNEL__ */
146 178
147#define NFDBITS __NFDBITS 179#define NFDBITS __NFDBITS
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 34d3ccff7b..d543d3871e 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -57,7 +57,6 @@
57#include <linux/time.h> 57#include <linux/time.h>
58 58
59#include <asm/param.h> 59#include <asm/param.h>
60#include <asm/timex.h>
61 60
62/* 61/*
63 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 62 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
@@ -191,6 +190,8 @@ struct timex {
191#define TIME_BAD TIME_ERROR /* bw compat */ 190#define TIME_BAD TIME_ERROR /* bw compat */
192 191
193#ifdef __KERNEL__ 192#ifdef __KERNEL__
193#include <asm/timex.h>
194
194/* 195/*
195 * kernel variables 196 * kernel variables
196 * Note: maximum error = NTP synch distance = dispersion + delay / 2; 197 * Note: maximum error = NTP synch distance = dispersion + delay / 2;
@@ -303,6 +304,8 @@ time_interpolator_reset(void)
303 304
304#endif /* !CONFIG_TIME_INTERPOLATION */ 305#endif /* !CONFIG_TIME_INTERPOLATION */
305 306
307#define TICK_LENGTH_SHIFT 32
308
306/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 309/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
307extern u64 current_tick_length(void); 310extern u64 current_tick_length(void);
308 311
diff --git a/include/linux/topology.h b/include/linux/topology.h
index a305ae2e44..ec1eca8529 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -134,7 +134,8 @@
134 .flags = SD_LOAD_BALANCE \ 134 .flags = SD_LOAD_BALANCE \
135 | SD_BALANCE_NEWIDLE \ 135 | SD_BALANCE_NEWIDLE \
136 | SD_BALANCE_EXEC \ 136 | SD_BALANCE_EXEC \
137 | SD_WAKE_AFFINE, \ 137 | SD_WAKE_AFFINE \
138 | BALANCE_FOR_POWER, \
138 .last_balance = jiffies, \ 139 .last_balance = jiffies, \
139 .balance_interval = 1, \ 140 .balance_interval = 1, \
140 .nr_balance_failed = 0, \ 141 .nr_balance_failed = 0, \
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
index 99e02ef54c..bfc84a7aec 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/tty.h b/include/linux/tty.h
index cb35ca50a0..ea4c2605f8 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -5,16 +5,6 @@
5 * 'tty.h' defines some structures used by tty_io.c and some defines. 5 * 'tty.h' defines some structures used by tty_io.c and some defines.
6 */ 6 */
7 7
8/*
9 * These constants are also useful for user-level apps (e.g., VC
10 * resizing).
11 */
12#define MIN_NR_CONSOLES 1 /* must be at least 1 */
13#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
14#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
15 /* Note: the ioctl VT_GETSTATE does not work for
16 consoles 16 and higher (since it returns a short) */
17
18#ifdef __KERNEL__ 8#ifdef __KERNEL__
19#include <linux/fs.h> 9#include <linux/fs.h>
20#include <linux/major.h> 10#include <linux/major.h>
@@ -22,7 +12,6 @@
22#include <linux/workqueue.h> 12#include <linux/workqueue.h>
23#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
24#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
25#include <linux/screen_info.h>
26#include <linux/mutex.h> 15#include <linux/mutex.h>
27 16
28#include <asm/system.h> 17#include <asm/system.h>
@@ -57,7 +46,6 @@ struct tty_buffer {
57 unsigned char *flag_buf_ptr; 46 unsigned char *flag_buf_ptr;
58 int used; 47 int used;
59 int size; 48 int size;
60 int active;
61 int commit; 49 int commit;
62 int read; 50 int read;
63 /* Data points here */ 51 /* Data points here */
@@ -71,6 +59,7 @@ struct tty_bufhead {
71 struct tty_buffer *head; /* Queue head */ 59 struct tty_buffer *head; /* Queue head */
72 struct tty_buffer *tail; /* Active buffer */ 60 struct tty_buffer *tail; /* Active buffer */
73 struct tty_buffer *free; /* Free queue head */ 61 struct tty_buffer *free; /* Free queue head */
62 int memory_used; /* Buffer space used excluding free queue */
74}; 63};
75/* 64/*
76 * The pty uses char_buf and flag_buf as a contiguous buffer 65 * The pty uses char_buf and flag_buf as a contiguous buffer
@@ -185,7 +174,7 @@ struct tty_struct {
185 struct tty_driver *driver; 174 struct tty_driver *driver;
186 int index; 175 int index;
187 struct tty_ldisc ldisc; 176 struct tty_ldisc ldisc;
188 struct semaphore termios_sem; 177 struct mutex termios_mutex;
189 struct termios *termios, *termios_locked; 178 struct termios *termios, *termios_locked;
190 char name[64]; 179 char name[64];
191 int pgrp; 180 int pgrp;
@@ -201,7 +190,6 @@ struct tty_struct {
201 struct tty_struct *link; 190 struct tty_struct *link;
202 struct fasync_struct *fasync; 191 struct fasync_struct *fasync;
203 struct tty_bufhead buf; 192 struct tty_bufhead buf;
204 int max_flip_cnt;
205 int alt_speed; /* For magic substitution of 38400 bps */ 193 int alt_speed; /* For magic substitution of 38400 bps */
206 wait_queue_head_t write_wait; 194 wait_queue_head_t write_wait;
207 wait_queue_head_t read_wait; 195 wait_queue_head_t read_wait;
@@ -259,7 +247,6 @@ struct tty_struct {
259#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 247#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
260#define TTY_PUSH 6 /* n_tty private */ 248#define TTY_PUSH 6 /* n_tty private */
261#define TTY_CLOSING 7 /* ->close() in progress */ 249#define TTY_CLOSING 7 /* ->close() in progress */
262#define TTY_DONT_FLIP 8 /* Defer buffer flip */
263#define TTY_LDISC 9 /* Line discipline attached */ 250#define TTY_LDISC 9 /* Line discipline attached */
264#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ 251#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
265#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ 252#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
@@ -272,7 +259,6 @@ struct tty_struct {
272extern void tty_write_flush(struct tty_struct *); 259extern void tty_write_flush(struct tty_struct *);
273 260
274extern struct termios tty_std_termios; 261extern struct termios tty_std_termios;
275extern int fg_console, last_console, want_console;
276 262
277extern int kmsg_redirect; 263extern int kmsg_redirect;
278 264
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b368b296d0..58c961c9e1 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -157,7 +157,6 @@ struct tty_driver {
157 struct cdev cdev; 157 struct cdev cdev;
158 struct module *owner; 158 struct module *owner;
159 const char *driver_name; 159 const char *driver_name;
160 const char *devfs_name;
161 const char *name; 160 const char *name;
162 int name_base; /* offset of printed name */ 161 int name_base; /* offset of printed name */
163 int major; /* major device number */ 162 int major; /* major device number */
@@ -242,8 +241,15 @@ void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
242 * is also a promise, if the above case is true, not to signal 241 * is also a promise, if the above case is true, not to signal
243 * overruns, either.) 242 * overruns, either.)
244 * 243 *
245 * TTY_DRIVER_NO_DEVFS --- if set, do not create devfs entries. This 244 * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
246 * is only used by tty_register_driver(). 245 * to be registered with a call to tty_register_driver() when the
246 * device is found in the system and unregistered with a call to
247 * tty_unregister_device() so the devices will be show up
248 * properly in sysfs. If not set, driver->num entries will be
249 * created by the tty core in sysfs when tty_register_driver() is
250 * called. This is to be used by drivers that have tty devices
251 * that can appear and disappear while the main tty driver is
252 * registered with the tty core.
247 * 253 *
248 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead 254 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead
249 * use dynamic memory keyed through the devpts filesystem. This 255 * use dynamic memory keyed through the devpts filesystem. This
@@ -252,7 +258,7 @@ void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
252#define TTY_DRIVER_INSTALLED 0x0001 258#define TTY_DRIVER_INSTALLED 0x0001
253#define TTY_DRIVER_RESET_TERMIOS 0x0002 259#define TTY_DRIVER_RESET_TERMIOS 0x0002
254#define TTY_DRIVER_REAL_RAW 0x0004 260#define TTY_DRIVER_REAL_RAW 0x0004
255#define TTY_DRIVER_NO_DEVFS 0x0008 261#define TTY_DRIVER_DYNAMIC_DEV 0x0008
256#define TTY_DRIVER_DEVPTS_MEM 0x0010 262#define TTY_DRIVER_DEVPTS_MEM 0x0010
257 263
258/* tty driver types */ 264/* tty driver types */
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 31548303ee..eb677cf561 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -12,7 +12,7 @@ static inline int tty_insert_flip_char(struct tty_struct *tty,
12 unsigned char ch, char flag) 12 unsigned char ch, char flag)
13{ 13{
14 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->buf.tail;
15 if (tb && tb->active && tb->used < tb->size) { 15 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 16 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 17 tb->char_buf_ptr[tb->used++] = ch;
18 return 1; 18 return 1;
diff --git a/include/linux/types.h b/include/linux/types.h
index a5e46e783f..3f235660a3 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -177,8 +177,15 @@ typedef __u64 __bitwise __be64;
177 177
178#ifdef __KERNEL__ 178#ifdef __KERNEL__
179typedef unsigned __bitwise__ gfp_t; 179typedef unsigned __bitwise__ gfp_t;
180
181#ifdef CONFIG_RESOURCES_64BIT
182typedef u64 resource_size_t;
183#else
184typedef u32 resource_size_t;
180#endif 185#endif
181 186
187#endif /* __KERNEL__ */
188
182struct ustat { 189struct ustat {
183 __kernel_daddr_t f_tfree; 190 __kernel_daddr_t f_tfree;
184 __kernel_ino_t f_tinode; 191 __kernel_ino_t f_tinode;
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 391e7ed1eb..a48d7f11c7 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 bdd39be094..014b41d1e3 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 */
@@ -46,7 +46,7 @@ struct udp_sock {
46 unsigned int corkflag; /* Cork is required */ 46 unsigned int corkflag; /* Cork is required */
47 __u16 encap_type; /* Is this an Encapsulation socket? */ 47 __u16 encap_type; /* Is this an Encapsulation socket? */
48 /* 48 /*
49 * Following member retains the infomation to create a UDP header 49 * Following member retains the information to create a UDP header
50 * when the socket is uncorked. 50 * when the socket is uncorked.
51 */ 51 */
52 __u16 len; /* total length of pending frames */ 52 __u16 len; /* total length of pending frames */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 86b5b4271b..fc62887c52 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -220,6 +220,19 @@ typedef __u16 __bitwise __fs16;
220 */ 220 */
221#define UFS_MINFREE 5 221#define UFS_MINFREE 5
222#define UFS_DEFAULTOPT UFS_OPTTIME 222#define UFS_DEFAULTOPT UFS_OPTTIME
223
224/*
225 * Debug code
226 */
227#ifdef CONFIG_UFS_DEBUG
228# define UFSD(f, a...) { \
229 printk ("UFSD (%s, %d): %s:", \
230 __FILE__, __LINE__, __FUNCTION__); \
231 printk (f, ## a); \
232 }
233#else
234# define UFSD(f, a...) /**/
235#endif
223 236
224/* 237/*
225 * Turn file system block numbers into disk block addresses. 238 * Turn file system block numbers into disk block addresses.
@@ -339,7 +352,22 @@ struct ufs2_csum_total {
339}; 352};
340 353
341/* 354/*
355 * File system flags
356 */
357#define UFS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
358#define UFS_DOSOFTDEP 0x02 /* file system using soft dependencies */
359#define UFS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
360#define UFS_INDEXDIRS 0x08 /* kernel supports indexed directories */
361#define UFS_ACLS 0x10 /* file system has ACLs enabled */
362#define UFS_MULTILABEL 0x20 /* file system is MAC multi-label */
363#define UFS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
364
365#if 0
366/*
342 * This is the actual superblock, as it is laid out on the disk. 367 * This is the actual superblock, as it is laid out on the disk.
368 * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and
369 * it may occupy several blocks, use
370 * struct ufs_super_block_(first,second,third) instead.
343 */ 371 */
344struct ufs_super_block { 372struct ufs_super_block {
345 __fs32 fs_link; /* UNUSED */ 373 __fs32 fs_link; /* UNUSED */
@@ -416,7 +444,7 @@ struct ufs_super_block {
416 __s8 fs_fmod; /* super block modified flag */ 444 __s8 fs_fmod; /* super block modified flag */
417 __s8 fs_clean; /* file system is clean flag */ 445 __s8 fs_clean; /* file system is clean flag */
418 __s8 fs_ronly; /* mounted read-only flag */ 446 __s8 fs_ronly; /* mounted read-only flag */
419 __s8 fs_flags; /* currently unused flag */ 447 __s8 fs_flags;
420 union { 448 union {
421 struct { 449 struct {
422 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */ 450 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
@@ -485,6 +513,7 @@ struct ufs_super_block {
485 __fs32 fs_magic; /* magic number */ 513 __fs32 fs_magic; /* magic number */
486 __u8 fs_space[1]; /* list of blocks for each rotation */ 514 __u8 fs_space[1]; /* list of blocks for each rotation */
487}; 515};
516#endif/*struct ufs_super_block*/
488 517
489/* 518/*
490 * Preference for optimization. 519 * Preference for optimization.
@@ -666,7 +695,7 @@ struct ufs_buffer_head {
666}; 695};
667 696
668struct ufs_cg_private_info { 697struct ufs_cg_private_info {
669 struct ufs_cylinder_group ucg; 698 struct ufs_buffer_head c_ubh;
670 __u32 c_cgx; /* number of cylidner group */ 699 __u32 c_cgx; /* number of cylidner group */
671 __u16 c_ncyl; /* number of cyl's this cg */ 700 __u16 c_ncyl; /* number of cyl's this cg */
672 __u16 c_niblk; /* number of inode blocks this cg */ 701 __u16 c_niblk; /* number of inode blocks this cg */
@@ -686,6 +715,7 @@ struct ufs_cg_private_info {
686 715
687struct ufs_sb_private_info { 716struct ufs_sb_private_info {
688 struct ufs_buffer_head s_ubh; /* buffer containing super block */ 717 struct ufs_buffer_head s_ubh; /* buffer containing super block */
718 struct ufs2_csum_total cs_total;
689 __u32 s_sblkno; /* offset of super-blocks in filesys */ 719 __u32 s_sblkno; /* offset of super-blocks in filesys */
690 __u32 s_cblkno; /* offset of cg-block in filesys */ 720 __u32 s_cblkno; /* offset of cg-block in filesys */
691 __u32 s_iblkno; /* offset of inode-blocks in filesys */ 721 __u32 s_iblkno; /* offset of inode-blocks in filesys */
@@ -824,16 +854,54 @@ struct ufs_super_block_first {
824}; 854};
825 855
826struct ufs_super_block_second { 856struct ufs_super_block_second {
827 __s8 fs_fsmnt[212]; 857 union {
828 __fs32 fs_cgrotor; 858 struct {
829 __fs32 fs_csp[UFS_MAXCSBUFS]; 859 __s8 fs_fsmnt[212];
830 __fs32 fs_maxcluster; 860 __fs32 fs_cgrotor;
831 __fs32 fs_cpc; 861 __fs32 fs_csp[UFS_MAXCSBUFS];
832 __fs16 fs_opostbl[82]; 862 __fs32 fs_maxcluster;
833}; 863 __fs32 fs_cpc;
864 __fs16 fs_opostbl[82];
865 } fs_u1;
866 struct {
867 __s8 fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212];
868 __u8 fs_volname[UFS2_MAXVOLLEN];
869 __fs64 fs_swuid;
870 __fs32 fs_pad;
871 __fs32 fs_cgrotor;
872 __fs32 fs_ocsp[UFS2_NOCSPTRS];
873 __fs32 fs_contigdirs;
874 __fs32 fs_csp;
875 __fs32 fs_maxcluster;
876 __fs32 fs_active;
877 __fs32 fs_old_cpc;
878 __fs32 fs_maxbsize;
879 __fs64 fs_sparecon64[17];
880 __fs64 fs_sblockloc;
881 __fs64 cs_ndir;
882 __fs64 cs_nbfree;
883 } fs_u2;
884 } fs_un;
885};
834 886
835struct ufs_super_block_third { 887struct ufs_super_block_third {
836 __fs16 fs_opostbl[46]; 888 union {
889 struct {
890 __fs16 fs_opostbl[46];
891 } fs_u1;
892 struct {
893 __fs64 cs_nifree; /* number of free inodes */
894 __fs64 cs_nffree; /* number of free frags */
895 __fs64 cs_numclusters; /* number of free clusters */
896 __fs64 cs_spare[3]; /* future expansion */
897 struct ufs_timeval fs_time; /* last time written */
898 __fs64 fs_size; /* number of blocks in fs */
899 __fs64 fs_dsize; /* number of data blocks in fs */
900 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
901 __fs64 fs_pendingblocks;/* blocks in process of being freed */
902 __fs32 fs_pendinginodes;/*inodes in process of being freed */
903 } fs_u2;
904 } fs_un1;
837 union { 905 union {
838 struct { 906 struct {
839 __fs32 fs_sparecon[53];/* reserved for future constants */ 907 __fs32 fs_sparecon[53];/* reserved for future constants */
@@ -861,7 +929,7 @@ struct ufs_super_block_third {
861 __fs32 fs_qfmask[2]; /* ~usb_fmask */ 929 __fs32 fs_qfmask[2]; /* ~usb_fmask */
862 __fs32 fs_state; /* file system state time stamp */ 930 __fs32 fs_state; /* file system state time stamp */
863 } fs_44; 931 } fs_44;
864 } fs_u2; 932 } fs_un2;
865 __fs32 fs_postblformat; 933 __fs32 fs_postblformat;
866 __fs32 fs_nrpos; 934 __fs32 fs_nrpos;
867 __fs32 fs_postbloff; 935 __fs32 fs_postbloff;
@@ -875,7 +943,8 @@ struct ufs_super_block_third {
875/* balloc.c */ 943/* balloc.c */
876extern void ufs_free_fragments (struct inode *, unsigned, unsigned); 944extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
877extern void ufs_free_blocks (struct inode *, unsigned, unsigned); 945extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
878extern unsigned ufs_new_fragments (struct inode *, __fs32 *, unsigned, unsigned, unsigned, int *); 946extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned,
947 unsigned, int *, struct page *);
879 948
880/* cylinder.c */ 949/* cylinder.c */
881extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned); 950extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
@@ -886,30 +955,29 @@ extern struct inode_operations ufs_dir_inode_operations;
886extern int ufs_add_link (struct dentry *, struct inode *); 955extern int ufs_add_link (struct dentry *, struct inode *);
887extern ino_t ufs_inode_by_name(struct inode *, struct dentry *); 956extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
888extern int ufs_make_empty(struct inode *, struct inode *); 957extern int ufs_make_empty(struct inode *, struct inode *);
889extern struct ufs_dir_entry * ufs_find_entry (struct dentry *, struct buffer_head **); 958extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
890extern int ufs_delete_entry (struct inode *, struct ufs_dir_entry *, struct buffer_head *); 959extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
891extern int ufs_empty_dir (struct inode *); 960extern int ufs_empty_dir (struct inode *);
892extern struct ufs_dir_entry * ufs_dotdot (struct inode *, struct buffer_head **); 961extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
893extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_head *, struct inode *); 962extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
963 struct page *page, struct inode *inode);
894 964
895/* file.c */ 965/* file.c */
896extern struct inode_operations ufs_file_inode_operations; 966extern struct inode_operations ufs_file_inode_operations;
897extern const struct file_operations ufs_file_operations; 967extern const struct file_operations ufs_file_operations;
898 968
899extern struct address_space_operations ufs_aops; 969extern const struct address_space_operations ufs_aops;
900 970
901/* ialloc.c */ 971/* ialloc.c */
902extern void ufs_free_inode (struct inode *inode); 972extern void ufs_free_inode (struct inode *inode);
903extern struct inode * ufs_new_inode (struct inode *, int); 973extern struct inode * ufs_new_inode (struct inode *, int);
904 974
905/* inode.c */ 975/* inode.c */
906extern u64 ufs_frag_map (struct inode *, sector_t);
907extern void ufs_read_inode (struct inode *); 976extern void ufs_read_inode (struct inode *);
908extern void ufs_put_inode (struct inode *); 977extern void ufs_put_inode (struct inode *);
909extern int ufs_write_inode (struct inode *, int); 978extern int ufs_write_inode (struct inode *, int);
910extern int ufs_sync_inode (struct inode *); 979extern int ufs_sync_inode (struct inode *);
911extern void ufs_delete_inode (struct inode *); 980extern void ufs_delete_inode (struct inode *);
912extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
913extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); 981extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
914extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); 982extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
915 983
@@ -925,7 +993,7 @@ extern void ufs_panic (struct super_block *, const char *, const char *, ...) __
925extern struct inode_operations ufs_fast_symlink_inode_operations; 993extern struct inode_operations ufs_fast_symlink_inode_operations;
926 994
927/* truncate.c */ 995/* truncate.c */
928extern void ufs_truncate (struct inode *); 996extern int ufs_truncate (struct inode *, loff_t);
929 997
930static inline struct ufs_sb_info *UFS_SB(struct super_block *sb) 998static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
931{ 999{
diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h
index 21665a9539..f50ce3b0cd 100644
--- a/include/linux/ufs_fs_i.h
+++ b/include/linux/ufs_fs_i.h
@@ -27,6 +27,7 @@ struct ufs_inode_info {
27 __u32 i_oeftflag; 27 __u32 i_oeftflag;
28 __u16 i_osync; 28 __u16 i_osync;
29 __u32 i_lastfrag; 29 __u32 i_lastfrag;
30 __u32 i_dir_start_lookup;
30 struct inode vfs_inode; 31 struct inode vfs_inode;
31}; 32};
32 33
diff --git a/include/linux/unwind.h b/include/linux/unwind.h
new file mode 100644
index 0000000000..ce48e2cd37
--- /dev/null
+++ b/include/linux/unwind.h
@@ -0,0 +1,127 @@
1#ifndef _LINUX_UNWIND_H
2#define _LINUX_UNWIND_H
3
4/*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
8 *
9 * A simple API for unwinding kernel stacks. This is used for
10 * debugging and error reporting purposes. The kernel doesn't need
11 * full-blown stack unwinding with all the bells and whistles, so there
12 * is not much point in implementing the full Dwarf2 unwind API.
13 */
14
15#include <linux/config.h>
16
17struct module;
18
19#ifdef CONFIG_STACK_UNWIND
20
21#include <asm/unwind.h>
22
23#ifndef ARCH_UNWIND_SECTION_NAME
24#define ARCH_UNWIND_SECTION_NAME ".eh_frame"
25#endif
26
27/*
28 * Initialize unwind support.
29 */
30extern void unwind_init(void);
31
32#ifdef CONFIG_MODULES
33
34extern void *unwind_add_table(struct module *,
35 const void *table_start,
36 unsigned long table_size);
37
38extern void unwind_remove_table(void *handle, int init_only);
39
40#endif
41
42extern int unwind_init_frame_info(struct unwind_frame_info *,
43 struct task_struct *,
44 /*const*/ struct pt_regs *);
45
46/*
47 * Prepare to unwind a blocked task.
48 */
49extern int unwind_init_blocked(struct unwind_frame_info *,
50 struct task_struct *);
51
52/*
53 * Prepare to unwind the currently running thread.
54 */
55extern int unwind_init_running(struct unwind_frame_info *,
56 asmlinkage int (*callback)(struct unwind_frame_info *,
57 void *arg),
58 void *arg);
59
60/*
61 * Unwind to previous to frame. Returns 0 if successful, negative
62 * number in case of an error.
63 */
64extern int unwind(struct unwind_frame_info *);
65
66/*
67 * Unwind until the return pointer is in user-land (or until an error
68 * occurs). Returns 0 if successful, negative number in case of
69 * error.
70 */
71extern int unwind_to_user(struct unwind_frame_info *);
72
73#else
74
75struct unwind_frame_info {};
76
77static inline void unwind_init(void) {}
78
79#ifdef CONFIG_MODULES
80
81static inline void *unwind_add_table(struct module *mod,
82 const void *table_start,
83 unsigned long table_size)
84{
85 return NULL;
86}
87
88#endif
89
90static inline void unwind_remove_table(void *handle, int init_only)
91{
92}
93
94static inline int unwind_init_frame_info(struct unwind_frame_info *info,
95 struct task_struct *tsk,
96 const struct pt_regs *regs)
97{
98 return -ENOSYS;
99}
100
101static inline int unwind_init_blocked(struct unwind_frame_info *info,
102 struct task_struct *tsk)
103{
104 return -ENOSYS;
105}
106
107static inline int unwind_init_running(struct unwind_frame_info *info,
108 asmlinkage int (*cb)(struct unwind_frame_info *,
109 void *arg),
110 void *arg)
111{
112 return -ENOSYS;
113}
114
115static inline int unwind(struct unwind_frame_info *info)
116{
117 return -ENOSYS;
118}
119
120static inline int unwind_to_user(struct unwind_frame_info *info)
121{
122 return -ENOSYS;
123}
124
125#endif
126
127#endif /* _LINUX_UNWIND_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8dead32e7e..190cc1b78f 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;
@@ -48,7 +49,7 @@ struct ep_device;
48 * @urb_list: urbs queued to this endpoint; maintained by usbcore 49 * @urb_list: urbs queued to this endpoint; maintained by usbcore
49 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 50 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
50 * with one or more transfer descriptors (TDs) per urb 51 * with one or more transfer descriptors (TDs) per urb
51 * @kobj: kobject for sysfs info 52 * @ep_dev: ep_device for sysfs info
52 * @extra: descriptors following this endpoint in the configuration 53 * @extra: descriptors following this endpoint in the configuration
53 * @extralen: how many bytes of "extra" are valid 54 * @extralen: how many bytes of "extra" are valid
54 * 55 *
@@ -102,9 +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 * @usb_dev: if an interface is bound to the USB major, this will point 110 * @class_dev: driver model's class view of this device.
107 * to the sysfs representation for that device. 111 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
112 * allowed unless the counter is 0.
108 * 113 *
109 * USB device drivers attach to interfaces on a physical device. Each 114 * USB device drivers attach to interfaces on a physical device. Each
110 * interface encapsulates a single high level function, such as feeding 115 * interface encapsulates a single high level function, such as feeding
@@ -143,8 +148,12 @@ struct usb_interface {
143 int minor; /* minor number this interface is 148 int minor; /* minor number this interface is
144 * bound to */ 149 * bound to */
145 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
146 struct device dev; /* interface specific device info */ 154 struct device dev; /* interface specific device info */
147 struct device *usb_dev; /* pointer to the usb class's device, if any */ 155 struct class_device *class_dev;
156 int pm_usage_cnt; /* usage counter for autosuspend */
148}; 157};
149#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)
150#define interface_to_usbdev(intf) \ 159#define interface_to_usbdev(intf) \
@@ -255,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
255 264
256/* ----------------------------------------------------------------------- */ 265/* ----------------------------------------------------------------------- */
257 266
258struct usb_operations;
259
260/* USB device number allocation bitmap */ 267/* USB device number allocation bitmap */
261struct usb_devmap { 268struct usb_devmap {
262 unsigned long devicemap[128 / (8*sizeof(unsigned long))]; 269 unsigned long devicemap[128 / (8*sizeof(unsigned long))];
@@ -269,6 +276,7 @@ struct usb_bus {
269 struct device *controller; /* host/master side hardware */ 276 struct device *controller; /* host/master side hardware */
270 int busnum; /* Bus number (in order of reg) */ 277 int busnum; /* Bus number (in order of reg) */
271 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? */
272 u8 otg_port; /* 0, or number of OTG/HNP port */ 280 u8 otg_port; /* 0, or number of OTG/HNP port */
273 unsigned is_b_host:1; /* true during some HNP roleswitches */ 281 unsigned is_b_host:1; /* true during some HNP roleswitches */
274 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 282 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
@@ -277,10 +285,8 @@ struct usb_bus {
277 * round-robin allocation */ 285 * round-robin allocation */
278 286
279 struct usb_devmap devmap; /* device address allocation map */ 287 struct usb_devmap devmap; /* device address allocation map */
280 struct usb_operations *op; /* Operations (specific to the HC) */
281 struct usb_device *root_hub; /* Root hub */ 288 struct usb_device *root_hub; /* Root hub */
282 struct list_head bus_list; /* list of busses */ 289 struct list_head bus_list; /* list of busses */
283 void *hcpriv; /* Host Controller private data */
284 290
285 int bandwidth_allocated; /* on this bus: how much of the time 291 int bandwidth_allocated; /* on this bus: how much of the time
286 * reserved for periodic (intr/iso) 292 * reserved for periodic (intr/iso)
@@ -295,8 +301,6 @@ struct usb_bus {
295 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 301 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
296 302
297 struct class_device *class_dev; /* class device for this bus */ 303 struct class_device *class_dev; /* class device for this bus */
298 struct kref kref; /* reference counting for this bus */
299 void (*release)(struct usb_bus *bus);
300 304
301#if defined(CONFIG_USB_MON) 305#if defined(CONFIG_USB_MON)
302 struct mon_bus *mon_bus; /* non-null when associated */ 306 struct mon_bus *mon_bus; /* non-null when associated */
@@ -351,6 +355,7 @@ struct usb_device {
351 355
352 unsigned short bus_mA; /* Current available from the bus */ 356 unsigned short bus_mA; /* Current available from the bus */
353 u8 portnum; /* Parent port number (origin 1) */ 357 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */
354 359
355 int have_langid; /* whether string_langid is valid */ 360 int have_langid; /* whether string_langid is valid */
356 int string_langid; /* language ID for strings */ 361 int string_langid; /* language ID for strings */
@@ -361,7 +366,7 @@ struct usb_device {
361 char *serial; /* iSerialNumber string, if present */ 366 char *serial; /* iSerialNumber string, if present */
362 367
363 struct list_head filelist; 368 struct list_head filelist;
364 struct device *usbfs_dev; 369 struct class_device *class_dev;
365 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 370 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
366 371
367 /* 372 /*
@@ -374,6 +379,15 @@ struct usb_device {
374 379
375 int maxchild; /* Number of ports if hub */ 380 int maxchild; /* Number of ports if hub */
376 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
377}; 391};
378#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)
379 393
@@ -385,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev);
385#define usb_unlock_device(udev) up(&(udev)->dev.sem) 399#define usb_unlock_device(udev) up(&(udev)->dev.sem)
386#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) 400#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
387extern int usb_lock_device_for_reset(struct usb_device *udev, 401extern int usb_lock_device_for_reset(struct usb_device *udev,
388 struct usb_interface *iface); 402 const struct usb_interface *iface);
389 403
390/* USB port reset for device reinitialization */ 404/* USB port reset for device reinitialization */
391extern int usb_reset_device(struct usb_device *dev); 405extern int usb_reset_device(struct usb_device *dev);
@@ -394,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev,
394 408
395extern 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);
396 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
397/*-------------------------------------------------------------------------*/ 422/*-------------------------------------------------------------------------*/
398 423
399/* for drivers using iso endpoints */ 424/* for drivers using iso endpoints */
@@ -424,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
424 449
425extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 450extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
426 int minor); 451 int minor);
427extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, 452extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
428 unsigned ifnum); 453 unsigned ifnum);
429extern struct usb_host_interface *usb_altnum_to_altsetting( 454extern struct usb_host_interface *usb_altnum_to_altsetting(
430 struct usb_interface *intf, unsigned int altnum); 455 const struct usb_interface *intf, unsigned int altnum);
431 456
432 457
433/** 458/**
@@ -465,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
465 490
466/*-------------------------------------------------------------------------*/ 491/*-------------------------------------------------------------------------*/
467 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
468#define USB_DEVICE_ID_MATCH_DEVICE \ 507#define USB_DEVICE_ID_MATCH_DEVICE \
469 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 508 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
470#define USB_DEVICE_ID_MATCH_DEV_RANGE \ 509#define USB_DEVICE_ID_MATCH_DEV_RANGE \
@@ -541,7 +580,17 @@ struct usb_dynids {
541}; 580};
542 581
543/** 582/**
544 * 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
545 * @name: The driver name should be unique among USB drivers, 594 * @name: The driver name should be unique among USB drivers,
546 * and should normally be the same as the module name. 595 * and should normally be the same as the module name.
547 * @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
@@ -568,12 +617,14 @@ struct usb_dynids {
568 * or your driver's probe function will never get called. 617 * or your driver's probe function will never get called.
569 * @dynids: used internally to hold the list of dynamically added device 618 * @dynids: used internally to hold the list of dynamically added device
570 * ids for this driver. 619 * ids for this driver.
571 * @driver: the driver model core driver structure. 620 * @drvwrap: Driver-model core structure wrapper.
572 * @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
573 * 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.
574 * 625 *
575 * USB drivers must provide a name, probe() and disconnect() methods, 626 * USB interface drivers must provide a name, probe() and disconnect()
576 * and an id_table. Other driver fields are optional. 627 * methods, and an id_table. Other driver fields are optional.
577 * 628 *
578 * 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,
579 * and specialized data may be associated with each entry. That table 630 * and specialized data may be associated with each entry. That table
@@ -607,10 +658,44 @@ struct usb_driver {
607 const struct usb_device_id *id_table; 658 const struct usb_device_id *id_table;
608 659
609 struct usb_dynids dynids; 660 struct usb_dynids dynids;
610 struct device_driver driver; 661 struct usbdrv_wrap drvwrap;
611 unsigned int no_dynamic_id:1; 662 unsigned int no_dynamic_id:1;
663 unsigned int supports_autosuspend:1;
612}; 664};
613#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)
614 699
615extern struct bus_type usb_bus_type; 700extern struct bus_type usb_bus_type;
616 701
@@ -634,13 +719,17 @@ struct usb_class_driver {
634 * use these in module_init()/module_exit() 719 * use these in module_init()/module_exit()
635 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 720 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
636 */ 721 */
637int usb_register_driver(struct usb_driver *, struct module *); 722extern int usb_register_driver(struct usb_driver *, struct module *);
638static inline int usb_register(struct usb_driver *driver) 723static inline int usb_register(struct usb_driver *driver)
639{ 724{
640 return usb_register_driver(driver, THIS_MODULE); 725 return usb_register_driver(driver, THIS_MODULE);
641} 726}
642extern void usb_deregister(struct usb_driver *); 727extern void usb_deregister(struct usb_driver *);
643 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
644extern int usb_register_dev(struct usb_interface *intf, 733extern int usb_register_dev(struct usb_interface *intf,
645 struct usb_class_driver *class_driver); 734 struct usb_class_driver *class_driver);
646extern void usb_deregister_dev(struct usb_interface *intf, 735extern void usb_deregister_dev(struct usb_interface *intf,
@@ -886,7 +975,7 @@ struct urb
886 * @setup_packet: pointer to the setup_packet buffer 975 * @setup_packet: pointer to the setup_packet buffer
887 * @transfer_buffer: pointer to the transfer buffer 976 * @transfer_buffer: pointer to the transfer buffer
888 * @buffer_length: length of the transfer buffer 977 * @buffer_length: length of the transfer buffer
889 * @complete: pointer to the usb_complete_t function 978 * @complete_fn: pointer to the usb_complete_t function
890 * @context: what to set the urb context to. 979 * @context: what to set the urb context to.
891 * 980 *
892 * Initializes a control urb with the proper information needed to submit 981 * Initializes a control urb with the proper information needed to submit
@@ -898,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
898 unsigned char *setup_packet, 987 unsigned char *setup_packet,
899 void *transfer_buffer, 988 void *transfer_buffer,
900 int buffer_length, 989 int buffer_length,
901 usb_complete_t complete, 990 usb_complete_t complete_fn,
902 void *context) 991 void *context)
903{ 992{
904 spin_lock_init(&urb->lock); 993 spin_lock_init(&urb->lock);
@@ -907,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
907 urb->setup_packet = setup_packet; 996 urb->setup_packet = setup_packet;
908 urb->transfer_buffer = transfer_buffer; 997 urb->transfer_buffer = transfer_buffer;
909 urb->transfer_buffer_length = buffer_length; 998 urb->transfer_buffer_length = buffer_length;
910 urb->complete = complete; 999 urb->complete = complete_fn;
911 urb->context = context; 1000 urb->context = context;
912} 1001}
913 1002
@@ -918,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
918 * @pipe: the endpoint pipe 1007 * @pipe: the endpoint pipe
919 * @transfer_buffer: pointer to the transfer buffer 1008 * @transfer_buffer: pointer to the transfer buffer
920 * @buffer_length: length of the transfer buffer 1009 * @buffer_length: length of the transfer buffer
921 * @complete: pointer to the usb_complete_t function 1010 * @complete_fn: pointer to the usb_complete_t function
922 * @context: what to set the urb context to. 1011 * @context: what to set the urb context to.
923 * 1012 *
924 * 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
@@ -929,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
929 unsigned int pipe, 1018 unsigned int pipe,
930 void *transfer_buffer, 1019 void *transfer_buffer,
931 int buffer_length, 1020 int buffer_length,
932 usb_complete_t complete, 1021 usb_complete_t complete_fn,
933 void *context) 1022 void *context)
934{ 1023{
935 spin_lock_init(&urb->lock); 1024 spin_lock_init(&urb->lock);
@@ -937,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
937 urb->pipe = pipe; 1026 urb->pipe = pipe;
938 urb->transfer_buffer = transfer_buffer; 1027 urb->transfer_buffer = transfer_buffer;
939 urb->transfer_buffer_length = buffer_length; 1028 urb->transfer_buffer_length = buffer_length;
940 urb->complete = complete; 1029 urb->complete = complete_fn;
941 urb->context = context; 1030 urb->context = context;
942} 1031}
943 1032
@@ -948,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
948 * @pipe: the endpoint pipe 1037 * @pipe: the endpoint pipe
949 * @transfer_buffer: pointer to the transfer buffer 1038 * @transfer_buffer: pointer to the transfer buffer
950 * @buffer_length: length of the transfer buffer 1039 * @buffer_length: length of the transfer buffer
951 * @complete: pointer to the usb_complete_t function 1040 * @complete_fn: pointer to the usb_complete_t function
952 * @context: what to set the urb context to. 1041 * @context: what to set the urb context to.
953 * @interval: what to set the urb interval to, encoded like 1042 * @interval: what to set the urb interval to, encoded like
954 * the endpoint descriptor's bInterval value. 1043 * the endpoint descriptor's bInterval value.
@@ -964,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
964 unsigned int pipe, 1053 unsigned int pipe,
965 void *transfer_buffer, 1054 void *transfer_buffer,
966 int buffer_length, 1055 int buffer_length,
967 usb_complete_t complete, 1056 usb_complete_t complete_fn,
968 void *context, 1057 void *context,
969 int interval) 1058 int interval)
970{ 1059{
@@ -973,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
973 urb->pipe = pipe; 1062 urb->pipe = pipe;
974 urb->transfer_buffer = transfer_buffer; 1063 urb->transfer_buffer = transfer_buffer;
975 urb->transfer_buffer_length = buffer_length; 1064 urb->transfer_buffer_length = buffer_length;
976 urb->complete = complete; 1065 urb->complete = complete_fn;
977 urb->context = context; 1066 urb->context = context;
978 if (dev->speed == USB_SPEED_HIGH) 1067 if (dev->speed == USB_SPEED_HIGH)
979 urb->interval = 1 << (interval - 1); 1068 urb->interval = 1 << (interval - 1);
@@ -991,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
991extern int usb_unlink_urb(struct urb *urb); 1080extern int usb_unlink_urb(struct urb *urb);
992extern void usb_kill_urb(struct urb *urb); 1081extern void usb_kill_urb(struct urb *urb);
993 1082
994#define HAVE_USB_BUFFERS
995void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1083void *usb_buffer_alloc (struct usb_device *dev, size_t size,
996 gfp_t mem_flags, dma_addr_t *dma); 1084 gfp_t mem_flags, dma_addr_t *dma);
997void usb_buffer_free (struct usb_device *dev, size_t size, 1085void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1004,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb);
1004#endif 1092#endif
1005 1093
1006struct scatterlist; 1094struct scatterlist;
1007int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, 1095int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe,
1008 struct scatterlist *sg, int nents); 1096 struct scatterlist *sg, int nents);
1009#if 0 1097#if 0
1010void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, 1098void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe,
1011 struct scatterlist *sg, int n_hw_ents); 1099 struct scatterlist *sg, int n_hw_ents);
1012#endif 1100#endif
1013void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, 1101void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe,
1014 struct scatterlist *sg, int n_hw_ents); 1102 struct scatterlist *sg, int n_hw_ents);
1015 1103
1016/*-------------------------------------------------------------------* 1104/*-------------------------------------------------------------------*
1017 * SYNCHRONOUS CALL SUPPORT * 1105 * SYNCHRONOUS CALL SUPPORT *
@@ -1039,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe);
1039extern int usb_reset_configuration(struct usb_device *dev); 1127extern int usb_reset_configuration(struct usb_device *dev);
1040extern 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);
1041 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
1042/* 1133/*
1043 * timeouts, in milliseconds, used for sending/receiving control messages 1134 * timeouts, in milliseconds, used for sending/receiving control messages
1044 * 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 0000000000..6bd235994d
--- /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 0000000000..11a97d5ffd
--- /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 f827f6e203..9897f7a818 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/serial.h b/include/linux/usb/serial.h
new file mode 100644
index 0000000000..91c983eef8
--- /dev/null
+++ b/include/linux/usb/serial.h
@@ -0,0 +1,300 @@
1/*
2 * USB Serial Converter stuff
3 *
4 * Copyright (C) 1999 - 2005
5 * Greg Kroah-Hartman (greg@kroah.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 */
12
13
14#ifndef __LINUX_USB_SERIAL_H
15#define __LINUX_USB_SERIAL_H
16
17#include <linux/kref.h>
18#include <linux/mutex.h>
19
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
22
23#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */
24
25/* parity check flag */
26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
27
28/**
29 * usb_serial_port: structure for the specific ports of a device.
30 * @serial: pointer back to the struct usb_serial owner of this port.
31 * @tty: pointer to the corresponding tty for this port.
32 * @lock: spinlock to grab when updating portions of this structure.
33 * @mutex: mutex used to synchronize serial_open() and serial_close()
34 * access for this port.
35 * @number: the number of the port (the minor number).
36 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
37 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
38 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
39 * for this port.
40 * @interrupt_out_buffer: pointer to the interrupt out buffer for this port.
41 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
42 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
43 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
44 * for this port.
45 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
46 * @read_urb: pointer to the bulk in struct urb for this port.
47 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
48 * port.
49 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
50 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
51 * @write_urb: pointer to the bulk out struct urb for this port.
52 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
53 * port.
54 * @write_wait: a wait_queue_head_t used by the port.
55 * @work: work queue entry for the line discipline waking up.
56 * @open_count: number of times this port has been opened.
57 *
58 * This structure is used by the usb-serial core and drivers for the specific
59 * ports of a device.
60 */
61struct usb_serial_port {
62 struct usb_serial * serial;
63 struct tty_struct * tty;
64 spinlock_t lock;
65 struct mutex mutex;
66 unsigned char number;
67
68 unsigned char * interrupt_in_buffer;
69 struct urb * interrupt_in_urb;
70 __u8 interrupt_in_endpointAddress;
71
72 unsigned char * interrupt_out_buffer;
73 int interrupt_out_size;
74 struct urb * interrupt_out_urb;
75 __u8 interrupt_out_endpointAddress;
76
77 unsigned char * bulk_in_buffer;
78 int bulk_in_size;
79 struct urb * read_urb;
80 __u8 bulk_in_endpointAddress;
81
82 unsigned char * bulk_out_buffer;
83 int bulk_out_size;
84 struct urb * write_urb;
85 int write_urb_busy;
86 __u8 bulk_out_endpointAddress;
87
88 wait_queue_head_t write_wait;
89 struct work_struct work;
90 int open_count;
91 struct device dev;
92};
93#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
94
95/* get and set the port private data pointer helper functions */
96static inline void *usb_get_serial_port_data (struct usb_serial_port *port)
97{
98 return dev_get_drvdata(&port->dev);
99}
100
101static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data)
102{
103 dev_set_drvdata(&port->dev, data);
104}
105
106/**
107 * usb_serial - structure used by the usb-serial core for a device
108 * @dev: pointer to the struct usb_device for this device
109 * @type: pointer to the struct usb_serial_driver for this device
110 * @interface: pointer to the struct usb_interface for this device
111 * @minor: the starting minor number for this device
112 * @num_ports: the number of ports this device has
113 * @num_interrupt_in: number of interrupt in endpoints we have
114 * @num_interrupt_out: number of interrupt out endpoints we have
115 * @num_bulk_in: number of bulk in endpoints we have
116 * @num_bulk_out: number of bulk out endpoints we have
117 * @port: array of struct usb_serial_port structures for the different ports.
118 * @private: place to put any driver specific information that is needed. The
119 * usb-serial driver is required to manage this data, the usb-serial core
120 * will not touch this. Use usb_get_serial_data() and
121 * usb_set_serial_data() to access this.
122 */
123struct usb_serial {
124 struct usb_device * dev;
125 struct usb_serial_driver * type;
126 struct usb_interface * interface;
127 unsigned char minor;
128 unsigned char num_ports;
129 unsigned char num_port_pointers;
130 char num_interrupt_in;
131 char num_interrupt_out;
132 char num_bulk_in;
133 char num_bulk_out;
134 struct usb_serial_port * port[MAX_NUM_PORTS];
135 struct kref kref;
136 void * private;
137};
138#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
139
140#define NUM_DONT_CARE (-1)
141
142/* get and set the serial private data pointer helper functions */
143static inline void *usb_get_serial_data (struct usb_serial *serial)
144{
145 return serial->private;
146}
147
148static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
149{
150 serial->private = data;
151}
152
153/**
154 * usb_serial_driver - describes a usb serial driver
155 * @description: pointer to a string that describes this driver. This string used
156 * in the syslog messages when a device is inserted or removed.
157 * @id_table: pointer to a list of usb_device_id structures that define all
158 * of the devices this structure can support.
159 * @num_interrupt_in: the number of interrupt in endpoints this device will
160 * have.
161 * @num_interrupt_out: the number of interrupt out endpoints this device will
162 * have.
163 * @num_bulk_in: the number of bulk in endpoints this device will have.
164 * @num_bulk_out: the number of bulk out endpoints this device will have.
165 * @num_ports: the number of different ports this device will have.
166 * @calc_num_ports: pointer to a function to determine how many ports this
167 * device has dynamically. It will be called after the probe()
168 * callback is called, but before attach()
169 * @probe: pointer to the driver's probe function.
170 * This will be called when the device is inserted into the system,
171 * but before the device has been fully initialized by the usb_serial
172 * subsystem. Use this function to download any firmware to the device,
173 * or any other early initialization that might be needed.
174 * Return 0 to continue on with the initialization sequence. Anything
175 * else will abort it.
176 * @attach: pointer to the driver's attach function.
177 * This will be called when the struct usb_serial structure is fully set
178 * set up. Do any local initialization of the device, or any private
179 * memory structure allocation at this point in time.
180 * @shutdown: pointer to the driver's shutdown function. This will be
181 * called when the device is removed from the system.
182 *
183 * This structure is defines a USB Serial driver. It provides all of
184 * the information that the USB serial core code needs. If the function
185 * pointers are defined, then the USB serial core code will call them when
186 * the corresponding tty port functions are called. If they are not
187 * called, the generic serial function will be used instead.
188 *
189 * The driver.owner field should be set to the module owner of this driver.
190 * The driver.name field should be set to the name of this driver (remember
191 * it will show up in sysfs, so it needs to be short and to the point.
192 * Useing the module name is a good idea.)
193 */
194struct usb_serial_driver {
195 const char *description;
196 const struct usb_device_id *id_table;
197 char num_interrupt_in;
198 char num_interrupt_out;
199 char num_bulk_in;
200 char num_bulk_out;
201 char num_ports;
202
203 struct list_head driver_list;
204 struct device_driver driver;
205
206 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
207 int (*attach) (struct usb_serial *serial);
208 int (*calc_num_ports) (struct usb_serial *serial);
209
210 void (*shutdown) (struct usb_serial *serial);
211
212 int (*port_probe) (struct usb_serial_port *port);
213 int (*port_remove) (struct usb_serial_port *port);
214
215 /* serial function calls */
216 int (*open) (struct usb_serial_port *port, struct file * filp);
217 void (*close) (struct usb_serial_port *port, struct file * filp);
218 int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count);
219 int (*write_room) (struct usb_serial_port *port);
220 int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
221 void (*set_termios) (struct usb_serial_port *port, struct termios * old);
222 void (*break_ctl) (struct usb_serial_port *port, int break_state);
223 int (*chars_in_buffer) (struct usb_serial_port *port);
224 void (*throttle) (struct usb_serial_port *port);
225 void (*unthrottle) (struct usb_serial_port *port);
226 int (*tiocmget) (struct usb_serial_port *port, struct file *file);
227 int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
228
229 void (*read_int_callback)(struct urb *urb, struct pt_regs *regs);
230 void (*write_int_callback)(struct urb *urb, struct pt_regs *regs);
231 void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs);
232 void (*write_bulk_callback)(struct urb *urb, struct pt_regs *regs);
233};
234#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver)
235
236extern int usb_serial_register(struct usb_serial_driver *driver);
237extern void usb_serial_deregister(struct usb_serial_driver *driver);
238extern void usb_serial_port_softint(struct usb_serial_port *port);
239
240extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
241extern void usb_serial_disconnect(struct usb_interface *iface);
242
243extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
244extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
245
246/* USB Serial console functions */
247#ifdef CONFIG_USB_SERIAL_CONSOLE
248extern void usb_serial_console_init (int debug, int minor);
249extern void usb_serial_console_exit (void);
250extern void usb_serial_console_disconnect(struct usb_serial *serial);
251#else
252static inline void usb_serial_console_init (int debug, int minor) { }
253static inline void usb_serial_console_exit (void) { }
254static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
255#endif
256
257/* Functions needed by other parts of the usbserial core */
258extern struct usb_serial *usb_serial_get_by_index (unsigned int minor);
259extern void usb_serial_put(struct usb_serial *serial);
260extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp);
261extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count);
262extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp);
263extern int usb_serial_generic_write_room (struct usb_serial_port *port);
264extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
265extern void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
266extern void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
267extern void usb_serial_generic_shutdown (struct usb_serial *serial);
268extern int usb_serial_generic_register (int debug);
269extern void usb_serial_generic_deregister (void);
270
271extern int usb_serial_bus_register (struct usb_serial_driver *device);
272extern void usb_serial_bus_deregister (struct usb_serial_driver *device);
273
274extern struct usb_serial_driver usb_serial_generic_device;
275extern struct bus_type usb_serial_bus_type;
276extern struct tty_driver *usb_serial_tty_driver;
277
278static inline void usb_serial_debug_data(int debug,
279 struct device *dev,
280 const char *function, int size,
281 const unsigned char *data)
282{
283 int i;
284
285 if (debug) {
286 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size);
287 for (i = 0; i < size; ++i)
288 printk ("%.2x ", data[i]);
289 printk ("\n");
290 }
291}
292
293/* Use our own dbg macro */
294#undef dbg
295#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0)
296
297
298
299#endif /* ifdef __LINUX_USB_SERIAL_H */
300
diff --git a/include/linux/usb_ch9.h b/include/linux/usb_ch9.h
index a2aacfc7af..c720d107ff 100644
--- a/include/linux/usb_ch9.h
+++ b/include/linux/usb_ch9.h
@@ -51,6 +51,9 @@
51#define USB_RECIP_INTERFACE 0x01 51#define USB_RECIP_INTERFACE 0x01
52#define USB_RECIP_ENDPOINT 0x02 52#define USB_RECIP_ENDPOINT 0x02
53#define USB_RECIP_OTHER 0x03 53#define USB_RECIP_OTHER 0x03
54/* From Wireless USB 1.0 */
55#define USB_RECIP_PORT 0x04
56#define USB_RECIP_RPIPE 0x05
54 57
55/* 58/*
56 * Standard requests, for the bRequest field of a SETUP packet. 59 * Standard requests, for the bRequest field of a SETUP packet.
@@ -73,7 +76,9 @@
73 76
74#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ 77#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
75#define USB_REQ_GET_ENCRYPTION 0x0E 78#define USB_REQ_GET_ENCRYPTION 0x0E
79#define USB_REQ_RPIPE_ABORT 0x0E
76#define USB_REQ_SET_HANDSHAKE 0x0F 80#define USB_REQ_SET_HANDSHAKE 0x0F
81#define USB_REQ_RPIPE_RESET 0x0F
77#define USB_REQ_GET_HANDSHAKE 0x10 82#define USB_REQ_GET_HANDSHAKE 0x10
78#define USB_REQ_SET_CONNECTION 0x11 83#define USB_REQ_SET_CONNECTION 0x11
79#define USB_REQ_SET_SECURITY_DATA 0x12 84#define USB_REQ_SET_SECURITY_DATA 0x12
@@ -159,6 +164,8 @@ struct usb_ctrlrequest {
159#define USB_DT_BOS 0x0f 164#define USB_DT_BOS 0x0f
160#define USB_DT_DEVICE_CAPABILITY 0x10 165#define USB_DT_DEVICE_CAPABILITY 0x10
161#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 166#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
167#define USB_DT_WIRE_ADAPTER 0x21
168#define USB_DT_RPIPE 0x22
162 169
163/* conventional codes for class-specific descriptors */ 170/* conventional codes for class-specific descriptors */
164#define USB_DT_CS_DEVICE 0x21 171#define USB_DT_CS_DEVICE 0x21
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index 1d78870ed8..e17186dbcd 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -872,9 +872,9 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
872/* utility wrapping a simple endpoint selection policy */ 872/* utility wrapping a simple endpoint selection policy */
873 873
874extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, 874extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *,
875 struct usb_endpoint_descriptor *) __init; 875 struct usb_endpoint_descriptor *) __devinit;
876 876
877extern void usb_ep_autoconfig_reset (struct usb_gadget *) __init; 877extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit;
878 878
879#endif /* __KERNEL__ */ 879#endif /* __KERNEL__ */
880 880
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 608487a62c..2ae76fe52f 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -43,6 +43,10 @@
43 /* Need delay after Command phase */ \ 43 /* Need delay after Command phase */ \
44 US_FLAG(NO_WP_DETECT, 0x00000200) \ 44 US_FLAG(NO_WP_DETECT, 0x00000200) \
45 /* Don't check for write-protect */ \ 45 /* Don't check for write-protect */ \
46 US_FLAG(MAX_SECTORS_64, 0x00000400) \
47 /* Sets max_sectors to 64 */ \
48 US_FLAG(IGNORE_DEVICE, 0x00000800) \
49 /* Don't claim device */
46 50
47#define US_FLAG(name, value) US_FL_##name = value , 51#define US_FLAG(name, value) US_FL_##name = value ,
48enum { US_DO_ALL_FLAGS }; 52enum { US_DO_ALL_FLAGS };
@@ -104,6 +108,9 @@ enum { US_DO_ALL_FLAGS };
104#ifdef CONFIG_USB_STORAGE_ALAUDA 108#ifdef CONFIG_USB_STORAGE_ALAUDA
105#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ 109#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
106#endif 110#endif
111#ifdef CONFIG_USB_STORAGE_KARMA
112#define US_PR_KARMA 0xf5 /* Rio Karma */
113#endif
107 114
108#define US_PR_DEVICE 0xff /* Use device's value */ 115#define US_PR_DEVICE 0xff /* Use device's value */
109 116
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 7b7aadb690..617d8a1c59 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -32,11 +32,10 @@
32#define _LINUX_USBDEVICE_FS_H 32#define _LINUX_USBDEVICE_FS_H
33 33
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/magic.h>
35 36
36/* --------------------------------------------------------------------- */ 37/* --------------------------------------------------------------------- */
37 38
38#define USBDEVICE_SUPER_MAGIC 0x9fa2
39
40/* usbdevfs ioctl codes */ 39/* usbdevfs ioctl codes */
41 40
42struct usbdevfs_ctrltransfer { 41struct usbdevfs_ctrltransfer {
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index dc7c621e46..4d0909e535 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -1,4 +1,4 @@
1#include <linux/version.h> 1#include <linux/utsrelease.h>
2#include <linux/module.h> 2#include <linux/module.h>
3 3
4/* Simply sanity version stamp for modules. */ 4/* Simply sanity version stamp for modules. */
@@ -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/videodev.h b/include/linux/videodev.h
index 91140091ce..8dba97a291 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -1,48 +1,20 @@
1/*
2 * Video for Linux version 1 - OBSOLETE
3 *
4 * Header file for v4l1 drivers and applications, for
5 * Linux kernels 2.2.x or 2.4.x.
6 *
7 * Provides header for legacy drivers and applications
8 *
9 * See http://linuxtv.org for more info
10 *
11 */
1#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
2#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
3 14
4#include <linux/types.h>
5
6#define HAVE_V4L1 1
7
8#include <linux/videodev2.h> 15#include <linux/videodev2.h>
9 16
10#ifdef __KERNEL__ 17#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
11
12#include <linux/mm.h>
13
14extern struct video_device* video_devdata(struct file*);
15
16#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
17static inline void
18video_device_create_file(struct video_device *vfd,
19 struct class_device_attribute *attr)
20{
21 class_device_create_file(&vfd->class_dev, attr);
22}
23static inline void
24video_device_remove_file(struct video_device *vfd,
25 struct class_device_attribute *attr)
26{
27 class_device_remove_file(&vfd->class_dev, attr);
28}
29
30#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
31/* helper functions to access driver private data. */
32static inline void *video_get_drvdata(struct video_device *dev)
33{
34 return dev->priv;
35}
36
37static inline void video_set_drvdata(struct video_device *dev, void *data)
38{
39 dev->priv = data;
40}
41#endif
42
43extern int video_exclusive_open(struct inode *inode, struct file *file);
44extern int video_exclusive_release(struct inode *inode, struct file *file);
45#endif /* __KERNEL__ */
46 18
47struct video_capability 19struct video_capability
48{ 20{
@@ -363,6 +335,9 @@ struct video_code
363#define VID_HARDWARE_SAA7114H 37 335#define VID_HARDWARE_SAA7114H 37
364#define VID_HARDWARE_SN9C102 38 336#define VID_HARDWARE_SN9C102 38
365#define VID_HARDWARE_ARV 39 337#define VID_HARDWARE_ARV 39
338
339#endif /* CONFIG_VIDEO_V4L1_COMPAT */
340
366#endif /* __LINUX_VIDEODEV_H */ 341#endif /* __LINUX_VIDEODEV_H */
367 342
368/* 343/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ad7fa9c86c..e3715d7741 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,35 +1,31 @@
1#ifndef __LINUX_VIDEODEV2_H
2#define __LINUX_VIDEODEV2_H
3/* 1/*
4 * Video for Linux Two 2 * Video for Linux Two
5 * 3 *
6 * Header file for v4l or V4L2 drivers and applications, for 4 * Header file for v4l or V4L2 drivers and applications
7 * Linux kernels 2.2.x or 2.4.x. 5 * with public API.
6 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
7 * no #if __KERNEL tests are allowed here
8 * 8 *
9 * See http://bytesex.org/v4l/ for API specs and other 9 * See http://linuxtv.org for more info
10 * v4l2 documentation.
11 * 10 *
12 * Author: Bill Dirks <bdirks@pacbell.net> 11 * Author: Bill Dirks <bdirks@pacbell.net>
13 * Justin Schoeman 12 * Justin Schoeman
14 * et al. 13 * et al.
15 */ 14 */
15#ifndef __LINUX_VIDEODEV2_H
16#define __LINUX_VIDEODEV2_H
16#ifdef __KERNEL__ 17#ifdef __KERNEL__
17#include <linux/time.h> /* need struct timeval */ 18#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h>
19#include <linux/device.h>
20#include <linux/mutex.h>
21#endif
22#include <linux/compiler.h> /* need __user */ 19#include <linux/compiler.h> /* need __user */
23 20#else
24 21#define __user
25#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */ 22#endif
26#define HAVE_V4L2 1 23#include <linux/types.h>
27 24
28/* 25/*
29 * Common stuff for both V4L1 and V4L2 26 * Common stuff for both V4L1 and V4L2
30 * Moved from videodev.h 27 * Moved from videodev.h
31 */ 28 */
32
33#define VIDEO_MAX_FRAME 32 29#define VIDEO_MAX_FRAME 32
34 30
35#define VID_TYPE_CAPTURE 1 /* Can capture */ 31#define VID_TYPE_CAPTURE 1 /* Can capture */
@@ -47,71 +43,6 @@
47#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 43#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
48#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 44#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
49 45
50#ifdef __KERNEL__
51
52/* Minor device allocation */
53#define MINOR_VFL_TYPE_GRABBER_MIN 0
54#define MINOR_VFL_TYPE_GRABBER_MAX 63
55#define MINOR_VFL_TYPE_RADIO_MIN 64
56#define MINOR_VFL_TYPE_RADIO_MAX 127
57#define MINOR_VFL_TYPE_VTX_MIN 192
58#define MINOR_VFL_TYPE_VTX_MAX 223
59#define MINOR_VFL_TYPE_VBI_MIN 224
60#define MINOR_VFL_TYPE_VBI_MAX 255
61
62#define VFL_TYPE_GRABBER 0
63#define VFL_TYPE_VBI 1
64#define VFL_TYPE_RADIO 2
65#define VFL_TYPE_VTX 3
66
67struct video_device
68{
69 /* device info */
70 struct device *dev;
71 char name[32];
72 int type; /* v4l1 */
73 int type2; /* v4l2 */
74 int hardware;
75 int minor;
76
77 /* device ops + callbacks */
78 const struct file_operations *fops;
79 void (*release)(struct video_device *vfd);
80
81
82#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
83 /* obsolete -- fops->owner is used instead */
84 struct module *owner;
85 /* dev->driver_data will be used instead some day.
86 * Use the video_{get|set}_drvdata() helper functions,
87 * so the switch over will be transparent for you.
88 * Or use {pci|usb}_{get|set}_drvdata() directly. */
89 void *priv;
90#endif
91
92 /* for videodev.c intenal usage -- please don't touch */
93 int users; /* video_exclusive_{open|close} ... */
94 struct mutex lock; /* ... helper function uses these */
95 char devfs_name[64]; /* devfs */
96 struct class_device class_dev; /* sysfs */
97};
98
99#define VIDEO_MAJOR 81
100
101extern int video_register_device(struct video_device *, int type, int nr);
102extern void video_unregister_device(struct video_device *);
103extern int video_usercopy(struct inode *inode, struct file *file,
104 unsigned int cmd, unsigned long arg,
105 int (*func)(struct inode *inode, struct file *file,
106 unsigned int cmd, void *arg));
107
108/* helper functions to alloc / release struct video_device, the
109 later can be used for video_device->release() */
110struct video_device *video_device_alloc(void);
111void video_device_release(struct video_device *vfd);
112
113#endif
114
115/* 46/*
116 * M I S C E L L A N E O U S 47 * M I S C E L L A N E O U S
117 */ 48 */
@@ -172,6 +103,8 @@ enum v4l2_ctrl_type {
172 V4L2_CTRL_TYPE_BOOLEAN = 2, 103 V4L2_CTRL_TYPE_BOOLEAN = 2,
173 V4L2_CTRL_TYPE_MENU = 3, 104 V4L2_CTRL_TYPE_MENU = 3,
174 V4L2_CTRL_TYPE_BUTTON = 4, 105 V4L2_CTRL_TYPE_BUTTON = 4,
106 V4L2_CTRL_TYPE_INTEGER64 = 5,
107 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
175}; 108};
176 109
177enum v4l2_tuner_type { 110enum v4l2_tuner_type {
@@ -270,7 +203,6 @@ struct v4l2_capability
270/* 203/*
271 * V I D E O I M A G E F O R M A T 204 * V I D E O I M A G E F O R M A T
272 */ 205 */
273
274struct v4l2_pix_format 206struct v4l2_pix_format
275{ 207{
276 __u32 width; 208 __u32 width;
@@ -283,7 +215,7 @@ struct v4l2_pix_format
283 __u32 priv; /* private data, depends on pixelformat */ 215 __u32 priv; /* private data, depends on pixelformat */
284}; 216};
285 217
286/* Pixel format FOURCC depth Description */ 218/* Pixel format FOURCC depth Description */
287#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 219#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */
288#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 220#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */
289#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 221#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */
@@ -311,6 +243,7 @@ struct v4l2_pix_format
311#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 243#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */
312#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 244#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */
313#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 245#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */
246#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:1:1 16x16 macroblocks */
314 247
315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 248/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 249#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
@@ -319,7 +252,7 @@ struct v4l2_pix_format
319#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 252#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */
320#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 253#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */
321#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 254#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */
322#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG */ 255#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */
323 256
324/* Vendor-specific formats */ 257/* Vendor-specific formats */
325#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 258#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
@@ -343,7 +276,6 @@ struct v4l2_fmtdesc
343 276
344#define V4L2_FMT_FLAG_COMPRESSED 0x0001 277#define V4L2_FMT_FLAG_COMPRESSED 0x0001
345 278
346
347/* 279/*
348 * T I M E C O D E 280 * T I M E C O D E
349 */ 281 */
@@ -373,16 +305,15 @@ struct v4l2_timecode
373#define V4L2_TC_USERBITS_8BITCHARS 0x0008 305#define V4L2_TC_USERBITS_8BITCHARS 0x0008
374/* The above is based on SMPTE timecodes */ 306/* The above is based on SMPTE timecodes */
375 307
376 308#ifdef __KERNEL__
377/* 309/*
378 * M P E G C O M P R E S S I O N P A R A M E T E R S 310 * M P E G C O M P R E S S I O N P A R A M E T E R S
379 * 311 *
380 * ### WARNING: this is still work-in-progress right now, most likely 312 * ### WARNING: This experimental MPEG compression API is obsolete.
381 * ### there will be some incompatible changes. 313 * ### It is replaced by the MPEG controls API.
314 * ### This old API will disappear in the near future!
382 * 315 *
383 */ 316 */
384
385
386enum v4l2_bitrate_mode { 317enum v4l2_bitrate_mode {
387 V4L2_BITRATE_NONE = 0, /* not specified */ 318 V4L2_BITRATE_NONE = 0, /* not specified */
388 V4L2_BITRATE_CBR, /* constant bitrate */ 319 V4L2_BITRATE_CBR, /* constant bitrate */
@@ -460,6 +391,7 @@ struct v4l2_mpeg_compression {
460 /* I don't expect the above being perfect yet ;) */ 391 /* I don't expect the above being perfect yet ;) */
461 __u32 reserved_5[8]; 392 __u32 reserved_5[8];
462}; 393};
394#endif
463 395
464struct v4l2_jpegcompression 396struct v4l2_jpegcompression
465{ 397{
@@ -491,7 +423,6 @@ struct v4l2_jpegcompression
491 * allways use APP0 */ 423 * allways use APP0 */
492}; 424};
493 425
494
495/* 426/*
496 * M E M O R Y - M A P P I N G B U F F E R S 427 * M E M O R Y - M A P P I N G B U F F E R S
497 */ 428 */
@@ -573,7 +504,6 @@ struct v4l2_window
573 void __user *bitmap; 504 void __user *bitmap;
574}; 505};
575 506
576
577/* 507/*
578 * C A P T U R E P A R A M E T E R S 508 * C A P T U R E P A R A M E T E R S
579 */ 509 */
@@ -586,6 +516,7 @@ struct v4l2_captureparm
586 __u32 readbuffers; /* # of buffers for read */ 516 __u32 readbuffers; /* # of buffers for read */
587 __u32 reserved[4]; 517 __u32 reserved[4];
588}; 518};
519
589/* Flags for 'capability' and 'capturemode' fields */ 520/* Flags for 'capability' and 'capturemode' fields */
590#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 521#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
591#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 522#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
@@ -603,7 +534,6 @@ struct v4l2_outputparm
603/* 534/*
604 * I N P U T I M A G E C R O P P I N G 535 * I N P U T I M A G E C R O P P I N G
605 */ 536 */
606
607struct v4l2_cropcap { 537struct v4l2_cropcap {
608 enum v4l2_buf_type type; 538 enum v4l2_buf_type type;
609 struct v4l2_rect bounds; 539 struct v4l2_rect bounds;
@@ -710,7 +640,6 @@ struct v4l2_standard
710 __u32 reserved[4]; 640 __u32 reserved[4];
711}; 641};
712 642
713
714/* 643/*
715 * V I D E O I N P U T S 644 * V I D E O I N P U T S
716 */ 645 */
@@ -725,6 +654,7 @@ struct v4l2_input
725 __u32 status; 654 __u32 status;
726 __u32 reserved[4]; 655 __u32 reserved[4];
727}; 656};
657
728/* Values for the 'type' field */ 658/* Values for the 'type' field */
729#define V4L2_INPUT_TYPE_TUNER 1 659#define V4L2_INPUT_TYPE_TUNER 1
730#define V4L2_INPUT_TYPE_CAMERA 2 660#define V4L2_INPUT_TYPE_CAMERA 2
@@ -775,6 +705,34 @@ struct v4l2_control
775 __s32 value; 705 __s32 value;
776}; 706};
777 707
708struct v4l2_ext_control
709{
710 __u32 id;
711 __u32 reserved2[2];
712 union {
713 __s32 value;
714 __s64 value64;
715 void *reserved;
716 };
717} __attribute__ ((packed));
718
719struct v4l2_ext_controls
720{
721 __u32 ctrl_class;
722 __u32 count;
723 __u32 error_idx;
724 __u32 reserved[2];
725 struct v4l2_ext_control *controls;
726};
727
728/* Values for ctrl_class field */
729#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
730#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
731
732#define V4L2_CTRL_ID_MASK (0x0fffffff)
733#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
734#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
735
778/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 736/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
779struct v4l2_queryctrl 737struct v4l2_queryctrl
780{ 738{
@@ -801,12 +759,21 @@ struct v4l2_querymenu
801/* Control flags */ 759/* Control flags */
802#define V4L2_CTRL_FLAG_DISABLED 0x0001 760#define V4L2_CTRL_FLAG_DISABLED 0x0001
803#define V4L2_CTRL_FLAG_GRABBED 0x0002 761#define V4L2_CTRL_FLAG_GRABBED 0x0002
762#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
763#define V4L2_CTRL_FLAG_UPDATE 0x0008
764#define V4L2_CTRL_FLAG_INACTIVE 0x0010
765#define V4L2_CTRL_FLAG_SLIDER 0x0020
766
767/* Query flag, to be ORed with the control ID */
768#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
804 769
805/* Control IDs defined by V4L2 */ 770/* User-class control IDs defined by V4L2 */
806#define V4L2_CID_BASE 0x00980900 771#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
772#define V4L2_CID_USER_BASE V4L2_CID_BASE
807/* IDs reserved for driver specific controls */ 773/* IDs reserved for driver specific controls */
808#define V4L2_CID_PRIVATE_BASE 0x08000000 774#define V4L2_CID_PRIVATE_BASE 0x08000000
809 775
776#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
810#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) 777#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
811#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) 778#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
812#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) 779#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
@@ -833,6 +800,188 @@ struct v4l2_querymenu
833#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) 800#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
834#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ 801#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */
835 802
803/* MPEG-class control IDs defined by V4L2 */
804#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
805#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
806
807/* MPEG streams */
808#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
809enum v4l2_mpeg_stream_type {
810 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
811 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
812 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
813 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
814 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
815 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
816};
817#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
818#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
819#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
820#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
821#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
822#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
823#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
824enum v4l2_mpeg_stream_vbi_fmt {
825 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
826 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
827};
828
829/* MPEG audio */
830#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
831enum v4l2_mpeg_audio_sampling_freq {
832 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
833 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
834 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
835};
836#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
837enum v4l2_mpeg_audio_encoding {
838 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
839 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
840 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
841};
842#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
843enum v4l2_mpeg_audio_l1_bitrate {
844 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
845 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
846 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
847 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
848 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
849 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
850 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
851 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
852 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
853 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
854 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
855 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
856 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
857 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
858};
859#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
860enum v4l2_mpeg_audio_l2_bitrate {
861 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
862 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
863 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
864 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
865 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
866 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
867 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
868 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
869 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
870 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
871 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
872 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
873 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
874 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
875};
876#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
877enum v4l2_mpeg_audio_l3_bitrate {
878 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
879 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
880 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
881 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
882 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
883 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
884 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
885 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
886 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
887 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
888 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
889 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
890 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
891 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
892};
893#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
894enum v4l2_mpeg_audio_mode {
895 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
896 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
897 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
898 V4L2_MPEG_AUDIO_MODE_MONO = 3,
899};
900#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
901enum v4l2_mpeg_audio_mode_extension {
902 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
903 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
904 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
905 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
906};
907#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
908enum v4l2_mpeg_audio_emphasis {
909 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
910 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
911 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
912};
913#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
914enum v4l2_mpeg_audio_crc {
915 V4L2_MPEG_AUDIO_CRC_NONE = 0,
916 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
917};
918
919/* MPEG video */
920#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
921enum v4l2_mpeg_video_encoding {
922 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
923 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
924};
925#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
926enum v4l2_mpeg_video_aspect {
927 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
928 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
929 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
930 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
931};
932#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
933#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
934#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
935#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
936#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
937enum v4l2_mpeg_video_bitrate_mode {
938 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
939 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
940};
941#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
942#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
943#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
944
945/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
946#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
947#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
948enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
949 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
950 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
951};
952#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
953#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
954enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
955 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
956 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
957 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
958 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
959 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
960};
961#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
962enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
963 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
964 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
965};
966#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
967enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
968 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
969 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
970};
971#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
972#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
973enum v4l2_mpeg_cx2341x_video_median_filter_type {
974 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
975 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
976 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
977 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
978 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
979};
980#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
981#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
982#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
983#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
984
836/* 985/*
837 * T U N I N G 986 * T U N I N G
838 */ 987 */
@@ -904,6 +1053,7 @@ struct v4l2_audio
904 __u32 mode; 1053 __u32 mode;
905 __u32 reserved[2]; 1054 __u32 reserved[2];
906}; 1055};
1056
907/* Flags for the 'capability' field */ 1057/* Flags for the 'capability' field */
908#define V4L2_AUDCAP_STEREO 0x00001 1058#define V4L2_AUDCAP_STEREO 0x00001
909#define V4L2_AUDCAP_AVL 0x00002 1059#define V4L2_AUDCAP_AVL 0x00002
@@ -927,7 +1077,6 @@ struct v4l2_audioout
927 */ 1077 */
928 1078
929/* Raw VBI */ 1079/* Raw VBI */
930
931struct v4l2_vbi_format 1080struct v4l2_vbi_format
932{ 1081{
933 __u32 sampling_rate; /* in 1 Hz */ 1082 __u32 sampling_rate; /* in 1 Hz */
@@ -1034,8 +1183,6 @@ struct v4l2_streamparm
1034 } parm; 1183 } parm;
1035}; 1184};
1036 1185
1037
1038
1039/* 1186/*
1040 * I O C T L C O D E S F O R V I D E O D E V I C E S 1187 * I O C T L C O D E S F O R V I D E O D E V I C E S
1041 * 1188 *
@@ -1045,8 +1192,10 @@ struct v4l2_streamparm
1045#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1192#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
1046#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1193#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
1047#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1194#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
1195#ifdef __KERNEL__
1048#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) 1196#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
1049#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) 1197#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
1198#endif
1050#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1199#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
1051#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1200#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
1052#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1201#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer)
@@ -1096,7 +1245,11 @@ struct v4l2_streamparm
1096#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) 1245#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap)
1097#endif 1246#endif
1098#define VIDIOC_LOG_STATUS _IO ('V', 70) 1247#define VIDIOC_LOG_STATUS _IO ('V', 70)
1248#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)
1250#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls)
1099 1251
1252#ifdef __OLD_VIDIOC_
1100/* for compatibility, will go away some day */ 1253/* for compatibility, will go away some day */
1101#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1254#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
1102#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1255#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
@@ -1104,57 +1257,10 @@ struct v4l2_streamparm
1104#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1257#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
1105#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1258#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
1106#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1259#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
1107
1108#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1109
1110
1111#ifdef __KERNEL__
1112/*
1113 *
1114 * V 4 L 2 D R I V E R H E L P E R A P I
1115 *
1116 * Some commonly needed functions for drivers (v4l2-common.o module)
1117 */
1118#include <linux/fs.h>
1119
1120/* Video standard functions */
1121extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
1122extern int v4l2_video_std_construct(struct v4l2_standard *vs,
1123 int id, char *name);
1124
1125/* prority handling */
1126struct v4l2_prio_state {
1127 atomic_t prios[4];
1128};
1129int v4l2_prio_init(struct v4l2_prio_state *global);
1130int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
1131 enum v4l2_priority new);
1132int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
1133int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
1134enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
1135int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1136
1137/* names for fancy debug output */
1138extern char *v4l2_field_names[];
1139extern char *v4l2_type_names[];
1140
1141/* Compatibility layer interface -- v4l1-compat module */
1142typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1143 unsigned int cmd, void *arg);
1144
1145#ifdef CONFIG_VIDEO_V4L1_COMPAT
1146int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1147 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1148#else
1149#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
1150#endif 1260#endif
1151 1261
1152/* 32 Bits compatibility layer for 64 bits processors */ 1262#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1153extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1154 unsigned long arg);
1155
1156 1263
1157#endif /* __KERNEL__ */
1158#endif /* __LINUX_VIDEODEV2_H */ 1264#endif /* __LINUX_VIDEODEV2_H */
1159 1265
1160/* 1266/*
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index f6024ab4ef..ce5f1482e6 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -11,6 +11,7 @@ struct vm_area_struct;
11#define VM_ALLOC 0x00000002 /* vmalloc() */ 11#define VM_ALLOC 0x00000002 /* vmalloc() */
12#define VM_MAP 0x00000004 /* vmap()ed pages */ 12#define VM_MAP 0x00000004 /* vmap()ed pages */
13#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 13#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
14#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
14/* bits [20..32] reserved for arch specific ioremap internals */ 15/* bits [20..32] reserved for arch specific ioremap internals */
15 16
16/* 17/*
@@ -43,8 +44,6 @@ extern void *vmalloc_32_user(unsigned long size);
43extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 44extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
44extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, 45extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
45 pgprot_t prot); 46 pgprot_t prot);
46extern void *__vmalloc_node(unsigned long size, gfp_t gfp_mask,
47 pgprot_t prot, int node);
48extern void vfree(void *addr); 47extern void vfree(void *addr);
49 48
50extern void *vmap(struct page **pages, unsigned int count, 49extern void *vmap(struct page **pages, unsigned int count,
@@ -63,7 +62,6 @@ extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
63extern struct vm_struct *get_vm_area_node(unsigned long size, 62extern struct vm_struct *get_vm_area_node(unsigned long size,
64 unsigned long flags, int node); 63 unsigned long flags, int node);
65extern struct vm_struct *remove_vm_area(void *addr); 64extern struct vm_struct *remove_vm_area(void *addr);
66extern struct vm_struct *__remove_vm_area(void *addr);
67extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 65extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
68 struct page ***pages); 66 struct page ***pages);
69extern 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
new file mode 100644
index 0000000000..c89df55f6e
--- /dev/null
+++ b/include/linux/vmstat.h
@@ -0,0 +1,229 @@
1#ifndef _LINUX_VMSTAT_H
2#define _LINUX_VMSTAT_H
3
4#include <linux/types.h>
5#include <linux/percpu.h>
6#include <linux/mmzone.h>
7#include <asm/atomic.h>
8
9#ifdef CONFIG_VM_EVENT_COUNTERS
10/*
11 * Light weight per cpu counter implementation.
12 *
13 * Counters should only be incremented and no critical kernel component
14 * should rely on the counter values.
15 *
16 * Counters are handled completely inline. On many platforms the code
17 * generated will simply be the increment of a global address.
18 */
19
20#ifdef CONFIG_ZONE_DMA32
21#define DMA32_ZONE(xx) xx##_DMA32,
22#else
23#define DMA32_ZONE(xx)
24#endif
25
26#ifdef CONFIG_HIGHMEM
27#define HIGHMEM_ZONE(xx) , xx##_HIGH
28#else
29#define HIGHMEM_ZONE(xx)
30#endif
31
32#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
33
34enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
35 FOR_ALL_ZONES(PGALLOC),
36 PGFREE, PGACTIVATE, PGDEACTIVATE,
37 PGFAULT, PGMAJFAULT,
38 FOR_ALL_ZONES(PGREFILL),
39 FOR_ALL_ZONES(PGSTEAL),
40 FOR_ALL_ZONES(PGSCAN_KSWAPD),
41 FOR_ALL_ZONES(PGSCAN_DIRECT),
42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
43 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
44 NR_VM_EVENT_ITEMS
45};
46
47struct vm_event_state {
48 unsigned long event[NR_VM_EVENT_ITEMS];
49};
50
51DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
52
53static inline void __count_vm_event(enum vm_event_item item)
54{
55 __get_cpu_var(vm_event_states).event[item]++;
56}
57
58static inline void count_vm_event(enum vm_event_item item)
59{
60 get_cpu_var(vm_event_states).event[item]++;
61 put_cpu();
62}
63
64static inline void __count_vm_events(enum vm_event_item item, long delta)
65{
66 __get_cpu_var(vm_event_states).event[item] += delta;
67}
68
69static inline void count_vm_events(enum vm_event_item item, long delta)
70{
71 get_cpu_var(vm_event_states).event[item] += delta;
72 put_cpu();
73}
74
75extern void all_vm_events(unsigned long *);
76extern void vm_events_fold_cpu(int cpu);
77
78#else
79
80/* Disable counters */
81#define get_cpu_vm_events(e) 0L
82#define count_vm_event(e) do { } while (0)
83#define count_vm_events(e,d) do { } while (0)
84#define __count_vm_event(e) do { } while (0)
85#define __count_vm_events(e,d) do { } while (0)
86#define vm_events_fold_cpu(x) do { } while (0)
87
88#endif /* CONFIG_VM_EVENT_COUNTERS */
89
90#define __count_zone_vm_events(item, zone, delta) \
91 __count_vm_events(item##_DMA + zone_idx(zone), delta)
92
93/*
94 * Zone based page accounting with per cpu differentials.
95 */
96extern atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
97
98static inline void zone_page_state_add(long x, struct zone *zone,
99 enum zone_stat_item item)
100{
101 atomic_long_add(x, &zone->vm_stat[item]);
102 atomic_long_add(x, &vm_stat[item]);
103}
104
105static inline unsigned long global_page_state(enum zone_stat_item item)
106{
107 long x = atomic_long_read(&vm_stat[item]);
108#ifdef CONFIG_SMP
109 if (x < 0)
110 x = 0;
111#endif
112 return x;
113}
114
115static inline unsigned long zone_page_state(struct zone *zone,
116 enum zone_stat_item item)
117{
118 long x = atomic_long_read(&zone->vm_stat[item]);
119#ifdef CONFIG_SMP
120 if (x < 0)
121 x = 0;
122#endif
123 return x;
124}
125
126#ifdef CONFIG_NUMA
127/*
128 * Determine the per node value of a stat item. This function
129 * is called frequently in a NUMA machine, so try to be as
130 * frugal as possible.
131 */
132static inline unsigned long node_page_state(int node,
133 enum zone_stat_item item)
134{
135 struct zone *zones = NODE_DATA(node)->node_zones;
136
137 return
138#ifdef CONFIG_ZONE_DMA32
139 zone_page_state(&zones[ZONE_DMA32], item) +
140#endif
141 zone_page_state(&zones[ZONE_NORMAL], item) +
142#ifdef CONFIG_HIGHMEM
143 zone_page_state(&zones[ZONE_HIGHMEM], item) +
144#endif
145 zone_page_state(&zones[ZONE_DMA], item);
146}
147
148extern void zone_statistics(struct zonelist *, struct zone *);
149
150#else
151
152#define node_page_state(node, item) global_page_state(item)
153#define zone_statistics(_zl,_z) do { } while (0)
154
155#endif /* CONFIG_NUMA */
156
157#define __add_zone_page_state(__z, __i, __d) \
158 __mod_zone_page_state(__z, __i, __d)
159#define __sub_zone_page_state(__z, __i, __d) \
160 __mod_zone_page_state(__z, __i,-(__d))
161
162#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
163#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
164
165static inline void zap_zone_vm_stats(struct zone *zone)
166{
167 memset(zone->vm_stat, 0, sizeof(zone->vm_stat));
168}
169
170extern void inc_zone_state(struct zone *, enum zone_stat_item);
171
172#ifdef CONFIG_SMP
173void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int);
174void __inc_zone_page_state(struct page *, enum zone_stat_item);
175void __dec_zone_page_state(struct page *, enum zone_stat_item);
176
177void mod_zone_page_state(struct zone *, enum zone_stat_item, int);
178void inc_zone_page_state(struct page *, enum zone_stat_item);
179void dec_zone_page_state(struct page *, enum zone_stat_item);
180
181extern void inc_zone_state(struct zone *, enum zone_stat_item);
182
183void refresh_cpu_vm_stats(int);
184void refresh_vm_stats(void);
185
186#else /* CONFIG_SMP */
187
188/*
189 * We do not maintain differentials in a single processor configuration.
190 * The functions directly modify the zone and global counters.
191 */
192static inline void __mod_zone_page_state(struct zone *zone,
193 enum zone_stat_item item, int delta)
194{
195 zone_page_state_add(delta, zone, item);
196}
197
198static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
199{
200 atomic_long_inc(&zone->vm_stat[item]);
201 atomic_long_inc(&vm_stat[item]);
202}
203
204static inline void __inc_zone_page_state(struct page *page,
205 enum zone_stat_item item)
206{
207 __inc_zone_state(page_zone(page), item);
208}
209
210static inline void __dec_zone_page_state(struct page *page,
211 enum zone_stat_item item)
212{
213 atomic_long_dec(&page_zone(page)->vm_stat[item]);
214 atomic_long_dec(&vm_stat[item]);
215}
216
217/*
218 * We only use atomic operations to update counters. So there is no need to
219 * disable interrupts.
220 */
221#define inc_zone_page_state __inc_zone_page_state
222#define dec_zone_page_state __dec_zone_page_state
223#define mod_zone_page_state __mod_zone_page_state
224
225static inline void refresh_cpu_vm_stats(int cpu) { }
226static inline void refresh_vm_stats(void) { }
227#endif
228
229#endif /* _LINUX_VMSTAT_H */
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 9f95b0bea5..ba806e8711 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,6 +1,16 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4/*
5 * These constants are also useful for user-level apps (e.g., VC
6 * resizing).
7 */
8#define MIN_NR_CONSOLES 1 /* must be at least 1 */
9#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
10#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
11 /* Note: the ioctl VT_GETSTATE does not work for
12 consoles 16 and higher (since it returns a short) */
13
4/* 0x56 is 'V', to avoid collision with termios and kd */ 14/* 0x56 is 'V', to avoid collision with termios and kd */
5 15
6#define VT_OPENQRY 0x5600 /* find available vt */ 16#define VT_OPENQRY 0x5600 /* find available vt */
@@ -50,5 +60,6 @@ struct vt_consize {
50#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ 60#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
51#define VT_LOCKSWITCH 0x560B /* disallow vt switching */ 61#define VT_LOCKSWITCH 0x560B /* disallow vt switching */
52#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ 62#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
63#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
53 64
54#endif /* _LINUX_VT_H */ 65#endif /* _LINUX_VT_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 940d0261a5..1009d3fe1f 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -26,13 +26,15 @@
26 26
27extern void kd_mksound(unsigned int hz, unsigned int ticks); 27extern void kd_mksound(unsigned int hz, unsigned int ticks);
28extern int kbd_rate(struct kbd_repeat *rep); 28extern int kbd_rate(struct kbd_repeat *rep);
29extern int fg_console, last_console, want_console;
29 30
30/* console.c */ 31/* console.c */
31 32
32int vc_allocate(unsigned int console); 33int vc_allocate(unsigned int console);
33int vc_cons_allocated(unsigned int console); 34int vc_cons_allocated(unsigned int console);
34int 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);
35void 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);
36void reset_palette(struct vc_data *vc); 38void reset_palette(struct vc_data *vc);
37void do_blank_screen(int entering_gfx); 39void do_blank_screen(int entering_gfx);
38void do_unblank_screen(int leaving_gfx); 40void do_unblank_screen(int leaving_gfx);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 544e855c7c..b3b9048421 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -68,7 +68,7 @@ struct task_struct;
68 wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk) 68 wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk)
69 69
70#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ 70#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \
71 .lock = SPIN_LOCK_UNLOCKED, \ 71 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
72 .task_list = { &(name).task_list, &(name).task_list } } 72 .task_list = { &(name).task_list, &(name).task_list } }
73 73
74#define DECLARE_WAIT_QUEUE_HEAD(name) \ 74#define DECLARE_WAIT_QUEUE_HEAD(name) \
@@ -77,11 +77,7 @@ struct task_struct;
77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
78 { .flags = word, .bit_nr = bit, } 78 { .flags = word, .bit_nr = bit, }
79 79
80static inline void init_waitqueue_head(wait_queue_head_t *q) 80extern void init_waitqueue_head(wait_queue_head_t *q);
81{
82 spin_lock_init(&q->lock);
83 INIT_LIST_HEAD(&q->task_list);
84}
85 81
86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 82static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
87{ 83{
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 1192ed8f4f..011bcfeb9f 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -28,6 +28,9 @@ struct watchdog_info {
28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) 28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int)
29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) 29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) 30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int)
31#define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int)
32#define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int)
33#define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int)
31 34
32#define WDIOF_UNKNOWN -1 /* Unknown flag error */ 35#define WDIOF_UNKNOWN -1 /* Unknown flag error */
33#define WDIOS_UNKNOWN -1 /* Unknown status error */ 36#define WDIOS_UNKNOWN -1 /* Unknown status error */
@@ -38,9 +41,10 @@ struct watchdog_info {
38#define WDIOF_EXTERN2 0x0008 /* External relay 2 */ 41#define WDIOF_EXTERN2 0x0008 /* External relay 2 */
39#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ 42#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */
40#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ 43#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */
41#define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 44#define WDIOF_POWEROVER 0x0040 /* Power over voltage */
42#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 45#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */
43#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 46#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */
47#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */
44#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ 48#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */
45 49
46#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ 50#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 13588564b4..a50a0130fd 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/workqueue.h b/include/linux/workqueue.h
index 957c21c16d..9bca3539a1 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -63,6 +63,8 @@ extern void destroy_workqueue(struct workqueue_struct *wq);
63 63
64extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work)); 64extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work));
65extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)); 65extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay));
66extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
67 struct work_struct *work, unsigned long delay);
66extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); 68extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq));
67 69
68extern int FASTCALL(schedule_work(struct work_struct *work)); 70extern int FASTCALL(schedule_work(struct work_struct *work));
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 9e38b566d0..9d4074ecd0 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -85,6 +85,7 @@ int wakeup_pdflush(long nr_pages);
85void laptop_io_completion(void); 85void laptop_io_completion(void);
86void laptop_sync_completion(void); 86void laptop_sync_completion(void);
87void throttle_vm_writeout(void); 87void throttle_vm_writeout(void);
88void writeback_congestion_end(void);
88 89
89/* These are exported to sysctl. */ 90/* These are exported to sysctl. */
90extern int dirty_background_ratio; 91extern int dirty_background_ratio;
@@ -115,6 +116,8 @@ int sync_page_range(struct inode *inode, struct address_space *mapping,
115 loff_t pos, loff_t count); 116 loff_t pos, loff_t count);
116int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, 117int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
117 loff_t pos, loff_t count); 118 loff_t pos, loff_t count);
119void set_page_dirty_balance(struct page *page);
120void writeback_set_ratelimit(void);
118 121
119/* pdflush.c */ 122/* pdflush.c */
120extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 123extern 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 46a15c7a1a..430afd0582 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;
@@ -104,6 +104,13 @@ struct xfrm_stats {
104 104
105enum 105enum
106{ 106{
107 XFRM_POLICY_TYPE_MAIN = 0,
108 XFRM_POLICY_TYPE_SUB = 1,
109 XFRM_POLICY_TYPE_MAX = 2
110};
111
112enum
113{
107 XFRM_POLICY_IN = 0, 114 XFRM_POLICY_IN = 0,
108 XFRM_POLICY_OUT = 1, 115 XFRM_POLICY_OUT = 1,
109 XFRM_POLICY_FWD = 2, 116 XFRM_POLICY_FWD = 2,
@@ -120,7 +127,9 @@ enum
120 127
121#define XFRM_MODE_TRANSPORT 0 128#define XFRM_MODE_TRANSPORT 0
122#define XFRM_MODE_TUNNEL 1 129#define XFRM_MODE_TUNNEL 1
123#define XFRM_MODE_MAX 2 130#define XFRM_MODE_ROUTEOPTIMIZATION 2
131#define XFRM_MODE_IN_TRIGGER 3
132#define XFRM_MODE_MAX 4
124 133
125/* Netlink configuration messages. */ 134/* Netlink configuration messages. */
126enum { 135enum {
@@ -164,6 +173,10 @@ enum {
164#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE 173#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE
165 XFRM_MSG_GETAE, 174 XFRM_MSG_GETAE,
166#define XFRM_MSG_GETAE XFRM_MSG_GETAE 175#define XFRM_MSG_GETAE XFRM_MSG_GETAE
176
177 XFRM_MSG_REPORT,
178#define XFRM_MSG_REPORT XFRM_MSG_REPORT
179
167 __XFRM_MSG_MAX 180 __XFRM_MSG_MAX
168}; 181};
169#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 182#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -217,6 +230,12 @@ enum xfrm_ae_ftype_t {
217#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 230#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
218}; 231};
219 232
233struct xfrm_userpolicy_type {
234 __u8 type;
235 __u16 reserved1;
236 __u8 reserved2;
237};
238
220/* Netlink message attributes. */ 239/* Netlink message attributes. */
221enum xfrm_attr_type_t { 240enum xfrm_attr_type_t {
222 XFRMA_UNSPEC, 241 XFRMA_UNSPEC,
@@ -232,6 +251,10 @@ enum xfrm_attr_type_t {
232 XFRMA_REPLAY_VAL, 251 XFRMA_REPLAY_VAL,
233 XFRMA_REPLAY_THRESH, 252 XFRMA_REPLAY_THRESH,
234 XFRMA_ETIMER_THRESH, 253 XFRMA_ETIMER_THRESH,
254 XFRMA_SRCADDR, /* xfrm_address_t */
255 XFRMA_COADDR, /* xfrm_address_t */
256 XFRMA_LASTUSED,
257 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
235 __XFRMA_MAX 258 __XFRMA_MAX
236 259
237#define XFRMA_MAX (__XFRMA_MAX - 1) 260#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -247,17 +270,18 @@ struct xfrm_usersa_info {
247 __u32 seq; 270 __u32 seq;
248 __u32 reqid; 271 __u32 reqid;
249 __u16 family; 272 __u16 family;
250 __u8 mode; /* 0=transport,1=tunnel */ 273 __u8 mode; /* XFRM_MODE_xxx */
251 __u8 replay_window; 274 __u8 replay_window;
252 __u8 flags; 275 __u8 flags;
253#define XFRM_STATE_NOECN 1 276#define XFRM_STATE_NOECN 1
254#define XFRM_STATE_DECAP_DSCP 2 277#define XFRM_STATE_DECAP_DSCP 2
255#define XFRM_STATE_NOPMTUDISC 4 278#define XFRM_STATE_NOPMTUDISC 4
279#define XFRM_STATE_WILDRECV 8
256}; 280};
257 281
258struct xfrm_usersa_id { 282struct xfrm_usersa_id {
259 xfrm_address_t daddr; 283 xfrm_address_t daddr;
260 __u32 spi; 284 __be32 spi;
261 __u16 family; 285 __u16 family;
262 __u8 proto; 286 __u8 proto;
263}; 287};
@@ -319,12 +343,18 @@ struct xfrm_usersa_flush {
319 __u8 proto; 343 __u8 proto;
320}; 344};
321 345
346struct xfrm_user_report {
347 __u8 proto;
348 struct xfrm_selector sel;
349};
350
322#ifndef __KERNEL__ 351#ifndef __KERNEL__
323/* backwards compatibility for userspace */ 352/* backwards compatibility for userspace */
324#define XFRMGRP_ACQUIRE 1 353#define XFRMGRP_ACQUIRE 1
325#define XFRMGRP_EXPIRE 2 354#define XFRMGRP_EXPIRE 2
326#define XFRMGRP_SA 4 355#define XFRMGRP_SA 4
327#define XFRMGRP_POLICY 8 356#define XFRMGRP_POLICY 8
357#define XFRMGRP_REPORT 0x10
328#endif 358#endif
329 359
330enum xfrm_nlgroups { 360enum xfrm_nlgroups {
@@ -340,6 +370,8 @@ enum xfrm_nlgroups {
340#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY 370#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
341 XFRMNLGRP_AEVENTS, 371 XFRMNLGRP_AEVENTS,
342#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS 372#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS
373 XFRMNLGRP_REPORT,
374#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
343 __XFRMNLGRP_MAX 375 __XFRMNLGRP_MAX
344}; 376};
345#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 377#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
new file mode 100644
index 0000000000..d91d88f93c
--- /dev/null
+++ b/include/media/cx2341x.h
@@ -0,0 +1,195 @@
1/*
2 cx23415/6 header containing common defines.
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
19#ifndef CX2341X_H
20#define CX2341X_H
21
22enum cx2341x_port {
23 CX2341X_PORT_MEMORY = 0,
24 CX2341X_PORT_STREAMING = 1,
25 CX2341X_PORT_SERIAL = 2
26};
27
28enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
30};
31
32struct cx2341x_mpeg_params {
33 /* misc */
34 u32 capabilities;
35 enum cx2341x_port port;
36 u16 width;
37 u16 height;
38 u16 is_50hz;
39
40 /* stream */
41 enum v4l2_mpeg_stream_type stream_type;
42 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt;
43
44 /* audio */
45 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
46 enum v4l2_mpeg_audio_encoding audio_encoding;
47 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
48 enum v4l2_mpeg_audio_mode audio_mode;
49 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
50 enum v4l2_mpeg_audio_emphasis audio_emphasis;
51 enum v4l2_mpeg_audio_crc audio_crc;
52 u8 audio_properties;
53
54 /* video */
55 enum v4l2_mpeg_video_encoding video_encoding;
56 enum v4l2_mpeg_video_aspect video_aspect;
57 u16 video_b_frames;
58 u16 video_gop_size;
59 u16 video_gop_closure;
60 u16 video_pulldown;
61 enum v4l2_mpeg_video_bitrate_mode video_bitrate_mode;
62 u32 video_bitrate;
63 u32 video_bitrate_peak;
64 u16 video_temporal_decimation;
65
66 /* encoding filters */
67 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode;
68 u16 video_spatial_filter;
69 enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type video_luma_spatial_filter_type;
70 enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type video_chroma_spatial_filter_type;
71 enum v4l2_mpeg_cx2341x_video_temporal_filter_mode video_temporal_filter_mode;
72 u16 video_temporal_filter;
73 enum v4l2_mpeg_cx2341x_video_median_filter_type video_median_filter_type;
74 u16 video_luma_median_filter_top;
75 u16 video_luma_median_filter_bottom;
76 u16 video_chroma_median_filter_top;
77 u16 video_chroma_median_filter_bottom;
78};
79
80#define CX2341X_MBOX_MAX_DATA 16
81
82extern const u32 cx2341x_mpeg_ctrls[];
83typedef int (*cx2341x_mbox_func)(void *priv, int cmd, int in, int out,
84 u32 data[CX2341X_MBOX_MAX_DATA]);
85int cx2341x_update(void *priv, cx2341x_mbox_func func,
86 const struct cx2341x_mpeg_params *old,
87 const struct cx2341x_mpeg_params *new);
88int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
89 struct v4l2_queryctrl *qctrl);
90const char **cx2341x_ctrl_get_menu(u32 id);
91int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params,
92 struct v4l2_ext_controls *ctrls, unsigned int cmd);
93void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
94void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix);
95
96/* Firmware names */
97#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"
98/* Decoder firmware for the cx23415 only */
99#define CX2341X_FIRM_DEC_FILENAME "v4l-cx2341x-dec.fw"
100
101/* Firmware API commands */
102
103/* MPEG decoder API, specific to the cx23415 */
104#define CX2341X_DEC_PING_FW 0x00
105#define CX2341X_DEC_START_PLAYBACK 0x01
106#define CX2341X_DEC_STOP_PLAYBACK 0x02
107#define CX2341X_DEC_SET_PLAYBACK_SPEED 0x03
108#define CX2341X_DEC_STEP_VIDEO 0x05
109#define CX2341X_DEC_SET_DMA_BLOCK_SIZE 0x08
110#define CX2341X_DEC_GET_XFER_INFO 0x09
111#define CX2341X_DEC_GET_DMA_STATUS 0x0a
112#define CX2341X_DEC_SCHED_DMA_FROM_HOST 0x0b
113#define CX2341X_DEC_PAUSE_PLAYBACK 0x0d
114#define CX2341X_DEC_HALT_FW 0x0e
115#define CX2341X_DEC_SET_STANDARD 0x10
116#define CX2341X_DEC_GET_VERSION 0x11
117#define CX2341X_DEC_SET_STREAM_INPUT 0x14
118#define CX2341X_DEC_GET_TIMING_INFO 0x15
119#define CX2341X_DEC_SET_AUDIO_MODE 0x16
120#define CX2341X_DEC_SET_EVENT_NOTIFICATION 0x17
121#define CX2341X_DEC_SET_DISPLAY_BUFFERS 0x18
122#define CX2341X_DEC_EXTRACT_VBI 0x19
123#define CX2341X_DEC_SET_DECODER_SOURCE 0x1a
124#define CX2341X_DEC_SET_AUDIO_OUTPUT 0x1b
125#define CX2341X_DEC_SET_AV_DELAY 0x1c
126#define CX2341X_DEC_SET_PREBUFFERING 0x1e
127
128/* MPEG encoder API */
129#define CX2341X_ENC_PING_FW 0x80
130#define CX2341X_ENC_START_CAPTURE 0x81
131#define CX2341X_ENC_STOP_CAPTURE 0x82
132#define CX2341X_ENC_SET_AUDIO_ID 0x89
133#define CX2341X_ENC_SET_VIDEO_ID 0x8b
134#define CX2341X_ENC_SET_PCR_ID 0x8d
135#define CX2341X_ENC_SET_FRAME_RATE 0x8f
136#define CX2341X_ENC_SET_FRAME_SIZE 0x91
137#define CX2341X_ENC_SET_BIT_RATE 0x95
138#define CX2341X_ENC_SET_GOP_PROPERTIES 0x97
139#define CX2341X_ENC_SET_ASPECT_RATIO 0x99
140#define CX2341X_ENC_SET_DNR_FILTER_MODE 0x9b
141#define CX2341X_ENC_SET_DNR_FILTER_PROPS 0x9d
142#define CX2341X_ENC_SET_CORING_LEVELS 0x9f
143#define CX2341X_ENC_SET_SPATIAL_FILTER_TYPE 0xa1
144#define CX2341X_ENC_SET_3_2_PULLDOWN 0xb1
145#define CX2341X_ENC_SET_VBI_LINE 0xb7
146#define CX2341X_ENC_SET_STREAM_TYPE 0xb9
147#define CX2341X_ENC_SET_OUTPUT_PORT 0xbb
148#define CX2341X_ENC_SET_AUDIO_PROPERTIES 0xbd
149#define CX2341X_ENC_HALT_FW 0xc3
150#define CX2341X_ENC_GET_VERSION 0xc4
151#define CX2341X_ENC_SET_GOP_CLOSURE 0xc5
152#define CX2341X_ENC_GET_SEQ_END 0xc6
153#define CX2341X_ENC_SET_PGM_INDEX_INFO 0xc7
154#define CX2341X_ENC_SET_VBI_CONFIG 0xc8
155#define CX2341X_ENC_SET_DMA_BLOCK_SIZE 0xc9
156#define CX2341X_ENC_GET_PREV_DMA_INFO_MB_10 0xca
157#define CX2341X_ENC_GET_PREV_DMA_INFO_MB_9 0xcb
158#define CX2341X_ENC_SCHED_DMA_TO_HOST 0xcc
159#define CX2341X_ENC_INITIALIZE_INPUT 0xcd
160#define CX2341X_ENC_SET_FRAME_DROP_RATE 0xd0
161#define CX2341X_ENC_PAUSE_ENCODER 0xd2
162#define CX2341X_ENC_REFRESH_INPUT 0xd3
163#define CX2341X_ENC_SET_COPYRIGHT 0xd4
164#define CX2341X_ENC_SET_EVENT_NOTIFICATION 0xd5
165#define CX2341X_ENC_SET_NUM_VSYNC_LINES 0xd6
166#define CX2341X_ENC_SET_PLACEHOLDER 0xd7
167#define CX2341X_ENC_MUTE_VIDEO 0xd9
168#define CX2341X_ENC_MUTE_AUDIO 0xda
169#define CX2341X_ENC_UNKNOWN 0xdb
170#define CX2341X_ENC_MISC 0xdc
171
172/* OSD API, specific to the cx23415 */
173#define CX2341X_OSD_GET_FRAMEBUFFER 0x41
174#define CX2341X_OSD_GET_PIXEL_FORMAT 0x42
175#define CX2341X_OSD_SET_PIXEL_FORMAT 0x43
176#define CX2341X_OSD_GET_STATE 0x44
177#define CX2341X_OSD_SET_STATE 0x45
178#define CX2341X_OSD_GET_OSD_COORDS 0x46
179#define CX2341X_OSD_SET_OSD_COORDS 0x47
180#define CX2341X_OSD_GET_SCREEN_COORDS 0x48
181#define CX2341X_OSD_SET_SCREEN_COORDS 0x49
182#define CX2341X_OSD_GET_GLOBAL_ALPHA 0x4a
183#define CX2341X_OSD_SET_GLOBAL_ALPHA 0x4b
184#define CX2341X_OSD_SET_BLEND_COORDS 0x4c
185#define CX2341X_OSD_GET_FLICKER_STATE 0x4f
186#define CX2341X_OSD_SET_FLICKER_STATE 0x50
187#define CX2341X_OSD_BLT_COPY 0x52
188#define CX2341X_OSD_BLT_FILL 0x53
189#define CX2341X_OSD_BLT_TEXT 0x54
190#define CX2341X_OSD_SET_FRAMEBUFFER_WINDOW 0x56
191#define CX2341X_OSD_SET_CHROMA_KEY 0x60
192#define CX2341X_OSD_GET_ALPHA_CONTENT_INDEX 0x61
193#define CX2341X_OSD_SET_ALPHA_CONTENT_INDEX 0x62
194
195#endif /* CX2341X_H */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 302d5b3946..7bab09b0ed 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -73,7 +73,7 @@ extern IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE];
73extern IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE]; 73extern IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE];
74extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE]; 74extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE];
75extern IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE]; 75extern IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE];
76extern IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE]; 76extern IR_KEYTAB_TYPE ir_codes_pinnacle_grey[IR_KEYTAB_SIZE];
77extern IR_KEYTAB_TYPE ir_codes_flyvideo[IR_KEYTAB_SIZE]; 77extern IR_KEYTAB_TYPE ir_codes_flyvideo[IR_KEYTAB_SIZE];
78extern IR_KEYTAB_TYPE ir_codes_flydvb[IR_KEYTAB_SIZE]; 78extern IR_KEYTAB_TYPE ir_codes_flydvb[IR_KEYTAB_SIZE];
79extern IR_KEYTAB_TYPE ir_codes_cinergy[IR_KEYTAB_SIZE]; 79extern IR_KEYTAB_TYPE ir_codes_cinergy[IR_KEYTAB_SIZE];
@@ -87,8 +87,9 @@ extern IR_KEYTAB_TYPE ir_codes_pctv_sedna[IR_KEYTAB_SIZE];
87extern IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE]; 87extern IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE];
88extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; 88extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE];
89extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; 89extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
90extern IR_KEYTAB_TYPE ir_codes_pinnacle[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];
92 93
93#endif 94#endif
94 95
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 730f21ed91..a455f7ce5e 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -20,5 +20,6 @@ struct IR_i2c {
20 int (*get_key)(struct IR_i2c*, u32*, u32*); 20 int (*get_key)(struct IR_i2c*, u32*, u32*);
21}; 21};
22 22
23int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); 23int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
24int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
24#endif 25#endif
diff --git a/include/media/ovcamchip.h b/include/media/ovcamchip.h
index 8138983adc..0f43451f8b 100644
--- a/include/media/ovcamchip.h
+++ b/include/media/ovcamchip.h
@@ -15,6 +15,7 @@
15#define __LINUX_OVCAMCHIP_H 15#define __LINUX_OVCAMCHIP_H
16 16
17#include <linux/videodev.h> 17#include <linux/videodev.h>
18#include <media/v4l2-common.h>
18#include <linux/i2c.h> 19#include <linux/i2c.h>
19 20
20/* --------------------------------- */ 21/* --------------------------------- */
diff --git a/include/media/pwc-ioctl.h b/include/media/pwc-ioctl.h
new file mode 100644
index 0000000000..adc1254e88
--- /dev/null
+++ b/include/media/pwc-ioctl.h
@@ -0,0 +1,325 @@
1#ifndef PWC_IOCTL_H
2#define PWC_IOCTL_H
3
4/* (C) 2001-2004 Nemosoft Unv.
5 (C) 2004-2006 Luc Saillard (luc@saillard.org)
6
7 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
8 driver and thus may have bugs that are not present in the original version.
9 Please send bug reports and support requests to <luc@saillard.org>.
10 The decompression routines have been implemented by reverse-engineering the
11 Nemosoft binary pwcx module. Caveat emptor.
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26*/
27
28/* This is pwc-ioctl.h belonging to PWC 10.0.10
29 It contains structures and defines to communicate from user space
30 directly to the driver.
31 */
32
33/*
34 Changes
35 2001/08/03 Alvarado Added ioctl constants to access methods for
36 changing white balance and red/blue gains
37 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
38 2003/12/13 Nemosft Unv. Some modifications to make interfacing to
39 PWCX easier
40 2006/01/01 Luc Saillard Add raw format definition
41 */
42
43/* These are private ioctl() commands, specific for the Philips webcams.
44 They contain functions not found in other webcams, and settings not
45 specified in the Video4Linux API.
46
47 The #define names are built up like follows:
48 VIDIOC VIDeo IOCtl prefix
49 PWC Philps WebCam
50 G optional: Get
51 S optional: Set
52 ... the function
53 */
54
55#include <linux/types.h>
56#include <linux/version.h>
57
58
59 /* Enumeration of image sizes */
60#define PSZ_SQCIF 0x00
61#define PSZ_QSIF 0x01
62#define PSZ_QCIF 0x02
63#define PSZ_SIF 0x03
64#define PSZ_CIF 0x04
65#define PSZ_VGA 0x05
66#define PSZ_MAX 6
67
68
69/* The frame rate is encoded in the video_window.flags parameter using
70 the upper 16 bits, since some flags are defined nowadays. The following
71 defines provide a mask and shift to filter out this value.
72 This value can also be passing using the private flag when using v4l2 and
73 VIDIOC_S_FMT ioctl.
74
75 In 'Snapshot' mode the camera freezes its automatic exposure and colour
76 balance controls.
77 */
78#define PWC_FPS_SHIFT 16
79#define PWC_FPS_MASK 0x00FF0000
80#define PWC_FPS_FRMASK 0x003F0000
81#define PWC_FPS_SNAPSHOT 0x00400000
82#define PWC_QLT_MASK 0x03000000
83#define PWC_QLT_SHIFT 24
84
85
86/* structure for transferring x & y coordinates */
87struct pwc_coord
88{
89 int x, y; /* guess what */
90 int size; /* size, or offset */
91};
92
93
94/* Used with VIDIOCPWCPROBE */
95struct pwc_probe
96{
97 char name[32];
98 int type;
99};
100
101struct pwc_serial
102{
103 char serial[30]; /* String with serial number. Contains terminating 0 */
104};
105
106/* pwc_whitebalance.mode values */
107#define PWC_WB_INDOOR 0
108#define PWC_WB_OUTDOOR 1
109#define PWC_WB_FL 2
110#define PWC_WB_MANUAL 3
111#define PWC_WB_AUTO 4
112
113/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
114 Set mode to one of the PWC_WB_* values above.
115 *red and *blue are the respective gains of these colour components inside
116 the camera; range 0..65535
117 When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
118 otherwise undefined.
119 'read_red' and 'read_blue' are read-only.
120*/
121struct pwc_whitebalance
122{
123 int mode;
124 int manual_red, manual_blue; /* R/W */
125 int read_red, read_blue; /* R/O */
126};
127
128/*
129 'control_speed' and 'control_delay' are used in automatic whitebalance mode,
130 and tell the camera how fast it should react to changes in lighting, and
131 with how much delay. Valid values are 0..65535.
132*/
133struct pwc_wb_speed
134{
135 int control_speed;
136 int control_delay;
137
138};
139
140/* Used with VIDIOCPWC[SG]LED */
141struct pwc_leds
142{
143 int led_on; /* Led on-time; range = 0..25000 */
144 int led_off; /* Led off-time; range = 0..25000 */
145};
146
147/* Image size (used with GREALSIZE) */
148struct pwc_imagesize
149{
150 int width;
151 int height;
152};
153
154/* Defines and structures for Motorized Pan & Tilt */
155#define PWC_MPT_PAN 0x01
156#define PWC_MPT_TILT 0x02
157#define PWC_MPT_TIMEOUT 0x04 /* for status */
158
159/* Set angles; when absolute != 0, the angle is absolute and the
160 driver calculates the relative offset for you. This can only
161 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
162 absolute angles.
163 */
164struct pwc_mpt_angles
165{
166 int absolute; /* write-only */
167 int pan; /* degrees * 100 */
168 int tilt; /* degress * 100 */
169};
170
171/* Range of angles of the camera, both horizontally and vertically.
172 */
173struct pwc_mpt_range
174{
175 int pan_min, pan_max; /* degrees * 100 */
176 int tilt_min, tilt_max;
177};
178
179struct pwc_mpt_status
180{
181 int status;
182 int time_pan;
183 int time_tilt;
184};
185
186
187/* This is used for out-of-kernel decompression. With it, you can get
188 all the necessary information to initialize and use the decompressor
189 routines in standalone applications.
190 */
191struct pwc_video_command
192{
193 int type; /* camera type (645, 675, 730, etc.) */
194 int release; /* release number */
195
196 int size; /* one of PSZ_* */
197 int alternate;
198 int command_len; /* length of USB video command */
199 unsigned char command_buf[13]; /* Actual USB video command */
200 int bandlength; /* >0 = compressed */
201 int frame_size; /* Size of one (un)compressed frame */
202};
203
204/* Flags for PWCX subroutines. Not all modules honour all flags. */
205#define PWCX_FLAG_PLANAR 0x0001
206#define PWCX_FLAG_BAYER 0x0008
207
208
209/* IOCTL definitions */
210
211 /* Restore user settings */
212#define VIDIOCPWCRUSER _IO('v', 192)
213 /* Save user settings */
214#define VIDIOCPWCSUSER _IO('v', 193)
215 /* Restore factory settings */
216#define VIDIOCPWCFACTORY _IO('v', 194)
217
218 /* You can manipulate the compression factor. A compression preference of 0
219 means use uncompressed modes when available; 1 is low compression, 2 is
220 medium and 3 is high compression preferred. Of course, the higher the
221 compression, the lower the bandwidth used but more chance of artefacts
222 in the image. The driver automatically chooses a higher compression when
223 the preferred mode is not available.
224 */
225 /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
226#define VIDIOCPWCSCQUAL _IOW('v', 195, int)
227 /* Get preferred compression quality */
228#define VIDIOCPWCGCQUAL _IOR('v', 195, int)
229
230
231/* Retrieve serial number of camera */
232#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial)
233
234 /* This is a probe function; since so many devices are supported, it
235 becomes difficult to include all the names in programs that want to
236 check for the enhanced Philips stuff. So in stead, try this PROBE;
237 it returns a structure with the original name, and the corresponding
238 Philips type.
239 To use, fill the structure with zeroes, call PROBE and if that succeeds,
240 compare the name with that returned from VIDIOCGCAP; they should be the
241 same. If so, you can be assured it is a Philips (OEM) cam and the type
242 is valid.
243 */
244#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe)
245
246 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
247#define VIDIOCPWCSAGC _IOW('v', 200, int)
248 /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
249#define VIDIOCPWCGAGC _IOR('v', 200, int)
250 /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
251#define VIDIOCPWCSSHUTTER _IOW('v', 201, int)
252
253 /* Color compensation (Auto White Balance) */
254#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance)
255#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance)
256
257 /* Auto WB speed */
258#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed)
259#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed)
260
261 /* LEDs on/off/blink; int range 0..65535 */
262#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds)
263#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds)
264
265 /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
266#define VIDIOCPWCSCONTOUR _IOW('v', 206, int)
267#define VIDIOCPWCGCONTOUR _IOR('v', 206, int)
268
269 /* Backlight compensation; 0 = off, otherwise on */
270#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int)
271#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int)
272
273 /* Flickerless mode; = 0 off, otherwise on */
274#define VIDIOCPWCSFLICKER _IOW('v', 208, int)
275#define VIDIOCPWCGFLICKER _IOR('v', 208, int)
276
277 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
278#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
279#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
280
281 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
282#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
283
284 /* Motorized pan & tilt functions */
285#define VIDIOCPWCMPTRESET _IOW('v', 211, int)
286#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
287#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
288#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles)
289#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status)
290
291 /* Get the USB set-video command; needed for initializing libpwcx */
292#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command)
293struct pwc_table_init_buffer {
294 int len;
295 char *buffer;
296
297};
298#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer)
299
300/*
301 * This is private command used when communicating with v4l2.
302 * In the future all private ioctl will be remove/replace to
303 * use interface offer by v4l2.
304 */
305
306#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0)
307#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1)
308#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2)
309#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3)
310#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4)
311#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5)
312#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6)
313#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7)
314#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8)
315
316struct pwc_raw_frame {
317 __le16 type; /* type of the webcam */
318 __le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */
319 __u8 cmd[4]; /* the four byte of the command (in case of nala,
320 only the first 3 bytes is filled) */
321 __u8 rawframe[0]; /* frame_size = H/4*vbandlength */
322} __attribute__ ((packed));
323
324
325#endif
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index 6b4836f3f0..9f0e2285a0 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -1,5 +1,5 @@
1/* 1/*
2 saa7115.h - definition for saa7113/4/5 inputs 2 saa7115.h - definition for saa7113/4/5 inputs and frequency flags
3 3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5 5
@@ -33,5 +33,14 @@
33#define SAA7115_SVIDEO2 8 33#define SAA7115_SVIDEO2 8
34#define SAA7115_SVIDEO3 9 34#define SAA7115_SVIDEO3 9
35 35
36/* SAA7115 v4l2_crystal_freq frequency values */
37#define SAA7115_FREQ_32_11_MHZ 32110000 /* 32.11 MHz crystal, SAA7114/5 only */
38#define SAA7115_FREQ_24_576_MHZ 24576000 /* 24.576 MHz crystal */
39
40/* SAA7115 v4l2_crystal_freq audio clock control flags */
41#define SAA7115_FREQ_FL_UCGC (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */
42#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
43#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
44
36#endif 45#endif
37 46
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 4507cb61ae..83fe2e3d1e 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -2,7 +2,7 @@
2#define __SAA7146_VV__ 2#define __SAA7146_VV__
3 3
4#include <linux/videodev.h> 4#include <linux/videodev.h>
5 5#include <media/v4l2-common.h>
6#include <media/saa7146.h> 6#include <media/saa7146.h>
7#include <media/video-buf.h> 7#include <media/video-buf.h>
8 8
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
index ad9c171bfa..3c43b95f4c 100644
--- a/include/media/tuner-types.h
+++ b/include/media/tuner-types.h
@@ -20,6 +20,7 @@ struct tuner_range {
20 20
21struct tuner_params { 21struct tuner_params {
22 enum param_type type; 22 enum param_type type;
23
23 /* Many Philips based tuners have a comment like this in their 24 /* Many Philips based tuners have a comment like this in their
24 * datasheet: 25 * datasheet:
25 * 26 *
@@ -39,6 +40,60 @@ struct tuner_params {
39 * static unless the control byte was sent first. 40 * static unless the control byte was sent first.
40 */ 41 */
41 unsigned int cb_first_if_lower_freq:1; 42 unsigned int cb_first_if_lower_freq:1;
43 /* Set to 1 if this tuner uses a tda9887 */
44 unsigned int has_tda9887:1;
45 /* Many Philips tuners use tda9887 PORT1 to select the FM radio
46 sensitivity. If this setting is 1, then set PORT1 to 1 to
47 get proper FM reception. */
48 unsigned int port1_fm_high_sensitivity:1;
49 /* Some Philips tuners use tda9887 PORT2 to select the FM radio
50 sensitivity. If this setting is 1, then set PORT2 to 1 to
51 get proper FM reception. */
52 unsigned int port2_fm_high_sensitivity:1;
53 /* Most tuners with a tda9887 use QSS mode. Some (cheaper) tuners
54 use Intercarrier mode. If this setting is 1, then the tuner
55 needs to be set to intercarrier mode. */
56 unsigned int intercarrier_mode:1;
57 /* This setting sets the default value for PORT1.
58 0 means inactive, 1 means active. Note: the actual bit
59 value written to the tda9887 is inverted. So a 0 here
60 means a 1 in the B6 bit. */
61 unsigned int port1_active:1;
62 /* This setting sets the default value for PORT2.
63 0 means inactive, 1 means active. Note: the actual bit
64 value written to the tda9887 is inverted. So a 0 here
65 means a 1 in the B7 bit. */
66 unsigned int port2_active:1;
67 /* Sometimes PORT1 is inverted when the SECAM-L' standard is selected.
68 Set this bit to 1 if this is needed. */
69 unsigned int port1_invert_for_secam_lc:1;
70 /* Sometimes PORT2 is inverted when the SECAM-L' standard is selected.
71 Set this bit to 1 if this is needed. */
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. */
74 unsigned int port1_set_for_fm_mono:1;
75 /* Default tda9887 TOP value in dB for the low band. Default is 0.
76 Range: -16:+15 */
77 signed int default_top_low:5;
78 /* Default tda9887 TOP value in dB for the mid band. Default is 0.
79 Range: -16:+15 */
80 signed int default_top_mid:5;
81 /* Default tda9887 TOP value in dB for the high band. Default is 0.
82 Range: -16:+15 */
83 signed int default_top_high:5;
84 /* Default tda9887 TOP value in dB for SECAM-L/L' for the low band.
85 Default is 0. Several tuners require a different TOP value for
86 the SECAM-L/L' standards. Range: -16:+15 */
87 signed int default_top_secam_low:5;
88 /* Default tda9887 TOP value in dB for SECAM-L/L' for the mid band.
89 Default is 0. Several tuners require a different TOP value for
90 the SECAM-L/L' standards. Range: -16:+15 */
91 signed int default_top_secam_mid:5;
92 /* Default tda9887 TOP value in dB for SECAM-L/L' for the high band.
93 Default is 0. Several tuners require a different TOP value for
94 the SECAM-L/L' standards. Range: -16:+15 */
95 signed int default_top_secam_high:5;
96
42 97
43 unsigned int count; 98 unsigned int count;
44 struct tuner_range *ranges; 99 struct tuner_range *ranges;
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 017fed7d5e..2f7b00b08e 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -25,6 +25,8 @@
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <media/tuner-types.h> 26#include <media/tuner-types.h>
27 27
28extern int tuner_debug;
29
28#define ADDR_UNSET (255) 30#define ADDR_UNSET (255)
29 31
30#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 32#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
@@ -108,7 +110,7 @@
108#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 110#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
109#define TUNER_PHILIPS_FMD1216ME_MK3 63 111#define TUNER_PHILIPS_FMD1216ME_MK3 63
110 112
111#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ 113#define TUNER_LG_TDVS_H06XF 64 /* TDVS H061F, H062F, H064F */
112#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ 114#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */
113#define TUNER_LG_TALN 66 115#define TUNER_LG_TALN 66
114#define TUNER_PHILIPS_TD1316 67 116#define TUNER_PHILIPS_TD1316 67
@@ -119,6 +121,8 @@
119#define TUNER_XCEIVE_XC3028 71 121#define TUNER_XCEIVE_XC3028 71
120 122
121#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */ 123#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
124#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */
125#define TUNER_TDA9887 74 /* This tuner should be used only internally */
122 126
123/* tv card specific */ 127/* tv card specific */
124#define TDA9887_PRESENT (1<<0) 128#define TDA9887_PRESENT (1<<0)
@@ -190,6 +194,10 @@ struct tuner {
190 194
191 int using_v4l2; 195 int using_v4l2;
192 196
197 /* used by tda9887 */
198 unsigned int tda9887_config;
199 unsigned char tda9887_data[4];
200
193 /* used by MT2032 */ 201 /* used by MT2032 */
194 unsigned int xogc; 202 unsigned int xogc;
195 unsigned int radio_if2; 203 unsigned int radio_if2;
@@ -206,6 +214,8 @@ struct tuner {
206 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); 214 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
207 int (*has_signal)(struct i2c_client *c); 215 int (*has_signal)(struct i2c_client *c);
208 int (*is_stereo)(struct i2c_client *c); 216 int (*is_stereo)(struct i2c_client *c);
217 int (*get_afc)(struct i2c_client *c);
218 void (*tuner_status)(struct i2c_client *c);
209 void (*standby)(struct i2c_client *c); 219 void (*standby)(struct i2c_client *c);
210}; 220};
211 221
@@ -218,6 +228,7 @@ extern int tda8290_probe(struct i2c_client *c);
218extern int tea5767_tuner_init(struct i2c_client *c); 228extern int tea5767_tuner_init(struct i2c_client *c);
219extern int default_tuner_init(struct i2c_client *c); 229extern int default_tuner_init(struct i2c_client *c);
220extern int tea5767_autodetection(struct i2c_client *c); 230extern int tea5767_autodetection(struct i2c_client *c);
231extern int tda9887_tuner_init(struct i2c_client *c);
221 232
222#define tuner_warn(fmt, arg...) do {\ 233#define tuner_warn(fmt, arg...) do {\
223 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 234 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
diff --git a/include/media/tvp5150.h b/include/media/tvp5150.h
new file mode 100644
index 0000000000..72bd2a2b8b
--- /dev/null
+++ b/include/media/tvp5150.h
@@ -0,0 +1,34 @@
1/*
2 tvp5150.h - definition for tvp5150 inputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _TVP5150_H_
22#define _TVP5150_H_
23
24/* TVP5150 HW inputs */
25#define TVP5150_COMPOSITE0 0
26#define TVP5150_COMPOSITE1 1
27#define TVP5150_SVIDEO 2
28
29/* TVP5150 HW outputs */
30#define TVP5150_NORMAL 0
31#define TVP5150_BLACK_SCREEN 1
32
33#endif
34
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 642520acdf..5564db13c0 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -26,8 +26,14 @@
26#ifndef V4L2_COMMON_H_ 26#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_ 27#define V4L2_COMMON_H_
28 28
29#include <media/v4l2-dev.h>
30
29/* v4l debugging and diagnostics */ 31/* v4l debugging and diagnostics */
30 32
33/* Debug bitmask flags to be used on V4L2 */
34#define V4L2_DEBUG_IOCTL 0x01
35#define V4L2_DEBUG_IOCTL_ARG 0x02
36
31/* Common printk constucts for v4l-i2c drivers. These macros create a unique 37/* Common printk constucts for v4l-i2c drivers. These macros create a unique
32 prefix consisting of the driver name, the adapter number and the i2c 38 prefix consisting of the driver name, the adapter number and the i2c
33 address. */ 39 address. */
@@ -78,6 +84,19 @@ extern void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg);
78 84
79/* ------------------------------------------------------------------------- */ 85/* ------------------------------------------------------------------------- */
80 86
87/* Control helper functions */
88
89int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
90 const char **menu_items);
91const char **v4l2_ctrl_get_menu(u32 id);
92int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
93int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
94int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
95 struct v4l2_queryctrl *qctrl, const char **menu_items);
96u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
97
98/* ------------------------------------------------------------------------- */
99
81/* Internal ioctls */ 100/* Internal ioctls */
82 101
83/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ 102/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */
@@ -112,6 +131,8 @@ enum v4l2_chip_ident {
112 V4L2_IDENT_SAA7129 = 159, 131 V4L2_IDENT_SAA7129 = 159,
113 132
114 /* module cx25840: reserved range 200-249 */ 133 /* module cx25840: reserved range 200-249 */
134 V4L2_IDENT_CX25836 = 236,
135 V4L2_IDENT_CX25837 = 237,
115 V4L2_IDENT_CX25840 = 240, 136 V4L2_IDENT_CX25840 = 240,
116 V4L2_IDENT_CX25841 = 241, 137 V4L2_IDENT_CX25841 = 241,
117 V4L2_IDENT_CX25842 = 242, 138 V4L2_IDENT_CX25842 = 242,
@@ -211,4 +232,15 @@ struct v4l2_routing {
211#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing) 232#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
212#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing) 233#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)
213 234
235struct v4l2_crystal_freq {
236 u32 freq; /* frequency in Hz of the crystal */
237 u32 flags; /* device specific flags */
238};
239
240/* Sets the frequency of the crystal used to generate the clocks.
241 An extra flags field allows device specific configuration regarding
242 clock frequency dividers, etc. If not used, then set flags to 0.
243 If the frequency is not supported, then -EINVAL is returned. */
244#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW ('d', 113, struct v4l2_crystal_freq)
245
214#endif /* V4L2_COMMON_H_ */ 246#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
new file mode 100644
index 0000000000..bb495b7f46
--- /dev/null
+++ b/include/media/v4l2-dev.h
@@ -0,0 +1,378 @@
1/*
2 *
3 * V 4 L 2 D R I V E R H E L P E R A P I
4 *
5 * Moved from videodev2.h
6 *
7 * Some commonly needed functions for drivers (v4l2-common.o module)
8 */
9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H
11
12#define OBSOLETE_OWNER 1 /* to be removed soon */
13
14#include <linux/poll.h>
15#include <linux/fs.h>
16#include <linux/device.h>
17#include <linux/mutex.h>
18#include <linux/compiler.h> /* need __user */
19#ifdef CONFIG_VIDEO_V4L1_COMPAT
20#include <linux/videodev.h>
21#else
22#include <linux/videodev2.h>
23#endif
24
25#include <linux/fs.h>
26
27#define VIDEO_MAJOR 81
28/* Minor device allocation */
29#define MINOR_VFL_TYPE_GRABBER_MIN 0
30#define MINOR_VFL_TYPE_GRABBER_MAX 63
31#define MINOR_VFL_TYPE_RADIO_MIN 64
32#define MINOR_VFL_TYPE_RADIO_MAX 127
33#define MINOR_VFL_TYPE_VTX_MIN 192
34#define MINOR_VFL_TYPE_VTX_MAX 223
35#define MINOR_VFL_TYPE_VBI_MIN 224
36#define MINOR_VFL_TYPE_VBI_MAX 255
37
38#define VFL_TYPE_GRABBER 0
39#define VFL_TYPE_VBI 1
40#define VFL_TYPE_RADIO 2
41#define VFL_TYPE_VTX 3
42
43/* Video standard functions */
44extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
45extern int v4l2_video_std_construct(struct v4l2_standard *vs,
46 int id, char *name);
47
48/* prority handling */
49struct v4l2_prio_state {
50 atomic_t prios[4];
51};
52int v4l2_prio_init(struct v4l2_prio_state *global);
53int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
54 enum v4l2_priority new);
55int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
56int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
57enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
58int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
59
60/* names for fancy debug output */
61extern char *v4l2_field_names[];
62extern char *v4l2_type_names[];
63
64/* Compatibility layer interface -- v4l1-compat module */
65typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
66 unsigned int cmd, void *arg);
67#ifdef CONFIG_VIDEO_V4L1_COMPAT
68int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
69 int cmd, void *arg, v4l2_kioctl driver_ioctl);
70#else
71#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
72#endif
73
74/* 32 Bits compatibility layer for 64 bits processors */
75extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
76 unsigned long arg);
77
78/*
79 * Newer version of video_device, handled by videodev2.c
80 * This version moves redundant code from video device code to
81 * the common handler
82 */
83struct v4l2_tvnorm {
84 char *name;
85 v4l2_std_id id;
86
87 void *priv_data;
88};
89
90struct video_device
91{
92 /* device ops */
93 const struct file_operations *fops;
94
95 /* device info */
96 struct device *dev;
97 char name[32];
98 int type; /* v4l1 */
99 int type2; /* v4l2 */
100 int hardware;
101 int minor;
102
103 int debug; /* Activates debug level*/
104
105 /* Video standard vars */
106 int tvnormsize; /* Size of tvnorm array */
107 v4l2_std_id current_norm; /* Current tvnorm */
108 struct v4l2_tvnorm *tvnorms;
109
110 /* callbacks */
111 void (*release)(struct video_device *vfd);
112
113 /* ioctl callbacks */
114
115 /* VIDIOC_QUERYCAP handler */
116 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
117
118 /* Priority handling */
119 int (*vidioc_g_priority) (struct file *file, void *fh,
120 enum v4l2_priority *p);
121 int (*vidioc_s_priority) (struct file *file, void *fh,
122 enum v4l2_priority p);
123
124 /* VIDIOC_ENUM_FMT handlers */
125 int (*vidioc_enum_fmt_cap) (struct file *file, void *fh,
126 struct v4l2_fmtdesc *f);
127 int (*vidioc_enum_fmt_overlay) (struct file *file, void *fh,
128 struct v4l2_fmtdesc *f);
129 int (*vidioc_enum_fmt_vbi) (struct file *file, void *fh,
130 struct v4l2_fmtdesc *f);
131 int (*vidioc_enum_fmt_vbi_capture) (struct file *file, void *fh,
132 struct v4l2_fmtdesc *f);
133 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
134 struct v4l2_fmtdesc *f);
135 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
136 struct v4l2_fmtdesc *f);
137 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
138 struct v4l2_fmtdesc *f);
139
140 /* VIDIOC_G_FMT handlers */
141 int (*vidioc_g_fmt_cap) (struct file *file, void *fh,
142 struct v4l2_format *f);
143 int (*vidioc_g_fmt_overlay) (struct file *file, void *fh,
144 struct v4l2_format *f);
145 int (*vidioc_g_fmt_vbi) (struct file *file, void *fh,
146 struct v4l2_format *f);
147 int (*vidioc_g_fmt_vbi_output) (struct file *file, void *fh,
148 struct v4l2_format *f);
149 int (*vidioc_g_fmt_vbi_capture)(struct file *file, void *fh,
150 struct v4l2_format *f);
151 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
152 struct v4l2_format *f);
153 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
154 struct v4l2_format *f);
155
156 /* VIDIOC_S_FMT handlers */
157 int (*vidioc_s_fmt_cap) (struct file *file, void *fh,
158 struct v4l2_format *f);
159
160 int (*vidioc_s_fmt_overlay) (struct file *file, void *fh,
161 struct v4l2_format *f);
162 int (*vidioc_s_fmt_vbi) (struct file *file, void *fh,
163 struct v4l2_format *f);
164 int (*vidioc_s_fmt_vbi_output) (struct file *file, void *fh,
165 struct v4l2_format *f);
166 int (*vidioc_s_fmt_vbi_capture)(struct file *file, void *fh,
167 struct v4l2_format *f);
168 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
169 struct v4l2_format *f);
170 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
171 struct v4l2_format *f);
172
173 /* VIDIOC_TRY_FMT handlers */
174 int (*vidioc_try_fmt_cap) (struct file *file, void *fh,
175 struct v4l2_format *f);
176 int (*vidioc_try_fmt_overlay) (struct file *file, void *fh,
177 struct v4l2_format *f);
178 int (*vidioc_try_fmt_vbi) (struct file *file, void *fh,
179 struct v4l2_format *f);
180 int (*vidioc_try_fmt_vbi_output) (struct file *file, void *fh,
181 struct v4l2_format *f);
182 int (*vidioc_try_fmt_vbi_capture)(struct file *file, void *fh,
183 struct v4l2_format *f);
184 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
185 struct v4l2_format *f);
186 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
187 struct v4l2_format *f);
188
189 /* Buffer handlers */
190 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
191 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
192 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
193 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
194
195
196 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
197#ifdef CONFIG_VIDEO_V4L1_COMPAT
198 /* buffer type is struct vidio_mbuf * */
199 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p);
200#endif
201 int (*vidioc_g_fbuf) (struct file *file, void *fh,
202 struct v4l2_framebuffer *a);
203 int (*vidioc_s_fbuf) (struct file *file, void *fh,
204 struct v4l2_framebuffer *a);
205
206 /* Stream on/off */
207 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
208 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
209
210 /* Standard handling
211 G_STD and ENUMSTD are handled by videodev.c
212 */
213 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id a);
214 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
215
216 /* Input handling */
217 int (*vidioc_enum_input)(struct file *file, void *fh,
218 struct v4l2_input *inp);
219 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
220 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
221
222 /* Output handling */
223 int (*vidioc_enumoutput) (struct file *file, void *fh,
224 struct v4l2_output *a);
225 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
226 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
227
228 /* Control handling */
229 int (*vidioc_queryctrl) (struct file *file, void *fh,
230 struct v4l2_queryctrl *a);
231 int (*vidioc_g_ctrl) (struct file *file, void *fh,
232 struct v4l2_control *a);
233 int (*vidioc_s_ctrl) (struct file *file, void *fh,
234 struct v4l2_control *a);
235 int (*vidioc_g_ext_ctrls) (struct file *file, void *fh,
236 struct v4l2_ext_controls *a);
237 int (*vidioc_s_ext_ctrls) (struct file *file, void *fh,
238 struct v4l2_ext_controls *a);
239 int (*vidioc_try_ext_ctrls) (struct file *file, void *fh,
240 struct v4l2_ext_controls *a);
241 int (*vidioc_querymenu) (struct file *file, void *fh,
242 struct v4l2_querymenu *a);
243
244 /* Audio ioctls */
245 int (*vidioc_enumaudio) (struct file *file, void *fh,
246 struct v4l2_audio *a);
247 int (*vidioc_g_audio) (struct file *file, void *fh,
248 struct v4l2_audio *a);
249 int (*vidioc_s_audio) (struct file *file, void *fh,
250 struct v4l2_audio *a);
251
252 /* Audio out ioctls */
253 int (*vidioc_enumaudout) (struct file *file, void *fh,
254 struct v4l2_audioout *a);
255 int (*vidioc_g_audout) (struct file *file, void *fh,
256 struct v4l2_audioout *a);
257 int (*vidioc_s_audout) (struct file *file, void *fh,
258 struct v4l2_audioout *a);
259 int (*vidioc_g_modulator) (struct file *file, void *fh,
260 struct v4l2_modulator *a);
261 int (*vidioc_s_modulator) (struct file *file, void *fh,
262 struct v4l2_modulator *a);
263 /* Crop ioctls */
264 int (*vidioc_cropcap) (struct file *file, void *fh,
265 struct v4l2_cropcap *a);
266 int (*vidioc_g_crop) (struct file *file, void *fh,
267 struct v4l2_crop *a);
268 int (*vidioc_s_crop) (struct file *file, void *fh,
269 struct v4l2_crop *a);
270 /* Compression ioctls */
271 int (*vidioc_g_mpegcomp) (struct file *file, void *fh,
272 struct v4l2_mpeg_compression *a);
273 int (*vidioc_s_mpegcomp) (struct file *file, void *fh,
274 struct v4l2_mpeg_compression *a);
275 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
276 struct v4l2_jpegcompression *a);
277 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
278 struct v4l2_jpegcompression *a);
279
280 /* Stream type-dependent parameter ioctls */
281 int (*vidioc_g_parm) (struct file *file, void *fh,
282 struct v4l2_streamparm *a);
283 int (*vidioc_s_parm) (struct file *file, void *fh,
284 struct v4l2_streamparm *a);
285
286 /* Tuner ioctls */
287 int (*vidioc_g_tuner) (struct file *file, void *fh,
288 struct v4l2_tuner *a);
289 int (*vidioc_s_tuner) (struct file *file, void *fh,
290 struct v4l2_tuner *a);
291 int (*vidioc_g_frequency) (struct file *file, void *fh,
292 struct v4l2_frequency *a);
293 int (*vidioc_s_frequency) (struct file *file, void *fh,
294 struct v4l2_frequency *a);
295
296 /* Sliced VBI cap */
297 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
298 struct v4l2_sliced_vbi_cap *a);
299
300 /* Log status ioctl */
301 int (*vidioc_log_status) (struct file *file, void *fh);
302
303
304#ifdef OBSOLETE_OWNER /* to be removed soon */
305/* obsolete -- fops->owner is used instead */
306struct module *owner;
307/* dev->driver_data will be used instead some day.
308 * Use the video_{get|set}_drvdata() helper functions,
309 * so the switch over will be transparent for you.
310 * Or use {pci|usb}_{get|set}_drvdata() directly. */
311void *priv;
312#endif
313
314 /* for videodev.c intenal usage -- please don't touch */
315 int users; /* video_exclusive_{open|close} ... */
316 struct mutex lock; /* ... helper function uses these */
317 struct class_device class_dev; /* sysfs */
318};
319
320/* Version 2 functions */
321extern int video_register_device(struct video_device *vfd, int type, int nr);
322void video_unregister_device(struct video_device *);
323extern int video_ioctl2(struct inode *inode, struct file *file,
324 unsigned int cmd, unsigned long arg);
325
326/* helper functions to alloc / release struct video_device, the
327 later can be used for video_device->release() */
328struct video_device *video_device_alloc(void);
329void video_device_release(struct video_device *vfd);
330
331/* Include support for obsoleted stuff */
332extern int video_usercopy(struct inode *inode, struct file *file,
333 unsigned int cmd, unsigned long arg,
334 int (*func)(struct inode *inode, struct file *file,
335 unsigned int cmd, void *arg));
336
337
338#ifdef CONFIG_VIDEO_V4L1_COMPAT
339#include <linux/mm.h>
340
341extern struct video_device* video_devdata(struct file*);
342
343#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
344static inline int __must_check
345video_device_create_file(struct video_device *vfd,
346 struct class_device_attribute *attr)
347{
348 int ret = class_device_create_file(&vfd->class_dev, attr);
349 if (ret < 0)
350 printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
351 return ret;
352}
353static inline void
354video_device_remove_file(struct video_device *vfd,
355 struct class_device_attribute *attr)
356{
357 class_device_remove_file(&vfd->class_dev, attr);
358}
359
360#endif /* CONFIG_VIDEO_V4L1_COMPAT */
361
362#ifdef OBSOLETE_OWNER /* to be removed soon */
363/* helper functions to access driver private data. */
364static inline void *video_get_drvdata(struct video_device *dev)
365{
366 return dev->priv;
367}
368
369static inline void video_set_drvdata(struct video_device *dev, void *data)
370{
371 dev->priv = data;
372}
373#endif
374
375extern int video_exclusive_open(struct inode *inode, struct file *file);
376extern int video_exclusive_release(struct inode *inode, struct file *file);
377
378#endif /* _V4L2_DEV_H */
diff --git a/include/media/video-buf-dvb.h b/include/media/video-buf-dvb.h
index b78d90fe62..8233cafdee 100644
--- a/include/media/video-buf-dvb.h
+++ b/include/media/video-buf-dvb.h
@@ -26,7 +26,8 @@ struct videobuf_dvb {
26 26
27int videobuf_dvb_register(struct videobuf_dvb *dvb, 27int videobuf_dvb_register(struct videobuf_dvb *dvb,
28 struct module *module, 28 struct module *module,
29 void *adapter_priv); 29 void *adapter_priv,
30 struct device *device);
30void videobuf_dvb_unregister(struct videobuf_dvb *dvb); 31void videobuf_dvb_unregister(struct videobuf_dvb *dvb);
31 32
32/* 33/*
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index fff3fd0fbf..1115a25696 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <linux/poll.h>
26 27
27#define UNSET (-1U) 28#define UNSET (-1U)
28 29
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
new file mode 100644
index 0000000000..13e7a3c6d7
--- /dev/null
+++ b/include/mtd/Kbuild
@@ -0,0 +1,6 @@
1header-y += inftl-user.h
2header-y += jffs2-user.h
3header-y += mtd-user.h
4header-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 31329fce1f..b0a67b7ffd 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -34,6 +34,7 @@ struct mtd_oob_buf {
34#define MTD_WRITEABLE 0x400 /* Device is writeable */ 34#define MTD_WRITEABLE 0x400 /* Device is writeable */
35#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ 35#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
36#define MTD_NO_ERASE 0x1000 /* No erase necessary */ 36#define MTD_NO_ERASE 0x1000 /* No erase necessary */
37#define MTD_STUPID_LOCK 0x2000 /* Always locked after reset */
37 38
38// Some common devices / combinations of capabilities 39// Some common devices / combinations of capabilities
39#define MTD_CAP_ROM 0 40#define MTD_CAP_ROM 0
@@ -133,7 +134,7 @@ struct nand_ecclayout {
133}; 134};
134 135
135/** 136/**
136 * struct mtd_ecc_stats - error correction status 137 * struct mtd_ecc_stats - error correction stats
137 * 138 *
138 * @corrected: number of corrected bits 139 * @corrected: number of corrected bits
139 * @failed: number of uncorrectable errors 140 * @failed: number of uncorrectable errors
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 11e9eaf79f..8b06c2f365 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -8,70 +8,110 @@
8#include <net/sch_generic.h> 8#include <net/sch_generic.h>
9#include <net/pkt_sched.h> 9#include <net/pkt_sched.h>
10 10
11#define tca_gen(name) \ 11struct tcf_common {
12struct tcf_##name *next; \ 12 struct tcf_common *tcfc_next;
13 u32 index; \ 13 u32 tcfc_index;
14 int refcnt; \ 14 int tcfc_refcnt;
15 int bindcnt; \ 15 int tcfc_bindcnt;
16 u32 capab; \ 16 u32 tcfc_capab;
17 int action; \ 17 int tcfc_action;
18 struct tcf_t tm; \ 18 struct tcf_t tcfc_tm;
19 struct gnet_stats_basic bstats; \ 19 struct gnet_stats_basic tcfc_bstats;
20 struct gnet_stats_queue qstats; \ 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est rate_est; \ 21 struct gnet_stats_rate_est tcfc_rate_est;
22 spinlock_t *stats_lock; \ 22 spinlock_t *tcfc_stats_lock;
23 spinlock_t lock 23 spinlock_t tcfc_lock;
24 24};
25struct tcf_police 25#define tcf_next common.tcfc_next
26{ 26#define tcf_index common.tcfc_index
27 tca_gen(police); 27#define tcf_refcnt common.tcfc_refcnt
28 int result; 28#define tcf_bindcnt common.tcfc_bindcnt
29 u32 ewma_rate; 29#define tcf_capab common.tcfc_capab
30 u32 burst; 30#define tcf_action common.tcfc_action
31 u32 mtu; 31#define tcf_tm common.tcfc_tm
32 u32 toks; 32#define tcf_bstats common.tcfc_bstats
33 u32 ptoks; 33#define tcf_qstats common.tcfc_qstats
34 psched_time_t t_c; 34#define tcf_rate_est common.tcfc_rate_est
35 struct qdisc_rate_table *R_tab; 35#define tcf_stats_lock common.tcfc_stats_lock
36 struct qdisc_rate_table *P_tab; 36#define tcf_lock common.tcfc_lock
37
38struct tcf_police {
39 struct tcf_common common;
40 int tcfp_result;
41 u32 tcfp_ewma_rate;
42 u32 tcfp_burst;
43 u32 tcfp_mtu;
44 u32 tcfp_toks;
45 u32 tcfp_ptoks;
46 psched_time_t tcfp_t_c;
47 struct qdisc_rate_table *tcfp_R_tab;
48 struct qdisc_rate_table *tcfp_P_tab;
37}; 49};
50#define to_police(pc) \
51 container_of(pc, struct tcf_police, common)
52
53struct tcf_hashinfo {
54 struct tcf_common **htab;
55 unsigned int hmask;
56 rwlock_t *lock;
57};
58
59static inline unsigned int tcf_hash(u32 index, unsigned int hmask)
60{
61 return index & hmask;
62}
38 63
39#ifdef CONFIG_NET_CLS_ACT 64#ifdef CONFIG_NET_CLS_ACT
40 65
41#define ACT_P_CREATED 1 66#define ACT_P_CREATED 1
42#define ACT_P_DELETED 1 67#define ACT_P_DELETED 1
43 68
44struct tcf_act_hdr 69struct tcf_act_hdr {
45{ 70 struct tcf_common common;
46 tca_gen(act_hdr);
47}; 71};
48 72
49struct tc_action 73struct tc_action {
50{ 74 void *priv;
51 void *priv; 75 struct tc_action_ops *ops;
52 struct tc_action_ops *ops; 76 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
53 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ 77 __u32 order;
54 __u32 order; 78 struct tc_action *next;
55 struct tc_action *next;
56}; 79};
57 80
58#define TCA_CAP_NONE 0 81#define TCA_CAP_NONE 0
59struct tc_action_ops 82struct tc_action_ops {
60{
61 struct tc_action_ops *next; 83 struct tc_action_ops *next;
84 struct tcf_hashinfo *hinfo;
62 char kind[IFNAMSIZ]; 85 char kind[IFNAMSIZ];
63 __u32 type; /* TBD to match kind */ 86 __u32 type; /* TBD to match kind */
64 __u32 capab; /* capabilities includes 4 bit version */ 87 __u32 capab; /* capabilities includes 4 bit version */
65 struct module *owner; 88 struct module *owner;
66 int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); 89 int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *);
67 int (*get_stats)(struct sk_buff *, struct tc_action *); 90 int (*get_stats)(struct sk_buff *, struct tc_action *);
68 int (*dump)(struct sk_buff *, struct tc_action *,int , int); 91 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
69 int (*cleanup)(struct tc_action *, int bind); 92 int (*cleanup)(struct tc_action *, int bind);
70 int (*lookup)(struct tc_action *, u32 ); 93 int (*lookup)(struct tc_action *, u32);
71 int (*init)(struct rtattr *,struct rtattr *,struct tc_action *, int , int ); 94 int (*init)(struct rtattr *, struct rtattr *, struct tc_action *, int , int);
72 int (*walk)(struct sk_buff *, struct netlink_callback *, int , struct tc_action *); 95 int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *);
73}; 96};
74 97
98extern struct tcf_common *tcf_hash_lookup(u32 index,
99 struct tcf_hashinfo *hinfo);
100extern void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo);
101extern int tcf_hash_release(struct tcf_common *p, int bind,
102 struct tcf_hashinfo *hinfo);
103extern int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb,
104 int type, struct tc_action *a);
105extern u32 tcf_hash_new_index(u32 *idx_gen, struct tcf_hashinfo *hinfo);
106extern int tcf_hash_search(struct tc_action *a, u32 index);
107extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a,
108 int bind, struct tcf_hashinfo *hinfo);
109extern struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est,
110 struct tc_action *a, int size,
111 int bind, u32 *idx_gen,
112 struct tcf_hashinfo *hinfo);
113extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo);
114
75extern int tcf_register_action(struct tc_action_ops *a); 115extern int tcf_register_action(struct tc_action_ops *a);
76extern int tcf_unregister_action(struct tc_action_ops *a); 116extern int tcf_unregister_action(struct tc_action_ops *a);
77extern void tcf_action_destroy(struct tc_action *a, int bind); 117extern void tcf_action_destroy(struct tc_action *a, int bind);
@@ -96,17 +136,17 @@ tcf_police_release(struct tcf_police *p, int bind)
96 int ret = 0; 136 int ret = 0;
97#ifdef CONFIG_NET_CLS_ACT 137#ifdef CONFIG_NET_CLS_ACT
98 if (p) { 138 if (p) {
99 if (bind) { 139 if (bind)
100 p->bindcnt--; 140 p->tcf_bindcnt--;
101 } 141
102 p->refcnt--; 142 p->tcf_refcnt--;
103 if (p->refcnt <= 0 && !p->bindcnt) { 143 if (p->tcf_refcnt <= 0 && !p->tcf_bindcnt) {
104 tcf_police_destroy(p); 144 tcf_police_destroy(p);
105 ret = 1; 145 ret = 1;
106 } 146 }
107 } 147 }
108#else 148#else
109 if (p && --p->refcnt == 0) 149 if (p && --p->tcf_refcnt == 0)
110 tcf_police_destroy(p); 150 tcf_police_destroy(p);
111 151
112#endif /* CONFIG_NET_CLS_ACT */ 152#endif /* CONFIG_NET_CLS_ACT */
diff --git a/include/net/act_generic.h b/include/net/act_generic.h
deleted file mode 100644
index c9daa7e523..0000000000
--- a/include/net/act_generic.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * include/net/act_generic.h
3 *
4*/
5#ifndef _NET_ACT_GENERIC_H
6#define _NET_ACT_GENERIC_H
7static inline int tcf_defact_release(struct tcf_defact *p, int bind)
8{
9 int ret = 0;
10 if (p) {
11 if (bind) {
12 p->bindcnt--;
13 }
14 p->refcnt--;
15 if (p->bindcnt <= 0 && p->refcnt <= 0) {
16 kfree(p->defdata);
17 tcf_hash_destroy(p);
18 ret = 1;
19 }
20 }
21 return ret;
22}
23
24static inline int
25alloc_defdata(struct tcf_defact *p, u32 datalen, void *defdata)
26{
27 p->defdata = kmalloc(datalen, GFP_KERNEL);
28 if (p->defdata == NULL)
29 return -ENOMEM;
30 p->datalen = datalen;
31 memcpy(p->defdata, defdata, datalen);
32 return 0;
33}
34
35static inline int
36realloc_defdata(struct tcf_defact *p, u32 datalen, void *defdata)
37{
38 /* safer to be just brute force for now */
39 kfree(p->defdata);
40 return alloc_defdata(p, datalen, defdata);
41}
42
43static inline int
44tcf_defact_init(struct rtattr *rta, struct rtattr *est,
45 struct tc_action *a, int ovr, int bind)
46{
47 struct rtattr *tb[TCA_DEF_MAX];
48 struct tc_defact *parm;
49 struct tcf_defact *p;
50 void *defdata;
51 u32 datalen = 0;
52 int ret = 0;
53
54 if (rta == NULL || rtattr_parse_nested(tb, TCA_DEF_MAX, rta) < 0)
55 return -EINVAL;
56
57 if (tb[TCA_DEF_PARMS - 1] == NULL ||
58 RTA_PAYLOAD(tb[TCA_DEF_PARMS - 1]) < sizeof(*parm))
59 return -EINVAL;
60
61 parm = RTA_DATA(tb[TCA_DEF_PARMS - 1]);
62 defdata = RTA_DATA(tb[TCA_DEF_DATA - 1]);
63 if (defdata == NULL)
64 return -EINVAL;
65
66 datalen = RTA_PAYLOAD(tb[TCA_DEF_DATA - 1]);
67 if (datalen <= 0)
68 return -EINVAL;
69
70 p = tcf_hash_check(parm->index, a, ovr, bind);
71 if (p == NULL) {
72 p = tcf_hash_create(parm->index, est, a, sizeof(*p), ovr, bind);
73 if (p == NULL)
74 return -ENOMEM;
75
76 ret = alloc_defdata(p, datalen, defdata);
77 if (ret < 0) {
78 kfree(p);
79 return ret;
80 }
81 ret = ACT_P_CREATED;
82 } else {
83 if (!ovr) {
84 tcf_defact_release(p, bind);
85 return -EEXIST;
86 }
87 realloc_defdata(p, datalen, defdata);
88 }
89
90 spin_lock_bh(&p->lock);
91 p->action = parm->action;
92 spin_unlock_bh(&p->lock);
93 if (ret == ACT_P_CREATED)
94 tcf_hash_insert(p);
95 return ret;
96}
97
98static inline int tcf_defact_cleanup(struct tc_action *a, int bind)
99{
100 struct tcf_defact *p = PRIV(a, defact);
101
102 if (p != NULL)
103 return tcf_defact_release(p, bind);
104 return 0;
105}
106
107static inline int
108tcf_defact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
109{
110 unsigned char *b = skb->tail;
111 struct tc_defact opt;
112 struct tcf_defact *p = PRIV(a, defact);
113 struct tcf_t t;
114
115 opt.index = p->index;
116 opt.refcnt = p->refcnt - ref;
117 opt.bindcnt = p->bindcnt - bind;
118 opt.action = p->action;
119 RTA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt);
120 RTA_PUT(skb, TCA_DEF_DATA, p->datalen, p->defdata);
121 t.install = jiffies_to_clock_t(jiffies - p->tm.install);
122 t.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse);
123 t.expires = jiffies_to_clock_t(p->tm.expires);
124 RTA_PUT(skb, TCA_DEF_TM, sizeof(t), &t);
125 return skb->len;
126
127rtattr_failure:
128 skb_trim(skb, b - skb->data);
129 return -1;
130}
131
132#define tca_use_default_ops \
133 .dump = tcf_defact_dump, \
134 .cleanup = tcf_defact_cleanup, \
135 .init = tcf_defact_init, \
136 .walk = tcf_generic_walker, \
137
138#define tca_use_default_defines(name) \
139 static u32 idx_gen; \
140 static struct tcf_defact *tcf_##name_ht[MY_TAB_SIZE]; \
141 static DEFINE_RWLOCK(##name_lock);
142#endif /* _NET_ACT_GENERIC_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 3d71251b3e..44f1b673f9 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -61,6 +61,9 @@ extern int addrconf_set_dstaddr(void __user *arg);
61extern int ipv6_chk_addr(struct in6_addr *addr, 61extern int ipv6_chk_addr(struct in6_addr *addr,
62 struct net_device *dev, 62 struct net_device *dev,
63 int strict); 63 int strict);
64#ifdef CONFIG_IPV6_MIP6
65extern int ipv6_chk_home_addr(struct in6_addr *addr);
66#endif
64extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, 67extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr,
65 struct net_device *dev, 68 struct net_device *dev,
66 int strict); 69 int strict);
@@ -126,20 +129,18 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb);
126static inline struct inet6_dev * 129static inline struct inet6_dev *
127__in6_dev_get(struct net_device *dev) 130__in6_dev_get(struct net_device *dev)
128{ 131{
129 return (struct inet6_dev *)dev->ip6_ptr; 132 return rcu_dereference(dev->ip6_ptr);
130} 133}
131 134
132extern rwlock_t addrconf_lock;
133
134static inline struct inet6_dev * 135static inline struct inet6_dev *
135in6_dev_get(struct net_device *dev) 136in6_dev_get(struct net_device *dev)
136{ 137{
137 struct inet6_dev *idev = NULL; 138 struct inet6_dev *idev = NULL;
138 read_lock(&addrconf_lock); 139 rcu_read_lock();
139 idev = dev->ip6_ptr; 140 idev = __in6_dev_get(dev);
140 if (idev) 141 if (idev)
141 atomic_inc(&idev->refcnt); 142 atomic_inc(&idev->refcnt);
142 read_unlock(&addrconf_lock); 143 rcu_read_unlock();
143 return idev; 144 return idev;
144} 145}
145 146
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 795f81f9ec..c0398f5a8c 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -53,14 +53,21 @@ struct unix_address {
53struct unix_skb_parms { 53struct unix_skb_parms {
54 struct ucred creds; /* Skb credentials */ 54 struct ucred creds; /* Skb credentials */
55 struct scm_fp_list *fp; /* Passed files */ 55 struct scm_fp_list *fp; /* Passed files */
56#ifdef CONFIG_SECURITY_NETWORK
57 u32 secid; /* Security ID */
58#endif
56}; 59};
57 60
58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 61#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 62#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
63#define UNIXSID(skb) (&UNIXCB((skb)).secid)
60 64
61#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) 65#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
62#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) 66#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
63#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) 67#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock)
68#define unix_state_wlock_nested(s) \
69 spin_lock_nested(&unix_sk(s)->lock, \
70 SINGLE_DEPTH_NESTING)
64#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) 71#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
65 72
66#ifdef __KERNEL__ 73#ifdef __KERNEL__
diff --git a/include/net/ah.h b/include/net/ah.h
index ceff00afae..8f257c1599 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -1,6 +1,7 @@
1#ifndef _NET_AH_H 1#ifndef _NET_AH_H
2#define _NET_AH_H 2#define _NET_AH_H
3 3
4#include <linux/crypto.h>
4#include <net/xfrm.h> 5#include <net/xfrm.h>
5 6
6/* This is the maximum truncated ICV length that we know of. */ 7/* This is the maximum truncated ICV length that we know of. */
@@ -14,22 +15,29 @@ struct ah_data
14 int icv_full_len; 15 int icv_full_len;
15 int icv_trunc_len; 16 int icv_trunc_len;
16 17
17 void (*icv)(struct ah_data*, 18 struct crypto_hash *tfm;
18 struct sk_buff *skb, u8 *icv);
19
20 struct crypto_tfm *tfm;
21}; 19};
22 20
23static inline void 21static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb,
24ah_hmac_digest(struct ah_data *ahp, struct sk_buff *skb, u8 *auth_data) 22 u8 *auth_data)
25{ 23{
26 struct crypto_tfm *tfm = ahp->tfm; 24 struct hash_desc desc;
25 int err;
26
27 desc.tfm = ahp->tfm;
28 desc.flags = 0;
27 29
28 memset(auth_data, 0, ahp->icv_trunc_len); 30 memset(auth_data, 0, ahp->icv_trunc_len);
29 crypto_hmac_init(tfm, ahp->key, &ahp->key_len); 31 err = crypto_hash_init(&desc);
30 skb_icv_walk(skb, tfm, 0, skb->len, crypto_hmac_update); 32 if (unlikely(err))
31 crypto_hmac_final(tfm, ahp->key, &ahp->key_len, ahp->work_icv); 33 goto out;
32 memcpy(auth_data, ahp->work_icv, ahp->icv_trunc_len); 34 err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update);
35 if (unlikely(err))
36 goto out;
37 err = crypto_hash_final(&desc, ahp->work_icv);
38
39out:
40 return err;
33} 41}
34 42
35#endif 43#endif
diff --git a/include/net/arp.h b/include/net/arp.h
index 643bded9f5..6a3d9a7d30 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/ax25.h b/include/net/ax25.h
index 7cd528e9d6..69374cd1a8 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -182,14 +182,26 @@ typedef struct {
182 182
183typedef struct ax25_route { 183typedef struct ax25_route {
184 struct ax25_route *next; 184 struct ax25_route *next;
185 atomic_t ref; 185 atomic_t refcount;
186 ax25_address callsign; 186 ax25_address callsign;
187 struct net_device *dev; 187 struct net_device *dev;
188 ax25_digi *digipeat; 188 ax25_digi *digipeat;
189 char ip_mode; 189 char ip_mode;
190 struct timer_list timer;
191} ax25_route; 190} ax25_route;
192 191
192static inline void ax25_hold_route(ax25_route *ax25_rt)
193{
194 atomic_inc(&ax25_rt->refcount);
195}
196
197extern void __ax25_put_route(ax25_route *ax25_rt);
198
199static inline void ax25_put_route(ax25_route *ax25_rt)
200{
201 if (atomic_dec_and_test(&ax25_rt->refcount))
202 __ax25_put_route(ax25_rt);
203}
204
193typedef struct { 205typedef struct {
194 char slave; /* slave_mode? */ 206 char slave; /* slave_mode? */
195 struct timer_list slave_timer; /* timeout timer */ 207 struct timer_list slave_timer; /* timeout timer */
@@ -348,17 +360,11 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short);
348extern void ax25_rt_device_down(struct net_device *); 360extern void ax25_rt_device_down(struct net_device *);
349extern int ax25_rt_ioctl(unsigned int, void __user *); 361extern int ax25_rt_ioctl(unsigned int, void __user *);
350extern struct file_operations ax25_route_fops; 362extern struct file_operations ax25_route_fops;
363extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev);
351extern int ax25_rt_autobind(ax25_cb *, ax25_address *); 364extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
352extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *,
353 struct net_device *);
354extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); 365extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *);
355extern void ax25_rt_free(void); 366extern void ax25_rt_free(void);
356 367
357static inline void ax25_put_route(ax25_route *ax25_rt)
358{
359 atomic_dec(&ax25_rt->ref);
360}
361
362/* ax25_std_in.c */ 368/* ax25_std_in.c */
363extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); 369extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int);
364 370
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 911ceb5cd2..771d17783c 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -175,6 +175,6 @@ extern int hci_sock_cleanup(void);
175extern int bt_sysfs_init(void); 175extern int bt_sysfs_init(void);
176extern void bt_sysfs_cleanup(void); 176extern void bt_sysfs_cleanup(void);
177 177
178extern struct class bt_class; 178extern struct class *bt_class;
179 179
180#endif /* __BLUETOOTH_H */ 180#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index b06a2d2f63..10a3eec191 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -44,17 +44,19 @@
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 {
56 HCI_QUIRK_RESET_ON_INIT, 57 HCI_QUIRK_RESET_ON_INIT,
57 HCI_QUIRK_RAW_DEVICE 58 HCI_QUIRK_RAW_DEVICE,
59 HCI_QUIRK_FIXUP_BUFFER_SIZE
58}; 60};
59 61
60/* HCI device flags */ 62/* HCI device flags */
@@ -100,9 +102,10 @@ enum {
100#define HCIINQUIRY _IOR('H', 240, int) 102#define HCIINQUIRY _IOR('H', 240, int)
101 103
102/* HCI timeouts */ 104/* HCI timeouts */
103#define HCI_CONN_TIMEOUT (HZ * 40) 105#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
104#define HCI_DISCONN_TIMEOUT (HZ * 2) 106#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
105#define HCI_CONN_IDLE_TIMEOUT (HZ * 60) 107#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
108#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
106 109
107/* HCI Packet types */ 110/* HCI Packet types */
108#define HCI_COMMAND_PKT 0x01 111#define HCI_COMMAND_PKT 0x01
@@ -144,7 +147,7 @@ enum {
144#define LMP_TACCURACY 0x10 147#define LMP_TACCURACY 0x10
145#define LMP_RSWITCH 0x20 148#define LMP_RSWITCH 0x20
146#define LMP_HOLD 0x40 149#define LMP_HOLD 0x40
147#define LMP_SNIF 0x80 150#define LMP_SNIFF 0x80
148 151
149#define LMP_PARK 0x01 152#define LMP_PARK 0x01
150#define LMP_RSSI 0x02 153#define LMP_RSSI 0x02
@@ -159,13 +162,21 @@ enum {
159#define LMP_PSCHEME 0x02 162#define LMP_PSCHEME 0x02
160#define LMP_PCONTROL 0x04 163#define LMP_PCONTROL 0x04
161 164
165#define LMP_SNIFF_SUBR 0x02
166
167/* Connection modes */
168#define HCI_CM_ACTIVE 0x0000
169#define HCI_CM_HOLD 0x0001
170#define HCI_CM_SNIFF 0x0002
171#define HCI_CM_PARK 0x0003
172
162/* Link policies */ 173/* Link policies */
163#define HCI_LP_RSWITCH 0x0001 174#define HCI_LP_RSWITCH 0x0001
164#define HCI_LP_HOLD 0x0002 175#define HCI_LP_HOLD 0x0002
165#define HCI_LP_SNIFF 0x0004 176#define HCI_LP_SNIFF 0x0004
166#define HCI_LP_PARK 0x0008 177#define HCI_LP_PARK 0x0008
167 178
168/* Link mode */ 179/* Link modes */
169#define HCI_LM_ACCEPT 0x8000 180#define HCI_LM_ACCEPT 0x8000
170#define HCI_LM_MASTER 0x0001 181#define HCI_LM_MASTER 0x0001
171#define HCI_LM_AUTH 0x0002 182#define HCI_LM_AUTH 0x0002
@@ -191,7 +202,7 @@ struct hci_rp_read_loc_version {
191} __attribute__ ((packed)); 202} __attribute__ ((packed));
192 203
193#define OCF_READ_LOCAL_FEATURES 0x0003 204#define OCF_READ_LOCAL_FEATURES 0x0003
194struct hci_rp_read_loc_features { 205struct hci_rp_read_local_features {
195 __u8 status; 206 __u8 status;
196 __u8 features[8]; 207 __u8 features[8];
197} __attribute__ ((packed)); 208} __attribute__ ((packed));
@@ -286,6 +297,7 @@ struct hci_cp_host_buffer_size {
286 297
287/* Link Control */ 298/* Link Control */
288#define OGF_LINK_CTL 0x01 299#define OGF_LINK_CTL 0x01
300
289#define OCF_CREATE_CONN 0x0005 301#define OCF_CREATE_CONN 0x0005
290struct hci_cp_create_conn { 302struct hci_cp_create_conn {
291 bdaddr_t bdaddr; 303 bdaddr_t bdaddr;
@@ -296,6 +308,11 @@ struct hci_cp_create_conn {
296 __u8 role_switch; 308 __u8 role_switch;
297} __attribute__ ((packed)); 309} __attribute__ ((packed));
298 310
311#define OCF_CREATE_CONN_CANCEL 0x0008
312struct hci_cp_create_conn_cancel {
313 bdaddr_t bdaddr;
314} __attribute__ ((packed));
315
299#define OCF_ACCEPT_CONN_REQ 0x0009 316#define OCF_ACCEPT_CONN_REQ 0x0009
300struct hci_cp_accept_conn_req { 317struct hci_cp_accept_conn_req {
301 bdaddr_t bdaddr; 318 bdaddr_t bdaddr;
@@ -329,6 +346,8 @@ struct hci_cp_inquiry {
329 346
330#define OCF_INQUIRY_CANCEL 0x0002 347#define OCF_INQUIRY_CANCEL 0x0002
331 348
349#define OCF_EXIT_PERIODIC_INQ 0x0004
350
332#define OCF_LINK_KEY_REPLY 0x000B 351#define OCF_LINK_KEY_REPLY 0x000B
333struct hci_cp_link_key_reply { 352struct hci_cp_link_key_reply {
334 bdaddr_t bdaddr; 353 bdaddr_t bdaddr;
@@ -375,17 +394,32 @@ struct hci_cp_change_conn_link_key {
375} __attribute__ ((packed)); 394} __attribute__ ((packed));
376 395
377#define OCF_READ_REMOTE_FEATURES 0x001B 396#define OCF_READ_REMOTE_FEATURES 0x001B
378struct hci_cp_read_rmt_features { 397struct hci_cp_read_remote_features {
379 __le16 handle; 398 __le16 handle;
380} __attribute__ ((packed)); 399} __attribute__ ((packed));
381 400
382#define OCF_READ_REMOTE_VERSION 0x001D 401#define OCF_READ_REMOTE_VERSION 0x001D
383struct hci_cp_read_rmt_version { 402struct hci_cp_read_remote_version {
384 __le16 handle; 403 __le16 handle;
385} __attribute__ ((packed)); 404} __attribute__ ((packed));
386 405
387/* Link Policy */ 406/* Link Policy */
388#define OGF_LINK_POLICY 0x02 407#define OGF_LINK_POLICY 0x02
408
409#define OCF_SNIFF_MODE 0x0003
410struct hci_cp_sniff_mode {
411 __le16 handle;
412 __le16 max_interval;
413 __le16 min_interval;
414 __le16 attempt;
415 __le16 timeout;
416} __attribute__ ((packed));
417
418#define OCF_EXIT_SNIFF_MODE 0x0004
419struct hci_cp_exit_sniff_mode {
420 __le16 handle;
421} __attribute__ ((packed));
422
389#define OCF_ROLE_DISCOVERY 0x0009 423#define OCF_ROLE_DISCOVERY 0x0009
390struct hci_cp_role_discovery { 424struct hci_cp_role_discovery {
391 __le16 handle; 425 __le16 handle;
@@ -406,7 +440,7 @@ struct hci_rp_read_link_policy {
406 __le16 policy; 440 __le16 policy;
407} __attribute__ ((packed)); 441} __attribute__ ((packed));
408 442
409#define OCF_SWITCH_ROLE 0x000B 443#define OCF_SWITCH_ROLE 0x000B
410struct hci_cp_switch_role { 444struct hci_cp_switch_role {
411 bdaddr_t bdaddr; 445 bdaddr_t bdaddr;
412 __u8 role; 446 __u8 role;
@@ -422,6 +456,14 @@ struct hci_rp_write_link_policy {
422 __le16 handle; 456 __le16 handle;
423} __attribute__ ((packed)); 457} __attribute__ ((packed));
424 458
459#define OCF_SNIFF_SUBRATE 0x0011
460struct hci_cp_sniff_subrate {
461 __le16 handle;
462 __le16 max_latency;
463 __le16 min_remote_timeout;
464 __le16 min_local_timeout;
465} __attribute__ ((packed));
466
425/* Status params */ 467/* Status params */
426#define OGF_STATUS_PARAM 0x05 468#define OGF_STATUS_PARAM 0x05
427 469
@@ -581,15 +623,15 @@ struct hci_ev_link_key_notify {
581 __u8 key_type; 623 __u8 key_type;
582} __attribute__ ((packed)); 624} __attribute__ ((packed));
583 625
584#define HCI_EV_RMT_FEATURES 0x0B 626#define HCI_EV_REMOTE_FEATURES 0x0B
585struct hci_ev_rmt_features { 627struct hci_ev_remote_features {
586 __u8 status; 628 __u8 status;
587 __le16 handle; 629 __le16 handle;
588 __u8 features[8]; 630 __u8 features[8];
589} __attribute__ ((packed)); 631} __attribute__ ((packed));
590 632
591#define HCI_EV_RMT_VERSION 0x0C 633#define HCI_EV_REMOTE_VERSION 0x0C
592struct hci_ev_rmt_version { 634struct hci_ev_remote_version {
593 __u8 status; 635 __u8 status;
594 __le16 handle; 636 __le16 handle;
595 __u8 lmp_ver; 637 __u8 lmp_ver;
@@ -610,6 +652,16 @@ struct hci_ev_pscan_rep_mode {
610 __u8 pscan_rep_mode; 652 __u8 pscan_rep_mode;
611} __attribute__ ((packed)); 653} __attribute__ ((packed));
612 654
655#define HCI_EV_SNIFF_SUBRATE 0x2E
656struct hci_ev_sniff_subrate {
657 __u8 status;
658 __le16 handle;
659 __le16 max_tx_latency;
660 __le16 max_rx_latency;
661 __le16 max_remote_timeout;
662 __le16 max_local_timeout;
663} __attribute__ ((packed));
664
613/* Internal events generated by Bluetooth stack */ 665/* Internal events generated by Bluetooth stack */
614#define HCI_EV_STACK_INTERNAL 0xFD 666#define HCI_EV_STACK_INTERNAL 0xFD
615struct hci_ev_stack_internal { 667struct hci_ev_stack_internal {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index bb9f81dc87..df22efcfcc 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -31,10 +31,7 @@
31#define HCI_PROTO_L2CAP 0 31#define HCI_PROTO_L2CAP 0
32#define HCI_PROTO_SCO 1 32#define HCI_PROTO_SCO 1
33 33
34#define HCI_INIT_TIMEOUT (HZ * 10)
35
36/* HCI Core structures */ 34/* HCI Core structures */
37
38struct inquiry_data { 35struct inquiry_data {
39 bdaddr_t bdaddr; 36 bdaddr_t bdaddr;
40 __u8 pscan_rep_mode; 37 __u8 pscan_rep_mode;
@@ -75,12 +72,19 @@ struct hci_dev {
75 __u8 type; 72 __u8 type;
76 bdaddr_t bdaddr; 73 bdaddr_t bdaddr;
77 __u8 features[8]; 74 __u8 features[8];
75 __u8 hci_ver;
76 __u16 hci_rev;
77 __u16 manufacturer;
78 __u16 voice_setting; 78 __u16 voice_setting;
79 79
80 __u16 pkt_type; 80 __u16 pkt_type;
81 __u16 link_policy; 81 __u16 link_policy;
82 __u16 link_mode; 82 __u16 link_mode;
83 83
84 __u32 idle_timeout;
85 __u16 sniff_min_interval;
86 __u16 sniff_max_interval;
87
84 unsigned long quirks; 88 unsigned long quirks;
85 89
86 atomic_t cmd_cnt; 90 atomic_t cmd_cnt;
@@ -123,7 +127,8 @@ struct hci_dev {
123 127
124 atomic_t promisc; 128 atomic_t promisc;
125 129
126 struct class_device class_dev; 130 struct device *parent;
131 struct device dev;
127 132
128 struct module *owner; 133 struct module *owner;
129 134
@@ -145,18 +150,28 @@ struct hci_conn {
145 bdaddr_t dst; 150 bdaddr_t dst;
146 __u16 handle; 151 __u16 handle;
147 __u16 state; 152 __u16 state;
153 __u8 mode;
148 __u8 type; 154 __u8 type;
149 __u8 out; 155 __u8 out;
150 __u8 dev_class[3]; 156 __u8 dev_class[3];
157 __u8 features[8];
158 __u16 interval;
159 __u16 link_policy;
151 __u32 link_mode; 160 __u32 link_mode;
161 __u8 power_save;
152 unsigned long pend; 162 unsigned long pend;
153 163
154 unsigned int sent; 164 unsigned int sent;
155 165
156 struct sk_buff_head data_q; 166 struct sk_buff_head data_q;
157 167
158 struct timer_list timer; 168 struct timer_list disc_timer;
159 169 struct timer_list idle_timer;
170
171 struct work_struct work;
172
173 struct device dev;
174
160 struct hci_dev *hdev; 175 struct hci_dev *hdev;
161 void *l2cap_data; 176 void *l2cap_data;
162 void *sco_data; 177 void *sco_data;
@@ -211,7 +226,8 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data);
211enum { 226enum {
212 HCI_CONN_AUTH_PEND, 227 HCI_CONN_AUTH_PEND,
213 HCI_CONN_ENCRYPT_PEND, 228 HCI_CONN_ENCRYPT_PEND,
214 HCI_CONN_RSWITCH_PEND 229 HCI_CONN_RSWITCH_PEND,
230 HCI_CONN_MODE_CHANGE_PEND,
215}; 231};
216 232
217static inline void hci_conn_hash_init(struct hci_dev *hdev) 233static inline void hci_conn_hash_init(struct hci_dev *hdev)
@@ -286,31 +302,30 @@ int hci_conn_encrypt(struct hci_conn *conn);
286int hci_conn_change_link_key(struct hci_conn *conn); 302int hci_conn_change_link_key(struct hci_conn *conn);
287int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); 303int hci_conn_switch_role(struct hci_conn *conn, uint8_t role);
288 304
289static inline void hci_conn_set_timer(struct hci_conn *conn, unsigned long timeout) 305void hci_conn_enter_active_mode(struct hci_conn *conn);
290{ 306void hci_conn_enter_sniff_mode(struct hci_conn *conn);
291 mod_timer(&conn->timer, jiffies + timeout);
292}
293
294static inline void hci_conn_del_timer(struct hci_conn *conn)
295{
296 del_timer(&conn->timer);
297}
298 307
299static inline void hci_conn_hold(struct hci_conn *conn) 308static inline void hci_conn_hold(struct hci_conn *conn)
300{ 309{
301 atomic_inc(&conn->refcnt); 310 atomic_inc(&conn->refcnt);
302 hci_conn_del_timer(conn); 311 del_timer(&conn->disc_timer);
303} 312}
304 313
305static inline void hci_conn_put(struct hci_conn *conn) 314static inline void hci_conn_put(struct hci_conn *conn)
306{ 315{
307 if (atomic_dec_and_test(&conn->refcnt)) { 316 if (atomic_dec_and_test(&conn->refcnt)) {
317 unsigned long timeo;
308 if (conn->type == ACL_LINK) { 318 if (conn->type == ACL_LINK) {
309 unsigned long timeo = (conn->out) ? 319 del_timer(&conn->idle_timer);
310 HCI_DISCONN_TIMEOUT : HCI_DISCONN_TIMEOUT * 2; 320 if (conn->state == BT_CONNECTED) {
311 hci_conn_set_timer(conn, timeo); 321 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
322 if (!conn->out)
323 timeo *= 2;
324 } else
325 timeo = msecs_to_jiffies(10);
312 } else 326 } else
313 hci_conn_set_timer(conn, HZ / 100); 327 timeo = msecs_to_jiffies(10);
328 mod_timer(&conn->disc_timer, jiffies + timeo);
314 } 329 }
315} 330}
316 331
@@ -407,12 +422,16 @@ static inline int hci_recv_frame(struct sk_buff *skb)
407 422
408int hci_register_sysfs(struct hci_dev *hdev); 423int hci_register_sysfs(struct hci_dev *hdev);
409void 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);
410 427
411#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->class_dev.dev = (pdev)) 428#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev))
412 429
413/* ----- LMP capabilities ----- */ 430/* ----- LMP capabilities ----- */
414#define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH) 431#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
415#define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT) 432#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT)
433#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF)
434#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
416 435
417/* ----- HCI protocols ----- */ 436/* ----- HCI protocols ----- */
418struct hci_proto { 437struct hci_proto {
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
new file mode 100644
index 0000000000..718b4d9c89
--- /dev/null
+++ b/include/net/cipso_ipv4.h
@@ -0,0 +1,254 @@
1/*
2 * CIPSO - Commercial IP Security Option
3 *
4 * This is an implementation of the CIPSO 2.2 protocol as specified in
5 * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in
6 * FIPS-188, copies of both documents can be found in the Documentation
7 * directory. While CIPSO never became a full IETF RFC standard many vendors
8 * have chosen to adopt the protocol and over the years it has become a
9 * de-facto standard for labeled networking.
10 *
11 * Author: Paul Moore <paul.moore@hp.com>
12 *
13 */
14
15/*
16 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
26 * the GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 *
32 */
33
34#ifndef _CIPSO_IPV4_H
35#define _CIPSO_IPV4_H
36
37#include <linux/types.h>
38#include <linux/rcupdate.h>
39#include <linux/list.h>
40#include <linux/net.h>
41#include <linux/skbuff.h>
42#include <net/netlabel.h>
43
44/* known doi values */
45#define CIPSO_V4_DOI_UNKNOWN 0x00000000
46
47/* tag types */
48#define CIPSO_V4_TAG_INVALID 0
49#define CIPSO_V4_TAG_RBITMAP 1
50#define CIPSO_V4_TAG_ENUM 2
51#define CIPSO_V4_TAG_RANGE 5
52#define CIPSO_V4_TAG_PBITMAP 6
53#define CIPSO_V4_TAG_FREEFORM 7
54
55/* doi mapping types */
56#define CIPSO_V4_MAP_UNKNOWN 0
57#define CIPSO_V4_MAP_STD 1
58#define CIPSO_V4_MAP_PASS 2
59
60/* limits */
61#define CIPSO_V4_MAX_REM_LVLS 256
62#define CIPSO_V4_INV_LVL 0x80000000
63#define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1)
64#define CIPSO_V4_MAX_REM_CATS 65536
65#define CIPSO_V4_INV_CAT 0x80000000
66#define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1)
67
68/*
69 * CIPSO DOI definitions
70 */
71
72/* DOI definition struct */
73#define CIPSO_V4_TAG_MAXCNT 5
74struct cipso_v4_doi {
75 u32 doi;
76 u32 type;
77 union {
78 struct cipso_v4_std_map_tbl *std;
79 } map;
80 u8 tags[CIPSO_V4_TAG_MAXCNT];
81
82 u32 valid;
83 struct list_head list;
84 struct rcu_head rcu;
85 struct list_head dom_list;
86};
87
88/* Standard CIPSO mapping table */
89/* NOTE: the highest order bit (i.e. 0x80000000) is an 'invalid' flag, if the
90 * bit is set then consider that value as unspecified, meaning the
91 * mapping for that particular level/category is invalid */
92struct cipso_v4_std_map_tbl {
93 struct {
94 u32 *cipso;
95 u32 *local;
96 u32 cipso_size;
97 u32 local_size;
98 } lvl;
99 struct {
100 u32 *cipso;
101 u32 *local;
102 u32 cipso_size;
103 u32 local_size;
104 } cat;
105};
106
107/*
108 * Sysctl Variables
109 */
110
111#ifdef CONFIG_NETLABEL
112extern int cipso_v4_cache_enabled;
113extern int cipso_v4_cache_bucketsize;
114extern int cipso_v4_rbm_optfmt;
115extern int cipso_v4_rbm_strictvalid;
116#endif
117
118/*
119 * Helper Functions
120 */
121
122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0)
123#define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso)
124
125/*
126 * DOI List Functions
127 */
128
129#ifdef CONFIG_NETLABEL
130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
131int cipso_v4_doi_remove(u32 doi,
132 struct netlbl_audit *audit_info,
133 void (*callback) (struct rcu_head * head));
134struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
135int cipso_v4_doi_walk(u32 *skip_cnt,
136 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
137 void *cb_arg);
138int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain);
139int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
140 const char *domain);
141#else
142static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
143{
144 return -ENOSYS;
145}
146
147static inline int cipso_v4_doi_remove(u32 doi,
148 struct netlbl_audit *audit_info,
149 void (*callback) (struct rcu_head * head))
150{
151 return 0;
152}
153
154static inline struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi)
155{
156 return NULL;
157}
158
159static inline int cipso_v4_doi_walk(u32 *skip_cnt,
160 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
161 void *cb_arg)
162{
163 return 0;
164}
165
166static inline int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def,
167 const char *domain)
168{
169 return -ENOSYS;
170}
171
172static inline int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
173 const char *domain)
174{
175 return 0;
176}
177#endif /* CONFIG_NETLABEL */
178
179/*
180 * Label Mapping Cache Functions
181 */
182
183#ifdef CONFIG_NETLABEL
184void cipso_v4_cache_invalidate(void);
185int cipso_v4_cache_add(const struct sk_buff *skb,
186 const struct netlbl_lsm_secattr *secattr);
187#else
188static inline void cipso_v4_cache_invalidate(void)
189{
190 return;
191}
192
193static inline int cipso_v4_cache_add(const struct sk_buff *skb,
194 const struct netlbl_lsm_secattr *secattr)
195{
196 return 0;
197}
198#endif /* CONFIG_NETLABEL */
199
200/*
201 * Protocol Handling Functions
202 */
203
204#ifdef CONFIG_NETLABEL
205void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway);
206int cipso_v4_socket_setattr(const struct socket *sock,
207 const struct cipso_v4_doi *doi_def,
208 const struct netlbl_lsm_secattr *secattr);
209int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
210int cipso_v4_socket_getattr(const struct socket *sock,
211 struct netlbl_lsm_secattr *secattr);
212int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
213 struct netlbl_lsm_secattr *secattr);
214int cipso_v4_validate(unsigned char **option);
215#else
216static inline void cipso_v4_error(struct sk_buff *skb,
217 int error,
218 u32 gateway)
219{
220 return;
221}
222
223static inline int cipso_v4_socket_setattr(const struct socket *sock,
224 const struct cipso_v4_doi *doi_def,
225 const struct netlbl_lsm_secattr *secattr)
226{
227 return -ENOSYS;
228}
229
230static inline int cipso_v4_sock_getattr(struct sock *sk,
231 struct netlbl_lsm_secattr *secattr)
232{
233 return -ENOSYS;
234}
235
236static inline int cipso_v4_socket_getattr(const struct socket *sock,
237 struct netlbl_lsm_secattr *secattr)
238{
239 return -ENOSYS;
240}
241
242static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
243 struct netlbl_lsm_secattr *secattr)
244{
245 return -ENOSYS;
246}
247
248static inline int cipso_v4_validate(unsigned char **option)
249{
250 return -ENOSYS;
251}
252#endif /* CONFIG_NETLABEL */
253
254#endif /* _CIPSO_IPV4_H */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index a15dcf0d5c..f01626cbbe 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -22,7 +22,7 @@ struct dn_kern_rta
22}; 22};
23 23
24struct dn_fib_res { 24struct dn_fib_res {
25 struct dn_fib_rule *r; 25 struct fib_rule *r;
26 struct dn_fib_info *fi; 26 struct dn_fib_info *fi;
27 unsigned char prefixlen; 27 unsigned char prefixlen;
28 unsigned char nh_sel; 28 unsigned char nh_sel;
@@ -94,7 +94,8 @@ struct dn_fib_node {
94 94
95 95
96struct dn_fib_table { 96struct dn_fib_table {
97 int n; 97 struct hlist_node hlist;
98 u32 n;
98 99
99 int (*insert)(struct dn_fib_table *t, struct rtmsg *r, 100 int (*insert)(struct dn_fib_table *t, struct rtmsg *r,
100 struct dn_kern_rta *rta, struct nlmsghdr *n, 101 struct dn_kern_rta *rta, struct nlmsghdr *n,
@@ -130,14 +131,11 @@ extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
130extern void dn_fib_flush(void); 131extern void dn_fib_flush(void);
131extern void dn_fib_select_multipath(const struct flowi *fl, 132extern void dn_fib_select_multipath(const struct flowi *fl,
132 struct dn_fib_res *res); 133 struct dn_fib_res *res);
133extern int dn_fib_sync_down(__le16 local, struct net_device *dev,
134 int force);
135extern int dn_fib_sync_up(struct net_device *dev);
136 134
137/* 135/*
138 * dn_tables.c 136 * dn_tables.c
139 */ 137 */
140extern struct dn_fib_table *dn_fib_get_table(int n, int creat); 138extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat);
141extern struct dn_fib_table *dn_fib_empty_table(void); 139extern struct dn_fib_table *dn_fib_empty_table(void);
142extern void dn_fib_table_init(void); 140extern void dn_fib_table_init(void);
143extern void dn_fib_table_cleanup(void); 141extern void dn_fib_table_cleanup(void);
@@ -147,10 +145,8 @@ extern void dn_fib_table_cleanup(void);
147 */ 145 */
148extern void dn_fib_rules_init(void); 146extern void dn_fib_rules_init(void);
149extern void dn_fib_rules_cleanup(void); 147extern void dn_fib_rules_cleanup(void);
150extern void dn_fib_rule_put(struct dn_fib_rule *);
151extern __le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, unsigned *flags);
152extern unsigned dnet_addr_type(__le16 addr); 148extern unsigned dnet_addr_type(__le16 addr);
153extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res); 149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
154 150
155/* 151/*
156 * rtnetlink interface 152 * rtnetlink interface
@@ -176,11 +172,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res)
176 if (res->fi) 172 if (res->fi)
177 dn_fib_info_put(res->fi); 173 dn_fib_info_put(res->fi);
178 if (res->r) 174 if (res->r)
179 dn_fib_rule_put(res->r); 175 fib_rule_put(res->r);
180} 176}
181 177
182extern struct dn_fib_table *dn_fib_tables[];
183
184#else /* Endnode */ 178#else /* Endnode */
185 179
186#define dn_fib_init() do { } while(0) 180#define dn_fib_init() do { } while(0)
diff --git a/include/net/dst.h b/include/net/dst.h
index 36d54fc248..e156e38e4a 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -54,6 +54,7 @@ struct dst_entry
54 unsigned long expires; 54 unsigned long expires;
55 55
56 unsigned short header_len; /* more space at head required */ 56 unsigned short header_len; /* more space at head required */
57 unsigned short nfheader_len; /* more non-fragment space at head required */
57 unsigned short trailer_len; /* space to reserve at tail */ 58 unsigned short trailer_len; /* space to reserve at tail */
58 59
59 u32 metrics[RTAX_MAX]; 60 u32 metrics[RTAX_MAX];
@@ -83,7 +84,7 @@ struct dst_entry
83struct dst_ops 84struct dst_ops
84{ 85{
85 unsigned short family; 86 unsigned short family;
86 unsigned short protocol; 87 __be16 protocol;
87 unsigned gc_thresh; 88 unsigned gc_thresh;
88 89
89 int (*gc)(void); 90 int (*gc)(void);
diff --git a/include/net/esp.h b/include/net/esp.h
index 90cd94fad7..713d039f4a 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -1,6 +1,7 @@
1#ifndef _NET_ESP_H 1#ifndef _NET_ESP_H
2#define _NET_ESP_H 2#define _NET_ESP_H
3 3
4#include <linux/crypto.h>
4#include <net/xfrm.h> 5#include <net/xfrm.h>
5#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
6 7
@@ -14,14 +15,15 @@ struct esp_data
14 struct { 15 struct {
15 u8 *key; /* Key */ 16 u8 *key; /* Key */
16 int key_len; /* Key length */ 17 int key_len; /* Key length */
17 u8 *ivec; /* ivec buffer */ 18 int padlen; /* 0..255 */
18 /* ivlen is offset from enc_data, where encrypted data start. 19 /* ivlen is offset from enc_data, where encrypted data start.
19 * It is logically different of crypto_tfm_alg_ivsize(tfm). 20 * It is logically different of crypto_tfm_alg_ivsize(tfm).
20 * We assume that it is either zero (no ivec), or 21 * We assume that it is either zero (no ivec), or
21 * >= crypto_tfm_alg_ivsize(tfm). */ 22 * >= crypto_tfm_alg_ivsize(tfm). */
22 int ivlen; 23 int ivlen;
23 int padlen; /* 0..255 */ 24 int ivinitted;
24 struct crypto_tfm *tfm; /* crypto handle */ 25 u8 *ivec; /* ivec buffer */
26 struct crypto_blkcipher *tfm; /* crypto handle */
25 } conf; 27 } conf;
26 28
27 /* Integrity. It is active when icv_full_len != 0 */ 29 /* Integrity. It is active when icv_full_len != 0 */
@@ -34,7 +36,7 @@ struct esp_data
34 void (*icv)(struct esp_data*, 36 void (*icv)(struct esp_data*,
35 struct sk_buff *skb, 37 struct sk_buff *skb,
36 int offset, int len, u8 *icv); 38 int offset, int len, u8 *icv);
37 struct crypto_tfm *tfm; 39 struct crypto_hash *tfm;
38 } auth; 40 } auth;
39}; 41};
40 42
@@ -42,18 +44,22 @@ extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
42extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); 44extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
43extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 45extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
44 46
45static inline void 47static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
46esp_hmac_digest(struct esp_data *esp, struct sk_buff *skb, int offset, 48 int offset, int len)
47 int len, u8 *auth_data)
48{ 49{
49 struct crypto_tfm *tfm = esp->auth.tfm; 50 struct hash_desc desc;
50 char *icv = esp->auth.work_icv; 51 int err;
51 52
52 memset(auth_data, 0, esp->auth.icv_trunc_len); 53 desc.tfm = esp->auth.tfm;
53 crypto_hmac_init(tfm, esp->auth.key, &esp->auth.key_len); 54 desc.flags = 0;
54 skb_icv_walk(skb, tfm, offset, len, crypto_hmac_update); 55
55 crypto_hmac_final(tfm, esp->auth.key, &esp->auth.key_len, icv); 56 err = crypto_hash_init(&desc);
56 memcpy(auth_data, icv, esp->auth.icv_trunc_len); 57 if (unlikely(err))
58 return err;
59 err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update);
60 if (unlikely(err))
61 return err;
62 return crypto_hash_final(&desc, esp->auth.work_icv);
57} 63}
58 64
59#endif 65#endif
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
new file mode 100644
index 0000000000..8e2f473d3e
--- /dev/null
+++ b/include/net/fib_rules.h
@@ -0,0 +1,97 @@
1#ifndef __NET_FIB_RULES_H
2#define __NET_FIB_RULES_H
3
4#include <linux/types.h>
5#include <linux/netdevice.h>
6#include <linux/fib_rules.h>
7#include <net/flow.h>
8#include <net/netlink.h>
9
10struct fib_rule
11{
12 struct list_head list;
13 atomic_t refcnt;
14 int ifindex;
15 char ifname[IFNAMSIZ];
16 u32 pref;
17 u32 flags;
18 u32 table;
19 u8 action;
20 struct rcu_head rcu;
21};
22
23struct fib_lookup_arg
24{
25 void *lookup_ptr;
26 void *result;
27 struct fib_rule *rule;
28};
29
30struct fib_rules_ops
31{
32 int family;
33 struct list_head list;
34 int rule_size;
35
36 int (*action)(struct fib_rule *,
37 struct flowi *, int,
38 struct fib_lookup_arg *);
39 int (*match)(struct fib_rule *,
40 struct flowi *, int);
41 int (*configure)(struct fib_rule *,
42 struct sk_buff *,
43 struct nlmsghdr *,
44 struct fib_rule_hdr *,
45 struct nlattr **);
46 int (*compare)(struct fib_rule *,
47 struct fib_rule_hdr *,
48 struct nlattr **);
49 int (*fill)(struct fib_rule *, struct sk_buff *,
50 struct nlmsghdr *,
51 struct fib_rule_hdr *);
52 u32 (*default_pref)(void);
53
54 int nlgroup;
55 struct nla_policy *policy;
56 struct list_head *rules_list;
57 struct module *owner;
58};
59
60static inline void fib_rule_get(struct fib_rule *rule)
61{
62 atomic_inc(&rule->refcnt);
63}
64
65static inline void fib_rule_put_rcu(struct rcu_head *head)
66{
67 struct fib_rule *rule = container_of(head, struct fib_rule, rcu);
68 kfree(rule);
69}
70
71static inline void fib_rule_put(struct fib_rule *rule)
72{
73 if (atomic_dec_and_test(&rule->refcnt))
74 call_rcu(&rule->rcu, fib_rule_put_rcu);
75}
76
77static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
78{
79 if (nla[FRA_TABLE])
80 return nla_get_u32(nla[FRA_TABLE]);
81 return frh->table;
82}
83
84extern int fib_rules_register(struct fib_rules_ops *);
85extern int fib_rules_unregister(struct fib_rules_ops *);
86
87extern int fib_rules_lookup(struct fib_rules_ops *,
88 struct flowi *, int flags,
89 struct fib_lookup_arg *);
90
91extern int fib_nl_newrule(struct sk_buff *,
92 struct nlmsghdr *, void *);
93extern int fib_nl_delrule(struct sk_buff *,
94 struct nlmsghdr *, void *);
95extern int fib_rules_dump(struct sk_buff *,
96 struct netlink_callback *, int);
97#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 04d89f7634..ddf5f3ca17 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;
@@ -26,6 +26,7 @@ struct flowi {
26 struct { 26 struct {
27 struct in6_addr daddr; 27 struct in6_addr daddr;
28 struct in6_addr saddr; 28 struct in6_addr saddr;
29 __u32 fwmark;
29 __u32 flowlabel; 30 __u32 flowlabel;
30 } ip6_u; 31 } ip6_u;
31 32
@@ -42,6 +43,7 @@ struct flowi {
42#define fld_scope nl_u.dn_u.scope 43#define fld_scope nl_u.dn_u.scope
43#define fl6_dst nl_u.ip6_u.daddr 44#define fl6_dst nl_u.ip6_u.daddr
44#define fl6_src nl_u.ip6_u.saddr 45#define fl6_src nl_u.ip6_u.saddr
46#define fl6_fwmark nl_u.ip6_u.fwmark
45#define fl6_flowlabel nl_u.ip6_u.flowlabel 47#define fl6_flowlabel nl_u.ip6_u.flowlabel
46#define fl4_dst nl_u.ip4_u.daddr 48#define fl4_dst nl_u.ip4_u.daddr
47#define fl4_src nl_u.ip4_u.saddr 49#define fl4_src nl_u.ip4_u.saddr
@@ -54,8 +56,8 @@ struct flowi {
54#define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 56#define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01
55 union { 57 union {
56 struct { 58 struct {
57 __u16 sport; 59 __be16 sport;
58 __u16 dport; 60 __be16 dport;
59 } ports; 61 } ports;
60 62
61 struct { 63 struct {
@@ -71,13 +73,23 @@ struct flowi {
71 __u8 objname[16]; /* Not zero terminated */ 73 __u8 objname[16]; /* Not zero terminated */
72 } dnports; 74 } dnports;
73 75
74 __u32 spi; 76 __be32 spi;
77
78#ifdef CONFIG_IPV6_MIP6
79 struct {
80 __u8 type;
81 } mht;
82#endif
75 } uli_u; 83 } uli_u;
76#define fl_ip_sport uli_u.ports.sport 84#define fl_ip_sport uli_u.ports.sport
77#define fl_ip_dport uli_u.ports.dport 85#define fl_ip_dport uli_u.ports.dport
78#define fl_icmp_type uli_u.icmpt.type 86#define fl_icmp_type uli_u.icmpt.type
79#define fl_icmp_code uli_u.icmpt.code 87#define fl_icmp_code uli_u.icmpt.code
80#define fl_ipsec_spi uli_u.spi 88#define fl_ipsec_spi uli_u.spi
89#ifdef CONFIG_IPV6_MIP6
90#define fl_mh_type uli_u.mht.type
91#endif
92 __u32 secid; /* used by xfrm; see secid.txt */
81} __attribute__((__aligned__(BITS_PER_LONG/8))); 93} __attribute__((__aligned__(BITS_PER_LONG/8)));
82 94
83#define FLOW_DIR_IN 0 95#define FLOW_DIR_IN 0
@@ -85,10 +97,10 @@ struct flowi {
85#define FLOW_DIR_FWD 2 97#define FLOW_DIR_FWD 2
86 98
87struct sock; 99struct sock;
88typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir, 100typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir,
89 void **objp, atomic_t **obj_refp); 101 void **objp, atomic_t **obj_refp);
90 102
91extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir, 103extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
92 flow_resolve_t resolver); 104 flow_resolve_t resolver);
93extern void flow_cache_flush(void); 105extern void flow_cache_flush(void);
94extern atomic_t flow_cache_genid; 106extern atomic_t flow_cache_genid;
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 805de50df0..4a38d85e4e 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -27,8 +27,6 @@ struct genl_family
27 struct list_head family_list; /* private */ 27 struct list_head family_list; /* private */
28}; 28};
29 29
30#define GENL_ADMIN_PERM 0x01
31
32/** 30/**
33 * struct genl_info - receiving information 31 * struct genl_info - receiving information
34 * @snd_seq: sending sequence number 32 * @snd_seq: sending sequence number
@@ -133,11 +131,12 @@ static inline int genlmsg_cancel(struct sk_buff *skb, void *hdr)
133 * @skb: netlink message as socket buffer 131 * @skb: netlink message as socket buffer
134 * @pid: own netlink pid to avoid sending to yourself 132 * @pid: own netlink pid to avoid sending to yourself
135 * @group: multicast group id 133 * @group: multicast group id
134 * @flags: allocation flags
136 */ 135 */
137static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 136static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid,
138 unsigned int group) 137 unsigned int group, gfp_t flags)
139{ 138{
140 return nlmsg_multicast(genl_sock, skb, pid, group); 139 return nlmsg_multicast(genl_sock, skb, pid, group, flags);
141} 140}
142 141
143/** 142/**
@@ -150,4 +149,24 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
150 return nlmsg_unicast(genl_sock, skb, pid); 149 return nlmsg_unicast(genl_sock, skb, pid);
151} 150}
152 151
152/**
153 * gennlmsg_data - head of message payload
154 * @gnlh: genetlink messsage header
155 */
156static inline void *genlmsg_data(const struct genlmsghdr *gnlh)
157{
158 return ((unsigned char *) gnlh + GENL_HDRLEN);
159}
160
161/**
162 * genlmsg_len - length of message payload
163 * @gnlh: genetlink message header
164 */
165static inline int genlmsg_len(const struct genlmsghdr *gnlh)
166{
167 struct nlmsghdr *nlh = (struct nlmsghdr *)((unsigned char *)gnlh -
168 NLMSG_HDRLEN);
169 return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN);
170}
171
153#endif /* __NET_GENERIC_NETLINK_H */ 172#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 05f8ff7d93..dc09474efc 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/ieee80211.h b/include/net/ieee80211.h
index ecc42864b0..b174ebb277 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -240,6 +240,11 @@ struct ieee80211_snap_hdr {
240#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) 240#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
241#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) 241#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
242 242
243/* 802.11g ERP information element */
244#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
245#define WLAN_ERP_USE_PROTECTION (1<<1)
246#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
247
243/* Status codes */ 248/* Status codes */
244enum ieee80211_statuscode { 249enum ieee80211_statuscode {
245 WLAN_STATUS_SUCCESS = 0, 250 WLAN_STATUS_SUCCESS = 0,
@@ -747,6 +752,8 @@ struct ieee80211_txb {
747#define NETWORK_HAS_IBSS_DFS (1<<8) 752#define NETWORK_HAS_IBSS_DFS (1<<8)
748#define NETWORK_HAS_TPC_REPORT (1<<9) 753#define NETWORK_HAS_TPC_REPORT (1<<9)
749 754
755#define NETWORK_HAS_ERP_VALUE (1<<10)
756
750#define QOS_QUEUE_NUM 4 757#define QOS_QUEUE_NUM 4
751#define QOS_OUI_LEN 3 758#define QOS_OUI_LEN 3
752#define QOS_OUI_TYPE 2 759#define QOS_OUI_TYPE 2
@@ -1252,6 +1259,8 @@ extern int ieee80211_tx_frame(struct ieee80211_device *ieee,
1252 int total_len, int encrypt_mpdu); 1259 int total_len, int encrypt_mpdu);
1253 1260
1254/* ieee80211_rx.c */ 1261/* ieee80211_rx.c */
1262extern void ieee80211_rx_any(struct ieee80211_device *ieee,
1263 struct sk_buff *skb, struct ieee80211_rx_stats *stats);
1255extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 1264extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1256 struct ieee80211_rx_stats *rx_stats); 1265 struct ieee80211_rx_stats *rx_stats);
1257/* make sure to set stats->len */ 1266/* make sure to set stats->len */
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
index 7a483ab402..425b3a57ac 100644
--- a/include/net/ieee80211softmac.h
+++ b/include/net/ieee80211softmac.h
@@ -86,9 +86,6 @@ struct ieee80211softmac_assoc_info {
86 86
87 /* BSSID we're trying to associate to */ 87 /* BSSID we're trying to associate to */
88 char bssid[ETH_ALEN]; 88 char bssid[ETH_ALEN];
89
90 /* Rates supported by the network */
91 struct ieee80211softmac_ratesinfo supported_rates;
92 89
93 /* some flags. 90 /* some flags.
94 * static_essid is valid if the essid is constant, 91 * static_essid is valid if the essid is constant,
@@ -103,7 +100,9 @@ struct ieee80211softmac_assoc_info {
103 * bssfixed is used for SIOCSIWAP. 100 * bssfixed is used for SIOCSIWAP.
104 */ 101 */
105 u8 static_essid:1, 102 u8 static_essid:1,
103 short_preamble_available:1,
106 associating:1, 104 associating:1,
105 assoc_wait:1,
107 bssvalid:1, 106 bssvalid:1,
108 bssfixed:1; 107 bssfixed:1;
109 108
@@ -114,6 +113,19 @@ struct ieee80211softmac_assoc_info {
114 struct work_struct timeout; 113 struct work_struct timeout;
115}; 114};
116 115
116struct ieee80211softmac_bss_info {
117 /* Rates supported by the network */
118 struct ieee80211softmac_ratesinfo supported_rates;
119
120 /* This indicates whether frames can currently be transmitted with
121 * short preamble (only use this variable during TX at CCK rates) */
122 u8 short_preamble:1;
123
124 /* This indicates whether protection (e.g. self-CTS) should be used
125 * when transmitting with OFDM modulation */
126 u8 use_protection:1;
127};
128
117enum { 129enum {
118 IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, 130 IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1,
119 IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, 131 IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2,
@@ -156,6 +168,10 @@ struct ieee80211softmac_txrates {
156#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ 168#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */
157#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ 169#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */
158 170
171#define IEEE80211SOFTMAC_BSSINFOCHG_RATES (1 << 0) /* supported_rates */
172#define IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE (1 << 1) /* short_preamble */
173#define IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION (1 << 2) /* use_protection */
174
159struct ieee80211softmac_device { 175struct ieee80211softmac_device {
160 /* 802.11 structure for data stuff */ 176 /* 802.11 structure for data stuff */
161 struct ieee80211_device *ieee; 177 struct ieee80211_device *ieee;
@@ -199,10 +215,16 @@ struct ieee80211softmac_device {
199 * The driver just needs to read them. 215 * The driver just needs to read them.
200 */ 216 */
201 struct ieee80211softmac_txrates txrates; 217 struct ieee80211softmac_txrates txrates;
202 /* If the driver needs to do stuff on TX rate changes, assign this callback. */ 218
219 /* If the driver needs to do stuff on TX rate changes, assign this
220 * callback. See IEEE80211SOFTMAC_TXRATECHG for change flags. */
203 void (*txrates_change)(struct net_device *dev, 221 void (*txrates_change)(struct net_device *dev,
204 u32 changes, /* see IEEE80211SOFTMAC_TXRATECHG flags */ 222 u32 changes);
205 const struct ieee80211softmac_txrates *rates_before_change); 223
224 /* If the driver needs to do stuff when BSS properties change, assign
225 * this callback. see IEEE80211SOFTMAC_BSSINFOCHG for change flags. */
226 void (*bssinfo_change)(struct net_device *dev,
227 u32 changes);
206 228
207 /* private stuff follows */ 229 /* private stuff follows */
208 /* this lock protects this structure */ 230 /* this lock protects this structure */
@@ -215,6 +237,7 @@ struct ieee80211softmac_device {
215 237
216 struct ieee80211softmac_scaninfo *scaninfo; 238 struct ieee80211softmac_scaninfo *scaninfo;
217 struct ieee80211softmac_assoc_info associnfo; 239 struct ieee80211softmac_assoc_info associnfo;
240 struct ieee80211softmac_bss_info bssinfo;
218 241
219 struct list_head auth_queue; 242 struct list_head auth_queue;
220 struct list_head events; 243 struct list_head events;
@@ -256,6 +279,14 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev,
256 * Note that the rates need to be sorted. */ 279 * Note that the rates need to be sorted. */
257extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); 280extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
258 281
282/* Finds the highest rate which is:
283 * 1. Present in ri (optionally a basic rate)
284 * 2. Supported by the device
285 * 3. Less than or equal to the user-defined rate
286 */
287extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac,
288 struct ieee80211softmac_ratesinfo *ri, int basic_only);
289
259/* Helper function which advises you the rate at which a frame should be 290/* Helper function which advises you the rate at which a frame should be
260 * transmitted at. */ 291 * transmitted at. */
261static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, 292static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac,
@@ -278,6 +309,24 @@ static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device
278 return txrates->mcast_rate; 309 return txrates->mcast_rate;
279} 310}
280 311
312/* Helper function which advises you when it is safe to transmit with short
313 * preamble.
314 * You should only call this function when transmitting at CCK rates. */
315static inline int ieee80211softmac_short_preamble_ok(struct ieee80211softmac_device *mac,
316 int is_multicast,
317 int is_mgt)
318{
319 return (is_multicast && is_mgt) ? 0 : mac->bssinfo.short_preamble;
320}
321
322/* Helper function which advises you whether protection (e.g. self-CTS) is
323 * needed. 1 = protection needed, 0 = no protection needed
324 * Only use this function when transmitting with OFDM modulation. */
325static inline int ieee80211softmac_protection_needed(struct ieee80211softmac_device *mac)
326{
327 return mac->bssinfo.use_protection;
328}
329
281/* Start the SoftMAC. Call this after you initialized the device 330/* Start the SoftMAC. Call this after you initialized the device
282 * and it is ready to run. 331 * and it is ready to run.
283 */ 332 */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index e459e1a0ae..34489c13c1 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -189,6 +189,7 @@ struct inet6_dev
189 struct ipv6_devconf cnf; 189 struct ipv6_devconf cnf;
190 struct ipv6_devstat stats; 190 struct ipv6_devstat stats;
191 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ 191 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */
192 struct rcu_head rcu;
192}; 193};
193 194
194extern struct ipv6_devconf ipv6_devconf; 195extern struct ipv6_devconf ipv6_devconf;
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 9bf73fe509..0bcf9f237e 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -147,7 +147,8 @@ extern struct sock *inet_csk_clone(struct sock *sk,
147enum inet_csk_ack_state_t { 147enum inet_csk_ack_state_t {
148 ICSK_ACK_SCHED = 1, 148 ICSK_ACK_SCHED = 1,
149 ICSK_ACK_TIMER = 2, 149 ICSK_ACK_TIMER = 2,
150 ICSK_ACK_PUSHED = 4 150 ICSK_ACK_PUSHED = 4,
151 ICSK_ACK_PUSHED2 = 8
151}; 152};
152 153
153extern void inet_csk_init_xmit_timers(struct sock *sk, 154extern void inet_csk_init_xmit_timers(struct sock *sk,
@@ -237,9 +238,9 @@ extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
237 238
238extern struct request_sock *inet_csk_search_req(const struct sock *sk, 239extern struct request_sock *inet_csk_search_req(const struct sock *sk,
239 struct request_sock ***prevp, 240 struct request_sock ***prevp,
240 const __u16 rport, 241 const __be16 rport,
241 const __u32 raddr, 242 const __be32 raddr,
242 const __u32 laddr); 243 const __be32 laddr);
243extern int inet_csk_bind_conflict(const struct sock *sk, 244extern int inet_csk_bind_conflict(const struct sock *sk,
244 const struct inet_bind_bucket *tb); 245 const struct inet_bind_bucket *tb);
245extern 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 98e0bb3014..a9eb2eaf09 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -271,66 +271,57 @@ static inline int inet_iif(const struct sk_buff *skb)
271 return ((struct rtable *)skb->dst)->rt_iif; 271 return ((struct rtable *)skb->dst)->rt_iif;
272} 272}
273 273
274extern struct sock *__inet_lookup_listener(const struct hlist_head *head, 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
279/* Optimize the common listener case. */ 279static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
280static inline struct sock * 280 __be32 daddr, __be16 dport, int dif)
281 inet_lookup_listener(struct inet_hashinfo *hashinfo,
282 const u32 daddr,
283 const unsigned short hnum, const int dif)
284{ 281{
285 struct sock *sk = NULL; 282 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif);
286 const struct hlist_head *head;
287
288 read_lock(&hashinfo->lhash_lock);
289 head = &hashinfo->listening_hash[inet_lhashfn(hnum)];
290 if (!hlist_empty(head)) {
291 const struct inet_sock *inet = inet_sk((sk = __sk_head(head)));
292
293 if (inet->num == hnum && !sk->sk_node.next &&
294 (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
295 (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
296 !sk->sk_bound_dev_if)
297 goto sherry_cache;
298 sk = __inet_lookup_listener(head, daddr, hnum, dif);
299 }
300 if (sk) {
301sherry_cache:
302 sock_hold(sk);
303 }
304 read_unlock(&hashinfo->lhash_lock);
305 return sk;
306} 283}
307 284
308/* 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;
309#ifdef __BIG_ENDIAN 295#ifdef __BIG_ENDIAN
310#define INET_COMBINED_PORTS(__sport, __dport) \ 296#define INET_COMBINED_PORTS(__sport, __dport) \
311 (((__u32)(__sport) << 16) | (__u32)(__dport)) 297 ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
312#else /* __LITTLE_ENDIAN */ 298#else /* __LITTLE_ENDIAN */
313#define INET_COMBINED_PORTS(__sport, __dport) \ 299#define INET_COMBINED_PORTS(__sport, __dport) \
314 (((__u32)(__dport) << 16) | (__u32)(__sport)) 300 ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(__sport)))
315#endif 301#endif
316 302
317#if (BITS_PER_LONG == 64) 303#if (BITS_PER_LONG == 64)
304typedef __u64 __bitwise __addrpair;
318#ifdef __BIG_ENDIAN 305#ifdef __BIG_ENDIAN
319#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 306#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
320 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)));
321#else /* __LITTLE_ENDIAN */ 310#else /* __LITTLE_ENDIAN */
322#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 311#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
323 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)));
324#endif /* __BIG_ENDIAN */ 315#endif /* __BIG_ENDIAN */
325#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 316#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
326 (((__sk)->sk_hash == (__hash)) && \ 317 (((__sk)->sk_hash == (__hash)) && \
327 ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 318 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
328 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 319 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
329 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 320 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
330#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 321#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
331 (((__sk)->sk_hash == (__hash)) && \ 322 (((__sk)->sk_hash == (__hash)) && \
332 ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 323 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
333 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 324 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
334 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
335#else /* 32-bit arch */ 326#else /* 32-bit arch */
336#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 327#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
@@ -338,13 +329,13 @@ sherry_cache:
338 (((__sk)->sk_hash == (__hash)) && \ 329 (((__sk)->sk_hash == (__hash)) && \
339 (inet_sk(__sk)->daddr == (__saddr)) && \ 330 (inet_sk(__sk)->daddr == (__saddr)) && \
340 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 331 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
341 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 332 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
342 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 333 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
343#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 334#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
344 (((__sk)->sk_hash == (__hash)) && \ 335 (((__sk)->sk_hash == (__hash)) && \
345 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 336 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
346 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 337 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
347 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 338 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
348 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 339 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
349#endif /* 64-bit arch */ 340#endif /* 64-bit arch */
350 341
@@ -356,12 +347,12 @@ sherry_cache:
356 */ 347 */
357static inline struct sock * 348static inline struct sock *
358 __inet_lookup_established(struct inet_hashinfo *hashinfo, 349 __inet_lookup_established(struct inet_hashinfo *hashinfo,
359 const u32 saddr, const u16 sport, 350 const __be32 saddr, const __be16 sport,
360 const u32 daddr, const u16 hnum, 351 const __be32 daddr, const u16 hnum,
361 const int dif) 352 const int dif)
362{ 353{
363 INET_ADDR_COOKIE(acookie, saddr, daddr) 354 INET_ADDR_COOKIE(acookie, saddr, daddr)
364 const __u32 ports = INET_COMBINED_PORTS(sport, hnum); 355 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
365 struct sock *sk; 356 struct sock *sk;
366 const struct hlist_node *node; 357 const struct hlist_node *node;
367 /* Optimize here for direct hit, only listening connections can 358 /* Optimize here for direct hit, only listening connections can
@@ -391,25 +382,36 @@ hit:
391 goto out; 382 goto out;
392} 383}
393 384
385static inline struct sock *
386 inet_lookup_established(struct inet_hashinfo *hashinfo,
387 const __be32 saddr, const __be16 sport,
388 const __be32 daddr, const __be16 dport,
389 const int dif)
390{
391 return __inet_lookup_established(hashinfo, saddr, sport, daddr,
392 ntohs(dport), dif);
393}
394
394static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, 395static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
395 const u32 saddr, const u16 sport, 396 const __be32 saddr, const __be16 sport,
396 const u32 daddr, const u16 hnum, 397 const __be32 daddr, const __be16 dport,
397 const int dif) 398 const int dif)
398{ 399{
400 u16 hnum = ntohs(dport);
399 struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, 401 struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr,
400 hnum, dif); 402 hnum, dif);
401 return sk ? : inet_lookup_listener(hashinfo, daddr, hnum, dif); 403 return sk ? : __inet_lookup_listener(hashinfo, daddr, hnum, dif);
402} 404}
403 405
404static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, 406static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
405 const u32 saddr, const u16 sport, 407 const __be32 saddr, const __be16 sport,
406 const u32 daddr, const u16 dport, 408 const __be32 daddr, const __be16 dport,
407 const int dif) 409 const int dif)
408{ 410{
409 struct sock *sk; 411 struct sock *sk;
410 412
411 local_bh_disable(); 413 local_bh_disable();
412 sk = __inet_lookup(hashinfo, saddr, sport, daddr, ntohs(dport), dif); 414 sk = __inet_lookup(hashinfo, saddr, sport, daddr, dport, dif);
413 local_bh_enable(); 415 local_bh_enable();
414 416
415 return sk; 417 return sk;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1f4a9a60d4..ce6da97bc8 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -27,7 +27,6 @@
27/** struct ip_options - IP Options 27/** struct ip_options - IP Options
28 * 28 *
29 * @faddr - Saved first hop address 29 * @faddr - Saved first hop address
30 * @is_setbyuser - Set by setsockopt?
31 * @is_data - Options in __data, rather than skb 30 * @is_data - Options in __data, rather than skb
32 * @is_strictroute - Strict source route 31 * @is_strictroute - Strict source route
33 * @srr_is_hit - Packet destination addr was our one 32 * @srr_is_hit - Packet destination addr was our one
@@ -37,13 +36,12 @@
37 * @ts_needaddr - Need to record addr of outgoing dev 36 * @ts_needaddr - Need to record addr of outgoing dev
38 */ 37 */
39struct ip_options { 38struct ip_options {
40 __u32 faddr; 39 __be32 faddr;
41 unsigned char optlen; 40 unsigned char optlen;
42 unsigned char srr; 41 unsigned char srr;
43 unsigned char rr; 42 unsigned char rr;
44 unsigned char ts; 43 unsigned char ts;
45 unsigned char is_setbyuser:1, 44 unsigned char is_data:1,
46 is_data:1,
47 is_strictroute:1, 45 is_strictroute:1,
48 srr_is_hit:1, 46 srr_is_hit:1,
49 is_changed:1, 47 is_changed:1,
@@ -51,7 +49,7 @@ struct ip_options {
51 ts_needtime:1, 49 ts_needtime:1,
52 ts_needaddr:1; 50 ts_needaddr:1;
53 unsigned char router_alert; 51 unsigned char router_alert;
54 unsigned char __pad1; 52 unsigned char cipso;
55 unsigned char __pad2; 53 unsigned char __pad2;
56 unsigned char __data[0]; 54 unsigned char __data[0];
57}; 55};
@@ -64,9 +62,9 @@ struct inet_request_sock {
64 u16 inet6_rsk_offset; 62 u16 inet6_rsk_offset;
65 /* 2 bytes hole, try to pack */ 63 /* 2 bytes hole, try to pack */
66#endif 64#endif
67 u32 loc_addr; 65 __be32 loc_addr;
68 u32 rmt_addr; 66 __be32 rmt_addr;
69 u16 rmt_port; 67 __be16 rmt_port;
70 u16 snd_wscale : 4, 68 u16 snd_wscale : 4,
71 rcv_wscale : 4, 69 rcv_wscale : 4,
72 tstamp_ok : 1, 70 tstamp_ok : 1,
@@ -112,15 +110,15 @@ struct inet_sock {
112 struct ipv6_pinfo *pinet6; 110 struct ipv6_pinfo *pinet6;
113#endif 111#endif
114 /* Socket demultiplex comparisons on incoming packets. */ 112 /* Socket demultiplex comparisons on incoming packets. */
115 __u32 daddr; 113 __be32 daddr;
116 __u32 rcv_saddr; 114 __be32 rcv_saddr;
117 __u16 dport; 115 __be16 dport;
118 __u16 num; 116 __u16 num;
119 __u32 saddr; 117 __be32 saddr;
120 __s16 uc_ttl; 118 __s16 uc_ttl;
121 __u16 cmsg_flags; 119 __u16 cmsg_flags;
122 struct ip_options *opt; 120 struct ip_options *opt;
123 __u16 sport; 121 __be16 sport;
124 __u16 id; 122 __u16 id;
125 __u8 tos; 123 __u8 tos;
126 __u8 mc_ttl; 124 __u8 mc_ttl;
@@ -131,7 +129,7 @@ struct inet_sock {
131 hdrincl:1, 129 hdrincl:1,
132 mc_loop:1; 130 mc_loop:1;
133 int mc_index; 131 int mc_index;
134 __u32 mc_addr; 132 __be32 mc_addr;
135 struct ip_mc_socklist *mc_list; 133 struct ip_mc_socklist *mc_list;
136 struct { 134 struct {
137 unsigned int flags; 135 unsigned int flags;
@@ -139,7 +137,7 @@ struct inet_sock {
139 struct ip_options *opt; 137 struct ip_options *opt;
140 struct rtable *rt; 138 struct rtable *rt;
141 int length; /* Total length of all frames */ 139 int length; /* Total length of all frames */
142 u32 addr; 140 __be32 addr;
143 struct flowi fl; 141 struct flowi fl;
144 } cork; 142 } cork;
145}; 143};
@@ -169,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
169 167
170extern int inet_sk_rebuild_header(struct sock *sk); 168extern int inet_sk_rebuild_header(struct sock *sk);
171 169
172static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, 170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
173 const __u32 faddr, const __u16 fport) 171 const __be32 faddr, const __be16 fport)
174{ 172{
175 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); 173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport);
176 h ^= h >> 16; 174 h ^= h >> 16;
177 h ^= h >> 8; 175 h ^= h >> 8;
178 return h; 176 return h;
@@ -181,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
181static inline int inet_sk_ehashfn(const struct sock *sk) 179static inline int inet_sk_ehashfn(const struct sock *sk)
182{ 180{
183 const struct inet_sock *inet = inet_sk(sk); 181 const struct inet_sock *inet = inet_sk(sk);
184 const __u32 laddr = inet->rcv_saddr; 182 const __be32 laddr = inet->rcv_saddr;
185 const __u16 lport = inet->num; 183 const __u16 lport = inet->num;
186 const __u32 faddr = inet->daddr; 184 const __be32 faddr = inet->daddr;
187 const __u16 fport = inet->dport; 185 const __be16 fport = inet->dport;
188 186
189 return inet_ehashfn(laddr, lport, faddr, fport); 187 return inet_ehashfn(laddr, lport, faddr, fport);
190} 188}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 600cb54355..6d14c22a00 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 0965515f40..925573fd2a 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 98f9084007..b6d95e5534 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/ip6_fib.h b/include/net/ip6_fib.h
index a66e9de16a..e4438de3bd 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -16,14 +16,35 @@
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#include <linux/ipv6_route.h> 18#include <linux/ipv6_route.h>
19
20#include <net/dst.h>
21#include <net/flow.h>
22#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
23#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <net/dst.h>
22#include <net/flow.h>
23#include <net/netlink.h>
24 24
25struct rt6_info; 25struct rt6_info;
26 26
27struct fib6_config
28{
29 u32 fc_table;
30 u32 fc_metric;
31 int fc_dst_len;
32 int fc_src_len;
33 int fc_ifindex;
34 u32 fc_flags;
35 u32 fc_protocol;
36
37 struct in6_addr fc_dst;
38 struct in6_addr fc_src;
39 struct in6_addr fc_gateway;
40
41 unsigned long fc_expires;
42 struct nlattr *fc_mx;
43 int fc_mx_len;
44
45 struct nl_info fc_nlinfo;
46};
47
27struct fib6_node 48struct fib6_node
28{ 49{
29 struct fib6_node *parent; 50 struct fib6_node *parent;
@@ -39,6 +60,11 @@ struct fib6_node
39 __u32 fn_sernum; 60 __u32 fn_sernum;
40}; 61};
41 62
63#ifndef CONFIG_IPV6_SUBTREES
64#define FIB6_SUBTREE(fn) NULL
65#else
66#define FIB6_SUBTREE(fn) ((fn)->subtree)
67#endif
42 68
43/* 69/*
44 * routing information 70 * routing information
@@ -51,6 +77,8 @@ struct rt6key
51 int plen; 77 int plen;
52}; 78};
53 79
80struct fib6_table;
81
54struct rt6_info 82struct rt6_info
55{ 83{
56 union { 84 union {
@@ -71,6 +99,7 @@ struct rt6_info
71 u32 rt6i_flags; 99 u32 rt6i_flags;
72 u32 rt6i_metric; 100 u32 rt6i_metric;
73 atomic_t rt6i_ref; 101 atomic_t rt6i_ref;
102 struct fib6_table *rt6i_table;
74 103
75 struct rt6key rt6i_dst; 104 struct rt6key rt6i_dst;
76 struct rt6key rt6i_src; 105 struct rt6key rt6i_src;
@@ -89,28 +118,6 @@ struct fib6_walker_t
89 void *args; 118 void *args;
90}; 119};
91 120
92extern struct fib6_walker_t fib6_walker_list;
93extern rwlock_t fib6_walker_lock;
94
95static inline void fib6_walker_link(struct fib6_walker_t *w)
96{
97 write_lock_bh(&fib6_walker_lock);
98 w->next = fib6_walker_list.next;
99 w->prev = &fib6_walker_list;
100 w->next->prev = w;
101 w->prev->next = w;
102 write_unlock_bh(&fib6_walker_lock);
103}
104
105static inline void fib6_walker_unlink(struct fib6_walker_t *w)
106{
107 write_lock_bh(&fib6_walker_lock);
108 w->next->prev = w->prev;
109 w->prev->next = w->next;
110 w->prev = w->next = w;
111 write_unlock_bh(&fib6_walker_lock);
112}
113
114struct rt6_statistics { 121struct rt6_statistics {
115 __u32 fib_nodes; 122 __u32 fib_nodes;
116 __u32 fib_route_nodes; 123 __u32 fib_route_nodes;
@@ -143,12 +150,41 @@ struct rt6_statistics {
143 150
144typedef void (*f_pnode)(struct fib6_node *fn, void *); 151typedef void (*f_pnode)(struct fib6_node *fn, void *);
145 152
146extern struct fib6_node ip6_routing_table; 153struct fib6_table {
154 struct hlist_node tb6_hlist;
155 u32 tb6_id;
156 rwlock_t tb6_lock;
157 struct fib6_node tb6_root;
158};
159
160#define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC
161#define RT6_TABLE_MAIN RT_TABLE_MAIN
162#define RT6_TABLE_DFLT RT6_TABLE_MAIN
163#define RT6_TABLE_INFO RT6_TABLE_MAIN
164#define RT6_TABLE_PREFIX RT6_TABLE_MAIN
165
166#ifdef CONFIG_IPV6_MULTIPLE_TABLES
167#define FIB6_TABLE_MIN 1
168#define FIB6_TABLE_MAX RT_TABLE_MAX
169#define RT6_TABLE_LOCAL RT_TABLE_LOCAL
170#else
171#define FIB6_TABLE_MIN RT_TABLE_MAIN
172#define FIB6_TABLE_MAX FIB6_TABLE_MIN
173#define RT6_TABLE_LOCAL RT6_TABLE_MAIN
174#endif
175
176typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *,
177 struct flowi *, int);
147 178
148/* 179/*
149 * exported functions 180 * exported functions
150 */ 181 */
151 182
183extern struct fib6_table * fib6_get_table(u32 id);
184extern struct fib6_table * fib6_new_table(u32 id);
185extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags,
186 pol_lookup_t lookup);
187
152extern struct fib6_node *fib6_lookup(struct fib6_node *root, 188extern struct fib6_node *fib6_lookup(struct fib6_node *root,
153 struct in6_addr *daddr, 189 struct in6_addr *daddr,
154 struct in6_addr *saddr); 190 struct in6_addr *saddr);
@@ -157,32 +193,29 @@ struct fib6_node *fib6_locate(struct fib6_node *root,
157 struct in6_addr *daddr, int dst_len, 193 struct in6_addr *daddr, int dst_len,
158 struct in6_addr *saddr, int src_len); 194 struct in6_addr *saddr, int src_len);
159 195
160extern void fib6_clean_tree(struct fib6_node *root, 196extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
161 int (*func)(struct rt6_info *, void *arg), 197 int prune, void *arg);
162 int prune, void *arg);
163
164extern int fib6_walk(struct fib6_walker_t *w);
165extern int fib6_walk_continue(struct fib6_walker_t *w);
166 198
167extern int fib6_add(struct fib6_node *root, 199extern int fib6_add(struct fib6_node *root,
168 struct rt6_info *rt, 200 struct rt6_info *rt,
169 struct nlmsghdr *nlh, 201 struct nl_info *info);
170 void *rtattr,
171 struct netlink_skb_parms *req);
172 202
173extern int fib6_del(struct rt6_info *rt, 203extern int fib6_del(struct rt6_info *rt,
174 struct nlmsghdr *nlh, 204 struct nl_info *info);
175 void *rtattr,
176 struct netlink_skb_parms *req);
177 205
178extern void inet6_rt_notify(int event, struct rt6_info *rt, 206extern void inet6_rt_notify(int event, struct rt6_info *rt,
179 struct nlmsghdr *nlh, 207 struct nl_info *info);
180 struct netlink_skb_parms *req);
181 208
182extern void fib6_run_gc(unsigned long dummy); 209extern void fib6_run_gc(unsigned long dummy);
183 210
184extern void fib6_gc_cleanup(void); 211extern void fib6_gc_cleanup(void);
185 212
186extern void fib6_init(void); 213extern void fib6_init(void);
214
215extern void fib6_rules_init(void);
216extern void fib6_rules_cleanup(void);
217extern int fib6_rules_dump(struct sk_buff *,
218 struct netlink_callback *);
219
187#endif 220#endif
188#endif 221#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index a398ae5e30..6ca6b71dfe 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -32,6 +32,10 @@ struct route_info {
32#include <linux/ip.h> 32#include <linux/ip.h>
33#include <linux/ipv6.h> 33#include <linux/ipv6.h>
34 34
35#define RT6_LOOKUP_F_IFACE 0x1
36#define RT6_LOOKUP_F_REACHABLE 0x2
37#define RT6_LOOKUP_F_HAS_SADDR 0x4
38
35struct pol_chain { 39struct pol_chain {
36 int type; 40 int type;
37 int priority; 41 int priority;
@@ -41,6 +45,11 @@ struct pol_chain {
41 45
42extern struct rt6_info ip6_null_entry; 46extern struct rt6_info ip6_null_entry;
43 47
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES
49extern struct rt6_info ip6_prohibit_entry;
50extern struct rt6_info ip6_blk_hole_entry;
51#endif
52
44extern int ip6_rt_gc_interval; 53extern int ip6_rt_gc_interval;
45 54
46extern void ip6_route_input(struct sk_buff *skb); 55extern void ip6_route_input(struct sk_buff *skb);
@@ -48,25 +57,14 @@ extern void ip6_route_input(struct sk_buff *skb);
48extern struct dst_entry * ip6_route_output(struct sock *sk, 57extern struct dst_entry * ip6_route_output(struct sock *sk,
49 struct flowi *fl); 58 struct flowi *fl);
50 59
51extern int ip6_route_me_harder(struct sk_buff *skb);
52
53extern void ip6_route_init(void); 60extern void ip6_route_init(void);
54extern void ip6_route_cleanup(void); 61extern void ip6_route_cleanup(void);
55 62
56extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); 63extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg);
57 64
58extern int ip6_route_add(struct in6_rtmsg *rtmsg, 65extern int ip6_route_add(struct fib6_config *cfg);
59 struct nlmsghdr *, 66extern int ip6_ins_rt(struct rt6_info *);
60 void *rtattr, 67extern int ip6_del_rt(struct rt6_info *);
61 struct netlink_skb_parms *req);
62extern int ip6_ins_rt(struct rt6_info *,
63 struct nlmsghdr *,
64 void *rtattr,
65 struct netlink_skb_parms *req);
66extern int ip6_del_rt(struct rt6_info *,
67 struct nlmsghdr *,
68 void *rtattr,
69 struct netlink_skb_parms *req);
70 68
71extern int ip6_rt_addr_add(struct in6_addr *addr, 69extern int ip6_rt_addr_add(struct in6_addr *addr,
72 struct net_device *dev, 70 struct net_device *dev,
@@ -114,6 +112,7 @@ extern int rt6_route_rcv(struct net_device *dev,
114 struct in6_addr *gwaddr); 112 struct in6_addr *gwaddr);
115 113
116extern void rt6_redirect(struct in6_addr *dest, 114extern void rt6_redirect(struct in6_addr *dest,
115 struct in6_addr *src,
117 struct in6_addr *saddr, 116 struct in6_addr *saddr,
118 struct neighbour *neigh, 117 struct neighbour *neigh,
119 u8 *lladdr, 118 u8 *lladdr,
@@ -131,6 +130,13 @@ extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a
131extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); 130extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
132extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); 131extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
133 132
133struct rt6_rtnl_dump_arg
134{
135 struct sk_buff *skb;
136 struct netlink_callback *cb;
137};
138
139extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
134extern void rt6_ifdown(struct net_device *dev); 140extern void rt6_ifdown(struct net_device *dev);
135extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); 141extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
136 142
@@ -139,16 +145,25 @@ extern rwlock_t rt6_lock;
139/* 145/*
140 * Store a destination cache entry in a socket 146 * Store a destination cache entry in a socket
141 */ 147 */
142static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, 148static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst,
143 struct in6_addr *daddr) 149 struct in6_addr *daddr, struct in6_addr *saddr)
144{ 150{
145 struct ipv6_pinfo *np = inet6_sk(sk); 151 struct ipv6_pinfo *np = inet6_sk(sk);
146 struct rt6_info *rt = (struct rt6_info *) dst; 152 struct rt6_info *rt = (struct rt6_info *) dst;
147 153
148 write_lock(&sk->sk_dst_lock); 154 sk_setup_caps(sk, dst);
149 __sk_dst_set(sk, dst);
150 np->daddr_cache = daddr; 155 np->daddr_cache = daddr;
156#ifdef CONFIG_IPV6_SUBTREES
157 np->saddr_cache = saddr;
158#endif
151 np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; 159 np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
160}
161
162static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
163 struct in6_addr *daddr, struct in6_addr *saddr)
164{
165 write_lock(&sk->sk_dst_lock);
166 __ip6_dst_store(sk, dst, daddr, saddr);
152 write_unlock(&sk->sk_dst_lock); 167 write_unlock(&sk->sk_dst_lock);
153} 168}
154 169
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index a095d1dec7..82229146ba 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -18,26 +18,34 @@
18 18
19#include <net/flow.h> 19#include <net/flow.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21 21#include <net/fib_rules.h>
22/* WARNING: The ordering of these elements must match ordering 22
23 * of RTA_* rtnetlink attribute numbers. 23struct fib_config {
24 */ 24 u8 fc_family;
25struct kern_rta { 25 u8 fc_dst_len;
26 void *rta_dst; 26 u8 fc_src_len;
27 void *rta_src; 27 u8 fc_tos;
28 int *rta_iif; 28 u8 fc_protocol;
29 int *rta_oif; 29 u8 fc_scope;
30 void *rta_gw; 30 u8 fc_type;
31 u32 *rta_priority; 31 /* 1 byte unused */
32 void *rta_prefsrc; 32 u32 fc_table;
33 struct rtattr *rta_mx; 33 __be32 fc_dst;
34 struct rtattr *rta_mp; 34 __be32 fc_src;
35 unsigned char *rta_protoinfo; 35 __be32 fc_gw;
36 u32 *rta_flow; 36 int fc_oif;
37 struct rta_cacheinfo *rta_ci; 37 u32 fc_flags;
38 struct rta_session *rta_sess; 38 u32 fc_priority;
39 u32 *rta_mp_alg; 39 __be32 fc_prefsrc;
40}; 40 struct nlattr *fc_mx;
41 struct rtnexthop *fc_mp;
42 int fc_mx_len;
43 int fc_mp_len;
44 u32 fc_flow;
45 u32 fc_mp_alg;
46 u32 fc_nlflags;
47 struct nl_info fc_nlinfo;
48 };
41 49
42struct fib_info; 50struct fib_info;
43 51
@@ -55,7 +63,7 @@ struct fib_nh {
55 __u32 nh_tclassid; 63 __u32 nh_tclassid;
56#endif 64#endif
57 int nh_oif; 65 int nh_oif;
58 u32 nh_gw; 66 __be32 nh_gw;
59}; 67};
60 68
61/* 69/*
@@ -70,7 +78,7 @@ struct fib_info {
70 int fib_dead; 78 int fib_dead;
71 unsigned fib_flags; 79 unsigned fib_flags;
72 int fib_protocol; 80 int fib_protocol;
73 u32 fib_prefsrc; 81 __be32 fib_prefsrc;
74 u32 fib_priority; 82 u32 fib_priority;
75 u32 fib_metrics[RTAX_MAX]; 83 u32 fib_metrics[RTAX_MAX];
76#define fib_mtu fib_metrics[RTAX_MTU-1] 84#define fib_mtu fib_metrics[RTAX_MTU-1]
@@ -99,8 +107,8 @@ struct fib_result {
99 unsigned char type; 107 unsigned char type;
100 unsigned char scope; 108 unsigned char scope;
101#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 109#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
102 __u32 network; 110 __be32 network;
103 __u32 netmask; 111 __be32 netmask;
104#endif 112#endif
105 struct fib_info *fi; 113 struct fib_info *fi;
106#ifdef CONFIG_IP_MULTIPLE_TABLES 114#ifdef CONFIG_IP_MULTIPLE_TABLES
@@ -109,7 +117,7 @@ struct fib_result {
109}; 117};
110 118
111struct fib_result_nl { 119struct fib_result_nl {
112 u32 fl_addr; /* To be looked up*/ 120 __be32 fl_addr; /* To be looked up*/
113 u32 fl_fwmark; 121 u32 fl_fwmark;
114 unsigned char fl_tos; 122 unsigned char fl_tos;
115 unsigned char fl_scope; 123 unsigned char fl_scope;
@@ -149,15 +157,12 @@ struct fib_result_nl {
149#endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ 157#endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */
150 158
151struct fib_table { 159struct fib_table {
152 unsigned char tb_id; 160 struct hlist_node tb_hlist;
161 u32 tb_id;
153 unsigned tb_stamp; 162 unsigned tb_stamp;
154 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); 163 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
155 int (*tb_insert)(struct fib_table *table, struct rtmsg *r, 164 int (*tb_insert)(struct fib_table *, struct fib_config *);
156 struct kern_rta *rta, struct nlmsghdr *n, 165 int (*tb_delete)(struct fib_table *, struct fib_config *);
157 struct netlink_skb_parms *req);
158 int (*tb_delete)(struct fib_table *table, struct rtmsg *r,
159 struct kern_rta *rta, struct nlmsghdr *n,
160 struct netlink_skb_parms *req);
161 int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, 166 int (*tb_dump)(struct fib_table *table, struct sk_buff *skb,
162 struct netlink_callback *cb); 167 struct netlink_callback *cb);
163 int (*tb_flush)(struct fib_table *table); 168 int (*tb_flush)(struct fib_table *table);
@@ -172,14 +177,14 @@ struct fib_table {
172extern struct fib_table *ip_fib_local_table; 177extern struct fib_table *ip_fib_local_table;
173extern struct fib_table *ip_fib_main_table; 178extern struct fib_table *ip_fib_main_table;
174 179
175static inline struct fib_table *fib_get_table(int id) 180static inline struct fib_table *fib_get_table(u32 id)
176{ 181{
177 if (id != RT_TABLE_LOCAL) 182 if (id != RT_TABLE_LOCAL)
178 return ip_fib_main_table; 183 return ip_fib_main_table;
179 return ip_fib_local_table; 184 return ip_fib_local_table;
180} 185}
181 186
182static inline struct fib_table *fib_new_table(int id) 187static inline struct fib_table *fib_new_table(u32 id)
183{ 188{
184 return fib_get_table(id); 189 return fib_get_table(id);
185} 190}
@@ -199,67 +204,48 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result
199} 204}
200 205
201#else /* CONFIG_IP_MULTIPLE_TABLES */ 206#else /* CONFIG_IP_MULTIPLE_TABLES */
202#define ip_fib_local_table (fib_tables[RT_TABLE_LOCAL]) 207#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL)
203#define ip_fib_main_table (fib_tables[RT_TABLE_MAIN]) 208#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN)
204
205extern struct fib_table * fib_tables[RT_TABLE_MAX+1];
206extern int fib_lookup(const struct flowi *flp, struct fib_result *res);
207extern struct fib_table *__fib_new_table(int id);
208extern void fib_rule_put(struct fib_rule *r);
209 209
210static inline struct fib_table *fib_get_table(int id) 210extern int fib_lookup(struct flowi *flp, struct fib_result *res);
211{
212 if (id == 0)
213 id = RT_TABLE_MAIN;
214
215 return fib_tables[id];
216}
217
218static inline struct fib_table *fib_new_table(int id)
219{
220 if (id == 0)
221 id = RT_TABLE_MAIN;
222
223 return fib_tables[id] ? : __fib_new_table(id);
224}
225 211
212extern struct fib_table *fib_new_table(u32 id);
213extern struct fib_table *fib_get_table(u32 id);
226extern void fib_select_default(const struct flowi *flp, struct fib_result *res); 214extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
227 215
228#endif /* CONFIG_IP_MULTIPLE_TABLES */ 216#endif /* CONFIG_IP_MULTIPLE_TABLES */
229 217
230/* Exported by fib_frontend.c */ 218/* Exported by fib_frontend.c */
219extern struct nla_policy rtm_ipv4_policy[];
231extern void ip_fib_init(void); 220extern void ip_fib_init(void);
232extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); 221extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
233extern 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);
234extern 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);
235extern 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);
236extern 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,
237 struct net_device *dev, u32 *spec_dst, u32 *itag); 226 struct net_device *dev, __be32 *spec_dst, u32 *itag);
238extern 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);
239 228
240struct rtentry; 229struct rtentry;
241 230
242/* Exported by fib_semantics.c */ 231/* Exported by fib_semantics.c */
243extern int ip_fib_check_default(u32 gw, struct net_device *dev); 232extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
244extern 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);
245extern int fib_sync_up(struct net_device *dev); 234extern int fib_sync_up(struct net_device *dev);
246extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, 235extern __be32 __fib_res_prefsrc(struct fib_result *res);
247 struct kern_rta *rta, struct rtentry *r);
248extern u32 __fib_res_prefsrc(struct fib_result *res);
249 236
250/* Exported by fib_hash.c */ 237/* Exported by fib_hash.c */
251extern struct fib_table *fib_hash_init(int id); 238extern struct fib_table *fib_hash_init(u32 id);
252 239
253#ifdef CONFIG_IP_MULTIPLE_TABLES 240#ifdef CONFIG_IP_MULTIPLE_TABLES
254/* Exported by fib_rules.c */ 241extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb);
242
243extern void __init fib4_rules_init(void);
255 244
256extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
257extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
258extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
259#ifdef CONFIG_NET_CLS_ROUTE 245#ifdef CONFIG_NET_CLS_ROUTE
260extern u32 fib_rules_tclass(struct fib_result *res); 246extern u32 fib_rules_tclass(struct fib_result *res);
261#endif 247#endif
262extern void fib_rules_init(void); 248
263#endif 249#endif
264 250
265static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 251static inline void fib_combine_itag(u32 *itag, struct fib_result *res)
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h
index ac747b6473..beffdd66ad 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 3b57b159b6..49c717e3b0 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/ipcomp.h b/include/net/ipcomp.h
index e651a57ecd..87c1af3e5e 100644
--- a/include/net/ipcomp.h
+++ b/include/net/ipcomp.h
@@ -1,11 +1,14 @@
1#ifndef _NET_IPCOMP_H 1#ifndef _NET_IPCOMP_H
2#define _NET_IPCOMP_H 2#define _NET_IPCOMP_H
3 3
4#include <linux/crypto.h>
5#include <linux/types.h>
6
4#define IPCOMP_SCRATCH_SIZE 65400 7#define IPCOMP_SCRATCH_SIZE 65400
5 8
6struct ipcomp_data { 9struct ipcomp_data {
7 u16 threshold; 10 u16 threshold;
8 struct crypto_tfm **tfms; 11 struct crypto_comp **tfms;
9}; 12};
10 13
11#endif 14#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a8fdf7970b..8223c4410b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -40,6 +40,7 @@
40#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ 40#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
41#define NEXTHDR_NONE 59 /* No next header */ 41#define NEXTHDR_NONE 59 /* No next header */
42#define NEXTHDR_DEST 60 /* Destination options header. */ 42#define NEXTHDR_DEST 60 /* Destination options header. */
43#define NEXTHDR_MOBILITY 135 /* Mobility header. */
43 44
44#define NEXTHDR_MAX 255 45#define NEXTHDR_MAX 255
45 46
@@ -229,7 +230,7 @@ extern int ip6_ra_control(struct sock *sk, int sel,
229 void (*destructor)(struct sock *)); 230 void (*destructor)(struct sock *));
230 231
231 232
232extern int ipv6_parse_hopopts(struct sk_buff *skb); 233extern int ipv6_parse_hopopts(struct sk_buff **skbp);
233 234
234extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 235extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
235extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 236extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
@@ -317,8 +318,8 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
317 318
318#ifndef __HAVE_ARCH_ADDR_SET 319#ifndef __HAVE_ARCH_ADDR_SET
319static inline void ipv6_addr_set(struct in6_addr *addr, 320static inline void ipv6_addr_set(struct in6_addr *addr,
320 __u32 w1, __u32 w2, 321 __be32 w1, __be32 w2,
321 __u32 w3, __u32 w4) 322 __be32 w3, __be32 w4)
322{ 323{
323 addr->s6_addr32[0] = w1; 324 addr->s6_addr32[0] = w1;
324 addr->s6_addr32[1] = w2; 325 addr->s6_addr32[1] = w2;
@@ -336,7 +337,7 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1,
336 a1->s6_addr32[3] == a2->s6_addr32[3]); 337 a1->s6_addr32[3] == a2->s6_addr32[3]);
337} 338}
338 339
339static inline int __ipv6_prefix_equal(const u32 *a1, const u32 *a2, 340static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
340 unsigned int prefixlen) 341 unsigned int prefixlen)
341{ 342{
342 unsigned pdw, pbi; 343 unsigned pdw, pbi;
@@ -468,6 +469,9 @@ extern void ip6_flush_pending_frames(struct sock *sk);
468extern int ip6_dst_lookup(struct sock *sk, 469extern int ip6_dst_lookup(struct sock *sk,
469 struct dst_entry **dst, 470 struct dst_entry **dst,
470 struct flowi *fl); 471 struct flowi *fl);
472extern int ip6_sk_dst_lookup(struct sock *sk,
473 struct dst_entry **dst,
474 struct flowi *fl);
471 475
472/* 476/*
473 * skb processing functions 477 * skb processing functions
@@ -503,6 +507,8 @@ extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
503 507
504extern int ipv6_ext_hdr(u8 nexthdr); 508extern int ipv6_ext_hdr(u8 nexthdr);
505 509
510extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
511
506extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk, 512extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk,
507 struct ipv6_rt_hdr *hdr); 513 struct ipv6_rt_hdr *hdr);
508 514
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 0575c59a5c..bca19ca7bd 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -160,7 +160,7 @@ typedef struct {
160 int irq, irq2; /* Interrupts used */ 160 int irq, irq2; /* Interrupts used */
161 int dma, dma2; /* DMA channel(s) used */ 161 int dma, dma2; /* DMA channel(s) used */
162 int fifo_size; /* FIFO size */ 162 int fifo_size; /* FIFO size */
163 int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */ 163 int irqflags; /* interrupt flags (ie, IRQF_SHARED|IRQF_DISABLED) */
164 int direction; /* Link direction, used by some FIR drivers */ 164 int direction; /* Link direction, used by some FIR drivers */
165 int enabled; /* Powered on? */ 165 int enabled; /* Powered on? */
166 int suspended; /* Suspended by APM */ 166 int suspended; /* Suspended by APM */
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
index 1c73bdbc3e..9592c374b4 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 3452ae257c..9dd54a5002 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 11ecfa58a6..e212b9bc25 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/mip6.h b/include/net/mip6.h
new file mode 100644
index 0000000000..68263c6d99
--- /dev/null
+++ b/include/net/mip6.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C)2003-2006 Helsinki University of Technology
3 * Copyright (C)2003-2006 USAGI/WIDE Project
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19/*
20 * Authors:
21 * Noriaki TAKAMIYA @USAGI
22 * Masahide NAKAMURA @USAGI
23 * YOSHIFUJI Hideaki @USAGI
24 */
25#ifndef _NET_MIP6_H
26#define _NET_MIP6_H
27
28#include <linux/skbuff.h>
29#include <net/sock.h>
30
31#define MIP6_OPT_PAD_1 0
32#define MIP6_OPT_PAD_N 1
33
34/*
35 * Mobility Header
36 */
37struct ip6_mh {
38 __u8 ip6mh_proto;
39 __u8 ip6mh_hdrlen;
40 __u8 ip6mh_type;
41 __u8 ip6mh_reserved;
42 __u16 ip6mh_cksum;
43 /* Followed by type specific messages */
44 __u8 data[0];
45} __attribute__ ((__packed__));
46
47#define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */
48#define IP6_MH_TYPE_HOTI 1 /* HOTI Message */
49#define IP6_MH_TYPE_COTI 2 /* COTI Message */
50#define IP6_MH_TYPE_HOT 3 /* HOT Message */
51#define IP6_MH_TYPE_COT 4 /* COT Message */
52#define IP6_MH_TYPE_BU 5 /* Binding Update */
53#define IP6_MH_TYPE_BACK 6 /* Binding ACK */
54#define IP6_MH_TYPE_BERROR 7 /* Binding Error */
55#define IP6_MH_TYPE_MAX IP6_MH_TYPE_BERROR
56
57extern int mip6_init(void);
58extern void mip6_fini(void);
59extern int mip6_mh_filter(struct sock *sk, struct sk_buff *skb);
60
61#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 4901ee4468..c8aacbd2e3 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -1,6 +1,8 @@
1#ifndef _NET_NEIGHBOUR_H 1#ifndef _NET_NEIGHBOUR_H
2#define _NET_NEIGHBOUR_H 2#define _NET_NEIGHBOUR_H
3 3
4#include <linux/neighbour.h>
5
4/* 6/*
5 * Generic neighbour manipulation 7 * Generic neighbour manipulation
6 * 8 *
@@ -14,40 +16,6 @@
14 * - Add neighbour cache statistics like rtstat 16 * - Add neighbour cache statistics like rtstat
15 */ 17 */
16 18
17/* The following flags & states are exported to user space,
18 so that they should be moved to include/linux/ directory.
19 */
20
21/*
22 * Neighbor Cache Entry Flags
23 */
24
25#define NTF_PROXY 0x08 /* == ATF_PUBL */
26#define NTF_ROUTER 0x80
27
28/*
29 * Neighbor Cache Entry States.
30 */
31
32#define NUD_INCOMPLETE 0x01
33#define NUD_REACHABLE 0x02
34#define NUD_STALE 0x04
35#define NUD_DELAY 0x08
36#define NUD_PROBE 0x10
37#define NUD_FAILED 0x20
38
39/* Dummy states */
40#define NUD_NOARP 0x40
41#define NUD_PERMANENT 0x80
42#define NUD_NONE 0x00
43
44/* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change
45 and make no address resolution or NUD.
46 NUD_PERMANENT is also cannot be deleted by garbage collectors.
47 */
48
49#ifdef __KERNEL__
50
51#include <asm/atomic.h> 19#include <asm/atomic.h>
52#include <linux/netdevice.h> 20#include <linux/netdevice.h>
53#include <linux/skbuff.h> 21#include <linux/skbuff.h>
@@ -133,7 +101,7 @@ struct neighbour
133 __u8 dead; 101 __u8 dead;
134 atomic_t probes; 102 atomic_t probes;
135 rwlock_t lock; 103 rwlock_t lock;
136 unsigned char ha[(MAX_ADDR_LEN+sizeof(unsigned long)-1)&~(sizeof(unsigned long)-1)]; 104 unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))];
137 struct hh_cache *hh; 105 struct hh_cache *hh;
138 atomic_t refcnt; 106 atomic_t refcnt;
139 int (*output)(struct sk_buff *skb); 107 int (*output)(struct sk_buff *skb);
@@ -158,6 +126,7 @@ struct pneigh_entry
158{ 126{
159 struct pneigh_entry *next; 127 struct pneigh_entry *next;
160 struct net_device *dev; 128 struct net_device *dev;
129 u8 flags;
161 u8 key[0]; 130 u8 key[0];
162}; 131};
163 132
@@ -374,6 +343,3 @@ struct neighbour_cb {
374#define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) 343#define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb)
375 344
376#endif 345#endif
377#endif
378
379
diff --git a/include/net/netdma.h b/include/net/netdma.h
index 19760eb131..7f53cd1d8b 100644
--- a/include/net/netdma.h
+++ b/include/net/netdma.h
@@ -29,7 +29,7 @@ static inline struct dma_chan *get_softnet_dma(void)
29{ 29{
30 struct dma_chan *chan; 30 struct dma_chan *chan;
31 rcu_read_lock(); 31 rcu_read_lock();
32 chan = rcu_dereference(__get_cpu_var(softnet_data.net_dma)); 32 chan = rcu_dereference(__get_cpu_var(softnet_data).net_dma);
33 if (chan) 33 if (chan)
34 dma_chan_get(chan); 34 dma_chan_get(chan);
35 rcu_read_unlock(); 35 rcu_read_unlock();
@@ -37,7 +37,7 @@ static inline struct dma_chan *get_softnet_dma(void)
37} 37}
38 38
39int dma_skb_copy_datagram_iovec(struct dma_chan* chan, 39int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
40 const struct sk_buff *skb, int offset, struct iovec *to, 40 struct sk_buff *skb, int offset, struct iovec *to,
41 size_t len, struct dma_pinned_list *pinned_list); 41 size_t len, struct dma_pinned_list *pinned_list);
42 42
43#endif /* CONFIG_NET_DMA */ 43#endif /* CONFIG_NET_DMA */
diff --git a/include/net/netevent.h b/include/net/netevent.h
new file mode 100644
index 0000000000..e5d2162414
--- /dev/null
+++ b/include/net/netevent.h
@@ -0,0 +1,33 @@
1#ifndef _NET_EVENT_H
2#define _NET_EVENT_H
3
4/*
5 * Generic netevent notifiers
6 *
7 * Authors:
8 * Tom Tucker <tom@opengridcomputing.com>
9 * Steve Wise <swise@opengridcomputing.com>
10 *
11 * Changes:
12 */
13#ifdef __KERNEL__
14
15#include <net/dst.h>
16
17struct netevent_redirect {
18 struct dst_entry *old;
19 struct dst_entry *new;
20};
21
22enum netevent_notif_type {
23 NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */
24 NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */
25 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
26};
27
28extern int register_netevent_notifier(struct notifier_block *nb);
29extern int unregister_netevent_notifier(struct notifier_block *nb);
30extern int call_netevent_notifiers(unsigned long val, void *v);
31
32#endif
33#endif
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
new file mode 100644
index 0000000000..c63a58058e
--- /dev/null
+++ b/include/net/netlabel.h
@@ -0,0 +1,261 @@
1/*
2 * NetLabel System
3 *
4 * The NetLabel system manages static and dynamic label mappings for network
5 * protocols such as CIPSO and RIPSO.
6 *
7 * Author: Paul Moore <paul.moore@hp.com>
8 *
9 */
10
11/*
12 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
22 * the GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30#ifndef _NETLABEL_H
31#define _NETLABEL_H
32
33#include <linux/types.h>
34#include <linux/net.h>
35#include <linux/skbuff.h>
36#include <net/netlink.h>
37
38/*
39 * NetLabel - A management interface for maintaining network packet label
40 * mapping tables for explicit packet labling protocols.
41 *
42 * Network protocols such as CIPSO and RIPSO require a label translation layer
43 * to convert the label on the packet into something meaningful on the host
44 * machine. In the current Linux implementation these mapping tables live
45 * inside the kernel; NetLabel provides a mechanism for user space applications
46 * to manage these mapping tables.
47 *
48 * NetLabel makes use of the Generic NETLINK mechanism as a transport layer to
49 * send messages between kernel and user space. The general format of a
50 * NetLabel message is shown below:
51 *
52 * +-----------------+-------------------+--------- --- -- -
53 * | struct nlmsghdr | struct genlmsghdr | payload
54 * +-----------------+-------------------+--------- --- -- -
55 *
56 * The 'nlmsghdr' and 'genlmsghdr' structs should be dealt with like normal.
57 * The payload is dependent on the subsystem specified in the
58 * 'nlmsghdr->nlmsg_type' and should be defined below, supporting functions
59 * should be defined in the corresponding net/netlabel/netlabel_<subsys>.h|c
60 * file. All of the fields in the NetLabel payload are NETLINK attributes, see
61 * the include/net/netlink.h file for more information on NETLINK attributes.
62 *
63 */
64
65/*
66 * NetLabel NETLINK protocol
67 */
68
69#define NETLBL_PROTO_VERSION 1
70
71/* NetLabel NETLINK types/families */
72#define NETLBL_NLTYPE_NONE 0
73#define NETLBL_NLTYPE_MGMT 1
74#define NETLBL_NLTYPE_MGMT_NAME "NLBL_MGMT"
75#define NETLBL_NLTYPE_RIPSO 2
76#define NETLBL_NLTYPE_RIPSO_NAME "NLBL_RIPSO"
77#define NETLBL_NLTYPE_CIPSOV4 3
78#define NETLBL_NLTYPE_CIPSOV4_NAME "NLBL_CIPSOv4"
79#define NETLBL_NLTYPE_CIPSOV6 4
80#define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6"
81#define NETLBL_NLTYPE_UNLABELED 5
82#define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL"
83
84/*
85 * NetLabel - Kernel API for accessing the network packet label mappings.
86 *
87 * The following functions are provided for use by other kernel modules,
88 * specifically kernel LSM modules, to provide a consistent, transparent API
89 * for dealing with explicit packet labeling protocols such as CIPSO and
90 * RIPSO. The functions defined here are implemented in the
91 * net/netlabel/netlabel_kapi.c file.
92 *
93 */
94
95/* NetLabel audit information */
96struct netlbl_audit {
97 u32 secid;
98 uid_t loginuid;
99};
100
101/* Domain mapping definition struct */
102struct netlbl_dom_map;
103
104/* Domain mapping operations */
105int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);
106
107/* LSM security attributes */
108struct netlbl_lsm_cache {
109 void (*free) (const void *data);
110 void *data;
111};
112struct netlbl_lsm_secattr {
113 char *domain;
114
115 u32 mls_lvl;
116 u32 mls_lvl_vld;
117 unsigned char *mls_cat;
118 size_t mls_cat_len;
119
120 struct netlbl_lsm_cache cache;
121};
122
123/*
124 * LSM security attribute operations
125 */
126
127
128/**
129 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct
130 * @secattr: the struct to initialize
131 *
132 * Description:
133 * Initialize an already allocated netlbl_lsm_secattr struct. Returns zero on
134 * success, negative values on error.
135 *
136 */
137static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
138{
139 memset(secattr, 0, sizeof(*secattr));
140 return 0;
141}
142
143/**
144 * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct
145 * @secattr: the struct to clear
146 * @clear_cache: cache clear flag
147 *
148 * Description:
149 * Destroys the @secattr struct, including freeing all of the internal buffers.
150 * If @clear_cache is true then free the cache fields, otherwise leave them
151 * intact. The struct must be reset with a call to netlbl_secattr_init()
152 * before reuse.
153 *
154 */
155static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr,
156 u32 clear_cache)
157{
158 if (clear_cache && secattr->cache.data != NULL && secattr->cache.free)
159 secattr->cache.free(secattr->cache.data);
160 kfree(secattr->domain);
161 kfree(secattr->mls_cat);
162}
163
164/**
165 * netlbl_secattr_alloc - Allocate and initialize a netlbl_lsm_secattr struct
166 * @flags: the memory allocation flags
167 *
168 * Description:
169 * Allocate and initialize a netlbl_lsm_secattr struct. Returns a valid
170 * pointer on success, or NULL on failure.
171 *
172 */
173static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags)
174{
175 return kzalloc(sizeof(struct netlbl_lsm_secattr), flags);
176}
177
178/**
179 * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct
180 * @secattr: the struct to free
181 * @clear_cache: cache clear flag
182 *
183 * Description:
184 * Frees @secattr including all of the internal buffers. If @clear_cache is
185 * true then free the cache fields, otherwise leave them intact.
186 *
187 */
188static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr,
189 u32 clear_cache)
190{
191 netlbl_secattr_destroy(secattr, clear_cache);
192 kfree(secattr);
193}
194
195/*
196 * LSM protocol operations
197 */
198
199#ifdef CONFIG_NETLABEL
200int netlbl_socket_setattr(const struct socket *sock,
201 const struct netlbl_lsm_secattr *secattr);
202int netlbl_sock_getattr(struct sock *sk,
203 struct netlbl_lsm_secattr *secattr);
204int netlbl_socket_getattr(const struct socket *sock,
205 struct netlbl_lsm_secattr *secattr);
206int netlbl_skbuff_getattr(const struct sk_buff *skb,
207 struct netlbl_lsm_secattr *secattr);
208void netlbl_skbuff_err(struct sk_buff *skb, int error);
209#else
210static inline int netlbl_socket_setattr(const struct socket *sock,
211 const struct netlbl_lsm_secattr *secattr)
212{
213 return -ENOSYS;
214}
215
216static inline int netlbl_sock_getattr(struct sock *sk,
217 struct netlbl_lsm_secattr *secattr)
218{
219 return -ENOSYS;
220}
221
222static inline int netlbl_socket_getattr(const struct socket *sock,
223 struct netlbl_lsm_secattr *secattr)
224{
225 return -ENOSYS;
226}
227
228static inline int netlbl_skbuff_getattr(const struct sk_buff *skb,
229 struct netlbl_lsm_secattr *secattr)
230{
231 return -ENOSYS;
232}
233
234static inline void netlbl_skbuff_err(struct sk_buff *skb, int error)
235{
236 return;
237}
238#endif /* CONFIG_NETLABEL */
239
240/*
241 * LSM label mapping cache operations
242 */
243
244#ifdef CONFIG_NETLABEL
245void netlbl_cache_invalidate(void);
246int netlbl_cache_add(const struct sk_buff *skb,
247 const struct netlbl_lsm_secattr *secattr);
248#else
249static inline void netlbl_cache_invalidate(void)
250{
251 return;
252}
253
254static inline int netlbl_cache_add(const struct sk_buff *skb,
255 const struct netlbl_lsm_secattr *secattr)
256{
257 return 0;
258}
259#endif /* CONFIG_NETLABEL */
260
261#endif /* _NETLABEL_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 640c26a90c..ce5cba19c3 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -35,12 +35,15 @@
35 * nlmsg_put() add a netlink message to an skb 35 * nlmsg_put() add a netlink message to an skb
36 * nlmsg_put_answer() callback based nlmsg_put() 36 * nlmsg_put_answer() callback based nlmsg_put()
37 * nlmsg_end() finanlize netlink message 37 * nlmsg_end() finanlize netlink message
38 * nlmsg_get_pos() return current position in message
39 * nlmsg_trim() trim part of message
38 * nlmsg_cancel() cancel message construction 40 * nlmsg_cancel() cancel message construction
39 * nlmsg_free() free a netlink message 41 * nlmsg_free() free a netlink message
40 * 42 *
41 * Message Sending: 43 * Message Sending:
42 * nlmsg_multicast() multicast message to several groups 44 * nlmsg_multicast() multicast message to several groups
43 * nlmsg_unicast() unicast a message to a single socket 45 * nlmsg_unicast() unicast a message to a single socket
46 * nlmsg_notify() send notification message
44 * 47 *
45 * Message Length Calculations: 48 * Message Length Calculations:
46 * nlmsg_msg_size(payload) length of message w/o padding 49 * nlmsg_msg_size(payload) length of message w/o padding
@@ -62,6 +65,9 @@
62 * nlmsg_validate() validate netlink message incl. attrs 65 * nlmsg_validate() validate netlink message incl. attrs
63 * nlmsg_for_each_attr() loop over all attributes 66 * nlmsg_for_each_attr() loop over all attributes
64 * 67 *
68 * Misc:
69 * nlmsg_report() report back to application?
70 *
65 * ------------------------------------------------------------------------ 71 * ------------------------------------------------------------------------
66 * Attributes Interface 72 * Attributes Interface
67 * ------------------------------------------------------------------------ 73 * ------------------------------------------------------------------------
@@ -80,8 +86,10 @@
80 * struct nlattr netlink attribtue header 86 * struct nlattr netlink attribtue header
81 * 87 *
82 * Attribute Construction: 88 * Attribute Construction:
83 * nla_reserve(skb, type, len) reserve skb tailroom for an attribute 89 * nla_reserve(skb, type, len) reserve room for an attribute
90 * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr
84 * nla_put(skb, type, len, data) add attribute to skb 91 * nla_put(skb, type, len, data) add attribute to skb
92 * nla_put_nohdr(skb, len, data) add attribute w/o hdr
85 * 93 *
86 * Attribute Construction for Basic Types: 94 * Attribute Construction for Basic Types:
87 * nla_put_u8(skb, type, value) add u8 attribute to skb 95 * nla_put_u8(skb, type, value) add u8 attribute to skb
@@ -138,10 +146,13 @@
138 * nla_ok(nla, remaining) does nla fit into remaining bytes? 146 * nla_ok(nla, remaining) does nla fit into remaining bytes?
139 * nla_next(nla, remaining) get next netlink attribute 147 * nla_next(nla, remaining) get next netlink attribute
140 * nla_validate() validate a stream of attributes 148 * nla_validate() validate a stream of attributes
149 * nla_validate_nested() validate a stream of nested attributes
141 * nla_find() find attribute in stream of attributes 150 * nla_find() find attribute in stream of attributes
151 * nla_find_nested() find attribute in nested attributes
142 * nla_parse() parse and validate stream of attrs 152 * nla_parse() parse and validate stream of attrs
143 * nla_parse_nested() parse nested attribuets 153 * nla_parse_nested() parse nested attribuets
144 * nla_for_each_attr() loop over all attributes 154 * nla_for_each_attr() loop over all attributes
155 * nla_for_each_nested() loop over the nested attributes
145 *========================================================================= 156 *=========================================================================
146 */ 157 */
147 158
@@ -158,6 +169,7 @@ enum {
158 NLA_FLAG, 169 NLA_FLAG,
159 NLA_MSECS, 170 NLA_MSECS,
160 NLA_NESTED, 171 NLA_NESTED,
172 NLA_NUL_STRING,
161 __NLA_TYPE_MAX, 173 __NLA_TYPE_MAX,
162}; 174};
163 175
@@ -166,21 +178,37 @@ enum {
166/** 178/**
167 * struct nla_policy - attribute validation policy 179 * struct nla_policy - attribute validation policy
168 * @type: Type of attribute or NLA_UNSPEC 180 * @type: Type of attribute or NLA_UNSPEC
169 * @minlen: Minimal length of payload required to be available 181 * @len: Type specific length of payload
170 * 182 *
171 * Policies are defined as arrays of this struct, the array must be 183 * Policies are defined as arrays of this struct, the array must be
172 * accessible by attribute type up to the highest identifier to be expected. 184 * accessible by attribute type up to the highest identifier to be expected.
173 * 185 *
186 * Meaning of `len' field:
187 * NLA_STRING Maximum length of string
188 * NLA_NUL_STRING Maximum length of string (excluding NUL)
189 * NLA_FLAG Unused
190 * All other Exact length of attribute payload
191 *
174 * Example: 192 * Example:
175 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 193 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
176 * [ATTR_FOO] = { .type = NLA_U16 }, 194 * [ATTR_FOO] = { .type = NLA_U16 },
177 * [ATTR_BAR] = { .type = NLA_STRING }, 195 * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ },
178 * [ATTR_BAZ] = { .minlen = sizeof(struct mystruct) }, 196 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
179 * }; 197 * };
180 */ 198 */
181struct nla_policy { 199struct nla_policy {
182 u16 type; 200 u16 type;
183 u16 minlen; 201 u16 len;
202};
203
204/**
205 * struct nl_info - netlink source information
206 * @nlh: Netlink message header of original request
207 * @pid: Netlink PID of requesting application
208 */
209struct nl_info {
210 struct nlmsghdr *nlh;
211 u32 pid;
184}; 212};
185 213
186extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, 214extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
@@ -188,6 +216,9 @@ extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
188 struct nlmsghdr *, int *)); 216 struct nlmsghdr *, int *));
189extern void netlink_queue_skip(struct nlmsghdr *nlh, 217extern void netlink_queue_skip(struct nlmsghdr *nlh,
190 struct sk_buff *skb); 218 struct sk_buff *skb);
219extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
220 u32 pid, unsigned int group, int report,
221 gfp_t flags);
191 222
192extern int nla_validate(struct nlattr *head, int len, int maxtype, 223extern int nla_validate(struct nlattr *head, int len, int maxtype,
193 struct nla_policy *policy); 224 struct nla_policy *policy);
@@ -203,12 +234,18 @@ extern int nla_memcmp(const struct nlattr *nla, const void *data,
203extern int nla_strcmp(const struct nlattr *nla, const char *str); 234extern int nla_strcmp(const struct nlattr *nla, const char *str);
204extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, 235extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype,
205 int attrlen); 236 int attrlen);
237extern void * __nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
206extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype, 238extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype,
207 int attrlen); 239 int attrlen);
240extern void * nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
208extern void __nla_put(struct sk_buff *skb, int attrtype, 241extern void __nla_put(struct sk_buff *skb, int attrtype,
209 int attrlen, const void *data); 242 int attrlen, const void *data);
243extern void __nla_put_nohdr(struct sk_buff *skb, int attrlen,
244 const void *data);
210extern int nla_put(struct sk_buff *skb, int attrtype, 245extern int nla_put(struct sk_buff *skb, int attrtype,
211 int attrlen, const void *data); 246 int attrlen, const void *data);
247extern int nla_put_nohdr(struct sk_buff *skb, int attrlen,
248 const void *data);
212 249
213/************************************************************************** 250/**************************************************************************
214 * Netlink Messages 251 * Netlink Messages
@@ -364,6 +401,17 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
364} 401}
365 402
366/** 403/**
404 * nlmsg_report - need to report back to application?
405 * @nlh: netlink message header
406 *
407 * Returns 1 if a report back to the application is requested.
408 */
409static inline int nlmsg_report(struct nlmsghdr *nlh)
410{
411 return !!(nlh->nlmsg_flags & NLM_F_ECHO);
412}
413
414/**
367 * nlmsg_for_each_attr - iterate over a stream of attributes 415 * nlmsg_for_each_attr - iterate over a stream of attributes
368 * @pos: loop counter, set to current attribute 416 * @pos: loop counter, set to current attribute
369 * @nlh: netlink message header 417 * @nlh: netlink message header
@@ -453,12 +501,13 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
453/** 501/**
454 * nlmsg_new - Allocate a new netlink message 502 * nlmsg_new - Allocate a new netlink message
455 * @size: maximum size of message 503 * @size: maximum size of message
504 * @flags: the type of memory to allocate.
456 * 505 *
457 * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. 506 * Use NLMSG_GOODSIZE if size isn't know and you need a good default size.
458 */ 507 */
459static inline struct sk_buff *nlmsg_new(int size) 508static inline struct sk_buff *nlmsg_new(int size, gfp_t flags)
460{ 509{
461 return alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 510 return alloc_skb(size, flags);
462} 511}
463 512
464/** 513/**
@@ -480,6 +529,32 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
480} 529}
481 530
482/** 531/**
532 * nlmsg_get_pos - return current position in netlink message
533 * @skb: socket buffer the message is stored in
534 *
535 * Returns a pointer to the current tail of the message.
536 */
537static inline void *nlmsg_get_pos(struct sk_buff *skb)
538{
539 return skb->tail;
540}
541
542/**
543 * nlmsg_trim - Trim message to a mark
544 * @skb: socket buffer the message is stored in
545 * @mark: mark to trim to
546 *
547 * Trims the message to the provided mark. Returns -1.
548 */
549static inline int nlmsg_trim(struct sk_buff *skb, void *mark)
550{
551 if (mark)
552 skb_trim(skb, (unsigned char *) mark - skb->data);
553
554 return -1;
555}
556
557/**
483 * nlmsg_cancel - Cancel construction of a netlink message 558 * nlmsg_cancel - Cancel construction of a netlink message
484 * @skb: socket buffer the message is stored in 559 * @skb: socket buffer the message is stored in
485 * @nlh: netlink message header 560 * @nlh: netlink message header
@@ -489,9 +564,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
489 */ 564 */
490static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) 565static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh)
491{ 566{
492 skb_trim(skb, (unsigned char *) nlh - skb->data); 567 return nlmsg_trim(skb, nlh);
493
494 return -1;
495} 568}
496 569
497/** 570/**
@@ -509,15 +582,16 @@ static inline void nlmsg_free(struct sk_buff *skb)
509 * @skb: netlink message as socket buffer 582 * @skb: netlink message as socket buffer
510 * @pid: own netlink pid to avoid sending to yourself 583 * @pid: own netlink pid to avoid sending to yourself
511 * @group: multicast group id 584 * @group: multicast group id
585 * @flags: allocation flags
512 */ 586 */
513static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, 587static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
514 u32 pid, unsigned int group) 588 u32 pid, unsigned int group, gfp_t flags)
515{ 589{
516 int err; 590 int err;
517 591
518 NETLINK_CB(skb).dst_group = group; 592 NETLINK_CB(skb).dst_group = group;
519 593
520 err = netlink_broadcast(sk, skb, pid, group, GFP_KERNEL); 594 err = netlink_broadcast(sk, skb, pid, group, flags);
521 if (err > 0) 595 if (err > 0)
522 err = 0; 596 err = 0;
523 597
@@ -631,6 +705,18 @@ static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
631} 705}
632 706
633/** 707/**
708 * nla_find_nested - find attribute in a set of nested attributes
709 * @nla: attribute containing the nested attributes
710 * @attrtype: type of attribute to look for
711 *
712 * Returns the first attribute which matches the specified type.
713 */
714static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
715{
716 return nla_find(nla_data(nla), nla_len(nla), attrtype);
717}
718
719/**
634 * nla_parse_nested - parse nested attributes 720 * nla_parse_nested - parse nested attributes
635 * @tb: destination array with maxtype+1 elements 721 * @tb: destination array with maxtype+1 elements
636 * @maxtype: maximum attribute type to be expected 722 * @maxtype: maximum attribute type to be expected
@@ -745,13 +831,16 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
745#define NLA_PUT_U32(skb, attrtype, value) \ 831#define NLA_PUT_U32(skb, attrtype, value) \
746 NLA_PUT_TYPE(skb, u32, attrtype, value) 832 NLA_PUT_TYPE(skb, u32, attrtype, value)
747 833
834#define NLA_PUT_BE32(skb, attrtype, value) \
835 NLA_PUT_TYPE(skb, __be32, attrtype, value)
836
748#define NLA_PUT_U64(skb, attrtype, value) \ 837#define NLA_PUT_U64(skb, attrtype, value) \
749 NLA_PUT_TYPE(skb, u64, attrtype, value) 838 NLA_PUT_TYPE(skb, u64, attrtype, value)
750 839
751#define NLA_PUT_STRING(skb, attrtype, value) \ 840#define NLA_PUT_STRING(skb, attrtype, value) \
752 NLA_PUT(skb, attrtype, strlen(value) + 1, value) 841 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
753 842
754#define NLA_PUT_FLAG(skb, attrtype, value) \ 843#define NLA_PUT_FLAG(skb, attrtype) \
755 NLA_PUT(skb, attrtype, 0, NULL) 844 NLA_PUT(skb, attrtype, 0, NULL)
756 845
757#define NLA_PUT_MSECS(skb, attrtype, jiffies) \ 846#define NLA_PUT_MSECS(skb, attrtype, jiffies) \
@@ -767,6 +856,15 @@ static inline u32 nla_get_u32(struct nlattr *nla)
767} 856}
768 857
769/** 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/**
770 * nla_get_u16 - return payload of u16 attribute 868 * nla_get_u16 - return payload of u16 attribute
771 * @nla: u16 netlink attribute 869 * @nla: u16 netlink attribute
772 */ 870 */
@@ -862,10 +960,25 @@ static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
862 */ 960 */
863static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) 961static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
864{ 962{
865 if (start) 963 return nlmsg_trim(skb, start);
866 skb_trim(skb, (unsigned char *) start - skb->data); 964}
867 965
868 return -1; 966/**
967 * nla_validate_nested - Validate a stream of nested attributes
968 * @start: container attribute
969 * @maxtype: maximum attribute type to be expected
970 * @policy: validation policy
971 *
972 * Validates all attributes in the nested attribute stream against the
973 * specified policy. Attributes with a type exceeding maxtype will be
974 * ignored. See documenation of struct nla_policy for more details.
975 *
976 * Returns 0 on success or a negative error code.
977 */
978static inline int nla_validate_nested(struct nlattr *start, int maxtype,
979 struct nla_policy *policy)
980{
981 return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
869} 982}
870 983
871/** 984/**
@@ -880,4 +993,13 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
880 nla_ok(pos, rem); \ 993 nla_ok(pos, rem); \
881 pos = nla_next(pos, &(rem))) 994 pos = nla_next(pos, &(rem)))
882 995
996/**
997 * nla_for_each_nested - iterate over nested attributes
998 * @pos: loop counter, set to current attribute
999 * @nla: attribute containing the nested attributes
1000 * @rem: initialized to len, holds bytes currently remaining in stream
1001 */
1002#define nla_for_each_nested(pos, nla, rem) \
1003 nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem)
1004
883#endif 1005#endif
diff --git a/include/net/nexthop.h b/include/net/nexthop.h
new file mode 100644
index 0000000000..3334dbfa5a
--- /dev/null
+++ b/include/net/nexthop.h
@@ -0,0 +1,33 @@
1#ifndef __NET_NEXTHOP_H
2#define __NET_NEXTHOP_H
3
4#include <linux/rtnetlink.h>
5#include <net/netlink.h>
6
7static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining)
8{
9 return remaining >= sizeof(*rtnh) &&
10 rtnh->rtnh_len >= sizeof(*rtnh) &&
11 rtnh->rtnh_len <= remaining;
12}
13
14static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh,
15 int *remaining)
16{
17 int totlen = NLA_ALIGN(rtnh->rtnh_len);
18
19 *remaining -= totlen;
20 return (struct rtnexthop *) ((char *) rtnh + totlen);
21}
22
23static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh)
24{
25 return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh)));
26}
27
28static inline int rtnh_attrlen(const struct rtnexthop *rtnh)
29{
30 return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh));
31}
32
33#endif
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h
deleted file mode 100644
index cf5e4d2e4c..0000000000
--- a/include/net/pkt_act.h
+++ /dev/null
@@ -1,273 +0,0 @@
1#ifndef __NET_PKT_ACT_H
2#define __NET_PKT_ACT_H
3
4#include <asm/uaccess.h>
5#include <asm/system.h>
6#include <linux/bitops.h>
7#include <linux/types.h>
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/string.h>
11#include <linux/mm.h>
12#include <linux/socket.h>
13#include <linux/sockios.h>
14#include <linux/in.h>
15#include <linux/errno.h>
16#include <linux/interrupt.h>
17#include <linux/skbuff.h>
18#include <linux/rtnetlink.h>
19#include <linux/module.h>
20#include <linux/init.h>
21#include <linux/proc_fs.h>
22#include <net/sock.h>
23#include <net/pkt_sched.h>
24
25#define tca_st(val) (struct tcf_##val *)
26#define PRIV(a,name) ( tca_st(name) (a)->priv)
27
28#if 0 /* control */
29#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
30#else
31#define DPRINTK(format,args...)
32#endif
33
34#if 0 /* data */
35#define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args)
36#else
37#define D2PRINTK(format,args...)
38#endif
39
40static __inline__ unsigned
41tcf_hash(u32 index)
42{
43 return index & MY_TAB_MASK;
44}
45
46/* probably move this from being inline
47 * and put into act_generic
48*/
49static inline void
50tcf_hash_destroy(struct tcf_st *p)
51{
52 unsigned h = tcf_hash(p->index);
53 struct tcf_st **p1p;
54
55 for (p1p = &tcf_ht[h]; *p1p; p1p = &(*p1p)->next) {
56 if (*p1p == p) {
57 write_lock_bh(&tcf_t_lock);
58 *p1p = p->next;
59 write_unlock_bh(&tcf_t_lock);
60#ifdef CONFIG_NET_ESTIMATOR
61 gen_kill_estimator(&p->bstats, &p->rate_est);
62#endif
63 kfree(p);
64 return;
65 }
66 }
67 BUG_TRAP(0);
68}
69
70static inline int
71tcf_hash_release(struct tcf_st *p, int bind )
72{
73 int ret = 0;
74 if (p) {
75 if (bind) {
76 p->bindcnt--;
77 }
78 p->refcnt--;
79 if(p->bindcnt <=0 && p->refcnt <= 0) {
80 tcf_hash_destroy(p);
81 ret = 1;
82 }
83 }
84 return ret;
85}
86
87static __inline__ int
88tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
89 struct tc_action *a)
90{
91 struct tcf_st *p;
92 int err =0, index = -1,i= 0, s_i = 0, n_i = 0;
93 struct rtattr *r ;
94
95 read_lock(&tcf_t_lock);
96
97 s_i = cb->args[0];
98
99 for (i = 0; i < MY_TAB_SIZE; i++) {
100 p = tcf_ht[tcf_hash(i)];
101
102 for (; p; p = p->next) {
103 index++;
104 if (index < s_i)
105 continue;
106 a->priv = p;
107 a->order = n_i;
108 r = (struct rtattr*) skb->tail;
109 RTA_PUT(skb, a->order, 0, NULL);
110 err = tcf_action_dump_1(skb, a, 0, 0);
111 if (0 > err) {
112 index--;
113 skb_trim(skb, (u8*)r - skb->data);
114 goto done;
115 }
116 r->rta_len = skb->tail - (u8*)r;
117 n_i++;
118 if (n_i >= TCA_ACT_MAX_PRIO) {
119 goto done;
120 }
121 }
122 }
123done:
124 read_unlock(&tcf_t_lock);
125 if (n_i)
126 cb->args[0] += n_i;
127 return n_i;
128
129rtattr_failure:
130 skb_trim(skb, (u8*)r - skb->data);
131 goto done;
132}
133
134static __inline__ int
135tcf_del_walker(struct sk_buff *skb, struct tc_action *a)
136{
137 struct tcf_st *p, *s_p;
138 struct rtattr *r ;
139 int i= 0, n_i = 0;
140
141 r = (struct rtattr*) skb->tail;
142 RTA_PUT(skb, a->order, 0, NULL);
143 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
144 for (i = 0; i < MY_TAB_SIZE; i++) {
145 p = tcf_ht[tcf_hash(i)];
146
147 while (p != NULL) {
148 s_p = p->next;
149 if (ACT_P_DELETED == tcf_hash_release(p, 0)) {
150 module_put(a->ops->owner);
151 }
152 n_i++;
153 p = s_p;
154 }
155 }
156 RTA_PUT(skb, TCA_FCNT, 4, &n_i);
157 r->rta_len = skb->tail - (u8*)r;
158
159 return n_i;
160rtattr_failure:
161 skb_trim(skb, (u8*)r - skb->data);
162 return -EINVAL;
163}
164
165static __inline__ int
166tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, int type,
167 struct tc_action *a)
168{
169 if (type == RTM_DELACTION) {
170 return tcf_del_walker(skb,a);
171 } else if (type == RTM_GETACTION) {
172 return tcf_dump_walker(skb,cb,a);
173 } else {
174 printk("tcf_generic_walker: unknown action %d\n",type);
175 return -EINVAL;
176 }
177}
178
179static __inline__ struct tcf_st *
180tcf_hash_lookup(u32 index)
181{
182 struct tcf_st *p;
183
184 read_lock(&tcf_t_lock);
185 for (p = tcf_ht[tcf_hash(index)]; p; p = p->next) {
186 if (p->index == index)
187 break;
188 }
189 read_unlock(&tcf_t_lock);
190 return p;
191}
192
193static __inline__ u32
194tcf_hash_new_index(void)
195{
196 do {
197 if (++idx_gen == 0)
198 idx_gen = 1;
199 } while (tcf_hash_lookup(idx_gen));
200
201 return idx_gen;
202}
203
204
205static inline int
206tcf_hash_search(struct tc_action *a, u32 index)
207{
208 struct tcf_st *p = tcf_hash_lookup(index);
209
210 if (p != NULL) {
211 a->priv = p;
212 return 1;
213 }
214 return 0;
215}
216
217#ifdef CONFIG_NET_ACT_INIT
218static inline struct tcf_st *
219tcf_hash_check(u32 index, struct tc_action *a, int ovr, int bind)
220{
221 struct tcf_st *p = NULL;
222 if (index && (p = tcf_hash_lookup(index)) != NULL) {
223 if (bind) {
224 p->bindcnt++;
225 p->refcnt++;
226 }
227 a->priv = p;
228 }
229 return p;
230}
231
232static inline struct tcf_st *
233tcf_hash_create(u32 index, struct rtattr *est, struct tc_action *a, int size, int ovr, int bind)
234{
235 struct tcf_st *p = NULL;
236
237 p = kmalloc(size, GFP_KERNEL);
238 if (p == NULL)
239 return p;
240
241 memset(p, 0, size);
242 p->refcnt = 1;
243
244 if (bind) {
245 p->bindcnt = 1;
246 }
247
248 spin_lock_init(&p->lock);
249 p->stats_lock = &p->lock;
250 p->index = index ? : tcf_hash_new_index();
251 p->tm.install = jiffies;
252 p->tm.lastuse = jiffies;
253#ifdef CONFIG_NET_ESTIMATOR
254 if (est)
255 gen_new_estimator(&p->bstats, &p->rate_est, p->stats_lock, est);
256#endif
257 a->priv = (void *) p;
258 return p;
259}
260
261static inline void tcf_hash_insert(struct tcf_st *p)
262{
263 unsigned h = tcf_hash(p->index);
264
265 write_lock_bh(&tcf_t_lock);
266 p->next = tcf_ht[h];
267 tcf_ht[h] = p;
268 write_unlock_bh(&tcf_t_lock);
269}
270
271#endif
272
273#endif
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 75b5b9333f..f6afee7323 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -171,14 +171,14 @@ psched_tod_diff(int delta_sec, int bound)
171({ \ 171({ \
172 int __delta = (tv).tv_usec + (delta); \ 172 int __delta = (tv).tv_usec + (delta); \
173 (tv_res).tv_sec = (tv).tv_sec; \ 173 (tv_res).tv_sec = (tv).tv_sec; \
174 if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ 174 while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
175 (tv_res).tv_usec = __delta; \ 175 (tv_res).tv_usec = __delta; \
176}) 176})
177 177
178#define PSCHED_TADD(tv, delta) \ 178#define PSCHED_TADD(tv, delta) \
179({ \ 179({ \
180 (tv).tv_usec += (delta); \ 180 (tv).tv_usec += (delta); \
181 if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \ 181 while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \
182 (tv).tv_usec -= USEC_PER_SEC; } \ 182 (tv).tv_usec -= USEC_PER_SEC; } \
183}) 183})
184 184
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 3b6dc15c68..c643bce64e 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -36,7 +36,9 @@
36struct net_protocol { 36struct net_protocol {
37 int (*handler)(struct sk_buff *skb); 37 int (*handler)(struct sk_buff *skb);
38 void (*err_handler)(struct sk_buff *skb, u32 info); 38 void (*err_handler)(struct sk_buff *skb, u32 info);
39 struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); 39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 int features);
40 int no_policy; 42 int no_policy;
41}; 43};
42 44
@@ -49,11 +51,18 @@ struct inet6_protocol
49 struct inet6_skb_parm *opt, 51 struct inet6_skb_parm *opt,
50 int type, int code, int offset, 52 int type, int code, int offset,
51 __u32 info); 53 __u32 info);
54
55 int (*gso_send_check)(struct sk_buff *skb);
56 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
57 int features);
58
52 unsigned int flags; /* INET6_PROTO_xxx */ 59 unsigned int flags; /* INET6_PROTO_xxx */
53}; 60};
54 61
55#define INET6_PROTO_NOPOLICY 0x1 62#define INET6_PROTO_NOPOLICY 0x1
56#define INET6_PROTO_FINAL 0x2 63#define INET6_PROTO_FINAL 0x2
64/* This should be set for any extension header which is compatible with GSO. */
65#define INET6_PROTO_GSO_EXTHDR 0x4
57#endif 66#endif
58 67
59/* This is used to register socket interfaces for IP protocols. */ 68/* This is used to register socket interfaces for IP protocols. */
diff --git a/include/net/red.h b/include/net/red.h
index 5ccdbb3d47..a4eb37946f 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -212,7 +212,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
212 * Seems, it is the best solution to 212 * Seems, it is the best solution to
213 * problem of too coarse exponent tabulation. 213 * problem of too coarse exponent tabulation.
214 */ 214 */
215 us_idle = (p->qavg * us_idle) >> p->Scell_log; 215 us_idle = (p->qavg * (u64)us_idle) >> p->Scell_log;
216 216
217 if (us_idle < (p->qavg >> 1)) 217 if (us_idle < (p->qavg >> 1))
218 return p->qavg - us_idle; 218 return p->qavg - us_idle;
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index c5d7f920c3..8e165ca16b 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -53,6 +53,7 @@ struct request_sock {
53 unsigned long expires; 53 unsigned long expires;
54 struct request_sock_ops *rsk_ops; 54 struct request_sock_ops *rsk_ops;
55 struct sock *sk; 55 struct sock *sk;
56 u32 secid;
56}; 57};
57 58
58static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) 59static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops)
diff --git a/include/net/route.h b/include/net/route.h
index c4a068692d..486e37aff0 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -32,6 +32,7 @@
32#include <linux/route.h> 32#include <linux/route.h>
33#include <linux/ip.h> 33#include <linux/ip.h>
34#include <linux/cache.h> 34#include <linux/cache.h>
35#include <linux/security.h>
35 36
36#ifndef __KERNEL__ 37#ifndef __KERNEL__
37#warning This file is not supposed to be used outside of kernel. 38#warning This file is not supposed to be used outside of kernel.
@@ -61,18 +62,18 @@ struct rtable
61 __u16 rt_type; 62 __u16 rt_type;
62 __u16 rt_multipath_alg; 63 __u16 rt_multipath_alg;
63 64
64 __u32 rt_dst; /* Path destination */ 65 __be32 rt_dst; /* Path destination */
65 __u32 rt_src; /* Path source */ 66 __be32 rt_src; /* Path source */
66 int rt_iif; 67 int rt_iif;
67 68
68 /* Info on neighbour */ 69 /* Info on neighbour */
69 __u32 rt_gateway; 70 __be32 rt_gateway;
70 71
71 /* Cache lookup keys */ 72 /* Cache lookup keys */
72 struct flowi fl; 73 struct flowi fl;
73 74
74 /* Miscellaneous cached information */ 75 /* Miscellaneous cached information */
75 __u32 rt_spec_dst; /* RFC1122 specific destination */ 76 __be32 rt_spec_dst; /* RFC1122 specific destination */
76 struct inet_peer *peer; /* long-living peer info */ 77 struct inet_peer *peer; /* long-living peer info */
77}; 78};
78 79
@@ -108,18 +109,18 @@ extern struct ip_rt_acct *ip_rt_acct;
108 109
109struct in_device; 110struct in_device;
110extern int ip_rt_init(void); 111extern int ip_rt_init(void);
111extern 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,
112 u32 src, struct net_device *dev); 113 __be32 src, struct net_device *dev);
113extern void ip_rt_advice(struct rtable **rp, int advice); 114extern void ip_rt_advice(struct rtable **rp, int advice);
114extern void rt_cache_flush(int how); 115extern void rt_cache_flush(int how);
115extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); 116extern int __ip_route_output_key(struct rtable **, const struct flowi *flp);
116extern int ip_route_output_key(struct rtable **, struct flowi *flp); 117extern int ip_route_output_key(struct rtable **, struct flowi *flp);
117extern 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);
118extern 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);
119extern 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);
120extern void ip_rt_send_redirect(struct sk_buff *skb); 121extern void ip_rt_send_redirect(struct sk_buff *skb);
121 122
122extern unsigned inet_addr_type(u32 addr); 123extern unsigned inet_addr_type(__be32 addr);
123extern void ip_rt_multicast_event(struct in_device *); 124extern void ip_rt_multicast_event(struct in_device *);
124extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); 125extern int ip_rt_ioctl(unsigned int cmd, void __user *arg);
125extern void ip_rt_get_source(u8 *src, struct rtable *rt); 126extern void ip_rt_get_source(u8 *src, struct rtable *rt);
@@ -143,9 +144,9 @@ static inline char rt_tos2priority(u8 tos)
143 return ip_tos2prio[IPTOS_TOS(tos)>>1]; 144 return ip_tos2prio[IPTOS_TOS(tos)>>1];
144} 145}
145 146
146static inline int ip_route_connect(struct rtable **rp, u32 dst, 147static inline int ip_route_connect(struct rtable **rp, __be32 dst,
147 u32 src, u32 tos, int oif, u8 protocol, 148 __be32 src, u32 tos, int oif, u8 protocol,
148 u16 sport, u16 dport, struct sock *sk) 149 __be16 sport, __be16 dport, struct sock *sk)
149{ 150{
150 struct flowi fl = { .oif = oif, 151 struct flowi fl = { .oif = oif,
151 .nl_u = { .ip4_u = { .daddr = dst, 152 .nl_u = { .ip4_u = { .daddr = dst,
@@ -166,11 +167,12 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst,
166 ip_rt_put(*rp); 167 ip_rt_put(*rp);
167 *rp = NULL; 168 *rp = NULL;
168 } 169 }
170 security_sk_classify_flow(sk, &fl);
169 return ip_route_output_flow(rp, &fl, sk, 0); 171 return ip_route_output_flow(rp, &fl, sk, 0);
170} 172}
171 173
172static inline int ip_route_newports(struct rtable **rp, u8 protocol, 174static inline int ip_route_newports(struct rtable **rp, u8 protocol,
173 u16 sport, u16 dport, struct sock *sk) 175 __be16 sport, __be16 dport, struct sock *sk)
174{ 176{
175 if (sport != (*rp)->fl.fl_ip_sport || 177 if (sport != (*rp)->fl.fl_ip_sport ||
176 dport != (*rp)->fl.fl_ip_dport) { 178 dport != (*rp)->fl.fl_ip_dport) {
@@ -182,6 +184,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
182 fl.proto = protocol; 184 fl.proto = protocol;
183 ip_rt_put(*rp); 185 ip_rt_put(*rp);
184 *rp = NULL; 186 *rp = NULL;
187 security_sk_classify_flow(sk, &fl);
185 return ip_route_output_flow(rp, &fl, sk, 0); 188 return ip_route_output_flow(rp, &fl, sk, 0);
186 } 189 }
187 return 0; 190 return 0;
diff --git a/include/net/scm.h b/include/net/scm.h
index 540619cb71..5637d5e22d 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/limits.h> 4#include <linux/limits.h>
5#include <linux/net.h> 5#include <linux/net.h>
6#include <linux/security.h>
6 7
7/* Well, we should have at least one descriptor open 8/* Well, we should have at least one descriptor open
8 * to accept passed FDs 8) 9 * to accept passed FDs 8)
@@ -19,6 +20,9 @@ struct scm_cookie
19{ 20{
20 struct ucred creds; /* Skb credentials */ 21 struct ucred creds; /* Skb credentials */
21 struct scm_fp_list *fp; /* Passed files */ 22 struct scm_fp_list *fp; /* Passed files */
23#ifdef CONFIG_SECURITY_NETWORK
24 u32 secid; /* Passed security ID */
25#endif
22 unsigned long seq; /* Connection seqno */ 26 unsigned long seq; /* Connection seqno */
23}; 27};
24 28
@@ -28,6 +32,16 @@ extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie
28extern void __scm_destroy(struct scm_cookie *scm); 32extern void __scm_destroy(struct scm_cookie *scm);
29extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); 33extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl);
30 34
35#ifdef CONFIG_SECURITY_NETWORK
36static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
37{
38 security_socket_getpeersec_dgram(sock, NULL, &scm->secid);
39}
40#else
41static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
42{ }
43#endif /* CONFIG_SECURITY_NETWORK */
44
31static __inline__ void scm_destroy(struct scm_cookie *scm) 45static __inline__ void scm_destroy(struct scm_cookie *scm)
32{ 46{
33 if (scm && scm->fp) 47 if (scm && scm->fp)
@@ -43,11 +57,33 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
43 scm->creds.pid = p->tgid; 57 scm->creds.pid = p->tgid;
44 scm->fp = NULL; 58 scm->fp = NULL;
45 scm->seq = 0; 59 scm->seq = 0;
60 unix_get_peersec_dgram(sock, scm);
46 if (msg->msg_controllen <= 0) 61 if (msg->msg_controllen <= 0)
47 return 0; 62 return 0;
48 return __scm_send(sock, msg, scm); 63 return __scm_send(sock, msg, scm);
49} 64}
50 65
66#ifdef CONFIG_SECURITY_NETWORK
67static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
68{
69 char *secdata;
70 u32 seclen;
71 int err;
72
73 if (test_bit(SOCK_PASSSEC, &sock->flags)) {
74 err = security_secid_to_secctx(scm->secid, &secdata, &seclen);
75
76 if (!err) {
77 put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, seclen, secdata);
78 security_release_secctx(secdata, seclen);
79 }
80 }
81}
82#else
83static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
84{ }
85#endif /* CONFIG_SECURITY_NETWORK */
86
51static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, 87static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
52 struct scm_cookie *scm, int flags) 88 struct scm_cookie *scm, int flags)
53{ 89{
@@ -62,6 +98,8 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
62 if (test_bit(SOCK_PASSCRED, &sock->flags)) 98 if (test_bit(SOCK_PASSCRED, &sock->flags))
63 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); 99 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
64 100
101 scm_passec(sock, msg, scm);
102
65 if (!scm->fp) 103 if (!scm->fp)
66 return; 104 return;
67 105
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index c51541ee02..6c632e26f7 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -264,10 +264,10 @@ enum { SCTP_MAX_DUP_TSNS = 16 };
264enum { SCTP_MAX_GABS = 16 }; 264enum { SCTP_MAX_GABS = 16 };
265 265
266/* Heartbeat interval - 30 secs */ 266/* Heartbeat interval - 30 secs */
267#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ) 267#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30*1000)
268 268
269/* Delayed sack timer - 200ms */ 269/* Delayed sack timer - 200ms */
270#define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) 270#define SCTP_DEFAULT_TIMEOUT_SACK (200)
271 271
272/* RTO.Initial - 3 seconds 272/* RTO.Initial - 3 seconds
273 * RTO.Min - 1 second 273 * RTO.Min - 1 second
@@ -275,9 +275,9 @@ enum { SCTP_MAX_GABS = 16 };
275 * RTO.Alpha - 1/8 275 * RTO.Alpha - 1/8
276 * RTO.Beta - 1/4 276 * RTO.Beta - 1/4
277 */ 277 */
278#define SCTP_RTO_INITIAL (3 * HZ) 278#define SCTP_RTO_INITIAL (3 * 1000)
279#define SCTP_RTO_MIN (1 * HZ) 279#define SCTP_RTO_MIN (1 * 1000)
280#define SCTP_RTO_MAX (60 * HZ) 280#define SCTP_RTO_MAX (60 * 1000)
281 281
282#define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ 282#define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */
283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ 283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */
@@ -290,8 +290,7 @@ enum { SCTP_MAX_GABS = 16 };
290#define SCTP_DEF_MAX_INIT 6 290#define SCTP_DEF_MAX_INIT 6
291#define SCTP_DEF_MAX_SEND 10 291#define SCTP_DEF_MAX_SEND 10
292 292
293#define SCTP_DEFAULT_COOKIE_LIFE_SEC 60 /* seconds */ 293#define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */
294#define SCTP_DEFAULT_COOKIE_LIFE_USEC 0 /* microseconds */
295 294
296#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ 295#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */
297#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ 296#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */
@@ -312,9 +311,9 @@ enum { SCTP_MAX_GABS = 16 };
312 */ 311 */
313 312
314#if defined (CONFIG_SCTP_HMAC_MD5) 313#if defined (CONFIG_SCTP_HMAC_MD5)
315#define SCTP_COOKIE_HMAC_ALG "md5" 314#define SCTP_COOKIE_HMAC_ALG "hmac(md5)"
316#elif defined (CONFIG_SCTP_HMAC_SHA1) 315#elif defined (CONFIG_SCTP_HMAC_SHA1)
317#define SCTP_COOKIE_HMAC_ALG "sha1" 316#define SCTP_COOKIE_HMAC_ALG "hmac(sha1)"
318#else 317#else
319#define SCTP_COOKIE_HMAC_ALG NULL 318#define SCTP_COOKIE_HMAC_ALG NULL
320#endif 319#endif
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a9663b49ea..ee68a31240 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -128,6 +128,8 @@ extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
128 int flags); 128 int flags);
129extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 129extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
130extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 130extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
131int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
132 void *ptr);
131 133
132/* 134/*
133 * sctp/socket.c 135 * sctp/socket.c
@@ -178,6 +180,17 @@ void sctp_backlog_migrate(struct sctp_association *assoc,
178 struct sock *oldsk, struct sock *newsk); 180 struct sock *oldsk, struct sock *newsk);
179 181
180/* 182/*
183 * sctp/proc.c
184 */
185int sctp_snmp_proc_init(void);
186void sctp_snmp_proc_exit(void);
187int sctp_eps_proc_init(void);
188void sctp_eps_proc_exit(void);
189int sctp_assocs_proc_init(void);
190void sctp_assocs_proc_exit(void);
191
192
193/*
181 * Section: Macros, externs, and inlines 194 * Section: Macros, externs, and inlines
182 */ 195 */
183 196
@@ -216,6 +229,50 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics);
216 229
217#endif /* !TEST_FRAME */ 230#endif /* !TEST_FRAME */
218 231
232/* sctp mib definitions */
233enum
234{
235 SCTP_MIB_NUM = 0,
236 SCTP_MIB_CURRESTAB, /* CurrEstab */
237 SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */
238 SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */
239 SCTP_MIB_ABORTEDS, /* Aborteds */
240 SCTP_MIB_SHUTDOWNS, /* Shutdowns */
241 SCTP_MIB_OUTOFBLUES, /* OutOfBlues */
242 SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */
243 SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */
244 SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */
245 SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */
246 SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */
247 SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */
248 SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */
249 SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */
250 SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */
251 SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */
252 SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */
253 SCTP_MIB_T1_INIT_EXPIREDS,
254 SCTP_MIB_T1_COOKIE_EXPIREDS,
255 SCTP_MIB_T2_SHUTDOWN_EXPIREDS,
256 SCTP_MIB_T3_RTX_EXPIREDS,
257 SCTP_MIB_T4_RTO_EXPIREDS,
258 SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS,
259 SCTP_MIB_DELAY_SACK_EXPIREDS,
260 SCTP_MIB_AUTOCLOSE_EXPIREDS,
261 SCTP_MIB_T3_RETRANSMITS,
262 SCTP_MIB_PMTUD_RETRANSMITS,
263 SCTP_MIB_FAST_RETRANSMITS,
264 SCTP_MIB_IN_PKT_SOFTIRQ,
265 SCTP_MIB_IN_PKT_BACKLOG,
266 SCTP_MIB_IN_PKT_DISCARDS,
267 SCTP_MIB_IN_DATA_CHUNK_DISCARDS,
268 __SCTP_MIB_MAX
269};
270
271#define SCTP_MIB_MAX __SCTP_MIB_MAX
272struct sctp_mib {
273 unsigned long mibs[SCTP_MIB_MAX];
274} __SNMP_MIB_ALIGN__;
275
219 276
220/* Print debugging messages. */ 277/* Print debugging messages. */
221#if SCTP_DEBUG 278#if SCTP_DEBUG
@@ -330,17 +387,6 @@ static inline void sctp_v6_exit(void) { return; }
330 387
331#endif /* #if defined(CONFIG_IPV6) */ 388#endif /* #if defined(CONFIG_IPV6) */
332 389
333/* Some wrappers, in case crypto not available. */
334#if defined (CONFIG_CRYPTO_HMAC)
335#define sctp_crypto_alloc_tfm crypto_alloc_tfm
336#define sctp_crypto_free_tfm crypto_free_tfm
337#define sctp_crypto_hmac crypto_hmac
338#else
339#define sctp_crypto_alloc_tfm(x...) NULL
340#define sctp_crypto_free_tfm(x...)
341#define sctp_crypto_hmac(x...)
342#endif
343
344 390
345/* Map an association to an assoc_id. */ 391/* Map an association to an assoc_id. */
346static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) 392static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
@@ -404,19 +450,6 @@ static inline int sctp_list_single_entry(struct list_head *head)
404 return ((head->next != head) && (head->next == head->prev)); 450 return ((head->next != head) && (head->next == head->prev));
405} 451}
406 452
407/* Calculate the size (in bytes) occupied by the data of an iovec. */
408static inline size_t get_user_iov_size(struct iovec *iov, int iovlen)
409{
410 size_t retval = 0;
411
412 for (; iovlen > 0; --iovlen) {
413 retval += iov->iov_len;
414 iov++;
415 }
416
417 return retval;
418}
419
420/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ 453/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
421static inline __s32 sctp_jitter(__u32 rto) 454static inline __s32 sctp_jitter(__u32 rto)
422{ 455{
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 1eac3d0eb7..de313de4fe 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -221,8 +221,7 @@ struct sctp_chunk *sctp_make_abort_no_data(const struct sctp_association *,
221 const struct sctp_chunk *, 221 const struct sctp_chunk *,
222 __u32 tsn); 222 __u32 tsn);
223struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, 223struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *,
224 const struct sctp_chunk *, 224 const struct msghdr *, size_t msg_len);
225 const struct msghdr *);
226struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, 225struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
227 const struct sctp_chunk *, 226 const struct sctp_chunk *,
228 const __u8 *, 227 const __u8 *,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 5f69158c10..c6d93bb0dc 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -87,6 +87,7 @@ struct sctp_bind_addr;
87struct sctp_ulpq; 87struct sctp_ulpq;
88struct sctp_ep_common; 88struct sctp_ep_common;
89struct sctp_ssnmap; 89struct sctp_ssnmap;
90struct crypto_hash;
90 91
91 92
92#include <net/sctp/tsnmap.h> 93#include <net/sctp/tsnmap.h>
@@ -127,9 +128,9 @@ extern struct sctp_globals {
127 * RTO.Alpha - 1/8 (3 when converted to right shifts.) 128 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
128 * RTO.Beta - 1/4 (2 when converted to right shifts.) 129 * RTO.Beta - 1/4 (2 when converted to right shifts.)
129 */ 130 */
130 unsigned long rto_initial; 131 unsigned int rto_initial;
131 unsigned long rto_min; 132 unsigned int rto_min;
132 unsigned long rto_max; 133 unsigned int rto_max;
133 134
134 /* Note: rto_alpha and rto_beta are really defined as inverse 135 /* Note: rto_alpha and rto_beta are really defined as inverse
135 * powers of two to facilitate integer operations. 136 * powers of two to facilitate integer operations.
@@ -144,13 +145,13 @@ extern struct sctp_globals {
144 int cookie_preserve_enable; 145 int cookie_preserve_enable;
145 146
146 /* Valid.Cookie.Life - 60 seconds */ 147 /* Valid.Cookie.Life - 60 seconds */
147 unsigned long valid_cookie_life; 148 unsigned int valid_cookie_life;
148 149
149 /* Delayed SACK timeout 200ms default*/ 150 /* Delayed SACK timeout 200ms default*/
150 unsigned long sack_timeout; 151 unsigned int sack_timeout;
151 152
152 /* HB.interval - 30 seconds */ 153 /* HB.interval - 30 seconds */
153 unsigned long hb_interval; 154 unsigned int hb_interval;
154 155
155 /* Association.Max.Retrans - 10 attempts 156 /* Association.Max.Retrans - 10 attempts
156 * Path.Max.Retrans - 5 attempts (per destination address) 157 * Path.Max.Retrans - 5 attempts (per destination address)
@@ -264,7 +265,7 @@ struct sctp_sock {
264 struct sctp_pf *pf; 265 struct sctp_pf *pf;
265 266
266 /* Access to HMAC transform. */ 267 /* Access to HMAC transform. */
267 struct crypto_tfm *hmac; 268 struct crypto_hash *hmac;
268 269
269 /* What is our base endpointer? */ 270 /* What is our base endpointer? */
270 struct sctp_endpoint *ep; 271 struct sctp_endpoint *ep;
@@ -445,6 +446,7 @@ typedef struct sctp_sender_hb_info {
445 struct sctp_paramhdr param_hdr; 446 struct sctp_paramhdr param_hdr;
446 union sctp_addr daddr; 447 union sctp_addr daddr;
447 unsigned long sent_at; 448 unsigned long sent_at;
449 __u64 hb_nonce;
448} __attribute__((packed)) sctp_sender_hb_info_t; 450} __attribute__((packed)) sctp_sender_hb_info_t;
449 451
450/* 452/*
@@ -730,13 +732,10 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
730const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); 732const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
731 733
732/* This is a structure for holding either an IPv6 or an IPv4 address. */ 734/* This is a structure for holding either an IPv6 or an IPv4 address. */
733/* sin_family -- AF_INET or AF_INET6
734 * sin_port -- ordinary port number
735 * sin_addr -- cast to either (struct in_addr) or (struct in6_addr)
736 */
737struct sctp_sockaddr_entry { 735struct sctp_sockaddr_entry {
738 struct list_head list; 736 struct list_head list;
739 union sctp_addr a; 737 union sctp_addr a;
738 __u8 use_as_src;
740}; 739};
741 740
742typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); 741typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *);
@@ -984,6 +983,9 @@ struct sctp_transport {
984 */ 983 */
985 char cacc_saw_newack; 984 char cacc_saw_newack;
986 } cacc; 985 } cacc;
986
987 /* 64-bit random number sent with heartbeat. */
988 __u64 hb_nonce;
987}; 989};
988 990
989struct sctp_transport *sctp_transport_new(const union sctp_addr *, 991struct sctp_transport *sctp_transport_new(const union sctp_addr *,
@@ -1138,7 +1140,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
1138 sctp_scope_t scope, gfp_t gfp, 1140 sctp_scope_t scope, gfp_t gfp,
1139 int flags); 1141 int flags);
1140int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1142int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
1141 gfp_t gfp); 1143 __u8 use_as_src, gfp_t gfp);
1142int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); 1144int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
1143int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, 1145int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
1144 struct sctp_sock *); 1146 struct sctp_sock *);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 8a6bef6f91..1b7aae6cdd 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -560,9 +560,18 @@ struct sctp_paddrinfo {
560} __attribute__((packed, aligned(4))); 560} __attribute__((packed, aligned(4)));
561 561
562/* Peer addresses's state. */ 562/* Peer addresses's state. */
563/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
564 * calls.
565 * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
566 * Not yet confirmed by a heartbeat and not available for data
567 * transfers.
568 * ACTIVE : Peer address confirmed, active and available for data transfers.
569 * INACTIVE: Peer address inactive and not available for data transfers.
570 */
563enum sctp_spinfo_state { 571enum sctp_spinfo_state {
564 SCTP_INACTIVE, 572 SCTP_INACTIVE,
565 SCTP_ACTIVE, 573 SCTP_ACTIVE,
574 SCTP_UNCONFIRMED,
566 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ 575 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
567}; 576};
568 577
diff --git a/include/net/snmp.h b/include/net/snmp.h
index a36bed8ea2..464970e39e 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -100,12 +100,6 @@ struct udp_mib {
100 unsigned long mibs[UDP_MIB_MAX]; 100 unsigned long mibs[UDP_MIB_MAX];
101} __SNMP_MIB_ALIGN__; 101} __SNMP_MIB_ALIGN__;
102 102
103/* SCTP */
104#define SCTP_MIB_MAX __SCTP_MIB_MAX
105struct sctp_mib {
106 unsigned long mibs[SCTP_MIB_MAX];
107} __SNMP_MIB_ALIGN__;
108
109/* Linux */ 103/* Linux */
110#define LINUX_MIB_MAX __LINUX_MIB_MAX 104#define LINUX_MIB_MAX __LINUX_MIB_MAX
111struct linux_mib { 105struct linux_mib {
diff --git a/include/net/sock.h b/include/net/sock.h
index 2d8d6adf16..edd4d73ce7 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -44,6 +44,7 @@
44#include <linux/timer.h> 44#include <linux/timer.h>
45#include <linux/cache.h> 45#include <linux/cache.h>
46#include <linux/module.h> 46#include <linux/module.h>
47#include <linux/lockdep.h>
47#include <linux/netdevice.h> 48#include <linux/netdevice.h>
48#include <linux/skbuff.h> /* struct sk_buff */ 49#include <linux/skbuff.h> /* struct sk_buff */
49#include <linux/security.h> 50#include <linux/security.h>
@@ -78,14 +79,17 @@ typedef struct {
78 spinlock_t slock; 79 spinlock_t slock;
79 struct sock_iocb *owner; 80 struct sock_iocb *owner;
80 wait_queue_head_t wq; 81 wait_queue_head_t wq;
82 /*
83 * We express the mutex-alike socket_lock semantics
84 * to the lock validator by explicitly managing
85 * the slock as a lock variant (in addition to
86 * the slock itself):
87 */
88#ifdef CONFIG_DEBUG_LOCK_ALLOC
89 struct lockdep_map dep_map;
90#endif
81} socket_lock_t; 91} socket_lock_t;
82 92
83#define sock_lock_init(__sk) \
84do { spin_lock_init(&((__sk)->sk_lock.slock)); \
85 (__sk)->sk_lock.owner = NULL; \
86 init_waitqueue_head(&((__sk)->sk_lock.wq)); \
87} while(0)
88
89struct sock; 93struct sock;
90struct proto; 94struct proto;
91 95
@@ -140,6 +144,7 @@ struct sock_common {
140 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings 144 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings
141 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 145 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
142 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 146 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
147 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
143 * @sk_lingertime: %SO_LINGER l_linger setting 148 * @sk_lingertime: %SO_LINGER l_linger setting
144 * @sk_backlog: always used with the per-socket spinlock held 149 * @sk_backlog: always used with the per-socket spinlock held
145 * @sk_callback_lock: used with the callbacks in the end of this struct 150 * @sk_callback_lock: used with the callbacks in the end of this struct
@@ -211,6 +216,7 @@ struct sock {
211 gfp_t sk_allocation; 216 gfp_t sk_allocation;
212 int sk_sndbuf; 217 int sk_sndbuf;
213 int sk_route_caps; 218 int sk_route_caps;
219 int sk_gso_type;
214 int sk_rcvlowat; 220 int sk_rcvlowat;
215 unsigned long sk_flags; 221 unsigned long sk_flags;
216 unsigned long sk_lingertime; 222 unsigned long sk_lingertime;
@@ -383,7 +389,6 @@ enum sock_flags {
383 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ 389 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */
384 SOCK_DBG, /* %SO_DEBUG setting */ 390 SOCK_DBG, /* %SO_DEBUG setting */
385 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ 391 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */
386 SOCK_NO_LARGESEND, /* whether to sent large segments or not */
387 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 392 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
388 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 393 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
389}; 394};
@@ -746,6 +751,9 @@ extern void FASTCALL(release_sock(struct sock *sk));
746 751
747/* BH context may only use the following locking interface. */ 752/* BH context may only use the following locking interface. */
748#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 753#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
754#define bh_lock_sock_nested(__sk) \
755 spin_lock_nested(&((__sk)->sk_lock.slock), \
756 SINGLE_DEPTH_NESTING)
749#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 757#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
750 758
751extern struct sock *sk_alloc(int family, 759extern struct sock *sk_alloc(int family,
@@ -854,30 +862,24 @@ extern void sock_init_data(struct socket *sock, struct sock *sk);
854 * 862 *
855 */ 863 */
856 864
857static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) 865static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
858{ 866{
859 int err; 867 int err;
868 struct sk_filter *filter;
860 869
861 err = security_sock_rcv_skb(sk, skb); 870 err = security_sock_rcv_skb(sk, skb);
862 if (err) 871 if (err)
863 return err; 872 return err;
864 873
865 if (sk->sk_filter) { 874 rcu_read_lock_bh();
866 struct sk_filter *filter; 875 filter = sk->sk_filter;
867 876 if (filter) {
868 if (needlock) 877 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
869 bh_lock_sock(sk); 878 filter->len);
870 879 err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
871 filter = sk->sk_filter;
872 if (filter) {
873 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
874 filter->len);
875 err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
876 }
877
878 if (needlock)
879 bh_unlock_sock(sk);
880 } 880 }
881 rcu_read_unlock_bh();
882
881 return err; 883 return err;
882} 884}
883 885
@@ -889,6 +891,12 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock)
889 * Remove a filter from a socket and release its resources. 891 * Remove a filter from a socket and release its resources.
890 */ 892 */
891 893
894static inline void sk_filter_rcu_free(struct rcu_head *rcu)
895{
896 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
897 kfree(fp);
898}
899
892static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) 900static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp)
893{ 901{
894 unsigned int size = sk_filter_len(fp); 902 unsigned int size = sk_filter_len(fp);
@@ -896,7 +904,7 @@ static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp)
896 atomic_sub(size, &sk->sk_omem_alloc); 904 atomic_sub(size, &sk->sk_omem_alloc);
897 905
898 if (atomic_dec_and_test(&fp->refcnt)) 906 if (atomic_dec_and_test(&fp->refcnt))
899 kfree(fp); 907 call_rcu_bh(&fp->rcu, sk_filter_rcu_free);
900} 908}
901 909
902static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 910static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
@@ -961,9 +969,23 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
961 sk->sk_sleep = &parent->wait; 969 sk->sk_sleep = &parent->wait;
962 parent->sk = sk; 970 parent->sk = sk;
963 sk->sk_socket = parent; 971 sk->sk_socket = parent;
972 security_sock_graft(sk, parent);
964 write_unlock_bh(&sk->sk_callback_lock); 973 write_unlock_bh(&sk->sk_callback_lock);
965} 974}
966 975
976static inline void sock_copy(struct sock *nsk, const struct sock *osk)
977{
978#ifdef CONFIG_SECURITY_NETWORK
979 void *sptr = nsk->sk_security;
980#endif
981
982 memcpy(nsk, osk, osk->sk_prot->obj_size);
983#ifdef CONFIG_SECURITY_NETWORK
984 nsk->sk_security = sptr;
985 security_sk_clone(osk, nsk);
986#endif
987}
988
967extern int sock_i_uid(struct sock *sk); 989extern int sock_i_uid(struct sock *sk);
968extern unsigned long sock_i_ino(struct sock *sk); 990extern unsigned long sock_i_ino(struct sock *sk);
969 991
@@ -1026,15 +1048,20 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1026 1048
1027extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1049extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1028 1050
1051static inline int sk_can_gso(const struct sock *sk)
1052{
1053 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1054}
1055
1029static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1056static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1030{ 1057{
1031 __sk_dst_set(sk, dst); 1058 __sk_dst_set(sk, dst);
1032 sk->sk_route_caps = dst->dev->features; 1059 sk->sk_route_caps = dst->dev->features;
1033 if (sk->sk_route_caps & NETIF_F_GSO) 1060 if (sk->sk_route_caps & NETIF_F_GSO)
1034 sk->sk_route_caps |= NETIF_F_TSO; 1061 sk->sk_route_caps |= NETIF_F_GSO_MASK;
1035 if (sk->sk_route_caps & NETIF_F_TSO) { 1062 if (sk_can_gso(sk)) {
1036 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) 1063 if (dst->header_len)
1037 sk->sk_route_caps &= ~NETIF_F_TSO; 1064 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1038 else 1065 else
1039 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; 1066 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1040 } 1067 }
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h
index 463aa671f9..65f024b809 100644
--- a/include/net/tc_act/tc_defact.h
+++ b/include/net/tc_act/tc_defact.h
@@ -3,11 +3,12 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_defact 6struct tcf_defact {
7{ 7 struct tcf_common common;
8 tca_gen(defact); 8 u32 tcfd_datalen;
9 u32 datalen; 9 void *tcfd_defdata;
10 void *defdata;
11}; 10};
11#define to_defact(pc) \
12 container_of(pc, struct tcf_defact, common)
12 13
13#endif 14#endif /* __NET_TC_DEF_H */
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 59f0d9628a..9e3f6767b8 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -3,15 +3,15 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_gact 6struct tcf_gact {
7{ 7 struct tcf_common common;
8 tca_gen(gact);
9#ifdef CONFIG_GACT_PROB 8#ifdef CONFIG_GACT_PROB
10 u16 ptype; 9 u16 tcfg_ptype;
11 u16 pval; 10 u16 tcfg_pval;
12 int paction; 11 int tcfg_paction;
13#endif 12#endif
14
15}; 13};
16 14#define to_gact(pc) \
17#endif 15 container_of(pc, struct tcf_gact, common)
16
17#endif /* __NET_TC_GACT_H */
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h
index cb37ad0842..f7d25dfcc4 100644
--- a/include/net/tc_act/tc_ipt.h
+++ b/include/net/tc_act/tc_ipt.h
@@ -5,12 +5,13 @@
5 5
6struct xt_entry_target; 6struct xt_entry_target;
7 7
8struct tcf_ipt 8struct tcf_ipt {
9{ 9 struct tcf_common common;
10 tca_gen(ipt); 10 u32 tcfi_hook;
11 u32 hook; 11 char *tcfi_tname;
12 char *tname; 12 struct xt_entry_target *tcfi_t;
13 struct xt_entry_target *t;
14}; 13};
14#define to_ipt(pc) \
15 container_of(pc, struct tcf_ipt, common)
15 16
16#endif 17#endif /* __NET_TC_IPT_H */
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index b5c32f65c1..ceac661cdf 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -3,13 +3,14 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_mirred 6struct tcf_mirred {
7{ 7 struct tcf_common common;
8 tca_gen(mirred); 8 int tcfm_eaction;
9 int eaction; 9 int tcfm_ifindex;
10 int ifindex; 10 int tcfm_ok_push;
11 int ok_push; 11 struct net_device *tcfm_dev;
12 struct net_device *dev;
13}; 12};
13#define to_mirred(pc) \
14 container_of(pc, struct tcf_mirred, common)
14 15
15#endif 16#endif /* __NET_TC_MIR_H */
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
index eb21689d75..e6f6e15956 100644
--- a/include/net/tc_act/tc_pedit.h
+++ b/include/net/tc_act/tc_pedit.h
@@ -3,12 +3,13 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_pedit 6struct tcf_pedit {
7{ 7 struct tcf_common common;
8 tca_gen(pedit); 8 unsigned char tcfp_nkeys;
9 unsigned char nkeys; 9 unsigned char tcfp_flags;
10 unsigned char flags; 10 struct tc_pedit_key *tcfp_keys;
11 struct tc_pedit_key *keys;
12}; 11};
12#define to_pedit(pc) \
13 container_of(pc, struct tcf_pedit, common)
13 14
14#endif 15#endif /* __NET_TC_PED_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ca3d38dfc0..7a093d0aa0 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -751,7 +751,7 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
751 if (in_flight >= tp->snd_cwnd) 751 if (in_flight >= tp->snd_cwnd)
752 return 1; 752 return 1;
753 753
754 if (!(sk->sk_route_caps & NETIF_F_TSO)) 754 if (!sk_can_gso(sk))
755 return 0; 755 return 0;
756 756
757 left = tp->snd_cwnd - in_flight; 757 left = tp->snd_cwnd - in_flight;
@@ -914,6 +914,9 @@ static inline void tcp_set_state(struct sock *sk, int state)
914 914
915static inline void tcp_done(struct sock *sk) 915static inline void tcp_done(struct sock *sk)
916{ 916{
917 if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
918 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
919
917 tcp_set_state(sk, TCP_CLOSE); 920 tcp_set_state(sk, TCP_CLOSE);
918 tcp_clear_xmit_timers(sk); 921 tcp_clear_xmit_timers(sk);
919 922
@@ -1086,7 +1089,8 @@ extern struct request_sock_ops tcp_request_sock_ops;
1086 1089
1087extern int tcp_v4_destroy_sock(struct sock *sk); 1090extern int tcp_v4_destroy_sock(struct sock *sk);
1088 1091
1089extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg); 1092extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1093extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
1090 1094
1091#ifdef CONFIG_PROC_FS 1095#ifdef CONFIG_PROC_FS
1092extern int tcp4_proc_init(void); 1096extern int tcp4_proc_init(void);
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index c6b8439744..4629d77173 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -31,10 +31,9 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp,
31 struct sk_buff *skb) 31 struct sk_buff *skb)
32{ 32{
33 tp->ecn_flags = 0; 33 tp->ecn_flags = 0;
34 if (sysctl_tcp_ecn && !(sk->sk_route_caps & NETIF_F_TSO)) { 34 if (sysctl_tcp_ecn) {
35 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; 35 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR;
36 tp->ecn_flags = TCP_ECN_OK; 36 tp->ecn_flags = TCP_ECN_OK;
37 sock_set_flag(sk, SOCK_NO_LARGESEND);
38 } 37 }
39} 38}
40 39
@@ -56,6 +55,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
56 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { 55 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) {
57 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; 56 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR;
58 skb->h.th->cwr = 1; 57 skb->h.th->cwr = 1;
58 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
59 } 59 }
60 } else { 60 } else {
61 /* ACK or retransmitted segment: clear ECT|CE */ 61 /* ACK or retransmitted segment: clear ECT|CE */
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h
index 098607cd4b..e07136d74c 100644
--- a/include/net/tipc/tipc_bearer.h
+++ b/include/net/tipc/tipc_bearer.h
@@ -49,10 +49,18 @@
49 49
50#define TIPC_MEDIA_TYPE_ETH 1 50#define TIPC_MEDIA_TYPE_ETH 1
51 51
52/*
53 * Destination address structure used by TIPC bearers when sending messages
54 *
55 * IMPORTANT: The fields of this structure MUST be stored using the specified
56 * byte order indicated below, as the structure is exchanged between nodes
57 * as part of a link setup process.
58 */
59
52struct tipc_media_addr { 60struct tipc_media_addr {
53 __u32 type; 61 __u32 type; /* bearer type (network byte order) */
54 union { 62 union {
55 __u8 eth_addr[6]; /* Ethernet bearer */ 63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */
56#if 0 64#if 0
57 /* Prototypes for other possible bearer types */ 65 /* Prototypes for other possible bearer types */
58 66
diff --git a/include/net/udp.h b/include/net/udp.h
index 766fba1369..db0c05f675 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -30,25 +30,9 @@
30 30
31#define UDP_HTABLE_SIZE 128 31#define UDP_HTABLE_SIZE 128
32 32
33/* udp.c: This needs to be shared by v4 and v6 because the lookup
34 * and hashing code needs to work with different AF's yet
35 * the port space is shared.
36 */
37extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; 33extern struct hlist_head udp_hash[UDP_HTABLE_SIZE];
38extern rwlock_t udp_hash_lock; 34extern rwlock_t udp_hash_lock;
39 35
40extern int udp_port_rover;
41
42static inline int udp_lport_inuse(u16 num)
43{
44 struct sock *sk;
45 struct hlist_node *node;
46
47 sk_for_each(sk, node, &udp_hash[num & (UDP_HTABLE_SIZE - 1)])
48 if (inet_sk(sk)->num == num)
49 return 1;
50 return 0;
51}
52 36
53/* Note: this must match 'valbool' in sock_setsockopt */ 37/* Note: this must match 'valbool' in sock_setsockopt */
54#define UDP_CSUM_NOXMIT 1 38#define UDP_CSUM_NOXMIT 1
@@ -63,6 +47,8 @@ extern struct proto udp_prot;
63 47
64struct sk_buff; 48struct sk_buff;
65 49
50extern int udp_get_port(struct sock *sk, unsigned short snum,
51 int (*saddr_cmp)(const struct sock *, const struct sock *));
66extern void udp_err(struct sk_buff *, u32); 52extern void udp_err(struct sk_buff *, u32);
67 53
68extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 54extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9c5ee9f20b..1e2a4ddec9 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -8,8 +8,8 @@
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/skbuff.h> 9#include <linux/skbuff.h>
10#include <linux/socket.h> 10#include <linux/socket.h>
11#include <linux/crypto.h>
12#include <linux/pfkeyv2.h> 11#include <linux/pfkeyv2.h>
12#include <linux/ipsec.h>
13#include <linux/in6.h> 13#include <linux/in6.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15 15
@@ -94,8 +94,9 @@ extern struct mutex xfrm_cfg_mutex;
94struct xfrm_state 94struct xfrm_state
95{ 95{
96 /* Note: bydst is re-used during gc */ 96 /* Note: bydst is re-used during gc */
97 struct list_head bydst; 97 struct hlist_node bydst;
98 struct list_head byspi; 98 struct hlist_node bysrc;
99 struct hlist_node byspi;
99 100
100 atomic_t refcnt; 101 atomic_t refcnt;
101 spinlock_t lock; 102 spinlock_t lock;
@@ -103,6 +104,8 @@ struct xfrm_state
103 struct xfrm_id id; 104 struct xfrm_id id;
104 struct xfrm_selector sel; 105 struct xfrm_selector sel;
105 106
107 u32 genid;
108
106 /* Key manger bits */ 109 /* Key manger bits */
107 struct { 110 struct {
108 u8 state; 111 u8 state;
@@ -133,6 +136,9 @@ struct xfrm_state
133 /* Data for encapsulator */ 136 /* Data for encapsulator */
134 struct xfrm_encap_tmpl *encap; 137 struct xfrm_encap_tmpl *encap;
135 138
139 /* Data for care-of address */
140 xfrm_address_t *coaddr;
141
136 /* IPComp needs an IPIP tunnel for handling uncompressed packets */ 142 /* IPComp needs an IPIP tunnel for handling uncompressed packets */
137 struct xfrm_state *tunnel; 143 struct xfrm_state *tunnel;
138 144
@@ -163,6 +169,9 @@ struct xfrm_state
163 struct xfrm_lifetime_cur curlft; 169 struct xfrm_lifetime_cur curlft;
164 struct timer_list timer; 170 struct timer_list timer;
165 171
172 /* Last used time */
173 u64 lastused;
174
166 /* Reference to data common to all the instances of this 175 /* Reference to data common to all the instances of this
167 * transformer. */ 176 * transformer. */
168 struct xfrm_type *type; 177 struct xfrm_type *type;
@@ -196,6 +205,7 @@ struct km_event
196 u32 proto; 205 u32 proto;
197 u32 byid; 206 u32 byid;
198 u32 aevent; 207 u32 aevent;
208 u32 type;
199 } data; 209 } data;
200 210
201 u32 seq; 211 u32 seq;
@@ -212,6 +222,7 @@ struct xfrm_policy_afinfo {
212 struct dst_ops *dst_ops; 222 struct dst_ops *dst_ops;
213 void (*garbage_collect)(void); 223 void (*garbage_collect)(void);
214 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 224 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
225 int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr);
215 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); 226 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
216 int (*bundle_create)(struct xfrm_policy *policy, 227 int (*bundle_create)(struct xfrm_policy *policy,
217 struct xfrm_state **xfrm, 228 struct xfrm_state **xfrm,
@@ -235,16 +246,12 @@ extern int __xfrm_state_delete(struct xfrm_state *x);
235 246
236struct xfrm_state_afinfo { 247struct xfrm_state_afinfo {
237 unsigned short family; 248 unsigned short family;
238 struct list_head *state_bydst;
239 struct list_head *state_byspi;
240 int (*init_flags)(struct xfrm_state *x); 249 int (*init_flags)(struct xfrm_state *x);
241 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 250 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
242 struct xfrm_tmpl *tmpl, 251 struct xfrm_tmpl *tmpl,
243 xfrm_address_t *daddr, xfrm_address_t *saddr); 252 xfrm_address_t *daddr, xfrm_address_t *saddr);
244 struct xfrm_state *(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto); 253 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
245 struct xfrm_state *(*find_acq)(u8 mode, u32 reqid, u8 proto, 254 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
246 xfrm_address_t *daddr, xfrm_address_t *saddr,
247 int create);
248}; 255};
249 256
250extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); 257extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
@@ -257,11 +264,17 @@ struct xfrm_type
257 char *description; 264 char *description;
258 struct module *owner; 265 struct module *owner;
259 __u8 proto; 266 __u8 proto;
267 __u8 flags;
268#define XFRM_TYPE_NON_FRAGMENT 1
260 269
261 int (*init_state)(struct xfrm_state *x); 270 int (*init_state)(struct xfrm_state *x);
262 void (*destructor)(struct xfrm_state *); 271 void (*destructor)(struct xfrm_state *);
263 int (*input)(struct xfrm_state *, struct sk_buff *skb); 272 int (*input)(struct xfrm_state *, struct sk_buff *skb);
264 int (*output)(struct xfrm_state *, struct sk_buff *pskb); 273 int (*output)(struct xfrm_state *, struct sk_buff *pskb);
274 int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *);
275 int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **);
276 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *);
277 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *);
265 /* Estimate maximal size of result of transformation of a dgram */ 278 /* Estimate maximal size of result of transformation of a dgram */
266 u32 (*get_max_size)(struct xfrm_state *, int size); 279 u32 (*get_max_size)(struct xfrm_state *, int size);
267}; 280};
@@ -273,7 +286,7 @@ extern void xfrm_put_type(struct xfrm_type *type);
273 286
274struct xfrm_mode { 287struct xfrm_mode {
275 int (*input)(struct xfrm_state *x, struct sk_buff *skb); 288 int (*input)(struct xfrm_state *x, struct sk_buff *skb);
276 int (*output)(struct sk_buff *skb); 289 int (*output)(struct xfrm_state *x,struct sk_buff *skb);
277 290
278 struct module *owner; 291 struct module *owner;
279 unsigned int encap; 292 unsigned int encap;
@@ -299,7 +312,7 @@ struct xfrm_tmpl
299 312
300 __u32 reqid; 313 __u32 reqid;
301 314
302/* Mode: transport/tunnel */ 315/* Mode: transport, tunnel etc. */
303 __u8 mode; 316 __u8 mode;
304 317
305/* Sharing mode: unique, this session only, this user only etc. */ 318/* Sharing mode: unique, this session only, this user only etc. */
@@ -314,18 +327,20 @@ struct xfrm_tmpl
314 __u32 calgos; 327 __u32 calgos;
315}; 328};
316 329
317#define XFRM_MAX_DEPTH 4 330#define XFRM_MAX_DEPTH 6
318 331
319struct xfrm_policy 332struct xfrm_policy
320{ 333{
321 struct xfrm_policy *next; 334 struct xfrm_policy *next;
322 struct list_head list; 335 struct hlist_node bydst;
336 struct hlist_node byidx;
323 337
324 /* This lock only affects elements except for entry. */ 338 /* This lock only affects elements except for entry. */
325 rwlock_t lock; 339 rwlock_t lock;
326 atomic_t refcnt; 340 atomic_t refcnt;
327 struct timer_list timer; 341 struct timer_list timer;
328 342
343 u8 type;
329 u32 priority; 344 u32 priority;
330 u32 index; 345 u32 index;
331 struct xfrm_selector selector; 346 struct xfrm_selector selector;
@@ -363,16 +378,16 @@ struct xfrm_mgr
363 char *id; 378 char *id;
364 int (*notify)(struct xfrm_state *x, struct km_event *c); 379 int (*notify)(struct xfrm_state *x, struct km_event *c);
365 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 380 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir);
366 struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir); 381 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
367 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 382 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport);
368 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 383 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
384 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
369}; 385};
370 386
371extern int xfrm_register_km(struct xfrm_mgr *km); 387extern int xfrm_register_km(struct xfrm_mgr *km);
372extern int xfrm_unregister_km(struct xfrm_mgr *km); 388extern int xfrm_unregister_km(struct xfrm_mgr *km);
373 389
374 390extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
375extern struct xfrm_policy *xfrm_policy_list[XFRM_POLICY_MAX*2];
376 391
377static inline void xfrm_pol_hold(struct xfrm_policy *policy) 392static inline void xfrm_pol_hold(struct xfrm_policy *policy)
378{ 393{
@@ -388,67 +403,19 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy)
388 __xfrm_policy_destroy(policy); 403 __xfrm_policy_destroy(policy);
389} 404}
390 405
391#define XFRM_DST_HSIZE 1024 406#ifdef CONFIG_XFRM_SUB_POLICY
392 407static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
393static __inline__
394unsigned __xfrm4_dst_hash(xfrm_address_t *addr)
395{
396 unsigned h;
397 h = ntohl(addr->a4);
398 h = (h ^ (h>>16)) % XFRM_DST_HSIZE;
399 return h;
400}
401
402static __inline__
403unsigned __xfrm6_dst_hash(xfrm_address_t *addr)
404{
405 unsigned h;
406 h = ntohl(addr->a6[2]^addr->a6[3]);
407 h = (h ^ (h>>16)) % XFRM_DST_HSIZE;
408 return h;
409}
410
411static __inline__
412unsigned xfrm_dst_hash(xfrm_address_t *addr, unsigned short family)
413{
414 switch (family) {
415 case AF_INET:
416 return __xfrm4_dst_hash(addr);
417 case AF_INET6:
418 return __xfrm6_dst_hash(addr);
419 }
420 return 0;
421}
422
423static __inline__
424unsigned __xfrm4_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto)
425{ 408{
426 unsigned h; 409 int i;
427 h = ntohl(addr->a4^spi^proto); 410 for (i = npols - 1; i >= 0; --i)
428 h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; 411 xfrm_pol_put(pols[i]);
429 return h;
430} 412}
431 413#else
432static __inline__ 414static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
433unsigned __xfrm6_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto)
434{
435 unsigned h;
436 h = ntohl(addr->a6[2]^addr->a6[3]^spi^proto);
437 h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE;
438 return h;
439}
440
441static __inline__
442unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short family)
443{ 415{
444 switch (family) { 416 xfrm_pol_put(pols[0]);
445 case AF_INET:
446 return __xfrm4_spi_hash(addr, spi, proto);
447 case AF_INET6:
448 return __xfrm6_spi_hash(addr, spi, proto);
449 }
450 return 0; /*XXX*/
451} 417}
418#endif
452 419
453extern void __xfrm_state_destroy(struct xfrm_state *); 420extern void __xfrm_state_destroy(struct xfrm_state *);
454 421
@@ -470,8 +437,8 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
470 437
471static __inline__ int addr_match(void *token1, void *token2, int prefixlen) 438static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
472{ 439{
473 __u32 *a1 = token1; 440 __be32 *a1 = token1;
474 __u32 *a2 = token2; 441 __be32 *a2 = token2;
475 int pdw; 442 int pdw;
476 int pbi; 443 int pbi;
477 444
@@ -483,7 +450,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
483 return 0; 450 return 0;
484 451
485 if (pbi) { 452 if (pbi) {
486 __u32 mask; 453 __be32 mask;
487 454
488 mask = htonl((0xffffffff) << (32 - pbi)); 455 mask = htonl((0xffffffff) << (32 - pbi));
489 456
@@ -495,9 +462,9 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
495} 462}
496 463
497static __inline__ 464static __inline__
498u16 xfrm_flowi_sport(struct flowi *fl) 465__be16 xfrm_flowi_sport(struct flowi *fl)
499{ 466{
500 u16 port; 467 __be16 port;
501 switch(fl->proto) { 468 switch(fl->proto) {
502 case IPPROTO_TCP: 469 case IPPROTO_TCP:
503 case IPPROTO_UDP: 470 case IPPROTO_UDP:
@@ -508,6 +475,11 @@ u16 xfrm_flowi_sport(struct flowi *fl)
508 case IPPROTO_ICMPV6: 475 case IPPROTO_ICMPV6:
509 port = htons(fl->fl_icmp_type); 476 port = htons(fl->fl_icmp_type);
510 break; 477 break;
478#ifdef CONFIG_IPV6_MIP6
479 case IPPROTO_MH:
480 port = htons(fl->fl_mh_type);
481 break;
482#endif
511 default: 483 default:
512 port = 0; /*XXX*/ 484 port = 0; /*XXX*/
513 } 485 }
@@ -515,9 +487,9 @@ u16 xfrm_flowi_sport(struct flowi *fl)
515} 487}
516 488
517static __inline__ 489static __inline__
518u16 xfrm_flowi_dport(struct flowi *fl) 490__be16 xfrm_flowi_dport(struct flowi *fl)
519{ 491{
520 u16 port; 492 __be16 port;
521 switch(fl->proto) { 493 switch(fl->proto) {
522 case IPPROTO_TCP: 494 case IPPROTO_TCP:
523 case IPPROTO_UDP: 495 case IPPROTO_UDP:
@@ -608,6 +580,7 @@ struct xfrm_dst
608 struct rt6_info rt6; 580 struct rt6_info rt6;
609 } u; 581 } u;
610 struct dst_entry *route; 582 struct dst_entry *route;
583 u32 genid;
611 u32 route_mtu_cached; 584 u32 route_mtu_cached;
612 u32 child_mtu_cached; 585 u32 child_mtu_cached;
613 u32 route_cookie; 586 u32 route_cookie;
@@ -659,6 +632,18 @@ secpath_reset(struct sk_buff *skb)
659} 632}
660 633
661static inline int 634static inline int
635xfrm_addr_any(xfrm_address_t *addr, unsigned short family)
636{
637 switch (family) {
638 case AF_INET:
639 return addr->a4 == 0;
640 case AF_INET6:
641 return ipv6_addr_any((struct in6_addr *)&addr->a6);
642 }
643 return 0;
644}
645
646static inline int
662__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) 647__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x)
663{ 648{
664 return (tmpl->saddr.a4 && 649 return (tmpl->saddr.a4 &&
@@ -692,8 +677,8 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk
692{ 677{
693 if (sk && sk->sk_policy[XFRM_POLICY_IN]) 678 if (sk && sk->sk_policy[XFRM_POLICY_IN])
694 return __xfrm_policy_check(sk, dir, skb, family); 679 return __xfrm_policy_check(sk, dir, skb, family);
695 680
696 return (!xfrm_policy_list[dir] && !skb->sp) || 681 return (!xfrm_policy_count[dir] && !skb->sp) ||
697 (skb->dst->flags & DST_NOPOLICY) || 682 (skb->dst->flags & DST_NOPOLICY) ||
698 __xfrm_policy_check(sk, dir, skb, family); 683 __xfrm_policy_check(sk, dir, skb, family);
699} 684}
@@ -713,7 +698,7 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
713 698
714static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 699static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
715{ 700{
716 return !xfrm_policy_list[XFRM_POLICY_OUT] || 701 return !xfrm_policy_count[XFRM_POLICY_OUT] ||
717 (skb->dst->flags & DST_NOXFRM) || 702 (skb->dst->flags & DST_NOXFRM) ||
718 __xfrm_route_forward(skb, family); 703 __xfrm_route_forward(skb, family);
719} 704}
@@ -831,11 +816,36 @@ xfrm_state_addr_check(struct xfrm_state *x,
831 return 0; 816 return 0;
832} 817}
833 818
819static __inline__ int
820xfrm_state_addr_flow_check(struct xfrm_state *x, struct flowi *fl,
821 unsigned short family)
822{
823 switch (family) {
824 case AF_INET:
825 return __xfrm4_state_addr_check(x,
826 (xfrm_address_t *)&fl->fl4_dst,
827 (xfrm_address_t *)&fl->fl4_src);
828 case AF_INET6:
829 return __xfrm6_state_addr_check(x,
830 (xfrm_address_t *)&fl->fl6_dst,
831 (xfrm_address_t *)&fl->fl6_src);
832 }
833 return 0;
834}
835
834static inline int xfrm_state_kern(struct xfrm_state *x) 836static inline int xfrm_state_kern(struct xfrm_state *x)
835{ 837{
836 return atomic_read(&x->tunnel_users); 838 return atomic_read(&x->tunnel_users);
837} 839}
838 840
841static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
842{
843 return (!userproto || proto == userproto ||
844 (userproto == IPSEC_PROTO_ANY && (proto == IPPROTO_AH ||
845 proto == IPPROTO_ESP ||
846 proto == IPPROTO_COMP)));
847}
848
839/* 849/*
840 * xfrm algorithm information 850 * xfrm algorithm information
841 */ 851 */
@@ -855,6 +865,7 @@ struct xfrm_algo_comp_info {
855 865
856struct xfrm_algo_desc { 866struct xfrm_algo_desc {
857 char *name; 867 char *name;
868 char *compat;
858 u8 available:1; 869 u8 available:1;
859 union { 870 union {
860 struct xfrm_algo_auth_info auth; 871 struct xfrm_algo_auth_info auth;
@@ -901,12 +912,31 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
901extern void xfrm_state_insert(struct xfrm_state *x); 912extern void xfrm_state_insert(struct xfrm_state *x);
902extern int xfrm_state_add(struct xfrm_state *x); 913extern int xfrm_state_add(struct xfrm_state *x);
903extern int xfrm_state_update(struct xfrm_state *x); 914extern int xfrm_state_update(struct xfrm_state *x);
904extern 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);
917#ifdef CONFIG_XFRM_SUB_POLICY
918extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
919 int n, unsigned short family);
920extern int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src,
921 int n, unsigned short family);
922#else
923static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
924 int n, unsigned short family)
925{
926 return -ENOSYS;
927}
928
929static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src,
930 int n, unsigned short family)
931{
932 return -ENOSYS;
933}
934#endif
905extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 935extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
906extern int xfrm_state_delete(struct xfrm_state *x); 936extern int xfrm_state_delete(struct xfrm_state *x);
907extern void xfrm_state_flush(u8 proto); 937extern void xfrm_state_flush(u8 proto);
908extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); 938extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
909extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); 939extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
910extern void xfrm_replay_notify(struct xfrm_state *x, int event); 940extern void xfrm_replay_notify(struct xfrm_state *x, int event);
911extern 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);
912extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 942extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
@@ -915,14 +945,18 @@ extern int xfrm4_rcv(struct sk_buff *skb);
915extern int xfrm4_output(struct sk_buff *skb); 945extern int xfrm4_output(struct sk_buff *skb);
916extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 946extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
917extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 947extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
918extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); 948extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi);
919extern 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,
951 xfrm_address_t *saddr, u8 proto);
920extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 952extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
921extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 953extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
922extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 954extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
923extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 955extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
924extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 956extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
925extern int xfrm6_output(struct sk_buff *skb); 957extern int xfrm6_output(struct sk_buff *skb);
958extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
959 u8 **prevhdr);
926 960
927#ifdef CONFIG_XFRM 961#ifdef CONFIG_XFRM
928extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); 962extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type);
@@ -947,30 +981,30 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig
947#endif 981#endif
948 982
949struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 983struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
950extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); 984extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*), void *);
951int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 985int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
952struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel, 986struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
987 struct xfrm_selector *sel,
953 struct xfrm_sec_ctx *ctx, int delete); 988 struct xfrm_sec_ctx *ctx, int delete);
954struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); 989struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete);
955void xfrm_policy_flush(void); 990void xfrm_policy_flush(u8 type);
956u32 xfrm_get_acqseq(void); 991u32 xfrm_get_acqseq(void);
957void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 992void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
958struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 993struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
959 xfrm_address_t *daddr, xfrm_address_t *saddr, 994 xfrm_address_t *daddr, xfrm_address_t *saddr,
960 int create, unsigned short family); 995 int create, unsigned short family);
961extern void xfrm_policy_flush(void); 996extern void xfrm_policy_flush(u8 type);
962extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 997extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
963extern int xfrm_flush_bundles(void); 998extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family, int strict);
964extern void xfrm_flush_all_bundles(void);
965extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family);
966extern void xfrm_init_pmtu(struct dst_entry *dst); 999extern void xfrm_init_pmtu(struct dst_entry *dst);
967 1000
968extern wait_queue_head_t km_waitq; 1001extern wait_queue_head_t km_waitq;
969extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 1002extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport);
970extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1003extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
1004extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
971 1005
972extern void xfrm_input_init(void); 1006extern void xfrm_input_init(void);
973extern 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);
974 1008
975extern void xfrm_probe_algs(void); 1009extern void xfrm_probe_algs(void);
976extern int xfrm_count_auth_supported(void); 1010extern int xfrm_count_auth_supported(void);
@@ -984,11 +1018,13 @@ extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe);
984extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); 1018extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe);
985extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); 1019extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe);
986 1020
987struct crypto_tfm; 1021struct hash_desc;
988typedef void (icv_update_fn_t)(struct crypto_tfm *, struct scatterlist *, unsigned int); 1022struct scatterlist;
1023typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1024 unsigned int);
989 1025
990extern void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, 1026extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm,
991 int offset, int len, icv_update_fn_t icv_update); 1027 int offset, int len, icv_update_fn_t icv_update);
992 1028
993static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, 1029static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
994 int family) 1030 int family)
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild
new file mode 100644
index 0000000000..e7c0432165
--- /dev/null
+++ b/include/rdma/Kbuild
@@ -0,0 +1 @@
header-y += ib_user_mad.h
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index fcb5ba87dc..81b6230762 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -40,7 +40,7 @@ struct rdma_dev_addr {
40 unsigned char src_dev_addr[MAX_ADDR_LEN]; 40 unsigned char src_dev_addr[MAX_ADDR_LEN];
41 unsigned char dst_dev_addr[MAX_ADDR_LEN]; 41 unsigned char dst_dev_addr[MAX_ADDR_LEN];
42 unsigned char broadcast[MAX_ADDR_LEN]; 42 unsigned char broadcast[MAX_ADDR_LEN];
43 enum ib_node_type dev_type; 43 enum rdma_node_type dev_type;
44}; 44};
45 45
46/** 46/**
@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr,
72 72
73void rdma_addr_cancel(struct rdma_dev_addr *addr); 73void rdma_addr_cancel(struct rdma_dev_addr *addr);
74 74
75int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
76 const unsigned char *dst_dev_addr);
77
75static inline int ip_addr_size(struct sockaddr *addr) 78static inline int ip_addr_size(struct sockaddr *addr)
76{ 79{
77 return addr->sa_family == AF_INET6 ? 80 return addr->sa_family == AF_INET6 ?
@@ -89,9 +92,10 @@ static inline void ib_addr_set_pkey(struct rdma_dev_addr *dev_addr, u16 pkey)
89 dev_addr->broadcast[9] = (unsigned char) pkey; 92 dev_addr->broadcast[9] = (unsigned char) pkey;
90} 93}
91 94
92static inline union ib_gid *ib_addr_get_sgid(struct rdma_dev_addr *dev_addr) 95static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr,
96 union ib_gid *gid)
93{ 97{
94 return (union ib_gid *) (dev_addr->src_dev_addr + 4); 98 memcpy(gid, dev_addr->src_dev_addr + 4, sizeof *gid);
95} 99}
96 100
97static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr, 101static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr,
@@ -100,9 +104,10 @@ static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr,
100 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid); 104 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid);
101} 105}
102 106
103static inline union ib_gid *ib_addr_get_dgid(struct rdma_dev_addr *dev_addr) 107static inline void ib_addr_get_dgid(struct rdma_dev_addr *dev_addr,
108 union ib_gid *gid)
104{ 109{
105 return (union ib_gid *) (dev_addr->dst_dev_addr + 4); 110 memcpy(gid, dev_addr->dst_dev_addr + 4, sizeof *gid);
106} 111}
107 112
108static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, 113static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,
@@ -111,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,
111 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); 116 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid);
112} 117}
113 118
119static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr,
120 union ib_gid *gid)
121{
122 memcpy(gid, dev_addr->src_dev_addr, sizeof *gid);
123}
124
125static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr,
126 union ib_gid *gid)
127{
128 memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid);
129}
130
114#endif /* IB_ADDR_H */ 131#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_fmr_pool.h b/include/rdma/ib_fmr_pool.h
index 4ace54cd0c..00dadbf94e 100644
--- a/include/rdma/ib_fmr_pool.h
+++ b/include/rdma/ib_fmr_pool.h
@@ -88,7 +88,7 @@ int ib_flush_fmr_pool(struct ib_fmr_pool *pool);
88struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, 88struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
89 u64 *page_list, 89 u64 *page_list,
90 int list_len, 90 int list_len,
91 u64 *io_virtual_address); 91 u64 io_virtual_address);
92 92
93int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr); 93int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);
94 94
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 5ff7755801..585d28e960 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -75,6 +75,7 @@
75#define IB_MGMT_METHOD_TRAP_REPRESS 0x07 75#define IB_MGMT_METHOD_TRAP_REPRESS 0x07
76 76
77#define IB_MGMT_METHOD_RESP 0x80 77#define IB_MGMT_METHOD_RESP 0x80
78#define IB_BM_ATTR_MOD_RESP cpu_to_be32(1)
78 79
79#define IB_MGMT_MAX_METHODS 128 80#define IB_MGMT_MAX_METHODS 128
80 81
@@ -247,6 +248,12 @@ struct ib_mad_send_buf {
247}; 248};
248 249
249/** 250/**
251 * ib_response_mad - Returns if the specified MAD has been generated in
252 * response to a sent request or trap.
253 */
254int ib_response_mad(struct ib_mad *mad);
255
256/**
250 * ib_get_rmpp_resptime - Returns the RMPP response time. 257 * ib_get_rmpp_resptime - Returns the RMPP response time.
251 * @rmpp_hdr: An RMPP header. 258 * @rmpp_hdr: An RMPP header.
252 */ 259 */
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index c99e4420fd..97715b0c20 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved. 3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4 * Copyright (c) 2006 Intel Corporation. All rights reserved.
4 * 5 *
5 * This software is available to you under a choice of one of two 6 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
@@ -36,8 +37,11 @@
36#ifndef IB_SA_H 37#ifndef IB_SA_H
37#define IB_SA_H 38#define IB_SA_H
38 39
40#include <linux/completion.h>
39#include <linux/compiler.h> 41#include <linux/compiler.h>
40 42
43#include <asm/atomic.h>
44
41#include <rdma/ib_verbs.h> 45#include <rdma/ib_verbs.h>
42#include <rdma/ib_mad.h> 46#include <rdma/ib_mad.h>
43 47
@@ -79,8 +83,8 @@ enum {
79}; 83};
80 84
81enum ib_sa_selector { 85enum ib_sa_selector {
82 IB_SA_GTE = 0, 86 IB_SA_GT = 0,
83 IB_SA_LTE = 1, 87 IB_SA_LT = 1,
84 IB_SA_EQ = 2, 88 IB_SA_EQ = 2,
85 /* 89 /*
86 * The meaning of "best" depends on the attribute: for 90 * The meaning of "best" depends on the attribute: for
@@ -250,11 +254,28 @@ struct ib_sa_service_rec {
250 u64 data64[2]; 254 u64 data64[2];
251}; 255};
252 256
257struct ib_sa_client {
258 atomic_t users;
259 struct completion comp;
260};
261
262/**
263 * ib_sa_register_client - Register an SA client.
264 */
265void ib_sa_register_client(struct ib_sa_client *client);
266
267/**
268 * ib_sa_unregister_client - Deregister an SA client.
269 * @client: Client object to deregister.
270 */
271void ib_sa_unregister_client(struct ib_sa_client *client);
272
253struct ib_sa_query; 273struct ib_sa_query;
254 274
255void ib_sa_cancel_query(int id, struct ib_sa_query *query); 275void ib_sa_cancel_query(int id, struct ib_sa_query *query);
256 276
257int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, 277int ib_sa_path_rec_get(struct ib_sa_client *client,
278 struct ib_device *device, u8 port_num,
258 struct ib_sa_path_rec *rec, 279 struct ib_sa_path_rec *rec,
259 ib_sa_comp_mask comp_mask, 280 ib_sa_comp_mask comp_mask,
260 int timeout_ms, gfp_t gfp_mask, 281 int timeout_ms, gfp_t gfp_mask,
@@ -264,7 +285,8 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
264 void *context, 285 void *context,
265 struct ib_sa_query **query); 286 struct ib_sa_query **query);
266 287
267int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, 288int ib_sa_mcmember_rec_query(struct ib_sa_client *client,
289 struct ib_device *device, u8 port_num,
268 u8 method, 290 u8 method,
269 struct ib_sa_mcmember_rec *rec, 291 struct ib_sa_mcmember_rec *rec,
270 ib_sa_comp_mask comp_mask, 292 ib_sa_comp_mask comp_mask,
@@ -275,7 +297,8 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
275 void *context, 297 void *context,
276 struct ib_sa_query **query); 298 struct ib_sa_query **query);
277 299
278int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, 300int ib_sa_service_rec_query(struct ib_sa_client *client,
301 struct ib_device *device, u8 port_num,
279 u8 method, 302 u8 method,
280 struct ib_sa_service_rec *rec, 303 struct ib_sa_service_rec *rec,
281 ib_sa_comp_mask comp_mask, 304 ib_sa_comp_mask comp_mask,
@@ -288,6 +311,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
288 311
289/** 312/**
290 * ib_sa_mcmember_rec_set - Start an MCMember set query 313 * ib_sa_mcmember_rec_set - Start an MCMember set query
314 * @client:SA client
291 * @device:device to send query on 315 * @device:device to send query on
292 * @port_num: port number to send query on 316 * @port_num: port number to send query on
293 * @rec:MCMember Record to send in query 317 * @rec:MCMember Record to send in query
@@ -311,7 +335,8 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
311 * cancel the query. 335 * cancel the query.
312 */ 336 */
313static inline int 337static inline int
314ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, 338ib_sa_mcmember_rec_set(struct ib_sa_client *client,
339 struct ib_device *device, u8 port_num,
315 struct ib_sa_mcmember_rec *rec, 340 struct ib_sa_mcmember_rec *rec,
316 ib_sa_comp_mask comp_mask, 341 ib_sa_comp_mask comp_mask,
317 int timeout_ms, gfp_t gfp_mask, 342 int timeout_ms, gfp_t gfp_mask,
@@ -321,7 +346,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
321 void *context, 346 void *context,
322 struct ib_sa_query **query) 347 struct ib_sa_query **query)
323{ 348{
324 return ib_sa_mcmember_rec_query(device, port_num, 349 return ib_sa_mcmember_rec_query(client, device, port_num,
325 IB_MGMT_METHOD_SET, 350 IB_MGMT_METHOD_SET,
326 rec, comp_mask, 351 rec, comp_mask,
327 timeout_ms, gfp_mask, callback, 352 timeout_ms, gfp_mask, callback,
@@ -330,6 +355,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
330 355
331/** 356/**
332 * ib_sa_mcmember_rec_delete - Start an MCMember delete query 357 * ib_sa_mcmember_rec_delete - Start an MCMember delete query
358 * @client:SA client
333 * @device:device to send query on 359 * @device:device to send query on
334 * @port_num: port number to send query on 360 * @port_num: port number to send query on
335 * @rec:MCMember Record to send in query 361 * @rec:MCMember Record to send in query
@@ -353,7 +379,8 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
353 * cancel the query. 379 * cancel the query.
354 */ 380 */
355static inline int 381static inline int
356ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, 382ib_sa_mcmember_rec_delete(struct ib_sa_client *client,
383 struct ib_device *device, u8 port_num,
357 struct ib_sa_mcmember_rec *rec, 384 struct ib_sa_mcmember_rec *rec,
358 ib_sa_comp_mask comp_mask, 385 ib_sa_comp_mask comp_mask,
359 int timeout_ms, gfp_t gfp_mask, 386 int timeout_ms, gfp_t gfp_mask,
@@ -363,7 +390,7 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
363 void *context, 390 void *context,
364 struct ib_sa_query **query) 391 struct ib_sa_query **query)
365{ 392{
366 return ib_sa_mcmember_rec_query(device, port_num, 393 return ib_sa_mcmember_rec_query(client, device, port_num,
367 IB_SA_METHOD_DELETE, 394 IB_SA_METHOD_DELETE,
368 rec, comp_mask, 395 rec, comp_mask,
369 timeout_ms, gfp_mask, callback, 396 timeout_ms, gfp_mask, callback,
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 7b5372010f..db1b814b62 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -275,6 +275,8 @@ struct ib_uverbs_resize_cq {
275 275
276struct ib_uverbs_resize_cq_resp { 276struct ib_uverbs_resize_cq_resp {
277 __u32 cqe; 277 __u32 cqe;
278 __u32 reserved;
279 __u64 driver_data[0];
278}; 280};
279 281
280struct ib_uverbs_poll_cq { 282struct ib_uverbs_poll_cq {
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ee1f3a3556..8eacc35109 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -56,12 +56,22 @@ union ib_gid {
56 } global; 56 } global;
57}; 57};
58 58
59enum ib_node_type { 59enum rdma_node_type {
60 IB_NODE_CA = 1, 60 /* IB values map to NodeInfo:NodeType. */
61 IB_NODE_SWITCH, 61 RDMA_NODE_IB_CA = 1,
62 IB_NODE_ROUTER 62 RDMA_NODE_IB_SWITCH,
63 RDMA_NODE_IB_ROUTER,
64 RDMA_NODE_RNIC
63}; 65};
64 66
67enum rdma_transport_type {
68 RDMA_TRANSPORT_IB,
69 RDMA_TRANSPORT_IWARP
70};
71
72enum rdma_transport_type
73rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__;
74
65enum ib_device_cap_flags { 75enum ib_device_cap_flags {
66 IB_DEVICE_RESIZE_MAX_WR = 1, 76 IB_DEVICE_RESIZE_MAX_WR = 1,
67 IB_DEVICE_BAD_PKEY_CNTR = (1<<1), 77 IB_DEVICE_BAD_PKEY_CNTR = (1<<1),
@@ -78,6 +88,9 @@ enum ib_device_cap_flags {
78 IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), 88 IB_DEVICE_RC_RNR_NAK_GEN = (1<<12),
79 IB_DEVICE_SRQ_RESIZE = (1<<13), 89 IB_DEVICE_SRQ_RESIZE = (1<<13),
80 IB_DEVICE_N_NOTIFY_CQ = (1<<14), 90 IB_DEVICE_N_NOTIFY_CQ = (1<<14),
91 IB_DEVICE_ZERO_STAG = (1<<15),
92 IB_DEVICE_SEND_W_INV = (1<<16),
93 IB_DEVICE_MEM_WINDOW = (1<<17)
81}; 94};
82 95
83enum ib_atomic_cap { 96enum ib_atomic_cap {
@@ -835,6 +848,8 @@ struct ib_cache {
835 u8 *lmc_cache; 848 u8 *lmc_cache;
836}; 849};
837 850
851struct iw_cm_verbs;
852
838struct ib_device { 853struct ib_device {
839 struct device *dma_device; 854 struct device *dma_device;
840 855
@@ -851,6 +866,8 @@ struct ib_device {
851 866
852 u32 flags; 867 u32 flags;
853 868
869 struct iw_cm_verbs *iwcm;
870
854 int (*query_device)(struct ib_device *device, 871 int (*query_device)(struct ib_device *device,
855 struct ib_device_attr *device_attr); 872 struct ib_device_attr *device_attr);
856 int (*query_port)(struct ib_device *device, 873 int (*query_port)(struct ib_device *device,
@@ -888,7 +905,8 @@ struct ib_device {
888 struct ib_udata *udata); 905 struct ib_udata *udata);
889 int (*modify_srq)(struct ib_srq *srq, 906 int (*modify_srq)(struct ib_srq *srq,
890 struct ib_srq_attr *srq_attr, 907 struct ib_srq_attr *srq_attr,
891 enum ib_srq_attr_mask srq_attr_mask); 908 enum ib_srq_attr_mask srq_attr_mask,
909 struct ib_udata *udata);
892 int (*query_srq)(struct ib_srq *srq, 910 int (*query_srq)(struct ib_srq *srq,
893 struct ib_srq_attr *srq_attr); 911 struct ib_srq_attr *srq_attr);
894 int (*destroy_srq)(struct ib_srq *srq); 912 int (*destroy_srq)(struct ib_srq *srq);
@@ -900,7 +918,8 @@ struct ib_device {
900 struct ib_udata *udata); 918 struct ib_udata *udata);
901 int (*modify_qp)(struct ib_qp *qp, 919 int (*modify_qp)(struct ib_qp *qp,
902 struct ib_qp_attr *qp_attr, 920 struct ib_qp_attr *qp_attr,
903 int qp_attr_mask); 921 int qp_attr_mask,
922 struct ib_udata *udata);
904 int (*query_qp)(struct ib_qp *qp, 923 int (*query_qp)(struct ib_qp *qp,
905 struct ib_qp_attr *qp_attr, 924 struct ib_qp_attr *qp_attr,
906 int qp_attr_mask, 925 int qp_attr_mask,
diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h
new file mode 100644
index 0000000000..aeefa9b740
--- /dev/null
+++ b/include/rdma/iw_cm.h
@@ -0,0 +1,258 @@
1/*
2 * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
3 * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33#ifndef IW_CM_H
34#define IW_CM_H
35
36#include <linux/in.h>
37#include <rdma/ib_cm.h>
38
39struct iw_cm_id;
40
41enum iw_cm_event_type {
42 IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
43 IW_CM_EVENT_CONNECT_REPLY, /* reply from active connect request */
44 IW_CM_EVENT_ESTABLISHED, /* passive side accept successful */
45 IW_CM_EVENT_DISCONNECT, /* orderly shutdown */
46 IW_CM_EVENT_CLOSE /* close complete */
47};
48
49enum iw_cm_event_status {
50 IW_CM_EVENT_STATUS_OK = 0, /* request successful */
51 IW_CM_EVENT_STATUS_ACCEPTED = 0, /* connect request accepted */
52 IW_CM_EVENT_STATUS_REJECTED, /* connect request rejected */
53 IW_CM_EVENT_STATUS_TIMEOUT, /* the operation timed out */
54 IW_CM_EVENT_STATUS_RESET, /* reset from remote peer */
55 IW_CM_EVENT_STATUS_EINVAL, /* asynchronous failure for bad parm */
56};
57
58struct iw_cm_event {
59 enum iw_cm_event_type event;
60 enum iw_cm_event_status status;
61 struct sockaddr_in local_addr;
62 struct sockaddr_in remote_addr;
63 void *private_data;
64 u8 private_data_len;
65 void* provider_data;
66};
67
68/**
69 * iw_cm_handler - Function to be called by the IW CM when delivering events
70 * to the client.
71 *
72 * @cm_id: The IW CM identifier associated with the event.
73 * @event: Pointer to the event structure.
74 */
75typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
76 struct iw_cm_event *event);
77
78/**
79 * iw_event_handler - Function called by the provider when delivering provider
80 * events to the IW CM. Returns either 0 indicating the event was processed
81 * or -errno if the event could not be processed.
82 *
83 * @cm_id: The IW CM identifier associated with the event.
84 * @event: Pointer to the event structure.
85 */
86typedef int (*iw_event_handler)(struct iw_cm_id *cm_id,
87 struct iw_cm_event *event);
88
89struct iw_cm_id {
90 iw_cm_handler cm_handler; /* client callback function */
91 void *context; /* client cb context */
92 struct ib_device *device;
93 struct sockaddr_in local_addr;
94 struct sockaddr_in remote_addr;
95 void *provider_data; /* provider private data */
96 iw_event_handler event_handler; /* cb for provider
97 events */
98 /* Used by provider to add and remove refs on IW cm_id */
99 void (*add_ref)(struct iw_cm_id *);
100 void (*rem_ref)(struct iw_cm_id *);
101};
102
103struct iw_cm_conn_param {
104 const void *private_data;
105 u16 private_data_len;
106 u32 ord;
107 u32 ird;
108 u32 qpn;
109};
110
111struct iw_cm_verbs {
112 void (*add_ref)(struct ib_qp *qp);
113
114 void (*rem_ref)(struct ib_qp *qp);
115
116 struct ib_qp * (*get_qp)(struct ib_device *device,
117 int qpn);
118
119 int (*connect)(struct iw_cm_id *cm_id,
120 struct iw_cm_conn_param *conn_param);
121
122 int (*accept)(struct iw_cm_id *cm_id,
123 struct iw_cm_conn_param *conn_param);
124
125 int (*reject)(struct iw_cm_id *cm_id,
126 const void *pdata, u8 pdata_len);
127
128 int (*create_listen)(struct iw_cm_id *cm_id,
129 int backlog);
130
131 int (*destroy_listen)(struct iw_cm_id *cm_id);
132};
133
134/**
135 * iw_create_cm_id - Create an IW CM identifier.
136 *
137 * @device: The IB device on which to create the IW CM identier.
138 * @event_handler: User callback invoked to report events associated with the
139 * returned IW CM identifier.
140 * @context: User specified context associated with the id.
141 */
142struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
143 iw_cm_handler cm_handler, void *context);
144
145/**
146 * iw_destroy_cm_id - Destroy an IW CM identifier.
147 *
148 * @cm_id: The previously created IW CM identifier to destroy.
149 *
150 * The client can assume that no events will be delivered for the CM ID after
151 * this function returns.
152 */
153void iw_destroy_cm_id(struct iw_cm_id *cm_id);
154
155/**
156 * iw_cm_bind_qp - Unbind the specified IW CM identifier and QP
157 *
158 * @cm_id: The IW CM idenfier to unbind from the QP.
159 * @qp: The QP
160 *
161 * This is called by the provider when destroying the QP to ensure
162 * that any references held by the IWCM are released. It may also
163 * be called by the IWCM when destroying a CM_ID to that any
164 * references held by the provider are released.
165 */
166void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp);
167
168/**
169 * iw_cm_get_qp - Return the ib_qp associated with a QPN
170 *
171 * @ib_device: The IB device
172 * @qpn: The queue pair number
173 */
174struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn);
175
176/**
177 * iw_cm_listen - Listen for incoming connection requests on the
178 * specified IW CM id.
179 *
180 * @cm_id: The IW CM identifier.
181 * @backlog: The maximum number of outstanding un-accepted inbound listen
182 * requests to queue.
183 *
184 * The source address and port number are specified in the IW CM identifier
185 * structure.
186 */
187int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
188
189/**
190 * iw_cm_accept - Called to accept an incoming connect request.
191 *
192 * @cm_id: The IW CM identifier associated with the connection request.
193 * @iw_param: Pointer to a structure containing connection establishment
194 * parameters.
195 *
196 * The specified cm_id will have been provided in the event data for a
197 * CONNECT_REQUEST event. Subsequent events related to this connection will be
198 * delivered to the specified IW CM identifier prior and may occur prior to
199 * the return of this function. If this function returns a non-zero value, the
200 * client can assume that no events will be delivered to the specified IW CM
201 * identifier.
202 */
203int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
204
205/**
206 * iw_cm_reject - Reject an incoming connection request.
207 *
208 * @cm_id: Connection identifier associated with the request.
209 * @private_daa: Pointer to data to deliver to the remote peer as part of the
210 * reject message.
211 * @private_data_len: The number of bytes in the private_data parameter.
212 *
213 * The client can assume that no events will be delivered to the specified IW
214 * CM identifier following the return of this function. The private_data
215 * buffer is available for reuse when this function returns.
216 */
217int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data,
218 u8 private_data_len);
219
220/**
221 * iw_cm_connect - Called to request a connection to a remote peer.
222 *
223 * @cm_id: The IW CM identifier for the connection.
224 * @iw_param: Pointer to a structure containing connection establishment
225 * parameters.
226 *
227 * Events may be delivered to the specified IW CM identifier prior to the
228 * return of this function. If this function returns a non-zero value, the
229 * client can assume that no events will be delivered to the specified IW CM
230 * identifier.
231 */
232int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
233
234/**
235 * iw_cm_disconnect - Close the specified connection.
236 *
237 * @cm_id: The IW CM identifier to close.
238 * @abrupt: If 0, the connection will be closed gracefully, otherwise, the
239 * connection will be reset.
240 *
241 * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is
242 * delivered.
243 */
244int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt);
245
246/**
247 * iw_cm_init_qp_attr - Called to initialize the attributes of the QP
248 * associated with a IW CM identifier.
249 *
250 * @cm_id: The IW CM identifier associated with the QP
251 * @qp_attr: Pointer to the QP attributes structure.
252 * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are
253 * valid.
254 */
255int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr,
256 int *qp_attr_mask);
257
258#endif /* IW_CM_H */
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index 402c63d722..deb5a0a4ce 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -117,6 +117,14 @@ struct rdma_cm_id {
117struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, 117struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
118 void *context, enum rdma_port_space ps); 118 void *context, enum rdma_port_space ps);
119 119
120/**
121 * rdma_destroy_id - Destroys an RDMA identifier.
122 *
123 * @id: RDMA identifier.
124 *
125 * Note: calling this function has the effect of canceling in-flight
126 * asynchronous operations associated with the id.
127 */
120void rdma_destroy_id(struct rdma_cm_id *id); 128void rdma_destroy_id(struct rdma_cm_id *id);
121 129
122/** 130/**
@@ -237,6 +245,10 @@ int rdma_listen(struct rdma_cm_id *id, int backlog);
237 * Typically, this routine is only called by the listener to accept a connection 245 * Typically, this routine is only called by the listener to accept a connection
238 * request. It must also be called on the active side of a connection if the 246 * request. It must also be called on the active side of a connection if the
239 * user is performing their own QP transitions. 247 * user is performing their own QP transitions.
248 *
249 * In the case of error, a reject message is sent to the remote side and the
250 * state of the qp associated with the id is modified to error, such that any
251 * previously posted receive buffers would be flushed.
240 */ 252 */
241int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param); 253int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
242 254
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
new file mode 100644
index 0000000000..744f85011f
--- /dev/null
+++ b/include/scsi/Kbuild
@@ -0,0 +1,4 @@
1header-y += scsi.h
2
3unifdef-y += scsi_ioctl.h
4unifdef-y += sg.h
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 253797c600..55ebf035e6 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -47,10 +47,19 @@ enum iscsi_uevent_e {
47 ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13, 47 ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
48 ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14, 48 ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
49 49
50 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51
50 /* up events */ 52 /* up events */
51 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 53 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
52 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, 54 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
53 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, 55 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
56 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
57};
58
59enum iscsi_tgt_dscvr {
60 ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
61 ISCSI_TGT_DSCVR_ISNS = 2,
62 ISCSI_TGT_DSCVR_SLP = 3,
54}; 63};
55 64
56struct iscsi_uevent { 65struct iscsi_uevent {
@@ -116,6 +125,17 @@ struct iscsi_uevent {
116 struct msg_transport_disconnect { 125 struct msg_transport_disconnect {
117 uint64_t ep_handle; 126 uint64_t ep_handle;
118 } ep_disconnect; 127 } ep_disconnect;
128 struct msg_tgt_dscvr {
129 enum iscsi_tgt_dscvr type;
130 uint32_t host_no;
131 /*
132 * enable = 1 to establish a new connection
133 * with the server. enable = 0 to disconnect
134 * from the server. Used primarily to switch
135 * from one iSNS server to another.
136 */
137 uint32_t enable;
138 } tgt_dscvr;
119 } u; 139 } u;
120 union { 140 union {
121 /* messages k -> u */ 141 /* messages k -> u */
@@ -138,6 +158,10 @@ struct iscsi_uevent {
138 uint32_t cid; 158 uint32_t cid;
139 uint32_t error; /* enum iscsi_err */ 159 uint32_t error; /* enum iscsi_err */
140 } connerror; 160 } connerror;
161 struct msg_session_destroyed {
162 uint32_t host_no;
163 uint32_t sid;
164 } d_session;
141 struct msg_transport_connect_ret { 165 struct msg_transport_connect_ret {
142 uint64_t handle; 166 uint64_t handle;
143 } ep_connect_ret; 167 } ep_connect_ret;
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index cbf7e58bd6..401192e56e 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -60,6 +60,7 @@ struct iscsi_nopin;
60#define TMABORT_SUCCESS 0x1 60#define TMABORT_SUCCESS 0x1
61#define TMABORT_FAILED 0x2 61#define TMABORT_FAILED 0x2
62#define TMABORT_TIMEDOUT 0x3 62#define TMABORT_TIMEDOUT 0x3
63#define TMABORT_NOT_FOUND 0x4
63 64
64/* Connection suspend "bit" */ 65/* Connection suspend "bit" */
65#define ISCSI_SUSPEND_BIT 1 66#define ISCSI_SUSPEND_BIT 1
@@ -83,6 +84,12 @@ struct iscsi_mgmt_task {
83 struct list_head running; 84 struct list_head running;
84}; 85};
85 86
87enum {
88 ISCSI_TASK_COMPLETED,
89 ISCSI_TASK_PENDING,
90 ISCSI_TASK_RUNNING,
91};
92
86struct iscsi_cmd_task { 93struct iscsi_cmd_task {
87 /* 94 /*
88 * Becuae LLDs allocate their hdr differently, this is a pointer to 95 * Becuae LLDs allocate their hdr differently, this is a pointer to
@@ -95,12 +102,17 @@ struct iscsi_cmd_task {
95 uint32_t unsol_datasn; 102 uint32_t unsol_datasn;
96 int imm_count; /* imm-data (bytes) */ 103 int imm_count; /* imm-data (bytes) */
97 int unsol_count; /* unsolicited (bytes)*/ 104 int unsol_count; /* unsolicited (bytes)*/
105 /* offset in unsolicited stream (bytes); */
106 int unsol_offset;
98 int data_count; /* remaining Data-Out */ 107 int data_count; /* remaining Data-Out */
99 struct scsi_cmnd *sc; /* associated SCSI cmd*/ 108 struct scsi_cmnd *sc; /* associated SCSI cmd*/
100 int total_length; 109 int total_length;
101 struct iscsi_conn *conn; /* used connection */ 110 struct iscsi_conn *conn; /* used connection */
102 struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */ 111 struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */
103 112
113 /* state set/tested under session->lock */
114 int state;
115 atomic_t refcount;
104 struct list_head running; /* running cmd list */ 116 struct list_head running; /* running cmd list */
105 void *dd_data; /* driver/transport data */ 117 void *dd_data; /* driver/transport data */
106}; 118};
@@ -126,6 +138,14 @@ struct iscsi_conn {
126 int id; /* CID */ 138 int id; /* CID */
127 struct list_head item; /* maintains list of conns */ 139 struct list_head item; /* maintains list of conns */
128 int c_stage; /* connection state */ 140 int c_stage; /* connection state */
141 /*
142 * Preallocated buffer for pdus that have data but do not
143 * originate from scsi-ml. We never have two pdus using the
144 * buffer at the same time. It is only allocated to
145 * the default max recv size because the pdus we support
146 * should always fit in this buffer
147 */
148 char *data;
129 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ 149 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */
130 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ 150 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */
131 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ 151 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
@@ -134,7 +154,7 @@ struct iscsi_conn {
134 struct kfifo *immqueue; /* immediate xmit queue */ 154 struct kfifo *immqueue; /* immediate xmit queue */
135 struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */ 155 struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */
136 struct list_head mgmt_run_list; /* list of control tasks */ 156 struct list_head mgmt_run_list; /* list of control tasks */
137 struct kfifo *xmitqueue; /* data-path cmd queue */ 157 struct list_head xmitqueue; /* data-path cmd queue */
138 struct list_head run_list; /* list of cmds in progress */ 158 struct list_head run_list; /* list of cmds in progress */
139 struct work_struct xmitwork; /* per-conn. xmit workqueue */ 159 struct work_struct xmitwork; /* per-conn. xmit workqueue */
140 /* 160 /*
@@ -157,6 +177,11 @@ struct iscsi_conn {
157 int max_xmit_dlength; /* target_max_recv_dsl */ 177 int max_xmit_dlength; /* target_max_recv_dsl */
158 int hdrdgst_en; 178 int hdrdgst_en;
159 int datadgst_en; 179 int datadgst_en;
180 int ifmarker_en;
181 int ofmarker_en;
182 /* values userspace uses to id a conn */
183 int persistent_port;
184 char *persistent_address;
160 185
161 /* MIB-statistics */ 186 /* MIB-statistics */
162 uint64_t txdata_octets; 187 uint64_t txdata_octets;
@@ -196,8 +221,8 @@ struct iscsi_session {
196 int pdu_inorder_en; 221 int pdu_inorder_en;
197 int dataseq_inorder_en; 222 int dataseq_inorder_en;
198 int erl; 223 int erl;
199 int ifmarker_en; 224 int tpgt;
200 int ofmarker_en; 225 char *targetname;
201 226
202 /* control data */ 227 /* control data */
203 struct iscsi_transport *tt; 228 struct iscsi_transport *tt;
@@ -240,6 +265,10 @@ iscsi_session_setup(struct iscsi_transport *, struct scsi_transport_template *,
240extern void iscsi_session_teardown(struct iscsi_cls_session *); 265extern void iscsi_session_teardown(struct iscsi_cls_session *);
241extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *); 266extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *);
242extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); 267extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
268extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
269 enum iscsi_param param, char *buf, int buflen);
270extern int iscsi_session_get_param(struct iscsi_cls_session *cls_session,
271 enum iscsi_param param, char *buf);
243 272
244#define session_to_cls(_sess) \ 273#define session_to_cls(_sess) \
245 hostdata_session(_sess->host->hostdata) 274 hostdata_session(_sess->host->hostdata)
@@ -255,6 +284,8 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
255extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, 284extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
256 int); 285 int);
257extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); 286extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
287extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
288 enum iscsi_param param, char *buf);
258 289
259/* 290/*
260 * pdu and task processing 291 * pdu and task processing
@@ -262,8 +293,7 @@ extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
262extern int iscsi_check_assign_cmdsn(struct iscsi_session *, 293extern int iscsi_check_assign_cmdsn(struct iscsi_session *,
263 struct iscsi_nopin *); 294 struct iscsi_nopin *);
264extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, 295extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *,
265 struct iscsi_data *hdr, 296 struct iscsi_data *hdr);
266 int transport_data_cnt);
267extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, 297extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
268 char *, uint32_t); 298 char *, uint32_t);
269extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, 299extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
new file mode 100644
index 0000000000..9582e84016
--- /dev/null
+++ b/include/scsi/libsas.h
@@ -0,0 +1,627 @@
1/*
2 * SAS host prototypes and structures header file
3 *
4 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
5 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
6 *
7 * This file is licensed under GPLv2.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 *
24 */
25
26#ifndef _LIBSAS_H_
27#define _LIBSAS_H_
28
29
30#include <linux/timer.h>
31#include <linux/pci.h>
32#include <scsi/sas.h>
33#include <linux/list.h>
34#include <asm/semaphore.h>
35#include <scsi/scsi_device.h>
36#include <scsi/scsi_cmnd.h>
37#include <scsi/scsi_transport_sas.h>
38
39struct block_device;
40
41enum sas_class {
42 SAS,
43 EXPANDER
44};
45
46enum sas_phy_role {
47 PHY_ROLE_NONE = 0,
48 PHY_ROLE_TARGET = 0x40,
49 PHY_ROLE_INITIATOR = 0x80,
50};
51
52enum sas_phy_type {
53 PHY_TYPE_PHYSICAL,
54 PHY_TYPE_VIRTUAL
55};
56
57/* The events are mnemonically described in sas_dump.c
58 * so when updating/adding events here, please also
59 * update the other file too.
60 */
61enum ha_event {
62 HAE_RESET = 0U,
63 HA_NUM_EVENTS = 1,
64};
65
66enum port_event {
67 PORTE_BYTES_DMAED = 0U,
68 PORTE_BROADCAST_RCVD = 1,
69 PORTE_LINK_RESET_ERR = 2,
70 PORTE_TIMER_EVENT = 3,
71 PORTE_HARD_RESET = 4,
72 PORT_NUM_EVENTS = 5,
73};
74
75enum phy_event {
76 PHYE_LOSS_OF_SIGNAL = 0U,
77 PHYE_OOB_DONE = 1,
78 PHYE_OOB_ERROR = 2,
79 PHYE_SPINUP_HOLD = 3, /* hot plug SATA, no COMWAKE sent */
80 PHY_NUM_EVENTS = 4,
81};
82
83enum discover_event {
84 DISCE_DISCOVER_DOMAIN = 0U,
85 DISCE_REVALIDATE_DOMAIN = 1,
86 DISCE_PORT_GONE = 2,
87 DISC_NUM_EVENTS = 3,
88};
89
90/* ---------- Expander Devices ---------- */
91
92#define ETASK 0xFA
93
94#define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj)
95#define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\
96 attr)
97
98enum routing_attribute {
99 DIRECT_ROUTING,
100 SUBTRACTIVE_ROUTING,
101 TABLE_ROUTING,
102};
103
104enum ex_phy_state {
105 PHY_EMPTY,
106 PHY_VACANT,
107 PHY_NOT_PRESENT,
108 PHY_DEVICE_DISCOVERED
109};
110
111struct ex_phy {
112 int phy_id;
113
114 enum ex_phy_state phy_state;
115
116 enum sas_dev_type attached_dev_type;
117 enum sas_linkrate linkrate;
118
119 u8 attached_sata_host:1;
120 u8 attached_sata_dev:1;
121 u8 attached_sata_ps:1;
122
123 enum sas_proto attached_tproto;
124 enum sas_proto attached_iproto;
125
126 u8 attached_sas_addr[SAS_ADDR_SIZE];
127 u8 attached_phy_id;
128
129 u8 phy_change_count;
130 enum routing_attribute routing_attr;
131 u8 virtual:1;
132
133 int last_da_index;
134
135 struct sas_phy *phy;
136 struct sas_port *port;
137};
138
139struct expander_device {
140 struct list_head children;
141
142 u16 ex_change_count;
143 u16 max_route_indexes;
144 u8 num_phys;
145 u8 configuring:1;
146 u8 conf_route_table:1;
147 u8 enclosure_logical_id[8];
148
149 struct ex_phy *ex_phy;
150 struct sas_port *parent_port;
151};
152
153/* ---------- SATA device ---------- */
154enum ata_command_set {
155 ATA_COMMAND_SET = 0,
156 ATAPI_COMMAND_SET = 1,
157};
158
159struct sata_device {
160 enum ata_command_set command_set;
161 struct smp_resp rps_resp; /* report_phy_sata_resp */
162 __le16 *identify_device;
163 __le16 *identify_packet_device;
164
165 u8 port_no; /* port number, if this is a PM (Port) */
166 struct list_head children; /* PM Ports if this is a PM */
167};
168
169/* ---------- Domain device ---------- */
170struct domain_device {
171 enum sas_dev_type dev_type;
172
173 enum sas_linkrate linkrate;
174 enum sas_linkrate min_linkrate;
175 enum sas_linkrate max_linkrate;
176
177 int pathways;
178
179 struct domain_device *parent;
180 struct list_head siblings; /* devices on the same level */
181 struct asd_sas_port *port; /* shortcut to root of the tree */
182
183 struct list_head dev_list_node;
184
185 enum sas_proto iproto;
186 enum sas_proto tproto;
187
188 struct sas_rphy *rphy;
189
190 u8 sas_addr[SAS_ADDR_SIZE];
191 u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
192
193 u8 frame_rcvd[32];
194
195 union {
196 struct expander_device ex_dev;
197 struct sata_device sata_dev; /* STP & directly attached */
198 };
199
200 void *lldd_dev;
201};
202
203struct sas_discovery {
204 spinlock_t disc_event_lock;
205 struct work_struct disc_work[DISC_NUM_EVENTS];
206 unsigned long pending;
207 u8 fanout_sas_addr[8];
208 u8 eeds_a[8];
209 u8 eeds_b[8];
210 int max_level;
211};
212
213
214/* The port struct is Class:RW, driver:RO */
215struct asd_sas_port {
216/* private: */
217 struct completion port_gone_completion;
218
219 struct sas_discovery disc;
220 struct domain_device *port_dev;
221 spinlock_t dev_list_lock;
222 struct list_head dev_list;
223 enum sas_linkrate linkrate;
224
225 struct sas_phy *phy;
226 struct work_struct work;
227
228/* public: */
229 int id;
230
231 enum sas_class class;
232 u8 sas_addr[SAS_ADDR_SIZE];
233 u8 attached_sas_addr[SAS_ADDR_SIZE];
234 enum sas_proto iproto;
235 enum sas_proto tproto;
236
237 enum sas_oob_mode oob_mode;
238
239 spinlock_t phy_list_lock;
240 struct list_head phy_list;
241 int num_phys;
242 u32 phy_mask;
243
244 struct sas_ha_struct *ha;
245
246 struct sas_port *port;
247
248 void *lldd_port; /* not touched by the sas class code */
249};
250
251/* The phy pretty much is controlled by the LLDD.
252 * The class only reads those fields.
253 */
254struct asd_sas_phy {
255/* private: */
256 /* protected by ha->event_lock */
257 struct work_struct port_events[PORT_NUM_EVENTS];
258 struct work_struct phy_events[PHY_NUM_EVENTS];
259
260 unsigned long port_events_pending;
261 unsigned long phy_events_pending;
262
263 int error;
264
265 struct sas_phy *phy;
266
267/* public: */
268 /* The following are class:RO, driver:R/W */
269 int enabled; /* must be set */
270
271 int id; /* must be set */
272 enum sas_class class;
273 enum sas_proto iproto;
274 enum sas_proto tproto;
275
276 enum sas_phy_type type;
277 enum sas_phy_role role;
278 enum sas_oob_mode oob_mode;
279 enum sas_linkrate linkrate;
280
281 u8 *sas_addr; /* must be set */
282 u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */
283
284 spinlock_t frame_rcvd_lock;
285 u8 *frame_rcvd; /* must be set */
286 int frame_rcvd_size;
287
288 spinlock_t sas_prim_lock;
289 u32 sas_prim;
290
291 struct list_head port_phy_el; /* driver:RO */
292 struct asd_sas_port *port; /* Class:RW, driver: RO */
293
294 struct sas_ha_struct *ha; /* may be set; the class sets it anyway */
295
296 void *lldd_phy; /* not touched by the sas_class_code */
297};
298
299struct scsi_core {
300 struct Scsi_Host *shost;
301
302 spinlock_t task_queue_lock;
303 struct list_head task_queue;
304 int task_queue_size;
305
306 struct semaphore queue_thread_sema;
307 int queue_thread_kill;
308};
309
310struct sas_ha_struct {
311/* private: */
312 spinlock_t event_lock;
313 struct work_struct ha_events[HA_NUM_EVENTS];
314 unsigned long pending;
315
316 struct scsi_core core;
317
318/* public: */
319 char *sas_ha_name;
320 struct pci_dev *pcidev; /* should be set */
321 struct module *lldd_module; /* should be set */
322
323 u8 *sas_addr; /* must be set */
324 u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
325
326 spinlock_t phy_port_lock;
327 struct asd_sas_phy **sas_phy; /* array of valid pointers, must be set */
328 struct asd_sas_port **sas_port; /* array of valid pointers, must be set */
329 int num_phys; /* must be set, gt 0, static */
330
331 /* The class calls this to send a task for execution. */
332 int lldd_max_execute_num;
333 int lldd_queue_size;
334
335 /* LLDD calls these to notify the class of an event. */
336 void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);
337 void (*notify_port_event)(struct asd_sas_phy *, enum port_event);
338 void (*notify_phy_event)(struct asd_sas_phy *, enum phy_event);
339
340 void *lldd_ha; /* not touched by sas class code */
341};
342
343#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
344
345static inline struct domain_device *
346starget_to_domain_dev(struct scsi_target *starget) {
347 return starget->hostdata;
348}
349
350static inline struct domain_device *
351sdev_to_domain_dev(struct scsi_device *sdev) {
352 return starget_to_domain_dev(sdev->sdev_target);
353}
354
355static inline struct domain_device *
356cmd_to_domain_dev(struct scsi_cmnd *cmd)
357{
358 return sdev_to_domain_dev(cmd->device);
359}
360
361void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
362
363/* Before calling a notify event, LLDD should use this function
364 * when the link is severed (possibly from its tasklet).
365 * The idea is that the Class only reads those, while the LLDD,
366 * can R/W these (thus avoiding a race).
367 */
368static inline void sas_phy_disconnected(struct asd_sas_phy *phy)
369{
370 phy->oob_mode = OOB_NOT_CONNECTED;
371 phy->linkrate = SAS_LINK_RATE_UNKNOWN;
372}
373
374/* ---------- Tasks ---------- */
375/*
376 service_response | SAS_TASK_COMPLETE | SAS_TASK_UNDELIVERED |
377 exec_status | | |
378 ---------------------+---------------------+-----------------------+
379 SAM_... | X | |
380 DEV_NO_RESPONSE | X | X |
381 INTERRUPTED | X | |
382 QUEUE_FULL | | X |
383 DEVICE_UNKNOWN | | X |
384 SG_ERR | | X |
385 ---------------------+---------------------+-----------------------+
386 */
387
388enum service_response {
389 SAS_TASK_COMPLETE,
390 SAS_TASK_UNDELIVERED = -1,
391};
392
393enum exec_status {
394 SAM_GOOD = 0,
395 SAM_CHECK_COND = 2,
396 SAM_COND_MET = 4,
397 SAM_BUSY = 8,
398 SAM_INTERMEDIATE = 0x10,
399 SAM_IM_COND_MET = 0x12,
400 SAM_RESV_CONFLICT= 0x14,
401 SAM_TASK_SET_FULL= 0x28,
402 SAM_ACA_ACTIVE = 0x30,
403 SAM_TASK_ABORTED = 0x40,
404
405 SAS_DEV_NO_RESPONSE = 0x80,
406 SAS_DATA_UNDERRUN,
407 SAS_DATA_OVERRUN,
408 SAS_INTERRUPTED,
409 SAS_QUEUE_FULL,
410 SAS_DEVICE_UNKNOWN,
411 SAS_SG_ERR,
412 SAS_OPEN_REJECT,
413 SAS_OPEN_TO,
414 SAS_PROTO_RESPONSE,
415 SAS_PHY_DOWN,
416 SAS_NAK_R_ERR,
417 SAS_PENDING,
418 SAS_ABORTED_TASK,
419};
420
421/* When a task finishes with a response, the LLDD examines the
422 * response:
423 * - For an ATA task task_status_struct::stat is set to
424 * SAS_PROTO_RESPONSE, and the task_status_struct::buf is set to the
425 * contents of struct ata_task_resp.
426 * - For SSP tasks, if no data is present or status/TMF response
427 * is valid, task_status_struct::stat is set. If data is present
428 * (SENSE data), the LLDD copies up to SAS_STATUS_BUF_SIZE, sets
429 * task_status_struct::buf_valid_size, and task_status_struct::stat is
430 * set to SAM_CHECK_COND.
431 *
432 * "buf" has format SCSI Sense for SSP task, or struct ata_task_resp
433 * for ATA task.
434 *
435 * "frame_len" is the total frame length, which could be more or less
436 * than actually copied.
437 *
438 * Tasks ending with response, always set the residual field.
439 */
440struct ata_task_resp {
441 u16 frame_len;
442 u8 ending_fis[24]; /* dev to host or data-in */
443 u32 sstatus;
444 u32 serror;
445 u32 scontrol;
446 u32 sactive;
447};
448
449#define SAS_STATUS_BUF_SIZE 96
450
451struct task_status_struct {
452 enum service_response resp;
453 enum exec_status stat;
454 int buf_valid_size;
455
456 u8 buf[SAS_STATUS_BUF_SIZE];
457
458 u32 residual;
459 enum sas_open_rej_reason open_rej_reason;
460};
461
462/* ATA and ATAPI task queuable to a SAS LLDD.
463 */
464struct sas_ata_task {
465 struct host_to_dev_fis fis;
466 u8 atapi_packet[16]; /* 0 if not ATAPI task */
467
468 u8 retry_count; /* hardware retry, should be > 0 */
469
470 u8 dma_xfer:1; /* PIO:0 or DMA:1 */
471 u8 use_ncq:1;
472 u8 set_affil_pol:1;
473 u8 stp_affil_pol:1;
474
475 u8 device_control_reg_update:1;
476};
477
478struct sas_smp_task {
479 struct scatterlist smp_req;
480 struct scatterlist smp_resp;
481};
482
483enum task_attribute {
484 TASK_ATTR_SIMPLE = 0,
485 TASK_ATTR_HOQ = 1,
486 TASK_ATTR_ORDERED= 2,
487 TASK_ATTR_ACA = 4,
488};
489
490struct sas_ssp_task {
491 u8 retry_count; /* hardware retry, should be > 0 */
492
493 u8 LUN[8];
494 u8 enable_first_burst:1;
495 enum task_attribute task_attr;
496 u8 task_prio;
497 u8 cdb[16];
498};
499
500struct sas_task {
501 struct domain_device *dev;
502 struct list_head list;
503
504 spinlock_t task_state_lock;
505 unsigned task_state_flags;
506
507 enum sas_proto task_proto;
508
509 /* Used by the discovery code. */
510 struct timer_list timer;
511 struct completion completion;
512
513 union {
514 struct sas_ata_task ata_task;
515 struct sas_smp_task smp_task;
516 struct sas_ssp_task ssp_task;
517 };
518
519 struct scatterlist *scatter;
520 int num_scatter;
521 u32 total_xfer_len;
522 u8 data_dir:2; /* Use PCI_DMA_... */
523
524 struct task_status_struct task_status;
525 void (*task_done)(struct sas_task *);
526
527 void *lldd_task; /* for use by LLDDs */
528 void *uldd_task;
529};
530
531
532
533#define SAS_TASK_STATE_PENDING 1
534#define SAS_TASK_STATE_DONE 2
535#define SAS_TASK_STATE_ABORTED 4
536
537static inline struct sas_task *sas_alloc_task(gfp_t flags)
538{
539 extern kmem_cache_t *sas_task_cache;
540 struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags);
541
542 if (task) {
543 memset(task, 0, sizeof(*task));
544 INIT_LIST_HEAD(&task->list);
545 spin_lock_init(&task->task_state_lock);
546 task->task_state_flags = SAS_TASK_STATE_PENDING;
547 init_timer(&task->timer);
548 init_completion(&task->completion);
549 }
550
551 return task;
552}
553
554static inline void sas_free_task(struct sas_task *task)
555{
556 if (task) {
557 extern kmem_cache_t *sas_task_cache;
558 BUG_ON(!list_empty(&task->list));
559 kmem_cache_free(sas_task_cache, task);
560 }
561}
562
563struct sas_domain_function_template {
564 /* The class calls these to notify the LLDD of an event. */
565 void (*lldd_port_formed)(struct asd_sas_phy *);
566 void (*lldd_port_deformed)(struct asd_sas_phy *);
567
568 /* The class calls these when a device is found or gone. */
569 int (*lldd_dev_found)(struct domain_device *);
570 void (*lldd_dev_gone)(struct domain_device *);
571
572 int (*lldd_execute_task)(struct sas_task *, int num,
573 gfp_t gfp_flags);
574
575 /* Task Management Functions. Must be called from process context. */
576 int (*lldd_abort_task)(struct sas_task *);
577 int (*lldd_abort_task_set)(struct domain_device *, u8 *lun);
578 int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
579 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
580 int (*lldd_I_T_nexus_reset)(struct domain_device *);
581 int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
582 int (*lldd_query_task)(struct sas_task *);
583
584 /* Port and Adapter management */
585 int (*lldd_clear_nexus_port)(struct asd_sas_port *);
586 int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);
587
588 /* Phy management */
589 int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *);
590};
591
592extern int sas_register_ha(struct sas_ha_struct *);
593extern int sas_unregister_ha(struct sas_ha_struct *);
594
595extern int sas_queuecommand(struct scsi_cmnd *,
596 void (*scsi_done)(struct scsi_cmnd *));
597extern int sas_target_alloc(struct scsi_target *);
598extern int sas_slave_alloc(struct scsi_device *);
599extern int sas_slave_configure(struct scsi_device *);
600extern void sas_slave_destroy(struct scsi_device *);
601extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
602extern int sas_change_queue_type(struct scsi_device *, int qt);
603extern int sas_bios_param(struct scsi_device *,
604 struct block_device *,
605 sector_t capacity, int *hsc);
606extern struct scsi_transport_template *
607sas_domain_attach_transport(struct sas_domain_function_template *);
608extern void sas_domain_release_transport(struct scsi_transport_template *);
609
610int sas_discover_root_expander(struct domain_device *);
611
612void sas_init_ex_attr(void);
613
614int sas_ex_revalidate_domain(struct domain_device *);
615
616void sas_unregister_domain_devices(struct asd_sas_port *port);
617void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
618int sas_discover_event(struct asd_sas_port *, enum discover_event ev);
619
620int sas_discover_sata(struct domain_device *);
621int sas_discover_end_dev(struct domain_device *);
622
623void sas_unregister_dev(struct domain_device *);
624
625void sas_init_dev(struct domain_device *);
626
627#endif /* _SASLIB_H_ */
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
new file mode 100644
index 0000000000..2f4b6afa34
--- /dev/null
+++ b/include/scsi/sas.h
@@ -0,0 +1,631 @@
1/*
2 * SAS structures and definitions header file
3 *
4 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
5 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
6 *
7 * This file is licensed under GPLv2.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 *
24 */
25
26#ifndef _SAS_H_
27#define _SAS_H_
28
29#include <linux/types.h>
30#include <asm/byteorder.h>
31
32#define SAS_ADDR_SIZE 8
33#define HASHED_SAS_ADDR_SIZE 3
34#define SAS_ADDR(_sa) ((unsigned long long) be64_to_cpu(*(__be64 *)(_sa)))
35
36#define SMP_REQUEST 0x40
37#define SMP_RESPONSE 0x41
38
39#define SSP_DATA 0x01
40#define SSP_XFER_RDY 0x05
41#define SSP_COMMAND 0x06
42#define SSP_RESPONSE 0x07
43#define SSP_TASK 0x16
44
45#define SMP_REPORT_GENERAL 0x00
46#define SMP_REPORT_MANUF_INFO 0x01
47#define SMP_READ_GPIO_REG 0x02
48#define SMP_DISCOVER 0x10
49#define SMP_REPORT_PHY_ERR_LOG 0x11
50#define SMP_REPORT_PHY_SATA 0x12
51#define SMP_REPORT_ROUTE_INFO 0x13
52#define SMP_WRITE_GPIO_REG 0x82
53#define SMP_CONF_ROUTE_INFO 0x90
54#define SMP_PHY_CONTROL 0x91
55#define SMP_PHY_TEST_FUNCTION 0x92
56
57#define SMP_RESP_FUNC_ACC 0x00
58#define SMP_RESP_FUNC_UNK 0x01
59#define SMP_RESP_FUNC_FAILED 0x02
60#define SMP_RESP_INV_FRM_LEN 0x03
61#define SMP_RESP_NO_PHY 0x10
62#define SMP_RESP_NO_INDEX 0x11
63#define SMP_RESP_PHY_NO_SATA 0x12
64#define SMP_RESP_PHY_UNK_OP 0x13
65#define SMP_RESP_PHY_UNK_TESTF 0x14
66#define SMP_RESP_PHY_TEST_INPROG 0x15
67#define SMP_RESP_PHY_VACANT 0x16
68
69/* SAM TMFs */
70#define TMF_ABORT_TASK 0x01
71#define TMF_ABORT_TASK_SET 0x02
72#define TMF_CLEAR_TASK_SET 0x04
73#define TMF_LU_RESET 0x08
74#define TMF_CLEAR_ACA 0x40
75#define TMF_QUERY_TASK 0x80
76
77/* SAS TMF responses */
78#define TMF_RESP_FUNC_COMPLETE 0x00
79#define TMF_RESP_INVALID_FRAME 0x02
80#define TMF_RESP_FUNC_ESUPP 0x04
81#define TMF_RESP_FUNC_FAILED 0x05
82#define TMF_RESP_FUNC_SUCC 0x08
83#define TMF_RESP_NO_LUN 0x09
84#define TMF_RESP_OVERLAPPED_TAG 0x0A
85
86enum sas_oob_mode {
87 OOB_NOT_CONNECTED,
88 SATA_OOB_MODE,
89 SAS_OOB_MODE
90};
91
92/* See sas_discover.c if you plan on changing these.
93 */
94enum sas_dev_type {
95 NO_DEVICE = 0, /* protocol */
96 SAS_END_DEV = 1, /* protocol */
97 EDGE_DEV = 2, /* protocol */
98 FANOUT_DEV = 3, /* protocol */
99 SAS_HA = 4,
100 SATA_DEV = 5,
101 SATA_PM = 7,
102 SATA_PM_PORT= 8,
103};
104
105/* Partly from IDENTIFY address frame. */
106enum sas_proto {
107 SATA_PROTO = 1,
108 SAS_PROTO_SMP = 2, /* protocol */
109 SAS_PROTO_STP = 4, /* protocol */
110 SAS_PROTO_SSP = 8, /* protocol */
111 SAS_PROTO_ALL = 0xE,
112};
113
114/* From the spec; local phys only */
115enum phy_func {
116 PHY_FUNC_NOP,
117 PHY_FUNC_LINK_RESET, /* Enables the phy */
118 PHY_FUNC_HARD_RESET,
119 PHY_FUNC_DISABLE,
120 PHY_FUNC_CLEAR_ERROR_LOG = 5,
121 PHY_FUNC_CLEAR_AFFIL,
122 PHY_FUNC_TX_SATA_PS_SIGNAL,
123 PHY_FUNC_RELEASE_SPINUP_HOLD = 0x10, /* LOCAL PORT ONLY! */
124 PHY_FUNC_SET_LINK_RATE,
125};
126
127/* SAS LLDD would need to report only _very_few_ of those, like BROADCAST.
128 * Most of those are here for completeness.
129 */
130enum sas_prim {
131 SAS_PRIM_AIP_NORMAL = 1,
132 SAS_PRIM_AIP_R0 = 2,
133 SAS_PRIM_AIP_R1 = 3,
134 SAS_PRIM_AIP_R2 = 4,
135 SAS_PRIM_AIP_WC = 5,
136 SAS_PRIM_AIP_WD = 6,
137 SAS_PRIM_AIP_WP = 7,
138 SAS_PRIM_AIP_RWP = 8,
139
140 SAS_PRIM_BC_CH = 9,
141 SAS_PRIM_BC_RCH0 = 10,
142 SAS_PRIM_BC_RCH1 = 11,
143 SAS_PRIM_BC_R0 = 12,
144 SAS_PRIM_BC_R1 = 13,
145 SAS_PRIM_BC_R2 = 14,
146 SAS_PRIM_BC_R3 = 15,
147 SAS_PRIM_BC_R4 = 16,
148
149 SAS_PRIM_NOTIFY_ENSP= 17,
150 SAS_PRIM_NOTIFY_R0 = 18,
151 SAS_PRIM_NOTIFY_R1 = 19,
152 SAS_PRIM_NOTIFY_R2 = 20,
153
154 SAS_PRIM_CLOSE_CLAF = 21,
155 SAS_PRIM_CLOSE_NORM = 22,
156 SAS_PRIM_CLOSE_R0 = 23,
157 SAS_PRIM_CLOSE_R1 = 24,
158
159 SAS_PRIM_OPEN_RTRY = 25,
160 SAS_PRIM_OPEN_RJCT = 26,
161 SAS_PRIM_OPEN_ACPT = 27,
162
163 SAS_PRIM_DONE = 28,
164 SAS_PRIM_BREAK = 29,
165
166 SATA_PRIM_DMAT = 33,
167 SATA_PRIM_PMNAK = 34,
168 SATA_PRIM_PMACK = 35,
169 SATA_PRIM_PMREQ_S = 36,
170 SATA_PRIM_PMREQ_P = 37,
171 SATA_SATA_R_ERR = 38,
172};
173
174enum sas_open_rej_reason {
175 /* Abandon open */
176 SAS_OREJ_UNKNOWN = 0,
177 SAS_OREJ_BAD_DEST = 1,
178 SAS_OREJ_CONN_RATE = 2,
179 SAS_OREJ_EPROTO = 3,
180 SAS_OREJ_RESV_AB0 = 4,
181 SAS_OREJ_RESV_AB1 = 5,
182 SAS_OREJ_RESV_AB2 = 6,
183 SAS_OREJ_RESV_AB3 = 7,
184 SAS_OREJ_WRONG_DEST= 8,
185 SAS_OREJ_STP_NORES = 9,
186
187 /* Retry open */
188 SAS_OREJ_NO_DEST = 10,
189 SAS_OREJ_PATH_BLOCKED = 11,
190 SAS_OREJ_RSVD_CONT0 = 12,
191 SAS_OREJ_RSVD_CONT1 = 13,
192 SAS_OREJ_RSVD_INIT0 = 14,
193 SAS_OREJ_RSVD_INIT1 = 15,
194 SAS_OREJ_RSVD_STOP0 = 16,
195 SAS_OREJ_RSVD_STOP1 = 17,
196 SAS_OREJ_RSVD_RETRY = 18,
197};
198
199struct dev_to_host_fis {
200 u8 fis_type; /* 0x34 */
201 u8 flags;
202 u8 status;
203 u8 error;
204
205 u8 lbal;
206 union { u8 lbam; u8 byte_count_low; };
207 union { u8 lbah; u8 byte_count_high; };
208 u8 device;
209
210 u8 lbal_exp;
211 u8 lbam_exp;
212 u8 lbah_exp;
213 u8 _r_a;
214
215 union { u8 sector_count; u8 interrupt_reason; };
216 u8 sector_count_exp;
217 u8 _r_b;
218 u8 _r_c;
219
220 u32 _r_d;
221} __attribute__ ((packed));
222
223struct host_to_dev_fis {
224 u8 fis_type; /* 0x27 */
225 u8 flags;
226 u8 command;
227 u8 features;
228
229 u8 lbal;
230 union { u8 lbam; u8 byte_count_low; };
231 union { u8 lbah; u8 byte_count_high; };
232 u8 device;
233
234 u8 lbal_exp;
235 u8 lbam_exp;
236 u8 lbah_exp;
237 u8 features_exp;
238
239 union { u8 sector_count; u8 interrupt_reason; };
240 u8 sector_count_exp;
241 u8 _r_a;
242 u8 control;
243
244 u32 _r_b;
245} __attribute__ ((packed));
246
247/* Prefer to have code clarity over header file clarity.
248 */
249#ifdef __LITTLE_ENDIAN_BITFIELD
250struct sas_identify_frame {
251 /* Byte 0 */
252 u8 frame_type:4;
253 u8 dev_type:3;
254 u8 _un0:1;
255
256 /* Byte 1 */
257 u8 _un1;
258
259 /* Byte 2 */
260 union {
261 struct {
262 u8 _un20:1;
263 u8 smp_iport:1;
264 u8 stp_iport:1;
265 u8 ssp_iport:1;
266 u8 _un247:4;
267 };
268 u8 initiator_bits;
269 };
270
271 /* Byte 3 */
272 union {
273 struct {
274 u8 _un30:1;
275 u8 smp_tport:1;
276 u8 stp_tport:1;
277 u8 ssp_tport:1;
278 u8 _un347:4;
279 };
280 u8 target_bits;
281 };
282
283 /* Byte 4 - 11 */
284 u8 _un4_11[8];
285
286 /* Byte 12 - 19 */
287 u8 sas_addr[SAS_ADDR_SIZE];
288
289 /* Byte 20 */
290 u8 phy_id;
291
292 u8 _un21_27[7];
293
294 __be32 crc;
295} __attribute__ ((packed));
296
297struct ssp_frame_hdr {
298 u8 frame_type;
299 u8 hashed_dest_addr[HASHED_SAS_ADDR_SIZE];
300 u8 _r_a;
301 u8 hashed_src_addr[HASHED_SAS_ADDR_SIZE];
302 __be16 _r_b;
303
304 u8 changing_data_ptr:1;
305 u8 retransmit:1;
306 u8 retry_data_frames:1;
307 u8 _r_c:5;
308
309 u8 num_fill_bytes:2;
310 u8 _r_d:6;
311
312 u32 _r_e;
313 __be16 tag;
314 __be16 tptt;
315 __be32 data_offs;
316} __attribute__ ((packed));
317
318struct ssp_response_iu {
319 u8 _r_a[10];
320
321 u8 datapres:2;
322 u8 _r_b:6;
323
324 u8 status;
325
326 u32 _r_c;
327
328 __be32 sense_data_len;
329 __be32 response_data_len;
330
331 u8 resp_data[0];
332 u8 sense_data[0];
333} __attribute__ ((packed));
334
335/* ---------- SMP ---------- */
336
337struct report_general_resp {
338 __be16 change_count;
339 __be16 route_indexes;
340 u8 _r_a;
341 u8 num_phys;
342
343 u8 conf_route_table:1;
344 u8 configuring:1;
345 u8 _r_b:6;
346
347 u8 _r_c;
348
349 u8 enclosure_logical_id[8];
350
351 u8 _r_d[12];
352} __attribute__ ((packed));
353
354struct discover_resp {
355 u8 _r_a[5];
356
357 u8 phy_id;
358 __be16 _r_b;
359
360 u8 _r_c:4;
361 u8 attached_dev_type:3;
362 u8 _r_d:1;
363
364 u8 linkrate:4;
365 u8 _r_e:4;
366
367 u8 attached_sata_host:1;
368 u8 iproto:3;
369 u8 _r_f:4;
370
371 u8 attached_sata_dev:1;
372 u8 tproto:3;
373 u8 _r_g:3;
374 u8 attached_sata_ps:1;
375
376 u8 sas_addr[8];
377 u8 attached_sas_addr[8];
378 u8 attached_phy_id;
379
380 u8 _r_h[7];
381
382 u8 hmin_linkrate:4;
383 u8 pmin_linkrate:4;
384 u8 hmax_linkrate:4;
385 u8 pmax_linkrate:4;
386
387 u8 change_count;
388
389 u8 pptv:4;
390 u8 _r_i:3;
391 u8 virtual:1;
392
393 u8 routing_attr:4;
394 u8 _r_j:4;
395
396 u8 conn_type;
397 u8 conn_el_index;
398 u8 conn_phy_link;
399
400 u8 _r_k[8];
401} __attribute__ ((packed));
402
403struct report_phy_sata_resp {
404 u8 _r_a[5];
405
406 u8 phy_id;
407 u8 _r_b;
408
409 u8 affil_valid:1;
410 u8 affil_supp:1;
411 u8 _r_c:6;
412
413 u32 _r_d;
414
415 u8 stp_sas_addr[8];
416
417 struct dev_to_host_fis fis;
418
419 u32 _r_e;
420
421 u8 affil_stp_ini_addr[8];
422
423 __be32 crc;
424} __attribute__ ((packed));
425
426struct smp_resp {
427 u8 frame_type;
428 u8 function;
429 u8 result;
430 u8 reserved;
431 union {
432 struct report_general_resp rg;
433 struct discover_resp disc;
434 struct report_phy_sata_resp rps;
435 };
436} __attribute__ ((packed));
437
438#elif defined(__BIG_ENDIAN_BITFIELD)
439struct sas_identify_frame {
440 /* Byte 0 */
441 u8 _un0:1;
442 u8 dev_type:3;
443 u8 frame_type:4;
444
445 /* Byte 1 */
446 u8 _un1;
447
448 /* Byte 2 */
449 union {
450 struct {
451 u8 _un247:4;
452 u8 ssp_iport:1;
453 u8 stp_iport:1;
454 u8 smp_iport:1;
455 u8 _un20:1;
456 };
457 u8 initiator_bits;
458 };
459
460 /* Byte 3 */
461 union {
462 struct {
463 u8 _un347:4;
464 u8 ssp_tport:1;
465 u8 stp_tport:1;
466 u8 smp_tport:1;
467 u8 _un30:1;
468 };
469 u8 target_bits;
470 };
471
472 /* Byte 4 - 11 */
473 u8 _un4_11[8];
474
475 /* Byte 12 - 19 */
476 u8 sas_addr[SAS_ADDR_SIZE];
477
478 /* Byte 20 */
479 u8 phy_id;
480
481 u8 _un21_27[7];
482
483 __be32 crc;
484} __attribute__ ((packed));
485
486struct ssp_frame_hdr {
487 u8 frame_type;
488 u8 hashed_dest_addr[HASHED_SAS_ADDR_SIZE];
489 u8 _r_a;
490 u8 hashed_src_addr[HASHED_SAS_ADDR_SIZE];
491 __be16 _r_b;
492
493 u8 _r_c:5;
494 u8 retry_data_frames:1;
495 u8 retransmit:1;
496 u8 changing_data_ptr:1;
497
498 u8 _r_d:6;
499 u8 num_fill_bytes:2;
500
501 u32 _r_e;
502 __be16 tag;
503 __be16 tptt;
504 __be32 data_offs;
505} __attribute__ ((packed));
506
507struct ssp_response_iu {
508 u8 _r_a[10];
509
510 u8 _r_b:6;
511 u8 datapres:2;
512
513 u8 status;
514
515 u32 _r_c;
516
517 __be32 sense_data_len;
518 __be32 response_data_len;
519
520 u8 resp_data[0];
521 u8 sense_data[0];
522} __attribute__ ((packed));
523
524/* ---------- SMP ---------- */
525
526struct report_general_resp {
527 __be16 change_count;
528 __be16 route_indexes;
529 u8 _r_a;
530 u8 num_phys;
531
532 u8 _r_b:6;
533 u8 configuring:1;
534 u8 conf_route_table:1;
535
536 u8 _r_c;
537
538 u8 enclosure_logical_id[8];
539
540 u8 _r_d[12];
541} __attribute__ ((packed));
542
543struct discover_resp {
544 u8 _r_a[5];
545
546 u8 phy_id;
547 __be16 _r_b;
548
549 u8 _r_d:1;
550 u8 attached_dev_type:3;
551 u8 _r_c:4;
552
553 u8 _r_e:4;
554 u8 linkrate:4;
555
556 u8 _r_f:4;
557 u8 iproto:3;
558 u8 attached_sata_host:1;
559
560 u8 attached_sata_ps:1;
561 u8 _r_g:3;
562 u8 tproto:3;
563 u8 attached_sata_dev:1;
564
565 u8 sas_addr[8];
566 u8 attached_sas_addr[8];
567 u8 attached_phy_id;
568
569 u8 _r_h[7];
570
571 u8 pmin_linkrate:4;
572 u8 hmin_linkrate:4;
573 u8 pmax_linkrate:4;
574 u8 hmax_linkrate:4;
575
576 u8 change_count;
577
578 u8 virtual:1;
579 u8 _r_i:3;
580 u8 pptv:4;
581
582 u8 _r_j:4;
583 u8 routing_attr:4;
584
585 u8 conn_type;
586 u8 conn_el_index;
587 u8 conn_phy_link;
588
589 u8 _r_k[8];
590} __attribute__ ((packed));
591
592struct report_phy_sata_resp {
593 u8 _r_a[5];
594
595 u8 phy_id;
596 u8 _r_b;
597
598 u8 _r_c:6;
599 u8 affil_supp:1;
600 u8 affil_valid:1;
601
602 u32 _r_d;
603
604 u8 stp_sas_addr[8];
605
606 struct dev_to_host_fis fis;
607
608 u32 _r_e;
609
610 u8 affil_stp_ini_addr[8];
611
612 __be32 crc;
613} __attribute__ ((packed));
614
615struct smp_resp {
616 u8 frame_type;
617 u8 function;
618 u8 result;
619 u8 reserved;
620 union {
621 struct report_general_resp rg;
622 struct discover_resp disc;
623 struct report_phy_sata_resp rps;
624 };
625} __attribute__ ((packed));
626
627#else
628#error "Bitfield order not defined!"
629#endif
630
631#endif /* _SAS_H_ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index c60b8ff2f5..84a6d5fe09 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -25,13 +25,6 @@ extern const unsigned char scsi_command_size[8];
25#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] 25#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7]
26 26
27/* 27/*
28 * SCSI device types
29 */
30
31#define MAX_SCSI_DEVICE_CODE 15
32extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
33
34/*
35 * Special value for scanning to specify scanning or rescanning of all 28 * Special value for scanning to specify scanning or rescanning of all
36 * possible channels, (target) ids, or luns on a given shost. 29 * possible channels, (target) ids, or luns on a given shost.
37 */ 30 */
@@ -225,6 +218,9 @@ static inline int scsi_status_is_good(int status)
225#define TYPE_RBC 0x0e 218#define TYPE_RBC 0x0e
226#define TYPE_NO_LUN 0x7f 219#define TYPE_NO_LUN 0x7f
227 220
221/* Returns a human-readable name for the device */
222extern const char * scsi_device_type(unsigned type);
223
228/* 224/*
229 * standard mode-select header prepended to all mode-select commands 225 * standard mode-select header prepended to all mode-select commands
230 */ 226 */
@@ -433,4 +429,10 @@ struct scsi_lun {
433/* Used to obtain the PCI location of a device */ 429/* Used to obtain the PCI location of a device */
434#define SCSI_IOCTL_GET_PCI 0x5387 430#define SCSI_IOCTL_GET_PCI 0x5387
435 431
432/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
433static inline u32 scsi_to_u32(u8 *ptr)
434{
435 return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
436}
437
436#endif /* _SCSI_SCSI_H */ 438#endif /* _SCSI_SCSI_H */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index e46cd404bd..be117f812d 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -58,9 +58,7 @@ struct scsi_cmnd {
58 int timeout_per_command; 58 int timeout_per_command;
59 59
60 unsigned char cmd_len; 60 unsigned char cmd_len;
61 unsigned char old_cmd_len;
62 enum dma_data_direction sc_data_direction; 61 enum dma_data_direction sc_data_direction;
63 enum dma_data_direction sc_old_data_direction;
64 62
65 /* These elements define the operation we are about to perform */ 63 /* These elements define the operation we are about to perform */
66#define MAX_COMMAND_SIZE 16 64#define MAX_COMMAND_SIZE 16
@@ -71,18 +69,11 @@ struct scsi_cmnd {
71 void *request_buffer; /* Actual requested buffer */ 69 void *request_buffer; /* Actual requested buffer */
72 70
73 /* These elements define the operation we ultimately want to perform */ 71 /* These elements define the operation we ultimately want to perform */
74 unsigned char data_cmnd[MAX_COMMAND_SIZE];
75 unsigned short old_use_sg; /* We save use_sg here when requesting
76 * sense info */
77 unsigned short use_sg; /* Number of pieces of scatter-gather */ 72 unsigned short use_sg; /* Number of pieces of scatter-gather */
78 unsigned short sglist_len; /* size of malloc'd scatter-gather list */ 73 unsigned short sglist_len; /* size of malloc'd scatter-gather list */
79 unsigned bufflen; /* Size of data buffer */
80 void *buffer; /* Data buffer */
81 74
82 unsigned underflow; /* Return error if less than 75 unsigned underflow; /* Return error if less than
83 this amount is transferred */ 76 this amount is transferred */
84 unsigned old_underflow; /* save underflow here when reusing the
85 * command for error handling */
86 77
87 unsigned transfersize; /* How much we are guaranteed to 78 unsigned transfersize; /* How much we are guaranteed to
88 transfer with each SCSI transfer 79 transfer with each SCSI transfer
@@ -127,23 +118,9 @@ struct scsi_cmnd {
127 unsigned long pid; /* Process ID, starts at 0. Unique per host. */ 118 unsigned long pid; /* Process ID, starts at 0. Unique per host. */
128}; 119};
129 120
130/*
131 * These are the values that scsi_cmd->state can take.
132 */
133#define SCSI_STATE_TIMEOUT 0x1000
134#define SCSI_STATE_FINISHED 0x1001
135#define SCSI_STATE_FAILED 0x1002
136#define SCSI_STATE_QUEUED 0x1003
137#define SCSI_STATE_UNUSED 0x1006
138#define SCSI_STATE_DISCONNECTING 0x1008
139#define SCSI_STATE_INITIALIZING 0x1009
140#define SCSI_STATE_BHQUEUE 0x100a
141#define SCSI_STATE_MLQUEUE 0x100b
142
143
144extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 121extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
145extern void scsi_put_command(struct scsi_cmnd *); 122extern void scsi_put_command(struct scsi_cmnd *);
146extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 123extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
147extern void scsi_finish_command(struct scsi_cmnd *cmd); 124extern void scsi_finish_command(struct scsi_cmnd *cmd);
148extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd); 125extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
149 126
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index a42efd6e4b..39c6f8cc20 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -16,6 +16,7 @@ struct scsi_target;
16struct Scsi_Host; 16struct Scsi_Host;
17struct scsi_host_cmd_pool; 17struct scsi_host_cmd_pool;
18struct scsi_transport_template; 18struct scsi_transport_template;
19struct blk_queue_tags;
19 20
20 21
21/* 22/*
@@ -466,6 +467,12 @@ struct Scsi_Host {
466 struct scsi_transport_template *transportt; 467 struct scsi_transport_template *transportt;
467 468
468 /* 469 /*
470 * area to keep a shared tag map (if needed, will be
471 * NULL if not)
472 */
473 struct blk_queue_tag *bqt;
474
475 /*
469 * The following two fields are protected with host_lock; 476 * The following two fields are protected with host_lock;
470 * however, eh routines can safely access during eh processing 477 * however, eh routines can safely access during eh processing
471 * without acquiring the lock. 478 * without acquiring the lock.
@@ -542,6 +549,9 @@ struct Scsi_Host {
542 */ 549 */
543 unsigned ordered_tag:1; 550 unsigned ordered_tag:1;
544 551
552 /* task mgmt function in progress */
553 unsigned tmf_in_progress:1;
554
545 /* 555 /*
546 * Optional work queue to be utilized by the transport 556 * Optional work queue to be utilized by the transport
547 */ 557 */
@@ -619,7 +629,8 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
619{ 629{
620 return shost->shost_state == SHOST_RECOVERY || 630 return shost->shost_state == SHOST_RECOVERY ||
621 shost->shost_state == SHOST_CANCEL_RECOVERY || 631 shost->shost_state == SHOST_CANCEL_RECOVERY ||
622 shost->shost_state == SHOST_DEL_RECOVERY; 632 shost->shost_state == SHOST_DEL_RECOVERY ||
633 shost->tmf_in_progress;
623} 634}
624 635
625extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *); 636extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
new file mode 100644
index 0000000000..8c1470cc82
--- /dev/null
+++ b/include/scsi/scsi_netlink.h
@@ -0,0 +1,87 @@
1/*
2 * SCSI Transport Netlink Interface
3 * Used for the posting of outbound SCSI transport events
4 *
5 * Copyright (C) 2006 James Smart, Emulex Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef SCSI_NETLINK_H
23#define SCSI_NETLINK_H
24
25/*
26 * This file intended to be included by both kernel and user space
27 */
28
29/* Single Netlink Message type to send all SCSI Transport messages */
30#define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
31
32/* SCSI Transport Broadcast Groups */
33 /* leaving groups 0 and 1 unassigned */
34#define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
35#define SCSI_NL_GRP_CNT 3
36
37
38/* SCSI_TRANSPORT_MSG event message header */
39struct scsi_nl_hdr {
40 uint8_t version;
41 uint8_t transport;
42 uint16_t magic;
43 uint16_t msgtype;
44 uint16_t msglen;
45} __attribute__((aligned(sizeof(uint64_t))));
46
47/* scsi_nl_hdr->version value */
48#define SCSI_NL_VERSION 1
49
50/* scsi_nl_hdr->magic value */
51#define SCSI_NL_MAGIC 0xA1B2
52
53/* scsi_nl_hdr->transport value */
54#define SCSI_NL_TRANSPORT 0
55#define SCSI_NL_TRANSPORT_FC 1
56#define SCSI_NL_MAX_TRANSPORTS 2
57
58/* scsi_nl_hdr->msgtype values are defined in each transport */
59
60
61/*
62 * Vendor ID:
63 * If transports post vendor-unique events, they must pass a well-known
64 * 32-bit vendor identifier. This identifier consists of 8 bits indicating
65 * the "type" of identifier contained, and 24 bits of id data.
66 *
67 * Identifiers for each type:
68 * PCI : ID data is the 16 bit PCI Registered Vendor ID
69 */
70#define SCSI_NL_VID_TYPE_SHIFT 56
71#define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
72#define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
73#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
74
75
76#define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
77 { \
78 (hdr)->version = SCSI_NL_VERSION; \
79 (hdr)->transport = t; \
80 (hdr)->magic = SCSI_NL_MAGIC; \
81 (hdr)->msgtype = mtype; \
82 (hdr)->msglen = mlen; \
83 }
84
85
86#endif /* SCSI_NETLINK_H */
87
diff --git a/include/scsi/scsi_netlink_fc.h b/include/scsi/scsi_netlink_fc.h
new file mode 100644
index 0000000000..cbf76e4797
--- /dev/null
+++ b/include/scsi/scsi_netlink_fc.h
@@ -0,0 +1,71 @@
1/*
2 * FC Transport Netlink Interface
3 *
4 * Copyright (C) 2006 James Smart, Emulex Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21#ifndef SCSI_NETLINK_FC_H
22#define SCSI_NETLINK_FC_H
23
24#include <scsi/scsi_netlink.h>
25
26/*
27 * This file intended to be included by both kernel and user space
28 */
29
30/*
31 * FC Transport Message Types
32 */
33 /* kernel -> user */
34#define FC_NL_ASYNC_EVENT 0x0100
35 /* user -> kernel */
36/* none */
37
38
39/*
40 * Message Structures :
41 */
42
43/* macro to round up message lengths to 8byte boundary */
44#define FC_NL_MSGALIGN(len) (((len) + 7) & ~7)
45
46
47/*
48 * FC Transport Broadcast Event Message :
49 * FC_NL_ASYNC_EVENT
50 *
51 * Note: if Vendor Unique message, &event_data will be start of
52 * vendor unique payload, and the length of the payload is
53 * per event_datalen
54 *
55 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
56 * formatting requirements specified in scsi_netlink.h
57 */
58struct fc_nl_event {
59 struct scsi_nl_hdr snlh; /* must be 1st element ! */
60 uint64_t seconds;
61 uint64_t vendor_id;
62 uint16_t host_no;
63 uint16_t event_datalen;
64 uint32_t event_num;
65 uint32_t event_code;
66 uint32_t event_data;
67} __attribute__((aligned(sizeof(uint64_t))));
68
69
70#endif /* SCSI_NETLINK_FC_H */
71
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index e47e36a4ef..d04d05adfa 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -4,6 +4,7 @@
4#include <linux/blkdev.h> 4#include <linux/blkdev.h>
5#include <scsi/scsi_cmnd.h> 5#include <scsi/scsi_cmnd.h>
6#include <scsi/scsi_device.h> 6#include <scsi/scsi_device.h>
7#include <scsi/scsi_host.h>
7 8
8 9
9#define MSG_SIMPLE_TAG 0x20 10#define MSG_SIMPLE_TAG 0x20
@@ -66,7 +67,8 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
66 return; 67 return;
67 68
68 if (!blk_queue_tagged(sdev->request_queue)) 69 if (!blk_queue_tagged(sdev->request_queue))
69 blk_queue_init_tags(sdev->request_queue, depth, NULL); 70 blk_queue_init_tags(sdev->request_queue, depth,
71 sdev->host->bqt);
70 72
71 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 73 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
72} 74}
@@ -131,4 +133,15 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag)
131 return sdev->current_cmnd; 133 return sdev->current_cmnd;
132} 134}
133 135
136/**
137 * scsi_init_shared_tag_map - create a shared tag map
138 * @shost: the host to share the tag map among all devices
139 * @depth: the total depth of the map
140 */
141static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
142{
143 shost->bqt = blk_init_tags(depth);
144 return shost->bqt ? 0 : -ENOMEM;
145}
146
134#endif /* _SCSI_SCSI_TCQ_H */ 147#endif /* _SCSI_SCSI_TCQ_H */
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 6d28b03176..fd35232337 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -29,6 +29,7 @@
29 29
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <scsi/scsi.h> 31#include <scsi/scsi.h>
32#include <scsi/scsi_netlink.h>
32 33
33struct scsi_transport_template; 34struct scsi_transport_template;
34 35
@@ -194,6 +195,7 @@ struct fc_rport { /* aka fc_starget_attrs */
194 u32 roles; 195 u32 roles;
195 enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */ 196 enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */
196 u32 scsi_target_id; 197 u32 scsi_target_id;
198 u32 fast_io_fail_tmo;
197 199
198 /* exported data */ 200 /* exported data */
199 void *dd_data; /* Used for driver-specific storage */ 201 void *dd_data; /* Used for driver-specific storage */
@@ -206,6 +208,7 @@ struct fc_rport { /* aka fc_starget_attrs */
206 struct device dev; 208 struct device dev;
207 struct work_struct dev_loss_work; 209 struct work_struct dev_loss_work;
208 struct work_struct scan_work; 210 struct work_struct scan_work;
211 struct work_struct fail_io_work;
209 struct work_struct stgt_delete_work; 212 struct work_struct stgt_delete_work;
210 struct work_struct rport_delete_work; 213 struct work_struct rport_delete_work;
211} __attribute__((aligned(sizeof(unsigned long)))); 214} __attribute__((aligned(sizeof(unsigned long))));
@@ -284,6 +287,30 @@ struct fc_host_statistics {
284 287
285 288
286/* 289/*
290 * FC Event Codes - Polled and Async, following FC HBAAPI v2.0 guidelines
291 */
292
293/*
294 * fc_host_event_code: If you alter this, you also need to alter
295 * scsi_transport_fc.c (for the ascii descriptions).
296 */
297enum fc_host_event_code {
298 FCH_EVT_LIP = 0x1,
299 FCH_EVT_LINKUP = 0x2,
300 FCH_EVT_LINKDOWN = 0x3,
301 FCH_EVT_LIPRESET = 0x4,
302 FCH_EVT_RSCN = 0x5,
303 FCH_EVT_ADAPTER_CHANGE = 0x103,
304 FCH_EVT_PORT_UNKNOWN = 0x200,
305 FCH_EVT_PORT_OFFLINE = 0x201,
306 FCH_EVT_PORT_ONLINE = 0x202,
307 FCH_EVT_PORT_FABRIC = 0x204,
308 FCH_EVT_LINK_UNKNOWN = 0x500,
309 FCH_EVT_VENDOR_UNIQUE = 0xffff,
310};
311
312
313/*
287 * FC Local Port (Host) Attributes 314 * FC Local Port (Host) Attributes
288 * 315 *
289 * Attributes are based on HBAAPI V2.0 definitions. 316 * Attributes are based on HBAAPI V2.0 definitions.
@@ -312,7 +339,6 @@ struct fc_host_attrs {
312 u64 permanent_port_name; 339 u64 permanent_port_name;
313 u32 supported_classes; 340 u32 supported_classes;
314 u8 supported_fc4s[FC_FC4_LIST_SIZE]; 341 u8 supported_fc4s[FC_FC4_LIST_SIZE];
315 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
316 u32 supported_speeds; 342 u32 supported_speeds;
317 u32 maxframe_size; 343 u32 maxframe_size;
318 char serial_number[FC_SERIAL_NUMBER_SIZE]; 344 char serial_number[FC_SERIAL_NUMBER_SIZE];
@@ -324,6 +350,8 @@ struct fc_host_attrs {
324 u8 active_fc4s[FC_FC4_LIST_SIZE]; 350 u8 active_fc4s[FC_FC4_LIST_SIZE];
325 u32 speed; 351 u32 speed;
326 u64 fabric_name; 352 u64 fabric_name;
353 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
354 char system_hostname[FC_SYMBOLIC_NAME_SIZE];
327 355
328 /* Private (Transport-managed) Attributes */ 356 /* Private (Transport-managed) Attributes */
329 enum fc_tgtid_binding_type tgtid_bind_type; 357 enum fc_tgtid_binding_type tgtid_bind_type;
@@ -354,8 +382,6 @@ struct fc_host_attrs {
354 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes) 382 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes)
355#define fc_host_supported_fc4s(x) \ 383#define fc_host_supported_fc4s(x) \
356 (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s) 384 (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s)
357#define fc_host_symbolic_name(x) \
358 (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name)
359#define fc_host_supported_speeds(x) \ 385#define fc_host_supported_speeds(x) \
360 (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds) 386 (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds)
361#define fc_host_maxframe_size(x) \ 387#define fc_host_maxframe_size(x) \
@@ -374,6 +400,10 @@ struct fc_host_attrs {
374 (((struct fc_host_attrs *)(x)->shost_data)->speed) 400 (((struct fc_host_attrs *)(x)->shost_data)->speed)
375#define fc_host_fabric_name(x) \ 401#define fc_host_fabric_name(x) \
376 (((struct fc_host_attrs *)(x)->shost_data)->fabric_name) 402 (((struct fc_host_attrs *)(x)->shost_data)->fabric_name)
403#define fc_host_symbolic_name(x) \
404 (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name)
405#define fc_host_system_hostname(x) \
406 (((struct fc_host_attrs *)(x)->shost_data)->system_hostname)
377#define fc_host_tgtid_bind_type(x) \ 407#define fc_host_tgtid_bind_type(x) \
378 (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type) 408 (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type)
379#define fc_host_rports(x) \ 409#define fc_host_rports(x) \
@@ -409,12 +439,17 @@ struct fc_function_template {
409 void (*get_host_active_fc4s)(struct Scsi_Host *); 439 void (*get_host_active_fc4s)(struct Scsi_Host *);
410 void (*get_host_speed)(struct Scsi_Host *); 440 void (*get_host_speed)(struct Scsi_Host *);
411 void (*get_host_fabric_name)(struct Scsi_Host *); 441 void (*get_host_fabric_name)(struct Scsi_Host *);
442 void (*get_host_symbolic_name)(struct Scsi_Host *);
443 void (*set_host_system_hostname)(struct Scsi_Host *);
412 444
413 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); 445 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
414 void (*reset_fc_host_stats)(struct Scsi_Host *); 446 void (*reset_fc_host_stats)(struct Scsi_Host *);
415 447
416 int (*issue_fc_host_lip)(struct Scsi_Host *); 448 int (*issue_fc_host_lip)(struct Scsi_Host *);
417 449
450 void (*dev_loss_tmo_callbk)(struct fc_rport *);
451 void (*terminate_rport_io)(struct fc_rport *);
452
418 /* allocation lengths for host-specific data */ 453 /* allocation lengths for host-specific data */
419 u32 dd_fcrport_size; 454 u32 dd_fcrport_size;
420 455
@@ -445,7 +480,6 @@ struct fc_function_template {
445 unsigned long show_host_permanent_port_name:1; 480 unsigned long show_host_permanent_port_name:1;
446 unsigned long show_host_supported_classes:1; 481 unsigned long show_host_supported_classes:1;
447 unsigned long show_host_supported_fc4s:1; 482 unsigned long show_host_supported_fc4s:1;
448 unsigned long show_host_symbolic_name:1;
449 unsigned long show_host_supported_speeds:1; 483 unsigned long show_host_supported_speeds:1;
450 unsigned long show_host_maxframe_size:1; 484 unsigned long show_host_maxframe_size:1;
451 unsigned long show_host_serial_number:1; 485 unsigned long show_host_serial_number:1;
@@ -456,6 +490,8 @@ struct fc_function_template {
456 unsigned long show_host_active_fc4s:1; 490 unsigned long show_host_active_fc4s:1;
457 unsigned long show_host_speed:1; 491 unsigned long show_host_speed:1;
458 unsigned long show_host_fabric_name:1; 492 unsigned long show_host_fabric_name:1;
493 unsigned long show_host_symbolic_name:1;
494 unsigned long show_host_system_hostname:1;
459}; 495};
460 496
461 497
@@ -491,6 +527,25 @@ fc_remote_port_chkready(struct fc_rport *rport)
491 return result; 527 return result;
492} 528}
493 529
530static inline u64 wwn_to_u64(u8 *wwn)
531{
532 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
533 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
534 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
535 (u64)wwn[6] << 8 | (u64)wwn[7];
536}
537
538static inline void u64_to_wwn(u64 inm, u8 *wwn)
539{
540 wwn[0] = (inm >> 56) & 0xff;
541 wwn[1] = (inm >> 48) & 0xff;
542 wwn[2] = (inm >> 40) & 0xff;
543 wwn[3] = (inm >> 32) & 0xff;
544 wwn[4] = (inm >> 24) & 0xff;
545 wwn[5] = (inm >> 16) & 0xff;
546 wwn[6] = (inm >> 8) & 0xff;
547 wwn[7] = inm & 0xff;
548}
494 549
495struct scsi_transport_template *fc_attach_transport( 550struct scsi_transport_template *fc_attach_transport(
496 struct fc_function_template *); 551 struct fc_function_template *);
@@ -501,13 +556,14 @@ struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost,
501void fc_remote_port_delete(struct fc_rport *rport); 556void fc_remote_port_delete(struct fc_rport *rport);
502void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); 557void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles);
503int scsi_is_fc_rport(const struct device *); 558int scsi_is_fc_rport(const struct device *);
504 559u32 fc_get_event_number(void);
505static inline u64 wwn_to_u64(u8 *wwn) 560void fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
506{ 561 enum fc_host_event_code event_code, u32 event_data);
507 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 | 562void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
508 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 | 563 u32 data_len, char * data_buf, u64 vendor_id);
509 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 | 564 /* Note: when specifying vendor_id to fc_host_post_vendor_event()
510 (u64)wwn[6] << 8 | (u64)wwn[7]; 565 * be sure to read the Vendor Type and ID formatting requirements
511} 566 * specified in scsi_netlink.h
567 */
512 568
513#endif /* SCSI_TRANSPORT_FC_H */ 569#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index b684426a59..39e833260b 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -34,6 +34,7 @@ struct iscsi_cls_conn;
34struct iscsi_conn; 34struct iscsi_conn;
35struct iscsi_cmd_task; 35struct iscsi_cmd_task;
36struct iscsi_mgmt_task; 36struct iscsi_mgmt_task;
37struct sockaddr;
37 38
38/** 39/**
39 * struct iscsi_transport - iSCSI Transport template 40 * struct iscsi_transport - iSCSI Transport template
@@ -46,13 +47,16 @@ struct iscsi_mgmt_task;
46 * @bind_conn: associate this connection with existing iSCSI session 47 * @bind_conn: associate this connection with existing iSCSI session
47 * and specified transport descriptor 48 * and specified transport descriptor
48 * @destroy_conn: destroy inactive iSCSI connection 49 * @destroy_conn: destroy inactive iSCSI connection
49 * @set_param: set iSCSI Data-Path operational parameter 50 * @set_param: set iSCSI parameter. Return 0 on success, -ENODATA
51 * when param is not supported, and a -Exx value on other
52 * error.
53 * @get_param get iSCSI parameter. Must return number of bytes
54 * copied to buffer on success, -ENODATA when param
55 * is not supported, and a -Exx value on other error
50 * @start_conn: set connection to be operational 56 * @start_conn: set connection to be operational
51 * @stop_conn: suspend/recover/terminate connection 57 * @stop_conn: suspend/recover/terminate connection
52 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text. 58 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
53 * @session_recovery_timedout: notify LLD a block during recovery timed out 59 * @session_recovery_timedout: notify LLD a block during recovery timed out
54 * @suspend_conn_recv: susepend the recv side of the connection
55 * @termincate_conn: destroy socket connection. Called with mutex lock.
56 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs. 60 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs.
57 * Called from queuecommand with session lock held. 61 * Called from queuecommand with session lock held.
58 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs. 62 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs.
@@ -97,21 +101,15 @@ struct iscsi_transport {
97 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag); 101 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag);
98 void (*destroy_conn) (struct iscsi_cls_conn *conn); 102 void (*destroy_conn) (struct iscsi_cls_conn *conn);
99 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, 103 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param,
100 uint32_t value); 104 char *buf, int buflen);
101 int (*get_conn_param) (struct iscsi_cls_conn *conn, 105 int (*get_conn_param) (struct iscsi_cls_conn *conn,
102 enum iscsi_param param, uint32_t *value); 106 enum iscsi_param param, char *buf);
103 int (*get_session_param) (struct iscsi_cls_session *session, 107 int (*get_session_param) (struct iscsi_cls_session *session,
104 enum iscsi_param param, uint32_t *value); 108 enum iscsi_param param, char *buf);
105 int (*get_conn_str_param) (struct iscsi_cls_conn *conn,
106 enum iscsi_param param, char *buf);
107 int (*get_session_str_param) (struct iscsi_cls_session *session,
108 enum iscsi_param param, char *buf);
109 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 109 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
110 char *data, uint32_t data_size); 110 char *data, uint32_t data_size);
111 void (*get_stats) (struct iscsi_cls_conn *conn, 111 void (*get_stats) (struct iscsi_cls_conn *conn,
112 struct iscsi_stats *stats); 112 struct iscsi_stats *stats);
113 void (*suspend_conn_recv) (struct iscsi_conn *conn);
114 void (*terminate_conn) (struct iscsi_conn *conn);
115 void (*init_cmd_task) (struct iscsi_cmd_task *ctask); 113 void (*init_cmd_task) (struct iscsi_cmd_task *ctask);
116 void (*init_mgmt_task) (struct iscsi_conn *conn, 114 void (*init_mgmt_task) (struct iscsi_conn *conn,
117 struct iscsi_mgmt_task *mtask, 115 struct iscsi_mgmt_task *mtask,
@@ -127,6 +125,8 @@ struct iscsi_transport {
127 uint64_t *ep_handle); 125 uint64_t *ep_handle);
128 int (*ep_poll) (uint64_t ep_handle, int timeout_ms); 126 int (*ep_poll) (uint64_t ep_handle, int timeout_ms);
129 void (*ep_disconnect) (uint64_t ep_handle); 127 void (*ep_disconnect) (uint64_t ep_handle);
128 int (*tgt_dscvr) (enum iscsi_tgt_dscvr type, uint32_t host_no,
129 uint32_t enable, struct sockaddr *dst_addr);
130}; 130};
131 131
132/* 132/*
@@ -155,13 +155,6 @@ struct iscsi_cls_conn {
155 struct iscsi_transport *transport; 155 struct iscsi_transport *transport;
156 uint32_t cid; /* connection id */ 156 uint32_t cid; /* connection id */
157 157
158 /* portal/group values we got during discovery */
159 char *persistent_address;
160 int persistent_port;
161 /* portal/group values we are currently using */
162 char *address;
163 int port;
164
165 int active; /* must be accessed with the connlock */ 158 int active; /* must be accessed with the connlock */
166 struct device dev; /* sysfs transport/container device */ 159 struct device dev; /* sysfs transport/container device */
167 struct mempool_zone *z_error; 160 struct mempool_zone *z_error;
@@ -185,16 +178,11 @@ struct iscsi_cls_session {
185 struct list_head host_list; 178 struct list_head host_list;
186 struct iscsi_transport *transport; 179 struct iscsi_transport *transport;
187 180
188 /* iSCSI values used as unique id by userspace. */
189 char *targetname;
190 int tpgt;
191
192 /* recovery fields */ 181 /* recovery fields */
193 int recovery_tmo; 182 int recovery_tmo;
194 struct work_struct recovery_work; 183 struct work_struct recovery_work;
195 184
196 int target_id; 185 int target_id;
197 int channel;
198 186
199 int sid; /* session id */ 187 int sid; /* session id */
200 void *dd_data; /* LLD private data */ 188 void *dd_data; /* LLD private data */
@@ -207,8 +195,10 @@ struct iscsi_cls_session {
207#define iscsi_session_to_shost(_session) \ 195#define iscsi_session_to_shost(_session) \
208 dev_to_shost(_session->dev.parent) 196 dev_to_shost(_session->dev.parent)
209 197
198#define starget_to_session(_stgt) \
199 iscsi_dev_to_session(_stgt->dev.parent)
200
210struct iscsi_host { 201struct iscsi_host {
211 int next_target_id;
212 struct list_head sessions; 202 struct list_head sessions;
213 struct mutex mutex; 203 struct mutex mutex;
214}; 204};
@@ -216,8 +206,17 @@ struct iscsi_host {
216/* 206/*
217 * session and connection functions that can be used by HW iSCSI LLDs 207 * session and connection functions that can be used by HW iSCSI LLDs
218 */ 208 */
209extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost,
210 struct iscsi_transport *transport);
211extern int iscsi_add_session(struct iscsi_cls_session *session,
212 unsigned int target_id);
213extern int iscsi_if_create_session_done(struct iscsi_cls_conn *conn);
214extern int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn);
219extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, 215extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
220 struct iscsi_transport *t, int channel); 216 struct iscsi_transport *t,
217 unsigned int target_id);
218extern void iscsi_remove_session(struct iscsi_cls_session *session);
219extern void iscsi_free_session(struct iscsi_cls_session *session);
221extern int iscsi_destroy_session(struct iscsi_cls_session *session); 220extern int iscsi_destroy_session(struct iscsi_cls_session *session);
222extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, 221extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
223 uint32_t cid); 222 uint32_t cid);
@@ -225,4 +224,5 @@ extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
225extern void iscsi_unblock_session(struct iscsi_cls_session *session); 224extern void iscsi_unblock_session(struct iscsi_cls_session *session);
226extern void iscsi_block_session(struct iscsi_cls_session *session); 225extern void iscsi_block_session(struct iscsi_cls_session *session);
227 226
227
228#endif 228#endif
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 93cfb4bf42..53024377f3 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/transport_class.h> 4#include <linux/transport_class.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/mutex.h>
6 7
7struct scsi_transport_template; 8struct scsi_transport_template;
8struct sas_rphy; 9struct sas_rphy;
@@ -23,15 +24,23 @@ enum sas_protocol {
23}; 24};
24 25
25enum sas_linkrate { 26enum sas_linkrate {
26 SAS_LINK_RATE_UNKNOWN, 27 /* These Values are defined in the SAS standard */
27 SAS_PHY_DISABLED, 28 SAS_LINK_RATE_UNKNOWN = 0,
28 SAS_LINK_RATE_FAILED, 29 SAS_PHY_DISABLED = 1,
29 SAS_SATA_SPINUP_HOLD, 30 SAS_PHY_RESET_PROBLEM = 2,
30 SAS_SATA_PORT_SELECTOR, 31 SAS_SATA_SPINUP_HOLD = 3,
31 SAS_LINK_RATE_1_5_GBPS, 32 SAS_SATA_PORT_SELECTOR = 4,
32 SAS_LINK_RATE_3_0_GBPS, 33 SAS_PHY_RESET_IN_PROGRESS = 5,
33 SAS_LINK_RATE_6_0_GBPS, 34 SAS_LINK_RATE_1_5_GBPS = 8,
34 SAS_LINK_VIRTUAL, 35 SAS_LINK_RATE_G1 = SAS_LINK_RATE_1_5_GBPS,
36 SAS_LINK_RATE_3_0_GBPS = 9,
37 SAS_LINK_RATE_G2 = SAS_LINK_RATE_3_0_GBPS,
38 SAS_LINK_RATE_6_0_GBPS = 10,
39 /* These are virtual to the transport class and may never
40 * be signalled normally since the standard defined field
41 * is only 4 bits */
42 SAS_LINK_RATE_FAILED = 0x10,
43 SAS_PHY_VIRTUAL = 0x11,
35}; 44};
36 45
37struct sas_identify { 46struct sas_identify {
@@ -55,10 +64,6 @@ struct sas_phy {
55 enum sas_linkrate minimum_linkrate; 64 enum sas_linkrate minimum_linkrate;
56 enum sas_linkrate maximum_linkrate_hw; 65 enum sas_linkrate maximum_linkrate_hw;
57 enum sas_linkrate maximum_linkrate; 66 enum sas_linkrate maximum_linkrate;
58 u8 port_identifier;
59
60 /* internal state */
61 unsigned int local_attached : 1;
62 67
63 /* link error statistics */ 68 /* link error statistics */
64 u32 invalid_dword_count; 69 u32 invalid_dword_count;
@@ -66,8 +71,8 @@ struct sas_phy {
66 u32 loss_of_dword_sync_count; 71 u32 loss_of_dword_sync_count;
67 u32 phy_reset_problem_count; 72 u32 phy_reset_problem_count;
68 73
69 /* the other end of the link */ 74 /* for the list of phys belonging to a port */
70 struct sas_rphy *rphy; 75 struct list_head port_siblings;
71}; 76};
72 77
73#define dev_to_phy(d) \ 78#define dev_to_phy(d) \
@@ -106,6 +111,7 @@ struct sas_end_device {
106 111
107struct sas_expander_device { 112struct sas_expander_device {
108 int level; 113 int level;
114 int next_port_id;
109 115
110 #define SAS_EXPANDER_VENDOR_ID_LEN 8 116 #define SAS_EXPANDER_VENDOR_ID_LEN 8
111 char vendor_id[SAS_EXPANDER_VENDOR_ID_LEN+1]; 117 char vendor_id[SAS_EXPANDER_VENDOR_ID_LEN+1];
@@ -124,15 +130,42 @@ struct sas_expander_device {
124#define rphy_to_expander_device(r) \ 130#define rphy_to_expander_device(r) \
125 container_of((r), struct sas_expander_device, rphy) 131 container_of((r), struct sas_expander_device, rphy)
126 132
133struct sas_port {
134 struct device dev;
135
136 int port_identifier;
137 int num_phys;
138 /* port flags */
139 unsigned int is_backlink:1;
140
141 /* the other end of the link */
142 struct sas_rphy *rphy;
143
144 struct mutex phy_list_mutex;
145 struct list_head phy_list;
146};
147
148#define dev_to_sas_port(d) \
149 container_of((d), struct sas_port, dev)
150#define transport_class_to_sas_port(cdev) \
151 dev_to_sas_port((cdev)->dev)
152
153struct sas_phy_linkrates {
154 enum sas_linkrate maximum_linkrate;
155 enum sas_linkrate minimum_linkrate;
156};
157
127/* The functions by which the transport class and the driver communicate */ 158/* The functions by which the transport class and the driver communicate */
128struct sas_function_template { 159struct sas_function_template {
129 int (*get_linkerrors)(struct sas_phy *); 160 int (*get_linkerrors)(struct sas_phy *);
130 int (*get_enclosure_identifier)(struct sas_rphy *, u64 *); 161 int (*get_enclosure_identifier)(struct sas_rphy *, u64 *);
131 int (*get_bay_identifier)(struct sas_rphy *); 162 int (*get_bay_identifier)(struct sas_rphy *);
132 int (*phy_reset)(struct sas_phy *, int); 163 int (*phy_reset)(struct sas_phy *, int);
164 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *);
133}; 165};
134 166
135 167
168void sas_remove_children(struct device *);
136extern void sas_remove_host(struct Scsi_Host *); 169extern void sas_remove_host(struct Scsi_Host *);
137 170
138extern struct sas_phy *sas_phy_alloc(struct device *, int); 171extern struct sas_phy *sas_phy_alloc(struct device *, int);
@@ -141,13 +174,23 @@ extern int sas_phy_add(struct sas_phy *);
141extern void sas_phy_delete(struct sas_phy *); 174extern void sas_phy_delete(struct sas_phy *);
142extern int scsi_is_sas_phy(const struct device *); 175extern int scsi_is_sas_phy(const struct device *);
143 176
144extern struct sas_rphy *sas_end_device_alloc(struct sas_phy *); 177extern struct sas_rphy *sas_end_device_alloc(struct sas_port *);
145extern struct sas_rphy *sas_expander_alloc(struct sas_phy *, enum sas_device_type); 178extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type);
146void sas_rphy_free(struct sas_rphy *); 179void sas_rphy_free(struct sas_rphy *);
147extern int sas_rphy_add(struct sas_rphy *); 180extern int sas_rphy_add(struct sas_rphy *);
148extern void sas_rphy_delete(struct sas_rphy *); 181extern void sas_rphy_delete(struct sas_rphy *);
149extern int scsi_is_sas_rphy(const struct device *); 182extern int scsi_is_sas_rphy(const struct device *);
150 183
184struct sas_port *sas_port_alloc(struct device *, int);
185struct sas_port *sas_port_alloc_num(struct device *);
186int sas_port_add(struct sas_port *);
187void sas_port_free(struct sas_port *);
188void sas_port_delete(struct sas_port *);
189void sas_port_add_phy(struct sas_port *, struct sas_phy *);
190void sas_port_delete_phy(struct sas_port *, struct sas_phy *);
191void sas_port_mark_backlink(struct sas_port *);
192int scsi_is_sas_port(const struct device *);
193
151extern struct scsi_transport_template * 194extern struct scsi_transport_template *
152sas_attach_transport(struct sas_function_template *); 195sas_attach_transport(struct sas_function_template *);
153extern void sas_release_transport(struct scsi_transport_template *); 196extern void sas_release_transport(struct scsi_transport_template *);
@@ -164,4 +207,6 @@ scsi_is_sas_expander_device(struct device *dev)
164 rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE; 207 rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE;
165} 208}
166 209
210#define scsi_is_sas_phy_local(phy) scsi_is_host_device((phy)->dev.parent)
211
167#endif /* SCSI_TRANSPORT_SAS_H */ 212#endif /* SCSI_TRANSPORT_SAS_H */
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 302680c0c0..da180f7384 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -53,7 +53,8 @@ struct spi_transport_attrs {
53 unsigned int support_ius; /* support Information Units */ 53 unsigned int support_ius; /* support Information Units */
54 unsigned int support_qas; /* supports quick arbitration and selection */ 54 unsigned int support_qas; /* supports quick arbitration and selection */
55 /* Private Fields */ 55 /* Private Fields */
56 unsigned int dv_pending:1; /* Internal flag */ 56 unsigned int dv_pending:1; /* Internal flag: DV Requested */
57 unsigned int dv_in_progress:1; /* Internal: DV started */
57 struct mutex dv_mutex; /* semaphore to serialise dv */ 58 struct mutex dv_mutex; /* semaphore to serialise dv */
58}; 59};
59 60
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
new file mode 100644
index 0000000000..fd054a3443
--- /dev/null
+++ b/include/sound/Kbuild
@@ -0,0 +1,10 @@
1header-y += asound_fm.h
2header-y += hdsp.h
3header-y += hdspm.h
4header-y += sfnt_info.h
5header-y += sscape_ioctl.h
6
7unifdef-y += asequencer.h
8unifdef-y += asound.h
9unifdef-y += emu10k1.h
10unifdef-y += sb16_csp.h
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 446afc3ea2..4c43521cc4 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -27,6 +27,7 @@
27 27
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h>
30#include "pcm.h" 31#include "pcm.h"
31#include "control.h" 32#include "control.h"
32#include "info.h" 33#include "info.h"
@@ -140,6 +141,20 @@
140#define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */ 141#define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */
141#define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */ 142#define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */
142 143
144/* powerdown bits */
145#define AC97_PD_ADC_STATUS 0x0001 /* ADC status (RO) */
146#define AC97_PD_DAC_STATUS 0x0002 /* DAC status (RO) */
147#define AC97_PD_MIXER_STATUS 0x0004 /* Analog mixer status (RO) */
148#define AC97_PD_VREF_STATUS 0x0008 /* Vref status (RO) */
149#define AC97_PD_PR0 0x0100 /* Power down PCM ADCs and input MUX */
150#define AC97_PD_PR1 0x0200 /* Power down PCM front DAC */
151#define AC97_PD_PR2 0x0400 /* Power down Mixer (Vref still on) */
152#define AC97_PD_PR3 0x0800 /* Power down Mixer (Vref off) */
153#define AC97_PD_PR4 0x1000 /* Power down AC-Link */
154#define AC97_PD_PR5 0x2000 /* Disable internal clock usage */
155#define AC97_PD_PR6 0x4000 /* Headphone amplifier */
156#define AC97_PD_EAPD 0x8000 /* External Amplifer Power Down (EAPD) */
157
143/* extended audio ID bit defines */ 158/* extended audio ID bit defines */
144#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */ 159#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */
145#define AC97_EI_DRA 0x0002 /* Double rate supported */ 160#define AC97_EI_DRA 0x0002 /* Double rate supported */
@@ -265,6 +280,7 @@
265 280
266/* specific - Analog Devices */ 281/* specific - Analog Devices */
267#define AC97_AD_TEST 0x5a /* test register */ 282#define AC97_AD_TEST 0x5a /* test register */
283#define AC97_AD_TEST2 0x5c /* undocumented test register 2 */
268#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */ 284#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */
269#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */ 285#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */
270#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */ 286#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */
@@ -358,6 +374,7 @@
358#define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */ 374#define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */
359#define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */ 375#define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */
360#define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ 376#define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */
377#define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */
361 378
362/* ac97->flags */ 379/* ac97->flags */
363#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ 380#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */
@@ -490,6 +507,12 @@ struct snd_ac97 {
490 /* jack-sharing info */ 507 /* jack-sharing info */
491 unsigned char indep_surround; 508 unsigned char indep_surround;
492 unsigned char channel_mode; 509 unsigned char channel_mode;
510
511#ifdef CONFIG_SND_AC97_POWER_SAVE
512 unsigned int power_up; /* power states */
513 struct workqueue_struct *power_workq;
514 struct work_struct power_work;
515#endif
493 struct device dev; 516 struct device dev;
494}; 517};
495 518
@@ -531,6 +554,15 @@ unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
531void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 554void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
532int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 555int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
533int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); 556int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value);
557#ifdef CONFIG_SND_AC97_POWER_SAVE
558int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup);
559#else
560static inline int snd_ac97_update_power(struct snd_ac97 *ac97, int reg,
561 int powerup)
562{
563 return 0;
564}
565#endif
534#ifdef CONFIG_PM 566#ifdef CONFIG_PM
535void snd_ac97_suspend(struct snd_ac97 *ac97); 567void snd_ac97_suspend(struct snd_ac97 *ac97);
536void snd_ac97_resume(struct snd_ac97 *ac97); 568void snd_ac97_resume(struct snd_ac97 *ac97);
@@ -582,6 +614,7 @@ struct ac97_pcm {
582 copy_flag: 1, /* lowlevel driver must fill all entries */ 614 copy_flag: 1, /* lowlevel driver must fill all entries */
583 spdif: 1; /* spdif pcm */ 615 spdif: 1; /* spdif pcm */
584 unsigned short aslots; /* active slots */ 616 unsigned short aslots; /* active slots */
617 unsigned short cur_dbl; /* current double-rate state */
585 unsigned int rates; /* available rates */ 618 unsigned int rates; /* available rates */
586 struct { 619 struct {
587 unsigned short slots; /* driver input: requested AC97 slot numbers */ 620 unsigned short slots; /* driver input: requested AC97 slot numbers */
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 57af1fe7b3..c8de6f8333 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -179,14 +179,13 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ 179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) 180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
181 181
182int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value);
183
184/* for ease of use */ 182/* for ease of use */
185struct ad1848_mix_elem { 183struct ad1848_mix_elem {
186 const char *name; 184 const char *name;
187 int index; 185 int index;
188 int type; 186 int type;
189 unsigned long private_value; 187 unsigned long private_value;
188 unsigned int *tlv;
190}; 189};
191 190
192#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \ 191#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \
@@ -195,15 +194,26 @@ struct ad1848_mix_elem {
195 .type = AD1848_MIX_SINGLE, \ 194 .type = AD1848_MIX_SINGLE, \
196 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) } 195 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) }
197 196
197#define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
198{ .name = xname, \
199 .index = xindex, \
200 .type = AD1848_MIX_SINGLE, \
201 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \
202 .tlv = xtlv }
203
198#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 204#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
199{ .name = xname, \ 205{ .name = xname, \
200 .index = xindex, \ 206 .index = xindex, \
201 .type = AD1848_MIX_DOUBLE, \ 207 .type = AD1848_MIX_DOUBLE, \
202 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } 208 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
203 209
204static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c) 210#define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
205{ 211{ .name = xname, \
206 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); 212 .index = xindex, \
207} 213 .type = AD1848_MIX_DOUBLE, \
214 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
215 .tlv = xtlv }
216
217int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c);
208 218
209#endif /* __SOUND_AD1848_H */ 219#endif /* __SOUND_AD1848_H */
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index 3bf5911fe8..d0deca669b 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -32,38 +32,62 @@ struct snd_akm4xxx;
32struct snd_ak4xxx_ops { 32struct snd_ak4xxx_ops {
33 void (*lock)(struct snd_akm4xxx *ak, int chip); 33 void (*lock)(struct snd_akm4xxx *ak, int chip);
34 void (*unlock)(struct snd_akm4xxx *ak, int chip); 34 void (*unlock)(struct snd_akm4xxx *ak, int chip);
35 void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val); 35 void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg,
36 // unsigned char (*read)(struct snd_akm4xxx *ak, int chip, unsigned char reg); 36 unsigned char val);
37 void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate); 37 void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
38}; 38};
39 39
40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ 40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
41 41
42/* DAC label and channels */
43struct snd_akm4xxx_dac_channel {
44 char *name; /* mixer volume name */
45 unsigned int num_channels;
46};
47
48/* ADC labels and channels */
49struct snd_akm4xxx_adc_channel {
50 char *name; /* capture gain volume label */
51 char *switch_name; /* capture switch */
52 unsigned int num_channels;
53};
54
42struct snd_akm4xxx { 55struct snd_akm4xxx {
43 struct snd_card *card; 56 struct snd_card *card;
44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ 57 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */
45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */ 58 unsigned int num_dacs; /* AK4524 or AK4528 DACs */
46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ 59 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
47 unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image for IPGA (AK4528) */ 60 unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */
48 unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ 61 unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */
49 void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ 62 void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */
50 /* template should fill the following fields */ 63 /* template should fill the following fields */
51 unsigned int idx_offset; /* control index offset */ 64 unsigned int idx_offset; /* control index offset */
52 enum { 65 enum {
53 SND_AK4524, SND_AK4528, SND_AK4529, 66 SND_AK4524, SND_AK4528, SND_AK4529,
54 SND_AK4355, SND_AK4358, SND_AK4381 67 SND_AK4355, SND_AK4358, SND_AK4381,
68 SND_AK5365
55 } type; 69 } type;
70
71 /* (array) information of combined codecs */
72 struct snd_akm4xxx_dac_channel *dac_info;
73 struct snd_akm4xxx_adc_channel *adc_info;
74
56 struct snd_ak4xxx_ops ops; 75 struct snd_ak4xxx_ops ops;
57}; 76};
58 77
59void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val); 78void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg,
79 unsigned char val);
60void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state); 80void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
61void snd_akm4xxx_init(struct snd_akm4xxx *ak); 81void snd_akm4xxx_init(struct snd_akm4xxx *ak);
62int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak); 82int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
63 83
64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)] 84#define snd_akm4xxx_get(ak,chip,reg) \
65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val)) 85 (ak)->images[(chip) * 16 + (reg)]
66#define snd_akm4xxx_get_ipga(ak,chip,reg) (ak)->ipga_gain[chip][(reg)-4] 86#define snd_akm4xxx_set(ak,chip,reg,val) \
67#define snd_akm4xxx_set_ipga(ak,chip,reg,val) ((ak)->ipga_gain[chip][(reg)-4] = (val)) 87 ((ak)->images[(chip) * 16 + (reg)] = (val))
88#define snd_akm4xxx_get_vol(ak,chip,reg) \
89 (ak)->volumes[(chip) * 16 + (reg)]
90#define snd_akm4xxx_set_vol(ak,chip,reg,val) \
91 ((ak)->volumes[(chip) * 16 + (reg)] = (val))
68 92
69#endif /* __SOUND_AK4XXX_ADDA_H */ 93#endif /* __SOUND_AK4XXX_ADDA_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 41885f48ad..c1621c650a 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -688,7 +688,7 @@ struct snd_timer_tread {
688 * * 688 * *
689 ****************************************************************************/ 689 ****************************************************************************/
690 690
691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
692 692
693struct snd_ctl_card_info { 693struct snd_ctl_card_info {
694 int card; /* card number */ 694 int card; /* card number */
@@ -727,10 +727,15 @@ typedef int __bitwise snd_ctl_elem_iface_t;
727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
728#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) 728#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
729#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ 729#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
730#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<2) /* when was control changed */ 730#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
731#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
732#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
733#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
734#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
731#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ 735#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
732#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ 736#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
733#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ 737#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
738#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
734#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ 739#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
735#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ 740#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */
736#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ 741#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */
@@ -818,6 +823,12 @@ struct snd_ctl_elem_value {
818 unsigned char reserved[128-sizeof(struct timespec)]; 823 unsigned char reserved[128-sizeof(struct timespec)];
819}; 824};
820 825
826struct snd_ctl_tlv {
827 unsigned int numid; /* control element numeric identification */
828 unsigned int length; /* in bytes aligned to 4 */
829 unsigned int tlv[0]; /* first TLV */
830};
831
821enum { 832enum {
822 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 833 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
823 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), 834 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
@@ -831,6 +842,9 @@ enum {
831 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), 842 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
832 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), 843 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
833 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), 844 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
845 SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv),
846 SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv),
847 SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv),
834 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 848 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
835 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), 849 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
836 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 850 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
@@ -855,6 +869,7 @@ enum sndrv_ctl_event_type {
855#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ 869#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
856#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ 870#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
857#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 871#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
872#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
858#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 873#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
859 874
860struct snd_ctl_event { 875struct snd_ctl_event {
diff --git a/include/sound/control.h b/include/sound/control.h
index 2489b1eb01..1de148b0fd 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -30,6 +30,11 @@ struct snd_kcontrol;
30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); 30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
33typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol,
34 int op_flag, /* 0=read,1=write,-1=command */
35 unsigned int size,
36 unsigned int __user *tlv);
37
33 38
34struct snd_kcontrol_new { 39struct snd_kcontrol_new {
35 snd_ctl_elem_iface_t iface; /* interface identifier */ 40 snd_ctl_elem_iface_t iface; /* interface identifier */
@@ -42,6 +47,10 @@ struct snd_kcontrol_new {
42 snd_kcontrol_info_t *info; 47 snd_kcontrol_info_t *info;
43 snd_kcontrol_get_t *get; 48 snd_kcontrol_get_t *get;
44 snd_kcontrol_put_t *put; 49 snd_kcontrol_put_t *put;
50 union {
51 snd_kcontrol_tlv_rw_t *c;
52 unsigned int *p;
53 } tlv;
45 unsigned long private_value; 54 unsigned long private_value;
46}; 55};
47 56
@@ -58,6 +67,10 @@ struct snd_kcontrol {
58 snd_kcontrol_info_t *info; 67 snd_kcontrol_info_t *info;
59 snd_kcontrol_get_t *get; 68 snd_kcontrol_get_t *get;
60 snd_kcontrol_put_t *put; 69 snd_kcontrol_put_t *put;
70 union {
71 snd_kcontrol_tlv_rw_t *c;
72 unsigned int *p;
73 } tlv;
61 unsigned long private_value; 74 unsigned long private_value;
62 void *private_data; 75 void *private_data;
63 void (*private_free)(struct snd_kcontrol *kcontrol); 76 void (*private_free)(struct snd_kcontrol *kcontrol);
diff --git a/include/sound/core.h b/include/sound/core.h
index 5d184be0ff..b056ea925e 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -25,8 +25,8 @@
25#include <linux/sched.h> /* wake_up() */ 25#include <linux/sched.h> /* wake_up() */
26#include <linux/mutex.h> /* struct mutex */ 26#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/workqueue.h> /* struct workqueue_struct */
29#include <linux/pm.h> /* pm_message_t */ 28#include <linux/pm.h> /* pm_message_t */
29#include <linux/device.h>
30 30
31/* forward declarations */ 31/* forward declarations */
32#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
@@ -71,7 +71,6 @@ struct snd_device_ops {
71 int (*dev_free)(struct snd_device *dev); 71 int (*dev_free)(struct snd_device *dev);
72 int (*dev_register)(struct snd_device *dev); 72 int (*dev_register)(struct snd_device *dev);
73 int (*dev_disconnect)(struct snd_device *dev); 73 int (*dev_disconnect)(struct snd_device *dev);
74 int (*dev_unregister)(struct snd_device *dev);
75}; 74};
76 75
77struct snd_device { 76struct snd_device {
@@ -131,8 +130,8 @@ struct snd_card {
131 state */ 130 state */
132 spinlock_t files_lock; /* lock the files for this card */ 131 spinlock_t files_lock; /* lock the files for this card */
133 int shutdown; /* this card is going down */ 132 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct work_struct free_workq; /* for free in workqueue */
136 struct device *dev; 135 struct device *dev;
137 136
138#ifdef CONFIG_PM 137#ifdef CONFIG_PM
@@ -188,8 +187,7 @@ struct snd_minor {
188 int device; /* device number */ 187 int device; /* device number */
189 const struct file_operations *f_ops; /* file operations */ 188 const struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */ 189 void *private_data; /* private data for f_ops->open */
191 char name[0]; /* device name (keep at the end of 190 struct class_device *class_dev; /* class device for sysfs */
192 structure) */
193}; 191};
194 192
195/* sound.c */ 193/* sound.c */
@@ -204,6 +202,8 @@ int snd_register_device(int type, struct snd_card *card, int dev,
204 const char *name); 202 const char *name);
205int snd_unregister_device(int type, struct snd_card *card, int dev); 203int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type); 204void *snd_lookup_minor_data(unsigned int minor, int type);
205int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
206 const struct class_device_attribute *attr);
207 207
208#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
209int snd_register_oss_device(int type, struct snd_card *card, int dev, 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
@@ -246,7 +246,7 @@ struct snd_card *snd_card_new(int idx, const char *id,
246 struct module *module, int extra_size); 246 struct module *module, int extra_size);
247int snd_card_disconnect(struct snd_card *card); 247int snd_card_disconnect(struct snd_card *card);
248int snd_card_free(struct snd_card *card); 248int snd_card_free(struct snd_card *card);
249int snd_card_free_in_thread(struct snd_card *card); 249int snd_card_free_when_closed(struct snd_card *card);
250int snd_card_register(struct snd_card *card); 250int snd_card_register(struct snd_card *card);
251int snd_card_info_init(void); 251int snd_card_info_init(void);
252int snd_card_info_done(void); 252int snd_card_info_done(void);
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 80b2979c0c..685928e6f6 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1704,6 +1704,7 @@ struct snd_cs46xx {
1704 int acpi_port; 1704 int acpi_port;
1705 struct snd_kcontrol *eapd_switch; /* for amplifier hack */ 1705 struct snd_kcontrol *eapd_switch; /* for amplifier hack */
1706 int accept_valid; /* accept mmap valid (for OSS) */ 1706 int accept_valid; /* accept mmap valid (for OSS) */
1707 int in_suspend;
1707 1708
1708 struct gameport *gameport; 1709 struct gameport *gameport;
1709 1710
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 884bbf54cd..892e310c50 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1524,6 +1524,10 @@ struct snd_emu10k1_fx8010_control_gpr {
1524 unsigned int value[32]; /* initial values */ 1524 unsigned int value[32]; /* initial values */
1525 unsigned int min; /* minimum range */ 1525 unsigned int min; /* minimum range */
1526 unsigned int max; /* maximum range */ 1526 unsigned int max; /* maximum range */
1527 union {
1528 snd_kcontrol_tlv_rw_t *c;
1529 unsigned int *p;
1530 } tlv;
1527 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1531 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1528}; 1532};
1529 1533
diff --git a/include/sound/info.h b/include/sound/info.h
index 74f6996769..97ffc4fb99 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -71,7 +71,6 @@ struct snd_info_entry {
71 mode_t mode; 71 mode_t mode;
72 long size; 72 long size;
73 unsigned short content; 73 unsigned short content;
74 unsigned short disconnected: 1;
75 union { 74 union {
76 struct snd_info_entry_text text; 75 struct snd_info_entry_text text;
77 struct snd_info_entry_ops *ops; 76 struct snd_info_entry_ops *ops;
@@ -83,6 +82,8 @@ struct snd_info_entry {
83 void (*private_free)(struct snd_info_entry *entry); 82 void (*private_free)(struct snd_info_entry *entry);
84 struct proc_dir_entry *p; 83 struct proc_dir_entry *p;
85 struct mutex access; 84 struct mutex access;
85 struct list_head children;
86 struct list_head list;
86}; 87};
87 88
88#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 89#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
@@ -122,8 +123,8 @@ int snd_info_restore_text(struct snd_info_entry * entry);
122int snd_info_card_create(struct snd_card * card); 123int snd_info_card_create(struct snd_card * card);
123int snd_info_card_register(struct snd_card * card); 124int snd_info_card_register(struct snd_card * card);
124int snd_info_card_free(struct snd_card * card); 125int snd_info_card_free(struct snd_card * card);
126void snd_info_card_disconnect(struct snd_card * card);
125int snd_info_register(struct snd_info_entry * entry); 127int snd_info_register(struct snd_info_entry * entry);
126int snd_info_unregister(struct snd_info_entry * entry);
127 128
128/* for card drivers */ 129/* for card drivers */
129int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); 130int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
@@ -156,8 +157,8 @@ static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
156static inline int snd_info_card_create(struct snd_card * card) { return 0; } 157static inline int snd_info_card_create(struct snd_card * card) { return 0; }
157static inline int snd_info_card_register(struct snd_card * card) { return 0; } 158static inline int snd_info_card_register(struct snd_card * card) { return 0; }
158static inline int snd_info_card_free(struct snd_card * card) { return 0; } 159static inline int snd_info_card_free(struct snd_card * card) { return 0; }
160static inline void snd_info_card_disconnect(struct snd_card * card) { }
159static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } 161static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
160static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
161 162
162static inline int snd_card_proc_new(struct snd_card *card, const char *name, 163static inline int snd_card_proc_new(struct snd_card *card, const char *name,
163 struct snd_info_entry **entryp) { return -EINVAL; } 164 struct snd_info_entry **entryp) { return -EINVAL; }
diff --git a/include/sound/initval.h b/include/sound/initval.h
index d29e3d31d1..2ae76efc69 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -62,7 +62,8 @@ static int snd_legacy_find_free_irq(int *irq_table)
62{ 62{
63 while (*irq_table != -1) { 63 while (*irq_table != -1) {
64 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler, 64 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
65 SA_INTERRUPT, "ALSA Test IRQ", (void *) irq_table)) { 65 IRQF_DISABLED | IRQF_PROBE_SHARED, "ALSA Test IRQ",
66 (void *) irq_table)) {
66 free_irq(*irq_table, (void *) irq_table); 67 free_irq(*irq_table, (void *) irq_table);
67 return *irq_table; 68 return *irq_table;
68 } 69 }
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index f84d84993a..60d40b34ef 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -190,7 +190,7 @@ struct snd_pcm_ops {
190 190
191struct snd_pcm_file { 191struct snd_pcm_file {
192 struct snd_pcm_substream *substream; 192 struct snd_pcm_substream *substream;
193 struct snd_pcm_file *next; 193 int no_compat_mmap;
194}; 194};
195 195
196struct snd_pcm_hw_rule; 196struct snd_pcm_hw_rule;
@@ -384,7 +384,6 @@ struct snd_pcm_substream {
384 struct snd_info_entry *proc_prealloc_entry; 384 struct snd_info_entry *proc_prealloc_entry;
385#endif 385#endif
386 /* misc flags */ 386 /* misc flags */
387 unsigned int no_mmap_ctrl: 1;
388 unsigned int hw_opened: 1; 387 unsigned int hw_opened: 1;
389}; 388};
390 389
@@ -402,7 +401,6 @@ struct snd_pcm_str {
402 /* -- OSS things -- */ 401 /* -- OSS things -- */
403 struct snd_pcm_oss_stream oss; 402 struct snd_pcm_oss_stream oss;
404#endif 403#endif
405 struct snd_pcm_file *files;
406#ifdef CONFIG_SND_VERBOSE_PROCFS 404#ifdef CONFIG_SND_VERBOSE_PROCFS
407 struct snd_info_entry *proc_root; 405 struct snd_info_entry *proc_root;
408 struct snd_info_entry *proc_info_entry; 406 struct snd_info_entry *proc_info_entry;
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index a4f5545201..b5067d3c23 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -20,9 +20,10 @@
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * 22 *
23 */ 23 */
24 24
25#include <linux/videodev.h> 25#include <linux/videodev.h>
26#include <media/v4l2-dev.h>
26 27
27struct snd_tea575x; 28struct snd_tea575x;
28 29
diff --git a/include/sound/timer.h b/include/sound/timer.h
index 5ece2bf541..d42c083db1 100644
--- a/include/sound/timer.h
+++ b/include/sound/timer.h
@@ -129,7 +129,6 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam
129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); 129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer);
130int snd_timer_global_free(struct snd_timer *timer); 130int snd_timer_global_free(struct snd_timer *timer);
131int snd_timer_global_register(struct snd_timer *timer); 131int snd_timer_global_register(struct snd_timer *timer);
132int snd_timer_global_unregister(struct snd_timer *timer);
133 132
134int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); 133int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id);
135int snd_timer_close(struct snd_timer_instance *timeri); 134int snd_timer_close(struct snd_timer_instance *timeri);
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
new file mode 100644
index 0000000000..d93a96b918
--- /dev/null
+++ b/include/sound/tlv.h
@@ -0,0 +1,60 @@
1#ifndef __SOUND_TLV_H
2#define __SOUND_TLV_H
3
4/*
5 * Advanced Linux Sound Architecture - ALSA - Driver
6 * Copyright (c) 2006 by Jaroslav Kysela <perex@suse.cz>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25/*
26 * TLV structure is right behind the struct snd_ctl_tlv:
27 * unsigned int type - see SNDRV_CTL_TLVT_*
28 * unsigned int length
29 * .... data aligned to sizeof(unsigned int), use
30 * block_length = (length + (sizeof(unsigned int) - 1)) &
31 * ~(sizeof(unsigned int) - 1)) ....
32 */
33
34#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
36#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
37#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
38
39#define TLV_DB_SCALE_ITEM(min, step, mute) \
40 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
41 (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0)
42#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
43 unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) }
44
45/* linear volume between min_dB and max_dB (.01dB unit) */
46#define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \
47 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \
48 (min_dB), (max_dB)
49#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \
50 unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) }
51
52/* dB range container */
53/* Each item is: <min> <max> <TLV> */
54/* The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR */
55#define TLV_DB_RANGE_HEAD(num) \
56 SNDRV_CTL_TLVT_DB_RANGE, 6 * (num) * sizeof(unsigned int)
57
58#define TLV_DB_GAIN_MUTE -9999999
59
60#endif /* __SOUND_TLV_H */
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 9821a6194c..dbca141706 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -128,6 +128,7 @@ struct snd_vx_hardware {
128 unsigned int num_ins; 128 unsigned int num_ins;
129 unsigned int num_outs; 129 unsigned int num_outs;
130 unsigned int output_level_max; 130 unsigned int output_level_max;
131 unsigned int *output_level_db_scale;
131}; 132};
132 133
133/* hwdep id string */ 134/* hwdep id string */
diff --git a/include/video/Kbuild b/include/video/Kbuild
new file mode 100644
index 0000000000..a14f9c045b
--- /dev/null
+++ b/include/video/Kbuild
@@ -0,0 +1 @@
unifdef-y += sisfb.h
diff --git a/include/video/mbxfb.h b/include/video/mbxfb.h
new file mode 100644
index 0000000000..3bde0f5cd5
--- /dev/null
+++ b/include/video/mbxfb.h
@@ -0,0 +1,28 @@
1#ifndef __MBX_FB_H
2#define __MBX_FB_H
3
4struct mbxfb_val {
5 unsigned int defval;
6 unsigned int min;
7 unsigned int max;
8};
9
10struct fb_info;
11
12struct mbxfb_platform_data {
13 /* Screen info */
14 struct mbxfb_val xres;
15 struct mbxfb_val yres;
16 struct mbxfb_val bpp;
17
18 /* Memory info */
19 unsigned long memsize; /* if 0 use ODFB? */
20 unsigned long timings1;
21 unsigned long timings2;
22 unsigned long timings3;
23
24 int (*probe)(struct fb_info *fb);
25 int (*remove)(struct fb_info *fb);
26};
27
28#endif /* __MBX_FB_H */